suprform 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/suprform.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import _, { useCallback as Ye, cloneElement as
|
|
3
|
-
var
|
|
1
|
+
import { jsx as he, jsxs as Et, Fragment as St } from "react/jsx-runtime";
|
|
2
|
+
import _, { useCallback as Ye, cloneElement as Ct } from "react";
|
|
3
|
+
var ge = (e) => e.type === "checkbox", ae = (e) => e instanceof Date, j = (e) => e == null;
|
|
4
4
|
const ut = (e) => typeof e == "object";
|
|
5
|
-
var M = (e) =>
|
|
5
|
+
var M = (e) => !j(e) && !Array.isArray(e) && ut(e) && !ae(e), lt = (e) => M(e) && e.target ? ge(e.target) ? e.target.checked : e.target.value : e, Rt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ot = (e, s) => e.has(Rt(s)), Ot = (e) => {
|
|
6
6
|
const s = e.constructor && e.constructor.prototype;
|
|
7
7
|
return M(s) && s.hasOwnProperty("isPrototypeOf");
|
|
8
8
|
}, Te = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -12,7 +12,7 @@ function U(e) {
|
|
|
12
12
|
if (e instanceof Date)
|
|
13
13
|
s = new Date(e);
|
|
14
14
|
else if (!(Te && (e instanceof Blob || i)) && (t || M(e)))
|
|
15
|
-
if (s = t ? [] : Object.create(Object.getPrototypeOf(e)), !t && !
|
|
15
|
+
if (s = t ? [] : Object.create(Object.getPrototypeOf(e)), !t && !Ot(e))
|
|
16
16
|
s = e;
|
|
17
17
|
else
|
|
18
18
|
for (const u in e)
|
|
@@ -24,7 +24,7 @@ function U(e) {
|
|
|
24
24
|
var Fe = (e) => /^\w*$/.test(e), O = (e) => e === void 0, Le = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Me = (e) => Le(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, s, t) => {
|
|
25
25
|
if (!s || !M(e))
|
|
26
26
|
return t;
|
|
27
|
-
const i = (Fe(s) ? [s] : Me(s)).reduce((u, n) =>
|
|
27
|
+
const i = (Fe(s) ? [s] : Me(s)).reduce((u, n) => j(u) ? u : u[n], e);
|
|
28
28
|
return O(i) || i === e ? O(e[s]) ? t : e[s] : i;
|
|
29
29
|
}, z = (e) => typeof e == "boolean", C = (e, s, t) => {
|
|
30
30
|
let i = -1;
|
|
@@ -41,7 +41,7 @@ var Fe = (e) => /^\w*$/.test(e), O = (e) => e === void 0, Le = (e) => Array.isAr
|
|
|
41
41
|
e[c] = w, e = e[c];
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
const
|
|
44
|
+
const me = {
|
|
45
45
|
BLUR: "blur",
|
|
46
46
|
FOCUS_OUT: "focusout",
|
|
47
47
|
CHANGE: "change"
|
|
@@ -61,7 +61,7 @@ const be = {
|
|
|
61
61
|
validate: "validate"
|
|
62
62
|
}, Ue = _.createContext(null);
|
|
63
63
|
Ue.displayName = "HookFormContext";
|
|
64
|
-
const Ae = () => _.useContext(Ue),
|
|
64
|
+
const Ae = () => _.useContext(Ue), Tt = (e) => {
|
|
65
65
|
const { children: s, ...t } = e;
|
|
66
66
|
return _.createElement(Ue.Provider, { value: t }, s);
|
|
67
67
|
};
|
|
@@ -79,7 +79,7 @@ var dt = (e, s, t, i = !0) => {
|
|
|
79
79
|
return u;
|
|
80
80
|
};
|
|
81
81
|
const pe = typeof window < "u" ? _.useLayoutEffect : _.useEffect;
|
|
82
|
-
function
|
|
82
|
+
function Lt(e) {
|
|
83
83
|
const s = Ae(), { control: t = s.control, disabled: i, name: u, exact: n } = e || {}, [d, c] = _.useState(t._formState), w = _.useRef({
|
|
84
84
|
isDirty: !1,
|
|
85
85
|
isLoading: !1,
|
|
@@ -104,7 +104,7 @@ function Ot(e) {
|
|
|
104
104
|
w.current.isValid && t._setValid(!0);
|
|
105
105
|
}, [t]), _.useMemo(() => dt(d, t, w.current, !1), [d, t]);
|
|
106
106
|
}
|
|
107
|
-
var G = (e) => typeof e == "string", Ce = (e, s, t, i, u) => G(e) ? (i && s.watch.add(e), y(t, e, u)) : Array.isArray(e) ? e.map((n) => (i && s.watch.add(n), y(t, n))) : (i && (s.watchAll = !0), t), Re = (e) =>
|
|
107
|
+
var G = (e) => typeof e == "string", Ce = (e, s, t, i, u) => G(e) ? (i && s.watch.add(e), y(t, e, u)) : Array.isArray(e) ? e.map((n) => (i && s.watch.add(n), y(t, n))) : (i && (s.watchAll = !0), t), Re = (e) => j(e) || !ut(e);
|
|
108
108
|
function Q(e, s, t = /* @__PURE__ */ new WeakSet()) {
|
|
109
109
|
if (Re(e) || Re(s))
|
|
110
110
|
return Object.is(e, s);
|
|
@@ -128,8 +128,8 @@ function Q(e, s, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
128
128
|
}
|
|
129
129
|
return !0;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const s = Ae(), { control: t = s.control, name: i, defaultValue: u, disabled: n, exact: d, compute: c } = e || {}, w = _.useRef(u), E = _.useRef(c), V = _.useRef(void 0),
|
|
131
|
+
function Mt(e) {
|
|
132
|
+
const s = Ae(), { control: t = s.control, name: i, defaultValue: u, disabled: n, exact: d, compute: c } = e || {}, w = _.useRef(u), E = _.useRef(c), V = _.useRef(void 0), m = _.useRef(t), v = _.useRef(i);
|
|
133
133
|
E.current = c;
|
|
134
134
|
const [p, q] = _.useState(() => {
|
|
135
135
|
const F = t._getWatch(i, w.current);
|
|
@@ -141,13 +141,13 @@ function Tt(e) {
|
|
|
141
141
|
if (!n) {
|
|
142
142
|
const A = Ce(i, t._names, F || t._formValues, !1, w.current);
|
|
143
143
|
if (E.current) {
|
|
144
|
-
const
|
|
145
|
-
Q(
|
|
144
|
+
const $ = E.current(A);
|
|
145
|
+
Q($, V.current) || (q($), V.current = $);
|
|
146
146
|
} else
|
|
147
147
|
q(A);
|
|
148
148
|
}
|
|
149
149
|
}, [t._formValues, t._names, n, i]);
|
|
150
|
-
pe(() => ((
|
|
150
|
+
pe(() => ((m.current !== t || !Q(v.current, i)) && (m.current = t, v.current = i, B()), t._subscribe({
|
|
151
151
|
name: i,
|
|
152
152
|
formState: {
|
|
153
153
|
values: !0
|
|
@@ -157,21 +157,21 @@ function Tt(e) {
|
|
|
157
157
|
B(F.values);
|
|
158
158
|
}
|
|
159
159
|
})), [t, d, i, B]), _.useEffect(() => t._removeUnmounted());
|
|
160
|
-
const Z =
|
|
160
|
+
const Z = m.current !== t, b = v.current, N = _.useMemo(() => {
|
|
161
161
|
if (n)
|
|
162
162
|
return null;
|
|
163
|
-
const F = !Z && !Q(
|
|
163
|
+
const F = !Z && !Q(b, i);
|
|
164
164
|
return Z || F ? R() : null;
|
|
165
|
-
}, [n, Z, i,
|
|
165
|
+
}, [n, Z, i, b, R]);
|
|
166
166
|
return N !== null ? N : p;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
const s = Ae(), { name: t, disabled: i, control: u = s.control, shouldUnregister: n, defaultValue: d, exact: c = !0 } = e, w = ot(u._names.array, t), E = _.useMemo(() => y(u._formValues, t, y(u._defaultValues, t, d)), [u, t, d]), V =
|
|
168
|
+
function Ut(e) {
|
|
169
|
+
const s = Ae(), { name: t, disabled: i, control: u = s.control, shouldUnregister: n, defaultValue: d, exact: c = !0 } = e, w = ot(u._names.array, t), E = _.useMemo(() => y(u._formValues, t, y(u._defaultValues, t, d)), [u, t, d]), V = Mt({
|
|
170
170
|
control: u,
|
|
171
171
|
name: t,
|
|
172
172
|
defaultValue: E,
|
|
173
173
|
exact: c
|
|
174
|
-
}),
|
|
174
|
+
}), m = Lt({
|
|
175
175
|
control: u,
|
|
176
176
|
name: t,
|
|
177
177
|
exact: c
|
|
@@ -184,68 +184,68 @@ function Lt(e) {
|
|
|
184
184
|
const R = _.useMemo(() => Object.defineProperties({}, {
|
|
185
185
|
invalid: {
|
|
186
186
|
enumerable: !0,
|
|
187
|
-
get: () => !!y(
|
|
187
|
+
get: () => !!y(m.errors, t)
|
|
188
188
|
},
|
|
189
189
|
isDirty: {
|
|
190
190
|
enumerable: !0,
|
|
191
|
-
get: () => !!y(
|
|
191
|
+
get: () => !!y(m.dirtyFields, t)
|
|
192
192
|
},
|
|
193
193
|
isTouched: {
|
|
194
194
|
enumerable: !0,
|
|
195
|
-
get: () => !!y(
|
|
195
|
+
get: () => !!y(m.touchedFields, t)
|
|
196
196
|
},
|
|
197
197
|
isValidating: {
|
|
198
198
|
enumerable: !0,
|
|
199
|
-
get: () => !!y(
|
|
199
|
+
get: () => !!y(m.validatingFields, t)
|
|
200
200
|
},
|
|
201
201
|
error: {
|
|
202
202
|
enumerable: !0,
|
|
203
|
-
get: () => y(
|
|
203
|
+
get: () => y(m.errors, t)
|
|
204
204
|
}
|
|
205
|
-
}), [
|
|
205
|
+
}), [m, t]), B = _.useCallback((F) => q.current.onChange({
|
|
206
206
|
target: {
|
|
207
207
|
value: lt(F),
|
|
208
208
|
name: t
|
|
209
209
|
},
|
|
210
|
-
type:
|
|
210
|
+
type: me.CHANGE
|
|
211
211
|
}), [t]), Z = _.useCallback(() => q.current.onBlur({
|
|
212
212
|
target: {
|
|
213
213
|
value: y(u._formValues, t),
|
|
214
214
|
name: t
|
|
215
215
|
},
|
|
216
|
-
type:
|
|
217
|
-
}), [t, u._formValues]),
|
|
216
|
+
type: me.BLUR
|
|
217
|
+
}), [t, u._formValues]), b = _.useCallback((F) => {
|
|
218
218
|
const A = y(u._fields, t);
|
|
219
219
|
A && F && (A._f.ref = {
|
|
220
220
|
focus: () => F.focus && F.focus(),
|
|
221
221
|
select: () => F.select && F.select(),
|
|
222
|
-
setCustomValidity: (
|
|
222
|
+
setCustomValidity: ($) => F.setCustomValidity($),
|
|
223
223
|
reportValidity: () => F.reportValidity()
|
|
224
224
|
});
|
|
225
225
|
}, [u._fields, t]), N = _.useMemo(() => ({
|
|
226
226
|
name: t,
|
|
227
227
|
value: V,
|
|
228
|
-
...z(i) ||
|
|
228
|
+
...z(i) || m.disabled ? { disabled: m.disabled || i } : {},
|
|
229
229
|
onChange: B,
|
|
230
230
|
onBlur: Z,
|
|
231
|
-
ref:
|
|
232
|
-
}), [t, i,
|
|
231
|
+
ref: b
|
|
232
|
+
}), [t, i, m.disabled, B, Z, b, V]);
|
|
233
233
|
return _.useEffect(() => {
|
|
234
234
|
const F = u._options.shouldUnregister || n, A = p.current;
|
|
235
235
|
A && A !== t && !w && u.unregister(A), u.register(t, {
|
|
236
236
|
...v.current.rules,
|
|
237
237
|
...z(v.current.disabled) ? { disabled: v.current.disabled } : {}
|
|
238
238
|
});
|
|
239
|
-
const
|
|
239
|
+
const $ = (K, oe) => {
|
|
240
240
|
const I = y(u._fields, K);
|
|
241
241
|
I && I._f && (I._f.mount = oe);
|
|
242
242
|
};
|
|
243
|
-
if (
|
|
243
|
+
if ($(t, !0), F) {
|
|
244
244
|
const K = U(y(u._options.defaultValues, t, v.current.defaultValue));
|
|
245
245
|
C(u._defaultValues, t, K), O(y(u._formValues, t)) && C(u._formValues, t, K);
|
|
246
246
|
}
|
|
247
247
|
return !w && u.register(t), p.current = t, () => {
|
|
248
|
-
(w ? F && !u._state.action : F) ? u.unregister(t) :
|
|
248
|
+
(w ? F && !u._state.action : F) ? u.unregister(t) : $(t, !1);
|
|
249
249
|
};
|
|
250
250
|
}, [t, u, w, n]), _.useEffect(() => {
|
|
251
251
|
u._setDisabledField({
|
|
@@ -254,12 +254,12 @@ function Lt(e) {
|
|
|
254
254
|
});
|
|
255
255
|
}, [i, t, u]), _.useMemo(() => ({
|
|
256
256
|
field: N,
|
|
257
|
-
formState:
|
|
257
|
+
formState: m,
|
|
258
258
|
fieldState: R
|
|
259
|
-
}), [N,
|
|
259
|
+
}), [N, m, R]);
|
|
260
260
|
}
|
|
261
|
-
const
|
|
262
|
-
var
|
|
261
|
+
const pt = (e) => e.render(Ut(e));
|
|
262
|
+
var Bt = (e, s, t, i, u) => s ? {
|
|
263
263
|
...t[e],
|
|
264
264
|
types: {
|
|
265
265
|
...t[e] && t[e].types ? t[e].types : {},
|
|
@@ -297,37 +297,37 @@ function ct(e, s) {
|
|
|
297
297
|
}
|
|
298
298
|
return t;
|
|
299
299
|
}
|
|
300
|
-
var W = (e) => M(e) && !Object.keys(e).length, Be = (e) => e.type === "file", X = (e) => typeof e == "function",
|
|
300
|
+
var W = (e) => M(e) && !Object.keys(e).length, Be = (e) => e.type === "file", X = (e) => typeof e == "function", be = (e) => {
|
|
301
301
|
if (!Te)
|
|
302
302
|
return !1;
|
|
303
303
|
const s = e ? e.ownerDocument : 0;
|
|
304
304
|
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
305
|
-
}, ft = (e) => e.type === "select-multiple", Ne = (e) => e.type === "radio",
|
|
306
|
-
function
|
|
305
|
+
}, ft = (e) => e.type === "select-multiple", Ne = (e) => e.type === "radio", Nt = (e) => Ne(e) || ge(e), Se = (e) => be(e) && e.isConnected;
|
|
306
|
+
function It(e, s) {
|
|
307
307
|
const t = s.slice(0, -1).length;
|
|
308
308
|
let i = 0;
|
|
309
309
|
for (; i < t; )
|
|
310
310
|
e = O(e) ? i++ : e[s[i++]];
|
|
311
311
|
return e;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function Pt(e) {
|
|
314
314
|
for (const s in e)
|
|
315
315
|
if (e.hasOwnProperty(s) && !O(e[s]))
|
|
316
316
|
return !1;
|
|
317
317
|
return !0;
|
|
318
318
|
}
|
|
319
319
|
function L(e, s) {
|
|
320
|
-
const t = Array.isArray(s) ? s : Fe(s) ? [s] : Me(s), i = t.length === 1 ? e :
|
|
321
|
-
return i && delete i[n], u !== 0 && (M(i) && W(i) || Array.isArray(i) &&
|
|
320
|
+
const t = Array.isArray(s) ? s : Fe(s) ? [s] : Me(s), i = t.length === 1 ? e : It(e, t), u = t.length - 1, n = t[u];
|
|
321
|
+
return i && delete i[n], u !== 0 && (M(i) && W(i) || Array.isArray(i) && Pt(i)) && L(e, t.slice(0, -1)), e;
|
|
322
322
|
}
|
|
323
|
-
var
|
|
323
|
+
var Wt = (e) => {
|
|
324
324
|
for (const s in e)
|
|
325
325
|
if (X(e[s]))
|
|
326
326
|
return !0;
|
|
327
327
|
return !1;
|
|
328
328
|
};
|
|
329
329
|
function yt(e) {
|
|
330
|
-
return Array.isArray(e) || M(e) && !
|
|
330
|
+
return Array.isArray(e) || M(e) && !Wt(e);
|
|
331
331
|
}
|
|
332
332
|
function Oe(e, s = {}) {
|
|
333
333
|
for (const t in e) {
|
|
@@ -341,7 +341,7 @@ function le(e, s, t) {
|
|
|
341
341
|
for (const i in e) {
|
|
342
342
|
const u = e[i];
|
|
343
343
|
if (yt(u))
|
|
344
|
-
O(s) || Re(t[i]) ? t[i] = Oe(u, Array.isArray(u) ? [] : {}) : le(u,
|
|
344
|
+
O(s) || Re(t[i]) ? t[i] = Oe(u, Array.isArray(u) ? [] : {}) : le(u, j(s) ? {} : s[i], t[i]);
|
|
345
345
|
else {
|
|
346
346
|
const n = s[i];
|
|
347
347
|
t[i] = !Q(u, n);
|
|
@@ -376,9 +376,9 @@ var vt = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disab
|
|
|
376
376
|
} : s, Ze) : Ze;
|
|
377
377
|
function et(e) {
|
|
378
378
|
const s = e.ref;
|
|
379
|
-
return Be(s) ? s.files : Ne(s) ? vt(e.refs).value : ft(s) ? [...s.selectedOptions].map(({ value: t }) => t) :
|
|
379
|
+
return Be(s) ? s.files : Ne(s) ? vt(e.refs).value : ft(s) ? [...s.selectedOptions].map(({ value: t }) => t) : ge(s) ? ht(e.refs).value : gt(O(s.value) ? e.ref.value : s.value, e);
|
|
380
380
|
}
|
|
381
|
-
var
|
|
381
|
+
var qt = (e, s, t, i) => {
|
|
382
382
|
const u = {};
|
|
383
383
|
for (const n of e) {
|
|
384
384
|
const d = y(s, n);
|
|
@@ -398,7 +398,7 @@ var Pt = (e, s, t, i) => {
|
|
|
398
398
|
isOnTouch: e === J.onTouched
|
|
399
399
|
});
|
|
400
400
|
const rt = "AsyncFunction";
|
|
401
|
-
var
|
|
401
|
+
var Ht = (e) => !!e && !!e.validate && !!(X(e.validate) && e.validate.constructor.name === rt || M(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === rt)), jt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), st = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
|
|
402
402
|
const ye = (e, s, t, i) => {
|
|
403
403
|
for (const u of t || Object.keys(e)) {
|
|
404
404
|
const n = y(e, u);
|
|
@@ -444,11 +444,11 @@ function it(e, s, t) {
|
|
|
444
444
|
name: t
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
var
|
|
447
|
+
var $t = (e, s, t, i) => {
|
|
448
448
|
t(e);
|
|
449
449
|
const { name: u, ...n } = e;
|
|
450
450
|
return W(n) || Object.keys(n).length >= Object.keys(s).length || Object.keys(n).find((d) => s[d] === (!i || J.all));
|
|
451
|
-
},
|
|
451
|
+
}, Kt = (e, s, t) => !e || !s || e === s || fe(e).some((i) => i && (t ? i === s : i.startsWith(s) || s.startsWith(i))), zt = (e, s, t, i, u) => u.isOnAll ? !1 : !t && u.isOnTouch ? !(s || e) : (t ? i.isOnBlur : u.isOnBlur) ? !e : (t ? i.isOnChange : u.isOnChange) ? e : !0, Gt = (e, s) => !Le(y(e, s)).length && L(e, s), Yt = (e, s, t) => {
|
|
452
452
|
const i = fe(y(e, t));
|
|
453
453
|
return C(i, "root", s[t]), C(e, t, i), e;
|
|
454
454
|
};
|
|
@@ -464,12 +464,12 @@ var ue = (e) => M(e) && !Ve(e) ? e : {
|
|
|
464
464
|
value: e,
|
|
465
465
|
message: ""
|
|
466
466
|
}, nt = async (e, s, t, i, u, n) => {
|
|
467
|
-
const { ref: d, refs: c, required: w, maxLength: E, minLength: V, min:
|
|
467
|
+
const { ref: d, refs: c, required: w, maxLength: E, minLength: V, min: m, max: v, pattern: p, validate: q, name: R, valueAsNumber: B, mount: Z } = e._f, b = y(t, R);
|
|
468
468
|
if (!Z || s.has(R))
|
|
469
469
|
return {};
|
|
470
470
|
const N = c ? c[0] : d, F = (x) => {
|
|
471
471
|
u && N.reportValidity && (N.setCustomValidity(z(x) ? "" : x || ""), N.reportValidity());
|
|
472
|
-
}, A = {},
|
|
472
|
+
}, A = {}, $ = Ne(d), K = ge(d), oe = $ || K, I = (B || Be(d)) && O(d.value) && O(b) || be(d) && d.value === "" || b === "" || Array.isArray(b) && !b.length, ie = Bt.bind(null, R, i, A), ee = (x, D, T, P = re.maxLength, H = re.minLength) => {
|
|
473
473
|
const te = x ? D : T;
|
|
474
474
|
A[R] = {
|
|
475
475
|
type: x ? P : H,
|
|
@@ -478,7 +478,7 @@ var ue = (e) => M(e) && !Ve(e) ? e : {
|
|
|
478
478
|
...ie(x ? P : H, te)
|
|
479
479
|
};
|
|
480
480
|
};
|
|
481
|
-
if (n ? !Array.isArray(
|
|
481
|
+
if (n ? !Array.isArray(b) || !b.length : w && (!oe && (I || j(b)) || z(b) && !b || K && !ht(c).isValid || $ && !vt(c).isValid)) {
|
|
482
482
|
const { value: x, message: D } = G(w) ? { value: !!w, message: w } : ue(w);
|
|
483
483
|
if (x && (A[R] = {
|
|
484
484
|
type: re.required,
|
|
@@ -488,27 +488,27 @@ var ue = (e) => M(e) && !Ve(e) ? e : {
|
|
|
488
488
|
}, !i))
|
|
489
489
|
return F(D), A;
|
|
490
490
|
}
|
|
491
|
-
if (!I && (
|
|
491
|
+
if (!I && (!j(m) || !j(v))) {
|
|
492
492
|
let x, D;
|
|
493
|
-
const T = ue(v), P = ue(
|
|
494
|
-
if (
|
|
495
|
-
const H = d.valueAsNumber ||
|
|
496
|
-
|
|
493
|
+
const T = ue(v), P = ue(m);
|
|
494
|
+
if (!j(b) && !isNaN(b)) {
|
|
495
|
+
const H = d.valueAsNumber || b && +b;
|
|
496
|
+
j(T.value) || (x = H > T.value), j(P.value) || (D = H < P.value);
|
|
497
497
|
} else {
|
|
498
|
-
const H = d.valueAsDate || new Date(
|
|
499
|
-
G(T.value) &&
|
|
498
|
+
const H = d.valueAsDate || new Date(b), te = (ve) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ve), de = d.type == "time", ne = d.type == "week";
|
|
499
|
+
G(T.value) && b && (x = de ? te(b) > te(T.value) : ne ? b > T.value : H > new Date(T.value)), G(P.value) && b && (D = de ? te(b) < te(P.value) : ne ? b < P.value : H < new Date(P.value));
|
|
500
500
|
}
|
|
501
501
|
if ((x || D) && (ee(!!x, T.message, P.message, re.max, re.min), !i))
|
|
502
502
|
return F(A[R].message), A;
|
|
503
503
|
}
|
|
504
|
-
if ((E || V) && !I && (G(
|
|
505
|
-
const x = ue(E), D = ue(V), T =
|
|
504
|
+
if ((E || V) && !I && (G(b) || n && Array.isArray(b))) {
|
|
505
|
+
const x = ue(E), D = ue(V), T = !j(x.value) && b.length > +x.value, P = !j(D.value) && b.length < +D.value;
|
|
506
506
|
if ((T || P) && (ee(T, x.message, D.message), !i))
|
|
507
507
|
return F(A[R].message), A;
|
|
508
508
|
}
|
|
509
|
-
if (p && !I && G(
|
|
509
|
+
if (p && !I && G(b)) {
|
|
510
510
|
const { value: x, message: D } = ue(p);
|
|
511
|
-
if (Ve(x) && !
|
|
511
|
+
if (Ve(x) && !b.match(x) && (A[R] = {
|
|
512
512
|
type: re.pattern,
|
|
513
513
|
message: D,
|
|
514
514
|
ref: d,
|
|
@@ -518,7 +518,7 @@ var ue = (e) => M(e) && !Ve(e) ? e : {
|
|
|
518
518
|
}
|
|
519
519
|
if (q) {
|
|
520
520
|
if (X(q)) {
|
|
521
|
-
const x = await q(
|
|
521
|
+
const x = await q(b, t), D = at(x, N);
|
|
522
522
|
if (D && (A[R] = {
|
|
523
523
|
...D,
|
|
524
524
|
...ie(re.validate, D.message)
|
|
@@ -529,7 +529,7 @@ var ue = (e) => M(e) && !Ve(e) ? e : {
|
|
|
529
529
|
for (const D in q) {
|
|
530
530
|
if (!W(x) && !i)
|
|
531
531
|
break;
|
|
532
|
-
const T = at(await q[D](
|
|
532
|
+
const T = at(await q[D](b, t), N, D);
|
|
533
533
|
T && (x = {
|
|
534
534
|
...T,
|
|
535
535
|
...ie(D, T.message)
|
|
@@ -544,14 +544,14 @@ var ue = (e) => M(e) && !Ve(e) ? e : {
|
|
|
544
544
|
}
|
|
545
545
|
return F(!0), A;
|
|
546
546
|
};
|
|
547
|
-
const
|
|
547
|
+
const Jt = {
|
|
548
548
|
mode: J.onSubmit,
|
|
549
549
|
reValidateMode: J.onChange,
|
|
550
550
|
shouldFocusError: !0
|
|
551
551
|
};
|
|
552
|
-
function
|
|
552
|
+
function Qt(e = {}) {
|
|
553
553
|
let s = {
|
|
554
|
-
...
|
|
554
|
+
...Jt,
|
|
555
555
|
...e
|
|
556
556
|
}, t = {
|
|
557
557
|
submitCount: 0,
|
|
@@ -588,7 +588,7 @@ function Yt(e = {}) {
|
|
|
588
588
|
isValid: !1,
|
|
589
589
|
errors: !1
|
|
590
590
|
};
|
|
591
|
-
let
|
|
591
|
+
let m = {
|
|
592
592
|
...V
|
|
593
593
|
};
|
|
594
594
|
const v = {
|
|
@@ -597,14 +597,14 @@ function Yt(e = {}) {
|
|
|
597
597
|
}, p = s.criteriaMode === J.all, q = (r) => (a) => {
|
|
598
598
|
clearTimeout(E), E = setTimeout(r, a);
|
|
599
599
|
}, R = async (r) => {
|
|
600
|
-
if (!s.disabled && (V.isValid ||
|
|
600
|
+
if (!s.disabled && (V.isValid || m.isValid || r)) {
|
|
601
601
|
const a = s.resolver ? W((await K()).errors) : await I(i, !0);
|
|
602
602
|
a !== t.isValid && v.state.next({
|
|
603
603
|
isValid: a
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
606
|
}, B = (r, a) => {
|
|
607
|
-
!s.disabled && (V.isValidating || V.validatingFields ||
|
|
607
|
+
!s.disabled && (V.isValidating || V.validatingFields || m.isValidating || m.validatingFields) && ((r || Array.from(c.mount)).forEach((l) => {
|
|
608
608
|
l && (a ? C(t.validatingFields, l, a) : L(t.validatingFields, l));
|
|
609
609
|
}), v.state.next({
|
|
610
610
|
validatingFields: t.validatingFields,
|
|
@@ -618,13 +618,13 @@ function Yt(e = {}) {
|
|
|
618
618
|
}
|
|
619
619
|
if (o && Array.isArray(y(t.errors, r))) {
|
|
620
620
|
const g = l(y(t.errors, r), h.argA, h.argB);
|
|
621
|
-
f && C(t.errors, r, g),
|
|
621
|
+
f && C(t.errors, r, g), Gt(t.errors, r);
|
|
622
622
|
}
|
|
623
|
-
if ((V.touchedFields ||
|
|
623
|
+
if ((V.touchedFields || m.touchedFields) && o && Array.isArray(y(t.touchedFields, r))) {
|
|
624
624
|
const g = l(y(t.touchedFields, r), h.argA, h.argB);
|
|
625
625
|
f && C(t.touchedFields, r, g);
|
|
626
626
|
}
|
|
627
|
-
(V.dirtyFields ||
|
|
627
|
+
(V.dirtyFields || m.dirtyFields) && (t.dirtyFields = le(u, n)), v.state.next({
|
|
628
628
|
name: r,
|
|
629
629
|
isDirty: ee(r, a),
|
|
630
630
|
dirtyFields: t.dirtyFields,
|
|
@@ -633,7 +633,7 @@ function Yt(e = {}) {
|
|
|
633
633
|
});
|
|
634
634
|
} else
|
|
635
635
|
C(n, r, a);
|
|
636
|
-
},
|
|
636
|
+
}, b = (r, a) => {
|
|
637
637
|
C(t.errors, r, a), v.state.next({
|
|
638
638
|
errors: t.errors
|
|
639
639
|
});
|
|
@@ -655,20 +655,20 @@ function Yt(e = {}) {
|
|
|
655
655
|
};
|
|
656
656
|
if (!s.disabled) {
|
|
657
657
|
if (!l || h) {
|
|
658
|
-
(V.isDirty ||
|
|
658
|
+
(V.isDirty || m.isDirty) && (g = t.isDirty, t.isDirty = k.isDirty = ee(), o = g !== k.isDirty);
|
|
659
659
|
const S = Q(y(u, r), a);
|
|
660
|
-
g = !!y(t.dirtyFields, r), S ? L(t.dirtyFields, r) : C(t.dirtyFields, r, !0), k.dirtyFields = t.dirtyFields, o = o || (V.dirtyFields ||
|
|
660
|
+
g = !!y(t.dirtyFields, r), S ? L(t.dirtyFields, r) : C(t.dirtyFields, r, !0), k.dirtyFields = t.dirtyFields, o = o || (V.dirtyFields || m.dirtyFields) && g !== !S;
|
|
661
661
|
}
|
|
662
662
|
if (l) {
|
|
663
663
|
const S = y(t.touchedFields, r);
|
|
664
|
-
S || (C(t.touchedFields, r, l), k.touchedFields = t.touchedFields, o = o || (V.touchedFields ||
|
|
664
|
+
S || (C(t.touchedFields, r, l), k.touchedFields = t.touchedFields, o = o || (V.touchedFields || m.touchedFields) && S !== l);
|
|
665
665
|
}
|
|
666
666
|
o && f && v.state.next(k);
|
|
667
667
|
}
|
|
668
668
|
return o ? k : {};
|
|
669
|
-
},
|
|
670
|
-
const f = y(t.errors, r), o = (V.isValid ||
|
|
671
|
-
if (s.delayError && l ? (w = q(() =>
|
|
669
|
+
}, $ = (r, a, l, h) => {
|
|
670
|
+
const f = y(t.errors, r), o = (V.isValid || m.isValid) && z(a) && t.isValid !== a;
|
|
671
|
+
if (s.delayError && l ? (w = q(() => b(r, l)), w(s.delayError)) : (clearTimeout(E), w = null, l ? C(t.errors, r, l) : L(t.errors, r)), (l ? !Q(f, l) : f) || !W(h) || o) {
|
|
672
672
|
const g = {
|
|
673
673
|
...h,
|
|
674
674
|
...o && z(a) ? { isValid: a } : {},
|
|
@@ -682,7 +682,7 @@ function Yt(e = {}) {
|
|
|
682
682
|
}
|
|
683
683
|
}, K = async (r) => {
|
|
684
684
|
B(r, !0);
|
|
685
|
-
const a = await s.resolver(n, s.context,
|
|
685
|
+
const a = await s.resolver(n, s.context, qt(r || c.mount, i, s.criteriaMode, s.shouldUseNativeValidation));
|
|
686
686
|
return B(r), a;
|
|
687
687
|
}, oe = async (r) => {
|
|
688
688
|
const { errors: a } = await K(r);
|
|
@@ -702,12 +702,12 @@ function Yt(e = {}) {
|
|
|
702
702
|
if (f) {
|
|
703
703
|
const { _f: o, ...g } = f;
|
|
704
704
|
if (o) {
|
|
705
|
-
const k = c.array.has(o.name), S = f._f &&
|
|
705
|
+
const k = c.array.has(o.name), S = f._f && Ht(f._f);
|
|
706
706
|
S && V.validatingFields && B([o.name], !0);
|
|
707
707
|
const Y = await nt(f, c.disabled, n, p, s.shouldUseNativeValidation && !a, k);
|
|
708
708
|
if (S && V.validatingFields && B([o.name]), Y[o.name] && (l.valid = !1, a))
|
|
709
709
|
break;
|
|
710
|
-
!a && (y(Y, o.name) ? k ?
|
|
710
|
+
!a && (y(Y, o.name) ? k ? Yt(t.errors, Y, o.name) : C(t.errors, o.name, Y[o.name]) : L(t.errors, o.name));
|
|
711
711
|
}
|
|
712
712
|
!W(g) && await I(g, a, l);
|
|
713
713
|
}
|
|
@@ -719,14 +719,14 @@ function Yt(e = {}) {
|
|
|
719
719
|
a && (a._f.refs ? a._f.refs.every((l) => !Se(l)) : !Se(a._f.ref)) && xe(r);
|
|
720
720
|
}
|
|
721
721
|
c.unMount = /* @__PURE__ */ new Set();
|
|
722
|
-
}, ee = (r, a) => !s.disabled && (r && a && C(n, r, a), !Q(
|
|
722
|
+
}, ee = (r, a) => !s.disabled && (r && a && C(n, r, a), !Q(ve(), u)), x = (r, a, l) => Ce(r, c, {
|
|
723
723
|
...d.mount ? n : O(a) ? u : G(r) ? { [r]: a } : a
|
|
724
724
|
}, l, a), D = (r) => Le(y(d.mount ? n : u, r, s.shouldUnregister ? y(u, r, []) : [])), T = (r, a, l = {}) => {
|
|
725
725
|
const h = y(i, r);
|
|
726
726
|
let f = a;
|
|
727
727
|
if (h) {
|
|
728
728
|
const o = h._f;
|
|
729
|
-
o && (!o.disabled && C(n, r, gt(a, o)), f =
|
|
729
|
+
o && (!o.disabled && C(n, r, gt(a, o)), f = be(o.ref) && j(a) ? "" : a, ft(o.ref) ? [...o.ref.options].forEach((g) => g.selected = f.includes(g.value)) : o.refs ? ge(o.ref) ? o.refs.forEach((g) => {
|
|
730
730
|
(!g.defaultChecked || !g.disabled) && (Array.isArray(f) ? g.checked = !!f.find((k) => k === g.value) : g.checked = f === g.value || !!f);
|
|
731
731
|
}) : o.refs.forEach((g) => g.checked = g.value === f) : Be(o.ref) ? o.ref.value = "" : (o.ref.value = f, o.ref.type || v.state.next({
|
|
732
732
|
name: r,
|
|
@@ -746,11 +746,11 @@ function Yt(e = {}) {
|
|
|
746
746
|
C(n, r, o), f ? (v.array.next({
|
|
747
747
|
name: r,
|
|
748
748
|
values: U(n)
|
|
749
|
-
}), (V.isDirty || V.dirtyFields ||
|
|
749
|
+
}), (V.isDirty || V.dirtyFields || m.isDirty || m.dirtyFields) && l.shouldDirty && v.state.next({
|
|
750
750
|
name: r,
|
|
751
751
|
dirtyFields: le(u, n),
|
|
752
752
|
isDirty: ee(r, o)
|
|
753
|
-
})) : h && !h._f &&
|
|
753
|
+
})) : h && !h._f && !j(o) ? P(r, o, l) : T(r, o, l), st(r, c) && v.state.next({ ...t, name: r }), v.state.next({
|
|
754
754
|
name: d.mount ? r : void 0,
|
|
755
755
|
values: U(n)
|
|
756
756
|
});
|
|
@@ -763,24 +763,24 @@ function Yt(e = {}) {
|
|
|
763
763
|
}, g = tt(s.mode), k = tt(s.reValidateMode);
|
|
764
764
|
if (f) {
|
|
765
765
|
let S, Y;
|
|
766
|
-
const
|
|
767
|
-
C(n, l,
|
|
768
|
-
const Ee = A(l,
|
|
766
|
+
const _e = a.type ? et(f._f) : lt(r), se = r.type === me.BLUR || r.type === me.FOCUS_OUT, wt = !jt(f._f) && !s.resolver && !y(t.errors, l) && !f._f.deps || zt(se, y(t.touchedFields, l), t.isSubmitted, k, g), De = st(l, c, se);
|
|
767
|
+
C(n, l, _e), se ? (!a || !a.readOnly) && (f._f.onBlur && f._f.onBlur(r), w && w(0)) : f._f.onChange && f._f.onChange(r);
|
|
768
|
+
const Ee = A(l, _e, se), kt = !W(Ee) || De;
|
|
769
769
|
if (!se && v.state.next({
|
|
770
770
|
name: l,
|
|
771
771
|
type: r.type,
|
|
772
772
|
values: U(n)
|
|
773
773
|
}), wt)
|
|
774
|
-
return (V.isValid ||
|
|
774
|
+
return (V.isValid || m.isValid) && (s.mode === "onBlur" ? se && R() : se || R()), kt && v.state.next({ name: l, ...De ? {} : Ee });
|
|
775
775
|
if (!se && De && v.state.next({ ...t }), s.resolver) {
|
|
776
776
|
const { errors: ze } = await K([l]);
|
|
777
|
-
if (o(
|
|
777
|
+
if (o(_e), h) {
|
|
778
778
|
const Dt = it(t.errors, i, l), Ge = it(ze, i, Dt.name || l);
|
|
779
779
|
S = Ge.error, l = Ge.name, Y = W(ze);
|
|
780
780
|
}
|
|
781
781
|
} else
|
|
782
|
-
B([l], !0), S = (await nt(f, c.disabled, n, p, s.shouldUseNativeValidation))[l], B([l]), o(
|
|
783
|
-
h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && ne(f._f.deps),
|
|
782
|
+
B([l], !0), S = (await nt(f, c.disabled, n, p, s.shouldUseNativeValidation))[l], B([l]), o(_e), h && (S ? Y = !1 : (V.isValid || m.isValid) && (Y = await I(i, !0)));
|
|
783
|
+
h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && ne(f._f.deps), $(l, Y, S, Ee));
|
|
784
784
|
}
|
|
785
785
|
}, de = (r, a) => {
|
|
786
786
|
if (y(t.errors, a) && r.focus)
|
|
@@ -796,11 +796,11 @@ function Yt(e = {}) {
|
|
|
796
796
|
return await I(g && g._f ? { [o]: g } : g);
|
|
797
797
|
}))).every(Boolean), !(!h && !t.isValid) && R()) : h = l = await I(i);
|
|
798
798
|
return v.state.next({
|
|
799
|
-
...!G(r) || (V.isValid ||
|
|
799
|
+
...!G(r) || (V.isValid || m.isValid) && l !== t.isValid ? {} : { name: r },
|
|
800
800
|
...s.resolver || !r ? { isValid: l } : {},
|
|
801
801
|
errors: t.errors
|
|
802
802
|
}), a.shouldFocus && !h && ye(i, de, r ? f : c.mount), h;
|
|
803
|
-
},
|
|
803
|
+
}, ve = (r, a) => {
|
|
804
804
|
let l = {
|
|
805
805
|
...d.mount ? n : u
|
|
806
806
|
};
|
|
@@ -826,23 +826,23 @@ function Yt(e = {}) {
|
|
|
826
826
|
errors: t.errors,
|
|
827
827
|
isValid: !1
|
|
828
828
|
}), l && l.shouldFocus && h && h.focus && h.focus();
|
|
829
|
-
},
|
|
829
|
+
}, mt = (r, a) => X(r) ? v.state.subscribe({
|
|
830
830
|
next: (l) => "values" in l && r(x(void 0, a), l)
|
|
831
831
|
}) : x(r, a, !0), We = (r) => v.state.subscribe({
|
|
832
832
|
next: (a) => {
|
|
833
|
-
|
|
833
|
+
Kt(r.name, a.name, r.exact) && $t(a, r.formState || V, xt, r.reRenderRoot) && r.callback({
|
|
834
834
|
values: { ...n },
|
|
835
835
|
...t,
|
|
836
836
|
...a,
|
|
837
837
|
defaultValues: u
|
|
838
838
|
});
|
|
839
839
|
}
|
|
840
|
-
}).unsubscribe,
|
|
841
|
-
...
|
|
840
|
+
}).unsubscribe, bt = (r) => (d.mount = !0, m = {
|
|
841
|
+
...m,
|
|
842
842
|
...r.formState
|
|
843
843
|
}, We({
|
|
844
844
|
...r,
|
|
845
|
-
formState:
|
|
845
|
+
formState: m
|
|
846
846
|
})), xe = (r, a = {}) => {
|
|
847
847
|
for (const l of r ? fe(r) : c.mount)
|
|
848
848
|
c.mount.delete(l), c.array.delete(l), a.keepValue || (L(i, l), L(n, l)), !a.keepError && L(t.errors, l), !a.keepDirty && L(t.dirtyFields, l), !a.keepTouched && L(t.touchedFields, l), !a.keepIsValidating && L(t.validatingFields, l), !s.shouldUnregister && !a.keepDefaultValue && L(u, l);
|
|
@@ -884,7 +884,7 @@ function Yt(e = {}) {
|
|
|
884
884
|
ref: (f) => {
|
|
885
885
|
if (f) {
|
|
886
886
|
we(r, a), l = y(i, r);
|
|
887
|
-
const o = O(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g =
|
|
887
|
+
const o = O(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = Nt(o), k = l._f.refs || [];
|
|
888
888
|
if (g ? k.find((S) => S === o) : o === l._f.ref)
|
|
889
889
|
return;
|
|
890
890
|
C(i, r, {
|
|
@@ -946,7 +946,7 @@ function Yt(e = {}) {
|
|
|
946
946
|
throw h;
|
|
947
947
|
}, Ft = (r, a = {}) => {
|
|
948
948
|
y(i, r) && (O(a.defaultValue) ? H(r, U(y(u, r))) : (H(r, a.defaultValue), C(u, r, U(a.defaultValue))), a.keepTouched || L(t.touchedFields, r), a.keepDirty || (L(t.dirtyFields, r), t.isDirty = a.defaultValue ? ee(r, U(y(u, r))) : ee()), a.keepError || (L(t.errors, r), V.isValid && R()), v.state.next({ ...t }));
|
|
949
|
-
},
|
|
949
|
+
}, je = (r, a = {}) => {
|
|
950
950
|
const l = r ? U(r) : u, h = U(l), f = W(r), o = f ? u : h;
|
|
951
951
|
if (a.keepDefaultValues || (u = l), !a.keepValues) {
|
|
952
952
|
if (a.keepDirtyValues) {
|
|
@@ -962,7 +962,7 @@ function Yt(e = {}) {
|
|
|
962
962
|
const k = y(i, g);
|
|
963
963
|
if (k && k._f) {
|
|
964
964
|
const S = Array.isArray(k._f.refs) ? k._f.refs[0] : k._f.ref;
|
|
965
|
-
if (
|
|
965
|
+
if (be(S)) {
|
|
966
966
|
const Y = S.closest("form");
|
|
967
967
|
if (Y) {
|
|
968
968
|
Y.reset();
|
|
@@ -1002,7 +1002,7 @@ function Yt(e = {}) {
|
|
|
1002
1002
|
isSubmitting: !1,
|
|
1003
1003
|
defaultValues: u
|
|
1004
1004
|
});
|
|
1005
|
-
},
|
|
1005
|
+
}, $e = (r, a) => je(X(r) ? r(n) : r, a), At = (r, a = {}) => {
|
|
1006
1006
|
const l = y(i, r), h = l && l._f;
|
|
1007
1007
|
if (h) {
|
|
1008
1008
|
const f = h.refs ? h.refs[0] : h.ref;
|
|
@@ -1030,9 +1030,9 @@ function Yt(e = {}) {
|
|
|
1030
1030
|
_setDisabledField: qe,
|
|
1031
1031
|
_setErrors: N,
|
|
1032
1032
|
_getFieldArray: D,
|
|
1033
|
-
_reset:
|
|
1033
|
+
_reset: je,
|
|
1034
1034
|
_resetDefaultValues: () => X(s.defaultValues) && s.defaultValues().then((r) => {
|
|
1035
|
-
|
|
1035
|
+
$e(r, s.resetOptions), v.state.next({
|
|
1036
1036
|
isLoading: !1
|
|
1037
1037
|
});
|
|
1038
1038
|
}),
|
|
@@ -1074,14 +1074,14 @@ function Yt(e = {}) {
|
|
|
1074
1074
|
};
|
|
1075
1075
|
}
|
|
1076
1076
|
},
|
|
1077
|
-
subscribe:
|
|
1077
|
+
subscribe: bt,
|
|
1078
1078
|
trigger: ne,
|
|
1079
1079
|
register: we,
|
|
1080
1080
|
handleSubmit: He,
|
|
1081
|
-
watch:
|
|
1081
|
+
watch: mt,
|
|
1082
1082
|
setValue: H,
|
|
1083
|
-
getValues:
|
|
1084
|
-
reset:
|
|
1083
|
+
getValues: ve,
|
|
1084
|
+
reset: $e,
|
|
1085
1085
|
resetField: Ft,
|
|
1086
1086
|
clearErrors: _t,
|
|
1087
1087
|
unregister: xe,
|
|
@@ -1094,7 +1094,7 @@ function Yt(e = {}) {
|
|
|
1094
1094
|
formControl: Ke
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function Xt(e = {}) {
|
|
1098
1098
|
const s = _.useRef(void 0), t = _.useRef(void 0), [i, u] = _.useState({
|
|
1099
1099
|
isDirty: !1,
|
|
1100
1100
|
isValidating: !1,
|
|
@@ -1119,7 +1119,7 @@ function Jt(e = {}) {
|
|
|
1119
1119
|
formState: i
|
|
1120
1120
|
}, e.defaultValues && !X(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
1121
1121
|
else {
|
|
1122
|
-
const { formControl: d, ...c } =
|
|
1122
|
+
const { formControl: d, ...c } = Qt(e);
|
|
1123
1123
|
s.current = {
|
|
1124
1124
|
...c,
|
|
1125
1125
|
formState: i
|
|
@@ -1161,7 +1161,7 @@ function Jt(e = {}) {
|
|
|
1161
1161
|
n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
|
|
1162
1162
|
}), s.current.formState = dt(i, n), s.current;
|
|
1163
1163
|
}
|
|
1164
|
-
const
|
|
1164
|
+
const Zt = ({
|
|
1165
1165
|
children: e,
|
|
1166
1166
|
onSubmit: s = () => {
|
|
1167
1167
|
},
|
|
@@ -1169,13 +1169,13 @@ const Qt = ({
|
|
|
1169
1169
|
className: i = "",
|
|
1170
1170
|
formOptions: u
|
|
1171
1171
|
}) => {
|
|
1172
|
-
const n =
|
|
1172
|
+
const n = Xt({
|
|
1173
1173
|
mode: "onSubmit",
|
|
1174
1174
|
reValidateMode: "onChange",
|
|
1175
1175
|
shouldFocusError: !0,
|
|
1176
1176
|
...u
|
|
1177
1177
|
});
|
|
1178
|
-
return /* @__PURE__ */
|
|
1178
|
+
return /* @__PURE__ */ he(Tt, { ...n, children: /* @__PURE__ */ he(
|
|
1179
1179
|
"form",
|
|
1180
1180
|
{
|
|
1181
1181
|
noValidate: !0,
|
|
@@ -1185,27 +1185,27 @@ const Qt = ({
|
|
|
1185
1185
|
children: e
|
|
1186
1186
|
}
|
|
1187
1187
|
) });
|
|
1188
|
-
},
|
|
1188
|
+
}, er = ({
|
|
1189
1189
|
children: e,
|
|
1190
1190
|
name: s,
|
|
1191
1191
|
rules: t
|
|
1192
1192
|
}) => {
|
|
1193
1193
|
const { control: i } = Ae();
|
|
1194
|
-
return /* @__PURE__ */
|
|
1195
|
-
|
|
1194
|
+
return /* @__PURE__ */ he(
|
|
1195
|
+
pt,
|
|
1196
1196
|
{
|
|
1197
1197
|
control: i,
|
|
1198
1198
|
name: s,
|
|
1199
1199
|
rules: t,
|
|
1200
|
-
render: (u) => /* @__PURE__ */
|
|
1200
|
+
render: (u) => /* @__PURE__ */ he(tr, { ...u, children: e })
|
|
1201
1201
|
}
|
|
1202
1202
|
);
|
|
1203
|
-
},
|
|
1203
|
+
}, tr = ({
|
|
1204
1204
|
field: e,
|
|
1205
1205
|
fieldState: s,
|
|
1206
1206
|
children: t
|
|
1207
1207
|
}) => {
|
|
1208
|
-
const { onChange: i, onBlur: u, value: n, name: d, disabled: c } = e, { error: w } = s, E = t.props.onChange, V = t.props.onBlur,
|
|
1208
|
+
const { onChange: i, onBlur: u, value: n, name: d, disabled: c } = e, { error: w } = s, E = t.props.onChange, V = t.props.onBlur, m = Ye(
|
|
1209
1209
|
(...p) => {
|
|
1210
1210
|
i(...p), E == null || E(...p);
|
|
1211
1211
|
},
|
|
@@ -1216,18 +1216,21 @@ const Qt = ({
|
|
|
1216
1216
|
},
|
|
1217
1217
|
[u, V]
|
|
1218
1218
|
);
|
|
1219
|
-
return Et(
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1219
|
+
return /* @__PURE__ */ Et(St, { children: [
|
|
1220
|
+
Ct(t, {
|
|
1221
|
+
...t.props,
|
|
1222
|
+
name: d,
|
|
1223
|
+
disabled: c,
|
|
1224
|
+
onChange: m,
|
|
1225
|
+
value: n || t.props.value,
|
|
1226
|
+
onBlur: v,
|
|
1227
|
+
error: w
|
|
1228
|
+
}),
|
|
1229
|
+
w && /* @__PURE__ */ he("div", { style: { color: "red", marginTop: 4 }, children: w.message })
|
|
1230
|
+
] });
|
|
1228
1231
|
};
|
|
1229
|
-
|
|
1232
|
+
Zt.Control = er;
|
|
1230
1233
|
export {
|
|
1231
|
-
|
|
1234
|
+
Zt as SuprForm
|
|
1232
1235
|
};
|
|
1233
1236
|
//# sourceMappingURL=suprform.es.js.map
|