mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 15:46:10 +02:00
🐛 Fix problem with changing cell type in grid
This commit is contained in:
parent
f4d513b622
commit
337f52e1bf
2 changed files with 9 additions and 5 deletions
|
@ -59,7 +59,7 @@
|
|||
|
||||
(mf/defc radio-buttons
|
||||
{::mf/props :obj}
|
||||
[{:keys [children on-change selected class wide encode-fn decode-fn] :as props}]
|
||||
[{:keys [children on-change selected class wide encode-fn decode-fn allow-empty] :as props}]
|
||||
(let [encode-fn (d/nilv encode-fn identity)
|
||||
decode-fn (d/nilv decode-fn identity)
|
||||
nitems (if (array? children)
|
||||
|
@ -75,14 +75,17 @@
|
|||
|
||||
on-change'
|
||||
(mf/use-fn
|
||||
(mf/deps on-change)
|
||||
(mf/deps selected on-change)
|
||||
(fn [event]
|
||||
(let [input (dom/get-target event)
|
||||
value (dom/get-target-val event)
|
||||
value (when (not= value selected) value)]
|
||||
|
||||
;; Only allow null values when the "allow-empty" prop is true
|
||||
value (when (or (not allow-empty)
|
||||
(not= value selected)) value)]
|
||||
(when (fn? on-change)
|
||||
(on-change (decode-fn value) event)
|
||||
(dom/blur! input)))))
|
||||
(on-change (decode-fn value) event))
|
||||
(dom/blur! input))))
|
||||
|
||||
context-value
|
||||
(mf/spread-obj props {:on-change on-change'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue