does not change now.
This commit is contained in:
@@ -424,7 +424,7 @@
|
||||
[:fieldset {:class "hx-disable" :hx-disinherit "hx-target"}
|
||||
|
||||
(fc/start-form entity form-errors
|
||||
[:div.space-y-2
|
||||
[:div.space-y-1
|
||||
(when-let [id (:db/id entity)]
|
||||
(com/hidden {:name "db/id"
|
||||
:value id}))
|
||||
@@ -551,8 +551,9 @@
|
||||
:name (fc/field-name)
|
||||
:orientation :horizontal})))
|
||||
|
||||
[:div#form-errors [:span.error-content
|
||||
(com/errors {:errors (:errors fc/*form-errors*)})]]
|
||||
[:div#form-errors (when (:errors fc/*form-errors*)
|
||||
[:span.error-content
|
||||
(com/errors {:errors (:errors fc/*form-errors*)})])]
|
||||
(com/button {:color :primary :form "edit-form" :type "submit" :class "w-32"}
|
||||
"Save")])]]
|
||||
[:div])))
|
||||
@@ -611,7 +612,7 @@
|
||||
(html-response (dialog* :entity entity
|
||||
:form-params {:hx-put (str (bidi/path-for ssr-routes/only-routes
|
||||
:admin-transaction-rule-edit-save))})
|
||||
:headers {"hx-trigger" "modalopen"})))
|
||||
:headers {"hx-trigger-after-settle" "modalopen"})))
|
||||
|
||||
(defn transaction-rule-error [request]
|
||||
(let [entity (some-> request :last-form)]
|
||||
@@ -631,7 +632,7 @@
|
||||
:form-errors {}
|
||||
:form-params {:hx-post (str (bidi/path-for ssr-routes/only-routes
|
||||
:admin-transaction-rule-edit-save))})
|
||||
:headers {"hx-trigger" "modalopen"}))
|
||||
:headers {"hx-trigger-after-settle" "modalopen"}))
|
||||
|
||||
(def transaction-rule-schema (mc/schema
|
||||
[:map
|
||||
|
||||
@@ -81,12 +81,14 @@ c.clearChoices();
|
||||
:elements (if (:value params)
|
||||
[{:value ((:value-fn params first) (:value params)) :label ((:content-fn params second) (:value params))}]
|
||||
[])})}
|
||||
[:a {:class (-> (hh/add-class (or (:class params) "") default-input-classes)
|
||||
(hh/add-class "cursor-pointer"))
|
||||
"@click.prevent.stop" "open = !open;"
|
||||
[:a {:class (-> (hh/add-class (or (:class params) "") default-input-classes)
|
||||
(hh/add-class "cursor-pointer"))
|
||||
"@click.prevent" "open = !open;"
|
||||
"@keydown.enter.prevent.stop" "open = !open;"
|
||||
:tabindex 0
|
||||
:x-init (:x-init params)}
|
||||
"@keydown.down.prevent.stop" "open = true;"
|
||||
"@keydown.backspace" "value = {value: '', label: '' }"
|
||||
:tabindex 0
|
||||
:x-init (:x-init params)}
|
||||
[:input (-> params
|
||||
(dissoc :class)
|
||||
(dissoc :value-fn)
|
||||
@@ -94,42 +96,43 @@ c.clearChoices();
|
||||
|
||||
(dissoc :placeholder)
|
||||
(assoc
|
||||
"x-ref" "hidden"
|
||||
:type "hidden"
|
||||
":value" "value.value"
|
||||
:x-init (hiccup/raw (str "$watch('value', v => $dispatch('change')); "))))]
|
||||
"x-ref" "hidden"
|
||||
:type "hidden"
|
||||
":value" "value.value"
|
||||
:x-init (hiccup/raw (str "$watch('value', v => $dispatch('change')); "))))]
|
||||
[:div.flex.w-full.justify-items-stretch
|
||||
[:span.flex-grow.text-left {"x-text" "value.label"}]
|
||||
[:div {:class "w-5 h-5 inline ml-1 justify-self-end"}
|
||||
[:div {:class "w-3 h-3 m-1 inline ml-1 justify-self-end text-gray-500 self-center"}
|
||||
svg/drop-down]]]
|
||||
|
||||
[:ul.dropdown-contents {:class "absolute bg-gray-50 dark:bg-gray-600 rounded-lg shadow-lg py-1 w-max z-10 mt-1"
|
||||
"@keydown.escape.window" "open = false"
|
||||
"x-transition:enter" "ease-[cubic-bezier(.3,2.3,.6,1)] duration-200"
|
||||
|
||||
[:ul.dropdown-contents {:class "absolute bg-gray-50 dark:bg-gray-600 rounded-lg shadow-lg py-1 w-max z-10 mt-1"
|
||||
"@keydown.escape" "open = false; value = {value: '', label: '' }"
|
||||
"x-transition:enter" "ease-[cubic-bezier(.3,2.3,.6,1)] duration-200"
|
||||
"x-transition:enter-start" "!opacity-0 !mt-0"
|
||||
"x-transition:enter-end" "!opacity-1 !mt-1"
|
||||
"x-transition:leave" "ease-out duration-200"
|
||||
"x-transition:enter-end" "!opacity-1 !mt-1"
|
||||
"x-transition:leave" "ease-out duration-200"
|
||||
"x-transition:leave-start" "!opacity-1 !mt-1"
|
||||
"x-transition:leave-end" "!opacity-0 !mt-0"
|
||||
"x-show " "open"
|
||||
"x-trap" "open"
|
||||
"@click.outside" "open=false; console.log('is this ihid')"}
|
||||
[:input {:type "text" :class (hh/add-class (or (:class params) "") default-input-classes)
|
||||
"x-model" "search"
|
||||
"placeholder" (:placeholder params)
|
||||
"@keydown.down.prevent" "active ++; active = active >= elements.length - 1 ? elements.length - 1 : active"
|
||||
"@keydown.up.prevent" "active --; active = active < 0 ? 0 : active"
|
||||
"x-transition:leave-end" "!opacity-0 !mt-0"
|
||||
"x-show " "open"
|
||||
"x-trap" "open"
|
||||
"@click.outside" "open=false; console.log('is this ihid')"}
|
||||
[:input {:type "text" :class (hh/add-class (or (:class params) "") default-input-classes)
|
||||
"x-model" "search"
|
||||
"placeholder" (:placeholder params)
|
||||
"@keydown.down.prevent" "active ++; active = active >= elements.length - 1 ? elements.length - 1 : active"
|
||||
"@keydown.up.prevent" "active --; active = active < 0 ? 0 : active"
|
||||
"@keydown.enter.prevent" "open = false; value = elements.length > 0 ? $data.elements[active] : {'value': '', label: ''}; console.log('are we here')"
|
||||
"x-init" "$watch('search', s => { if($el.value.length > 2) {fetch(baseUrl + s).then(data=>data.json()).then(data => {elements = data; active=-1}) }})"}]
|
||||
"x-init" "$watch('search', s => { if($el.value.length > 2) {fetch(baseUrl + s).then(data=>data.json()).then(data => {elements = data; active=-1}) }})"}]
|
||||
[:div.dropdown-options
|
||||
[:template {:x-for "(element, index) in elements"}
|
||||
[:li [:a {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-300 [&.active]:dark:bg-primary-700 text-gray-800 dark:text-gray-100"
|
||||
:href "#"
|
||||
":class" "active == index ? 'active' : ''"
|
||||
"@mouseover" "active = index"
|
||||
"@mouseout" "active = -1"
|
||||
[:li [:a {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-300 [&.active]:dark:bg-primary-700 text-gray-800 dark:text-gray-100"
|
||||
:href "#"
|
||||
":class" "active == index ? 'active' : ''"
|
||||
"@mouseover" "active = index"
|
||||
"@mouseout" "active = -1"
|
||||
"@click.prevent" "value = element; open=false; "
|
||||
"x-html" "element.label"}]]]
|
||||
"x-html" "element.label"}]]]
|
||||
[:template {:x-if "elements.length == 0"}
|
||||
[:li {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-500 text-gray-800 dark:text-gray-100 text-xs "}
|
||||
"No results found"]]]]])
|
||||
|
||||
@@ -78,8 +78,9 @@ input[type=number] {
|
||||
"x-transition:leave-end" "!bg-opacity-0"}
|
||||
|
||||
[:div.flex.place-items-center.place-content-center.w-full.h-full.p-12
|
||||
[:div {:class (str "w-full sm:max-w-4xl sm:rounded-lg overflow-scroll max-h-full sm:max-h-[80vh]")
|
||||
[:div {:class (str "w-full sm:max-w-4xl sm:rounded-lg overflow-scroll max-h-full sm:max-h-[90vh]")
|
||||
"@click.outside" "open=false"
|
||||
"x-trap.inert.noscroll" "open"
|
||||
"x-trap.inert" "open"
|
||||
"x-show" "open"
|
||||
"x-transition:enter" "ease-out duration-300"
|
||||
|
||||
Reference in New Issue
Block a user