@scbt-ecom/ui 0.68.1 → 0.70.0
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/hooks.js +2 -2
- package/dist/{index-37evuXv8.js → index-Cskajs8e.js} +12945 -11994
- package/dist/index-Cskajs8e.js.map +1 -0
- package/dist/index-lfBvBrWg.js +436 -0
- package/dist/index-lfBvBrWg.js.map +1 -0
- package/dist/shared/ui/formElements/controlled/index.d.ts +1 -1
- package/dist/shared/ui/formElements/controlled/slider/SliderControl.d.ts +4 -3
- package/dist/shared/ui/formElements/uncontrolled/index.d.ts +3 -1
- package/dist/shared/ui/formElements/uncontrolled/slider/SliderBase.d.ts +4 -74
- package/dist/shared/ui/formElements/uncontrolled/slider/model/helpers/dates/getDayIntl.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/model/helpers/dates/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/model/helpers/getInputSliderSuffix.d.ts +2 -2
- package/dist/shared/ui/formElements/uncontrolled/slider/model/types.d.ts +103 -1
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/Slider.d.ts +10 -13
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/SliderAlgorithmic.d.ts +6 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/hooks/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/hooks/useSliderAlgorithmic.d.ts +18 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderMarks/SliderMarks.d.ts +6 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderMarks/hooks/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderMarks/hooks/useSliderMarks.d.ts +10 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderMarks/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderStep/SliderStep.d.ts +7 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderStep/hooks/index.d.ts +1 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderStep/hooks/useSliderStep.d.ts +14 -0
- package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderStep/index.d.ts +1 -0
- package/dist/shared/utils/typeGuards.d.ts +1 -0
- package/dist/shared/validation/base/boolean.validators.d.ts +8 -1
- package/dist/shared/validation/base/date.validators.d.ts +5 -0
- package/dist/shared/validation/base/email.validators.d.ts +5 -0
- package/dist/shared/validation/base/number.validators.d.ts +5 -1
- package/dist/shared/validation/base/phone.validators.d.ts +5 -0
- package/dist/shared/validation/base/select.validators.d.ts +4 -0
- package/dist/shared/validation/base/string.validators.d.ts +4 -0
- package/dist/shared/validation/base/url.validators.d.ts +4 -0
- package/dist/{typeGuards-Bhdr9KYW.js → typeGuards-CSiImkUY.js} +34 -31
- package/dist/{typeGuards-Bhdr9KYW.js.map → typeGuards-CSiImkUY.js.map} +1 -1
- package/dist/ui.js +5 -5
- package/dist/{useDebounce-BZSs8EPD.js → useDebounce-MaKPBuaC.js} +282 -290
- package/dist/useDebounce-MaKPBuaC.js.map +1 -0
- package/dist/{useFieldsProgress-B_tgt_Hg.js → useFieldsProgress-CeEaFp3Q.js} +2 -2
- package/dist/{useFieldsProgress-B_tgt_Hg.js.map → useFieldsProgress-CeEaFp3Q.js.map} +1 -1
- package/dist/{utils-DaXd4sci.js → utils-k3uzuyeN.js} +6 -4
- package/dist/utils-k3uzuyeN.js.map +1 -0
- package/dist/utils.js +55 -12
- package/dist/utils.js.map +1 -1
- package/dist/validation.js +2 -2
- package/dist/widget.js +289 -285
- package/dist/widget.js.map +1 -1
- package/dist/widgets/buttonWithHandlers/ButtonWithHandlers.d.ts +1 -1
- package/dist/widgets/calculator/model/helpers.d.ts +2 -2
- package/dist/widgets/calculator/model/utils.d.ts +2 -0
- package/dist/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoBody.d.ts +2 -2
- package/dist/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoFooter.d.ts +7 -2
- package/dist/widgets/calculator/ui/calculatorInfo/ui/InfoListItem.d.ts +6 -4
- package/package.json +5 -5
- package/dist/index-37evuXv8.js.map +0 -1
- package/dist/index-cm9kMt4X.js +0 -435
- package/dist/index-cm9kMt4X.js.map +0 -1
- package/dist/shared/ui/formElements/uncontrolled/slider/model/useSlider.d.ts +0 -17
- package/dist/useDebounce-BZSs8EPD.js.map +0 -1
- package/dist/utils-DaXd4sci.js.map +0 -1
- package/dist/uuid-2wKG15vy.js +0 -25
- package/dist/uuid-2wKG15vy.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as ie from "react";
|
|
2
|
-
import
|
|
2
|
+
import w, { useCallback as $e, useSyncExternalStore as ze } from "react";
|
|
3
3
|
import { i as Ot } from "./isClient-C9aZtt2Q.js";
|
|
4
|
-
const
|
|
5
|
-
const e = "(max-width: 1187px)", r = "(min-width: 1188px)", t =
|
|
4
|
+
const Ge = () => !1, or = () => {
|
|
5
|
+
const e = "(max-width: 1187px)", r = "(min-width: 1188px)", t = $e(
|
|
6
6
|
(u) => {
|
|
7
7
|
const d = globalThis.matchMedia(e);
|
|
8
8
|
return d.addEventListener("change", u), () => {
|
|
@@ -10,7 +10,7 @@ const ze = () => !1, lr = () => {
|
|
|
10
10
|
};
|
|
11
11
|
},
|
|
12
12
|
[e]
|
|
13
|
-
), i =
|
|
13
|
+
), i = $e(
|
|
14
14
|
(u) => {
|
|
15
15
|
const d = globalThis.matchMedia(r);
|
|
16
16
|
return d.addEventListener("change", u), () => {
|
|
@@ -20,10 +20,10 @@ const ze = () => !1, lr = () => {
|
|
|
20
20
|
[r]
|
|
21
21
|
), a = () => globalThis.matchMedia(e).matches, o = () => globalThis.matchMedia(r).matches;
|
|
22
22
|
return {
|
|
23
|
-
isMobile:
|
|
24
|
-
isDesktop:
|
|
23
|
+
isMobile: ze(t, a, Ge),
|
|
24
|
+
isDesktop: ze(i, o, Ge)
|
|
25
25
|
};
|
|
26
|
-
},
|
|
26
|
+
}, lr = (e, r) => {
|
|
27
27
|
const t = (i) => {
|
|
28
28
|
e.current && !e.current.contains(i.target) && r();
|
|
29
29
|
};
|
|
@@ -35,9 +35,9 @@ const ze = () => !1, lr = () => {
|
|
|
35
35
|
};
|
|
36
36
|
}, [e, r]);
|
|
37
37
|
};
|
|
38
|
-
var ye = (e) => e.type === "checkbox", se = (e) => e instanceof Date,
|
|
39
|
-
const
|
|
40
|
-
var C = (e) => !
|
|
38
|
+
var ye = (e) => e.type === "checkbox", se = (e) => e instanceof Date, B = (e) => e == null;
|
|
39
|
+
const lt = (e) => typeof e == "object";
|
|
40
|
+
var C = (e) => !B(e) && !Array.isArray(e) && lt(e) && !se(e), ut = (e) => C(e) && e.target ? ye(e.target) ? e.target.checked : e.target.value : e, Rt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ct = (e, r) => e.has(Rt(r)), Ut = (e) => {
|
|
41
41
|
const r = e.constructor && e.constructor.prototype;
|
|
42
42
|
return C(r) && r.hasOwnProperty("isPrototypeOf");
|
|
43
43
|
}, Ce = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -61,11 +61,11 @@ function R(e) {
|
|
|
61
61
|
var Ve = (e) => Array.isArray(e) ? e.filter(Boolean) : [], k = (e) => e === void 0, y = (e, r, t) => {
|
|
62
62
|
if (!r || !C(e))
|
|
63
63
|
return t;
|
|
64
|
-
const i = Ve(r.split(/[,[\].]+?/)).reduce((a, o) =>
|
|
64
|
+
const i = Ve(r.split(/[,[\].]+?/)).reduce((a, o) => B(a) ? a : a[o], e);
|
|
65
65
|
return k(i) || i === e ? k(e[r]) ? t : e[r] : i;
|
|
66
|
-
}, W = (e) => typeof e == "boolean", Te = (e) => /^\w*$/.test(e),
|
|
66
|
+
}, W = (e) => typeof e == "boolean", Te = (e) => /^\w*$/.test(e), dt = (e) => Ve(e.replace(/["|']|\]/g, "").split(/\.|\[/)), x = (e, r, t) => {
|
|
67
67
|
let i = -1;
|
|
68
|
-
const a = Te(r) ? [r] :
|
|
68
|
+
const a = Te(r) ? [r] : dt(r), o = a.length, u = o - 1;
|
|
69
69
|
for (; ++i < o; ) {
|
|
70
70
|
const d = a[i];
|
|
71
71
|
let b = t;
|
|
@@ -96,11 +96,11 @@ const ve = {
|
|
|
96
96
|
pattern: "pattern",
|
|
97
97
|
required: "required",
|
|
98
98
|
validate: "validate"
|
|
99
|
-
},
|
|
99
|
+
}, ft = w.createContext(null), Me = () => w.useContext(ft), ur = (e) => {
|
|
100
100
|
const { children: r, ...t } = e;
|
|
101
|
-
return
|
|
101
|
+
return w.createElement(ft.Provider, { value: t }, r);
|
|
102
102
|
};
|
|
103
|
-
var
|
|
103
|
+
var yt = (e, r, t, i = !0) => {
|
|
104
104
|
const a = {
|
|
105
105
|
defaultValues: r._defaultValues
|
|
106
106
|
};
|
|
@@ -112,33 +112,10 @@ var ft = (e, r, t, i = !0) => {
|
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
return a;
|
|
115
|
-
}, ke = (e) => p(e) || !ot(e);
|
|
116
|
-
function Z(e, r) {
|
|
117
|
-
if (ke(e) || ke(r))
|
|
118
|
-
return e === r;
|
|
119
|
-
if (se(e) && se(r))
|
|
120
|
-
return e.getTime() === r.getTime();
|
|
121
|
-
const t = Object.keys(e), i = Object.keys(r);
|
|
122
|
-
if (t.length !== i.length)
|
|
123
|
-
return !1;
|
|
124
|
-
for (const a of t) {
|
|
125
|
-
const o = e[a];
|
|
126
|
-
if (!i.includes(a))
|
|
127
|
-
return !1;
|
|
128
|
-
if (a !== "ref") {
|
|
129
|
-
const u = r[a];
|
|
130
|
-
if (se(o) && se(u) || C(o) && C(u) || Array.isArray(o) && Array.isArray(u) ? !Z(o, u) : o !== u)
|
|
131
|
-
return !1;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return !0;
|
|
135
|
-
}
|
|
136
|
-
const yt = (e, r) => {
|
|
137
|
-
const t = ie.useRef(r);
|
|
138
|
-
Z(r, t.current) || (t.current = r), ie.useEffect(e, t.current);
|
|
139
115
|
};
|
|
116
|
+
const Le = typeof window < "u" ? ie.useLayoutEffect : ie.useEffect;
|
|
140
117
|
function Nt(e) {
|
|
141
|
-
const r = Me(), { control: t = r.control, disabled: i, name: a, exact: o } = e || {}, [u, d] =
|
|
118
|
+
const r = Me(), { control: t = r.control, disabled: i, name: a, exact: o } = e || {}, [u, d] = w.useState(t._formState), b = w.useRef({
|
|
142
119
|
isDirty: !1,
|
|
143
120
|
isLoading: !1,
|
|
144
121
|
dirtyFields: !1,
|
|
@@ -148,7 +125,7 @@ function Nt(e) {
|
|
|
148
125
|
isValid: !1,
|
|
149
126
|
errors: !1
|
|
150
127
|
});
|
|
151
|
-
return
|
|
128
|
+
return Le(() => t._subscribe({
|
|
152
129
|
name: a,
|
|
153
130
|
formState: b.current,
|
|
154
131
|
exact: o,
|
|
@@ -158,24 +135,24 @@ function Nt(e) {
|
|
|
158
135
|
...D
|
|
159
136
|
});
|
|
160
137
|
}
|
|
161
|
-
}), [a, i, o]),
|
|
138
|
+
}), [a, i, o]), w.useEffect(() => {
|
|
162
139
|
b.current.isValid && t._setValid(!0);
|
|
163
|
-
}, [t]),
|
|
140
|
+
}, [t]), w.useMemo(() => yt(u, t, b.current, !1), [u, t]);
|
|
164
141
|
}
|
|
165
142
|
var Y = (e) => typeof e == "string", ht = (e, r, t, i, a) => Y(e) ? (i && r.watch.add(e), y(t, e, a)) : Array.isArray(e) ? e.map((o) => (i && r.watch.add(o), y(t, o))) : (i && (r.watchAll = !0), t);
|
|
166
143
|
function Pt(e) {
|
|
167
|
-
const r = Me(), { control: t = r.control, name: i, defaultValue: a, disabled: o, exact: u } = e || {},
|
|
168
|
-
return
|
|
144
|
+
const r = Me(), { control: t = r.control, name: i, defaultValue: a, disabled: o, exact: u } = e || {}, d = w.useRef(a), [b, D] = w.useState(t._getWatch(i, d.current));
|
|
145
|
+
return Le(() => t._subscribe({
|
|
169
146
|
name: i,
|
|
170
147
|
formState: {
|
|
171
148
|
values: !0
|
|
172
149
|
},
|
|
173
150
|
exact: u,
|
|
174
|
-
callback: (
|
|
175
|
-
}), [i,
|
|
151
|
+
callback: (F) => !o && D(ht(i, t._names, F.values || t._formValues, !1, d.current))
|
|
152
|
+
}), [i, t, o, u]), w.useEffect(() => t._removeUnmounted()), b;
|
|
176
153
|
}
|
|
177
|
-
function
|
|
178
|
-
const r = Me(), { name: t, disabled: i, control: a = r.control, shouldUnregister: o } = e, u =
|
|
154
|
+
function cr(e) {
|
|
155
|
+
const r = Me(), { name: t, disabled: i, control: a = r.control, shouldUnregister: o } = e, u = ct(a._names.array, t), d = Pt({
|
|
179
156
|
control: a,
|
|
180
157
|
name: t,
|
|
181
158
|
defaultValue: y(a._formValues, t, y(a._defaultValues, t, e.defaultValue)),
|
|
@@ -184,11 +161,11 @@ function dr(e) {
|
|
|
184
161
|
control: a,
|
|
185
162
|
name: t,
|
|
186
163
|
exact: !0
|
|
187
|
-
}), D =
|
|
164
|
+
}), D = w.useRef(e), F = w.useRef(a.register(t, {
|
|
188
165
|
...e.rules,
|
|
189
166
|
value: d,
|
|
190
167
|
...W(e.disabled) ? { disabled: e.disabled } : {}
|
|
191
|
-
})),
|
|
168
|
+
})), E = w.useMemo(() => Object.defineProperties({}, {
|
|
192
169
|
invalid: {
|
|
193
170
|
enumerable: !0,
|
|
194
171
|
get: () => !!y(b.errors, t)
|
|
@@ -209,27 +186,22 @@ function dr(e) {
|
|
|
209
186
|
enumerable: !0,
|
|
210
187
|
get: () => y(b.errors, t)
|
|
211
188
|
}
|
|
212
|
-
}), [b, t]), m =
|
|
189
|
+
}), [b, t]), m = w.useCallback((q) => F.current.onChange({
|
|
213
190
|
target: {
|
|
214
|
-
value:
|
|
191
|
+
value: ut(q),
|
|
215
192
|
name: t
|
|
216
193
|
},
|
|
217
194
|
type: ve.CHANGE
|
|
218
|
-
}), [t]), te =
|
|
195
|
+
}), [t]), te = w.useCallback(() => F.current.onBlur({
|
|
219
196
|
target: {
|
|
220
197
|
value: y(a._formValues, t),
|
|
221
198
|
name: t
|
|
222
199
|
},
|
|
223
200
|
type: ve.BLUR
|
|
224
|
-
}), [t, a._formValues]), j =
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
select: () => N.select(),
|
|
229
|
-
setCustomValidity: (v) => N.setCustomValidity(v),
|
|
230
|
-
reportValidity: () => N.reportValidity()
|
|
231
|
-
});
|
|
232
|
-
}, [a._fields, t]), O = x.useMemo(() => ({
|
|
201
|
+
}), [t, a._formValues]), j = w.useCallback((q) => {
|
|
202
|
+
const N = y(a._fields, t);
|
|
203
|
+
N && q && (N._f.ref = q);
|
|
204
|
+
}, [a._fields, t]), O = w.useMemo(() => ({
|
|
233
205
|
name: t,
|
|
234
206
|
value: d,
|
|
235
207
|
...W(i) || b.disabled ? { disabled: b.disabled || i } : {},
|
|
@@ -237,33 +209,33 @@ function dr(e) {
|
|
|
237
209
|
onBlur: te,
|
|
238
210
|
ref: j
|
|
239
211
|
}), [t, i, b.disabled, m, te, j, d]);
|
|
240
|
-
return
|
|
241
|
-
const
|
|
212
|
+
return w.useEffect(() => {
|
|
213
|
+
const q = a._options.shouldUnregister || o;
|
|
242
214
|
a.register(t, {
|
|
243
215
|
...D.current.rules,
|
|
244
216
|
...W(D.current.disabled) ? { disabled: D.current.disabled } : {}
|
|
245
217
|
});
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
|
|
218
|
+
const N = (v, K) => {
|
|
219
|
+
const p = y(a._fields, v);
|
|
220
|
+
p && p._f && (p._f.mount = K);
|
|
249
221
|
};
|
|
250
|
-
if (
|
|
222
|
+
if (N(t, !0), q) {
|
|
251
223
|
const v = R(y(a._options.defaultValues, t));
|
|
252
|
-
|
|
224
|
+
x(a._defaultValues, t, v), k(y(a._formValues, t)) && x(a._formValues, t, v);
|
|
253
225
|
}
|
|
254
226
|
return !u && a.register(t), () => {
|
|
255
|
-
(u ?
|
|
227
|
+
(u ? q && !a._state.action : q) ? a.unregister(t) : N(t, !1);
|
|
256
228
|
};
|
|
257
|
-
}, [t, a, u, o]),
|
|
229
|
+
}, [t, a, u, o]), w.useEffect(() => {
|
|
258
230
|
a._setDisabledField({
|
|
259
231
|
disabled: i,
|
|
260
232
|
name: t
|
|
261
233
|
});
|
|
262
|
-
}, [i, t, a]),
|
|
234
|
+
}, [i, t, a]), w.useMemo(() => ({
|
|
263
235
|
field: O,
|
|
264
236
|
formState: b,
|
|
265
|
-
fieldState:
|
|
266
|
-
}), [O, b,
|
|
237
|
+
fieldState: E
|
|
238
|
+
}), [O, b, E]);
|
|
267
239
|
}
|
|
268
240
|
var gt = (e, r, t, i, a) => r ? {
|
|
269
241
|
...t[e],
|
|
@@ -271,7 +243,7 @@ var gt = (e, r, t, i, a) => r ? {
|
|
|
271
243
|
...t[e] && t[e].types ? t[e].types : {},
|
|
272
244
|
[i]: a || !0
|
|
273
245
|
}
|
|
274
|
-
} : {}, de = (e) => Array.isArray(e) ? e : [e],
|
|
246
|
+
} : {}, de = (e) => Array.isArray(e) ? e : [e], Ye = () => {
|
|
275
247
|
let e = [];
|
|
276
248
|
return {
|
|
277
249
|
get observers() {
|
|
@@ -290,28 +262,49 @@ var gt = (e, r, t, i, a) => r ? {
|
|
|
290
262
|
e = [];
|
|
291
263
|
}
|
|
292
264
|
};
|
|
293
|
-
},
|
|
265
|
+
}, ke = (e) => B(e) || !lt(e);
|
|
266
|
+
function ee(e, r) {
|
|
267
|
+
if (ke(e) || ke(r))
|
|
268
|
+
return e === r;
|
|
269
|
+
if (se(e) && se(r))
|
|
270
|
+
return e.getTime() === r.getTime();
|
|
271
|
+
const t = Object.keys(e), i = Object.keys(r);
|
|
272
|
+
if (t.length !== i.length)
|
|
273
|
+
return !1;
|
|
274
|
+
for (const a of t) {
|
|
275
|
+
const o = e[a];
|
|
276
|
+
if (!i.includes(a))
|
|
277
|
+
return !1;
|
|
278
|
+
if (a !== "ref") {
|
|
279
|
+
const u = r[a];
|
|
280
|
+
if (se(o) && se(u) || C(o) && C(u) || Array.isArray(o) && Array.isArray(u) ? !ee(o, u) : o !== u)
|
|
281
|
+
return !1;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return !0;
|
|
285
|
+
}
|
|
286
|
+
var P = (e) => C(e) && !Object.keys(e).length, Oe = (e) => e.type === "file", $ = (e) => typeof e == "function", be = (e) => {
|
|
294
287
|
if (!Ce)
|
|
295
288
|
return !1;
|
|
296
289
|
const r = e ? e.ownerDocument : 0;
|
|
297
290
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
298
|
-
}, vt = (e) => e.type === "select-multiple",
|
|
299
|
-
function
|
|
291
|
+
}, vt = (e) => e.type === "select-multiple", Re = (e) => e.type === "radio", Bt = (e) => Re(e) || ye(e), Se = (e) => be(e) && e.isConnected;
|
|
292
|
+
function It(e, r) {
|
|
300
293
|
const t = r.slice(0, -1).length;
|
|
301
294
|
let i = 0;
|
|
302
295
|
for (; i < t; )
|
|
303
296
|
e = k(e) ? i++ : e[r[i++]];
|
|
304
297
|
return e;
|
|
305
298
|
}
|
|
306
|
-
function
|
|
299
|
+
function pt(e) {
|
|
307
300
|
for (const r in e)
|
|
308
301
|
if (e.hasOwnProperty(r) && !k(e[r]))
|
|
309
302
|
return !1;
|
|
310
303
|
return !0;
|
|
311
304
|
}
|
|
312
305
|
function M(e, r) {
|
|
313
|
-
const t = Array.isArray(r) ? r : Te(r) ? [r] :
|
|
314
|
-
return i && delete i[o], a !== 0 && (C(i) &&
|
|
306
|
+
const t = Array.isArray(r) ? r : Te(r) ? [r] : dt(r), i = t.length === 1 ? e : It(e, t), a = t.length - 1, o = t[a];
|
|
307
|
+
return i && delete i[o], a !== 0 && (C(i) && P(i) || Array.isArray(i) && pt(i)) && M(e, t.slice(0, -1)), e;
|
|
315
308
|
}
|
|
316
309
|
var bt = (e) => {
|
|
317
310
|
for (const r in e)
|
|
@@ -323,21 +316,21 @@ function me(e, r = {}) {
|
|
|
323
316
|
const t = Array.isArray(e);
|
|
324
317
|
if (C(e) || t)
|
|
325
318
|
for (const i in e)
|
|
326
|
-
Array.isArray(e[i]) || C(e[i]) && !bt(e[i]) ? (r[i] = Array.isArray(e[i]) ? [] : {}, me(e[i], r[i])) :
|
|
319
|
+
Array.isArray(e[i]) || C(e[i]) && !bt(e[i]) ? (r[i] = Array.isArray(e[i]) ? [] : {}, me(e[i], r[i])) : B(e[i]) || (r[i] = !0);
|
|
327
320
|
return r;
|
|
328
321
|
}
|
|
329
322
|
function mt(e, r, t) {
|
|
330
323
|
const i = Array.isArray(e);
|
|
331
324
|
if (C(e) || i)
|
|
332
325
|
for (const a in e)
|
|
333
|
-
Array.isArray(e[a]) || C(e[a]) && !bt(e[a]) ? k(r) || ke(t[a]) ? t[a] = Array.isArray(e[a]) ? me(e[a], []) : { ...me(e[a]) } : mt(e[a],
|
|
326
|
+
Array.isArray(e[a]) || C(e[a]) && !bt(e[a]) ? k(r) || ke(t[a]) ? t[a] = Array.isArray(e[a]) ? me(e[a], []) : { ...me(e[a]) } : mt(e[a], B(r) ? {} : r[a], t[a]) : t[a] = !ee(e[a], r[a]);
|
|
334
327
|
return t;
|
|
335
328
|
}
|
|
336
329
|
var ue = (e, r) => mt(e, r, me(r));
|
|
337
|
-
const
|
|
330
|
+
const Je = {
|
|
338
331
|
value: !1,
|
|
339
332
|
isValid: !1
|
|
340
|
-
},
|
|
333
|
+
}, Xe = { value: !0, isValid: !0 };
|
|
341
334
|
var _t = (e) => {
|
|
342
335
|
if (Array.isArray(e)) {
|
|
343
336
|
if (e.length > 1) {
|
|
@@ -346,28 +339,28 @@ var _t = (e) => {
|
|
|
346
339
|
}
|
|
347
340
|
return e[0].checked && !e[0].disabled ? (
|
|
348
341
|
// @ts-expect-error expected to work in the browser
|
|
349
|
-
e[0].attributes && !k(e[0].attributes.value) ? k(e[0].value) || e[0].value === "" ?
|
|
350
|
-
) :
|
|
342
|
+
e[0].attributes && !k(e[0].attributes.value) ? k(e[0].value) || e[0].value === "" ? Xe : { value: e[0].value, isValid: !0 } : Xe
|
|
343
|
+
) : Je;
|
|
351
344
|
}
|
|
352
|
-
return
|
|
345
|
+
return Je;
|
|
353
346
|
}, Vt = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: i }) => k(e) ? e : r ? e === "" ? NaN : e && +e : t && Y(e) ? new Date(e) : i ? i(e) : e;
|
|
354
|
-
const
|
|
347
|
+
const Ze = {
|
|
355
348
|
isValid: !1,
|
|
356
349
|
value: null
|
|
357
350
|
};
|
|
358
351
|
var Ft = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
359
352
|
isValid: !0,
|
|
360
353
|
value: t.value
|
|
361
|
-
} : r,
|
|
362
|
-
function
|
|
354
|
+
} : r, Ze) : Ze;
|
|
355
|
+
function et(e) {
|
|
363
356
|
const r = e.ref;
|
|
364
|
-
return
|
|
357
|
+
return Oe(r) ? r.files : Re(r) ? Ft(e.refs).value : vt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : ye(r) ? _t(e.refs).value : Vt(k(r.value) ? e.ref.value : r.value, e);
|
|
365
358
|
}
|
|
366
|
-
var
|
|
359
|
+
var Wt = (e, r, t, i) => {
|
|
367
360
|
const a = {};
|
|
368
361
|
for (const o of e) {
|
|
369
362
|
const u = y(r, o);
|
|
370
|
-
u &&
|
|
363
|
+
u && x(a, o, u._f);
|
|
371
364
|
}
|
|
372
365
|
return {
|
|
373
366
|
criteriaMode: t,
|
|
@@ -375,15 +368,15 @@ var qt = (e, r, t, i) => {
|
|
|
375
368
|
fields: a,
|
|
376
369
|
shouldUseNativeValidation: i
|
|
377
370
|
};
|
|
378
|
-
}, _e = (e) => e instanceof RegExp, ce = (e) => k(e) ? e : _e(e) ? e.source : C(e) ? _e(e.value) ? e.value.source : e.value : e,
|
|
371
|
+
}, _e = (e) => e instanceof RegExp, ce = (e) => k(e) ? e : _e(e) ? e.source : C(e) ? _e(e.value) ? e.value.source : e.value : e, tt = (e) => ({
|
|
379
372
|
isOnSubmit: !e || e === Q.onSubmit,
|
|
380
373
|
isOnBlur: e === Q.onBlur,
|
|
381
374
|
isOnChange: e === Q.onChange,
|
|
382
375
|
isOnAll: e === Q.all,
|
|
383
376
|
isOnTouch: e === Q.onTouched
|
|
384
377
|
});
|
|
385
|
-
const
|
|
386
|
-
var
|
|
378
|
+
const rt = "AsyncFunction";
|
|
379
|
+
var qt = (e) => !!e && !!e.validate && !!($(e.validate) && e.validate.constructor.name === rt || C(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === rt)), Ht = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), st = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
|
|
387
380
|
const fe = (e, r, t, i) => {
|
|
388
381
|
for (const a of t || Object.keys(e)) {
|
|
389
382
|
const o = y(e, a);
|
|
@@ -401,7 +394,7 @@ const fe = (e, r, t, i) => {
|
|
|
401
394
|
}
|
|
402
395
|
}
|
|
403
396
|
};
|
|
404
|
-
function
|
|
397
|
+
function it(e, r, t) {
|
|
405
398
|
const i = y(e, t);
|
|
406
399
|
if (i || Te(t))
|
|
407
400
|
return {
|
|
@@ -427,12 +420,12 @@ function st(e, r, t) {
|
|
|
427
420
|
var jt = (e, r, t, i) => {
|
|
428
421
|
t(e);
|
|
429
422
|
const { name: a, ...o } = e;
|
|
430
|
-
return
|
|
423
|
+
return P(o) || Object.keys(o).length >= Object.keys(r).length || Object.keys(o).find((u) => r[u] === (!i || Q.all));
|
|
431
424
|
}, Kt = (e, r, t) => !e || !r || e === r || de(e).some((i) => i && (t ? i === r : i.startsWith(r) || r.startsWith(i))), Qt = (e, r, t, i, a) => a.isOnAll ? !1 : !t && a.isOnTouch ? !(r || e) : (t ? i.isOnBlur : a.isOnBlur) ? !e : (t ? i.isOnChange : a.isOnChange) ? e : !0, $t = (e, r) => !Ve(y(e, r)).length && M(e, r), zt = (e, r, t) => {
|
|
432
425
|
const i = de(y(e, t));
|
|
433
|
-
return
|
|
426
|
+
return x(i, "root", r[t]), x(e, t, i), e;
|
|
434
427
|
}, ge = (e) => Y(e);
|
|
435
|
-
function
|
|
428
|
+
function nt(e, r, t = "validate") {
|
|
436
429
|
if (ge(e) || Array.isArray(e) && e.every(ge) || W(e) && !e)
|
|
437
430
|
return {
|
|
438
431
|
type: t,
|
|
@@ -443,86 +436,86 @@ function it(e, r, t = "validate") {
|
|
|
443
436
|
var ne = (e) => C(e) && !_e(e) ? e : {
|
|
444
437
|
value: e,
|
|
445
438
|
message: ""
|
|
446
|
-
},
|
|
447
|
-
const { ref: u, refs: d, required: b, maxLength: D, minLength:
|
|
448
|
-
if (!
|
|
439
|
+
}, at = async (e, r, t, i, a, o) => {
|
|
440
|
+
const { ref: u, refs: d, required: b, maxLength: D, minLength: F, min: E, max: m, pattern: te, validate: j, name: O, valueAsNumber: q, mount: N } = e._f, v = y(t, O);
|
|
441
|
+
if (!N || r.has(O))
|
|
449
442
|
return {};
|
|
450
|
-
const K = d ? d[0] : u,
|
|
451
|
-
a && K.reportValidity && (K.setCustomValidity(W(
|
|
452
|
-
}, L = {}, ae =
|
|
453
|
-
const G =
|
|
443
|
+
const K = d ? d[0] : u, p = (A) => {
|
|
444
|
+
a && K.reportValidity && (K.setCustomValidity(W(A) ? "" : A || ""), K.reportValidity());
|
|
445
|
+
}, L = {}, ae = Re(u), oe = ye(u), Fe = ae || oe, z = (q || Oe(u)) && k(u.value) && k(v) || be(u) && u.value === "" || v === "" || Array.isArray(v) && !v.length, re = gt.bind(null, O, i, L), J = (A, _, S, I = X.maxLength, H = X.minLength) => {
|
|
446
|
+
const G = A ? _ : S;
|
|
454
447
|
L[O] = {
|
|
455
|
-
type:
|
|
448
|
+
type: A ? I : H,
|
|
456
449
|
message: G,
|
|
457
450
|
ref: u,
|
|
458
|
-
...re(
|
|
451
|
+
...re(A ? I : H, G)
|
|
459
452
|
};
|
|
460
453
|
};
|
|
461
|
-
if (o ? !Array.isArray(v) || !v.length : b && (!Fe && (z ||
|
|
462
|
-
const { value:
|
|
463
|
-
if (
|
|
454
|
+
if (o ? !Array.isArray(v) || !v.length : b && (!Fe && (z || B(v)) || W(v) && !v || oe && !_t(d).isValid || ae && !Ft(d).isValid)) {
|
|
455
|
+
const { value: A, message: _ } = ge(b) ? { value: !!b, message: b } : ne(b);
|
|
456
|
+
if (A && (L[O] = {
|
|
464
457
|
type: X.required,
|
|
465
458
|
message: _,
|
|
466
459
|
ref: K,
|
|
467
460
|
...re(X.required, _)
|
|
468
461
|
}, !i))
|
|
469
|
-
return
|
|
462
|
+
return p(_), L;
|
|
470
463
|
}
|
|
471
|
-
if (!z && (!
|
|
472
|
-
let
|
|
473
|
-
const S = ne(m), I = ne(
|
|
474
|
-
if (!
|
|
464
|
+
if (!z && (!B(E) || !B(m))) {
|
|
465
|
+
let A, _;
|
|
466
|
+
const S = ne(m), I = ne(E);
|
|
467
|
+
if (!B(v) && !isNaN(v)) {
|
|
475
468
|
const H = u.valueAsNumber || v && +v;
|
|
476
|
-
|
|
469
|
+
B(S.value) || (A = H > S.value), B(I.value) || (_ = H < I.value);
|
|
477
470
|
} else {
|
|
478
|
-
const H = u.valueAsDate || new Date(v), G = (he) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + he),
|
|
479
|
-
Y(S.value) && v && (
|
|
471
|
+
const H = u.valueAsDate || new Date(v), G = (he) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + he), Z = u.type == "time", le = u.type == "week";
|
|
472
|
+
Y(S.value) && v && (A = Z ? G(v) > G(S.value) : le ? v > S.value : H > new Date(S.value)), Y(I.value) && v && (_ = Z ? G(v) < G(I.value) : le ? v < I.value : H < new Date(I.value));
|
|
480
473
|
}
|
|
481
|
-
if ((
|
|
482
|
-
return
|
|
474
|
+
if ((A || _) && (J(!!A, S.message, I.message, X.max, X.min), !i))
|
|
475
|
+
return p(L[O].message), L;
|
|
483
476
|
}
|
|
484
|
-
if ((D ||
|
|
485
|
-
const
|
|
486
|
-
if ((S || I) && (J(S,
|
|
487
|
-
return
|
|
477
|
+
if ((D || F) && !z && (Y(v) || o && Array.isArray(v))) {
|
|
478
|
+
const A = ne(D), _ = ne(F), S = !B(A.value) && v.length > +A.value, I = !B(_.value) && v.length < +_.value;
|
|
479
|
+
if ((S || I) && (J(S, A.message, _.message), !i))
|
|
480
|
+
return p(L[O].message), L;
|
|
488
481
|
}
|
|
489
482
|
if (te && !z && Y(v)) {
|
|
490
|
-
const { value:
|
|
491
|
-
if (_e(
|
|
483
|
+
const { value: A, message: _ } = ne(te);
|
|
484
|
+
if (_e(A) && !v.match(A) && (L[O] = {
|
|
492
485
|
type: X.pattern,
|
|
493
486
|
message: _,
|
|
494
487
|
ref: u,
|
|
495
488
|
...re(X.pattern, _)
|
|
496
489
|
}, !i))
|
|
497
|
-
return
|
|
490
|
+
return p(_), L;
|
|
498
491
|
}
|
|
499
492
|
if (j) {
|
|
500
493
|
if ($(j)) {
|
|
501
|
-
const
|
|
494
|
+
const A = await j(v, t), _ = nt(A, K);
|
|
502
495
|
if (_ && (L[O] = {
|
|
503
496
|
..._,
|
|
504
497
|
...re(X.validate, _.message)
|
|
505
498
|
}, !i))
|
|
506
|
-
return
|
|
499
|
+
return p(_.message), L;
|
|
507
500
|
} else if (C(j)) {
|
|
508
|
-
let
|
|
501
|
+
let A = {};
|
|
509
502
|
for (const _ in j) {
|
|
510
|
-
if (!
|
|
503
|
+
if (!P(A) && !i)
|
|
511
504
|
break;
|
|
512
|
-
const S =
|
|
513
|
-
S && (
|
|
505
|
+
const S = nt(await j[_](v, t), K, _);
|
|
506
|
+
S && (A = {
|
|
514
507
|
...S,
|
|
515
508
|
...re(_, S.message)
|
|
516
|
-
},
|
|
509
|
+
}, p(S.message), i && (L[O] = A));
|
|
517
510
|
}
|
|
518
|
-
if (!
|
|
511
|
+
if (!P(A) && (L[O] = {
|
|
519
512
|
ref: K,
|
|
520
|
-
...
|
|
513
|
+
...A
|
|
521
514
|
}, !i))
|
|
522
515
|
return L;
|
|
523
516
|
}
|
|
524
517
|
}
|
|
525
|
-
return
|
|
518
|
+
return p(!0), L;
|
|
526
519
|
};
|
|
527
520
|
const Gt = {
|
|
528
521
|
mode: Q.onSubmit,
|
|
@@ -550,7 +543,7 @@ function Yt(e = {}) {
|
|
|
550
543
|
disabled: r.disabled || !1
|
|
551
544
|
};
|
|
552
545
|
const i = {};
|
|
553
|
-
let a = C(r.defaultValues) || C(r.values) ? R(r.
|
|
546
|
+
let a = C(r.defaultValues) || C(r.values) ? R(r.defaultValues || r.values) || {} : {}, o = r.shouldUnregister ? {} : R(a), u = {
|
|
554
547
|
action: !1,
|
|
555
548
|
mount: !1,
|
|
556
549
|
watch: !1
|
|
@@ -561,7 +554,7 @@ function Yt(e = {}) {
|
|
|
561
554
|
array: /* @__PURE__ */ new Set(),
|
|
562
555
|
watch: /* @__PURE__ */ new Set()
|
|
563
556
|
}, b, D = 0;
|
|
564
|
-
const
|
|
557
|
+
const F = {
|
|
565
558
|
isDirty: !1,
|
|
566
559
|
dirtyFields: !1,
|
|
567
560
|
validatingFields: !1,
|
|
@@ -570,43 +563,43 @@ function Yt(e = {}) {
|
|
|
570
563
|
isValid: !1,
|
|
571
564
|
errors: !1
|
|
572
565
|
};
|
|
573
|
-
let
|
|
574
|
-
...
|
|
566
|
+
let E = {
|
|
567
|
+
...F
|
|
575
568
|
};
|
|
576
569
|
const m = {
|
|
577
|
-
array:
|
|
578
|
-
state:
|
|
579
|
-
}, te =
|
|
570
|
+
array: Ye(),
|
|
571
|
+
state: Ye()
|
|
572
|
+
}, te = tt(r.mode), j = tt(r.reValidateMode), O = r.criteriaMode === Q.all, q = (s) => (n) => {
|
|
580
573
|
clearTimeout(D), D = setTimeout(s, n);
|
|
581
|
-
},
|
|
582
|
-
if (!r.disabled && (
|
|
583
|
-
const n = r.resolver ?
|
|
574
|
+
}, N = async (s) => {
|
|
575
|
+
if (!r.disabled && (F.isValid || E.isValid || s)) {
|
|
576
|
+
const n = r.resolver ? P((await z()).errors) : await J(i, !0);
|
|
584
577
|
n !== t.isValid && m.state.next({
|
|
585
578
|
isValid: n
|
|
586
579
|
});
|
|
587
580
|
}
|
|
588
581
|
}, v = (s, n) => {
|
|
589
|
-
!r.disabled && (
|
|
590
|
-
l && (n ?
|
|
582
|
+
!r.disabled && (F.isValidating || F.validatingFields || E.isValidating || E.validatingFields) && ((s || Array.from(d.mount)).forEach((l) => {
|
|
583
|
+
l && (n ? x(t.validatingFields, l, n) : M(t.validatingFields, l));
|
|
591
584
|
}), m.state.next({
|
|
592
585
|
validatingFields: t.validatingFields,
|
|
593
|
-
isValidating: !
|
|
586
|
+
isValidating: !P(t.validatingFields)
|
|
594
587
|
}));
|
|
595
588
|
}, K = (s, n = [], l, h, f = !0, c = !0) => {
|
|
596
589
|
if (h && l && !r.disabled) {
|
|
597
590
|
if (u.action = !0, c && Array.isArray(y(i, s))) {
|
|
598
591
|
const g = l(y(i, s), h.argA, h.argB);
|
|
599
|
-
f &&
|
|
592
|
+
f && x(i, s, g);
|
|
600
593
|
}
|
|
601
594
|
if (c && Array.isArray(y(t.errors, s))) {
|
|
602
595
|
const g = l(y(t.errors, s), h.argA, h.argB);
|
|
603
|
-
f &&
|
|
596
|
+
f && x(t.errors, s, g), $t(t.errors, s);
|
|
604
597
|
}
|
|
605
|
-
if ((
|
|
598
|
+
if ((F.touchedFields || E.touchedFields) && c && Array.isArray(y(t.touchedFields, s))) {
|
|
606
599
|
const g = l(y(t.touchedFields, s), h.argA, h.argB);
|
|
607
|
-
f &&
|
|
600
|
+
f && x(t.touchedFields, s, g);
|
|
608
601
|
}
|
|
609
|
-
(
|
|
602
|
+
(F.dirtyFields || E.dirtyFields) && (t.dirtyFields = ue(a, o)), m.state.next({
|
|
610
603
|
name: s,
|
|
611
604
|
isDirty: _(s, n),
|
|
612
605
|
dirtyFields: t.dirtyFields,
|
|
@@ -614,9 +607,9 @@ function Yt(e = {}) {
|
|
|
614
607
|
isValid: t.isValid
|
|
615
608
|
});
|
|
616
609
|
} else
|
|
617
|
-
|
|
618
|
-
},
|
|
619
|
-
|
|
610
|
+
x(o, s, n);
|
|
611
|
+
}, p = (s, n) => {
|
|
612
|
+
x(t.errors, s, n), m.state.next({
|
|
620
613
|
errors: t.errors
|
|
621
614
|
});
|
|
622
615
|
}, L = (s) => {
|
|
@@ -628,7 +621,7 @@ function Yt(e = {}) {
|
|
|
628
621
|
const f = y(i, s);
|
|
629
622
|
if (f) {
|
|
630
623
|
const c = y(o, s, k(l) ? y(a, s) : l);
|
|
631
|
-
k(c) || h && h.defaultChecked || n ?
|
|
624
|
+
k(c) || h && h.defaultChecked || n ? x(o, s, n ? c : et(f._f)) : H(s, c), u.mount && N();
|
|
632
625
|
}
|
|
633
626
|
}, oe = (s, n, l, h, f) => {
|
|
634
627
|
let c = !1, g = !1;
|
|
@@ -637,20 +630,20 @@ function Yt(e = {}) {
|
|
|
637
630
|
};
|
|
638
631
|
if (!r.disabled) {
|
|
639
632
|
if (!l || h) {
|
|
640
|
-
(
|
|
641
|
-
const T =
|
|
642
|
-
g = !!y(t.dirtyFields, s), T ? M(t.dirtyFields, s) :
|
|
633
|
+
(F.isDirty || E.isDirty) && (g = t.isDirty, t.isDirty = V.isDirty = _(), c = g !== V.isDirty);
|
|
634
|
+
const T = ee(y(a, s), n);
|
|
635
|
+
g = !!y(t.dirtyFields, s), T ? M(t.dirtyFields, s) : x(t.dirtyFields, s, !0), V.dirtyFields = t.dirtyFields, c = c || (F.dirtyFields || E.dirtyFields) && g !== !T;
|
|
643
636
|
}
|
|
644
637
|
if (l) {
|
|
645
638
|
const T = y(t.touchedFields, s);
|
|
646
|
-
T || (
|
|
639
|
+
T || (x(t.touchedFields, s, l), V.touchedFields = t.touchedFields, c = c || (F.touchedFields || E.touchedFields) && T !== l);
|
|
647
640
|
}
|
|
648
641
|
c && f && m.state.next(V);
|
|
649
642
|
}
|
|
650
643
|
return c ? V : {};
|
|
651
644
|
}, Fe = (s, n, l, h) => {
|
|
652
|
-
const f = y(t.errors, s), c = (
|
|
653
|
-
if (r.delayError && l ? (b =
|
|
645
|
+
const f = y(t.errors, s), c = (F.isValid || E.isValid) && W(n) && t.isValid !== n;
|
|
646
|
+
if (r.delayError && l ? (b = q(() => p(s, l)), b(r.delayError)) : (clearTimeout(D), b = null, l ? x(t.errors, s, l) : M(t.errors, s)), (l ? !ee(f, l) : f) || !P(h) || c) {
|
|
654
647
|
const g = {
|
|
655
648
|
...h,
|
|
656
649
|
...c && W(n) ? { isValid: n } : {},
|
|
@@ -664,14 +657,14 @@ function Yt(e = {}) {
|
|
|
664
657
|
}
|
|
665
658
|
}, z = async (s) => {
|
|
666
659
|
v(s, !0);
|
|
667
|
-
const n = await r.resolver(o, r.context,
|
|
660
|
+
const n = await r.resolver(o, r.context, Wt(s || d.mount, i, r.criteriaMode, r.shouldUseNativeValidation));
|
|
668
661
|
return v(s), n;
|
|
669
662
|
}, re = async (s) => {
|
|
670
663
|
const { errors: n } = await z(s);
|
|
671
664
|
if (s)
|
|
672
665
|
for (const l of s) {
|
|
673
666
|
const h = y(n, l);
|
|
674
|
-
h ?
|
|
667
|
+
h ? x(t.errors, l, h) : M(t.errors, l);
|
|
675
668
|
}
|
|
676
669
|
else
|
|
677
670
|
t.errors = n;
|
|
@@ -684,31 +677,31 @@ function Yt(e = {}) {
|
|
|
684
677
|
if (f) {
|
|
685
678
|
const { _f: c, ...g } = f;
|
|
686
679
|
if (c) {
|
|
687
|
-
const V = d.array.has(c.name), T = f._f &&
|
|
688
|
-
T &&
|
|
689
|
-
const U = await
|
|
690
|
-
if (T &&
|
|
680
|
+
const V = d.array.has(c.name), T = f._f && qt(f._f);
|
|
681
|
+
T && F.validatingFields && v([h], !0);
|
|
682
|
+
const U = await at(f, d.disabled, o, O, r.shouldUseNativeValidation && !n, V);
|
|
683
|
+
if (T && F.validatingFields && v([h]), U[c.name] && (l.valid = !1, n))
|
|
691
684
|
break;
|
|
692
|
-
!n && (y(U, c.name) ? V ? zt(t.errors, U, c.name) :
|
|
685
|
+
!n && (y(U, c.name) ? V ? zt(t.errors, U, c.name) : x(t.errors, c.name, U[c.name]) : M(t.errors, c.name));
|
|
693
686
|
}
|
|
694
|
-
!
|
|
687
|
+
!P(g) && await J(g, n, l);
|
|
695
688
|
}
|
|
696
689
|
}
|
|
697
690
|
return l.valid;
|
|
698
|
-
},
|
|
691
|
+
}, A = () => {
|
|
699
692
|
for (const s of d.unMount) {
|
|
700
693
|
const n = y(i, s);
|
|
701
694
|
n && (n._f.refs ? n._f.refs.every((l) => !Se(l)) : !Se(n._f.ref)) && xe(s);
|
|
702
695
|
}
|
|
703
696
|
d.unMount = /* @__PURE__ */ new Set();
|
|
704
|
-
}, _ = (s, n) => !r.disabled && (s && n &&
|
|
697
|
+
}, _ = (s, n) => !r.disabled && (s && n && x(o, s, n), !ee(Ue(), a)), S = (s, n, l) => ht(s, d, {
|
|
705
698
|
...u.mount ? o : k(n) ? a : Y(s) ? { [s]: n } : n
|
|
706
699
|
}, l, n), I = (s) => Ve(y(u.mount ? o : a, s, r.shouldUnregister ? y(a, s, []) : [])), H = (s, n, l = {}) => {
|
|
707
700
|
const h = y(i, s);
|
|
708
701
|
let f = n;
|
|
709
702
|
if (h) {
|
|
710
703
|
const c = h._f;
|
|
711
|
-
c && (!c.disabled &&
|
|
704
|
+
c && (!c.disabled && x(o, s, Vt(n, c)), f = be(c.ref) && B(n) ? "" : n, vt(c.ref) ? [...c.ref.options].forEach((g) => g.selected = f.includes(g.value)) : c.refs ? ye(c.ref) ? c.refs.length > 1 ? c.refs.forEach((g) => (!g.defaultChecked || !g.disabled) && (g.checked = Array.isArray(f) ? !!f.find((V) => V === g.value) : f === g.value)) : c.refs[0] && (c.refs[0].checked = !!f) : c.refs.forEach((g) => g.checked = g.value === f) : Oe(c.ref) ? c.ref.value = "" : (c.ref.value = f, c.ref.type || m.state.next({
|
|
712
705
|
name: s,
|
|
713
706
|
values: R(o)
|
|
714
707
|
})));
|
|
@@ -719,16 +712,16 @@ function Yt(e = {}) {
|
|
|
719
712
|
const f = n[h], c = `${s}.${h}`, g = y(i, c);
|
|
720
713
|
(d.array.has(s) || C(f) || g && !g._f) && !se(f) ? G(c, f, l) : H(c, f, l);
|
|
721
714
|
}
|
|
722
|
-
},
|
|
715
|
+
}, Z = (s, n, l = {}) => {
|
|
723
716
|
const h = y(i, s), f = d.array.has(s), c = R(n);
|
|
724
|
-
|
|
717
|
+
x(o, s, c), f ? (m.array.next({
|
|
725
718
|
name: s,
|
|
726
719
|
values: R(o)
|
|
727
|
-
}), (
|
|
720
|
+
}), (F.isDirty || F.dirtyFields || E.isDirty || E.dirtyFields) && l.shouldDirty && m.state.next({
|
|
728
721
|
name: s,
|
|
729
722
|
dirtyFields: ue(a, o),
|
|
730
723
|
isDirty: _(s, c)
|
|
731
|
-
})) : h && !h._f && !
|
|
724
|
+
})) : h && !h._f && !B(c) ? G(s, c, l) : H(s, c, l), st(s, d) && m.state.next({ ...t }), m.state.next({
|
|
732
725
|
name: u.mount ? s : void 0,
|
|
733
726
|
values: R(o)
|
|
734
727
|
});
|
|
@@ -737,28 +730,28 @@ function Yt(e = {}) {
|
|
|
737
730
|
const n = s.target;
|
|
738
731
|
let l = n.name, h = !0;
|
|
739
732
|
const f = y(i, l), c = (g) => {
|
|
740
|
-
h = Number.isNaN(g) || se(g) && isNaN(g.getTime()) ||
|
|
733
|
+
h = Number.isNaN(g) || se(g) && isNaN(g.getTime()) || ee(g, y(o, l, g));
|
|
741
734
|
};
|
|
742
735
|
if (f) {
|
|
743
736
|
let g, V;
|
|
744
|
-
const T = n.type ?
|
|
745
|
-
|
|
746
|
-
const
|
|
737
|
+
const T = n.type ? et(f._f) : ut(s), U = s.type === ve.BLUR || s.type === ve.FOCUS_OUT, Tt = !Ht(f._f) && !r.resolver && !y(t.errors, l) && !f._f.deps || Qt(U, y(t.touchedFields, l), t.isSubmitted, j, te), De = st(l, d, U);
|
|
738
|
+
x(o, l, T), U ? (f._f.onBlur && f._f.onBlur(s), b && b(0)) : f._f.onChange && f._f.onChange(s);
|
|
739
|
+
const Ee = oe(l, T, U), Mt = !P(Ee) || De;
|
|
747
740
|
if (!U && m.state.next({
|
|
748
741
|
name: l,
|
|
749
742
|
type: s.type,
|
|
750
743
|
values: R(o)
|
|
751
744
|
}), Tt)
|
|
752
|
-
return (
|
|
745
|
+
return (F.isValid || E.isValid) && (r.mode === "onBlur" ? U && N() : U || N()), Mt && m.state.next({ name: l, ...De ? {} : Ee });
|
|
753
746
|
if (!U && De && m.state.next({ ...t }), r.resolver) {
|
|
754
|
-
const { errors:
|
|
747
|
+
const { errors: Ke } = await z([l]);
|
|
755
748
|
if (c(T), h) {
|
|
756
|
-
const Lt =
|
|
757
|
-
g =
|
|
749
|
+
const Lt = it(t.errors, i, l), Qe = it(Ke, i, Lt.name || l);
|
|
750
|
+
g = Qe.error, l = Qe.name, V = P(Ke);
|
|
758
751
|
}
|
|
759
752
|
} else
|
|
760
|
-
v([l], !0), g = (await
|
|
761
|
-
h && (f._f.deps && Ae(f._f.deps), Fe(l, V, g,
|
|
753
|
+
v([l], !0), g = (await at(f, d.disabled, o, O, r.shouldUseNativeValidation))[l], v([l]), c(T), h && (g ? V = !1 : (F.isValid || E.isValid) && (V = await J(i, !0)));
|
|
754
|
+
h && (f._f.deps && Ae(f._f.deps), Fe(l, V, g, Ee));
|
|
762
755
|
}
|
|
763
756
|
}, he = (s, n) => {
|
|
764
757
|
if (y(t.errors, n) && s.focus)
|
|
@@ -768,22 +761,22 @@ function Yt(e = {}) {
|
|
|
768
761
|
const f = de(s);
|
|
769
762
|
if (r.resolver) {
|
|
770
763
|
const c = await re(k(s) ? s : f);
|
|
771
|
-
l =
|
|
764
|
+
l = P(c), h = s ? !f.some((g) => y(c, g)) : l;
|
|
772
765
|
} else s ? (h = (await Promise.all(f.map(async (c) => {
|
|
773
766
|
const g = y(i, c);
|
|
774
767
|
return await J(g && g._f ? { [c]: g } : g);
|
|
775
|
-
}))).every(Boolean), !(!h && !t.isValid) &&
|
|
768
|
+
}))).every(Boolean), !(!h && !t.isValid) && N()) : h = l = await J(i);
|
|
776
769
|
return m.state.next({
|
|
777
|
-
...!Y(s) || (
|
|
770
|
+
...!Y(s) || (F.isValid || E.isValid) && l !== t.isValid ? {} : { name: s },
|
|
778
771
|
...r.resolver || !s ? { isValid: l } : {},
|
|
779
772
|
errors: t.errors
|
|
780
773
|
}), n.shouldFocus && !h && fe(i, he, s ? f : d.mount), h;
|
|
781
|
-
},
|
|
774
|
+
}, Ue = (s) => {
|
|
782
775
|
const n = {
|
|
783
776
|
...u.mount ? o : a
|
|
784
777
|
};
|
|
785
778
|
return k(s) ? n : Y(s) ? y(n, s) : s.map((l) => y(n, l));
|
|
786
|
-
},
|
|
779
|
+
}, Ne = (s, n) => ({
|
|
787
780
|
invalid: !!y((n || t).errors, s),
|
|
788
781
|
isDirty: !!y((n || t).dirtyFields, s),
|
|
789
782
|
error: y((n || t).errors, s),
|
|
@@ -793,9 +786,9 @@ function Yt(e = {}) {
|
|
|
793
786
|
s && de(s).forEach((n) => M(t.errors, n)), m.state.next({
|
|
794
787
|
errors: s ? t.errors : {}
|
|
795
788
|
});
|
|
796
|
-
},
|
|
789
|
+
}, Pe = (s, n, l) => {
|
|
797
790
|
const h = (y(i, s, { _f: {} })._f || {}).ref, f = y(t.errors, s) || {}, { ref: c, message: g, type: V, ...T } = f;
|
|
798
|
-
|
|
791
|
+
x(t.errors, s, {
|
|
799
792
|
...T,
|
|
800
793
|
...n,
|
|
801
794
|
ref: h
|
|
@@ -804,22 +797,22 @@ function Yt(e = {}) {
|
|
|
804
797
|
errors: t.errors,
|
|
805
798
|
isValid: !1
|
|
806
799
|
}), l && l.shouldFocus && h && h.focus && h.focus();
|
|
807
|
-
},
|
|
800
|
+
}, wt = (s, n) => $(s) ? m.state.subscribe({
|
|
808
801
|
next: (l) => s(S(void 0, n), l)
|
|
809
|
-
}) : S(s, n, !0),
|
|
802
|
+
}) : S(s, n, !0), Be = (s) => m.state.subscribe({
|
|
810
803
|
next: (n) => {
|
|
811
|
-
Kt(s.name, n.name, s.exact) && jt(n, s.formState ||
|
|
804
|
+
Kt(s.name, n.name, s.exact) && jt(n, s.formState || F, Ct, s.reRenderRoot) && s.callback({
|
|
812
805
|
values: { ...o },
|
|
813
806
|
...t,
|
|
814
807
|
...n
|
|
815
808
|
});
|
|
816
809
|
}
|
|
817
|
-
}).unsubscribe, Dt = (s) => (u.mount = !0,
|
|
818
|
-
...
|
|
810
|
+
}).unsubscribe, Dt = (s) => (u.mount = !0, E = {
|
|
811
|
+
...E,
|
|
819
812
|
...s.formState
|
|
820
|
-
},
|
|
813
|
+
}, Be({
|
|
821
814
|
...s,
|
|
822
|
-
formState:
|
|
815
|
+
formState: E
|
|
823
816
|
})), xe = (s, n = {}) => {
|
|
824
817
|
for (const l of s ? de(s) : d.mount)
|
|
825
818
|
d.mount.delete(l), d.array.delete(l), n.keepValue || (M(i, l), M(o, l)), !n.keepError && M(t.errors, l), !n.keepDirty && M(t.dirtyFields, l), !n.keepTouched && M(t.touchedFields, l), !n.keepIsValidating && M(t.validatingFields, l), !r.shouldUnregister && !n.keepDefaultValue && M(a, l);
|
|
@@ -828,13 +821,13 @@ function Yt(e = {}) {
|
|
|
828
821
|
}), m.state.next({
|
|
829
822
|
...t,
|
|
830
823
|
...n.keepDirty ? { isDirty: _() } : {}
|
|
831
|
-
}), !n.keepIsValid &&
|
|
832
|
-
},
|
|
824
|
+
}), !n.keepIsValid && N();
|
|
825
|
+
}, Ie = ({ disabled: s, name: n }) => {
|
|
833
826
|
(W(s) && u.mount || s || d.disabled.has(n)) && (s ? d.disabled.add(n) : d.disabled.delete(n));
|
|
834
|
-
},
|
|
827
|
+
}, we = (s, n = {}) => {
|
|
835
828
|
let l = y(i, s);
|
|
836
829
|
const h = W(n.disabled) || W(r.disabled);
|
|
837
|
-
return
|
|
830
|
+
return x(i, s, {
|
|
838
831
|
...l || {},
|
|
839
832
|
_f: {
|
|
840
833
|
...l && l._f ? l._f : { ref: { name: s } },
|
|
@@ -842,7 +835,7 @@ function Yt(e = {}) {
|
|
|
842
835
|
mount: !0,
|
|
843
836
|
...n
|
|
844
837
|
}
|
|
845
|
-
}), d.mount.add(s), l ?
|
|
838
|
+
}), d.mount.add(s), l ? Ie({
|
|
846
839
|
disabled: W(n.disabled) ? n.disabled : r.disabled,
|
|
847
840
|
name: s
|
|
848
841
|
}) : ae(s, !0, n.value), {
|
|
@@ -860,11 +853,11 @@ function Yt(e = {}) {
|
|
|
860
853
|
onBlur: le,
|
|
861
854
|
ref: (f) => {
|
|
862
855
|
if (f) {
|
|
863
|
-
|
|
856
|
+
we(s, n), l = y(i, s);
|
|
864
857
|
const c = k(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = Bt(c), V = l._f.refs || [];
|
|
865
858
|
if (g ? V.find((T) => T === c) : c === l._f.ref)
|
|
866
859
|
return;
|
|
867
|
-
|
|
860
|
+
x(i, s, {
|
|
868
861
|
_f: {
|
|
869
862
|
...l._f,
|
|
870
863
|
...g ? {
|
|
@@ -878,17 +871,17 @@ function Yt(e = {}) {
|
|
|
878
871
|
}
|
|
879
872
|
}), ae(s, !1, void 0, c);
|
|
880
873
|
} else
|
|
881
|
-
l = y(i, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(
|
|
874
|
+
l = y(i, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(ct(d.array, s) && u.action) && d.unMount.add(s);
|
|
882
875
|
}
|
|
883
876
|
};
|
|
884
|
-
}, pe = () => r.shouldFocusError && fe(i, he, d.mount),
|
|
877
|
+
}, pe = () => r.shouldFocusError && fe(i, he, d.mount), Et = (s) => {
|
|
885
878
|
W(s) && (m.state.next({ disabled: s }), fe(i, (n, l) => {
|
|
886
879
|
const h = y(i, l);
|
|
887
880
|
h && (n.disabled = h._f.disabled || s, Array.isArray(h._f.refs) && h._f.refs.forEach((f) => {
|
|
888
881
|
f.disabled = h._f.disabled || s;
|
|
889
882
|
}));
|
|
890
883
|
}, 0, !1));
|
|
891
|
-
},
|
|
884
|
+
}, We = (s, n) => async (l) => {
|
|
892
885
|
let h;
|
|
893
886
|
l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
|
|
894
887
|
let f = R(o);
|
|
@@ -901,8 +894,8 @@ function Yt(e = {}) {
|
|
|
901
894
|
await J(i);
|
|
902
895
|
if (d.disabled.size)
|
|
903
896
|
for (const c of d.disabled)
|
|
904
|
-
|
|
905
|
-
if (M(t.errors, "root"),
|
|
897
|
+
x(f, c, void 0);
|
|
898
|
+
if (M(t.errors, "root"), P(t.errors)) {
|
|
906
899
|
m.state.next({
|
|
907
900
|
errors: {}
|
|
908
901
|
});
|
|
@@ -916,15 +909,15 @@ function Yt(e = {}) {
|
|
|
916
909
|
if (m.state.next({
|
|
917
910
|
isSubmitted: !0,
|
|
918
911
|
isSubmitting: !1,
|
|
919
|
-
isSubmitSuccessful:
|
|
912
|
+
isSubmitSuccessful: P(t.errors) && !h,
|
|
920
913
|
submitCount: t.submitCount + 1,
|
|
921
914
|
errors: t.errors
|
|
922
915
|
}), h)
|
|
923
916
|
throw h;
|
|
924
917
|
}, St = (s, n = {}) => {
|
|
925
|
-
y(i, s) && (k(n.defaultValue) ?
|
|
918
|
+
y(i, s) && (k(n.defaultValue) ? Z(s, R(y(a, s))) : (Z(s, n.defaultValue), x(a, s, R(n.defaultValue))), n.keepTouched || M(t.touchedFields, s), n.keepDirty || (M(t.dirtyFields, s), t.isDirty = n.defaultValue ? _(s, R(y(a, s))) : _()), n.keepError || (M(t.errors, s), F.isValid && N()), m.state.next({ ...t }));
|
|
926
919
|
}, qe = (s, n = {}) => {
|
|
927
|
-
const l = s ? R(s) : a, h = R(l), f =
|
|
920
|
+
const l = s ? R(s) : a, h = R(l), f = P(s), c = f ? a : h;
|
|
928
921
|
if (n.keepDefaultValues || (a = l), !n.keepValues) {
|
|
929
922
|
if (n.keepDirtyValues) {
|
|
930
923
|
const g = /* @__PURE__ */ new Set([
|
|
@@ -932,7 +925,7 @@ function Yt(e = {}) {
|
|
|
932
925
|
...Object.keys(ue(a, o))
|
|
933
926
|
]);
|
|
934
927
|
for (const V of Array.from(g))
|
|
935
|
-
y(t.dirtyFields, V) ?
|
|
928
|
+
y(t.dirtyFields, V) ? x(c, V, y(o, V)) : Z(V, y(c, V));
|
|
936
929
|
} else {
|
|
937
930
|
if (Ce && k(s))
|
|
938
931
|
for (const g of d.mount) {
|
|
@@ -949,7 +942,7 @@ function Yt(e = {}) {
|
|
|
949
942
|
}
|
|
950
943
|
}
|
|
951
944
|
for (const g of d.mount)
|
|
952
|
-
|
|
945
|
+
Z(g, y(c, g));
|
|
953
946
|
}
|
|
954
947
|
o = R(c), m.array.next({
|
|
955
948
|
values: { ...c }
|
|
@@ -965,9 +958,9 @@ function Yt(e = {}) {
|
|
|
965
958
|
watch: /* @__PURE__ */ new Set(),
|
|
966
959
|
watchAll: !1,
|
|
967
960
|
focus: ""
|
|
968
|
-
}, u.mount = !
|
|
961
|
+
}, u.mount = !F.isValid || !!n.keepIsValid || !!n.keepDirtyValues, u.watch = !!r.shouldUnregister, m.state.next({
|
|
969
962
|
submitCount: n.keepSubmitCount ? t.submitCount : 0,
|
|
970
|
-
isDirty: f ? !1 : n.keepDirty ? t.isDirty : !!(n.keepDefaultValues && !
|
|
963
|
+
isDirty: f ? !1 : n.keepDirty ? t.isDirty : !!(n.keepDefaultValues && !ee(s, a)),
|
|
971
964
|
isSubmitted: n.keepIsSubmitted ? t.isSubmitted : !1,
|
|
972
965
|
dirtyFields: f ? {} : n.keepDirtyValues ? n.keepDefaultValues && o ? ue(a, o) : t.dirtyFields : n.keepDefaultValues && s ? ue(a, s) : n.keepDirty ? t.dirtyFields : {},
|
|
973
966
|
touchedFields: n.keepTouched ? t.touchedFields : {},
|
|
@@ -975,7 +968,7 @@ function Yt(e = {}) {
|
|
|
975
968
|
isSubmitSuccessful: n.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
976
969
|
isSubmitting: !1
|
|
977
970
|
});
|
|
978
|
-
},
|
|
971
|
+
}, He = (s, n) => qe($(s) ? s(o) : s, n), kt = (s, n = {}) => {
|
|
979
972
|
const l = y(i, s), h = l && l._f;
|
|
980
973
|
if (h) {
|
|
981
974
|
const f = h.refs ? h.refs[0] : h.ref;
|
|
@@ -986,32 +979,32 @@ function Yt(e = {}) {
|
|
|
986
979
|
...t,
|
|
987
980
|
...s
|
|
988
981
|
};
|
|
989
|
-
},
|
|
982
|
+
}, je = {
|
|
990
983
|
control: {
|
|
991
|
-
register:
|
|
984
|
+
register: we,
|
|
992
985
|
unregister: xe,
|
|
993
|
-
getFieldState:
|
|
994
|
-
handleSubmit:
|
|
995
|
-
setError:
|
|
996
|
-
_subscribe:
|
|
986
|
+
getFieldState: Ne,
|
|
987
|
+
handleSubmit: We,
|
|
988
|
+
setError: Pe,
|
|
989
|
+
_subscribe: Be,
|
|
997
990
|
_runSchema: z,
|
|
998
991
|
_getWatch: S,
|
|
999
992
|
_getDirty: _,
|
|
1000
|
-
_setValid:
|
|
993
|
+
_setValid: N,
|
|
1001
994
|
_setFieldArray: K,
|
|
1002
|
-
_setDisabledField:
|
|
995
|
+
_setDisabledField: Ie,
|
|
1003
996
|
_setErrors: L,
|
|
1004
997
|
_getFieldArray: I,
|
|
1005
998
|
_reset: qe,
|
|
1006
999
|
_resetDefaultValues: () => $(r.defaultValues) && r.defaultValues().then((s) => {
|
|
1007
|
-
|
|
1000
|
+
He(s, r.resetOptions), m.state.next({
|
|
1008
1001
|
isLoading: !1
|
|
1009
1002
|
});
|
|
1010
1003
|
}),
|
|
1011
|
-
_removeUnmounted:
|
|
1012
|
-
_disableForm:
|
|
1004
|
+
_removeUnmounted: A,
|
|
1005
|
+
_disableForm: Et,
|
|
1013
1006
|
_subjects: m,
|
|
1014
|
-
_proxyFormState:
|
|
1007
|
+
_proxyFormState: F,
|
|
1015
1008
|
get _fields() {
|
|
1016
1009
|
return i;
|
|
1017
1010
|
},
|
|
@@ -1048,27 +1041,26 @@ function Yt(e = {}) {
|
|
|
1048
1041
|
},
|
|
1049
1042
|
subscribe: Dt,
|
|
1050
1043
|
trigger: Ae,
|
|
1051
|
-
register:
|
|
1052
|
-
handleSubmit:
|
|
1053
|
-
watch:
|
|
1054
|
-
setValue:
|
|
1055
|
-
getValues:
|
|
1056
|
-
reset:
|
|
1044
|
+
register: we,
|
|
1045
|
+
handleSubmit: We,
|
|
1046
|
+
watch: wt,
|
|
1047
|
+
setValue: Z,
|
|
1048
|
+
getValues: Ue,
|
|
1049
|
+
reset: He,
|
|
1057
1050
|
resetField: St,
|
|
1058
1051
|
clearErrors: xt,
|
|
1059
1052
|
unregister: xe,
|
|
1060
|
-
setError:
|
|
1053
|
+
setError: Pe,
|
|
1061
1054
|
setFocus: kt,
|
|
1062
|
-
getFieldState:
|
|
1055
|
+
getFieldState: Ne
|
|
1063
1056
|
};
|
|
1064
1057
|
return {
|
|
1065
|
-
...
|
|
1066
|
-
formControl:
|
|
1058
|
+
...je,
|
|
1059
|
+
formControl: je
|
|
1067
1060
|
};
|
|
1068
1061
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
const r = x.useRef(void 0), t = x.useRef(void 0), [i, a] = x.useState({
|
|
1062
|
+
function Jt(e = {}) {
|
|
1063
|
+
const r = w.useRef(void 0), t = w.useRef(void 0), [i, a] = w.useState({
|
|
1072
1064
|
isDirty: !1,
|
|
1073
1065
|
isValidating: !1,
|
|
1074
1066
|
isLoading: $(e.defaultValues),
|
|
@@ -1090,7 +1082,7 @@ function Xt(e = {}) {
|
|
|
1090
1082
|
formState: i
|
|
1091
1083
|
}, e.formControl && e.defaultValues && !$(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
|
|
1092
1084
|
const o = r.current.control;
|
|
1093
|
-
return o._options = e,
|
|
1085
|
+
return o._options = e, Le(() => {
|
|
1094
1086
|
const u = o._subscribe({
|
|
1095
1087
|
formState: o._proxyFormState,
|
|
1096
1088
|
callback: () => a({ ...o._formState }),
|
|
@@ -1100,26 +1092,26 @@ function Xt(e = {}) {
|
|
|
1100
1092
|
...d,
|
|
1101
1093
|
isReady: !0
|
|
1102
1094
|
})), o._formState.isReady = !0, u;
|
|
1103
|
-
}, [o]),
|
|
1104
|
-
e.mode && (o._options.mode = e.mode), e.reValidateMode && (o._options.reValidateMode = e.reValidateMode), e.errors && !
|
|
1105
|
-
}, [o, e.errors, e.mode, e.reValidateMode]),
|
|
1095
|
+
}, [o]), w.useEffect(() => o._disableForm(e.disabled), [o, e.disabled]), w.useEffect(() => {
|
|
1096
|
+
e.mode && (o._options.mode = e.mode), e.reValidateMode && (o._options.reValidateMode = e.reValidateMode), e.errors && !P(e.errors) && o._setErrors(e.errors);
|
|
1097
|
+
}, [o, e.errors, e.mode, e.reValidateMode]), w.useEffect(() => {
|
|
1106
1098
|
e.shouldUnregister && o._subjects.state.next({
|
|
1107
1099
|
values: o._getWatch()
|
|
1108
1100
|
});
|
|
1109
|
-
}, [o, e.shouldUnregister]),
|
|
1101
|
+
}, [o, e.shouldUnregister]), w.useEffect(() => {
|
|
1110
1102
|
if (o._proxyFormState.isDirty) {
|
|
1111
1103
|
const u = o._getDirty();
|
|
1112
1104
|
u !== i.isDirty && o._subjects.state.next({
|
|
1113
1105
|
isDirty: u
|
|
1114
1106
|
});
|
|
1115
1107
|
}
|
|
1116
|
-
}, [o, i.isDirty]),
|
|
1117
|
-
e.values && !
|
|
1118
|
-
}, [o, e.values]),
|
|
1108
|
+
}, [o, i.isDirty]), w.useEffect(() => {
|
|
1109
|
+
e.values && !ee(e.values, t.current) ? (o._reset(e.values, o._options.resetOptions), t.current = e.values, a((u) => ({ ...u }))) : o._resetDefaultValues();
|
|
1110
|
+
}, [o, e.values]), w.useEffect(() => {
|
|
1119
1111
|
o._state.mount || (o._setValid(), o._state.mount = !0), o._state.watch && (o._state.watch = !1, o._subjects.state.next({ ...o._formState })), o._removeUnmounted();
|
|
1120
|
-
}), r.current.formState =
|
|
1112
|
+
}), r.current.formState = yt(i, o), r.current;
|
|
1121
1113
|
}
|
|
1122
|
-
const
|
|
1114
|
+
const ot = (e, r, t) => {
|
|
1123
1115
|
if (e && "reportValidity" in e) {
|
|
1124
1116
|
const i = y(t, r);
|
|
1125
1117
|
e.setCustomValidity(i && i.message || ""), e.reportValidity();
|
|
@@ -1127,30 +1119,30 @@ const at = (e, r, t) => {
|
|
|
1127
1119
|
}, At = (e, r) => {
|
|
1128
1120
|
for (const t in r.fields) {
|
|
1129
1121
|
const i = r.fields[t];
|
|
1130
|
-
i && i.ref && "reportValidity" in i.ref ?
|
|
1122
|
+
i && i.ref && "reportValidity" in i.ref ? ot(i.ref, t, e) : i.refs && i.refs.forEach((a) => ot(a, t, e));
|
|
1131
1123
|
}
|
|
1132
|
-
},
|
|
1124
|
+
}, Xt = (e, r) => {
|
|
1133
1125
|
r.shouldUseNativeValidation && At(e, r);
|
|
1134
1126
|
const t = {};
|
|
1135
1127
|
for (const i in e) {
|
|
1136
1128
|
const a = y(r.fields, i), o = Object.assign(e[i] || {}, { ref: a && a.ref });
|
|
1137
|
-
if (
|
|
1129
|
+
if (Zt(r.names || Object.keys(e), i)) {
|
|
1138
1130
|
const u = Object.assign({}, y(t, i));
|
|
1139
|
-
|
|
1140
|
-
} else
|
|
1131
|
+
x(u, "root", o), x(t, i, u);
|
|
1132
|
+
} else x(t, i, o);
|
|
1141
1133
|
}
|
|
1142
1134
|
return t;
|
|
1143
|
-
},
|
|
1144
|
-
var
|
|
1135
|
+
}, Zt = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
1136
|
+
var er = function(e, r) {
|
|
1145
1137
|
for (var t = {}; e.length; ) {
|
|
1146
1138
|
var i = e[0], a = i.code, o = i.message, u = i.path.join(".");
|
|
1147
1139
|
if (!t[u]) if ("unionErrors" in i) {
|
|
1148
1140
|
var d = i.unionErrors[0].errors[0];
|
|
1149
1141
|
t[u] = { message: d.message, type: d.code };
|
|
1150
1142
|
} else t[u] = { message: o, type: a };
|
|
1151
|
-
if ("unionErrors" in i && i.unionErrors.forEach(function(
|
|
1152
|
-
return
|
|
1153
|
-
return e.push(
|
|
1143
|
+
if ("unionErrors" in i && i.unionErrors.forEach(function(F) {
|
|
1144
|
+
return F.errors.forEach(function(E) {
|
|
1145
|
+
return e.push(E);
|
|
1154
1146
|
});
|
|
1155
1147
|
}), r) {
|
|
1156
1148
|
var b = t[u].types, D = b && b[i.code];
|
|
@@ -1159,7 +1151,7 @@ var tr = function(e, r) {
|
|
|
1159
1151
|
e.shift();
|
|
1160
1152
|
}
|
|
1161
1153
|
return t;
|
|
1162
|
-
},
|
|
1154
|
+
}, tr = function(e, r, t) {
|
|
1163
1155
|
return t === void 0 && (t = {}), function(i, a, o) {
|
|
1164
1156
|
try {
|
|
1165
1157
|
return Promise.resolve(function(u, d) {
|
|
@@ -1174,7 +1166,7 @@ var tr = function(e, r) {
|
|
|
1174
1166
|
}(0, function(u) {
|
|
1175
1167
|
if (function(d) {
|
|
1176
1168
|
return Array.isArray(d == null ? void 0 : d.errors);
|
|
1177
|
-
}(u)) return { values: {}, errors:
|
|
1169
|
+
}(u)) return { values: {}, errors: Xt(er(u.errors, !o.shouldUseNativeValidation && o.criteriaMode === "all"), o) };
|
|
1178
1170
|
throw u;
|
|
1179
1171
|
}));
|
|
1180
1172
|
} catch (u) {
|
|
@@ -1182,30 +1174,30 @@ var tr = function(e, r) {
|
|
|
1182
1174
|
}
|
|
1183
1175
|
};
|
|
1184
1176
|
};
|
|
1185
|
-
const
|
|
1177
|
+
const dr = ({ schema: e, ...r }) => Jt({
|
|
1186
1178
|
...r,
|
|
1187
|
-
resolver:
|
|
1188
|
-
}),
|
|
1179
|
+
resolver: tr(e)
|
|
1180
|
+
}), rr = (e, r) => {
|
|
1189
1181
|
let t;
|
|
1190
1182
|
return function(...i) {
|
|
1191
1183
|
clearTimeout(t), t = setTimeout(() => e(...i), r);
|
|
1192
1184
|
};
|
|
1193
|
-
},
|
|
1194
|
-
const t = ie.useRef(e), [i, a] = ie.useState(e), o =
|
|
1185
|
+
}, sr = (e, r) => ie.useMemo(() => rr(e, r), [r]), fr = (e, r) => {
|
|
1186
|
+
const t = ie.useRef(e), [i, a] = ie.useState(e), o = sr(a, r);
|
|
1195
1187
|
return ie.useEffect(() => {
|
|
1196
1188
|
t.current !== e && (o(e), t.current = e);
|
|
1197
1189
|
}, [e]), i;
|
|
1198
1190
|
};
|
|
1199
1191
|
export {
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1192
|
+
ur as F,
|
|
1193
|
+
lr as a,
|
|
1194
|
+
dr as b,
|
|
1195
|
+
sr as c,
|
|
1196
|
+
rr as d,
|
|
1197
|
+
fr as e,
|
|
1206
1198
|
Pt as f,
|
|
1207
1199
|
Me as g,
|
|
1208
|
-
|
|
1209
|
-
|
|
1200
|
+
cr as h,
|
|
1201
|
+
or as u
|
|
1210
1202
|
};
|
|
1211
|
-
//# sourceMappingURL=useDebounce-
|
|
1203
|
+
//# sourceMappingURL=useDebounce-MaKPBuaC.js.map
|