suprform 1.0.12 → 1.1.1
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 +4 -0
- package/dist/components/DisabilityChecker.d.ts.map +1 -0
- package/dist/components/SuprForm.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 +916 -900
- package/dist/suprform.es.js.map +1 -1
- package/dist/type.d.ts +6 -1
- package/dist/type.d.ts.map +1 -1
- package/dist/util.d.ts +4 -0
- package/dist/util.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/suprform.es.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import b, { createContext as
|
|
3
|
-
var ve = (
|
|
4
|
-
const
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
return
|
|
1
|
+
import { jsx as ee, jsxs as dt, Fragment as Qt } from "react/jsx-runtime";
|
|
2
|
+
import b, { createContext as Gt, useContext as zt, useMemo as he, cloneElement as Ae, useImperativeHandle as bt, useEffect as Kt, Children as Yt, isValidElement as Jt } from "react";
|
|
3
|
+
var ve = (t) => t.type === "checkbox", le = (t) => t instanceof Date, G = (t) => t == null;
|
|
4
|
+
const At = (t) => typeof t == "object";
|
|
5
|
+
var P = (t) => !G(t) && !Array.isArray(t) && At(t) && !le(t), pt = (t) => P(t) && t.target ? ve(t.target) ? t.target.checked : t.target.value : t, Xt = (t) => t.substring(0, t.search(/\.\d+(\.|$)/)) || t, xt = (t, r) => t.has(Xt(r)), Zt = (t) => {
|
|
6
|
+
const r = t.constructor && t.constructor.prototype;
|
|
7
|
+
return P(r) && r.hasOwnProperty("isPrototypeOf");
|
|
8
8
|
}, ze = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
9
|
-
function U(
|
|
10
|
-
let
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
else if (!(ze && (
|
|
15
|
-
if (
|
|
16
|
-
|
|
9
|
+
function U(t) {
|
|
10
|
+
let r;
|
|
11
|
+
const e = Array.isArray(t), s = typeof FileList < "u" ? t instanceof FileList : !1;
|
|
12
|
+
if (t instanceof Date)
|
|
13
|
+
r = new Date(t);
|
|
14
|
+
else if (!(ze && (t instanceof Blob || s)) && (e || P(t)))
|
|
15
|
+
if (r = e ? [] : Object.create(Object.getPrototypeOf(t)), !e && !Zt(t))
|
|
16
|
+
r = t;
|
|
17
17
|
else
|
|
18
|
-
for (const u in
|
|
19
|
-
|
|
18
|
+
for (const u in t)
|
|
19
|
+
t.hasOwnProperty(u) && (r[u] = U(t[u]));
|
|
20
20
|
else
|
|
21
|
-
return
|
|
22
|
-
return
|
|
21
|
+
return t;
|
|
22
|
+
return r;
|
|
23
23
|
}
|
|
24
|
-
var
|
|
25
|
-
if (!
|
|
26
|
-
return
|
|
27
|
-
const s = (
|
|
28
|
-
return T(s) || s ===
|
|
29
|
-
}, K = (
|
|
24
|
+
var Ee = (t) => /^\w*$/.test(t), T = (t) => t === void 0, we = (t) => Array.isArray(t) ? t.filter(Boolean) : [], Ke = (t) => we(t.replace(/["|']|\]/g, "").split(/\.|\[/)), m = (t, r, e) => {
|
|
25
|
+
if (!r || !P(t))
|
|
26
|
+
return e;
|
|
27
|
+
const s = (Ee(r) ? [r] : Ke(r)).reduce((u, i) => G(u) ? u : u[i], t);
|
|
28
|
+
return T(s) || s === t ? T(t[r]) ? e : t[r] : s;
|
|
29
|
+
}, K = (t) => typeof t == "boolean", R = (t, r, e) => {
|
|
30
30
|
let s = -1;
|
|
31
|
-
const u =
|
|
31
|
+
const u = Ee(r) ? [r] : Ke(r), i = u.length, c = i - 1;
|
|
32
32
|
for (; ++s < i; ) {
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
if (s !==
|
|
36
|
-
const
|
|
37
|
-
|
|
33
|
+
const l = u[s];
|
|
34
|
+
let V = e;
|
|
35
|
+
if (s !== c) {
|
|
36
|
+
const v = t[l];
|
|
37
|
+
V = P(v) || Array.isArray(v) ? v : isNaN(+u[s + 1]) ? {} : [];
|
|
38
38
|
}
|
|
39
|
-
if (
|
|
39
|
+
if (l === "__proto__" || l === "constructor" || l === "prototype")
|
|
40
40
|
return;
|
|
41
|
-
|
|
41
|
+
t[l] = V, t = t[l];
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
const
|
|
44
|
+
const pe = {
|
|
45
45
|
BLUR: "blur",
|
|
46
46
|
FOCUS_OUT: "focusout",
|
|
47
47
|
CHANGE: "change"
|
|
@@ -61,26 +61,26 @@ const Fe = {
|
|
|
61
61
|
validate: "validate"
|
|
62
62
|
}, Ye = b.createContext(null);
|
|
63
63
|
Ye.displayName = "HookFormContext";
|
|
64
|
-
const
|
|
65
|
-
const { children:
|
|
66
|
-
return b.createElement(Ye.Provider, { value:
|
|
64
|
+
const Ve = () => b.useContext(Ye), er = (t) => {
|
|
65
|
+
const { children: r, ...e } = t;
|
|
66
|
+
return b.createElement(Ye.Provider, { value: e }, r);
|
|
67
67
|
};
|
|
68
|
-
var
|
|
68
|
+
var St = (t, r, e, s = !0) => {
|
|
69
69
|
const u = {
|
|
70
|
-
defaultValues:
|
|
70
|
+
defaultValues: r._defaultValues
|
|
71
71
|
};
|
|
72
|
-
for (const i in
|
|
72
|
+
for (const i in t)
|
|
73
73
|
Object.defineProperty(u, i, {
|
|
74
74
|
get: () => {
|
|
75
|
-
const
|
|
76
|
-
return
|
|
75
|
+
const c = i;
|
|
76
|
+
return r._proxyFormState[c] !== X.all && (r._proxyFormState[c] = !s || X.all), e && (e[c] = !0), t[c];
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
return u;
|
|
80
80
|
};
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const
|
|
81
|
+
const Ce = typeof window < "u" ? b.useLayoutEffect : b.useEffect;
|
|
82
|
+
function tr(t) {
|
|
83
|
+
const r = Ve(), { control: e = r.control, disabled: s, name: u, exact: i } = t || {}, [c, l] = b.useState(e._formState), V = b.useRef({
|
|
84
84
|
isDirty: !1,
|
|
85
85
|
isLoading: !1,
|
|
86
86
|
dirtyFields: !1,
|
|
@@ -90,474 +90,474 @@ function et(e) {
|
|
|
90
90
|
isValid: !1,
|
|
91
91
|
errors: !1
|
|
92
92
|
});
|
|
93
|
-
return
|
|
93
|
+
return Ce(() => e._subscribe({
|
|
94
94
|
name: u,
|
|
95
|
-
formState:
|
|
95
|
+
formState: V.current,
|
|
96
96
|
exact: i,
|
|
97
|
-
callback: (
|
|
98
|
-
!s &&
|
|
99
|
-
...
|
|
100
|
-
...
|
|
97
|
+
callback: (v) => {
|
|
98
|
+
!s && l({
|
|
99
|
+
...e._formState,
|
|
100
|
+
...v
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
}), [u, s, i]), b.useEffect(() => {
|
|
104
|
-
|
|
105
|
-
}, [
|
|
104
|
+
V.current.isValid && e._setValid(!0);
|
|
105
|
+
}, [e]), b.useMemo(() => St(c, e, V.current, !1), [c, e]);
|
|
106
106
|
}
|
|
107
|
-
var Y = (
|
|
108
|
-
function
|
|
109
|
-
if (qe(
|
|
110
|
-
return Object.is(
|
|
111
|
-
if (le(
|
|
112
|
-
return
|
|
113
|
-
const s = Object.keys(
|
|
107
|
+
var Y = (t) => typeof t == "string", He = (t, r, e, s, u) => Y(t) ? (s && r.watch.add(t), m(e, t, u)) : Array.isArray(t) ? t.map((i) => (s && r.watch.add(i), m(e, i))) : (s && (r.watchAll = !0), e), qe = (t) => G(t) || !At(t);
|
|
108
|
+
function te(t, r, e = /* @__PURE__ */ new WeakSet()) {
|
|
109
|
+
if (qe(t) || qe(r))
|
|
110
|
+
return Object.is(t, r);
|
|
111
|
+
if (le(t) && le(r))
|
|
112
|
+
return t.getTime() === r.getTime();
|
|
113
|
+
const s = Object.keys(t), u = Object.keys(r);
|
|
114
114
|
if (s.length !== u.length)
|
|
115
115
|
return !1;
|
|
116
|
-
if (
|
|
116
|
+
if (e.has(t) || e.has(r))
|
|
117
117
|
return !0;
|
|
118
|
-
|
|
118
|
+
e.add(t), e.add(r);
|
|
119
119
|
for (const i of s) {
|
|
120
|
-
const
|
|
120
|
+
const c = t[i];
|
|
121
121
|
if (!u.includes(i))
|
|
122
122
|
return !1;
|
|
123
123
|
if (i !== "ref") {
|
|
124
|
-
const
|
|
125
|
-
if (le(
|
|
124
|
+
const l = r[i];
|
|
125
|
+
if (le(c) && le(l) || P(c) && P(l) || Array.isArray(c) && Array.isArray(l) ? !te(c, l, e) : !Object.is(c, l))
|
|
126
126
|
return !1;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
return !0;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const [
|
|
135
|
-
const f =
|
|
136
|
-
return
|
|
131
|
+
function Je(t) {
|
|
132
|
+
const r = Ve(), { control: e = r.control, name: s, defaultValue: u, disabled: i, exact: c, compute: l } = t || {}, V = b.useRef(u), v = b.useRef(l), x = b.useRef(void 0), g = b.useRef(e), F = b.useRef(s);
|
|
133
|
+
v.current = l;
|
|
134
|
+
const [$, L] = b.useState(() => {
|
|
135
|
+
const f = e._getWatch(s, V.current);
|
|
136
|
+
return v.current ? v.current(f) : f;
|
|
137
137
|
}), w = b.useCallback((f) => {
|
|
138
|
-
const
|
|
139
|
-
return
|
|
140
|
-
}, [
|
|
138
|
+
const d = He(s, e._names, f || e._formValues, !1, V.current);
|
|
139
|
+
return v.current ? v.current(d) : d;
|
|
140
|
+
}, [e._formValues, e._names, s]), N = b.useCallback((f) => {
|
|
141
141
|
if (!i) {
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
const
|
|
145
|
-
|
|
142
|
+
const d = He(s, e._names, f || e._formValues, !1, V.current);
|
|
143
|
+
if (v.current) {
|
|
144
|
+
const p = v.current(d);
|
|
145
|
+
te(p, x.current) || (L(p), x.current = p);
|
|
146
146
|
} else
|
|
147
|
-
|
|
147
|
+
L(d);
|
|
148
148
|
}
|
|
149
|
-
}, [
|
|
150
|
-
|
|
149
|
+
}, [e._formValues, e._names, i, s]);
|
|
150
|
+
Ce(() => ((g.current !== e || !te(F.current, s)) && (g.current = e, F.current = s, N()), e._subscribe({
|
|
151
151
|
name: s,
|
|
152
152
|
formState: {
|
|
153
153
|
values: !0
|
|
154
154
|
},
|
|
155
|
-
exact:
|
|
155
|
+
exact: c,
|
|
156
156
|
callback: (f) => {
|
|
157
|
-
|
|
157
|
+
N(f.values);
|
|
158
158
|
}
|
|
159
|
-
})), [
|
|
160
|
-
const
|
|
159
|
+
})), [e, c, s, N]), b.useEffect(() => e._removeUnmounted());
|
|
160
|
+
const H = g.current !== e, S = F.current, M = b.useMemo(() => {
|
|
161
161
|
if (i)
|
|
162
162
|
return null;
|
|
163
|
-
const f =
|
|
164
|
-
return
|
|
165
|
-
}, [i,
|
|
166
|
-
return
|
|
163
|
+
const f = !H && !te(S, s);
|
|
164
|
+
return H || f ? w() : null;
|
|
165
|
+
}, [i, H, s, S, w]);
|
|
166
|
+
return M !== null ? M : $;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
168
|
+
function rr(t) {
|
|
169
|
+
const r = Ve(), { name: e, disabled: s, control: u = r.control, shouldUnregister: i, defaultValue: c, exact: l = !0 } = t, V = xt(u._names.array, e), v = b.useMemo(() => m(u._formValues, e, m(u._defaultValues, e, c)), [u, e, c]), x = Je({
|
|
170
170
|
control: u,
|
|
171
|
-
name:
|
|
172
|
-
defaultValue:
|
|
173
|
-
exact:
|
|
174
|
-
}), g =
|
|
171
|
+
name: e,
|
|
172
|
+
defaultValue: v,
|
|
173
|
+
exact: l
|
|
174
|
+
}), g = tr({
|
|
175
175
|
control: u,
|
|
176
|
-
name:
|
|
177
|
-
exact:
|
|
178
|
-
}),
|
|
179
|
-
...
|
|
180
|
-
value:
|
|
181
|
-
...K(
|
|
176
|
+
name: e,
|
|
177
|
+
exact: l
|
|
178
|
+
}), F = b.useRef(t), $ = b.useRef(void 0), L = b.useRef(u.register(e, {
|
|
179
|
+
...t.rules,
|
|
180
|
+
value: x,
|
|
181
|
+
...K(t.disabled) ? { disabled: t.disabled } : {}
|
|
182
182
|
}));
|
|
183
|
-
|
|
183
|
+
F.current = t;
|
|
184
184
|
const w = b.useMemo(() => Object.defineProperties({}, {
|
|
185
185
|
invalid: {
|
|
186
186
|
enumerable: !0,
|
|
187
|
-
get: () => !!m(g.errors,
|
|
187
|
+
get: () => !!m(g.errors, e)
|
|
188
188
|
},
|
|
189
189
|
isDirty: {
|
|
190
190
|
enumerable: !0,
|
|
191
|
-
get: () => !!m(g.dirtyFields,
|
|
191
|
+
get: () => !!m(g.dirtyFields, e)
|
|
192
192
|
},
|
|
193
193
|
isTouched: {
|
|
194
194
|
enumerable: !0,
|
|
195
|
-
get: () => !!m(g.touchedFields,
|
|
195
|
+
get: () => !!m(g.touchedFields, e)
|
|
196
196
|
},
|
|
197
197
|
isValidating: {
|
|
198
198
|
enumerable: !0,
|
|
199
|
-
get: () => !!m(g.validatingFields,
|
|
199
|
+
get: () => !!m(g.validatingFields, e)
|
|
200
200
|
},
|
|
201
201
|
error: {
|
|
202
202
|
enumerable: !0,
|
|
203
|
-
get: () => m(g.errors,
|
|
203
|
+
get: () => m(g.errors, e)
|
|
204
204
|
}
|
|
205
|
-
}), [g,
|
|
205
|
+
}), [g, e]), N = b.useCallback((f) => L.current.onChange({
|
|
206
206
|
target: {
|
|
207
|
-
value:
|
|
208
|
-
name:
|
|
207
|
+
value: pt(f),
|
|
208
|
+
name: e
|
|
209
209
|
},
|
|
210
|
-
type:
|
|
211
|
-
}), [
|
|
210
|
+
type: pe.CHANGE
|
|
211
|
+
}), [e]), H = b.useCallback(() => L.current.onBlur({
|
|
212
212
|
target: {
|
|
213
|
-
value: m(u._formValues,
|
|
214
|
-
name:
|
|
213
|
+
value: m(u._formValues, e),
|
|
214
|
+
name: e
|
|
215
215
|
},
|
|
216
|
-
type:
|
|
217
|
-
}), [
|
|
218
|
-
const
|
|
219
|
-
|
|
216
|
+
type: pe.BLUR
|
|
217
|
+
}), [e, u._formValues]), S = b.useCallback((f) => {
|
|
218
|
+
const d = m(u._fields, e);
|
|
219
|
+
d && f && (d._f.ref = {
|
|
220
220
|
focus: () => f.focus && f.focus(),
|
|
221
221
|
select: () => f.select && f.select(),
|
|
222
|
-
setCustomValidity: (
|
|
222
|
+
setCustomValidity: (p) => f.setCustomValidity(p),
|
|
223
223
|
reportValidity: () => f.reportValidity()
|
|
224
224
|
});
|
|
225
|
-
}, [u._fields,
|
|
226
|
-
name:
|
|
227
|
-
value:
|
|
225
|
+
}, [u._fields, e]), M = b.useMemo(() => ({
|
|
226
|
+
name: e,
|
|
227
|
+
value: x,
|
|
228
228
|
...K(s) || g.disabled ? { disabled: g.disabled || s } : {},
|
|
229
|
-
onChange:
|
|
230
|
-
onBlur:
|
|
229
|
+
onChange: N,
|
|
230
|
+
onBlur: H,
|
|
231
231
|
ref: S
|
|
232
|
-
}), [
|
|
232
|
+
}), [e, s, g.disabled, N, H, S, x]);
|
|
233
233
|
return b.useEffect(() => {
|
|
234
|
-
const f = u._options.shouldUnregister || i,
|
|
235
|
-
|
|
236
|
-
...
|
|
237
|
-
...K(
|
|
234
|
+
const f = u._options.shouldUnregister || i, d = $.current;
|
|
235
|
+
d && d !== e && !V && u.unregister(d), u.register(e, {
|
|
236
|
+
...F.current.rules,
|
|
237
|
+
...K(F.current.disabled) ? { disabled: F.current.disabled } : {}
|
|
238
238
|
});
|
|
239
|
-
const
|
|
240
|
-
const
|
|
241
|
-
|
|
239
|
+
const p = (E, Z) => {
|
|
240
|
+
const W = m(u._fields, E);
|
|
241
|
+
W && W._f && (W._f.mount = Z);
|
|
242
242
|
};
|
|
243
|
-
if (
|
|
244
|
-
const E = U(m(u._options.defaultValues,
|
|
245
|
-
R(u._defaultValues,
|
|
243
|
+
if (p(e, !0), f) {
|
|
244
|
+
const E = U(m(u._options.defaultValues, e, F.current.defaultValue));
|
|
245
|
+
R(u._defaultValues, e, E), T(m(u._formValues, e)) && R(u._formValues, e, E);
|
|
246
246
|
}
|
|
247
|
-
return !
|
|
248
|
-
(
|
|
247
|
+
return !V && u.register(e), $.current = e, () => {
|
|
248
|
+
(V ? f && !u._state.action : f) ? u.unregister(e) : p(e, !1);
|
|
249
249
|
};
|
|
250
|
-
}, [
|
|
250
|
+
}, [e, u, V, i]), b.useEffect(() => {
|
|
251
251
|
u._setDisabledField({
|
|
252
252
|
disabled: s,
|
|
253
|
-
name:
|
|
253
|
+
name: e
|
|
254
254
|
});
|
|
255
|
-
}, [s,
|
|
256
|
-
field:
|
|
255
|
+
}, [s, e, u]), b.useMemo(() => ({
|
|
256
|
+
field: M,
|
|
257
257
|
formState: g,
|
|
258
258
|
fieldState: w
|
|
259
|
-
}), [
|
|
259
|
+
}), [M, g, w]);
|
|
260
260
|
}
|
|
261
|
-
const
|
|
262
|
-
var
|
|
263
|
-
...
|
|
261
|
+
const sr = (t) => t.render(rr(t));
|
|
262
|
+
var ar = (t, r, e, s, u) => r ? {
|
|
263
|
+
...e[t],
|
|
264
264
|
types: {
|
|
265
|
-
...
|
|
265
|
+
...e[t] && e[t].types ? e[t].types : {},
|
|
266
266
|
[s]: u || !0
|
|
267
267
|
}
|
|
268
|
-
} : {}, z = (
|
|
269
|
-
let
|
|
268
|
+
} : {}, z = (t) => Array.isArray(t) ? t : [t], ft = () => {
|
|
269
|
+
let t = [];
|
|
270
270
|
return {
|
|
271
271
|
get observers() {
|
|
272
|
-
return
|
|
272
|
+
return t;
|
|
273
273
|
},
|
|
274
274
|
next: (u) => {
|
|
275
|
-
for (const i of
|
|
275
|
+
for (const i of t)
|
|
276
276
|
i.next && i.next(u);
|
|
277
277
|
},
|
|
278
|
-
subscribe: (u) => (
|
|
278
|
+
subscribe: (u) => (t.push(u), {
|
|
279
279
|
unsubscribe: () => {
|
|
280
|
-
|
|
280
|
+
t = t.filter((i) => i !== u);
|
|
281
281
|
}
|
|
282
282
|
}),
|
|
283
283
|
unsubscribe: () => {
|
|
284
|
-
|
|
284
|
+
t = [];
|
|
285
285
|
}
|
|
286
286
|
};
|
|
287
287
|
};
|
|
288
|
-
function
|
|
289
|
-
const
|
|
290
|
-
for (const s in
|
|
291
|
-
if (
|
|
292
|
-
const u =
|
|
293
|
-
if (u &&
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
} else
|
|
288
|
+
function Et(t, r) {
|
|
289
|
+
const e = {};
|
|
290
|
+
for (const s in t)
|
|
291
|
+
if (t.hasOwnProperty(s)) {
|
|
292
|
+
const u = t[s], i = r[s];
|
|
293
|
+
if (u && P(u) && i) {
|
|
294
|
+
const c = Et(u, i);
|
|
295
|
+
P(c) && (e[s] = c);
|
|
296
|
+
} else t[s] && (e[s] = i);
|
|
297
297
|
}
|
|
298
|
-
return
|
|
298
|
+
return e;
|
|
299
299
|
}
|
|
300
|
-
var q = (
|
|
300
|
+
var q = (t) => P(t) && !Object.keys(t).length, Xe = (t) => t.type === "file", re = (t) => typeof t == "function", xe = (t) => {
|
|
301
301
|
if (!ze)
|
|
302
302
|
return !1;
|
|
303
|
-
const
|
|
304
|
-
return
|
|
305
|
-
},
|
|
306
|
-
function
|
|
307
|
-
const
|
|
303
|
+
const r = t ? t.ownerDocument : 0;
|
|
304
|
+
return t instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
305
|
+
}, wt = (t) => t.type === "select-multiple", Ze = (t) => t.type === "radio", nr = (t) => Ze(t) || ve(t), Ue = (t) => xe(t) && t.isConnected;
|
|
306
|
+
function ir(t, r) {
|
|
307
|
+
const e = r.slice(0, -1).length;
|
|
308
308
|
let s = 0;
|
|
309
|
-
for (; s <
|
|
310
|
-
|
|
311
|
-
return
|
|
309
|
+
for (; s < e; )
|
|
310
|
+
t = T(t) ? s++ : t[r[s++]];
|
|
311
|
+
return t;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
for (const
|
|
315
|
-
if (
|
|
313
|
+
function ur(t) {
|
|
314
|
+
for (const r in t)
|
|
315
|
+
if (t.hasOwnProperty(r) && !T(t[r]))
|
|
316
316
|
return !1;
|
|
317
317
|
return !0;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
const
|
|
321
|
-
return s && delete s[i], u !== 0 && (
|
|
319
|
+
function B(t, r) {
|
|
320
|
+
const e = Array.isArray(r) ? r : Ee(r) ? [r] : Ke(r), s = e.length === 1 ? t : ir(t, e), u = e.length - 1, i = e[u];
|
|
321
|
+
return s && delete s[i], u !== 0 && (P(s) && q(s) || Array.isArray(s) && ur(s)) && B(t, e.slice(0, -1)), t;
|
|
322
322
|
}
|
|
323
|
-
var
|
|
324
|
-
for (const
|
|
325
|
-
if (re(
|
|
323
|
+
var or = (t) => {
|
|
324
|
+
for (const r in t)
|
|
325
|
+
if (re(t[r]))
|
|
326
326
|
return !0;
|
|
327
327
|
return !1;
|
|
328
328
|
};
|
|
329
|
-
function
|
|
330
|
-
return Array.isArray(
|
|
329
|
+
function Ct(t) {
|
|
330
|
+
return Array.isArray(t) || P(t) && !or(t);
|
|
331
331
|
}
|
|
332
|
-
function je(
|
|
333
|
-
for (const
|
|
334
|
-
const s = e
|
|
335
|
-
|
|
332
|
+
function je(t, r = {}) {
|
|
333
|
+
for (const e in t) {
|
|
334
|
+
const s = t[e];
|
|
335
|
+
Ct(s) ? (r[e] = Array.isArray(s) ? [] : {}, je(s, r[e])) : T(s) || (r[e] = !0);
|
|
336
336
|
}
|
|
337
|
-
return
|
|
337
|
+
return r;
|
|
338
338
|
}
|
|
339
|
-
function fe(
|
|
340
|
-
|
|
341
|
-
for (const s in
|
|
342
|
-
const u =
|
|
343
|
-
if (
|
|
344
|
-
T(
|
|
339
|
+
function fe(t, r, e) {
|
|
340
|
+
e || (e = je(r));
|
|
341
|
+
for (const s in t) {
|
|
342
|
+
const u = t[s];
|
|
343
|
+
if (Ct(u))
|
|
344
|
+
T(r) || qe(e[s]) ? e[s] = je(u, Array.isArray(u) ? [] : {}) : fe(u, G(r) ? {} : r[s], e[s]);
|
|
345
345
|
else {
|
|
346
|
-
const i =
|
|
347
|
-
|
|
346
|
+
const i = r[s];
|
|
347
|
+
e[s] = !te(u, i);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
return
|
|
350
|
+
return e;
|
|
351
351
|
}
|
|
352
|
-
const
|
|
352
|
+
const yt = {
|
|
353
353
|
value: !1,
|
|
354
354
|
isValid: !1
|
|
355
|
-
},
|
|
356
|
-
var
|
|
357
|
-
if (Array.isArray(
|
|
358
|
-
if (
|
|
359
|
-
const
|
|
360
|
-
return { value:
|
|
355
|
+
}, mt = { value: !0, isValid: !0 };
|
|
356
|
+
var kt = (t) => {
|
|
357
|
+
if (Array.isArray(t)) {
|
|
358
|
+
if (t.length > 1) {
|
|
359
|
+
const r = t.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
|
|
360
|
+
return { value: r, isValid: !!r.length };
|
|
361
361
|
}
|
|
362
|
-
return
|
|
362
|
+
return t[0].checked && !t[0].disabled ? (
|
|
363
363
|
// @ts-expect-error expected to work in the browser
|
|
364
|
-
|
|
365
|
-
) :
|
|
364
|
+
t[0].attributes && !T(t[0].attributes.value) ? T(t[0].value) || t[0].value === "" ? mt : { value: t[0].value, isValid: !0 } : mt
|
|
365
|
+
) : yt;
|
|
366
366
|
}
|
|
367
|
-
return
|
|
368
|
-
},
|
|
369
|
-
const
|
|
367
|
+
return yt;
|
|
368
|
+
}, Dt = (t, { valueAsNumber: r, valueAsDate: e, setValueAs: s }) => T(t) ? t : r ? t === "" ? NaN : t && +t : e && Y(t) ? new Date(t) : s ? s(t) : t;
|
|
369
|
+
const _t = {
|
|
370
370
|
isValid: !1,
|
|
371
371
|
value: null
|
|
372
372
|
};
|
|
373
|
-
var
|
|
373
|
+
var Rt = (t) => Array.isArray(t) ? t.reduce((r, e) => e && e.checked && !e.disabled ? {
|
|
374
374
|
isValid: !0,
|
|
375
|
-
value:
|
|
376
|
-
} :
|
|
377
|
-
function
|
|
378
|
-
const
|
|
379
|
-
return
|
|
375
|
+
value: e.value
|
|
376
|
+
} : r, _t) : _t;
|
|
377
|
+
function gt(t) {
|
|
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(T(r.value) ? t.ref.value : r.value, t);
|
|
380
380
|
}
|
|
381
|
-
var
|
|
381
|
+
var lr = (t, r, e, s) => {
|
|
382
382
|
const u = {};
|
|
383
|
-
for (const i of
|
|
384
|
-
const
|
|
385
|
-
|
|
383
|
+
for (const i of t) {
|
|
384
|
+
const c = m(r, i);
|
|
385
|
+
c && R(u, i, c._f);
|
|
386
386
|
}
|
|
387
387
|
return {
|
|
388
|
-
criteriaMode:
|
|
389
|
-
names: [...
|
|
388
|
+
criteriaMode: e,
|
|
389
|
+
names: [...t],
|
|
390
390
|
fields: u,
|
|
391
391
|
shouldUseNativeValidation: s
|
|
392
392
|
};
|
|
393
|
-
},
|
|
394
|
-
isOnSubmit: !
|
|
395
|
-
isOnBlur:
|
|
396
|
-
isOnChange:
|
|
397
|
-
isOnAll:
|
|
398
|
-
isOnTouch:
|
|
393
|
+
}, Se = (t) => t instanceof RegExp, ge = (t) => T(t) ? t : Se(t) ? t.source : P(t) ? Se(t.value) ? t.value.source : t.value : t, ye = (t) => ({
|
|
394
|
+
isOnSubmit: !t || t === X.onSubmit,
|
|
395
|
+
isOnBlur: t === X.onBlur,
|
|
396
|
+
isOnChange: t === X.onChange,
|
|
397
|
+
isOnAll: t === X.all,
|
|
398
|
+
isOnTouch: t === X.onTouched
|
|
399
399
|
});
|
|
400
|
-
const
|
|
401
|
-
var
|
|
402
|
-
const me = (
|
|
403
|
-
for (const u of
|
|
404
|
-
const i = m(
|
|
400
|
+
const ht = "AsyncFunction";
|
|
401
|
+
var cr = (t) => !!t && !!t.validate && !!(re(t.validate) && t.validate.constructor.name === ht || P(t.validate) && Object.values(t.validate).find((r) => r.constructor.name === ht)), dr = (t) => t.mount && (t.required || t.min || t.max || t.maxLength || t.minLength || t.pattern || t.validate), Qe = (t, r, e) => !e && (r.watchAll || r.watch.has(t) || [...r.watch].some((s) => t.startsWith(s) && /^\.\w+/.test(t.slice(s.length))));
|
|
402
|
+
const me = (t, r, e, s) => {
|
|
403
|
+
for (const u of e || Object.keys(t)) {
|
|
404
|
+
const i = m(t, u);
|
|
405
405
|
if (i) {
|
|
406
|
-
const { _f:
|
|
407
|
-
if (
|
|
408
|
-
if (
|
|
406
|
+
const { _f: c, ...l } = i;
|
|
407
|
+
if (c) {
|
|
408
|
+
if (c.refs && c.refs[0] && r(c.refs[0], u) && !s)
|
|
409
409
|
return !0;
|
|
410
|
-
if (
|
|
410
|
+
if (c.ref && r(c.ref, c.name) && !s)
|
|
411
411
|
return !0;
|
|
412
|
-
if (me(
|
|
412
|
+
if (me(l, r))
|
|
413
413
|
break;
|
|
414
|
-
} else if (
|
|
414
|
+
} else if (P(l) && me(l, r))
|
|
415
415
|
break;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
};
|
|
419
|
-
function
|
|
420
|
-
const s = m(
|
|
421
|
-
if (s ||
|
|
419
|
+
function vt(t, r, e) {
|
|
420
|
+
const s = m(t, e);
|
|
421
|
+
if (s || Ee(e))
|
|
422
422
|
return {
|
|
423
423
|
error: s,
|
|
424
|
-
name:
|
|
424
|
+
name: e
|
|
425
425
|
};
|
|
426
|
-
const u =
|
|
426
|
+
const u = e.split(".");
|
|
427
427
|
for (; u.length; ) {
|
|
428
|
-
const i = u.join("."),
|
|
429
|
-
if (
|
|
430
|
-
return { name:
|
|
431
|
-
if (
|
|
428
|
+
const i = u.join("."), c = m(r, i), l = m(t, i);
|
|
429
|
+
if (c && !Array.isArray(c) && e !== i)
|
|
430
|
+
return { name: e };
|
|
431
|
+
if (l && l.type)
|
|
432
432
|
return {
|
|
433
433
|
name: i,
|
|
434
|
-
error:
|
|
434
|
+
error: l
|
|
435
435
|
};
|
|
436
|
-
if (
|
|
436
|
+
if (l && l.root && l.root.type)
|
|
437
437
|
return {
|
|
438
438
|
name: `${i}.root`,
|
|
439
|
-
error:
|
|
439
|
+
error: l.root
|
|
440
440
|
};
|
|
441
441
|
u.pop();
|
|
442
442
|
}
|
|
443
443
|
return {
|
|
444
|
-
name:
|
|
444
|
+
name: e
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
var
|
|
448
|
-
|
|
449
|
-
const { name: u, ...i } =
|
|
450
|
-
return q(i) || Object.keys(i).length >= Object.keys(
|
|
451
|
-
},
|
|
452
|
-
const s = z(m(
|
|
453
|
-
return R(s, "root",
|
|
447
|
+
var fr = (t, r, e, s) => {
|
|
448
|
+
e(t);
|
|
449
|
+
const { name: u, ...i } = t;
|
|
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), Ot = (t, r, e) => {
|
|
452
|
+
const s = z(m(t, e));
|
|
453
|
+
return R(s, "root", r[e]), R(t, e, s), t;
|
|
454
454
|
};
|
|
455
|
-
function
|
|
456
|
-
if (Y(
|
|
455
|
+
function Vt(t, r, e = "validate") {
|
|
456
|
+
if (Y(t) || Array.isArray(t) && t.every(Y) || K(t) && !t)
|
|
457
457
|
return {
|
|
458
|
-
type:
|
|
459
|
-
message: Y(
|
|
460
|
-
ref:
|
|
458
|
+
type: e,
|
|
459
|
+
message: Y(t) ? t : "",
|
|
460
|
+
ref: r
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
|
-
var de = (
|
|
464
|
-
value:
|
|
463
|
+
var de = (t) => P(t) && !Se(t) ? t : {
|
|
464
|
+
value: t,
|
|
465
465
|
message: ""
|
|
466
|
-
}, Ge = async (
|
|
467
|
-
const { ref:
|
|
468
|
-
if (
|
|
466
|
+
}, Ge = async (t, r, e, s, u, i) => {
|
|
467
|
+
const { ref: c, refs: l, required: V, maxLength: v, minLength: x, min: g, max: F, pattern: $, validate: L, name: w, valueAsNumber: N, mount: H } = t._f, S = m(e, w);
|
|
468
|
+
if (!H || r.has(w))
|
|
469
469
|
return {};
|
|
470
|
-
const
|
|
471
|
-
u &&
|
|
472
|
-
},
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
type:
|
|
476
|
-
message:
|
|
477
|
-
ref:
|
|
478
|
-
...oe(
|
|
470
|
+
const M = l ? l[0] : c, f = (C) => {
|
|
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)) && T(c.value) && T(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
|
+
const ae = C ? D : I;
|
|
474
|
+
d[w] = {
|
|
475
|
+
type: C ? j : Q,
|
|
476
|
+
message: ae,
|
|
477
|
+
ref: c,
|
|
478
|
+
...oe(C ? j : Q, ae)
|
|
479
479
|
};
|
|
480
480
|
};
|
|
481
|
-
if (i ? !Array.isArray(S) || !S.length :
|
|
482
|
-
const { value:
|
|
483
|
-
if (
|
|
481
|
+
if (i ? !Array.isArray(S) || !S.length : V && (!Z && (W || G(S)) || K(S) && !S || E && !kt(l).isValid || p && !Rt(l).isValid)) {
|
|
482
|
+
const { value: C, message: D } = Y(V) ? { value: !!V, message: V } : de(V);
|
|
483
|
+
if (C && (d[w] = {
|
|
484
484
|
type: ne.required,
|
|
485
485
|
message: D,
|
|
486
|
-
ref:
|
|
486
|
+
ref: M,
|
|
487
487
|
...oe(ne.required, D)
|
|
488
488
|
}, !s))
|
|
489
|
-
return f(D),
|
|
489
|
+
return f(D), d;
|
|
490
490
|
}
|
|
491
|
-
if (!
|
|
492
|
-
let
|
|
493
|
-
const
|
|
491
|
+
if (!W && (!G(g) || !G(F))) {
|
|
492
|
+
let C, D;
|
|
493
|
+
const I = de(F), j = de(g);
|
|
494
494
|
if (!G(S) && !isNaN(S)) {
|
|
495
|
-
const Q =
|
|
496
|
-
G(
|
|
495
|
+
const Q = c.valueAsNumber || S && +S;
|
|
496
|
+
G(I.value) || (C = Q > I.value), G(j.value) || (D = Q < j.value);
|
|
497
497
|
} else {
|
|
498
|
-
const Q =
|
|
499
|
-
Y(
|
|
498
|
+
const Q = c.valueAsDate || new Date(S), ae = (Fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Fe), _e = c.type == "time", ce = c.type == "week";
|
|
499
|
+
Y(I.value) && S && (C = _e ? ae(S) > ae(I.value) : ce ? S > I.value : Q > new Date(I.value)), Y(j.value) && S && (D = _e ? ae(S) < ae(j.value) : ce ? S < j.value : Q < new Date(j.value));
|
|
500
500
|
}
|
|
501
|
-
if ((
|
|
502
|
-
return f(
|
|
501
|
+
if ((C || D) && (se(!!C, I.message, j.message, ne.max, ne.min), !s))
|
|
502
|
+
return f(d[w].message), d;
|
|
503
503
|
}
|
|
504
|
-
if ((
|
|
505
|
-
const
|
|
506
|
-
if ((
|
|
507
|
-
return f(
|
|
504
|
+
if ((v || x) && !W && (Y(S) || i && Array.isArray(S))) {
|
|
505
|
+
const C = de(v), D = de(x), I = !G(C.value) && S.length > +C.value, j = !G(D.value) && S.length < +D.value;
|
|
506
|
+
if ((I || j) && (se(I, C.message, D.message), !s))
|
|
507
|
+
return f(d[w].message), d;
|
|
508
508
|
}
|
|
509
|
-
if (
|
|
510
|
-
const { value:
|
|
511
|
-
if (
|
|
509
|
+
if ($ && !W && Y(S)) {
|
|
510
|
+
const { value: C, message: D } = de($);
|
|
511
|
+
if (Se(C) && !S.match(C) && (d[w] = {
|
|
512
512
|
type: ne.pattern,
|
|
513
513
|
message: D,
|
|
514
|
-
ref:
|
|
514
|
+
ref: c,
|
|
515
515
|
...oe(ne.pattern, D)
|
|
516
516
|
}, !s))
|
|
517
|
-
return f(D),
|
|
517
|
+
return f(D), d;
|
|
518
518
|
}
|
|
519
|
-
if (
|
|
520
|
-
if (re(
|
|
521
|
-
const
|
|
522
|
-
if (D && (
|
|
519
|
+
if (L) {
|
|
520
|
+
if (re(L)) {
|
|
521
|
+
const C = await L(S, e), D = Vt(C, M);
|
|
522
|
+
if (D && (d[w] = {
|
|
523
523
|
...D,
|
|
524
524
|
...oe(ne.validate, D.message)
|
|
525
525
|
}, !s))
|
|
526
|
-
return f(D.message),
|
|
527
|
-
} else if (
|
|
528
|
-
let
|
|
529
|
-
for (const D in
|
|
530
|
-
if (!q(
|
|
526
|
+
return f(D.message), d;
|
|
527
|
+
} else if (P(L)) {
|
|
528
|
+
let C = {};
|
|
529
|
+
for (const D in L) {
|
|
530
|
+
if (!q(C) && !s)
|
|
531
531
|
break;
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
...
|
|
535
|
-
...oe(D,
|
|
536
|
-
}, f(
|
|
532
|
+
const I = Vt(await L[D](S, e), M, D);
|
|
533
|
+
I && (C = {
|
|
534
|
+
...I,
|
|
535
|
+
...oe(D, I.message)
|
|
536
|
+
}, f(I.message), s && (d[w] = C));
|
|
537
537
|
}
|
|
538
|
-
if (!q(
|
|
539
|
-
ref:
|
|
540
|
-
...
|
|
538
|
+
if (!q(C) && (d[w] = {
|
|
539
|
+
ref: M,
|
|
540
|
+
...C
|
|
541
541
|
}, !s))
|
|
542
|
-
return
|
|
542
|
+
return d;
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
|
-
return f(!0),
|
|
545
|
+
return f(!0), d;
|
|
546
546
|
};
|
|
547
|
-
const
|
|
547
|
+
const gr = {
|
|
548
548
|
mode: X.onSubmit,
|
|
549
549
|
reValidateMode: X.onChange,
|
|
550
550
|
shouldFocusError: !0
|
|
551
551
|
};
|
|
552
|
-
function
|
|
553
|
-
let
|
|
554
|
-
...
|
|
555
|
-
...
|
|
556
|
-
},
|
|
552
|
+
function hr(t = {}) {
|
|
553
|
+
let r = {
|
|
554
|
+
...gr,
|
|
555
|
+
...t
|
|
556
|
+
}, e = {
|
|
557
557
|
submitCount: 0,
|
|
558
558
|
isDirty: !1,
|
|
559
559
|
isReady: !1,
|
|
560
|
-
isLoading: re(
|
|
560
|
+
isLoading: re(r.defaultValues),
|
|
561
561
|
isValidating: !1,
|
|
562
562
|
isSubmitted: !1,
|
|
563
563
|
isSubmitting: !1,
|
|
@@ -566,20 +566,20 @@ function gt(e = {}) {
|
|
|
566
566
|
touchedFields: {},
|
|
567
567
|
dirtyFields: {},
|
|
568
568
|
validatingFields: {},
|
|
569
|
-
errors:
|
|
570
|
-
disabled:
|
|
571
|
-
}, s = {}, u =
|
|
569
|
+
errors: r.errors || {},
|
|
570
|
+
disabled: r.disabled || !1
|
|
571
|
+
}, s = {}, u = P(r.defaultValues) || P(r.values) ? U(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : U(u), c = {
|
|
572
572
|
action: !1,
|
|
573
573
|
mount: !1,
|
|
574
574
|
watch: !1
|
|
575
|
-
},
|
|
575
|
+
}, l = {
|
|
576
576
|
mount: /* @__PURE__ */ new Set(),
|
|
577
577
|
disabled: /* @__PURE__ */ new Set(),
|
|
578
578
|
unMount: /* @__PURE__ */ new Set(),
|
|
579
579
|
array: /* @__PURE__ */ new Set(),
|
|
580
580
|
watch: /* @__PURE__ */ new Set()
|
|
581
|
-
},
|
|
582
|
-
const
|
|
581
|
+
}, V, v = 0;
|
|
582
|
+
const x = {
|
|
583
583
|
isDirty: !1,
|
|
584
584
|
dirtyFields: !1,
|
|
585
585
|
validatingFields: !1,
|
|
@@ -589,274 +589,274 @@ function gt(e = {}) {
|
|
|
589
589
|
errors: !1
|
|
590
590
|
};
|
|
591
591
|
let g = {
|
|
592
|
-
...
|
|
592
|
+
...x
|
|
593
593
|
};
|
|
594
|
-
const
|
|
595
|
-
array:
|
|
596
|
-
state:
|
|
597
|
-
},
|
|
598
|
-
clearTimeout(
|
|
594
|
+
const F = {
|
|
595
|
+
array: ft(),
|
|
596
|
+
state: ft()
|
|
597
|
+
}, $ = r.criteriaMode === X.all, L = (a) => (n) => {
|
|
598
|
+
clearTimeout(v), v = setTimeout(a, n);
|
|
599
599
|
}, w = async (a) => {
|
|
600
|
-
if (!
|
|
601
|
-
const n =
|
|
602
|
-
n !==
|
|
600
|
+
if (!r.disabled && (x.isValid || g.isValid || a)) {
|
|
601
|
+
const n = r.resolver ? q((await E()).errors) : await W(s, !0);
|
|
602
|
+
n !== e.isValid && F.state.next({
|
|
603
603
|
isValid: n
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
|
-
},
|
|
607
|
-
!
|
|
608
|
-
o && (n ? R(
|
|
609
|
-
}),
|
|
610
|
-
validatingFields:
|
|
611
|
-
isValidating: !q(
|
|
606
|
+
}, N = (a, n) => {
|
|
607
|
+
!r.disabled && (x.isValidating || x.validatingFields || g.isValidating || g.validatingFields) && ((a || Array.from(l.mount)).forEach((o) => {
|
|
608
|
+
o && (n ? R(e.validatingFields, o, n) : B(e.validatingFields, o));
|
|
609
|
+
}), F.state.next({
|
|
610
|
+
validatingFields: e.validatingFields,
|
|
611
|
+
isValidating: !q(e.validatingFields)
|
|
612
612
|
}));
|
|
613
|
-
},
|
|
614
|
-
if (
|
|
615
|
-
if (
|
|
616
|
-
const
|
|
617
|
-
_ && R(s, a,
|
|
613
|
+
}, H = (a, n = [], o, h, _ = !0, y = !0) => {
|
|
614
|
+
if (h && o && !r.disabled) {
|
|
615
|
+
if (c.action = !0, y && Array.isArray(m(s, a))) {
|
|
616
|
+
const A = o(m(s, a), h.argA, h.argB);
|
|
617
|
+
_ && R(s, a, A);
|
|
618
618
|
}
|
|
619
|
-
if (
|
|
620
|
-
const
|
|
621
|
-
_ && R(
|
|
619
|
+
if (y && Array.isArray(m(e.errors, a))) {
|
|
620
|
+
const A = o(m(e.errors, a), h.argA, h.argB);
|
|
621
|
+
_ && R(e.errors, a, A), _r(e.errors, a);
|
|
622
622
|
}
|
|
623
|
-
if ((
|
|
624
|
-
const
|
|
625
|
-
_ && R(
|
|
623
|
+
if ((x.touchedFields || g.touchedFields) && y && Array.isArray(m(e.touchedFields, a))) {
|
|
624
|
+
const A = o(m(e.touchedFields, a), h.argA, h.argB);
|
|
625
|
+
_ && R(e.touchedFields, a, A);
|
|
626
626
|
}
|
|
627
|
-
(
|
|
627
|
+
(x.dirtyFields || g.dirtyFields) && (e.dirtyFields = fe(u, i)), F.state.next({
|
|
628
628
|
name: a,
|
|
629
|
-
isDirty:
|
|
630
|
-
dirtyFields:
|
|
631
|
-
errors:
|
|
632
|
-
isValid:
|
|
629
|
+
isDirty: se(a, n),
|
|
630
|
+
dirtyFields: e.dirtyFields,
|
|
631
|
+
errors: e.errors,
|
|
632
|
+
isValid: e.isValid
|
|
633
633
|
});
|
|
634
634
|
} else
|
|
635
635
|
R(i, a, n);
|
|
636
636
|
}, S = (a, n) => {
|
|
637
|
-
R(
|
|
638
|
-
errors:
|
|
637
|
+
R(e.errors, a, n), F.state.next({
|
|
638
|
+
errors: e.errors
|
|
639
639
|
});
|
|
640
|
-
},
|
|
641
|
-
|
|
642
|
-
errors:
|
|
640
|
+
}, M = (a) => {
|
|
641
|
+
e.errors = a, F.state.next({
|
|
642
|
+
errors: e.errors,
|
|
643
643
|
isValid: !1
|
|
644
644
|
});
|
|
645
|
-
}, f = (a, n, o,
|
|
645
|
+
}, f = (a, n, o, h) => {
|
|
646
646
|
const _ = m(s, a);
|
|
647
647
|
if (_) {
|
|
648
|
-
const
|
|
649
|
-
T(
|
|
648
|
+
const y = m(i, a, T(o) ? m(u, a) : o);
|
|
649
|
+
T(y) || h && h.defaultChecked || n ? R(i, a, n ? y : gt(_._f)) : I(a, y), c.mount && !c.action && w();
|
|
650
650
|
}
|
|
651
|
-
},
|
|
652
|
-
let
|
|
653
|
-
const
|
|
651
|
+
}, d = (a, n, o, h, _) => {
|
|
652
|
+
let y = !1, A = !1;
|
|
653
|
+
const k = {
|
|
654
654
|
name: a
|
|
655
655
|
};
|
|
656
|
-
if (!
|
|
657
|
-
if (!o ||
|
|
658
|
-
(
|
|
659
|
-
const O =
|
|
660
|
-
|
|
656
|
+
if (!r.disabled) {
|
|
657
|
+
if (!o || h) {
|
|
658
|
+
(x.isDirty || g.isDirty) && (A = e.isDirty, e.isDirty = k.isDirty = se(), y = A !== k.isDirty);
|
|
659
|
+
const O = te(m(u, a), n);
|
|
660
|
+
A = !!m(e.dirtyFields, a), O ? B(e.dirtyFields, a) : R(e.dirtyFields, a, !0), k.dirtyFields = e.dirtyFields, y = y || (x.dirtyFields || g.dirtyFields) && A !== !O;
|
|
661
661
|
}
|
|
662
662
|
if (o) {
|
|
663
|
-
const O = m(
|
|
664
|
-
O || (R(
|
|
663
|
+
const O = m(e.touchedFields, a);
|
|
664
|
+
O || (R(e.touchedFields, a, o), k.touchedFields = e.touchedFields, y = y || (x.touchedFields || g.touchedFields) && O !== o);
|
|
665
665
|
}
|
|
666
|
-
|
|
666
|
+
y && _ && F.state.next(k);
|
|
667
667
|
}
|
|
668
|
-
return
|
|
669
|
-
},
|
|
670
|
-
const _ = m(
|
|
671
|
-
if (
|
|
672
|
-
const
|
|
673
|
-
...
|
|
674
|
-
...
|
|
675
|
-
errors:
|
|
668
|
+
return y ? k : {};
|
|
669
|
+
}, p = (a, n, o, h) => {
|
|
670
|
+
const _ = m(e.errors, a), y = (x.isValid || g.isValid) && K(n) && e.isValid !== n;
|
|
671
|
+
if (r.delayError && o ? (V = L(() => S(a, o)), V(r.delayError)) : (clearTimeout(v), V = null, o ? R(e.errors, a, o) : B(e.errors, a)), (o ? !te(_, o) : _) || !q(h) || y) {
|
|
672
|
+
const A = {
|
|
673
|
+
...h,
|
|
674
|
+
...y && K(n) ? { isValid: n } : {},
|
|
675
|
+
errors: e.errors,
|
|
676
676
|
name: a
|
|
677
677
|
};
|
|
678
|
-
|
|
679
|
-
...
|
|
680
|
-
...
|
|
681
|
-
},
|
|
678
|
+
e = {
|
|
679
|
+
...e,
|
|
680
|
+
...A
|
|
681
|
+
}, F.state.next(A);
|
|
682
682
|
}
|
|
683
683
|
}, E = async (a) => {
|
|
684
|
-
|
|
685
|
-
const n = await
|
|
686
|
-
return
|
|
684
|
+
N(a, !0);
|
|
685
|
+
const n = await r.resolver(i, r.context, lr(a || l.mount, s, r.criteriaMode, r.shouldUseNativeValidation));
|
|
686
|
+
return N(a), n;
|
|
687
687
|
}, Z = async (a) => {
|
|
688
688
|
const { errors: n } = await E(a);
|
|
689
689
|
if (a)
|
|
690
690
|
for (const o of a) {
|
|
691
|
-
const
|
|
692
|
-
|
|
691
|
+
const h = m(n, o);
|
|
692
|
+
h ? R(e.errors, o, h) : B(e.errors, o);
|
|
693
693
|
}
|
|
694
694
|
else
|
|
695
|
-
|
|
695
|
+
e.errors = n;
|
|
696
696
|
return n;
|
|
697
|
-
},
|
|
697
|
+
}, W = async (a, n, o = {
|
|
698
698
|
valid: !0
|
|
699
699
|
}) => {
|
|
700
|
-
for (const
|
|
701
|
-
const _ = a[
|
|
700
|
+
for (const h in a) {
|
|
701
|
+
const _ = a[h];
|
|
702
702
|
if (_) {
|
|
703
|
-
const { _f:
|
|
704
|
-
if (
|
|
705
|
-
const
|
|
706
|
-
O &&
|
|
707
|
-
const J = await Ge(_,
|
|
708
|
-
if (O &&
|
|
703
|
+
const { _f: y, ...A } = _;
|
|
704
|
+
if (y) {
|
|
705
|
+
const k = l.array.has(y.name), O = _._f && cr(_._f);
|
|
706
|
+
O && x.validatingFields && N([y.name], !0);
|
|
707
|
+
const J = await Ge(_, l.disabled, i, $, r.shouldUseNativeValidation && !n, k);
|
|
708
|
+
if (O && x.validatingFields && N([y.name]), J[y.name] && (o.valid = !1, n))
|
|
709
709
|
break;
|
|
710
|
-
!n && (m(J,
|
|
710
|
+
!n && (m(J, y.name) ? k ? Ot(e.errors, J, y.name) : R(e.errors, y.name, J[y.name]) : B(e.errors, y.name));
|
|
711
711
|
}
|
|
712
|
-
!q(
|
|
712
|
+
!q(A) && await W(A, n, o);
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
return o.valid;
|
|
716
716
|
}, oe = () => {
|
|
717
|
-
for (const a of
|
|
717
|
+
for (const a of l.unMount) {
|
|
718
718
|
const n = m(s, a);
|
|
719
|
-
n && (n._f.refs ? n._f.refs.every((o) => !
|
|
719
|
+
n && (n._f.refs ? n._f.refs.every((o) => !Ue(o)) : !Ue(n._f.ref)) && ke(a);
|
|
720
720
|
}
|
|
721
|
-
|
|
722
|
-
},
|
|
723
|
-
...
|
|
724
|
-
}, o, n), D = (a) =>
|
|
725
|
-
const
|
|
721
|
+
l.unMount = /* @__PURE__ */ new Set();
|
|
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 : T(n) ? u : Y(a) ? { [a]: n } : n
|
|
724
|
+
}, o, n), D = (a) => we(m(c.mount ? i : u, a, r.shouldUnregister ? m(u, a, []) : [])), I = (a, n, o = {}) => {
|
|
725
|
+
const h = m(s, a);
|
|
726
726
|
let _ = n;
|
|
727
|
-
if (
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
(!
|
|
731
|
-
}) :
|
|
727
|
+
if (h) {
|
|
728
|
+
const y = h._f;
|
|
729
|
+
y && (!y.disabled && R(i, a, Dt(n, y)), _ = xe(y.ref) && G(n) ? "" : n, wt(y.ref) ? [...y.ref.options].forEach((A) => A.selected = _.includes(A.value)) : y.refs ? ve(y.ref) ? y.refs.forEach((A) => {
|
|
730
|
+
(!A.defaultChecked || !A.disabled) && (Array.isArray(_) ? A.checked = !!_.find((k) => k === A.value) : A.checked = _ === A.value || !!_);
|
|
731
|
+
}) : y.refs.forEach((A) => A.checked = A.value === _) : Xe(y.ref) ? y.ref.value = "" : (y.ref.value = _, y.ref.type || F.state.next({
|
|
732
732
|
name: a,
|
|
733
733
|
values: U(i)
|
|
734
734
|
})));
|
|
735
735
|
}
|
|
736
|
-
(o.shouldDirty || o.shouldTouch) &&
|
|
736
|
+
(o.shouldDirty || o.shouldTouch) && d(a, _, o.shouldTouch, o.shouldDirty, !0), o.shouldValidate && ce(a);
|
|
737
737
|
}, j = (a, n, o) => {
|
|
738
|
-
for (const
|
|
739
|
-
if (!n.hasOwnProperty(
|
|
738
|
+
for (const h in n) {
|
|
739
|
+
if (!n.hasOwnProperty(h))
|
|
740
740
|
return;
|
|
741
|
-
const _ = n[
|
|
742
|
-
(
|
|
741
|
+
const _ = n[h], y = a + "." + h, A = m(s, y);
|
|
742
|
+
(l.array.has(a) || P(_) || A && !A._f) && !le(_) ? j(y, _, o) : I(y, _, o);
|
|
743
743
|
}
|
|
744
744
|
}, Q = (a, n, o = {}) => {
|
|
745
|
-
const
|
|
746
|
-
R(i, a,
|
|
745
|
+
const h = m(s, a), _ = l.array.has(a), y = U(n);
|
|
746
|
+
R(i, a, y), _ ? (F.array.next({
|
|
747
747
|
name: a,
|
|
748
748
|
values: U(i)
|
|
749
|
-
}), (
|
|
749
|
+
}), (x.isDirty || x.dirtyFields || g.isDirty || g.dirtyFields) && o.shouldDirty && F.state.next({
|
|
750
750
|
name: a,
|
|
751
751
|
dirtyFields: fe(u, i),
|
|
752
|
-
isDirty:
|
|
753
|
-
})) :
|
|
754
|
-
name:
|
|
752
|
+
isDirty: se(a, y)
|
|
753
|
+
})) : h && !h._f && !G(y) ? j(a, y, o) : I(a, y, o), Qe(a, l) && F.state.next({ ...e, name: a }), F.state.next({
|
|
754
|
+
name: c.mount ? a : void 0,
|
|
755
755
|
values: U(i)
|
|
756
756
|
});
|
|
757
|
-
},
|
|
758
|
-
|
|
757
|
+
}, ae = async (a) => {
|
|
758
|
+
c.mount = !0;
|
|
759
759
|
const n = a.target;
|
|
760
|
-
let o = n.name,
|
|
761
|
-
const _ = m(s, o),
|
|
762
|
-
|
|
763
|
-
},
|
|
760
|
+
let o = n.name, h = !0;
|
|
761
|
+
const _ = m(s, o), y = (O) => {
|
|
762
|
+
h = Number.isNaN(O) || le(O) && isNaN(O.getTime()) || te(O, m(i, o, O));
|
|
763
|
+
}, A = ye(r.mode), k = ye(r.reValidateMode);
|
|
764
764
|
if (_) {
|
|
765
765
|
let O, J;
|
|
766
|
-
const be = n.type ?
|
|
767
|
-
R(i, o, be), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a),
|
|
768
|
-
const
|
|
769
|
-
if (!ie &&
|
|
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), Oe = Qe(o, l, ie);
|
|
767
|
+
R(i, o, be), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), V && V(0)) : _._f.onChange && _._f.onChange(a);
|
|
768
|
+
const Te = d(o, be, ie), qt = !q(Te) || Oe;
|
|
769
|
+
if (!ie && F.state.next({
|
|
770
770
|
name: o,
|
|
771
771
|
type: a.type,
|
|
772
772
|
values: U(i)
|
|
773
|
-
}),
|
|
774
|
-
return (
|
|
775
|
-
if (!ie &&
|
|
776
|
-
const { errors:
|
|
777
|
-
if (
|
|
778
|
-
const
|
|
779
|
-
O =
|
|
773
|
+
}), Ht)
|
|
774
|
+
return (x.isValid || g.isValid) && (r.mode === "onBlur" ? ie && w() : ie || w()), qt && F.state.next({ name: o, ...Oe ? {} : Te });
|
|
775
|
+
if (!ie && Oe && F.state.next({ ...e }), r.resolver) {
|
|
776
|
+
const { errors: lt } = await E([o]);
|
|
777
|
+
if (y(be), h) {
|
|
778
|
+
const jt = vt(e.errors, s, o), ct = vt(lt, s, jt.name || o);
|
|
779
|
+
O = ct.error, o = ct.name, J = q(lt);
|
|
780
780
|
}
|
|
781
781
|
} else
|
|
782
|
-
|
|
783
|
-
|
|
782
|
+
N([o], !0), O = (await Ge(_, l.disabled, i, $, r.shouldUseNativeValidation))[o], N([o]), y(be), h && (O ? 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, O, Te));
|
|
784
784
|
}
|
|
785
|
-
},
|
|
786
|
-
if (m(
|
|
785
|
+
}, _e = (a, n) => {
|
|
786
|
+
if (m(e.errors, n) && a.focus)
|
|
787
787
|
return a.focus(), 1;
|
|
788
788
|
}, ce = async (a, n = {}) => {
|
|
789
|
-
let o,
|
|
789
|
+
let o, h;
|
|
790
790
|
const _ = z(a);
|
|
791
|
-
if (
|
|
792
|
-
const
|
|
793
|
-
o = q(
|
|
794
|
-
} else a ? (
|
|
795
|
-
const
|
|
796
|
-
return await
|
|
797
|
-
}))).every(Boolean), !(!
|
|
798
|
-
return
|
|
799
|
-
...!Y(a) || (
|
|
800
|
-
...
|
|
801
|
-
errors:
|
|
802
|
-
}), n.shouldFocus && !
|
|
803
|
-
},
|
|
791
|
+
if (r.resolver) {
|
|
792
|
+
const y = await Z(T(a) ? a : _);
|
|
793
|
+
o = q(y), h = a ? !_.some((A) => m(y, A)) : o;
|
|
794
|
+
} else a ? (h = (await Promise.all(_.map(async (y) => {
|
|
795
|
+
const A = m(s, y);
|
|
796
|
+
return await W(A && A._f ? { [y]: A } : A);
|
|
797
|
+
}))).every(Boolean), !(!h && !e.isValid) && w()) : h = o = await W(s);
|
|
798
|
+
return F.state.next({
|
|
799
|
+
...!Y(a) || (x.isValid || g.isValid) && o !== e.isValid ? {} : { name: a },
|
|
800
|
+
...r.resolver || !a ? { isValid: o } : {},
|
|
801
|
+
errors: e.errors
|
|
802
|
+
}), n.shouldFocus && !h && me(s, _e, a ? _ : l.mount), h;
|
|
803
|
+
}, Fe = (a, n) => {
|
|
804
804
|
let o = {
|
|
805
|
-
...
|
|
805
|
+
...c.mount ? i : u
|
|
806
806
|
};
|
|
807
|
-
return n && (o =
|
|
808
|
-
},
|
|
809
|
-
invalid: !!m((n ||
|
|
810
|
-
isDirty: !!m((n ||
|
|
811
|
-
error: m((n ||
|
|
812
|
-
isValidating: !!m(
|
|
813
|
-
isTouched: !!m((n ||
|
|
814
|
-
}),
|
|
815
|
-
a && z(a).forEach((n) =>
|
|
816
|
-
errors: a ?
|
|
807
|
+
return n && (o = Et(n.dirtyFields ? e.dirtyFields : e.touchedFields, o)), T(a) ? o : Y(a) ? m(o, a) : a.map((h) => m(o, h));
|
|
808
|
+
}, tt = (a, n) => ({
|
|
809
|
+
invalid: !!m((n || e).errors, a),
|
|
810
|
+
isDirty: !!m((n || e).dirtyFields, a),
|
|
811
|
+
error: m((n || e).errors, a),
|
|
812
|
+
isValidating: !!m(e.validatingFields, a),
|
|
813
|
+
isTouched: !!m((n || e).touchedFields, a)
|
|
814
|
+
}), Lt = (a) => {
|
|
815
|
+
a && z(a).forEach((n) => B(e.errors, n)), F.state.next({
|
|
816
|
+
errors: a ? e.errors : {}
|
|
817
817
|
});
|
|
818
|
-
},
|
|
819
|
-
const
|
|
820
|
-
R(
|
|
818
|
+
}, rt = (a, n, o) => {
|
|
819
|
+
const h = (m(s, a, { _f: {} })._f || {}).ref, _ = m(e.errors, a) || {}, { ref: y, message: A, type: k, ...O } = _;
|
|
820
|
+
R(e.errors, a, {
|
|
821
821
|
...O,
|
|
822
822
|
...n,
|
|
823
|
-
ref:
|
|
824
|
-
}),
|
|
823
|
+
ref: h
|
|
824
|
+
}), F.state.next({
|
|
825
825
|
name: a,
|
|
826
|
-
errors:
|
|
826
|
+
errors: e.errors,
|
|
827
827
|
isValid: !1
|
|
828
|
-
}), o && o.shouldFocus &&
|
|
829
|
-
},
|
|
830
|
-
next: (o) => "values" in o && a(
|
|
831
|
-
}) :
|
|
828
|
+
}), o && o.shouldFocus && h && h.focus && h.focus();
|
|
829
|
+
}, Mt = (a, n) => re(a) ? F.state.subscribe({
|
|
830
|
+
next: (o) => "values" in o && a(C(void 0, n), o)
|
|
831
|
+
}) : C(a, n, !0), st = (a) => F.state.subscribe({
|
|
832
832
|
next: (n) => {
|
|
833
|
-
|
|
833
|
+
yr(a.name, n.name, a.exact) && fr(n, a.formState || x, $t, a.reRenderRoot) && a.callback({
|
|
834
834
|
values: { ...i },
|
|
835
|
-
...
|
|
835
|
+
...e,
|
|
836
836
|
...n,
|
|
837
837
|
defaultValues: u
|
|
838
838
|
});
|
|
839
839
|
}
|
|
840
|
-
}).unsubscribe,
|
|
840
|
+
}).unsubscribe, It = (a) => (c.mount = !0, g = {
|
|
841
841
|
...g,
|
|
842
842
|
...a.formState
|
|
843
|
-
},
|
|
843
|
+
}, st({
|
|
844
844
|
...a,
|
|
845
845
|
formState: g
|
|
846
|
-
})),
|
|
847
|
-
for (const o of a ? z(a) :
|
|
848
|
-
|
|
849
|
-
|
|
846
|
+
})), ke = (a, n = {}) => {
|
|
847
|
+
for (const o of a ? z(a) : l.mount)
|
|
848
|
+
l.mount.delete(o), l.array.delete(o), n.keepValue || (B(s, o), B(i, o)), !n.keepError && B(e.errors, o), !n.keepDirty && B(e.dirtyFields, o), !n.keepTouched && B(e.touchedFields, o), !n.keepIsValidating && B(e.validatingFields, o), !r.shouldUnregister && !n.keepDefaultValue && B(u, o);
|
|
849
|
+
F.state.next({
|
|
850
850
|
values: U(i)
|
|
851
|
-
}),
|
|
852
|
-
...
|
|
853
|
-
...n.keepDirty ? { isDirty:
|
|
851
|
+
}), F.state.next({
|
|
852
|
+
...e,
|
|
853
|
+
...n.keepDirty ? { isDirty: se() } : {}
|
|
854
854
|
}), !n.keepIsValid && w();
|
|
855
|
-
},
|
|
856
|
-
(K(a) &&
|
|
857
|
-
},
|
|
855
|
+
}, at = ({ disabled: a, name: n }) => {
|
|
856
|
+
(K(a) && c.mount || a || l.disabled.has(n)) && (a ? l.disabled.add(n) : l.disabled.delete(n));
|
|
857
|
+
}, De = (a, n = {}) => {
|
|
858
858
|
let o = m(s, a);
|
|
859
|
-
const
|
|
859
|
+
const h = K(n.disabled) || K(r.disabled);
|
|
860
860
|
return R(s, a, {
|
|
861
861
|
...o || {},
|
|
862
862
|
_f: {
|
|
@@ -865,104 +865,104 @@ function gt(e = {}) {
|
|
|
865
865
|
mount: !0,
|
|
866
866
|
...n
|
|
867
867
|
}
|
|
868
|
-
}),
|
|
869
|
-
disabled: K(n.disabled) ? n.disabled :
|
|
868
|
+
}), l.mount.add(a), o ? at({
|
|
869
|
+
disabled: K(n.disabled) ? n.disabled : r.disabled,
|
|
870
870
|
name: a
|
|
871
871
|
}) : f(a, !0, n.value), {
|
|
872
|
-
...
|
|
873
|
-
...
|
|
872
|
+
...h ? { disabled: n.disabled || r.disabled } : {},
|
|
873
|
+
...r.progressive ? {
|
|
874
874
|
required: !!n.required,
|
|
875
|
-
min:
|
|
876
|
-
max:
|
|
877
|
-
minLength:
|
|
878
|
-
maxLength:
|
|
879
|
-
pattern:
|
|
875
|
+
min: ge(n.min),
|
|
876
|
+
max: ge(n.max),
|
|
877
|
+
minLength: ge(n.minLength),
|
|
878
|
+
maxLength: ge(n.maxLength),
|
|
879
|
+
pattern: ge(n.pattern)
|
|
880
880
|
} : {},
|
|
881
881
|
name: a,
|
|
882
|
-
onChange:
|
|
883
|
-
onBlur:
|
|
882
|
+
onChange: ae,
|
|
883
|
+
onBlur: ae,
|
|
884
884
|
ref: (_) => {
|
|
885
885
|
if (_) {
|
|
886
|
-
|
|
887
|
-
const
|
|
888
|
-
if (
|
|
886
|
+
De(a, n), o = m(s, a);
|
|
887
|
+
const y = T(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, A = nr(y), k = o._f.refs || [];
|
|
888
|
+
if (A ? k.find((O) => O === y) : y === o._f.ref)
|
|
889
889
|
return;
|
|
890
890
|
R(s, a, {
|
|
891
891
|
_f: {
|
|
892
892
|
...o._f,
|
|
893
|
-
...
|
|
893
|
+
...A ? {
|
|
894
894
|
refs: [
|
|
895
|
-
...
|
|
896
|
-
|
|
895
|
+
...k.filter(Ue),
|
|
896
|
+
y,
|
|
897
897
|
...Array.isArray(m(u, a)) ? [{}] : []
|
|
898
898
|
],
|
|
899
|
-
ref: { type:
|
|
900
|
-
} : { ref:
|
|
899
|
+
ref: { type: y.type, name: a }
|
|
900
|
+
} : { ref: y }
|
|
901
901
|
}
|
|
902
|
-
}), f(a, !1, void 0,
|
|
902
|
+
}), f(a, !1, void 0, y);
|
|
903
903
|
} else
|
|
904
|
-
o = m(s, a, {}), o._f && (o._f.mount = !1), (
|
|
904
|
+
o = m(s, a, {}), o._f && (o._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(xt(l.array, a) && c.action) && l.unMount.add(a);
|
|
905
905
|
}
|
|
906
906
|
};
|
|
907
|
-
},
|
|
908
|
-
K(a) && (
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
_.disabled =
|
|
907
|
+
}, Re = () => r.shouldFocusError && me(s, _e, l.mount), Bt = (a) => {
|
|
908
|
+
K(a) && (F.state.next({ disabled: a }), me(s, (n, o) => {
|
|
909
|
+
const h = m(s, o);
|
|
910
|
+
h && (n.disabled = h._f.disabled || a, Array.isArray(h._f.refs) && h._f.refs.forEach((_) => {
|
|
911
|
+
_.disabled = h._f.disabled || a;
|
|
912
912
|
}));
|
|
913
913
|
}, 0, !1));
|
|
914
|
-
},
|
|
915
|
-
let
|
|
914
|
+
}, nt = (a, n) => async (o) => {
|
|
915
|
+
let h;
|
|
916
916
|
o && (o.preventDefault && o.preventDefault(), o.persist && o.persist());
|
|
917
917
|
let _ = U(i);
|
|
918
|
-
if (
|
|
918
|
+
if (F.state.next({
|
|
919
919
|
isSubmitting: !0
|
|
920
|
-
}),
|
|
921
|
-
const { errors:
|
|
922
|
-
|
|
920
|
+
}), r.resolver) {
|
|
921
|
+
const { errors: y, values: A } = await E();
|
|
922
|
+
e.errors = y, _ = U(A);
|
|
923
923
|
} else
|
|
924
|
-
await
|
|
925
|
-
if (
|
|
926
|
-
for (const
|
|
927
|
-
|
|
928
|
-
if (
|
|
929
|
-
|
|
924
|
+
await W(s);
|
|
925
|
+
if (l.disabled.size)
|
|
926
|
+
for (const y of l.disabled)
|
|
927
|
+
B(_, y);
|
|
928
|
+
if (B(e.errors, "root"), q(e.errors)) {
|
|
929
|
+
F.state.next({
|
|
930
930
|
errors: {}
|
|
931
931
|
});
|
|
932
932
|
try {
|
|
933
933
|
await a(_, o);
|
|
934
|
-
} catch (
|
|
935
|
-
|
|
934
|
+
} catch (y) {
|
|
935
|
+
h = y;
|
|
936
936
|
}
|
|
937
937
|
} else
|
|
938
|
-
n && await n({ ...
|
|
939
|
-
if (
|
|
938
|
+
n && await n({ ...e.errors }, o), Re(), setTimeout(Re);
|
|
939
|
+
if (F.state.next({
|
|
940
940
|
isSubmitted: !0,
|
|
941
941
|
isSubmitting: !1,
|
|
942
|
-
isSubmitSuccessful: q(
|
|
943
|
-
submitCount:
|
|
944
|
-
errors:
|
|
945
|
-
}),
|
|
946
|
-
throw
|
|
947
|
-
},
|
|
948
|
-
m(s, a) && (T(n.defaultValue) ? Q(a, U(m(u, a))) : (Q(a, n.defaultValue), R(u, a, U(n.defaultValue))), n.keepTouched ||
|
|
949
|
-
},
|
|
950
|
-
const o = a ? U(a) : u,
|
|
942
|
+
isSubmitSuccessful: q(e.errors) && !h,
|
|
943
|
+
submitCount: e.submitCount + 1,
|
|
944
|
+
errors: e.errors
|
|
945
|
+
}), h)
|
|
946
|
+
throw h;
|
|
947
|
+
}, Pt = (a, n = {}) => {
|
|
948
|
+
m(s, a) && (T(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
|
+
}, it = (a, n = {}) => {
|
|
950
|
+
const o = a ? U(a) : u, h = U(o), _ = q(a), y = _ ? u : h;
|
|
951
951
|
if (n.keepDefaultValues || (u = o), !n.keepValues) {
|
|
952
952
|
if (n.keepDirtyValues) {
|
|
953
|
-
const
|
|
954
|
-
...
|
|
953
|
+
const A = /* @__PURE__ */ new Set([
|
|
954
|
+
...l.mount,
|
|
955
955
|
...Object.keys(fe(u, i))
|
|
956
956
|
]);
|
|
957
|
-
for (const
|
|
958
|
-
m(
|
|
957
|
+
for (const k of Array.from(A))
|
|
958
|
+
m(e.dirtyFields, k) ? R(y, k, m(i, k)) : Q(k, m(y, k));
|
|
959
959
|
} else {
|
|
960
960
|
if (ze && T(a))
|
|
961
|
-
for (const
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
964
|
-
const O = Array.isArray(
|
|
965
|
-
if (
|
|
961
|
+
for (const A of l.mount) {
|
|
962
|
+
const k = m(s, A);
|
|
963
|
+
if (k && k._f) {
|
|
964
|
+
const O = Array.isArray(k._f.refs) ? k._f.refs[0] : k._f.ref;
|
|
965
|
+
if (xe(O)) {
|
|
966
966
|
const J = O.closest("form");
|
|
967
967
|
if (J) {
|
|
968
968
|
J.reset();
|
|
@@ -972,74 +972,74 @@ function gt(e = {}) {
|
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
974
|
if (n.keepFieldsRef)
|
|
975
|
-
for (const
|
|
976
|
-
Q(
|
|
975
|
+
for (const A of l.mount)
|
|
976
|
+
Q(A, m(y, A));
|
|
977
977
|
else
|
|
978
978
|
s = {};
|
|
979
979
|
}
|
|
980
|
-
i =
|
|
981
|
-
values: { ...
|
|
982
|
-
}),
|
|
983
|
-
values: { ...
|
|
980
|
+
i = r.shouldUnregister ? n.keepDefaultValues ? U(u) : {} : U(y), F.array.next({
|
|
981
|
+
values: { ...y }
|
|
982
|
+
}), F.state.next({
|
|
983
|
+
values: { ...y }
|
|
984
984
|
});
|
|
985
985
|
}
|
|
986
|
-
|
|
987
|
-
mount: n.keepDirtyValues ?
|
|
986
|
+
l = {
|
|
987
|
+
mount: n.keepDirtyValues ? l.mount : /* @__PURE__ */ new Set(),
|
|
988
988
|
unMount: /* @__PURE__ */ new Set(),
|
|
989
989
|
array: /* @__PURE__ */ new Set(),
|
|
990
990
|
disabled: /* @__PURE__ */ new Set(),
|
|
991
991
|
watch: /* @__PURE__ */ new Set(),
|
|
992
992
|
watchAll: !1,
|
|
993
993
|
focus: ""
|
|
994
|
-
},
|
|
995
|
-
submitCount: n.keepSubmitCount ?
|
|
996
|
-
isDirty: _ ? !1 : n.keepDirty ?
|
|
997
|
-
isSubmitted: n.keepIsSubmitted ?
|
|
998
|
-
dirtyFields: _ ? {} : n.keepDirtyValues ? n.keepDefaultValues && i ? fe(u, i) :
|
|
999
|
-
touchedFields: n.keepTouched ?
|
|
1000
|
-
errors: n.keepErrors ?
|
|
1001
|
-
isSubmitSuccessful: n.keepIsSubmitSuccessful ?
|
|
994
|
+
}, c.mount = !x.isValid || !!n.keepIsValid || !!n.keepDirtyValues || !r.shouldUnregister && !q(y), c.watch = !!r.shouldUnregister, c.action = !1, n.keepErrors || (e.errors = {}), F.state.next({
|
|
995
|
+
submitCount: n.keepSubmitCount ? e.submitCount : 0,
|
|
996
|
+
isDirty: _ ? !1 : n.keepDirty ? e.isDirty : !!(n.keepDefaultValues && !te(a, u)),
|
|
997
|
+
isSubmitted: n.keepIsSubmitted ? e.isSubmitted : !1,
|
|
998
|
+
dirtyFields: _ ? {} : n.keepDirtyValues ? n.keepDefaultValues && i ? fe(u, i) : e.dirtyFields : n.keepDefaultValues && a ? fe(u, a) : n.keepDirty ? e.dirtyFields : {},
|
|
999
|
+
touchedFields: n.keepTouched ? e.touchedFields : {},
|
|
1000
|
+
errors: n.keepErrors ? e.errors : {},
|
|
1001
|
+
isSubmitSuccessful: n.keepIsSubmitSuccessful ? e.isSubmitSuccessful : !1,
|
|
1002
1002
|
isSubmitting: !1,
|
|
1003
1003
|
defaultValues: u
|
|
1004
1004
|
});
|
|
1005
|
-
},
|
|
1006
|
-
const o = m(s, a),
|
|
1007
|
-
if (
|
|
1008
|
-
const _ =
|
|
1005
|
+
}, ut = (a, n) => it(re(a) ? a(i) : a, n), Wt = (a, n = {}) => {
|
|
1006
|
+
const o = m(s, a), h = o && o._f;
|
|
1007
|
+
if (h) {
|
|
1008
|
+
const _ = h.refs ? h.refs[0] : h.ref;
|
|
1009
1009
|
_.focus && (_.focus(), n.shouldSelect && re(_.select) && _.select());
|
|
1010
1010
|
}
|
|
1011
|
-
},
|
|
1012
|
-
|
|
1013
|
-
...
|
|
1011
|
+
}, $t = (a) => {
|
|
1012
|
+
e = {
|
|
1013
|
+
...e,
|
|
1014
1014
|
...a
|
|
1015
1015
|
};
|
|
1016
|
-
},
|
|
1016
|
+
}, ot = {
|
|
1017
1017
|
control: {
|
|
1018
|
-
register:
|
|
1019
|
-
unregister:
|
|
1020
|
-
getFieldState:
|
|
1021
|
-
handleSubmit:
|
|
1022
|
-
setError:
|
|
1023
|
-
_subscribe:
|
|
1018
|
+
register: De,
|
|
1019
|
+
unregister: ke,
|
|
1020
|
+
getFieldState: tt,
|
|
1021
|
+
handleSubmit: nt,
|
|
1022
|
+
setError: rt,
|
|
1023
|
+
_subscribe: st,
|
|
1024
1024
|
_runSchema: E,
|
|
1025
|
-
_focusError:
|
|
1026
|
-
_getWatch:
|
|
1027
|
-
_getDirty:
|
|
1025
|
+
_focusError: Re,
|
|
1026
|
+
_getWatch: C,
|
|
1027
|
+
_getDirty: se,
|
|
1028
1028
|
_setValid: w,
|
|
1029
|
-
_setFieldArray:
|
|
1030
|
-
_setDisabledField:
|
|
1031
|
-
_setErrors:
|
|
1029
|
+
_setFieldArray: H,
|
|
1030
|
+
_setDisabledField: at,
|
|
1031
|
+
_setErrors: M,
|
|
1032
1032
|
_getFieldArray: D,
|
|
1033
|
-
_reset:
|
|
1034
|
-
_resetDefaultValues: () => re(
|
|
1035
|
-
|
|
1033
|
+
_reset: it,
|
|
1034
|
+
_resetDefaultValues: () => re(r.defaultValues) && r.defaultValues().then((a) => {
|
|
1035
|
+
ut(a, r.resetOptions), F.state.next({
|
|
1036
1036
|
isLoading: !1
|
|
1037
1037
|
});
|
|
1038
1038
|
}),
|
|
1039
1039
|
_removeUnmounted: oe,
|
|
1040
|
-
_disableForm:
|
|
1041
|
-
_subjects:
|
|
1042
|
-
_proxyFormState:
|
|
1040
|
+
_disableForm: Bt,
|
|
1041
|
+
_subjects: F,
|
|
1042
|
+
_proxyFormState: x,
|
|
1043
1043
|
get _fields() {
|
|
1044
1044
|
return s;
|
|
1045
1045
|
},
|
|
@@ -1047,192 +1047,192 @@ function gt(e = {}) {
|
|
|
1047
1047
|
return i;
|
|
1048
1048
|
},
|
|
1049
1049
|
get _state() {
|
|
1050
|
-
return
|
|
1050
|
+
return c;
|
|
1051
1051
|
},
|
|
1052
1052
|
set _state(a) {
|
|
1053
|
-
|
|
1053
|
+
c = a;
|
|
1054
1054
|
},
|
|
1055
1055
|
get _defaultValues() {
|
|
1056
1056
|
return u;
|
|
1057
1057
|
},
|
|
1058
1058
|
get _names() {
|
|
1059
|
-
return
|
|
1059
|
+
return l;
|
|
1060
1060
|
},
|
|
1061
1061
|
set _names(a) {
|
|
1062
|
-
|
|
1062
|
+
l = a;
|
|
1063
1063
|
},
|
|
1064
1064
|
get _formState() {
|
|
1065
|
-
return
|
|
1065
|
+
return e;
|
|
1066
1066
|
},
|
|
1067
1067
|
get _options() {
|
|
1068
|
-
return
|
|
1068
|
+
return r;
|
|
1069
1069
|
},
|
|
1070
1070
|
set _options(a) {
|
|
1071
|
-
|
|
1072
|
-
...
|
|
1071
|
+
r = {
|
|
1072
|
+
...r,
|
|
1073
1073
|
...a
|
|
1074
1074
|
};
|
|
1075
1075
|
}
|
|
1076
1076
|
},
|
|
1077
|
-
subscribe:
|
|
1077
|
+
subscribe: It,
|
|
1078
1078
|
trigger: ce,
|
|
1079
|
-
register:
|
|
1080
|
-
handleSubmit:
|
|
1081
|
-
watch:
|
|
1079
|
+
register: De,
|
|
1080
|
+
handleSubmit: nt,
|
|
1081
|
+
watch: Mt,
|
|
1082
1082
|
setValue: Q,
|
|
1083
|
-
getValues:
|
|
1084
|
-
reset:
|
|
1085
|
-
resetField:
|
|
1086
|
-
clearErrors:
|
|
1087
|
-
unregister:
|
|
1088
|
-
setError:
|
|
1089
|
-
setFocus:
|
|
1090
|
-
getFieldState:
|
|
1083
|
+
getValues: Fe,
|
|
1084
|
+
reset: ut,
|
|
1085
|
+
resetField: Pt,
|
|
1086
|
+
clearErrors: Lt,
|
|
1087
|
+
unregister: ke,
|
|
1088
|
+
setError: rt,
|
|
1089
|
+
setFocus: Wt,
|
|
1090
|
+
getFieldState: tt
|
|
1091
1091
|
};
|
|
1092
1092
|
return {
|
|
1093
|
-
...
|
|
1094
|
-
formControl:
|
|
1093
|
+
...ot,
|
|
1094
|
+
formControl: ot
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
1097
|
var ue = () => {
|
|
1098
1098
|
if (typeof crypto < "u" && crypto.randomUUID)
|
|
1099
1099
|
return crypto.randomUUID();
|
|
1100
|
-
const
|
|
1101
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (
|
|
1102
|
-
const
|
|
1103
|
-
return (
|
|
1100
|
+
const t = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
|
|
1101
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
|
|
1102
|
+
const e = (Math.random() * 16 + t) % 16 | 0;
|
|
1103
|
+
return (r == "x" ? e : e & 3 | 8).toString(16);
|
|
1104
1104
|
});
|
|
1105
|
-
},
|
|
1106
|
-
...
|
|
1107
|
-
...z(
|
|
1108
|
-
],
|
|
1105
|
+
}, Ne = (t, r, e = {}) => e.shouldFocus || T(e.shouldFocus) ? e.focusName || `${t}.${T(e.focusIndex) ? r : e.focusIndex}.` : "", Le = (t, r) => [
|
|
1106
|
+
...t,
|
|
1107
|
+
...z(r)
|
|
1108
|
+
], Me = (t) => Array.isArray(t) ? t.map(() => {
|
|
1109
1109
|
}) : void 0;
|
|
1110
|
-
function
|
|
1110
|
+
function Ie(t, r, e) {
|
|
1111
1111
|
return [
|
|
1112
|
-
...
|
|
1113
|
-
...z(
|
|
1114
|
-
...
|
|
1112
|
+
...t.slice(0, r),
|
|
1113
|
+
...z(e),
|
|
1114
|
+
...t.slice(r)
|
|
1115
1115
|
];
|
|
1116
1116
|
}
|
|
1117
|
-
var
|
|
1118
|
-
...z(
|
|
1119
|
-
...z(
|
|
1117
|
+
var Be = (t, r, e) => Array.isArray(t) ? (T(t[e]) && (t[e] = void 0), t.splice(e, 0, t.splice(r, 1)[0]), t) : [], Pe = (t, r) => [
|
|
1118
|
+
...z(r),
|
|
1119
|
+
...z(t)
|
|
1120
1120
|
];
|
|
1121
|
-
function
|
|
1122
|
-
let
|
|
1123
|
-
const s = [...
|
|
1124
|
-
for (const u of
|
|
1125
|
-
s.splice(u -
|
|
1126
|
-
return
|
|
1121
|
+
function vr(t, r) {
|
|
1122
|
+
let e = 0;
|
|
1123
|
+
const s = [...t];
|
|
1124
|
+
for (const u of r)
|
|
1125
|
+
s.splice(u - e, 1), e++;
|
|
1126
|
+
return we(s).length ? s : [];
|
|
1127
1127
|
}
|
|
1128
|
-
var
|
|
1129
|
-
[
|
|
1130
|
-
},
|
|
1131
|
-
function
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1134
|
-
next: ({ values: f, name:
|
|
1135
|
-
if (
|
|
1136
|
-
const
|
|
1137
|
-
Array.isArray(
|
|
1128
|
+
var We = (t, r) => T(r) ? [] : vr(t, z(r).sort((e, s) => e - s)), $e = (t, r, e) => {
|
|
1129
|
+
[t[r], t[e]] = [t[e], t[r]];
|
|
1130
|
+
}, Ft = (t, r, e) => (t[r] = e, t);
|
|
1131
|
+
function Vr(t) {
|
|
1132
|
+
const r = Ve(), { control: e = r.control, name: s, keyName: u = "id", shouldUnregister: i, rules: c } = t, [l, V] = b.useState(e._getFieldArray(s)), v = b.useRef(e._getFieldArray(s).map(ue)), x = b.useRef(!1);
|
|
1133
|
+
e._names.array.add(s), b.useMemo(() => c && l.length >= 0 && e.register(s, c), [e, s, l.length, c]), Ce(() => e._subjects.array.subscribe({
|
|
1134
|
+
next: ({ values: f, name: d }) => {
|
|
1135
|
+
if (d === s || !d) {
|
|
1136
|
+
const p = m(f, s);
|
|
1137
|
+
Array.isArray(p) && (V(p), v.current = p.map(ue));
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
|
-
}).unsubscribe, [
|
|
1140
|
+
}).unsubscribe, [e, s]);
|
|
1141
1141
|
const g = b.useCallback((f) => {
|
|
1142
|
-
|
|
1143
|
-
}, [
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1146
|
-
argA:
|
|
1142
|
+
x.current = !0, e._setFieldArray(s, f);
|
|
1143
|
+
}, [e, s]), F = (f, d) => {
|
|
1144
|
+
const p = z(U(f)), E = Le(e._getFieldArray(s), p);
|
|
1145
|
+
e._names.focus = Ne(s, E.length - 1, d), v.current = Le(v.current, p.map(ue)), g(E), V(E), e._setFieldArray(s, E, Le, {
|
|
1146
|
+
argA: Me(f)
|
|
1147
1147
|
});
|
|
1148
|
-
},
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1151
|
-
argA:
|
|
1148
|
+
}, $ = (f, d) => {
|
|
1149
|
+
const p = z(U(f)), E = Pe(e._getFieldArray(s), p);
|
|
1150
|
+
e._names.focus = Ne(s, 0, d), v.current = Pe(v.current, p.map(ue)), g(E), V(E), e._setFieldArray(s, E, Pe, {
|
|
1151
|
+
argA: Me(f)
|
|
1152
1152
|
});
|
|
1153
|
-
},
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1153
|
+
}, L = (f) => {
|
|
1154
|
+
const d = We(e._getFieldArray(s), f);
|
|
1155
|
+
v.current = We(v.current, f), g(d), V(d), !Array.isArray(m(e._fields, s)) && R(e._fields, s, void 0), e._setFieldArray(s, d, We, {
|
|
1156
1156
|
argA: f
|
|
1157
1157
|
});
|
|
1158
|
-
}, w = (f,
|
|
1159
|
-
const E = z(U(
|
|
1160
|
-
|
|
1158
|
+
}, w = (f, d, p) => {
|
|
1159
|
+
const E = z(U(d)), Z = Ie(e._getFieldArray(s), f, E);
|
|
1160
|
+
e._names.focus = Ne(s, f, p), v.current = Ie(v.current, f, E.map(ue)), g(Z), V(Z), e._setFieldArray(s, Z, Ie, {
|
|
1161
1161
|
argA: f,
|
|
1162
|
-
argB:
|
|
1162
|
+
argB: Me(d)
|
|
1163
1163
|
});
|
|
1164
|
-
},
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1164
|
+
}, N = (f, d) => {
|
|
1165
|
+
const p = e._getFieldArray(s);
|
|
1166
|
+
$e(p, f, d), $e(v.current, f, d), g(p), V(p), e._setFieldArray(s, p, $e, {
|
|
1167
1167
|
argA: f,
|
|
1168
|
-
argB:
|
|
1168
|
+
argB: d
|
|
1169
1169
|
}, !1);
|
|
1170
|
-
},
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1170
|
+
}, H = (f, d) => {
|
|
1171
|
+
const p = e._getFieldArray(s);
|
|
1172
|
+
Be(p, f, d), Be(v.current, f, d), g(p), V(p), e._setFieldArray(s, p, Be, {
|
|
1173
1173
|
argA: f,
|
|
1174
|
-
argB:
|
|
1174
|
+
argB: d
|
|
1175
1175
|
}, !1);
|
|
1176
|
-
}, S = (f,
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1176
|
+
}, S = (f, d) => {
|
|
1177
|
+
const p = U(d), E = Ft(e._getFieldArray(s), f, p);
|
|
1178
|
+
v.current = [...E].map((Z, W) => !Z || W === f ? ue() : v.current[W]), g(E), V([...E]), e._setFieldArray(s, E, Ft, {
|
|
1179
1179
|
argA: f,
|
|
1180
|
-
argB:
|
|
1180
|
+
argB: p
|
|
1181
1181
|
}, !0, !1);
|
|
1182
|
-
},
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1182
|
+
}, M = (f) => {
|
|
1183
|
+
const d = z(U(f));
|
|
1184
|
+
v.current = d.map(ue), g([...d]), V([...d]), e._setFieldArray(s, [...d], (p) => p, {}, !0, !1);
|
|
1185
1185
|
};
|
|
1186
1186
|
return b.useEffect(() => {
|
|
1187
|
-
if (
|
|
1188
|
-
...
|
|
1189
|
-
}),
|
|
1190
|
-
if (
|
|
1191
|
-
|
|
1192
|
-
const
|
|
1193
|
-
(
|
|
1194
|
-
errors:
|
|
1187
|
+
if (e._state.action = !1, Qe(s, e._names) && e._subjects.state.next({
|
|
1188
|
+
...e._formState
|
|
1189
|
+
}), x.current && (!ye(e._options.mode).isOnSubmit || e._formState.isSubmitted) && !ye(e._options.reValidateMode).isOnSubmit)
|
|
1190
|
+
if (e._options.resolver)
|
|
1191
|
+
e._runSchema([s]).then((f) => {
|
|
1192
|
+
const d = m(f.errors, s), p = m(e._formState.errors, s);
|
|
1193
|
+
(p ? !d && p.type || d && (p.type !== d.type || p.message !== d.message) : d && d.type) && (d ? R(e._formState.errors, s, d) : B(e._formState.errors, s), e._subjects.state.next({
|
|
1194
|
+
errors: e._formState.errors
|
|
1195
1195
|
}));
|
|
1196
1196
|
});
|
|
1197
1197
|
else {
|
|
1198
|
-
const f = m(
|
|
1199
|
-
f && f._f && !(ye(
|
|
1200
|
-
errors:
|
|
1198
|
+
const f = m(e._fields, s);
|
|
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: Ot(e._formState.errors, d, s)
|
|
1201
1201
|
}));
|
|
1202
1202
|
}
|
|
1203
|
-
|
|
1203
|
+
e._subjects.state.next({
|
|
1204
1204
|
name: s,
|
|
1205
|
-
values: U(
|
|
1206
|
-
}),
|
|
1207
|
-
if (
|
|
1205
|
+
values: U(e._formValues)
|
|
1206
|
+
}), e._names.focus && me(e._fields, (f, d) => {
|
|
1207
|
+
if (e._names.focus && d.startsWith(e._names.focus) && f.focus)
|
|
1208
1208
|
return f.focus(), 1;
|
|
1209
|
-
}),
|
|
1210
|
-
}, [
|
|
1211
|
-
const f = (
|
|
1212
|
-
const E = m(
|
|
1213
|
-
E && E._f && (E._f.mount =
|
|
1209
|
+
}), e._names.focus = "", e._setValid(), x.current = !1;
|
|
1210
|
+
}, [l, s, e]), b.useEffect(() => (!m(e._formValues, s) && e._setFieldArray(s), () => {
|
|
1211
|
+
const f = (d, p) => {
|
|
1212
|
+
const E = m(e._fields, d);
|
|
1213
|
+
E && E._f && (E._f.mount = p);
|
|
1214
1214
|
};
|
|
1215
|
-
|
|
1216
|
-
}), [s,
|
|
1217
|
-
swap: b.useCallback(
|
|
1218
|
-
move: b.useCallback(
|
|
1219
|
-
prepend: b.useCallback(
|
|
1220
|
-
append: b.useCallback(
|
|
1221
|
-
remove: b.useCallback(
|
|
1222
|
-
insert: b.useCallback(w, [g, s,
|
|
1223
|
-
update: b.useCallback(S, [g, s,
|
|
1224
|
-
replace: b.useCallback(
|
|
1225
|
-
fields: b.useMemo(() =>
|
|
1215
|
+
e._options.shouldUnregister || i ? e.unregister(s) : f(s, !1);
|
|
1216
|
+
}), [s, e, u, i]), {
|
|
1217
|
+
swap: b.useCallback(N, [g, s, e]),
|
|
1218
|
+
move: b.useCallback(H, [g, s, e]),
|
|
1219
|
+
prepend: b.useCallback($, [g, s, e]),
|
|
1220
|
+
append: b.useCallback(F, [g, s, e]),
|
|
1221
|
+
remove: b.useCallback(L, [g, s, e]),
|
|
1222
|
+
insert: b.useCallback(w, [g, s, e]),
|
|
1223
|
+
update: b.useCallback(S, [g, s, e]),
|
|
1224
|
+
replace: b.useCallback(M, [g, s, e]),
|
|
1225
|
+
fields: b.useMemo(() => l.map((f, d) => ({
|
|
1226
1226
|
...f,
|
|
1227
|
-
[u]:
|
|
1228
|
-
})), [
|
|
1227
|
+
[u]: v.current[d] || ue()
|
|
1228
|
+
})), [l, u])
|
|
1229
1229
|
};
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1232
|
-
const
|
|
1231
|
+
function Fr(t = {}) {
|
|
1232
|
+
const r = b.useRef(void 0), e = b.useRef(void 0), [s, u] = b.useState({
|
|
1233
1233
|
isDirty: !1,
|
|
1234
1234
|
isValidating: !1,
|
|
1235
|
-
isLoading: re(
|
|
1235
|
+
isLoading: re(t.defaultValues),
|
|
1236
1236
|
isSubmitted: !1,
|
|
1237
1237
|
isSubmitting: !1,
|
|
1238
1238
|
isSubmitSuccessful: !1,
|
|
@@ -1241,257 +1241,273 @@ function Vt(e = {}) {
|
|
|
1241
1241
|
dirtyFields: {},
|
|
1242
1242
|
touchedFields: {},
|
|
1243
1243
|
validatingFields: {},
|
|
1244
|
-
errors:
|
|
1245
|
-
disabled:
|
|
1244
|
+
errors: t.errors || {},
|
|
1245
|
+
disabled: t.disabled || !1,
|
|
1246
1246
|
isReady: !1,
|
|
1247
|
-
defaultValues: re(
|
|
1247
|
+
defaultValues: re(t.defaultValues) ? void 0 : t.defaultValues
|
|
1248
1248
|
});
|
|
1249
|
-
if (!
|
|
1250
|
-
if (
|
|
1251
|
-
|
|
1252
|
-
...
|
|
1249
|
+
if (!r.current)
|
|
1250
|
+
if (t.formControl)
|
|
1251
|
+
r.current = {
|
|
1252
|
+
...t.formControl,
|
|
1253
1253
|
formState: s
|
|
1254
|
-
},
|
|
1254
|
+
}, t.defaultValues && !re(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
|
|
1255
1255
|
else {
|
|
1256
|
-
const { formControl:
|
|
1257
|
-
|
|
1258
|
-
...
|
|
1256
|
+
const { formControl: c, ...l } = hr(t);
|
|
1257
|
+
r.current = {
|
|
1258
|
+
...l,
|
|
1259
1259
|
formState: s
|
|
1260
1260
|
};
|
|
1261
1261
|
}
|
|
1262
|
-
const i =
|
|
1263
|
-
return i._options =
|
|
1264
|
-
const
|
|
1262
|
+
const i = r.current.control;
|
|
1263
|
+
return i._options = t, Ce(() => {
|
|
1264
|
+
const c = i._subscribe({
|
|
1265
1265
|
formState: i._proxyFormState,
|
|
1266
1266
|
callback: () => u({ ...i._formState }),
|
|
1267
1267
|
reRenderRoot: !0
|
|
1268
1268
|
});
|
|
1269
|
-
return u((
|
|
1270
|
-
...
|
|
1269
|
+
return u((l) => ({
|
|
1270
|
+
...l,
|
|
1271
1271
|
isReady: !0
|
|
1272
|
-
})), i._formState.isReady = !0,
|
|
1273
|
-
}, [i]), b.useEffect(() => i._disableForm(
|
|
1274
|
-
|
|
1275
|
-
}, [i,
|
|
1276
|
-
|
|
1277
|
-
}, [i,
|
|
1278
|
-
|
|
1272
|
+
})), i._formState.isReady = !0, c;
|
|
1273
|
+
}, [i]), b.useEffect(() => i._disableForm(t.disabled), [i, t.disabled]), b.useEffect(() => {
|
|
1274
|
+
t.mode && (i._options.mode = t.mode), t.reValidateMode && (i._options.reValidateMode = t.reValidateMode);
|
|
1275
|
+
}, [i, t.mode, t.reValidateMode]), b.useEffect(() => {
|
|
1276
|
+
t.errors && (i._setErrors(t.errors), i._focusError());
|
|
1277
|
+
}, [i, t.errors]), b.useEffect(() => {
|
|
1278
|
+
t.shouldUnregister && i._subjects.state.next({
|
|
1279
1279
|
values: i._getWatch()
|
|
1280
1280
|
});
|
|
1281
|
-
}, [i,
|
|
1281
|
+
}, [i, t.shouldUnregister]), b.useEffect(() => {
|
|
1282
1282
|
if (i._proxyFormState.isDirty) {
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1285
|
-
isDirty:
|
|
1283
|
+
const c = i._getDirty();
|
|
1284
|
+
c !== s.isDirty && i._subjects.state.next({
|
|
1285
|
+
isDirty: c
|
|
1286
1286
|
});
|
|
1287
1287
|
}
|
|
1288
1288
|
}, [i, s.isDirty]), b.useEffect(() => {
|
|
1289
|
-
var
|
|
1290
|
-
|
|
1289
|
+
var c;
|
|
1290
|
+
t.values && !te(t.values, e.current) ? (i._reset(t.values, {
|
|
1291
1291
|
keepFieldsRef: !0,
|
|
1292
1292
|
...i._options.resetOptions
|
|
1293
|
-
}), !((
|
|
1294
|
-
}, [i,
|
|
1293
|
+
}), !((c = i._options.resetOptions) === null || c === void 0) && c.keepIsValid || i._setValid(), e.current = t.values, u((l) => ({ ...l }))) : i._resetDefaultValues();
|
|
1294
|
+
}, [i, t.values]), b.useEffect(() => {
|
|
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
|
|
1300
|
-
if (!
|
|
1298
|
+
const Tt = Gt(void 0), br = ({ showAsterisk: t, children: r }) => /* @__PURE__ */ ee(Tt.Provider, { value: { showAsterisk: t }, children: r }), Ar = () => {
|
|
1299
|
+
const t = zt(Tt);
|
|
1300
|
+
if (!t)
|
|
1301
1301
|
throw new Error("useSuprFormContext must be used within a SuprFormProvider");
|
|
1302
|
-
return
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1302
|
+
return t;
|
|
1303
|
+
};
|
|
1304
|
+
function Ut(t, r, e) {
|
|
1305
|
+
const { conditions: s, operator: u } = e, i = t.reduce((l, V, v) => (l[V] = r[v], l), {}), c = s.map((l) => {
|
|
1306
|
+
const V = i[l.name];
|
|
1307
|
+
switch (l.operator) {
|
|
1308
|
+
case "EQUALS":
|
|
1309
|
+
return V === l.value;
|
|
1310
|
+
case "NOT_EQUALS":
|
|
1311
|
+
return V !== l.value;
|
|
1312
|
+
case "GREATER_THAN":
|
|
1313
|
+
return V > l.value;
|
|
1314
|
+
case "LESS_THAN":
|
|
1315
|
+
return V < l.value;
|
|
1316
|
+
case "GREATER_THAN_OR_EQUAL":
|
|
1317
|
+
return V >= l.value;
|
|
1318
|
+
case "LESS_THAN_OR_EQUAL":
|
|
1319
|
+
return V <= l.value;
|
|
1320
|
+
case "STARTS_WITH":
|
|
1321
|
+
return V.startsWith(l.value);
|
|
1322
|
+
case "ENDS_WITH":
|
|
1323
|
+
return V.endsWith(l.value);
|
|
1324
|
+
case "INCLUDES":
|
|
1325
|
+
return V.includes(l.value);
|
|
1326
|
+
case "NOT_INCLUDES":
|
|
1327
|
+
return !V.includes(l.value);
|
|
1328
|
+
default:
|
|
1329
|
+
return !1;
|
|
1330
|
+
}
|
|
1331
|
+
});
|
|
1332
|
+
return console.log("Condition results:", c, "Operator:", u), u === "AND" ? c.every(Boolean) : c.some(Boolean);
|
|
1333
|
+
}
|
|
1334
|
+
const pr = ({
|
|
1335
|
+
children: t,
|
|
1336
|
+
visibility: r
|
|
1306
1337
|
}) => {
|
|
1307
|
-
const
|
|
1308
|
-
return
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
case "GREATER_THAN":
|
|
1319
|
-
return g > V.value;
|
|
1320
|
-
case "LESS_THAN":
|
|
1321
|
-
return g < V.value;
|
|
1322
|
-
case "GREATER_THAN_OR_EQUAL":
|
|
1323
|
-
return g >= V.value;
|
|
1324
|
-
case "LESS_THAN_OR_EQUAL":
|
|
1325
|
-
return g <= V.value;
|
|
1326
|
-
case "STARTS_WITH":
|
|
1327
|
-
return g.startsWith(V.value);
|
|
1328
|
-
case "ENDS_WITH":
|
|
1329
|
-
return g.endsWith(V.value);
|
|
1330
|
-
case "INCLUDES":
|
|
1331
|
-
return g.includes(V.value);
|
|
1332
|
-
case "NOT_INCLUDES":
|
|
1333
|
-
return !g.includes(V.value);
|
|
1334
|
-
default:
|
|
1335
|
-
return !1;
|
|
1336
|
-
}
|
|
1337
|
-
});
|
|
1338
|
-
return c === "AND" ? h.every(Boolean) : h.some(Boolean);
|
|
1339
|
-
}, [t, s, u, r]) ? e : null;
|
|
1340
|
-
}, Ur = ({
|
|
1341
|
-
children: e,
|
|
1342
|
-
onSubmit: t = () => {
|
|
1338
|
+
const e = he(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Je({ name: e });
|
|
1339
|
+
return he(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !0 : Ut(e, s, r), [r, e, s]) ? t : null;
|
|
1340
|
+
}, xr = ({
|
|
1341
|
+
children: t,
|
|
1342
|
+
disabled: r
|
|
1343
|
+
}) => {
|
|
1344
|
+
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 });
|
|
1346
|
+
}, Nt = ({
|
|
1347
|
+
children: t,
|
|
1348
|
+
onSubmit: r = () => {
|
|
1343
1349
|
},
|
|
1344
|
-
onError:
|
|
1350
|
+
onError: e = () => {
|
|
1345
1351
|
},
|
|
1346
1352
|
style: s = {},
|
|
1347
1353
|
className: u = "",
|
|
1348
1354
|
formOptions: i,
|
|
1349
|
-
showAsterisk:
|
|
1350
|
-
ref:
|
|
1351
|
-
onChange:
|
|
1355
|
+
showAsterisk: c,
|
|
1356
|
+
ref: l,
|
|
1357
|
+
onChange: V
|
|
1352
1358
|
}) => {
|
|
1353
|
-
const
|
|
1359
|
+
const v = Fr({
|
|
1354
1360
|
mode: "onSubmit",
|
|
1355
1361
|
reValidateMode: "onChange",
|
|
1356
1362
|
shouldFocusError: !0,
|
|
1357
1363
|
...i
|
|
1358
1364
|
});
|
|
1359
|
-
return
|
|
1360
|
-
|
|
1365
|
+
return bt(
|
|
1366
|
+
l,
|
|
1361
1367
|
() => ({
|
|
1362
|
-
setValue:
|
|
1363
|
-
setError:
|
|
1364
|
-
clearErrors:
|
|
1365
|
-
getValues:
|
|
1366
|
-
reset:
|
|
1367
|
-
setFocus:
|
|
1368
|
-
resetField:
|
|
1369
|
-
trigger:
|
|
1370
|
-
unregister:
|
|
1371
|
-
watch:
|
|
1372
|
-
handleSubmit:
|
|
1368
|
+
setValue: v.setValue,
|
|
1369
|
+
setError: v.setError,
|
|
1370
|
+
clearErrors: v.clearErrors,
|
|
1371
|
+
getValues: v.getValues,
|
|
1372
|
+
reset: v.reset,
|
|
1373
|
+
setFocus: v.setFocus,
|
|
1374
|
+
resetField: v.resetField,
|
|
1375
|
+
trigger: v.trigger,
|
|
1376
|
+
unregister: v.unregister,
|
|
1377
|
+
watch: v.watch,
|
|
1378
|
+
handleSubmit: v.handleSubmit
|
|
1373
1379
|
}),
|
|
1374
|
-
[
|
|
1375
|
-
),
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1380
|
+
[v]
|
|
1381
|
+
), Kt(() => {
|
|
1382
|
+
const x = v.watch((g) => {
|
|
1383
|
+
V == null || V(g);
|
|
1378
1384
|
});
|
|
1379
|
-
return () =>
|
|
1380
|
-
}, [
|
|
1385
|
+
return () => x.unsubscribe();
|
|
1386
|
+
}, [v.watch]), /* @__PURE__ */ ee(br, { showAsterisk: c, children: /* @__PURE__ */ ee(er, { ...v, children: /* @__PURE__ */ ee(
|
|
1381
1387
|
"form",
|
|
1382
1388
|
{
|
|
1383
1389
|
noValidate: !0,
|
|
1384
|
-
onSubmit:
|
|
1390
|
+
onSubmit: v.handleSubmit(r, e),
|
|
1385
1391
|
style: s,
|
|
1386
1392
|
className: u,
|
|
1387
|
-
children:
|
|
1393
|
+
children: t
|
|
1388
1394
|
}
|
|
1389
1395
|
) }) });
|
|
1390
|
-
},
|
|
1391
|
-
children:
|
|
1392
|
-
name:
|
|
1393
|
-
rules:
|
|
1396
|
+
}, et = ({
|
|
1397
|
+
children: t,
|
|
1398
|
+
name: r,
|
|
1399
|
+
rules: e,
|
|
1394
1400
|
className: s = "",
|
|
1395
1401
|
label: u,
|
|
1396
1402
|
id: i,
|
|
1397
|
-
disabled:
|
|
1398
|
-
shouldUnregister:
|
|
1399
|
-
visibility:
|
|
1403
|
+
disabled: c,
|
|
1404
|
+
shouldUnregister: l,
|
|
1405
|
+
visibility: V
|
|
1400
1406
|
}) => {
|
|
1401
|
-
const { control:
|
|
1402
|
-
|
|
1407
|
+
const { control: v } = Ve(), x = t.props.value ?? "", { showAsterisk: g } = Ar(), F = t.props.onChange, $ = t.props.onBlur, L = he(() => i || crypto.randomUUID(), []);
|
|
1408
|
+
return /* @__PURE__ */ ee(pr, { visibility: V, children: /* @__PURE__ */ ee(xr, { disabled: c, children: /* @__PURE__ */ ee(
|
|
1409
|
+
sr,
|
|
1403
1410
|
{
|
|
1404
|
-
control:
|
|
1405
|
-
name:
|
|
1406
|
-
rules:
|
|
1407
|
-
defaultValue:
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
+
control: v,
|
|
1412
|
+
name: r,
|
|
1413
|
+
rules: e,
|
|
1414
|
+
defaultValue: x,
|
|
1415
|
+
shouldUnregister: l,
|
|
1416
|
+
render: ({
|
|
1417
|
+
field: { name: w, onBlur: N, value: H, onChange: S, ref: M, disabled: f },
|
|
1418
|
+
fieldState: { error: d }
|
|
1419
|
+
}) => /* @__PURE__ */ dt(
|
|
1411
1420
|
"div",
|
|
1412
1421
|
{
|
|
1413
1422
|
className: `controlled-field ${s}`,
|
|
1414
1423
|
style: { display: "flex", flexDirection: "column", gap: "5px" },
|
|
1415
1424
|
children: [
|
|
1416
|
-
u && /* @__PURE__ */
|
|
1425
|
+
u && /* @__PURE__ */ dt("label", { htmlFor: L, className: "controlled-field-label", children: [
|
|
1417
1426
|
u,
|
|
1418
|
-
g && !!
|
|
1427
|
+
g && !!e && /* @__PURE__ */ ee("span", { style: { color: "red" }, children: " *" })
|
|
1419
1428
|
] }),
|
|
1420
|
-
|
|
1421
|
-
...
|
|
1422
|
-
id:
|
|
1423
|
-
name:
|
|
1424
|
-
disabled:
|
|
1425
|
-
onChange: (...
|
|
1426
|
-
|
|
1429
|
+
Ae(t, {
|
|
1430
|
+
...t.props,
|
|
1431
|
+
id: L,
|
|
1432
|
+
name: w,
|
|
1433
|
+
disabled: f,
|
|
1434
|
+
onChange: (...p) => {
|
|
1435
|
+
S(...p), F == null || F(...p);
|
|
1427
1436
|
},
|
|
1428
|
-
value:
|
|
1429
|
-
onBlur: (...
|
|
1430
|
-
|
|
1437
|
+
value: H,
|
|
1438
|
+
onBlur: (...p) => {
|
|
1439
|
+
N(), $ == null || $(...p);
|
|
1431
1440
|
},
|
|
1432
|
-
ref:
|
|
1441
|
+
ref: M
|
|
1433
1442
|
}),
|
|
1434
|
-
|
|
1443
|
+
d && /* @__PURE__ */ ee("div", { style: { color: "red", fontSize: 13 }, className: "controlled-field-error", children: d.message })
|
|
1435
1444
|
]
|
|
1436
1445
|
}
|
|
1437
1446
|
)
|
|
1438
1447
|
}
|
|
1439
|
-
);
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
ref: r,
|
|
1448
|
+
) }) });
|
|
1449
|
+
}, Sr = ({
|
|
1450
|
+
name: t,
|
|
1451
|
+
rules: r,
|
|
1452
|
+
ref: e,
|
|
1445
1453
|
children: s,
|
|
1446
|
-
visibility: u
|
|
1454
|
+
visibility: u,
|
|
1455
|
+
disabled: i
|
|
1447
1456
|
}) => {
|
|
1448
|
-
const
|
|
1449
|
-
name:
|
|
1450
|
-
rules:
|
|
1457
|
+
const c = Vr({
|
|
1458
|
+
name: t,
|
|
1459
|
+
rules: r
|
|
1451
1460
|
});
|
|
1452
|
-
|
|
1453
|
-
const l = (
|
|
1454
|
-
var
|
|
1455
|
-
if (!
|
|
1456
|
-
return
|
|
1457
|
-
const
|
|
1458
|
-
if (((
|
|
1459
|
-
const N = u ? u[
|
|
1461
|
+
bt(e, () => c, [c]);
|
|
1462
|
+
const l = (V, v) => Yt.map(V, (x) => {
|
|
1463
|
+
var L, w;
|
|
1464
|
+
if (!Jt(x))
|
|
1465
|
+
return x;
|
|
1466
|
+
const g = x.props, F = x.type;
|
|
1467
|
+
if (((F == null ? void 0 : F.displayName) === "SuprFormControl" || F === et || g.name !== void 0 && typeof F != "string") && g.name !== void 0) {
|
|
1468
|
+
const N = u ? u[g.name] : void 0, H = N ? {
|
|
1460
1469
|
...N,
|
|
1461
|
-
conditions: ((
|
|
1462
|
-
|
|
1463
|
-
name: `${
|
|
1470
|
+
conditions: ((L = N.conditions) == null ? void 0 : L.map((d) => ({
|
|
1471
|
+
...d,
|
|
1472
|
+
name: `${v}${d.name}`
|
|
1473
|
+
}))) || []
|
|
1474
|
+
} : void 0, S = i ? i[g.name] : void 0, M = S ? {
|
|
1475
|
+
...S,
|
|
1476
|
+
conditions: ((w = S.conditions) == null ? void 0 : w.map((d) => ({
|
|
1477
|
+
...d,
|
|
1478
|
+
name: `${v}${d.name}`
|
|
1464
1479
|
}))) || []
|
|
1465
|
-
} : void 0,
|
|
1466
|
-
...
|
|
1467
|
-
name: `${
|
|
1468
|
-
visibility:
|
|
1480
|
+
} : void 0, f = {
|
|
1481
|
+
...g,
|
|
1482
|
+
name: `${v}${g.name}`,
|
|
1483
|
+
visibility: H,
|
|
1484
|
+
disabled: M
|
|
1469
1485
|
};
|
|
1470
|
-
return
|
|
1486
|
+
return g.id !== void 0 && (f.id = `${v}${g.id}`), Ae(x, f);
|
|
1471
1487
|
}
|
|
1472
|
-
return
|
|
1473
|
-
...
|
|
1474
|
-
children: l(
|
|
1475
|
-
}) :
|
|
1488
|
+
return g.children ? Ae(x, {
|
|
1489
|
+
...g,
|
|
1490
|
+
children: l(g.children, v)
|
|
1491
|
+
}) : x;
|
|
1476
1492
|
});
|
|
1477
|
-
return /* @__PURE__ */
|
|
1478
|
-
const
|
|
1479
|
-
return /* @__PURE__ */
|
|
1493
|
+
return /* @__PURE__ */ ee(Qt, { children: c.fields.map((V, v) => {
|
|
1494
|
+
const x = `${t}.${v}.`;
|
|
1495
|
+
return /* @__PURE__ */ ee(
|
|
1480
1496
|
"div",
|
|
1481
1497
|
{
|
|
1482
|
-
"data-index":
|
|
1498
|
+
"data-index": v,
|
|
1483
1499
|
style: { display: "contents" },
|
|
1484
1500
|
id: "field-array-item",
|
|
1485
|
-
children: l(s,
|
|
1501
|
+
children: l(s, x)
|
|
1486
1502
|
},
|
|
1487
|
-
|
|
1503
|
+
x
|
|
1488
1504
|
);
|
|
1489
1505
|
}) });
|
|
1490
1506
|
};
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1507
|
+
et.displayName = "SuprFormControl";
|
|
1508
|
+
Nt.Control = et;
|
|
1509
|
+
Nt.ControlArray = Sr;
|
|
1494
1510
|
export {
|
|
1495
|
-
|
|
1511
|
+
Nt as SuprForm
|
|
1496
1512
|
};
|
|
1497
1513
|
//# sourceMappingURL=suprform.es.js.map
|