locations.

This commit is contained in:
Bryce Covert
2019-04-14 22:08:36 -07:00
parent c44a36c815
commit b05b2244a0
13 changed files with 170 additions and 67 deletions

View File

@@ -81,7 +81,7 @@
(defn with-keys [children]
(map-indexed (fn [i c] ^{:key i} c) children))
(defmethod do-bind "select" [dom {:keys [field subscription event class value spec] :as keys} & rest]
(defmethod do-bind "select" [dom {:keys [field allow-nil? subscription event class value spec] :as keys} & rest]
(let [field (if (keyword? field) [field] field)
event (if (keyword? event) [event] event)
keys (assoc keys
@@ -91,8 +91,11 @@
: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))))
keys (dissoc keys :field :subscription :event :spec)
options (if allow-nil?
(with-keys (conj rest [:option {:value nil}]))
(with-keys rest))]
(into [dom keys] options)))
(defmethod do-bind "radio" [dom {:keys [field subscription event class value spec] :as keys} & rest]