treege 3.0.0-beta.89 → 3.0.0-beta.90
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-BIjoDpUm.js → DefaultSubmitButton-NeSDqyzv.js} +120 -120
- package/dist/{ThemeContext-CiVygpDK.js → ThemeContext-CPsC8QIP.js} +87 -72
- package/dist/{editor-DH9ocYy4.js → editor-D3EmQ-8C.js} +235 -235
- package/dist/editor.js +2 -2
- package/dist/main.js +6 -6
- package/dist/{renderer-BIccXyWl.js → renderer-CNbSt_QW.js} +41 -41
- package/dist/renderer-native.js +801 -814
- package/dist/renderer.js +5 -5
- package/dist/{useRenderNode-D9gPe-xm.js → useRenderNode-CG466pNk.js} +123 -123
- package/package.json +1 -1
package/dist/renderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as y, L as b, S as x, _ as S, a as C, b as w, c as T, d as E, g as D, h as O, i as k, m as A, n as j, o as M, r as N, u as P, v as F, x as I, y as L } from "./DefaultSubmitButton-
|
|
3
|
-
import { a as R, c as z, i as B, l as V, n as H, o as U, r as W, s as G } from "./useRenderNode-
|
|
4
|
-
import { a as K, c as q, i as J, l as Y, n as X, o as Z, r as Q, s as $, t as ee } from "./renderer-
|
|
5
|
-
export { y as DefaultAddressInput, x as DefaultAutocompleteInput, I as DefaultCheckboxInput, w as DefaultDateInput, L as DefaultDateRangeInput, F as DefaultFileInput, S as DefaultHiddenInput, D as DefaultHttpInput, b as DefaultInputLabel, O as DefaultNumberInput, A as DefaultPasswordInput, E as DefaultRadioInput, P as DefaultSelectInput, T as DefaultSwitchInput, M as DefaultTextAreaInput, C as DefaultTextInput, k as DefaultTimeInput, N as DefaultTimeRangeInput, Z as Divider, g as ThemeProvider, $ as Title, K as TreegeRenderer, z as TreegeRendererProvider, ee as TreegeViewer, Y as TreegeViewerProvider, m as applyReferenceTransformation,
|
|
1
|
+
import { I as e, L as t, _ as n, a as r, b as i, c as a, g as o, h as s, i as c, l, m as u, n as d, o as f, q as p, r as m, s as h, t as g, v as _, y as v } from "./ThemeContext-CPsC8QIP.js";
|
|
2
|
+
import { C as y, L as b, S as x, _ as S, a as C, b as w, c as T, d as E, g as D, h as O, i as k, m as A, n as j, o as M, r as N, u as P, v as F, x as I, y as L } from "./DefaultSubmitButton-NeSDqyzv.js";
|
|
3
|
+
import { a as R, c as z, i as B, l as V, n as H, o as U, r as W, s as G } from "./useRenderNode-CG466pNk.js";
|
|
4
|
+
import { a as K, c as q, i as J, l as Y, n as X, o as Z, r as Q, s as $, t as ee } from "./renderer-CNbSt_QW.js";
|
|
5
|
+
export { y as DefaultAddressInput, x as DefaultAutocompleteInput, I as DefaultCheckboxInput, w as DefaultDateInput, L as DefaultDateRangeInput, F as DefaultFileInput, S as DefaultHiddenInput, D as DefaultHttpInput, b as DefaultInputLabel, O as DefaultNumberInput, A as DefaultPasswordInput, E as DefaultRadioInput, P as DefaultSelectInput, T as DefaultSwitchInput, M as DefaultTextAreaInput, C as DefaultTextInput, k as DefaultTimeInput, N as DefaultTimeRangeInput, Z as Divider, g as ThemeProvider, $ as Title, K as TreegeRenderer, z as TreegeRendererProvider, ee as TreegeViewer, Y as TreegeViewerProvider, m as applyReferenceTransformation, c as buildInitialFormValues, r as calculateReferenceFieldUpdates, f as checkFormFieldHasValue, h as convertFormValuesToNamedFormat, j as defaultInputRenderers, q as defaultUI, U as evaluateCondition, G as evaluateConditions, u as fileNameFromUrl, s as fileToSerializable, o as filesToSerializable, W as findStartNode, n as formatFileSize, B as getFlowRenderState, p as getTranslatedText, X as getViewerFields, a as isFieldEmpty, Q as isImageFile, _ as isRemoteFileData, R as isStartNode, v as normalizeSerializableFiles, l as resolveNodeDefaultValue, e as sanitize, t as sanitizeHttpResponse, i as serializableToFile, d as useTheme, H as useTreegeRenderer, V as useTreegeRendererConfig, J as viewerFieldsFromResponse };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e,
|
|
1
|
+
import { A as e, C as t, F as n, H as r, I as i, M as a, N as o, O as s, U as c, X as l, Y as u, Z as d, a as f, c as p, d as m, f as h, i as g, j as _, k as v, l as ee, o as y, p as b, q as x, s as S, u as C } from "./ThemeContext-CPsC8QIP.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
|
|
@@ -12,21 +12,21 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
12
12
|
...e,
|
|
13
13
|
...r
|
|
14
14
|
};
|
|
15
|
-
}, F = async (
|
|
16
|
-
if (!
|
|
15
|
+
}, F = async (n, r, i, c, l, u) => {
|
|
16
|
+
if (!n.url || n.url.trim() === "") return {
|
|
17
17
|
error: "No URL configured for submission",
|
|
18
18
|
success: !1
|
|
19
19
|
};
|
|
20
|
-
let d =
|
|
20
|
+
let d = o(_(n.url, r, { encode: !0 }), l);
|
|
21
21
|
if (!d || d.trim() === "") return {
|
|
22
22
|
error: "Invalid URL after template replacement",
|
|
23
23
|
success: !1
|
|
24
24
|
};
|
|
25
|
-
let f = S(r, i), p =
|
|
25
|
+
let f = S(r, i), p = n.payloadTemplate ? t(n.payloadTemplate, r, i) : void 0, m = ne(p === void 0 ? n.sendAllFormValues ? f : void 0 : p, u, f), h = await s({
|
|
26
26
|
body: m === void 0 ? void 0 : JSON.stringify(m),
|
|
27
|
-
headers: v(
|
|
28
|
-
method:
|
|
29
|
-
queryParams:
|
|
27
|
+
headers: v(a(c, r), a(n.headers, r)),
|
|
28
|
+
method: n.method || "POST",
|
|
29
|
+
queryParams: a(n.queryParams, r),
|
|
30
30
|
url: d
|
|
31
31
|
});
|
|
32
32
|
if (!h.success) return {
|
|
@@ -34,9 +34,9 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
34
34
|
error: h.error,
|
|
35
35
|
success: !1
|
|
36
36
|
};
|
|
37
|
-
let g =
|
|
38
|
-
let
|
|
39
|
-
return
|
|
37
|
+
let g = n.redirectUrl ? (() => {
|
|
38
|
+
let t = e(n.redirectUrl, h.data);
|
|
39
|
+
return t && t.trim() !== "" ? t : void 0;
|
|
40
40
|
})() : void 0;
|
|
41
41
|
return {
|
|
42
42
|
data: h.data,
|
|
@@ -45,34 +45,34 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
45
45
|
};
|
|
46
46
|
}, I = (e) => {
|
|
47
47
|
e && (typeof window > "u" || !window.location || (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));
|
|
48
|
-
}, re = (e, t, n, r,
|
|
49
|
-
let [
|
|
50
|
-
let t = e.find((e) =>
|
|
51
|
-
return t &&
|
|
52
|
-
}, [e]),
|
|
53
|
-
if (!
|
|
54
|
-
let
|
|
55
|
-
if (!
|
|
56
|
-
|
|
48
|
+
}, re = (e, t, n, r, i, a, o) => {
|
|
49
|
+
let [s, c] = j(!1), [u, d] = j(null), f = k(() => {
|
|
50
|
+
let t = e.find((e) => l(e) && e.data?.type === "submit");
|
|
51
|
+
return t && l(t) ? t : null;
|
|
52
|
+
}, [e]), p = E(async (e) => {
|
|
53
|
+
if (!f?.data?.submitConfig) return null;
|
|
54
|
+
let s = f.data.submitConfig;
|
|
55
|
+
if (!s.url || s.url.trim() === "") return null;
|
|
56
|
+
d(null), s.showLoading !== !1 && c(!0);
|
|
57
57
|
try {
|
|
58
|
-
let
|
|
59
|
-
if (
|
|
60
|
-
let t =
|
|
61
|
-
if (t &&
|
|
58
|
+
let c = await F(s, t, r, i, a, o);
|
|
59
|
+
if (c.success) {
|
|
60
|
+
let t = x(s.successMessage, n);
|
|
61
|
+
if (t && d({
|
|
62
62
|
message: t,
|
|
63
63
|
type: "success"
|
|
64
|
-
}), e && e(
|
|
65
|
-
let e =
|
|
64
|
+
}), e && e(c.data), c.redirectUrl) {
|
|
65
|
+
let e = c.redirectUrl;
|
|
66
66
|
setTimeout(() => I(e), 1e3);
|
|
67
67
|
}
|
|
68
|
-
} else
|
|
69
|
-
message:
|
|
68
|
+
} else d({
|
|
69
|
+
message: x(s.errorMessage, n) || c.error || "An error occurred during submission",
|
|
70
70
|
type: "error"
|
|
71
71
|
});
|
|
72
|
-
return
|
|
72
|
+
return c;
|
|
73
73
|
} catch (e) {
|
|
74
|
-
let t =
|
|
75
|
-
return
|
|
74
|
+
let t = x(s.errorMessage, n) || (e instanceof Error ? e.message : "An unexpected error occurred");
|
|
75
|
+
return d({
|
|
76
76
|
message: t,
|
|
77
77
|
type: "error"
|
|
78
78
|
}), {
|
|
@@ -80,26 +80,26 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
80
80
|
success: !1
|
|
81
81
|
};
|
|
82
82
|
} finally {
|
|
83
|
-
|
|
83
|
+
c(!1);
|
|
84
84
|
}
|
|
85
85
|
}, [
|
|
86
|
-
|
|
86
|
+
f,
|
|
87
87
|
t,
|
|
88
88
|
n,
|
|
89
89
|
r,
|
|
90
|
+
i,
|
|
90
91
|
a,
|
|
91
|
-
|
|
92
|
-
c
|
|
92
|
+
o
|
|
93
93
|
]);
|
|
94
94
|
return {
|
|
95
95
|
clearSubmitMessage: E(() => {
|
|
96
|
-
|
|
96
|
+
d(null);
|
|
97
97
|
}, []),
|
|
98
|
-
handleSubmitWithConfig:
|
|
99
|
-
hasSubmitConfig: !!
|
|
100
|
-
isSubmitting:
|
|
101
|
-
submitButtonNode:
|
|
102
|
-
submitMessage:
|
|
98
|
+
handleSubmitWithConfig: p,
|
|
99
|
+
hasSubmitConfig: !!f?.data?.submitConfig,
|
|
100
|
+
isSubmitting: s,
|
|
101
|
+
submitButtonNode: f,
|
|
102
|
+
submitMessage: u
|
|
103
103
|
};
|
|
104
104
|
}, 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) => {
|
|
105
105
|
let r = L(e), i = L(t);
|
|
@@ -138,17 +138,17 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
138
138
|
}, z = (e, t, n) => {
|
|
139
139
|
let { field: r, operator: i, value: a } = e;
|
|
140
140
|
if (!(r && i) || a === void 0) return !0;
|
|
141
|
-
let
|
|
142
|
-
return Array.isArray(
|
|
141
|
+
let o = t[r], s = o === void 0 && n ? n.get(r) : void 0, c = s && l(s) ? t[s.id] : o;
|
|
142
|
+
return Array.isArray(c) ? i === "===" ? c.some((e) => R(e, a, "===")) || R(c, a, "===") : i === "!==" ? c.every((e) => R(e, a, "!==")) && R(c, a, "!==") : c.some((e) => R(e, a, i)) : R(c, a, i);
|
|
143
143
|
}, B = (e, t, n) => {
|
|
144
144
|
if (!e || e.length === 0) return !0;
|
|
145
145
|
if (e.length === 1) return z(e[0], t, n);
|
|
146
146
|
let r = z(e[0], t, n);
|
|
147
147
|
for (let i = 1; i < e.length; i += 1) {
|
|
148
|
-
let a = e[i], o = z(a, t, n), s = e[i - 1].logicalOperator ||
|
|
149
|
-
if (s ===
|
|
148
|
+
let a = e[i], o = z(a, t, n), s = e[i - 1].logicalOperator || c.AND;
|
|
149
|
+
if (s === c.AND) {
|
|
150
150
|
if (r &&= o, !r) return !1;
|
|
151
|
-
} else if (s ===
|
|
151
|
+
} else if (s === c.OR && (r ||= o, r)) return !0;
|
|
152
152
|
}
|
|
153
153
|
return r;
|
|
154
154
|
}, V = (e) => {
|
|
@@ -163,9 +163,9 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
163
163
|
let t = e.data?.isFallback, n = e.data?.conditions?.length;
|
|
164
164
|
t ? a.push(e) : n ? i.push(e) : r.push(e);
|
|
165
165
|
});
|
|
166
|
-
let
|
|
167
|
-
if (i.length === 0) return a.length > 0 &&
|
|
168
|
-
edgesToFollow:
|
|
166
|
+
let o = [...r];
|
|
167
|
+
if (i.length === 0) return a.length > 0 && o.length === 0 && o.push(...a), {
|
|
168
|
+
edgesToFollow: o,
|
|
169
169
|
waitingForInput: !1
|
|
170
170
|
};
|
|
171
171
|
if (!i.every((e) => {
|
|
@@ -173,23 +173,23 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
173
173
|
return r ? r.every((e) => {
|
|
174
174
|
if (!e.field) return !0;
|
|
175
175
|
let r = n.get(e.field);
|
|
176
|
-
return y(
|
|
176
|
+
return y(l(r) ? r.id : e.field, t);
|
|
177
177
|
}) : !1;
|
|
178
|
-
})) return a.length > 0 &&
|
|
179
|
-
edgesToFollow:
|
|
180
|
-
waitingForInput:
|
|
178
|
+
})) return a.length > 0 && o.push(...a), {
|
|
179
|
+
edgesToFollow: o,
|
|
180
|
+
waitingForInput: o.length === 0
|
|
181
181
|
};
|
|
182
|
-
let
|
|
183
|
-
return
|
|
184
|
-
edgesToFollow:
|
|
182
|
+
let s = i.filter((e) => B(e.data?.conditions, t, n));
|
|
183
|
+
return s.length > 0 ? (o.push(...s), {
|
|
184
|
+
edgesToFollow: o,
|
|
185
185
|
waitingForInput: !1
|
|
186
|
-
}) : (
|
|
187
|
-
edgesToFollow:
|
|
186
|
+
}) : (o.push(...a), {
|
|
187
|
+
edgesToFollow: o,
|
|
188
188
|
waitingForInput: !1
|
|
189
189
|
});
|
|
190
190
|
}, ie = (e, t) => !t.some((t) => t.target === e), U = (e, t) => {
|
|
191
191
|
let n = e.filter((e) => ie(e.id, t));
|
|
192
|
-
return n.find(
|
|
192
|
+
return n.find(l) || n[0];
|
|
193
193
|
}, ae = (e, t, n = /* @__PURE__ */ new Set()) => !e || n.has(e) ? [] : (n.add(e), [e, ...ae(t.get(e)?.parentId, t, n)]), W = (e, t, n, r) => {
|
|
194
194
|
e.forEach((e) => {
|
|
195
195
|
let i = n.get(e);
|
|
@@ -230,7 +230,7 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
230
230
|
visibleNodes: p,
|
|
231
231
|
visibleRootNodes: m
|
|
232
232
|
};
|
|
233
|
-
}, se = (e) => e.filter((e) => !
|
|
233
|
+
}, se = (e) => e.filter((e) => !u(e)).reduce((e, t) => {
|
|
234
234
|
let n = t.parentId ?? null, r = e.at(-1);
|
|
235
235
|
return r && r.groupId === n ? [...e.slice(0, -1), {
|
|
236
236
|
...r,
|
|
@@ -244,52 +244,52 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
244
244
|
if (Array.isArray(e)) return `[${e.map(G).join(",")}]`;
|
|
245
245
|
let t = e;
|
|
246
246
|
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${G(t[e])}`).join(",")}}`;
|
|
247
|
-
}, K = ({ baseUrl: e, components:
|
|
247
|
+
}, K = ({ baseUrl: e, components: r, extraPayload: i, flow: a, googleApiKey: o, headers: s, language: c, onChange: d, onSubmit: m, showPoweredBy: h, theme: _, validate: y, validationMode: b, initialValues: x = {} }) => {
|
|
248
248
|
let w = te(), T = k(() => ({
|
|
249
249
|
baseUrl: e ?? w?.baseUrl,
|
|
250
250
|
components: {
|
|
251
|
-
form:
|
|
251
|
+
form: r?.form ?? w?.components?.form,
|
|
252
252
|
inputs: {
|
|
253
253
|
...w?.components?.inputs,
|
|
254
|
-
...
|
|
254
|
+
...r?.inputs
|
|
255
255
|
},
|
|
256
|
-
loadingSkeleton:
|
|
257
|
-
step:
|
|
258
|
-
submitButton:
|
|
259
|
-
submitButtonWrapper:
|
|
256
|
+
loadingSkeleton: r?.loadingSkeleton ?? w?.components?.loadingSkeleton,
|
|
257
|
+
step: r?.step ?? w?.components?.step,
|
|
258
|
+
submitButton: r?.submitButton ?? w?.components?.submitButton,
|
|
259
|
+
submitButtonWrapper: r?.submitButtonWrapper ?? w?.components?.submitButtonWrapper,
|
|
260
260
|
ui: {
|
|
261
261
|
...w?.components?.ui,
|
|
262
|
-
...
|
|
262
|
+
...r?.ui
|
|
263
263
|
}
|
|
264
264
|
},
|
|
265
|
-
googleApiKey:
|
|
266
|
-
headers: v(w?.headers,
|
|
267
|
-
language:
|
|
268
|
-
showPoweredBy:
|
|
269
|
-
theme:
|
|
270
|
-
validationMode:
|
|
265
|
+
googleApiKey: o ?? w?.googleApiKey,
|
|
266
|
+
headers: v(w?.headers, s),
|
|
267
|
+
language: c ?? w?.language ?? "en",
|
|
268
|
+
showPoweredBy: h ?? w?.showPoweredBy ?? !0,
|
|
269
|
+
theme: _ ?? w?.theme ?? "dark",
|
|
270
|
+
validationMode: b ?? w?.validationMode ?? "onSubmit"
|
|
271
271
|
}), [
|
|
272
272
|
e,
|
|
273
|
-
|
|
273
|
+
r,
|
|
274
274
|
w,
|
|
275
|
+
o,
|
|
275
276
|
s,
|
|
276
277
|
c,
|
|
277
|
-
l,
|
|
278
|
-
m,
|
|
279
278
|
h,
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
_,
|
|
280
|
+
b
|
|
281
|
+
]), D = k(() => a?.nodes ?? [], [a]), M = k(() => a?.edges ?? [], [a]), N = k(() => C(D), [D]), P = n(T.language), F = A({}), I = A(null), [L, R] = j({}), [z, B] = j(() => g(x, N)), V = k(() => G(x), [x]), H = A(V), { endOfPathReached: ie, visibleNodes: U, visibleRootNodes: ae } = k(() => oe(D, M, z), [
|
|
282
282
|
D,
|
|
283
283
|
M,
|
|
284
284
|
z
|
|
285
285
|
]), W = k(() => C(U), [U]), K = k(() => se(U), [U]), ce = k(() => {
|
|
286
286
|
let e = /* @__PURE__ */ new Map();
|
|
287
287
|
return D.forEach((t) => {
|
|
288
|
-
|
|
288
|
+
u(t) && e.set(t.id, t);
|
|
289
289
|
}), e;
|
|
290
|
-
}, [D]), [q, J] = j(0), Y = K.length === 0 ? 0 : Math.min(q, K.length - 1), X = K[Y], le = X?.groupId ? ce.get(X.groupId) : void 0, ue = Y === 0, de = K.length === 0 || Y >= K.length - 1, { clearSubmitMessage: fe, handleSubmitWithConfig: pe, hasSubmitConfig: me, isSubmitting: he, submitButtonNode: ge, submitMessage: _e } = re(U, z, T.language, W, T.headers, T.baseUrl, i), ve = A(
|
|
290
|
+
}, [D]), [q, J] = j(0), Y = K.length === 0 ? 0 : Math.min(q, K.length - 1), X = K[Y], le = X?.groupId ? ce.get(X.groupId) : void 0, ue = Y === 0, de = K.length === 0 || Y >= K.length - 1, { clearSubmitMessage: fe, handleSubmitWithConfig: pe, hasSubmitConfig: me, isSubmitting: he, submitButtonNode: ge, submitMessage: _e } = re(U, z, T.language, W, T.headers, T.baseUrl, i), ve = A(d), Z = A(y), Q = k(() => S(z, W), [z, W]), ye = k(() => {
|
|
291
291
|
let e = ge?.data?.submitConfig?.payloadTemplate;
|
|
292
|
-
return e ?
|
|
292
|
+
return e ? t(e, z, W) ?? Q : Q;
|
|
293
293
|
}, [
|
|
294
294
|
ge,
|
|
295
295
|
z,
|
|
@@ -316,7 +316,7 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
316
316
|
}, []), $ = E((e) => {
|
|
317
317
|
let t = {};
|
|
318
318
|
U.forEach((e) => {
|
|
319
|
-
if (
|
|
319
|
+
if (l(e)) {
|
|
320
320
|
let n = e.id, r = z[n];
|
|
321
321
|
if (e.data.required && p(r)) {
|
|
322
322
|
t[n] = P(e.data.errorMessage) || P("validation.required");
|
|
@@ -352,17 +352,17 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
352
352
|
let t = ne(ye, i, Q);
|
|
353
353
|
if (me) {
|
|
354
354
|
let e = await pe((e) => {
|
|
355
|
-
|
|
355
|
+
m && m(t, { httpResponse: e });
|
|
356
356
|
});
|
|
357
|
-
if (e === null) return
|
|
357
|
+
if (e === null) return m?.(t), !0;
|
|
358
358
|
if (!e.success) return !0;
|
|
359
|
-
} else
|
|
359
|
+
} else m && m(t);
|
|
360
360
|
return !0;
|
|
361
361
|
}, [
|
|
362
362
|
$,
|
|
363
363
|
me,
|
|
364
364
|
pe,
|
|
365
|
-
|
|
365
|
+
m,
|
|
366
366
|
ye,
|
|
367
367
|
i,
|
|
368
368
|
Q
|
|
@@ -370,13 +370,13 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
370
370
|
if (!X) return [];
|
|
371
371
|
let e = [];
|
|
372
372
|
return X.nodes.forEach((t) => {
|
|
373
|
-
|
|
373
|
+
l(t) && t.data.type !== "submit" && t.data.required && p(z[t.id]) && e.push(P(t.data.label) || t.id);
|
|
374
374
|
}), e;
|
|
375
375
|
}, [
|
|
376
376
|
X,
|
|
377
377
|
z,
|
|
378
378
|
P
|
|
379
|
-
]), Ee = k(() => U.some((e) =>
|
|
379
|
+
]), Ee = k(() => U.some((e) => l(e) && e.data.type === "submit"), [U]), De = k(() => X ? X.nodes.every((e) => !l(e) || !e.data.required || e.data.type === "submit" ? !0 : !p(z[e.id])) : !1, [X, z]), Oe = k(() => {
|
|
380
380
|
let e = Object.keys(L);
|
|
381
381
|
return e.length > 0 ? e[0] : void 0;
|
|
382
382
|
}, [L]);
|
|
@@ -387,10 +387,10 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
387
387
|
}
|
|
388
388
|
q > K.length - 1 && J(K.length - 1);
|
|
389
389
|
}, [K.length, q]), O(() => {
|
|
390
|
-
ve.current =
|
|
391
|
-
}, [
|
|
392
|
-
Z.current =
|
|
393
|
-
}, [
|
|
390
|
+
ve.current = d;
|
|
391
|
+
}, [d]), O(() => {
|
|
392
|
+
Z.current = y;
|
|
393
|
+
}, [y]), O(() => {
|
|
394
394
|
ve.current?.(Q);
|
|
395
395
|
}, [Q]), O(() => {
|
|
396
396
|
T.validationMode === "onChange" && $(Z.current);
|
|
@@ -424,10 +424,10 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
424
424
|
}), t ? r : e;
|
|
425
425
|
}));
|
|
426
426
|
}, [W, z]), O(() => {
|
|
427
|
-
H.current !== V && (H.current = V, B(g(
|
|
427
|
+
H.current !== V && (H.current = V, B(g(x, N)), R({}), I.current = null);
|
|
428
428
|
}, [
|
|
429
429
|
V,
|
|
430
|
-
|
|
430
|
+
x,
|
|
431
431
|
N
|
|
432
432
|
]), {
|
|
433
433
|
canContinueStep: De,
|
|
@@ -475,62 +475,62 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
475
475
|
id: e,
|
|
476
476
|
label: t ? b(t, r) : e
|
|
477
477
|
};
|
|
478
|
-
}), le = ({ DefaultFormWrapper: e, DefaultInputLabel:
|
|
479
|
-
let
|
|
478
|
+
}), le = ({ DefaultFormWrapper: e, DefaultInputLabel: t, DefaultInputWrapper: n, DefaultSubmitButton: a, DefaultSubmitButtonWrapper: o, config: s, defaultInputRenderers: c, defaultUI: u, formErrors: f, formValues: p, inputNodes: g, isSubmitting: _, missingRequiredFields: v, setFieldValue: ee }) => {
|
|
479
|
+
let y = k(() => s.components.form || e, [s.components.form, e]), b = k(() => s.components.submitButton || a, [s.components.submitButton, a]), S = k(() => s.components.submitButtonWrapper || o || w, [s.components.submitButtonWrapper, o]), C = k(() => s.components.inputLabel || t, [s.components.inputLabel, t]);
|
|
480
480
|
return {
|
|
481
|
-
FormWrapper:
|
|
481
|
+
FormWrapper: y,
|
|
482
482
|
renderNode: E(function(e) {
|
|
483
|
-
let { type:
|
|
484
|
-
switch (
|
|
485
|
-
case
|
|
486
|
-
if (!
|
|
487
|
-
let t = e.data,
|
|
488
|
-
return
|
|
483
|
+
let { type: t } = e;
|
|
484
|
+
switch (t) {
|
|
485
|
+
case r.input: {
|
|
486
|
+
if (!l(e)) return null;
|
|
487
|
+
let t = e.data, r = t.type || "text", a = s.components.inputs?.[r], o = c[r], u = a || o, d = e.id, y = (e) => ee(d, e), b = p[d], S = f[d], w = x(t.label, s.language), T = m(t, s.language), E = x(t.helperText, s.language), D = h(e), O = i(w), k = i(T), A = i(E);
|
|
488
|
+
return u ? /* @__PURE__ */ M(n, {
|
|
489
489
|
node: e,
|
|
490
|
-
children: /* @__PURE__ */ M(
|
|
490
|
+
children: /* @__PURE__ */ M(u, {
|
|
491
491
|
field: {
|
|
492
492
|
"aria-invalid": S ? !0 : void 0,
|
|
493
493
|
id: e.id,
|
|
494
494
|
name: D,
|
|
495
495
|
placeholder: k,
|
|
496
496
|
required: t.required,
|
|
497
|
-
value:
|
|
497
|
+
value: b
|
|
498
498
|
},
|
|
499
499
|
extra: {
|
|
500
500
|
error: S,
|
|
501
501
|
helperText: A,
|
|
502
502
|
InputLabel: C,
|
|
503
|
-
isSubmitting:
|
|
503
|
+
isSubmitting: _,
|
|
504
504
|
label: O,
|
|
505
|
-
missingDependencies: X(e,
|
|
506
|
-
missingRequiredFields:
|
|
505
|
+
missingDependencies: X(e, p, g, s.language),
|
|
506
|
+
missingRequiredFields: v,
|
|
507
507
|
node: e,
|
|
508
|
-
setValue:
|
|
508
|
+
setValue: y
|
|
509
509
|
}
|
|
510
|
-
},
|
|
511
|
-
}, e.id) : (console.warn("No renderer found for input type:",
|
|
510
|
+
}, r)
|
|
511
|
+
}, e.id) : (console.warn("No renderer found for input type:", r), null);
|
|
512
512
|
}
|
|
513
|
-
case
|
|
514
|
-
case
|
|
513
|
+
case r.group: return null;
|
|
514
|
+
case r.ui: {
|
|
515
515
|
if (!d(e)) return null;
|
|
516
|
-
let t = e.data.type || "title", n =
|
|
516
|
+
let t = e.data.type || "title", n = s.components.ui?.[t], r = u[t], i = n || r;
|
|
517
517
|
return i ? /* @__PURE__ */ M(i, { node: e }, e.id) : null;
|
|
518
518
|
}
|
|
519
|
-
default: return console.warn("Unknown node type:",
|
|
519
|
+
default: return console.warn("Unknown node type:", t), null;
|
|
520
520
|
}
|
|
521
521
|
}, [
|
|
522
|
-
|
|
523
|
-
g,
|
|
522
|
+
s,
|
|
524
523
|
p,
|
|
525
|
-
|
|
526
|
-
v,
|
|
524
|
+
f,
|
|
527
525
|
ee,
|
|
528
526
|
_,
|
|
527
|
+
v,
|
|
528
|
+
g,
|
|
529
|
+
c,
|
|
529
530
|
u,
|
|
530
|
-
|
|
531
|
-
r
|
|
531
|
+
n
|
|
532
532
|
]),
|
|
533
|
-
SubmitButton:
|
|
533
|
+
SubmitButton: b,
|
|
534
534
|
SubmitButtonWrapper: S
|
|
535
535
|
};
|
|
536
536
|
};
|