@harnessio/forms 0.8.0 → 0.9.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 +113 -114
- package/dist/index.js.map +1 -1
- package/dist/utils/utils.d.ts +1 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var A = (r, e, n) =>
|
|
4
|
-
import { isEmpty as
|
|
5
|
-
import xe, { createContext as Fe, useContext as
|
|
6
|
-
import { useFormContext as
|
|
7
|
-
import { Controller as
|
|
1
|
+
var Ce = Object.defineProperty;
|
|
2
|
+
var we = (r, e, n) => e in r ? Ce(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var A = (r, e, n) => we(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { isEmpty as q, set as b, get as E, forOwn as me, isArray as w, isObject as he, merge as N, isUndefined as B, cloneDeep as H, unset as pe, pick as Ie, isNull as ye, omitBy as ge, isNil as Oe, isString as je, capitalize as Ve } from "lodash-es";
|
|
5
|
+
import xe, { createContext as Fe, useContext as Pe, Component as qe, memo as ke, useMemo as D, useRef as M, useEffect as F, useCallback as Ae, forwardRef as Ne, Fragment as De } from "react";
|
|
6
|
+
import { useFormContext as Me, get as $e, useForm as Ze, FormProvider as Be, appendErrors as Je, useController as Ue } from "react-hook-form";
|
|
7
|
+
import { Controller as Br, Form as Jr, FormProvider as Ur, get as Wr, set as Lr, useFieldArray as Hr, useForm as Gr, useFormContext as Kr, useFormState as Qr, useWatch as Xr } from "react-hook-form";
|
|
8
8
|
import * as l from "zod";
|
|
9
9
|
import { toNestErrors as We } from "@hookform/resolvers";
|
|
10
10
|
class Le extends Error {
|
|
@@ -30,7 +30,7 @@ class be {
|
|
|
30
30
|
this.componentBank.set(e.internalType, e);
|
|
31
31
|
}
|
|
32
32
|
getComponent(e) {
|
|
33
|
-
if (e && !
|
|
33
|
+
if (e && !q(e))
|
|
34
34
|
return this.componentBank.get(e);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -55,7 +55,7 @@ class be {
|
|
|
55
55
|
}), e;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
var J = { exports: {} },
|
|
58
|
+
var J = { exports: {} }, C = {};
|
|
59
59
|
/*
|
|
60
60
|
object-assign
|
|
61
61
|
(c) Sindre Sorhus
|
|
@@ -117,12 +117,12 @@ function He() {
|
|
|
117
117
|
*/
|
|
118
118
|
var ue;
|
|
119
119
|
function Ge() {
|
|
120
|
-
if (ue) return
|
|
120
|
+
if (ue) return C;
|
|
121
121
|
ue = 1, He();
|
|
122
122
|
var r = xe, e = 60103;
|
|
123
|
-
if (
|
|
123
|
+
if (C.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
|
|
124
124
|
var n = Symbol.for;
|
|
125
|
-
e = n("react.element"),
|
|
125
|
+
e = n("react.element"), C.Fragment = n("react.fragment");
|
|
126
126
|
}
|
|
127
127
|
var t = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = Object.prototype.hasOwnProperty, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
128
128
|
function o(u, i, f) {
|
|
@@ -132,7 +132,7 @@ function Ge() {
|
|
|
132
132
|
if (u && u.defaultProps) for (c in i = u.defaultProps, i) m[c] === void 0 && (m[c] = i[c]);
|
|
133
133
|
return { $$typeof: e, type: u, key: d, ref: h, props: m, _owner: t.current };
|
|
134
134
|
}
|
|
135
|
-
return
|
|
135
|
+
return C.jsx = o, C.jsxs = o, C;
|
|
136
136
|
}
|
|
137
137
|
var ie;
|
|
138
138
|
function Ke() {
|
|
@@ -159,10 +159,10 @@ function Qe({
|
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
function Xe() {
|
|
162
|
-
const r =
|
|
162
|
+
const r = Pe(ve);
|
|
163
163
|
return r || console.warn("useRootFormContext must be used within RootFormProvider"), r;
|
|
164
164
|
}
|
|
165
|
-
class Ye extends
|
|
165
|
+
class Ye extends qe {
|
|
166
166
|
constructor() {
|
|
167
167
|
super(...arguments);
|
|
168
168
|
A(this, "state", {
|
|
@@ -197,19 +197,19 @@ const ce = ({
|
|
|
197
197
|
withoutWrapper: u = !1
|
|
198
198
|
}) {
|
|
199
199
|
var Y, z, ee, re, te;
|
|
200
|
-
const i =
|
|
200
|
+
const i = Me(), { formState: f } = i, { fixedValues: c = {} } = {}, { metadata: m, readonly: d, inputErrorHandler: h } = Xe(), y = n == null ? void 0 : n.getComponent(o.inputType), g = !!(o.isVisible || typeof o.disabled == "function" || typeof ((Y = o.validation) == null ? void 0 : Y.schema) == "function" || typeof ((z = o.warning) == null ? void 0 : z.schema) == "function"), I = !!((ee = o.warning) != null && ee.schema || (re = o.validation) != null && re.schema), R = g ? i.watch() : {}, O = I ? g ? $e(R, o.path) : i.watch(o.path) : void 0, T = D(() => {
|
|
201
201
|
if (!g) return {};
|
|
202
202
|
let V = R;
|
|
203
203
|
return c && Object.keys(c).forEach((k) => {
|
|
204
204
|
const x = c[k];
|
|
205
205
|
V = b(V, k, x);
|
|
206
206
|
}), V;
|
|
207
|
-
}, [g, R, c]), v = !o.isVisible || o.isVisible(T, m), _ = d || o.readonly,
|
|
207
|
+
}, [g, R, c]), v = !o.isVisible || o.isVisible(T, m), _ = d || o.readonly, S = typeof o.disabled == "function" ? o.disabled(T, m) : o.disabled, j = (te = o.warning) == null ? void 0 : te.schema, Q = D(() => {
|
|
208
208
|
var se, ae;
|
|
209
|
-
if (!v || typeof
|
|
210
|
-
const V = typeof
|
|
209
|
+
if (!v || typeof j > "u") return;
|
|
210
|
+
const V = typeof j == "function" ? j(T) : j, { success: k, error: x } = V.safeParse(O), ne = (ae = (se = x == null ? void 0 : x.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
|
|
211
211
|
return !k && ne ? ne : void 0;
|
|
212
|
-
}, [o.path,
|
|
212
|
+
}, [o.path, O, j, v]), X = D(
|
|
213
213
|
() => ({
|
|
214
214
|
path: e,
|
|
215
215
|
key: e,
|
|
@@ -219,22 +219,22 @@ const ce = ({
|
|
|
219
219
|
factory: n,
|
|
220
220
|
readonly: _,
|
|
221
221
|
input: o,
|
|
222
|
-
disabled:
|
|
222
|
+
disabled: S,
|
|
223
223
|
warning: Q
|
|
224
224
|
}),
|
|
225
|
-
[n, s, o, a, t, e, _, f.errors,
|
|
226
|
-
),
|
|
225
|
+
[n, s, o, a, t, e, _, f.errors, S, Q]
|
|
226
|
+
), Se = D(() => v ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
227
227
|
o.before ? o.before : null,
|
|
228
228
|
/* @__PURE__ */ p.jsx(Ye, { path: e, inputType: o.inputType, inputErrorHandler: h, children: y == null ? void 0 : y.renderComponent(X) }),
|
|
229
229
|
o.after ? o.after : null
|
|
230
230
|
] }) : null, [v, o.before, o.inputType, o.after, e, y, X, f.errors]);
|
|
231
|
-
return y ? /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children:
|
|
231
|
+
return y ? /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: Se }) : /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: /* @__PURE__ */ p.jsxs("p", { children: [
|
|
232
232
|
"Input component not found (internal type: ",
|
|
233
233
|
o.inputType,
|
|
234
234
|
")"
|
|
235
235
|
] }) });
|
|
236
236
|
});
|
|
237
|
-
class
|
|
237
|
+
class vr {
|
|
238
238
|
getType() {
|
|
239
239
|
return this.internalType;
|
|
240
240
|
}
|
|
@@ -255,7 +255,7 @@ function fe() {
|
|
|
255
255
|
function le() {
|
|
256
256
|
return typeof window < "u" && "cancelIdleCallback" in window ? window.cancelIdleCallback : clearTimeout;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function Er(r) {
|
|
259
259
|
const {
|
|
260
260
|
mode: e = "onSubmit",
|
|
261
261
|
resolver: n,
|
|
@@ -274,17 +274,17 @@ function vr(r) {
|
|
|
274
274
|
// fixedValues
|
|
275
275
|
autoFocusPath: m,
|
|
276
276
|
readonly: d
|
|
277
|
-
} = r, h =
|
|
277
|
+
} = r, h = Ze({
|
|
278
278
|
mode: e ?? "onSubmit",
|
|
279
279
|
reValidateMode: "onChange",
|
|
280
280
|
defaultValues: t,
|
|
281
281
|
shouldFocusError: a,
|
|
282
282
|
resolver: n
|
|
283
|
-
}), y =
|
|
283
|
+
}), y = M(!1);
|
|
284
284
|
F(() => {
|
|
285
285
|
h.reset(t, {});
|
|
286
286
|
}, [h.reset, t]), F(() => {
|
|
287
|
-
const v = fe(), _ = le(),
|
|
287
|
+
const v = fe(), _ = le(), S = v(() => {
|
|
288
288
|
h.reset({}, {
|
|
289
289
|
keepErrors: !0,
|
|
290
290
|
keepDirty: !0,
|
|
@@ -298,17 +298,17 @@ function vr(r) {
|
|
|
298
298
|
keepSubmitCount: !0
|
|
299
299
|
});
|
|
300
300
|
});
|
|
301
|
-
return () => _(
|
|
301
|
+
return () => _(S);
|
|
302
302
|
}, []);
|
|
303
|
-
const { getValues: g, handleSubmit:
|
|
303
|
+
const { getValues: g, handleSubmit: I } = h, R = g(), O = M(!0);
|
|
304
304
|
F(() => {
|
|
305
|
-
if (
|
|
306
|
-
|
|
305
|
+
if (O.current) {
|
|
306
|
+
O.current = !1;
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
309
|
s == null || s({ ...R }), y.current === !0 && h.trigger();
|
|
310
310
|
}, [JSON.stringify(R)]);
|
|
311
|
-
const T =
|
|
311
|
+
const T = M(!0);
|
|
312
312
|
return F(() => {
|
|
313
313
|
if (T.current) {
|
|
314
314
|
T.current = !1;
|
|
@@ -317,21 +317,21 @@ function vr(r) {
|
|
|
317
317
|
o == null || o({ isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
|
|
318
318
|
}, [h.formState.isValid, h.formState.isSubmitted]), F(() => {
|
|
319
319
|
if (m) {
|
|
320
|
-
const v = fe(), _ = le(),
|
|
320
|
+
const v = fe(), _ = le(), S = v(() => {
|
|
321
321
|
h.setFocus(m);
|
|
322
322
|
});
|
|
323
|
-
return () => _(
|
|
323
|
+
return () => _(S);
|
|
324
324
|
}
|
|
325
|
-
}, [h]), /* @__PURE__ */ p.jsx(Qe, { metadata: f, readonly: d, inputErrorHandler: i, children: /* @__PURE__ */ p.jsx(
|
|
325
|
+
}, [h]), /* @__PURE__ */ p.jsx(Qe, { metadata: f, readonly: d, inputErrorHandler: i, children: /* @__PURE__ */ p.jsx(Be, { ...h, children: typeof c == "function" ? c({
|
|
326
326
|
...h,
|
|
327
327
|
submitForm: async () => {
|
|
328
|
-
u && (y.current = !0,
|
|
328
|
+
u && (y.current = !0, I((v) => {
|
|
329
329
|
u(v);
|
|
330
330
|
})());
|
|
331
331
|
}
|
|
332
332
|
}) : c }) });
|
|
333
333
|
}
|
|
334
|
-
const
|
|
334
|
+
const Rr = (r) => {
|
|
335
335
|
const e = {}, n = (t) => {
|
|
336
336
|
t.forEach((a) => {
|
|
337
337
|
const { path: s, default: o, inputType: u, inputs: i } = a;
|
|
@@ -340,7 +340,7 @@ const Er = (r) => {
|
|
|
340
340
|
};
|
|
341
341
|
return Array.isArray(r.inputs) && n(r.inputs), e;
|
|
342
342
|
};
|
|
343
|
-
function
|
|
343
|
+
function Tr(r, e) {
|
|
344
344
|
const n = r.inputs.map((t) => {
|
|
345
345
|
const a = er(e, t.path);
|
|
346
346
|
return a || t;
|
|
@@ -350,7 +350,7 @@ function Rr(r, e) {
|
|
|
350
350
|
function er(r, e) {
|
|
351
351
|
return r.inputs.find((n) => n.path === e);
|
|
352
352
|
}
|
|
353
|
-
const Ee = "__temp_",
|
|
353
|
+
const Ee = "__temp_", _r = (r) => Ee + r.split(".").join("__");
|
|
354
354
|
function rr(r) {
|
|
355
355
|
const e = { ...r };
|
|
356
356
|
return me(e, (n, t) => {
|
|
@@ -358,7 +358,7 @@ function rr(r) {
|
|
|
358
358
|
}), e;
|
|
359
359
|
}
|
|
360
360
|
const tr = "Required field";
|
|
361
|
-
function
|
|
361
|
+
function P(r) {
|
|
362
362
|
let e;
|
|
363
363
|
if (typeof r == "string")
|
|
364
364
|
try {
|
|
@@ -370,20 +370,20 @@ function q(r) {
|
|
|
370
370
|
e = r;
|
|
371
371
|
if (typeof e == "string")
|
|
372
372
|
return e;
|
|
373
|
-
if (
|
|
374
|
-
return
|
|
373
|
+
if (w(e))
|
|
374
|
+
return P(e[0]);
|
|
375
375
|
const n = e;
|
|
376
376
|
return he(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
|
|
377
377
|
}
|
|
378
378
|
function nr(r, e, n) {
|
|
379
379
|
let t = {};
|
|
380
|
-
if (
|
|
380
|
+
if (Z(t, r.inputs, e, n), n != null && n.prefix) {
|
|
381
381
|
const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
|
|
382
382
|
t = b({}, s, t);
|
|
383
383
|
}
|
|
384
|
-
return l.object(
|
|
384
|
+
return l.object($(t, e, n));
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function $(r, e, n) {
|
|
387
387
|
const t = {};
|
|
388
388
|
return Object.keys(r).forEach((a) => {
|
|
389
389
|
const {
|
|
@@ -396,15 +396,15 @@ function B(r, e, n) {
|
|
|
396
396
|
/*...nestedSchemaObj*/
|
|
397
397
|
} = r[a];
|
|
398
398
|
if (i && o && u) {
|
|
399
|
-
const m = l.array(l.object(
|
|
399
|
+
const m = l.array(l.object($(o, e, n))).optional(), d = de(c, u, e, n, m);
|
|
400
400
|
t[a] = d;
|
|
401
401
|
} else if (f && u) {
|
|
402
|
-
const m = o != null && o.___array ?
|
|
402
|
+
const m = o != null && o.___array ? $({ ___array: o.___array }, e, n) : { ___array: l.any() }, d = sr(m, u, n), h = de(c, u, e, n, d);
|
|
403
403
|
t[a] = h;
|
|
404
404
|
} else if (c && u) {
|
|
405
405
|
const m = ar(c, u, e, n);
|
|
406
406
|
t[a] = m;
|
|
407
|
-
} else s && u ? t[a] = G(u, n) : t[a] = l.object(
|
|
407
|
+
} else s && u ? t[a] = G(u, n) : t[a] = l.object($(r[a], e, n)).optional();
|
|
408
408
|
}), t;
|
|
409
409
|
}
|
|
410
410
|
function sr(r, e, n) {
|
|
@@ -448,7 +448,7 @@ function ar(r, e, n, t) {
|
|
|
448
448
|
if (o) {
|
|
449
449
|
const f = await o.safeParseAsync(a);
|
|
450
450
|
if (!f.success) {
|
|
451
|
-
const c =
|
|
451
|
+
const c = P(f == null ? void 0 : f.error.message), m = c === "Required" ? W(e, t) : c;
|
|
452
452
|
s.addIssue({
|
|
453
453
|
code: l.ZodIssueCode.custom,
|
|
454
454
|
message: m
|
|
@@ -462,7 +462,7 @@ function de(r, e, n, t, a) {
|
|
|
462
462
|
var c, m;
|
|
463
463
|
const i = await G(e, t).safeParseAsync(s);
|
|
464
464
|
if (e.required && !i.success) {
|
|
465
|
-
const d =
|
|
465
|
+
const d = P(i.error.message);
|
|
466
466
|
return o.addIssue({ code: l.ZodIssueCode.custom, message: d, fatal: !0 }), l.NEVER;
|
|
467
467
|
}
|
|
468
468
|
if (!e.required && !i.success)
|
|
@@ -472,12 +472,12 @@ function de(r, e, n, t, a) {
|
|
|
472
472
|
if (d.error)
|
|
473
473
|
return o.addIssue({
|
|
474
474
|
code: l.ZodIssueCode.custom,
|
|
475
|
-
message:
|
|
475
|
+
message: P(d.error)
|
|
476
476
|
}), l.NEVER;
|
|
477
477
|
if (!d.continue)
|
|
478
478
|
return l.NEVER;
|
|
479
479
|
}
|
|
480
|
-
if (!
|
|
480
|
+
if (!w(s))
|
|
481
481
|
return o.addIssue({
|
|
482
482
|
code: l.ZodIssueCode.custom,
|
|
483
483
|
message: "'Value is not array'"
|
|
@@ -488,12 +488,12 @@ function de(r, e, n, t, a) {
|
|
|
488
488
|
if (!d.success)
|
|
489
489
|
return o.addIssue({
|
|
490
490
|
code: l.ZodIssueCode.custom,
|
|
491
|
-
message:
|
|
491
|
+
message: P(d.error.message)
|
|
492
492
|
}), l.NEVER;
|
|
493
493
|
}
|
|
494
494
|
}).pipe(a ?? l.any());
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function Z(r, e, n, t, a) {
|
|
497
497
|
e.forEach((s) => {
|
|
498
498
|
var u, i, f, c, m, d, h;
|
|
499
499
|
const o = n;
|
|
@@ -506,9 +506,9 @@ function M(r, e, n, t, a) {
|
|
|
506
506
|
_schema: (f = s.validation) == null ? void 0 : f.schema,
|
|
507
507
|
_input: s
|
|
508
508
|
})
|
|
509
|
-
) : s.required && b(r, s.path, N(y, { _requiredOnly: !0, _input: s })), s.inputs &&
|
|
509
|
+
) : s.required && b(r, s.path, N(y, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
|
|
510
510
|
const g = {};
|
|
511
|
-
|
|
511
|
+
Z(
|
|
512
512
|
g,
|
|
513
513
|
(m = (c = s.inputConfig) == null ? void 0 : c.inputs) == null ? void 0 : m.map((R) => ({
|
|
514
514
|
...R,
|
|
@@ -517,12 +517,12 @@ function M(r, e, n, t, a) {
|
|
|
517
517
|
n,
|
|
518
518
|
t
|
|
519
519
|
);
|
|
520
|
-
const
|
|
521
|
-
b(r, s.path, N(
|
|
520
|
+
const I = E(r, s.path);
|
|
521
|
+
b(r, s.path, N(I, { _schemaObj: g, _isList: !0, _input: s }));
|
|
522
522
|
}
|
|
523
523
|
if (!((d = s.validation) != null && d.schema) && s.inputType === "array") {
|
|
524
524
|
const g = {};
|
|
525
|
-
|
|
525
|
+
Z(
|
|
526
526
|
g,
|
|
527
527
|
[{ ...s.inputConfig.input, path: "___array" }],
|
|
528
528
|
n,
|
|
@@ -553,10 +553,10 @@ function G(r, e) {
|
|
|
553
553
|
return (i = e == null ? void 0 : e.validationConfig) == null ? void 0 : i.requiredSchema;
|
|
554
554
|
const n = W(r, e);
|
|
555
555
|
return l.any().optional().superRefine((f, c) => {
|
|
556
|
-
typeof f == "object" &&
|
|
556
|
+
typeof f == "object" && q(f) && c.addIssue({
|
|
557
557
|
code: l.ZodIssueCode.custom,
|
|
558
558
|
message: n
|
|
559
|
-
}), (
|
|
559
|
+
}), (B(f) || f === "") && c.addIssue({
|
|
560
560
|
code: l.ZodIssueCode.custom,
|
|
561
561
|
message: n
|
|
562
562
|
});
|
|
@@ -596,7 +596,7 @@ const or = (r) => Array.isArray(r == null ? void 0 : r.errors), ur = (r, e) => {
|
|
|
596
596
|
}
|
|
597
597
|
return n;
|
|
598
598
|
};
|
|
599
|
-
function
|
|
599
|
+
function Sr(r, e) {
|
|
600
600
|
return Ae(
|
|
601
601
|
async (n, t, a) => {
|
|
602
602
|
try {
|
|
@@ -619,7 +619,7 @@ function _r(r, e) {
|
|
|
619
619
|
function ir(r, e) {
|
|
620
620
|
const n = H(r);
|
|
621
621
|
return e.forEach((t) => {
|
|
622
|
-
t.inputTransform && (
|
|
622
|
+
t.inputTransform && (w(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
|
|
623
623
|
const o = E(n, t.path), u = s(o, n);
|
|
624
624
|
u && b(n, u.path ?? t.path, u.value);
|
|
625
625
|
});
|
|
@@ -628,7 +628,7 @@ function ir(r, e) {
|
|
|
628
628
|
function cr(r, e) {
|
|
629
629
|
const n = [], t = H(r);
|
|
630
630
|
return e.forEach((a) => {
|
|
631
|
-
a.outputTransform && (
|
|
631
|
+
a.outputTransform && (w(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((o) => {
|
|
632
632
|
const u = E(t, a.path), i = o(u, t);
|
|
633
633
|
i && (i.path ? (b(t, i.path, i.value), i.unset && n.push(a.path)) : b(t, a.path, i.value));
|
|
634
634
|
});
|
|
@@ -643,7 +643,7 @@ function Te(r) {
|
|
|
643
643
|
const n = K(r.inputs).reduce((t, a) => {
|
|
644
644
|
const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
|
|
645
645
|
return (a.inputTransform || a.outputTransform) && t.push({
|
|
646
|
-
...
|
|
646
|
+
...Ie(a, "path", "inputTransform", "outputTransform"),
|
|
647
647
|
level: a.path.split(".").length,
|
|
648
648
|
isPrimitive: s
|
|
649
649
|
}), t;
|
|
@@ -660,7 +660,7 @@ function Cr(r, e) {
|
|
|
660
660
|
const n = Te(e);
|
|
661
661
|
return ir(r, n);
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function wr(r, e, n, t = {}) {
|
|
664
664
|
const a = Te(e);
|
|
665
665
|
let s = fr(e, r, n, t);
|
|
666
666
|
return s = cr(s, a), s = rr(s), s;
|
|
@@ -695,33 +695,33 @@ function jr(r) {
|
|
|
695
695
|
return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Vr() {
|
|
699
699
|
return function(r, e) {
|
|
700
700
|
if (!(typeof r > "u"))
|
|
701
|
-
return
|
|
701
|
+
return w(r) && q(r) ? { value: void 0 } : { value: r };
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function xr(r) {
|
|
705
705
|
return function(e, n) {
|
|
706
706
|
const t = r ? E(n, r) : e;
|
|
707
707
|
if (!(typeof t > "u")) {
|
|
708
708
|
if (ye(t)) return { value: void 0, path: r };
|
|
709
709
|
if (he(t)) {
|
|
710
|
-
const a = ge(t,
|
|
711
|
-
if (
|
|
710
|
+
const a = ge(t, Oe);
|
|
711
|
+
if (q(a))
|
|
712
712
|
return { value: void 0, path: r };
|
|
713
713
|
}
|
|
714
714
|
return { value: t, path: r };
|
|
715
715
|
}
|
|
716
716
|
};
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Fr() {
|
|
719
719
|
return function(r, e) {
|
|
720
720
|
if (!(typeof r > "u"))
|
|
721
|
-
return
|
|
721
|
+
return je(r) && q(r) ? { value: void 0 } : { value: r };
|
|
722
722
|
};
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Pr(r) {
|
|
725
725
|
return function(e, n) {
|
|
726
726
|
const t = E(n, r);
|
|
727
727
|
return typeof t == "string" ? { value: t } : { value: e };
|
|
@@ -740,19 +740,19 @@ function qr(r) {
|
|
|
740
740
|
return { value: e };
|
|
741
741
|
};
|
|
742
742
|
}
|
|
743
|
-
function
|
|
743
|
+
function kr(r) {
|
|
744
744
|
return function(e, n) {
|
|
745
745
|
if (typeof e > "u") return;
|
|
746
746
|
const t = E(n, r);
|
|
747
747
|
return typeof t == "string" ? { value: [t] } : { value: e };
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function Ar(r, e) {
|
|
751
751
|
return function(n, t) {
|
|
752
752
|
if (typeof n > "u") return;
|
|
753
753
|
if (!n) return { value: n };
|
|
754
754
|
const a = E(t, r);
|
|
755
|
-
if (
|
|
755
|
+
if (w(a)) {
|
|
756
756
|
if (a.length === 1)
|
|
757
757
|
return { value: a[0], path: r };
|
|
758
758
|
if (a.length === 0 && e != null && e.unsetIfEmpty)
|
|
@@ -762,10 +762,10 @@ function kr(r, e) {
|
|
|
762
762
|
};
|
|
763
763
|
}
|
|
764
764
|
function _e(r) {
|
|
765
|
-
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !_e(r[e])) :
|
|
765
|
+
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !_e(r[e])) : B(r);
|
|
766
766
|
}
|
|
767
767
|
function lr(r) {
|
|
768
|
-
return ge(r, (e) => typeof e == "object" ? _e(e) :
|
|
768
|
+
return ge(r, (e) => typeof e == "object" ? _e(e) : B(e));
|
|
769
769
|
}
|
|
770
770
|
function L(r) {
|
|
771
771
|
const { items: e, ...n } = r;
|
|
@@ -791,83 +791,82 @@ const dr = Ne((r, e) => {
|
|
|
791
791
|
] });
|
|
792
792
|
});
|
|
793
793
|
dr.displayName = "RenderForm";
|
|
794
|
-
function
|
|
794
|
+
function Nr(r) {
|
|
795
795
|
let e = !0;
|
|
796
796
|
return me(r, (n) => {
|
|
797
|
-
e = e && (n === "" || ye(n) ||
|
|
797
|
+
e = e && (n === "" || ye(n) || B(n));
|
|
798
798
|
}), e;
|
|
799
799
|
}
|
|
800
|
-
const
|
|
801
|
-
let
|
|
802
|
-
const
|
|
800
|
+
const Dr = (r = "") => Ve(r.split("_").join(" ")), mr = (r, e = 2, n, t = 1e3) => {
|
|
801
|
+
let a = !1;
|
|
802
|
+
const s = () => {
|
|
803
803
|
requestAnimationFrame(() => {
|
|
804
|
-
|
|
804
|
+
a || (e -= 1, e <= 0 ? r() : s());
|
|
805
805
|
});
|
|
806
806
|
};
|
|
807
|
-
return t(), () => {
|
|
808
|
-
|
|
809
|
-
|
|
807
|
+
return n && Date.now() - n <= t ? (r(), () => {
|
|
808
|
+
}) : (s(), () => {
|
|
809
|
+
a = !0;
|
|
810
|
+
});
|
|
810
811
|
};
|
|
811
|
-
function
|
|
812
|
+
function Mr(r) {
|
|
812
813
|
const {
|
|
813
814
|
field: { onBlur: e, ...n },
|
|
814
815
|
...t
|
|
815
|
-
} = Ue(r);
|
|
816
|
+
} = Ue(r), a = M(Date.now());
|
|
816
817
|
return {
|
|
817
818
|
...t,
|
|
818
819
|
field: {
|
|
819
820
|
...n,
|
|
820
|
-
onBlur: (
|
|
821
|
-
requestAnimationFrame(() => e());
|
|
822
|
-
}
|
|
821
|
+
onBlur: mr(e, 2, a.current)
|
|
823
822
|
}
|
|
824
823
|
};
|
|
825
824
|
}
|
|
826
825
|
export {
|
|
827
|
-
|
|
826
|
+
Br as Controller,
|
|
828
827
|
Jr as Form,
|
|
829
828
|
Ur as FormProvider,
|
|
830
|
-
|
|
829
|
+
vr as InputComponent,
|
|
831
830
|
ze as InputComponentRenderer,
|
|
832
831
|
be as InputFactory,
|
|
833
832
|
Le as InputOverrideError,
|
|
834
833
|
dr as RenderForm,
|
|
835
834
|
L as RenderInputs,
|
|
836
|
-
|
|
837
|
-
|
|
835
|
+
Er as RootForm,
|
|
836
|
+
mr as afterFrames,
|
|
838
837
|
jr as arrayToObjectOutputTransformer,
|
|
839
838
|
Ir as collectDefaultValues,
|
|
840
839
|
Cr as convertDataToFormModel,
|
|
841
|
-
|
|
842
|
-
|
|
840
|
+
wr as convertFormModelToData,
|
|
841
|
+
Dr as generateReadableLabel,
|
|
843
842
|
Wr as get,
|
|
844
|
-
|
|
845
|
-
|
|
843
|
+
Rr as getDefaultValuesFromFormDefinition,
|
|
844
|
+
_r as getTemporaryPath,
|
|
846
845
|
Te as getTransformers,
|
|
847
846
|
nr as getValidationSchema,
|
|
848
847
|
ir as inputTransformValues,
|
|
849
|
-
|
|
848
|
+
Nr as isChildrenEmpty,
|
|
850
849
|
Or as objectToArrayInputTransformer,
|
|
851
850
|
cr as outputTransformValues,
|
|
852
|
-
|
|
853
|
-
|
|
851
|
+
Tr as overrideFormDefinition,
|
|
852
|
+
P as processValidationParseResponse,
|
|
854
853
|
rr as removeTemporaryFieldsValue,
|
|
855
854
|
Lr as set,
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
855
|
+
kr as shorthandArrayInputTransformer,
|
|
856
|
+
Ar as shorthandArrayOutputTransformer,
|
|
857
|
+
Pr as shorthandObjectInputTransformer,
|
|
859
858
|
qr as shorthandObjectOutputTransformer,
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
859
|
+
Vr as unsetEmptyArrayOutputTransformer,
|
|
860
|
+
xr as unsetEmptyObjectOutputTransformer,
|
|
861
|
+
Fr as unsetEmptyStringOutputTransformer,
|
|
863
862
|
fr as unsetHiddenInputsValues,
|
|
864
|
-
|
|
863
|
+
Mr as useController,
|
|
865
864
|
Hr as useFieldArray,
|
|
866
865
|
Gr as useForm,
|
|
867
866
|
Kr as useFormContext,
|
|
868
867
|
Qr as useFormState,
|
|
869
868
|
Xe as useRootFormContext,
|
|
870
869
|
Xr as useWatch,
|
|
871
|
-
|
|
870
|
+
Sr as useZodValidationResolver
|
|
872
871
|
};
|
|
873
872
|
//# sourceMappingURL=index.js.map
|