@harnessio/forms 0.0.7 → 0.0.8
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 +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +152 -150
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var x = (r, e, n) =>
|
|
4
|
-
import { isEmpty as T, cloneDeep as
|
|
5
|
-
import
|
|
6
|
-
import { useFormContext as
|
|
1
|
+
var Y = Object.defineProperty;
|
|
2
|
+
var K = (r, e, n) => e in r ? Y(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var x = (r, e, n) => K(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { isEmpty as T, cloneDeep as C, set as b, get as g, isArray as E, isObject as L, merge as I, isUndefined as q, pick as X, unset as z, isNull as U, omitBy as W, isNil as ee, isString as re, forOwn as te, capitalize as ne } from "lodash-es";
|
|
5
|
+
import se, { useMemo as Z, useRef as P, useEffect as O, useCallback as ae, forwardRef as ue } from "react";
|
|
6
|
+
import { useFormContext as ie, useForm as oe, FormProvider as ce, appendErrors as fe } from "react-hook-form";
|
|
7
7
|
export * from "react-hook-form";
|
|
8
8
|
import * as m from "zod";
|
|
9
|
-
import { toNestErrors as
|
|
10
|
-
class
|
|
9
|
+
import { toNestErrors as de } from "@hookform/resolvers";
|
|
10
|
+
class le extends Error {
|
|
11
11
|
constructor(e) {
|
|
12
12
|
super(`Input component '${e}' is already registered.`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
class
|
|
15
|
+
class xe {
|
|
16
16
|
constructor(e) {
|
|
17
17
|
x(this, "componentBank");
|
|
18
18
|
x(this, "allowOverride");
|
|
@@ -26,7 +26,7 @@ class qe {
|
|
|
26
26
|
*/
|
|
27
27
|
registerComponent(e) {
|
|
28
28
|
if (!this.allowOverride && this.getComponent(e.internalType))
|
|
29
|
-
throw new
|
|
29
|
+
throw new le(e.internalType);
|
|
30
30
|
this.componentBank.set(e.internalType, e);
|
|
31
31
|
}
|
|
32
32
|
getComponent(e) {
|
|
@@ -41,7 +41,7 @@ object-assign
|
|
|
41
41
|
@license MIT
|
|
42
42
|
*/
|
|
43
43
|
var k, $;
|
|
44
|
-
function
|
|
44
|
+
function me() {
|
|
45
45
|
if ($) return k;
|
|
46
46
|
$ = 1;
|
|
47
47
|
var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
|
|
@@ -95,10 +95,10 @@ function le() {
|
|
|
95
95
|
* LICENSE file in the root directory of this source tree.
|
|
96
96
|
*/
|
|
97
97
|
var M;
|
|
98
|
-
function
|
|
98
|
+
function he() {
|
|
99
99
|
if (M) return S;
|
|
100
|
-
M = 1,
|
|
101
|
-
var r =
|
|
100
|
+
M = 1, me();
|
|
101
|
+
var r = se, e = 60103;
|
|
102
102
|
if (S.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
|
|
103
103
|
var n = Symbol.for;
|
|
104
104
|
e = n("react.element"), S.Fragment = n("react.fragment");
|
|
@@ -114,11 +114,11 @@ function me() {
|
|
|
114
114
|
return S.jsx = o, S.jsxs = o, S;
|
|
115
115
|
}
|
|
116
116
|
var B;
|
|
117
|
-
function
|
|
118
|
-
return B || (B = 1, N.exports =
|
|
117
|
+
function ye() {
|
|
118
|
+
return B || (B = 1, N.exports = he()), N.exports;
|
|
119
119
|
}
|
|
120
|
-
var y =
|
|
121
|
-
function
|
|
120
|
+
var y = ye();
|
|
121
|
+
function ge({
|
|
122
122
|
path: r,
|
|
123
123
|
factory: e,
|
|
124
124
|
onUpdate: n,
|
|
@@ -127,7 +127,7 @@ function ye({
|
|
|
127
127
|
initialValues: s,
|
|
128
128
|
input: o
|
|
129
129
|
}) {
|
|
130
|
-
const { formState: u, watch: c } =
|
|
130
|
+
const { formState: u, watch: c } = ie(), {
|
|
131
131
|
metadata: f = {},
|
|
132
132
|
fixedValues: i = {}
|
|
133
133
|
/*getValuesWithDependencies*/
|
|
@@ -142,28 +142,28 @@ function ye({
|
|
|
142
142
|
input: o
|
|
143
143
|
}),
|
|
144
144
|
[e, s, o, t, n, r, a, u.errors]
|
|
145
|
-
), h = c(),
|
|
146
|
-
i && Object.keys(i).forEach((
|
|
147
|
-
const
|
|
148
|
-
|
|
145
|
+
), h = c(), _ = C(h);
|
|
146
|
+
i && Object.keys(i).forEach((p) => {
|
|
147
|
+
const Q = i[p];
|
|
148
|
+
b(_, p, Q);
|
|
149
149
|
});
|
|
150
|
-
const
|
|
150
|
+
const v = !o.isVisible || (o == null ? void 0 : o.isVisible(_, f)), j = Z(() => v ? /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
|
|
151
151
|
o.before ? o.before : null,
|
|
152
152
|
d == null ? void 0 : d.renderComponent(l),
|
|
153
153
|
o.after ? o.after : null
|
|
154
|
-
] }) : null, [l, o.after, o.before, d,
|
|
155
|
-
return d ?
|
|
154
|
+
] }) : null, [l, o.after, o.before, d, v, u.errors]);
|
|
155
|
+
return d ? v ? j : null : /* @__PURE__ */ y.jsxs("p", { children: [
|
|
156
156
|
"Input component not found (internal type: ",
|
|
157
157
|
o.inputType,
|
|
158
158
|
")"
|
|
159
159
|
] });
|
|
160
160
|
}
|
|
161
|
-
class
|
|
161
|
+
class Pe {
|
|
162
162
|
getType() {
|
|
163
163
|
return this.internalType;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function Ne(r) {
|
|
167
167
|
const {
|
|
168
168
|
mode: e = "onSubmit",
|
|
169
169
|
resolver: n,
|
|
@@ -180,7 +180,7 @@ function Pe(r) {
|
|
|
180
180
|
children: c,
|
|
181
181
|
// fixedValues
|
|
182
182
|
autoFocusPath: f
|
|
183
|
-
} = r, i =
|
|
183
|
+
} = r, i = oe({
|
|
184
184
|
mode: e ?? "onSubmit",
|
|
185
185
|
reValidateMode: "onChange",
|
|
186
186
|
defaultValues: t,
|
|
@@ -190,7 +190,7 @@ function Pe(r) {
|
|
|
190
190
|
O(() => {
|
|
191
191
|
i.reset(t, {});
|
|
192
192
|
}, [i.reset, t]), O(() => {
|
|
193
|
-
requestIdleCallback(() => {
|
|
193
|
+
const p = requestIdleCallback(() => {
|
|
194
194
|
i.reset({}, {
|
|
195
195
|
keepErrors: !0,
|
|
196
196
|
keepDirty: !0,
|
|
@@ -204,65 +204,66 @@ function Pe(r) {
|
|
|
204
204
|
keepSubmitCount: !0
|
|
205
205
|
});
|
|
206
206
|
});
|
|
207
|
+
return () => cancelIdleCallback(p);
|
|
207
208
|
}, []);
|
|
208
|
-
const { getValues: l, handleSubmit: h } = i,
|
|
209
|
+
const { getValues: l, handleSubmit: h } = i, _ = l(), v = P(!0);
|
|
209
210
|
O(() => {
|
|
210
|
-
if (
|
|
211
|
-
|
|
211
|
+
if (v.current) {
|
|
212
|
+
v.current = !1;
|
|
212
213
|
return;
|
|
213
214
|
}
|
|
214
|
-
s == null || s({ ...
|
|
215
|
-
}, [JSON.stringify(
|
|
216
|
-
const
|
|
215
|
+
s == null || s({ ..._ }), d.current === !0 && i.trigger();
|
|
216
|
+
}, [JSON.stringify(_)]);
|
|
217
|
+
const j = P(!0);
|
|
217
218
|
return O(() => {
|
|
218
|
-
if (
|
|
219
|
-
|
|
219
|
+
if (j.current) {
|
|
220
|
+
j.current = !1;
|
|
220
221
|
return;
|
|
221
222
|
}
|
|
222
223
|
o == null || o({ isValid: i.formState.isValid, isSubmitted: i.formState.isSubmitted });
|
|
223
224
|
}, [i.formState.isValid, i.formState.isSubmitted]), O(() => {
|
|
224
225
|
if (f)
|
|
225
226
|
if ("requestIdleCallback" in window) {
|
|
226
|
-
const
|
|
227
|
+
const p = requestIdleCallback(() => {
|
|
227
228
|
i.setFocus(f);
|
|
228
229
|
});
|
|
229
|
-
return () => cancelIdleCallback(
|
|
230
|
+
return () => cancelIdleCallback(p);
|
|
230
231
|
} else {
|
|
231
|
-
const
|
|
232
|
+
const p = setTimeout(() => {
|
|
232
233
|
i.setFocus(f);
|
|
233
234
|
}, 100);
|
|
234
|
-
return () => clearTimeout(
|
|
235
|
+
return () => clearTimeout(p);
|
|
235
236
|
}
|
|
236
|
-
}, [i]), /* @__PURE__ */ y.jsx(
|
|
237
|
+
}, [i]), /* @__PURE__ */ y.jsx(ce, { ...i, children: typeof c == "function" ? c({
|
|
237
238
|
...i,
|
|
238
239
|
submitForm: async () => {
|
|
239
|
-
u && (d.current = !0, h((
|
|
240
|
-
u(
|
|
240
|
+
u && (d.current = !0, h((p) => {
|
|
241
|
+
u(p);
|
|
241
242
|
})());
|
|
242
243
|
}
|
|
243
244
|
}) : c });
|
|
244
245
|
}
|
|
245
|
-
const
|
|
246
|
+
const ke = (r) => {
|
|
246
247
|
var n;
|
|
247
248
|
const e = {};
|
|
248
249
|
return (n = r == null ? void 0 : r.inputs) == null || n.forEach((t) => {
|
|
249
250
|
var a;
|
|
250
251
|
t.inputType === "group" && ((a = t == null ? void 0 : t.inputs) == null || a.forEach((s) => {
|
|
251
|
-
typeof g(e, s.path) > "u" &&
|
|
252
|
-
})), typeof g(e, t.path) > "u" &&
|
|
252
|
+
typeof g(e, s.path) > "u" && b(e, s.path, s.default);
|
|
253
|
+
})), typeof g(e, t.path) > "u" && b(e, t.path, t.default);
|
|
253
254
|
}), e;
|
|
254
255
|
};
|
|
255
|
-
function
|
|
256
|
+
function Fe(r, e) {
|
|
256
257
|
const n = r.inputs.map((t) => {
|
|
257
|
-
const a =
|
|
258
|
+
const a = pe(e, t.path);
|
|
258
259
|
return a || t;
|
|
259
260
|
});
|
|
260
261
|
return { ...r, inputs: n };
|
|
261
262
|
}
|
|
262
|
-
function
|
|
263
|
+
function pe(r, e) {
|
|
263
264
|
return r.inputs.find((n) => n.path === e);
|
|
264
265
|
}
|
|
265
|
-
const
|
|
266
|
+
const be = "Required field";
|
|
266
267
|
function R(r) {
|
|
267
268
|
const e = typeof r == "string" ? JSON.parse(r) : r;
|
|
268
269
|
if (typeof e == "string")
|
|
@@ -272,15 +273,15 @@ function R(r) {
|
|
|
272
273
|
const n = e;
|
|
273
274
|
return L(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
|
|
274
275
|
}
|
|
275
|
-
function
|
|
276
|
+
function ve(r, e, n) {
|
|
276
277
|
let t = {};
|
|
277
|
-
if (
|
|
278
|
+
if (w(t, r.inputs, e, n), n != null && n.prefix) {
|
|
278
279
|
const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
|
|
279
|
-
t =
|
|
280
|
+
t = b({}, s, t);
|
|
280
281
|
}
|
|
281
|
-
return m.object(
|
|
282
|
+
return m.object(V(t, e, n));
|
|
282
283
|
}
|
|
283
|
-
function
|
|
284
|
+
function V(r, e, n) {
|
|
284
285
|
const t = {};
|
|
285
286
|
return Object.keys(r).forEach((a) => {
|
|
286
287
|
const {
|
|
@@ -293,15 +294,15 @@ function w(r, e, n) {
|
|
|
293
294
|
/*...nestedSchemaObj*/
|
|
294
295
|
} = r[a];
|
|
295
296
|
if (c && o && u) {
|
|
296
|
-
const d = m.array(m.object(
|
|
297
|
+
const d = m.array(m.object(V(o, e, n))).optional(), l = J(i, u, e, n, d);
|
|
297
298
|
t[a] = l;
|
|
298
299
|
} else if (f && u) {
|
|
299
|
-
const d = o != null && o.___array ?
|
|
300
|
+
const d = o != null && o.___array ? V({ ___array: o.___array }, e, n) : { ___array: m.any() }, l = m.array(d.___array).optional(), h = J(i, u, e, n, l);
|
|
300
301
|
t[a] = h;
|
|
301
302
|
} else if (i && u) {
|
|
302
303
|
const d = _e(i, u, e, n);
|
|
303
304
|
t[a] = d;
|
|
304
|
-
} else s && u ? t[a] = A(u, n) : t[a] = m.object(
|
|
305
|
+
} else s && u ? t[a] = A(u, n) : t[a] = m.object(V(r[a], e, n)).optional();
|
|
305
306
|
}), t;
|
|
306
307
|
}
|
|
307
308
|
function _e(r, e, n, t) {
|
|
@@ -322,7 +323,7 @@ function _e(r, e, n, t) {
|
|
|
322
323
|
if (!f.continue)
|
|
323
324
|
return !0;
|
|
324
325
|
}
|
|
325
|
-
const o =
|
|
326
|
+
const o = G(r, n);
|
|
326
327
|
if (o) {
|
|
327
328
|
const f = await o.safeParseAsync(a);
|
|
328
329
|
if (!f.success) {
|
|
@@ -360,7 +361,7 @@ function J(r, e, n, t, a) {
|
|
|
360
361
|
code: m.ZodIssueCode.custom,
|
|
361
362
|
message: "'Value is not array'"
|
|
362
363
|
}), m.NEVER;
|
|
363
|
-
const f =
|
|
364
|
+
const f = G(r, n);
|
|
364
365
|
if (f) {
|
|
365
366
|
const l = await f.safeParseAsync(s);
|
|
366
367
|
if (!l.success)
|
|
@@ -371,44 +372,44 @@ function J(r, e, n, t, a) {
|
|
|
371
372
|
}
|
|
372
373
|
}).pipe(a ?? m.any());
|
|
373
374
|
}
|
|
374
|
-
function
|
|
375
|
+
function w(r, e, n, t, a) {
|
|
375
376
|
e.forEach((s) => {
|
|
376
377
|
var u, c, f, i, d;
|
|
377
378
|
const o = n;
|
|
378
379
|
if (!s.isVisible || (u = s.isVisible) != null && u.call(s, o, t == null ? void 0 : t.metadata)) {
|
|
379
380
|
const l = g(r, s.path);
|
|
380
|
-
if ((c = s.validation) != null && c.schema ?
|
|
381
|
+
if ((c = s.validation) != null && c.schema ? b(
|
|
381
382
|
r,
|
|
382
383
|
s.path,
|
|
383
|
-
|
|
384
|
+
I(l, {
|
|
384
385
|
_schema: (f = s.validation) == null ? void 0 : f.schema,
|
|
385
386
|
_input: s
|
|
386
387
|
})
|
|
387
|
-
) : s.required &&
|
|
388
|
+
) : s.required && b(r, s.path, I(l, { _requiredOnly: !0, _input: s })), s.inputs && w(r, s.inputs, n, t), s.inputType === "list") {
|
|
388
389
|
const h = {};
|
|
389
|
-
|
|
390
|
+
w(
|
|
390
391
|
h,
|
|
391
|
-
s.inputConfig.inputs.map((
|
|
392
|
-
...
|
|
393
|
-
path:
|
|
392
|
+
s.inputConfig.inputs.map((v) => ({
|
|
393
|
+
...v,
|
|
394
|
+
path: v.relativePath
|
|
394
395
|
})),
|
|
395
396
|
n,
|
|
396
397
|
t
|
|
397
398
|
);
|
|
398
|
-
const
|
|
399
|
-
|
|
399
|
+
const _ = g(r, s.path);
|
|
400
|
+
b(r, s.path, I(_, { _schemaObj: h, _isList: !0, _input: s }));
|
|
400
401
|
}
|
|
401
402
|
if (!((i = s.validation) != null && i.schema) && s.inputType === "array") {
|
|
402
403
|
const h = {};
|
|
403
|
-
|
|
404
|
+
w(
|
|
404
405
|
h,
|
|
405
406
|
[{ ...s.inputConfig.input, path: "___array" }],
|
|
406
407
|
n,
|
|
407
408
|
t
|
|
408
|
-
),
|
|
409
|
+
), b(
|
|
409
410
|
r,
|
|
410
411
|
s.path,
|
|
411
|
-
|
|
412
|
+
I(l, {
|
|
412
413
|
_schemaObj: h,
|
|
413
414
|
_schema: (d = s.validation) == null ? void 0 : d.schema,
|
|
414
415
|
_isArrayItem: !0,
|
|
@@ -421,7 +422,7 @@ function C(r, e, n, t, a) {
|
|
|
421
422
|
}
|
|
422
423
|
function F(r, e) {
|
|
423
424
|
var n, t, a;
|
|
424
|
-
return ((t = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredMessagePerInput) == null ? void 0 : t[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ??
|
|
425
|
+
return ((t = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredMessagePerInput) == null ? void 0 : t[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ?? be;
|
|
425
426
|
}
|
|
426
427
|
function A(r, e) {
|
|
427
428
|
var t, a, s, o, u, c;
|
|
@@ -434,19 +435,19 @@ function A(r, e) {
|
|
|
434
435
|
typeof f == "object" && T(f) && i.addIssue({
|
|
435
436
|
code: m.ZodIssueCode.custom,
|
|
436
437
|
message: n
|
|
437
|
-
}), (
|
|
438
|
+
}), (q(f) || f === "") && i.addIssue({
|
|
438
439
|
code: m.ZodIssueCode.custom,
|
|
439
440
|
message: n
|
|
440
441
|
});
|
|
441
442
|
});
|
|
442
443
|
}
|
|
443
|
-
function
|
|
444
|
+
function G(r, e) {
|
|
444
445
|
if (r instanceof m.ZodType)
|
|
445
446
|
return r;
|
|
446
447
|
if (typeof r == "function")
|
|
447
448
|
return r(e);
|
|
448
449
|
}
|
|
449
|
-
const
|
|
450
|
+
const Se = (r) => Array.isArray(r == null ? void 0 : r.errors), Ee = (r, e) => {
|
|
450
451
|
const n = {};
|
|
451
452
|
for (; r.length; ) {
|
|
452
453
|
const t = r[0], { code: a, message: s, path: o } = t, u = o.join(".");
|
|
@@ -462,7 +463,7 @@ const ve = (r) => Array.isArray(r == null ? void 0 : r.errors), Se = (r, e) => {
|
|
|
462
463
|
"unionErrors" in t && t.unionErrors.forEach((c) => c.errors.forEach((f) => r.push(f)));
|
|
463
464
|
{
|
|
464
465
|
const c = n[u].types, f = c && c[t.code];
|
|
465
|
-
n[u] =
|
|
466
|
+
n[u] = fe(
|
|
466
467
|
u,
|
|
467
468
|
e,
|
|
468
469
|
n,
|
|
@@ -474,20 +475,20 @@ const ve = (r) => Array.isArray(r == null ? void 0 : r.errors), Se = (r, e) => {
|
|
|
474
475
|
}
|
|
475
476
|
return n;
|
|
476
477
|
};
|
|
477
|
-
function
|
|
478
|
-
return
|
|
478
|
+
function Ae(r, e) {
|
|
479
|
+
return ae(
|
|
479
480
|
async (n, t, a) => {
|
|
480
481
|
try {
|
|
481
|
-
return await
|
|
482
|
+
return await ve(r, n, e).parseAsync(n), {
|
|
482
483
|
values: n,
|
|
483
484
|
// TODO: check this - values does not contains all data
|
|
484
485
|
errors: {}
|
|
485
486
|
};
|
|
486
487
|
} catch (s) {
|
|
487
|
-
if (
|
|
488
|
+
if (Se(s))
|
|
488
489
|
return {
|
|
489
490
|
values: {},
|
|
490
|
-
errors:
|
|
491
|
+
errors: de(Ee(s.errors, !0), a)
|
|
491
492
|
};
|
|
492
493
|
throw s;
|
|
493
494
|
}
|
|
@@ -495,26 +496,26 @@ function Fe(r, e) {
|
|
|
495
496
|
[r]
|
|
496
497
|
);
|
|
497
498
|
}
|
|
498
|
-
function
|
|
499
|
-
const n =
|
|
499
|
+
function De(r, e) {
|
|
500
|
+
const n = C(r);
|
|
500
501
|
return e.forEach((t) => {
|
|
501
502
|
if (t.inputTransform) {
|
|
502
503
|
const a = E(t.inputTransform) ? t.inputTransform : [t.inputTransform], s = g(n, t.path);
|
|
503
504
|
a.forEach((o) => {
|
|
504
505
|
const u = o(s, n);
|
|
505
|
-
u &&
|
|
506
|
+
u && b(n, u.path ?? t.path, u.value);
|
|
506
507
|
});
|
|
507
508
|
}
|
|
508
509
|
}), n;
|
|
509
510
|
}
|
|
510
|
-
function
|
|
511
|
-
const n =
|
|
511
|
+
function Ze(r, e) {
|
|
512
|
+
const n = C(r);
|
|
512
513
|
return e.forEach((t) => {
|
|
513
514
|
if (t.outputTransform) {
|
|
514
515
|
const a = E(t.outputTransform) ? t.outputTransform : [t.outputTransform], s = g(n, t.path);
|
|
515
516
|
a.forEach((o) => {
|
|
516
517
|
const u = o(s, n);
|
|
517
|
-
u &&
|
|
518
|
+
u && b(n, u.path ?? t.path, u.value);
|
|
518
519
|
});
|
|
519
520
|
}
|
|
520
521
|
}), n;
|
|
@@ -522,24 +523,24 @@ function De(r, e) {
|
|
|
522
523
|
function D(r) {
|
|
523
524
|
return r.reduce((n, t) => t.inputType === "group" && t.inputs ? [...n, t, ...D(t.inputs)] : [...n, t], []);
|
|
524
525
|
}
|
|
525
|
-
function
|
|
526
|
+
function $e(r) {
|
|
526
527
|
const n = D(r.inputs).reduce((t, a) => {
|
|
527
528
|
const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
|
|
528
529
|
return (a.inputTransform || a.outputTransform) && t.push({
|
|
529
|
-
...
|
|
530
|
+
...X(a, "path", "inputTransform", "outputTransform"),
|
|
530
531
|
level: a.path.split(".").length,
|
|
531
532
|
isPrimitive: s
|
|
532
533
|
}), t;
|
|
533
534
|
}, []);
|
|
534
535
|
return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
|
|
535
536
|
}
|
|
536
|
-
function
|
|
537
|
-
const t = D(r.inputs), a =
|
|
537
|
+
function Me(r, e, n) {
|
|
538
|
+
const t = D(r.inputs), a = C(e);
|
|
538
539
|
return t.forEach((s) => {
|
|
539
|
-
s.isVisible && !s.isVisible(e, n) &&
|
|
540
|
+
s.isVisible && !s.isVisible(e, n) && z(a, s.path);
|
|
540
541
|
}), a;
|
|
541
542
|
}
|
|
542
|
-
function
|
|
543
|
+
function Be() {
|
|
543
544
|
return function(r, e) {
|
|
544
545
|
if (!(typeof r > "u"))
|
|
545
546
|
return r ? {
|
|
@@ -547,7 +548,7 @@ function Me() {
|
|
|
547
548
|
} : { value: r };
|
|
548
549
|
};
|
|
549
550
|
}
|
|
550
|
-
function
|
|
551
|
+
function Je(r) {
|
|
551
552
|
return function(e, n) {
|
|
552
553
|
if (typeof e > "u") return;
|
|
553
554
|
if (!e) return { value: e };
|
|
@@ -557,18 +558,19 @@ function Be(r) {
|
|
|
557
558
|
return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
|
|
558
559
|
};
|
|
559
560
|
}
|
|
560
|
-
function
|
|
561
|
+
function Le() {
|
|
561
562
|
return function(r, e) {
|
|
562
563
|
if (!(typeof r > "u"))
|
|
563
564
|
return E(r) && T(r) ? { value: void 0 } : { value: r };
|
|
564
565
|
};
|
|
565
566
|
}
|
|
566
|
-
function
|
|
567
|
+
function Ue(r) {
|
|
567
568
|
return function(e, n) {
|
|
568
569
|
const t = r ? g(n, r) : e;
|
|
569
570
|
if (!(typeof t > "u")) {
|
|
571
|
+
if (U(t)) return { value: void 0, path: r };
|
|
570
572
|
if (L(t)) {
|
|
571
|
-
const a =
|
|
573
|
+
const a = W(t, ee);
|
|
572
574
|
if (T(a))
|
|
573
575
|
return { value: void 0, path: r };
|
|
574
576
|
}
|
|
@@ -576,39 +578,39 @@ function Le(r) {
|
|
|
576
578
|
}
|
|
577
579
|
};
|
|
578
580
|
}
|
|
579
|
-
function
|
|
581
|
+
function We() {
|
|
580
582
|
return function(r, e) {
|
|
581
583
|
if (!(typeof r > "u"))
|
|
582
|
-
return
|
|
584
|
+
return re(r) && T(r) ? { value: void 0 } : { value: r };
|
|
583
585
|
};
|
|
584
586
|
}
|
|
585
|
-
function
|
|
587
|
+
function Ge(r) {
|
|
586
588
|
return function(e, n) {
|
|
587
589
|
const t = g(n, r);
|
|
588
590
|
return typeof t == "string" ? { value: t } : { value: e };
|
|
589
591
|
};
|
|
590
592
|
}
|
|
591
|
-
function
|
|
593
|
+
function He(r) {
|
|
592
594
|
return function(e, n) {
|
|
593
595
|
if (typeof e > "u") return;
|
|
594
596
|
if (!e) return { value: e };
|
|
595
597
|
const t = g(n, r);
|
|
596
598
|
if (typeof t == "object") {
|
|
597
|
-
const a =
|
|
599
|
+
const a = Oe(t);
|
|
598
600
|
if (Object.getOwnPropertyNames(a).length === 1)
|
|
599
601
|
return { value: e, path: r };
|
|
600
602
|
}
|
|
601
603
|
return { value: e };
|
|
602
604
|
};
|
|
603
605
|
}
|
|
604
|
-
function
|
|
606
|
+
function Qe(r) {
|
|
605
607
|
return function(e, n) {
|
|
606
608
|
if (typeof e > "u") return;
|
|
607
609
|
const t = g(n, r);
|
|
608
610
|
return typeof t == "string" ? { value: [t] } : { value: e };
|
|
609
611
|
};
|
|
610
612
|
}
|
|
611
|
-
function
|
|
613
|
+
function Ye(r, e) {
|
|
612
614
|
return function(n, t) {
|
|
613
615
|
if (typeof n > "u") return;
|
|
614
616
|
if (!n) return { value: n };
|
|
@@ -622,66 +624,66 @@ function Qe(r, e) {
|
|
|
622
624
|
return { value: n };
|
|
623
625
|
};
|
|
624
626
|
}
|
|
625
|
-
function
|
|
626
|
-
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !
|
|
627
|
+
function H(r) {
|
|
628
|
+
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !H(r[e])) : q(r);
|
|
627
629
|
}
|
|
628
|
-
function
|
|
629
|
-
return
|
|
630
|
+
function Oe(r) {
|
|
631
|
+
return W(r, (e) => typeof e == "object" ? H(e) : q(e));
|
|
630
632
|
}
|
|
631
|
-
function
|
|
633
|
+
function Re({ input: r, factory: e }) {
|
|
632
634
|
const { prefix: n = "" } = {};
|
|
633
|
-
return /* @__PURE__ */ y.jsx("div", { children: /* @__PURE__ */ y.jsx(
|
|
635
|
+
return /* @__PURE__ */ y.jsx("div", { children: /* @__PURE__ */ y.jsx(ge, { path: `${n}${r.path}`, factory: e, readonly: !1, input: r }) });
|
|
634
636
|
}
|
|
635
|
-
function
|
|
637
|
+
function Te(r) {
|
|
636
638
|
const { items: e, factory: n } = r;
|
|
637
639
|
return /* @__PURE__ */ y.jsx(y.Fragment, { children: e.map((t) => {
|
|
638
640
|
const a = `${t.inputType}_${t.path}_${t.label}`;
|
|
639
|
-
return /* @__PURE__ */ y.jsx(
|
|
641
|
+
return /* @__PURE__ */ y.jsx(Re, { input: t, factory: n }, a);
|
|
640
642
|
}) });
|
|
641
643
|
}
|
|
642
|
-
const
|
|
644
|
+
const je = ue((r, e) => {
|
|
643
645
|
const { inputs: n, className: t, factory: a } = r;
|
|
644
646
|
return /* @__PURE__ */ y.jsxs("div", { className: t, ref: e, children: [
|
|
645
647
|
n.hero,
|
|
646
|
-
/* @__PURE__ */ y.jsx(
|
|
648
|
+
/* @__PURE__ */ y.jsx(Te, { items: n.inputs, factory: a })
|
|
647
649
|
] });
|
|
648
650
|
});
|
|
649
|
-
|
|
650
|
-
function
|
|
651
|
+
je.displayName = "RenderForm";
|
|
652
|
+
function Ke(r) {
|
|
651
653
|
let e = !0;
|
|
652
|
-
return
|
|
653
|
-
e = e && (n === "" ||
|
|
654
|
+
return te(r, (n) => {
|
|
655
|
+
e = e && (n === "" || U(n) || q(n));
|
|
654
656
|
}), e;
|
|
655
657
|
}
|
|
656
|
-
const
|
|
658
|
+
const Xe = (r = "") => ne(r.split("_").join(" "));
|
|
657
659
|
export {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
660
|
+
Pe as InputComponent,
|
|
661
|
+
ge as InputComponentRenderer,
|
|
662
|
+
xe as InputFactory,
|
|
663
|
+
le as InputOverrideError,
|
|
664
|
+
je as RenderForm,
|
|
665
|
+
Te as RenderInputs,
|
|
666
|
+
Ne as RootForm,
|
|
667
|
+
Re as Row,
|
|
668
|
+
Je as arrayToObjectOutputTransformer,
|
|
669
|
+
Xe as generateReadableLabel,
|
|
670
|
+
ke as getDefaultValuesFromFormDefinition,
|
|
671
|
+
$e as getTransformers,
|
|
672
|
+
ve as getValidationSchema,
|
|
673
|
+
De as inputTransformValues,
|
|
674
|
+
Ke as isChildrenEmpty,
|
|
675
|
+
Be as objectToArrayInputTransformer,
|
|
676
|
+
Ze as outputTransformValues,
|
|
677
|
+
Fe as overrideFormDefinition,
|
|
676
678
|
R as processValidationParseResponse,
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
679
|
+
Qe as shorthandArrayInputTransformer,
|
|
680
|
+
Ye as shorthandArrayOutputTransformer,
|
|
681
|
+
Ge as shorthandObjectInputTransformer,
|
|
682
|
+
He as shorthandObjectOutputTransformer,
|
|
683
|
+
Le as unsetEmptyArrayOutputTransformer,
|
|
684
|
+
Ue as unsetEmptyObjectOutputTransformer,
|
|
685
|
+
We as unsetEmptyStringOutputTransformer,
|
|
686
|
+
Me as unsetHiddenInputsValues,
|
|
687
|
+
Ae as useZodValidationResolver
|
|
686
688
|
};
|
|
687
689
|
//# sourceMappingURL=index.js.map
|