Better experience for adding new journal entry
This commit is contained in:
@@ -135,20 +135,21 @@
|
||||
(defn new-row- [{:keys [index colspan tr-params row-offset] :as params} & content]
|
||||
(row-
|
||||
(merge {:class "new-row"
|
||||
"x-on:htmx:after-settle.camel" "let options=$el.parentNode.querySelectorAll('tr'); let target=options[options.length-2]; $nextTick(() => $focus.within(target).first())"
|
||||
|
||||
:x-data (hx/json {:newRowIndex index
|
||||
:offset (or row-offset 0)})
|
||||
}
|
||||
:offset (or row-offset 0)}) }
|
||||
tr-params)
|
||||
(cell- {:colspan colspan
|
||||
:class "bg-gray-100"}
|
||||
[:div.flex.justify-center
|
||||
(a-button- (merge
|
||||
(dissoc params :index :colspan)
|
||||
{
|
||||
"@click.prevent" "$dispatch('newRow', {index: (newRowIndex++)})"
|
||||
:color :secondary
|
||||
:hx-trigger "newRow"
|
||||
:hx-vals (hiccup/raw "js:{index: event.detail.index }")
|
||||
:hx-target "closest .new-row"
|
||||
:hx-swap "beforebegin"})
|
||||
(dissoc params :index :colspan)
|
||||
{"@click.prevent" "$dispatch('newRow', {index: (newRowIndex++)})"
|
||||
:color :secondary
|
||||
:hx-trigger "newRow"
|
||||
:hx-vals (hiccup/raw "js:{index: event.detail.index }")
|
||||
:hx-target "closest .new-row"
|
||||
:hx-swap "beforebegin"
|
||||
})
|
||||
content)])))
|
||||
|
||||
Reference in New Issue
Block a user