treege 3.0.0-beta.72 → 3.0.0-beta.74
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/{DefaultSubmitButton-C_141kVj.js → DefaultSubmitButton-BT4AxAnR.js} +746 -720
- package/dist/{ThemeContext-BGeTYtnw.js → ThemeContext-CSH4Fupd.js} +75 -59
- package/dist/{editor-Dy_Ul5Mu.js → editor-alr_fxTU.js} +1527 -1493
- package/dist/editor.js +2 -2
- package/dist/main.js +6 -6
- package/dist/renderer/utils/http.d.ts +16 -0
- package/dist/renderer-D9Yaxr2H.js +255 -0
- package/dist/renderer-native.js +740 -745
- package/dist/renderer.js +5 -5
- package/dist/shared/locales/ar.json.d.ts +3 -0
- package/dist/shared/locales/de.json.d.ts +3 -0
- package/dist/shared/locales/en.json.d.ts +3 -0
- package/dist/shared/locales/es.json.d.ts +3 -0
- package/dist/shared/locales/fr.json.d.ts +3 -0
- package/dist/shared/locales/it.json.d.ts +3 -0
- package/dist/shared/locales/pt.json.d.ts +3 -0
- package/dist/shared/types/node.d.ts +7 -0
- package/dist/shared/utils/normalizeLabel.d.ts +21 -0
- package/dist/{useRenderNode-eqCek6JX.js → useRenderNode-GobhZp-Y.js} +154 -154
- package/package.json +1 -1
- package/dist/renderer-D5xQw7hp.js +0 -255
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { B as e,
|
|
1
|
+
import { B as e, D as t, E as n, H as r, I as i, L as a, M as o, O as s, T as c, U as l, V as u, a as d, c as f, d as p, f as m, i as h, j as ee, k as g, l as _, o as v, p as y, s as b, u as x, w as S, y as C } from "./ThemeContext-CSH4Fupd.js";
|
|
2
2
|
import { Fragment as w, createContext as T, useCallback as E, useContext as D, useEffect as O, useMemo as k, useRef as A, useState as j } from "react";
|
|
3
3
|
import { jsx as M } from "react/jsx-runtime";
|
|
4
4
|
//#region src/renderer/context/TreegeRendererProvider.tsx
|
|
5
5
|
var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__ */ M(N.Provider, {
|
|
6
6
|
value: t,
|
|
7
7
|
children: e
|
|
8
|
-
}), F = async (e, i, a, o
|
|
8
|
+
}), F = async (e, r, i, a, o) => {
|
|
9
9
|
if (!e.url || e.url.trim() === "") return {
|
|
10
10
|
error: "No URL configured for submission",
|
|
11
11
|
success: !1
|
|
12
12
|
};
|
|
13
|
-
let
|
|
14
|
-
if (!
|
|
13
|
+
let l = g(t(e.url, r, { encode: !0 }), o);
|
|
14
|
+
if (!l || l.trim() === "") return {
|
|
15
15
|
error: "Invalid URL after template replacement",
|
|
16
16
|
success: !1
|
|
17
17
|
};
|
|
18
|
-
let
|
|
19
|
-
body:
|
|
20
|
-
headers:
|
|
18
|
+
let u = e.payloadTemplate ? C(e.payloadTemplate, r, i) : void 0, d = await S({
|
|
19
|
+
body: u === void 0 ? e.sendAllFormValues ? JSON.stringify(b(r, i)) : void 0 : JSON.stringify(u),
|
|
20
|
+
headers: c(s(a, r), s(e.headers, r)),
|
|
21
21
|
method: e.method || "POST",
|
|
22
|
-
queryParams:
|
|
23
|
-
url:
|
|
22
|
+
queryParams: s(e.queryParams, r),
|
|
23
|
+
url: l
|
|
24
24
|
});
|
|
25
|
-
if (!
|
|
26
|
-
data:
|
|
27
|
-
error:
|
|
25
|
+
if (!d.success) return {
|
|
26
|
+
data: d.data,
|
|
27
|
+
error: d.error,
|
|
28
28
|
success: !1
|
|
29
29
|
};
|
|
30
|
-
let
|
|
31
|
-
let t =
|
|
30
|
+
let f = e.redirectUrl ? (() => {
|
|
31
|
+
let t = n(e.redirectUrl, d.data);
|
|
32
32
|
return t && t.trim() !== "" ? t : void 0;
|
|
33
33
|
})() : void 0;
|
|
34
34
|
return {
|
|
35
|
-
data:
|
|
36
|
-
redirectUrl:
|
|
35
|
+
data: d.data,
|
|
36
|
+
redirectUrl: f,
|
|
37
37
|
success: !0
|
|
38
38
|
};
|
|
39
39
|
}, I = (e) => {
|
|
40
40
|
e && (e.startsWith("http://") || e.startsWith("https://") ? window.location.href = e : window.history?.pushState ? (window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate"))) : window.location.href = e);
|
|
41
|
-
}, ne = (
|
|
42
|
-
let [
|
|
43
|
-
let
|
|
44
|
-
return
|
|
45
|
-
}, [
|
|
46
|
-
if (!
|
|
47
|
-
let
|
|
48
|
-
if (!
|
|
49
|
-
|
|
41
|
+
}, ne = (t, n, i, a, o, s) => {
|
|
42
|
+
let [c, l] = j(!1), [u, d] = j(null), f = k(() => {
|
|
43
|
+
let e = t.find((e) => r(e) && e.data?.type === "submit");
|
|
44
|
+
return e && r(e) ? e : null;
|
|
45
|
+
}, [t]), p = E(async (t) => {
|
|
46
|
+
if (!f?.data?.submitConfig) return null;
|
|
47
|
+
let r = f.data.submitConfig;
|
|
48
|
+
if (!r.url || r.url.trim() === "") return null;
|
|
49
|
+
d(null), r.showLoading !== !1 && l(!0);
|
|
50
50
|
try {
|
|
51
|
-
let c = await F(
|
|
51
|
+
let c = await F(r, n, a, o, s);
|
|
52
52
|
if (c.success) {
|
|
53
|
-
let
|
|
54
|
-
if (
|
|
55
|
-
message:
|
|
53
|
+
let n = e(r.successMessage, i);
|
|
54
|
+
if (n && d({
|
|
55
|
+
message: n,
|
|
56
56
|
type: "success"
|
|
57
|
-
}),
|
|
57
|
+
}), t && t(c.data), c.redirectUrl) {
|
|
58
58
|
let e = c.redirectUrl;
|
|
59
59
|
setTimeout(() => I(e), 1e3);
|
|
60
60
|
}
|
|
61
|
-
} else
|
|
62
|
-
message:
|
|
61
|
+
} else d({
|
|
62
|
+
message: e(r.errorMessage, i) || c.error || "An error occurred during submission",
|
|
63
63
|
type: "error"
|
|
64
64
|
});
|
|
65
65
|
return c;
|
|
66
|
-
} catch (
|
|
67
|
-
let
|
|
68
|
-
return
|
|
69
|
-
message:
|
|
66
|
+
} catch (t) {
|
|
67
|
+
let n = e(r.errorMessage, i) || (t instanceof Error ? t.message : "An unexpected error occurred");
|
|
68
|
+
return d({
|
|
69
|
+
message: n,
|
|
70
70
|
type: "error"
|
|
71
71
|
}), {
|
|
72
|
-
error:
|
|
72
|
+
error: n,
|
|
73
73
|
success: !1
|
|
74
74
|
};
|
|
75
75
|
} finally {
|
|
76
|
-
|
|
76
|
+
l(!1);
|
|
77
77
|
}
|
|
78
78
|
}, [
|
|
79
|
-
|
|
80
|
-
t,
|
|
79
|
+
f,
|
|
81
80
|
n,
|
|
82
|
-
|
|
81
|
+
i,
|
|
83
82
|
a,
|
|
84
|
-
o
|
|
83
|
+
o,
|
|
84
|
+
s
|
|
85
85
|
]);
|
|
86
86
|
return {
|
|
87
87
|
clearSubmitMessage: E(() => {
|
|
88
|
-
|
|
88
|
+
d(null);
|
|
89
89
|
}, []),
|
|
90
|
-
handleSubmitWithConfig:
|
|
91
|
-
hasSubmitConfig: !!
|
|
92
|
-
isSubmitting:
|
|
93
|
-
submitButtonNode:
|
|
94
|
-
submitMessage:
|
|
90
|
+
handleSubmitWithConfig: p,
|
|
91
|
+
hasSubmitConfig: !!f?.data?.submitConfig,
|
|
92
|
+
isSubmitting: c,
|
|
93
|
+
submitButtonNode: f,
|
|
94
|
+
submitMessage: u
|
|
95
95
|
};
|
|
96
96
|
}, L = (e) => e == null ? null : typeof e == "boolean" || typeof e == "number" ? e : typeof e == "string" ? e === "" ? null : e : typeof e == "object" ? JSON.stringify(e) : String(e), R = (e, t, n) => {
|
|
97
97
|
let r = L(e), i = L(t);
|
|
@@ -128,23 +128,23 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
128
128
|
default: return !1;
|
|
129
129
|
}
|
|
130
130
|
}, z = (e, t, n) => {
|
|
131
|
-
let { field:
|
|
132
|
-
if (!(
|
|
133
|
-
let
|
|
134
|
-
if (
|
|
135
|
-
let e = n.get(
|
|
136
|
-
e &&
|
|
131
|
+
let { field: i, operator: a, value: o } = e;
|
|
132
|
+
if (!(i && a) || o === void 0) return !0;
|
|
133
|
+
let s = t[i];
|
|
134
|
+
if (s === void 0 && n) {
|
|
135
|
+
let e = n.get(i);
|
|
136
|
+
e && r(e) && (s = t[e.id]);
|
|
137
137
|
}
|
|
138
|
-
return Array.isArray(
|
|
138
|
+
return Array.isArray(s) ? a === "===" ? s.some((e) => R(e, o, "===")) || R(s, o, "===") : a === "!==" ? s.every((e) => R(e, o, "!==")) && R(s, o, "!==") : s.some((e) => R(e, o, a)) : R(s, o, a);
|
|
139
139
|
}, B = (e, t, n) => {
|
|
140
140
|
if (!e || e.length === 0) return !0;
|
|
141
141
|
if (e.length === 1) return z(e[0], t, n);
|
|
142
142
|
let r = z(e[0], t, n);
|
|
143
143
|
for (let i = 1; i < e.length; i += 1) {
|
|
144
|
-
let
|
|
145
|
-
if (c ===
|
|
146
|
-
if (r &&=
|
|
147
|
-
} else if (c ===
|
|
144
|
+
let o = e[i], s = z(o, t, n), c = e[i - 1].logicalOperator || a.AND;
|
|
145
|
+
if (c === a.AND) {
|
|
146
|
+
if (r &&= s, !r) return !1;
|
|
147
|
+
} else if (c === a.OR && (r ||= s, r)) return !0;
|
|
148
148
|
}
|
|
149
149
|
return r;
|
|
150
150
|
}, V = (e) => {
|
|
@@ -154,38 +154,38 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
154
154
|
n ? n.push(e) : t.set(e.source, [e]);
|
|
155
155
|
}), t;
|
|
156
156
|
}, re = (e, t, n) => {
|
|
157
|
-
let
|
|
157
|
+
let i = [], a = [], o = [];
|
|
158
158
|
e.forEach((e) => {
|
|
159
159
|
let t = e.data?.isFallback, n = e.data?.conditions?.length;
|
|
160
|
-
t ?
|
|
160
|
+
t ? o.push(e) : n ? a.push(e) : i.push(e);
|
|
161
161
|
});
|
|
162
|
-
let
|
|
163
|
-
if (
|
|
164
|
-
edgesToFollow:
|
|
162
|
+
let s = [...i];
|
|
163
|
+
if (a.length === 0) return o.length > 0 && s.length === 0 && s.push(...o), {
|
|
164
|
+
edgesToFollow: s,
|
|
165
165
|
waitingForInput: !1
|
|
166
166
|
};
|
|
167
|
-
if (!
|
|
168
|
-
let
|
|
169
|
-
return
|
|
167
|
+
if (!a.every((e) => {
|
|
168
|
+
let i = e.data?.conditions;
|
|
169
|
+
return i ? i.every((e) => {
|
|
170
170
|
if (!e.field) return !0;
|
|
171
|
-
let
|
|
172
|
-
return v(
|
|
171
|
+
let i = n.get(e.field);
|
|
172
|
+
return v(r(i) ? i.id : e.field, t);
|
|
173
173
|
}) : !1;
|
|
174
|
-
})) return
|
|
175
|
-
edgesToFollow:
|
|
176
|
-
waitingForInput:
|
|
174
|
+
})) return o.length > 0 && s.push(...o), {
|
|
175
|
+
edgesToFollow: s,
|
|
176
|
+
waitingForInput: s.length === 0
|
|
177
177
|
};
|
|
178
|
-
let
|
|
179
|
-
return
|
|
180
|
-
edgesToFollow:
|
|
178
|
+
let c = a.filter((e) => B(e.data?.conditions, t, n));
|
|
179
|
+
return c.length > 0 ? (s.push(...c), {
|
|
180
|
+
edgesToFollow: s,
|
|
181
181
|
waitingForInput: !1
|
|
182
|
-
}) : (
|
|
183
|
-
edgesToFollow:
|
|
182
|
+
}) : (s.push(...o), {
|
|
183
|
+
edgesToFollow: s,
|
|
184
184
|
waitingForInput: !1
|
|
185
185
|
});
|
|
186
186
|
}, H = (e, t) => !t.some((t) => t.target === e), U = (e, t) => {
|
|
187
187
|
let n = e.filter((e) => H(e.id, t));
|
|
188
|
-
return n.find(
|
|
188
|
+
return n.find(r) || n[0];
|
|
189
189
|
}, W = (e, t, n, r) => {
|
|
190
190
|
e.forEach((e) => {
|
|
191
191
|
let i = r.get(e);
|
|
@@ -232,7 +232,7 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
232
232
|
visibleNodes: p,
|
|
233
233
|
visibleRootNodes: m
|
|
234
234
|
};
|
|
235
|
-
}, ae = (e) => e.filter((e) => !
|
|
235
|
+
}, ae = (e) => e.filter((e) => !u(e)).reduce((e, t) => {
|
|
236
236
|
let n = t.parentId ?? null, r = e.at(-1);
|
|
237
237
|
return r && r.groupId === n ? [...e.slice(0, -1), {
|
|
238
238
|
...r,
|
|
@@ -246,52 +246,52 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
246
246
|
if (Array.isArray(e)) return `[${e.map(G).join(",")}]`;
|
|
247
247
|
let t = e;
|
|
248
248
|
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${G(t[e])}`).join(",")}}`;
|
|
249
|
-
}, K = ({ baseUrl: e, components:
|
|
249
|
+
}, K = ({ baseUrl: e, components: t, flow: n, googleApiKey: i, headers: a, language: o, onChange: s, onSubmit: l, showPoweredBy: p, theme: m, validate: g, validationMode: v, initialValues: y = {} }) => {
|
|
250
250
|
let S = te(), w = k(() => ({
|
|
251
251
|
baseUrl: e ?? S?.baseUrl,
|
|
252
252
|
components: {
|
|
253
|
-
form:
|
|
253
|
+
form: t?.form ?? S?.components?.form,
|
|
254
254
|
inputs: {
|
|
255
255
|
...S?.components?.inputs,
|
|
256
|
-
...
|
|
256
|
+
...t?.inputs
|
|
257
257
|
},
|
|
258
|
-
loadingSkeleton:
|
|
259
|
-
step:
|
|
260
|
-
submitButton:
|
|
261
|
-
submitButtonWrapper:
|
|
258
|
+
loadingSkeleton: t?.loadingSkeleton ?? S?.components?.loadingSkeleton,
|
|
259
|
+
step: t?.step ?? S?.components?.step,
|
|
260
|
+
submitButton: t?.submitButton ?? S?.components?.submitButton,
|
|
261
|
+
submitButtonWrapper: t?.submitButtonWrapper ?? S?.components?.submitButtonWrapper,
|
|
262
262
|
ui: {
|
|
263
263
|
...S?.components?.ui,
|
|
264
|
-
...
|
|
264
|
+
...t?.ui
|
|
265
265
|
}
|
|
266
266
|
},
|
|
267
267
|
googleApiKey: i ?? S?.googleApiKey,
|
|
268
|
-
headers:
|
|
269
|
-
language:
|
|
270
|
-
showPoweredBy:
|
|
271
|
-
theme:
|
|
268
|
+
headers: c(S?.headers, a),
|
|
269
|
+
language: o ?? S?.language ?? "en",
|
|
270
|
+
showPoweredBy: p ?? S?.showPoweredBy ?? !0,
|
|
271
|
+
theme: m ?? S?.theme ?? "dark",
|
|
272
272
|
validationMode: v ?? S?.validationMode ?? "onSubmit"
|
|
273
273
|
}), [
|
|
274
274
|
e,
|
|
275
|
-
|
|
275
|
+
t,
|
|
276
276
|
S,
|
|
277
277
|
i,
|
|
278
278
|
a,
|
|
279
|
-
|
|
279
|
+
o,
|
|
280
|
+
p,
|
|
280
281
|
m,
|
|
281
|
-
h,
|
|
282
282
|
v
|
|
283
|
-
]), T = k(() =>
|
|
283
|
+
]), T = k(() => n?.nodes ?? [], [n]), D = k(() => n?.edges ?? [], [n]), M = k(() => x(T), [T]), N = ee(w.language), P = A({}), F = A(null), [I, L] = j({}), [R, z] = j(() => h(y, M)), B = k(() => G(y), [y]), V = A(B), { endOfPathReached: re, visibleNodes: H, visibleRootNodes: U } = k(() => ie(T, D, R), [
|
|
284
284
|
T,
|
|
285
285
|
D,
|
|
286
286
|
R
|
|
287
287
|
]), W = k(() => x(H), [H]), K = k(() => ae(H), [H]), oe = k(() => {
|
|
288
288
|
let e = /* @__PURE__ */ new Map();
|
|
289
289
|
return T.forEach((t) => {
|
|
290
|
-
|
|
290
|
+
u(t) && e.set(t.id, t);
|
|
291
291
|
}), e;
|
|
292
|
-
}, [T]), [q, J] = j(0), Y = K.length === 0 ? 0 : Math.min(q, K.length - 1), X = K[Y], se = X?.groupId ? oe.get(X.groupId) : void 0, ce = Y === 0, le = K.length === 0 || Y >= K.length - 1, { clearSubmitMessage: ue, handleSubmitWithConfig: de, hasSubmitConfig: fe, isSubmitting: pe, submitButtonNode: me, submitMessage: he } = ne(H, R, w.language, W, w.headers, w.baseUrl), ge = A(
|
|
292
|
+
}, [T]), [q, J] = j(0), Y = K.length === 0 ? 0 : Math.min(q, K.length - 1), X = K[Y], se = X?.groupId ? oe.get(X.groupId) : void 0, ce = Y === 0, le = K.length === 0 || Y >= K.length - 1, { clearSubmitMessage: ue, handleSubmitWithConfig: de, hasSubmitConfig: fe, isSubmitting: pe, submitButtonNode: me, submitMessage: he } = ne(H, R, w.language, W, w.headers, w.baseUrl), ge = A(s), _e = A(g), Z = k(() => b(R, W), [R, W]), Q = k(() => {
|
|
293
293
|
let e = me?.data?.submitConfig?.payloadTemplate;
|
|
294
|
-
return e ?
|
|
294
|
+
return e ? C(e, R, W) ?? Z : Z;
|
|
295
295
|
}, [
|
|
296
296
|
me,
|
|
297
297
|
R,
|
|
@@ -318,27 +318,27 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
318
318
|
}, []), $ = E((e) => {
|
|
319
319
|
let t = {};
|
|
320
320
|
H.forEach((e) => {
|
|
321
|
-
if (
|
|
321
|
+
if (r(e)) {
|
|
322
322
|
let n = e.id, r = R[n];
|
|
323
|
-
if (e.data.required &&
|
|
323
|
+
if (e.data.required && f(r)) {
|
|
324
324
|
t[n] = N(e.data.errorMessage) || N("validation.required");
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
|
-
if (!
|
|
327
|
+
if (!f(r) && e.data.pattern) try {
|
|
328
328
|
new RegExp(e.data.pattern).test(String(r)) || (t[n] = N(e.data.errorMessage) || N("validation.invalidFormat"));
|
|
329
329
|
} catch (e) {
|
|
330
330
|
console.error(`Invalid pattern for field ${n}:`, e);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
});
|
|
334
|
-
let n = e ? e(R, H) : {},
|
|
334
|
+
let n = e ? e(R, H) : {}, i = {
|
|
335
335
|
...t,
|
|
336
336
|
...n
|
|
337
337
|
};
|
|
338
|
-
return L(
|
|
339
|
-
errors:
|
|
338
|
+
return L(i), {
|
|
339
|
+
errors: i,
|
|
340
340
|
hasCustomErrors: Object.keys(n).length > 0,
|
|
341
|
-
isValid: Object.keys(
|
|
341
|
+
isValid: Object.keys(i).length === 0
|
|
342
342
|
};
|
|
343
343
|
}, [
|
|
344
344
|
H,
|
|
@@ -353,29 +353,29 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
353
353
|
if (!e) return !1;
|
|
354
354
|
if (fe) {
|
|
355
355
|
let e = await de((e) => {
|
|
356
|
-
|
|
356
|
+
l && l(Q, { httpResponse: e });
|
|
357
357
|
});
|
|
358
|
-
if (e === null) return
|
|
358
|
+
if (e === null) return l?.(Q), !0;
|
|
359
359
|
if (!e.success) return !0;
|
|
360
|
-
} else
|
|
360
|
+
} else l && l(Q);
|
|
361
361
|
return !0;
|
|
362
362
|
}, [
|
|
363
363
|
$,
|
|
364
364
|
fe,
|
|
365
365
|
de,
|
|
366
|
-
|
|
366
|
+
l,
|
|
367
367
|
Q
|
|
368
368
|
]), Ce = k(() => {
|
|
369
369
|
if (!X) return [];
|
|
370
370
|
let e = [];
|
|
371
371
|
return X.nodes.forEach((t) => {
|
|
372
|
-
|
|
372
|
+
r(t) && t.data.type !== "submit" && t.data.required && f(R[t.id]) && e.push(N(t.data.label) || t.id);
|
|
373
373
|
}), e;
|
|
374
374
|
}, [
|
|
375
375
|
X,
|
|
376
376
|
R,
|
|
377
377
|
N
|
|
378
|
-
]), we = k(() => H.some((e) =>
|
|
378
|
+
]), we = k(() => H.some((e) => r(e) && e.data.type === "submit"), [H]), Te = k(() => X ? X.nodes.every((e) => !r(e) || !e.data.required || e.data.type === "submit" ? !0 : !f(R[e.id])) : !1, [X, R]), Ee = k(() => {
|
|
379
379
|
let e = Object.keys(I);
|
|
380
380
|
return e.length > 0 ? e[0] : void 0;
|
|
381
381
|
}, [I]);
|
|
@@ -386,15 +386,15 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
386
386
|
}
|
|
387
387
|
q > K.length - 1 && J(K.length - 1);
|
|
388
388
|
}, [K.length, q]), O(() => {
|
|
389
|
-
ge.current =
|
|
390
|
-
}, [
|
|
391
|
-
_e.current =
|
|
392
|
-
}, [
|
|
389
|
+
ge.current = s;
|
|
390
|
+
}, [s]), O(() => {
|
|
391
|
+
_e.current = g;
|
|
392
|
+
}, [g]), O(() => {
|
|
393
393
|
ge.current?.(Z);
|
|
394
394
|
}, [Z]), O(() => {
|
|
395
395
|
w.validationMode === "onChange" && $(_e.current);
|
|
396
396
|
}, [w.validationMode, $]), O(() => {
|
|
397
|
-
let e =
|
|
397
|
+
let e = d(M, R, P.current);
|
|
398
398
|
Object.keys(e).length > 0 && ye(e), P.current = R;
|
|
399
399
|
}, [
|
|
400
400
|
R,
|
|
@@ -406,7 +406,7 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
406
406
|
let n = [...e].filter((e) => !t.has(e)), r = {};
|
|
407
407
|
W.forEach((t) => {
|
|
408
408
|
if (e.has(t.id) || R[t.id] !== void 0) return;
|
|
409
|
-
let n =
|
|
409
|
+
let n = _(t, R);
|
|
410
410
|
n !== void 0 && (r[t.id] = n);
|
|
411
411
|
}), !(n.length === 0 && Object.keys(r).length === 0) && (z((e) => {
|
|
412
412
|
let t = {
|
|
@@ -423,7 +423,7 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
423
423
|
}), t ? r : e;
|
|
424
424
|
}));
|
|
425
425
|
}, [W, R]), O(() => {
|
|
426
|
-
V.current !== B && (V.current = B, z(
|
|
426
|
+
V.current !== B && (V.current = B, z(h(y, M)), L({}), F.current = null);
|
|
427
427
|
}, [
|
|
428
428
|
B,
|
|
429
429
|
y,
|
|
@@ -474,62 +474,62 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
474
474
|
id: e,
|
|
475
475
|
label: t ? y(t, r) : e
|
|
476
476
|
};
|
|
477
|
-
}), se = ({ DefaultFormWrapper: t, DefaultInputWrapper: n, DefaultSubmitButton:
|
|
478
|
-
let
|
|
477
|
+
}), se = ({ DefaultFormWrapper: t, DefaultInputWrapper: n, DefaultSubmitButton: a, DefaultSubmitButtonWrapper: s, config: c, defaultInputRenderers: u, defaultUI: d, formErrors: f, formValues: h, inputNodes: ee, isSubmitting: g, missingRequiredFields: _, setFieldValue: v }) => {
|
|
478
|
+
let y = k(() => c.components.form || t, [c.components.form, t]), b = k(() => c.components.submitButton || a, [c.components.submitButton, a]), x = k(() => c.components.submitButtonWrapper || s || w, [c.components.submitButtonWrapper, s]);
|
|
479
479
|
return {
|
|
480
|
-
FormWrapper:
|
|
480
|
+
FormWrapper: y,
|
|
481
481
|
renderNode: E(function(t) {
|
|
482
|
-
let { type:
|
|
483
|
-
switch (
|
|
484
|
-
case
|
|
485
|
-
if (!
|
|
486
|
-
let
|
|
487
|
-
return
|
|
482
|
+
let { type: a } = t;
|
|
483
|
+
switch (a) {
|
|
484
|
+
case i.input: {
|
|
485
|
+
if (!r(t)) return null;
|
|
486
|
+
let i = t.data, a = i.type || "text", s = c.components.inputs?.[a], l = u[a], d = s || l, y = t.id, b = (e) => v(y, e), x = h[y], S = f[y], C = e(i.label, c.language), w = p(i, c.language), T = e(i.helperText, c.language), E = m(t), D = o(C), O = o(w), k = o(T);
|
|
487
|
+
return d ? /* @__PURE__ */ M(n, {
|
|
488
488
|
node: t,
|
|
489
|
-
children: /* @__PURE__ */ M(
|
|
489
|
+
children: /* @__PURE__ */ M(d, {
|
|
490
490
|
field: {
|
|
491
|
-
"aria-invalid":
|
|
491
|
+
"aria-invalid": S ? !0 : void 0,
|
|
492
492
|
id: t.id,
|
|
493
493
|
name: E,
|
|
494
494
|
placeholder: O,
|
|
495
|
-
required:
|
|
496
|
-
value:
|
|
495
|
+
required: i.required,
|
|
496
|
+
value: x
|
|
497
497
|
},
|
|
498
498
|
extra: {
|
|
499
|
-
error:
|
|
499
|
+
error: S,
|
|
500
500
|
helperText: k,
|
|
501
|
-
isSubmitting:
|
|
501
|
+
isSubmitting: g,
|
|
502
502
|
label: D,
|
|
503
|
-
missingDependencies: X(t,
|
|
504
|
-
missingRequiredFields:
|
|
503
|
+
missingDependencies: X(t, h, ee, c.language),
|
|
504
|
+
missingRequiredFields: _,
|
|
505
505
|
node: t,
|
|
506
|
-
setValue:
|
|
506
|
+
setValue: b
|
|
507
507
|
}
|
|
508
|
-
},
|
|
509
|
-
}, t.id) : (console.warn("No renderer found for input type:",
|
|
508
|
+
}, a)
|
|
509
|
+
}, t.id) : (console.warn("No renderer found for input type:", a), null);
|
|
510
510
|
}
|
|
511
|
-
case
|
|
512
|
-
case
|
|
513
|
-
if (!
|
|
514
|
-
let
|
|
515
|
-
return
|
|
511
|
+
case i.group: return null;
|
|
512
|
+
case i.ui: {
|
|
513
|
+
if (!l(t)) return null;
|
|
514
|
+
let e = t.data.type || "title", n = c.components.ui?.[e], r = d[e], i = n || r;
|
|
515
|
+
return i ? /* @__PURE__ */ M(i, { node: t }, t.id) : null;
|
|
516
516
|
}
|
|
517
|
-
default: return console.warn("Unknown node type:",
|
|
517
|
+
default: return console.warn("Unknown node type:", a), null;
|
|
518
518
|
}
|
|
519
519
|
}, [
|
|
520
|
-
s,
|
|
521
|
-
d,
|
|
522
|
-
u,
|
|
523
|
-
ee,
|
|
524
|
-
p,
|
|
525
|
-
g,
|
|
526
|
-
f,
|
|
527
520
|
c,
|
|
528
|
-
|
|
521
|
+
h,
|
|
522
|
+
f,
|
|
523
|
+
v,
|
|
524
|
+
g,
|
|
525
|
+
_,
|
|
526
|
+
ee,
|
|
527
|
+
u,
|
|
528
|
+
d,
|
|
529
529
|
n
|
|
530
530
|
]),
|
|
531
|
-
SubmitButton:
|
|
532
|
-
SubmitButtonWrapper:
|
|
531
|
+
SubmitButton: b,
|
|
532
|
+
SubmitButtonWrapper: x
|
|
533
533
|
};
|
|
534
534
|
};
|
|
535
535
|
//#endregion
|