Replace enum type with available choices (#10438)

* Add type schema for enum values

* Refactor: closed values instead of enum to limit values

There's no need to add the enum type, we just want to limit the
values.

* feat: :page type supports closed values

* fix: can't set property values for text/number types

* fix: don't trigger on-chosen when unmounting any select component

* fix: can't apply both page classes limitation and closed values

* fix: merge conflicts

* fix: ui not refresh when changing closed value

* fix: can't set icon for closed value
This commit is contained in:
Tienson Qin
2023-11-14 18:48:34 +08:00
committed by GitHub
parent ade1af5874
commit 6a47648c6c
14 changed files with 538 additions and 447 deletions

View File

@@ -54,9 +54,6 @@
(atom (set (:selected-choices (first (:rum/args state)))))))
:will-unmount (fn [state]
(state/set-state! [:ui/open-select] nil)
(let [{:keys [multiple-choices? on-chosen]} (first (:rum/args state))]
(when (and multiple-choices? on-chosen)
(on-chosen @(::selected-choices state))))
state)}
[state {:keys [items limit on-chosen empty-placeholder
prompt-key input-default-placeholder close-modal?