autoforma 2.9.2 → 2.9.4
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 +4 -4
- package/dist/index.es.js +275 -289
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import R, { useMemo as
|
|
2
|
-
var De = { exports: {} },
|
|
1
|
+
import R, { useMemo as he, createContext as $t, useContext as Wt, useState as xt, useEffect as Ce, useRef as Et, useImperativeHandle as Yt } from "react";
|
|
2
|
+
var De = { exports: {} }, Ae = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -11,7 +11,7 @@ var De = { exports: {} }, pe = {};
|
|
|
11
11
|
*/
|
|
12
12
|
var it;
|
|
13
13
|
function qt() {
|
|
14
|
-
if (it) return
|
|
14
|
+
if (it) return Ae;
|
|
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 Ae.Fragment = r, Ae.jsx = t, Ae.jsxs = t, Ae;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var we = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -99,11 +99,11 @@ function zt() {
|
|
|
99
99
|
}
|
|
100
100
|
if (g) {
|
|
101
101
|
g = console;
|
|
102
|
-
var j = g.error,
|
|
102
|
+
var j = g.error, L = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
|
|
103
103
|
return j.call(
|
|
104
104
|
g,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
|
|
106
|
+
L
|
|
107
107
|
), r(c);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -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
|
}
|
|
@@ -150,14 +150,14 @@ function zt() {
|
|
|
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
|
-
function
|
|
153
|
+
function p(c, g, j, L, _e, xe) {
|
|
154
154
|
var U = j.ref;
|
|
155
155
|
return c = {
|
|
156
156
|
$$typeof: B,
|
|
157
157
|
type: c,
|
|
158
158
|
key: g,
|
|
159
159
|
props: j,
|
|
160
|
-
_owner:
|
|
160
|
+
_owner: L
|
|
161
161
|
}, (U !== void 0 ? U : null) !== null ? Object.defineProperty(c, "ref", {
|
|
162
162
|
enumerable: !1,
|
|
163
163
|
get: F
|
|
@@ -183,36 +183,36 @@ function zt() {
|
|
|
183
183
|
value: xe
|
|
184
184
|
}), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function S(c, g, j, L, _e, xe) {
|
|
187
187
|
var U = g.children;
|
|
188
188
|
if (U !== void 0)
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
for (
|
|
192
|
-
x(U[
|
|
189
|
+
if (L)
|
|
190
|
+
if (I(U)) {
|
|
191
|
+
for (L = 0; L < U.length; L++)
|
|
192
|
+
x(U[L]);
|
|
193
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
198
|
else x(U);
|
|
199
|
-
if (
|
|
199
|
+
if (w.call(g, "key")) {
|
|
200
200
|
U = e(c);
|
|
201
|
-
var oe = Object.keys(g).filter(function(
|
|
202
|
-
return
|
|
201
|
+
var oe = Object.keys(g).filter(function(pe) {
|
|
202
|
+
return pe !== "key";
|
|
203
203
|
});
|
|
204
|
-
|
|
204
|
+
L = 0 < oe.length ? "{key: someKey, " + oe.join(": ..., ") + ": ...}" : "{key: someKey}", me[U + L] || (oe = 0 < oe.length ? "{" + oe.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} />
|
|
208
208
|
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
212
|
U,
|
|
213
213
|
oe,
|
|
214
214
|
U
|
|
215
|
-
), me[U +
|
|
215
|
+
), me[U + L] = !0);
|
|
216
216
|
}
|
|
217
217
|
if (U = null, j !== void 0 && (t(j), U = "" + j), u(g) && (t(g.key), U = "" + g.key), "key" in g) {
|
|
218
218
|
j = {};
|
|
@@ -222,7 +222,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
222
222
|
return U && f(
|
|
223
223
|
j,
|
|
224
224
|
typeof c == "function" ? c.displayName || c.name || "Unknown" : c
|
|
225
|
-
),
|
|
225
|
+
), p(
|
|
226
226
|
c,
|
|
227
227
|
U,
|
|
228
228
|
j,
|
|
@@ -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
|
+
A(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof === N && (c._payload.status === "fulfilled" ? A(c._payload.value) && c._payload.value._store && (c._payload.value._store.validated = 1) : c._store && (c._store.validated = 1));
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function A(c) {
|
|
238
238
|
return typeof c == "object" && c !== null && c.$$typeof === B;
|
|
239
239
|
}
|
|
240
|
-
var b = R, B = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), $ = Symbol.for("react.fragment"), W = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), G = Symbol.for("react.consumer"), C = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), ee = Symbol.for("react.suspense"), ce = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), J = Symbol.for("react.activity"), fe = Symbol.for("react.client.reference"), _ = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
240
|
+
var b = R, B = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), $ = Symbol.for("react.fragment"), W = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), G = Symbol.for("react.consumer"), C = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), ee = Symbol.for("react.suspense"), ce = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), J = Symbol.for("react.activity"), fe = 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 = {
|
|
@@ -249,36 +249,36 @@ React keys must be passed directly to JSX without using spread:
|
|
|
249
249
|
b,
|
|
250
250
|
i
|
|
251
251
|
)(), ye = Y(n(i)), me = {};
|
|
252
|
-
|
|
253
|
-
var
|
|
254
|
-
return
|
|
252
|
+
we.Fragment = $, we.jsx = function(c, g, j) {
|
|
253
|
+
var L = 1e4 > _.recentlyCreatedOwnerStacks++;
|
|
254
|
+
return S(
|
|
255
255
|
c,
|
|
256
256
|
g,
|
|
257
257
|
j,
|
|
258
258
|
!1,
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
L ? Error("react-stack-top-frame") : de,
|
|
260
|
+
L ? Y(n(c)) : ye
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
return
|
|
262
|
+
}, we.jsxs = function(c, g, j) {
|
|
263
|
+
var L = 1e4 > _.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return S(
|
|
265
265
|
c,
|
|
266
266
|
g,
|
|
267
267
|
j,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
L ? Error("react-stack-top-frame") : de,
|
|
270
|
+
L ? Y(n(c)) : ye
|
|
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(),
|
|
279
|
+
var V = Ht(), Se = (e) => e.type === "checkbox", be = (e) => e instanceof Date, K = (e) => e == null;
|
|
280
280
|
const Vt = (e) => typeof e == "object";
|
|
281
|
-
var z = (e) => !K(e) && !Array.isArray(e) && Vt(e) && !be(e), Jt = (e) => z(e) && e.target ?
|
|
281
|
+
var z = (e) => !K(e) && !Array.isArray(e) && Vt(e) && !be(e), Jt = (e) => z(e) && e.target ? Se(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
283
|
return z(r) && r.hasOwnProperty("isPrototypeOf");
|
|
284
284
|
}, ze = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -296,20 +296,20 @@ function H(e) {
|
|
|
296
296
|
Object.prototype.hasOwnProperty.call(e, o) && (n[o] = H(e[o]));
|
|
297
297
|
return n;
|
|
298
298
|
}
|
|
299
|
-
var
|
|
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(/\.|\[/)), v = (e, r, t) => {
|
|
300
300
|
if (!r || !z(e))
|
|
301
301
|
return t;
|
|
302
|
-
const n = (
|
|
302
|
+
const n = (Ie(r) ? [r] : Je(r)).reduce((o, i) => K(o) ? o : o[i], e);
|
|
303
303
|
return M(n) || n === e ? M(e[r]) ? t : e[r] : n;
|
|
304
304
|
}, le = (e) => typeof e == "boolean", ne = (e) => typeof e == "function", P = (e, r, t) => {
|
|
305
305
|
let n = -1;
|
|
306
|
-
const o =
|
|
306
|
+
const o = Ie(r) ? [r] : Je(r), i = o.length, u = i - 1;
|
|
307
307
|
for (; ++n < i; ) {
|
|
308
308
|
const f = o[n];
|
|
309
309
|
let F = t;
|
|
310
310
|
if (n !== u) {
|
|
311
|
-
const
|
|
312
|
-
F = z(
|
|
311
|
+
const p = e[f];
|
|
312
|
+
F = z(p) || Array.isArray(p) ? p : isNaN(+o[n + 1]) ? {} : [];
|
|
313
313
|
}
|
|
314
314
|
if (f === "__proto__" || f === "constructor" || f === "prototype")
|
|
315
315
|
return;
|
|
@@ -353,7 +353,7 @@ var Kt = (e, r, t, n = !0) => {
|
|
|
353
353
|
return o;
|
|
354
354
|
};
|
|
355
355
|
const Ft = typeof window < "u" ? R.useLayoutEffect : R.useEffect;
|
|
356
|
-
var te = (e) => typeof e == "string", We = (e, r, t, n, o) => te(e) ? (n && r.watch.add(e),
|
|
356
|
+
var te = (e) => typeof e == "string", We = (e, r, t, n, o) => te(e) ? (n && r.watch.add(e), v(t, e, o)) : Array.isArray(e) ? e.map((i) => (n && r.watch.add(i), v(t, i))) : (n && (r.watchAll = !0), t), Ye = (e) => K(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);
|
|
@@ -377,26 +377,26 @@ function ae(e, r, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
377
377
|
}
|
|
378
378
|
return !0;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
const r = ge(), { control: t = r.control, name: n, defaultValue: o, disabled: i, exact: u, compute: f } = e || {}, F = R.useRef(o),
|
|
382
|
-
|
|
380
|
+
function pt(e) {
|
|
381
|
+
const r = ge(), { control: t = r.control, name: n, defaultValue: o, disabled: i, exact: u, compute: f } = e || {}, F = R.useRef(o), p = R.useRef(f), S = R.useRef(void 0), x = R.useRef(t), A = R.useRef(n);
|
|
382
|
+
p.current = f;
|
|
383
383
|
const [b, B] = R.useState(() => {
|
|
384
384
|
const C = t._getWatch(n, F.current);
|
|
385
|
-
return
|
|
385
|
+
return p.current ? p.current(C) : C;
|
|
386
386
|
}), O = R.useCallback((C) => {
|
|
387
387
|
const k = We(n, t._names, C || t._formValues, !1, F.current);
|
|
388
|
-
return
|
|
388
|
+
return p.current ? p.current(k) : k;
|
|
389
389
|
}, [t._formValues, t._names, n]), $ = R.useCallback((C) => {
|
|
390
390
|
if (!i) {
|
|
391
391
|
const k = We(n, t._names, C || t._formValues, !1, F.current);
|
|
392
|
-
if (
|
|
393
|
-
const ee =
|
|
394
|
-
ae(ee,
|
|
392
|
+
if (p.current) {
|
|
393
|
+
const ee = p.current(k);
|
|
394
|
+
ae(ee, S.current) || (B(ee), S.current = ee);
|
|
395
395
|
} else
|
|
396
396
|
B(k);
|
|
397
397
|
}
|
|
398
398
|
}, [t._formValues, t._names, i, n]);
|
|
399
|
-
Ft(() => ((x.current !== t || !ae(
|
|
399
|
+
Ft(() => ((x.current !== t || !ae(A.current, n)) && (x.current = t, A.current = n, $()), t._subscribe({
|
|
400
400
|
name: n,
|
|
401
401
|
formState: {
|
|
402
402
|
values: !0
|
|
@@ -406,7 +406,7 @@ function wt(e) {
|
|
|
406
406
|
$(C.values);
|
|
407
407
|
}
|
|
408
408
|
})), [t, u, n, $]), R.useEffect(() => t._removeUnmounted());
|
|
409
|
-
const W = x.current !== t, E =
|
|
409
|
+
const W = x.current !== t, E = A.current, G = R.useMemo(() => {
|
|
410
410
|
if (i)
|
|
411
411
|
return null;
|
|
412
412
|
const C = !W && !ae(E, n);
|
|
@@ -440,13 +440,13 @@ var er = (e, r, t, n, o) => r ? {
|
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
};
|
|
443
|
-
function
|
|
443
|
+
function At(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
448
|
if (o && z(o) && i) {
|
|
449
|
-
const u =
|
|
449
|
+
const u = At(o, i);
|
|
450
450
|
z(u) && (t[n] = u);
|
|
451
451
|
} else e[n] && (t[n] = i);
|
|
452
452
|
}
|
|
@@ -457,7 +457,7 @@ var Z = (e) => z(e) && !Object.keys(e).length, Xe = (e) => e.type === "file", je
|
|
|
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) || Se(e), $e = (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;
|
|
@@ -472,7 +472,7 @@ function sr(e) {
|
|
|
472
472
|
return !0;
|
|
473
473
|
}
|
|
474
474
|
function q(e, r) {
|
|
475
|
-
const t = Array.isArray(r) ? r :
|
|
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
476
|
return n && delete n[i], o !== 0 && (z(n) && Z(n) || Array.isArray(n) && sr(n)) && q(e, t.slice(0, -1)), e;
|
|
477
477
|
}
|
|
478
478
|
var nr = (e) => {
|
|
@@ -520,23 +520,23 @@ var kt = (e) => {
|
|
|
520
520
|
) : ct;
|
|
521
521
|
}
|
|
522
522
|
return ct;
|
|
523
|
-
},
|
|
523
|
+
}, Tt = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => M(e) ? e : r ? e === "" ? NaN : e && +e : t && te(e) ? new Date(e) : n ? n(e) : e;
|
|
524
524
|
const dt = {
|
|
525
525
|
isValid: !1,
|
|
526
526
|
value: null
|
|
527
527
|
};
|
|
528
|
-
var
|
|
528
|
+
var St = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
|
|
529
529
|
isValid: !0,
|
|
530
530
|
value: t.value
|
|
531
531
|
} : r, dt) : dt;
|
|
532
532
|
function yt(e) {
|
|
533
533
|
const r = e.ref;
|
|
534
|
-
return Xe(r) ? r.files : Ze(r) ?
|
|
534
|
+
return Xe(r) ? r.files : Ze(r) ? St(e.refs).value : wt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Se(r) ? kt(e.refs).value : Tt(M(r.value) ? e.ref.value : r.value, e);
|
|
535
535
|
}
|
|
536
536
|
var ir = (e, r, t, n) => {
|
|
537
537
|
const o = {};
|
|
538
538
|
for (const i of e) {
|
|
539
|
-
const u =
|
|
539
|
+
const u = v(r, i);
|
|
540
540
|
u && P(o, i, u._f);
|
|
541
541
|
}
|
|
542
542
|
return {
|
|
@@ -552,11 +552,11 @@ var ir = (e, r, t, n) => {
|
|
|
552
552
|
isOnAll: e === ie.all,
|
|
553
553
|
isOnTouch: e === ie.onTouched
|
|
554
554
|
});
|
|
555
|
-
const
|
|
556
|
-
var ar = (e) => !!e && !!e.validate && !!(ne(e.validate) && e.validate.constructor.name ===
|
|
557
|
-
const
|
|
555
|
+
const vt = "AsyncFunction";
|
|
556
|
+
var ar = (e) => !!e && !!e.validate && !!(ne(e.validate) && e.validate.constructor.name === vt || z(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === vt)), or = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), ht = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
557
|
+
const Te = (e, r, t, n) => {
|
|
558
558
|
for (const o of t || Object.keys(e)) {
|
|
559
|
-
const i =
|
|
559
|
+
const i = v(e, o);
|
|
560
560
|
if (i) {
|
|
561
561
|
const { _f: u, ...f } = i;
|
|
562
562
|
if (u) {
|
|
@@ -564,23 +564,23 @@ const Se = (e, r, t, n) => {
|
|
|
564
564
|
return !0;
|
|
565
565
|
if (u.ref && r(u.ref, u.name) && !n)
|
|
566
566
|
return !0;
|
|
567
|
-
if (
|
|
567
|
+
if (Te(f, r))
|
|
568
568
|
break;
|
|
569
|
-
} else if (z(f) &&
|
|
569
|
+
} else if (z(f) && Te(f, r))
|
|
570
570
|
break;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
};
|
|
574
574
|
function bt(e, r, t) {
|
|
575
|
-
const n =
|
|
576
|
-
if (n ||
|
|
575
|
+
const n = v(e, t);
|
|
576
|
+
if (n || Ie(t))
|
|
577
577
|
return {
|
|
578
578
|
error: n,
|
|
579
579
|
name: t
|
|
580
580
|
};
|
|
581
581
|
const o = t.split(".");
|
|
582
582
|
for (; o.length; ) {
|
|
583
|
-
const i = o.join("."), u =
|
|
583
|
+
const i = o.join("."), u = v(r, i), f = v(e, i);
|
|
584
584
|
if (u && !Array.isArray(u) && t !== i)
|
|
585
585
|
return { name: t };
|
|
586
586
|
if (f && f.type)
|
|
@@ -603,8 +603,8 @@ var lr = (e, r, t, n) => {
|
|
|
603
603
|
t(e);
|
|
604
604
|
const { name: o, ...i } = e;
|
|
605
605
|
return Z(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(
|
|
607
|
-
const n = ke(
|
|
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(v(e, r)).length && q(e, r), dr = (e, r, t) => {
|
|
607
|
+
const n = ke(v(e, t));
|
|
608
608
|
return P(n, "root", r[t]), P(e, t, n), e;
|
|
609
609
|
};
|
|
610
610
|
function gt(e, r, t = "validate") {
|
|
@@ -619,13 +619,13 @@ 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:
|
|
622
|
+
const { ref: u, refs: f, required: F, maxLength: p, minLength: S, min: x, max: A, pattern: b, validate: B, name: O, valueAsNumber: $, mount: W } = e._f, E = v(t, O);
|
|
623
623
|
if (!W || r.has(O))
|
|
624
624
|
return {};
|
|
625
625
|
const G = f ? f[0] : u, C = (_) => {
|
|
626
626
|
o && G.reportValidity && (G.setCustomValidity(le(_) ? "" : _ || ""), G.reportValidity());
|
|
627
|
-
}, k = {}, ee = Ze(u), ce =
|
|
628
|
-
const X = _ ?
|
|
627
|
+
}, k = {}, ee = Ze(u), ce = Se(u), se = ee || ce, N = ($ || Xe(u)) && M(u.value) && M(E) || je(u) && u.value === "" || E === "" || Array.isArray(E) && !E.length, J = er.bind(null, O, n, k), fe = (_, w, I, Y = ue.maxLength, Q = ue.minLength) => {
|
|
628
|
+
const X = _ ? w : I;
|
|
629
629
|
k[O] = {
|
|
630
630
|
type: _ ? Y : Q,
|
|
631
631
|
message: X,
|
|
@@ -633,62 +633,62 @@ var Ve = (e) => z(e) && !Pe(e) ? e : {
|
|
|
633
633
|
...J(_ ? Y : Q, X)
|
|
634
634
|
};
|
|
635
635
|
};
|
|
636
|
-
if (i ? !Array.isArray(E) || !E.length : F && (!se && (N || K(E)) || le(E) && !E || ce && !kt(f).isValid || ee && !
|
|
637
|
-
const { value: _, message:
|
|
636
|
+
if (i ? !Array.isArray(E) || !E.length : F && (!se && (N || K(E)) || le(E) && !E || ce && !kt(f).isValid || ee && !St(f).isValid)) {
|
|
637
|
+
const { value: _, message: w } = te(F) ? { value: !!F, message: F } : Ve(F);
|
|
638
638
|
if (_ && (k[O] = {
|
|
639
639
|
type: ue.required,
|
|
640
|
-
message:
|
|
640
|
+
message: w,
|
|
641
641
|
ref: G,
|
|
642
|
-
...J(ue.required,
|
|
642
|
+
...J(ue.required, w)
|
|
643
643
|
}, !n))
|
|
644
|
-
return C(
|
|
644
|
+
return C(w), k;
|
|
645
645
|
}
|
|
646
|
-
if (!N && (!K(x) || !K(
|
|
647
|
-
let _,
|
|
648
|
-
const
|
|
646
|
+
if (!N && (!K(x) || !K(A))) {
|
|
647
|
+
let _, w;
|
|
648
|
+
const I = Ve(A), Y = Ve(x);
|
|
649
649
|
if (!K(E) && !isNaN(E)) {
|
|
650
650
|
const Q = u.valueAsNumber || E && +E;
|
|
651
|
-
K(
|
|
651
|
+
K(I.value) || (_ = Q > I.value), K(Y.value) || (w = Q < Y.value);
|
|
652
652
|
} else {
|
|
653
653
|
const Q = u.valueAsDate || new Date(E), X = (me) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + me), de = u.type == "time", ye = u.type == "week";
|
|
654
|
-
te(
|
|
654
|
+
te(I.value) && E && (_ = de ? X(E) > X(I.value) : ye ? E > I.value : Q > new Date(I.value)), te(Y.value) && E && (w = de ? X(E) < X(Y.value) : ye ? E < Y.value : Q < new Date(Y.value));
|
|
655
655
|
}
|
|
656
|
-
if ((_ ||
|
|
656
|
+
if ((_ || w) && (fe(!!_, I.message, Y.message, ue.max, ue.min), !n))
|
|
657
657
|
return C(k[O].message), k;
|
|
658
658
|
}
|
|
659
|
-
if ((
|
|
660
|
-
const _ = Ve(
|
|
661
|
-
if ((
|
|
659
|
+
if ((p || S) && !N && (te(E) || i && Array.isArray(E))) {
|
|
660
|
+
const _ = Ve(p), w = Ve(S), I = !K(_.value) && E.length > +_.value, Y = !K(w.value) && E.length < +w.value;
|
|
661
|
+
if ((I || Y) && (fe(I, _.message, w.message), !n))
|
|
662
662
|
return C(k[O].message), k;
|
|
663
663
|
}
|
|
664
664
|
if (b && !N && te(E)) {
|
|
665
|
-
const { value: _, message:
|
|
665
|
+
const { value: _, message: w } = Ve(b);
|
|
666
666
|
if (Pe(_) && !E.match(_) && (k[O] = {
|
|
667
667
|
type: ue.pattern,
|
|
668
|
-
message:
|
|
668
|
+
message: w,
|
|
669
669
|
ref: u,
|
|
670
|
-
...J(ue.pattern,
|
|
670
|
+
...J(ue.pattern, w)
|
|
671
671
|
}, !n))
|
|
672
|
-
return C(
|
|
672
|
+
return C(w), k;
|
|
673
673
|
}
|
|
674
674
|
if (B) {
|
|
675
675
|
if (ne(B)) {
|
|
676
|
-
const _ = await B(E, t),
|
|
677
|
-
if (
|
|
678
|
-
...
|
|
679
|
-
...J(ue.validate,
|
|
676
|
+
const _ = await B(E, t), w = gt(_, G);
|
|
677
|
+
if (w && (k[O] = {
|
|
678
|
+
...w,
|
|
679
|
+
...J(ue.validate, w.message)
|
|
680
680
|
}, !n))
|
|
681
|
-
return C(
|
|
681
|
+
return C(w.message), k;
|
|
682
682
|
} else if (z(B)) {
|
|
683
683
|
let _ = {};
|
|
684
|
-
for (const
|
|
684
|
+
for (const w in B) {
|
|
685
685
|
if (!Z(_) && !n)
|
|
686
686
|
break;
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
...
|
|
690
|
-
...J(
|
|
691
|
-
}, C(
|
|
687
|
+
const I = gt(await B[w](E, t), G, w);
|
|
688
|
+
I && (_ = {
|
|
689
|
+
...I,
|
|
690
|
+
...J(w, I.message)
|
|
691
|
+
}, C(I.message), n && (k[O] = _));
|
|
692
692
|
}
|
|
693
693
|
if (!Z(_) && (k[O] = {
|
|
694
694
|
ref: G,
|
|
@@ -734,8 +734,8 @@ function mr(e = {}) {
|
|
|
734
734
|
unMount: /* @__PURE__ */ new Set(),
|
|
735
735
|
array: /* @__PURE__ */ new Set(),
|
|
736
736
|
watch: /* @__PURE__ */ new Set()
|
|
737
|
-
}, F,
|
|
738
|
-
const
|
|
737
|
+
}, F, p = 0;
|
|
738
|
+
const S = {
|
|
739
739
|
isDirty: !1,
|
|
740
740
|
dirtyFields: !1,
|
|
741
741
|
validatingFields: !1,
|
|
@@ -744,25 +744,25 @@ function mr(e = {}) {
|
|
|
744
744
|
isValid: !1,
|
|
745
745
|
errors: !1
|
|
746
746
|
}, x = {
|
|
747
|
-
...
|
|
747
|
+
...S
|
|
748
748
|
};
|
|
749
|
-
let
|
|
749
|
+
let A = {
|
|
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
|
-
clearTimeout(
|
|
756
|
+
clearTimeout(p), p = setTimeout(s, a);
|
|
757
757
|
}, $ = async (s) => {
|
|
758
|
-
if (!u.keepIsValid && !r.disabled && (x.isValid ||
|
|
758
|
+
if (!u.keepIsValid && !r.disabled && (x.isValid || A.isValid || s)) {
|
|
759
759
|
let a;
|
|
760
760
|
r.resolver ? (a = Z((await se()).errors), W()) : a = await J(n, !0), a !== t.isValid && b.state.next({
|
|
761
761
|
isValid: a
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
}, W = (s, a) => {
|
|
765
|
-
!r.disabled && (x.isValidating || x.validatingFields ||
|
|
765
|
+
!r.disabled && (x.isValidating || x.validatingFields || A.isValidating || A.validatingFields) && ((s || Array.from(f.mount)).forEach((l) => {
|
|
766
766
|
l && (a ? P(t.validatingFields, l, a) : q(t.validatingFields, l));
|
|
767
767
|
}), b.state.next({
|
|
768
768
|
validatingFields: t.validatingFields,
|
|
@@ -770,19 +770,19 @@ function mr(e = {}) {
|
|
|
770
770
|
}));
|
|
771
771
|
}, E = (s, a = [], l, m, y = !0, d = !0) => {
|
|
772
772
|
if (m && l && !r.disabled) {
|
|
773
|
-
if (u.action = !0, d && Array.isArray(
|
|
774
|
-
const
|
|
775
|
-
y && P(n, s,
|
|
773
|
+
if (u.action = !0, d && Array.isArray(v(n, s))) {
|
|
774
|
+
const h = l(v(n, s), m.argA, m.argB);
|
|
775
|
+
y && P(n, s, h);
|
|
776
776
|
}
|
|
777
|
-
if (d && Array.isArray(
|
|
778
|
-
const
|
|
779
|
-
y && P(t.errors, s,
|
|
777
|
+
if (d && Array.isArray(v(t.errors, s))) {
|
|
778
|
+
const h = l(v(t.errors, s), m.argA, m.argB);
|
|
779
|
+
y && P(t.errors, s, h), fr(t.errors, s);
|
|
780
780
|
}
|
|
781
|
-
if ((x.touchedFields ||
|
|
782
|
-
const
|
|
783
|
-
y && P(t.touchedFields, s,
|
|
781
|
+
if ((x.touchedFields || A.touchedFields) && d && Array.isArray(v(t.touchedFields, s))) {
|
|
782
|
+
const h = l(v(t.touchedFields, s), m.argA, m.argB);
|
|
783
|
+
y && P(t.touchedFields, s, h);
|
|
784
784
|
}
|
|
785
|
-
(x.dirtyFields ||
|
|
785
|
+
(x.dirtyFields || A.dirtyFields) && (t.dirtyFields = Fe(o, i)), b.state.next({
|
|
786
786
|
name: s,
|
|
787
787
|
isDirty: _(s, a),
|
|
788
788
|
dirtyFields: t.dirtyFields,
|
|
@@ -801,33 +801,33 @@ function mr(e = {}) {
|
|
|
801
801
|
isValid: !1
|
|
802
802
|
});
|
|
803
803
|
}, k = (s, a, l, m) => {
|
|
804
|
-
const y =
|
|
804
|
+
const y = v(n, s);
|
|
805
805
|
if (y) {
|
|
806
|
-
const d =
|
|
806
|
+
const d = v(i, s, M(l) ? v(o, s) : l);
|
|
807
807
|
M(d) || m && m.defaultChecked || a ? P(i, s, a ? d : yt(y._f)) : Y(s, d), u.mount && !u.action && $();
|
|
808
808
|
}
|
|
809
809
|
}, ee = (s, a, l, m, y) => {
|
|
810
|
-
let d = !1,
|
|
811
|
-
const
|
|
810
|
+
let d = !1, h = !1;
|
|
811
|
+
const T = {
|
|
812
812
|
name: s
|
|
813
813
|
};
|
|
814
814
|
if (!r.disabled) {
|
|
815
815
|
if (!l || m) {
|
|
816
|
-
(x.isDirty ||
|
|
817
|
-
const D = ae(
|
|
818
|
-
|
|
816
|
+
(x.isDirty || A.isDirty) && (h = t.isDirty, t.isDirty = T.isDirty = _(), d = h !== T.isDirty);
|
|
817
|
+
const D = ae(v(o, s), a);
|
|
818
|
+
h = !!v(t.dirtyFields, s), D ? q(t.dirtyFields, s) : P(t.dirtyFields, s, !0), T.dirtyFields = t.dirtyFields, d = d || (x.dirtyFields || A.dirtyFields) && h !== !D;
|
|
819
819
|
}
|
|
820
820
|
if (l) {
|
|
821
|
-
const D =
|
|
822
|
-
D || (P(t.touchedFields, s, l),
|
|
821
|
+
const D = v(t.touchedFields, s);
|
|
822
|
+
D || (P(t.touchedFields, s, l), T.touchedFields = t.touchedFields, d = d || (x.touchedFields || A.touchedFields) && D !== l);
|
|
823
823
|
}
|
|
824
|
-
d && y && b.state.next(
|
|
824
|
+
d && y && b.state.next(T);
|
|
825
825
|
}
|
|
826
|
-
return d ?
|
|
826
|
+
return d ? T : {};
|
|
827
827
|
}, ce = (s, a, l, m) => {
|
|
828
|
-
const y =
|
|
829
|
-
if (r.delayError && l ? (F = O(() => G(s, l)), F(r.delayError)) : (clearTimeout(
|
|
830
|
-
const
|
|
828
|
+
const y = v(t.errors, s), d = (x.isValid || A.isValid) && le(a) && t.isValid !== a;
|
|
829
|
+
if (r.delayError && l ? (F = O(() => G(s, l)), F(r.delayError)) : (clearTimeout(p), F = null, l ? P(t.errors, s, l) : q(t.errors, s)), (l ? !ae(y, l) : y) || !Z(m) || d) {
|
|
830
|
+
const h = {
|
|
831
831
|
...m,
|
|
832
832
|
...d && le(a) ? { isValid: a } : {},
|
|
833
833
|
errors: t.errors,
|
|
@@ -835,14 +835,14 @@ function mr(e = {}) {
|
|
|
835
835
|
};
|
|
836
836
|
t = {
|
|
837
837
|
...t,
|
|
838
|
-
...
|
|
839
|
-
}, b.state.next(
|
|
838
|
+
...h
|
|
839
|
+
}, b.state.next(h);
|
|
840
840
|
}
|
|
841
841
|
}, se = async (s) => (W(s, !0), await r.resolver(i, r.context, ir(s || f.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), N = async (s) => {
|
|
842
842
|
const { errors: a } = await se(s);
|
|
843
843
|
if (W(s), s)
|
|
844
844
|
for (const l of s) {
|
|
845
|
-
const m =
|
|
845
|
+
const m = v(a, l);
|
|
846
846
|
m ? P(t.errors, l, m) : q(t.errors, l);
|
|
847
847
|
}
|
|
848
848
|
else
|
|
@@ -854,35 +854,35 @@ function mr(e = {}) {
|
|
|
854
854
|
for (const m in s) {
|
|
855
855
|
const y = s[m];
|
|
856
856
|
if (y) {
|
|
857
|
-
const { _f: d, ...
|
|
857
|
+
const { _f: d, ...h } = y;
|
|
858
858
|
if (d) {
|
|
859
|
-
const
|
|
859
|
+
const T = f.array.has(d.name), D = y._f && ar(y._f);
|
|
860
860
|
D && x.validatingFields && W([d.name], !0);
|
|
861
|
-
const re = await _t(y, f.disabled, i, B, r.shouldUseNativeValidation && !a,
|
|
861
|
+
const re = await _t(y, f.disabled, i, B, r.shouldUseNativeValidation && !a, T);
|
|
862
862
|
if (D && x.validatingFields && W([d.name]), re[d.name] && (l.valid = !1, a))
|
|
863
863
|
break;
|
|
864
|
-
!a && (
|
|
864
|
+
!a && (v(re, d.name) ? T ? dr(t.errors, re, d.name) : P(t.errors, d.name, re[d.name]) : q(t.errors, d.name));
|
|
865
865
|
}
|
|
866
|
-
!Z(
|
|
866
|
+
!Z(h) && await J(h, a, l);
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
869
|
return l.valid;
|
|
870
870
|
}, fe = () => {
|
|
871
871
|
for (const s of f.unMount) {
|
|
872
|
-
const a =
|
|
872
|
+
const a = v(n, s);
|
|
873
873
|
a && (a._f.refs ? a._f.refs.every((l) => !$e(l)) : !$e(a._f.ref)) && oe(s);
|
|
874
874
|
}
|
|
875
875
|
f.unMount = /* @__PURE__ */ new Set();
|
|
876
|
-
}, _ = (s, a) => !r.disabled && (s && a && P(i, s, a), !ae(c(), o)),
|
|
876
|
+
}, _ = (s, a) => !r.disabled && (s && a && P(i, s, a), !ae(c(), o)), w = (s, a, l) => We(s, f, {
|
|
877
877
|
...u.mount ? i : M(a) ? o : te(s) ? { [s]: a } : a
|
|
878
|
-
}, l, a),
|
|
879
|
-
const m =
|
|
878
|
+
}, l, a), I = (s) => He(v(u.mount ? i : o, s, r.shouldUnregister ? v(o, s, []) : [])), Y = (s, a, l = {}) => {
|
|
879
|
+
const m = v(n, s);
|
|
880
880
|
let y = a;
|
|
881
881
|
if (m) {
|
|
882
882
|
const d = m._f;
|
|
883
|
-
d && (!d.disabled && P(i, s,
|
|
884
|
-
(!
|
|
885
|
-
}) : d.refs.forEach((
|
|
883
|
+
d && (!d.disabled && P(i, s, Tt(a, d)), y = je(d.ref) && K(a) ? "" : a, wt(d.ref) ? [...d.ref.options].forEach((h) => h.selected = y.includes(h.value)) : d.refs ? Se(d.ref) ? d.refs.forEach((h) => {
|
|
884
|
+
(!h.defaultChecked || !h.disabled) && (Array.isArray(y) ? h.checked = !!y.find((T) => T === h.value) : h.checked = y === h.value || !!y);
|
|
885
|
+
}) : d.refs.forEach((h) => h.checked = h.value === y) : Xe(d.ref) ? d.ref.value = "" : (d.ref.value = y, d.ref.type || b.state.next({
|
|
886
886
|
name: s,
|
|
887
887
|
values: H(i)
|
|
888
888
|
})));
|
|
@@ -892,19 +892,19 @@ function mr(e = {}) {
|
|
|
892
892
|
for (const m in a) {
|
|
893
893
|
if (!a.hasOwnProperty(m))
|
|
894
894
|
return;
|
|
895
|
-
const y = a[m], d = s + "." + m,
|
|
896
|
-
(f.array.has(s) || z(y) ||
|
|
895
|
+
const y = a[m], d = s + "." + m, h = v(n, d);
|
|
896
|
+
(f.array.has(s) || z(y) || h && !h._f) && !be(y) ? Q(d, y, l) : Y(d, y, l);
|
|
897
897
|
}
|
|
898
898
|
}, X = (s, a, l = {}) => {
|
|
899
|
-
const m =
|
|
899
|
+
const m = v(n, s), y = f.array.has(s), d = H(a);
|
|
900
900
|
P(i, s, d), y ? (b.array.next({
|
|
901
901
|
name: s,
|
|
902
902
|
values: H(i)
|
|
903
|
-
}), (x.isDirty || x.dirtyFields ||
|
|
903
|
+
}), (x.isDirty || x.dirtyFields || A.isDirty || A.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 && !K(d) ? Q(s, d, l) : Y(s, d, l),
|
|
907
|
+
})) : m && !m._f && !K(d) ? Q(s, d, l) : Y(s, d, l), ht(s, f) && b.state.next({ ...t, name: s }), b.state.next({
|
|
908
908
|
name: u.mount ? s : void 0,
|
|
909
909
|
values: H(i)
|
|
910
910
|
});
|
|
@@ -912,65 +912,65 @@ function mr(e = {}) {
|
|
|
912
912
|
u.mount = !0;
|
|
913
913
|
const a = s.target;
|
|
914
914
|
let l = a.name, m = !0;
|
|
915
|
-
const y =
|
|
916
|
-
m = Number.isNaN(D) || be(D) && isNaN(D.getTime()) || ae(D,
|
|
917
|
-
},
|
|
915
|
+
const y = v(n, l), d = (D) => {
|
|
916
|
+
m = Number.isNaN(D) || be(D) && isNaN(D.getTime()) || ae(D, v(i, l, D));
|
|
917
|
+
}, h = mt(r.mode), T = mt(r.reValidateMode);
|
|
918
918
|
if (y) {
|
|
919
919
|
let D, re;
|
|
920
|
-
const Oe = a.type ? yt(y._f) : Jt(s),
|
|
921
|
-
P(i, l, Oe),
|
|
922
|
-
const Be = ee(l, Oe,
|
|
923
|
-
if (!
|
|
920
|
+
const Oe = a.type ? yt(y._f) : Jt(s), ve = s.type === lt.BLUR || s.type === lt.FOCUS_OUT, Ut = !or(y._f) && !r.resolver && !v(t.errors, l) && !y._f.deps || cr(ve, v(t.touchedFields, l), t.isSubmitted, T, h), Me = ht(l, f, ve);
|
|
921
|
+
P(i, l, Oe), ve ? (!a || !a.readOnly) && (y._f.onBlur && y._f.onBlur(s), F && F(0)) : y._f.onChange && y._f.onChange(s);
|
|
922
|
+
const Be = ee(l, Oe, ve), Mt = !Z(Be) || Me;
|
|
923
|
+
if (!ve && b.state.next({
|
|
924
924
|
name: l,
|
|
925
925
|
type: s.type,
|
|
926
926
|
values: H(i)
|
|
927
927
|
}), Ut)
|
|
928
|
-
return (x.isValid ||
|
|
929
|
-
if (!
|
|
928
|
+
return (x.isValid || A.isValid) && (r.mode === "onBlur" ? ve && $() : ve || $()), Mt && b.state.next({ name: l, ...Me ? {} : Be });
|
|
929
|
+
if (!ve && Me && b.state.next({ ...t }), r.resolver) {
|
|
930
930
|
const { errors: st } = await se([l]);
|
|
931
931
|
if (W([l]), d(Oe), m) {
|
|
932
932
|
const Bt = bt(t.errors, n, l), nt = bt(st, n, Bt.name || l);
|
|
933
933
|
D = nt.error, l = nt.name, re = Z(st);
|
|
934
934
|
}
|
|
935
935
|
} else
|
|
936
|
-
W([l], !0), D = (await _t(y, f.disabled, i, B, r.shouldUseNativeValidation))[l], W([l]), d(Oe), m && (D ? re = !1 : (x.isValid ||
|
|
936
|
+
W([l], !0), D = (await _t(y, f.disabled, i, B, r.shouldUseNativeValidation))[l], W([l]), d(Oe), m && (D ? re = !1 : (x.isValid || A.isValid) && (re = await J(n, !0)));
|
|
937
937
|
m && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) && me(y._f.deps), ce(l, re, D, Be));
|
|
938
938
|
}
|
|
939
939
|
}, ye = (s, a) => {
|
|
940
|
-
if (
|
|
940
|
+
if (v(t.errors, a) && s.focus)
|
|
941
941
|
return s.focus(), 1;
|
|
942
942
|
}, me = async (s, a = {}) => {
|
|
943
943
|
let l, m;
|
|
944
944
|
const y = ke(s);
|
|
945
945
|
if (r.resolver) {
|
|
946
946
|
const d = await N(M(s) ? s : y);
|
|
947
|
-
l = Z(d), m = s ? !y.some((
|
|
947
|
+
l = Z(d), m = s ? !y.some((h) => v(d, h)) : l;
|
|
948
948
|
} else s ? (m = (await Promise.all(y.map(async (d) => {
|
|
949
|
-
const
|
|
950
|
-
return await J(
|
|
949
|
+
const h = v(n, d);
|
|
950
|
+
return await J(h && h._f ? { [d]: h } : h);
|
|
951
951
|
}))).every(Boolean), !(!m && !t.isValid) && $()) : m = l = await J(n);
|
|
952
952
|
return b.state.next({
|
|
953
|
-
...!te(s) || (x.isValid ||
|
|
953
|
+
...!te(s) || (x.isValid || A.isValid) && l !== t.isValid ? {} : { name: s },
|
|
954
954
|
...r.resolver || !s ? { isValid: l } : {},
|
|
955
955
|
errors: t.errors
|
|
956
|
-
}), a.shouldFocus && !m &&
|
|
956
|
+
}), a.shouldFocus && !m && Te(n, ye, 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 = At(a.dirtyFields ? t.dirtyFields : t.touchedFields, l)), M(s) ? l : te(s) ? v(l, s) : s.map((m) => v(l, m));
|
|
962
962
|
}, g = (s, a) => ({
|
|
963
|
-
invalid: !!
|
|
964
|
-
isDirty: !!
|
|
965
|
-
error:
|
|
966
|
-
isValidating: !!
|
|
967
|
-
isTouched: !!
|
|
963
|
+
invalid: !!v((a || t).errors, s),
|
|
964
|
+
isDirty: !!v((a || t).dirtyFields, s),
|
|
965
|
+
error: v((a || t).errors, s),
|
|
966
|
+
isValidating: !!v(t.validatingFields, s),
|
|
967
|
+
isTouched: !!v((a || t).touchedFields, s)
|
|
968
968
|
}), j = (s) => {
|
|
969
969
|
s && ke(s).forEach((a) => q(t.errors, a)), b.state.next({
|
|
970
970
|
errors: s ? t.errors : {}
|
|
971
971
|
});
|
|
972
|
-
},
|
|
973
|
-
const m = (
|
|
972
|
+
}, L = (s, a, l) => {
|
|
973
|
+
const m = (v(n, s, { _f: {} })._f || {}).ref, y = v(t.errors, s) || {}, { ref: d, message: h, type: T, ...D } = y;
|
|
974
974
|
P(t.errors, s, {
|
|
975
975
|
...D,
|
|
976
976
|
...a,
|
|
@@ -981,23 +981,23 @@ 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
|
-
ur(s.name, a.name, s.exact) && lr(a, s.formState || x,
|
|
987
|
+
ur(s.name, a.name, s.exact) && lr(a, s.formState || x, It, s.reRenderRoot) && s.callback({
|
|
988
988
|
values: { ...i },
|
|
989
989
|
...t,
|
|
990
990
|
...a,
|
|
991
991
|
defaultValues: o
|
|
992
992
|
});
|
|
993
993
|
}
|
|
994
|
-
}).unsubscribe, U = (s) => (u.mount = !0,
|
|
995
|
-
...
|
|
994
|
+
}).unsubscribe, U = (s) => (u.mount = !0, A = {
|
|
995
|
+
...A,
|
|
996
996
|
...s.formState
|
|
997
997
|
}, xe({
|
|
998
998
|
...s,
|
|
999
999
|
formState: {
|
|
1000
|
-
...
|
|
1000
|
+
...S,
|
|
1001
1001
|
...s.formState
|
|
1002
1002
|
}
|
|
1003
1003
|
})), oe = (s, a = {}) => {
|
|
@@ -1011,8 +1011,8 @@ function mr(e = {}) {
|
|
|
1011
1011
|
}), !a.keepIsValid && $();
|
|
1012
1012
|
}, Ee = ({ disabled: s, name: a }) => {
|
|
1013
1013
|
(le(s) && u.mount || s || f.disabled.has(a)) && (s ? f.disabled.add(a) : f.disabled.delete(a));
|
|
1014
|
-
},
|
|
1015
|
-
let l =
|
|
1014
|
+
}, pe = (s, a = {}) => {
|
|
1015
|
+
let l = v(n, s);
|
|
1016
1016
|
const m = le(a.disabled) || le(r.disabled);
|
|
1017
1017
|
return P(n, s, {
|
|
1018
1018
|
...l || {},
|
|
@@ -1040,30 +1040,30 @@ function mr(e = {}) {
|
|
|
1040
1040
|
onBlur: de,
|
|
1041
1041
|
ref: (y) => {
|
|
1042
1042
|
if (y) {
|
|
1043
|
-
|
|
1044
|
-
const d = M(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y,
|
|
1045
|
-
if (
|
|
1043
|
+
pe(s, a), l = v(n, s);
|
|
1044
|
+
const d = M(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, h = tr(d), T = l._f.refs || [];
|
|
1045
|
+
if (h ? T.find((D) => D === d) : d === l._f.ref)
|
|
1046
1046
|
return;
|
|
1047
1047
|
P(n, s, {
|
|
1048
1048
|
_f: {
|
|
1049
1049
|
...l._f,
|
|
1050
|
-
...
|
|
1050
|
+
...h ? {
|
|
1051
1051
|
refs: [
|
|
1052
|
-
...
|
|
1052
|
+
...T.filter($e),
|
|
1053
1053
|
d,
|
|
1054
|
-
...Array.isArray(
|
|
1054
|
+
...Array.isArray(v(o, s)) ? [{}] : []
|
|
1055
1055
|
],
|
|
1056
1056
|
ref: { type: d.type, name: s }
|
|
1057
1057
|
} : { ref: d }
|
|
1058
1058
|
}
|
|
1059
1059
|
}), k(s, !1, void 0, d);
|
|
1060
1060
|
} else
|
|
1061
|
-
l =
|
|
1061
|
+
l = v(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 &&
|
|
1065
|
-
le(s) && (b.state.next({ disabled: s }),
|
|
1066
|
-
const m =
|
|
1064
|
+
}, Ue = () => r.shouldFocusError && Te(n, ye, f.mount), Pt = (s) => {
|
|
1065
|
+
le(s) && (b.state.next({ disabled: s }), Te(n, (a, l) => {
|
|
1066
|
+
const m = v(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;
|
|
1069
1069
|
}));
|
|
@@ -1075,8 +1075,8 @@ function mr(e = {}) {
|
|
|
1075
1075
|
if (b.state.next({
|
|
1076
1076
|
isSubmitting: !0
|
|
1077
1077
|
}), r.resolver) {
|
|
1078
|
-
const { errors: d, values:
|
|
1079
|
-
W(), t.errors = d, y = H(
|
|
1078
|
+
const { errors: d, values: h } = await se();
|
|
1079
|
+
W(), t.errors = d, y = H(h);
|
|
1080
1080
|
} else
|
|
1081
1081
|
await J(n);
|
|
1082
1082
|
if (f.disabled.size)
|
|
@@ -1102,23 +1102,23 @@ function mr(e = {}) {
|
|
|
1102
1102
|
}), m)
|
|
1103
1103
|
throw m;
|
|
1104
1104
|
}, Nt = (s, a = {}) => {
|
|
1105
|
-
|
|
1105
|
+
v(n, s) && (M(a.defaultValue) ? X(s, H(v(o, s))) : (X(s, a.defaultValue), P(o, s, H(a.defaultValue))), a.keepTouched || q(t.touchedFields, s), a.keepDirty || (q(t.dirtyFields, s), t.isDirty = a.defaultValue ? _(s, H(v(o, s))) : _()), a.keepError || (q(t.errors, s), x.isValid && $()), b.state.next({ ...t }));
|
|
1106
1106
|
}, et = (s, a = {}) => {
|
|
1107
1107
|
const l = s ? H(s) : o, m = H(l), y = Z(s), d = y ? o : m;
|
|
1108
1108
|
if (a.keepDefaultValues || (o = l), !a.keepValues) {
|
|
1109
1109
|
if (a.keepDirtyValues) {
|
|
1110
|
-
const
|
|
1110
|
+
const h = /* @__PURE__ */ new Set([
|
|
1111
1111
|
...f.mount,
|
|
1112
1112
|
...Object.keys(Fe(o, i))
|
|
1113
1113
|
]);
|
|
1114
|
-
for (const
|
|
1115
|
-
|
|
1114
|
+
for (const T of Array.from(h))
|
|
1115
|
+
v(t.dirtyFields, T) ? P(d, T, v(i, T)) : X(T, v(d, T));
|
|
1116
1116
|
} else {
|
|
1117
1117
|
if (ze && M(s))
|
|
1118
|
-
for (const
|
|
1119
|
-
const
|
|
1120
|
-
if (
|
|
1121
|
-
const D = Array.isArray(
|
|
1118
|
+
for (const h of f.mount) {
|
|
1119
|
+
const T = v(n, h);
|
|
1120
|
+
if (T && T._f) {
|
|
1121
|
+
const D = Array.isArray(T._f.refs) ? T._f.refs[0] : T._f.ref;
|
|
1122
1122
|
if (je(D)) {
|
|
1123
1123
|
const re = D.closest("form");
|
|
1124
1124
|
if (re) {
|
|
@@ -1129,8 +1129,8 @@ function mr(e = {}) {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
1131
|
if (a.keepFieldsRef)
|
|
1132
|
-
for (const
|
|
1133
|
-
X(
|
|
1132
|
+
for (const h of f.mount)
|
|
1133
|
+
X(h, v(d, h));
|
|
1134
1134
|
else
|
|
1135
1135
|
n = {};
|
|
1136
1136
|
}
|
|
@@ -1159,37 +1159,37 @@ function mr(e = {}) {
|
|
|
1159
1159
|
isSubmitting: !1,
|
|
1160
1160
|
defaultValues: o
|
|
1161
1161
|
});
|
|
1162
|
-
}, tt = (s, a) => et(ne(s) ? s(i) : s, { ...r.resetOptions, ...a }),
|
|
1163
|
-
const l =
|
|
1162
|
+
}, tt = (s, a) => et(ne(s) ? s(i) : s, { ...r.resetOptions, ...a }), Lt = (s, a = {}) => {
|
|
1163
|
+
const l = v(n, s), m = l && l._f;
|
|
1164
1164
|
if (m) {
|
|
1165
1165
|
const y = m.refs ? m.refs[0] : m.ref;
|
|
1166
1166
|
y.focus && setTimeout(() => {
|
|
1167
1167
|
y.focus(), a.shouldSelect && ne(y.select) && y.select();
|
|
1168
1168
|
});
|
|
1169
1169
|
}
|
|
1170
|
-
},
|
|
1170
|
+
}, It = (s) => {
|
|
1171
1171
|
t = {
|
|
1172
1172
|
...t,
|
|
1173
1173
|
...s
|
|
1174
1174
|
};
|
|
1175
1175
|
}, rt = {
|
|
1176
1176
|
control: {
|
|
1177
|
-
register:
|
|
1177
|
+
register: pe,
|
|
1178
1178
|
unregister: oe,
|
|
1179
1179
|
getFieldState: g,
|
|
1180
1180
|
handleSubmit: Ke,
|
|
1181
|
-
setError:
|
|
1181
|
+
setError: L,
|
|
1182
1182
|
_subscribe: xe,
|
|
1183
1183
|
_runSchema: se,
|
|
1184
1184
|
_updateIsValidating: W,
|
|
1185
1185
|
_focusError: Ue,
|
|
1186
|
-
_getWatch:
|
|
1186
|
+
_getWatch: w,
|
|
1187
1187
|
_getDirty: _,
|
|
1188
1188
|
_setValid: $,
|
|
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({
|
|
@@ -1236,7 +1236,7 @@ function mr(e = {}) {
|
|
|
1236
1236
|
},
|
|
1237
1237
|
subscribe: U,
|
|
1238
1238
|
trigger: me,
|
|
1239
|
-
register:
|
|
1239
|
+
register: pe,
|
|
1240
1240
|
handleSubmit: Ke,
|
|
1241
1241
|
watch: _e,
|
|
1242
1242
|
setValue: X,
|
|
@@ -1245,8 +1245,8 @@ function mr(e = {}) {
|
|
|
1245
1245
|
resetField: Nt,
|
|
1246
1246
|
clearErrors: j,
|
|
1247
1247
|
unregister: oe,
|
|
1248
|
-
setError:
|
|
1249
|
-
setFocus:
|
|
1248
|
+
setError: L,
|
|
1249
|
+
setFocus: Lt,
|
|
1250
1250
|
getFieldState: g
|
|
1251
1251
|
};
|
|
1252
1252
|
return {
|
|
@@ -1254,7 +1254,7 @@ function mr(e = {}) {
|
|
|
1254
1254
|
formControl: rt
|
|
1255
1255
|
};
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1257
|
+
function vr(e = {}) {
|
|
1258
1258
|
const r = R.useRef(void 0), t = R.useRef(void 0), [n, o] = R.useState({
|
|
1259
1259
|
isDirty: !1,
|
|
1260
1260
|
isValidating: !1,
|
|
@@ -1321,13 +1321,13 @@ function hr(e = {}) {
|
|
|
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
|
}
|
|
1324
|
-
const Ot = $t(null),
|
|
1324
|
+
const Ot = $t(null), hr = ({
|
|
1325
1325
|
children: e,
|
|
1326
1326
|
layout: r = "vertical",
|
|
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,
|
|
@@ -1360,31 +1360,16 @@ function _r(e, r) {
|
|
|
1360
1360
|
const i = n.split(".");
|
|
1361
1361
|
let u = t;
|
|
1362
1362
|
i.forEach((f, F) => {
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1363
|
+
const p = F === i.length - 1, S = !isNaN(Number(f));
|
|
1364
|
+
p ? u[f] = r[o] : (f in u || (u[f] = S ? [] : {}), u = u[f]);
|
|
1365
1365
|
});
|
|
1366
1366
|
}), t;
|
|
1367
1367
|
}
|
|
1368
1368
|
function xr(e) {
|
|
1369
1369
|
switch (e) {
|
|
1370
|
-
case "text":
|
|
1371
|
-
return "";
|
|
1372
|
-
case "number":
|
|
1373
|
-
return 0;
|
|
1374
1370
|
case "array":
|
|
1375
1371
|
return [];
|
|
1376
|
-
case "checkbox":
|
|
1377
|
-
return !1;
|
|
1378
1372
|
case "object":
|
|
1379
|
-
return {};
|
|
1380
|
-
case "select":
|
|
1381
|
-
return null;
|
|
1382
|
-
case "date":
|
|
1383
|
-
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
1384
|
-
case "datetime-local":
|
|
1385
|
-
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 16);
|
|
1386
|
-
case "time":
|
|
1387
|
-
return (/* @__PURE__ */ new Date()).toISOString().slice(11, 16);
|
|
1388
1373
|
default:
|
|
1389
1374
|
return null;
|
|
1390
1375
|
}
|
|
@@ -1442,37 +1427,37 @@ const Vr = R.memo((e) => {
|
|
|
1442
1427
|
"row ",
|
|
1443
1428
|
t
|
|
1444
1429
|
] }),
|
|
1445
|
-
/* @__PURE__ */ V.jsx(
|
|
1430
|
+
/* @__PURE__ */ V.jsx(Le, { schema: o })
|
|
1446
1431
|
] });
|
|
1447
1432
|
}), Fr = (e) => {
|
|
1448
|
-
const { fieldSchema: r } = e, { control: t, getValues: n, setValue: o } = ge(), u =
|
|
1433
|
+
const { fieldSchema: r } = e, { control: t, getValues: n, setValue: o } = ge(), u = pt({
|
|
1449
1434
|
control: t,
|
|
1450
1435
|
name: r.name
|
|
1451
1436
|
}) ?? [], f = () => {
|
|
1452
|
-
const
|
|
1453
|
-
o(r.name, [...
|
|
1454
|
-
}, F = (
|
|
1455
|
-
const x = (n(r.name) || []).filter((
|
|
1437
|
+
const p = n(r.name) || [];
|
|
1438
|
+
o(r.name, [...p, Ne(r.fields)]);
|
|
1439
|
+
}, F = (p) => {
|
|
1440
|
+
const x = (n(r.name) || []).filter((A, b) => b !== p);
|
|
1456
1441
|
o(r.name, x);
|
|
1457
1442
|
};
|
|
1458
1443
|
return /* @__PURE__ */ V.jsxs("div", { children: [
|
|
1459
|
-
u.map((
|
|
1460
|
-
/* @__PURE__ */ V.jsx(Vr, { baseName: r.name, index:
|
|
1461
|
-
!r.readonly && /* @__PURE__ */ V.jsx("button", { type: "button", onClick: () => F(
|
|
1462
|
-
] },
|
|
1444
|
+
u.map((p, S) => /* @__PURE__ */ V.jsxs("div", { children: [
|
|
1445
|
+
/* @__PURE__ */ V.jsx(Vr, { baseName: r.name, index: S, fields: r.fields }),
|
|
1446
|
+
!r.readonly && /* @__PURE__ */ V.jsx("button", { type: "button", onClick: () => F(S), children: "Remove" })
|
|
1447
|
+
] }, S)),
|
|
1463
1448
|
!r.readonly && /* @__PURE__ */ V.jsx("button", { type: "button", onClick: f, children: "Add Row" })
|
|
1464
1449
|
] });
|
|
1465
|
-
},
|
|
1450
|
+
}, pr = R.memo(Fr), Ar = (e) => {
|
|
1466
1451
|
const { fieldSchema: r } = e;
|
|
1467
|
-
let t =
|
|
1452
|
+
let t = he(
|
|
1468
1453
|
() => r.fields.map((n) => ({
|
|
1469
1454
|
...n,
|
|
1470
1455
|
name: `${r.name}.${n.name}`
|
|
1471
1456
|
})),
|
|
1472
1457
|
[r.fields]
|
|
1473
1458
|
);
|
|
1474
|
-
return /* @__PURE__ */ V.jsx(
|
|
1475
|
-
},
|
|
1459
|
+
return /* @__PURE__ */ V.jsx(Le, { schema: t });
|
|
1460
|
+
}, wr = [
|
|
1476
1461
|
"text",
|
|
1477
1462
|
"number",
|
|
1478
1463
|
"checkbox",
|
|
@@ -1483,25 +1468,25 @@ const Vr = R.memo((e) => {
|
|
|
1483
1468
|
"array",
|
|
1484
1469
|
"object"
|
|
1485
1470
|
], jt = ({ fieldSchema: e }) => {
|
|
1486
|
-
var
|
|
1487
|
-
const t = Dt().uiConfig, { register: n, control: o } = ge(), i = Qe(e.name), u = n(e.name), f = (
|
|
1471
|
+
var p, S;
|
|
1472
|
+
const t = Dt().uiConfig, { register: n, control: o } = ge(), i = Qe(e.name), u = n(e.name), f = (p = t == null ? void 0 : t.renderersByName) == null ? void 0 : p[i];
|
|
1488
1473
|
if (e.visible === !1)
|
|
1489
1474
|
return null;
|
|
1490
1475
|
if (f)
|
|
1491
1476
|
return /* @__PURE__ */ V.jsx(f, { fieldSchema: e, control: o, register: u });
|
|
1492
|
-
const F = (
|
|
1477
|
+
const F = (S = t == null ? void 0 : t.renderersByType) == null ? void 0 : S[e.type];
|
|
1493
1478
|
if (F)
|
|
1494
1479
|
return /* @__PURE__ */ V.jsx(F, { fieldSchema: e, control: o, register: u });
|
|
1495
|
-
if (
|
|
1496
|
-
return e.type === "select" ? /* @__PURE__ */ V.jsx(gr, { fieldSchema: e }) : e.type === "array" ? /* @__PURE__ */ V.jsx(
|
|
1480
|
+
if (wr.includes(e.type))
|
|
1481
|
+
return e.type === "select" ? /* @__PURE__ */ V.jsx(gr, { fieldSchema: e }) : e.type === "array" ? /* @__PURE__ */ V.jsx(pr, { fieldSchema: e }) : e.type === "object" ? /* @__PURE__ */ V.jsx(Ar, { fieldSchema: e }) : /* @__PURE__ */ V.jsx(br, { fieldSchema: e });
|
|
1497
1482
|
throw new Error(
|
|
1498
1483
|
`AutoForm: No renderer found for field "${e.name}" with type "${e.type}". If this is a custom field type, make sure to register a renderer via uiConfig.renderersByType.`
|
|
1499
1484
|
);
|
|
1500
1485
|
}, Rr = ({ fieldSchema: e }) => /* @__PURE__ */ V.jsx(jt, { fieldSchema: e }), kr = ({ fieldSchema: e }) => {
|
|
1501
|
-
const { control: r } = ge(), t = Dt(), n = e.dependsOn ?? [], o =
|
|
1486
|
+
const { control: r } = ge(), t = Dt(), n = e.dependsOn ?? [], o = he(
|
|
1502
1487
|
() => Er(e.name, n),
|
|
1503
1488
|
[e.name, n]
|
|
1504
|
-
), i =
|
|
1489
|
+
), i = pt({
|
|
1505
1490
|
control: r,
|
|
1506
1491
|
name: o
|
|
1507
1492
|
}), [u, f] = xt(e);
|
|
@@ -1510,9 +1495,9 @@ const Vr = R.memo((e) => {
|
|
|
1510
1495
|
let F = !1;
|
|
1511
1496
|
return (async () => {
|
|
1512
1497
|
var B;
|
|
1513
|
-
const
|
|
1514
|
-
if (!
|
|
1515
|
-
const b = await
|
|
1498
|
+
const S = Qe(e.name), x = _r(o, i ?? []), A = (B = t == null ? void 0 : t.updateFieldSchema) == null ? void 0 : B[S];
|
|
1499
|
+
if (!A) return;
|
|
1500
|
+
const b = await A(e.name, e, x);
|
|
1516
1501
|
!F && b && f({
|
|
1517
1502
|
...e,
|
|
1518
1503
|
...b
|
|
@@ -1521,17 +1506,17 @@ const Vr = R.memo((e) => {
|
|
|
1521
1506
|
F = !0;
|
|
1522
1507
|
};
|
|
1523
1508
|
}, [i]), /* @__PURE__ */ V.jsx(jt, { fieldSchema: u });
|
|
1524
|
-
},
|
|
1509
|
+
}, Tr = (e) => {
|
|
1525
1510
|
var t;
|
|
1526
1511
|
const { fieldSchema: r } = e;
|
|
1527
1512
|
return (t = r.dependsOn) != null && t.length ? /* @__PURE__ */ V.jsx(kr, { fieldSchema: r }) : /* @__PURE__ */ V.jsx(Rr, { fieldSchema: r });
|
|
1528
|
-
},
|
|
1513
|
+
}, Sr = (e) => {
|
|
1529
1514
|
const { fieldSchema: r } = e;
|
|
1530
|
-
return /* @__PURE__ */ V.jsx(
|
|
1531
|
-
},
|
|
1515
|
+
return /* @__PURE__ */ V.jsx(Tr, { fieldSchema: r });
|
|
1516
|
+
}, Le = R.memo(
|
|
1532
1517
|
(e) => {
|
|
1533
1518
|
const { schema: r } = e;
|
|
1534
|
-
return r.map((t) => /* @__PURE__ */ V.jsx(
|
|
1519
|
+
return r.map((t) => /* @__PURE__ */ V.jsx(Sr, { fieldSchema: t }, t.name));
|
|
1535
1520
|
}
|
|
1536
1521
|
);
|
|
1537
1522
|
function Or(e, r) {
|
|
@@ -1547,11 +1532,11 @@ function Or(e, r) {
|
|
|
1547
1532
|
const Dr = (e) => {
|
|
1548
1533
|
const { onDirtyChange: r, onValuesChange: t, onFieldChange: n } = e, { formState: o, watch: i } = ge(), u = Et(!0);
|
|
1549
1534
|
return Ce(() => {
|
|
1550
|
-
const f = i((F, { name:
|
|
1551
|
-
var
|
|
1535
|
+
const f = i((F, { name: p = "" }) => {
|
|
1536
|
+
var A;
|
|
1552
1537
|
t(F);
|
|
1553
|
-
const
|
|
1554
|
-
(
|
|
1538
|
+
const S = Qe(p), x = Or(p, F);
|
|
1539
|
+
(A = n == null ? void 0 : n[S]) == null || A.call(n, p, x, F);
|
|
1555
1540
|
});
|
|
1556
1541
|
return () => f.unsubscribe();
|
|
1557
1542
|
}, [i, t]), Ce(() => {
|
|
@@ -1582,33 +1567,34 @@ const Dr = (e) => {
|
|
|
1582
1567
|
layout: u = "vertical",
|
|
1583
1568
|
values: f = () => ({}),
|
|
1584
1569
|
hideSubmit: F = !1,
|
|
1585
|
-
onDirtyChange:
|
|
1570
|
+
onDirtyChange: p = () => {
|
|
1586
1571
|
},
|
|
1587
|
-
onValuesChange:
|
|
1572
|
+
onValuesChange: S = () => {
|
|
1588
1573
|
},
|
|
1589
1574
|
resolver: x,
|
|
1590
|
-
readonly:
|
|
1575
|
+
readonly: A,
|
|
1591
1576
|
onFieldChange: b = {},
|
|
1592
1577
|
loadingComponent: B
|
|
1593
|
-
} = e, O =
|
|
1578
|
+
} = e, O = vr({
|
|
1594
1579
|
reValidateMode: "onSubmit",
|
|
1595
1580
|
criteriaMode: "all",
|
|
1596
1581
|
resolver: x
|
|
1597
|
-
}), $ = Et(!1), [W, E] = xt(!1), G = O.handleSubmit(n), C =
|
|
1582
|
+
}), $ = Et(!1), [W, E] = xt(!1), G = O.handleSubmit(n), C = he(() => {
|
|
1598
1583
|
let N = t;
|
|
1599
|
-
return
|
|
1600
|
-
}, [
|
|
1584
|
+
return A && (N = Ct(N)), N;
|
|
1585
|
+
}, [A, t]);
|
|
1601
1586
|
Ce(() => {
|
|
1602
|
-
if (
|
|
1587
|
+
if (!f) return;
|
|
1603
1588
|
let N = !1;
|
|
1604
1589
|
return (async () => {
|
|
1590
|
+
if ($.current) return;
|
|
1605
1591
|
E(!1);
|
|
1606
1592
|
const fe = await f();
|
|
1607
1593
|
N || (O.reset(Ne(t, fe)), $.current = !0, E(!0));
|
|
1608
1594
|
})(), () => {
|
|
1609
1595
|
N = !0;
|
|
1610
1596
|
};
|
|
1611
|
-
}, [t]), Yt(r, () => ({
|
|
1597
|
+
}, [t, f]), Yt(r, () => ({
|
|
1612
1598
|
submit: async () => {
|
|
1613
1599
|
await O.handleSubmit(n)();
|
|
1614
1600
|
},
|
|
@@ -1620,7 +1606,7 @@ const Dr = (e) => {
|
|
|
1620
1606
|
O.setValue(N, J);
|
|
1621
1607
|
}
|
|
1622
1608
|
}));
|
|
1623
|
-
const k = F ||
|
|
1609
|
+
const k = F || A, ee = he(() => o, [o]), ce = he(() => i, [i]), se = he(
|
|
1624
1610
|
() => ({
|
|
1625
1611
|
layout: u,
|
|
1626
1612
|
uiConfig: o,
|
|
@@ -1632,13 +1618,13 @@ const Dr = (e) => {
|
|
|
1632
1618
|
/* @__PURE__ */ V.jsx(
|
|
1633
1619
|
Cr,
|
|
1634
1620
|
{
|
|
1635
|
-
onDirtyChange:
|
|
1636
|
-
onValuesChange:
|
|
1621
|
+
onDirtyChange: p,
|
|
1622
|
+
onValuesChange: S,
|
|
1637
1623
|
onFieldChange: b
|
|
1638
1624
|
}
|
|
1639
1625
|
),
|
|
1640
1626
|
/* @__PURE__ */ V.jsxs(
|
|
1641
|
-
|
|
1627
|
+
hr,
|
|
1642
1628
|
{
|
|
1643
1629
|
layout: se.layout,
|
|
1644
1630
|
uiConfig: ee,
|
|
@@ -1651,10 +1637,10 @@ const Dr = (e) => {
|
|
|
1651
1637
|
display: "flex",
|
|
1652
1638
|
flexDirection: u === "vertical" ? "column" : "row"
|
|
1653
1639
|
},
|
|
1654
|
-
children: /* @__PURE__ */ V.jsx(
|
|
1640
|
+
children: /* @__PURE__ */ V.jsx(Le, { schema: C })
|
|
1655
1641
|
}
|
|
1656
1642
|
),
|
|
1657
|
-
u === "custom" && /* @__PURE__ */ V.jsx(
|
|
1643
|
+
u === "custom" && /* @__PURE__ */ V.jsx(Le, { schema: C }),
|
|
1658
1644
|
!k && /* @__PURE__ */ V.jsx("button", { style: { marginTop: "1rem" }, onClick: G, children: "Submit" })
|
|
1659
1645
|
]
|
|
1660
1646
|
}
|
|
@@ -1675,7 +1661,7 @@ const Dr = (e) => {
|
|
|
1675
1661
|
);
|
|
1676
1662
|
export {
|
|
1677
1663
|
Nr as AutoForm,
|
|
1678
|
-
|
|
1664
|
+
Le as SchemaRenderer,
|
|
1679
1665
|
_r as buildNestedPartialValues,
|
|
1680
1666
|
Ne as generateInitialValues,
|
|
1681
1667
|
xr as getDefaultValueForField,
|