This commit is contained in:
2024-11-04 21:43:41 -08:00
parent 61f043ddae
commit 966deb232a
3 changed files with 18 additions and 15 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,15 +1,16 @@
(ns auto-ap.ssr.components.data-grid
(:require
[auto-ap.logging :as alog]
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.components.card :refer [content-card-]]
[auto-ap.ssr.components.paginator :refer [paginator-]]
[auto-ap.ssr.components.buttons :refer [a-button-]]
[bidi.bidi :as bidi]
[hiccup2.core :as hiccup]
[auto-ap.ssr.hx :as hx]
[auto-ap.ssr.components.card :refer [content-card-]]
[auto-ap.ssr.components.inputs :as inputs]
[auto-ap.ssr.components.paginator :refer [paginator-]]
[auto-ap.ssr.hiccup-helper :as hh]
[hiccup.util :as hu]))
[auto-ap.ssr.hx :as hx]
[bidi.bidi :as bidi]
[hiccup.util :as hu]
[hiccup2.core :as hiccup]))
(defn header- [params & rest]
(into [:th.px-4.py-3 {:scope "col" :class (:class params)
@@ -26,10 +27,13 @@
(defn row- [params & rest]
(into [:tr (update params
:class str " border-b dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700")] rest))
:class str " border-b dark:border-gray-600 group hover:bg-gray-100 dark:hover:bg-gray-700")] rest))
(defn cell- [params & rest]
(into [:td.px-4.py-2 params ] rest))
(into [:td.px-4.py-2 (update params
:class #(str (-> "first:border-l-4 first:box-content first:group-[.live-added]:border-green-500 "
(hh/add-class (or % ""))))) ]
rest))
(defn right-stack-cell- [params & rest]
(cell- params (into [:div.flex.flex-row-reverse.items-center.justify-between

View File

@@ -56,12 +56,11 @@
[:input {:type :hidden :name "id" :value ((:id-fn gridspec) entity)}]]
((:row-buttons gridspec) request entity))))] ;; TODO double check usage of row buttons user and identity in callers
(apply com/data-grid-row
{:class (cond-> (or class "")
flash? (hh/add-class "live-added"))
"_" (hiccup/raw (when delete-after-settle?
" on htmx:afterSettle wait 400ms then remove me"))
:data-id ((:id-fn gridspec) entity)}
(cond-> {:class (cond-> (or class "")
flash? (hh/add-class "live-added group"))
:data-id ((:id-fn gridspec) entity)}
delete-after-settle?
(assoc "@htmx:after-settle.camel" "setTimeout(() => $el.remove(), 400)"))
cells)))
(defn sort-icon [sort key]