@harnessio/forms 0.1.6-beta.2 → 0.3.0-beta.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/core/components/InputComponent.d.ts +4 -2
- package/dist/core/components/InputComponentRenderer.d.ts +4 -2
- package/dist/core/components/RootForm.d.ts +4 -0
- package/dist/core/context/RootFormContext.d.ts +3 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +363 -348
- package/dist/index.js.map +1 -1
- package/dist/types/types.d.ts +11 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { isEmpty as
|
|
5
|
-
import
|
|
6
|
-
import { useFormContext as
|
|
1
|
+
var he = Object.defineProperty;
|
|
2
|
+
var pe = (r, e, n) => e in r ? he(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var N = (r, e, n) => pe(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { isEmpty as C, cloneDeep as q, set as g, get as b, forOwn as te, isArray as S, isObject as ne, merge as V, isUndefined as F, pick as ye, unset as ge, isNull as se, omitBy as ae, isNil as be, isString as ve, capitalize as _e } from "lodash-es";
|
|
5
|
+
import Re, { createContext as Ee, useContext as Te, useMemo as D, useRef as M, useEffect as j, useCallback as Oe, forwardRef as Se, Fragment as je } from "react";
|
|
6
|
+
import { useFormContext as Ie, get as Ce, useForm as we, FormProvider as Ve, appendErrors as xe, useController as Pe } from "react-hook-form";
|
|
7
7
|
export * from "react-hook-form";
|
|
8
|
-
import * as
|
|
9
|
-
import { toNestErrors as
|
|
10
|
-
class
|
|
8
|
+
import * as d from "zod";
|
|
9
|
+
import { toNestErrors as qe } from "@hookform/resolvers";
|
|
10
|
+
class Fe extends Error {
|
|
11
11
|
constructor(e) {
|
|
12
12
|
super(`Input component '${e}' is already registered.`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
class
|
|
15
|
+
class oe {
|
|
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
|
/**
|
|
@@ -26,11 +26,11 @@ class Y {
|
|
|
26
26
|
*/
|
|
27
27
|
registerComponent(e) {
|
|
28
28
|
if (!this.allowOverride && this.getComponent(e.internalType))
|
|
29
|
-
throw new
|
|
29
|
+
throw new Fe(e.internalType);
|
|
30
30
|
this.componentBank.set(e.internalType, e);
|
|
31
31
|
}
|
|
32
32
|
getComponent(e) {
|
|
33
|
-
if (e && !
|
|
33
|
+
if (e && !C(e))
|
|
34
34
|
return this.componentBank.get(e);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -47,7 +47,7 @@ class Y {
|
|
|
47
47
|
* @returns new input factory
|
|
48
48
|
*/
|
|
49
49
|
clone() {
|
|
50
|
-
const e = new
|
|
50
|
+
const e = new oe({
|
|
51
51
|
allowOverride: this.allowOverride
|
|
52
52
|
});
|
|
53
53
|
return this.listRegisteredComponents().forEach((n) => {
|
|
@@ -55,16 +55,16 @@ class Y {
|
|
|
55
55
|
}), e;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
var
|
|
58
|
+
var Z = { exports: {} }, O = {};
|
|
59
59
|
/*
|
|
60
60
|
object-assign
|
|
61
61
|
(c) Sindre Sorhus
|
|
62
62
|
@license MIT
|
|
63
63
|
*/
|
|
64
|
-
var
|
|
65
|
-
function
|
|
66
|
-
if (
|
|
67
|
-
|
|
64
|
+
var B, X;
|
|
65
|
+
function Ae() {
|
|
66
|
+
if (X) return B;
|
|
67
|
+
X = 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)
|
|
@@ -78,34 +78,34 @@ function Oe() {
|
|
|
78
78
|
var s = new String("abc");
|
|
79
79
|
if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5")
|
|
80
80
|
return !1;
|
|
81
|
-
for (var
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
return
|
|
81
|
+
for (var i = {}, o = 0; o < 10; o++)
|
|
82
|
+
i["_" + String.fromCharCode(o)] = o;
|
|
83
|
+
var u = Object.getOwnPropertyNames(i).map(function(l) {
|
|
84
|
+
return i[l];
|
|
85
85
|
});
|
|
86
|
-
if (
|
|
86
|
+
if (u.join("") !== "0123456789")
|
|
87
87
|
return !1;
|
|
88
88
|
var c = {};
|
|
89
|
-
return "abcdefghijklmnopqrst".split("").forEach(function(
|
|
90
|
-
c[
|
|
89
|
+
return "abcdefghijklmnopqrst".split("").forEach(function(l) {
|
|
90
|
+
c[l] = l;
|
|
91
91
|
}), Object.keys(Object.assign({}, c)).join("") === "abcdefghijklmnopqrst";
|
|
92
92
|
} catch {
|
|
93
93
|
return !1;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
return
|
|
97
|
-
for (var o,
|
|
98
|
-
o = Object(arguments[
|
|
99
|
-
for (var
|
|
100
|
-
e.call(o,
|
|
96
|
+
return B = a() ? Object.assign : function(s, i) {
|
|
97
|
+
for (var o, u = t(s), c, l = 1; l < arguments.length; l++) {
|
|
98
|
+
o = Object(arguments[l]);
|
|
99
|
+
for (var m in o)
|
|
100
|
+
e.call(o, m) && (u[m] = o[m]);
|
|
101
101
|
if (r) {
|
|
102
102
|
c = r(o);
|
|
103
|
-
for (var
|
|
104
|
-
n.call(o, c[
|
|
103
|
+
for (var f = 0; f < c.length; f++)
|
|
104
|
+
n.call(o, c[f]) && (u[c[f]] = o[c[f]]);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
return
|
|
108
|
-
},
|
|
107
|
+
return u;
|
|
108
|
+
}, B;
|
|
109
109
|
}
|
|
110
110
|
/** @license React v17.0.2
|
|
111
111
|
* react-jsx-runtime.production.min.js
|
|
@@ -115,97 +115,112 @@ function Oe() {
|
|
|
115
115
|
* This source code is licensed under the MIT license found in the
|
|
116
116
|
* LICENSE file in the root directory of this source tree.
|
|
117
117
|
*/
|
|
118
|
-
var
|
|
119
|
-
function
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
var r =
|
|
123
|
-
if (
|
|
118
|
+
var Y;
|
|
119
|
+
function ke() {
|
|
120
|
+
if (Y) return O;
|
|
121
|
+
Y = 1, Ae();
|
|
122
|
+
var r = Re, e = 60103;
|
|
123
|
+
if (O.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
|
|
124
124
|
var n = Symbol.for;
|
|
125
|
-
e = n("react.element"),
|
|
125
|
+
e = n("react.element"), O.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
|
-
function
|
|
129
|
-
var
|
|
130
|
-
c !== void 0 && (
|
|
131
|
-
for (
|
|
132
|
-
if (o && o.defaultProps) for (
|
|
133
|
-
return { $$typeof: e, type: o, key:
|
|
128
|
+
function i(o, u, c) {
|
|
129
|
+
var l, m = {}, f = null, h = null;
|
|
130
|
+
c !== void 0 && (f = "" + c), u.key !== void 0 && (f = "" + u.key), u.ref !== void 0 && (h = u.ref);
|
|
131
|
+
for (l in u) a.call(u, l) && !s.hasOwnProperty(l) && (m[l] = u[l]);
|
|
132
|
+
if (o && o.defaultProps) for (l in u = o.defaultProps, u) m[l] === void 0 && (m[l] = u[l]);
|
|
133
|
+
return { $$typeof: e, type: o, key: f, ref: h, props: m, _owner: t.current };
|
|
134
134
|
}
|
|
135
|
-
return
|
|
135
|
+
return O.jsx = i, O.jsxs = i, O;
|
|
136
136
|
}
|
|
137
|
-
var
|
|
138
|
-
function
|
|
139
|
-
return
|
|
137
|
+
var K;
|
|
138
|
+
function Ne() {
|
|
139
|
+
return K || (K = 1, Z.exports = ke()), Z.exports;
|
|
140
140
|
}
|
|
141
|
-
var
|
|
142
|
-
const
|
|
143
|
-
function
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
var p = Ne();
|
|
142
|
+
const ue = Ee({});
|
|
143
|
+
function De({
|
|
144
|
+
children: r,
|
|
145
|
+
metadata: e,
|
|
146
|
+
readonly: n
|
|
147
|
+
}) {
|
|
148
|
+
return /* @__PURE__ */ p.jsx(
|
|
149
|
+
ue.Provider,
|
|
146
150
|
{
|
|
147
151
|
value: {
|
|
148
|
-
metadata: e
|
|
152
|
+
metadata: e,
|
|
153
|
+
readonly: n
|
|
149
154
|
},
|
|
150
155
|
children: r
|
|
151
156
|
}
|
|
152
157
|
);
|
|
153
158
|
}
|
|
154
|
-
function
|
|
155
|
-
const r =
|
|
159
|
+
function Me() {
|
|
160
|
+
const r = Te(ue);
|
|
156
161
|
return r || console.warn("useRootFormContext must be used within RootFormProvider"), r;
|
|
157
162
|
}
|
|
158
|
-
const
|
|
163
|
+
const z = ({
|
|
159
164
|
children: r,
|
|
160
165
|
withoutWrapper: e = !1
|
|
161
|
-
}) => e || !r ? r : /* @__PURE__ */
|
|
162
|
-
function
|
|
166
|
+
}) => e || !r ? r : /* @__PURE__ */ p.jsx("div", { children: r });
|
|
167
|
+
function Ze({
|
|
163
168
|
path: r,
|
|
164
169
|
factory: e,
|
|
165
170
|
onUpdate: n,
|
|
166
171
|
onChange: t,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
withoutWrapper: o = !1
|
|
172
|
+
initialValues: a,
|
|
173
|
+
input: s,
|
|
174
|
+
withoutWrapper: i = !1
|
|
171
175
|
}) {
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
var W;
|
|
177
|
+
const { formState: o, watch: u } = Ie(), {
|
|
178
|
+
fixedValues: c = {}
|
|
174
179
|
/*getValuesWithDependencies*/
|
|
175
|
-
} = {}, { metadata: l } =
|
|
180
|
+
} = {}, { metadata: l, readonly: m } = Me(), f = e == null ? void 0 : e.getComponent(s.inputType), h = u(), _ = q(h);
|
|
181
|
+
c && Object.keys(c).forEach((w) => {
|
|
182
|
+
const A = c[w];
|
|
183
|
+
g(_, w, A);
|
|
184
|
+
});
|
|
185
|
+
const y = !s.isVisible || s.isVisible(_, l);
|
|
186
|
+
let E, T;
|
|
187
|
+
y && (E = m || s.readonly, T = typeof s.disabled == "function" ? s.disabled(_, l) : s.disabled);
|
|
188
|
+
const R = (W = s.warning) == null ? void 0 : W.schema, v = D(() => {
|
|
189
|
+
var H, Q;
|
|
190
|
+
if (!y || typeof R > "u") return;
|
|
191
|
+
const w = Ce(h, s.path), A = typeof R == "function" ? R(_) : R, { success: me, error: k } = A.safeParse(w), G = (Q = (H = k == null ? void 0 : k.errors) == null ? void 0 : H[0]) == null ? void 0 : Q.message;
|
|
192
|
+
return !me && G ? G : void 0;
|
|
193
|
+
}, [s.path, h, R, y]), U = D(
|
|
176
194
|
() => ({
|
|
177
195
|
path: r,
|
|
178
196
|
key: r,
|
|
179
|
-
initialValues:
|
|
197
|
+
initialValues: a,
|
|
180
198
|
onUpdate: n,
|
|
181
199
|
onChange: t,
|
|
182
200
|
factory: e,
|
|
183
|
-
readonly:
|
|
184
|
-
input:
|
|
201
|
+
readonly: E,
|
|
202
|
+
input: s,
|
|
203
|
+
disabled: T,
|
|
204
|
+
warning: v
|
|
185
205
|
}),
|
|
186
|
-
[e,
|
|
187
|
-
),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
u.before ? u.before : null,
|
|
194
|
-
d == null ? void 0 : d.renderComponent(p),
|
|
195
|
-
u.after ? u.after : null
|
|
196
|
-
] }) : null, [p, u.after, u.before, d, T, i.errors]);
|
|
197
|
-
return d ? /* @__PURE__ */ h.jsx(L, { withoutWrapper: o, children: I }) : /* @__PURE__ */ h.jsx(L, { withoutWrapper: o, children: /* @__PURE__ */ h.jsxs("p", { children: [
|
|
206
|
+
[e, a, s, t, n, r, E, o.errors, T]
|
|
207
|
+
), de = D(() => y ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
208
|
+
s.before ? s.before : null,
|
|
209
|
+
f == null ? void 0 : f.renderComponent(U),
|
|
210
|
+
s.after ? s.after : null
|
|
211
|
+
] }) : null, [U, s.after, s.before, f, y, o.errors]);
|
|
212
|
+
return f ? /* @__PURE__ */ p.jsx(z, { withoutWrapper: i, children: de }) : /* @__PURE__ */ p.jsx(z, { withoutWrapper: i, children: /* @__PURE__ */ p.jsxs("p", { children: [
|
|
198
213
|
"Input component not found (internal type: ",
|
|
199
|
-
|
|
214
|
+
s.inputType,
|
|
200
215
|
")"
|
|
201
216
|
] }) });
|
|
202
217
|
}
|
|
203
|
-
class
|
|
218
|
+
class ar {
|
|
204
219
|
getType() {
|
|
205
220
|
return this.internalType;
|
|
206
221
|
}
|
|
207
222
|
}
|
|
208
|
-
function
|
|
223
|
+
function or(r) {
|
|
209
224
|
const {
|
|
210
225
|
mode: e = "onSubmit",
|
|
211
226
|
resolver: n,
|
|
@@ -213,27 +228,28 @@ function Qe(r) {
|
|
|
213
228
|
shouldFocusError: a,
|
|
214
229
|
// validateAfterFirstSubmit,
|
|
215
230
|
onValuesChange: s,
|
|
216
|
-
onValidationChange:
|
|
231
|
+
onValidationChange: i,
|
|
217
232
|
onSubmit: o,
|
|
218
233
|
// validate,
|
|
219
234
|
// validateDebounceInterval,
|
|
220
235
|
// validationConfig,
|
|
221
|
-
metadata:
|
|
236
|
+
metadata: u,
|
|
222
237
|
children: c,
|
|
223
238
|
// fixedValues
|
|
224
|
-
autoFocusPath:
|
|
225
|
-
|
|
239
|
+
autoFocusPath: l,
|
|
240
|
+
readonly: m
|
|
241
|
+
} = r, f = we({
|
|
226
242
|
mode: e ?? "onSubmit",
|
|
227
243
|
reValidateMode: "onChange",
|
|
228
244
|
defaultValues: t,
|
|
229
245
|
shouldFocusError: a,
|
|
230
246
|
resolver: n
|
|
231
|
-
}),
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}, [
|
|
235
|
-
const
|
|
236
|
-
|
|
247
|
+
}), h = M(!1);
|
|
248
|
+
j(() => {
|
|
249
|
+
f.reset(t, {});
|
|
250
|
+
}, [f.reset, t]), j(() => {
|
|
251
|
+
const v = requestIdleCallback(() => {
|
|
252
|
+
f.reset({}, {
|
|
237
253
|
keepErrors: !0,
|
|
238
254
|
keepDirty: !0,
|
|
239
255
|
keepDirtyValues: !0,
|
|
@@ -246,220 +262,220 @@ function Qe(r) {
|
|
|
246
262
|
keepSubmitCount: !0
|
|
247
263
|
});
|
|
248
264
|
});
|
|
249
|
-
return () => cancelIdleCallback(
|
|
265
|
+
return () => cancelIdleCallback(v);
|
|
250
266
|
}, []);
|
|
251
|
-
const { getValues:
|
|
252
|
-
|
|
267
|
+
const { getValues: _, handleSubmit: y } = f, E = _(), T = M(!0);
|
|
268
|
+
j(() => {
|
|
253
269
|
if (T.current) {
|
|
254
270
|
T.current = !1;
|
|
255
271
|
return;
|
|
256
272
|
}
|
|
257
|
-
s == null || s({ ...
|
|
258
|
-
}, [JSON.stringify(
|
|
259
|
-
const
|
|
260
|
-
return
|
|
261
|
-
if (
|
|
262
|
-
|
|
273
|
+
s == null || s({ ...E }), h.current === !0 && f.trigger();
|
|
274
|
+
}, [JSON.stringify(E)]);
|
|
275
|
+
const R = M(!0);
|
|
276
|
+
return j(() => {
|
|
277
|
+
if (R.current) {
|
|
278
|
+
R.current = !1;
|
|
263
279
|
return;
|
|
264
280
|
}
|
|
265
|
-
|
|
266
|
-
}, [
|
|
267
|
-
if (
|
|
281
|
+
i == null || i({ isValid: f.formState.isValid, isSubmitted: f.formState.isSubmitted });
|
|
282
|
+
}, [f.formState.isValid, f.formState.isSubmitted]), j(() => {
|
|
283
|
+
if (l)
|
|
268
284
|
if ("requestIdleCallback" in window) {
|
|
269
|
-
const
|
|
270
|
-
|
|
285
|
+
const v = requestIdleCallback(() => {
|
|
286
|
+
f.setFocus(l);
|
|
271
287
|
});
|
|
272
|
-
return () => cancelIdleCallback(
|
|
288
|
+
return () => cancelIdleCallback(v);
|
|
273
289
|
} else {
|
|
274
|
-
const
|
|
275
|
-
|
|
290
|
+
const v = setTimeout(() => {
|
|
291
|
+
f.setFocus(l);
|
|
276
292
|
}, 100);
|
|
277
|
-
return () => clearTimeout(
|
|
293
|
+
return () => clearTimeout(v);
|
|
278
294
|
}
|
|
279
|
-
}, [
|
|
280
|
-
...
|
|
295
|
+
}, [f]), /* @__PURE__ */ p.jsx(De, { metadata: u, readonly: m, children: /* @__PURE__ */ p.jsx(Ve, { ...f, children: typeof c == "function" ? c({
|
|
296
|
+
...f,
|
|
281
297
|
submitForm: async () => {
|
|
282
|
-
o && (
|
|
283
|
-
o(
|
|
298
|
+
o && (h.current = !0, y((v) => {
|
|
299
|
+
o(v);
|
|
284
300
|
})());
|
|
285
301
|
}
|
|
286
302
|
}) : c }) });
|
|
287
303
|
}
|
|
288
|
-
const
|
|
304
|
+
const ur = (r) => {
|
|
289
305
|
const e = {}, n = (t) => {
|
|
290
306
|
t.forEach((a) => {
|
|
291
|
-
const { path: s, default:
|
|
292
|
-
(o === "group" || o === "accordion") && Array.isArray(
|
|
307
|
+
const { path: s, default: i, inputType: o, inputs: u } = a;
|
|
308
|
+
(o === "group" || o === "accordion") && Array.isArray(u) ? n(u) : b(e, s) === void 0 && g(e, s, i);
|
|
293
309
|
});
|
|
294
310
|
};
|
|
295
311
|
return Array.isArray(r.inputs) && n(r.inputs), e;
|
|
296
312
|
};
|
|
297
|
-
function
|
|
313
|
+
function ir(r, e) {
|
|
298
314
|
const n = r.inputs.map((t) => {
|
|
299
|
-
const a =
|
|
315
|
+
const a = Be(e, t.path);
|
|
300
316
|
return a || t;
|
|
301
317
|
});
|
|
302
318
|
return { ...r, inputs: n };
|
|
303
319
|
}
|
|
304
|
-
function
|
|
320
|
+
function Be(r, e) {
|
|
305
321
|
return r.inputs.find((n) => n.path === e);
|
|
306
322
|
}
|
|
307
|
-
const
|
|
308
|
-
function
|
|
323
|
+
const ie = "__temp_", cr = (r) => ie + r.split(".").join("__");
|
|
324
|
+
function $e(r) {
|
|
309
325
|
const e = { ...r };
|
|
310
|
-
return
|
|
311
|
-
t.startsWith(
|
|
326
|
+
return te(e, (n, t) => {
|
|
327
|
+
t.startsWith(ie) && delete e[t];
|
|
312
328
|
}), e;
|
|
313
329
|
}
|
|
314
|
-
const
|
|
315
|
-
function
|
|
330
|
+
const Je = "Required field";
|
|
331
|
+
function I(r) {
|
|
316
332
|
const e = typeof r == "string" ? JSON.parse(r) : r;
|
|
317
333
|
if (typeof e == "string")
|
|
318
334
|
return e;
|
|
319
|
-
if (
|
|
320
|
-
return
|
|
335
|
+
if (S(e))
|
|
336
|
+
return I(e[0]);
|
|
321
337
|
const n = e;
|
|
322
|
-
return
|
|
338
|
+
return ne(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
|
|
323
339
|
}
|
|
324
|
-
function
|
|
340
|
+
function Le(r, e, n) {
|
|
325
341
|
let t = {};
|
|
326
|
-
if (
|
|
342
|
+
if (P(t, r.inputs, e, n), n != null && n.prefix) {
|
|
327
343
|
const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
|
|
328
344
|
t = g({}, s, t);
|
|
329
345
|
}
|
|
330
|
-
return
|
|
346
|
+
return d.object(x(t, e, n));
|
|
331
347
|
}
|
|
332
|
-
function
|
|
348
|
+
function x(r, e, n) {
|
|
333
349
|
const t = {};
|
|
334
350
|
return Object.keys(r).forEach((a) => {
|
|
335
351
|
const {
|
|
336
352
|
_requiredOnly: s,
|
|
337
|
-
_schemaObj:
|
|
353
|
+
_schemaObj: i,
|
|
338
354
|
_input: o,
|
|
339
|
-
_isList:
|
|
355
|
+
_isList: u,
|
|
340
356
|
_isArrayItem: c,
|
|
341
|
-
_schema:
|
|
357
|
+
_schema: l
|
|
342
358
|
/*...nestedSchemaObj*/
|
|
343
359
|
} = r[a];
|
|
344
|
-
if (
|
|
345
|
-
const
|
|
346
|
-
t[a] =
|
|
360
|
+
if (u && i && o) {
|
|
361
|
+
const m = d.array(d.object(x(i, e, n))).optional(), f = ee(l, o, e, n, m);
|
|
362
|
+
t[a] = f;
|
|
347
363
|
} else if (c && o) {
|
|
348
|
-
const
|
|
349
|
-
t[a] =
|
|
350
|
-
} else if (
|
|
351
|
-
const
|
|
352
|
-
t[a] =
|
|
353
|
-
} else s && o ? t[a] =
|
|
364
|
+
const m = i != null && i.___array ? x({ ___array: i.___array }, e, n) : { ___array: d.any() }, f = d.array(m.___array).optional(), h = ee(l, o, e, n, f);
|
|
365
|
+
t[a] = h;
|
|
366
|
+
} else if (l && o) {
|
|
367
|
+
const m = Ue(l, o, e, n);
|
|
368
|
+
t[a] = m;
|
|
369
|
+
} else s && o ? t[a] = J(o, n) : t[a] = d.object(x(r[a], e, n)).optional();
|
|
354
370
|
}), t;
|
|
355
371
|
}
|
|
356
|
-
function
|
|
357
|
-
return
|
|
358
|
-
var o,
|
|
359
|
-
if (e.required && !(await
|
|
372
|
+
function Ue(r, e, n, t) {
|
|
373
|
+
return d.any().optional().superRefine(async (a, s) => {
|
|
374
|
+
var o, u;
|
|
375
|
+
if (e.required && !(await J(e, t).safeParseAsync(a)).success)
|
|
360
376
|
return s.addIssue({
|
|
361
|
-
code:
|
|
362
|
-
message:
|
|
363
|
-
}),
|
|
377
|
+
code: d.ZodIssueCode.custom,
|
|
378
|
+
message: $(e, t)
|
|
379
|
+
}), d.NEVER;
|
|
364
380
|
if ((o = t == null ? void 0 : t.validationConfig) != null && o.globalValidation) {
|
|
365
|
-
const c = (
|
|
381
|
+
const c = (u = t == null ? void 0 : t.validationConfig) == null ? void 0 : u.globalValidation(a, e, t.metadata);
|
|
366
382
|
if (c.error)
|
|
367
383
|
return s.addIssue({
|
|
368
|
-
code:
|
|
384
|
+
code: d.ZodIssueCode.custom,
|
|
369
385
|
message: c.error
|
|
370
|
-
}),
|
|
386
|
+
}), d.NEVER;
|
|
371
387
|
if (!c.continue)
|
|
372
388
|
return !0;
|
|
373
389
|
}
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
376
|
-
const c = await
|
|
390
|
+
const i = ce(r, n);
|
|
391
|
+
if (i) {
|
|
392
|
+
const c = await i.safeParseAsync(a);
|
|
377
393
|
if (!c.success) {
|
|
378
|
-
const
|
|
394
|
+
const l = I(c == null ? void 0 : c.error.message), m = l === "Required" ? $(e, t) : l;
|
|
379
395
|
s.addIssue({
|
|
380
|
-
code:
|
|
381
|
-
message:
|
|
396
|
+
code: d.ZodIssueCode.custom,
|
|
397
|
+
message: m
|
|
382
398
|
});
|
|
383
399
|
}
|
|
384
400
|
}
|
|
385
401
|
});
|
|
386
402
|
}
|
|
387
|
-
function
|
|
388
|
-
return
|
|
389
|
-
var
|
|
390
|
-
const
|
|
391
|
-
if (e.required && !
|
|
392
|
-
const
|
|
393
|
-
return
|
|
403
|
+
function ee(r, e, n, t, a) {
|
|
404
|
+
return d.any().optional().superRefine(async (s, i) => {
|
|
405
|
+
var l, m;
|
|
406
|
+
const u = await J(e, t).safeParseAsync(s);
|
|
407
|
+
if (e.required && !u.success) {
|
|
408
|
+
const f = I(u.error.message);
|
|
409
|
+
return i.addIssue({ code: d.ZodIssueCode.custom, message: f, fatal: !0 }), d.NEVER;
|
|
394
410
|
}
|
|
395
|
-
if (!e.required && !
|
|
396
|
-
return
|
|
397
|
-
if ((
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
401
|
-
code:
|
|
402
|
-
message:
|
|
403
|
-
}),
|
|
404
|
-
if (!
|
|
405
|
-
return
|
|
411
|
+
if (!e.required && !u.success)
|
|
412
|
+
return d.NEVER;
|
|
413
|
+
if ((l = t == null ? void 0 : t.validationConfig) != null && l.globalValidation) {
|
|
414
|
+
const f = (m = t == null ? void 0 : t.validationConfig) == null ? void 0 : m.globalValidation(s, e, t.metadata);
|
|
415
|
+
if (f.error)
|
|
416
|
+
return i.addIssue({
|
|
417
|
+
code: d.ZodIssueCode.custom,
|
|
418
|
+
message: I(f.error)
|
|
419
|
+
}), d.NEVER;
|
|
420
|
+
if (!f.continue)
|
|
421
|
+
return d.NEVER;
|
|
406
422
|
}
|
|
407
|
-
if (!
|
|
408
|
-
return
|
|
409
|
-
code:
|
|
423
|
+
if (!S(s))
|
|
424
|
+
return i.addIssue({
|
|
425
|
+
code: d.ZodIssueCode.custom,
|
|
410
426
|
message: "'Value is not array'"
|
|
411
|
-
}),
|
|
412
|
-
const c =
|
|
427
|
+
}), d.NEVER;
|
|
428
|
+
const c = ce(r, n);
|
|
413
429
|
if (c) {
|
|
414
|
-
const
|
|
415
|
-
if (!
|
|
416
|
-
return
|
|
417
|
-
code:
|
|
418
|
-
message:
|
|
419
|
-
}),
|
|
430
|
+
const f = await c.safeParseAsync(s);
|
|
431
|
+
if (!f.success)
|
|
432
|
+
return i.addIssue({
|
|
433
|
+
code: d.ZodIssueCode.custom,
|
|
434
|
+
message: I(f.error.message)
|
|
435
|
+
}), d.NEVER;
|
|
420
436
|
}
|
|
421
|
-
}).pipe(a ??
|
|
437
|
+
}).pipe(a ?? d.any());
|
|
422
438
|
}
|
|
423
|
-
function
|
|
439
|
+
function P(r, e, n, t, a) {
|
|
424
440
|
e.forEach((s) => {
|
|
425
|
-
var o,
|
|
426
|
-
const
|
|
427
|
-
if (!s.isVisible || (o = s.isVisible) != null && o.call(s,
|
|
428
|
-
const
|
|
429
|
-
if ((
|
|
441
|
+
var o, u, c, l, m;
|
|
442
|
+
const i = n;
|
|
443
|
+
if (!s.isVisible || (o = s.isVisible) != null && o.call(s, i, t == null ? void 0 : t.metadata)) {
|
|
444
|
+
const f = b(r, s.path);
|
|
445
|
+
if ((u = s.validation) != null && u.schema ? g(
|
|
430
446
|
r,
|
|
431
447
|
s.path,
|
|
432
|
-
|
|
448
|
+
V(f, {
|
|
433
449
|
_schema: (c = s.validation) == null ? void 0 : c.schema,
|
|
434
450
|
_input: s
|
|
435
451
|
})
|
|
436
|
-
) : s.required && g(r, s.path,
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
s.inputConfig.inputs.map((
|
|
441
|
-
...
|
|
442
|
-
path:
|
|
452
|
+
) : s.required && g(r, s.path, V(f, { _requiredOnly: !0, _input: s })), s.inputs && P(r, s.inputs, n, t), s.inputType === "list") {
|
|
453
|
+
const h = {};
|
|
454
|
+
P(
|
|
455
|
+
h,
|
|
456
|
+
s.inputConfig.inputs.map((y) => ({
|
|
457
|
+
...y,
|
|
458
|
+
path: y.relativePath
|
|
443
459
|
})),
|
|
444
460
|
n,
|
|
445
461
|
t
|
|
446
462
|
);
|
|
447
|
-
const
|
|
448
|
-
g(r, s.path,
|
|
463
|
+
const _ = b(r, s.path);
|
|
464
|
+
g(r, s.path, V(_, { _schemaObj: h, _isList: !0, _input: s }));
|
|
449
465
|
}
|
|
450
|
-
if (!((
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
|
|
466
|
+
if (!((l = s.validation) != null && l.schema) && s.inputType === "array") {
|
|
467
|
+
const h = {};
|
|
468
|
+
P(
|
|
469
|
+
h,
|
|
454
470
|
[{ ...s.inputConfig.input, path: "___array" }],
|
|
455
471
|
n,
|
|
456
472
|
t
|
|
457
473
|
), g(
|
|
458
474
|
r,
|
|
459
475
|
s.path,
|
|
460
|
-
|
|
461
|
-
_schemaObj:
|
|
462
|
-
_schema: (
|
|
476
|
+
V(f, {
|
|
477
|
+
_schemaObj: h,
|
|
478
|
+
_schema: (m = s.validation) == null ? void 0 : m.schema,
|
|
463
479
|
_isArrayItem: !0,
|
|
464
480
|
_input: s
|
|
465
481
|
})
|
|
@@ -468,50 +484,50 @@ function w(r, e, n, t, a) {
|
|
|
468
484
|
}
|
|
469
485
|
});
|
|
470
486
|
}
|
|
471
|
-
function
|
|
487
|
+
function $(r, e) {
|
|
472
488
|
var n, t, a;
|
|
473
|
-
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) ??
|
|
489
|
+
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) ?? Je;
|
|
474
490
|
}
|
|
475
|
-
function
|
|
476
|
-
var t, a, s,
|
|
491
|
+
function J(r, e) {
|
|
492
|
+
var t, a, s, i, o, u;
|
|
477
493
|
if ((a = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredSchemaPerInput) != null && a[r.inputType])
|
|
478
|
-
return (
|
|
494
|
+
return (i = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : i[r.inputType];
|
|
479
495
|
if ((o = e == null ? void 0 : e.validationConfig) != null && o.requiredSchema)
|
|
480
|
-
return (
|
|
481
|
-
const n =
|
|
482
|
-
return
|
|
483
|
-
typeof c == "object" &&
|
|
484
|
-
code:
|
|
496
|
+
return (u = e == null ? void 0 : e.validationConfig) == null ? void 0 : u.requiredSchema;
|
|
497
|
+
const n = $(r, e);
|
|
498
|
+
return d.any().optional().superRefine((c, l) => {
|
|
499
|
+
typeof c == "object" && C(c) && l.addIssue({
|
|
500
|
+
code: d.ZodIssueCode.custom,
|
|
485
501
|
message: n
|
|
486
|
-
}), (
|
|
487
|
-
code:
|
|
502
|
+
}), (F(c) || c === "") && l.addIssue({
|
|
503
|
+
code: d.ZodIssueCode.custom,
|
|
488
504
|
message: n
|
|
489
505
|
});
|
|
490
506
|
});
|
|
491
507
|
}
|
|
492
|
-
function
|
|
493
|
-
if (r instanceof
|
|
508
|
+
function ce(r, e) {
|
|
509
|
+
if (r instanceof d.ZodType)
|
|
494
510
|
return r;
|
|
495
511
|
if (typeof r == "function")
|
|
496
512
|
return r(e);
|
|
497
513
|
}
|
|
498
|
-
const
|
|
514
|
+
const We = (r) => Array.isArray(r == null ? void 0 : r.errors), Ge = (r, e) => {
|
|
499
515
|
const n = {};
|
|
500
516
|
for (; r.length; ) {
|
|
501
|
-
const t = r[0], { code: a, message: s, path:
|
|
517
|
+
const t = r[0], { code: a, message: s, path: i } = t, o = i.join(".");
|
|
502
518
|
if (!n[o])
|
|
503
519
|
if ("unionErrors" in t) {
|
|
504
|
-
const
|
|
520
|
+
const u = t.unionErrors[0].errors[0];
|
|
505
521
|
n[o] = {
|
|
506
|
-
message:
|
|
507
|
-
type:
|
|
522
|
+
message: u.message,
|
|
523
|
+
type: u.code
|
|
508
524
|
};
|
|
509
525
|
} else
|
|
510
526
|
n[o] = { message: s, type: a };
|
|
511
|
-
"unionErrors" in t && t.unionErrors.forEach((
|
|
527
|
+
"unionErrors" in t && t.unionErrors.forEach((u) => u.errors.forEach((c) => r.push(c)));
|
|
512
528
|
{
|
|
513
|
-
const
|
|
514
|
-
n[o] =
|
|
529
|
+
const u = n[o].types, c = u && u[t.code];
|
|
530
|
+
n[o] = xe(
|
|
515
531
|
o,
|
|
516
532
|
e,
|
|
517
533
|
n,
|
|
@@ -523,20 +539,20 @@ const Ae = (r) => Array.isArray(r == null ? void 0 : r.errors), ke = (r, e) => {
|
|
|
523
539
|
}
|
|
524
540
|
return n;
|
|
525
541
|
};
|
|
526
|
-
function
|
|
527
|
-
return
|
|
542
|
+
function fr(r, e) {
|
|
543
|
+
return Oe(
|
|
528
544
|
async (n, t, a) => {
|
|
529
545
|
try {
|
|
530
|
-
return await
|
|
546
|
+
return await Le(r, n, e).parseAsync(n), {
|
|
531
547
|
values: n,
|
|
532
548
|
// TODO: check this - values does not contains all data
|
|
533
549
|
errors: {}
|
|
534
550
|
};
|
|
535
551
|
} catch (s) {
|
|
536
|
-
if (
|
|
552
|
+
if (We(s))
|
|
537
553
|
return {
|
|
538
554
|
values: {},
|
|
539
|
-
errors:
|
|
555
|
+
errors: qe(Ge(s.errors, !0), a)
|
|
540
556
|
};
|
|
541
557
|
throw s;
|
|
542
558
|
}
|
|
@@ -544,63 +560,63 @@ function ze(r, e) {
|
|
|
544
560
|
[r]
|
|
545
561
|
);
|
|
546
562
|
}
|
|
547
|
-
function
|
|
548
|
-
const n =
|
|
563
|
+
function He(r, e) {
|
|
564
|
+
const n = q(r);
|
|
549
565
|
return e.forEach((t) => {
|
|
550
|
-
t.inputTransform && (
|
|
551
|
-
const
|
|
566
|
+
t.inputTransform && (S(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
|
|
567
|
+
const i = b(n, t.path), o = s(i, n);
|
|
552
568
|
o && g(n, o.path ?? t.path, o.value);
|
|
553
569
|
});
|
|
554
570
|
}), n;
|
|
555
571
|
}
|
|
556
|
-
function
|
|
557
|
-
const n =
|
|
572
|
+
function Qe(r, e) {
|
|
573
|
+
const n = q(r);
|
|
558
574
|
return e.forEach((t) => {
|
|
559
|
-
t.outputTransform && (
|
|
560
|
-
const
|
|
575
|
+
t.outputTransform && (S(t.outputTransform) ? t.outputTransform : [t.outputTransform]).forEach((s) => {
|
|
576
|
+
const i = b(n, t.path), o = s(i, n);
|
|
561
577
|
o && g(n, o.path ?? t.path, o.value);
|
|
562
578
|
});
|
|
563
579
|
}), n;
|
|
564
580
|
}
|
|
565
|
-
function
|
|
566
|
-
return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...
|
|
581
|
+
function L(r) {
|
|
582
|
+
return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...L(t.inputs)] : [...n, t], []);
|
|
567
583
|
}
|
|
568
|
-
function
|
|
569
|
-
const n =
|
|
584
|
+
function fe(r) {
|
|
585
|
+
const n = L(r.inputs).reduce((t, a) => {
|
|
570
586
|
const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
|
|
571
587
|
return (a.inputTransform || a.outputTransform) && t.push({
|
|
572
|
-
...
|
|
588
|
+
...ye(a, "path", "inputTransform", "outputTransform"),
|
|
573
589
|
level: a.path.split(".").length,
|
|
574
590
|
isPrimitive: s
|
|
575
591
|
}), t;
|
|
576
592
|
}, []);
|
|
577
593
|
return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
|
|
578
594
|
}
|
|
579
|
-
function
|
|
580
|
-
const { preserve: a } = t, s =
|
|
595
|
+
function Xe(r, e, n, t = {}) {
|
|
596
|
+
const { preserve: a } = t, s = L(r.inputs), i = q(e);
|
|
581
597
|
return s.forEach((o) => {
|
|
582
|
-
a && a.includes(o.path) || o.isVisible && !o.isVisible(e, n) &&
|
|
583
|
-
}),
|
|
598
|
+
a && a.includes(o.path) || o.isVisible && !o.isVisible(e, n) && ge(i, o.path);
|
|
599
|
+
}), i;
|
|
584
600
|
}
|
|
585
|
-
function
|
|
586
|
-
const n =
|
|
587
|
-
return
|
|
601
|
+
function lr(r, e) {
|
|
602
|
+
const n = fe(e);
|
|
603
|
+
return He(r, n);
|
|
588
604
|
}
|
|
589
|
-
function
|
|
590
|
-
const a =
|
|
591
|
-
let s =
|
|
592
|
-
return s =
|
|
605
|
+
function dr(r, e, n, t = {}) {
|
|
606
|
+
const a = fe(e);
|
|
607
|
+
let s = Xe(e, r, n, t);
|
|
608
|
+
return s = Qe(s, a), s = $e(s), s;
|
|
593
609
|
}
|
|
594
|
-
function
|
|
610
|
+
function mr(r) {
|
|
595
611
|
const e = {}, n = (t) => {
|
|
596
612
|
t.forEach((a) => {
|
|
597
|
-
const { default: s, path:
|
|
598
|
-
(o === "group" || o === "accordion") && Array.isArray(
|
|
613
|
+
const { default: s, path: i, inputType: o, inputs: u } = a;
|
|
614
|
+
(o === "group" || o === "accordion") && Array.isArray(u) ? n(u) : s !== void 0 && g(e, i, s);
|
|
599
615
|
});
|
|
600
616
|
};
|
|
601
617
|
return Array.isArray(r.inputs) && n(r.inputs), e;
|
|
602
618
|
}
|
|
603
|
-
function
|
|
619
|
+
function hr() {
|
|
604
620
|
return function(r, e) {
|
|
605
621
|
if (!(typeof r > "u"))
|
|
606
622
|
return r ? {
|
|
@@ -608,7 +624,7 @@ function nr() {
|
|
|
608
624
|
} : { value: r };
|
|
609
625
|
};
|
|
610
626
|
}
|
|
611
|
-
function
|
|
627
|
+
function pr(r) {
|
|
612
628
|
return function(e, n) {
|
|
613
629
|
if (typeof e > "u") return;
|
|
614
630
|
if (!e) return { value: e };
|
|
@@ -618,64 +634,64 @@ function sr(r) {
|
|
|
618
634
|
return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
|
|
619
635
|
};
|
|
620
636
|
}
|
|
621
|
-
function
|
|
637
|
+
function yr() {
|
|
622
638
|
return function(r, e) {
|
|
623
639
|
if (!(typeof r > "u"))
|
|
624
|
-
return
|
|
640
|
+
return S(r) && C(r) ? { value: void 0 } : { value: r };
|
|
625
641
|
};
|
|
626
642
|
}
|
|
627
|
-
function
|
|
643
|
+
function gr(r) {
|
|
628
644
|
return function(e, n) {
|
|
629
645
|
const t = r ? b(n, r) : e;
|
|
630
646
|
if (!(typeof t > "u")) {
|
|
631
|
-
if (
|
|
632
|
-
if (
|
|
633
|
-
const a =
|
|
634
|
-
if (
|
|
647
|
+
if (se(t)) return { value: void 0, path: r };
|
|
648
|
+
if (ne(t)) {
|
|
649
|
+
const a = ae(t, be);
|
|
650
|
+
if (C(a))
|
|
635
651
|
return { value: void 0, path: r };
|
|
636
652
|
}
|
|
637
653
|
return { value: t, path: r };
|
|
638
654
|
}
|
|
639
655
|
};
|
|
640
656
|
}
|
|
641
|
-
function
|
|
657
|
+
function br() {
|
|
642
658
|
return function(r, e) {
|
|
643
659
|
if (!(typeof r > "u"))
|
|
644
|
-
return
|
|
660
|
+
return ve(r) && C(r) ? { value: void 0 } : { value: r };
|
|
645
661
|
};
|
|
646
662
|
}
|
|
647
|
-
function
|
|
663
|
+
function vr(r) {
|
|
648
664
|
return function(e, n) {
|
|
649
665
|
const t = b(n, r);
|
|
650
666
|
return typeof t == "string" ? { value: t } : { value: e };
|
|
651
667
|
};
|
|
652
668
|
}
|
|
653
|
-
function
|
|
669
|
+
function _r(r) {
|
|
654
670
|
return function(e, n) {
|
|
655
671
|
if (typeof e > "u") return;
|
|
656
672
|
if (!e) return { value: e };
|
|
657
673
|
const t = b(n, r);
|
|
658
674
|
if (typeof t == "object") {
|
|
659
|
-
const a =
|
|
675
|
+
const a = Ye(t);
|
|
660
676
|
if (Object.getOwnPropertyNames(a).length === 1)
|
|
661
677
|
return { value: e, path: r };
|
|
662
678
|
}
|
|
663
679
|
return { value: e };
|
|
664
680
|
};
|
|
665
681
|
}
|
|
666
|
-
function
|
|
682
|
+
function Rr(r) {
|
|
667
683
|
return function(e, n) {
|
|
668
684
|
if (typeof e > "u") return;
|
|
669
685
|
const t = b(n, r);
|
|
670
686
|
return typeof t == "string" ? { value: [t] } : { value: e };
|
|
671
687
|
};
|
|
672
688
|
}
|
|
673
|
-
function
|
|
689
|
+
function Er(r, e) {
|
|
674
690
|
return function(n, t) {
|
|
675
691
|
if (typeof n > "u") return;
|
|
676
692
|
if (!n) return { value: n };
|
|
677
693
|
const a = b(t, r);
|
|
678
|
-
if (
|
|
694
|
+
if (S(a)) {
|
|
679
695
|
if (a.length === 1)
|
|
680
696
|
return { value: a[0], path: r };
|
|
681
697
|
if (a.length === 0 && e != null && e.unsetIfEmpty)
|
|
@@ -684,43 +700,42 @@ function lr(r, e) {
|
|
|
684
700
|
return { value: n };
|
|
685
701
|
};
|
|
686
702
|
}
|
|
687
|
-
function
|
|
688
|
-
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !
|
|
703
|
+
function le(r) {
|
|
704
|
+
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !le(r[e])) : F(r);
|
|
689
705
|
}
|
|
690
|
-
function
|
|
691
|
-
return
|
|
706
|
+
function Ye(r) {
|
|
707
|
+
return ae(r, (e) => typeof e == "object" ? le(e) : F(e));
|
|
692
708
|
}
|
|
693
|
-
function
|
|
709
|
+
function re(r) {
|
|
694
710
|
const { items: e, ...n } = r;
|
|
695
|
-
return /* @__PURE__ */
|
|
696
|
-
|
|
711
|
+
return /* @__PURE__ */ p.jsx(p.Fragment, { children: e.map((t) => /* @__PURE__ */ p.jsx(
|
|
712
|
+
Ze,
|
|
697
713
|
{
|
|
698
714
|
input: t,
|
|
699
715
|
path: t.path,
|
|
700
|
-
readonly: !1,
|
|
701
716
|
...n
|
|
702
717
|
},
|
|
703
718
|
`${t.inputType}_${t.path}_${t.label}`
|
|
704
719
|
)) });
|
|
705
720
|
}
|
|
706
|
-
const
|
|
721
|
+
const Ke = Se((r, e) => {
|
|
707
722
|
const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
|
|
708
|
-
return s ? /* @__PURE__ */
|
|
723
|
+
return s ? /* @__PURE__ */ p.jsxs(je, { children: [
|
|
709
724
|
n.hero,
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
] }) : /* @__PURE__ */
|
|
725
|
+
/* @__PURE__ */ p.jsx(re, { items: n.inputs, factory: a, withoutWrapper: s })
|
|
726
|
+
] }) : /* @__PURE__ */ p.jsxs("div", { className: t, ref: e, children: [
|
|
712
727
|
n.hero,
|
|
713
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ p.jsx(re, { items: n.inputs, factory: a, withoutWrapper: s })
|
|
714
729
|
] });
|
|
715
730
|
});
|
|
716
|
-
|
|
717
|
-
function
|
|
731
|
+
Ke.displayName = "RenderForm";
|
|
732
|
+
function Tr(r) {
|
|
718
733
|
let e = !0;
|
|
719
|
-
return
|
|
720
|
-
e = e && (n === "" ||
|
|
734
|
+
return te(r, (n) => {
|
|
735
|
+
e = e && (n === "" || se(n) || F(n));
|
|
721
736
|
}), e;
|
|
722
737
|
}
|
|
723
|
-
const
|
|
738
|
+
const Or = (r = "") => _e(r.split("_").join(" ")), ze = (r, e = 2) => {
|
|
724
739
|
let n = !1;
|
|
725
740
|
const t = () => {
|
|
726
741
|
requestAnimationFrame(() => {
|
|
@@ -731,54 +746,54 @@ const mr = (r = "") => fe(r.split("_").join(" ")), $e = (r, e = 2) => {
|
|
|
731
746
|
n = !0;
|
|
732
747
|
};
|
|
733
748
|
};
|
|
734
|
-
function
|
|
749
|
+
function Sr(r) {
|
|
735
750
|
const {
|
|
736
751
|
field: { onBlur: e, ...n },
|
|
737
752
|
...t
|
|
738
|
-
} =
|
|
753
|
+
} = Pe(r);
|
|
739
754
|
return {
|
|
740
755
|
...t,
|
|
741
756
|
field: {
|
|
742
757
|
...n,
|
|
743
|
-
onBlur:
|
|
758
|
+
onBlur: ze(e)
|
|
744
759
|
}
|
|
745
760
|
};
|
|
746
761
|
}
|
|
747
762
|
export {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
763
|
+
ar as InputComponent,
|
|
764
|
+
Ze as InputComponentRenderer,
|
|
765
|
+
oe as InputFactory,
|
|
766
|
+
Fe as InputOverrideError,
|
|
767
|
+
Ke as RenderForm,
|
|
768
|
+
re as RenderInputs,
|
|
769
|
+
or as RootForm,
|
|
770
|
+
ze as afterFrames,
|
|
771
|
+
pr as arrayToObjectOutputTransformer,
|
|
772
|
+
mr as collectDefaultValues,
|
|
773
|
+
lr as convertDataToFormModel,
|
|
774
|
+
dr as convertFormModelToData,
|
|
775
|
+
Or as generateReadableLabel,
|
|
776
|
+
ur as getDefaultValuesFromFormDefinition,
|
|
777
|
+
cr as getTemporaryPath,
|
|
778
|
+
fe as getTransformers,
|
|
779
|
+
Le as getValidationSchema,
|
|
780
|
+
He as inputTransformValues,
|
|
781
|
+
Tr as isChildrenEmpty,
|
|
782
|
+
hr as objectToArrayInputTransformer,
|
|
783
|
+
Qe as outputTransformValues,
|
|
784
|
+
ir as overrideFormDefinition,
|
|
785
|
+
I as processValidationParseResponse,
|
|
786
|
+
$e as removeTemporaryFieldsValue,
|
|
787
|
+
Rr as shorthandArrayInputTransformer,
|
|
788
|
+
Er as shorthandArrayOutputTransformer,
|
|
789
|
+
vr as shorthandObjectInputTransformer,
|
|
790
|
+
_r as shorthandObjectOutputTransformer,
|
|
791
|
+
yr as unsetEmptyArrayOutputTransformer,
|
|
792
|
+
gr as unsetEmptyObjectOutputTransformer,
|
|
793
|
+
br as unsetEmptyStringOutputTransformer,
|
|
794
|
+
Xe as unsetHiddenInputsValues,
|
|
795
|
+
Sr as useController,
|
|
796
|
+
Me as useRootFormContext,
|
|
797
|
+
fr as useZodValidationResolver
|
|
783
798
|
};
|
|
784
799
|
//# sourceMappingURL=index.js.map
|