percentage-based splitting.

This commit is contained in:
Bryce Covert
2019-04-23 07:09:21 -07:00
parent 81a13bf2e0
commit 9f30c74619
6 changed files with 158 additions and 56 deletions

View File

@@ -156,6 +156,23 @@
(into [dom keys] (with-keys rest))))
(defmethod do-bind "number" [dom {:keys [field precision event subscription class spec] :as keys :or {precision 2}} & rest]
(let [field (if (keyword? field) [field] field)
event (if (keyword? event) [event] event)
keys (assoc keys
:on-change (fn [e]
(.preventDefault e)
(re-frame/dispatch (-> event
(conj field)
(conj (js/parseFloat (.. e -target -value))))))
:value (get-in subscription field)
:class (str class
(when (and spec (not (s/valid? spec (get-in subscription field))))
" is-danger")))
keys (dissoc keys :field :subscription :event :spec)]
(into [dom keys] (with-keys rest))))
(defmethod do-bind :default [dom {:keys [field event subscription class spec] :as keys} & rest]
(let [field (if (keyword? field) [field] field)
event (if (keyword? event) [event] event)