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/editor.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as e } from "./editor-
|
|
2
|
-
import { n as t, t as n } from "./ThemeContext-
|
|
1
|
+
import { t as e } from "./editor-D3EmQ-8C.js";
|
|
2
|
+
import { n as t, t as n } from "./ThemeContext-CPsC8QIP.js";
|
|
3
3
|
export { n as ThemeProvider, e as TreegeEditor, t as useTheme };
|
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "./editor-
|
|
2
|
-
import { G as t, I as n, J as r, K as i, L as a,
|
|
3
|
-
import { C as E, L as D, S as O, _ as k, a as A, b as j, c as M, d as N, g as P, h as F, i as I, m as L, n as R, o as z, r as B, u as V, v as H, x as U, y as W } from "./DefaultSubmitButton-
|
|
4
|
-
import { a as G, c as K, i as q, l as J, n as Y, o as X, r as Z, s as Q } from "./useRenderNode-
|
|
5
|
-
import { a as $, c as ee, i as te, l as ne, n as re, o as ie, r as ae, s as oe, t as se } from "./renderer-
|
|
6
|
-
export { E as DefaultAddressInput, O as DefaultAutocompleteInput, U as DefaultCheckboxInput, j as DefaultDateInput, W as DefaultDateRangeInput, H as DefaultFileInput, k as DefaultHiddenInput, P as DefaultHttpInput, D as DefaultInputLabel, F as DefaultNumberInput, L as DefaultPasswordInput, N as DefaultRadioInput, V as DefaultSelectInput, M as DefaultSwitchInput, z as DefaultTextAreaInput, A as DefaultTextInput, I as DefaultTimeInput, B as DefaultTimeRangeInput, ie as Divider, C as ThemeProvider, oe as Title, e as TreegeEditor, $ as TreegeRenderer, K as TreegeRendererProvider, se as TreegeViewer, ne as TreegeViewerProvider, x as applyReferenceTransformation, h as buildInitialFormValues, u as calculateReferenceFieldUpdates, y as checkFormFieldHasValue, S as convertFormValuesToNamedFormat, R as defaultInputRenderers, ee as defaultUI, X as evaluateCondition, Q as evaluateConditions, _ as fileNameFromUrl, m as fileToSerializable, p as filesToSerializable, Z as findStartNode, l as formatFileSize, q as getFlowRenderState,
|
|
1
|
+
import { t as e } from "./editor-D3EmQ-8C.js";
|
|
2
|
+
import { G as t, I as n, J as r, K as i, L as a, X as o, Y as s, Z as c, _ as l, a as u, b as d, c as f, g as p, h as m, i as h, l as g, m as _, n as v, o as y, q as b, r as x, s as S, t as C, v as w, y as T } from "./ThemeContext-CPsC8QIP.js";
|
|
3
|
+
import { C as E, L as D, S as O, _ as k, a as A, b as j, c as M, d as N, g as P, h as F, i as I, m as L, n as R, o as z, r as B, u as V, v as H, x as U, y as W } from "./DefaultSubmitButton-NeSDqyzv.js";
|
|
4
|
+
import { a as G, c as K, i as q, l as J, n as Y, o as X, r as Z, s as Q } from "./useRenderNode-CG466pNk.js";
|
|
5
|
+
import { a as $, c as ee, i as te, l as ne, n as re, o as ie, r as ae, s as oe, t as se } from "./renderer-CNbSt_QW.js";
|
|
6
|
+
export { E as DefaultAddressInput, O as DefaultAutocompleteInput, U as DefaultCheckboxInput, j as DefaultDateInput, W as DefaultDateRangeInput, H as DefaultFileInput, k as DefaultHiddenInput, P as DefaultHttpInput, D as DefaultInputLabel, F as DefaultNumberInput, L as DefaultPasswordInput, N as DefaultRadioInput, V as DefaultSelectInput, M as DefaultSwitchInput, z as DefaultTextAreaInput, A as DefaultTextInput, I as DefaultTimeInput, B as DefaultTimeRangeInput, ie as Divider, C as ThemeProvider, oe as Title, e as TreegeEditor, $ as TreegeRenderer, K as TreegeRendererProvider, se as TreegeViewer, ne as TreegeViewerProvider, x as applyReferenceTransformation, h as buildInitialFormValues, u as calculateReferenceFieldUpdates, y as checkFormFieldHasValue, S as convertFormValuesToNamedFormat, R as defaultInputRenderers, ee as defaultUI, X as evaluateCondition, Q as evaluateConditions, _ as fileNameFromUrl, m as fileToSerializable, p as filesToSerializable, Z as findStartNode, l as formatFileSize, q as getFlowRenderState, t as getStaticTranslations, i as getTranslatableValue, b as getTranslatedText, re as getViewerFields, f as isFieldEmpty, s as isGroupNode, ae as isImageFile, o as isInputNode, w as isRemoteFileData, G as isStartNode, c as isUINode, T as normalizeSerializableFiles, g as resolveNodeDefaultValue, n as sanitize, a as sanitizeHttpResponse, d as serializableToFile, r as setTranslatableValue, v as useTheme, Y as useTreegeRenderer, J as useTreegeRendererConfig, te as viewerFieldsFromResponse };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as d, H as f, L as p, R as m, U as h, V as g, W as _, dt as v, lt as y, n as b, rt as x, t as S, z as C } from "./DefaultSubmitButton-
|
|
3
|
-
import { a as w, c as T, i as E, l as D, n as ee, t as te } from "./useRenderNode-
|
|
1
|
+
import { B as e, F as t, N as n, V as r, X as i, f as a, i as o, q as s, t as c, u as l, y as u } from "./ThemeContext-CPsC8QIP.js";
|
|
2
|
+
import { B as d, H as f, L as p, R as m, U as h, V as g, W as _, dt as v, lt as y, n as b, rt as x, t as S, z as C } from "./DefaultSubmitButton-NeSDqyzv.js";
|
|
3
|
+
import { a as w, c as T, i as E, l as D, n as ee, t as te } from "./useRenderNode-CG466pNk.js";
|
|
4
4
|
import { useCallback as O, useMemo as k, useState as ne } from "react";
|
|
5
5
|
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
6
6
|
import { File as N } from "lucide-react";
|
|
@@ -15,13 +15,13 @@ var P = ({ children: e, theme: t, baseUrl: n, language: r }) => /* @__PURE__ */
|
|
|
15
15
|
onSubmit: n,
|
|
16
16
|
className: "tg:mx-auto tg:max-w-2xl tg:gap-y-3",
|
|
17
17
|
children: e
|
|
18
|
-
}), ie = ({ children:
|
|
19
|
-
let r = n.length > 0, i =
|
|
18
|
+
}), ie = ({ children: e, missingFields: n = [] }) => {
|
|
19
|
+
let r = n.length > 0, i = t();
|
|
20
20
|
return r ? /* @__PURE__ */ j(f, { children: /* @__PURE__ */ M(d, { children: [/* @__PURE__ */ j(h, {
|
|
21
21
|
asChild: !0,
|
|
22
22
|
children: /* @__PURE__ */ j("span", {
|
|
23
23
|
className: "tg:inline-flex",
|
|
24
|
-
children:
|
|
24
|
+
children: e
|
|
25
25
|
})
|
|
26
26
|
}), /* @__PURE__ */ j(g, { children: /* @__PURE__ */ M("div", {
|
|
27
27
|
className: "tg:space-y-1",
|
|
@@ -32,9 +32,9 @@ var P = ({ children: e, theme: t, baseUrl: n, language: r }) => /* @__PURE__ */
|
|
|
32
32
|
className: "tg:list-inside tg:list-disc",
|
|
33
33
|
children: n.map((e, t) => /* @__PURE__ */ j("li", { children: e }, t))
|
|
34
34
|
})]
|
|
35
|
-
}) })] }) }) :
|
|
36
|
-
}, ae = ({ step:
|
|
37
|
-
let f =
|
|
35
|
+
}) })] }) }) : e;
|
|
36
|
+
}, ae = ({ step: e, label: n, children: r, canGoBack: a, isLastStep: o, canContinue: s, isSubmitting: c, onBack: l, onContinue: u, missingFields: d }) => {
|
|
37
|
+
let f = t(), p = D(), m = p?.components?.submitButton || S, h = p?.components?.submitButtonWrapper || ie, g = !s || c, _ = e.nodes.find((e) => i(e) && e.data.type === "submit"), v = _ && i(_) ? f(_.data.label) : void 0, y = /* @__PURE__ */ j(m, {
|
|
38
38
|
type: "button",
|
|
39
39
|
onClick: u,
|
|
40
40
|
disabled: g,
|
|
@@ -44,11 +44,11 @@ var P = ({ children: e, theme: t, baseUrl: n, language: r }) => /* @__PURE__ */
|
|
|
44
44
|
return /* @__PURE__ */ M("section", {
|
|
45
45
|
className: "tg:rounded-lg tg:border tg:p-4",
|
|
46
46
|
children: [
|
|
47
|
-
|
|
47
|
+
n && /* @__PURE__ */ j("h3", {
|
|
48
48
|
className: "tg:mb-4 tg:font-semibold tg:text-lg",
|
|
49
|
-
children:
|
|
49
|
+
children: n
|
|
50
50
|
}),
|
|
51
|
-
|
|
51
|
+
r,
|
|
52
52
|
/* @__PURE__ */ M("div", {
|
|
53
53
|
className: "tg:mt-6 tg:flex tg:items-center tg:justify-between tg:gap-2",
|
|
54
54
|
children: [a ? /* @__PURE__ */ j("button", {
|
|
@@ -64,8 +64,8 @@ var P = ({ children: e, theme: t, baseUrl: n, language: r }) => /* @__PURE__ */
|
|
|
64
64
|
})
|
|
65
65
|
]
|
|
66
66
|
});
|
|
67
|
-
}, F = ({ node:
|
|
68
|
-
let n =
|
|
67
|
+
}, F = ({ node: e }) => {
|
|
68
|
+
let n = t()(e.data?.label);
|
|
69
69
|
return n ? /* @__PURE__ */ M("div", {
|
|
70
70
|
className: "tg:flex tg:items-center tg:gap-x-3",
|
|
71
71
|
children: [
|
|
@@ -77,11 +77,11 @@ var P = ({ children: e, theme: t, baseUrl: n, language: r }) => /* @__PURE__ */
|
|
|
77
77
|
/* @__PURE__ */ j(m, { className: "tg:my-8 tg:flex-1" })
|
|
78
78
|
]
|
|
79
79
|
}) : /* @__PURE__ */ j(m, { className: "tg:my-8" });
|
|
80
|
-
}, I = ({ node:
|
|
81
|
-
let { edges: n } =
|
|
80
|
+
}, I = ({ node: e }) => {
|
|
81
|
+
let { edges: n } = r(), i = t();
|
|
82
82
|
return /* @__PURE__ */ j("h2", {
|
|
83
|
-
className: v("tg:mb-5 tg:font-bold tg:text-2xl", !w(
|
|
84
|
-
children:
|
|
83
|
+
className: v("tg:mb-5 tg:font-bold tg:text-2xl", !w(e.id, n) && "tg:mt-10"),
|
|
84
|
+
children: i(e.data?.label)
|
|
85
85
|
});
|
|
86
86
|
}, L = {
|
|
87
87
|
divider: F,
|
|
@@ -131,13 +131,13 @@ var se = () => /* @__PURE__ */ M("section", {
|
|
|
131
131
|
href: "treege-renderer",
|
|
132
132
|
precedence: "default",
|
|
133
133
|
children: z
|
|
134
|
-
}), B = ({ baseUrl:
|
|
134
|
+
}), B = ({ baseUrl: t, components: n, className: r, extraPayload: i, flow: a, formId: o, googleApiKey: s, headers: l, language: u, onBack: d, onChange: f, onSubmit: m, showPoweredBy: h, theme: g, validate: _, validationMode: y, initialValues: C = {}, isLoading: w = !1, isSubmitting: T = !1 }) => {
|
|
135
135
|
let { canContinueStep: E, canSubmit: D, clearSubmitMessage: A, config: N, currentStep: P, currentStepGroupNode: F, currentStepIndex: I, firstErrorFieldId: R, formErrors: z, formValues: B, goToNextStep: V, goToPreviousStep: H, handleSubmit: U, hasSubmitInput: W, inputNodes: G, isFirstStep: K, isLastStep: q, isSubmitting: le, missingRequiredFields: J, setFieldValue: Y, steps: X, submitMessage: Z, t: Q } = ee({
|
|
136
|
-
baseUrl:
|
|
137
|
-
components:
|
|
138
|
-
extraPayload:
|
|
136
|
+
baseUrl: t,
|
|
137
|
+
components: n,
|
|
138
|
+
extraPayload: i,
|
|
139
139
|
flow: a,
|
|
140
|
-
googleApiKey:
|
|
140
|
+
googleApiKey: s,
|
|
141
141
|
headers: l,
|
|
142
142
|
initialValues: C,
|
|
143
143
|
language: u,
|
|
@@ -197,13 +197,13 @@ var se = () => /* @__PURE__ */ M("section", {
|
|
|
197
197
|
]), be = !K || !!d;
|
|
198
198
|
return /* @__PURE__ */ j("div", {
|
|
199
199
|
ref: de,
|
|
200
|
-
className: v("treege treege-renderer",
|
|
200
|
+
className: v("treege treege-renderer", r),
|
|
201
201
|
children: /* @__PURE__ */ M(x, {
|
|
202
202
|
container: ue,
|
|
203
|
-
children: [/* @__PURE__ */ j(ce, {}), /* @__PURE__ */ j(
|
|
203
|
+
children: [/* @__PURE__ */ j(ce, {}), /* @__PURE__ */ j(c, {
|
|
204
204
|
theme: N.theme,
|
|
205
205
|
storageKey: "treege-renderer-theme",
|
|
206
|
-
children: w ? /* @__PURE__ */ j(he, {}) : /* @__PURE__ */ M(
|
|
206
|
+
children: w ? /* @__PURE__ */ j(he, {}) : /* @__PURE__ */ M(e, {
|
|
207
207
|
value: {
|
|
208
208
|
baseUrl: N.baseUrl,
|
|
209
209
|
flow: a,
|
|
@@ -262,10 +262,10 @@ var se = () => /* @__PURE__ */ M("section", {
|
|
|
262
262
|
if (e == null || e === "") return "";
|
|
263
263
|
let n = new Date(e);
|
|
264
264
|
return Number.isNaN(n.getTime()) ? String(e) : n.toLocaleDateString(t);
|
|
265
|
-
}, G = (e,
|
|
266
|
-
let
|
|
267
|
-
return
|
|
268
|
-
}, K = /\.(png|jpe?g|gif|webp|svg|avif|bmp|ico)(\?|#|$)/i, q = (e) => !!e.type?.startsWith("image/") || !!e.data?.startsWith("data:image/") || K.test(e.data ?? ""), le = (e, t) => !e || e.startsWith("data:") || e.startsWith("blob:") ? e :
|
|
265
|
+
}, G = (e, t, n) => {
|
|
266
|
+
let r = e?.find((e) => e.value === t);
|
|
267
|
+
return r ? s(r.label, n) || r.value : String(t ?? "");
|
|
268
|
+
}, K = /\.(png|jpe?g|gif|webp|svg|avif|bmp|ico)(\?|#|$)/i, q = (e) => !!e.type?.startsWith("image/") || !!e.data?.startsWith("data:image/") || K.test(e.data ?? ""), le = (e, t) => !e || e.startsWith("data:") || e.startsWith("blob:") ? e : n(e, t), J = (e, t) => u(e).map((e) => ({
|
|
269
269
|
...e,
|
|
270
270
|
data: le(e.data, t)
|
|
271
271
|
})), Y = (e, t, n, r, i) => {
|
|
@@ -316,21 +316,21 @@ var se = () => /* @__PURE__ */ M("section", {
|
|
|
316
316
|
text: String(t)
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
}, X = (e,
|
|
320
|
-
let { language:
|
|
321
|
-
return
|
|
322
|
-
let
|
|
319
|
+
}, X = (e, t, n = {}) => {
|
|
320
|
+
let { language: r = "en", baseUrl: i } = n, c = e?.nodes ?? [], u = e?.edges ?? [], d = l(c), f = o(t ?? {}, d), { visibleNodes: p } = E(c, u, f);
|
|
321
|
+
return l(p).filter((e) => !V.has(e.data.type ?? "")).map((e) => {
|
|
322
|
+
let t = f[e.id];
|
|
323
323
|
return {
|
|
324
|
-
display: Y(e.data.type,
|
|
324
|
+
display: Y(e.data.type, t, e.data.options, r, i),
|
|
325
325
|
id: e.id,
|
|
326
|
-
label:
|
|
326
|
+
label: s(e.data.label, r) || e.data.name || e.id,
|
|
327
327
|
name: a(e),
|
|
328
328
|
node: e,
|
|
329
|
-
rawValue:
|
|
329
|
+
rawValue: t,
|
|
330
330
|
type: e.data.type ?? _.text
|
|
331
331
|
};
|
|
332
332
|
});
|
|
333
|
-
}, Z = (e,
|
|
333
|
+
}, Z = (e, t) => (typeof e == "string" ? e : s(e, t)) || "", Q = (e, t = {}) => {
|
|
334
334
|
let { language: n = "en", baseUrl: r } = t;
|
|
335
335
|
return (e ?? []).filter((e) => !!e.name && !V.has(e.type ?? "")).map((e) => ({
|
|
336
336
|
display: Y(e.type, e.value, void 0, n, r),
|
|
@@ -392,7 +392,7 @@ var se = () => /* @__PURE__ */ M("section", {
|
|
|
392
392
|
children: n.text
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
|
-
}, $ = ({ flow: e, flowResponse: t, baseUrl: n, theme: r, excludedFields: i, excludeEmptyFields: a, collapsed: o, collapsedVisibleCount:
|
|
395
|
+
}, $ = ({ flow: e, flowResponse: t, baseUrl: n, theme: r, excludedFields: i, excludeEmptyFields: a, collapsed: o, collapsedVisibleCount: s, className: l, renderField: u, renderRow: d, language: f, emptyText: p = "—" }) => {
|
|
396
396
|
let m = D(), h = r ?? m?.theme ?? "dark", g = n ?? m?.baseUrl, _ = f ?? m?.language ?? "en", y = k(() => e ? X(e, t, {
|
|
397
397
|
baseUrl: g,
|
|
398
398
|
language: _
|
|
@@ -423,8 +423,8 @@ var se = () => /* @__PURE__ */ M("section", {
|
|
|
423
423
|
})]
|
|
424
424
|
});
|
|
425
425
|
return /* @__PURE__ */ j("div", { children: d ? d(e, r) : r }, e.id);
|
|
426
|
-
}, S =
|
|
427
|
-
return /* @__PURE__ */ M(
|
|
426
|
+
}, S = s ?? b.length, C = b.slice(0, S), w = b.slice(S), T = !!o && w.length > 0;
|
|
427
|
+
return /* @__PURE__ */ M(c, {
|
|
428
428
|
theme: h,
|
|
429
429
|
storageKey: "treege-renderer-theme",
|
|
430
430
|
children: [/* @__PURE__ */ j(ce, {}), /* @__PURE__ */ M("dl", {
|