in progreess date fixes.
This commit is contained in:
@@ -395,14 +395,28 @@
|
|||||||
:max outstanding-balance
|
:max outstanding-balance
|
||||||
:step "0.01"}]]]]]])]]])))
|
:step "0.01"}]]]]]])]]])))
|
||||||
|
|
||||||
|
#_(defn date-picker []
|
||||||
|
(let [cal (r/atom nil)]
|
||||||
|
(r/create-class
|
||||||
|
{:component-did-mount (fn [this]
|
||||||
|
|
||||||
|
(reset! cal (new bc (r/dom-node this) (clj->js {:overlay false :dateFormat "mm/dd/yyyy"} )))
|
||||||
|
nil)
|
||||||
|
|
||||||
|
:component-will-unmount (fn [this]
|
||||||
|
(.hide @cal)
|
||||||
|
nil)
|
||||||
|
:reagent-render (fn [props]
|
||||||
|
[:input ])})))
|
||||||
(defn my-date [props]
|
(defn my-date [props]
|
||||||
(let [cal (r/atom nil)]
|
(let [cal (r/atom nil)]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-did-mount (fn [this]
|
{:component-did-mount (fn [this]
|
||||||
(reset! cal (new bc (r/dom-node this) (clj->js {:overlay false :dateFormat "mm/dd/yyyy"} )))
|
(reset! cal (new bc (r/dom-node this) (clj->js {:overlay false :dateFormat "yyyy-mm-dd"} )))
|
||||||
|
|
||||||
nil)
|
nil)
|
||||||
:reagent-render (fn [props]
|
:reagent-render (fn [props]
|
||||||
[:input.input (merge props {:on-blur (fn [] (js/setTimeout 100 #(.hide @cal)) )}) ])})))
|
[:input.input (merge props {:on-blur (fn [] (js/setTimeout 100 #(.hide @cal)) )}) ])})))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -432,7 +446,7 @@
|
|||||||
|
|
||||||
|
|
||||||
[bind-field
|
[bind-field
|
||||||
[my-date {:type "text"
|
[my-date {:type "date"
|
||||||
:field [:date]
|
:field [:date]
|
||||||
:event change-event
|
:event change-event
|
||||||
:spec ::invoice/date
|
:spec ::invoice/date
|
||||||
|
|||||||
@@ -83,6 +83,18 @@
|
|||||||
keys (dissoc keys :field :subscription :event :spec)]
|
keys (dissoc keys :field :subscription :event :spec)]
|
||||||
(into [dom keys] (with-keys rest))))
|
(into [dom keys] (with-keys rest))))
|
||||||
|
|
||||||
|
(defmethod do-bind "date" [dom {:keys [field event subscription class spec] :as keys} & rest]
|
||||||
|
(let [field (if (keyword? field) [field] field)
|
||||||
|
event (if (keyword? event) [event] event)
|
||||||
|
keys (assoc keys
|
||||||
|
:on-change (dispatch-value-change (conj event field))
|
||||||
|
:value (doto (get-in subscription field) println)
|
||||||
|
: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]
|
(defmethod do-bind :default [dom {:keys [field event subscription class spec] :as keys} & rest]
|
||||||
(let [field (if (keyword? field) [field] field)
|
(let [field (if (keyword? field) [field] field)
|
||||||
event (if (keyword? event) [event] event)
|
event (if (keyword? event) [event] event)
|
||||||
|
|||||||
Reference in New Issue
Block a user