@harnessio/forms 0.0.12 → 0.0.14
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/form/RenderForm/RenderForm.d.ts +1 -0
- package/dist/form/RenderInputs/RenderInputs.d.ts +1 -0
- package/dist/form/Row/Row.d.ts +2 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +135 -132
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { isEmpty as R, cloneDeep as C, set as g, get as b, forOwn as
|
|
5
|
-
import
|
|
6
|
-
import { useFormContext as
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var te = (r, e, n) => e in r ? re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var x = (r, e, n) => te(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { isEmpty as R, cloneDeep as C, set as g, get as b, forOwn as U, isArray as O, isObject as G, merge as I, isUndefined as q, pick as ne, unset as se, isNull as H, omitBy as Q, isNil as ae, isString as ue, capitalize as ie } from "lodash-es";
|
|
5
|
+
import oe, { useMemo as D, useRef as P, useEffect as S, useCallback as ce, forwardRef as fe, Fragment as le } from "react";
|
|
6
|
+
import { useFormContext as de, useForm as me, FormProvider as he, appendErrors as pe } 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 ye } from "@hookform/resolvers";
|
|
10
|
+
class ge extends Error {
|
|
11
11
|
constructor(e) {
|
|
12
12
|
super(`Input component '${e}' is already registered.`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
class
|
|
15
|
+
class X {
|
|
16
16
|
constructor(e) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
x(this, "componentBank");
|
|
18
|
+
x(this, "allowOverride");
|
|
19
19
|
this.allowOverride = (e == null ? void 0 : e.allowOverride) ?? !1, this.componentBank = /* @__PURE__ */ new Map();
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
@@ -26,7 +26,7 @@ class H {
|
|
|
26
26
|
*/
|
|
27
27
|
registerComponent(e) {
|
|
28
28
|
if (!this.allowOverride && this.getComponent(e.internalType))
|
|
29
|
-
throw new
|
|
29
|
+
throw new ge(e.internalType);
|
|
30
30
|
this.componentBank.set(e.internalType, e);
|
|
31
31
|
}
|
|
32
32
|
getComponent(e) {
|
|
@@ -47,7 +47,7 @@ class H {
|
|
|
47
47
|
* @returns new input factory
|
|
48
48
|
*/
|
|
49
49
|
clone() {
|
|
50
|
-
const e = new
|
|
50
|
+
const e = new X({
|
|
51
51
|
allowOverride: this.allowOverride
|
|
52
52
|
});
|
|
53
53
|
return this.listRegisteredComponents().forEach((n) => {
|
|
@@ -61,10 +61,10 @@ object-assign
|
|
|
61
61
|
(c) Sindre Sorhus
|
|
62
62
|
@license MIT
|
|
63
63
|
*/
|
|
64
|
-
var k,
|
|
65
|
-
function
|
|
66
|
-
if (
|
|
67
|
-
|
|
64
|
+
var k, Z;
|
|
65
|
+
function be() {
|
|
66
|
+
if (Z) return k;
|
|
67
|
+
Z = 1;
|
|
68
68
|
var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
|
|
69
69
|
function t(s) {
|
|
70
70
|
if (s == null)
|
|
@@ -116,10 +116,10 @@ function pe() {
|
|
|
116
116
|
* LICENSE file in the root directory of this source tree.
|
|
117
117
|
*/
|
|
118
118
|
var M;
|
|
119
|
-
function
|
|
119
|
+
function ve() {
|
|
120
120
|
if (M) return E;
|
|
121
|
-
M = 1,
|
|
122
|
-
var r =
|
|
121
|
+
M = 1, be();
|
|
122
|
+
var r = oe, e = 60103;
|
|
123
123
|
if (E.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
|
|
124
124
|
var n = Symbol.for;
|
|
125
125
|
e = n("react.element"), E.Fragment = n("react.fragment");
|
|
@@ -135,11 +135,11 @@ function ye() {
|
|
|
135
135
|
return E.jsx = i, E.jsxs = i, E;
|
|
136
136
|
}
|
|
137
137
|
var B;
|
|
138
|
-
function
|
|
139
|
-
return B || (B = 1, A.exports =
|
|
138
|
+
function _e() {
|
|
139
|
+
return B || (B = 1, A.exports = ve()), A.exports;
|
|
140
140
|
}
|
|
141
|
-
var p =
|
|
142
|
-
function
|
|
141
|
+
var p = _e();
|
|
142
|
+
function J({
|
|
143
143
|
path: r,
|
|
144
144
|
factory: e,
|
|
145
145
|
onUpdate: n,
|
|
@@ -148,11 +148,11 @@ function be({
|
|
|
148
148
|
initialValues: s,
|
|
149
149
|
input: i
|
|
150
150
|
}) {
|
|
151
|
-
const { formState: u, watch: c } =
|
|
151
|
+
const { formState: u, watch: c } = de(), {
|
|
152
152
|
metadata: f = {},
|
|
153
153
|
fixedValues: o = {}
|
|
154
154
|
/*getValuesWithDependencies*/
|
|
155
|
-
} = {}, l = e == null ? void 0 : e.getComponent(i.inputType), d =
|
|
155
|
+
} = {}, l = e == null ? void 0 : e.getComponent(i.inputType), d = D(
|
|
156
156
|
() => ({
|
|
157
157
|
path: r,
|
|
158
158
|
initialValues: s,
|
|
@@ -165,10 +165,10 @@ function be({
|
|
|
165
165
|
[e, s, i, t, n, r, a, u.errors]
|
|
166
166
|
), h = c(), _ = C(h);
|
|
167
167
|
o && Object.keys(o).forEach((y) => {
|
|
168
|
-
const
|
|
169
|
-
g(_, y,
|
|
168
|
+
const ee = o[y];
|
|
169
|
+
g(_, y, ee);
|
|
170
170
|
});
|
|
171
|
-
const v = !i.isVisible || (i == null ? void 0 : i.isVisible(_, f)), j =
|
|
171
|
+
const v = !i.isVisible || (i == null ? void 0 : i.isVisible(_, f)), j = D(() => v ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
172
172
|
i.before ? i.before : null,
|
|
173
173
|
l == null ? void 0 : l.renderComponent(d),
|
|
174
174
|
i.after ? i.after : null
|
|
@@ -179,12 +179,12 @@ function be({
|
|
|
179
179
|
")"
|
|
180
180
|
] });
|
|
181
181
|
}
|
|
182
|
-
class
|
|
182
|
+
class ke {
|
|
183
183
|
getType() {
|
|
184
184
|
return this.internalType;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function Ne(r) {
|
|
188
188
|
const {
|
|
189
189
|
mode: e = "onSubmit",
|
|
190
190
|
resolver: n,
|
|
@@ -201,13 +201,13 @@ function ke(r) {
|
|
|
201
201
|
children: c,
|
|
202
202
|
// fixedValues
|
|
203
203
|
autoFocusPath: f
|
|
204
|
-
} = r, o =
|
|
204
|
+
} = r, o = me({
|
|
205
205
|
mode: e ?? "onSubmit",
|
|
206
206
|
reValidateMode: "onChange",
|
|
207
207
|
defaultValues: t,
|
|
208
208
|
shouldFocusError: a,
|
|
209
209
|
resolver: n
|
|
210
|
-
}), l =
|
|
210
|
+
}), l = P(!1);
|
|
211
211
|
S(() => {
|
|
212
212
|
o.reset(t, {});
|
|
213
213
|
}, [o.reset, t]), S(() => {
|
|
@@ -227,7 +227,7 @@ function ke(r) {
|
|
|
227
227
|
});
|
|
228
228
|
return () => cancelIdleCallback(y);
|
|
229
229
|
}, []);
|
|
230
|
-
const { getValues: d, handleSubmit: h } = o, _ = d(), v =
|
|
230
|
+
const { getValues: d, handleSubmit: h } = o, _ = d(), v = P(!0);
|
|
231
231
|
S(() => {
|
|
232
232
|
if (v.current) {
|
|
233
233
|
v.current = !1;
|
|
@@ -235,7 +235,7 @@ function ke(r) {
|
|
|
235
235
|
}
|
|
236
236
|
s == null || s({ ..._ }), l.current === !0 && o.trigger();
|
|
237
237
|
}, [JSON.stringify(_)]);
|
|
238
|
-
const j =
|
|
238
|
+
const j = P(!0);
|
|
239
239
|
return S(() => {
|
|
240
240
|
if (j.current) {
|
|
241
241
|
j.current = !1;
|
|
@@ -255,7 +255,7 @@ function ke(r) {
|
|
|
255
255
|
}, 100);
|
|
256
256
|
return () => clearTimeout(y);
|
|
257
257
|
}
|
|
258
|
-
}, [o]), /* @__PURE__ */ p.jsx(
|
|
258
|
+
}, [o]), /* @__PURE__ */ p.jsx(he, { ...o, children: typeof c == "function" ? c({
|
|
259
259
|
...o,
|
|
260
260
|
submitForm: async () => {
|
|
261
261
|
u && (l.current = !0, h((y) => {
|
|
@@ -264,7 +264,7 @@ function ke(r) {
|
|
|
264
264
|
}
|
|
265
265
|
}) : c });
|
|
266
266
|
}
|
|
267
|
-
const
|
|
267
|
+
const Fe = (r) => {
|
|
268
268
|
const e = {}, n = (t) => {
|
|
269
269
|
t.forEach((a) => {
|
|
270
270
|
const { path: s, default: i, inputType: u, inputs: c } = a;
|
|
@@ -273,24 +273,24 @@ const Ne = (r) => {
|
|
|
273
273
|
};
|
|
274
274
|
return Array.isArray(r.inputs) && n(r.inputs), e;
|
|
275
275
|
};
|
|
276
|
-
function
|
|
276
|
+
function $e(r, e) {
|
|
277
277
|
const n = r.inputs.map((t) => {
|
|
278
|
-
const a =
|
|
278
|
+
const a = Ee(e, t.path);
|
|
279
279
|
return a || t;
|
|
280
280
|
});
|
|
281
281
|
return { ...r, inputs: n };
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Ee(r, e) {
|
|
284
284
|
return r.inputs.find((n) => n.path === e);
|
|
285
285
|
}
|
|
286
|
-
const
|
|
286
|
+
const Y = "__temp_", De = (r) => Y + r.split(".").join("__");
|
|
287
287
|
function Ze(r) {
|
|
288
288
|
const e = { ...r };
|
|
289
|
-
return
|
|
290
|
-
t.startsWith(
|
|
289
|
+
return U(e, (n, t) => {
|
|
290
|
+
t.startsWith(Y) && delete e[t];
|
|
291
291
|
}), e;
|
|
292
292
|
}
|
|
293
|
-
const
|
|
293
|
+
const Oe = "Required field";
|
|
294
294
|
function T(r) {
|
|
295
295
|
const e = typeof r == "string" ? JSON.parse(r) : r;
|
|
296
296
|
if (typeof e == "string")
|
|
@@ -298,9 +298,9 @@ function T(r) {
|
|
|
298
298
|
if (O(e))
|
|
299
299
|
return T(e[0]);
|
|
300
300
|
const n = e;
|
|
301
|
-
return
|
|
301
|
+
return G(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function Se(r, e, n) {
|
|
304
304
|
let t = {};
|
|
305
305
|
if (w(t, r.inputs, e, n), n != null && n.prefix) {
|
|
306
306
|
const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
|
|
@@ -321,18 +321,18 @@ function V(r, e, n) {
|
|
|
321
321
|
/*...nestedSchemaObj*/
|
|
322
322
|
} = r[a];
|
|
323
323
|
if (c && i && u) {
|
|
324
|
-
const l = m.array(m.object(V(i, e, n))).optional(), d =
|
|
324
|
+
const l = m.array(m.object(V(i, e, n))).optional(), d = W(o, u, e, n, l);
|
|
325
325
|
t[a] = d;
|
|
326
326
|
} else if (f && u) {
|
|
327
|
-
const l = i != null && i.___array ? V({ ___array: i.___array }, e, n) : { ___array: m.any() }, d = m.array(l.___array).optional(), h =
|
|
327
|
+
const l = i != null && i.___array ? V({ ___array: i.___array }, e, n) : { ___array: m.any() }, d = m.array(l.___array).optional(), h = W(o, u, e, n, d);
|
|
328
328
|
t[a] = h;
|
|
329
329
|
} else if (o && u) {
|
|
330
|
-
const l =
|
|
330
|
+
const l = Te(o, u, e, n);
|
|
331
331
|
t[a] = l;
|
|
332
332
|
} else s && u ? t[a] = F(u, n) : t[a] = m.object(V(r[a], e, n)).optional();
|
|
333
333
|
}), t;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function Te(r, e, n, t) {
|
|
336
336
|
return m.any().optional().superRefine(async (a, s) => {
|
|
337
337
|
var u, c;
|
|
338
338
|
if (e.required && !(await F(e, t).safeParseAsync(a)).success)
|
|
@@ -350,7 +350,7 @@ function Oe(r, e, n, t) {
|
|
|
350
350
|
if (!f.continue)
|
|
351
351
|
return !0;
|
|
352
352
|
}
|
|
353
|
-
const i =
|
|
353
|
+
const i = K(r, n);
|
|
354
354
|
if (i) {
|
|
355
355
|
const f = await i.safeParseAsync(a);
|
|
356
356
|
if (!f.success) {
|
|
@@ -363,7 +363,7 @@ function Oe(r, e, n, t) {
|
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function W(r, e, n, t, a) {
|
|
367
367
|
return m.any().optional().superRefine(async (s, i) => {
|
|
368
368
|
var o, l;
|
|
369
369
|
const c = await F(e, t).safeParseAsync(s);
|
|
@@ -388,7 +388,7 @@ function J(r, e, n, t, a) {
|
|
|
388
388
|
code: m.ZodIssueCode.custom,
|
|
389
389
|
message: "'Value is not array'"
|
|
390
390
|
}), m.NEVER;
|
|
391
|
-
const f =
|
|
391
|
+
const f = K(r, n);
|
|
392
392
|
if (f) {
|
|
393
393
|
const d = await f.safeParseAsync(s);
|
|
394
394
|
if (!d.success)
|
|
@@ -449,7 +449,7 @@ function w(r, e, n, t, a) {
|
|
|
449
449
|
}
|
|
450
450
|
function N(r, e) {
|
|
451
451
|
var n, t, a;
|
|
452
|
-
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) ??
|
|
452
|
+
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) ?? Oe;
|
|
453
453
|
}
|
|
454
454
|
function F(r, e) {
|
|
455
455
|
var t, a, s, i, u, c;
|
|
@@ -468,13 +468,13 @@ function F(r, e) {
|
|
|
468
468
|
});
|
|
469
469
|
});
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function K(r, e) {
|
|
472
472
|
if (r instanceof m.ZodType)
|
|
473
473
|
return r;
|
|
474
474
|
if (typeof r == "function")
|
|
475
475
|
return r(e);
|
|
476
476
|
}
|
|
477
|
-
const
|
|
477
|
+
const Re = (r) => Array.isArray(r == null ? void 0 : r.errors), je = (r, e) => {
|
|
478
478
|
const n = {};
|
|
479
479
|
for (; r.length; ) {
|
|
480
480
|
const t = r[0], { code: a, message: s, path: i } = t, u = i.join(".");
|
|
@@ -490,7 +490,7 @@ const Se = (r) => Array.isArray(r == null ? void 0 : r.errors), Te = (r, e) => {
|
|
|
490
490
|
"unionErrors" in t && t.unionErrors.forEach((c) => c.errors.forEach((f) => r.push(f)));
|
|
491
491
|
{
|
|
492
492
|
const c = n[u].types, f = c && c[t.code];
|
|
493
|
-
n[u] =
|
|
493
|
+
n[u] = pe(
|
|
494
494
|
u,
|
|
495
495
|
e,
|
|
496
496
|
n,
|
|
@@ -502,20 +502,20 @@ const Se = (r) => Array.isArray(r == null ? void 0 : r.errors), Te = (r, e) => {
|
|
|
502
502
|
}
|
|
503
503
|
return n;
|
|
504
504
|
};
|
|
505
|
-
function
|
|
506
|
-
return
|
|
505
|
+
function Me(r, e) {
|
|
506
|
+
return ce(
|
|
507
507
|
async (n, t, a) => {
|
|
508
508
|
try {
|
|
509
|
-
return await
|
|
509
|
+
return await Se(r, n, e).parseAsync(n), {
|
|
510
510
|
values: n,
|
|
511
511
|
// TODO: check this - values does not contains all data
|
|
512
512
|
errors: {}
|
|
513
513
|
};
|
|
514
514
|
} catch (s) {
|
|
515
|
-
if (
|
|
515
|
+
if (Re(s))
|
|
516
516
|
return {
|
|
517
517
|
values: {},
|
|
518
|
-
errors:
|
|
518
|
+
errors: ye(je(s.errors, !0), a)
|
|
519
519
|
};
|
|
520
520
|
throw s;
|
|
521
521
|
}
|
|
@@ -523,7 +523,7 @@ function $e(r, e) {
|
|
|
523
523
|
[r]
|
|
524
524
|
);
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function Be(r, e) {
|
|
527
527
|
const n = C(r);
|
|
528
528
|
return e.forEach((t) => {
|
|
529
529
|
t.inputTransform && (O(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
|
|
@@ -532,7 +532,7 @@ function Me(r, e) {
|
|
|
532
532
|
});
|
|
533
533
|
}), n;
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function Je(r, e) {
|
|
536
536
|
const n = C(r);
|
|
537
537
|
return e.forEach((t) => {
|
|
538
538
|
t.outputTransform && (O(t.outputTransform) ? t.outputTransform : [t.outputTransform]).forEach((s) => {
|
|
@@ -541,14 +541,14 @@ function Be(r, e) {
|
|
|
541
541
|
});
|
|
542
542
|
}), n;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t,
|
|
544
|
+
function $(r) {
|
|
545
|
+
return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...$(t.inputs)] : [...n, t], []);
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
const n =
|
|
547
|
+
function We(r) {
|
|
548
|
+
const n = $(r.inputs).reduce((t, a) => {
|
|
549
549
|
const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
|
|
550
550
|
return (a.inputTransform || a.outputTransform) && t.push({
|
|
551
|
-
...
|
|
551
|
+
...ne(a, "path", "inputTransform", "outputTransform"),
|
|
552
552
|
level: a.path.split(".").length,
|
|
553
553
|
isPrimitive: s
|
|
554
554
|
}), t;
|
|
@@ -556,9 +556,9 @@ function Je(r) {
|
|
|
556
556
|
return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
|
|
557
557
|
}
|
|
558
558
|
function Le(r, e, n) {
|
|
559
|
-
const t =
|
|
559
|
+
const t = $(r.inputs), a = C(e);
|
|
560
560
|
return t.forEach((s) => {
|
|
561
|
-
s.isVisible && !s.isVisible(e, n) &&
|
|
561
|
+
s.isVisible && !s.isVisible(e, n) && se(a, s.path);
|
|
562
562
|
}), a;
|
|
563
563
|
}
|
|
564
564
|
function Ue(r) {
|
|
@@ -570,7 +570,7 @@ function Ue(r) {
|
|
|
570
570
|
};
|
|
571
571
|
return Array.isArray(r.inputs) && n(r.inputs), e;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Ge() {
|
|
574
574
|
return function(r, e) {
|
|
575
575
|
if (!(typeof r > "u"))
|
|
576
576
|
return r ? {
|
|
@@ -578,7 +578,7 @@ function We() {
|
|
|
578
578
|
} : { value: r };
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function He(r) {
|
|
582
582
|
return function(e, n) {
|
|
583
583
|
if (typeof e > "u") return;
|
|
584
584
|
if (!e) return { value: e };
|
|
@@ -588,19 +588,19 @@ function Ge(r) {
|
|
|
588
588
|
return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function Qe() {
|
|
592
592
|
return function(r, e) {
|
|
593
593
|
if (!(typeof r > "u"))
|
|
594
594
|
return O(r) && R(r) ? { value: void 0 } : { value: r };
|
|
595
595
|
};
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function Xe(r) {
|
|
598
598
|
return function(e, n) {
|
|
599
599
|
const t = r ? b(n, r) : e;
|
|
600
600
|
if (!(typeof t > "u")) {
|
|
601
|
-
if (
|
|
602
|
-
if (
|
|
603
|
-
const a =
|
|
601
|
+
if (H(t)) return { value: void 0, path: r };
|
|
602
|
+
if (G(t)) {
|
|
603
|
+
const a = Q(t, ae);
|
|
604
604
|
if (R(a))
|
|
605
605
|
return { value: void 0, path: r };
|
|
606
606
|
}
|
|
@@ -608,39 +608,39 @@ function Qe(r) {
|
|
|
608
608
|
}
|
|
609
609
|
};
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function Ye() {
|
|
612
612
|
return function(r, e) {
|
|
613
613
|
if (!(typeof r > "u"))
|
|
614
|
-
return
|
|
614
|
+
return ue(r) && R(r) ? { value: void 0 } : { value: r };
|
|
615
615
|
};
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function Ke(r) {
|
|
618
618
|
return function(e, n) {
|
|
619
619
|
const t = b(n, r);
|
|
620
620
|
return typeof t == "string" ? { value: t } : { value: e };
|
|
621
621
|
};
|
|
622
622
|
}
|
|
623
|
-
function
|
|
623
|
+
function ze(r) {
|
|
624
624
|
return function(e, n) {
|
|
625
625
|
if (typeof e > "u") return;
|
|
626
626
|
if (!e) return { value: e };
|
|
627
627
|
const t = b(n, r);
|
|
628
628
|
if (typeof t == "object") {
|
|
629
|
-
const a =
|
|
629
|
+
const a = Ie(t);
|
|
630
630
|
if (Object.getOwnPropertyNames(a).length === 1)
|
|
631
631
|
return { value: e, path: r };
|
|
632
632
|
}
|
|
633
633
|
return { value: e };
|
|
634
634
|
};
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function er(r) {
|
|
637
637
|
return function(e, n) {
|
|
638
638
|
if (typeof e > "u") return;
|
|
639
639
|
const t = b(n, r);
|
|
640
640
|
return typeof t == "string" ? { value: [t] } : { value: e };
|
|
641
641
|
};
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function rr(r, e) {
|
|
644
644
|
return function(n, t) {
|
|
645
645
|
if (typeof n > "u") return;
|
|
646
646
|
if (!n) return { value: n };
|
|
@@ -654,69 +654,72 @@ function er(r, e) {
|
|
|
654
654
|
return { value: n };
|
|
655
655
|
};
|
|
656
656
|
}
|
|
657
|
-
function
|
|
658
|
-
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !
|
|
657
|
+
function z(r) {
|
|
658
|
+
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !z(r[e])) : q(r);
|
|
659
659
|
}
|
|
660
|
-
function
|
|
661
|
-
return
|
|
660
|
+
function Ie(r) {
|
|
661
|
+
return Q(r, (e) => typeof e == "object" ? z(e) : q(e));
|
|
662
662
|
}
|
|
663
|
-
function
|
|
664
|
-
const { prefix:
|
|
665
|
-
return /* @__PURE__ */ p.jsx("div", { children: /* @__PURE__ */ p.jsx(
|
|
663
|
+
function Ve({ input: r, factory: e, withoutWrapper: n = !1 }) {
|
|
664
|
+
const { prefix: t = "" } = {};
|
|
665
|
+
return n ? /* @__PURE__ */ p.jsx(J, { path: `${t}${r.path}`, factory: e, readonly: !1, input: r }) : /* @__PURE__ */ p.jsx("div", { children: /* @__PURE__ */ p.jsx(J, { path: `${t}${r.path}`, factory: e, readonly: !1, input: r }) });
|
|
666
666
|
}
|
|
667
|
-
function
|
|
668
|
-
const { items: e, factory: n } = r;
|
|
669
|
-
return /* @__PURE__ */ p.jsx(p.Fragment, { children: e.map((
|
|
670
|
-
const
|
|
671
|
-
return /* @__PURE__ */ p.jsx(
|
|
667
|
+
function L(r) {
|
|
668
|
+
const { items: e, factory: n, withoutWrapper: t } = r;
|
|
669
|
+
return /* @__PURE__ */ p.jsx(p.Fragment, { children: e.map((a) => {
|
|
670
|
+
const s = `${a.inputType}_${a.path}_${a.label}`;
|
|
671
|
+
return /* @__PURE__ */ p.jsx(Ve, { input: a, factory: n, withoutWrapper: t }, s);
|
|
672
672
|
}) });
|
|
673
673
|
}
|
|
674
|
-
const
|
|
675
|
-
const { inputs: n, className: t, factory: a } = r;
|
|
676
|
-
return /* @__PURE__ */ p.jsxs(
|
|
674
|
+
const we = fe((r, e) => {
|
|
675
|
+
const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
|
|
676
|
+
return s ? /* @__PURE__ */ p.jsxs(le, { children: [
|
|
677
|
+
n.hero,
|
|
678
|
+
/* @__PURE__ */ p.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
|
|
679
|
+
] }) : /* @__PURE__ */ p.jsxs("div", { className: t, ref: e, children: [
|
|
677
680
|
n.hero,
|
|
678
|
-
/* @__PURE__ */ p.jsx(
|
|
681
|
+
/* @__PURE__ */ p.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
|
|
679
682
|
] });
|
|
680
683
|
});
|
|
681
|
-
|
|
682
|
-
function
|
|
684
|
+
we.displayName = "RenderForm";
|
|
685
|
+
function tr(r) {
|
|
683
686
|
let e = !0;
|
|
684
|
-
return
|
|
685
|
-
e = e && (n === "" ||
|
|
687
|
+
return U(r, (n) => {
|
|
688
|
+
e = e && (n === "" || H(n) || q(n));
|
|
686
689
|
}), e;
|
|
687
690
|
}
|
|
688
|
-
const
|
|
691
|
+
const nr = (r = "") => ie(r.split("_").join(" "));
|
|
689
692
|
export {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
693
|
+
ke as InputComponent,
|
|
694
|
+
J as InputComponentRenderer,
|
|
695
|
+
X as InputFactory,
|
|
696
|
+
ge as InputOverrideError,
|
|
697
|
+
we as RenderForm,
|
|
698
|
+
L as RenderInputs,
|
|
699
|
+
Ne as RootForm,
|
|
700
|
+
Ve as Row,
|
|
701
|
+
He as arrayToObjectOutputTransformer,
|
|
699
702
|
Ue as collectDefaultValues,
|
|
700
|
-
|
|
701
|
-
|
|
703
|
+
nr as generateReadableLabel,
|
|
704
|
+
Fe as getDefaultValuesFromFormDefinition,
|
|
702
705
|
De as getTemporaryPath,
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
706
|
+
We as getTransformers,
|
|
707
|
+
Se as getValidationSchema,
|
|
708
|
+
Be as inputTransformValues,
|
|
709
|
+
tr as isChildrenEmpty,
|
|
710
|
+
Ge as objectToArrayInputTransformer,
|
|
711
|
+
Je as outputTransformValues,
|
|
712
|
+
$e as overrideFormDefinition,
|
|
710
713
|
T as processValidationParseResponse,
|
|
711
714
|
Ze as removeTemporaryFieldsValue,
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
715
|
+
er as shorthandArrayInputTransformer,
|
|
716
|
+
rr as shorthandArrayOutputTransformer,
|
|
717
|
+
Ke as shorthandObjectInputTransformer,
|
|
718
|
+
ze as shorthandObjectOutputTransformer,
|
|
719
|
+
Qe as unsetEmptyArrayOutputTransformer,
|
|
720
|
+
Xe as unsetEmptyObjectOutputTransformer,
|
|
721
|
+
Ye as unsetEmptyStringOutputTransformer,
|
|
719
722
|
Le as unsetHiddenInputsValues,
|
|
720
|
-
|
|
723
|
+
Me as useZodValidationResolver
|
|
721
724
|
};
|
|
722
725
|
//# sourceMappingURL=index.js.map
|