suprform 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ConditionChecker.d.ts.map +1 -1
- package/dist/components/DisabilityChecker.d.ts.map +1 -1
- package/dist/suprform.cjs.js +1 -1
- package/dist/suprform.cjs.js.map +1 -1
- package/dist/suprform.es.js +60 -55
- package/dist/suprform.es.js.map +1 -1
- package/dist/util.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/suprform.es.js
CHANGED
|
@@ -21,11 +21,11 @@ function U(t) {
|
|
|
21
21
|
return t;
|
|
22
22
|
return r;
|
|
23
23
|
}
|
|
24
|
-
var Ee = (t) => /^\w*$/.test(t),
|
|
24
|
+
var Ee = (t) => /^\w*$/.test(t), O = (t) => t === void 0, we = (t) => Array.isArray(t) ? t.filter(Boolean) : [], Ke = (t) => we(t.replace(/["|']|\]/g, "").split(/\.|\[/)), m = (t, r, e) => {
|
|
25
25
|
if (!r || !P(t))
|
|
26
26
|
return e;
|
|
27
27
|
const s = (Ee(r) ? [r] : Ke(r)).reduce((u, i) => G(u) ? u : u[i], t);
|
|
28
|
-
return
|
|
28
|
+
return O(s) || s === t ? O(t[r]) ? e : t[r] : s;
|
|
29
29
|
}, K = (t) => typeof t == "boolean", R = (t, r, e) => {
|
|
30
30
|
let s = -1;
|
|
31
31
|
const u = Ee(r) ? [r] : Ke(r), i = u.length, c = i - 1;
|
|
@@ -242,7 +242,7 @@ function rr(t) {
|
|
|
242
242
|
};
|
|
243
243
|
if (p(e, !0), f) {
|
|
244
244
|
const E = U(m(u._options.defaultValues, e, F.current.defaultValue));
|
|
245
|
-
R(u._defaultValues, e, E),
|
|
245
|
+
R(u._defaultValues, e, E), O(m(u._formValues, e)) && R(u._formValues, e, E);
|
|
246
246
|
}
|
|
247
247
|
return !V && u.register(e), $.current = e, () => {
|
|
248
248
|
(V ? f && !u._state.action : f) ? u.unregister(e) : p(e, !1);
|
|
@@ -307,12 +307,12 @@ function ir(t, r) {
|
|
|
307
307
|
const e = r.slice(0, -1).length;
|
|
308
308
|
let s = 0;
|
|
309
309
|
for (; s < e; )
|
|
310
|
-
t =
|
|
310
|
+
t = O(t) ? s++ : t[r[s++]];
|
|
311
311
|
return t;
|
|
312
312
|
}
|
|
313
313
|
function ur(t) {
|
|
314
314
|
for (const r in t)
|
|
315
|
-
if (t.hasOwnProperty(r) && !
|
|
315
|
+
if (t.hasOwnProperty(r) && !O(t[r]))
|
|
316
316
|
return !1;
|
|
317
317
|
return !0;
|
|
318
318
|
}
|
|
@@ -332,7 +332,7 @@ function Ct(t) {
|
|
|
332
332
|
function je(t, r = {}) {
|
|
333
333
|
for (const e in t) {
|
|
334
334
|
const s = t[e];
|
|
335
|
-
Ct(s) ? (r[e] = Array.isArray(s) ? [] : {}, je(s, r[e])) :
|
|
335
|
+
Ct(s) ? (r[e] = Array.isArray(s) ? [] : {}, je(s, r[e])) : O(s) || (r[e] = !0);
|
|
336
336
|
}
|
|
337
337
|
return r;
|
|
338
338
|
}
|
|
@@ -341,7 +341,7 @@ function fe(t, r, e) {
|
|
|
341
341
|
for (const s in t) {
|
|
342
342
|
const u = t[s];
|
|
343
343
|
if (Ct(u))
|
|
344
|
-
|
|
344
|
+
O(r) || qe(e[s]) ? e[s] = je(u, Array.isArray(u) ? [] : {}) : fe(u, G(r) ? {} : r[s], e[s]);
|
|
345
345
|
else {
|
|
346
346
|
const i = r[s];
|
|
347
347
|
e[s] = !te(u, i);
|
|
@@ -361,11 +361,11 @@ var kt = (t) => {
|
|
|
361
361
|
}
|
|
362
362
|
return t[0].checked && !t[0].disabled ? (
|
|
363
363
|
// @ts-expect-error expected to work in the browser
|
|
364
|
-
t[0].attributes && !
|
|
364
|
+
t[0].attributes && !O(t[0].attributes.value) ? O(t[0].value) || t[0].value === "" ? mt : { value: t[0].value, isValid: !0 } : mt
|
|
365
365
|
) : yt;
|
|
366
366
|
}
|
|
367
367
|
return yt;
|
|
368
|
-
}, Dt = (t, { valueAsNumber: r, valueAsDate: e, setValueAs: s }) =>
|
|
368
|
+
}, Dt = (t, { valueAsNumber: r, valueAsDate: e, setValueAs: s }) => O(t) ? t : r ? t === "" ? NaN : t && +t : e && Y(t) ? new Date(t) : s ? s(t) : t;
|
|
369
369
|
const _t = {
|
|
370
370
|
isValid: !1,
|
|
371
371
|
value: null
|
|
@@ -376,7 +376,7 @@ var Rt = (t) => Array.isArray(t) ? t.reduce((r, e) => e && e.checked && !e.disab
|
|
|
376
376
|
} : r, _t) : _t;
|
|
377
377
|
function gt(t) {
|
|
378
378
|
const r = t.ref;
|
|
379
|
-
return Xe(r) ? r.files : Ze(r) ? Rt(t.refs).value : wt(r) ? [...r.selectedOptions].map(({ value: e }) => e) : ve(r) ? kt(t.refs).value : Dt(
|
|
379
|
+
return Xe(r) ? r.files : Ze(r) ? Rt(t.refs).value : wt(r) ? [...r.selectedOptions].map(({ value: e }) => e) : ve(r) ? kt(t.refs).value : Dt(O(r.value) ? t.ref.value : r.value, t);
|
|
380
380
|
}
|
|
381
381
|
var lr = (t, r, e, s) => {
|
|
382
382
|
const u = {};
|
|
@@ -390,7 +390,7 @@ var lr = (t, r, e, s) => {
|
|
|
390
390
|
fields: u,
|
|
391
391
|
shouldUseNativeValidation: s
|
|
392
392
|
};
|
|
393
|
-
}, Se = (t) => t instanceof RegExp, ge = (t) =>
|
|
393
|
+
}, Se = (t) => t instanceof RegExp, ge = (t) => O(t) ? t : Se(t) ? t.source : P(t) ? Se(t.value) ? t.value.source : t.value : t, ye = (t) => ({
|
|
394
394
|
isOnSubmit: !t || t === X.onSubmit,
|
|
395
395
|
isOnBlur: t === X.onBlur,
|
|
396
396
|
isOnChange: t === X.onChange,
|
|
@@ -448,7 +448,7 @@ var fr = (t, r, e, s) => {
|
|
|
448
448
|
e(t);
|
|
449
449
|
const { name: u, ...i } = t;
|
|
450
450
|
return q(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((c) => r[c] === (!s || X.all));
|
|
451
|
-
}, yr = (t, r, e) => !t || !r || t === r || z(t).some((s) => s && (e ? s === r : s.startsWith(r) || r.startsWith(s))), mr = (t, r, e, s, u) => u.isOnAll ? !1 : !e && u.isOnTouch ? !(r || t) : (e ? s.isOnBlur : u.isOnBlur) ? !t : (e ? s.isOnChange : u.isOnChange) ? t : !0, _r = (t, r) => !we(m(t, r)).length && B(t, r),
|
|
451
|
+
}, yr = (t, r, e) => !t || !r || t === r || z(t).some((s) => s && (e ? s === r : s.startsWith(r) || r.startsWith(s))), mr = (t, r, e, s, u) => u.isOnAll ? !1 : !e && u.isOnTouch ? !(r || t) : (e ? s.isOnBlur : u.isOnBlur) ? !t : (e ? s.isOnChange : u.isOnChange) ? t : !0, _r = (t, r) => !we(m(t, r)).length && B(t, r), Tt = (t, r, e) => {
|
|
452
452
|
const s = z(m(t, e));
|
|
453
453
|
return R(s, "root", r[e]), R(t, e, s), t;
|
|
454
454
|
};
|
|
@@ -469,7 +469,7 @@ var de = (t) => P(t) && !Se(t) ? t : {
|
|
|
469
469
|
return {};
|
|
470
470
|
const M = l ? l[0] : c, f = (C) => {
|
|
471
471
|
u && M.reportValidity && (M.setCustomValidity(K(C) ? "" : C || ""), M.reportValidity());
|
|
472
|
-
}, d = {}, p = Ze(c), E = ve(c), Z = p || E, W = (N || Xe(c)) &&
|
|
472
|
+
}, d = {}, p = Ze(c), E = ve(c), Z = p || E, W = (N || Xe(c)) && O(c.value) && O(S) || xe(c) && c.value === "" || S === "" || Array.isArray(S) && !S.length, oe = ar.bind(null, w, s, d), se = (C, D, I, j = ne.maxLength, Q = ne.minLength) => {
|
|
473
473
|
const ae = C ? D : I;
|
|
474
474
|
d[w] = {
|
|
475
475
|
type: C ? j : Q,
|
|
@@ -645,8 +645,8 @@ function hr(t = {}) {
|
|
|
645
645
|
}, f = (a, n, o, h) => {
|
|
646
646
|
const _ = m(s, a);
|
|
647
647
|
if (_) {
|
|
648
|
-
const y = m(i, a,
|
|
649
|
-
|
|
648
|
+
const y = m(i, a, O(o) ? m(u, a) : o);
|
|
649
|
+
O(y) || h && h.defaultChecked || n ? R(i, a, n ? y : gt(_._f)) : I(a, y), c.mount && !c.action && w();
|
|
650
650
|
}
|
|
651
651
|
}, d = (a, n, o, h, _) => {
|
|
652
652
|
let y = !1, A = !1;
|
|
@@ -656,12 +656,12 @@ function hr(t = {}) {
|
|
|
656
656
|
if (!r.disabled) {
|
|
657
657
|
if (!o || h) {
|
|
658
658
|
(x.isDirty || g.isDirty) && (A = e.isDirty, e.isDirty = k.isDirty = se(), y = A !== k.isDirty);
|
|
659
|
-
const
|
|
660
|
-
A = !!m(e.dirtyFields, a),
|
|
659
|
+
const T = te(m(u, a), n);
|
|
660
|
+
A = !!m(e.dirtyFields, a), T ? B(e.dirtyFields, a) : R(e.dirtyFields, a, !0), k.dirtyFields = e.dirtyFields, y = y || (x.dirtyFields || g.dirtyFields) && A !== !T;
|
|
661
661
|
}
|
|
662
662
|
if (o) {
|
|
663
|
-
const
|
|
664
|
-
|
|
663
|
+
const T = m(e.touchedFields, a);
|
|
664
|
+
T || (R(e.touchedFields, a, o), k.touchedFields = e.touchedFields, y = y || (x.touchedFields || g.touchedFields) && T !== o);
|
|
665
665
|
}
|
|
666
666
|
y && _ && F.state.next(k);
|
|
667
667
|
}
|
|
@@ -702,12 +702,12 @@ function hr(t = {}) {
|
|
|
702
702
|
if (_) {
|
|
703
703
|
const { _f: y, ...A } = _;
|
|
704
704
|
if (y) {
|
|
705
|
-
const k = l.array.has(y.name),
|
|
706
|
-
|
|
705
|
+
const k = l.array.has(y.name), T = _._f && cr(_._f);
|
|
706
|
+
T && x.validatingFields && N([y.name], !0);
|
|
707
707
|
const J = await Ge(_, l.disabled, i, $, r.shouldUseNativeValidation && !n, k);
|
|
708
|
-
if (
|
|
708
|
+
if (T && x.validatingFields && N([y.name]), J[y.name] && (o.valid = !1, n))
|
|
709
709
|
break;
|
|
710
|
-
!n && (m(J, y.name) ? k ?
|
|
710
|
+
!n && (m(J, y.name) ? k ? Tt(e.errors, J, y.name) : R(e.errors, y.name, J[y.name]) : B(e.errors, y.name));
|
|
711
711
|
}
|
|
712
712
|
!q(A) && await W(A, n, o);
|
|
713
713
|
}
|
|
@@ -720,7 +720,7 @@ function hr(t = {}) {
|
|
|
720
720
|
}
|
|
721
721
|
l.unMount = /* @__PURE__ */ new Set();
|
|
722
722
|
}, se = (a, n) => !r.disabled && (a && n && R(i, a, n), !te(Fe(), u)), C = (a, n, o) => He(a, l, {
|
|
723
|
-
...c.mount ? i :
|
|
723
|
+
...c.mount ? i : O(n) ? u : Y(a) ? { [a]: n } : n
|
|
724
724
|
}, o, n), D = (a) => we(m(c.mount ? i : u, a, r.shouldUnregister ? m(u, a, []) : [])), I = (a, n, o = {}) => {
|
|
725
725
|
const h = m(s, a);
|
|
726
726
|
let _ = n;
|
|
@@ -758,29 +758,29 @@ function hr(t = {}) {
|
|
|
758
758
|
c.mount = !0;
|
|
759
759
|
const n = a.target;
|
|
760
760
|
let o = n.name, h = !0;
|
|
761
|
-
const _ = m(s, o), y = (
|
|
762
|
-
h = Number.isNaN(
|
|
761
|
+
const _ = m(s, o), y = (T) => {
|
|
762
|
+
h = Number.isNaN(T) || le(T) && isNaN(T.getTime()) || te(T, m(i, o, T));
|
|
763
763
|
}, A = ye(r.mode), k = ye(r.reValidateMode);
|
|
764
764
|
if (_) {
|
|
765
|
-
let
|
|
766
|
-
const be = n.type ? gt(_._f) : pt(a), ie = a.type === pe.BLUR || a.type === pe.FOCUS_OUT, Ht = !dr(_._f) && !r.resolver && !m(e.errors, o) && !_._f.deps || mr(ie, m(e.touchedFields, o), e.isSubmitted, k, A),
|
|
765
|
+
let T, J;
|
|
766
|
+
const be = n.type ? gt(_._f) : pt(a), ie = a.type === pe.BLUR || a.type === pe.FOCUS_OUT, Ht = !dr(_._f) && !r.resolver && !m(e.errors, o) && !_._f.deps || mr(ie, m(e.touchedFields, o), e.isSubmitted, k, A), Te = Qe(o, l, ie);
|
|
767
767
|
R(i, o, be), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), V && V(0)) : _._f.onChange && _._f.onChange(a);
|
|
768
|
-
const
|
|
768
|
+
const Oe = d(o, be, ie), qt = !q(Oe) || Te;
|
|
769
769
|
if (!ie && F.state.next({
|
|
770
770
|
name: o,
|
|
771
771
|
type: a.type,
|
|
772
772
|
values: U(i)
|
|
773
773
|
}), Ht)
|
|
774
|
-
return (x.isValid || g.isValid) && (r.mode === "onBlur" ? ie && w() : ie || w()), qt && F.state.next({ name: o, ...
|
|
775
|
-
if (!ie &&
|
|
774
|
+
return (x.isValid || g.isValid) && (r.mode === "onBlur" ? ie && w() : ie || w()), qt && F.state.next({ name: o, ...Te ? {} : Oe });
|
|
775
|
+
if (!ie && Te && F.state.next({ ...e }), r.resolver) {
|
|
776
776
|
const { errors: lt } = await E([o]);
|
|
777
777
|
if (y(be), h) {
|
|
778
778
|
const jt = vt(e.errors, s, o), ct = vt(lt, s, jt.name || o);
|
|
779
|
-
|
|
779
|
+
T = ct.error, o = ct.name, J = q(lt);
|
|
780
780
|
}
|
|
781
781
|
} else
|
|
782
|
-
N([o], !0),
|
|
783
|
-
h && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) && ce(_._f.deps), p(o, J,
|
|
782
|
+
N([o], !0), T = (await Ge(_, l.disabled, i, $, r.shouldUseNativeValidation))[o], N([o]), y(be), h && (T ? J = !1 : (x.isValid || g.isValid) && (J = await W(s, !0)));
|
|
783
|
+
h && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) && ce(_._f.deps), p(o, J, T, Oe));
|
|
784
784
|
}
|
|
785
785
|
}, _e = (a, n) => {
|
|
786
786
|
if (m(e.errors, n) && a.focus)
|
|
@@ -789,7 +789,7 @@ function hr(t = {}) {
|
|
|
789
789
|
let o, h;
|
|
790
790
|
const _ = z(a);
|
|
791
791
|
if (r.resolver) {
|
|
792
|
-
const y = await Z(
|
|
792
|
+
const y = await Z(O(a) ? a : _);
|
|
793
793
|
o = q(y), h = a ? !_.some((A) => m(y, A)) : o;
|
|
794
794
|
} else a ? (h = (await Promise.all(_.map(async (y) => {
|
|
795
795
|
const A = m(s, y);
|
|
@@ -804,7 +804,7 @@ function hr(t = {}) {
|
|
|
804
804
|
let o = {
|
|
805
805
|
...c.mount ? i : u
|
|
806
806
|
};
|
|
807
|
-
return n && (o = Et(n.dirtyFields ? e.dirtyFields : e.touchedFields, o)),
|
|
807
|
+
return n && (o = Et(n.dirtyFields ? e.dirtyFields : e.touchedFields, o)), O(a) ? o : Y(a) ? m(o, a) : a.map((h) => m(o, h));
|
|
808
808
|
}, tt = (a, n) => ({
|
|
809
809
|
invalid: !!m((n || e).errors, a),
|
|
810
810
|
isDirty: !!m((n || e).dirtyFields, a),
|
|
@@ -816,9 +816,9 @@ function hr(t = {}) {
|
|
|
816
816
|
errors: a ? e.errors : {}
|
|
817
817
|
});
|
|
818
818
|
}, rt = (a, n, o) => {
|
|
819
|
-
const h = (m(s, a, { _f: {} })._f || {}).ref, _ = m(e.errors, a) || {}, { ref: y, message: A, type: k, ...
|
|
819
|
+
const h = (m(s, a, { _f: {} })._f || {}).ref, _ = m(e.errors, a) || {}, { ref: y, message: A, type: k, ...T } = _;
|
|
820
820
|
R(e.errors, a, {
|
|
821
|
-
...
|
|
821
|
+
...T,
|
|
822
822
|
...n,
|
|
823
823
|
ref: h
|
|
824
824
|
}), F.state.next({
|
|
@@ -884,8 +884,8 @@ function hr(t = {}) {
|
|
|
884
884
|
ref: (_) => {
|
|
885
885
|
if (_) {
|
|
886
886
|
De(a, n), o = m(s, a);
|
|
887
|
-
const y =
|
|
888
|
-
if (A ? k.find((
|
|
887
|
+
const y = O(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, A = nr(y), k = o._f.refs || [];
|
|
888
|
+
if (A ? k.find((T) => T === y) : y === o._f.ref)
|
|
889
889
|
return;
|
|
890
890
|
R(s, a, {
|
|
891
891
|
_f: {
|
|
@@ -945,7 +945,7 @@ function hr(t = {}) {
|
|
|
945
945
|
}), h)
|
|
946
946
|
throw h;
|
|
947
947
|
}, Pt = (a, n = {}) => {
|
|
948
|
-
m(s, a) && (
|
|
948
|
+
m(s, a) && (O(n.defaultValue) ? Q(a, U(m(u, a))) : (Q(a, n.defaultValue), R(u, a, U(n.defaultValue))), n.keepTouched || B(e.touchedFields, a), n.keepDirty || (B(e.dirtyFields, a), e.isDirty = n.defaultValue ? se(a, U(m(u, a))) : se()), n.keepError || (B(e.errors, a), x.isValid && w()), F.state.next({ ...e }));
|
|
949
949
|
}, it = (a, n = {}) => {
|
|
950
950
|
const o = a ? U(a) : u, h = U(o), _ = q(a), y = _ ? u : h;
|
|
951
951
|
if (n.keepDefaultValues || (u = o), !n.keepValues) {
|
|
@@ -957,13 +957,13 @@ function hr(t = {}) {
|
|
|
957
957
|
for (const k of Array.from(A))
|
|
958
958
|
m(e.dirtyFields, k) ? R(y, k, m(i, k)) : Q(k, m(y, k));
|
|
959
959
|
} else {
|
|
960
|
-
if (ze &&
|
|
960
|
+
if (ze && O(a))
|
|
961
961
|
for (const A of l.mount) {
|
|
962
962
|
const k = m(s, A);
|
|
963
963
|
if (k && k._f) {
|
|
964
|
-
const
|
|
965
|
-
if (xe(
|
|
966
|
-
const J =
|
|
964
|
+
const T = Array.isArray(k._f.refs) ? k._f.refs[0] : k._f.ref;
|
|
965
|
+
if (xe(T)) {
|
|
966
|
+
const J = T.closest("form");
|
|
967
967
|
if (J) {
|
|
968
968
|
J.reset();
|
|
969
969
|
break;
|
|
@@ -1102,7 +1102,7 @@ var ue = () => {
|
|
|
1102
1102
|
const e = (Math.random() * 16 + t) % 16 | 0;
|
|
1103
1103
|
return (r == "x" ? e : e & 3 | 8).toString(16);
|
|
1104
1104
|
});
|
|
1105
|
-
}, Ne = (t, r, e = {}) => e.shouldFocus ||
|
|
1105
|
+
}, Ne = (t, r, e = {}) => e.shouldFocus || O(e.shouldFocus) ? e.focusName || `${t}.${O(e.focusIndex) ? r : e.focusIndex}.` : "", Le = (t, r) => [
|
|
1106
1106
|
...t,
|
|
1107
1107
|
...z(r)
|
|
1108
1108
|
], Me = (t) => Array.isArray(t) ? t.map(() => {
|
|
@@ -1114,7 +1114,7 @@ function Ie(t, r, e) {
|
|
|
1114
1114
|
...t.slice(r)
|
|
1115
1115
|
];
|
|
1116
1116
|
}
|
|
1117
|
-
var Be = (t, r, e) => Array.isArray(t) ? (
|
|
1117
|
+
var Be = (t, r, e) => Array.isArray(t) ? (O(t[e]) && (t[e] = void 0), t.splice(e, 0, t.splice(r, 1)[0]), t) : [], Pe = (t, r) => [
|
|
1118
1118
|
...z(r),
|
|
1119
1119
|
...z(t)
|
|
1120
1120
|
];
|
|
@@ -1125,7 +1125,7 @@ function vr(t, r) {
|
|
|
1125
1125
|
s.splice(u - e, 1), e++;
|
|
1126
1126
|
return we(s).length ? s : [];
|
|
1127
1127
|
}
|
|
1128
|
-
var We = (t, r) =>
|
|
1128
|
+
var We = (t, r) => O(r) ? [] : vr(t, z(r).sort((e, s) => e - s)), $e = (t, r, e) => {
|
|
1129
1129
|
[t[r], t[e]] = [t[e], t[r]];
|
|
1130
1130
|
}, Ft = (t, r, e) => (t[r] = e, t);
|
|
1131
1131
|
function Vr(t) {
|
|
@@ -1197,7 +1197,7 @@ function Vr(t) {
|
|
|
1197
1197
|
else {
|
|
1198
1198
|
const f = m(e._fields, s);
|
|
1199
1199
|
f && f._f && !(ye(e._options.reValidateMode).isOnSubmit && ye(e._options.mode).isOnSubmit) && Ge(f, e._names.disabled, e._formValues, e._options.criteriaMode === X.all, e._options.shouldUseNativeValidation, !0).then((d) => !q(d) && e._subjects.state.next({
|
|
1200
|
-
errors:
|
|
1200
|
+
errors: Tt(e._formState.errors, d, s)
|
|
1201
1201
|
}));
|
|
1202
1202
|
}
|
|
1203
1203
|
e._subjects.state.next({
|
|
@@ -1295,8 +1295,8 @@ function Fr(t = {}) {
|
|
|
1295
1295
|
i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
1296
1296
|
}), r.current.formState = St(s, i), r.current;
|
|
1297
1297
|
}
|
|
1298
|
-
const
|
|
1299
|
-
const t = zt(
|
|
1298
|
+
const Ot = Gt(void 0), br = ({ showAsterisk: t, children: r }) => /* @__PURE__ */ ee(Ot.Provider, { value: { showAsterisk: t }, children: r }), Ar = () => {
|
|
1299
|
+
const t = zt(Ot);
|
|
1300
1300
|
if (!t)
|
|
1301
1301
|
throw new Error("useSuprFormContext must be used within a SuprFormProvider");
|
|
1302
1302
|
return t;
|
|
@@ -1329,20 +1329,25 @@ function Ut(t, r, e) {
|
|
|
1329
1329
|
return !1;
|
|
1330
1330
|
}
|
|
1331
1331
|
});
|
|
1332
|
-
return
|
|
1332
|
+
return u === "AND" ? c.every(Boolean) : c.some(Boolean);
|
|
1333
1333
|
}
|
|
1334
1334
|
const pr = ({
|
|
1335
1335
|
children: t,
|
|
1336
1336
|
visibility: r
|
|
1337
1337
|
}) => {
|
|
1338
|
-
const e = he(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Je({ name: e });
|
|
1339
|
-
return
|
|
1338
|
+
const e = he(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Je({ name: e }), u = he(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !0 : Ut(e, s, r), [r, e, s]);
|
|
1339
|
+
return console.log(
|
|
1340
|
+
"ConditionChecker - evaluateCondition:",
|
|
1341
|
+
u,
|
|
1342
|
+
"namesToWatch:",
|
|
1343
|
+
e
|
|
1344
|
+
), u ? t : null;
|
|
1340
1345
|
}, xr = ({
|
|
1341
1346
|
children: t,
|
|
1342
1347
|
disabled: r
|
|
1343
1348
|
}) => {
|
|
1344
1349
|
const e = he(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Je({ name: e }), u = he(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !1 : Ut(e, s, r), [r, e, s]);
|
|
1345
|
-
return Ae(t, { ...t.props, disabled: u });
|
|
1350
|
+
return console.log("DisabilityChecker - isDisabled:", u, "namesToWatch:", e), Ae(t, { ...t.props, disabled: u });
|
|
1346
1351
|
}, Nt = ({
|
|
1347
1352
|
children: t,
|
|
1348
1353
|
onSubmit: r = () => {
|