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