Explorar el Código

fix value support.

Lucas Stadler %!s(int64=12) %!d(string=hace) años
padre
commit
bf4d539b03
Se han modificado 1 ficheros con 11 adiciones y 10 borrados
  1. 11 10
      clj/clarity/cljs/clarity.cljs

+ 11 - 10
clj/clarity/cljs/clarity.cljs

@ -104,16 +104,17 @@
104 104
                    :value val
105 105
                    :onChange (update-on-change! m key identity optional?)})))
106 106
107
(defmethod make-typed-input 'Value [value owner]
108
  (om/component
109
   (dom/input (clj->js
110
                (into {:value (str value)
111
                       :readOnly "readOnly"}
112
                  (cond
113
                    (instance? js/Boolean value) {:type "checkbox", :checked value}
114
                    (number? value) {:type "number"}
115
                    (keyword? value) {:type "text", :pattern keyword-pattern}
116
                    :else {:type "text"}))))))
107
(defmethod make-typed-input 'Value [m owner {type :type}]
108
  (let [[_ value] type]
109
    (om/component
110
      (dom/input (clj->js
111
                   (into {:value (str value)
112
                          :readOnly "readOnly"}
113
                         (cond
114
                           (instance? js/Boolean value) {:type "checkbox", :checked value}
115
                           (number? value) {:type "number"}
116
                           (keyword? value) {:type "text", :pattern keyword-pattern}
117
                           :else {:type "text"})))))))
117 118
118 119
(defmethod make-typed-input 'Option [m owner {type :type :as opts}]
119 120
  (let [[_ type] type]