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