Fix regression on configure page with properties

Was unable to add multiple page or schema properties. Caused by move to
select component which exited page modal by default
This commit is contained in:
Gabriel Horner
2023-08-04 14:11:25 -04:00
parent 11991a0919
commit 023a47562d
2 changed files with 24 additions and 11 deletions

View File

@@ -31,7 +31,15 @@
[:div.tip.flex
[:code.opacity-20.bg-transparent (:id result)]])]))
(rum/defcs select < rum/reactive
(rum/defcs select
"Provides a select dropdown powered by a fuzzy search. Takes the following options:
* :items - Vec of things to select from. Assumes a vec of maps with :value key by default. Required option
* :limit - Limit number of items to search. Default is 100
* :extract-fn - Fn applied to each item when extracting a value from it. Default is :value
* :show-new-when-not-exact-match? - Boolean to allow new values be entered. Default is false
* :sub-modal? - Boolean to indicate if in a sub-modal. Useful for closing behavior
TODO: Describe more options"
< rum/reactive
shortcut/disable-all-shortcuts
(rum/local "" ::input)
{:init (fn [state]
@@ -48,7 +56,8 @@
extract-fn host-opts on-input input-opts
item-cp transform-fn tap-*input-val
multiple-choices? on-apply _selected-choices
dropdown? show-new-when-not-exact-match? exact-match-exclude-items]
dropdown? show-new-when-not-exact-match? exact-match-exclude-items
sub-modal?]
:or {limit 100
prompt-key :select/default-prompt
empty-placeholder (fn [_t] [:div])
@@ -96,7 +105,8 @@
(swap! *selected-choices disj x)
(swap! *selected-choices conj x))
(do
(when close-modal? (state/close-modal!))
(when close-modal?
(if sub-modal? (state/close-sub-modal!) (state/close-modal!)))
(when on-chosen
(on-chosen (if multiple-choices? @*selected-choices x))))))
:empty-placeholder (empty-placeholder t)})]