/
fulcro_util.cljs
768 lines (677 loc) · 35.9 KB
/
fulcro_util.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
(ns dv.fulcro-util
(:refer-clojure :exclude [uuid ident?])
(:require
["react" :as react]
[borkdude.dynaload :refer [dynaload]]
[cljs.core.async :refer [<! chan put! go go-loop sliding-buffer]]
[clojure.spec.alpha :as s]
[clojure.string :as str]
[clojure.walk :as walk]
[com.fulcrologic.fulcro.algorithms.form-state :as fs]
[com.fulcrologic.fulcro.algorithms.merge :as merge]
[com.fulcrologic.fulcro.components :as c :refer [defsc]]
[com.fulcrologic.fulcro.dom :as dom :refer [div ul li p h3 button]]
[com.fulcrologic.fulcro.dom.events :as e]
[com.fulcrologic.fulcro.mutations :as m :refer [defmutation]]
[com.fulcrologic.fulcro.networking.mock-server-remote :refer [mock-http-server]]
[com.fulcrologic.fulcro.ui-state-machines :as sm :refer [defstatemachine]]
[com.fulcrologic.guardrails.core :refer [>defn => ?]]
[edn-query-language.core :as eql]
[goog.events :as events]
[goog.object :as gobj]
[reitit.frontend.easy :as rfe]
[taoensso.timbre :as log])
(:require-macros [dv.fulcro-util]))
(defn error [& msg]
(js/Error. (apply str msg)))
;; some thoughts:
;; I'm thinking of a floating widget on every component that you opt into that you click to toggle
;; the helpers - pprint props in a floating div etc.
;; websocket network remote
;; etc
(defn parse-int [int-str] (js/parseInt int-str 10))
(s/def ::str-or-num (s/or :s string? :n number?))
(>defn to-int
[str-num]
[::str-or-num => (s/or :empty #{""} :n number?)]
(if (string? str-num)
(let [v (str/replace str-num #"[^-0-9]" "")]
(cond-> v
(not= v "")
parse-int))
str-num))
(comment (to-int "9sss")
(to-int "-10") (to-int "-0"))
;; Form helpers str -> data type
(>defn pos-or-empty
[i]
[string? => ::str-or-num]
(if (empty? i)
i
(Math/max 0 (to-int i))))
(>defn min-or-empty
[min i]
[number? string? => ::str-or-num]
(if (empty? i)
i
(Math/max min (to-int i))))
(>defn clamp-or-empty
"Ret if invalid empty str, else int clamped at min - max"
[min max num-str]
[number? number? string? => ::str-or-num]
(cond
(empty? num-str) num-str
(or (nil? min) (nil? max)) (to-int num-str)
:else (Math/min max (Math/max min (to-int num-str)))))
(defn listen
"goog.events.listen to channel
(listen js/global (.-MOUSEMOVE EventType))
(listen js/global (.-MOUSEMOVE EventType) (map (fn [e] {:x (.-:y})))
https://google.github.io/closure-library/api/goog.events.EventType.html
(let [mouse-chan (listen js/window (.-MOUSEMOVE ^js EventType)
(async/chan (async/sliding-buffer 100)
(map (fn [e]
{:client-x (.-clientX e) :client-y (.-clientY e)
:screen-x (.-screenX e) :screen-y (.-screenY e)}))))]
(async/go-loop []
(async/<! (async/timeout 1e3))
(let [x (async/<! mouse-chan)]
(println \"Mouse move: \" x)
(recur))))
"
([el type]
(let [out (chan)]
(events/listen el type
(fn [e] (put! out e)))
out))
([el type out]
(events/listen el type
(fn [e] (put! out e)))
out))
(defn remove-id* [state table-key id]
(update state table-key #(dissoc % id)))
(defn remove-ids*
"Given a top level fulcro db table key and a collection of ids, dissoc's those ids from the db."
[state table-key ids]
(reduce #(remove-id* %1 table-key %2) state ids))
(defn nan? [v] (js/Number.isNaN v))
(defn valid-inst? [v]
(and (inst? v)
(not (nan? (.valueOf v)))))
;; you probably want to use logic like:
;; https://github.com/dvingo/cljs-emotion/blob/master/src/main/dv/cljs_emotion_reagent.cljc#L126
(defn react-factory [el]
(fn
([] (react/createElement el))
([props & children]
(if (seq children)
(apply react/createElement el (clj->js props) (apply array children))
(if (react/isValidElement props)
(react/createElement el nil props)
(react/createElement el (clj->js props)))))))
(def r-as-element (dynaload 'reagent.core/as-element))
(defn react-factory-reagent [el]
(fn
([] (react-factory el))
([props & children]
(if (seq children)
(apply react/createElement el (clj->js props)
(apply array (map @r-as-element children)))
(if (react/isValidElement props)
(react/createElement el nil props)
(react/createElement el (clj->js props)))))))
(def email-regex #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$")
(comment (re-matches email-regex "HI@HI.com"))
(defn ^boolean valid-email? [email]
(and (string? email)
(boolean (re-matches email-regex email))))
(comment (valid-email? "1230HI@HI.com"))
(defn ^boolean valid-password? [password] (> (count password) 7))
(defn ui-input [props] (react/createElement "input" (clj->js props)))
(defsc Input
[this props]
{}
(react/createElement "input" (clj->js props)))
(def ui-input2 (c/factory Input))
(defsc AutoFocusInput [this props]
{:initLocalState (fn [this props]
(gobj/set this "inputRef" (react/createRef)))
:componentDidMount (fn [this]
(when (:autofocus? (c/props this))
;; Needed when using inside a portal otherwise the input will not focus
(js/setTimeout
#(-> this
(gobj/getValueByKeys "inputRef" "current")
(.focus)))))}
(ui-input
(merge
(dissoc props :autofocus?)
{:ref (gobj/get this "inputRef")})))
(def ui-auto-focus-input (c/factory AutoFocusInput))
(defn field
[{:keys [label checked? valid? error-message inline-err?]
:or {inline-err? false}
:as props}]
(let [input-props (-> props
(assoc :name label)
(dissoc :checked? :label :valid? :error-message :inline-err?))
show-err-msg? (and checked? (not valid?))]
(div :.ui.field
(dom/label {:htmlFor label} label)
(cond->> (ui-auto-focus-input input-props)
inline-err? (div :.ui.input.field {:classes [(when show-err-msg? "error")]}))
(when inline-err?
(dom/div :.ui.upward.pointing.red.basic.label
{:style {:top "-19px"} :classes [(when (not show-err-msg?) "hidden")]} error-message))
(when-not inline-err?
(dom/div :.ui.error.message {:classes [(when valid? "hidden")]}
error-message)))))
(defn mark-fields-complete*
"Invokes fulcro.form-state/mark-complete on the collection of fields passed in.
- state map
- ident of component
- seq of fields to mark complete"
[s ref fs]
(reduce (fn [acc v] (fs/mark-complete* acc ref v)) s fs))
(defn reset-form* [s ident]
(-> s
(fs/pristine->entity* ident)
(fs/clear-complete* ident)))
(defn reset-form! [this]
(c/transact! this [(fs/reset-form!) (fs/clear-complete!)]))
(defn reset-form!! [this]
(c/transact!! this [(fs/reset-form!) (fs/clear-complete!)]))
(defn mark-complete!
[this field]
(c/transact!! this [(fs/mark-complete! {:field field})]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Server error and messages tracking mutation helpers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def submit-states #{:not-submitting :submitting :success :failed})
(defmutation set-submit
[{:keys [val msg]}]
(action [{:keys [state ref]}]
(log/info "Setting submit state to: " val)
(log/info "ref path: " (conj ref :ui/submit-state))
(swap! state
(fn [s]
(-> s
(assoc-in (conj ref :ui/submit-state) val)
(assoc-in (conj ref :server/message) msg))))))
(s/def ::opt-map (s/* (s/cat :k keyword? :v any?)))
(>defn ui-textfield
"
(fu/ui-textfield this
\"Description\"
:habit/description
props
:tabIndex 1
:error-message \"Give the habit a description.\")
"
[this label field-kw props & {:as opts}]
[some? string? keyword? map? ::opt-map => some?]
(let [value (field-kw props)
checked? (fs/checked? props field-kw)
opts (or opts {})
on-change (or (:onChange opts) identity)
opts (dissoc opts :onChange)
cls (c/react-type this)
props (merge
{:label label
:inline-err? true
:type "text"
:value (or (str value) "")
:checked? checked?
:valid? (not (empty? (str value)))
:error-message "Please enter a value"
:onBlur (fn [e]
(let [form-fields (or (fs/get-form-fields cls) #{})
v (str/trim (e/target-value e))]
(m/set-string!! this field-kw :value v)
(when (form-fields field-kw)
(mark-complete! this field-kw))))
:autoComplete "off"
:onChange #(do
(on-change %)
(m/set-string!! this field-kw :event %))}
opts)]
(field props)))
;; Defsc so you get shouldComponentUpdate perf gains when props don't change.
(defsc TextField
[this
{:keys [label value field-checked? error-message]
:or {label ""
value ""
field-checked? false
error-message "Please enter a value"}}
{:keys [on-change on-blur valid? on-key-down]
:or {on-change identity
on-key-down identity}
:as computed-props}]
(let [opts (dissoc computed-props :on-key-down :on-change :on-blur :valid?)]
(field
(merge
{:label label
:inline-err? true
:type "text"
:value (or (str value) "")
:checked? field-checked?
:valid? (not (empty? (str value)))
:error-message error-message
:onBlur on-blur
:autoComplete "off"
:onKeyDown on-key-down
:onChange on-change}
opts))))
(def ui-textfield2 (c/computed-factory TextField))
(defn ui-number-field
[this label kw props & {:keys [min max] :as opts}]
(ui-input
(merge
{:type "number"
:label label
:value (str (kw props))
:onBlur (fn [] (mark-complete! this kw))
:onChange #(m/set-value!! this kw (clamp-or-empty min max (e/target-value %)))}
(or opts {}))))
;; TODO use stateful design to track a timeout for a text field that will mark-complete the field
;; after 2 seconds or so. Need to clear this after you complete the field (create a new entity for example)
;; you don't want the now-fresh form to be marked complete triggering validation errors.
(defn make-txt-field []
(let [timer (volatile! nil)]
(fn [this label field-kw val]
(field [this label field-kw val]))))
(>defn ui-password2
[this field-kw val & {:as opts}]
[some? keyword? string? ::opt-map => some?]
(field (merge {:label "Password"
:type "password"
:value (or val "")
:valid? (valid-password? val)
:error-message "Password must be at least 8 characters."
:onBlur #(mark-complete! this field-kw)
:autoComplete "off"
:onChange #(m/set-string!! this field-kw :event %)}
(or opts {}))))
(defn ui-password-field [value on-change & {:as opts}]
(field (merge {:label "Password"
:type "password"
:value value
:autoComplete "off"
:onChange on-change}
(or opts {}))))
(defn ui-verify-password [this f pw pw-ver on-blur & {:as opts}]
(field
(merge {:label "Repeat Password"
:type "password"
:value (or pw-ver "")
:autoComplete "off"
:valid? (= pw pw-ver)
:error-message "Passwords do not match."
:onBlur #(on-blur f)
:onChange (fn [e]
(when (= pw (e/target-value e))
(mark-complete! this f))
(m/set-string!! this f :event e))}
(or opts {}))))
(defn ui-email [this f val on-blur & {:as opts}]
(field
(merge
{:label "Email"
:type "email"
:value (or val "")
:valid? (valid-email? val)
:error-message "Must be an email address"
:autoComplete "off"
:onBlur #(on-blur f)
:onChange #(m/set-string!! this f :event %)}
(or opts {}))))
(defn ui-primary-btn [text on-click]
(dom/button :.ui.primary.button {:onClick on-click} text))
(defn ui-button
([props on-click text]
(dom/button :.ui.button
(merge
props
{:onClick on-click}) text))
([on-click text]
(dom/button :.ui.button #js {:onClick on-click} text)))
(defn stop-propagation
([] (fn [e] (.stopPropagation e)))
([f] (fn [e] (.stopPropagation e) (f e))))
(defn prevent-default
([] (fn [e] (.preventDefault e)))
([f] (fn [e] (.preventDefault e) (f e))))
(defn prevent-default-and-stop
([] (fn [e] (doto e .preventDefault .stopPropagation)))
([f] (fn [e] (doto e .preventDefault .stopPropagation) (f e))))
(defn on-server? []
(not (exists? js/window)))
(defn map->vec
"Useful for passing a map to a fn that takes key val &args"
[m]
(vec (mapcat identity m)))
(comment
(map->vec {:a 5 :b 6})
(map->vec nil))
(defn get-props-keys [c]
(->> (c/get-query c)
(eql/query->ast)
:children
(map :key)))
(defn table [header-cells rows]
(dom/table :.ui.celled.table.striped.yellow {:key "table"}
(dom/thead
(dom/tr nil (map #(dom/th #js{:key (str %)} %) header-cells)))
(dom/tbody
(map (fn [[k v]]
(dom/tr #js{:key (str k)}
(dom/td #js{:key "key"} (str k))
(dom/td #js{:key "val"} (pr-str v))))
rows))))
(defn props-data-debug
"show table of fields for a component with value.
this: fulcro component"
[this show?]
(when show?
(let [props (c/props this)]
(when (some? props)
(let [ident (c/get-ident this props)
prop-keys (get-props-keys this)
rows (map #(vector % (get props %)) prop-keys)]
(dom/div nil
(dom/h2 {:key "first"} "ident: " (pr-str ident))
(table ["prop" "value"] rows)))))))
(defn form-debug
"show table of form fields for a component with value and validation state.
validator component instance"
[validator com show?]
(let [props (c/props com)
{:keys [form-fields]} (c/component-options com)
form-ident (c/get-ident com)]
(when show?
(c/fragment
(dom/h4 :.ui.violet.message (str "Form fields for " (pr-str form-ident) ":"))
(dom/table :.ui.celled.table.striped.yellow
(dom/thead
(dom/tr (dom/th "field") (dom/th "dirty?") (dom/th "value") (dom/th "valid state")))
(dom/tbody
(dom/tr {:key "all"} (dom/td "Entire form") (dom/td (pr-str (fs/dirty? props))) (dom/td "n/a") (dom/td (pr-str (validator props))))
(map #(dom/tr {:key (str %)}
(dom/td (str %))
(dom/td (pr-str (fs/dirty? props %)))
(dom/td (pr-str (props %)))
(dom/td (pr-str (validator props %))))
form-fields)))))))
(defn dirty-fields
"Returns the actual map of dirty fields for the current component."
[this]
(let [props (c/props this)
ident (c/ident this props)]
(get
(fs/dirty-fields props false)
ident)))
(defmutation entity->pristine!* [_]
(action [{:keys [ref state]}]
(swap! state #(fs/entity->pristine* % ref))))
(defn entity->pristine! [this]
(c/transact! this [(entity->pristine!*)]))
(defmutation pristine->entity!* [_]
(action [{:keys [ref state]}]
(swap! state #(fs/pristine->entity* % ref))))
(defn pristine->entity! [this]
(c/transact! this [(pristine->entity!*)]))
(defn field-valid? [validator props field]
(let [v (validator props field)]
(contains? #{:unchecked :valid} v)))
(defn validator-state [this validator]
(assert (c/component-instance? this))
(let [cls (c/react-type this)
props (c/props this)
fields (fs/get-form-fields cls)
valid-state (validator props)
dirty? (fs/dirty? props)
all-fields-valid? (every? #(= :valid (validator props %)) fields)
disabled? (or (= :invalid valid-state)
(and (= :unchecked valid-state) (not all-fields-valid?)))]
{:checked? (fs/checked? props)
:dirty? dirty?
:valid? (= :valid valid-state)
:disabled? disabled?}))
(defn get-server-mutation-err
[result-or-env]
(let [result (or (some-> result-or-env ::sm/event-data ::sm/mutation-result) result-or-env)
body (:body result)
mutation-sym (some-> body keys first)]
(let [error (some-> body mutation-sym :server/message)]
(if (nil? error)
"There was an error sending your request."
error))))
(defn get-server-mutation-err2
[result-or-env]
(let [result (or (some-> result-or-env ::sm/event-data ::sm/mutation-result) result-or-env)
body (:body result)
mutation-sym (-> body keys first)]
(-> body mutation-sym :server/message)))
(defn map-table
"show table of form fields for a component with value and validation state.
validator component instance"
([m show?] (map-table "Map of data" m show?))
([label m show?]
(when show?
(c/fragment
(dom/h4 :.ui.violet.message label)
(dom/table :.ui.celled.table.striped.yellow
(dom/thead
(dom/tr (dom/th "field") (dom/th "value")))
(dom/tbody
(map (fn [[k v]]
(dom/tr {:key (str k)}
(dom/td (str k))
(dom/td (pr-str v))))
m)))))))
;; with the specs, invoking this with a string would cause an infinite recursion loop.
(defn uuid
"Without args gives random UUID.
With args, builds UUID based on input (useful in tests)."
([] #_[=> uuid?] (random-uuid))
([s] #_[string? => uuid?] (cljs.core/uuid s)))
(defn deep-merge [x y]
(cond
(and (map? x) (map? y)) (merge-with deep-merge x y)
(and (map? x) (nil? y)) x
(and (map? y) (nil? x)) y
:else y))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Pathom remote
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn local-remote
[parser env]
(let [transmit!
(:transmit! (mock-http-server
{:parser
(fn [eql]
(go
(let [out (<! (parser env eql))]
(log/trace "Parser output: " out)
out)))}))]
{:transmit! (fn [this send-node] (transmit! this send-node))}))
(defn has-field?
"Returns true if a value is not nil and not :com.fulcrologic.fulcro.algorithms.merge/not-found"
[v]
(and
(some? v)
(not= ::merge/not-found v)))
(defn registry-key->class
[kw-or-sym]
(if-let [cls (c/registry-key->class kw-or-sym)]
cls
(throw (js/Error. (str "Class component: " kw-or-sym
" is not in the registry, you probably need to require the namespace it lives in.")))))
(defn kw-namespace [k] (and (keyword? k) (namespace k)))
(defn client-only-value? [k]
;(println "checking key: " k)
(let [ns (some-> k kw-namespace)
ident-ns (when (eql/ident? k) (some-> (first k) kw-namespace))
v (or
(and
(string? ns)
(or
(= "ui" ns)
(str/starts-with? ns "fulcro.")
(str/starts-with? ns "com.fulcrologic.fulcro.")))
(and
(string? ident-ns)
(or
(= "ui" ident-ns)
(str/starts-with? ns "fulcro.")
(str/starts-with? ident-ns "com.fulcrologic.fulcro."))))
]
;(println "ret: " v)
v))
;(defn elide-client-only-values
; "Takes a map and recursively removes and keys that should not be sent over the network."
; [m]
; (reduce
; (fn [acc [k v]]
; (if-not (client-only-value? k)
; (cond
; (map? v) (assoc acc k (elide-client-only-values v))
; (vector? v) (assoc acc k (mapv elide-client-only-values v))
; :else (assoc acc k v))
; acc))
; {} m))
(defn elide-client-only-values*
"Takes a map, removes keys that should not be sent over the network."
[m]
(reduce
(fn [acc [k v]]
(if (client-only-value? k) acc (assoc acc k v)))
{} m))
(defn elide-client-only-values
[m]
(cond
(vector? m)
(mapv elide-client-only-values m)
(map? m)
(walk/postwalk
(fn [x] (if (map? x) (elide-client-only-values* x) x))
m)
:else m))
;; testing elide-values
(comment
(elide-client-only-values
{:habit/id #uuid "e777425f-e28e-45b0-9ccf-f007b603d02f",
:fulcro.client.primitives/computed {:some-key "value"}
:habit/starts-on "UnknownTransitType: 2020-08-06",
:habit/criteria-num 2,
:habit/description "Right then",
:habit/active? true,
:habit/repeats-every "UnknownTransitType: P1D",
:habit/tasks
[{:task/subtasks [],
:ui/has-duration? false,
:ui/has-scheduled-at? false,
:ui/show-delete-confirmation? false,
:task/duration "UnknownTransitType: PT1M",
:com.fulcrologic.fulcro.algorithms.form-state/config
{:com.fulcrologic.fulcro.algorithms.form-state/id
[:task/id #uuid "1f2400de-af54-42e1-852d-48287d69f0d4"],
:com.fulcrologic.fulcro.algorithms.form-state/fields
#{:ui/has-duration? :ui/has-scheduled-at? :task/duration
:task/description
:task/scheduled-at},
:com.fulcrologic.fulcro.algorithms.form-state/complete?
#{:ui/has-duration? :ui/has-scheduled-at? :task/duration
:task/description
:task/scheduled-at},
:com.fulcrologic.fulcro.algorithms.form-state/subforms {},
:com.fulcrologic.fulcro.algorithms.form-state/pristine-state
{:ui/has-duration? false,
:ui/has-scheduled-at? false,
:task/duration "UnknownTransitType: PT1M",
:task/description "chagnge",
:task/scheduled-at "UnknownTransitType: [object Object]"}},
:ui/machine-state :state/not-submitting,
:task/id #uuid "1f2400de-af54-42e1-852d-48287d69f0d4",
:ui/subtask-form
{:task/id #uuid "6bde87a7-f6ef-4920-8828-404345282259",
:task/description "",
:task/duration "UnknownTransitType: PT1M",
:task/scheduled-at "UnknownTransitType: [object Object]",
:ui/show-form-debug? false,
:ui/has-duration? false,
:ui/has-scheduled-at? false,
:com.fulcrologic.fulcro.algorithms.form-state/config
{:com.fulcrologic.fulcro.algorithms.form-state/id
[:task/id #uuid "6bde87a7-f6ef-4920-8828-404345282259"],
:com.fulcrologic.fulcro.algorithms.form-state/fields
#{:ui/has-duration? :ui/has-scheduled-at? :task/duration
:task/description
:task/scheduled-at},
:com.fulcrologic.fulcro.algorithms.form-state/subforms {},
:com.fulcrologic.fulcro.algorithms.form-state/pristine-state
{:ui/has-duration? false,
:ui/has-scheduled-at? false,
:task/duration "UnknownTransitType: PT1M",
:task/description "",
:task/scheduled-at "UnknownTransitType: [object Object]"}}},
:ui/show-form-debug? false,
:task/description "chagnge",
:task/scheduled-at "UnknownTransitType: [object Object]",
:db/updated-at #inst "2020-08-06T20:31:24.755-00:00",
:db/created-at #inst "2020-08-06T19:47:07.686-00:00"}
{:task/subtasks [],
:ui/has-duration? false,
:ui/has-scheduled-at? false,
:ui/show-delete-confirmation? false,
:task/duration "UnknownTransitType: PT1M",
:com.fulcrologic.fulcro.algorithms.form-state/config
{:com.fulcrologic.fulcro.algorithms.form-state/id
[:task/id #uuid "8cf7f2eb-b095-4e36-a9a4-5f424cccc48c"],
:com.fulcrologic.fulcro.algorithms.form-state/fields
#{:ui/has-duration? :ui/has-scheduled-at? :task/duration
:task/description
:task/scheduled-at},
:com.fulcrologic.fulcro.algorithms.form-state/complete?
#{:ui/has-duration? :ui/has-scheduled-at? :task/duration
:task/description
:task/scheduled-at},
:com.fulcrologic.fulcro.algorithms.form-state/subforms {},
:com.fulcrologic.fulcro.algorithms.form-state/pristine-state
{:ui/has-duration? false,
:ui/has-scheduled-at? false,
:task/duration "UnknownTransitType: PT1M",
:task/description "Drink 1 liter of water",
:task/scheduled-at "UnknownTransitType: [object Object]"}},
:ui/machine-state :state/not-submitting,
:task/id #uuid "8cf7f2eb-b095-4e36-a9a4-5f424cccc48c",
:ui/subtask-form
{:task/id #uuid "a8bdce00-bce1-44bf-b749-602db3b03a3a",
:task/description "",
:task/duration "UnknownTransitType: PT1M",
:task/scheduled-at "UnknownTransitType: [object Object]",
:ui/show-form-debug? false,
:ui/has-duration? false,
:ui/has-scheduled-at? false,
:com.fulcrologic.fulcro.algorithms.form-state/config
{:com.fulcrologic.fulcro.algorithms.form-state/id
[:task/id #uuid "a8bdce00-bce1-44bf-b749-602db3b03a3a"],
:com.fulcrologic.fulcro.algorithms.form-state/fields
#{:ui/has-duration? :ui/has-scheduled-at? :task/duration
:task/description
:task/scheduled-at},
:com.fulcrologic.fulcro.algorithms.form-state/subforms {},
:com.fulcrologic.fulcro.algorithms.form-state/pristine-state
{:ui/has-duration? false,
:ui/has-scheduled-at? false,
:task/duration "UnknownTransitType: PT1M",
:task/description "",
:task/scheduled-at "UnknownTransitType: [object Object]"}}},
:ui/show-form-debug? false,
:task/description "Drink 1 liter of water",
:task/scheduled-at "UnknownTransitType: [object Object]",
:db/updated-at #inst "2020-08-06T19:47:07.696-00:00",
:db/created-at #inst "2020-08-06T19:47:07.696-00:00"}],
:habit/criteria :min-of})
)