@ram_28/kf-ai-sdk 1.0.19 → 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/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/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 +338 -327
- 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 +332 -322
- 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/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 +35 -11
- 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,38 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var ve = (e, t, r) =>
|
|
4
|
-
import X, { useState as ge, useRef as
|
|
5
|
-
import { useQuery as
|
|
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
6
|
import { a as be } from "./client-V-WzUb8H.js";
|
|
7
|
-
import { g as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
13
|
return U(t) && t.hasOwnProperty("isPrototypeOf");
|
|
13
|
-
},
|
|
14
|
+
}, it = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
14
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 && !(U(e) &&
|
|
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
26
|
Object.prototype.hasOwnProperty.call(e, i) && (s[i] = P(e[i]));
|
|
26
27
|
return s;
|
|
27
28
|
}
|
|
28
|
-
var
|
|
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) => {
|
|
29
30
|
if (!t || !U(e))
|
|
30
31
|
return r;
|
|
31
|
-
const s = (
|
|
32
|
+
const s = (ze(t) ? [t] : nt(t)).reduce((i, n) => J(i) ? i : i[n], e);
|
|
32
33
|
return T(s) || s === e ? T(e[t]) ? r : e[t] : s;
|
|
33
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
38
|
const f = i[s];
|
|
38
39
|
let w = r;
|
|
@@ -45,7 +46,7 @@ var Ke = (e) => /^\w*$/.test(e), T = (e) => e === void 0, it = (e) => Array.isAr
|
|
|
45
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 ft = {
|
|
|
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,10 +78,10 @@ var Kt = (e, t, r, s = !0) => {
|
|
|
77
78
|
});
|
|
78
79
|
return i;
|
|
79
80
|
};
|
|
80
|
-
const
|
|
81
|
-
var Q = (e) => typeof e == "string",
|
|
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);
|
|
82
83
|
function he(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
83
|
-
if (
|
|
84
|
+
if (rt(e) || rt(t))
|
|
84
85
|
return Object.is(e, t);
|
|
85
86
|
if (pe(e) && pe(t))
|
|
86
87
|
return Object.is(e.getTime(), t.getTime());
|
|
@@ -102,13 +103,13 @@ function he(e, t, r = /* @__PURE__ */ new WeakSet()) {
|
|
|
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,63 +129,63 @@ 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
137
|
if (i && U(i) && n) {
|
|
137
|
-
const l =
|
|
138
|
+
const l = Ot(i, n);
|
|
138
139
|
U(l) && (r[s] = l);
|
|
139
140
|
} else e[s] && (r[s] = n);
|
|
140
141
|
}
|
|
141
142
|
return r;
|
|
142
143
|
}
|
|
143
|
-
var H = (e) => U(e) && !Object.keys(e).length,
|
|
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
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
159
|
if (e.hasOwnProperty(t) && !T(e[t]))
|
|
159
160
|
return !1;
|
|
160
161
|
return !0;
|
|
161
162
|
}
|
|
162
163
|
function k(e, t) {
|
|
163
|
-
const r = Array.isArray(t) ? t :
|
|
164
|
-
return s && delete s[n], i !== 0 && (U(s) && H(s) || Array.isArray(s) &&
|
|
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) || U(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
|
-
T(t) ||
|
|
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
191
|
r[s] = !he(i, n);
|
|
@@ -192,11 +193,11 @@ function Ve(e, t, r) {
|
|
|
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,24 +205,24 @@ var Tt = (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 && !T(e[0].attributes.value) ? T(e[0].value) || e[0].value === "" ?
|
|
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);
|
|
@@ -233,16 +234,16 @@ 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) {
|
|
@@ -252,16 +253,16 @@ const Ce = (e, t, r, 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 (U(f) &&
|
|
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
|
|
@@ -287,15 +288,15 @@ function Ft(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
294
|
return H(n) || Object.keys(n).length >= Object.keys(t).length || Object.keys(n).find((l) => t[l] === (!s || se.all));
|
|
294
|
-
},
|
|
295
|
-
const s =
|
|
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));
|
|
296
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,16 +304,16 @@ function Vt(e, t, r = "validate") {
|
|
|
303
304
|
ref: t
|
|
304
305
|
};
|
|
305
306
|
}
|
|
306
|
-
var Fe = (e) => U(e) && !
|
|
307
|
+
var Fe = (e) => U(e) && !Ke(e) ? e : {
|
|
307
308
|
value: e,
|
|
308
309
|
message: ""
|
|
309
|
-
},
|
|
310
|
+
}, At = async (e, t, r, s, i, n) => {
|
|
310
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);
|
|
311
312
|
if (!W || t.has(C))
|
|
312
313
|
return {};
|
|
313
314
|
const ee = f ? f[0] : l, M = (V) => {
|
|
314
315
|
i && ee.reportValidity && (ee.setCustomValidity(ie(V) ? "" : V || ""), ee.reportValidity());
|
|
315
|
-
}, L = {}, le =
|
|
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) => {
|
|
316
317
|
const q = V ? x : S;
|
|
317
318
|
L[C] = {
|
|
318
319
|
type: V ? I : G,
|
|
@@ -321,7 +322,7 @@ var Fe = (e) => U(e) && !Ye(e) ? e : {
|
|
|
321
322
|
...j(V ? I : G, q)
|
|
322
323
|
};
|
|
323
324
|
};
|
|
324
|
-
if (n ? !Array.isArray(A) || !A.length : w && (!ae && (ne || J(A)) || ie(A) && !A || ye && !
|
|
325
|
+
if (n ? !Array.isArray(A) || !A.length : w && (!ae && (ne || J(A)) || ie(A) && !A || ye && !Lt(f).isValid || le && !It(f).isValid)) {
|
|
325
326
|
const { value: V, message: x } = Q(w) ? { value: !!w, message: w } : Fe(w);
|
|
326
327
|
if (V && (L[C] = {
|
|
327
328
|
type: oe.required,
|
|
@@ -351,7 +352,7 @@ var Fe = (e) => U(e) && !Ye(e) ? e : {
|
|
|
351
352
|
}
|
|
352
353
|
if (m && !ne && Q(A)) {
|
|
353
354
|
const { value: V, message: x } = Fe(m);
|
|
354
|
-
if (
|
|
355
|
+
if (Ke(V) && !A.match(V) && (L[C] = {
|
|
355
356
|
type: oe.pattern,
|
|
356
357
|
message: x,
|
|
357
358
|
ref: l,
|
|
@@ -361,7 +362,7 @@ var Fe = (e) => U(e) && !Ye(e) ? e : {
|
|
|
361
362
|
}
|
|
362
363
|
if (Y) {
|
|
363
364
|
if (re(Y)) {
|
|
364
|
-
const V = await Y(A, r), x =
|
|
365
|
+
const V = await Y(A, r), x = Et(V, ee);
|
|
365
366
|
if (x && (L[C] = {
|
|
366
367
|
...x,
|
|
367
368
|
...j(oe.validate, x.message)
|
|
@@ -372,7 +373,7 @@ var Fe = (e) => U(e) && !Ye(e) ? e : {
|
|
|
372
373
|
for (const x in Y) {
|
|
373
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
|
...j(x, S.message)
|
|
@@ -387,14 +388,14 @@ var Fe = (e) => U(e) && !Ye(e) ? e : {
|
|
|
387
388
|
}
|
|
388
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,
|
|
@@ -438,8 +439,8 @@ function cr(e = {}) {
|
|
|
438
439
|
...D
|
|
439
440
|
};
|
|
440
441
|
const m = {
|
|
441
|
-
array:
|
|
442
|
-
state:
|
|
442
|
+
array: mt(),
|
|
443
|
+
state: mt()
|
|
443
444
|
}, Y = t.criteriaMode === se.all, C = (a) => (o) => {
|
|
444
445
|
clearTimeout(b), b = setTimeout(a, o);
|
|
445
446
|
}, Z = async (a) => {
|
|
@@ -464,13 +465,13 @@ function cr(e = {}) {
|
|
|
464
465
|
}
|
|
465
466
|
if (d && Array.isArray(g(r.errors, a))) {
|
|
466
467
|
const y = u(g(r.errors, a), h.argA, h.argB);
|
|
467
|
-
c && N(r.errors, a, y),
|
|
468
|
+
c && N(r.errors, a, y), or(r.errors, a);
|
|
468
469
|
}
|
|
469
470
|
if ((D.touchedFields || v.touchedFields) && d && Array.isArray(g(r.touchedFields, a))) {
|
|
470
471
|
const y = u(g(r.touchedFields, a), h.argA, h.argB);
|
|
471
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,
|
|
@@ -492,7 +493,7 @@ function cr(e = {}) {
|
|
|
492
493
|
const c = g(s, a);
|
|
493
494
|
if (c) {
|
|
494
495
|
const d = g(n, a, T(u) ? g(i, a) : u);
|
|
495
|
-
T(d) || h && h.defaultChecked || o ? N(n, a, o ? d :
|
|
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
|
}, le = (a, o, u, h, c) => {
|
|
498
499
|
let d = !1, y = !1;
|
|
@@ -526,7 +527,7 @@ function cr(e = {}) {
|
|
|
526
527
|
...y
|
|
527
528
|
}, m.state.next(y);
|
|
528
529
|
}
|
|
529
|
-
}, ae = async (a) => (W(a, !0), await t.resolver(n, t.context,
|
|
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
532
|
if (W(a), a)
|
|
532
533
|
for (const u of a) {
|
|
@@ -544,12 +545,12 @@ function cr(e = {}) {
|
|
|
544
545
|
if (c) {
|
|
545
546
|
const { _f: d, ...y } = c;
|
|
546
547
|
if (d) {
|
|
547
|
-
const p = f.array.has(d.name), F = c._f &&
|
|
548
|
+
const p = f.array.has(d.name), F = c._f && sr(c._f);
|
|
548
549
|
F && D.validatingFields && W([d.name], !0);
|
|
549
|
-
const _ = await
|
|
550
|
+
const _ = await At(c, f.disabled, n, Y, t.shouldUseNativeValidation && !o, p);
|
|
550
551
|
if (F && D.validatingFields && W([d.name]), _[d.name] && (u.valid = !1, o || e.shouldUseNativeValidation))
|
|
551
552
|
break;
|
|
552
|
-
!o && (g(_, d.name) ? p ?
|
|
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
|
}
|
|
@@ -558,19 +559,19 @@ function cr(e = {}) {
|
|
|
558
559
|
}, ce = () => {
|
|
559
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
|
f.unMount = /* @__PURE__ */ new Set();
|
|
564
|
-
}, V = (a, o) => !t.disabled && (a && o && N(n, a, o), !he(
|
|
565
|
+
}, V = (a, o) => !t.disabled && (a && o && N(n, a, o), !he(Ie(), i)), x = (a, o, u) => Gt(a, f, {
|
|
565
566
|
...l.mount ? n : T(o) ? i : Q(a) ? { [a]: o } : o
|
|
566
|
-
}, u, o), S = (a) =>
|
|
567
|
+
}, u, o), S = (a) => at(g(l.mount ? n : i, a, t.shouldUnregister ? g(i, a, []) : [])), I = (a, o, u = {}) => {
|
|
567
568
|
const h = g(s, a);
|
|
568
569
|
let c = o;
|
|
569
570
|
if (h) {
|
|
570
571
|
const d = h._f;
|
|
571
|
-
d && (!d.disabled && N(n, a,
|
|
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) => {
|
|
572
573
|
(!y.defaultChecked || !y.disabled) && (Array.isArray(c) ? y.checked = !!c.find((p) => p === y.value) : y.checked = c === y.value || !!c);
|
|
573
|
-
}) : d.refs.forEach((y) => y.checked = 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
576
|
values: P(n)
|
|
576
577
|
})));
|
|
@@ -590,9 +591,9 @@ function cr(e = {}) {
|
|
|
590
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
|
+
dirtyFields: Ee(i, n),
|
|
594
595
|
isDirty: V(a, d)
|
|
595
|
-
})) : h && !h._f && !J(d) ? G(a, d, u) : I(a, d, u),
|
|
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
599
|
values: P(n)
|
|
@@ -606,26 +607,26 @@ function cr(e = {}) {
|
|
|
606
607
|
let u = o.name, h = !0;
|
|
607
608
|
const c = g(s, u), d = (F) => {
|
|
608
609
|
h = Number.isNaN(F) || pe(F) && isNaN(F.getTime()) || he(F, g(n, u, F));
|
|
609
|
-
}, y =
|
|
610
|
+
}, y = wt(t.mode), p = wt(t.reValidateMode);
|
|
610
611
|
if (c) {
|
|
611
612
|
let F, _;
|
|
612
|
-
const R = o.type ?
|
|
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, $);
|
|
613
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);
|
|
614
|
-
const z = le(u, R, $),
|
|
615
|
+
const z = le(u, R, $), We = !H(z) || B;
|
|
615
616
|
if (!$ && m.state.next({
|
|
616
617
|
name: u,
|
|
617
618
|
type: a.type,
|
|
618
619
|
values: P(n)
|
|
619
620
|
}), ue)
|
|
620
|
-
return (D.isValid || v.isValid) && (t.mode === "onBlur" ? $ && Z() : $ || Z()),
|
|
621
|
+
return (D.isValid || v.isValid) && (t.mode === "onBlur" ? $ && Z() : $ || Z()), We && m.state.next({ name: u, ...B ? {} : z });
|
|
621
622
|
if (!$ && B && m.state.next({ ...r }), t.resolver) {
|
|
622
|
-
const { errors:
|
|
623
|
+
const { errors: Ze } = await ae([u]);
|
|
623
624
|
if (W([u]), d(R), h) {
|
|
624
|
-
const
|
|
625
|
-
F =
|
|
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
|
-
W([u], !0), F = (await
|
|
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)));
|
|
629
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) => {
|
|
@@ -633,7 +634,7 @@ function cr(e = {}) {
|
|
|
633
634
|
return a.focus(), 1;
|
|
634
635
|
}, fe = async (a, o = {}) => {
|
|
635
636
|
let u, h;
|
|
636
|
-
const c =
|
|
637
|
+
const c = Te(a);
|
|
637
638
|
if (t.resolver) {
|
|
638
639
|
const d = await ne(T(a) ? a : c);
|
|
639
640
|
u = H(d), h = a ? !c.some((y) => g(d, y)) : u;
|
|
@@ -645,20 +646,20 @@ function cr(e = {}) {
|
|
|
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 && !h &&
|
|
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
|
}), E = (a) => {
|
|
661
|
-
a &&
|
|
662
|
+
a && Te(a).forEach((o) => k(r.errors, o)), m.state.next({
|
|
662
663
|
errors: a ? r.errors : {}
|
|
663
664
|
});
|
|
664
665
|
}, we = (a, o, u) => {
|
|
@@ -672,28 +673,28 @@ function cr(e = {}) {
|
|
|
672
673
|
errors: r.errors,
|
|
673
674
|
isValid: !1
|
|
674
675
|
}), u && u.shouldFocus && h && h.focus && h.focus();
|
|
675
|
-
},
|
|
676
|
+
}, Ue = (a, o) => re(a) ? m.state.subscribe({
|
|
676
677
|
next: (u) => "values" in u && a(x(void 0, o), u)
|
|
677
|
-
}) : x(a, o, !0),
|
|
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
|
-
for (const u of a ?
|
|
696
|
+
})), xe = (a, o = {}) => {
|
|
697
|
+
for (const u of a ? Te(a) : f.mount)
|
|
697
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
700
|
values: P(n)
|
|
@@ -701,9 +702,9 @@ function cr(e = {}) {
|
|
|
701
702
|
...r,
|
|
702
703
|
...o.keepDirty ? { isDirty: V() } : {}
|
|
703
704
|
}), !o.keepIsValid && Z();
|
|
704
|
-
},
|
|
705
|
+
}, Pe = ({ disabled: a, name: o }) => {
|
|
705
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
709
|
const h = ie(o.disabled) || ie(t.disabled);
|
|
709
710
|
return N(s, a, {
|
|
@@ -714,26 +715,26 @@ function cr(e = {}) {
|
|
|
714
715
|
mount: !0,
|
|
715
716
|
...o
|
|
716
717
|
}
|
|
717
|
-
}), f.mount.add(a), u ?
|
|
718
|
+
}), f.mount.add(a), u ? Pe({
|
|
718
719
|
disabled: ie(o.disabled) ? o.disabled : t.disabled,
|
|
719
720
|
name: a
|
|
720
721
|
}) : L(a, !0, o.value), {
|
|
721
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
732
|
onChange: de,
|
|
732
733
|
onBlur: de,
|
|
733
734
|
ref: (c) => {
|
|
734
735
|
if (c) {
|
|
735
|
-
|
|
736
|
-
const d = T(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, y =
|
|
736
|
+
_e(a, o), u = g(s, a);
|
|
737
|
+
const d = T(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, y = Qt(d), p = u._f.refs || [];
|
|
737
738
|
if (y ? p.find((F) => F === d) : d === u._f.ref)
|
|
738
739
|
return;
|
|
739
740
|
N(s, a, {
|
|
@@ -741,7 +742,7 @@ function cr(e = {}) {
|
|
|
741
742
|
...u._f,
|
|
742
743
|
...y ? {
|
|
743
744
|
refs: [
|
|
744
|
-
...p.filter(
|
|
745
|
+
...p.filter(et),
|
|
745
746
|
d,
|
|
746
747
|
...Array.isArray(g(i, a)) ? [{}] : []
|
|
747
748
|
],
|
|
@@ -750,17 +751,17 @@ function cr(e = {}) {
|
|
|
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
|
-
},
|
|
757
|
-
ie(a) && (m.state.next({ disabled: a }),
|
|
757
|
+
}, De = () => t.shouldFocusError && Le(s, K, f.mount), Ge = (a) => {
|
|
758
|
+
ie(a) && (m.state.next({ disabled: a }), Le(s, (o, u) => {
|
|
758
759
|
const h = g(s, u);
|
|
759
760
|
h && (o.disabled = h._f.disabled || a, Array.isArray(h._f.refs) && h._f.refs.forEach((c) => {
|
|
760
761
|
c.disabled = h._f.disabled || a;
|
|
761
762
|
}));
|
|
762
763
|
}, 0, !1));
|
|
763
|
-
},
|
|
764
|
+
}, qe = (a, o) => async (u) => {
|
|
764
765
|
let h;
|
|
765
766
|
u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
|
|
766
767
|
let c = P(n);
|
|
@@ -784,7 +785,7 @@ function cr(e = {}) {
|
|
|
784
785
|
h = d;
|
|
785
786
|
}
|
|
786
787
|
} else
|
|
787
|
-
o && await o({ ...r.errors }, u),
|
|
788
|
+
o && await o({ ...r.errors }, u), De(), setTimeout(De);
|
|
788
789
|
if (m.state.next({
|
|
789
790
|
isSubmitted: !0,
|
|
790
791
|
isSubmitting: !1,
|
|
@@ -793,27 +794,27 @@ function cr(e = {}) {
|
|
|
793
794
|
errors: r.errors
|
|
794
795
|
}), h)
|
|
795
796
|
throw h;
|
|
796
|
-
},
|
|
797
|
+
}, Xe = (a, o = {}) => {
|
|
797
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 }));
|
|
798
|
-
},
|
|
799
|
+
}, Se = (a, o = {}) => {
|
|
799
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
|
...f.mount,
|
|
804
|
-
...Object.keys(
|
|
805
|
+
...Object.keys(Ee(i, n))
|
|
805
806
|
]);
|
|
806
807
|
for (const p of Array.from(y)) {
|
|
807
808
|
const F = g(r.dirtyFields, p), _ = g(n, p), R = g(d, p);
|
|
808
809
|
F && !T(_) ? N(d, p, _) : !F && !T(R) && q(p, R);
|
|
809
810
|
}
|
|
810
811
|
} else {
|
|
811
|
-
if (
|
|
812
|
+
if (it && T(a))
|
|
812
813
|
for (const y of f.mount) {
|
|
813
814
|
const p = g(s, y);
|
|
814
815
|
if (p && p._f) {
|
|
815
816
|
const F = Array.isArray(p._f.refs) ? p._f.refs[0] : p._f.ref;
|
|
816
|
-
if (
|
|
817
|
+
if (Ye(F)) {
|
|
817
818
|
const _ = F.closest("form");
|
|
818
819
|
if (_) {
|
|
819
820
|
_.reset();
|
|
@@ -846,14 +847,14 @@ function cr(e = {}) {
|
|
|
846
847
|
submitCount: o.keepSubmitCount ? r.submitCount : 0,
|
|
847
848
|
isDirty: c ? !1 : o.keepDirty ? r.isDirty : !!(o.keepDefaultValues && !he(a, i)),
|
|
848
849
|
isSubmitted: o.keepIsSubmitted ? r.isSubmitted : !1,
|
|
849
|
-
dirtyFields: c ? {} : o.keepDirtyValues ? o.keepDefaultValues && n ?
|
|
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
|
+
}, $e = (a, o) => Se(re(a) ? a(n) : a, { ...t.resetOptions, ...o }), Re = (a, o = {}) => {
|
|
857
858
|
const u = g(s, a), h = u && u._f;
|
|
858
859
|
if (h) {
|
|
859
860
|
const c = h.refs ? h.refs[0] : h.ref;
|
|
@@ -861,37 +862,37 @@ function cr(e = {}) {
|
|
|
861
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
|
-
register:
|
|
872
|
-
unregister:
|
|
873
|
-
getFieldState:
|
|
874
|
-
handleSubmit:
|
|
872
|
+
register: _e,
|
|
873
|
+
unregister: xe,
|
|
874
|
+
getFieldState: ke,
|
|
875
|
+
handleSubmit: qe,
|
|
875
876
|
setError: we,
|
|
876
|
-
_subscribe:
|
|
877
|
+
_subscribe: Be,
|
|
877
878
|
_runSchema: ae,
|
|
878
879
|
_updateIsValidating: W,
|
|
879
|
-
_focusError:
|
|
880
|
+
_focusError: De,
|
|
880
881
|
_getWatch: x,
|
|
881
882
|
_getDirty: V,
|
|
882
883
|
_setValid: Z,
|
|
883
884
|
_setFieldArray: A,
|
|
884
|
-
_setDisabledField:
|
|
885
|
+
_setDisabledField: Pe,
|
|
885
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
894
|
_removeUnmounted: ce,
|
|
894
|
-
_disableForm:
|
|
895
|
+
_disableForm: Ge,
|
|
895
896
|
_subjects: m,
|
|
896
897
|
_proxyFormState: D,
|
|
897
898
|
get _fields() {
|
|
@@ -928,27 +929,27 @@ function cr(e = {}) {
|
|
|
928
929
|
};
|
|
929
930
|
}
|
|
930
931
|
},
|
|
931
|
-
subscribe:
|
|
932
|
+
subscribe: Je,
|
|
932
933
|
trigger: fe,
|
|
933
|
-
register:
|
|
934
|
-
handleSubmit:
|
|
935
|
-
watch:
|
|
934
|
+
register: _e,
|
|
935
|
+
handleSubmit: qe,
|
|
936
|
+
watch: Ue,
|
|
936
937
|
setValue: q,
|
|
937
|
-
getValues:
|
|
938
|
-
reset:
|
|
939
|
-
resetField:
|
|
938
|
+
getValues: Ie,
|
|
939
|
+
reset: $e,
|
|
940
|
+
resetField: Xe,
|
|
940
941
|
clearErrors: E,
|
|
941
|
-
unregister:
|
|
942
|
+
unregister: xe,
|
|
942
943
|
setError: we,
|
|
943
|
-
setFocus:
|
|
944
|
-
getFieldState:
|
|
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,14 +974,14 @@ 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, ...f } =
|
|
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 }),
|
|
@@ -1013,9 +1014,9 @@ function dr(e = {}) {
|
|
|
1013
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(),
|
|
@@ -1102,33 +1103,33 @@ function me(e, t) {
|
|
|
1102
1103
|
case "SystemIdentifier":
|
|
1103
1104
|
if (e.Property) {
|
|
1104
1105
|
const b = t.systemValues[e.Name];
|
|
1105
|
-
return
|
|
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 b =
|
|
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
1118
|
const s = me(e.Arguments[0], t), i = (r = e.Arguments[0].Property) == null ? void 0 : r.Name;
|
|
1118
|
-
return i ?
|
|
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
1123
|
const n = me(e.Arguments[0], t), l = me(e.Arguments[1], t);
|
|
1123
|
-
return
|
|
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 f =
|
|
1132
|
+
const f = mr[e.Callee];
|
|
1132
1133
|
if (!f)
|
|
1133
1134
|
throw new Error(`Unknown function: ${e.Callee}`);
|
|
1134
1135
|
const w = (e.Arguments || []).map(
|
|
@@ -1143,7 +1144,7 @@ function me(e, t) {
|
|
|
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 At(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,7 +1186,7 @@ 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
1192
|
return t.every((s) => !!me(s, r));
|
|
@@ -1195,10 +1196,10 @@ function yr(e, t, r) {
|
|
|
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 {
|
|
@@ -1207,11 +1208,11 @@ function It(e, t, r = {}) {
|
|
|
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,14 +1226,14 @@ function xt(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
|
+
function Dt(e, t) {
|
|
1236
1237
|
var f, w, b;
|
|
1237
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 : [
|
|
@@ -1243,7 +1244,7 @@ function _t(e, t) {
|
|
|
1243
1244
|
`${n}!=''`
|
|
1244
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: {},
|
|
@@ -1257,7 +1258,7 @@ function pr(e) {
|
|
|
1257
1258
|
if (i.Validation.length > 0 && typeof i.Validation[0] == "object") {
|
|
1258
1259
|
const l = [];
|
|
1259
1260
|
i.Validation.forEach((f) => {
|
|
1260
|
-
t.Rules.Validation[f.Id] = f, l.push(f.Id),
|
|
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,
|
|
@@ -1267,7 +1268,7 @@ function pr(e) {
|
|
|
1267
1268
|
i.Validation.forEach((f) => {
|
|
1268
1269
|
var b;
|
|
1269
1270
|
const w = (b = t.Rules.Validation) == null ? void 0 : b[f];
|
|
1270
|
-
w &&
|
|
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;
|
|
@@ -1316,7 +1317,7 @@ function wr(e) {
|
|
|
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] = {
|
|
@@ -1332,12 +1333,12 @@ function vr(e, t) {
|
|
|
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,
|
|
@@ -1357,7 +1358,7 @@ function Fr(e, t) {
|
|
|
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,15 +1434,15 @@ function _r(e, t, r, s = {}, i, n) {
|
|
|
1433
1434
|
validation: [],
|
|
1434
1435
|
computation: [],
|
|
1435
1436
|
businessLogic: []
|
|
1436
|
-
}, b = t.Computed || !!t.Formula || w.computation.length > 0, O =
|
|
1437
|
+
}, b = t.Computed || !!t.Formula || w.computation.length > 0, O = Ar(e, t);
|
|
1437
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
1443
|
computed: b,
|
|
1443
|
-
defaultValue:
|
|
1444
|
-
options:
|
|
1444
|
+
defaultValue: _r(t, s),
|
|
1445
|
+
options: xr(t),
|
|
1445
1446
|
validation: O,
|
|
1446
1447
|
description: t.Description,
|
|
1447
1448
|
_bdoField: t,
|
|
@@ -1449,17 +1450,17 @@ function _r(e, t, r, s = {}, i, n) {
|
|
|
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 = [], f = [], w = [], b =
|
|
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
1460
|
const Y = D[v];
|
|
1460
1461
|
if (Y.hidden)
|
|
1461
1462
|
continue;
|
|
1462
|
-
const C =
|
|
1463
|
+
const C = Dr(
|
|
1463
1464
|
v,
|
|
1464
1465
|
m,
|
|
1465
1466
|
s.Fields,
|
|
@@ -1484,7 +1485,7 @@ function Dr(e, t = {}, r) {
|
|
|
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,7 +1533,7 @@ 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
1538
|
return await be(e).get(t);
|
|
1538
1539
|
} catch (r) {
|
|
@@ -1541,7 +1542,7 @@ async function Cr(e, t) {
|
|
|
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")
|
|
@@ -1569,7 +1570,7 @@ 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
1576
|
return r && (i.Filter = r), s && (i.Sort = s), t.length > 0 && (i.Field = t), (await be(e).list(i)).Data || [];
|
|
@@ -1577,11 +1578,11 @@ async function Lr(e, t = ["_id"], r, s) {
|
|
|
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,7 +1601,7 @@ 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
1607
|
const l = n, f = e[l];
|
|
@@ -1620,43 +1621,43 @@ function Ir(e, t, r = "create", s) {
|
|
|
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
|
ve(this, "cache", /* @__PURE__ */ new Map());
|
|
1662
1663
|
ve(this, "maxSize");
|
|
@@ -1679,7 +1680,7 @@ class Dt {
|
|
|
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,10 +1699,10 @@ function Pr(e) {
|
|
|
1698
1699
|
}
|
|
1699
1700
|
return r(e), t;
|
|
1700
1701
|
}
|
|
1701
|
-
class
|
|
1702
|
+
class $r {
|
|
1702
1703
|
constructor() {
|
|
1703
|
-
ve(this, "resultCache", new
|
|
1704
|
-
ve(this, "dependencyCache", new
|
|
1704
|
+
ve(this, "resultCache", new St(500));
|
|
1705
|
+
ve(this, "dependencyCache", new St(200));
|
|
1705
1706
|
ve(this, "compiledExpressions", /* @__PURE__ */ new Map());
|
|
1706
1707
|
}
|
|
1707
1708
|
/**
|
|
@@ -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
|
|
@@ -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
|
|
@@ -1934,10 +1935,10 @@ function $r(e, t, r, s, i) {
|
|
|
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,
|
|
@@ -1951,8 +1952,8 @@ function Qr(e) {
|
|
|
1951
1952
|
skipSchemaFetch: b = !1,
|
|
1952
1953
|
schema: O,
|
|
1953
1954
|
interactionMode: D = "interactive"
|
|
1954
|
-
} = 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 =
|
|
1955
|
-
|
|
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(() => {
|
|
1956
1957
|
S.current = w;
|
|
1957
1958
|
}, [w]);
|
|
1958
1959
|
const {
|
|
@@ -1960,9 +1961,9 @@ function Qr(e) {
|
|
|
1960
1961
|
isLoading: G,
|
|
1961
1962
|
error: q,
|
|
1962
1963
|
refetch: de
|
|
1963
|
-
} =
|
|
1964
|
+
} = ft({
|
|
1964
1965
|
queryKey: ["form-schema", t],
|
|
1965
|
-
queryFn: () => b ? Promise.resolve(O || {}) :
|
|
1966
|
+
queryFn: () => b ? Promise.resolve(O || {}) : Pr(t),
|
|
1966
1967
|
enabled: l && (!b || !!O),
|
|
1967
1968
|
retry: 3,
|
|
1968
1969
|
staleTime: 30 * 60 * 1e3,
|
|
@@ -1973,10 +1974,10 @@ function Qr(e) {
|
|
|
1973
1974
|
}), {
|
|
1974
1975
|
data: K,
|
|
1975
1976
|
isLoading: fe,
|
|
1976
|
-
error:
|
|
1977
|
-
} =
|
|
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,78 +1985,88 @@ 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
|
+
}), ke = Oe(() => {
|
|
1988
1989
|
const u = { ...i };
|
|
1989
1990
|
if (r === "update" && K && Object.assign(u, K), m)
|
|
1990
1991
|
for (const [h, c] of Object.entries(m.fields))
|
|
1991
1992
|
c.defaultValue !== void 0 && !(h in u) && (u[h] = c.defaultValue);
|
|
1992
1993
|
return u;
|
|
1993
|
-
}, [i, K, r, m]), E =
|
|
1994
|
+
}, [i, K, r, m]), E = fr({
|
|
1994
1995
|
mode: n,
|
|
1995
1996
|
defaultValues: i,
|
|
1996
|
-
values: r === "update" && K ?
|
|
1997
|
+
values: r === "update" && K ? ke : void 0
|
|
1997
1998
|
});
|
|
1998
|
-
|
|
1999
|
+
He(() => {
|
|
1999
2000
|
var u;
|
|
2000
2001
|
if (I)
|
|
2001
2002
|
try {
|
|
2002
|
-
const h =
|
|
2003
|
+
const h = Sr(
|
|
2003
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
|
Y(h);
|
|
2009
|
-
const c =
|
|
2010
|
-
Object.keys(c).length > 0 &&
|
|
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
|
+
});
|
|
2011
2016
|
} catch (h) {
|
|
2012
|
-
console.error("Schema processing failed:", h), (u = S.current) == null || u.call(S, h);
|
|
2017
|
+
console.error("Schema processing failed:", h), (u = S.current) == null || u.call(S, Ve(h));
|
|
2013
2018
|
}
|
|
2014
|
-
}, [I, f]),
|
|
2019
|
+
}, [I, f]), He(() => {
|
|
2015
2020
|
var u;
|
|
2016
2021
|
q && ((u = S.current) == null || u.call(S, q));
|
|
2017
|
-
}, [q]),
|
|
2022
|
+
}, [q]), He(() => {
|
|
2018
2023
|
if (!v || r !== "create" || !m || !l || M || x.current)
|
|
2019
2024
|
return;
|
|
2020
|
-
x.current = !0
|
|
2025
|
+
x.current = !0;
|
|
2026
|
+
let u = !0;
|
|
2027
|
+
return (async () => {
|
|
2021
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
|
-
ye(!1);
|
|
2043
|
+
u && ye(!1);
|
|
2035
2044
|
}
|
|
2036
|
-
})()
|
|
2045
|
+
})(), () => {
|
|
2046
|
+
u = !1;
|
|
2047
|
+
};
|
|
2037
2048
|
}, [v, r, m, l, M, t]);
|
|
2038
|
-
const we =
|
|
2049
|
+
const we = Oe(() => {
|
|
2039
2050
|
if (!m) return [];
|
|
2040
2051
|
const u = /* @__PURE__ */ new Set(), h = new Set(m.computedFields);
|
|
2041
2052
|
return Object.entries(m.fieldRules).forEach(([c, d]) => {
|
|
2042
2053
|
d.computation.forEach((y) => {
|
|
2043
2054
|
const p = m.rules.computation[y];
|
|
2044
|
-
p != null && p.ExpressionTree &&
|
|
2055
|
+
p != null && p.ExpressionTree && Rt(p.ExpressionTree).forEach((_) => {
|
|
2045
2056
|
m.fields[_] && _ !== c && !h.has(_) && u.add(_);
|
|
2046
2057
|
});
|
|
2047
2058
|
});
|
|
2048
2059
|
}), m.computedFields.forEach((c) => {
|
|
2049
2060
|
const d = m.fields[c];
|
|
2050
|
-
d._bdoField.Formula &&
|
|
2061
|
+
d._bdoField.Formula && Rt(
|
|
2051
2062
|
d._bdoField.Formula.ExpressionTree
|
|
2052
2063
|
).forEach((p) => {
|
|
2053
2064
|
m.fields[p] && p !== c && !h.has(p) && u.add(p);
|
|
2054
2065
|
});
|
|
2055
2066
|
}), Array.from(u);
|
|
2056
|
-
}, [m]),
|
|
2067
|
+
}, [m]), Ue = te(
|
|
2057
2068
|
async (u) => {
|
|
2058
|
-
if (!(!m || !(v || we.length > 0 && we.includes(u)))) {
|
|
2069
|
+
if (!(!m || !(v && r !== "update" || we.length > 0 && we.includes(u)))) {
|
|
2059
2070
|
if (v && r === "create" && !M) {
|
|
2060
2071
|
console.warn("Interactive create mode: waiting for draft ID");
|
|
2061
2072
|
return;
|
|
@@ -2074,8 +2085,8 @@ function Qr(e) {
|
|
|
2074
2085
|
);
|
|
2075
2086
|
Object.keys(c).forEach((B) => {
|
|
2076
2087
|
if (B === "_id" || _.has(B)) return;
|
|
2077
|
-
const z = c[B],
|
|
2078
|
-
JSON.stringify(z) !== JSON.stringify(
|
|
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
2091
|
const R = p, $ = {
|
|
2081
2092
|
...V.current
|
|
@@ -2116,7 +2127,7 @@ function Qr(e) {
|
|
|
2116
2127
|
v,
|
|
2117
2128
|
M
|
|
2118
2129
|
]
|
|
2119
|
-
),
|
|
2130
|
+
), Be = te(async () => {
|
|
2120
2131
|
if (!m)
|
|
2121
2132
|
return !1;
|
|
2122
2133
|
const u = E.getValues();
|
|
@@ -2128,7 +2139,7 @@ function Qr(e) {
|
|
|
2128
2139
|
Condition: { ExpressionTree: y.ExpressionTree },
|
|
2129
2140
|
Message: y.Message || `Validation failed for ${y.Name}`
|
|
2130
2141
|
})
|
|
2131
|
-
), d =
|
|
2142
|
+
), d = _t(
|
|
2132
2143
|
c,
|
|
2133
2144
|
u,
|
|
2134
2145
|
C
|
|
@@ -2145,7 +2156,7 @@ function Qr(e) {
|
|
|
2145
2156
|
E.trigger,
|
|
2146
2157
|
E.setError,
|
|
2147
2158
|
C
|
|
2148
|
-
]),
|
|
2159
|
+
]), Je = te(
|
|
2149
2160
|
(u, h) => E.handleSubmit(
|
|
2150
2161
|
// RHF onValid handler - validation passed, now do cross-field + API
|
|
2151
2162
|
async (c, d) => {
|
|
@@ -2162,7 +2173,7 @@ function Qr(e) {
|
|
|
2162
2173
|
Condition: { ExpressionTree: R.ExpressionTree },
|
|
2163
2174
|
Message: R.Message || `Validation failed for ${R.Name}`
|
|
2164
2175
|
})
|
|
2165
|
-
), p =
|
|
2176
|
+
), p = _t(
|
|
2166
2177
|
y,
|
|
2167
2178
|
c,
|
|
2168
2179
|
C
|
|
@@ -2176,7 +2187,7 @@ function Qr(e) {
|
|
|
2176
2187
|
}), h == null || h(E.formState.errors, d);
|
|
2177
2188
|
return;
|
|
2178
2189
|
}
|
|
2179
|
-
const F =
|
|
2190
|
+
const F = kr(
|
|
2180
2191
|
c,
|
|
2181
2192
|
m.computedFields,
|
|
2182
2193
|
r,
|
|
@@ -2195,8 +2206,8 @@ function Qr(e) {
|
|
|
2195
2206
|
_id: M
|
|
2196
2207
|
}) };
|
|
2197
2208
|
} else
|
|
2198
|
-
_ = { success: !0, data: await R.
|
|
2199
|
-
} else if (_ = await
|
|
2209
|
+
_ = { success: !0, data: await R.update(s, F) };
|
|
2210
|
+
} else if (_ = await Lr(
|
|
2200
2211
|
t,
|
|
2201
2212
|
r,
|
|
2202
2213
|
F,
|
|
@@ -2205,7 +2216,7 @@ function Qr(e) {
|
|
|
2205
2216
|
throw _.error || new Error("Submission failed");
|
|
2206
2217
|
r === "create" && (E.reset(), v && L(null)), await (u == null ? void 0 : u(_.data || c, d));
|
|
2207
2218
|
} catch (y) {
|
|
2208
|
-
h == null || h(y, d);
|
|
2219
|
+
h == null || h(Ve(y), d);
|
|
2209
2220
|
} finally {
|
|
2210
2221
|
A(!1);
|
|
2211
2222
|
}
|
|
@@ -2226,35 +2237,35 @@ function Qr(e) {
|
|
|
2226
2237
|
v,
|
|
2227
2238
|
M
|
|
2228
2239
|
]
|
|
2229
|
-
),
|
|
2240
|
+
), xe = te(
|
|
2230
2241
|
(u) => (m == null ? void 0 : m.fields[u]) || null,
|
|
2231
2242
|
[m]
|
|
2232
|
-
),
|
|
2243
|
+
), Pe = te(() => {
|
|
2233
2244
|
if (!m) return {};
|
|
2234
2245
|
const u = {};
|
|
2235
2246
|
return Object.entries(m.fields).forEach(([h, c]) => {
|
|
2236
2247
|
u[h] = c;
|
|
2237
2248
|
}), u;
|
|
2238
|
-
}, [m]),
|
|
2249
|
+
}, [m]), _e = te(
|
|
2239
2250
|
(u) => !!(m != null && m.fields[u]),
|
|
2240
2251
|
[m]
|
|
2241
|
-
),
|
|
2252
|
+
), De = te(
|
|
2242
2253
|
(u) => (m == null ? void 0 : m.requiredFields.includes(u)) || !1,
|
|
2243
2254
|
[m]
|
|
2244
|
-
),
|
|
2255
|
+
), Ge = te(
|
|
2245
2256
|
(u) => (m == null ? void 0 : m.computedFields.includes(u)) || !1,
|
|
2246
2257
|
[m]
|
|
2247
|
-
),
|
|
2258
|
+
), qe = te(async () => {
|
|
2248
2259
|
await de();
|
|
2249
|
-
}, [de]),
|
|
2260
|
+
}, [de]), Xe = te(() => {
|
|
2250
2261
|
E.clearErrors();
|
|
2251
|
-
}, [E]),
|
|
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
|
-
), a =
|
|
2268
|
+
), a = Oe(() => {
|
|
2258
2269
|
if (!m) return {};
|
|
2259
2270
|
const u = {};
|
|
2260
2271
|
return Object.entries(m.fields).forEach(([h, c]) => {
|
|
@@ -2275,7 +2286,7 @@ function Qr(e) {
|
|
|
2275
2286
|
for (const _ of y) {
|
|
2276
2287
|
const R = m.rules.validation[_];
|
|
2277
2288
|
if (R) {
|
|
2278
|
-
const $ =
|
|
2289
|
+
const $ = jr(
|
|
2279
2290
|
h,
|
|
2280
2291
|
p,
|
|
2281
2292
|
[R],
|
|
@@ -2298,7 +2309,7 @@ function Qr(e) {
|
|
|
2298
2309
|
const c = a[u], d = h == null ? void 0 : h.onBlur, y = async (p) => {
|
|
2299
2310
|
d && await d(p);
|
|
2300
2311
|
let F = !0;
|
|
2301
|
-
n === "onBlur" || n === "onTouched" || n === "all" ? F = await E.trigger(u) : F = !E.getFieldState(u, E.formState).error, 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
2314
|
return E.register(u, {
|
|
2304
2315
|
...c,
|
|
@@ -2306,9 +2317,9 @@ function Qr(e) {
|
|
|
2306
2317
|
onBlur: y
|
|
2307
2318
|
});
|
|
2308
2319
|
},
|
|
2309
|
-
[E, a,
|
|
2320
|
+
[E, a, Ue, n]
|
|
2310
2321
|
),
|
|
2311
|
-
handleSubmit:
|
|
2322
|
+
handleSubmit: Je,
|
|
2312
2323
|
watch: E.watch,
|
|
2313
2324
|
// Type assertion for complex generic constraints
|
|
2314
2325
|
setValue: E.setValue,
|
|
@@ -2320,36 +2331,36 @@ function Qr(e) {
|
|
|
2320
2331
|
isSubmitting: E.formState.isSubmitting || W,
|
|
2321
2332
|
isSubmitSuccessful: E.formState.isSubmitSuccessful,
|
|
2322
2333
|
// Loading states
|
|
2323
|
-
isLoadingInitialData:
|
|
2334
|
+
isLoadingInitialData: Se,
|
|
2324
2335
|
isLoadingRecord: fe,
|
|
2325
|
-
isLoading:
|
|
2336
|
+
isLoading: $e,
|
|
2326
2337
|
// Interactive mode state
|
|
2327
2338
|
draftId: M,
|
|
2328
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
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
|
};
|