dgz-ui-shared 1.1.19 → 1.1.21
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/{Actions-1AyyAnYT.js → Actions-CKVu3P3q.js} +6 -6
- package/dist/Actions-uGf1oq7E.cjs +1 -0
- package/dist/{DateRangePicker-kaBfJaKY.cjs → DateRangePicker-C1c1mofH.cjs} +3 -3
- package/dist/{DateRangePicker-D57HSCpq.js → DateRangePicker-DFsQ10c7.js} +5 -5
- package/dist/{ExportData-dSwR1N1v.js → ExportData-1xS2UAoq.js} +6 -6
- package/dist/ExportData-ApStkEWC.cjs +1 -0
- package/dist/{FilterWrapper-DeQRSTAc.js → FilterWrapper-Dk18nVPy.js} +31 -31
- package/dist/{FilterWrapper-B6p9fJWb.cjs → FilterWrapper-DvNjUQih.cjs} +5 -5
- package/dist/{MyInput-BzXWiSVj.cjs → MyInput-9MnlVZ4h.cjs} +1 -1
- package/dist/{MyInput-CkiPA3UG.js → MyInput-B-QCpehg.js} +57 -57
- package/dist/{MyLimitSelect-DHyIJawN.cjs → MyLimitSelect-BU1FClXt.cjs} +2 -2
- package/dist/{MyLimitSelect-XMVeSEqs.js → MyLimitSelect-D5ZWDY-s.js} +13 -13
- package/dist/{MySelect-Bmw1Krye.js → MySelect-C5uWRVJh.js} +7 -7
- package/dist/MySelect-DNK997Bi.cjs +1 -0
- package/dist/{button-2punbuN6-BBVynxVj.cjs → button-CdZDBhmr-3yMPCRDo.cjs} +1 -1
- package/dist/{button-2punbuN6-Bxlf8sMg.js → button-CdZDBhmr-BT_j3ig5.js} +7 -7
- package/dist/{chevron-right-HWBijj-I-Bdcofm_0.cjs → chevron-right-HWBijj-I-CZBu0GKg.cjs} +1 -1
- package/dist/{chevron-right-HWBijj-I-Bkp_tbGM.js → chevron-right-HWBijj-I-DsFUufdU.js} +1 -1
- package/dist/components/actions/index.cjs.js +1 -1
- package/dist/components/actions/index.es.js +1 -1
- package/dist/components/confirm/index.cjs.js +1 -1
- package/dist/components/confirm/index.es.js +1 -1
- package/dist/components/datatable/index.cjs.js +5 -5
- package/dist/components/datatable/index.es.js +204 -201
- package/dist/components/datepicker/index.cjs.js +1 -1
- package/dist/components/datepicker/index.es.js +1 -1
- package/dist/components/export/index.cjs.js +1 -1
- package/dist/components/export/index.es.js +1 -1
- package/dist/components/filters/index.cjs.js +1 -1
- package/dist/components/filters/index.es.js +6 -6
- package/dist/components/form/index.cjs.js +2 -2
- package/dist/components/form/index.es.js +33 -33
- package/dist/components/modal/index.cjs.js +2 -2
- package/dist/components/modal/index.es.js +7 -7
- package/dist/components/pagination/index.cjs.js +1 -1
- package/dist/components/pagination/index.es.js +1 -1
- package/dist/components/theme/index.cjs.js +3 -3
- package/dist/components/theme/index.es.js +4 -4
- package/dist/components/tooltip/index.cjs.js +1 -1
- package/dist/components/tooltip/index.es.js +44 -44
- package/dist/{createLucideIcon-B950nf2d-Brk4LIHH.js → createLucideIcon-B950nf2d-9wLYOF5y.js} +1 -1
- package/dist/{createLucideIcon-B950nf2d-BaIaB_Fz.cjs → createLucideIcon-B950nf2d-DrrWmvZU.cjs} +4 -4
- package/dist/dropdown-menu-TWRSm6RK-DQ03CnVw.cjs +1 -0
- package/dist/{dropdown-menu-lArmcWbC-jIg7CHSO.js → dropdown-menu-TWRSm6RK-D_FJpI4C.js} +83 -83
- package/dist/hooks/index.cjs.js +1 -1
- package/dist/hooks/index.es.js +2 -2
- package/dist/{index-CiR6yUKf-BEMUeikM.js → index-BL59b1Bz-C9bJE_xn.js} +90 -90
- package/dist/{index-CiR6yUKf-B1h5S0LB.cjs → index-BL59b1Bz-COeLljOH.cjs} +4 -4
- package/dist/{index-DUK8Bn0m-Clp83x2_.js → index-C4qYhCZt-BZQduTld.js} +29 -29
- package/dist/index-C4qYhCZt-DWBiWQ93.cjs +5 -0
- package/dist/index-CbK6da4c-QXbo5Vgb.cjs +1 -0
- package/dist/{index-Dp0y0FJw-B42jTfO0.js → index-CbK6da4c-d_6FdYZH.js} +1 -1
- package/dist/{index-GjjxAtgk-Dl4JPPHK.js → index-Cths1nBq-BUfZy21E.js} +71 -71
- package/dist/index-Cths1nBq-DzDn15YE.cjs +11 -0
- package/dist/{index-CMHo7s91-D6S6dZoG.cjs → index-ZsCkaYy6-Bjyf2SZs.cjs} +1 -1
- package/dist/{index-CMHo7s91-BRFfxKgJ.js → index-ZsCkaYy6-Cw9HUeiu.js} +1 -1
- package/dist/index.esm-CQEA7FC8.js +1007 -0
- package/dist/index.esm-TI7V1a5F.cjs +1 -0
- package/dist/{input-mask-Chc-UIWX-Br4gXX2T.js → input-mask-DBLFIvhN-BBxoZxnd.js} +3738 -3687
- package/dist/input-mask-DBLFIvhN-C_0RAR2l.cjs +190 -0
- package/dist/{popover-Dvg-QyCn-CJ3lAD8Q.js → popover-OZcfKDD9-C2PVWPLS.js} +17 -17
- package/dist/popover-OZcfKDD9-KUWOsIOs.cjs +1 -0
- package/dist/{react-select-CKazfTiF-1EhjhhlL.js → react-select-DVPHHTAP-D2u3DqGr.js} +2 -2
- package/dist/{react-select-CKazfTiF-Bb-Uf4tM.cjs → react-select-DVPHHTAP-DKDInFsM.cjs} +9 -9
- package/dist/types/components/datatable/DataTable.d.ts +1 -1
- package/dist/types/components/datatable/DataTable.d.ts.map +1 -1
- package/dist/{unstyled-4GbbDand.cjs → unstyled-BFCMBSGZ.cjs} +2 -2
- package/dist/{unstyled-Cmnf9U5U.js → unstyled-BMbrfzye.js} +42 -42
- package/dist/{useFilter-CiORTEHP.cjs → useFilter-Cwz8oftI.cjs} +1 -1
- package/dist/{useFilter-DMpxv27U.js → useFilter-DJunNBm2.js} +1 -1
- package/package.json +2 -2
- package/dist/Actions-Dg5LYo56.cjs +0 -1
- package/dist/ExportData-DUuHYzA-.cjs +0 -1
- package/dist/MySelect-lSICw49W.cjs +0 -1
- package/dist/dropdown-menu-lArmcWbC-DCwGoXng.cjs +0 -1
- package/dist/index-DUK8Bn0m-BIulOZIQ.cjs +0 -5
- package/dist/index-Dp0y0FJw-DVwS4FcV.cjs +0 -1
- package/dist/index-GjjxAtgk-DaxZek3n.cjs +0 -11
- package/dist/index.esm-CpcLzfLZ.cjs +0 -1
- package/dist/index.esm-lbl2HgR1.js +0 -970
- package/dist/input-mask-Chc-UIWX-DimBl_dd.cjs +0 -190
- package/dist/popover-Dvg-QyCn-Dr2o9oAG.cjs +0 -1
|
@@ -1,970 +0,0 @@
|
|
|
1
|
-
import * as pe from "react";
|
|
2
|
-
import P from "react";
|
|
3
|
-
var de = (e) => e.type === "checkbox", re = (e) => e instanceof Date, R = (e) => e == null;
|
|
4
|
-
const rt = (e) => typeof e == "object";
|
|
5
|
-
var D = (e) => !R(e) && !Array.isArray(e) && rt(e) && !re(e), Ft = (e) => D(e) && e.target ? de(e.target) ? e.target.checked : e.target.value : e, At = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, mt = (e, s) => e.has(At(s)), xt = (e) => {
|
|
6
|
-
const s = e.constructor && e.constructor.prototype;
|
|
7
|
-
return D(s) && s.hasOwnProperty("isPrototypeOf");
|
|
8
|
-
}, Oe = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
9
|
-
function L(e) {
|
|
10
|
-
let s;
|
|
11
|
-
const r = Array.isArray(e), a = typeof FileList < "u" ? e instanceof FileList : !1;
|
|
12
|
-
if (e instanceof Date)
|
|
13
|
-
s = new Date(e);
|
|
14
|
-
else if (e instanceof Set)
|
|
15
|
-
s = new Set(e);
|
|
16
|
-
else if (!(Oe && (e instanceof Blob || a)) && (r || D(e)))
|
|
17
|
-
if (s = r ? [] : {}, !r && !xt(e))
|
|
18
|
-
s = e;
|
|
19
|
-
else
|
|
20
|
-
for (const u in e)
|
|
21
|
-
e.hasOwnProperty(u) && (s[u] = L(e[u]));
|
|
22
|
-
else
|
|
23
|
-
return e;
|
|
24
|
-
return s;
|
|
25
|
-
}
|
|
26
|
-
var Ve = (e) => Array.isArray(e) ? e.filter(Boolean) : [], S = (e) => e === void 0, y = (e, s, r) => {
|
|
27
|
-
if (!s || !D(e))
|
|
28
|
-
return r;
|
|
29
|
-
const a = Ve(s.split(/[,[\].]+?/)).reduce((u, n) => R(u) ? u : u[n], e);
|
|
30
|
-
return S(a) || a === e ? S(e[s]) ? r : e[s] : a;
|
|
31
|
-
}, z = (e) => typeof e == "boolean", Te = (e) => /^\w*$/.test(e), st = (e) => Ve(e.replace(/["|']|\]/g, "").split(/\.|\[/)), m = (e, s, r) => {
|
|
32
|
-
let a = -1;
|
|
33
|
-
const u = Te(s) ? [s] : st(s), n = u.length, c = n - 1;
|
|
34
|
-
for (; ++a < n; ) {
|
|
35
|
-
const h = u[a];
|
|
36
|
-
let M = r;
|
|
37
|
-
if (a !== c) {
|
|
38
|
-
const H = e[h];
|
|
39
|
-
M = D(H) || Array.isArray(H) ? H : isNaN(+u[a + 1]) ? {} : [];
|
|
40
|
-
}
|
|
41
|
-
if (h === "__proto__" || h === "constructor" || h === "prototype")
|
|
42
|
-
return;
|
|
43
|
-
e[h] = M, e = e[h];
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const $e = {
|
|
47
|
-
BLUR: "blur",
|
|
48
|
-
FOCUS_OUT: "focusout"
|
|
49
|
-
}, q = {
|
|
50
|
-
onBlur: "onBlur",
|
|
51
|
-
onChange: "onChange",
|
|
52
|
-
onSubmit: "onSubmit",
|
|
53
|
-
onTouched: "onTouched",
|
|
54
|
-
all: "all"
|
|
55
|
-
}, J = {
|
|
56
|
-
max: "max",
|
|
57
|
-
min: "min",
|
|
58
|
-
maxLength: "maxLength",
|
|
59
|
-
minLength: "minLength",
|
|
60
|
-
pattern: "pattern",
|
|
61
|
-
required: "required",
|
|
62
|
-
validate: "validate"
|
|
63
|
-
};
|
|
64
|
-
P.createContext(null);
|
|
65
|
-
var wt = (e, s, r, a = !0) => {
|
|
66
|
-
const u = {
|
|
67
|
-
defaultValues: s._defaultValues
|
|
68
|
-
};
|
|
69
|
-
for (const n in e)
|
|
70
|
-
Object.defineProperty(u, n, {
|
|
71
|
-
get: () => {
|
|
72
|
-
const c = n;
|
|
73
|
-
return s._proxyFormState[c] !== q.all && (s._proxyFormState[c] = !a || q.all), e[c];
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return u;
|
|
77
|
-
};
|
|
78
|
-
const Dt = typeof window < "u" ? pe.useLayoutEffect : pe.useEffect;
|
|
79
|
-
var Y = (e) => typeof e == "string", Et = (e, s, r, a, u) => Y(e) ? (a && s.watch.add(e), y(r, e, u)) : Array.isArray(e) ? e.map((n) => (a && s.watch.add(n), y(r, n))) : (a && (s.watchAll = !0), r), St = (e, s, r, a, u) => s ? {
|
|
80
|
-
...r[e],
|
|
81
|
-
types: {
|
|
82
|
-
...r[e] && r[e].types ? r[e].types : {},
|
|
83
|
-
[a]: u || !0
|
|
84
|
-
}
|
|
85
|
-
} : {}, oe = (e) => Array.isArray(e) ? e : [e], Ke = () => {
|
|
86
|
-
let e = [];
|
|
87
|
-
return {
|
|
88
|
-
get observers() {
|
|
89
|
-
return e;
|
|
90
|
-
},
|
|
91
|
-
next: (u) => {
|
|
92
|
-
for (const n of e)
|
|
93
|
-
n.next && n.next(u);
|
|
94
|
-
},
|
|
95
|
-
subscribe: (u) => (e.push(u), {
|
|
96
|
-
unsubscribe: () => {
|
|
97
|
-
e = e.filter((n) => n !== u);
|
|
98
|
-
}
|
|
99
|
-
}),
|
|
100
|
-
unsubscribe: () => {
|
|
101
|
-
e = [];
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}, ke = (e) => R(e) || !rt(e);
|
|
105
|
-
function ee(e, s) {
|
|
106
|
-
if (ke(e) || ke(s))
|
|
107
|
-
return e === s;
|
|
108
|
-
if (re(e) && re(s))
|
|
109
|
-
return e.getTime() === s.getTime();
|
|
110
|
-
const r = Object.keys(e), a = Object.keys(s);
|
|
111
|
-
if (r.length !== a.length)
|
|
112
|
-
return !1;
|
|
113
|
-
for (const u of r) {
|
|
114
|
-
const n = e[u];
|
|
115
|
-
if (!a.includes(u))
|
|
116
|
-
return !1;
|
|
117
|
-
if (u !== "ref") {
|
|
118
|
-
const c = s[u];
|
|
119
|
-
if (re(n) && re(c) || D(n) && D(c) || Array.isArray(n) && Array.isArray(c) ? !ee(n, c) : n !== c)
|
|
120
|
-
return !1;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return !0;
|
|
124
|
-
}
|
|
125
|
-
var N = (e) => D(e) && !Object.keys(e).length, Le = (e) => e.type === "file", W = (e) => typeof e == "function", ve = (e) => {
|
|
126
|
-
if (!Oe)
|
|
127
|
-
return !1;
|
|
128
|
-
const s = e ? e.ownerDocument : 0;
|
|
129
|
-
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
130
|
-
}, it = (e) => e.type === "select-multiple", Ce = (e) => e.type === "radio", kt = (e) => Ce(e) || de(e), Se = (e) => ve(e) && e.isConnected;
|
|
131
|
-
function Ot(e, s) {
|
|
132
|
-
const r = s.slice(0, -1).length;
|
|
133
|
-
let a = 0;
|
|
134
|
-
for (; a < r; )
|
|
135
|
-
e = S(e) ? a++ : e[s[a++]];
|
|
136
|
-
return e;
|
|
137
|
-
}
|
|
138
|
-
function Tt(e) {
|
|
139
|
-
for (const s in e)
|
|
140
|
-
if (e.hasOwnProperty(s) && !S(e[s]))
|
|
141
|
-
return !1;
|
|
142
|
-
return !0;
|
|
143
|
-
}
|
|
144
|
-
function T(e, s) {
|
|
145
|
-
const r = Array.isArray(s) ? s : Te(s) ? [s] : st(s), a = r.length === 1 ? e : Ot(e, r), u = r.length - 1, n = r[u];
|
|
146
|
-
return a && delete a[n], u !== 0 && (D(a) && N(a) || Array.isArray(a) && Tt(a)) && T(e, r.slice(0, -1)), e;
|
|
147
|
-
}
|
|
148
|
-
var at = (e) => {
|
|
149
|
-
for (const s in e)
|
|
150
|
-
if (W(e[s]))
|
|
151
|
-
return !0;
|
|
152
|
-
return !1;
|
|
153
|
-
};
|
|
154
|
-
function _e(e, s = {}) {
|
|
155
|
-
const r = Array.isArray(e);
|
|
156
|
-
if (D(e) || r)
|
|
157
|
-
for (const a in e)
|
|
158
|
-
Array.isArray(e[a]) || D(e[a]) && !at(e[a]) ? (s[a] = Array.isArray(e[a]) ? [] : {}, _e(e[a], s[a])) : R(e[a]) || (s[a] = !0);
|
|
159
|
-
return s;
|
|
160
|
-
}
|
|
161
|
-
function lt(e, s, r) {
|
|
162
|
-
const a = Array.isArray(e);
|
|
163
|
-
if (D(e) || a)
|
|
164
|
-
for (const u in e)
|
|
165
|
-
Array.isArray(e[u]) || D(e[u]) && !at(e[u]) ? S(s) || ke(r[u]) ? r[u] = Array.isArray(e[u]) ? _e(e[u], []) : { ..._e(e[u]) } : lt(e[u], R(s) ? {} : s[u], r[u]) : r[u] = !ee(e[u], s[u]);
|
|
166
|
-
return r;
|
|
167
|
-
}
|
|
168
|
-
var ne = (e, s) => lt(e, s, _e(s));
|
|
169
|
-
const ze = {
|
|
170
|
-
value: !1,
|
|
171
|
-
isValid: !1
|
|
172
|
-
}, Ye = { value: !0, isValid: !0 };
|
|
173
|
-
var nt = (e) => {
|
|
174
|
-
if (Array.isArray(e)) {
|
|
175
|
-
if (e.length > 1) {
|
|
176
|
-
const s = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
177
|
-
return { value: s, isValid: !!s.length };
|
|
178
|
-
}
|
|
179
|
-
return e[0].checked && !e[0].disabled ? (
|
|
180
|
-
// @ts-expect-error expected to work in the browser
|
|
181
|
-
e[0].attributes && !S(e[0].attributes.value) ? S(e[0].value) || e[0].value === "" ? Ye : { value: e[0].value, isValid: !0 } : Ye
|
|
182
|
-
) : ze;
|
|
183
|
-
}
|
|
184
|
-
return ze;
|
|
185
|
-
}, ut = (e, { valueAsNumber: s, valueAsDate: r, setValueAs: a }) => S(e) ? e : s ? e === "" ? NaN : e && +e : r && Y(e) ? new Date(e) : a ? a(e) : e;
|
|
186
|
-
const je = {
|
|
187
|
-
isValid: !1,
|
|
188
|
-
value: null
|
|
189
|
-
};
|
|
190
|
-
var ot = (e) => Array.isArray(e) ? e.reduce((s, r) => r && r.checked && !r.disabled ? {
|
|
191
|
-
isValid: !0,
|
|
192
|
-
value: r.value
|
|
193
|
-
} : s, je) : je;
|
|
194
|
-
function Je(e) {
|
|
195
|
-
const s = e.ref;
|
|
196
|
-
return Le(s) ? s.files : Ce(s) ? ot(e.refs).value : it(s) ? [...s.selectedOptions].map(({ value: r }) => r) : de(s) ? nt(e.refs).value : ut(S(s.value) ? e.ref.value : s.value, e);
|
|
197
|
-
}
|
|
198
|
-
var Lt = (e, s, r, a) => {
|
|
199
|
-
const u = {};
|
|
200
|
-
for (const n of e) {
|
|
201
|
-
const c = y(s, n);
|
|
202
|
-
c && m(u, n, c._f);
|
|
203
|
-
}
|
|
204
|
-
return {
|
|
205
|
-
criteriaMode: r,
|
|
206
|
-
names: [...e],
|
|
207
|
-
fields: u,
|
|
208
|
-
shouldUseNativeValidation: a
|
|
209
|
-
};
|
|
210
|
-
}, be = (e) => e instanceof RegExp, ue = (e) => S(e) ? e : be(e) ? e.source : D(e) ? be(e.value) ? e.value.source : e.value : e, Qe = (e) => ({
|
|
211
|
-
isOnSubmit: !e || e === q.onSubmit,
|
|
212
|
-
isOnBlur: e === q.onBlur,
|
|
213
|
-
isOnChange: e === q.onChange,
|
|
214
|
-
isOnAll: e === q.all,
|
|
215
|
-
isOnTouch: e === q.onTouched
|
|
216
|
-
});
|
|
217
|
-
const Xe = "AsyncFunction";
|
|
218
|
-
var Ct = (e) => !!e && !!e.validate && !!(W(e.validate) && e.validate.constructor.name === Xe || D(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === Xe)), Rt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Ze = (e, s, r) => !r && (s.watchAll || s.watch.has(e) || [...s.watch].some((a) => e.startsWith(a) && /^\.\w+/.test(e.slice(a.length))));
|
|
219
|
-
const fe = (e, s, r, a) => {
|
|
220
|
-
for (const u of r || Object.keys(e)) {
|
|
221
|
-
const n = y(e, u);
|
|
222
|
-
if (n) {
|
|
223
|
-
const { _f: c, ...h } = n;
|
|
224
|
-
if (c) {
|
|
225
|
-
if (c.refs && c.refs[0] && s(c.refs[0], u) && !a)
|
|
226
|
-
return !0;
|
|
227
|
-
if (c.ref && s(c.ref, c.name) && !a)
|
|
228
|
-
return !0;
|
|
229
|
-
if (fe(h, s))
|
|
230
|
-
break;
|
|
231
|
-
} else if (D(h) && fe(h, s))
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
function Ge(e, s, r) {
|
|
237
|
-
const a = y(e, r);
|
|
238
|
-
if (a || Te(r))
|
|
239
|
-
return {
|
|
240
|
-
error: a,
|
|
241
|
-
name: r
|
|
242
|
-
};
|
|
243
|
-
const u = r.split(".");
|
|
244
|
-
for (; u.length; ) {
|
|
245
|
-
const n = u.join("."), c = y(s, n), h = y(e, n);
|
|
246
|
-
if (c && !Array.isArray(c) && r !== n)
|
|
247
|
-
return { name: r };
|
|
248
|
-
if (h && h.type)
|
|
249
|
-
return {
|
|
250
|
-
name: n,
|
|
251
|
-
error: h
|
|
252
|
-
};
|
|
253
|
-
if (h && h.root && h.root.type)
|
|
254
|
-
return {
|
|
255
|
-
name: `${n}.root`,
|
|
256
|
-
error: h.root
|
|
257
|
-
};
|
|
258
|
-
u.pop();
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
name: r
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
var Mt = (e, s, r, a) => {
|
|
265
|
-
r(e);
|
|
266
|
-
const { name: u, ...n } = e;
|
|
267
|
-
return N(n) || Object.keys(n).length >= Object.keys(s).length || Object.keys(n).find((c) => s[c] === (!a || q.all));
|
|
268
|
-
}, Ut = (e, s, r) => !e || !s || e === s || oe(e).some((a) => a && (r ? a === s : a.startsWith(s) || s.startsWith(a))), Nt = (e, s, r, a, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(s || e) : (r ? a.isOnBlur : u.isOnBlur) ? !e : (r ? a.isOnChange : u.isOnChange) ? e : !0, Bt = (e, s) => !Ve(y(e, s)).length && T(e, s), It = (e, s, r) => {
|
|
269
|
-
const a = oe(y(e, r));
|
|
270
|
-
return m(a, "root", s[r]), m(e, r, a), e;
|
|
271
|
-
}, ge = (e) => Y(e);
|
|
272
|
-
function et(e, s, r = "validate") {
|
|
273
|
-
if (ge(e) || Array.isArray(e) && e.every(ge) || z(e) && !e)
|
|
274
|
-
return {
|
|
275
|
-
type: r,
|
|
276
|
-
message: ge(e) ? e : "",
|
|
277
|
-
ref: s
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
var ie = (e) => D(e) && !be(e) ? e : {
|
|
281
|
-
value: e,
|
|
282
|
-
message: ""
|
|
283
|
-
}, tt = async (e, s, r, a, u, n) => {
|
|
284
|
-
const { ref: c, refs: h, required: M, maxLength: H, minLength: x, min: E, max: v, pattern: ae, validate: Q, name: k, valueAsNumber: X, mount: Fe } = e._f, b = y(r, k);
|
|
285
|
-
if (!Fe || s.has(k))
|
|
286
|
-
return {};
|
|
287
|
-
const j = h ? h[0] : c, p = (_) => {
|
|
288
|
-
u && j.reportValidity && (j.setCustomValidity(z(_) ? "" : _ || ""), j.reportValidity());
|
|
289
|
-
}, O = {}, ce = Ce(c), Z = de(c), Ae = ce || Z, I = (X || Le(c)) && S(c.value) && S(b) || ve(c) && c.value === "" || b === "" || Array.isArray(b) && !b.length, te = St.bind(null, k, a, O), $ = (_, F, w, C = J.maxLength, U = J.minLength) => {
|
|
290
|
-
const K = _ ? F : w;
|
|
291
|
-
O[k] = {
|
|
292
|
-
type: _ ? C : U,
|
|
293
|
-
message: K,
|
|
294
|
-
ref: c,
|
|
295
|
-
...te(_ ? C : U, K)
|
|
296
|
-
};
|
|
297
|
-
};
|
|
298
|
-
if (n ? !Array.isArray(b) || !b.length : M && (!Ae && (I || R(b)) || z(b) && !b || Z && !nt(h).isValid || ce && !ot(h).isValid)) {
|
|
299
|
-
const { value: _, message: F } = ge(M) ? { value: !!M, message: M } : ie(M);
|
|
300
|
-
if (_ && (O[k] = {
|
|
301
|
-
type: J.required,
|
|
302
|
-
message: F,
|
|
303
|
-
ref: j,
|
|
304
|
-
...te(J.required, F)
|
|
305
|
-
}, !a))
|
|
306
|
-
return p(F), O;
|
|
307
|
-
}
|
|
308
|
-
if (!I && (!R(E) || !R(v))) {
|
|
309
|
-
let _, F;
|
|
310
|
-
const w = ie(v), C = ie(E);
|
|
311
|
-
if (!R(b) && !isNaN(b)) {
|
|
312
|
-
const U = c.valueAsNumber || b && +b;
|
|
313
|
-
R(w.value) || (_ = U > w.value), R(C.value) || (F = U < C.value);
|
|
314
|
-
} else {
|
|
315
|
-
const U = c.valueAsDate || new Date(b), K = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), le = c.type == "time", se = c.type == "week";
|
|
316
|
-
Y(w.value) && b && (_ = le ? K(b) > K(w.value) : se ? b > w.value : U > new Date(w.value)), Y(C.value) && b && (F = le ? K(b) < K(C.value) : se ? b < C.value : U < new Date(C.value));
|
|
317
|
-
}
|
|
318
|
-
if ((_ || F) && ($(!!_, w.message, C.message, J.max, J.min), !a))
|
|
319
|
-
return p(O[k].message), O;
|
|
320
|
-
}
|
|
321
|
-
if ((H || x) && !I && (Y(b) || n && Array.isArray(b))) {
|
|
322
|
-
const _ = ie(H), F = ie(x), w = !R(_.value) && b.length > +_.value, C = !R(F.value) && b.length < +F.value;
|
|
323
|
-
if ((w || C) && ($(w, _.message, F.message), !a))
|
|
324
|
-
return p(O[k].message), O;
|
|
325
|
-
}
|
|
326
|
-
if (ae && !I && Y(b)) {
|
|
327
|
-
const { value: _, message: F } = ie(ae);
|
|
328
|
-
if (be(_) && !b.match(_) && (O[k] = {
|
|
329
|
-
type: J.pattern,
|
|
330
|
-
message: F,
|
|
331
|
-
ref: c,
|
|
332
|
-
...te(J.pattern, F)
|
|
333
|
-
}, !a))
|
|
334
|
-
return p(F), O;
|
|
335
|
-
}
|
|
336
|
-
if (Q) {
|
|
337
|
-
if (W(Q)) {
|
|
338
|
-
const _ = await Q(b, r), F = et(_, j);
|
|
339
|
-
if (F && (O[k] = {
|
|
340
|
-
...F,
|
|
341
|
-
...te(J.validate, F.message)
|
|
342
|
-
}, !a))
|
|
343
|
-
return p(F.message), O;
|
|
344
|
-
} else if (D(Q)) {
|
|
345
|
-
let _ = {};
|
|
346
|
-
for (const F in Q) {
|
|
347
|
-
if (!N(_) && !a)
|
|
348
|
-
break;
|
|
349
|
-
const w = et(await Q[F](b, r), j, F);
|
|
350
|
-
w && (_ = {
|
|
351
|
-
...w,
|
|
352
|
-
...te(F, w.message)
|
|
353
|
-
}, p(w.message), a && (O[k] = _));
|
|
354
|
-
}
|
|
355
|
-
if (!N(_) && (O[k] = {
|
|
356
|
-
ref: j,
|
|
357
|
-
..._
|
|
358
|
-
}, !a))
|
|
359
|
-
return O;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
return p(!0), O;
|
|
363
|
-
};
|
|
364
|
-
const Pt = {
|
|
365
|
-
mode: q.onSubmit,
|
|
366
|
-
reValidateMode: q.onChange,
|
|
367
|
-
shouldFocusError: !0
|
|
368
|
-
};
|
|
369
|
-
function qt(e = {}) {
|
|
370
|
-
let s = {
|
|
371
|
-
...Pt,
|
|
372
|
-
...e
|
|
373
|
-
}, r = {
|
|
374
|
-
submitCount: 0,
|
|
375
|
-
isDirty: !1,
|
|
376
|
-
isReady: !1,
|
|
377
|
-
isLoading: W(s.defaultValues),
|
|
378
|
-
isValidating: !1,
|
|
379
|
-
isSubmitted: !1,
|
|
380
|
-
isSubmitting: !1,
|
|
381
|
-
isSubmitSuccessful: !1,
|
|
382
|
-
isValid: !1,
|
|
383
|
-
touchedFields: {},
|
|
384
|
-
dirtyFields: {},
|
|
385
|
-
validatingFields: {},
|
|
386
|
-
errors: s.errors || {},
|
|
387
|
-
disabled: s.disabled || !1
|
|
388
|
-
};
|
|
389
|
-
const a = {};
|
|
390
|
-
let u = D(s.defaultValues) || D(s.values) ? L(s.defaultValues || s.values) || {} : {}, n = s.shouldUnregister ? {} : L(u), c = {
|
|
391
|
-
action: !1,
|
|
392
|
-
mount: !1,
|
|
393
|
-
watch: !1
|
|
394
|
-
}, h = {
|
|
395
|
-
mount: /* @__PURE__ */ new Set(),
|
|
396
|
-
disabled: /* @__PURE__ */ new Set(),
|
|
397
|
-
unMount: /* @__PURE__ */ new Set(),
|
|
398
|
-
array: /* @__PURE__ */ new Set(),
|
|
399
|
-
watch: /* @__PURE__ */ new Set()
|
|
400
|
-
}, M, H = 0;
|
|
401
|
-
const x = {
|
|
402
|
-
isDirty: !1,
|
|
403
|
-
dirtyFields: !1,
|
|
404
|
-
validatingFields: !1,
|
|
405
|
-
touchedFields: !1,
|
|
406
|
-
isValidating: !1,
|
|
407
|
-
isValid: !1,
|
|
408
|
-
errors: !1
|
|
409
|
-
};
|
|
410
|
-
let E = {
|
|
411
|
-
...x
|
|
412
|
-
};
|
|
413
|
-
const v = {
|
|
414
|
-
array: Ke(),
|
|
415
|
-
state: Ke()
|
|
416
|
-
}, ae = s.criteriaMode === q.all, Q = (t) => (i) => {
|
|
417
|
-
clearTimeout(H), H = setTimeout(t, i);
|
|
418
|
-
}, k = async (t) => {
|
|
419
|
-
if (!s.disabled && (x.isValid || E.isValid || t)) {
|
|
420
|
-
const i = s.resolver ? N((await Z()).errors) : await I(a, !0);
|
|
421
|
-
i !== r.isValid && v.state.next({
|
|
422
|
-
isValid: i
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
}, X = (t, i) => {
|
|
426
|
-
!s.disabled && (x.isValidating || x.validatingFields || E.isValidating || E.validatingFields) && ((t || Array.from(h.mount)).forEach((l) => {
|
|
427
|
-
l && (i ? m(r.validatingFields, l, i) : T(r.validatingFields, l));
|
|
428
|
-
}), v.state.next({
|
|
429
|
-
validatingFields: r.validatingFields,
|
|
430
|
-
isValidating: !N(r.validatingFields)
|
|
431
|
-
}));
|
|
432
|
-
}, Fe = (t, i = [], l, d, f = !0, o = !0) => {
|
|
433
|
-
if (d && l && !s.disabled) {
|
|
434
|
-
if (c.action = !0, o && Array.isArray(y(a, t))) {
|
|
435
|
-
const g = l(y(a, t), d.argA, d.argB);
|
|
436
|
-
f && m(a, t, g);
|
|
437
|
-
}
|
|
438
|
-
if (o && Array.isArray(y(r.errors, t))) {
|
|
439
|
-
const g = l(y(r.errors, t), d.argA, d.argB);
|
|
440
|
-
f && m(r.errors, t, g), Bt(r.errors, t);
|
|
441
|
-
}
|
|
442
|
-
if ((x.touchedFields || E.touchedFields) && o && Array.isArray(y(r.touchedFields, t))) {
|
|
443
|
-
const g = l(y(r.touchedFields, t), d.argA, d.argB);
|
|
444
|
-
f && m(r.touchedFields, t, g);
|
|
445
|
-
}
|
|
446
|
-
(x.dirtyFields || E.dirtyFields) && (r.dirtyFields = ne(u, n)), v.state.next({
|
|
447
|
-
name: t,
|
|
448
|
-
isDirty: $(t, i),
|
|
449
|
-
dirtyFields: r.dirtyFields,
|
|
450
|
-
errors: r.errors,
|
|
451
|
-
isValid: r.isValid
|
|
452
|
-
});
|
|
453
|
-
} else
|
|
454
|
-
m(n, t, i);
|
|
455
|
-
}, b = (t, i) => {
|
|
456
|
-
m(r.errors, t, i), v.state.next({
|
|
457
|
-
errors: r.errors
|
|
458
|
-
});
|
|
459
|
-
}, j = (t) => {
|
|
460
|
-
r.errors = t, v.state.next({
|
|
461
|
-
errors: r.errors,
|
|
462
|
-
isValid: !1
|
|
463
|
-
});
|
|
464
|
-
}, p = (t, i, l, d) => {
|
|
465
|
-
const f = y(a, t);
|
|
466
|
-
if (f) {
|
|
467
|
-
const o = y(n, t, S(l) ? y(u, t) : l);
|
|
468
|
-
S(o) || d && d.defaultChecked || i ? m(n, t, i ? o : Je(f._f)) : w(t, o), c.mount && k();
|
|
469
|
-
}
|
|
470
|
-
}, O = (t, i, l, d, f) => {
|
|
471
|
-
let o = !1, g = !1;
|
|
472
|
-
const V = {
|
|
473
|
-
name: t
|
|
474
|
-
};
|
|
475
|
-
if (!s.disabled) {
|
|
476
|
-
if (!l || d) {
|
|
477
|
-
(x.isDirty || E.isDirty) && (g = r.isDirty, r.isDirty = V.isDirty = $(), o = g !== V.isDirty);
|
|
478
|
-
const A = ee(y(u, t), i);
|
|
479
|
-
g = !!y(r.dirtyFields, t), A ? T(r.dirtyFields, t) : m(r.dirtyFields, t, !0), V.dirtyFields = r.dirtyFields, o = o || (x.dirtyFields || E.dirtyFields) && g !== !A;
|
|
480
|
-
}
|
|
481
|
-
if (l) {
|
|
482
|
-
const A = y(r.touchedFields, t);
|
|
483
|
-
A || (m(r.touchedFields, t, l), V.touchedFields = r.touchedFields, o = o || (x.touchedFields || E.touchedFields) && A !== l);
|
|
484
|
-
}
|
|
485
|
-
o && f && v.state.next(V);
|
|
486
|
-
}
|
|
487
|
-
return o ? V : {};
|
|
488
|
-
}, ce = (t, i, l, d) => {
|
|
489
|
-
const f = y(r.errors, t), o = (x.isValid || E.isValid) && z(i) && r.isValid !== i;
|
|
490
|
-
if (s.delayError && l ? (M = Q(() => b(t, l)), M(s.delayError)) : (clearTimeout(H), M = null, l ? m(r.errors, t, l) : T(r.errors, t)), (l ? !ee(f, l) : f) || !N(d) || o) {
|
|
491
|
-
const g = {
|
|
492
|
-
...d,
|
|
493
|
-
...o && z(i) ? { isValid: i } : {},
|
|
494
|
-
errors: r.errors,
|
|
495
|
-
name: t
|
|
496
|
-
};
|
|
497
|
-
r = {
|
|
498
|
-
...r,
|
|
499
|
-
...g
|
|
500
|
-
}, v.state.next(g);
|
|
501
|
-
}
|
|
502
|
-
}, Z = async (t) => {
|
|
503
|
-
X(t, !0);
|
|
504
|
-
const i = await s.resolver(n, s.context, Lt(t || h.mount, a, s.criteriaMode, s.shouldUseNativeValidation));
|
|
505
|
-
return X(t), i;
|
|
506
|
-
}, Ae = async (t) => {
|
|
507
|
-
const { errors: i } = await Z(t);
|
|
508
|
-
if (t)
|
|
509
|
-
for (const l of t) {
|
|
510
|
-
const d = y(i, l);
|
|
511
|
-
d ? m(r.errors, l, d) : T(r.errors, l);
|
|
512
|
-
}
|
|
513
|
-
else
|
|
514
|
-
r.errors = i;
|
|
515
|
-
return i;
|
|
516
|
-
}, I = async (t, i, l = {
|
|
517
|
-
valid: !0
|
|
518
|
-
}) => {
|
|
519
|
-
for (const d in t) {
|
|
520
|
-
const f = t[d];
|
|
521
|
-
if (f) {
|
|
522
|
-
const { _f: o, ...g } = f;
|
|
523
|
-
if (o) {
|
|
524
|
-
const V = h.array.has(o.name), A = f._f && Ct(f._f);
|
|
525
|
-
A && x.validatingFields && X([d], !0);
|
|
526
|
-
const B = await tt(f, h.disabled, n, ae, s.shouldUseNativeValidation && !i, V);
|
|
527
|
-
if (A && x.validatingFields && X([d]), B[o.name] && (l.valid = !1, i))
|
|
528
|
-
break;
|
|
529
|
-
!i && (y(B, o.name) ? V ? It(r.errors, B, o.name) : m(r.errors, o.name, B[o.name]) : T(r.errors, o.name));
|
|
530
|
-
}
|
|
531
|
-
!N(g) && await I(g, i, l);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
return l.valid;
|
|
535
|
-
}, te = () => {
|
|
536
|
-
for (const t of h.unMount) {
|
|
537
|
-
const i = y(a, t);
|
|
538
|
-
i && (i._f.refs ? i._f.refs.every((l) => !Se(l)) : !Se(i._f.ref)) && me(t);
|
|
539
|
-
}
|
|
540
|
-
h.unMount = /* @__PURE__ */ new Set();
|
|
541
|
-
}, $ = (t, i) => !s.disabled && (t && i && m(n, t, i), !ee(ye(), u)), _ = (t, i, l) => Et(t, h, {
|
|
542
|
-
...c.mount ? n : S(i) ? u : Y(t) ? { [t]: i } : i
|
|
543
|
-
}, l, i), F = (t) => Ve(y(c.mount ? n : u, t, s.shouldUnregister ? y(u, t, []) : [])), w = (t, i, l = {}) => {
|
|
544
|
-
const d = y(a, t);
|
|
545
|
-
let f = i;
|
|
546
|
-
if (d) {
|
|
547
|
-
const o = d._f;
|
|
548
|
-
o && (!o.disabled && m(n, t, ut(i, o)), f = ve(o.ref) && R(i) ? "" : i, it(o.ref) ? [...o.ref.options].forEach((g) => g.selected = f.includes(g.value)) : o.refs ? de(o.ref) ? o.refs.forEach((g) => {
|
|
549
|
-
(!g.defaultChecked || !g.disabled) && (Array.isArray(f) ? g.checked = !!f.find((V) => V === g.value) : g.checked = f === g.value || !!f);
|
|
550
|
-
}) : o.refs.forEach((g) => g.checked = g.value === f) : Le(o.ref) ? o.ref.value = "" : (o.ref.value = f, o.ref.type || v.state.next({
|
|
551
|
-
name: t,
|
|
552
|
-
values: L(n)
|
|
553
|
-
})));
|
|
554
|
-
}
|
|
555
|
-
(l.shouldDirty || l.shouldTouch) && O(t, f, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && se(t);
|
|
556
|
-
}, C = (t, i, l) => {
|
|
557
|
-
for (const d in i) {
|
|
558
|
-
if (!i.hasOwnProperty(d))
|
|
559
|
-
return;
|
|
560
|
-
const f = i[d], o = t + "." + d, g = y(a, o);
|
|
561
|
-
(h.array.has(t) || D(f) || g && !g._f) && !re(f) ? C(o, f, l) : w(o, f, l);
|
|
562
|
-
}
|
|
563
|
-
}, U = (t, i, l = {}) => {
|
|
564
|
-
const d = y(a, t), f = h.array.has(t), o = L(i);
|
|
565
|
-
m(n, t, o), f ? (v.array.next({
|
|
566
|
-
name: t,
|
|
567
|
-
values: L(n)
|
|
568
|
-
}), (x.isDirty || x.dirtyFields || E.isDirty || E.dirtyFields) && l.shouldDirty && v.state.next({
|
|
569
|
-
name: t,
|
|
570
|
-
dirtyFields: ne(u, n),
|
|
571
|
-
isDirty: $(t, o)
|
|
572
|
-
})) : d && !d._f && !R(o) ? C(t, o, l) : w(t, o, l), Ze(t, h) && v.state.next({ ...r }), v.state.next({
|
|
573
|
-
name: c.mount ? t : void 0,
|
|
574
|
-
values: L(n)
|
|
575
|
-
});
|
|
576
|
-
}, K = async (t) => {
|
|
577
|
-
c.mount = !0;
|
|
578
|
-
const i = t.target;
|
|
579
|
-
let l = i.name, d = !0;
|
|
580
|
-
const f = y(a, l), o = (A) => {
|
|
581
|
-
d = Number.isNaN(A) || re(A) && isNaN(A.getTime()) || ee(A, y(n, l, A));
|
|
582
|
-
}, g = Qe(s.mode), V = Qe(s.reValidateMode);
|
|
583
|
-
if (f) {
|
|
584
|
-
let A, B;
|
|
585
|
-
const he = i.type ? Je(f._f) : Ft(t), G = t.type === $e.BLUR || t.type === $e.FOCUS_OUT, _t = !Rt(f._f) && !s.resolver && !y(r.errors, l) && !f._f.deps || Nt(G, y(r.touchedFields, l), r.isSubmitted, V, g), De = Ze(l, h, G);
|
|
586
|
-
m(n, l, he), G ? (f._f.onBlur && f._f.onBlur(t), M && M(0)) : f._f.onChange && f._f.onChange(t);
|
|
587
|
-
const Ee = O(l, he, G), bt = !N(Ee) || De;
|
|
588
|
-
if (!G && v.state.next({
|
|
589
|
-
name: l,
|
|
590
|
-
type: t.type,
|
|
591
|
-
values: L(n)
|
|
592
|
-
}), _t)
|
|
593
|
-
return (x.isValid || E.isValid) && (s.mode === "onBlur" ? G && k() : G || k()), bt && v.state.next({ name: l, ...De ? {} : Ee });
|
|
594
|
-
if (!G && De && v.state.next({ ...r }), s.resolver) {
|
|
595
|
-
const { errors: We } = await Z([l]);
|
|
596
|
-
if (o(he), d) {
|
|
597
|
-
const Vt = Ge(r.errors, a, l), He = Ge(We, a, Vt.name || l);
|
|
598
|
-
A = He.error, l = He.name, B = N(We);
|
|
599
|
-
}
|
|
600
|
-
} else
|
|
601
|
-
X([l], !0), A = (await tt(f, h.disabled, n, ae, s.shouldUseNativeValidation))[l], X([l]), o(he), d && (A ? B = !1 : (x.isValid || E.isValid) && (B = await I(a, !0)));
|
|
602
|
-
d && (f._f.deps && se(f._f.deps), ce(l, B, A, Ee));
|
|
603
|
-
}
|
|
604
|
-
}, le = (t, i) => {
|
|
605
|
-
if (y(r.errors, i) && t.focus)
|
|
606
|
-
return t.focus(), 1;
|
|
607
|
-
}, se = async (t, i = {}) => {
|
|
608
|
-
let l, d;
|
|
609
|
-
const f = oe(t);
|
|
610
|
-
if (s.resolver) {
|
|
611
|
-
const o = await Ae(S(t) ? t : f);
|
|
612
|
-
l = N(o), d = t ? !f.some((g) => y(o, g)) : l;
|
|
613
|
-
} else t ? (d = (await Promise.all(f.map(async (o) => {
|
|
614
|
-
const g = y(a, o);
|
|
615
|
-
return await I(g && g._f ? { [o]: g } : g);
|
|
616
|
-
}))).every(Boolean), !(!d && !r.isValid) && k()) : d = l = await I(a);
|
|
617
|
-
return v.state.next({
|
|
618
|
-
...!Y(t) || (x.isValid || E.isValid) && l !== r.isValid ? {} : { name: t },
|
|
619
|
-
...s.resolver || !t ? { isValid: l } : {},
|
|
620
|
-
errors: r.errors
|
|
621
|
-
}), i.shouldFocus && !d && fe(a, le, t ? f : h.mount), d;
|
|
622
|
-
}, ye = (t) => {
|
|
623
|
-
const i = {
|
|
624
|
-
...c.mount ? n : u
|
|
625
|
-
};
|
|
626
|
-
return S(t) ? i : Y(t) ? y(i, t) : t.map((l) => y(i, l));
|
|
627
|
-
}, Re = (t, i) => ({
|
|
628
|
-
invalid: !!y((i || r).errors, t),
|
|
629
|
-
isDirty: !!y((i || r).dirtyFields, t),
|
|
630
|
-
error: y((i || r).errors, t),
|
|
631
|
-
isValidating: !!y(r.validatingFields, t),
|
|
632
|
-
isTouched: !!y((i || r).touchedFields, t)
|
|
633
|
-
}), ft = (t) => {
|
|
634
|
-
t && oe(t).forEach((i) => T(r.errors, i)), v.state.next({
|
|
635
|
-
errors: t ? r.errors : {}
|
|
636
|
-
});
|
|
637
|
-
}, Me = (t, i, l) => {
|
|
638
|
-
const d = (y(a, t, { _f: {} })._f || {}).ref, f = y(r.errors, t) || {}, { ref: o, message: g, type: V, ...A } = f;
|
|
639
|
-
m(r.errors, t, {
|
|
640
|
-
...A,
|
|
641
|
-
...i,
|
|
642
|
-
ref: d
|
|
643
|
-
}), v.state.next({
|
|
644
|
-
name: t,
|
|
645
|
-
errors: r.errors,
|
|
646
|
-
isValid: !1
|
|
647
|
-
}), l && l.shouldFocus && d && d.focus && d.focus();
|
|
648
|
-
}, dt = (t, i) => W(t) ? v.state.subscribe({
|
|
649
|
-
next: (l) => t(_(void 0, i), l)
|
|
650
|
-
}) : _(t, i, !0), Ue = (t) => v.state.subscribe({
|
|
651
|
-
next: (i) => {
|
|
652
|
-
Ut(t.name, i.name, t.exact) && Mt(i, t.formState || x, vt, t.reRenderRoot) && t.callback({
|
|
653
|
-
values: { ...n },
|
|
654
|
-
...r,
|
|
655
|
-
...i
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
}).unsubscribe, ct = (t) => (c.mount = !0, E = {
|
|
659
|
-
...E,
|
|
660
|
-
...t.formState
|
|
661
|
-
}, Ue({
|
|
662
|
-
...t,
|
|
663
|
-
formState: E
|
|
664
|
-
})), me = (t, i = {}) => {
|
|
665
|
-
for (const l of t ? oe(t) : h.mount)
|
|
666
|
-
h.mount.delete(l), h.array.delete(l), i.keepValue || (T(a, l), T(n, l)), !i.keepError && T(r.errors, l), !i.keepDirty && T(r.dirtyFields, l), !i.keepTouched && T(r.touchedFields, l), !i.keepIsValidating && T(r.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && T(u, l);
|
|
667
|
-
v.state.next({
|
|
668
|
-
values: L(n)
|
|
669
|
-
}), v.state.next({
|
|
670
|
-
...r,
|
|
671
|
-
...i.keepDirty ? { isDirty: $() } : {}
|
|
672
|
-
}), !i.keepIsValid && k();
|
|
673
|
-
}, Ne = ({ disabled: t, name: i }) => {
|
|
674
|
-
(z(t) && c.mount || t || h.disabled.has(i)) && (t ? h.disabled.add(i) : h.disabled.delete(i));
|
|
675
|
-
}, xe = (t, i = {}) => {
|
|
676
|
-
let l = y(a, t);
|
|
677
|
-
const d = z(i.disabled) || z(s.disabled);
|
|
678
|
-
return m(a, t, {
|
|
679
|
-
...l || {},
|
|
680
|
-
_f: {
|
|
681
|
-
...l && l._f ? l._f : { ref: { name: t } },
|
|
682
|
-
name: t,
|
|
683
|
-
mount: !0,
|
|
684
|
-
...i
|
|
685
|
-
}
|
|
686
|
-
}), h.mount.add(t), l ? Ne({
|
|
687
|
-
disabled: z(i.disabled) ? i.disabled : s.disabled,
|
|
688
|
-
name: t
|
|
689
|
-
}) : p(t, !0, i.value), {
|
|
690
|
-
...d ? { disabled: i.disabled || s.disabled } : {},
|
|
691
|
-
...s.progressive ? {
|
|
692
|
-
required: !!i.required,
|
|
693
|
-
min: ue(i.min),
|
|
694
|
-
max: ue(i.max),
|
|
695
|
-
minLength: ue(i.minLength),
|
|
696
|
-
maxLength: ue(i.maxLength),
|
|
697
|
-
pattern: ue(i.pattern)
|
|
698
|
-
} : {},
|
|
699
|
-
name: t,
|
|
700
|
-
onChange: K,
|
|
701
|
-
onBlur: K,
|
|
702
|
-
ref: (f) => {
|
|
703
|
-
if (f) {
|
|
704
|
-
xe(t, i), l = y(a, t);
|
|
705
|
-
const o = S(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = kt(o), V = l._f.refs || [];
|
|
706
|
-
if (g ? V.find((A) => A === o) : o === l._f.ref)
|
|
707
|
-
return;
|
|
708
|
-
m(a, t, {
|
|
709
|
-
_f: {
|
|
710
|
-
...l._f,
|
|
711
|
-
...g ? {
|
|
712
|
-
refs: [
|
|
713
|
-
...V.filter(Se),
|
|
714
|
-
o,
|
|
715
|
-
...Array.isArray(y(u, t)) ? [{}] : []
|
|
716
|
-
],
|
|
717
|
-
ref: { type: o.type, name: t }
|
|
718
|
-
} : { ref: o }
|
|
719
|
-
}
|
|
720
|
-
}), p(t, !1, void 0, o);
|
|
721
|
-
} else
|
|
722
|
-
l = y(a, t, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(mt(h.array, t) && c.action) && h.unMount.add(t);
|
|
723
|
-
}
|
|
724
|
-
};
|
|
725
|
-
}, we = () => s.shouldFocusError && fe(a, le, h.mount), yt = (t) => {
|
|
726
|
-
z(t) && (v.state.next({ disabled: t }), fe(a, (i, l) => {
|
|
727
|
-
const d = y(a, l);
|
|
728
|
-
d && (i.disabled = d._f.disabled || t, Array.isArray(d._f.refs) && d._f.refs.forEach((f) => {
|
|
729
|
-
f.disabled = d._f.disabled || t;
|
|
730
|
-
}));
|
|
731
|
-
}, 0, !1));
|
|
732
|
-
}, Be = (t, i) => async (l) => {
|
|
733
|
-
let d;
|
|
734
|
-
l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
|
|
735
|
-
let f = L(n);
|
|
736
|
-
if (v.state.next({
|
|
737
|
-
isSubmitting: !0
|
|
738
|
-
}), s.resolver) {
|
|
739
|
-
const { errors: o, values: g } = await Z();
|
|
740
|
-
r.errors = o, f = g;
|
|
741
|
-
} else
|
|
742
|
-
await I(a);
|
|
743
|
-
if (h.disabled.size)
|
|
744
|
-
for (const o of h.disabled)
|
|
745
|
-
m(f, o, void 0);
|
|
746
|
-
if (T(r.errors, "root"), N(r.errors)) {
|
|
747
|
-
v.state.next({
|
|
748
|
-
errors: {}
|
|
749
|
-
});
|
|
750
|
-
try {
|
|
751
|
-
await t(f, l);
|
|
752
|
-
} catch (o) {
|
|
753
|
-
d = o;
|
|
754
|
-
}
|
|
755
|
-
} else
|
|
756
|
-
i && await i({ ...r.errors }, l), we(), setTimeout(we);
|
|
757
|
-
if (v.state.next({
|
|
758
|
-
isSubmitted: !0,
|
|
759
|
-
isSubmitting: !1,
|
|
760
|
-
isSubmitSuccessful: N(r.errors) && !d,
|
|
761
|
-
submitCount: r.submitCount + 1,
|
|
762
|
-
errors: r.errors
|
|
763
|
-
}), d)
|
|
764
|
-
throw d;
|
|
765
|
-
}, ht = (t, i = {}) => {
|
|
766
|
-
y(a, t) && (S(i.defaultValue) ? U(t, L(y(u, t))) : (U(t, i.defaultValue), m(u, t, L(i.defaultValue))), i.keepTouched || T(r.touchedFields, t), i.keepDirty || (T(r.dirtyFields, t), r.isDirty = i.defaultValue ? $(t, L(y(u, t))) : $()), i.keepError || (T(r.errors, t), x.isValid && k()), v.state.next({ ...r }));
|
|
767
|
-
}, Ie = (t, i = {}) => {
|
|
768
|
-
const l = t ? L(t) : u, d = L(l), f = N(t), o = f ? u : d;
|
|
769
|
-
if (i.keepDefaultValues || (u = l), !i.keepValues) {
|
|
770
|
-
if (i.keepDirtyValues) {
|
|
771
|
-
const g = /* @__PURE__ */ new Set([
|
|
772
|
-
...h.mount,
|
|
773
|
-
...Object.keys(ne(u, n))
|
|
774
|
-
]);
|
|
775
|
-
for (const V of Array.from(g))
|
|
776
|
-
y(r.dirtyFields, V) ? m(o, V, y(n, V)) : U(V, y(o, V));
|
|
777
|
-
} else {
|
|
778
|
-
if (Oe && S(t))
|
|
779
|
-
for (const g of h.mount) {
|
|
780
|
-
const V = y(a, g);
|
|
781
|
-
if (V && V._f) {
|
|
782
|
-
const A = Array.isArray(V._f.refs) ? V._f.refs[0] : V._f.ref;
|
|
783
|
-
if (ve(A)) {
|
|
784
|
-
const B = A.closest("form");
|
|
785
|
-
if (B) {
|
|
786
|
-
B.reset();
|
|
787
|
-
break;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
for (const g of h.mount)
|
|
793
|
-
U(g, y(o, g));
|
|
794
|
-
}
|
|
795
|
-
n = L(o), v.array.next({
|
|
796
|
-
values: { ...o }
|
|
797
|
-
}), v.state.next({
|
|
798
|
-
values: { ...o }
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
h = {
|
|
802
|
-
mount: i.keepDirtyValues ? h.mount : /* @__PURE__ */ new Set(),
|
|
803
|
-
unMount: /* @__PURE__ */ new Set(),
|
|
804
|
-
array: /* @__PURE__ */ new Set(),
|
|
805
|
-
disabled: /* @__PURE__ */ new Set(),
|
|
806
|
-
watch: /* @__PURE__ */ new Set(),
|
|
807
|
-
watchAll: !1,
|
|
808
|
-
focus: ""
|
|
809
|
-
}, c.mount = !x.isValid || !!i.keepIsValid || !!i.keepDirtyValues, c.watch = !!s.shouldUnregister, v.state.next({
|
|
810
|
-
submitCount: i.keepSubmitCount ? r.submitCount : 0,
|
|
811
|
-
isDirty: f ? !1 : i.keepDirty ? r.isDirty : !!(i.keepDefaultValues && !ee(t, u)),
|
|
812
|
-
isSubmitted: i.keepIsSubmitted ? r.isSubmitted : !1,
|
|
813
|
-
dirtyFields: f ? {} : i.keepDirtyValues ? i.keepDefaultValues && n ? ne(u, n) : r.dirtyFields : i.keepDefaultValues && t ? ne(u, t) : i.keepDirty ? r.dirtyFields : {},
|
|
814
|
-
touchedFields: i.keepTouched ? r.touchedFields : {},
|
|
815
|
-
errors: i.keepErrors ? r.errors : {},
|
|
816
|
-
isSubmitSuccessful: i.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
|
|
817
|
-
isSubmitting: !1
|
|
818
|
-
});
|
|
819
|
-
}, Pe = (t, i) => Ie(W(t) ? t(n) : t, i), gt = (t, i = {}) => {
|
|
820
|
-
const l = y(a, t), d = l && l._f;
|
|
821
|
-
if (d) {
|
|
822
|
-
const f = d.refs ? d.refs[0] : d.ref;
|
|
823
|
-
f.focus && (f.focus(), i.shouldSelect && W(f.select) && f.select());
|
|
824
|
-
}
|
|
825
|
-
}, vt = (t) => {
|
|
826
|
-
r = {
|
|
827
|
-
...r,
|
|
828
|
-
...t
|
|
829
|
-
};
|
|
830
|
-
}, qe = {
|
|
831
|
-
control: {
|
|
832
|
-
register: xe,
|
|
833
|
-
unregister: me,
|
|
834
|
-
getFieldState: Re,
|
|
835
|
-
handleSubmit: Be,
|
|
836
|
-
setError: Me,
|
|
837
|
-
_subscribe: Ue,
|
|
838
|
-
_runSchema: Z,
|
|
839
|
-
_focusError: we,
|
|
840
|
-
_getWatch: _,
|
|
841
|
-
_getDirty: $,
|
|
842
|
-
_setValid: k,
|
|
843
|
-
_setFieldArray: Fe,
|
|
844
|
-
_setDisabledField: Ne,
|
|
845
|
-
_setErrors: j,
|
|
846
|
-
_getFieldArray: F,
|
|
847
|
-
_reset: Ie,
|
|
848
|
-
_resetDefaultValues: () => W(s.defaultValues) && s.defaultValues().then((t) => {
|
|
849
|
-
Pe(t, s.resetOptions), v.state.next({
|
|
850
|
-
isLoading: !1
|
|
851
|
-
});
|
|
852
|
-
}),
|
|
853
|
-
_removeUnmounted: te,
|
|
854
|
-
_disableForm: yt,
|
|
855
|
-
_subjects: v,
|
|
856
|
-
_proxyFormState: x,
|
|
857
|
-
get _fields() {
|
|
858
|
-
return a;
|
|
859
|
-
},
|
|
860
|
-
get _formValues() {
|
|
861
|
-
return n;
|
|
862
|
-
},
|
|
863
|
-
get _state() {
|
|
864
|
-
return c;
|
|
865
|
-
},
|
|
866
|
-
set _state(t) {
|
|
867
|
-
c = t;
|
|
868
|
-
},
|
|
869
|
-
get _defaultValues() {
|
|
870
|
-
return u;
|
|
871
|
-
},
|
|
872
|
-
get _names() {
|
|
873
|
-
return h;
|
|
874
|
-
},
|
|
875
|
-
set _names(t) {
|
|
876
|
-
h = t;
|
|
877
|
-
},
|
|
878
|
-
get _formState() {
|
|
879
|
-
return r;
|
|
880
|
-
},
|
|
881
|
-
get _options() {
|
|
882
|
-
return s;
|
|
883
|
-
},
|
|
884
|
-
set _options(t) {
|
|
885
|
-
s = {
|
|
886
|
-
...s,
|
|
887
|
-
...t
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
},
|
|
891
|
-
subscribe: ct,
|
|
892
|
-
trigger: se,
|
|
893
|
-
register: xe,
|
|
894
|
-
handleSubmit: Be,
|
|
895
|
-
watch: dt,
|
|
896
|
-
setValue: U,
|
|
897
|
-
getValues: ye,
|
|
898
|
-
reset: Pe,
|
|
899
|
-
resetField: ht,
|
|
900
|
-
clearErrors: ft,
|
|
901
|
-
unregister: me,
|
|
902
|
-
setError: Me,
|
|
903
|
-
setFocus: gt,
|
|
904
|
-
getFieldState: Re
|
|
905
|
-
};
|
|
906
|
-
return {
|
|
907
|
-
...qe,
|
|
908
|
-
formControl: qe
|
|
909
|
-
};
|
|
910
|
-
}
|
|
911
|
-
function pt(e = {}) {
|
|
912
|
-
const s = P.useRef(void 0), r = P.useRef(void 0), [a, u] = P.useState({
|
|
913
|
-
isDirty: !1,
|
|
914
|
-
isValidating: !1,
|
|
915
|
-
isLoading: W(e.defaultValues),
|
|
916
|
-
isSubmitted: !1,
|
|
917
|
-
isSubmitting: !1,
|
|
918
|
-
isSubmitSuccessful: !1,
|
|
919
|
-
isValid: !1,
|
|
920
|
-
submitCount: 0,
|
|
921
|
-
dirtyFields: {},
|
|
922
|
-
touchedFields: {},
|
|
923
|
-
validatingFields: {},
|
|
924
|
-
errors: e.errors || {},
|
|
925
|
-
disabled: e.disabled || !1,
|
|
926
|
-
isReady: !1,
|
|
927
|
-
defaultValues: W(e.defaultValues) ? void 0 : e.defaultValues
|
|
928
|
-
});
|
|
929
|
-
s.current || (s.current = {
|
|
930
|
-
...e.formControl ? e.formControl : qt(e),
|
|
931
|
-
formState: a
|
|
932
|
-
}, e.formControl && e.defaultValues && !W(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
|
|
933
|
-
const n = s.current.control;
|
|
934
|
-
return n._options = e, Dt(() => {
|
|
935
|
-
const c = n._subscribe({
|
|
936
|
-
formState: n._proxyFormState,
|
|
937
|
-
callback: () => u({ ...n._formState }),
|
|
938
|
-
reRenderRoot: !0
|
|
939
|
-
});
|
|
940
|
-
return u((h) => ({
|
|
941
|
-
...h,
|
|
942
|
-
isReady: !0
|
|
943
|
-
})), n._formState.isReady = !0, c;
|
|
944
|
-
}, [n]), P.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), P.useEffect(() => {
|
|
945
|
-
e.mode && (n._options.mode = e.mode), e.reValidateMode && (n._options.reValidateMode = e.reValidateMode);
|
|
946
|
-
}, [n, e.mode, e.reValidateMode]), P.useEffect(() => {
|
|
947
|
-
e.errors && (n._setErrors(e.errors), n._focusError());
|
|
948
|
-
}, [n, e.errors]), P.useEffect(() => {
|
|
949
|
-
e.shouldUnregister && n._subjects.state.next({
|
|
950
|
-
values: n._getWatch()
|
|
951
|
-
});
|
|
952
|
-
}, [n, e.shouldUnregister]), P.useEffect(() => {
|
|
953
|
-
if (n._proxyFormState.isDirty) {
|
|
954
|
-
const c = n._getDirty();
|
|
955
|
-
c !== a.isDirty && n._subjects.state.next({
|
|
956
|
-
isDirty: c
|
|
957
|
-
});
|
|
958
|
-
}
|
|
959
|
-
}, [n, a.isDirty]), P.useEffect(() => {
|
|
960
|
-
e.values && !ee(e.values, r.current) ? (n._reset(e.values, n._options.resetOptions), r.current = e.values, u((c) => ({ ...c }))) : n._resetDefaultValues();
|
|
961
|
-
}, [n, e.values]), P.useEffect(() => {
|
|
962
|
-
n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
|
|
963
|
-
}), s.current.formState = wt(a, n), s.current;
|
|
964
|
-
}
|
|
965
|
-
export {
|
|
966
|
-
St as a,
|
|
967
|
-
y as g,
|
|
968
|
-
m as s,
|
|
969
|
-
pt as u
|
|
970
|
-
};
|