@ram_28/kf-ai-sdk 1.0.18 → 1.0.20
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/README.md +45 -12
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +2 -2
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +1 -1
- package/dist/{client-C15j4O5B.cjs → client-DgtkT50N.cjs} +1 -1
- package/dist/{client-CfvLiGfP.js → client-V-WzUb8H.js} +9 -5
- package/dist/components/hooks/useFilter/types.d.ts +14 -11
- package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/context.d.ts +1 -1
- package/dist/components/hooks/useKanban/context.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/types.d.ts +5 -22
- package/dist/components/hooks/useKanban/types.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/useKanban.d.ts.map +1 -1
- package/dist/components/hooks/useTable/types.d.ts +19 -31
- package/dist/components/hooks/useTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/error-handling-CAoD0Kwb.cjs +1 -0
- package/dist/error-handling-CrhTtD88.js +14 -0
- package/dist/filter.cjs +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +825 -814
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/kanban.cjs +2 -2
- package/dist/kanban.mjs +335 -323
- package/dist/{metadata-2FLBsFcf.cjs → metadata-0lZAfuTP.cjs} +1 -1
- package/dist/{metadata-DBcoDth-.js → metadata-B88D_pVS.js} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +113 -96
- package/dist/table.types.d.ts +1 -1
- package/dist/table.types.d.ts.map +1 -1
- package/dist/types/common.d.ts +26 -6
- package/dist/types/common.d.ts.map +1 -1
- package/dist/useFilter-DzpP_ag0.cjs +1 -0
- package/dist/useFilter-H5bgAZQF.js +120 -0
- package/dist/utils/api/buildListOptions.d.ts +43 -0
- package/dist/utils/api/buildListOptions.d.ts.map +1 -0
- package/dist/utils/api/index.d.ts +2 -0
- package/dist/utils/api/index.d.ts.map +1 -0
- package/dist/utils/error-handling.d.ts +41 -0
- package/dist/utils/error-handling.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/docs/QUICK_REFERENCE.md +142 -420
- package/docs/useAuth.md +52 -340
- package/docs/useFilter.md +858 -162
- package/docs/useForm.md +712 -501
- package/docs/useKanban.md +534 -279
- package/docs/useTable.md +725 -214
- package/package.json +1 -1
- package/sdk/api/client.ts +7 -1
- package/sdk/components/hooks/useFilter/types.ts +14 -11
- package/sdk/components/hooks/useFilter/useFilter.ts +20 -18
- package/sdk/components/hooks/useForm/apiClient.ts +2 -1
- package/sdk/components/hooks/useForm/useForm.ts +47 -13
- package/sdk/components/hooks/useKanban/context.ts +5 -3
- package/sdk/components/hooks/useKanban/types.ts +7 -23
- package/sdk/components/hooks/useKanban/useKanban.ts +54 -18
- package/sdk/components/hooks/useTable/types.ts +26 -32
- package/sdk/components/hooks/useTable/useTable.llm.txt +8 -22
- package/sdk/components/hooks/useTable/useTable.ts +70 -25
- package/sdk/index.ts +154 -10
- package/sdk/table.types.ts +3 -0
- package/sdk/types/common.ts +31 -6
- package/sdk/utils/api/buildListOptions.ts +120 -0
- package/sdk/utils/api/index.ts +2 -0
- package/sdk/utils/error-handling.ts +150 -0
- package/sdk/utils/index.ts +6 -0
- package/dist/useFilter-Dofowpr_.cjs +0 -1
- package/dist/useFilter-Dv-mr9QW.js +0 -117
package/dist/form.mjs
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import X, { useState as
|
|
5
|
-
import { useQuery as
|
|
6
|
-
import { a as
|
|
7
|
-
import { g as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var Pt = Object.defineProperty;
|
|
2
|
+
var qt = (e, t, r) => t in e ? Pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var ve = (e, t, r) => qt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import X, { useState as ge, useRef as Ne, useEffect as He, useMemo as Oe, useCallback as te } from "react";
|
|
5
|
+
import { useQuery as ft } from "@tanstack/react-query";
|
|
6
|
+
import { a as be } from "./client-V-WzUb8H.js";
|
|
7
|
+
import { g as $t } from "./metadata-B88D_pVS.js";
|
|
8
|
+
import { t as Ve } from "./error-handling-CrhTtD88.js";
|
|
9
|
+
var Me = (e) => e.type === "checkbox", pe = (e) => e instanceof Date, J = (e) => e == null;
|
|
10
|
+
const Nt = (e) => typeof e == "object";
|
|
11
|
+
var U = (e) => !J(e) && !Array.isArray(e) && Nt(e) && !pe(e), jt = (e) => U(e) && e.target ? Me(e.target) ? e.target.checked : e.target.value : e, Wt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Ht = (e, t) => e.has(Wt(t)), Yt = (e) => {
|
|
11
12
|
const t = e.constructor && e.constructor.prototype;
|
|
12
|
-
return
|
|
13
|
-
},
|
|
14
|
-
function
|
|
13
|
+
return U(t) && t.hasOwnProperty("isPrototypeOf");
|
|
14
|
+
}, it = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
15
|
+
function P(e) {
|
|
15
16
|
if (e instanceof Date)
|
|
16
17
|
return new Date(e);
|
|
17
18
|
const t = typeof FileList < "u" && e instanceof FileList;
|
|
18
|
-
if (
|
|
19
|
+
if (it && (e instanceof Blob || t))
|
|
19
20
|
return e;
|
|
20
21
|
const r = Array.isArray(e);
|
|
21
|
-
if (!r && !(
|
|
22
|
+
if (!r && !(U(e) && Yt(e)))
|
|
22
23
|
return e;
|
|
23
24
|
const s = r ? [] : Object.create(Object.getPrototypeOf(e));
|
|
24
25
|
for (const i in e)
|
|
25
|
-
Object.prototype.hasOwnProperty.call(e, i) && (s[i] =
|
|
26
|
+
Object.prototype.hasOwnProperty.call(e, i) && (s[i] = P(e[i]));
|
|
26
27
|
return s;
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
-
if (!t || !
|
|
29
|
+
var ze = (e) => /^\w*$/.test(e), T = (e) => e === void 0, at = (e) => Array.isArray(e) ? e.filter(Boolean) : [], nt = (e) => at(e.replace(/["|']|\]/g, "").split(/\.|\[/)), g = (e, t, r) => {
|
|
30
|
+
if (!t || !U(e))
|
|
30
31
|
return r;
|
|
31
|
-
const s = (
|
|
32
|
-
return
|
|
33
|
-
}, ie = (e) => typeof e == "boolean", re = (e) => typeof e == "function",
|
|
32
|
+
const s = (ze(t) ? [t] : nt(t)).reduce((i, n) => J(i) ? i : i[n], e);
|
|
33
|
+
return T(s) || s === e ? T(e[t]) ? r : e[t] : s;
|
|
34
|
+
}, ie = (e) => typeof e == "boolean", re = (e) => typeof e == "function", N = (e, t, r) => {
|
|
34
35
|
let s = -1;
|
|
35
|
-
const i =
|
|
36
|
+
const i = ze(t) ? [t] : nt(t), n = i.length, l = n - 1;
|
|
36
37
|
for (; ++s < n; ) {
|
|
37
|
-
const
|
|
38
|
+
const f = i[s];
|
|
38
39
|
let w = r;
|
|
39
40
|
if (s !== l) {
|
|
40
|
-
const
|
|
41
|
-
w =
|
|
41
|
+
const b = e[f];
|
|
42
|
+
w = U(b) || Array.isArray(b) ? b : isNaN(+i[s + 1]) ? {} : [];
|
|
42
43
|
}
|
|
43
|
-
if (
|
|
44
|
+
if (f === "__proto__" || f === "constructor" || f === "prototype")
|
|
44
45
|
return;
|
|
45
|
-
e[
|
|
46
|
+
e[f] = w, e = e[f];
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
|
-
const
|
|
49
|
+
const ht = {
|
|
49
50
|
BLUR: "blur",
|
|
50
51
|
FOCUS_OUT: "focusout"
|
|
51
52
|
}, se = {
|
|
@@ -62,9 +63,9 @@ const dt = {
|
|
|
62
63
|
pattern: "pattern",
|
|
63
64
|
required: "required",
|
|
64
65
|
validate: "validate"
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
var
|
|
66
|
+
}, Kt = X.createContext(null);
|
|
67
|
+
Kt.displayName = "HookFormContext";
|
|
68
|
+
var zt = (e, t, r, s = !0) => {
|
|
68
69
|
const i = {
|
|
69
70
|
defaultValues: t._defaultValues
|
|
70
71
|
};
|
|
@@ -77,12 +78,12 @@ var Kt = (e, t, r, s = !0) => {
|
|
|
77
78
|
});
|
|
78
79
|
return i;
|
|
79
80
|
};
|
|
80
|
-
const
|
|
81
|
-
var Q = (e) => typeof e == "string",
|
|
82
|
-
function
|
|
83
|
-
if (
|
|
81
|
+
const Jt = typeof window < "u" ? X.useLayoutEffect : X.useEffect;
|
|
82
|
+
var Q = (e) => typeof e == "string", Gt = (e, t, r, s, i) => Q(e) ? (s && t.watch.add(e), g(r, e, i)) : Array.isArray(e) ? e.map((n) => (s && t.watch.add(n), g(r, n))) : (s && (t.watchAll = !0), r), rt = (e) => J(e) || !Nt(e);
|
|
83
|
+
function he(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
84
|
+
if (rt(e) || rt(t))
|
|
84
85
|
return Object.is(e, t);
|
|
85
|
-
if (
|
|
86
|
+
if (pe(e) && pe(t))
|
|
86
87
|
return Object.is(e.getTime(), t.getTime());
|
|
87
88
|
const s = Object.keys(e), i = Object.keys(t);
|
|
88
89
|
if (s.length !== i.length)
|
|
@@ -95,20 +96,20 @@ function de(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
|
95
96
|
if (!i.includes(n))
|
|
96
97
|
return !1;
|
|
97
98
|
if (n !== "ref") {
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
99
|
+
const f = t[n];
|
|
100
|
+
if (pe(l) && pe(f) || U(l) && U(f) || Array.isArray(l) && Array.isArray(f) ? !he(l, f, r) : !Object.is(l, f))
|
|
100
101
|
return !1;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
return !0;
|
|
104
105
|
}
|
|
105
|
-
var
|
|
106
|
+
var Xt = (e, t, r, s, i) => t ? {
|
|
106
107
|
...r[e],
|
|
107
108
|
types: {
|
|
108
109
|
...r[e] && r[e].types ? r[e].types : {},
|
|
109
110
|
[s]: i || !0
|
|
110
111
|
}
|
|
111
|
-
} : {},
|
|
112
|
+
} : {}, Te = (e) => Array.isArray(e) ? e : [e], mt = () => {
|
|
112
113
|
let e = [];
|
|
113
114
|
return {
|
|
114
115
|
get observers() {
|
|
@@ -128,75 +129,75 @@ var Gt = (e, t, r, s, i) => t ? {
|
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
};
|
|
131
|
-
function
|
|
132
|
+
function Ot(e, t) {
|
|
132
133
|
const r = {};
|
|
133
134
|
for (const s in e)
|
|
134
135
|
if (e.hasOwnProperty(s)) {
|
|
135
136
|
const i = e[s], n = t[s];
|
|
136
|
-
if (i &&
|
|
137
|
-
const l =
|
|
138
|
-
|
|
137
|
+
if (i && U(i) && n) {
|
|
138
|
+
const l = Ot(i, n);
|
|
139
|
+
U(l) && (r[s] = l);
|
|
139
140
|
} else e[s] && (r[s] = n);
|
|
140
141
|
}
|
|
141
142
|
return r;
|
|
142
143
|
}
|
|
143
|
-
var
|
|
144
|
-
if (!
|
|
144
|
+
var H = (e) => U(e) && !Object.keys(e).length, ut = (e) => e.type === "file", Ye = (e) => {
|
|
145
|
+
if (!it)
|
|
145
146
|
return !1;
|
|
146
147
|
const t = e ? e.ownerDocument : 0;
|
|
147
148
|
return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
|
|
148
|
-
},
|
|
149
|
-
function
|
|
149
|
+
}, Ct = (e) => e.type === "select-multiple", ot = (e) => e.type === "radio", Qt = (e) => ot(e) || Me(e), et = (e) => Ye(e) && e.isConnected;
|
|
150
|
+
function Zt(e, t) {
|
|
150
151
|
const r = t.slice(0, -1).length;
|
|
151
152
|
let s = 0;
|
|
152
153
|
for (; s < r; )
|
|
153
|
-
e =
|
|
154
|
+
e = T(e) ? s++ : e[t[s++]];
|
|
154
155
|
return e;
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
+
function er(e) {
|
|
157
158
|
for (const t in e)
|
|
158
|
-
if (e.hasOwnProperty(t) && !
|
|
159
|
+
if (e.hasOwnProperty(t) && !T(e[t]))
|
|
159
160
|
return !1;
|
|
160
161
|
return !0;
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
-
const r = Array.isArray(t) ? t :
|
|
164
|
-
return s && delete s[n], i !== 0 && (
|
|
163
|
+
function k(e, t) {
|
|
164
|
+
const r = Array.isArray(t) ? t : ze(t) ? [t] : nt(t), s = r.length === 1 ? e : Zt(e, r), i = r.length - 1, n = r[i];
|
|
165
|
+
return s && delete s[n], i !== 0 && (U(s) && H(s) || Array.isArray(s) && er(s)) && k(e, r.slice(0, -1)), e;
|
|
165
166
|
}
|
|
166
|
-
var
|
|
167
|
+
var tr = (e) => {
|
|
167
168
|
for (const t in e)
|
|
168
169
|
if (re(e[t]))
|
|
169
170
|
return !0;
|
|
170
171
|
return !1;
|
|
171
172
|
};
|
|
172
|
-
function
|
|
173
|
-
return Array.isArray(e) ||
|
|
173
|
+
function Tt(e) {
|
|
174
|
+
return Array.isArray(e) || U(e) && !tr(e);
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
+
function st(e, t = {}) {
|
|
176
177
|
for (const r in e) {
|
|
177
178
|
const s = e[r];
|
|
178
|
-
|
|
179
|
+
Tt(s) ? (t[r] = Array.isArray(s) ? [] : {}, st(s, t[r])) : T(s) || (t[r] = !0);
|
|
179
180
|
}
|
|
180
181
|
return t;
|
|
181
182
|
}
|
|
182
|
-
function
|
|
183
|
-
r || (r =
|
|
183
|
+
function Ee(e, t, r) {
|
|
184
|
+
r || (r = st(t));
|
|
184
185
|
for (const s in e) {
|
|
185
186
|
const i = e[s];
|
|
186
|
-
if (
|
|
187
|
-
|
|
187
|
+
if (Tt(i))
|
|
188
|
+
T(t) || rt(r[s]) ? r[s] = st(i, Array.isArray(i) ? [] : {}) : Ee(i, J(t) ? {} : t[s], r[s]);
|
|
188
189
|
else {
|
|
189
190
|
const n = t[s];
|
|
190
|
-
r[s] = !
|
|
191
|
+
r[s] = !he(i, n);
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
return r;
|
|
194
195
|
}
|
|
195
|
-
const
|
|
196
|
+
const yt = {
|
|
196
197
|
value: !1,
|
|
197
198
|
isValid: !1
|
|
198
|
-
},
|
|
199
|
-
var
|
|
199
|
+
}, gt = { value: !0, isValid: !0 };
|
|
200
|
+
var Lt = (e) => {
|
|
200
201
|
if (Array.isArray(e)) {
|
|
201
202
|
if (e.length > 1) {
|
|
202
203
|
const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
@@ -204,28 +205,28 @@ var Ct = (e) => {
|
|
|
204
205
|
}
|
|
205
206
|
return e[0].checked && !e[0].disabled ? (
|
|
206
207
|
// @ts-expect-error expected to work in the browser
|
|
207
|
-
e[0].attributes && !
|
|
208
|
-
) :
|
|
208
|
+
e[0].attributes && !T(e[0].attributes.value) ? T(e[0].value) || e[0].value === "" ? gt : { value: e[0].value, isValid: !0 } : gt
|
|
209
|
+
) : yt;
|
|
209
210
|
}
|
|
210
|
-
return
|
|
211
|
-
},
|
|
212
|
-
const
|
|
211
|
+
return yt;
|
|
212
|
+
}, Mt = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: s }) => T(e) ? e : t ? e === "" ? NaN : e && +e : r && Q(e) ? new Date(e) : s ? s(e) : e;
|
|
213
|
+
const pt = {
|
|
213
214
|
isValid: !1,
|
|
214
215
|
value: null
|
|
215
216
|
};
|
|
216
|
-
var
|
|
217
|
+
var It = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
|
|
217
218
|
isValid: !0,
|
|
218
219
|
value: r.value
|
|
219
|
-
} : t,
|
|
220
|
-
function
|
|
220
|
+
} : t, pt) : pt;
|
|
221
|
+
function bt(e) {
|
|
221
222
|
const t = e.ref;
|
|
222
|
-
return
|
|
223
|
+
return ut(t) ? t.files : ot(t) ? It(e.refs).value : Ct(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Me(t) ? Lt(e.refs).value : Mt(T(t.value) ? e.ref.value : t.value, e);
|
|
223
224
|
}
|
|
224
|
-
var
|
|
225
|
+
var rr = (e, t, r, s) => {
|
|
225
226
|
const i = {};
|
|
226
227
|
for (const n of e) {
|
|
227
228
|
const l = g(t, n);
|
|
228
|
-
l &&
|
|
229
|
+
l && N(i, n, l._f);
|
|
229
230
|
}
|
|
230
231
|
return {
|
|
231
232
|
criteriaMode: r,
|
|
@@ -233,53 +234,53 @@ var tr = (e, t, r, s) => {
|
|
|
233
234
|
fields: i,
|
|
234
235
|
shouldUseNativeValidation: s
|
|
235
236
|
};
|
|
236
|
-
},
|
|
237
|
+
}, Ke = (e) => e instanceof RegExp, Ce = (e) => T(e) ? e : Ke(e) ? e.source : U(e) ? Ke(e.value) ? e.value.source : e.value : e, wt = (e) => ({
|
|
237
238
|
isOnSubmit: !e || e === se.onSubmit,
|
|
238
239
|
isOnBlur: e === se.onBlur,
|
|
239
240
|
isOnChange: e === se.onChange,
|
|
240
241
|
isOnAll: e === se.all,
|
|
241
242
|
isOnTouch: e === se.onTouched
|
|
242
243
|
});
|
|
243
|
-
const
|
|
244
|
-
var
|
|
245
|
-
const
|
|
244
|
+
const vt = "AsyncFunction";
|
|
245
|
+
var sr = (e) => !!e && !!e.validate && !!(re(e.validate) && e.validate.constructor.name === vt || U(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === vt)), ir = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Ft = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
|
|
246
|
+
const Le = (e, t, r, s) => {
|
|
246
247
|
for (const i of r || Object.keys(e)) {
|
|
247
248
|
const n = g(e, i);
|
|
248
249
|
if (n) {
|
|
249
|
-
const { _f: l, ...
|
|
250
|
+
const { _f: l, ...f } = n;
|
|
250
251
|
if (l) {
|
|
251
252
|
if (l.refs && l.refs[0] && t(l.refs[0], i) && !s)
|
|
252
253
|
return !0;
|
|
253
254
|
if (l.ref && t(l.ref, l.name) && !s)
|
|
254
255
|
return !0;
|
|
255
|
-
if (
|
|
256
|
+
if (Le(f, t))
|
|
256
257
|
break;
|
|
257
|
-
} else if (
|
|
258
|
+
} else if (U(f) && Le(f, t))
|
|
258
259
|
break;
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
};
|
|
262
|
-
function
|
|
263
|
+
function Vt(e, t, r) {
|
|
263
264
|
const s = g(e, r);
|
|
264
|
-
if (s ||
|
|
265
|
+
if (s || ze(r))
|
|
265
266
|
return {
|
|
266
267
|
error: s,
|
|
267
268
|
name: r
|
|
268
269
|
};
|
|
269
270
|
const i = r.split(".");
|
|
270
271
|
for (; i.length; ) {
|
|
271
|
-
const n = i.join("."), l = g(t, n),
|
|
272
|
+
const n = i.join("."), l = g(t, n), f = g(e, n);
|
|
272
273
|
if (l && !Array.isArray(l) && r !== n)
|
|
273
274
|
return { name: r };
|
|
274
|
-
if (
|
|
275
|
+
if (f && f.type)
|
|
275
276
|
return {
|
|
276
277
|
name: n,
|
|
277
|
-
error:
|
|
278
|
+
error: f
|
|
278
279
|
};
|
|
279
|
-
if (
|
|
280
|
+
if (f && f.root && f.root.type)
|
|
280
281
|
return {
|
|
281
282
|
name: `${n}.root`,
|
|
282
|
-
error:
|
|
283
|
+
error: f.root
|
|
283
284
|
};
|
|
284
285
|
i.pop();
|
|
285
286
|
}
|
|
@@ -287,15 +288,15 @@ function vt(e, t, r) {
|
|
|
287
288
|
name: r
|
|
288
289
|
};
|
|
289
290
|
}
|
|
290
|
-
var
|
|
291
|
+
var ar = (e, t, r, s) => {
|
|
291
292
|
r(e);
|
|
292
293
|
const { name: i, ...n } = e;
|
|
293
|
-
return
|
|
294
|
-
},
|
|
295
|
-
const s =
|
|
296
|
-
return
|
|
294
|
+
return H(n) || Object.keys(n).length >= Object.keys(t).length || Object.keys(n).find((l) => t[l] === (!s || se.all));
|
|
295
|
+
}, nr = (e, t, r) => !e || !t || e === t || Te(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), ur = (e, t, r, s, i) => i.isOnAll ? !1 : !r && i.isOnTouch ? !(t || e) : (r ? s.isOnBlur : i.isOnBlur) ? !e : (r ? s.isOnChange : i.isOnChange) ? e : !0, or = (e, t) => !at(g(e, t)).length && k(e, t), lr = (e, t, r) => {
|
|
296
|
+
const s = Te(g(e, r));
|
|
297
|
+
return N(s, "root", t[r]), N(e, r, s), e;
|
|
297
298
|
};
|
|
298
|
-
function
|
|
299
|
+
function Et(e, t, r = "validate") {
|
|
299
300
|
if (Q(e) || Array.isArray(e) && e.every(Q) || ie(e) && !e)
|
|
300
301
|
return {
|
|
301
302
|
type: r,
|
|
@@ -303,98 +304,98 @@ function Ft(e, t, r = "validate") {
|
|
|
303
304
|
ref: t
|
|
304
305
|
};
|
|
305
306
|
}
|
|
306
|
-
var
|
|
307
|
+
var Fe = (e) => U(e) && !Ke(e) ? e : {
|
|
307
308
|
value: e,
|
|
308
309
|
message: ""
|
|
309
|
-
},
|
|
310
|
-
const { ref: l, refs:
|
|
311
|
-
if (!
|
|
310
|
+
}, At = async (e, t, r, s, i, n) => {
|
|
311
|
+
const { ref: l, refs: f, required: w, maxLength: b, minLength: O, min: D, max: v, pattern: m, validate: Y, name: C, valueAsNumber: Z, mount: W } = e._f, A = g(r, C);
|
|
312
|
+
if (!W || t.has(C))
|
|
312
313
|
return {};
|
|
313
|
-
const ee =
|
|
314
|
+
const ee = f ? f[0] : l, M = (V) => {
|
|
314
315
|
i && ee.reportValidity && (ee.setCustomValidity(ie(V) ? "" : V || ""), ee.reportValidity());
|
|
315
|
-
},
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
type: V ?
|
|
319
|
-
message:
|
|
316
|
+
}, L = {}, le = ot(l), ye = Me(l), ae = le || ye, ne = (Z || ut(l)) && T(l.value) && T(A) || Ye(l) && l.value === "" || A === "" || Array.isArray(A) && !A.length, j = Xt.bind(null, C, s, L), ce = (V, x, S, I = oe.maxLength, G = oe.minLength) => {
|
|
317
|
+
const q = V ? x : S;
|
|
318
|
+
L[C] = {
|
|
319
|
+
type: V ? I : G,
|
|
320
|
+
message: q,
|
|
320
321
|
ref: l,
|
|
321
|
-
...
|
|
322
|
+
...j(V ? I : G, q)
|
|
322
323
|
};
|
|
323
324
|
};
|
|
324
|
-
if (n ? !Array.isArray(
|
|
325
|
-
const { value: V, message:
|
|
326
|
-
if (V && (
|
|
325
|
+
if (n ? !Array.isArray(A) || !A.length : w && (!ae && (ne || J(A)) || ie(A) && !A || ye && !Lt(f).isValid || le && !It(f).isValid)) {
|
|
326
|
+
const { value: V, message: x } = Q(w) ? { value: !!w, message: w } : Fe(w);
|
|
327
|
+
if (V && (L[C] = {
|
|
327
328
|
type: oe.required,
|
|
328
|
-
message:
|
|
329
|
+
message: x,
|
|
329
330
|
ref: ee,
|
|
330
|
-
...
|
|
331
|
+
...j(oe.required, x)
|
|
331
332
|
}, !s))
|
|
332
|
-
return
|
|
333
|
+
return M(x), L;
|
|
333
334
|
}
|
|
334
|
-
if (!ne && (!
|
|
335
|
-
let V,
|
|
336
|
-
const S =
|
|
337
|
-
if (!
|
|
338
|
-
const
|
|
339
|
-
|
|
335
|
+
if (!ne && (!J(D) || !J(v))) {
|
|
336
|
+
let V, x;
|
|
337
|
+
const S = Fe(v), I = Fe(D);
|
|
338
|
+
if (!J(A) && !isNaN(A)) {
|
|
339
|
+
const G = l.valueAsNumber || A && +A;
|
|
340
|
+
J(S.value) || (V = G > S.value), J(I.value) || (x = G < I.value);
|
|
340
341
|
} else {
|
|
341
|
-
const
|
|
342
|
-
Q(S.value) &&
|
|
342
|
+
const G = l.valueAsDate || new Date(A), q = (fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + fe), de = l.type == "time", K = l.type == "week";
|
|
343
|
+
Q(S.value) && A && (V = de ? q(A) > q(S.value) : K ? A > S.value : G > new Date(S.value)), Q(I.value) && A && (x = de ? q(A) < q(I.value) : K ? A < I.value : G < new Date(I.value));
|
|
343
344
|
}
|
|
344
|
-
if ((V ||
|
|
345
|
-
return L
|
|
345
|
+
if ((V || x) && (ce(!!V, S.message, I.message, oe.max, oe.min), !s))
|
|
346
|
+
return M(L[C].message), L;
|
|
346
347
|
}
|
|
347
|
-
if ((
|
|
348
|
-
const V =
|
|
349
|
-
if ((S ||
|
|
350
|
-
return L
|
|
348
|
+
if ((b || O) && !ne && (Q(A) || n && Array.isArray(A))) {
|
|
349
|
+
const V = Fe(b), x = Fe(O), S = !J(V.value) && A.length > +V.value, I = !J(x.value) && A.length < +x.value;
|
|
350
|
+
if ((S || I) && (ce(S, V.message, x.message), !s))
|
|
351
|
+
return M(L[C].message), L;
|
|
351
352
|
}
|
|
352
|
-
if (m && !ne && Q(
|
|
353
|
-
const { value: V, message:
|
|
354
|
-
if (
|
|
353
|
+
if (m && !ne && Q(A)) {
|
|
354
|
+
const { value: V, message: x } = Fe(m);
|
|
355
|
+
if (Ke(V) && !A.match(V) && (L[C] = {
|
|
355
356
|
type: oe.pattern,
|
|
356
|
-
message:
|
|
357
|
+
message: x,
|
|
357
358
|
ref: l,
|
|
358
|
-
...
|
|
359
|
+
...j(oe.pattern, x)
|
|
359
360
|
}, !s))
|
|
360
|
-
return
|
|
361
|
+
return M(x), L;
|
|
361
362
|
}
|
|
362
|
-
if (
|
|
363
|
-
if (re(
|
|
364
|
-
const V = await
|
|
365
|
-
if (
|
|
366
|
-
...
|
|
367
|
-
...
|
|
363
|
+
if (Y) {
|
|
364
|
+
if (re(Y)) {
|
|
365
|
+
const V = await Y(A, r), x = Et(V, ee);
|
|
366
|
+
if (x && (L[C] = {
|
|
367
|
+
...x,
|
|
368
|
+
...j(oe.validate, x.message)
|
|
368
369
|
}, !s))
|
|
369
|
-
return
|
|
370
|
-
} else if (
|
|
370
|
+
return M(x.message), L;
|
|
371
|
+
} else if (U(Y)) {
|
|
371
372
|
let V = {};
|
|
372
|
-
for (const
|
|
373
|
-
if (!
|
|
373
|
+
for (const x in Y) {
|
|
374
|
+
if (!H(V) && !s)
|
|
374
375
|
break;
|
|
375
|
-
const S =
|
|
376
|
+
const S = Et(await Y[x](A, r), ee, x);
|
|
376
377
|
S && (V = {
|
|
377
378
|
...S,
|
|
378
|
-
...
|
|
379
|
-
},
|
|
379
|
+
...j(x, S.message)
|
|
380
|
+
}, M(S.message), s && (L[C] = V));
|
|
380
381
|
}
|
|
381
|
-
if (!
|
|
382
|
+
if (!H(V) && (L[C] = {
|
|
382
383
|
ref: ee,
|
|
383
384
|
...V
|
|
384
385
|
}, !s))
|
|
385
|
-
return
|
|
386
|
+
return L;
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
|
-
return
|
|
389
|
+
return M(!0), L;
|
|
389
390
|
};
|
|
390
|
-
const
|
|
391
|
+
const cr = {
|
|
391
392
|
mode: se.onSubmit,
|
|
392
393
|
reValidateMode: se.onChange,
|
|
393
394
|
shouldFocusError: !0
|
|
394
395
|
};
|
|
395
|
-
function
|
|
396
|
+
function dr(e = {}) {
|
|
396
397
|
let t = {
|
|
397
|
-
...
|
|
398
|
+
...cr,
|
|
398
399
|
...e
|
|
399
400
|
}, r = {
|
|
400
401
|
submitCount: 0,
|
|
@@ -411,19 +412,19 @@ function cr(e = {}) {
|
|
|
411
412
|
validatingFields: {},
|
|
412
413
|
errors: t.errors || {},
|
|
413
414
|
disabled: t.disabled || !1
|
|
414
|
-
}, s = {}, i =
|
|
415
|
+
}, s = {}, i = U(t.defaultValues) || U(t.values) ? P(t.defaultValues || t.values) || {} : {}, n = t.shouldUnregister ? {} : P(i), l = {
|
|
415
416
|
action: !1,
|
|
416
417
|
mount: !1,
|
|
417
418
|
watch: !1,
|
|
418
419
|
keepIsValid: !1
|
|
419
|
-
},
|
|
420
|
+
}, f = {
|
|
420
421
|
mount: /* @__PURE__ */ new Set(),
|
|
421
422
|
disabled: /* @__PURE__ */ new Set(),
|
|
422
423
|
unMount: /* @__PURE__ */ new Set(),
|
|
423
424
|
array: /* @__PURE__ */ new Set(),
|
|
424
425
|
watch: /* @__PURE__ */ new Set()
|
|
425
|
-
}, w,
|
|
426
|
-
const
|
|
426
|
+
}, w, b = 0;
|
|
427
|
+
const O = {
|
|
427
428
|
isDirty: !1,
|
|
428
429
|
dirtyFields: !1,
|
|
429
430
|
validatingFields: !1,
|
|
@@ -432,45 +433,45 @@ function cr(e = {}) {
|
|
|
432
433
|
isValid: !1,
|
|
433
434
|
errors: !1
|
|
434
435
|
}, D = {
|
|
435
|
-
...
|
|
436
|
+
...O
|
|
436
437
|
};
|
|
437
438
|
let v = {
|
|
438
439
|
...D
|
|
439
440
|
};
|
|
440
441
|
const m = {
|
|
441
|
-
array:
|
|
442
|
-
state:
|
|
443
|
-
},
|
|
444
|
-
clearTimeout(
|
|
442
|
+
array: mt(),
|
|
443
|
+
state: mt()
|
|
444
|
+
}, Y = t.criteriaMode === se.all, C = (a) => (o) => {
|
|
445
|
+
clearTimeout(b), b = setTimeout(a, o);
|
|
445
446
|
}, Z = async (a) => {
|
|
446
447
|
if (!l.keepIsValid && !t.disabled && (D.isValid || v.isValid || a)) {
|
|
447
448
|
let o;
|
|
448
|
-
t.resolver ? (o =
|
|
449
|
+
t.resolver ? (o = H((await ae()).errors), W()) : o = await j(s, !0), o !== r.isValid && m.state.next({
|
|
449
450
|
isValid: o
|
|
450
451
|
});
|
|
451
452
|
}
|
|
452
|
-
},
|
|
453
|
-
!t.disabled && (D.isValidating || D.validatingFields || v.isValidating || v.validatingFields) && ((a || Array.from(
|
|
454
|
-
u && (o ?
|
|
453
|
+
}, W = (a, o) => {
|
|
454
|
+
!t.disabled && (D.isValidating || D.validatingFields || v.isValidating || v.validatingFields) && ((a || Array.from(f.mount)).forEach((u) => {
|
|
455
|
+
u && (o ? N(r.validatingFields, u, o) : k(r.validatingFields, u));
|
|
455
456
|
}), m.state.next({
|
|
456
457
|
validatingFields: r.validatingFields,
|
|
457
|
-
isValidating: !
|
|
458
|
+
isValidating: !H(r.validatingFields)
|
|
458
459
|
}));
|
|
459
|
-
},
|
|
460
|
-
if (
|
|
461
|
-
if (l.action = !0,
|
|
462
|
-
const y = u(g(s, a),
|
|
463
|
-
|
|
460
|
+
}, A = (a, o = [], u, h, c = !0, d = !0) => {
|
|
461
|
+
if (h && u && !t.disabled) {
|
|
462
|
+
if (l.action = !0, d && Array.isArray(g(s, a))) {
|
|
463
|
+
const y = u(g(s, a), h.argA, h.argB);
|
|
464
|
+
c && N(s, a, y);
|
|
464
465
|
}
|
|
465
|
-
if (
|
|
466
|
-
const y = u(g(r.errors, a),
|
|
467
|
-
|
|
466
|
+
if (d && Array.isArray(g(r.errors, a))) {
|
|
467
|
+
const y = u(g(r.errors, a), h.argA, h.argB);
|
|
468
|
+
c && N(r.errors, a, y), or(r.errors, a);
|
|
468
469
|
}
|
|
469
|
-
if ((D.touchedFields || v.touchedFields) &&
|
|
470
|
-
const y = u(g(r.touchedFields, a),
|
|
471
|
-
|
|
470
|
+
if ((D.touchedFields || v.touchedFields) && d && Array.isArray(g(r.touchedFields, a))) {
|
|
471
|
+
const y = u(g(r.touchedFields, a), h.argA, h.argB);
|
|
472
|
+
c && N(r.touchedFields, a, y);
|
|
472
473
|
}
|
|
473
|
-
(D.dirtyFields || v.dirtyFields) && (r.dirtyFields =
|
|
474
|
+
(D.dirtyFields || v.dirtyFields) && (r.dirtyFields = Ee(i, n)), m.state.next({
|
|
474
475
|
name: a,
|
|
475
476
|
isDirty: V(a, o),
|
|
476
477
|
dirtyFields: r.dirtyFields,
|
|
@@ -478,46 +479,46 @@ function cr(e = {}) {
|
|
|
478
479
|
isValid: r.isValid
|
|
479
480
|
});
|
|
480
481
|
} else
|
|
481
|
-
|
|
482
|
+
N(n, a, o);
|
|
482
483
|
}, ee = (a, o) => {
|
|
483
|
-
|
|
484
|
+
N(r.errors, a, o), m.state.next({
|
|
484
485
|
errors: r.errors
|
|
485
486
|
});
|
|
486
|
-
},
|
|
487
|
+
}, M = (a) => {
|
|
487
488
|
r.errors = a, m.state.next({
|
|
488
489
|
errors: r.errors,
|
|
489
490
|
isValid: !1
|
|
490
491
|
});
|
|
491
|
-
},
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
494
|
-
const
|
|
495
|
-
|
|
492
|
+
}, L = (a, o, u, h) => {
|
|
493
|
+
const c = g(s, a);
|
|
494
|
+
if (c) {
|
|
495
|
+
const d = g(n, a, T(u) ? g(i, a) : u);
|
|
496
|
+
T(d) || h && h.defaultChecked || o ? N(n, a, o ? d : bt(c._f)) : I(a, d), l.mount && !l.action && Z();
|
|
496
497
|
}
|
|
497
|
-
},
|
|
498
|
-
let
|
|
499
|
-
const
|
|
498
|
+
}, le = (a, o, u, h, c) => {
|
|
499
|
+
let d = !1, y = !1;
|
|
500
|
+
const p = {
|
|
500
501
|
name: a
|
|
501
502
|
};
|
|
502
503
|
if (!t.disabled) {
|
|
503
|
-
if (!u ||
|
|
504
|
-
(D.isDirty || v.isDirty) && (y = r.isDirty, r.isDirty =
|
|
505
|
-
const
|
|
506
|
-
y = !!g(r.dirtyFields, a),
|
|
504
|
+
if (!u || h) {
|
|
505
|
+
(D.isDirty || v.isDirty) && (y = r.isDirty, r.isDirty = p.isDirty = V(), d = y !== p.isDirty);
|
|
506
|
+
const F = he(g(i, a), o);
|
|
507
|
+
y = !!g(r.dirtyFields, a), F ? k(r.dirtyFields, a) : N(r.dirtyFields, a, !0), p.dirtyFields = r.dirtyFields, d = d || (D.dirtyFields || v.dirtyFields) && y !== !F;
|
|
507
508
|
}
|
|
508
509
|
if (u) {
|
|
509
|
-
const
|
|
510
|
-
|
|
510
|
+
const F = g(r.touchedFields, a);
|
|
511
|
+
F || (N(r.touchedFields, a, u), p.touchedFields = r.touchedFields, d = d || (D.touchedFields || v.touchedFields) && F !== u);
|
|
511
512
|
}
|
|
512
|
-
|
|
513
|
+
d && c && m.state.next(p);
|
|
513
514
|
}
|
|
514
|
-
return
|
|
515
|
-
},
|
|
516
|
-
const
|
|
517
|
-
if (t.delayError && u ? (w =
|
|
515
|
+
return d ? p : {};
|
|
516
|
+
}, ye = (a, o, u, h) => {
|
|
517
|
+
const c = g(r.errors, a), d = (D.isValid || v.isValid) && ie(o) && r.isValid !== o;
|
|
518
|
+
if (t.delayError && u ? (w = C(() => ee(a, u)), w(t.delayError)) : (clearTimeout(b), w = null, u ? N(r.errors, a, u) : k(r.errors, a)), (u ? !he(c, u) : c) || !H(h) || d) {
|
|
518
519
|
const y = {
|
|
519
|
-
...
|
|
520
|
-
...
|
|
520
|
+
...h,
|
|
521
|
+
...d && ie(o) ? { isValid: o } : {},
|
|
521
522
|
errors: r.errors,
|
|
522
523
|
name: a
|
|
523
524
|
};
|
|
@@ -526,187 +527,187 @@ function cr(e = {}) {
|
|
|
526
527
|
...y
|
|
527
528
|
}, m.state.next(y);
|
|
528
529
|
}
|
|
529
|
-
}, ae = async (a) => (
|
|
530
|
+
}, ae = async (a) => (W(a, !0), await t.resolver(n, t.context, rr(a || f.mount, s, t.criteriaMode, t.shouldUseNativeValidation))), ne = async (a) => {
|
|
530
531
|
const { errors: o } = await ae(a);
|
|
531
|
-
if (
|
|
532
|
+
if (W(a), a)
|
|
532
533
|
for (const u of a) {
|
|
533
|
-
const
|
|
534
|
-
|
|
534
|
+
const h = g(o, u);
|
|
535
|
+
h ? N(r.errors, u, h) : k(r.errors, u);
|
|
535
536
|
}
|
|
536
537
|
else
|
|
537
538
|
r.errors = o;
|
|
538
539
|
return o;
|
|
539
|
-
},
|
|
540
|
+
}, j = async (a, o, u = {
|
|
540
541
|
valid: !0
|
|
541
542
|
}) => {
|
|
542
|
-
for (const
|
|
543
|
-
const
|
|
544
|
-
if (
|
|
545
|
-
const { _f:
|
|
546
|
-
if (
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
const _ = await
|
|
550
|
-
if (
|
|
543
|
+
for (const h in a) {
|
|
544
|
+
const c = a[h];
|
|
545
|
+
if (c) {
|
|
546
|
+
const { _f: d, ...y } = c;
|
|
547
|
+
if (d) {
|
|
548
|
+
const p = f.array.has(d.name), F = c._f && sr(c._f);
|
|
549
|
+
F && D.validatingFields && W([d.name], !0);
|
|
550
|
+
const _ = await At(c, f.disabled, n, Y, t.shouldUseNativeValidation && !o, p);
|
|
551
|
+
if (F && D.validatingFields && W([d.name]), _[d.name] && (u.valid = !1, o || e.shouldUseNativeValidation))
|
|
551
552
|
break;
|
|
552
|
-
!o && (g(_,
|
|
553
|
+
!o && (g(_, d.name) ? p ? lr(r.errors, _, d.name) : N(r.errors, d.name, _[d.name]) : k(r.errors, d.name));
|
|
553
554
|
}
|
|
554
|
-
!
|
|
555
|
+
!H(y) && await j(y, o, u);
|
|
555
556
|
}
|
|
556
557
|
}
|
|
557
558
|
return u.valid;
|
|
558
|
-
},
|
|
559
|
-
for (const a of
|
|
559
|
+
}, ce = () => {
|
|
560
|
+
for (const a of f.unMount) {
|
|
560
561
|
const o = g(s, a);
|
|
561
|
-
o && (o._f.refs ? o._f.refs.every((u) => !
|
|
562
|
+
o && (o._f.refs ? o._f.refs.every((u) => !et(u)) : !et(o._f.ref)) && xe(a);
|
|
562
563
|
}
|
|
563
|
-
|
|
564
|
-
}, V = (a, o) => !t.disabled && (a && o &&
|
|
565
|
-
...l.mount ? n :
|
|
566
|
-
}, u, o), S = (a) =>
|
|
567
|
-
const
|
|
568
|
-
let
|
|
569
|
-
if (
|
|
570
|
-
const
|
|
571
|
-
|
|
572
|
-
(!y.defaultChecked || !y.disabled) && (Array.isArray(
|
|
573
|
-
}) :
|
|
564
|
+
f.unMount = /* @__PURE__ */ new Set();
|
|
565
|
+
}, V = (a, o) => !t.disabled && (a && o && N(n, a, o), !he(Ie(), i)), x = (a, o, u) => Gt(a, f, {
|
|
566
|
+
...l.mount ? n : T(o) ? i : Q(a) ? { [a]: o } : o
|
|
567
|
+
}, u, o), S = (a) => at(g(l.mount ? n : i, a, t.shouldUnregister ? g(i, a, []) : [])), I = (a, o, u = {}) => {
|
|
568
|
+
const h = g(s, a);
|
|
569
|
+
let c = o;
|
|
570
|
+
if (h) {
|
|
571
|
+
const d = h._f;
|
|
572
|
+
d && (!d.disabled && N(n, a, Mt(o, d)), c = Ye(d.ref) && J(o) ? "" : o, Ct(d.ref) ? [...d.ref.options].forEach((y) => y.selected = c.includes(y.value)) : d.refs ? Me(d.ref) ? d.refs.forEach((y) => {
|
|
573
|
+
(!y.defaultChecked || !y.disabled) && (Array.isArray(c) ? y.checked = !!c.find((p) => p === y.value) : y.checked = c === y.value || !!c);
|
|
574
|
+
}) : d.refs.forEach((y) => y.checked = y.value === c) : ut(d.ref) ? d.ref.value = "" : (d.ref.value = c, d.ref.type || m.state.next({
|
|
574
575
|
name: a,
|
|
575
|
-
values:
|
|
576
|
+
values: P(n)
|
|
576
577
|
})));
|
|
577
578
|
}
|
|
578
|
-
(u.shouldDirty || u.shouldTouch) &&
|
|
579
|
-
},
|
|
580
|
-
for (const
|
|
581
|
-
if (!o.hasOwnProperty(
|
|
579
|
+
(u.shouldDirty || u.shouldTouch) && le(a, c, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && fe(a);
|
|
580
|
+
}, G = (a, o, u) => {
|
|
581
|
+
for (const h in o) {
|
|
582
|
+
if (!o.hasOwnProperty(h))
|
|
582
583
|
return;
|
|
583
|
-
const
|
|
584
|
-
(
|
|
584
|
+
const c = o[h], d = a + "." + h, y = g(s, d);
|
|
585
|
+
(f.array.has(a) || U(c) || y && !y._f) && !pe(c) ? G(d, c, u) : I(d, c, u);
|
|
585
586
|
}
|
|
586
|
-
},
|
|
587
|
-
const
|
|
588
|
-
|
|
587
|
+
}, q = (a, o, u = {}) => {
|
|
588
|
+
const h = g(s, a), c = f.array.has(a), d = P(o);
|
|
589
|
+
N(n, a, d), c ? (m.array.next({
|
|
589
590
|
name: a,
|
|
590
|
-
values:
|
|
591
|
+
values: P(n)
|
|
591
592
|
}), (D.isDirty || D.dirtyFields || v.isDirty || v.dirtyFields) && u.shouldDirty && m.state.next({
|
|
592
593
|
name: a,
|
|
593
|
-
dirtyFields:
|
|
594
|
-
isDirty: V(a,
|
|
595
|
-
})) :
|
|
594
|
+
dirtyFields: Ee(i, n),
|
|
595
|
+
isDirty: V(a, d)
|
|
596
|
+
})) : h && !h._f && !J(d) ? G(a, d, u) : I(a, d, u), Ft(a, f) ? m.state.next({
|
|
596
597
|
...r,
|
|
597
598
|
name: a,
|
|
598
|
-
values:
|
|
599
|
+
values: P(n)
|
|
599
600
|
}) : m.state.next({
|
|
600
601
|
name: l.mount ? a : void 0,
|
|
601
|
-
values:
|
|
602
|
+
values: P(n)
|
|
602
603
|
});
|
|
603
|
-
},
|
|
604
|
+
}, de = async (a) => {
|
|
604
605
|
l.mount = !0;
|
|
605
606
|
const o = a.target;
|
|
606
|
-
let u = o.name,
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
}, y =
|
|
610
|
-
if (
|
|
611
|
-
let
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
if (
|
|
607
|
+
let u = o.name, h = !0;
|
|
608
|
+
const c = g(s, u), d = (F) => {
|
|
609
|
+
h = Number.isNaN(F) || pe(F) && isNaN(F.getTime()) || he(F, g(n, u, F));
|
|
610
|
+
}, y = wt(t.mode), p = wt(t.reValidateMode);
|
|
611
|
+
if (c) {
|
|
612
|
+
let F, _;
|
|
613
|
+
const R = o.type ? bt(c._f) : jt(a), $ = a.type === ht.BLUR || a.type === ht.FOCUS_OUT, ue = !ir(c._f) && !t.resolver && !g(r.errors, u) && !c._f.deps || ur($, g(r.touchedFields, u), r.isSubmitted, p, y), B = Ft(u, f, $);
|
|
614
|
+
N(n, u, R), $ ? (!o || !o.readOnly) && (c._f.onBlur && c._f.onBlur(a), w && w(0)) : c._f.onChange && c._f.onChange(a);
|
|
615
|
+
const z = le(u, R, $), We = !H(z) || B;
|
|
616
|
+
if (!$ && m.state.next({
|
|
616
617
|
name: u,
|
|
617
618
|
type: a.type,
|
|
618
|
-
values:
|
|
619
|
-
}),
|
|
620
|
-
return (D.isValid || v.isValid) && (t.mode === "onBlur" ?
|
|
621
|
-
if (
|
|
622
|
-
const { errors:
|
|
623
|
-
if (
|
|
624
|
-
const
|
|
625
|
-
|
|
619
|
+
values: P(n)
|
|
620
|
+
}), ue)
|
|
621
|
+
return (D.isValid || v.isValid) && (t.mode === "onBlur" ? $ && Z() : $ || Z()), We && m.state.next({ name: u, ...B ? {} : z });
|
|
622
|
+
if (!$ && B && m.state.next({ ...r }), t.resolver) {
|
|
623
|
+
const { errors: Ze } = await ae([u]);
|
|
624
|
+
if (W([u]), d(R), h) {
|
|
625
|
+
const ct = Vt(r.errors, s, u), dt = Vt(Ze, s, ct.name || u);
|
|
626
|
+
F = dt.error, u = dt.name, _ = H(Ze);
|
|
626
627
|
}
|
|
627
628
|
} else
|
|
628
|
-
|
|
629
|
-
|
|
629
|
+
W([u], !0), F = (await At(c, f.disabled, n, Y, t.shouldUseNativeValidation))[u], W([u]), d(R), h && (F ? _ = !1 : (D.isValid || v.isValid) && (_ = await j(s, !0)));
|
|
630
|
+
h && (c._f.deps && (!Array.isArray(c._f.deps) || c._f.deps.length > 0) && fe(c._f.deps), ye(u, _, F, z));
|
|
630
631
|
}
|
|
631
|
-
},
|
|
632
|
+
}, K = (a, o) => {
|
|
632
633
|
if (g(r.errors, o) && a.focus)
|
|
633
634
|
return a.focus(), 1;
|
|
634
|
-
},
|
|
635
|
-
let u,
|
|
636
|
-
const
|
|
635
|
+
}, fe = async (a, o = {}) => {
|
|
636
|
+
let u, h;
|
|
637
|
+
const c = Te(a);
|
|
637
638
|
if (t.resolver) {
|
|
638
|
-
const
|
|
639
|
-
u =
|
|
640
|
-
} else a ? (
|
|
641
|
-
const y = g(s,
|
|
642
|
-
return await
|
|
643
|
-
}))).every(Boolean), !(!
|
|
639
|
+
const d = await ne(T(a) ? a : c);
|
|
640
|
+
u = H(d), h = a ? !c.some((y) => g(d, y)) : u;
|
|
641
|
+
} else a ? (h = (await Promise.all(c.map(async (d) => {
|
|
642
|
+
const y = g(s, d);
|
|
643
|
+
return await j(y && y._f ? { [d]: y } : y);
|
|
644
|
+
}))).every(Boolean), !(!h && !r.isValid) && Z()) : h = u = await j(s);
|
|
644
645
|
return m.state.next({
|
|
645
646
|
...!Q(a) || (D.isValid || v.isValid) && u !== r.isValid ? {} : { name: a },
|
|
646
647
|
...t.resolver || !a ? { isValid: u } : {},
|
|
647
648
|
errors: r.errors
|
|
648
|
-
}), o.shouldFocus && !
|
|
649
|
-
},
|
|
649
|
+
}), o.shouldFocus && !h && Le(s, K, a ? c : f.mount), h;
|
|
650
|
+
}, Ie = (a, o) => {
|
|
650
651
|
let u = {
|
|
651
652
|
...l.mount ? n : i
|
|
652
653
|
};
|
|
653
|
-
return o && (u =
|
|
654
|
-
},
|
|
654
|
+
return o && (u = Ot(o.dirtyFields ? r.dirtyFields : r.touchedFields, u)), T(a) ? u : Q(a) ? g(u, a) : a.map((h) => g(u, h));
|
|
655
|
+
}, ke = (a, o) => ({
|
|
655
656
|
invalid: !!g((o || r).errors, a),
|
|
656
657
|
isDirty: !!g((o || r).dirtyFields, a),
|
|
657
658
|
error: g((o || r).errors, a),
|
|
658
659
|
isValidating: !!g(r.validatingFields, a),
|
|
659
660
|
isTouched: !!g((o || r).touchedFields, a)
|
|
660
|
-
}),
|
|
661
|
-
a &&
|
|
661
|
+
}), E = (a) => {
|
|
662
|
+
a && Te(a).forEach((o) => k(r.errors, o)), m.state.next({
|
|
662
663
|
errors: a ? r.errors : {}
|
|
663
664
|
});
|
|
664
|
-
},
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
...
|
|
665
|
+
}, we = (a, o, u) => {
|
|
666
|
+
const h = (g(s, a, { _f: {} })._f || {}).ref, c = g(r.errors, a) || {}, { ref: d, message: y, type: p, ...F } = c;
|
|
667
|
+
N(r.errors, a, {
|
|
668
|
+
...F,
|
|
668
669
|
...o,
|
|
669
|
-
ref:
|
|
670
|
+
ref: h
|
|
670
671
|
}), m.state.next({
|
|
671
672
|
name: a,
|
|
672
673
|
errors: r.errors,
|
|
673
674
|
isValid: !1
|
|
674
|
-
}), u && u.shouldFocus &&
|
|
675
|
-
},
|
|
676
|
-
next: (u) => "values" in u && a(
|
|
677
|
-
}) :
|
|
675
|
+
}), u && u.shouldFocus && h && h.focus && h.focus();
|
|
676
|
+
}, Ue = (a, o) => re(a) ? m.state.subscribe({
|
|
677
|
+
next: (u) => "values" in u && a(x(void 0, o), u)
|
|
678
|
+
}) : x(a, o, !0), Be = (a) => m.state.subscribe({
|
|
678
679
|
next: (o) => {
|
|
679
|
-
|
|
680
|
+
nr(a.name, o.name, a.exact) && ar(o, a.formState || D, Qe, a.reRenderRoot) && a.callback({
|
|
680
681
|
values: { ...n },
|
|
681
682
|
...r,
|
|
682
683
|
...o,
|
|
683
684
|
defaultValues: i
|
|
684
685
|
});
|
|
685
686
|
}
|
|
686
|
-
}).unsubscribe,
|
|
687
|
+
}).unsubscribe, Je = (a) => (l.mount = !0, v = {
|
|
687
688
|
...v,
|
|
688
689
|
...a.formState
|
|
689
|
-
},
|
|
690
|
+
}, Be({
|
|
690
691
|
...a,
|
|
691
692
|
formState: {
|
|
692
|
-
...
|
|
693
|
+
...O,
|
|
693
694
|
...a.formState
|
|
694
695
|
}
|
|
695
696
|
})), xe = (a, o = {}) => {
|
|
696
|
-
for (const u of a ?
|
|
697
|
-
|
|
697
|
+
for (const u of a ? Te(a) : f.mount)
|
|
698
|
+
f.mount.delete(u), f.array.delete(u), o.keepValue || (k(s, u), k(n, u)), !o.keepError && k(r.errors, u), !o.keepDirty && k(r.dirtyFields, u), !o.keepTouched && k(r.touchedFields, u), !o.keepIsValidating && k(r.validatingFields, u), !t.shouldUnregister && !o.keepDefaultValue && k(i, u);
|
|
698
699
|
m.state.next({
|
|
699
|
-
values:
|
|
700
|
+
values: P(n)
|
|
700
701
|
}), m.state.next({
|
|
701
702
|
...r,
|
|
702
703
|
...o.keepDirty ? { isDirty: V() } : {}
|
|
703
704
|
}), !o.keepIsValid && Z();
|
|
704
|
-
},
|
|
705
|
-
(ie(a) && l.mount || a ||
|
|
705
|
+
}, Pe = ({ disabled: a, name: o }) => {
|
|
706
|
+
(ie(a) && l.mount || a || f.disabled.has(o)) && (a ? f.disabled.add(o) : f.disabled.delete(o));
|
|
706
707
|
}, _e = (a, o = {}) => {
|
|
707
708
|
let u = g(s, a);
|
|
708
|
-
const
|
|
709
|
-
return
|
|
709
|
+
const h = ie(o.disabled) || ie(t.disabled);
|
|
710
|
+
return N(s, a, {
|
|
710
711
|
...u || {},
|
|
711
712
|
_f: {
|
|
712
713
|
...u && u._f ? u._f : { ref: { name: a } },
|
|
@@ -714,107 +715,107 @@ function cr(e = {}) {
|
|
|
714
715
|
mount: !0,
|
|
715
716
|
...o
|
|
716
717
|
}
|
|
717
|
-
}),
|
|
718
|
+
}), f.mount.add(a), u ? Pe({
|
|
718
719
|
disabled: ie(o.disabled) ? o.disabled : t.disabled,
|
|
719
720
|
name: a
|
|
720
|
-
}) :
|
|
721
|
-
...
|
|
721
|
+
}) : L(a, !0, o.value), {
|
|
722
|
+
...h ? { disabled: o.disabled || t.disabled } : {},
|
|
722
723
|
...t.progressive ? {
|
|
723
724
|
required: !!o.required,
|
|
724
|
-
min:
|
|
725
|
-
max:
|
|
726
|
-
minLength:
|
|
727
|
-
maxLength:
|
|
728
|
-
pattern:
|
|
725
|
+
min: Ce(o.min),
|
|
726
|
+
max: Ce(o.max),
|
|
727
|
+
minLength: Ce(o.minLength),
|
|
728
|
+
maxLength: Ce(o.maxLength),
|
|
729
|
+
pattern: Ce(o.pattern)
|
|
729
730
|
} : {},
|
|
730
731
|
name: a,
|
|
731
|
-
onChange:
|
|
732
|
-
onBlur:
|
|
733
|
-
ref: (
|
|
734
|
-
if (
|
|
732
|
+
onChange: de,
|
|
733
|
+
onBlur: de,
|
|
734
|
+
ref: (c) => {
|
|
735
|
+
if (c) {
|
|
735
736
|
_e(a, o), u = g(s, a);
|
|
736
|
-
const
|
|
737
|
-
if (y ?
|
|
737
|
+
const d = T(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, y = Qt(d), p = u._f.refs || [];
|
|
738
|
+
if (y ? p.find((F) => F === d) : d === u._f.ref)
|
|
738
739
|
return;
|
|
739
|
-
|
|
740
|
+
N(s, a, {
|
|
740
741
|
_f: {
|
|
741
742
|
...u._f,
|
|
742
743
|
...y ? {
|
|
743
744
|
refs: [
|
|
744
|
-
...
|
|
745
|
-
|
|
745
|
+
...p.filter(et),
|
|
746
|
+
d,
|
|
746
747
|
...Array.isArray(g(i, a)) ? [{}] : []
|
|
747
748
|
],
|
|
748
|
-
ref: { type:
|
|
749
|
-
} : { ref:
|
|
749
|
+
ref: { type: d.type, name: a }
|
|
750
|
+
} : { ref: d }
|
|
750
751
|
}
|
|
751
|
-
}),
|
|
752
|
+
}), L(a, !1, void 0, d);
|
|
752
753
|
} else
|
|
753
|
-
u = g(s, a, {}), u._f && (u._f.mount = !1), (t.shouldUnregister || o.shouldUnregister) && !(
|
|
754
|
+
u = g(s, a, {}), u._f && (u._f.mount = !1), (t.shouldUnregister || o.shouldUnregister) && !(Ht(f.array, a) && l.action) && f.unMount.add(a);
|
|
754
755
|
}
|
|
755
756
|
};
|
|
756
|
-
}, De = () => t.shouldFocusError &&
|
|
757
|
-
ie(a) && (m.state.next({ disabled: a }),
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
|
|
757
|
+
}, De = () => t.shouldFocusError && Le(s, K, f.mount), Ge = (a) => {
|
|
758
|
+
ie(a) && (m.state.next({ disabled: a }), Le(s, (o, u) => {
|
|
759
|
+
const h = g(s, u);
|
|
760
|
+
h && (o.disabled = h._f.disabled || a, Array.isArray(h._f.refs) && h._f.refs.forEach((c) => {
|
|
761
|
+
c.disabled = h._f.disabled || a;
|
|
761
762
|
}));
|
|
762
763
|
}, 0, !1));
|
|
763
|
-
},
|
|
764
|
-
let
|
|
764
|
+
}, qe = (a, o) => async (u) => {
|
|
765
|
+
let h;
|
|
765
766
|
u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
|
|
766
|
-
let
|
|
767
|
+
let c = P(n);
|
|
767
768
|
if (m.state.next({
|
|
768
769
|
isSubmitting: !0
|
|
769
770
|
}), t.resolver) {
|
|
770
|
-
const { errors:
|
|
771
|
-
|
|
771
|
+
const { errors: d, values: y } = await ae();
|
|
772
|
+
W(), r.errors = d, c = P(y);
|
|
772
773
|
} else
|
|
773
|
-
await
|
|
774
|
-
if (
|
|
775
|
-
for (const
|
|
776
|
-
|
|
777
|
-
if (
|
|
774
|
+
await j(s);
|
|
775
|
+
if (f.disabled.size)
|
|
776
|
+
for (const d of f.disabled)
|
|
777
|
+
k(c, d);
|
|
778
|
+
if (k(r.errors, "root"), H(r.errors)) {
|
|
778
779
|
m.state.next({
|
|
779
780
|
errors: {}
|
|
780
781
|
});
|
|
781
782
|
try {
|
|
782
|
-
await a(
|
|
783
|
-
} catch (
|
|
784
|
-
|
|
783
|
+
await a(c, u);
|
|
784
|
+
} catch (d) {
|
|
785
|
+
h = d;
|
|
785
786
|
}
|
|
786
787
|
} else
|
|
787
788
|
o && await o({ ...r.errors }, u), De(), setTimeout(De);
|
|
788
789
|
if (m.state.next({
|
|
789
790
|
isSubmitted: !0,
|
|
790
791
|
isSubmitting: !1,
|
|
791
|
-
isSubmitSuccessful:
|
|
792
|
+
isSubmitSuccessful: H(r.errors) && !h,
|
|
792
793
|
submitCount: r.submitCount + 1,
|
|
793
794
|
errors: r.errors
|
|
794
|
-
}),
|
|
795
|
-
throw
|
|
796
|
-
},
|
|
797
|
-
g(s, a) && (
|
|
798
|
-
},
|
|
799
|
-
const u = a ?
|
|
795
|
+
}), h)
|
|
796
|
+
throw h;
|
|
797
|
+
}, Xe = (a, o = {}) => {
|
|
798
|
+
g(s, a) && (T(o.defaultValue) ? q(a, P(g(i, a))) : (q(a, o.defaultValue), N(i, a, P(o.defaultValue))), o.keepTouched || k(r.touchedFields, a), o.keepDirty || (k(r.dirtyFields, a), r.isDirty = o.defaultValue ? V(a, P(g(i, a))) : V()), o.keepError || (k(r.errors, a), D.isValid && Z()), m.state.next({ ...r }));
|
|
799
|
+
}, Se = (a, o = {}) => {
|
|
800
|
+
const u = a ? P(a) : i, h = P(u), c = H(a), d = c ? i : h;
|
|
800
801
|
if (o.keepDefaultValues || (i = u), !o.keepValues) {
|
|
801
802
|
if (o.keepDirtyValues) {
|
|
802
803
|
const y = /* @__PURE__ */ new Set([
|
|
803
|
-
...
|
|
804
|
-
...Object.keys(
|
|
804
|
+
...f.mount,
|
|
805
|
+
...Object.keys(Ee(i, n))
|
|
805
806
|
]);
|
|
806
|
-
for (const
|
|
807
|
-
const
|
|
808
|
-
|
|
807
|
+
for (const p of Array.from(y)) {
|
|
808
|
+
const F = g(r.dirtyFields, p), _ = g(n, p), R = g(d, p);
|
|
809
|
+
F && !T(_) ? N(d, p, _) : !F && !T(R) && q(p, R);
|
|
809
810
|
}
|
|
810
811
|
} else {
|
|
811
|
-
if (
|
|
812
|
-
for (const y of
|
|
813
|
-
const
|
|
814
|
-
if (
|
|
815
|
-
const
|
|
816
|
-
if (
|
|
817
|
-
const _ =
|
|
812
|
+
if (it && T(a))
|
|
813
|
+
for (const y of f.mount) {
|
|
814
|
+
const p = g(s, y);
|
|
815
|
+
if (p && p._f) {
|
|
816
|
+
const F = Array.isArray(p._f.refs) ? p._f.refs[0] : p._f.ref;
|
|
817
|
+
if (Ye(F)) {
|
|
818
|
+
const _ = F.closest("form");
|
|
818
819
|
if (_) {
|
|
819
820
|
_.reset();
|
|
820
821
|
break;
|
|
@@ -823,75 +824,75 @@ function cr(e = {}) {
|
|
|
823
824
|
}
|
|
824
825
|
}
|
|
825
826
|
if (o.keepFieldsRef)
|
|
826
|
-
for (const y of
|
|
827
|
-
|
|
827
|
+
for (const y of f.mount)
|
|
828
|
+
q(y, g(d, y));
|
|
828
829
|
else
|
|
829
830
|
s = {};
|
|
830
831
|
}
|
|
831
|
-
n = t.shouldUnregister ? o.keepDefaultValues ?
|
|
832
|
-
values: { ...
|
|
832
|
+
n = t.shouldUnregister ? o.keepDefaultValues ? P(i) : {} : P(d), m.array.next({
|
|
833
|
+
values: { ...d }
|
|
833
834
|
}), m.state.next({
|
|
834
|
-
values: { ...
|
|
835
|
+
values: { ...d }
|
|
835
836
|
});
|
|
836
837
|
}
|
|
837
|
-
|
|
838
|
-
mount: o.keepDirtyValues ?
|
|
838
|
+
f = {
|
|
839
|
+
mount: o.keepDirtyValues ? f.mount : /* @__PURE__ */ new Set(),
|
|
839
840
|
unMount: /* @__PURE__ */ new Set(),
|
|
840
841
|
array: /* @__PURE__ */ new Set(),
|
|
841
842
|
disabled: /* @__PURE__ */ new Set(),
|
|
842
843
|
watch: /* @__PURE__ */ new Set(),
|
|
843
844
|
watchAll: !1,
|
|
844
845
|
focus: ""
|
|
845
|
-
}, l.mount = !D.isValid || !!o.keepIsValid || !!o.keepDirtyValues || !t.shouldUnregister && !
|
|
846
|
+
}, l.mount = !D.isValid || !!o.keepIsValid || !!o.keepDirtyValues || !t.shouldUnregister && !H(d), l.watch = !!t.shouldUnregister, l.keepIsValid = !!o.keepIsValid, l.action = !1, o.keepErrors || (r.errors = {}), m.state.next({
|
|
846
847
|
submitCount: o.keepSubmitCount ? r.submitCount : 0,
|
|
847
|
-
isDirty:
|
|
848
|
+
isDirty: c ? !1 : o.keepDirty ? r.isDirty : !!(o.keepDefaultValues && !he(a, i)),
|
|
848
849
|
isSubmitted: o.keepIsSubmitted ? r.isSubmitted : !1,
|
|
849
|
-
dirtyFields:
|
|
850
|
+
dirtyFields: c ? {} : o.keepDirtyValues ? o.keepDefaultValues && n ? Ee(i, n) : r.dirtyFields : o.keepDefaultValues && a ? Ee(i, a) : o.keepDirty ? r.dirtyFields : {},
|
|
850
851
|
touchedFields: o.keepTouched ? r.touchedFields : {},
|
|
851
852
|
errors: o.keepErrors ? r.errors : {},
|
|
852
853
|
isSubmitSuccessful: o.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
|
|
853
854
|
isSubmitting: !1,
|
|
854
855
|
defaultValues: i
|
|
855
856
|
});
|
|
856
|
-
},
|
|
857
|
-
const u = g(s, a),
|
|
858
|
-
if (
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
|
|
857
|
+
}, $e = (a, o) => Se(re(a) ? a(n) : a, { ...t.resetOptions, ...o }), Re = (a, o = {}) => {
|
|
858
|
+
const u = g(s, a), h = u && u._f;
|
|
859
|
+
if (h) {
|
|
860
|
+
const c = h.refs ? h.refs[0] : h.ref;
|
|
861
|
+
c.focus && setTimeout(() => {
|
|
862
|
+
c.focus(), o.shouldSelect && re(c.select) && c.select();
|
|
862
863
|
});
|
|
863
864
|
}
|
|
864
|
-
},
|
|
865
|
+
}, Qe = (a) => {
|
|
865
866
|
r = {
|
|
866
867
|
...r,
|
|
867
868
|
...a
|
|
868
869
|
};
|
|
869
|
-
},
|
|
870
|
+
}, je = {
|
|
870
871
|
control: {
|
|
871
872
|
register: _e,
|
|
872
873
|
unregister: xe,
|
|
873
|
-
getFieldState:
|
|
874
|
-
handleSubmit:
|
|
875
|
-
setError:
|
|
876
|
-
_subscribe:
|
|
874
|
+
getFieldState: ke,
|
|
875
|
+
handleSubmit: qe,
|
|
876
|
+
setError: we,
|
|
877
|
+
_subscribe: Be,
|
|
877
878
|
_runSchema: ae,
|
|
878
|
-
_updateIsValidating:
|
|
879
|
+
_updateIsValidating: W,
|
|
879
880
|
_focusError: De,
|
|
880
|
-
_getWatch:
|
|
881
|
+
_getWatch: x,
|
|
881
882
|
_getDirty: V,
|
|
882
883
|
_setValid: Z,
|
|
883
|
-
_setFieldArray:
|
|
884
|
-
_setDisabledField:
|
|
885
|
-
_setErrors:
|
|
884
|
+
_setFieldArray: A,
|
|
885
|
+
_setDisabledField: Pe,
|
|
886
|
+
_setErrors: M,
|
|
886
887
|
_getFieldArray: S,
|
|
887
|
-
_reset:
|
|
888
|
+
_reset: Se,
|
|
888
889
|
_resetDefaultValues: () => re(t.defaultValues) && t.defaultValues().then((a) => {
|
|
889
|
-
|
|
890
|
+
$e(a, t.resetOptions), m.state.next({
|
|
890
891
|
isLoading: !1
|
|
891
892
|
});
|
|
892
893
|
}),
|
|
893
|
-
_removeUnmounted:
|
|
894
|
-
_disableForm:
|
|
894
|
+
_removeUnmounted: ce,
|
|
895
|
+
_disableForm: Ge,
|
|
895
896
|
_subjects: m,
|
|
896
897
|
_proxyFormState: D,
|
|
897
898
|
get _fields() {
|
|
@@ -910,10 +911,10 @@ function cr(e = {}) {
|
|
|
910
911
|
return i;
|
|
911
912
|
},
|
|
912
913
|
get _names() {
|
|
913
|
-
return
|
|
914
|
+
return f;
|
|
914
915
|
},
|
|
915
916
|
set _names(a) {
|
|
916
|
-
|
|
917
|
+
f = a;
|
|
917
918
|
},
|
|
918
919
|
get _formState() {
|
|
919
920
|
return r;
|
|
@@ -928,27 +929,27 @@ function cr(e = {}) {
|
|
|
928
929
|
};
|
|
929
930
|
}
|
|
930
931
|
},
|
|
931
|
-
subscribe:
|
|
932
|
-
trigger:
|
|
932
|
+
subscribe: Je,
|
|
933
|
+
trigger: fe,
|
|
933
934
|
register: _e,
|
|
934
|
-
handleSubmit:
|
|
935
|
-
watch:
|
|
936
|
-
setValue:
|
|
937
|
-
getValues:
|
|
938
|
-
reset:
|
|
939
|
-
resetField:
|
|
940
|
-
clearErrors:
|
|
935
|
+
handleSubmit: qe,
|
|
936
|
+
watch: Ue,
|
|
937
|
+
setValue: q,
|
|
938
|
+
getValues: Ie,
|
|
939
|
+
reset: $e,
|
|
940
|
+
resetField: Xe,
|
|
941
|
+
clearErrors: E,
|
|
941
942
|
unregister: xe,
|
|
942
|
-
setError:
|
|
943
|
-
setFocus:
|
|
944
|
-
getFieldState:
|
|
943
|
+
setError: we,
|
|
944
|
+
setFocus: Re,
|
|
945
|
+
getFieldState: ke
|
|
945
946
|
};
|
|
946
947
|
return {
|
|
947
|
-
...
|
|
948
|
-
formControl:
|
|
948
|
+
...je,
|
|
949
|
+
formControl: je
|
|
949
950
|
};
|
|
950
951
|
}
|
|
951
|
-
function
|
|
952
|
+
function fr(e = {}) {
|
|
952
953
|
const t = X.useRef(void 0), r = X.useRef(void 0), [s, i] = X.useState({
|
|
953
954
|
isDirty: !1,
|
|
954
955
|
isValidating: !1,
|
|
@@ -973,21 +974,21 @@ function dr(e = {}) {
|
|
|
973
974
|
formState: s
|
|
974
975
|
}, e.defaultValues && !re(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
975
976
|
else {
|
|
976
|
-
const { formControl: l, ...
|
|
977
|
+
const { formControl: l, ...f } = dr(e);
|
|
977
978
|
t.current = {
|
|
978
|
-
...
|
|
979
|
+
...f,
|
|
979
980
|
formState: s
|
|
980
981
|
};
|
|
981
982
|
}
|
|
982
983
|
const n = t.current.control;
|
|
983
|
-
return n._options = e,
|
|
984
|
+
return n._options = e, Jt(() => {
|
|
984
985
|
const l = n._subscribe({
|
|
985
986
|
formState: n._proxyFormState,
|
|
986
987
|
callback: () => i({ ...n._formState }),
|
|
987
988
|
reRenderRoot: !0
|
|
988
989
|
});
|
|
989
|
-
return i((
|
|
990
|
-
...
|
|
990
|
+
return i((f) => ({
|
|
991
|
+
...f,
|
|
991
992
|
isReady: !0
|
|
992
993
|
})), n._formState.isReady = !0, l;
|
|
993
994
|
}, [n]), X.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), X.useEffect(() => {
|
|
@@ -1007,15 +1008,15 @@ function dr(e = {}) {
|
|
|
1007
1008
|
}
|
|
1008
1009
|
}, [n, s.isDirty]), X.useEffect(() => {
|
|
1009
1010
|
var l;
|
|
1010
|
-
e.values && !
|
|
1011
|
+
e.values && !he(e.values, r.current) ? (n._reset(e.values, {
|
|
1011
1012
|
keepFieldsRef: !0,
|
|
1012
1013
|
...n._options.resetOptions
|
|
1013
|
-
}), !((l = n._options.resetOptions) === null || l === void 0) && l.keepIsValid || n._setValid(), r.current = e.values, i((
|
|
1014
|
+
}), !((l = n._options.resetOptions) === null || l === void 0) && l.keepIsValid || n._setValid(), r.current = e.values, i((f) => ({ ...f }))) : n._resetDefaultValues();
|
|
1014
1015
|
}, [n, e.values]), X.useEffect(() => {
|
|
1015
1016
|
n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
|
|
1016
|
-
}), t.current.formState =
|
|
1017
|
+
}), t.current.formState = zt(s, n), t.current;
|
|
1017
1018
|
}
|
|
1018
|
-
function
|
|
1019
|
+
function hr() {
|
|
1019
1020
|
const e = /* @__PURE__ */ new Date();
|
|
1020
1021
|
return {
|
|
1021
1022
|
NOW: e,
|
|
@@ -1031,7 +1032,7 @@ function fr() {
|
|
|
1031
1032
|
CURRENT_USER_ID: 1
|
|
1032
1033
|
};
|
|
1033
1034
|
}
|
|
1034
|
-
const
|
|
1035
|
+
const mr = {
|
|
1035
1036
|
// String functions
|
|
1036
1037
|
CONCAT: (...e) => e.map((t) => String(t || "")).join(""),
|
|
1037
1038
|
TRIM: (e) => String(e || "").trim(),
|
|
@@ -1094,56 +1095,56 @@ const hr = {
|
|
|
1094
1095
|
ARRAY_CONTAINS: (e, t) => Array.isArray(e) ? e.includes(t) : !1,
|
|
1095
1096
|
ARRAY_JOIN: (e, t = ",") => Array.isArray(e) ? e.join(t) : ""
|
|
1096
1097
|
};
|
|
1097
|
-
function
|
|
1098
|
+
function me(e, t) {
|
|
1098
1099
|
var r;
|
|
1099
1100
|
switch (e.Type) {
|
|
1100
1101
|
case "Literal":
|
|
1101
1102
|
return e.Value;
|
|
1102
1103
|
case "SystemIdentifier":
|
|
1103
1104
|
if (e.Property) {
|
|
1104
|
-
const
|
|
1105
|
-
return
|
|
1105
|
+
const b = t.systemValues[e.Name];
|
|
1106
|
+
return tt(b, e.Property.Name);
|
|
1106
1107
|
}
|
|
1107
1108
|
return t.systemValues[e.Name];
|
|
1108
1109
|
case "Identifier":
|
|
1109
1110
|
if (e.Property) {
|
|
1110
|
-
const
|
|
1111
|
-
return
|
|
1111
|
+
const b = xt(e, t);
|
|
1112
|
+
return tt(b, e.Property.Name);
|
|
1112
1113
|
}
|
|
1113
|
-
return
|
|
1114
|
+
return xt(e, t);
|
|
1114
1115
|
case "MemberExpression":
|
|
1115
1116
|
if (!e.Arguments || e.Arguments.length === 0)
|
|
1116
1117
|
throw new Error("MemberExpression requires Arguments array");
|
|
1117
|
-
const s =
|
|
1118
|
-
return i ?
|
|
1118
|
+
const s = me(e.Arguments[0], t), i = (r = e.Arguments[0].Property) == null ? void 0 : r.Name;
|
|
1119
|
+
return i ? tt(s, i) : s;
|
|
1119
1120
|
case "BinaryExpression":
|
|
1120
1121
|
if (!e.Arguments || e.Arguments.length !== 2)
|
|
1121
1122
|
throw new Error("BinaryExpression requires exactly 2 arguments");
|
|
1122
|
-
const n =
|
|
1123
|
-
return
|
|
1123
|
+
const n = me(e.Arguments[0], t), l = me(e.Arguments[1], t);
|
|
1124
|
+
return yr(e.Operator, n, l);
|
|
1124
1125
|
case "LogicalExpression":
|
|
1125
1126
|
if (!e.Arguments || e.Arguments.length < 2)
|
|
1126
1127
|
throw new Error("LogicalExpression requires at least 2 arguments");
|
|
1127
|
-
return
|
|
1128
|
+
return gr(e.Operator, e.Arguments, t);
|
|
1128
1129
|
case "CallExpression":
|
|
1129
1130
|
if (!e.Callee)
|
|
1130
1131
|
throw new Error("CallExpression requires Callee");
|
|
1131
|
-
const
|
|
1132
|
-
if (!
|
|
1132
|
+
const f = mr[e.Callee];
|
|
1133
|
+
if (!f)
|
|
1133
1134
|
throw new Error(`Unknown function: ${e.Callee}`);
|
|
1134
1135
|
const w = (e.Arguments || []).map(
|
|
1135
|
-
(
|
|
1136
|
+
(b) => me(b, t)
|
|
1136
1137
|
);
|
|
1137
|
-
return
|
|
1138
|
+
return f(...w);
|
|
1138
1139
|
case "AssignmentExpression":
|
|
1139
1140
|
if (!e.Arguments || e.Arguments.length !== 1)
|
|
1140
1141
|
throw new Error("AssignmentExpression requires exactly 1 argument");
|
|
1141
|
-
return
|
|
1142
|
+
return me(e.Arguments[0], t);
|
|
1142
1143
|
default:
|
|
1143
1144
|
throw new Error(`Unknown expression type: ${e.Type}`);
|
|
1144
1145
|
}
|
|
1145
1146
|
}
|
|
1146
|
-
function
|
|
1147
|
+
function xt(e, t) {
|
|
1147
1148
|
const { Name: r, Source: s } = e;
|
|
1148
1149
|
if (!r)
|
|
1149
1150
|
throw new Error("Identifier requires Name");
|
|
@@ -1153,11 +1154,11 @@ function Et(e, t) {
|
|
|
1153
1154
|
return t.formValues[r];
|
|
1154
1155
|
}
|
|
1155
1156
|
}
|
|
1156
|
-
function
|
|
1157
|
+
function tt(e, t) {
|
|
1157
1158
|
if (!(!e || typeof e != "object"))
|
|
1158
1159
|
return e[t];
|
|
1159
1160
|
}
|
|
1160
|
-
function
|
|
1161
|
+
function yr(e, t, r) {
|
|
1161
1162
|
const s = (i) => i == null ? 0 : typeof i == "number" ? i : typeof i == "object" && i !== null && "value" in i ? Number(i.value) || 0 : Number(i) || 0;
|
|
1162
1163
|
switch (e) {
|
|
1163
1164
|
case "==":
|
|
@@ -1185,33 +1186,33 @@ function mr(e, t, r) {
|
|
|
1185
1186
|
throw new Error(`Unknown binary operator: ${e}`);
|
|
1186
1187
|
}
|
|
1187
1188
|
}
|
|
1188
|
-
function
|
|
1189
|
+
function gr(e, t, r) {
|
|
1189
1190
|
switch (e) {
|
|
1190
1191
|
case "AND":
|
|
1191
|
-
return t.every((s) => !!
|
|
1192
|
+
return t.every((s) => !!me(s, r));
|
|
1192
1193
|
case "OR":
|
|
1193
|
-
return t.some((s) => !!
|
|
1194
|
+
return t.some((s) => !!me(s, r));
|
|
1194
1195
|
default:
|
|
1195
1196
|
throw new Error(`Unknown logical operator: ${e}`);
|
|
1196
1197
|
}
|
|
1197
1198
|
}
|
|
1198
|
-
function
|
|
1199
|
+
function kt(e, t, r = {}) {
|
|
1199
1200
|
const s = {
|
|
1200
1201
|
formValues: t,
|
|
1201
|
-
systemValues:
|
|
1202
|
+
systemValues: hr(),
|
|
1202
1203
|
referenceData: r
|
|
1203
1204
|
};
|
|
1204
1205
|
try {
|
|
1205
|
-
return
|
|
1206
|
+
return me(e, s);
|
|
1206
1207
|
} catch (i) {
|
|
1207
1208
|
return console.warn("Expression evaluation failed:", i), !1;
|
|
1208
1209
|
}
|
|
1209
1210
|
}
|
|
1210
|
-
function
|
|
1211
|
+
function _t(e, t, r = {}) {
|
|
1211
1212
|
const s = [];
|
|
1212
1213
|
for (const i of e)
|
|
1213
1214
|
try {
|
|
1214
|
-
|
|
1215
|
+
kt(
|
|
1215
1216
|
i.Condition.ExpressionTree,
|
|
1216
1217
|
t,
|
|
1217
1218
|
r
|
|
@@ -1225,25 +1226,25 @@ function At(e, t, r = {}) {
|
|
|
1225
1226
|
}
|
|
1226
1227
|
return s;
|
|
1227
1228
|
}
|
|
1228
|
-
function
|
|
1229
|
+
function pr(e, t = {}, r = {}) {
|
|
1229
1230
|
try {
|
|
1230
|
-
return
|
|
1231
|
+
return kt(e, t, r);
|
|
1231
1232
|
} catch (s) {
|
|
1232
1233
|
return console.warn("Default value calculation failed:", s), null;
|
|
1233
1234
|
}
|
|
1234
1235
|
}
|
|
1235
|
-
function
|
|
1236
|
-
var
|
|
1237
|
-
const r = ((
|
|
1236
|
+
function Dt(e, t) {
|
|
1237
|
+
var f, w, b;
|
|
1238
|
+
const r = ((f = e.Expression) == null ? void 0 : f.toLowerCase()) || "", s = ((w = e.Name) == null ? void 0 : w.toLowerCase()) || "", i = ((b = e.Id) == null ? void 0 : b.toLowerCase()) || "", n = t.toLowerCase();
|
|
1238
1239
|
return s.includes("required") || i.includes("required") ? !0 : [
|
|
1239
1240
|
`${n} != null`,
|
|
1240
1241
|
`${n} != ''`,
|
|
1241
1242
|
`trim(${n}) != ''`,
|
|
1242
1243
|
`${n}!=null`,
|
|
1243
1244
|
`${n}!=''`
|
|
1244
|
-
].some((
|
|
1245
|
+
].some((O) => r.includes(O));
|
|
1245
1246
|
}
|
|
1246
|
-
function
|
|
1247
|
+
function br(e) {
|
|
1247
1248
|
const t = { ...e };
|
|
1248
1249
|
t.Rules || (t.Rules = {
|
|
1249
1250
|
Validation: {},
|
|
@@ -1256,18 +1257,18 @@ function pr(e) {
|
|
|
1256
1257
|
if (i.Validation && Array.isArray(i.Validation))
|
|
1257
1258
|
if (i.Validation.length > 0 && typeof i.Validation[0] == "object") {
|
|
1258
1259
|
const l = [];
|
|
1259
|
-
i.Validation.forEach((
|
|
1260
|
-
t.Rules.Validation[
|
|
1260
|
+
i.Validation.forEach((f) => {
|
|
1261
|
+
t.Rules.Validation[f.Id] = f, l.push(f.Id), Dt(f, s) && (n = !0);
|
|
1261
1262
|
}), r[s] = {
|
|
1262
1263
|
...i,
|
|
1263
1264
|
Validation: l,
|
|
1264
1265
|
Required: n
|
|
1265
1266
|
};
|
|
1266
1267
|
} else
|
|
1267
|
-
i.Validation.forEach((
|
|
1268
|
-
var
|
|
1269
|
-
const w = (
|
|
1270
|
-
w &&
|
|
1268
|
+
i.Validation.forEach((f) => {
|
|
1269
|
+
var b;
|
|
1270
|
+
const w = (b = t.Rules.Validation) == null ? void 0 : b[f];
|
|
1271
|
+
w && Dt(w, s) && (n = !0);
|
|
1271
1272
|
}), n && !i.Required && (r[s] = {
|
|
1272
1273
|
...i,
|
|
1273
1274
|
Required: !0
|
|
@@ -1285,7 +1286,7 @@ function pr(e) {
|
|
|
1285
1286
|
}
|
|
1286
1287
|
}), t.Fields = r, t;
|
|
1287
1288
|
}
|
|
1288
|
-
function
|
|
1289
|
+
function wr(e) {
|
|
1289
1290
|
var r, s, i;
|
|
1290
1291
|
const t = {
|
|
1291
1292
|
validation: {},
|
|
@@ -1294,7 +1295,7 @@ function br(e) {
|
|
|
1294
1295
|
};
|
|
1295
1296
|
return (r = e.Rules) != null && r.Validation && (t.validation = { ...e.Rules.Validation }), (s = e.Rules) != null && s.Computation && (t.computation = { ...e.Rules.Computation }), (i = e.Rules) != null && i.BusinessLogic && (t.businessLogic = { ...e.Rules.BusinessLogic }), t;
|
|
1296
1297
|
}
|
|
1297
|
-
function
|
|
1298
|
+
function vr(e) {
|
|
1298
1299
|
var s;
|
|
1299
1300
|
const t = {};
|
|
1300
1301
|
if (!((s = e.Rules) != null && s.Computation)) return t;
|
|
@@ -1302,21 +1303,21 @@ function wr(e) {
|
|
|
1302
1303
|
return r.sort((i, n) => n.length - i.length), Object.entries(e.Rules.Computation).forEach(([i, n]) => {
|
|
1303
1304
|
const l = i.toUpperCase().replace(/[_-]/g, "");
|
|
1304
1305
|
for (const w of r) {
|
|
1305
|
-
const
|
|
1306
|
-
if (l.includes(
|
|
1306
|
+
const b = w.toUpperCase().replace(/[_-]/g, "");
|
|
1307
|
+
if (l.includes(b)) {
|
|
1307
1308
|
t[i] = w;
|
|
1308
1309
|
return;
|
|
1309
1310
|
}
|
|
1310
1311
|
}
|
|
1311
|
-
const
|
|
1312
|
+
const f = `${n.Name || ""} ${n.Description || ""}`.toLowerCase();
|
|
1312
1313
|
for (const w of r)
|
|
1313
|
-
if (
|
|
1314
|
+
if (f.includes(w.toLowerCase())) {
|
|
1314
1315
|
t[i] = w;
|
|
1315
1316
|
return;
|
|
1316
1317
|
}
|
|
1317
1318
|
}), t;
|
|
1318
1319
|
}
|
|
1319
|
-
function
|
|
1320
|
+
function Fr(e, t) {
|
|
1320
1321
|
const r = {};
|
|
1321
1322
|
Object.keys(e.Fields).forEach((i) => {
|
|
1322
1323
|
r[i] = {
|
|
@@ -1325,39 +1326,39 @@ function vr(e, t) {
|
|
|
1325
1326
|
businessLogic: []
|
|
1326
1327
|
};
|
|
1327
1328
|
}), Object.entries(e.Fields).forEach(([i, n]) => {
|
|
1328
|
-
n.Validation && Array.isArray(n.Validation) && n.Validation.forEach((
|
|
1329
|
-
t.validation[
|
|
1330
|
-
}), n.Formula && Object.entries(t.computation).forEach(([l,
|
|
1329
|
+
n.Validation && Array.isArray(n.Validation) && n.Validation.forEach((f) => {
|
|
1330
|
+
t.validation[f] ? r[i].validation.push(f) : t.computation[f] ? r[i].computation.push(f) : t.businessLogic[f] && r[i].businessLogic.push(f);
|
|
1331
|
+
}), n.Formula && Object.entries(t.computation).forEach(([l, f]) => {
|
|
1331
1332
|
var w;
|
|
1332
|
-
|
|
1333
|
+
f.Expression === ((w = n.Formula) == null ? void 0 : w.Expression) && (r[i].computation.includes(l) || r[i].computation.push(l));
|
|
1333
1334
|
});
|
|
1334
1335
|
});
|
|
1335
|
-
const s =
|
|
1336
|
+
const s = vr(e);
|
|
1336
1337
|
return Object.entries(s).forEach(([i, n]) => {
|
|
1337
1338
|
r[n] && !r[n].computation.includes(i) && r[n].computation.push(i);
|
|
1338
1339
|
}), r;
|
|
1339
1340
|
}
|
|
1340
|
-
function
|
|
1341
|
+
function Vr(e, t) {
|
|
1341
1342
|
const r = {}, s = {
|
|
1342
1343
|
editable: !0,
|
|
1343
1344
|
readable: !0,
|
|
1344
1345
|
hidden: !1
|
|
1345
1346
|
};
|
|
1346
1347
|
return Object.keys(e.Fields).forEach((i) => {
|
|
1347
|
-
var w,
|
|
1348
|
+
var w, b, O, D, v, m;
|
|
1348
1349
|
if (!t || !((w = e.RolePermission) != null && w[t])) {
|
|
1349
1350
|
r[i] = s;
|
|
1350
1351
|
return;
|
|
1351
1352
|
}
|
|
1352
|
-
const n = e.RolePermission[t], l = ((
|
|
1353
|
+
const n = e.RolePermission[t], l = ((b = n.Editable) == null ? void 0 : b.includes(i)) || ((O = n.Editable) == null ? void 0 : O.includes("*")) || !1, f = ((D = n.ReadOnly) == null ? void 0 : D.includes(i)) || ((v = n.ReadOnly) == null ? void 0 : v.includes("*")) || l;
|
|
1353
1354
|
r[i] = {
|
|
1354
1355
|
editable: l && !((m = n.ReadOnly) != null && m.includes(i)),
|
|
1355
|
-
readable:
|
|
1356
|
-
hidden: !
|
|
1356
|
+
readable: f,
|
|
1357
|
+
hidden: !f
|
|
1357
1358
|
};
|
|
1358
1359
|
}), r;
|
|
1359
1360
|
}
|
|
1360
|
-
function
|
|
1361
|
+
function Er(e, t) {
|
|
1361
1362
|
switch (e) {
|
|
1362
1363
|
case "String":
|
|
1363
1364
|
return t.toLowerCase().includes("email") ? "email" : t.toLowerCase().includes("password") ? "password" : "text";
|
|
@@ -1378,14 +1379,14 @@ function Vr(e, t) {
|
|
|
1378
1379
|
return "text";
|
|
1379
1380
|
}
|
|
1380
1381
|
}
|
|
1381
|
-
function
|
|
1382
|
+
function Ut(e) {
|
|
1382
1383
|
return e.replace(/([A-Z])/g, " $1").replace(/^./, (t) => t.toUpperCase()).replace(/_/g, " ").trim();
|
|
1383
1384
|
}
|
|
1384
|
-
function
|
|
1385
|
+
function Ar(e, t, r) {
|
|
1385
1386
|
const s = {};
|
|
1386
1387
|
switch (t.Required && (s.required = {
|
|
1387
1388
|
value: !0,
|
|
1388
|
-
message: `${
|
|
1389
|
+
message: `${Ut(e)} is required`
|
|
1389
1390
|
}), t.Type) {
|
|
1390
1391
|
case "Number":
|
|
1391
1392
|
s.valueAsNumber = !0;
|
|
@@ -1397,13 +1398,13 @@ function Er(e, t, r) {
|
|
|
1397
1398
|
}
|
|
1398
1399
|
return t.Validation && t.Validation.length > 0 && (s.validate = () => !0), s;
|
|
1399
1400
|
}
|
|
1400
|
-
function
|
|
1401
|
+
function xr(e) {
|
|
1401
1402
|
return e.Values ? e.Values.Mode === "Static" && e.Values.Items ? e.Values.Items.map((t) => ({
|
|
1402
1403
|
value: t.Value,
|
|
1403
1404
|
label: t.Label
|
|
1404
1405
|
})) : e.Values.Mode === "Dynamic" && e.Values.Reference ? [] : [] : [];
|
|
1405
1406
|
}
|
|
1406
|
-
function
|
|
1407
|
+
function _r(e, t = {}) {
|
|
1407
1408
|
if (!e.DefaultValue)
|
|
1408
1409
|
switch (e.Type) {
|
|
1409
1410
|
case "Boolean":
|
|
@@ -1419,12 +1420,12 @@ function xr(e, t = {}) {
|
|
|
1419
1420
|
default:
|
|
1420
1421
|
return;
|
|
1421
1422
|
}
|
|
1422
|
-
return
|
|
1423
|
+
return pr(
|
|
1423
1424
|
e.DefaultValue.ExpressionTree,
|
|
1424
1425
|
t
|
|
1425
1426
|
);
|
|
1426
1427
|
}
|
|
1427
|
-
function
|
|
1428
|
+
function Dr(e, t, r, s = {}, i, n) {
|
|
1428
1429
|
const l = {
|
|
1429
1430
|
editable: !0,
|
|
1430
1431
|
readable: !0,
|
|
@@ -1433,58 +1434,58 @@ function _r(e, t, r, s = {}, i, n) {
|
|
|
1433
1434
|
validation: [],
|
|
1434
1435
|
computation: [],
|
|
1435
1436
|
businessLogic: []
|
|
1436
|
-
},
|
|
1437
|
-
return
|
|
1437
|
+
}, b = t.Computed || !!t.Formula || w.computation.length > 0, O = Ar(e, t);
|
|
1438
|
+
return b && (O.disabled = !0), {
|
|
1438
1439
|
name: e,
|
|
1439
|
-
type:
|
|
1440
|
-
label: t.Name ||
|
|
1440
|
+
type: Er(t.Type, e),
|
|
1441
|
+
label: t.Name || Ut(e),
|
|
1441
1442
|
required: t.Required || !1,
|
|
1442
|
-
computed:
|
|
1443
|
-
defaultValue:
|
|
1444
|
-
options:
|
|
1445
|
-
validation:
|
|
1443
|
+
computed: b,
|
|
1444
|
+
defaultValue: _r(t, s),
|
|
1445
|
+
options: xr(t),
|
|
1446
|
+
validation: O,
|
|
1446
1447
|
description: t.Description,
|
|
1447
1448
|
_bdoField: t,
|
|
1448
1449
|
permission: i || l,
|
|
1449
1450
|
rules: w
|
|
1450
1451
|
};
|
|
1451
1452
|
}
|
|
1452
|
-
function
|
|
1453
|
+
function Sr(e, t = {}, r) {
|
|
1453
1454
|
let s = e;
|
|
1454
|
-
s =
|
|
1455
|
-
const i = {}, n = [], l = [],
|
|
1455
|
+
s = br(s);
|
|
1456
|
+
const i = {}, n = [], l = [], f = [], w = [], b = wr(s), O = Fr(s, b), D = Vr(s, r);
|
|
1456
1457
|
for (const [v, m] of Object.entries(s.Fields)) {
|
|
1457
1458
|
if (v.startsWith("_") && !["_id"].includes(v))
|
|
1458
1459
|
continue;
|
|
1459
|
-
const
|
|
1460
|
-
if (
|
|
1460
|
+
const Y = D[v];
|
|
1461
|
+
if (Y.hidden)
|
|
1461
1462
|
continue;
|
|
1462
|
-
const
|
|
1463
|
+
const C = Dr(
|
|
1463
1464
|
v,
|
|
1464
1465
|
m,
|
|
1465
1466
|
s.Fields,
|
|
1466
1467
|
t,
|
|
1467
|
-
|
|
1468
|
-
|
|
1468
|
+
Y,
|
|
1469
|
+
O[v] || {
|
|
1469
1470
|
validation: [],
|
|
1470
1471
|
computation: [],
|
|
1471
1472
|
businessLogic: []
|
|
1472
1473
|
}
|
|
1473
1474
|
);
|
|
1474
|
-
i[v] =
|
|
1475
|
+
i[v] = C, n.push(v), C.computed && l.push(v), C.required && f.push(v);
|
|
1475
1476
|
}
|
|
1476
1477
|
return {
|
|
1477
1478
|
fields: i,
|
|
1478
1479
|
fieldOrder: n,
|
|
1479
1480
|
computedFields: l,
|
|
1480
|
-
requiredFields:
|
|
1481
|
+
requiredFields: f,
|
|
1481
1482
|
crossFieldValidation: w,
|
|
1482
|
-
rules:
|
|
1483
|
-
fieldRules:
|
|
1483
|
+
rules: b,
|
|
1484
|
+
fieldRules: O,
|
|
1484
1485
|
rolePermissions: s.RolePermission
|
|
1485
1486
|
};
|
|
1486
1487
|
}
|
|
1487
|
-
function
|
|
1488
|
+
function Rr(e) {
|
|
1488
1489
|
var r;
|
|
1489
1490
|
if (e.type !== "reference" || !((r = e._bdoField.Values) != null && r.Reference))
|
|
1490
1491
|
return null;
|
|
@@ -1497,18 +1498,18 @@ function Sr(e) {
|
|
|
1497
1498
|
sort: t.Sort
|
|
1498
1499
|
};
|
|
1499
1500
|
}
|
|
1500
|
-
function
|
|
1501
|
+
function Nr(e) {
|
|
1501
1502
|
const t = {};
|
|
1502
1503
|
for (const [r, s] of Object.entries(e.fields))
|
|
1503
1504
|
if (s.type === "reference") {
|
|
1504
|
-
const i =
|
|
1505
|
+
const i = Rr(s);
|
|
1505
1506
|
i && (t[r] = i);
|
|
1506
1507
|
}
|
|
1507
1508
|
return t;
|
|
1508
1509
|
}
|
|
1509
|
-
async function
|
|
1510
|
+
async function Or(e) {
|
|
1510
1511
|
try {
|
|
1511
|
-
const r = (await
|
|
1512
|
+
const r = (await $t(e)).BOBlob;
|
|
1512
1513
|
if (!r || typeof r != "object" || !r.Fields)
|
|
1513
1514
|
throw new Error(`Invalid BDO schema response for ${e}`);
|
|
1514
1515
|
return r;
|
|
@@ -1518,13 +1519,13 @@ async function Nr(e) {
|
|
|
1518
1519
|
);
|
|
1519
1520
|
}
|
|
1520
1521
|
}
|
|
1521
|
-
async function
|
|
1522
|
+
async function Cr(e, t = 3) {
|
|
1522
1523
|
let r;
|
|
1523
1524
|
for (let s = 1; s <= t; s++)
|
|
1524
1525
|
try {
|
|
1525
|
-
return await
|
|
1526
|
+
return await Or(e);
|
|
1526
1527
|
} catch (i) {
|
|
1527
|
-
if (r = i, s < t) {
|
|
1528
|
+
if (r = Ve(i), s < t) {
|
|
1528
1529
|
const n = Math.min(1e3 * Math.pow(2, s - 1), 5e3);
|
|
1529
1530
|
await new Promise((l) => setTimeout(l, n));
|
|
1530
1531
|
continue;
|
|
@@ -1532,20 +1533,20 @@ async function Or(e, t = 3) {
|
|
|
1532
1533
|
}
|
|
1533
1534
|
throw r;
|
|
1534
1535
|
}
|
|
1535
|
-
async function
|
|
1536
|
+
async function Tr(e, t) {
|
|
1536
1537
|
try {
|
|
1537
|
-
return await
|
|
1538
|
+
return await be(e).get(t);
|
|
1538
1539
|
} catch (r) {
|
|
1539
1540
|
throw console.error(`Record fetch error for ${e}/${t}:`, r), new Error(
|
|
1540
1541
|
`Failed to load record: ${r instanceof Error ? r.message : "Unknown error"}`
|
|
1541
1542
|
);
|
|
1542
1543
|
}
|
|
1543
1544
|
}
|
|
1544
|
-
async function
|
|
1545
|
+
async function Lr(e, t, r, s) {
|
|
1545
1546
|
try {
|
|
1546
1547
|
let i;
|
|
1547
1548
|
if (t === "create")
|
|
1548
|
-
return i = await
|
|
1549
|
+
return i = await be(e).create(r), {
|
|
1549
1550
|
success: !0,
|
|
1550
1551
|
data: i,
|
|
1551
1552
|
recordId: i._id || s
|
|
@@ -1553,7 +1554,7 @@ async function Tr(e, t, r, s) {
|
|
|
1553
1554
|
if (t === "update") {
|
|
1554
1555
|
if (!s)
|
|
1555
1556
|
throw new Error("Record ID is required for update operations");
|
|
1556
|
-
return i = await
|
|
1557
|
+
return i = await be(e).update(s, r), {
|
|
1557
1558
|
success: !0,
|
|
1558
1559
|
data: i,
|
|
1559
1560
|
recordId: i._id || s
|
|
@@ -1569,19 +1570,19 @@ async function Tr(e, t, r, s) {
|
|
|
1569
1570
|
};
|
|
1570
1571
|
}
|
|
1571
1572
|
}
|
|
1572
|
-
async function
|
|
1573
|
+
async function Mr(e, t = ["_id"], r, s) {
|
|
1573
1574
|
try {
|
|
1574
1575
|
const i = {};
|
|
1575
|
-
return r && (i.Filter = r), s && (i.Sort = s), t.length > 0 && (i.Field = t), (await
|
|
1576
|
+
return r && (i.Filter = r), s && (i.Sort = s), t.length > 0 && (i.Field = t), (await be(e).list(i)).Data || [];
|
|
1576
1577
|
} catch (i) {
|
|
1577
1578
|
return console.error(`Reference data fetch error for ${e}:`, i), [];
|
|
1578
1579
|
}
|
|
1579
1580
|
}
|
|
1580
|
-
async function
|
|
1581
|
+
async function Ir(e) {
|
|
1581
1582
|
const t = {}, r = Object.entries(e).map(
|
|
1582
1583
|
async ([i, n]) => {
|
|
1583
1584
|
try {
|
|
1584
|
-
const l = await
|
|
1585
|
+
const l = await Mr(
|
|
1585
1586
|
n.businessObject,
|
|
1586
1587
|
n.fields,
|
|
1587
1588
|
n.filters,
|
|
@@ -1600,66 +1601,66 @@ async function Mr(e) {
|
|
|
1600
1601
|
}
|
|
1601
1602
|
}), t;
|
|
1602
1603
|
}
|
|
1603
|
-
function
|
|
1604
|
+
function kr(e, t, r = "create", s) {
|
|
1604
1605
|
const i = {};
|
|
1605
1606
|
return Object.keys(e).forEach((n) => {
|
|
1606
|
-
const l = n,
|
|
1607
|
-
if (!t.includes(n) &&
|
|
1607
|
+
const l = n, f = e[l];
|
|
1608
|
+
if (!t.includes(n) && f !== void 0) {
|
|
1608
1609
|
if (r === "create") {
|
|
1609
|
-
i[l] =
|
|
1610
|
+
i[l] = f;
|
|
1610
1611
|
return;
|
|
1611
1612
|
}
|
|
1612
1613
|
if (r === "update") {
|
|
1613
1614
|
if (!s) {
|
|
1614
|
-
i[l] =
|
|
1615
|
+
i[l] = f;
|
|
1615
1616
|
return;
|
|
1616
1617
|
}
|
|
1617
1618
|
const w = s[l];
|
|
1618
|
-
JSON.stringify(
|
|
1619
|
+
JSON.stringify(f) !== JSON.stringify(w) && (i[l] = f);
|
|
1619
1620
|
}
|
|
1620
1621
|
}
|
|
1621
1622
|
}), i;
|
|
1622
1623
|
}
|
|
1623
|
-
function
|
|
1624
|
+
function Gr(e) {
|
|
1624
1625
|
var t, r, s, i;
|
|
1625
1626
|
return typeof e == "string" ? e : e != null && e.message ? e.message : (r = (t = e == null ? void 0 : e.response) == null ? void 0 : t.data) != null && r.message ? e.response.data.message : (i = (s = e == null ? void 0 : e.response) == null ? void 0 : s.data) != null && i.error ? e.response.data.error : "An unexpected error occurred";
|
|
1626
1627
|
}
|
|
1627
|
-
function
|
|
1628
|
+
function Xr(e) {
|
|
1628
1629
|
var t, r;
|
|
1629
1630
|
return !navigator.onLine || (e == null ? void 0 : e.code) === "NETWORK_ERROR" || ((t = e == null ? void 0 : e.message) == null ? void 0 : t.toLowerCase().includes("network")) || ((r = e == null ? void 0 : e.message) == null ? void 0 : r.toLowerCase().includes("fetch"));
|
|
1630
1631
|
}
|
|
1631
|
-
function
|
|
1632
|
+
function Qr(e) {
|
|
1632
1633
|
var t, r, s;
|
|
1633
1634
|
return (e == null ? void 0 : e.status) === 400 || ((t = e == null ? void 0 : e.response) == null ? void 0 : t.status) === 400 || ((r = e == null ? void 0 : e.message) == null ? void 0 : r.toLowerCase().includes("validation")) || ((s = e == null ? void 0 : e.message) == null ? void 0 : s.toLowerCase().includes("invalid"));
|
|
1634
1635
|
}
|
|
1635
|
-
const
|
|
1636
|
-
function
|
|
1637
|
-
|
|
1636
|
+
const Ae = /* @__PURE__ */ new Map();
|
|
1637
|
+
function Ur(e, t, r = 10) {
|
|
1638
|
+
Ae.set(e, {
|
|
1638
1639
|
data: t,
|
|
1639
1640
|
timestamp: Date.now(),
|
|
1640
1641
|
ttl: r * 60 * 1e3
|
|
1641
1642
|
});
|
|
1642
1643
|
}
|
|
1643
|
-
function
|
|
1644
|
-
const t =
|
|
1645
|
-
return t ? Date.now() - t.timestamp > t.ttl ? (
|
|
1644
|
+
function Br(e) {
|
|
1645
|
+
const t = Ae.get(e);
|
|
1646
|
+
return t ? Date.now() - t.timestamp > t.ttl ? (Ae.delete(e), null) : t.data : null;
|
|
1646
1647
|
}
|
|
1647
|
-
function
|
|
1648
|
-
e ? Array.from(
|
|
1648
|
+
function Zr(e) {
|
|
1649
|
+
e ? Array.from(Ae.keys()).filter(
|
|
1649
1650
|
(r) => r.startsWith(e)
|
|
1650
|
-
).forEach((r) =>
|
|
1651
|
+
).forEach((r) => Ae.delete(r)) : Ae.clear();
|
|
1651
1652
|
}
|
|
1652
|
-
async function
|
|
1653
|
-
const t = `schema:${e}`, r =
|
|
1653
|
+
async function Pr(e) {
|
|
1654
|
+
const t = `schema:${e}`, r = Br(t);
|
|
1654
1655
|
if (r)
|
|
1655
1656
|
return r;
|
|
1656
|
-
const s = await
|
|
1657
|
-
return
|
|
1657
|
+
const s = await Cr(e);
|
|
1658
|
+
return Ur(t, s, 30), s;
|
|
1658
1659
|
}
|
|
1659
|
-
class
|
|
1660
|
+
class St {
|
|
1660
1661
|
constructor(t = 1e3) {
|
|
1661
|
-
|
|
1662
|
-
|
|
1662
|
+
ve(this, "cache", /* @__PURE__ */ new Map());
|
|
1663
|
+
ve(this, "maxSize");
|
|
1663
1664
|
this.maxSize = t;
|
|
1664
1665
|
}
|
|
1665
1666
|
get(t) {
|
|
@@ -1679,7 +1680,7 @@ class _t {
|
|
|
1679
1680
|
this.cache.clear();
|
|
1680
1681
|
}
|
|
1681
1682
|
}
|
|
1682
|
-
function
|
|
1683
|
+
function qr(e) {
|
|
1683
1684
|
const t = /* @__PURE__ */ new Set();
|
|
1684
1685
|
function r(s) {
|
|
1685
1686
|
switch (s.Type) {
|
|
@@ -1698,11 +1699,11 @@ function Pr(e) {
|
|
|
1698
1699
|
}
|
|
1699
1700
|
return r(e), t;
|
|
1700
1701
|
}
|
|
1701
|
-
class
|
|
1702
|
+
class $r {
|
|
1702
1703
|
constructor() {
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1704
|
+
ve(this, "resultCache", new St(500));
|
|
1705
|
+
ve(this, "dependencyCache", new St(200));
|
|
1706
|
+
ve(this, "compiledExpressions", /* @__PURE__ */ new Map());
|
|
1706
1707
|
}
|
|
1707
1708
|
/**
|
|
1708
1709
|
* Create cache key from expression and context
|
|
@@ -1717,7 +1718,7 @@ class qr {
|
|
|
1717
1718
|
getDependencies(t) {
|
|
1718
1719
|
const r = JSON.stringify(t);
|
|
1719
1720
|
let s = this.dependencyCache.get(r);
|
|
1720
|
-
return s || (s =
|
|
1721
|
+
return s || (s = qr(t), this.dependencyCache.set(r, s)), s;
|
|
1721
1722
|
}
|
|
1722
1723
|
/**
|
|
1723
1724
|
* Check if expression result is cached and context hasn't changed
|
|
@@ -1848,7 +1849,7 @@ class qr {
|
|
|
1848
1849
|
const s = ((i = t.Arguments) == null ? void 0 : i.map((n) => this.evaluateNode(n, r))) || [];
|
|
1849
1850
|
switch (t.Callee) {
|
|
1850
1851
|
case "CONCAT":
|
|
1851
|
-
return s.map((
|
|
1852
|
+
return s.map((b) => String(b || "")).join("");
|
|
1852
1853
|
case "TRIM":
|
|
1853
1854
|
return String(s[0] || "").trim();
|
|
1854
1855
|
case "LENGTH":
|
|
@@ -1862,14 +1863,14 @@ class qr {
|
|
|
1862
1863
|
case "MATCHES":
|
|
1863
1864
|
return new RegExp(String(s[1])).test(String(s[0] || ""));
|
|
1864
1865
|
case "SUM":
|
|
1865
|
-
return s.reduce((
|
|
1866
|
+
return s.reduce((b, O) => b + (Number(O) || 0), 0);
|
|
1866
1867
|
case "AVG":
|
|
1867
|
-
const n = s.filter((
|
|
1868
|
-
return n.length > 0 ? n.reduce((
|
|
1868
|
+
const n = s.filter((b) => !isNaN(Number(b)));
|
|
1869
|
+
return n.length > 0 ? n.reduce((b, O) => b + Number(O), 0) / n.length : 0;
|
|
1869
1870
|
case "MIN":
|
|
1870
|
-
return Math.min(...s.map((
|
|
1871
|
+
return Math.min(...s.map((b) => Number(b) || 0));
|
|
1871
1872
|
case "MAX":
|
|
1872
|
-
return Math.max(...s.map((
|
|
1873
|
+
return Math.max(...s.map((b) => Number(b) || 0));
|
|
1873
1874
|
case "ROUND":
|
|
1874
1875
|
return Math.round(Number(s[0]) || 0);
|
|
1875
1876
|
case "FLOOR":
|
|
@@ -1885,7 +1886,7 @@ class qr {
|
|
|
1885
1886
|
case "DAY":
|
|
1886
1887
|
return new Date(s[0]).getDate();
|
|
1887
1888
|
case "DATE_DIFF":
|
|
1888
|
-
const l = new Date(s[0]),
|
|
1889
|
+
const l = new Date(s[0]), f = new Date(s[1]), w = Math.abs(l.getTime() - f.getTime());
|
|
1889
1890
|
return Math.ceil(w / (1e3 * 60 * 60 * 24));
|
|
1890
1891
|
case "IF":
|
|
1891
1892
|
return s[0] ? s[1] : s[2];
|
|
@@ -1912,14 +1913,14 @@ class qr {
|
|
|
1912
1913
|
this.resultCache.clear(), this.dependencyCache.clear(), this.compiledExpressions.clear();
|
|
1913
1914
|
}
|
|
1914
1915
|
}
|
|
1915
|
-
const
|
|
1916
|
-
function
|
|
1916
|
+
const Bt = new $r();
|
|
1917
|
+
function jr(e, t, r, s, i) {
|
|
1917
1918
|
if (!r || r.length === 0)
|
|
1918
1919
|
return { isValid: !0 };
|
|
1919
1920
|
const n = { ...s, [e]: t };
|
|
1920
1921
|
for (const l of r)
|
|
1921
1922
|
try {
|
|
1922
|
-
if (!
|
|
1923
|
+
if (!Bt.evaluate(
|
|
1923
1924
|
l.ExpressionTree,
|
|
1924
1925
|
n,
|
|
1925
1926
|
i
|
|
@@ -1929,15 +1930,15 @@ function $r(e, t, r, s, i) {
|
|
|
1929
1930
|
message: l.Message || `Validation failed for ${l.Name}`,
|
|
1930
1931
|
fieldName: e
|
|
1931
1932
|
};
|
|
1932
|
-
} catch (
|
|
1933
|
-
console.warn(`Validation rule ${l.Id} failed to evaluate:`,
|
|
1933
|
+
} catch (f) {
|
|
1934
|
+
console.warn(`Validation rule ${l.Id} failed to evaluate:`, f);
|
|
1934
1935
|
}
|
|
1935
1936
|
return { isValid: !0 };
|
|
1936
1937
|
}
|
|
1937
|
-
function
|
|
1938
|
-
return Array.from(
|
|
1938
|
+
function Rt(e) {
|
|
1939
|
+
return Array.from(Bt.getDependencies(e));
|
|
1939
1940
|
}
|
|
1940
|
-
function
|
|
1941
|
+
function es(e) {
|
|
1941
1942
|
const {
|
|
1942
1943
|
source: t,
|
|
1943
1944
|
operation: r,
|
|
@@ -1946,24 +1947,24 @@ function Qr(e) {
|
|
|
1946
1947
|
mode: n = "onBlur",
|
|
1947
1948
|
// Validation mode - controls when errors are shown (see types.ts for details)
|
|
1948
1949
|
enabled: l = !0,
|
|
1949
|
-
userRole:
|
|
1950
|
+
userRole: f,
|
|
1950
1951
|
onSchemaError: w,
|
|
1951
|
-
skipSchemaFetch:
|
|
1952
|
-
schema:
|
|
1952
|
+
skipSchemaFetch: b = !1,
|
|
1953
|
+
schema: O,
|
|
1953
1954
|
interactionMode: D = "interactive"
|
|
1954
|
-
} = e, v = D === "interactive", [m,
|
|
1955
|
-
|
|
1956
|
-
|
|
1955
|
+
} = e, v = D === "interactive", [m, Y] = ge(null), [C, Z] = ge({}), [W, A] = ge(!1), [ee] = ge({}), [M, L] = ge(null), [le, ye] = ge(!1), [ae, ne] = ge(null), j = Ne(!1), ce = Ne(null), V = Ne(null), x = Ne(!1), S = Ne(w);
|
|
1956
|
+
He(() => {
|
|
1957
|
+
S.current = w;
|
|
1957
1958
|
}, [w]);
|
|
1958
1959
|
const {
|
|
1959
|
-
data:
|
|
1960
|
-
isLoading:
|
|
1961
|
-
error:
|
|
1962
|
-
refetch:
|
|
1963
|
-
} =
|
|
1960
|
+
data: I,
|
|
1961
|
+
isLoading: G,
|
|
1962
|
+
error: q,
|
|
1963
|
+
refetch: de
|
|
1964
|
+
} = ft({
|
|
1964
1965
|
queryKey: ["form-schema", t],
|
|
1965
|
-
queryFn: () =>
|
|
1966
|
-
enabled: l && (!
|
|
1966
|
+
queryFn: () => b ? Promise.resolve(O || {}) : Pr(t),
|
|
1967
|
+
enabled: l && (!b || !!O),
|
|
1967
1968
|
retry: 3,
|
|
1968
1969
|
staleTime: 30 * 60 * 1e3,
|
|
1969
1970
|
// 30 minutes - schemas don't change frequently
|
|
@@ -1971,12 +1972,12 @@ function Qr(e) {
|
|
|
1971
1972
|
// 1 hour - keep schemas in cache longer
|
|
1972
1973
|
throwOnError: !1
|
|
1973
1974
|
}), {
|
|
1974
|
-
data:
|
|
1975
|
-
isLoading:
|
|
1976
|
-
error:
|
|
1977
|
-
} =
|
|
1975
|
+
data: K,
|
|
1976
|
+
isLoading: fe,
|
|
1977
|
+
error: Ie
|
|
1978
|
+
} = ft({
|
|
1978
1979
|
queryKey: ["form-record", t, s],
|
|
1979
|
-
queryFn: () =>
|
|
1980
|
+
queryFn: () => Tr(t, s),
|
|
1980
1981
|
enabled: l && r === "update" && !!s,
|
|
1981
1982
|
retry: 3,
|
|
1982
1983
|
staleTime: 5 * 60 * 1e3,
|
|
@@ -1984,122 +1985,132 @@ function Qr(e) {
|
|
|
1984
1985
|
gcTime: 15 * 60 * 1e3,
|
|
1985
1986
|
// 15 minutes - keep records for a reasonable time
|
|
1986
1987
|
throwOnError: !1
|
|
1987
|
-
}),
|
|
1988
|
-
const
|
|
1989
|
-
if (r === "update" &&
|
|
1990
|
-
for (const [
|
|
1991
|
-
|
|
1992
|
-
return
|
|
1993
|
-
}, [i,
|
|
1988
|
+
}), ke = Oe(() => {
|
|
1989
|
+
const u = { ...i };
|
|
1990
|
+
if (r === "update" && K && Object.assign(u, K), m)
|
|
1991
|
+
for (const [h, c] of Object.entries(m.fields))
|
|
1992
|
+
c.defaultValue !== void 0 && !(h in u) && (u[h] = c.defaultValue);
|
|
1993
|
+
return u;
|
|
1994
|
+
}, [i, K, r, m]), E = fr({
|
|
1994
1995
|
mode: n,
|
|
1995
1996
|
defaultValues: i,
|
|
1996
|
-
values: r === "update" &&
|
|
1997
|
+
values: r === "update" && K ? ke : void 0
|
|
1997
1998
|
});
|
|
1998
|
-
|
|
1999
|
-
var
|
|
2000
|
-
if (
|
|
1999
|
+
He(() => {
|
|
2000
|
+
var u;
|
|
2001
|
+
if (I)
|
|
2001
2002
|
try {
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2003
|
+
const h = Sr(
|
|
2004
|
+
I,
|
|
2004
2005
|
{},
|
|
2005
2006
|
// Pass empty object - validation functions get live values from react-hook-form
|
|
2006
|
-
|
|
2007
|
+
f
|
|
2007
2008
|
);
|
|
2008
|
-
|
|
2009
|
-
const
|
|
2010
|
-
Object.keys(
|
|
2011
|
-
|
|
2012
|
-
|
|
2009
|
+
Y(h);
|
|
2010
|
+
const c = Nr(h);
|
|
2011
|
+
Object.keys(c).length > 0 && Ir(c).then(Z).catch((d) => {
|
|
2012
|
+
var p;
|
|
2013
|
+
const y = Ve(d);
|
|
2014
|
+
console.warn("Failed to fetch reference data:", y), (p = S.current) == null || p.call(S, y);
|
|
2015
|
+
});
|
|
2016
|
+
} catch (h) {
|
|
2017
|
+
console.error("Schema processing failed:", h), (u = S.current) == null || u.call(S, Ve(h));
|
|
2013
2018
|
}
|
|
2014
|
-
}, [
|
|
2015
|
-
var
|
|
2016
|
-
|
|
2017
|
-
}, [
|
|
2018
|
-
if (!v || r !== "create" || !m || !l ||
|
|
2019
|
+
}, [I, f]), He(() => {
|
|
2020
|
+
var u;
|
|
2021
|
+
q && ((u = S.current) == null || u.call(S, q));
|
|
2022
|
+
}, [q]), He(() => {
|
|
2023
|
+
if (!v || r !== "create" || !m || !l || M || x.current)
|
|
2019
2024
|
return;
|
|
2020
|
-
|
|
2021
|
-
|
|
2025
|
+
x.current = !0;
|
|
2026
|
+
let u = !0;
|
|
2027
|
+
return (async () => {
|
|
2028
|
+
ye(!0), ne(null);
|
|
2022
2029
|
try {
|
|
2023
|
-
const
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2030
|
+
const d = await be(t).draftInteraction({});
|
|
2031
|
+
if (!u) return;
|
|
2032
|
+
L(d._id), d && typeof d == "object" && Object.entries(d).forEach(([y, p]) => {
|
|
2033
|
+
if (y === "_id") return;
|
|
2034
|
+
E.getValues(y) !== p && E.setValue(y, p, {
|
|
2027
2035
|
shouldDirty: !1,
|
|
2028
2036
|
shouldValidate: !1
|
|
2029
2037
|
});
|
|
2030
2038
|
});
|
|
2031
|
-
} catch (
|
|
2032
|
-
|
|
2039
|
+
} catch (c) {
|
|
2040
|
+
if (!u) return;
|
|
2041
|
+
console.error("Failed to create initial draft:", c), ne(Ve(c)), x.current = !1;
|
|
2033
2042
|
} finally {
|
|
2034
|
-
|
|
2043
|
+
u && ye(!1);
|
|
2035
2044
|
}
|
|
2036
|
-
})()
|
|
2037
|
-
|
|
2038
|
-
|
|
2045
|
+
})(), () => {
|
|
2046
|
+
u = !1;
|
|
2047
|
+
};
|
|
2048
|
+
}, [v, r, m, l, M, t]);
|
|
2049
|
+
const we = Oe(() => {
|
|
2039
2050
|
if (!m) return [];
|
|
2040
|
-
const
|
|
2041
|
-
return Object.entries(m.fieldRules).forEach(([
|
|
2042
|
-
|
|
2043
|
-
const
|
|
2044
|
-
|
|
2045
|
-
m.fields[
|
|
2051
|
+
const u = /* @__PURE__ */ new Set(), h = new Set(m.computedFields);
|
|
2052
|
+
return Object.entries(m.fieldRules).forEach(([c, d]) => {
|
|
2053
|
+
d.computation.forEach((y) => {
|
|
2054
|
+
const p = m.rules.computation[y];
|
|
2055
|
+
p != null && p.ExpressionTree && Rt(p.ExpressionTree).forEach((_) => {
|
|
2056
|
+
m.fields[_] && _ !== c && !h.has(_) && u.add(_);
|
|
2046
2057
|
});
|
|
2047
2058
|
});
|
|
2048
|
-
}), m.computedFields.forEach((
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
).forEach((
|
|
2053
|
-
m.fields[
|
|
2059
|
+
}), m.computedFields.forEach((c) => {
|
|
2060
|
+
const d = m.fields[c];
|
|
2061
|
+
d._bdoField.Formula && Rt(
|
|
2062
|
+
d._bdoField.Formula.ExpressionTree
|
|
2063
|
+
).forEach((p) => {
|
|
2064
|
+
m.fields[p] && p !== c && !h.has(p) && u.add(p);
|
|
2054
2065
|
});
|
|
2055
|
-
}), Array.from(
|
|
2056
|
-
}, [m]),
|
|
2057
|
-
async (
|
|
2058
|
-
if (!(!m || !(v ||
|
|
2059
|
-
if (v && r === "create" && !
|
|
2066
|
+
}), Array.from(u);
|
|
2067
|
+
}, [m]), Ue = te(
|
|
2068
|
+
async (u) => {
|
|
2069
|
+
if (!(!m || !(v && r !== "update" || we.length > 0 && we.includes(u)))) {
|
|
2070
|
+
if (v && r === "create" && !M) {
|
|
2060
2071
|
console.warn("Interactive create mode: waiting for draft ID");
|
|
2061
2072
|
return;
|
|
2062
2073
|
}
|
|
2063
|
-
|
|
2064
|
-
if (!m ||
|
|
2074
|
+
j.current || (ce.current && clearTimeout(ce.current), ce.current = setTimeout(() => {
|
|
2075
|
+
if (!m || j.current)
|
|
2065
2076
|
return;
|
|
2066
|
-
const
|
|
2077
|
+
const c = E.getValues();
|
|
2067
2078
|
(async () => {
|
|
2068
|
-
|
|
2079
|
+
j.current = !0;
|
|
2069
2080
|
try {
|
|
2070
|
-
const
|
|
2071
|
-
r === "update" && s && "_id" in
|
|
2072
|
-
const F = V.current ?? (r === "update" ?
|
|
2081
|
+
const y = be(t), p = {};
|
|
2082
|
+
r === "update" && s && "_id" in c && (p._id = c._id), v && r === "create" && M && (p._id = M);
|
|
2083
|
+
const F = V.current ?? (r === "update" ? K : null) ?? {}, _ = new Set(
|
|
2073
2084
|
m.computedFields || []
|
|
2074
2085
|
);
|
|
2075
|
-
Object.keys(
|
|
2076
|
-
if (
|
|
2077
|
-
const
|
|
2078
|
-
JSON.stringify(
|
|
2086
|
+
Object.keys(c).forEach((B) => {
|
|
2087
|
+
if (B === "_id" || _.has(B)) return;
|
|
2088
|
+
const z = c[B], We = F[B];
|
|
2089
|
+
JSON.stringify(z) !== JSON.stringify(We) && (z !== "" && z !== null && z !== void 0) && (p[B] = z);
|
|
2079
2090
|
});
|
|
2080
|
-
const
|
|
2091
|
+
const R = p, $ = {
|
|
2081
2092
|
...V.current
|
|
2082
2093
|
};
|
|
2083
|
-
Object.keys(
|
|
2084
|
-
|
|
2085
|
-
}), V.current =
|
|
2086
|
-
let
|
|
2087
|
-
r === "update" && s ?
|
|
2088
|
-
([
|
|
2089
|
-
|
|
2094
|
+
Object.keys(c).forEach((B) => {
|
|
2095
|
+
_.has(B) || ($[B] = c[B]);
|
|
2096
|
+
}), V.current = $;
|
|
2097
|
+
let ue;
|
|
2098
|
+
r === "update" && s ? ue = await y.draftPatch(s, R) : v && M ? ue = await y.draftInteraction(R) : ue = await y.draft(R), ue && typeof ue == "object" && (Object.entries(ue).forEach(
|
|
2099
|
+
([B, z]) => {
|
|
2100
|
+
c[B] !== z && E.setValue(B, z, {
|
|
2090
2101
|
shouldDirty: !1,
|
|
2091
2102
|
shouldValidate: !1
|
|
2092
2103
|
});
|
|
2093
2104
|
}
|
|
2094
|
-
), Object.entries(
|
|
2095
|
-
([
|
|
2096
|
-
|
|
2105
|
+
), Object.entries(ue).forEach(
|
|
2106
|
+
([B, z]) => {
|
|
2107
|
+
_.has(B) && (V.current[B] = z);
|
|
2097
2108
|
}
|
|
2098
2109
|
));
|
|
2099
|
-
} catch (
|
|
2100
|
-
console.warn("Failed to compute fields via API:",
|
|
2110
|
+
} catch (y) {
|
|
2111
|
+
console.warn("Failed to compute fields via API:", y);
|
|
2101
2112
|
} finally {
|
|
2102
|
-
|
|
2113
|
+
j.current = !1;
|
|
2103
2114
|
}
|
|
2104
2115
|
})();
|
|
2105
2116
|
}, 300));
|
|
@@ -2109,247 +2120,247 @@ function Qr(e) {
|
|
|
2109
2120
|
m,
|
|
2110
2121
|
r,
|
|
2111
2122
|
s,
|
|
2112
|
-
|
|
2123
|
+
K,
|
|
2113
2124
|
t,
|
|
2114
|
-
|
|
2115
|
-
|
|
2125
|
+
E,
|
|
2126
|
+
we,
|
|
2116
2127
|
v,
|
|
2117
|
-
|
|
2128
|
+
M
|
|
2118
2129
|
]
|
|
2119
|
-
),
|
|
2130
|
+
), Be = te(async () => {
|
|
2120
2131
|
if (!m)
|
|
2121
2132
|
return !1;
|
|
2122
|
-
const
|
|
2123
|
-
if (!await
|
|
2133
|
+
const u = E.getValues();
|
|
2134
|
+
if (!await E.trigger())
|
|
2124
2135
|
return !1;
|
|
2125
|
-
const
|
|
2126
|
-
(
|
|
2127
|
-
Id:
|
|
2128
|
-
Condition: { ExpressionTree:
|
|
2129
|
-
Message:
|
|
2136
|
+
const c = m.crossFieldValidation.map(
|
|
2137
|
+
(y) => ({
|
|
2138
|
+
Id: y.Id,
|
|
2139
|
+
Condition: { ExpressionTree: y.ExpressionTree },
|
|
2140
|
+
Message: y.Message || `Validation failed for ${y.Name}`
|
|
2130
2141
|
})
|
|
2131
|
-
),
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2142
|
+
), d = _t(
|
|
2143
|
+
c,
|
|
2144
|
+
u,
|
|
2145
|
+
C
|
|
2135
2146
|
);
|
|
2136
|
-
return
|
|
2137
|
-
|
|
2147
|
+
return d.length > 0 ? (d.forEach((y, p) => {
|
|
2148
|
+
E.setError(`root.crossField${p}`, {
|
|
2138
2149
|
type: "validate",
|
|
2139
|
-
message:
|
|
2150
|
+
message: y.message
|
|
2140
2151
|
});
|
|
2141
2152
|
}), !1) : !0;
|
|
2142
2153
|
}, [
|
|
2143
2154
|
m,
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
]),
|
|
2149
|
-
(
|
|
2155
|
+
E.getValues,
|
|
2156
|
+
E.trigger,
|
|
2157
|
+
E.setError,
|
|
2158
|
+
C
|
|
2159
|
+
]), Je = te(
|
|
2160
|
+
(u, h) => E.handleSubmit(
|
|
2150
2161
|
// RHF onValid handler - validation passed, now do cross-field + API
|
|
2151
|
-
async (
|
|
2162
|
+
async (c, d) => {
|
|
2152
2163
|
if (!m) {
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2164
|
+
const y = new Error("Schema not loaded");
|
|
2165
|
+
h == null || h(y, d);
|
|
2155
2166
|
return;
|
|
2156
2167
|
}
|
|
2157
|
-
|
|
2168
|
+
A(!0);
|
|
2158
2169
|
try {
|
|
2159
|
-
const
|
|
2160
|
-
(
|
|
2161
|
-
Id:
|
|
2162
|
-
Condition: { ExpressionTree:
|
|
2163
|
-
Message:
|
|
2170
|
+
const y = m.crossFieldValidation.map(
|
|
2171
|
+
(R) => ({
|
|
2172
|
+
Id: R.Id,
|
|
2173
|
+
Condition: { ExpressionTree: R.ExpressionTree },
|
|
2174
|
+
Message: R.Message || `Validation failed for ${R.Name}`
|
|
2164
2175
|
})
|
|
2165
|
-
),
|
|
2176
|
+
), p = _t(
|
|
2177
|
+
y,
|
|
2166
2178
|
c,
|
|
2167
|
-
|
|
2168
|
-
O
|
|
2179
|
+
C
|
|
2169
2180
|
);
|
|
2170
|
-
if (
|
|
2171
|
-
|
|
2172
|
-
|
|
2181
|
+
if (p.length > 0) {
|
|
2182
|
+
p.forEach((R, $) => {
|
|
2183
|
+
E.setError(`root.crossField${$}`, {
|
|
2173
2184
|
type: "validate",
|
|
2174
|
-
message:
|
|
2185
|
+
message: R.message
|
|
2175
2186
|
});
|
|
2176
|
-
}),
|
|
2187
|
+
}), h == null || h(E.formState.errors, d);
|
|
2177
2188
|
return;
|
|
2178
2189
|
}
|
|
2179
|
-
const F =
|
|
2180
|
-
|
|
2190
|
+
const F = kr(
|
|
2191
|
+
c,
|
|
2181
2192
|
m.computedFields,
|
|
2182
2193
|
r,
|
|
2183
|
-
|
|
2194
|
+
K
|
|
2184
2195
|
);
|
|
2185
|
-
let
|
|
2196
|
+
let _;
|
|
2186
2197
|
if (v) {
|
|
2187
|
-
const
|
|
2198
|
+
const R = be(t);
|
|
2188
2199
|
if (r === "create") {
|
|
2189
|
-
if (!
|
|
2200
|
+
if (!M)
|
|
2190
2201
|
throw new Error(
|
|
2191
2202
|
"Interactive create mode requires a draft ID. Draft creation may have failed."
|
|
2192
2203
|
);
|
|
2193
|
-
|
|
2204
|
+
_ = { success: !0, data: await R.draft({
|
|
2194
2205
|
...F,
|
|
2195
|
-
_id:
|
|
2206
|
+
_id: M
|
|
2196
2207
|
}) };
|
|
2197
2208
|
} else
|
|
2198
|
-
|
|
2199
|
-
} else if (
|
|
2209
|
+
_ = { success: !0, data: await R.update(s, F) };
|
|
2210
|
+
} else if (_ = await Lr(
|
|
2200
2211
|
t,
|
|
2201
2212
|
r,
|
|
2202
2213
|
F,
|
|
2203
2214
|
s
|
|
2204
|
-
), !
|
|
2205
|
-
throw
|
|
2206
|
-
r === "create" && (
|
|
2207
|
-
} catch (
|
|
2208
|
-
|
|
2215
|
+
), !_.success)
|
|
2216
|
+
throw _.error || new Error("Submission failed");
|
|
2217
|
+
r === "create" && (E.reset(), v && L(null)), await (u == null ? void 0 : u(_.data || c, d));
|
|
2218
|
+
} catch (y) {
|
|
2219
|
+
h == null || h(Ve(y), d);
|
|
2209
2220
|
} finally {
|
|
2210
|
-
|
|
2221
|
+
A(!1);
|
|
2211
2222
|
}
|
|
2212
2223
|
},
|
|
2213
2224
|
// RHF onInvalid handler - validation failed
|
|
2214
|
-
(
|
|
2215
|
-
|
|
2225
|
+
(c, d) => {
|
|
2226
|
+
h == null || h(c, d);
|
|
2216
2227
|
}
|
|
2217
2228
|
),
|
|
2218
2229
|
[
|
|
2219
|
-
|
|
2230
|
+
E,
|
|
2220
2231
|
m,
|
|
2221
|
-
|
|
2232
|
+
C,
|
|
2222
2233
|
t,
|
|
2223
2234
|
r,
|
|
2224
2235
|
s,
|
|
2225
|
-
|
|
2236
|
+
K,
|
|
2226
2237
|
v,
|
|
2227
|
-
|
|
2238
|
+
M
|
|
2228
2239
|
]
|
|
2229
|
-
),
|
|
2230
|
-
(
|
|
2240
|
+
), xe = te(
|
|
2241
|
+
(u) => (m == null ? void 0 : m.fields[u]) || null,
|
|
2231
2242
|
[m]
|
|
2232
|
-
),
|
|
2243
|
+
), Pe = te(() => {
|
|
2233
2244
|
if (!m) return {};
|
|
2234
|
-
const
|
|
2235
|
-
return Object.entries(m.fields).forEach(([
|
|
2236
|
-
|
|
2237
|
-
}),
|
|
2238
|
-
}, [m]),
|
|
2239
|
-
(
|
|
2240
|
-
[m]
|
|
2241
|
-
), _e = te(
|
|
2242
|
-
(o) => (m == null ? void 0 : m.requiredFields.includes(o)) || !1,
|
|
2245
|
+
const u = {};
|
|
2246
|
+
return Object.entries(m.fields).forEach(([h, c]) => {
|
|
2247
|
+
u[h] = c;
|
|
2248
|
+
}), u;
|
|
2249
|
+
}, [m]), _e = te(
|
|
2250
|
+
(u) => !!(m != null && m.fields[u]),
|
|
2243
2251
|
[m]
|
|
2244
2252
|
), De = te(
|
|
2245
|
-
(
|
|
2253
|
+
(u) => (m == null ? void 0 : m.requiredFields.includes(u)) || !1,
|
|
2254
|
+
[m]
|
|
2255
|
+
), Ge = te(
|
|
2256
|
+
(u) => (m == null ? void 0 : m.computedFields.includes(u)) || !1,
|
|
2246
2257
|
[m]
|
|
2247
|
-
),
|
|
2248
|
-
await
|
|
2249
|
-
}, [
|
|
2250
|
-
|
|
2251
|
-
}, [
|
|
2258
|
+
), qe = te(async () => {
|
|
2259
|
+
await de();
|
|
2260
|
+
}, [de]), Xe = te(() => {
|
|
2261
|
+
E.clearErrors();
|
|
2262
|
+
}, [E]), Se = G || r === "update" && fe || v && r === "create" && le, $e = Se || W, Re = q || Ie || ae, Qe = !!Re, lt = Oe(
|
|
2252
2263
|
() => (m == null ? void 0 : m.computedFields) || [],
|
|
2253
2264
|
[m]
|
|
2254
|
-
),
|
|
2265
|
+
), je = Oe(
|
|
2255
2266
|
() => (m == null ? void 0 : m.requiredFields) || [],
|
|
2256
2267
|
[m]
|
|
2257
|
-
),
|
|
2268
|
+
), a = Oe(() => {
|
|
2258
2269
|
if (!m) return {};
|
|
2259
|
-
const
|
|
2260
|
-
return Object.entries(m.fields).forEach(([
|
|
2261
|
-
const
|
|
2262
|
-
switch (
|
|
2270
|
+
const u = {};
|
|
2271
|
+
return Object.entries(m.fields).forEach(([h, c]) => {
|
|
2272
|
+
const d = {};
|
|
2273
|
+
switch (c.required && (d.required = `${c.label} is required`), c.permission.editable || (d.disabled = !0), c.type) {
|
|
2263
2274
|
case "number":
|
|
2264
|
-
|
|
2275
|
+
d.valueAsNumber = !0;
|
|
2265
2276
|
break;
|
|
2266
2277
|
case "date":
|
|
2267
2278
|
case "datetime-local":
|
|
2268
|
-
|
|
2279
|
+
d.valueAsDate = !0;
|
|
2269
2280
|
break;
|
|
2270
2281
|
}
|
|
2271
|
-
const
|
|
2272
|
-
|
|
2273
|
-
expressionValidation: (
|
|
2274
|
-
const F =
|
|
2275
|
-
for (const
|
|
2276
|
-
const
|
|
2277
|
-
if (
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
[
|
|
2282
|
+
const y = c.rules.validation;
|
|
2283
|
+
y.length > 0 && (d.validate = {
|
|
2284
|
+
expressionValidation: (p) => {
|
|
2285
|
+
const F = E.getValues();
|
|
2286
|
+
for (const _ of y) {
|
|
2287
|
+
const R = m.rules.validation[_];
|
|
2288
|
+
if (R) {
|
|
2289
|
+
const $ = jr(
|
|
2290
|
+
h,
|
|
2291
|
+
p,
|
|
2292
|
+
[R],
|
|
2282
2293
|
F,
|
|
2283
2294
|
ee
|
|
2284
2295
|
);
|
|
2285
|
-
if (
|
|
2286
|
-
return
|
|
2296
|
+
if (!$.isValid)
|
|
2297
|
+
return $.message || R.Message || "Invalid value";
|
|
2287
2298
|
}
|
|
2288
2299
|
}
|
|
2289
2300
|
return !0;
|
|
2290
2301
|
}
|
|
2291
|
-
}),
|
|
2292
|
-
}),
|
|
2293
|
-
}, [m,
|
|
2302
|
+
}), u[h] = d;
|
|
2303
|
+
}), u;
|
|
2304
|
+
}, [m, E, C]);
|
|
2294
2305
|
return {
|
|
2295
2306
|
// Form methods with strict typing
|
|
2296
2307
|
register: te(
|
|
2297
|
-
(
|
|
2298
|
-
const
|
|
2299
|
-
|
|
2308
|
+
(u, h) => {
|
|
2309
|
+
const c = a[u], d = h == null ? void 0 : h.onBlur, y = async (p) => {
|
|
2310
|
+
d && await d(p);
|
|
2300
2311
|
let F = !0;
|
|
2301
|
-
n === "onBlur" || n === "onTouched" || n === "all" ? F = await
|
|
2312
|
+
n === "onBlur" || n === "onTouched" || n === "all" ? F = await E.trigger(u) : F = !E.getFieldState(u, E.formState).error, F && await Ue(u);
|
|
2302
2313
|
};
|
|
2303
|
-
return
|
|
2304
|
-
...
|
|
2305
|
-
...
|
|
2306
|
-
onBlur:
|
|
2314
|
+
return E.register(u, {
|
|
2315
|
+
...c,
|
|
2316
|
+
...h,
|
|
2317
|
+
onBlur: y
|
|
2307
2318
|
});
|
|
2308
2319
|
},
|
|
2309
|
-
[
|
|
2320
|
+
[E, a, Ue, n]
|
|
2310
2321
|
),
|
|
2311
|
-
handleSubmit:
|
|
2312
|
-
watch:
|
|
2322
|
+
handleSubmit: Je,
|
|
2323
|
+
watch: E.watch,
|
|
2313
2324
|
// Type assertion for complex generic constraints
|
|
2314
|
-
setValue:
|
|
2315
|
-
reset:
|
|
2325
|
+
setValue: E.setValue,
|
|
2326
|
+
reset: E.reset,
|
|
2316
2327
|
// Flattened form state (NEW - direct access, no nested formState)
|
|
2317
|
-
errors:
|
|
2318
|
-
isValid:
|
|
2319
|
-
isDirty:
|
|
2320
|
-
isSubmitting:
|
|
2321
|
-
isSubmitSuccessful:
|
|
2328
|
+
errors: E.formState.errors,
|
|
2329
|
+
isValid: E.formState.isValid,
|
|
2330
|
+
isDirty: E.formState.isDirty,
|
|
2331
|
+
isSubmitting: E.formState.isSubmitting || W,
|
|
2332
|
+
isSubmitSuccessful: E.formState.isSubmitSuccessful,
|
|
2322
2333
|
// Loading states
|
|
2323
|
-
isLoadingInitialData:
|
|
2324
|
-
isLoadingRecord:
|
|
2325
|
-
isLoading:
|
|
2334
|
+
isLoadingInitialData: Se,
|
|
2335
|
+
isLoadingRecord: fe,
|
|
2336
|
+
isLoading: $e,
|
|
2326
2337
|
// Interactive mode state
|
|
2327
|
-
draftId:
|
|
2328
|
-
isCreatingDraft:
|
|
2338
|
+
draftId: M,
|
|
2339
|
+
isCreatingDraft: le,
|
|
2329
2340
|
// Error handling
|
|
2330
|
-
loadError:
|
|
2331
|
-
hasError:
|
|
2341
|
+
loadError: Re ? Ve(Re) : null,
|
|
2342
|
+
hasError: Qe,
|
|
2332
2343
|
// Schema information
|
|
2333
|
-
schema:
|
|
2344
|
+
schema: I,
|
|
2334
2345
|
schemaConfig: m,
|
|
2335
|
-
computedFields:
|
|
2336
|
-
requiredFields:
|
|
2346
|
+
computedFields: lt,
|
|
2347
|
+
requiredFields: je,
|
|
2337
2348
|
// Field helpers
|
|
2338
|
-
getField:
|
|
2339
|
-
getFields:
|
|
2340
|
-
hasField:
|
|
2341
|
-
isFieldRequired:
|
|
2342
|
-
isFieldComputed:
|
|
2349
|
+
getField: xe,
|
|
2350
|
+
getFields: Pe,
|
|
2351
|
+
hasField: _e,
|
|
2352
|
+
isFieldRequired: De,
|
|
2353
|
+
isFieldComputed: Ge,
|
|
2343
2354
|
// Operations
|
|
2344
|
-
refreshSchema:
|
|
2345
|
-
validateForm:
|
|
2346
|
-
clearErrors:
|
|
2355
|
+
refreshSchema: qe,
|
|
2356
|
+
validateForm: Be,
|
|
2357
|
+
clearErrors: Xe
|
|
2347
2358
|
};
|
|
2348
2359
|
}
|
|
2349
2360
|
export {
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2361
|
+
Zr as clearFormCache,
|
|
2362
|
+
Xr as isNetworkError,
|
|
2363
|
+
Qr as isValidationError,
|
|
2364
|
+
Gr as parseApiError,
|
|
2365
|
+
es as useForm
|
|
2355
2366
|
};
|