Make the multi-input more generic

This commit is contained in:
Andrey Antukh 2022-03-03 14:18:56 +01:00
parent a1c3789ec2
commit cfe657d853
6 changed files with 173 additions and 148 deletions

View file

@ -121,6 +121,13 @@
(assoc-in [:data field] (if trim? (str/trim value) value))
(update :errors dissoc field))))))
(defn update-input-value!
[form field value]
(swap! form (fn [state]
(-> state
(assoc-in [:data field] value)
(update :errors dissoc field)))))
(defn on-input-blur
[form field]
(fn [_]

View file

@ -36,6 +36,7 @@
(def ctrlKey? (or (is-key? "Control")
(is-key? "Meta")))
(def comma? (is-key? ","))
(def backspace? (is-key? "Backspace"))
(defn editing? [e]
(.-editing ^js e))