Improves balance sheet, starts moving it to new layout
This commit is contained in:
@@ -130,6 +130,7 @@
|
||||
"No results found"]]]]])
|
||||
|
||||
(defn multi-typeahead- [params]
|
||||
(println "VALUE IS" (:value params))
|
||||
[:div.relative {:x-data (hx/json {:open false
|
||||
:baseUrl (if (str/includes? (:url params) "?")
|
||||
(str (:url params) "&q=")
|
||||
@@ -163,7 +164,7 @@
|
||||
(dissoc :class :value-fn :content-fn :placeholder :x-model)
|
||||
(assoc
|
||||
:type "hidden"
|
||||
"x-bind:value" "v"
|
||||
"x-bind:value" "v.value"
|
||||
))]]
|
||||
[:div.flex.w-full.justify-items-stretch
|
||||
[:span.flex-grow.text-left [:span {"x-text" "value.length"} ]
|
||||
@@ -204,7 +205,7 @@
|
||||
"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.stop" "if ($data.elements[active]) { value.push($data.elements[active].value) }"
|
||||
"@keydown.enter.prevent.stop" "if ($data.elements[active]) { value.push($data.elements[active]) }"
|
||||
"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 {:class "rounded-b-lg overflow-hidden"}
|
||||
[:template {:x-for "(element, index) in elements"}
|
||||
@@ -214,7 +215,7 @@
|
||||
":class" "active == index ? 'active' : ''"
|
||||
"@mouseover" "active = index"
|
||||
"@mouseout" "active = -1"
|
||||
"@click.prevent" "value.push(element.value);"
|
||||
"@click.prevent" "value.push({value: element.value, label: element.label});"
|
||||
}
|
||||
[ :input {:type "checkbox" ":checked" "value.includes(element.value)"} ]
|
||||
[:span {"x-html" "element.label"}]]]]
|
||||
@@ -329,6 +330,13 @@
|
||||
rest
|
||||
(errors- {:errors (:errors params)})))
|
||||
|
||||
(defn validated-inline-field- [params & rest]
|
||||
(inline-field- (cond-> params
|
||||
true (dissoc :errors)
|
||||
(sequential? (:errors params)) (update :class #(hh/add-class (or % "") "has-error")))
|
||||
rest
|
||||
(errors- {:errors (:errors params)})))
|
||||
|
||||
(defn hidden- [{:keys [name value] :as params}]
|
||||
[:input (merge {:type "hidden" :value value :name name} params)])
|
||||
|
||||
@@ -340,3 +348,9 @@
|
||||
rest]]
|
||||
[:input (merge params {:type "checkbox" :class (hh/add-class default-checkbox-classes (:class params ""))})
|
||||
]))
|
||||
|
||||
(defn toggle- [params & children]
|
||||
[:label {:class "inline-flex items-center cursor-pointer"}
|
||||
[:input (merge {:type "checkbox", :class "sr-only peer"} params)]
|
||||
[:div {:class "relative w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"}]
|
||||
[:span {:class "ms-3 text-sm font-medium text-gray-900 dark:text-gray-300"} children]])
|
||||
Reference in New Issue
Block a user