autoforma 2.10.1 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +352 -352
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var De = { exports: {} },
|
|
1
|
+
import k, { useMemo as he, createContext as Wt, useContext as $t, useState as xt, useEffect as Ce, useRef as Et, useImperativeHandle as Yt } from "react";
|
|
2
|
+
var De = { exports: {} }, pe = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -11,7 +11,7 @@ var De = { exports: {} }, we = {};
|
|
|
11
11
|
*/
|
|
12
12
|
var it;
|
|
13
13
|
function qt() {
|
|
14
|
-
if (it) return
|
|
14
|
+
if (it) return pe;
|
|
15
15
|
it = 1;
|
|
16
16
|
var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
17
17
|
function t(n, o, i) {
|
|
@@ -29,9 +29,9 @@ function qt() {
|
|
|
29
29
|
props: i
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return pe.Fragment = r, pe.jsx = t, pe.jsxs = t, pe;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var we = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -47,20 +47,20 @@ function zt() {
|
|
|
47
47
|
function e(c) {
|
|
48
48
|
if (c == null) return null;
|
|
49
49
|
if (typeof c == "function")
|
|
50
|
-
return c.$$typeof ===
|
|
50
|
+
return c.$$typeof === ge ? null : c.displayName || c.name || null;
|
|
51
51
|
if (typeof c == "string") return c;
|
|
52
52
|
switch (c) {
|
|
53
|
-
case
|
|
53
|
+
case W:
|
|
54
54
|
return "Fragment";
|
|
55
55
|
case E:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case $:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case
|
|
59
|
+
case K:
|
|
60
60
|
return "Suspense";
|
|
61
|
-
case
|
|
61
|
+
case oe:
|
|
62
62
|
return "SuspenseList";
|
|
63
|
-
case
|
|
63
|
+
case X:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
66
|
if (typeof c == "object")
|
|
@@ -71,14 +71,14 @@ function zt() {
|
|
|
71
71
|
return "Portal";
|
|
72
72
|
case C:
|
|
73
73
|
return c.displayName || "Context";
|
|
74
|
-
case
|
|
74
|
+
case J:
|
|
75
75
|
return (c._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case
|
|
76
|
+
case R:
|
|
77
77
|
var g = c.render;
|
|
78
78
|
return c = c.displayName, c || (c = g.displayName || g.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
|
|
79
|
-
case se:
|
|
80
|
-
return g = c.displayName || null, g !== null ? g : e(c.type) || "Memo";
|
|
81
79
|
case j:
|
|
80
|
+
return g = c.displayName || null, g !== null ? g : e(c.type) || "Memo";
|
|
81
|
+
case G:
|
|
82
82
|
g = c._payload, c = c._init;
|
|
83
83
|
try {
|
|
84
84
|
return e(c(g));
|
|
@@ -108,8 +108,8 @@ function zt() {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
function n(c) {
|
|
111
|
-
if (c ===
|
|
112
|
-
if (typeof c == "object" && c !== null && c.$$typeof ===
|
|
111
|
+
if (c === W) return "<>";
|
|
112
|
+
if (typeof c == "object" && c !== null && c.$$typeof === G)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
115
|
var g = e(c);
|
|
@@ -126,7 +126,7 @@ function zt() {
|
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
128
|
function u(c) {
|
|
129
|
-
if (
|
|
129
|
+
if (w.call(c, "key")) {
|
|
130
130
|
var g = Object.getOwnPropertyDescriptor(c, "key").get;
|
|
131
131
|
if (g && g.isReactWarning) return !1;
|
|
132
132
|
}
|
|
@@ -134,7 +134,7 @@ function zt() {
|
|
|
134
134
|
}
|
|
135
135
|
function f(c, g) {
|
|
136
136
|
function P() {
|
|
137
|
-
|
|
137
|
+
ee || (ee = !0, console.error(
|
|
138
138
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
139
|
g
|
|
140
140
|
));
|
|
@@ -146,19 +146,19 @@ function zt() {
|
|
|
146
146
|
}
|
|
147
147
|
function F() {
|
|
148
148
|
var c = e(this.type);
|
|
149
|
-
return
|
|
149
|
+
return Z[c] || (Z[c] = !0, console.error(
|
|
150
150
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
151
|
)), c = this.props.ref, c !== void 0 ? c : null;
|
|
152
152
|
}
|
|
153
153
|
function A(c, g, P, L, _e, xe) {
|
|
154
|
-
var
|
|
154
|
+
var U = P.ref;
|
|
155
155
|
return c = {
|
|
156
|
-
$$typeof:
|
|
156
|
+
$$typeof: B,
|
|
157
157
|
type: c,
|
|
158
158
|
key: g,
|
|
159
159
|
props: P,
|
|
160
160
|
_owner: L
|
|
161
|
-
}, (
|
|
161
|
+
}, (U !== void 0 ? U : null) !== null ? Object.defineProperty(c, "ref", {
|
|
162
162
|
enumerable: !1,
|
|
163
163
|
get: F
|
|
164
164
|
}) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", {
|
|
@@ -184,24 +184,24 @@ function zt() {
|
|
|
184
184
|
}), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
|
|
185
185
|
}
|
|
186
186
|
function T(c, g, P, L, _e, xe) {
|
|
187
|
-
var
|
|
188
|
-
if (
|
|
187
|
+
var U = g.children;
|
|
188
|
+
if (U !== void 0)
|
|
189
189
|
if (L)
|
|
190
|
-
if (U
|
|
191
|
-
for (L = 0; L <
|
|
192
|
-
x(
|
|
193
|
-
Object.freeze && Object.freeze(
|
|
190
|
+
if (I(U)) {
|
|
191
|
+
for (L = 0; L < U.length; L++)
|
|
192
|
+
x(U[L]);
|
|
193
|
+
Object.freeze && Object.freeze(U);
|
|
194
194
|
} else
|
|
195
195
|
console.error(
|
|
196
196
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
197
|
);
|
|
198
|
-
else x(
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
var
|
|
198
|
+
else x(U);
|
|
199
|
+
if (w.call(g, "key")) {
|
|
200
|
+
U = e(c);
|
|
201
|
+
var le = Object.keys(g).filter(function(Ae) {
|
|
202
202
|
return Ae !== "key";
|
|
203
203
|
});
|
|
204
|
-
L = 0 <
|
|
204
|
+
L = 0 < le.length ? "{key: someKey, " + le.join(": ..., ") + ": ...}" : "{key: someKey}", ye[U + L] || (le = 0 < le.length ? "{" + le.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
205
|
`A props object containing a "key" prop is being spread into JSX:
|
|
206
206
|
let props = %s;
|
|
207
207
|
<%s {...props} />
|
|
@@ -209,22 +209,22 @@ React keys must be passed directly to JSX without using spread:
|
|
|
209
209
|
let props = %s;
|
|
210
210
|
<%s key={someKey} {...props} />`,
|
|
211
211
|
L,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
),
|
|
212
|
+
U,
|
|
213
|
+
le,
|
|
214
|
+
U
|
|
215
|
+
), ye[U + L] = !0);
|
|
216
216
|
}
|
|
217
|
-
if (
|
|
217
|
+
if (U = null, P !== void 0 && (t(P), U = "" + P), u(g) && (t(g.key), U = "" + g.key), "key" in g) {
|
|
218
218
|
P = {};
|
|
219
219
|
for (var Ee in g)
|
|
220
220
|
Ee !== "key" && (P[Ee] = g[Ee]);
|
|
221
221
|
} else P = g;
|
|
222
|
-
return
|
|
222
|
+
return U && f(
|
|
223
223
|
P,
|
|
224
224
|
typeof c == "function" ? c.displayName || c.name || "Unknown" : c
|
|
225
225
|
), A(
|
|
226
226
|
c,
|
|
227
|
-
|
|
227
|
+
U,
|
|
228
228
|
P,
|
|
229
229
|
o(),
|
|
230
230
|
_e,
|
|
@@ -232,12 +232,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
function x(c) {
|
|
235
|
-
|
|
235
|
+
p(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof === G && (c._payload.status === "fulfilled" ? p(c._payload.value) && c._payload.value._store && (c._payload.value._store.validated = 1) : c._store && (c._store.validated = 1));
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
return typeof c == "object" && c !== null && c.$$typeof ===
|
|
237
|
+
function p(c) {
|
|
238
|
+
return typeof c == "object" && c !== null && c.$$typeof === B;
|
|
239
239
|
}
|
|
240
|
-
var b =
|
|
240
|
+
var b = k, B = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), W = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), C = Symbol.for("react.context"), R = Symbol.for("react.forward_ref"), K = Symbol.for("react.suspense"), oe = Symbol.for("react.suspense_list"), j = Symbol.for("react.memo"), G = Symbol.for("react.lazy"), X = Symbol.for("react.activity"), ge = Symbol.for("react.client.reference"), _ = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, w = Object.prototype.hasOwnProperty, I = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
241
241
|
return null;
|
|
242
242
|
};
|
|
243
243
|
b = {
|
|
@@ -245,63 +245,63 @@ React keys must be passed directly to JSX without using spread:
|
|
|
245
245
|
return c();
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
var
|
|
248
|
+
var ee, Z = {}, fe = b.react_stack_bottom_frame.bind(
|
|
249
249
|
b,
|
|
250
250
|
i
|
|
251
|
-
)(),
|
|
252
|
-
|
|
251
|
+
)(), de = Y(n(i)), ye = {};
|
|
252
|
+
we.Fragment = W, we.jsx = function(c, g, P) {
|
|
253
253
|
var L = 1e4 > _.recentlyCreatedOwnerStacks++;
|
|
254
254
|
return T(
|
|
255
255
|
c,
|
|
256
256
|
g,
|
|
257
257
|
P,
|
|
258
258
|
!1,
|
|
259
|
-
L ? Error("react-stack-top-frame") :
|
|
260
|
-
L ?
|
|
259
|
+
L ? Error("react-stack-top-frame") : fe,
|
|
260
|
+
L ? Y(n(c)) : de
|
|
261
261
|
);
|
|
262
|
-
},
|
|
262
|
+
}, we.jsxs = function(c, g, P) {
|
|
263
263
|
var L = 1e4 > _.recentlyCreatedOwnerStacks++;
|
|
264
264
|
return T(
|
|
265
265
|
c,
|
|
266
266
|
g,
|
|
267
267
|
P,
|
|
268
268
|
!0,
|
|
269
|
-
L ? Error("react-stack-top-frame") :
|
|
270
|
-
L ?
|
|
269
|
+
L ? Error("react-stack-top-frame") : fe,
|
|
270
|
+
L ? Y(n(c)) : de
|
|
271
271
|
);
|
|
272
272
|
};
|
|
273
|
-
})()),
|
|
273
|
+
})()), we;
|
|
274
274
|
}
|
|
275
275
|
var ot;
|
|
276
276
|
function Ht() {
|
|
277
277
|
return ot || (ot = 1, process.env.NODE_ENV === "production" ? De.exports = qt() : De.exports = zt()), De.exports;
|
|
278
278
|
}
|
|
279
|
-
var V = Ht(), Te = (e) => e.type === "checkbox",
|
|
279
|
+
var V = Ht(), Te = (e) => e.type === "checkbox", ve = (e) => e instanceof Date, te = (e) => e == null;
|
|
280
280
|
const Vt = (e) => typeof e == "object";
|
|
281
|
-
var
|
|
281
|
+
var z = (e) => !te(e) && !Array.isArray(e) && Vt(e) && !ve(e), Jt = (e) => z(e) && e.target ? Te(e.target) ? e.target.checked : e.target.value : e, Gt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Xt = (e, r) => e.has(Gt(r)), Zt = (e) => {
|
|
282
282
|
const r = e.constructor && e.constructor.prototype;
|
|
283
|
-
return
|
|
283
|
+
return z(r) && r.hasOwnProperty("isPrototypeOf");
|
|
284
284
|
}, ze = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
285
|
-
function
|
|
285
|
+
function H(e) {
|
|
286
286
|
if (e instanceof Date)
|
|
287
287
|
return new Date(e);
|
|
288
288
|
const r = typeof FileList < "u" && e instanceof FileList;
|
|
289
289
|
if (ze && (e instanceof Blob || r))
|
|
290
290
|
return e;
|
|
291
291
|
const t = Array.isArray(e);
|
|
292
|
-
if (!t && !(
|
|
292
|
+
if (!t && !(z(e) && Zt(e)))
|
|
293
293
|
return e;
|
|
294
294
|
const n = t ? [] : Object.create(Object.getPrototypeOf(e));
|
|
295
295
|
for (const o in e)
|
|
296
|
-
Object.prototype.hasOwnProperty.call(e, o) && (n[o] =
|
|
296
|
+
Object.prototype.hasOwnProperty.call(e, o) && (n[o] = H(e[o]));
|
|
297
297
|
return n;
|
|
298
298
|
}
|
|
299
|
-
var Ie = (e) => /^\w*$/.test(e),
|
|
300
|
-
if (!r || !
|
|
299
|
+
var Ie = (e) => /^\w*$/.test(e), M = (e) => e === void 0, He = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Je = (e) => He(e.replace(/["|']|\]/g, "").split(/\.|\[/)), h = (e, r, t) => {
|
|
300
|
+
if (!r || !z(e))
|
|
301
301
|
return t;
|
|
302
|
-
const n = (Ie(r) ? [r] : Je(r)).reduce((o, i) =>
|
|
303
|
-
return
|
|
304
|
-
},
|
|
302
|
+
const n = (Ie(r) ? [r] : Je(r)).reduce((o, i) => te(o) ? o : o[i], e);
|
|
303
|
+
return M(n) || n === e ? M(e[r]) ? t : e[r] : n;
|
|
304
|
+
}, ue = (e) => typeof e == "boolean", ne = (e) => typeof e == "function", N = (e, r, t) => {
|
|
305
305
|
let n = -1;
|
|
306
306
|
const o = Ie(r) ? [r] : Je(r), i = o.length, u = i - 1;
|
|
307
307
|
for (; ++n < i; ) {
|
|
@@ -309,7 +309,7 @@ var Ie = (e) => /^\w*$/.test(e), B = (e) => e === void 0, He = (e) => Array.isAr
|
|
|
309
309
|
let F = t;
|
|
310
310
|
if (n !== u) {
|
|
311
311
|
const A = e[f];
|
|
312
|
-
F =
|
|
312
|
+
F = z(A) || Array.isArray(A) ? A : isNaN(+o[n + 1]) ? {} : [];
|
|
313
313
|
}
|
|
314
314
|
if (f === "__proto__" || f === "constructor" || f === "prototype")
|
|
315
315
|
return;
|
|
@@ -325,7 +325,7 @@ const lt = {
|
|
|
325
325
|
onSubmit: "onSubmit",
|
|
326
326
|
onTouched: "onTouched",
|
|
327
327
|
all: "all"
|
|
328
|
-
},
|
|
328
|
+
}, ce = {
|
|
329
329
|
max: "max",
|
|
330
330
|
min: "min",
|
|
331
331
|
maxLength: "maxLength",
|
|
@@ -333,11 +333,11 @@ const lt = {
|
|
|
333
333
|
pattern: "pattern",
|
|
334
334
|
required: "required",
|
|
335
335
|
validate: "validate"
|
|
336
|
-
}, Ge =
|
|
336
|
+
}, Ge = k.createContext(null);
|
|
337
337
|
Ge.displayName = "HookFormContext";
|
|
338
|
-
const
|
|
338
|
+
const be = () => k.useContext(Ge), Qt = (e) => {
|
|
339
339
|
const { children: r, ...t } = e;
|
|
340
|
-
return
|
|
340
|
+
return k.createElement(Ge.Provider, { value: t }, r);
|
|
341
341
|
};
|
|
342
342
|
var Kt = (e, r, t, n = !0) => {
|
|
343
343
|
const o = {
|
|
@@ -352,12 +352,12 @@ var Kt = (e, r, t, n = !0) => {
|
|
|
352
352
|
});
|
|
353
353
|
return o;
|
|
354
354
|
};
|
|
355
|
-
const Ft = typeof window < "u" ?
|
|
356
|
-
var
|
|
355
|
+
const Ft = typeof window < "u" ? k.useLayoutEffect : k.useEffect;
|
|
356
|
+
var re = (e) => typeof e == "string", $e = (e, r, t, n, o) => re(e) ? (n && r.watch.add(e), h(t, e, o)) : Array.isArray(e) ? e.map((i) => (n && r.watch.add(i), h(t, i))) : (n && (r.watchAll = !0), t), Ye = (e) => te(e) || !Vt(e);
|
|
357
357
|
function ae(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
358
358
|
if (Ye(e) || Ye(r))
|
|
359
359
|
return Object.is(e, r);
|
|
360
|
-
if (
|
|
360
|
+
if (ve(e) && ve(r))
|
|
361
361
|
return e.getTime() === r.getTime();
|
|
362
362
|
const n = Object.keys(e), o = Object.keys(r);
|
|
363
363
|
if (n.length !== o.length)
|
|
@@ -371,48 +371,48 @@ function ae(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
371
371
|
return !1;
|
|
372
372
|
if (i !== "ref") {
|
|
373
373
|
const f = r[i];
|
|
374
|
-
if (
|
|
374
|
+
if (ve(u) && ve(f) || z(u) && z(f) || Array.isArray(u) && Array.isArray(f) ? !ae(u, f, t) : !Object.is(u, f))
|
|
375
375
|
return !1;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
return !0;
|
|
379
379
|
}
|
|
380
380
|
function At(e) {
|
|
381
|
-
const r =
|
|
381
|
+
const r = be(), { control: t = r.control, name: n, defaultValue: o, disabled: i, exact: u, compute: f } = e || {}, F = k.useRef(o), A = k.useRef(f), T = k.useRef(void 0), x = k.useRef(t), p = k.useRef(n);
|
|
382
382
|
A.current = f;
|
|
383
|
-
const [b,
|
|
383
|
+
const [b, B] = k.useState(() => {
|
|
384
384
|
const C = t._getWatch(n, F.current);
|
|
385
385
|
return A.current ? A.current(C) : C;
|
|
386
|
-
}), O =
|
|
387
|
-
const
|
|
388
|
-
return A.current ? A.current(
|
|
389
|
-
}, [t._formValues, t._names, n]),
|
|
386
|
+
}), O = k.useCallback((C) => {
|
|
387
|
+
const R = $e(n, t._names, C || t._formValues, !1, F.current);
|
|
388
|
+
return A.current ? A.current(R) : R;
|
|
389
|
+
}, [t._formValues, t._names, n]), W = k.useCallback((C) => {
|
|
390
390
|
if (!i) {
|
|
391
|
-
const
|
|
391
|
+
const R = $e(n, t._names, C || t._formValues, !1, F.current);
|
|
392
392
|
if (A.current) {
|
|
393
|
-
const
|
|
394
|
-
ae(
|
|
393
|
+
const K = A.current(R);
|
|
394
|
+
ae(K, T.current) || (B(K), T.current = K);
|
|
395
395
|
} else
|
|
396
|
-
|
|
396
|
+
B(R);
|
|
397
397
|
}
|
|
398
398
|
}, [t._formValues, t._names, i, n]);
|
|
399
|
-
Ft(() => ((x.current !== t || !ae(
|
|
399
|
+
Ft(() => ((x.current !== t || !ae(p.current, n)) && (x.current = t, p.current = n, W()), t._subscribe({
|
|
400
400
|
name: n,
|
|
401
401
|
formState: {
|
|
402
402
|
values: !0
|
|
403
403
|
},
|
|
404
404
|
exact: u,
|
|
405
405
|
callback: (C) => {
|
|
406
|
-
|
|
406
|
+
W(C.values);
|
|
407
407
|
}
|
|
408
|
-
})), [t, u, n,
|
|
409
|
-
const
|
|
408
|
+
})), [t, u, n, W]), k.useEffect(() => t._removeUnmounted());
|
|
409
|
+
const $ = x.current !== t, E = p.current, J = k.useMemo(() => {
|
|
410
410
|
if (i)
|
|
411
411
|
return null;
|
|
412
|
-
const C =
|
|
413
|
-
return
|
|
414
|
-
}, [i,
|
|
415
|
-
return
|
|
412
|
+
const C = !$ && !ae(E, n);
|
|
413
|
+
return $ || C ? O() : null;
|
|
414
|
+
}, [i, $, n, E, O]);
|
|
415
|
+
return J !== null ? J : b;
|
|
416
416
|
}
|
|
417
417
|
var er = (e, r, t, n, o) => r ? {
|
|
418
418
|
...t[e],
|
|
@@ -440,40 +440,40 @@ var er = (e, r, t, n, o) => r ? {
|
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
};
|
|
443
|
-
function
|
|
443
|
+
function pt(e, r) {
|
|
444
444
|
const t = {};
|
|
445
445
|
for (const n in e)
|
|
446
446
|
if (e.hasOwnProperty(n)) {
|
|
447
447
|
const o = e[n], i = r[n];
|
|
448
|
-
if (o &&
|
|
449
|
-
const u =
|
|
450
|
-
|
|
448
|
+
if (o && z(o) && i) {
|
|
449
|
+
const u = pt(o, i);
|
|
450
|
+
z(u) && (t[n] = u);
|
|
451
451
|
} else e[n] && (t[n] = i);
|
|
452
452
|
}
|
|
453
453
|
return t;
|
|
454
454
|
}
|
|
455
|
-
var
|
|
455
|
+
var Q = (e) => z(e) && !Object.keys(e).length, Xe = (e) => e.type === "file", je = (e) => {
|
|
456
456
|
if (!ze)
|
|
457
457
|
return !1;
|
|
458
458
|
const r = e ? e.ownerDocument : 0;
|
|
459
459
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
460
|
-
},
|
|
460
|
+
}, wt = (e) => e.type === "select-multiple", Ze = (e) => e.type === "radio", tr = (e) => Ze(e) || Te(e), We = (e) => je(e) && e.isConnected;
|
|
461
461
|
function rr(e, r) {
|
|
462
462
|
const t = r.slice(0, -1).length;
|
|
463
463
|
let n = 0;
|
|
464
464
|
for (; n < t; )
|
|
465
|
-
e =
|
|
465
|
+
e = M(e) ? n++ : e[r[n++]];
|
|
466
466
|
return e;
|
|
467
467
|
}
|
|
468
468
|
function sr(e) {
|
|
469
469
|
for (const r in e)
|
|
470
|
-
if (e.hasOwnProperty(r) && !
|
|
470
|
+
if (e.hasOwnProperty(r) && !M(e[r]))
|
|
471
471
|
return !1;
|
|
472
472
|
return !0;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function q(e, r) {
|
|
475
475
|
const t = Array.isArray(r) ? r : Ie(r) ? [r] : Je(r), n = t.length === 1 ? e : rr(e, t), o = t.length - 1, i = t[o];
|
|
476
|
-
return n && delete n[i], o !== 0 && (
|
|
476
|
+
return n && delete n[i], o !== 0 && (z(n) && Q(n) || Array.isArray(n) && sr(n)) && q(e, t.slice(0, -1)), e;
|
|
477
477
|
}
|
|
478
478
|
var nr = (e) => {
|
|
479
479
|
for (const r in e)
|
|
@@ -482,12 +482,12 @@ var nr = (e) => {
|
|
|
482
482
|
return !1;
|
|
483
483
|
};
|
|
484
484
|
function Rt(e) {
|
|
485
|
-
return Array.isArray(e) ||
|
|
485
|
+
return Array.isArray(e) || z(e) && !nr(e);
|
|
486
486
|
}
|
|
487
487
|
function qe(e, r = {}) {
|
|
488
488
|
for (const t in e) {
|
|
489
489
|
const n = e[t];
|
|
490
|
-
Rt(n) ? (r[t] = Array.isArray(n) ? [] : {}, qe(n, r[t])) :
|
|
490
|
+
Rt(n) ? (r[t] = Array.isArray(n) ? [] : {}, qe(n, r[t])) : M(n) || (r[t] = !0);
|
|
491
491
|
}
|
|
492
492
|
return r;
|
|
493
493
|
}
|
|
@@ -496,7 +496,7 @@ function Fe(e, r, t) {
|
|
|
496
496
|
for (const n in e) {
|
|
497
497
|
const o = e[n];
|
|
498
498
|
if (Rt(o))
|
|
499
|
-
|
|
499
|
+
M(r) || Ye(t[n]) ? t[n] = qe(o, Array.isArray(o) ? [] : {}) : Fe(o, te(r) ? {} : r[n], t[n]);
|
|
500
500
|
else {
|
|
501
501
|
const i = r[n];
|
|
502
502
|
t[n] = !ae(o, i);
|
|
@@ -516,11 +516,11 @@ var kt = (e) => {
|
|
|
516
516
|
}
|
|
517
517
|
return e[0].checked && !e[0].disabled ? (
|
|
518
518
|
// @ts-expect-error expected to work in the browser
|
|
519
|
-
e[0].attributes && !
|
|
519
|
+
e[0].attributes && !M(e[0].attributes.value) ? M(e[0].value) || e[0].value === "" ? ft : { value: e[0].value, isValid: !0 } : ft
|
|
520
520
|
) : ct;
|
|
521
521
|
}
|
|
522
522
|
return ct;
|
|
523
|
-
}, St = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) =>
|
|
523
|
+
}, St = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => M(e) ? e : r ? e === "" ? NaN : e && +e : t && re(e) ? new Date(e) : n ? n(e) : e;
|
|
524
524
|
const dt = {
|
|
525
525
|
isValid: !1,
|
|
526
526
|
value: null
|
|
@@ -531,7 +531,7 @@ var Tt = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disab
|
|
|
531
531
|
} : r, dt) : dt;
|
|
532
532
|
function yt(e) {
|
|
533
533
|
const r = e.ref;
|
|
534
|
-
return Xe(r) ? r.files : Ze(r) ? Tt(e.refs).value :
|
|
534
|
+
return Xe(r) ? r.files : Ze(r) ? Tt(e.refs).value : wt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Te(r) ? kt(e.refs).value : St(M(r.value) ? e.ref.value : r.value, e);
|
|
535
535
|
}
|
|
536
536
|
var ir = (e, r, t, n) => {
|
|
537
537
|
const o = {};
|
|
@@ -545,7 +545,7 @@ var ir = (e, r, t, n) => {
|
|
|
545
545
|
fields: o,
|
|
546
546
|
shouldUseNativeValidation: n
|
|
547
547
|
};
|
|
548
|
-
}, Pe = (e) => e instanceof RegExp, Re = (e) =>
|
|
548
|
+
}, Pe = (e) => e instanceof RegExp, Re = (e) => M(e) ? e : Pe(e) ? e.source : z(e) ? Pe(e.value) ? e.value.source : e.value : e, mt = (e) => ({
|
|
549
549
|
isOnSubmit: !e || e === ie.onSubmit,
|
|
550
550
|
isOnBlur: e === ie.onBlur,
|
|
551
551
|
isOnChange: e === ie.onChange,
|
|
@@ -553,7 +553,7 @@ var ir = (e, r, t, n) => {
|
|
|
553
553
|
isOnTouch: e === ie.onTouched
|
|
554
554
|
});
|
|
555
555
|
const ht = "AsyncFunction";
|
|
556
|
-
var ar = (e) => !!e && !!e.validate && !!(ne(e.validate) && e.validate.constructor.name === ht ||
|
|
556
|
+
var ar = (e) => !!e && !!e.validate && !!(ne(e.validate) && e.validate.constructor.name === ht || z(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === ht)), or = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), vt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
557
557
|
const Se = (e, r, t, n) => {
|
|
558
558
|
for (const o of t || Object.keys(e)) {
|
|
559
559
|
const i = h(e, o);
|
|
@@ -566,7 +566,7 @@ const Se = (e, r, t, n) => {
|
|
|
566
566
|
return !0;
|
|
567
567
|
if (Se(f, r))
|
|
568
568
|
break;
|
|
569
|
-
} else if (
|
|
569
|
+
} else if (z(f) && Se(f, r))
|
|
570
570
|
break;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
@@ -602,102 +602,102 @@ function bt(e, r, t) {
|
|
|
602
602
|
var lr = (e, r, t, n) => {
|
|
603
603
|
t(e);
|
|
604
604
|
const { name: o, ...i } = e;
|
|
605
|
-
return
|
|
606
|
-
}, ur = (e, r, t) => !e || !r || e === r || ke(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), cr = (e, r, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, fr = (e, r) => !He(h(e, r)).length &&
|
|
605
|
+
return Q(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((u) => r[u] === (!n || ie.all));
|
|
606
|
+
}, ur = (e, r, t) => !e || !r || e === r || ke(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), cr = (e, r, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, fr = (e, r) => !He(h(e, r)).length && q(e, r), dr = (e, r, t) => {
|
|
607
607
|
const n = ke(h(e, t));
|
|
608
608
|
return N(n, "root", r[t]), N(e, t, n), e;
|
|
609
609
|
};
|
|
610
610
|
function gt(e, r, t = "validate") {
|
|
611
|
-
if (
|
|
611
|
+
if (re(e) || Array.isArray(e) && e.every(re) || ue(e) && !e)
|
|
612
612
|
return {
|
|
613
613
|
type: t,
|
|
614
|
-
message:
|
|
614
|
+
message: re(e) ? e : "",
|
|
615
615
|
ref: r
|
|
616
616
|
};
|
|
617
617
|
}
|
|
618
|
-
var Ve = (e) =>
|
|
618
|
+
var Ve = (e) => z(e) && !Pe(e) ? e : {
|
|
619
619
|
value: e,
|
|
620
620
|
message: ""
|
|
621
621
|
}, _t = async (e, r, t, n, o, i) => {
|
|
622
|
-
const { ref: u, refs: f, required: F, maxLength: A, minLength: T, min: x, max:
|
|
623
|
-
if (
|
|
622
|
+
const { ref: u, refs: f, required: F, maxLength: A, minLength: T, min: x, max: p, pattern: b, validate: B, name: O, valueAsNumber: W, mount: $ } = e._f, E = h(t, O);
|
|
623
|
+
if (!$ || r.has(O))
|
|
624
624
|
return {};
|
|
625
|
-
const
|
|
626
|
-
o &&
|
|
627
|
-
},
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
type: _ ?
|
|
631
|
-
message:
|
|
625
|
+
const J = f ? f[0] : u, C = (_) => {
|
|
626
|
+
o && J.reportValidity && (J.setCustomValidity(ue(_) ? "" : _ || ""), J.reportValidity());
|
|
627
|
+
}, R = {}, K = Ze(u), oe = Te(u), j = K || oe, G = (W || Xe(u)) && M(u.value) && M(E) || je(u) && u.value === "" || E === "" || Array.isArray(E) && !E.length, X = er.bind(null, O, n, R), ge = (_, w, I, Y = ce.maxLength, ee = ce.minLength) => {
|
|
628
|
+
const Z = _ ? w : I;
|
|
629
|
+
R[O] = {
|
|
630
|
+
type: _ ? Y : ee,
|
|
631
|
+
message: Z,
|
|
632
632
|
ref: u,
|
|
633
|
-
...
|
|
633
|
+
...X(_ ? Y : ee, Z)
|
|
634
634
|
};
|
|
635
635
|
};
|
|
636
|
-
if (i ? !Array.isArray(E) || !E.length : F && (!
|
|
637
|
-
const { value: _, message:
|
|
638
|
-
if (_ && (
|
|
639
|
-
type:
|
|
640
|
-
message:
|
|
641
|
-
ref:
|
|
642
|
-
...
|
|
636
|
+
if (i ? !Array.isArray(E) || !E.length : F && (!j && (G || te(E)) || ue(E) && !E || oe && !kt(f).isValid || K && !Tt(f).isValid)) {
|
|
637
|
+
const { value: _, message: w } = re(F) ? { value: !!F, message: F } : Ve(F);
|
|
638
|
+
if (_ && (R[O] = {
|
|
639
|
+
type: ce.required,
|
|
640
|
+
message: w,
|
|
641
|
+
ref: J,
|
|
642
|
+
...X(ce.required, w)
|
|
643
643
|
}, !n))
|
|
644
|
-
return C(
|
|
644
|
+
return C(w), R;
|
|
645
645
|
}
|
|
646
|
-
if (!
|
|
647
|
-
let _,
|
|
648
|
-
const
|
|
649
|
-
if (!
|
|
650
|
-
const
|
|
651
|
-
|
|
646
|
+
if (!G && (!te(x) || !te(p))) {
|
|
647
|
+
let _, w;
|
|
648
|
+
const I = Ve(p), Y = Ve(x);
|
|
649
|
+
if (!te(E) && !isNaN(E)) {
|
|
650
|
+
const ee = u.valueAsNumber || E && +E;
|
|
651
|
+
te(I.value) || (_ = ee > I.value), te(Y.value) || (w = ee < Y.value);
|
|
652
652
|
} else {
|
|
653
|
-
const
|
|
654
|
-
|
|
653
|
+
const ee = u.valueAsDate || new Date(E), Z = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), fe = u.type == "time", de = u.type == "week";
|
|
654
|
+
re(I.value) && E && (_ = fe ? Z(E) > Z(I.value) : de ? E > I.value : ee > new Date(I.value)), re(Y.value) && E && (w = fe ? Z(E) < Z(Y.value) : de ? E < Y.value : ee < new Date(Y.value));
|
|
655
655
|
}
|
|
656
|
-
if ((_ ||
|
|
657
|
-
return C(
|
|
656
|
+
if ((_ || w) && (ge(!!_, I.message, Y.message, ce.max, ce.min), !n))
|
|
657
|
+
return C(R[O].message), R;
|
|
658
658
|
}
|
|
659
|
-
if ((A || T) && !
|
|
660
|
-
const _ = Ve(A),
|
|
661
|
-
if ((
|
|
662
|
-
return C(
|
|
659
|
+
if ((A || T) && !G && (re(E) || i && Array.isArray(E))) {
|
|
660
|
+
const _ = Ve(A), w = Ve(T), I = !te(_.value) && E.length > +_.value, Y = !te(w.value) && E.length < +w.value;
|
|
661
|
+
if ((I || Y) && (ge(I, _.message, w.message), !n))
|
|
662
|
+
return C(R[O].message), R;
|
|
663
663
|
}
|
|
664
|
-
if (b && !
|
|
665
|
-
const { value: _, message:
|
|
666
|
-
if (Pe(_) && !E.match(_) && (
|
|
667
|
-
type:
|
|
668
|
-
message:
|
|
664
|
+
if (b && !G && re(E)) {
|
|
665
|
+
const { value: _, message: w } = Ve(b);
|
|
666
|
+
if (Pe(_) && !E.match(_) && (R[O] = {
|
|
667
|
+
type: ce.pattern,
|
|
668
|
+
message: w,
|
|
669
669
|
ref: u,
|
|
670
|
-
...
|
|
670
|
+
...X(ce.pattern, w)
|
|
671
671
|
}, !n))
|
|
672
|
-
return C(
|
|
672
|
+
return C(w), R;
|
|
673
673
|
}
|
|
674
|
-
if (
|
|
675
|
-
if (ne(
|
|
676
|
-
const _ = await
|
|
677
|
-
if (
|
|
678
|
-
...
|
|
679
|
-
...
|
|
674
|
+
if (B) {
|
|
675
|
+
if (ne(B)) {
|
|
676
|
+
const _ = await B(E, t), w = gt(_, J);
|
|
677
|
+
if (w && (R[O] = {
|
|
678
|
+
...w,
|
|
679
|
+
...X(ce.validate, w.message)
|
|
680
680
|
}, !n))
|
|
681
|
-
return C(
|
|
682
|
-
} else if (
|
|
681
|
+
return C(w.message), R;
|
|
682
|
+
} else if (z(B)) {
|
|
683
683
|
let _ = {};
|
|
684
|
-
for (const
|
|
685
|
-
if (!
|
|
684
|
+
for (const w in B) {
|
|
685
|
+
if (!Q(_) && !n)
|
|
686
686
|
break;
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
...
|
|
690
|
-
...
|
|
691
|
-
}, C(
|
|
687
|
+
const I = gt(await B[w](E, t), J, w);
|
|
688
|
+
I && (_ = {
|
|
689
|
+
...I,
|
|
690
|
+
...X(w, I.message)
|
|
691
|
+
}, C(I.message), n && (R[O] = _));
|
|
692
692
|
}
|
|
693
|
-
if (!
|
|
694
|
-
ref:
|
|
693
|
+
if (!Q(_) && (R[O] = {
|
|
694
|
+
ref: J,
|
|
695
695
|
..._
|
|
696
696
|
}, !n))
|
|
697
|
-
return
|
|
697
|
+
return R;
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
return C(!0),
|
|
700
|
+
return C(!0), R;
|
|
701
701
|
};
|
|
702
702
|
const yr = {
|
|
703
703
|
mode: ie.onSubmit,
|
|
@@ -723,7 +723,7 @@ function mr(e = {}) {
|
|
|
723
723
|
validatingFields: {},
|
|
724
724
|
errors: r.errors || {},
|
|
725
725
|
disabled: r.disabled || !1
|
|
726
|
-
}, n = {}, o =
|
|
726
|
+
}, n = {}, o = z(r.defaultValues) || z(r.values) ? H(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : H(o), u = {
|
|
727
727
|
action: !1,
|
|
728
728
|
mount: !1,
|
|
729
729
|
watch: !1,
|
|
@@ -746,27 +746,27 @@ function mr(e = {}) {
|
|
|
746
746
|
}, x = {
|
|
747
747
|
...T
|
|
748
748
|
};
|
|
749
|
-
let
|
|
749
|
+
let p = {
|
|
750
750
|
...x
|
|
751
751
|
};
|
|
752
752
|
const b = {
|
|
753
753
|
array: ut(),
|
|
754
754
|
state: ut()
|
|
755
|
-
},
|
|
755
|
+
}, B = r.criteriaMode === ie.all, O = (s) => (a) => {
|
|
756
756
|
clearTimeout(A), A = setTimeout(s, a);
|
|
757
|
-
},
|
|
758
|
-
if (!u.keepIsValid && !r.disabled && (x.isValid ||
|
|
757
|
+
}, W = async (s) => {
|
|
758
|
+
if (!u.keepIsValid && !r.disabled && (x.isValid || p.isValid || s)) {
|
|
759
759
|
let a;
|
|
760
|
-
r.resolver ? (a =
|
|
760
|
+
r.resolver ? (a = Q((await j()).errors), $()) : a = await X(n, !0), a !== t.isValid && b.state.next({
|
|
761
761
|
isValid: a
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
|
-
},
|
|
765
|
-
!r.disabled && (x.isValidating || x.validatingFields ||
|
|
766
|
-
l && (a ? N(t.validatingFields, l, a) :
|
|
764
|
+
}, $ = (s, a) => {
|
|
765
|
+
!r.disabled && (x.isValidating || x.validatingFields || p.isValidating || p.validatingFields) && ((s || Array.from(f.mount)).forEach((l) => {
|
|
766
|
+
l && (a ? N(t.validatingFields, l, a) : q(t.validatingFields, l));
|
|
767
767
|
}), b.state.next({
|
|
768
768
|
validatingFields: t.validatingFields,
|
|
769
|
-
isValidating: !
|
|
769
|
+
isValidating: !Q(t.validatingFields)
|
|
770
770
|
}));
|
|
771
771
|
}, E = (s, a = [], l, m, y = !0, d = !0) => {
|
|
772
772
|
if (m && l && !r.disabled) {
|
|
@@ -778,11 +778,11 @@ function mr(e = {}) {
|
|
|
778
778
|
const v = l(h(t.errors, s), m.argA, m.argB);
|
|
779
779
|
y && N(t.errors, s, v), fr(t.errors, s);
|
|
780
780
|
}
|
|
781
|
-
if ((x.touchedFields ||
|
|
781
|
+
if ((x.touchedFields || p.touchedFields) && d && Array.isArray(h(t.touchedFields, s))) {
|
|
782
782
|
const v = l(h(t.touchedFields, s), m.argA, m.argB);
|
|
783
783
|
y && N(t.touchedFields, s, v);
|
|
784
784
|
}
|
|
785
|
-
(x.dirtyFields ||
|
|
785
|
+
(x.dirtyFields || p.dirtyFields) && (t.dirtyFields = Fe(o, i)), b.state.next({
|
|
786
786
|
name: s,
|
|
787
787
|
isDirty: _(s, a),
|
|
788
788
|
dirtyFields: t.dirtyFields,
|
|
@@ -791,7 +791,7 @@ function mr(e = {}) {
|
|
|
791
791
|
});
|
|
792
792
|
} else
|
|
793
793
|
N(i, s, a);
|
|
794
|
-
},
|
|
794
|
+
}, J = (s, a) => {
|
|
795
795
|
N(t.errors, s, a), b.state.next({
|
|
796
796
|
errors: t.errors
|
|
797
797
|
});
|
|
@@ -800,36 +800,36 @@ function mr(e = {}) {
|
|
|
800
800
|
errors: t.errors,
|
|
801
801
|
isValid: !1
|
|
802
802
|
});
|
|
803
|
-
},
|
|
803
|
+
}, R = (s, a, l, m) => {
|
|
804
804
|
const y = h(n, s);
|
|
805
805
|
if (y) {
|
|
806
|
-
const d = h(i, s,
|
|
807
|
-
|
|
806
|
+
const d = h(i, s, M(l) ? h(o, s) : l);
|
|
807
|
+
M(d) || m && m.defaultChecked || a ? N(i, s, a ? d : yt(y._f)) : Y(s, d), u.mount && !u.action && W();
|
|
808
808
|
}
|
|
809
|
-
},
|
|
809
|
+
}, K = (s, a, l, m, y) => {
|
|
810
810
|
let d = !1, v = !1;
|
|
811
811
|
const S = {
|
|
812
812
|
name: s
|
|
813
813
|
};
|
|
814
814
|
if (!r.disabled) {
|
|
815
815
|
if (!l || m) {
|
|
816
|
-
(x.isDirty ||
|
|
816
|
+
(x.isDirty || p.isDirty) && (v = t.isDirty, t.isDirty = S.isDirty = _(), d = v !== S.isDirty);
|
|
817
817
|
const D = ae(h(o, s), a);
|
|
818
|
-
v = !!h(t.dirtyFields, s), D ?
|
|
818
|
+
v = !!h(t.dirtyFields, s), D ? q(t.dirtyFields, s) : N(t.dirtyFields, s, !0), S.dirtyFields = t.dirtyFields, d = d || (x.dirtyFields || p.dirtyFields) && v !== !D;
|
|
819
819
|
}
|
|
820
820
|
if (l) {
|
|
821
821
|
const D = h(t.touchedFields, s);
|
|
822
|
-
D || (N(t.touchedFields, s, l), S.touchedFields = t.touchedFields, d = d || (x.touchedFields ||
|
|
822
|
+
D || (N(t.touchedFields, s, l), S.touchedFields = t.touchedFields, d = d || (x.touchedFields || p.touchedFields) && D !== l);
|
|
823
823
|
}
|
|
824
824
|
d && y && b.state.next(S);
|
|
825
825
|
}
|
|
826
826
|
return d ? S : {};
|
|
827
|
-
},
|
|
828
|
-
const y = h(t.errors, s), d = (x.isValid ||
|
|
829
|
-
if (r.delayError && l ? (F = O(() =>
|
|
827
|
+
}, oe = (s, a, l, m) => {
|
|
828
|
+
const y = h(t.errors, s), d = (x.isValid || p.isValid) && ue(a) && t.isValid !== a;
|
|
829
|
+
if (r.delayError && l ? (F = O(() => J(s, l)), F(r.delayError)) : (clearTimeout(A), F = null, l ? N(t.errors, s, l) : q(t.errors, s)), (l ? !ae(y, l) : y) || !Q(m) || d) {
|
|
830
830
|
const v = {
|
|
831
831
|
...m,
|
|
832
|
-
...d &&
|
|
832
|
+
...d && ue(a) ? { isValid: a } : {},
|
|
833
833
|
errors: t.errors,
|
|
834
834
|
name: s
|
|
835
835
|
};
|
|
@@ -838,17 +838,17 @@ function mr(e = {}) {
|
|
|
838
838
|
...v
|
|
839
839
|
}, b.state.next(v);
|
|
840
840
|
}
|
|
841
|
-
},
|
|
842
|
-
const { errors: a } = await
|
|
843
|
-
if (
|
|
841
|
+
}, j = async (s) => ($(s, !0), await r.resolver(i, r.context, ir(s || f.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), G = async (s) => {
|
|
842
|
+
const { errors: a } = await j(s);
|
|
843
|
+
if ($(s), s)
|
|
844
844
|
for (const l of s) {
|
|
845
845
|
const m = h(a, l);
|
|
846
|
-
m ? N(t.errors, l, m) :
|
|
846
|
+
m ? N(t.errors, l, m) : q(t.errors, l);
|
|
847
847
|
}
|
|
848
848
|
else
|
|
849
849
|
t.errors = a;
|
|
850
850
|
return a;
|
|
851
|
-
},
|
|
851
|
+
}, X = async (s, a, l = {
|
|
852
852
|
valid: !0
|
|
853
853
|
}) => {
|
|
854
854
|
for (const m in s) {
|
|
@@ -857,108 +857,108 @@ function mr(e = {}) {
|
|
|
857
857
|
const { _f: d, ...v } = y;
|
|
858
858
|
if (d) {
|
|
859
859
|
const S = f.array.has(d.name), D = y._f && ar(y._f);
|
|
860
|
-
D && x.validatingFields &&
|
|
861
|
-
const
|
|
862
|
-
if (D && x.validatingFields &&
|
|
860
|
+
D && x.validatingFields && $([d.name], !0);
|
|
861
|
+
const se = await _t(y, f.disabled, i, B, r.shouldUseNativeValidation && !a, S);
|
|
862
|
+
if (D && x.validatingFields && $([d.name]), se[d.name] && (l.valid = !1, a))
|
|
863
863
|
break;
|
|
864
|
-
!a && (h(
|
|
864
|
+
!a && (h(se, d.name) ? S ? dr(t.errors, se, d.name) : N(t.errors, d.name, se[d.name]) : q(t.errors, d.name));
|
|
865
865
|
}
|
|
866
|
-
!
|
|
866
|
+
!Q(v) && await X(v, a, l);
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
869
|
return l.valid;
|
|
870
|
-
},
|
|
870
|
+
}, ge = () => {
|
|
871
871
|
for (const s of f.unMount) {
|
|
872
872
|
const a = h(n, s);
|
|
873
|
-
a && (a._f.refs ? a._f.refs.every((l) => !We(l)) : !We(a._f.ref)) &&
|
|
873
|
+
a && (a._f.refs ? a._f.refs.every((l) => !We(l)) : !We(a._f.ref)) && le(s);
|
|
874
874
|
}
|
|
875
875
|
f.unMount = /* @__PURE__ */ new Set();
|
|
876
|
-
}, _ = (s, a) => !r.disabled && (s && a && N(i, s, a), !ae(c(), o)),
|
|
877
|
-
...u.mount ? i :
|
|
878
|
-
}, l, a),
|
|
876
|
+
}, _ = (s, a) => !r.disabled && (s && a && N(i, s, a), !ae(c(), o)), w = (s, a, l) => $e(s, f, {
|
|
877
|
+
...u.mount ? i : M(a) ? o : re(s) ? { [s]: a } : a
|
|
878
|
+
}, l, a), I = (s) => He(h(u.mount ? i : o, s, r.shouldUnregister ? h(o, s, []) : [])), Y = (s, a, l = {}) => {
|
|
879
879
|
const m = h(n, s);
|
|
880
880
|
let y = a;
|
|
881
881
|
if (m) {
|
|
882
882
|
const d = m._f;
|
|
883
|
-
d && (!d.disabled && N(i, s, St(a, d)), y = je(d.ref) &&
|
|
883
|
+
d && (!d.disabled && N(i, s, St(a, d)), y = je(d.ref) && te(a) ? "" : a, wt(d.ref) ? [...d.ref.options].forEach((v) => v.selected = y.includes(v.value)) : d.refs ? Te(d.ref) ? d.refs.forEach((v) => {
|
|
884
884
|
(!v.defaultChecked || !v.disabled) && (Array.isArray(y) ? v.checked = !!y.find((S) => S === v.value) : v.checked = y === v.value || !!y);
|
|
885
885
|
}) : d.refs.forEach((v) => v.checked = v.value === y) : Xe(d.ref) ? d.ref.value = "" : (d.ref.value = y, d.ref.type || b.state.next({
|
|
886
886
|
name: s,
|
|
887
|
-
values:
|
|
887
|
+
values: H(i)
|
|
888
888
|
})));
|
|
889
889
|
}
|
|
890
|
-
(l.shouldDirty || l.shouldTouch) &&
|
|
891
|
-
},
|
|
890
|
+
(l.shouldDirty || l.shouldTouch) && K(s, y, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ye(s);
|
|
891
|
+
}, ee = (s, a, l) => {
|
|
892
892
|
for (const m in a) {
|
|
893
893
|
if (!a.hasOwnProperty(m))
|
|
894
894
|
return;
|
|
895
895
|
const y = a[m], d = s + "." + m, v = h(n, d);
|
|
896
|
-
(f.array.has(s) ||
|
|
896
|
+
(f.array.has(s) || z(y) || v && !v._f) && !ve(y) ? ee(d, y, l) : Y(d, y, l);
|
|
897
897
|
}
|
|
898
|
-
},
|
|
899
|
-
const m = h(n, s), y = f.array.has(s), d =
|
|
898
|
+
}, Z = (s, a, l = {}) => {
|
|
899
|
+
const m = h(n, s), y = f.array.has(s), d = H(a);
|
|
900
900
|
N(i, s, d), y ? (b.array.next({
|
|
901
901
|
name: s,
|
|
902
|
-
values:
|
|
903
|
-
}), (x.isDirty || x.dirtyFields ||
|
|
902
|
+
values: H(i)
|
|
903
|
+
}), (x.isDirty || x.dirtyFields || p.isDirty || p.dirtyFields) && l.shouldDirty && b.state.next({
|
|
904
904
|
name: s,
|
|
905
905
|
dirtyFields: Fe(o, i),
|
|
906
906
|
isDirty: _(s, d)
|
|
907
|
-
})) : m && !m._f && !
|
|
907
|
+
})) : m && !m._f && !te(d) ? ee(s, d, l) : Y(s, d, l), vt(s, f) && b.state.next({ ...t, name: s }), b.state.next({
|
|
908
908
|
name: u.mount ? s : void 0,
|
|
909
|
-
values:
|
|
909
|
+
values: H(i)
|
|
910
910
|
});
|
|
911
|
-
},
|
|
911
|
+
}, fe = async (s) => {
|
|
912
912
|
u.mount = !0;
|
|
913
913
|
const a = s.target;
|
|
914
914
|
let l = a.name, m = !0;
|
|
915
915
|
const y = h(n, l), d = (D) => {
|
|
916
|
-
m = Number.isNaN(D) ||
|
|
916
|
+
m = Number.isNaN(D) || ve(D) && isNaN(D.getTime()) || ae(D, h(i, l, D));
|
|
917
917
|
}, v = mt(r.mode), S = mt(r.reValidateMode);
|
|
918
918
|
if (y) {
|
|
919
|
-
let D,
|
|
920
|
-
const Oe = a.type ? yt(y._f) : Jt(s),
|
|
921
|
-
N(i, l, Oe),
|
|
922
|
-
const Be =
|
|
923
|
-
if (!
|
|
919
|
+
let D, se;
|
|
920
|
+
const Oe = a.type ? yt(y._f) : Jt(s), me = s.type === lt.BLUR || s.type === lt.FOCUS_OUT, Ut = !or(y._f) && !r.resolver && !h(t.errors, l) && !y._f.deps || cr(me, h(t.touchedFields, l), t.isSubmitted, S, v), Me = vt(l, f, me);
|
|
921
|
+
N(i, l, Oe), me ? (!a || !a.readOnly) && (y._f.onBlur && y._f.onBlur(s), F && F(0)) : y._f.onChange && y._f.onChange(s);
|
|
922
|
+
const Be = K(l, Oe, me), Mt = !Q(Be) || Me;
|
|
923
|
+
if (!me && b.state.next({
|
|
924
924
|
name: l,
|
|
925
925
|
type: s.type,
|
|
926
|
-
values:
|
|
926
|
+
values: H(i)
|
|
927
927
|
}), Ut)
|
|
928
|
-
return (x.isValid ||
|
|
929
|
-
if (!
|
|
930
|
-
const { errors: st } = await
|
|
931
|
-
if (
|
|
928
|
+
return (x.isValid || p.isValid) && (r.mode === "onBlur" ? me && W() : me || W()), Mt && b.state.next({ name: l, ...Me ? {} : Be });
|
|
929
|
+
if (!me && Me && b.state.next({ ...t }), r.resolver) {
|
|
930
|
+
const { errors: st } = await j([l]);
|
|
931
|
+
if ($([l]), d(Oe), m) {
|
|
932
932
|
const Bt = bt(t.errors, n, l), nt = bt(st, n, Bt.name || l);
|
|
933
|
-
D = nt.error, l = nt.name,
|
|
933
|
+
D = nt.error, l = nt.name, se = Q(st);
|
|
934
934
|
}
|
|
935
935
|
} else
|
|
936
|
-
|
|
937
|
-
m && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) &&
|
|
936
|
+
$([l], !0), D = (await _t(y, f.disabled, i, B, r.shouldUseNativeValidation))[l], $([l]), d(Oe), m && (D ? se = !1 : (x.isValid || p.isValid) && (se = await X(n, !0)));
|
|
937
|
+
m && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) && ye(y._f.deps), oe(l, se, D, Be));
|
|
938
938
|
}
|
|
939
|
-
},
|
|
939
|
+
}, de = (s, a) => {
|
|
940
940
|
if (h(t.errors, a) && s.focus)
|
|
941
941
|
return s.focus(), 1;
|
|
942
|
-
},
|
|
942
|
+
}, ye = async (s, a = {}) => {
|
|
943
943
|
let l, m;
|
|
944
944
|
const y = ke(s);
|
|
945
945
|
if (r.resolver) {
|
|
946
|
-
const d = await
|
|
947
|
-
l =
|
|
946
|
+
const d = await G(M(s) ? s : y);
|
|
947
|
+
l = Q(d), m = s ? !y.some((v) => h(d, v)) : l;
|
|
948
948
|
} else s ? (m = (await Promise.all(y.map(async (d) => {
|
|
949
949
|
const v = h(n, d);
|
|
950
|
-
return await
|
|
951
|
-
}))).every(Boolean), !(!m && !t.isValid) &&
|
|
950
|
+
return await X(v && v._f ? { [d]: v } : v);
|
|
951
|
+
}))).every(Boolean), !(!m && !t.isValid) && W()) : m = l = await X(n);
|
|
952
952
|
return b.state.next({
|
|
953
|
-
...!
|
|
953
|
+
...!re(s) || (x.isValid || p.isValid) && l !== t.isValid ? {} : { name: s },
|
|
954
954
|
...r.resolver || !s ? { isValid: l } : {},
|
|
955
955
|
errors: t.errors
|
|
956
|
-
}), a.shouldFocus && !m && Se(n,
|
|
956
|
+
}), a.shouldFocus && !m && Se(n, de, s ? y : f.mount), m;
|
|
957
957
|
}, c = (s, a) => {
|
|
958
958
|
let l = {
|
|
959
959
|
...u.mount ? i : o
|
|
960
960
|
};
|
|
961
|
-
return a && (l =
|
|
961
|
+
return a && (l = pt(a.dirtyFields ? t.dirtyFields : t.touchedFields, l)), M(s) ? l : re(s) ? h(l, s) : s.map((m) => h(l, m));
|
|
962
962
|
}, g = (s, a) => ({
|
|
963
963
|
invalid: !!h((a || t).errors, s),
|
|
964
964
|
isDirty: !!h((a || t).dirtyFields, s),
|
|
@@ -966,7 +966,7 @@ function mr(e = {}) {
|
|
|
966
966
|
isValidating: !!h(t.validatingFields, s),
|
|
967
967
|
isTouched: !!h((a || t).touchedFields, s)
|
|
968
968
|
}), P = (s) => {
|
|
969
|
-
s && ke(s).forEach((a) =>
|
|
969
|
+
s && ke(s).forEach((a) => q(t.errors, a)), b.state.next({
|
|
970
970
|
errors: s ? t.errors : {}
|
|
971
971
|
});
|
|
972
972
|
}, L = (s, a, l) => {
|
|
@@ -981,8 +981,8 @@ function mr(e = {}) {
|
|
|
981
981
|
isValid: !1
|
|
982
982
|
}), l && l.shouldFocus && m && m.focus && m.focus();
|
|
983
983
|
}, _e = (s, a) => ne(s) ? b.state.subscribe({
|
|
984
|
-
next: (l) => "values" in l && s(
|
|
985
|
-
}) :
|
|
984
|
+
next: (l) => "values" in l && s(w(void 0, a), l)
|
|
985
|
+
}) : w(s, a, !0), xe = (s) => b.state.subscribe({
|
|
986
986
|
next: (a) => {
|
|
987
987
|
ur(s.name, a.name, s.exact) && lr(a, s.formState || x, It, s.reRenderRoot) && s.callback({
|
|
988
988
|
values: { ...i },
|
|
@@ -991,8 +991,8 @@ function mr(e = {}) {
|
|
|
991
991
|
defaultValues: o
|
|
992
992
|
});
|
|
993
993
|
}
|
|
994
|
-
}).unsubscribe,
|
|
995
|
-
...
|
|
994
|
+
}).unsubscribe, U = (s) => (u.mount = !0, p = {
|
|
995
|
+
...p,
|
|
996
996
|
...s.formState
|
|
997
997
|
}, xe({
|
|
998
998
|
...s,
|
|
@@ -1000,20 +1000,20 @@ function mr(e = {}) {
|
|
|
1000
1000
|
...T,
|
|
1001
1001
|
...s.formState
|
|
1002
1002
|
}
|
|
1003
|
-
})),
|
|
1003
|
+
})), le = (s, a = {}) => {
|
|
1004
1004
|
for (const l of s ? ke(s) : f.mount)
|
|
1005
|
-
f.mount.delete(l), f.array.delete(l), a.keepValue || (
|
|
1005
|
+
f.mount.delete(l), f.array.delete(l), a.keepValue || (q(n, l), q(i, l)), !a.keepError && q(t.errors, l), !a.keepDirty && q(t.dirtyFields, l), !a.keepTouched && q(t.touchedFields, l), !a.keepIsValidating && q(t.validatingFields, l), !r.shouldUnregister && !a.keepDefaultValue && q(o, l);
|
|
1006
1006
|
b.state.next({
|
|
1007
|
-
values:
|
|
1007
|
+
values: H(i)
|
|
1008
1008
|
}), b.state.next({
|
|
1009
1009
|
...t,
|
|
1010
1010
|
...a.keepDirty ? { isDirty: _() } : {}
|
|
1011
|
-
}), !a.keepIsValid &&
|
|
1011
|
+
}), !a.keepIsValid && W();
|
|
1012
1012
|
}, Ee = ({ disabled: s, name: a }) => {
|
|
1013
|
-
(
|
|
1013
|
+
(ue(s) && u.mount || s || f.disabled.has(a)) && (s ? f.disabled.add(a) : f.disabled.delete(a));
|
|
1014
1014
|
}, Ae = (s, a = {}) => {
|
|
1015
1015
|
let l = h(n, s);
|
|
1016
|
-
const m =
|
|
1016
|
+
const m = ue(a.disabled) || ue(r.disabled);
|
|
1017
1017
|
return N(n, s, {
|
|
1018
1018
|
...l || {},
|
|
1019
1019
|
_f: {
|
|
@@ -1023,9 +1023,9 @@ function mr(e = {}) {
|
|
|
1023
1023
|
...a
|
|
1024
1024
|
}
|
|
1025
1025
|
}), f.mount.add(s), l ? Ee({
|
|
1026
|
-
disabled:
|
|
1026
|
+
disabled: ue(a.disabled) ? a.disabled : r.disabled,
|
|
1027
1027
|
name: s
|
|
1028
|
-
}) :
|
|
1028
|
+
}) : R(s, !0, a.value), {
|
|
1029
1029
|
...m ? { disabled: a.disabled || r.disabled } : {},
|
|
1030
1030
|
...r.progressive ? {
|
|
1031
1031
|
required: !!a.required,
|
|
@@ -1036,12 +1036,12 @@ function mr(e = {}) {
|
|
|
1036
1036
|
pattern: Re(a.pattern)
|
|
1037
1037
|
} : {},
|
|
1038
1038
|
name: s,
|
|
1039
|
-
onChange:
|
|
1040
|
-
onBlur:
|
|
1039
|
+
onChange: fe,
|
|
1040
|
+
onBlur: fe,
|
|
1041
1041
|
ref: (y) => {
|
|
1042
1042
|
if (y) {
|
|
1043
1043
|
Ae(s, a), l = h(n, s);
|
|
1044
|
-
const d =
|
|
1044
|
+
const d = M(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, v = tr(d), S = l._f.refs || [];
|
|
1045
1045
|
if (v ? S.find((D) => D === d) : d === l._f.ref)
|
|
1046
1046
|
return;
|
|
1047
1047
|
N(n, s, {
|
|
@@ -1056,13 +1056,13 @@ function mr(e = {}) {
|
|
|
1056
1056
|
ref: { type: d.type, name: s }
|
|
1057
1057
|
} : { ref: d }
|
|
1058
1058
|
}
|
|
1059
|
-
}),
|
|
1059
|
+
}), R(s, !1, void 0, d);
|
|
1060
1060
|
} else
|
|
1061
1061
|
l = h(n, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || a.shouldUnregister) && !(Xt(f.array, s) && u.action) && f.unMount.add(s);
|
|
1062
1062
|
}
|
|
1063
1063
|
};
|
|
1064
|
-
}, Ue = () => r.shouldFocusError && Se(n,
|
|
1065
|
-
|
|
1064
|
+
}, Ue = () => r.shouldFocusError && Se(n, de, f.mount), Pt = (s) => {
|
|
1065
|
+
ue(s) && (b.state.next({ disabled: s }), Se(n, (a, l) => {
|
|
1066
1066
|
const m = h(n, l);
|
|
1067
1067
|
m && (a.disabled = m._f.disabled || s, Array.isArray(m._f.refs) && m._f.refs.forEach((y) => {
|
|
1068
1068
|
y.disabled = m._f.disabled || s;
|
|
@@ -1071,18 +1071,18 @@ function mr(e = {}) {
|
|
|
1071
1071
|
}, Ke = (s, a) => async (l) => {
|
|
1072
1072
|
let m;
|
|
1073
1073
|
l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
|
|
1074
|
-
let y =
|
|
1074
|
+
let y = H(i);
|
|
1075
1075
|
if (b.state.next({
|
|
1076
1076
|
isSubmitting: !0
|
|
1077
1077
|
}), r.resolver) {
|
|
1078
|
-
const { errors: d, values: v } = await
|
|
1079
|
-
|
|
1078
|
+
const { errors: d, values: v } = await j();
|
|
1079
|
+
$(), t.errors = d, y = H(v);
|
|
1080
1080
|
} else
|
|
1081
|
-
await
|
|
1081
|
+
await X(n);
|
|
1082
1082
|
if (f.disabled.size)
|
|
1083
1083
|
for (const d of f.disabled)
|
|
1084
|
-
|
|
1085
|
-
if (
|
|
1084
|
+
q(y, d);
|
|
1085
|
+
if (q(t.errors, "root"), Q(t.errors)) {
|
|
1086
1086
|
b.state.next({
|
|
1087
1087
|
errors: {}
|
|
1088
1088
|
});
|
|
@@ -1096,15 +1096,15 @@ function mr(e = {}) {
|
|
|
1096
1096
|
if (b.state.next({
|
|
1097
1097
|
isSubmitted: !0,
|
|
1098
1098
|
isSubmitting: !1,
|
|
1099
|
-
isSubmitSuccessful:
|
|
1099
|
+
isSubmitSuccessful: Q(t.errors) && !m,
|
|
1100
1100
|
submitCount: t.submitCount + 1,
|
|
1101
1101
|
errors: t.errors
|
|
1102
1102
|
}), m)
|
|
1103
1103
|
throw m;
|
|
1104
1104
|
}, Nt = (s, a = {}) => {
|
|
1105
|
-
h(n, s) && (
|
|
1105
|
+
h(n, s) && (M(a.defaultValue) ? Z(s, H(h(o, s))) : (Z(s, a.defaultValue), N(o, s, H(a.defaultValue))), a.keepTouched || q(t.touchedFields, s), a.keepDirty || (q(t.dirtyFields, s), t.isDirty = a.defaultValue ? _(s, H(h(o, s))) : _()), a.keepError || (q(t.errors, s), x.isValid && W()), b.state.next({ ...t }));
|
|
1106
1106
|
}, et = (s, a = {}) => {
|
|
1107
|
-
const l = s ?
|
|
1107
|
+
const l = s ? H(s) : o, m = H(l), y = Q(s), d = y ? o : m;
|
|
1108
1108
|
if (a.keepDefaultValues || (o = l), !a.keepValues) {
|
|
1109
1109
|
if (a.keepDirtyValues) {
|
|
1110
1110
|
const v = /* @__PURE__ */ new Set([
|
|
@@ -1112,17 +1112,17 @@ function mr(e = {}) {
|
|
|
1112
1112
|
...Object.keys(Fe(o, i))
|
|
1113
1113
|
]);
|
|
1114
1114
|
for (const S of Array.from(v))
|
|
1115
|
-
h(t.dirtyFields, S) ? N(d, S, h(i, S)) :
|
|
1115
|
+
h(t.dirtyFields, S) ? N(d, S, h(i, S)) : Z(S, h(d, S));
|
|
1116
1116
|
} else {
|
|
1117
|
-
if (ze &&
|
|
1117
|
+
if (ze && M(s))
|
|
1118
1118
|
for (const v of f.mount) {
|
|
1119
1119
|
const S = h(n, v);
|
|
1120
1120
|
if (S && S._f) {
|
|
1121
1121
|
const D = Array.isArray(S._f.refs) ? S._f.refs[0] : S._f.ref;
|
|
1122
1122
|
if (je(D)) {
|
|
1123
|
-
const
|
|
1124
|
-
if (
|
|
1125
|
-
|
|
1123
|
+
const se = D.closest("form");
|
|
1124
|
+
if (se) {
|
|
1125
|
+
se.reset();
|
|
1126
1126
|
break;
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
@@ -1130,11 +1130,11 @@ function mr(e = {}) {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
if (a.keepFieldsRef)
|
|
1132
1132
|
for (const v of f.mount)
|
|
1133
|
-
|
|
1133
|
+
Z(v, h(d, v));
|
|
1134
1134
|
else
|
|
1135
1135
|
n = {};
|
|
1136
1136
|
}
|
|
1137
|
-
i = r.shouldUnregister ? a.keepDefaultValues ?
|
|
1137
|
+
i = r.shouldUnregister ? a.keepDefaultValues ? H(o) : {} : H(d), b.array.next({
|
|
1138
1138
|
values: { ...d }
|
|
1139
1139
|
}), b.state.next({
|
|
1140
1140
|
values: { ...d }
|
|
@@ -1148,7 +1148,7 @@ function mr(e = {}) {
|
|
|
1148
1148
|
watch: /* @__PURE__ */ new Set(),
|
|
1149
1149
|
watchAll: !1,
|
|
1150
1150
|
focus: ""
|
|
1151
|
-
}, u.mount = !x.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !r.shouldUnregister && !
|
|
1151
|
+
}, u.mount = !x.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !r.shouldUnregister && !Q(d), u.watch = !!r.shouldUnregister, u.keepIsValid = !!a.keepIsValid, u.action = !1, a.keepErrors || (t.errors = {}), b.state.next({
|
|
1152
1152
|
submitCount: a.keepSubmitCount ? t.submitCount : 0,
|
|
1153
1153
|
isDirty: y ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !ae(s, o)),
|
|
1154
1154
|
isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
|
|
@@ -1175,28 +1175,28 @@ function mr(e = {}) {
|
|
|
1175
1175
|
}, rt = {
|
|
1176
1176
|
control: {
|
|
1177
1177
|
register: Ae,
|
|
1178
|
-
unregister:
|
|
1178
|
+
unregister: le,
|
|
1179
1179
|
getFieldState: g,
|
|
1180
1180
|
handleSubmit: Ke,
|
|
1181
1181
|
setError: L,
|
|
1182
1182
|
_subscribe: xe,
|
|
1183
|
-
_runSchema:
|
|
1184
|
-
_updateIsValidating:
|
|
1183
|
+
_runSchema: j,
|
|
1184
|
+
_updateIsValidating: $,
|
|
1185
1185
|
_focusError: Ue,
|
|
1186
|
-
_getWatch:
|
|
1186
|
+
_getWatch: w,
|
|
1187
1187
|
_getDirty: _,
|
|
1188
|
-
_setValid:
|
|
1188
|
+
_setValid: W,
|
|
1189
1189
|
_setFieldArray: E,
|
|
1190
1190
|
_setDisabledField: Ee,
|
|
1191
1191
|
_setErrors: C,
|
|
1192
|
-
_getFieldArray:
|
|
1192
|
+
_getFieldArray: I,
|
|
1193
1193
|
_reset: et,
|
|
1194
1194
|
_resetDefaultValues: () => ne(r.defaultValues) && r.defaultValues().then((s) => {
|
|
1195
1195
|
tt(s, r.resetOptions), b.state.next({
|
|
1196
1196
|
isLoading: !1
|
|
1197
1197
|
});
|
|
1198
1198
|
}),
|
|
1199
|
-
_removeUnmounted:
|
|
1199
|
+
_removeUnmounted: ge,
|
|
1200
1200
|
_disableForm: Pt,
|
|
1201
1201
|
_subjects: b,
|
|
1202
1202
|
_proxyFormState: x,
|
|
@@ -1234,17 +1234,17 @@ function mr(e = {}) {
|
|
|
1234
1234
|
};
|
|
1235
1235
|
}
|
|
1236
1236
|
},
|
|
1237
|
-
subscribe:
|
|
1238
|
-
trigger:
|
|
1237
|
+
subscribe: U,
|
|
1238
|
+
trigger: ye,
|
|
1239
1239
|
register: Ae,
|
|
1240
1240
|
handleSubmit: Ke,
|
|
1241
1241
|
watch: _e,
|
|
1242
|
-
setValue:
|
|
1242
|
+
setValue: Z,
|
|
1243
1243
|
getValues: c,
|
|
1244
1244
|
reset: tt,
|
|
1245
1245
|
resetField: Nt,
|
|
1246
1246
|
clearErrors: P,
|
|
1247
|
-
unregister:
|
|
1247
|
+
unregister: le,
|
|
1248
1248
|
setError: L,
|
|
1249
1249
|
setFocus: Lt,
|
|
1250
1250
|
getFieldState: g
|
|
@@ -1255,7 +1255,7 @@ function mr(e = {}) {
|
|
|
1255
1255
|
};
|
|
1256
1256
|
}
|
|
1257
1257
|
function hr(e = {}) {
|
|
1258
|
-
const r =
|
|
1258
|
+
const r = k.useRef(void 0), t = k.useRef(void 0), [n, o] = k.useState({
|
|
1259
1259
|
isDirty: !1,
|
|
1260
1260
|
isValidating: !1,
|
|
1261
1261
|
isLoading: ne(e.defaultValues),
|
|
@@ -1296,28 +1296,28 @@ function hr(e = {}) {
|
|
|
1296
1296
|
...f,
|
|
1297
1297
|
isReady: !0
|
|
1298
1298
|
})), i._formState.isReady = !0, u;
|
|
1299
|
-
}, [i]),
|
|
1299
|
+
}, [i]), k.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), k.useEffect(() => {
|
|
1300
1300
|
e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
|
|
1301
|
-
}, [i, e.mode, e.reValidateMode]),
|
|
1301
|
+
}, [i, e.mode, e.reValidateMode]), k.useEffect(() => {
|
|
1302
1302
|
e.errors && (i._setErrors(e.errors), i._focusError());
|
|
1303
|
-
}, [i, e.errors]),
|
|
1303
|
+
}, [i, e.errors]), k.useEffect(() => {
|
|
1304
1304
|
e.shouldUnregister && i._subjects.state.next({
|
|
1305
1305
|
values: i._getWatch()
|
|
1306
1306
|
});
|
|
1307
|
-
}, [i, e.shouldUnregister]),
|
|
1307
|
+
}, [i, e.shouldUnregister]), k.useEffect(() => {
|
|
1308
1308
|
if (i._proxyFormState.isDirty) {
|
|
1309
1309
|
const u = i._getDirty();
|
|
1310
1310
|
u !== n.isDirty && i._subjects.state.next({
|
|
1311
1311
|
isDirty: u
|
|
1312
1312
|
});
|
|
1313
1313
|
}
|
|
1314
|
-
}, [i, n.isDirty]),
|
|
1314
|
+
}, [i, n.isDirty]), k.useEffect(() => {
|
|
1315
1315
|
var u;
|
|
1316
1316
|
e.values && !ae(e.values, t.current) ? (i._reset(e.values, {
|
|
1317
1317
|
keepFieldsRef: !0,
|
|
1318
1318
|
...i._options.resetOptions
|
|
1319
1319
|
}), !((u = i._options.resetOptions) === null || u === void 0) && u.keepIsValid || i._setValid(), t.current = e.values, o((f) => ({ ...f }))) : i._resetDefaultValues();
|
|
1320
|
-
}, [i, e.values]),
|
|
1320
|
+
}, [i, e.values]), k.useEffect(() => {
|
|
1321
1321
|
i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
|
|
1322
1322
|
}), r.current.formState = Kt(n, i), r.current;
|
|
1323
1323
|
}
|
|
@@ -1327,7 +1327,7 @@ const Ot = Wt(null), vr = ({
|
|
|
1327
1327
|
uiConfig: t,
|
|
1328
1328
|
updateFieldSchema: n
|
|
1329
1329
|
}) => {
|
|
1330
|
-
const o =
|
|
1330
|
+
const o = he(
|
|
1331
1331
|
() => ({
|
|
1332
1332
|
layout: r,
|
|
1333
1333
|
uiConfig: t,
|
|
@@ -1342,13 +1342,13 @@ const Ot = Wt(null), vr = ({
|
|
|
1342
1342
|
throw new Error("useAutoFormRenderContext must be used within AutoFormRenderContextProvider");
|
|
1343
1343
|
return e;
|
|
1344
1344
|
}, br = (e) => {
|
|
1345
|
-
const { fieldSchema: r } = e, { register: t } =
|
|
1345
|
+
const { fieldSchema: r } = e, { register: t } = be(), n = t(r.name);
|
|
1346
1346
|
return /* @__PURE__ */ V.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
1347
1347
|
/* @__PURE__ */ V.jsx("label", { children: r.label }),
|
|
1348
1348
|
/* @__PURE__ */ V.jsx("input", { type: r.type, ...n, readOnly: r.readonly })
|
|
1349
1349
|
] });
|
|
1350
1350
|
}, gr = (e) => {
|
|
1351
|
-
const { fieldSchema: r } = e, { register: t } =
|
|
1351
|
+
const { fieldSchema: r } = e, { register: t } = be(), n = t(r.name), o = r.options;
|
|
1352
1352
|
return /* @__PURE__ */ V.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
1353
1353
|
/* @__PURE__ */ V.jsx("label", { children: r.label }),
|
|
1354
1354
|
/* @__PURE__ */ V.jsx("select", { ...n, disabled: r.readonly, children: o.map((i) => /* @__PURE__ */ V.jsx("option", { value: i.value, children: i.label }, i.value)) })
|
|
@@ -1414,8 +1414,8 @@ function Ct(e) {
|
|
|
1414
1414
|
};
|
|
1415
1415
|
});
|
|
1416
1416
|
}
|
|
1417
|
-
const Vr =
|
|
1418
|
-
const { baseName: r, index: t, fields: n } = e, o =
|
|
1417
|
+
const Vr = k.memo((e) => {
|
|
1418
|
+
const { baseName: r, index: t, fields: n } = e, o = k.useMemo(
|
|
1419
1419
|
() => n.map((i) => ({
|
|
1420
1420
|
...i,
|
|
1421
1421
|
name: `${r}.${t}.${i.name}`
|
|
@@ -1430,14 +1430,14 @@ const Vr = R.memo((e) => {
|
|
|
1430
1430
|
/* @__PURE__ */ V.jsx(Le, { schema: o })
|
|
1431
1431
|
] });
|
|
1432
1432
|
}), Fr = (e) => {
|
|
1433
|
-
const { fieldSchema: r } = e, { control: t, getValues: n, setValue: o } =
|
|
1433
|
+
const { fieldSchema: r } = e, { control: t, getValues: n, setValue: o } = be(), u = At({
|
|
1434
1434
|
control: t,
|
|
1435
1435
|
name: r.name
|
|
1436
1436
|
}) ?? [], f = () => {
|
|
1437
1437
|
const A = n(r.name) || [];
|
|
1438
1438
|
o(r.name, [...A, Ne(r.fields)]);
|
|
1439
1439
|
}, F = (A) => {
|
|
1440
|
-
const x = (n(r.name) || []).filter((
|
|
1440
|
+
const x = (n(r.name) || []).filter((p, b) => b !== A);
|
|
1441
1441
|
o(r.name, x);
|
|
1442
1442
|
};
|
|
1443
1443
|
return /* @__PURE__ */ V.jsxs("div", { children: [
|
|
@@ -1447,9 +1447,9 @@ const Vr = R.memo((e) => {
|
|
|
1447
1447
|
] }, T)),
|
|
1448
1448
|
!r.readonly && /* @__PURE__ */ V.jsx("button", { type: "button", onClick: f, children: "Add Row" })
|
|
1449
1449
|
] });
|
|
1450
|
-
}, Ar =
|
|
1450
|
+
}, Ar = k.memo(Fr), pr = (e) => {
|
|
1451
1451
|
const { fieldSchema: r } = e;
|
|
1452
|
-
let t =
|
|
1452
|
+
let t = he(
|
|
1453
1453
|
() => r.fields.map((n) => ({
|
|
1454
1454
|
...n,
|
|
1455
1455
|
name: `${r.name}.${n.name}`
|
|
@@ -1459,7 +1459,7 @@ const Vr = R.memo((e) => {
|
|
|
1459
1459
|
return /* @__PURE__ */ V.jsx(Le, { schema: t });
|
|
1460
1460
|
}, jt = ({ fieldSchema: e }) => {
|
|
1461
1461
|
var A, T;
|
|
1462
|
-
const t = Dt().uiConfig, { register: n, control: o } =
|
|
1462
|
+
const t = Dt().uiConfig, { register: n, control: o } = be(), i = Qe(e.name), u = n(e.name), f = (A = t == null ? void 0 : t.renderersByName) == null ? void 0 : A[i];
|
|
1463
1463
|
if (e.visible === !1)
|
|
1464
1464
|
return null;
|
|
1465
1465
|
if (f)
|
|
@@ -1473,7 +1473,7 @@ const Vr = R.memo((e) => {
|
|
|
1473
1473
|
case "array":
|
|
1474
1474
|
return /* @__PURE__ */ V.jsx(Ar, { fieldSchema: e });
|
|
1475
1475
|
case "object":
|
|
1476
|
-
return /* @__PURE__ */ V.jsx(
|
|
1476
|
+
return /* @__PURE__ */ V.jsx(pr, { fieldSchema: e });
|
|
1477
1477
|
case "text":
|
|
1478
1478
|
case "number":
|
|
1479
1479
|
case "checkbox":
|
|
@@ -1482,8 +1482,8 @@ const Vr = R.memo((e) => {
|
|
|
1482
1482
|
case "time":
|
|
1483
1483
|
return /* @__PURE__ */ V.jsx(br, { fieldSchema: e });
|
|
1484
1484
|
}
|
|
1485
|
-
},
|
|
1486
|
-
const { control: r } =
|
|
1485
|
+
}, wr = ({ fieldSchema: e }) => /* @__PURE__ */ V.jsx(jt, { fieldSchema: e }), Rr = ({ fieldSchema: e }) => {
|
|
1486
|
+
const { control: r } = be(), t = Dt(), n = e.dependsOn ?? [], o = he(
|
|
1487
1487
|
() => Er(e.name, n),
|
|
1488
1488
|
[e.name, n]
|
|
1489
1489
|
), i = At({
|
|
@@ -1494,10 +1494,10 @@ const Vr = R.memo((e) => {
|
|
|
1494
1494
|
if (!n.length) return;
|
|
1495
1495
|
let F = !1;
|
|
1496
1496
|
return (async () => {
|
|
1497
|
-
var
|
|
1498
|
-
const T = Qe(e.name), x = _r(o, i ?? []),
|
|
1499
|
-
if (!
|
|
1500
|
-
const b = await
|
|
1497
|
+
var B;
|
|
1498
|
+
const T = Qe(e.name), x = _r(o, i ?? []), p = (B = t == null ? void 0 : t.updateFieldSchema) == null ? void 0 : B[T];
|
|
1499
|
+
if (!p) return;
|
|
1500
|
+
const b = await p(e.name, e, x);
|
|
1501
1501
|
!F && b && f({
|
|
1502
1502
|
...e,
|
|
1503
1503
|
...b
|
|
@@ -1509,11 +1509,11 @@ const Vr = R.memo((e) => {
|
|
|
1509
1509
|
}, kr = (e) => {
|
|
1510
1510
|
var t;
|
|
1511
1511
|
const { fieldSchema: r } = e;
|
|
1512
|
-
return (t = r.dependsOn) != null && t.length ? /* @__PURE__ */ V.jsx(Rr, { fieldSchema: r }) : /* @__PURE__ */ V.jsx(
|
|
1512
|
+
return (t = r.dependsOn) != null && t.length ? /* @__PURE__ */ V.jsx(Rr, { fieldSchema: r }) : /* @__PURE__ */ V.jsx(wr, { fieldSchema: r });
|
|
1513
1513
|
}, Sr = (e) => {
|
|
1514
1514
|
const { fieldSchema: r } = e;
|
|
1515
1515
|
return /* @__PURE__ */ V.jsx(kr, { fieldSchema: r });
|
|
1516
|
-
}, Le =
|
|
1516
|
+
}, Le = k.memo((e) => {
|
|
1517
1517
|
const { schema: r } = e;
|
|
1518
1518
|
return r.map((t) => /* @__PURE__ */ V.jsx(Sr, { fieldSchema: t }, t.name));
|
|
1519
1519
|
});
|
|
@@ -1528,13 +1528,13 @@ function Tr(e, r) {
|
|
|
1528
1528
|
return o;
|
|
1529
1529
|
}
|
|
1530
1530
|
const Or = (e) => {
|
|
1531
|
-
const { onDirtyChange: r, onValuesChange: t, onFieldChange: n } = e, { formState: o, watch: i } =
|
|
1531
|
+
const { onDirtyChange: r, onValuesChange: t, onFieldChange: n } = e, { formState: o, watch: i } = be(), u = Et(!0);
|
|
1532
1532
|
return Ce(() => {
|
|
1533
1533
|
const f = i((F, { name: A = "" }) => {
|
|
1534
|
-
var
|
|
1534
|
+
var p;
|
|
1535
1535
|
t(F);
|
|
1536
1536
|
const T = Qe(A), x = Tr(A, F);
|
|
1537
|
-
(
|
|
1537
|
+
(p = n == null ? void 0 : n[T]) == null || p.call(n, A, x, F);
|
|
1538
1538
|
});
|
|
1539
1539
|
return () => f.unsubscribe();
|
|
1540
1540
|
}, [i, t]), Ce(() => {
|
|
@@ -1552,7 +1552,7 @@ const Or = (e) => {
|
|
|
1552
1552
|
onDirtyChange: r,
|
|
1553
1553
|
onValuesChange: e,
|
|
1554
1554
|
onFieldChange: t
|
|
1555
|
-
}), null), Pr =
|
|
1555
|
+
}), null), Pr = k.forwardRef((e, r) => {
|
|
1556
1556
|
const {
|
|
1557
1557
|
schema: t,
|
|
1558
1558
|
onSubmit: n,
|
|
@@ -1569,40 +1569,40 @@ const Or = (e) => {
|
|
|
1569
1569
|
onValuesChange: T = () => {
|
|
1570
1570
|
},
|
|
1571
1571
|
resolver: x,
|
|
1572
|
-
readonly:
|
|
1572
|
+
readonly: p,
|
|
1573
1573
|
onFieldChange: b = {},
|
|
1574
|
-
loadingComponent:
|
|
1574
|
+
loadingComponent: B
|
|
1575
1575
|
} = e, O = hr({
|
|
1576
1576
|
reValidateMode: "onSubmit",
|
|
1577
1577
|
criteriaMode: "all",
|
|
1578
1578
|
resolver: x
|
|
1579
|
-
}),
|
|
1579
|
+
}), W = Et(!1), [$, E] = xt(!1), J = he(() => {
|
|
1580
1580
|
let j = t;
|
|
1581
|
-
return
|
|
1582
|
-
}, [
|
|
1581
|
+
return p && (j = Ct(j)), j;
|
|
1582
|
+
}, [p, t]);
|
|
1583
1583
|
Ce(() => {
|
|
1584
1584
|
if (!f) return;
|
|
1585
1585
|
let j = !1;
|
|
1586
1586
|
return (async () => {
|
|
1587
|
-
if (
|
|
1587
|
+
if (W.current) return;
|
|
1588
1588
|
E(!1);
|
|
1589
|
-
const
|
|
1590
|
-
j || (O.reset(Ne(t,
|
|
1589
|
+
const X = await f();
|
|
1590
|
+
j || (O.reset(Ne(t, X), {
|
|
1591
1591
|
keepErrors: !0,
|
|
1592
1592
|
keepDirty: !1,
|
|
1593
1593
|
keepTouched: !1
|
|
1594
|
-
}),
|
|
1594
|
+
}), W.current = !0, E(!0));
|
|
1595
1595
|
})(), () => {
|
|
1596
1596
|
j = !0;
|
|
1597
1597
|
};
|
|
1598
1598
|
}, [t, f]), Yt(r, () => ({
|
|
1599
1599
|
submit: () => new Promise((j) => {
|
|
1600
1600
|
O.handleSubmit(
|
|
1601
|
-
async (
|
|
1602
|
-
await n(
|
|
1601
|
+
async (G) => {
|
|
1602
|
+
await n(G), j({ success: !0, errors: {} });
|
|
1603
1603
|
},
|
|
1604
|
-
(
|
|
1605
|
-
j({ success: !1, errors:
|
|
1604
|
+
(G) => {
|
|
1605
|
+
j({ success: !1, errors: G });
|
|
1606
1606
|
}
|
|
1607
1607
|
)();
|
|
1608
1608
|
}),
|
|
@@ -1610,20 +1610,20 @@ const Or = (e) => {
|
|
|
1610
1610
|
O.reset(j ? Ne(t, j) : void 0);
|
|
1611
1611
|
},
|
|
1612
1612
|
getValues: () => O.getValues(),
|
|
1613
|
-
setValue: (j,
|
|
1614
|
-
O.setValue(j,
|
|
1613
|
+
setValue: (j, G) => {
|
|
1614
|
+
O.setValue(j, G);
|
|
1615
1615
|
},
|
|
1616
1616
|
getErrors: () => O.formState.errors
|
|
1617
1617
|
}));
|
|
1618
|
-
const
|
|
1618
|
+
const C = F || p, R = he(() => o, [o]), K = he(() => i, [i]), oe = he(
|
|
1619
1619
|
() => ({
|
|
1620
1620
|
layout: u,
|
|
1621
|
-
uiConfig:
|
|
1622
|
-
updateFieldSchema:
|
|
1621
|
+
uiConfig: R,
|
|
1622
|
+
updateFieldSchema: K
|
|
1623
1623
|
}),
|
|
1624
|
-
[u,
|
|
1624
|
+
[u, R, K]
|
|
1625
1625
|
);
|
|
1626
|
-
return
|
|
1626
|
+
return $ ? /* @__PURE__ */ V.jsxs(Qt, { ...O, children: [
|
|
1627
1627
|
/* @__PURE__ */ V.jsx(
|
|
1628
1628
|
Dr,
|
|
1629
1629
|
{
|
|
@@ -1635,9 +1635,9 @@ const Or = (e) => {
|
|
|
1635
1635
|
/* @__PURE__ */ V.jsxs(
|
|
1636
1636
|
vr,
|
|
1637
1637
|
{
|
|
1638
|
-
layout:
|
|
1639
|
-
uiConfig:
|
|
1640
|
-
updateFieldSchema:
|
|
1638
|
+
layout: oe.layout,
|
|
1639
|
+
uiConfig: oe.uiConfig,
|
|
1640
|
+
updateFieldSchema: oe.updateFieldSchema,
|
|
1641
1641
|
children: [
|
|
1642
1642
|
["vertical", "horizontal"].includes(u) && /* @__PURE__ */ V.jsx(
|
|
1643
1643
|
"div",
|
|
@@ -1646,15 +1646,15 @@ const Or = (e) => {
|
|
|
1646
1646
|
display: "flex",
|
|
1647
1647
|
flexDirection: u === "vertical" ? "column" : "row"
|
|
1648
1648
|
},
|
|
1649
|
-
children: /* @__PURE__ */ V.jsx(Le, { schema:
|
|
1649
|
+
children: /* @__PURE__ */ V.jsx(Le, { schema: J })
|
|
1650
1650
|
}
|
|
1651
1651
|
),
|
|
1652
|
-
u === "custom" && /* @__PURE__ */ V.jsx(Le, { schema:
|
|
1653
|
-
!
|
|
1652
|
+
u === "custom" && /* @__PURE__ */ V.jsx(Le, { schema: J }),
|
|
1653
|
+
!C && /* @__PURE__ */ V.jsx("button", { style: { marginTop: "1rem" }, onClick: O.handleSubmit(n), children: "Submit" })
|
|
1654
1654
|
]
|
|
1655
1655
|
}
|
|
1656
1656
|
)
|
|
1657
|
-
] }) : /* @__PURE__ */ V.jsx(V.Fragment, { children:
|
|
1657
|
+
] }) : /* @__PURE__ */ V.jsx(V.Fragment, { children: B ?? /* @__PURE__ */ V.jsx(
|
|
1658
1658
|
"div",
|
|
1659
1659
|
{
|
|
1660
1660
|
style: {
|