treege 3.0.0-beta.73 → 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-VU_Lwicd.js → DefaultSubmitButton-BT4AxAnR.js} +521 -500
- package/dist/{ThemeContext-CmyrtNyt.js → ThemeContext-CSH4Fupd.js} +61 -61
- package/dist/{editor-DLXwqtbI.js → editor-alr_fxTU.js} +926 -892
- package/dist/editor.js +2 -2
- package/dist/main.js +6 -6
- package/dist/renderer-D9Yaxr2H.js +255 -0
- package/dist/renderer-native.js +979 -989
- package/dist/renderer.js +5 -5
- package/dist/shared/locales/ar.json.d.ts +2 -0
- package/dist/shared/locales/de.json.d.ts +2 -0
- package/dist/shared/locales/en.json.d.ts +2 -0
- package/dist/shared/locales/es.json.d.ts +2 -0
- package/dist/shared/locales/fr.json.d.ts +2 -0
- package/dist/shared/locales/it.json.d.ts +2 -0
- package/dist/shared/locales/pt.json.d.ts +2 -0
- package/dist/shared/types/node.d.ts +7 -0
- package/dist/shared/utils/normalizeLabel.d.ts +21 -0
- package/dist/{useRenderNode-D1d8JGbe.js → useRenderNode-GobhZp-Y.js} +110 -110
- package/package.json +1 -1
- package/dist/renderer-pYP47xsl.js +0 -255
package/dist/renderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as h, S as g, _, a as v, b as y, c as b, d as x, g as S, h as C, i as w, m as T, n as E, o as D, r as O, u as k, v as A, x as j, y as M } from "./DefaultSubmitButton-
|
|
3
|
-
import { a as N, c as P, i as F, l as I, n as L, o as R, r as z, s as B } from "./useRenderNode-
|
|
4
|
-
import { i as V, n as H, r as U, t as W } from "./renderer-
|
|
5
|
-
export { h as DefaultAddressInput, g as DefaultAutocompleteInput, j as DefaultCheckboxInput, y as DefaultDateInput, M as DefaultDateRangeInput, A as DefaultFileInput, _ as DefaultHiddenInput, S as DefaultHttpInput, C as DefaultNumberInput, T as DefaultPasswordInput, x as DefaultRadioInput, k as DefaultSelectInput, b as DefaultSwitchInput, D as DefaultTextAreaInput, v as DefaultTextInput, w as DefaultTimeInput, O as DefaultTimeRangeInput, H as Divider, m as ThemeProvider, U as Title, W as TreegeRenderer, P as TreegeRendererProvider, f as applyReferenceTransformation,
|
|
1
|
+
import { B as e, M as t, N as n, a as r, c as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, r as f, s as p, t as m } from "./ThemeContext-CSH4Fupd.js";
|
|
2
|
+
import { C as h, S as g, _, a as v, b as y, c as b, d as x, g as S, h as C, i as w, m as T, n as E, o as D, r as O, u as k, v as A, x as j, y as M } from "./DefaultSubmitButton-BT4AxAnR.js";
|
|
3
|
+
import { a as N, c as P, i as F, l as I, n as L, o as R, r as z, s as B } from "./useRenderNode-GobhZp-Y.js";
|
|
4
|
+
import { i as V, n as H, r as U, t as W } from "./renderer-D9Yaxr2H.js";
|
|
5
|
+
export { h as DefaultAddressInput, g as DefaultAutocompleteInput, j as DefaultCheckboxInput, y as DefaultDateInput, M as DefaultDateRangeInput, A as DefaultFileInput, _ as DefaultHiddenInput, S as DefaultHttpInput, C as DefaultNumberInput, T as DefaultPasswordInput, x as DefaultRadioInput, k as DefaultSelectInput, b as DefaultSwitchInput, D as DefaultTextAreaInput, v as DefaultTextInput, w as DefaultTimeInput, O as DefaultTimeRangeInput, H as Divider, m as ThemeProvider, U as Title, W as TreegeRenderer, P as TreegeRendererProvider, f as applyReferenceTransformation, s as buildInitialFormValues, r as calculateReferenceFieldUpdates, d as checkFormFieldHasValue, p as convertFormValuesToNamedFormat, E as defaultInputRenderers, V as defaultUI, R as evaluateCondition, B as evaluateConditions, l as fileToSerializable, o as filesToSerializable, z as findStartNode, F as getFlowRenderState, e as getTranslatedText, i as isFieldEmpty, N as isStartNode, c as resolveNodeDefaultValue, t as sanitize, n as sanitizeHttpResponse, a as serializableToFile, u as useTheme, L as useTreegeRenderer, I as useTreegeRendererConfig };
|
|
@@ -201,6 +201,8 @@ declare const _default: {
|
|
|
201
201
|
"name": "الاسم",
|
|
202
202
|
"nameDescription": "اسم حقل مخصص اختياري لتصدير النموذج. إذا كان فارغاً، سيتم استخدام التسمية كمفتاح.",
|
|
203
203
|
"noParentFieldsAvailable": "لا توجد حقول أصلية متاحة",
|
|
204
|
+
"normalizeLabels": "توحيد التسميات",
|
|
205
|
+
"normalizeLabelsHint": "تنسيق التسميات الواردة من واجهة برمجة التطبيقات (مثل الأحرف الكبيرة) إلى شكل موحّد وسهل القراءة. لا تتأثر الخيارات المُدخلة يدويًا.",
|
|
204
206
|
"objectMapping": "تعيين الكائن",
|
|
205
207
|
"objectMappingDesc": "تعيين خصائص الكائن المصدر إلى بنية جديدة",
|
|
206
208
|
"optional": "اختياري",
|
|
@@ -201,6 +201,8 @@ declare const _default: {
|
|
|
201
201
|
"name": "Name",
|
|
202
202
|
"nameDescription": "Optionaler benutzerdefinierter Feldname für den Formularexport. Falls leer, wird die Bezeichnung als Schlüssel verwendet.",
|
|
203
203
|
"noParentFieldsAvailable": "Keine übergeordneten Felder verfügbar",
|
|
204
|
+
"normalizeLabels": "Beschriftungen normalisieren",
|
|
205
|
+
"normalizeLabelsHint": "Bereinigt von der API gelieferte Beschriftungen (z. B. GROSSBUCHSTABEN) zu einer einheitlichen, lesbaren Form. Manuell eingegebene Optionen sind nicht betroffen.",
|
|
204
206
|
"objectMapping": "Objektzuordnung",
|
|
205
207
|
"objectMappingDesc": "Eigenschaften des Quellobjekts auf eine neue Struktur abbilden",
|
|
206
208
|
"optional": "Optional",
|
|
@@ -201,6 +201,8 @@ declare const _default: {
|
|
|
201
201
|
"name": "Name",
|
|
202
202
|
"nameDescription": "Optional custom field name for form export. If empty, the label will be used as the key.",
|
|
203
203
|
"noParentFieldsAvailable": "No parent fields available",
|
|
204
|
+
"normalizeLabels": "Normalize labels",
|
|
205
|
+
"normalizeLabelsHint": "Clean up labels coming from the API (e.g. ALL CAPS) into a uniform, readable form. Manually-typed options are not affected.",
|
|
204
206
|
"objectMapping": "Object Mapping",
|
|
205
207
|
"objectMappingDesc": "Map properties from the source object to a new structure",
|
|
206
208
|
"optional": "Optional",
|
|
@@ -201,6 +201,8 @@ declare const _default: {
|
|
|
201
201
|
"name": "Nombre",
|
|
202
202
|
"nameDescription": "Nombre de campo personalizado opcional para la exportación del formulario. Si está vacío, la etiqueta se usará como clave.",
|
|
203
203
|
"noParentFieldsAvailable": "No hay campos principales disponibles",
|
|
204
|
+
"normalizeLabels": "Normalizar etiquetas",
|
|
205
|
+
"normalizeLabelsHint": "Limpia las etiquetas que vienen de la API (p. ej. EN MAYÚSCULAS) a una forma uniforme y legible. Las opciones escritas a mano no se ven afectadas.",
|
|
204
206
|
"objectMapping": "Mapeo de objetos",
|
|
205
207
|
"objectMappingDesc": "Mapear las propiedades del objeto de origen a una nueva estructura",
|
|
206
208
|
"optional": "Opcional",
|
|
@@ -201,6 +201,8 @@ declare const _default: {
|
|
|
201
201
|
"name": "Nom",
|
|
202
202
|
"nameDescription": "Nom de champ personnalisé optionnel pour l'export du formulaire. Si vide, le libellé sera utilisé comme clé.",
|
|
203
203
|
"noParentFieldsAvailable": "Aucun champ parent disponible",
|
|
204
|
+
"normalizeLabels": "Normaliser les libellés",
|
|
205
|
+
"normalizeLabelsHint": "Nettoie les libellés venant de l'API (ex : EN MAJUSCULES) pour un rendu uniforme et lisible. Les options saisies à la main ne sont pas affectées.",
|
|
204
206
|
"objectMapping": "Mappage d'objet",
|
|
205
207
|
"objectMappingDesc": "Mapper les propriétés de l'objet source vers une nouvelle structure",
|
|
206
208
|
"optional": "Optionnel",
|
|
@@ -201,6 +201,8 @@ declare const _default: {
|
|
|
201
201
|
"name": "Nome",
|
|
202
202
|
"nameDescription": "Nome campo personalizzato opzionale per l'esportazione del modulo. Se vuoto, l'etichetta verrà utilizzata come chiave.",
|
|
203
203
|
"noParentFieldsAvailable": "Nessun campo genitore disponibile",
|
|
204
|
+
"normalizeLabels": "Normalizza le etichette",
|
|
205
|
+
"normalizeLabelsHint": "Uniforma le etichette provenienti dall'API (es. TUTTO MAIUSCOLO) in una forma leggibile. Le opzioni inserite manualmente non vengono modificate.",
|
|
204
206
|
"objectMapping": "Mappatura oggetto",
|
|
205
207
|
"objectMappingDesc": "Mappa le proprietà dell'oggetto sorgente su una nuova struttura",
|
|
206
208
|
"optional": "Opzionale",
|
|
@@ -201,6 +201,8 @@ declare const _default: {
|
|
|
201
201
|
"name": "Nome",
|
|
202
202
|
"nameDescription": "Nome de campo personalizado opcional para exportação de formulário. Se vazio, o rótulo será usado como chave.",
|
|
203
203
|
"noParentFieldsAvailable": "Nenhum campo pai disponível",
|
|
204
|
+
"normalizeLabels": "Normalizar rótulos",
|
|
205
|
+
"normalizeLabelsHint": "Limpa os rótulos vindos da API (ex.: MAIÚSCULAS) para um formato uniforme e legível. As opções digitadas manualmente não são afetadas.",
|
|
204
206
|
"objectMapping": "Mapeamento de objeto",
|
|
205
207
|
"objectMappingDesc": "Mapear as propriedades do objeto de origem para uma nova estrutura",
|
|
206
208
|
"optional": "Opcional",
|
|
@@ -273,6 +273,13 @@ export type InputNodeData = BaseNodeData & {
|
|
|
273
273
|
* When set, overrides the static `options` array.
|
|
274
274
|
*/
|
|
275
275
|
optionsSource?: OptionsSource;
|
|
276
|
+
/**
|
|
277
|
+
* Whether labels fetched from an API (dynamic `optionsSource` or an `http`
|
|
278
|
+
* input's `responseMapping`) are normalized to a uniform, readable Title Case
|
|
279
|
+
* form (e.g. "DUPONT JEAN" -> "Dupont Jean"). Manually-typed static option
|
|
280
|
+
* labels are never affected. Defaults to `true` when unset.
|
|
281
|
+
*/
|
|
282
|
+
normalizeOptionLabels?: boolean;
|
|
276
283
|
/**
|
|
277
284
|
* Submit configuration for the input field (used with type="submit")
|
|
278
285
|
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Translatable } from '../types/translate';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a raw label string into a uniform, readable Title Case form.
|
|
4
|
+
*
|
|
5
|
+
* Designed for labels coming from an API where casing is often inconsistent
|
|
6
|
+
* (ALL CAPS, snake_case, kebab-case, camelCase). Each word gets an uppercase
|
|
7
|
+
* first letter and a lowercase remainder, with separators collapsed to single
|
|
8
|
+
* spaces:
|
|
9
|
+
*
|
|
10
|
+
* "DUPONT JEAN" -> "Dupont Jean"
|
|
11
|
+
* "admin_user" -> "Admin User"
|
|
12
|
+
* "dateNaissance" -> "Date Naissance"
|
|
13
|
+
*
|
|
14
|
+
* Empty/whitespace-only input is returned unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export declare const normalizeLabel: (text: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Applies {@link normalizeLabel} to every language entry of a `Translatable`
|
|
19
|
+
* label, preserving its shape.
|
|
20
|
+
*/
|
|
21
|
+
export declare const normalizeTranslatableLabel: (label: Translatable) => Translatable;
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
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 = (
|
|
41
|
+
}, ne = (t, n, i, a, o, s) => {
|
|
42
42
|
let [c, l] = j(!1), [u, d] = j(null), f = k(() => {
|
|
43
|
-
let
|
|
44
|
-
return
|
|
45
|
-
}, [
|
|
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
46
|
if (!f?.data?.submitConfig) return null;
|
|
47
|
-
let
|
|
48
|
-
if (!
|
|
49
|
-
d(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 n =
|
|
53
|
+
let n = e(r.successMessage, i);
|
|
54
54
|
if (n && d({
|
|
55
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
61
|
} else d({
|
|
62
|
-
message:
|
|
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 n =
|
|
66
|
+
} catch (t) {
|
|
67
|
+
let n = e(r.errorMessage, i) || (t instanceof Error ? t.message : "An unexpected error occurred");
|
|
68
68
|
return d({
|
|
69
69
|
message: n,
|
|
70
70
|
type: "error"
|
|
@@ -78,10 +78,10 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
78
78
|
}, [
|
|
79
79
|
f,
|
|
80
80
|
n,
|
|
81
|
-
r,
|
|
82
81
|
i,
|
|
83
82
|
a,
|
|
84
|
-
o
|
|
83
|
+
o,
|
|
84
|
+
s
|
|
85
85
|
]);
|
|
86
86
|
return {
|
|
87
87
|
clearSubmitMessage: E(() => {
|
|
@@ -127,13 +127,13 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
127
127
|
}
|
|
128
128
|
default: return !1;
|
|
129
129
|
}
|
|
130
|
-
}, z = (e,
|
|
130
|
+
}, z = (e, t, n) => {
|
|
131
131
|
let { field: i, operator: a, value: o } = e;
|
|
132
132
|
if (!(i && a) || o === void 0) return !0;
|
|
133
|
-
let s =
|
|
134
|
-
if (s === void 0 &&
|
|
135
|
-
let e =
|
|
136
|
-
e &&
|
|
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
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) => {
|
|
@@ -153,7 +153,7 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
153
153
|
let n = t.get(e.source);
|
|
154
154
|
n ? n.push(e) : t.set(e.source, [e]);
|
|
155
155
|
}), t;
|
|
156
|
-
}, re = (e,
|
|
156
|
+
}, re = (e, t, n) => {
|
|
157
157
|
let i = [], a = [], o = [];
|
|
158
158
|
e.forEach((e) => {
|
|
159
159
|
let t = e.data?.isFallback, n = e.data?.conditions?.length;
|
|
@@ -168,14 +168,14 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
168
168
|
let i = e.data?.conditions;
|
|
169
169
|
return i ? i.every((e) => {
|
|
170
170
|
if (!e.field) return !0;
|
|
171
|
-
let i =
|
|
172
|
-
return v(
|
|
171
|
+
let i = n.get(e.field);
|
|
172
|
+
return v(r(i) ? i.id : e.field, t);
|
|
173
173
|
}) : !1;
|
|
174
174
|
})) return o.length > 0 && s.push(...o), {
|
|
175
175
|
edgesToFollow: s,
|
|
176
176
|
waitingForInput: s.length === 0
|
|
177
177
|
};
|
|
178
|
-
let c = a.filter((e) => B(e.data?.conditions,
|
|
178
|
+
let c = a.filter((e) => B(e.data?.conditions, t, n));
|
|
179
179
|
return c.length > 0 ? (s.push(...c), {
|
|
180
180
|
edgesToFollow: s,
|
|
181
181
|
waitingForInput: !1
|
|
@@ -183,9 +183,9 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
183
183
|
edgesToFollow: s,
|
|
184
184
|
waitingForInput: !1
|
|
185
185
|
});
|
|
186
|
-
}, H = (e, t) => !t.some((t) => t.target === e), U = (e,
|
|
187
|
-
let
|
|
188
|
-
return
|
|
186
|
+
}, H = (e, t) => !t.some((t) => t.target === e), U = (e, t) => {
|
|
187
|
+
let n = e.filter((e) => H(e.id, t));
|
|
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
|
-
googleApiKey:
|
|
268
|
-
headers:
|
|
269
|
-
language:
|
|
270
|
-
showPoweredBy:
|
|
267
|
+
googleApiKey: i ?? S?.googleApiKey,
|
|
268
|
+
headers: c(S?.headers, a),
|
|
269
|
+
language: o ?? S?.language ?? "en",
|
|
270
|
+
showPoweredBy: p ?? S?.showPoweredBy ?? !0,
|
|
271
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
|
+
i,
|
|
277
278
|
a,
|
|
278
279
|
o,
|
|
279
|
-
|
|
280
|
-
u,
|
|
280
|
+
p,
|
|
281
281
|
m,
|
|
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,
|
|
@@ -316,28 +316,28 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
316
316
|
}), n;
|
|
317
317
|
}));
|
|
318
318
|
}, []), $ = E((e) => {
|
|
319
|
-
let
|
|
319
|
+
let t = {};
|
|
320
320
|
H.forEach((e) => {
|
|
321
|
-
if (
|
|
322
|
-
let
|
|
323
|
-
if (e.data.required &&
|
|
324
|
-
n
|
|
321
|
+
if (r(e)) {
|
|
322
|
+
let n = e.id, r = R[n];
|
|
323
|
+
if (e.data.required && f(r)) {
|
|
324
|
+
t[n] = N(e.data.errorMessage) || N("validation.required");
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
|
-
if (!
|
|
328
|
-
new RegExp(e.data.pattern).test(String(r)) || (n
|
|
327
|
+
if (!f(r) && e.data.pattern) try {
|
|
328
|
+
new RegExp(e.data.pattern).test(String(r)) || (t[n] = N(e.data.errorMessage) || N("validation.invalidFormat"));
|
|
329
329
|
} catch (e) {
|
|
330
|
-
console.error(`Invalid pattern for field ${
|
|
330
|
+
console.error(`Invalid pattern for field ${n}:`, e);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
});
|
|
334
|
-
let
|
|
335
|
-
...
|
|
336
|
-
...
|
|
334
|
+
let n = e ? e(R, H) : {}, i = {
|
|
335
|
+
...t,
|
|
336
|
+
...n
|
|
337
337
|
};
|
|
338
338
|
return L(i), {
|
|
339
339
|
errors: i,
|
|
340
|
-
hasCustomErrors: Object.keys(
|
|
340
|
+
hasCustomErrors: Object.keys(n).length > 0,
|
|
341
341
|
isValid: Object.keys(i).length === 0
|
|
342
342
|
};
|
|
343
343
|
}, [
|
|
@@ -368,14 +368,14 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
368
368
|
]), Ce = k(() => {
|
|
369
369
|
if (!X) return [];
|
|
370
370
|
let e = [];
|
|
371
|
-
return X.nodes.forEach((
|
|
372
|
-
t
|
|
371
|
+
return X.nodes.forEach((t) => {
|
|
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,
|
|
@@ -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,22 +474,22 @@ 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:
|
|
478
|
-
let y = k(() => c.components.form ||
|
|
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
480
|
FormWrapper: y,
|
|
481
|
-
renderNode: E(function(
|
|
482
|
-
let { type:
|
|
483
|
-
switch (
|
|
484
|
-
case
|
|
485
|
-
if (!t
|
|
486
|
-
let i =
|
|
487
|
-
return d ? /* @__PURE__ */ M(
|
|
488
|
-
node:
|
|
481
|
+
renderNode: E(function(t) {
|
|
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
|
+
node: t,
|
|
489
489
|
children: /* @__PURE__ */ M(d, {
|
|
490
490
|
field: {
|
|
491
491
|
"aria-invalid": S ? !0 : void 0,
|
|
492
|
-
id:
|
|
492
|
+
id: t.id,
|
|
493
493
|
name: E,
|
|
494
494
|
placeholder: O,
|
|
495
495
|
required: i.required,
|
|
@@ -498,35 +498,35 @@ var N = T(void 0), te = () => D(N), P = ({ children: e, ...t }) => /* @__PURE__
|
|
|
498
498
|
extra: {
|
|
499
499
|
error: S,
|
|
500
500
|
helperText: k,
|
|
501
|
-
isSubmitting:
|
|
501
|
+
isSubmitting: g,
|
|
502
502
|
label: D,
|
|
503
|
-
missingDependencies: X(
|
|
503
|
+
missingDependencies: X(t, h, ee, c.language),
|
|
504
504
|
missingRequiredFields: _,
|
|
505
|
-
node:
|
|
505
|
+
node: t,
|
|
506
506
|
setValue: b
|
|
507
507
|
}
|
|
508
508
|
}, a)
|
|
509
|
-
},
|
|
509
|
+
}, t.id) : (console.warn("No renderer found for input type:", a), null);
|
|
510
510
|
}
|
|
511
|
-
case
|
|
512
|
-
case
|
|
513
|
-
if (!
|
|
514
|
-
let e =
|
|
515
|
-
return i ? /* @__PURE__ */ M(i, { node:
|
|
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
520
|
c,
|
|
521
|
-
|
|
521
|
+
h,
|
|
522
522
|
f,
|
|
523
523
|
v,
|
|
524
|
-
ee,
|
|
525
|
-
_,
|
|
526
524
|
g,
|
|
527
|
-
|
|
525
|
+
_,
|
|
526
|
+
ee,
|
|
527
|
+
u,
|
|
528
528
|
d,
|
|
529
|
-
|
|
529
|
+
n
|
|
530
530
|
]),
|
|
531
531
|
SubmitButton: b,
|
|
532
532
|
SubmitButtonWrapper: x
|