From 238d323fe0f1a7490d214c089f4a70e4d5fd0cb0 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 13:10:32 -0300 Subject: [PATCH 01/23] Fix negative months bug --- src/om_widgets/datepicker.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/om_widgets/datepicker.cljs b/src/om_widgets/datepicker.cljs index 19e3cc1..31388e4 100644 --- a/src/om_widgets/datepicker.cljs +++ b/src/om_widgets/datepicker.cljs @@ -16,7 +16,7 @@ last-day (time/number-of-days-in-the-month previous-month) days-to-fill (range (inc (- last-day (dec weekday-current-month))) (inc last-day))] (mapv (fn [d] {:day d - :month (- 1 (time/month date)) + :month (if (= (time/month date) 1) 12 (dec (time/month date))) :year (time/year date) :belongs-to-month :previous}) days-to-fill))) From 50f14af07baf72c77f02a139b9084dd53e127ea8 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 13:11:47 -0300 Subject: [PATCH 02/23] Add week-start component option --- src/om_widgets/datepicker.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/om_widgets/datepicker.cljs b/src/om_widgets/datepicker.cljs index 31388e4..71a6f59 100644 --- a/src/om_widgets/datepicker.cljs +++ b/src/om_widgets/datepicker.cljs @@ -239,11 +239,12 @@ note: we assume today date if the cursor does not have a date " - [app path {:keys [id hidden onChange] :or {hidden true}}] + [app path {:keys [id hidden onChange week-start] :or {hidden true week-start :monday}}] (om/build body-component app {:state {:id id :hidden hidden :date (if (instance? js/Date (utils/om-get app [path])) (time/date-time (utils/om-get app [path])) (time/now)) + :week-start week-start :path path :onChange onChange}})) From b683844daaf9979a7dc03213c7da1d95255b71fb Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 13:14:32 -0300 Subject: [PATCH 03/23] Pass argument to child components and sort days based on value --- src/om_widgets/datepicker.cljs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/om_widgets/datepicker.cljs b/src/om_widgets/datepicker.cljs index 71a6f59..f83b55a 100644 --- a/src/om_widgets/datepicker.cljs +++ b/src/om_widgets/datepicker.cljs @@ -202,7 +202,7 @@ om/IDisplayName (display-name [_] "DatepickerBody") om/IRenderState - (render-state [this {:keys [path date onChange] :as state}] + (render-state [this {:keys [path date onChange week-start] :as state}] (dom/div #js {:className "datepicker datepicker-days" :style #js {:display "block"}} (dom/table #js {:className "table-condensed"} (dom/thead nil @@ -223,10 +223,12 @@ :onClick (fn [e] (om/set-state! owner :date (time/plus date (time/months 1))))} ">")) (apply dom/tr nil - (om/build-all day-header days-short))) + (om/build-all day-header (case week-start + :monday days-short + :sunday (concat [(last days-short)] (butlast days-short)))))) ;; datepicker body - (om/build weeks-component app {:state {:path path :date date :onChange onChange}})))))) + (om/build weeks-component app {:state {:path path :date date :onChange onChange :week-start week-start}})))))) (defn datepicker "Datepicker public API From 01644827a77b234f99ddb079582a586eca17fe89 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 13:20:23 -0300 Subject: [PATCH 04/23] Pass argument to weeks-component and fix days-to-fill logic --- src/om_widgets/datepicker.cljs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/om_widgets/datepicker.cljs b/src/om_widgets/datepicker.cljs index f83b55a..f7f50ef 100644 --- a/src/om_widgets/datepicker.cljs +++ b/src/om_widgets/datepicker.cljs @@ -9,12 +9,18 @@ ;; TODO translate (defonce days-short ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]) -(defn- build-previous-month-days [date] - (let [current-month (time/date-time (time/year date) (time/month date)) - weekday-current-month (time/day-of-week current-month) - previous-month (time/minus current-month (time/months 1)) +(defn- build-previous-month-days [date week-start] + (let [current_month (time/month date) + first-day-of-month (time/date-time (time/year date) current_month) + weekday-current-month (time/day-of-week first-day-of-month) + previous-month (time/minus first-day-of-month (time/months 1)) last-day (time/number-of-days-in-the-month previous-month) - days-to-fill (range (inc (- last-day (dec weekday-current-month))) (inc last-day))] + days-to-fill (range (inc + (- last-day + (case week-start + :monday (dec weekday-current-month) + :sunday weekday-current-month))) + (inc last-day))] (mapv (fn [d] {:day d :month (if (= (time/month date) 1) 12 (dec (time/month date))) :year (time/year date) @@ -55,8 +61,8 @@ [...] [{:day 1 :month 3 :year 2014 :belongs-to-month :next}] ] " - [date] - (let [previous-days (build-previous-month-days date) + [date week-start] + (let [previous-days (build-previous-month-days date week-start) currrent-days (build-current-month-days date) next-days (build-next-month-days date) days (into [] (concat previous-days currrent-days next-days))] @@ -167,13 +173,13 @@ om/IDisplayName (display-name [_] "DatepickerWeeks") om/IRenderState - (render-state [this {:keys [date path onChange] :as state}] + (render-state [this {:keys [date path onChange week-start] :as state}] (apply dom/tbody nil (map (fn [week] (apply dom/tr nil (map (fn [d] (om/build day-component app {:state {:day d :path path :date date :onChange onChange}})) week))) - (build-weeks date)))))) + (build-weeks date week-start)))))) (defn- year-component [app owner] (reify From 4e14d2721c6e9ce8ab2cf56a2c652f8d771302a3 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 13:21:15 -0300 Subject: [PATCH 05/23] Refactor current-month --- src/om_widgets/datepicker.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/om_widgets/datepicker.cljs b/src/om_widgets/datepicker.cljs index f7f50ef..de4fda6 100644 --- a/src/om_widgets/datepicker.cljs +++ b/src/om_widgets/datepicker.cljs @@ -22,7 +22,7 @@ :sunday weekday-current-month))) (inc last-day))] (mapv (fn [d] {:day d - :month (if (= (time/month date) 1) 12 (dec (time/month date))) + :month (if (= current_month 1) 12 (dec current_month)) :year (time/year date) :belongs-to-month :previous}) days-to-fill))) From d725ddc88ca7896d451a663e3096c7ba76b5c1ae Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 13:50:55 -0300 Subject: [PATCH 06/23] Add datepicker dosctring --- src/om_widgets/datepicker.cljs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/om_widgets/datepicker.cljs b/src/om_widgets/datepicker.cljs index de4fda6..f1f322e 100644 --- a/src/om_widgets/datepicker.cljs +++ b/src/om_widgets/datepicker.cljs @@ -245,6 +245,9 @@ app >> the cursor path >> the internal path to update the cursor + opts: + - week-start: defines whether the week starts on Monday or Sunday. Dafults to Monday + note: we assume today date if the cursor does not have a date " [app path {:keys [id hidden onChange week-start] :or {hidden true week-start :monday}}] From 103a110b5d12bf3755ba7308b9a645484620843c Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 13:58:41 -0300 Subject: [PATCH 07/23] Add datepicker example --- src/examples/basic/datepicker_example.cljs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/examples/basic/datepicker_example.cljs b/src/examples/basic/datepicker_example.cljs index e7aa12f..fd23eb7 100644 --- a/src/examples/basic/datepicker_example.cljs +++ b/src/examples/basic/datepicker_example.cljs @@ -62,7 +62,14 @@ {:for "btn-cal-close-on-select"})]] [:div.col-lg-6 - [:div.well - (w/datepicker app :inline) - ] - [:label (str (:inline app))]]]]])))) \ No newline at end of file + [:div + [:span "Week starting on Monday"] + [:div.well + (w/datepicker app :inline)] + [:label (str (:inline app))]] + [:hr] + [:div + [:span "Week starting on Sunday"] + [:div.well + (w/datepicker app :inline {:week-start :sunday})] + [:label (str (:inline app))]]]]]])))) \ No newline at end of file From 2601efa2886426f1fa8bd14b7ec1e057194de238 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 14:08:25 -0300 Subject: [PATCH 08/23] Improve readability with more idiomatic expressions --- src/om_widgets/textinput.cljs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index f52d6d2..6ab3d32 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -478,15 +478,13 @@ (cond-> (nil? (:read-only opts)) (assoc :read-only false)) (merge {:path path - :input-mask (cond - (= input-format "numeric") "numeric" - (= input-format "integer") "numeric" - (= input-format "currency") "numeric" - (= input-format "date") date-local-mask - :else input-format) - :currency (if (= input-format "currency") true false) + :input-mask (case input-format + ("numeric" "integer" "currency") "numeric" + "date" date-local-mask + input-format) + + :currency (= input-format "currency") :align (or align - (cond (= input-format "numeric") "right" - (= input-format "integer") "right" - (= input-format "currency") "right" - :else "left"))}))})) + (case input-format + ("numeric" "integer" "currency") "right" + "left"))}))})) From 7a239e3617ed5bd10d41a8240142c51b3ce5ac5c Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 14:10:02 -0300 Subject: [PATCH 09/23] Add :date-format opt --- src/om_widgets/textinput.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index 6ab3d32..d7eeeff 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -471,7 +471,7 @@ (merge {:resize (name (:resize state))})))))))) (defn textinput - [target path {:keys [input-class input-format align] :as opts + [target path {:keys [input-class input-format date-format align] :as opts :or {input-class ""}}] (om/build create-textinput target {:state (-> opts @@ -482,7 +482,7 @@ ("numeric" "integer" "currency") "numeric" "date" date-local-mask input-format) - + :date-format (and (= input-format "date") date-format) :currency (= input-format "currency") :align (or align (case input-format From af69ba7284281236f040e1d7231423a5a7b4f237 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 14:16:27 -0300 Subject: [PATCH 10/23] Modify convert-input to receive custom date format --- src/om_widgets/textinput.cljs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index d7eeeff..be80910 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -41,10 +41,10 @@ (time-format/unparse (time-format/formatter fmt) dt))) (defn- convert-input - [input-type value] + [input-type value fmt] (condp = input-type "date" (try - (string-from-date value (infer-date-format-pattern)) + (string-from-date value (or fmt (infer-date-format-pattern))) (catch js/Error e ;; assume empty string for unhandled values (str value))) @@ -330,8 +330,8 @@ (recur (next (next mv)) (next cv) (conj r m c))) (recur (next mv) (next cv) (conj r (if (re-matches m c) c \_)))) r))) - (:mask-vector @private-state) - (vec (convert-input (:input-format state) value))) + (:mask-vector @private-state) + (vec (convert-input (:input-format state) value (:date-format state)))) prev-value (:prev-value @private-state) new-value (apply str entered-values) dom-node (:dom-node @private-state)] From 56e8157bc5ca8515f9275c273036f68abde66332 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 14:20:37 -0300 Subject: [PATCH 11/23] Modify update-target to re-convert string into #inst --- src/om_widgets/textinput.cljs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index be80910..ce89769 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -51,10 +51,10 @@ value)) (defn- convert-output - [output-type value] + [output-type value fmt] (condp = output-type "date" (try - (date-from-localstring value (infer-date-format-pattern)) + (date-from-localstring value (or fmt (infer-date-format-pattern))) (catch js/Error e value)) "numeric" (let [f (js/parseFloat value)] @@ -132,11 +132,11 @@ :mask)) (defn- update-target - [target owner {:keys [input-format path onChange private-state] :as state} bInternal] + [target owner {:keys [input-format date-format path onChange private-state] :as state} bInternal] (when (and target (not= 0 (:cbtimeout @private-state))) (let [dom-node (:dom-node @private-state) - value (convert-output input-format (.-value dom-node))] + value (convert-output input-format (.-value dom-node) date-format)] (do (.clearTimeout js/window (:cbtimeout @private-state)) (swap! private-state assoc :cbtimeout 0 :prev-value value) From 7007be94b93192007ec0736abb9cd788a395f023 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 14:23:21 -0300 Subject: [PATCH 12/23] Calculate placeholder from dat-format if exists --- src/om_widgets/textinput.cljs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index ce89769..fbb4d92 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -451,7 +451,9 @@ :onPaste #(if (false? (handlepaste target owner state %)) (.preventDefault %) nil) - :placeholder (:placeholder state) + :placeholder (if (:date-format state) + (str/upper-case (:date-format state)) + (:placeholder state)) :disabled (:disabled state) ;:typing-timeout (:typing-timeout state) :type (condp = (:input-format state) From 486c568594360cb8f239c66d41d8bb4dcfe3b890 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 14:35:33 -0300 Subject: [PATCH 13/23] Add missing require --- src/om_widgets/textinput.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index fbb4d92..1a72b0d 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -6,8 +6,8 @@ [cljs-time.format :as time-format] [cljs-time.coerce :as timec] [goog.object :as gobj] - [pallet.thread-expr :as th])) - + [pallet.thread-expr :as th] + [clojure.string :as str])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (def date-local-mask "00/00/0000") From 78c6a5199c00f0f04cabdbe403d8092e1ec9178e Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 14:44:32 -0300 Subject: [PATCH 14/23] Add textinput component example --- src/examples/basic/datepicker_example.cljs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/examples/basic/datepicker_example.cljs b/src/examples/basic/datepicker_example.cljs index fd23eb7..d523732 100644 --- a/src/examples/basic/datepicker_example.cljs +++ b/src/examples/basic/datepicker_example.cljs @@ -29,7 +29,22 @@ :placeholder "MM/DD/YYYY"})]) (fn [close] (w/datepicker app :input-group-left)) - {:for "btn-cal-left"})] + {:for "btn-cal-left-1"})] + [:div.well + [:label "Input Group - left side (:date-format dd/MM/yyyy)"] + (w/popover + (fn [show] + [:div.input-group + [:span.input-group-btn + [:button.btn.btn-primary {:id "btn-cal-left-dt-format" :onClick show} + [:span.glyphicon.glyphicon-calendar]]] + (w/textinput app :input-group-date-format {:input-class "form-control" + :input-format "date" + :date-format "dd/MM/yyyy" + :placeholder "MM/DD/YYYY"})]) + (fn [close] + (w/datepicker app :input-group-date-format)) + {:for "btn-cal-left-dt-format"})] [:div.well [:label "Input Group - right side"] From f5fa9062dad28f19d512012da620496e0fb96bb6 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 15:13:02 -0300 Subject: [PATCH 15/23] Add initial value to example state --- src/examples/basic/state_example.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/examples/basic/state_example.cljs b/src/examples/basic/state_example.cljs index e195399..c970174 100644 --- a/src/examples/basic/state_example.cljs +++ b/src/examples/basic/state_example.cljs @@ -72,7 +72,8 @@ :datepicker {:inline #inst "1991-01-25" :input-group-left #inst "1991-01-25" :input-group-right #inst "1991-01-25" - :input-group-close-on-change #inst "1991-01-25"} + :input-group-close-on-change #inst "1991-01-25" + :input-group-date-format #inst "1991-01-25"} :sex :male :tab {:selected-tab :inbox} :form {:name "" From bbfa9d45f0848bcd6bd33d36bc6aea3a70ae8eb6 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 15:17:53 -0300 Subject: [PATCH 16/23] Apply mask only if an initial value exists, if not, show placeholder --- src/om_widgets/textinput.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index 1a72b0d..59b218a 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -335,7 +335,7 @@ prev-value (:prev-value @private-state) new-value (apply str entered-values) dom-node (:dom-node @private-state)] - (when (and (not= prev-value new-value) dom-node) + (when (and value (not= prev-value new-value) dom-node) (do (swap! private-state assoc :entered-values entered-values :prev-value new-value) From d33040f6a0aa6259e1eddbdc70f16cb3833977ca Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 15:39:27 -0300 Subject: [PATCH 17/23] Validate date-format to match with mask structure --- src/om_widgets/textinput.cljs | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index 59b218a..0388d25 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -475,18 +475,21 @@ (defn textinput [target path {:keys [input-class input-format date-format align] :as opts :or {input-class ""}}] - (om/build create-textinput target - {:state (-> opts - (cond-> (nil? (:read-only opts)) - (assoc :read-only false)) - (merge {:path path - :input-mask (case input-format - ("numeric" "integer" "currency") "numeric" - "date" date-local-mask - input-format) - :date-format (and (= input-format "date") date-format) - :currency (= input-format "currency") - :align (or align - (case input-format - ("numeric" "integer" "currency") "right" - "left"))}))})) + (let [valid-date-formats #{"MM/dd/yyy" "dd/MM/yyyy"}] + (om/build create-textinput target + {:state (-> opts + (cond-> (nil? (:read-only opts)) + (assoc :read-only false)) + (merge {:path path + :input-mask (case input-format + ("numeric" "integer" "currency") "numeric" + "date" date-local-mask + input-format) + :date-format (when (and (= input-format "date") + (valid-date-formats date-format)) + date-format) + :currency (= input-format "currency") + :align (or align + (case input-format + ("numeric" "integer" "currency") "right" + "left"))}))}))) From 5a60f7764e5307ade2c6baffcda6e5b889cf736c Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 15:44:36 -0300 Subject: [PATCH 18/23] Add missing dependency --- project.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/project.clj b/project.clj index 5da1501..c32397a 100644 --- a/project.clj +++ b/project.clj @@ -7,6 +7,7 @@ :dependencies [[org.clojure/clojure "1.7.0"] [org.clojure/clojurescript "1.7.122" :scope "provided"] [org.clojure/core.async "0.1.346.0-17112a-alpha"] + [org.clojure/tools.nrepl "0.2.13"] [org.omcljs/om "0.8.8" :scope "provided"] [org.clojars.intception/thread-expr "1.4.0"] [com.andrewmcveigh/cljs-time "0.3.13"] From 351a66d083167c37866f4634092310928c9ec66b Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 15:44:50 -0300 Subject: [PATCH 19/23] Fix readme doc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e579e40..929bf51 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ just run: ```bash lein figwheel basic ``` -inside the repo and this will start a webserver serving the sample files, point your browser to: `http://localhost:3449/examples/basic/index.html` +inside the repo and this will start a webserver serving the sample files, point your browser to: `http://localhost:3450/examples/basic/index.html` and you are ready to go. ## License From 6812225c1d7ff1e712f45b00fe5404c4c5c4249b Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 16:51:48 -0300 Subject: [PATCH 20/23] Add textinput docstring --- src/om_widgets/textinput.cljs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index 0388d25..6bcf4ba 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -473,6 +473,8 @@ (merge {:resize (name (:resize state))})))))))) (defn textinput + "Opts: + - date-format: only applied when input-format is \"date\". Should be one of the valid values, otherwise is ignored" [target path {:keys [input-class input-format date-format align] :as opts :or {input-class ""}}] (let [valid-date-formats #{"MM/dd/yyy" "dd/MM/yyyy"}] From ee2a10cbc0a8e64f1b32fc83560c5117c25cde5b Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 16:54:31 -0300 Subject: [PATCH 21/23] Improve idiomatic expression --- src/om_widgets/textinput.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index 6bcf4ba..e9bdac1 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -456,7 +456,7 @@ (:placeholder state)) :disabled (:disabled state) ;:typing-timeout (:typing-timeout state) - :type (condp = (:input-format state) + :type (case (:input-format state) "password" "password" "numeric" "number" "text") From 791cd3854cf2fb81578afe9600bd818e9c70cc8b Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 17:08:34 -0300 Subject: [PATCH 22/23] Fix label name --- src/examples/basic/datepicker_example.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/basic/datepicker_example.cljs b/src/examples/basic/datepicker_example.cljs index d523732..e197298 100644 --- a/src/examples/basic/datepicker_example.cljs +++ b/src/examples/basic/datepicker_example.cljs @@ -29,7 +29,7 @@ :placeholder "MM/DD/YYYY"})]) (fn [close] (w/datepicker app :input-group-left)) - {:for "btn-cal-left-1"})] + {:for "btn-cal-left"})] [:div.well [:label "Input Group - left side (:date-format dd/MM/yyyy)"] (w/popover From 036298f0fe77d6b797a1fb3b49b15421b76cbf25 Mon Sep 17 00:00:00 2001 From: Fabricio Cozzarolo Date: Sat, 28 Jun 2025 17:12:16 -0300 Subject: [PATCH 23/23] Fix indentation --- src/om_widgets/textinput.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/om_widgets/textinput.cljs b/src/om_widgets/textinput.cljs index e9bdac1..c5218f5 100644 --- a/src/om_widgets/textinput.cljs +++ b/src/om_widgets/textinput.cljs @@ -330,8 +330,8 @@ (recur (next (next mv)) (next cv) (conj r m c))) (recur (next mv) (next cv) (conj r (if (re-matches m c) c \_)))) r))) - (:mask-vector @private-state) - (vec (convert-input (:input-format state) value (:date-format state)))) + (:mask-vector @private-state) + (vec (convert-input (:input-format state) value (:date-format state)))) prev-value (:prev-value @private-state) new-value (apply str entered-values) dom-node (:dom-node @private-state)]