@harnessio/forms 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +114 -104
- package/dist/index.js.map +1 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Re = Object.defineProperty;
|
|
2
2
|
var je = (r, e, n) => e in r ? Re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
-
var
|
|
4
|
-
import { isEmpty as
|
|
3
|
+
var N = (r, e, n) => je(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { isEmpty as M, set as O, get as C, forOwn as pe, isArray as x, isObject as he, merge as A, isUndefined as J, cloneDeep as W, unset as ye, isPlainObject as we, isNull as ge, omitBy as be, isNil as Ve, isString as xe, capitalize as Fe } from "lodash-es";
|
|
5
5
|
import Pe, { createContext as qe, useContext as Ae, Component as ke, memo as De, useMemo as B, useRef as V, useEffect as w, useCallback as Me, forwardRef as $e, Fragment as Ne } from "react";
|
|
6
6
|
import { useFormContext as Be, get as Ze, useForm as We, FormProvider as Je, appendErrors as Le, useController as Ue } from "react-hook-form";
|
|
7
7
|
import { Controller as Gr, Form as Kr, FormProvider as Qr, get as Xr, set as Yr, useFieldArray as zr, useForm as et, useFormContext as rt, useFormState as tt, useWatch as nt } from "react-hook-form";
|
|
@@ -14,8 +14,8 @@ class Ge extends Error {
|
|
|
14
14
|
}
|
|
15
15
|
class ve {
|
|
16
16
|
constructor(e) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
N(this, "componentBank");
|
|
18
|
+
N(this, "allowOverride");
|
|
19
19
|
this.allowOverride = (e == null ? void 0 : e.allowOverride) ?? !1, this.componentBank = /* @__PURE__ */ new Map();
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
@@ -30,7 +30,7 @@ class ve {
|
|
|
30
30
|
this.componentBank.set(e.internalType, e);
|
|
31
31
|
}
|
|
32
32
|
getComponent(e) {
|
|
33
|
-
if (e && !
|
|
33
|
+
if (e && !M(e))
|
|
34
34
|
return this.componentBank.get(e);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -96,12 +96,12 @@ function Ke() {
|
|
|
96
96
|
return U = i() ? Object.assign : function(s, a) {
|
|
97
97
|
for (var o, u = t(s), f, c = 1; c < arguments.length; c++) {
|
|
98
98
|
o = Object(arguments[c]);
|
|
99
|
-
for (var
|
|
100
|
-
e.call(o,
|
|
99
|
+
for (var d in o)
|
|
100
|
+
e.call(o, d) && (u[d] = o[d]);
|
|
101
101
|
if (r) {
|
|
102
102
|
f = r(o);
|
|
103
|
-
for (var
|
|
104
|
-
n.call(o, f[
|
|
103
|
+
for (var l = 0; l < f.length; l++)
|
|
104
|
+
n.call(o, f[l]) && (u[f[l]] = o[f[l]]);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
return u;
|
|
@@ -126,11 +126,11 @@ function Qe() {
|
|
|
126
126
|
}
|
|
127
127
|
var t = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = Object.prototype.hasOwnProperty, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
128
128
|
function a(o, u, f) {
|
|
129
|
-
var c,
|
|
130
|
-
f !== void 0 && (
|
|
131
|
-
for (c in u) i.call(u, c) && !s.hasOwnProperty(c) && (
|
|
132
|
-
if (o && o.defaultProps) for (c in u = o.defaultProps, u)
|
|
133
|
-
return { $$typeof: e, type: o, key:
|
|
129
|
+
var c, d = {}, l = null, p = null;
|
|
130
|
+
f !== void 0 && (l = "" + f), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (p = u.ref);
|
|
131
|
+
for (c in u) i.call(u, c) && !s.hasOwnProperty(c) && (d[c] = u[c]);
|
|
132
|
+
if (o && o.defaultProps) for (c in u = o.defaultProps, u) d[c] === void 0 && (d[c] = u[c]);
|
|
133
|
+
return { $$typeof: e, type: o, key: l, ref: p, props: d, _owner: t.current };
|
|
134
134
|
}
|
|
135
135
|
return F.jsx = a, F.jsxs = a, F;
|
|
136
136
|
}
|
|
@@ -165,7 +165,7 @@ function ze() {
|
|
|
165
165
|
class er extends ke {
|
|
166
166
|
constructor() {
|
|
167
167
|
super(...arguments);
|
|
168
|
-
|
|
168
|
+
N(this, "state", {
|
|
169
169
|
hasError: !1
|
|
170
170
|
});
|
|
171
171
|
}
|
|
@@ -197,19 +197,19 @@ const fe = ({
|
|
|
197
197
|
withoutWrapper: o = !1
|
|
198
198
|
}) {
|
|
199
199
|
var z, ee, re, te, ne;
|
|
200
|
-
const u = Be(), { formState: f } = u, { fixedValues: c = {} } = {}, { metadata:
|
|
200
|
+
const u = Be(), { formState: f } = u, { fixedValues: c = {} } = {}, { metadata: d, readonly: l, inputErrorHandler: p } = ze(), g = n == null ? void 0 : n.getComponent(a.inputType), b = !!(a.isVisible || typeof a.disabled == "function" || typeof ((z = a.validation) == null ? void 0 : z.schema) == "function" || typeof ((ee = a.warning) == null ? void 0 : ee.schema) == "function"), v = !!((re = a.warning) != null && re.schema || (te = a.validation) != null && te.schema), y = b ? u.watch() : {}, S = v ? b ? Ze(y, a.path) : u.watch(a.path) : void 0, _ = B(() => {
|
|
201
201
|
if (!b) return {};
|
|
202
202
|
let P = y;
|
|
203
|
-
return c && Object.keys(c).forEach((
|
|
204
|
-
const q = c[
|
|
205
|
-
P = O(P,
|
|
203
|
+
return c && Object.keys(c).forEach(($) => {
|
|
204
|
+
const q = c[$];
|
|
205
|
+
P = O(P, $, q);
|
|
206
206
|
}), P;
|
|
207
|
-
}, [b, y, c]), j = !a.isVisible || a.isVisible(_,
|
|
207
|
+
}, [b, y, c]), j = !a.isVisible || a.isVisible(_, d), T = l || a.readonly, I = typeof a.disabled == "function" ? a.disabled(_, d) : a.disabled, E = (ne = a.warning) == null ? void 0 : ne.schema, X = B(() => {
|
|
208
208
|
var ae, ie;
|
|
209
209
|
if (!j || typeof E > "u") return;
|
|
210
|
-
const P = typeof E == "function" ? E(_,
|
|
211
|
-
return
|
|
212
|
-
}, [a.path, S, E, j,
|
|
210
|
+
const P = typeof E == "function" ? E(_, d) : E, { success: $, error: q } = P.safeParse(S), se = (ie = (ae = q == null ? void 0 : q.errors) == null ? void 0 : ae[0]) == null ? void 0 : ie.message;
|
|
211
|
+
return !$ && se ? se : void 0;
|
|
212
|
+
}, [a.path, S, E, j, d]), Y = B(
|
|
213
213
|
() => ({
|
|
214
214
|
path: e,
|
|
215
215
|
key: e,
|
|
@@ -217,12 +217,12 @@ const fe = ({
|
|
|
217
217
|
onUpdate: t,
|
|
218
218
|
onChange: i,
|
|
219
219
|
factory: n,
|
|
220
|
-
readonly:
|
|
220
|
+
readonly: T,
|
|
221
221
|
input: a,
|
|
222
222
|
disabled: I,
|
|
223
223
|
warning: X
|
|
224
224
|
}),
|
|
225
|
-
[n, s, a, i, t, e,
|
|
225
|
+
[n, s, a, i, t, e, T, f.errors, I, X]
|
|
226
226
|
), Ie = B(() => j ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
|
|
227
227
|
a.before ? a.before : null,
|
|
228
228
|
/* @__PURE__ */ h.jsx(er, { path: e, inputType: a.inputType, inputErrorHandler: p, children: g == null ? void 0 : g.renderComponent(Y) }),
|
|
@@ -272,8 +272,8 @@ function _r(r) {
|
|
|
272
272
|
metadata: f,
|
|
273
273
|
children: c,
|
|
274
274
|
// fixedValues
|
|
275
|
-
autoFocusPath:
|
|
276
|
-
readonly:
|
|
275
|
+
autoFocusPath: d,
|
|
276
|
+
readonly: l
|
|
277
277
|
} = r, p = We({
|
|
278
278
|
mode: e,
|
|
279
279
|
reValidateMode: "onChange",
|
|
@@ -284,7 +284,7 @@ function _r(r) {
|
|
|
284
284
|
w(() => {
|
|
285
285
|
b.current = JSON.stringify(t ?? {}), p.reset(t, {});
|
|
286
286
|
}, [p.reset, t]), w(() => {
|
|
287
|
-
const
|
|
287
|
+
const T = le(), I = de(), E = T(() => {
|
|
288
288
|
p.reset({}, {
|
|
289
289
|
keepErrors: !0,
|
|
290
290
|
keepDirty: !0,
|
|
@@ -310,36 +310,36 @@ function _r(r) {
|
|
|
310
310
|
}, [a]);
|
|
311
311
|
const _ = V(!1);
|
|
312
312
|
w(() => {
|
|
313
|
-
const
|
|
313
|
+
const T = p.watch((I) => {
|
|
314
314
|
var E;
|
|
315
315
|
_.current || JSON.stringify(I ?? {}) !== b.current && ((E = y.current) == null || E.call(y, { ...I }), g.current === !0 && (_.current = !0, p.trigger().finally(() => {
|
|
316
316
|
_.current = !1;
|
|
317
317
|
})));
|
|
318
318
|
});
|
|
319
319
|
return () => {
|
|
320
|
-
|
|
320
|
+
T.unsubscribe();
|
|
321
321
|
};
|
|
322
322
|
}, [p]);
|
|
323
323
|
const j = V(!0);
|
|
324
324
|
return w(() => {
|
|
325
|
-
var
|
|
325
|
+
var T;
|
|
326
326
|
if (j.current) {
|
|
327
327
|
j.current = !1;
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
|
-
(
|
|
330
|
+
(T = S.current) == null || T.call(S, { isValid: p.formState.isValid, isSubmitted: p.formState.isSubmitted });
|
|
331
331
|
}, [p.formState.isValid, p.formState.isSubmitted]), w(() => {
|
|
332
|
-
if (
|
|
333
|
-
const
|
|
334
|
-
p.setFocus(
|
|
332
|
+
if (d) {
|
|
333
|
+
const T = le(), I = de(), E = T(() => {
|
|
334
|
+
p.setFocus(d);
|
|
335
335
|
});
|
|
336
336
|
return () => I(E);
|
|
337
337
|
}
|
|
338
|
-
}, [p,
|
|
338
|
+
}, [p, d]), /* @__PURE__ */ h.jsx(Ye, { metadata: f, readonly: l, inputErrorHandler: u, children: /* @__PURE__ */ h.jsx(Je, { ...p, children: typeof c == "function" ? c({
|
|
339
339
|
...p,
|
|
340
340
|
submitForm: async () => {
|
|
341
|
-
o && (g.current = !0, v((
|
|
342
|
-
o(
|
|
341
|
+
o && (g.current = !0, v((T) => {
|
|
342
|
+
o(T);
|
|
343
343
|
})());
|
|
344
344
|
}
|
|
345
345
|
}) : c }) });
|
|
@@ -348,7 +348,7 @@ const Ir = (r) => {
|
|
|
348
348
|
const e = {}, n = (t) => {
|
|
349
349
|
t.forEach((i) => {
|
|
350
350
|
const { path: s, default: a, inputs: o } = i;
|
|
351
|
-
Array.isArray(o) ? n(o) :
|
|
351
|
+
Array.isArray(o) ? n(o) : C(e, s) === void 0 && O(e, s, a);
|
|
352
352
|
});
|
|
353
353
|
};
|
|
354
354
|
return Array.isArray(r.inputs) && n(r.inputs), e;
|
|
@@ -371,7 +371,7 @@ function nr(r) {
|
|
|
371
371
|
}), e;
|
|
372
372
|
}
|
|
373
373
|
const sr = "Required field";
|
|
374
|
-
function
|
|
374
|
+
function k(r) {
|
|
375
375
|
let e;
|
|
376
376
|
if (typeof r == "string")
|
|
377
377
|
try {
|
|
@@ -384,7 +384,7 @@ function A(r) {
|
|
|
384
384
|
if (typeof e == "string")
|
|
385
385
|
return e;
|
|
386
386
|
if (x(e))
|
|
387
|
-
return
|
|
387
|
+
return k(e[0]);
|
|
388
388
|
const n = e;
|
|
389
389
|
return he(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
|
|
390
390
|
}
|
|
@@ -394,7 +394,7 @@ function ar(r, e, n) {
|
|
|
394
394
|
const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
|
|
395
395
|
t = O({}, s, t);
|
|
396
396
|
}
|
|
397
|
-
return m.object(
|
|
397
|
+
return m.object(D(t, e, n));
|
|
398
398
|
}
|
|
399
399
|
function ir(r, e, n) {
|
|
400
400
|
const t = Object.keys(r).filter((a) => /^\d+$/.test(a) && !a.startsWith("_")).map((a) => parseInt(a, 10)).sort((a, o) => a - o);
|
|
@@ -402,13 +402,13 @@ function ir(r, e, n) {
|
|
|
402
402
|
const i = Math.max(...t), s = [];
|
|
403
403
|
for (let a = 0; a <= i; a++)
|
|
404
404
|
if (t.includes(a)) {
|
|
405
|
-
const o = r[a], u =
|
|
405
|
+
const o = r[a], u = D({ item: o }, e, n);
|
|
406
406
|
s.push(u.item || m.any().optional());
|
|
407
407
|
} else
|
|
408
408
|
s.push(m.any().optional());
|
|
409
409
|
return m.tuple(s).rest(m.any()).optional();
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function D(r, e, n) {
|
|
412
412
|
const t = {};
|
|
413
413
|
return Object.keys(r).forEach((i) => {
|
|
414
414
|
const {
|
|
@@ -418,29 +418,29 @@ function k(r, e, n) {
|
|
|
418
418
|
_isList: u,
|
|
419
419
|
_isArrayItem: f,
|
|
420
420
|
_isTuple: c,
|
|
421
|
-
_schema:
|
|
421
|
+
_schema: d
|
|
422
422
|
/*...nestedSchemaObj*/
|
|
423
423
|
} = r[i];
|
|
424
424
|
if (c && !u && !f) {
|
|
425
|
-
const
|
|
426
|
-
if (
|
|
427
|
-
t[i] =
|
|
425
|
+
const l = ir(r[i], e, n);
|
|
426
|
+
if (l) {
|
|
427
|
+
t[i] = l;
|
|
428
428
|
return;
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
if (u && a && o) {
|
|
432
|
-
const
|
|
433
|
-
m.array(
|
|
432
|
+
const l = m.object(D(a, e, n)), p = m.union([
|
|
433
|
+
m.array(l).optional(),
|
|
434
434
|
Ee(o, n)
|
|
435
|
-
]), g = me(
|
|
435
|
+
]), g = me(d, o, e, n, p);
|
|
436
436
|
t[i] = g;
|
|
437
437
|
} else if (f && o) {
|
|
438
|
-
const
|
|
438
|
+
const l = a != null && a.___array ? D({ ___array: a.___array }, e, n) : { ___array: m.any() }, p = or(l, o, n), g = me(d, o, e, n, p);
|
|
439
439
|
t[i] = g;
|
|
440
|
-
} else if (
|
|
441
|
-
const
|
|
442
|
-
t[i] =
|
|
443
|
-
} else s && o ? t[i] = K(o, n) : t[i] = m.object(
|
|
440
|
+
} else if (d && o) {
|
|
441
|
+
const l = ur(d, o, e, n);
|
|
442
|
+
t[i] = l;
|
|
443
|
+
} else s && o ? t[i] = K(o, n) : t[i] = m.object(D(r[i], e, n)).optional();
|
|
444
444
|
}), t;
|
|
445
445
|
}
|
|
446
446
|
function Ee(r, e) {
|
|
@@ -484,10 +484,10 @@ function ur(r, e, n, t) {
|
|
|
484
484
|
if (a) {
|
|
485
485
|
const f = await a.safeParseAsync(i);
|
|
486
486
|
if (!f.success) {
|
|
487
|
-
const c =
|
|
487
|
+
const c = k(f == null ? void 0 : f.error.message), d = c === "Required" ? H(e, t) : c;
|
|
488
488
|
s.addIssue({
|
|
489
489
|
code: m.ZodIssueCode.custom,
|
|
490
|
-
message:
|
|
490
|
+
message: d
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
493
|
}
|
|
@@ -495,22 +495,22 @@ function ur(r, e, n, t) {
|
|
|
495
495
|
}
|
|
496
496
|
function me(r, e, n, t, i) {
|
|
497
497
|
return m.any().optional().superRefine(async (s, a) => {
|
|
498
|
-
var c,
|
|
498
|
+
var c, d;
|
|
499
499
|
const u = await K(e, t).safeParseAsync(s);
|
|
500
500
|
if (e.required && !u.success) {
|
|
501
|
-
const
|
|
502
|
-
return a.addIssue({ code: m.ZodIssueCode.custom, message:
|
|
501
|
+
const l = k(u.error.message);
|
|
502
|
+
return a.addIssue({ code: m.ZodIssueCode.custom, message: l, fatal: !0 }), m.NEVER;
|
|
503
503
|
}
|
|
504
504
|
if (!e.required && !u.success)
|
|
505
505
|
return m.NEVER;
|
|
506
506
|
if ((c = t == null ? void 0 : t.validationConfig) != null && c.globalValidation) {
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
507
|
+
const l = (d = t == null ? void 0 : t.validationConfig) == null ? void 0 : d.globalValidation(s, e, t.metadata);
|
|
508
|
+
if (l.error)
|
|
509
509
|
return a.addIssue({
|
|
510
510
|
code: m.ZodIssueCode.custom,
|
|
511
|
-
message:
|
|
511
|
+
message: k(l.error)
|
|
512
512
|
}), m.NEVER;
|
|
513
|
-
if (!
|
|
513
|
+
if (!l.continue)
|
|
514
514
|
return !0;
|
|
515
515
|
}
|
|
516
516
|
if (!x(s))
|
|
@@ -520,43 +520,43 @@ function me(r, e, n, t, i) {
|
|
|
520
520
|
}), m.NEVER;
|
|
521
521
|
const f = Oe(r, n);
|
|
522
522
|
if (f) {
|
|
523
|
-
const
|
|
524
|
-
if (!
|
|
523
|
+
const l = await f.safeParseAsync(s);
|
|
524
|
+
if (!l.success)
|
|
525
525
|
return a.addIssue({
|
|
526
526
|
code: m.ZodIssueCode.custom,
|
|
527
|
-
message:
|
|
527
|
+
message: k(l.error.message)
|
|
528
528
|
}), m.NEVER;
|
|
529
529
|
}
|
|
530
530
|
}).pipe(i ?? m.any());
|
|
531
531
|
}
|
|
532
532
|
function Z(r, e, n, t, i) {
|
|
533
533
|
e.forEach((s) => {
|
|
534
|
-
var o, u, f, c,
|
|
534
|
+
var o, u, f, c, d, l, p;
|
|
535
535
|
const a = n;
|
|
536
536
|
if (!s.isVisible || (o = s.isVisible) != null && o.call(s, a, t == null ? void 0 : t.metadata)) {
|
|
537
|
-
const g =
|
|
537
|
+
const g = C(r, s.path);
|
|
538
538
|
if ((u = s.validation) != null && u.schema ? O(
|
|
539
539
|
r,
|
|
540
540
|
s.path,
|
|
541
|
-
|
|
541
|
+
A(g, {
|
|
542
542
|
_schema: (f = s.validation) == null ? void 0 : f.schema,
|
|
543
543
|
_input: s
|
|
544
544
|
})
|
|
545
|
-
) : s.required && O(r, s.path,
|
|
545
|
+
) : s.required && O(r, s.path, A(g, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
|
|
546
546
|
const b = {};
|
|
547
547
|
Z(
|
|
548
548
|
b,
|
|
549
|
-
(
|
|
549
|
+
(d = (c = s.inputConfig) == null ? void 0 : c.inputs) == null ? void 0 : d.map((y) => ({
|
|
550
550
|
...y,
|
|
551
551
|
path: y.relativePath
|
|
552
552
|
})),
|
|
553
553
|
n,
|
|
554
554
|
t
|
|
555
555
|
);
|
|
556
|
-
const v =
|
|
557
|
-
O(r, s.path,
|
|
556
|
+
const v = C(r, s.path);
|
|
557
|
+
O(r, s.path, A(v, { _schemaObj: b, _isList: !0, _input: s }));
|
|
558
558
|
}
|
|
559
|
-
if (!((
|
|
559
|
+
if (!((l = s.validation) != null && l.schema) && s.inputType === "array") {
|
|
560
560
|
const b = {};
|
|
561
561
|
Z(
|
|
562
562
|
b,
|
|
@@ -566,7 +566,7 @@ function Z(r, e, n, t, i) {
|
|
|
566
566
|
), O(
|
|
567
567
|
r,
|
|
568
568
|
s.path,
|
|
569
|
-
|
|
569
|
+
A(g, {
|
|
570
570
|
_schemaObj: b,
|
|
571
571
|
_schema: (p = s.validation) == null ? void 0 : p.schema,
|
|
572
572
|
_isArrayItem: !0,
|
|
@@ -582,8 +582,8 @@ function Z(r, e, n, t, i) {
|
|
|
582
582
|
const u = s.path.split(".");
|
|
583
583
|
u.forEach((f, c) => {
|
|
584
584
|
if (c > 0 && /^\d+$/.test(f)) {
|
|
585
|
-
const
|
|
586
|
-
|
|
585
|
+
const d = u.slice(0, c).join("."), l = d ? C(r, d) : r;
|
|
586
|
+
l && typeof l == "object" && (l._isTuple = !0);
|
|
587
587
|
}
|
|
588
588
|
});
|
|
589
589
|
}
|
|
@@ -601,7 +601,7 @@ function K(r, e) {
|
|
|
601
601
|
return (u = e == null ? void 0 : e.validationConfig) == null ? void 0 : u.requiredSchema;
|
|
602
602
|
const n = H(r, e);
|
|
603
603
|
return m.any().optional().superRefine((f, c) => {
|
|
604
|
-
typeof f == "object" &&
|
|
604
|
+
typeof f == "object" && M(f) && c.addIssue({
|
|
605
605
|
code: m.ZodIssueCode.custom,
|
|
606
606
|
message: n
|
|
607
607
|
}), (J(f) || f === "") && c.addIssue({
|
|
@@ -672,10 +672,10 @@ function lr(r, e) {
|
|
|
672
672
|
let s;
|
|
673
673
|
const a = t.path.split(".");
|
|
674
674
|
if (a.length > 1) {
|
|
675
|
-
const o = a.slice(0, -1).join("."), u =
|
|
676
|
-
typeof u == "string" || typeof u == "number" || typeof u == "boolean" ? s = void 0 : s =
|
|
675
|
+
const o = a.slice(0, -1).join("."), u = C(n, o);
|
|
676
|
+
typeof u == "string" || typeof u == "number" || typeof u == "boolean" ? s = void 0 : s = C(n, t.path);
|
|
677
677
|
} else
|
|
678
|
-
s =
|
|
678
|
+
s = C(n, t.path);
|
|
679
679
|
i.forEach((o) => {
|
|
680
680
|
const u = o(s, n);
|
|
681
681
|
u && (s = u.value, O(n, u.path ?? t.path, u.value));
|
|
@@ -691,10 +691,20 @@ function dr(r, e, n) {
|
|
|
691
691
|
return e.forEach((a) => {
|
|
692
692
|
if (a.outputTransform) {
|
|
693
693
|
const o = x(a.outputTransform) ? a.outputTransform : [a.outputTransform];
|
|
694
|
-
let u =
|
|
694
|
+
let u = C(s, a.path);
|
|
695
695
|
o.forEach((f) => {
|
|
696
696
|
const c = f(u, s);
|
|
697
|
-
|
|
697
|
+
if (c)
|
|
698
|
+
if (u = c.value, c.path) {
|
|
699
|
+
if (c.merge) {
|
|
700
|
+
const d = C(i, c.path);
|
|
701
|
+
let l;
|
|
702
|
+
d ? l = A({}, d, c.value) : l = c.value, O(i, c.path, l);
|
|
703
|
+
} else
|
|
704
|
+
O(i, c.path, c.value);
|
|
705
|
+
c.unset && t.push(a.path);
|
|
706
|
+
} else
|
|
707
|
+
O(i, a.path, c.value);
|
|
698
708
|
});
|
|
699
709
|
}
|
|
700
710
|
}), t.forEach((a) => {
|
|
@@ -778,17 +788,17 @@ function qr(r) {
|
|
|
778
788
|
function Ar() {
|
|
779
789
|
return function(r, e) {
|
|
780
790
|
if (!(typeof r > "u"))
|
|
781
|
-
return x(r) &&
|
|
791
|
+
return x(r) && M(r) ? { value: void 0 } : { value: r };
|
|
782
792
|
};
|
|
783
793
|
}
|
|
784
794
|
function kr(r) {
|
|
785
795
|
return function(e, n) {
|
|
786
|
-
const t = r ?
|
|
796
|
+
const t = r ? C(n, r) : e;
|
|
787
797
|
if (!(typeof t > "u")) {
|
|
788
798
|
if (ge(t)) return { value: void 0, path: r };
|
|
789
799
|
if (he(t)) {
|
|
790
800
|
const i = be(t, Ve);
|
|
791
|
-
if (
|
|
801
|
+
if (M(i))
|
|
792
802
|
return { value: void 0, path: r };
|
|
793
803
|
}
|
|
794
804
|
return { value: t, path: r };
|
|
@@ -798,12 +808,12 @@ function kr(r) {
|
|
|
798
808
|
function Dr() {
|
|
799
809
|
return function(r, e) {
|
|
800
810
|
if (!(typeof r > "u"))
|
|
801
|
-
return xe(r) &&
|
|
811
|
+
return xe(r) && M(r) ? { value: void 0 } : { value: r };
|
|
802
812
|
};
|
|
803
813
|
}
|
|
804
814
|
function Mr(r) {
|
|
805
815
|
return function(e, n) {
|
|
806
|
-
const t =
|
|
816
|
+
const t = C(n, r);
|
|
807
817
|
if (typeof t == "string")
|
|
808
818
|
return { value: t };
|
|
809
819
|
if (!(typeof t == "number" || typeof t == "boolean") && e !== void 0)
|
|
@@ -814,7 +824,7 @@ function $r(r) {
|
|
|
814
824
|
return function(e, n) {
|
|
815
825
|
if (typeof e > "u") return;
|
|
816
826
|
if (!e) return { value: e };
|
|
817
|
-
const t =
|
|
827
|
+
const t = C(n, r);
|
|
818
828
|
if (typeof t == "object") {
|
|
819
829
|
const i = yr(t);
|
|
820
830
|
if (Object.getOwnPropertyNames(i).length === 1)
|
|
@@ -825,7 +835,7 @@ function $r(r) {
|
|
|
825
835
|
}
|
|
826
836
|
function Nr(r) {
|
|
827
837
|
return function(e, n) {
|
|
828
|
-
const t =
|
|
838
|
+
const t = C(n, r);
|
|
829
839
|
if (typeof t == "string")
|
|
830
840
|
return { value: [t] };
|
|
831
841
|
if (!(typeof t == "number" || typeof t == "boolean") && e !== void 0)
|
|
@@ -836,7 +846,7 @@ function Br(r, e) {
|
|
|
836
846
|
return function(n, t) {
|
|
837
847
|
if (typeof n > "u") return;
|
|
838
848
|
if (!n) return { value: n };
|
|
839
|
-
const i =
|
|
849
|
+
const i = C(t, r);
|
|
840
850
|
if (x(i)) {
|
|
841
851
|
if (i.length === 1)
|
|
842
852
|
return { value: i[0], path: r };
|
|
@@ -895,13 +905,13 @@ function Jr(r, e) {
|
|
|
895
905
|
function R(r, e) {
|
|
896
906
|
var u, f, c;
|
|
897
907
|
const { override: n, ...t } = r, i = e && n ? n[e] : void 0, { inputConfig: s, ...a } = i || {}, o = i ? { ...t, ...a } : t;
|
|
898
|
-
if ((t.inputConfig || s) && (o.inputConfig = { ...t.inputConfig, ...s }), o.inputs && (o.inputs = o.inputs.map((
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
901
|
-
const p = Math.max(
|
|
908
|
+
if ((t.inputConfig || s) && (o.inputConfig = { ...t.inputConfig, ...s }), o.inputs && (o.inputs = o.inputs.map((d) => R(d, e))), o.inputType === "list" && o.inputConfig) {
|
|
909
|
+
const d = ((u = t.inputConfig) == null ? void 0 : u.inputs) || [], l = (s == null ? void 0 : s.inputs) || [];
|
|
910
|
+
if (d.length > 0 || l.length > 0) {
|
|
911
|
+
const p = Math.max(d.length, l.length);
|
|
902
912
|
o.inputConfig.inputs = Array.from({ length: p }, (g, b) => {
|
|
903
913
|
var S;
|
|
904
|
-
const v =
|
|
914
|
+
const v = d[b], y = l[b];
|
|
905
915
|
if (!v && y) return R(y, e);
|
|
906
916
|
if (v && !y) return R(v, e);
|
|
907
917
|
if (v && y) {
|
|
@@ -914,11 +924,11 @@ function R(r, e) {
|
|
|
914
924
|
));
|
|
915
925
|
}
|
|
916
926
|
if (o.inputType === "array" && o.inputConfig) {
|
|
917
|
-
const
|
|
918
|
-
if (
|
|
919
|
-
const p =
|
|
920
|
-
e &&
|
|
921
|
-
{ ...
|
|
927
|
+
const d = (f = t.inputConfig) == null ? void 0 : f.input, l = s == null ? void 0 : s.input;
|
|
928
|
+
if (d && l) {
|
|
929
|
+
const p = d.override ? { ...d.override } : {};
|
|
930
|
+
e && l && (p[e] = (c = d.override) != null && c[e] ? { ...d.override[e], ...l } : l), o.inputConfig.input = R(
|
|
931
|
+
{ ...d, override: p },
|
|
922
932
|
e
|
|
923
933
|
);
|
|
924
934
|
} else o.inputConfig.input && (o.inputConfig.input = R(o.inputConfig.input, e));
|
|
@@ -967,7 +977,7 @@ export {
|
|
|
967
977
|
Pr as objectToArrayInputTransformer,
|
|
968
978
|
dr as outputTransformValues,
|
|
969
979
|
Rr as overrideFormDefinition,
|
|
970
|
-
|
|
980
|
+
k as processValidationParseResponse,
|
|
971
981
|
nr as removeTemporaryFieldsValue,
|
|
972
982
|
Yr as set,
|
|
973
983
|
Nr as shorthandArrayInputTransformer,
|