treege 3.0.0-beta.58 → 3.0.0-beta.59
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/README.md +16 -17
- package/dist/{DefaultInputs-Dr3R5r53.js → DefaultInputs-CoDN_KvC.js} +4 -4
- package/dist/{ThemeContext-DrI5HTYl.js → ThemeContext-ClYtPOGK.js} +19 -19
- package/dist/editor/constants/nodeSpacing.d.ts +0 -8
- package/dist/{editor-BhL3w_KP.js → editor-Cd_ifJTX.js} +3 -3
- package/dist/editor.js +2 -2
- package/dist/main.js +3 -3
- package/dist/renderer/context/TreegeRendererContext.d.ts +2 -2
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +2 -2
- package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
- package/dist/renderer/types/renderer.d.ts +3 -3
- package/dist/renderer-native.js +4 -4
- package/dist/renderer.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
## Overview
|
|
24
24
|
|
|
25
|
-
Treege is a modern React library for creating and rendering interactive decision trees. Built on top of ReactFlow, it provides a complete solution for building complex form
|
|
25
|
+
Treege is a modern React library for creating and rendering interactive decision trees. Built on top of ReactFlow, it provides a complete solution for building complex form flow, decision logic, and conditional workflows with an intuitive visual editor.
|
|
26
26
|
|
|
27
27
|
## Features
|
|
28
28
|
|
|
@@ -132,7 +132,7 @@ function App() {
|
|
|
132
132
|
|
|
133
133
|
return (
|
|
134
134
|
<TreegeRenderer
|
|
135
|
-
|
|
135
|
+
flow={flow}
|
|
136
136
|
onSubmit={handleSubmit}
|
|
137
137
|
/>
|
|
138
138
|
);
|
|
@@ -159,7 +159,7 @@ function App() {
|
|
|
159
159
|
{mode === "edit" ? (
|
|
160
160
|
<TreegeEditor flow={flow} onSave={setFlow} />
|
|
161
161
|
) : (
|
|
162
|
-
<TreegeRenderer
|
|
162
|
+
<TreegeRenderer flow={flow} onSubmit={console.log} />
|
|
163
163
|
)}
|
|
164
164
|
</div>
|
|
165
165
|
);
|
|
@@ -242,7 +242,7 @@ function App() {
|
|
|
242
242
|
|
|
243
243
|
return (
|
|
244
244
|
<TreegeRenderer
|
|
245
|
-
|
|
245
|
+
flow={flow}
|
|
246
246
|
onSubmit={handleSubmit}
|
|
247
247
|
/>
|
|
248
248
|
);
|
|
@@ -255,7 +255,7 @@ You can customize the appearance using the `style` and `contentContainerStyle` p
|
|
|
255
255
|
|
|
256
256
|
```tsx
|
|
257
257
|
<TreegeRenderer
|
|
258
|
-
|
|
258
|
+
flow={flow}
|
|
259
259
|
onSubmit={handleSubmit}
|
|
260
260
|
style={{ flex: 1, backgroundColor: "#f5f5f5" }}
|
|
261
261
|
contentContainerStyle={{ padding: 20 }}
|
|
@@ -301,7 +301,7 @@ const CustomTextInput = (field, extra) => {
|
|
|
301
301
|
};
|
|
302
302
|
|
|
303
303
|
<TreegeRenderer
|
|
304
|
-
|
|
304
|
+
flow={flow}
|
|
305
305
|
components={{
|
|
306
306
|
inputs: {
|
|
307
307
|
text: CustomTextInput
|
|
@@ -337,7 +337,7 @@ The React Native renderer shares the same API as the web renderer, with some pla
|
|
|
337
337
|
|
|
338
338
|
| Prop | Type | Default | Description |
|
|
339
339
|
|-------------------------|---------------------------------------------|--------------|------------------------------------------------------------|
|
|
340
|
-
| `
|
|
340
|
+
| `flow` | `Flow \| null` | - | Decision tree to render |
|
|
341
341
|
| `onSubmit` | `(values: FormValues, meta?: Meta) => void` | - | Form submission handler (meta includes HTTP response data) |
|
|
342
342
|
| `onChange` | `(values: FormValues) => void` | - | Form change handler |
|
|
343
343
|
| `validate` | `(values, nodes) => Record<string, string>` | - | Custom validation function |
|
|
@@ -406,7 +406,7 @@ Supported UI types:
|
|
|
406
406
|
|
|
407
407
|
## Conditional Edges
|
|
408
408
|
|
|
409
|
-
Create dynamic
|
|
409
|
+
Create dynamic flow with conditional logic:
|
|
410
410
|
|
|
411
411
|
```tsx
|
|
412
412
|
{
|
|
@@ -474,7 +474,7 @@ const CustomTextInput = (field, extra) => {
|
|
|
474
474
|
};
|
|
475
475
|
|
|
476
476
|
<TreegeRenderer
|
|
477
|
-
|
|
477
|
+
flow={flow}
|
|
478
478
|
components={{
|
|
479
479
|
inputs: {
|
|
480
480
|
text: CustomTextInput
|
|
@@ -489,7 +489,7 @@ Add custom validation logic:
|
|
|
489
489
|
|
|
490
490
|
```tsx
|
|
491
491
|
<TreegeRenderer
|
|
492
|
-
|
|
492
|
+
flow={flow}
|
|
493
493
|
validate={(values, visibleNodes) => {
|
|
494
494
|
const errors = {};
|
|
495
495
|
|
|
@@ -558,7 +558,7 @@ function App() {
|
|
|
558
558
|
}
|
|
559
559
|
}}
|
|
560
560
|
>
|
|
561
|
-
<TreegeRenderer
|
|
561
|
+
<TreegeRenderer flow={flow} />
|
|
562
562
|
</TreegeConfigProvider>
|
|
563
563
|
);
|
|
564
564
|
}
|
|
@@ -572,7 +572,7 @@ When the flow is being fetched asynchronously, pass `isLoading` to render a skel
|
|
|
572
572
|
function App() {
|
|
573
573
|
const { data: flow, isPending } = useQuery(/* ... */);
|
|
574
574
|
|
|
575
|
-
return <TreegeRenderer
|
|
575
|
+
return <TreegeRenderer flow={flow ?? null} isLoading={isPending} onSubmit={console.log} />;
|
|
576
576
|
}
|
|
577
577
|
```
|
|
578
578
|
|
|
@@ -580,7 +580,7 @@ Customize the skeleton via `components.loadingSkeleton`:
|
|
|
580
580
|
|
|
581
581
|
```tsx
|
|
582
582
|
<TreegeRenderer
|
|
583
|
-
|
|
583
|
+
flow={flow}
|
|
584
584
|
isLoading={isPending}
|
|
585
585
|
components={{
|
|
586
586
|
loadingSkeleton: () => <MyCustomSkeleton />,
|
|
@@ -596,7 +596,7 @@ Override the default step layout via `components.step`:
|
|
|
596
596
|
|
|
597
597
|
```tsx
|
|
598
598
|
<TreegeRenderer
|
|
599
|
-
|
|
599
|
+
flow={flow}
|
|
600
600
|
components={{
|
|
601
601
|
step: ({ label, children, isFirstStep, isLastStep, canContinue, onBack, onContinue }) => (
|
|
602
602
|
<section>
|
|
@@ -627,12 +627,11 @@ function CustomForm({ flow }) {
|
|
|
627
627
|
formErrors,
|
|
628
628
|
visibleNodes,
|
|
629
629
|
isSubmitting,
|
|
630
|
-
// step navigation
|
|
631
630
|
currentStep,
|
|
632
631
|
goToNextStep,
|
|
633
632
|
goToPreviousStep,
|
|
634
633
|
} = useTreegeRenderer({
|
|
635
|
-
|
|
634
|
+
flow,
|
|
636
635
|
onSubmit: (values) => console.log("Submitted:", values),
|
|
637
636
|
});
|
|
638
637
|
|
|
@@ -706,7 +705,7 @@ Once the development server is running, you can access these examples:
|
|
|
706
705
|
|
|
707
706
|
| Prop | Type | Default | Description |
|
|
708
707
|
|------------------|---------------------------------------------|--------------|------------------------------------------------------------|
|
|
709
|
-
| `
|
|
708
|
+
| `flow` | `Flow \| null` | - | Decision tree to render |
|
|
710
709
|
| `onSubmit` | `(values: FormValues, meta?: Meta) => void` | - | Form submission handler (meta includes HTTP response data) |
|
|
711
710
|
| `onChange` | `(values: FormValues) => void` | - | Form change handler |
|
|
712
711
|
| `validate` | `(values, nodes) => Record<string, string>` | - | Custom validation function |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, N as r, O as i, P as a, S as o, T as s, b as c, d as l, h as u, i as d, j as f, k as p, r as m, s as h, t as g, w as _, y as v } from "./ThemeContext-
|
|
1
|
+
import { C as e, D as t, E as n, N as r, O as i, P as a, S as o, T as s, b as c, d as l, h as u, i as d, j as f, k as p, r as m, s as h, t as g, w as _, y as v } from "./ThemeContext-ClYtPOGK.js";
|
|
2
2
|
import * as y from "react";
|
|
3
3
|
import { forwardRef as b, useCallback as x, useEffect as S, useMemo as C, useRef as w, useState as T } from "react";
|
|
4
4
|
import { Fragment as ee, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
@@ -1582,11 +1582,11 @@ var Nt = () => /* @__PURE__ */ D("section", {
|
|
|
1582
1582
|
href: "treege-renderer",
|
|
1583
1583
|
precedence: "default",
|
|
1584
1584
|
children: Pt
|
|
1585
|
-
}), It = ({ baseUrl: e, components: t, className: n,
|
|
1585
|
+
}), It = ({ baseUrl: e, components: t, className: n, flow: i, googleApiKey: a, headers: o, language: s, onChange: c, onSubmit: l, theme: u, validate: f, validationMode: p, initialValues: h = {}, isLoading: _ = !1 }) => {
|
|
1586
1586
|
let { canContinueStep: v, canSubmit: y, clearSubmitMessage: b, config: S, currentStep: w, currentStepGroupNode: T, currentStepIndex: ee, firstErrorFieldId: te, formErrors: O, formValues: k, goToNextStep: ne, goToPreviousStep: A, handleSubmit: j, inputNodes: re, isFirstStep: M, isLastStep: N, isSubmitting: ie, missingRequiredFields: P, setFieldValue: F, steps: I, submitMessage: L, t: R } = d({
|
|
1587
1587
|
baseUrl: e,
|
|
1588
1588
|
components: t,
|
|
1589
|
-
|
|
1589
|
+
flow: i,
|
|
1590
1590
|
googleApiKey: a,
|
|
1591
1591
|
headers: o,
|
|
1592
1592
|
initialValues: h,
|
|
@@ -1630,7 +1630,7 @@ var Nt = () => /* @__PURE__ */ D("section", {
|
|
|
1630
1630
|
children: _ ? /* @__PURE__ */ E(B, {}) : /* @__PURE__ */ D(r, {
|
|
1631
1631
|
value: {
|
|
1632
1632
|
baseUrl: S.baseUrl,
|
|
1633
|
-
|
|
1633
|
+
flow: i,
|
|
1634
1634
|
formErrors: O,
|
|
1635
1635
|
formValues: k,
|
|
1636
1636
|
googleApiKey: S.googleApiKey,
|
|
@@ -529,7 +529,7 @@ var d = (e) => e?.type === "input", f = (e) => e?.type === "ui", p = (e) => e?.t
|
|
|
529
529
|
ui: "ui"
|
|
530
530
|
}, O = {
|
|
531
531
|
baseUrl: void 0,
|
|
532
|
-
|
|
532
|
+
flow: null,
|
|
533
533
|
formErrors: {},
|
|
534
534
|
formValues: {},
|
|
535
535
|
googleApiKey: void 0,
|
|
@@ -548,7 +548,7 @@ var d = (e) => e?.type === "input", f = (e) => e?.type === "ui", p = (e) => e?.t
|
|
|
548
548
|
children: e
|
|
549
549
|
});
|
|
550
550
|
}, A = () => {
|
|
551
|
-
let e = r(k) ?? O, t = a(() => e.
|
|
551
|
+
let e = r(k) ?? O, t = a(() => e.flow?.edges ?? [], [e.flow]);
|
|
552
552
|
return {
|
|
553
553
|
...e,
|
|
554
554
|
edges: t
|
|
@@ -1050,7 +1050,7 @@ var M = [
|
|
|
1050
1050
|
groupId: n,
|
|
1051
1051
|
nodes: [t]
|
|
1052
1052
|
}];
|
|
1053
|
-
}, []), Te = ({ baseUrl: e, components: t,
|
|
1053
|
+
}, []), Te = ({ baseUrl: e, components: t, flow: r, googleApiKey: c, headers: l, language: u, onChange: f, onSubmit: m, theme: h, validate: g, validationMode: _, initialValues: v = {} }) => {
|
|
1054
1054
|
let y = de(), b = a(() => ({
|
|
1055
1055
|
baseUrl: e ?? y?.baseUrl,
|
|
1056
1056
|
components: {
|
|
@@ -1070,20 +1070,20 @@ var M = [
|
|
|
1070
1070
|
},
|
|
1071
1071
|
googleApiKey: c ?? y?.googleApiKey,
|
|
1072
1072
|
headers: I(y?.headers, l),
|
|
1073
|
-
language:
|
|
1074
|
-
theme:
|
|
1075
|
-
validationMode:
|
|
1073
|
+
language: u ?? y?.language ?? "en",
|
|
1074
|
+
theme: h ?? y?.theme ?? "dark",
|
|
1075
|
+
validationMode: _ ?? y?.validationMode ?? "onSubmit"
|
|
1076
1076
|
}), [
|
|
1077
1077
|
e,
|
|
1078
1078
|
t,
|
|
1079
1079
|
y,
|
|
1080
1080
|
c,
|
|
1081
1081
|
l,
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1082
|
+
u,
|
|
1083
|
+
h,
|
|
1084
|
+
_
|
|
1085
1085
|
]), x = a(() => r?.nodes ?? [], [r]), S = a(() => r?.edges ?? [], [r]), C = a(() => oe(x), [x]), w = ne(b.language), T = o({}), [E, D] = s({}), [O, k] = s(() => {
|
|
1086
|
-
let e = { ...
|
|
1086
|
+
let e = { ...v };
|
|
1087
1087
|
return x.forEach((t) => {
|
|
1088
1088
|
if (d(t)) {
|
|
1089
1089
|
let n = t.id;
|
|
@@ -1105,7 +1105,7 @@ var M = [
|
|
|
1105
1105
|
return x.forEach((t) => {
|
|
1106
1106
|
p(t) && e.set(t.id, t);
|
|
1107
1107
|
}), e;
|
|
1108
|
-
}, [x]), [N, P] = s(0), F = M.length === 0 ? 0 : Math.min(N, M.length - 1), L = M[F], R = L?.groupId ? te.get(L.groupId) : void 0, z = F === 0, B = M.length === 0 || F >= M.length - 1, { clearSubmitMessage: re, handleSubmitWithConfig: V, hasSubmitConfig: H, isSubmitting: ie, submitMessage: U } = he(A, O, b.language, C, b.headers, b.baseUrl), ae = o(
|
|
1108
|
+
}, [x]), [N, P] = s(0), F = M.length === 0 ? 0 : Math.min(N, M.length - 1), L = M[F], R = L?.groupId ? te.get(L.groupId) : void 0, z = F === 0, B = M.length === 0 || F >= M.length - 1, { clearSubmitMessage: re, handleSubmitWithConfig: V, hasSubmitConfig: H, isSubmitting: ie, submitMessage: U } = he(A, O, b.language, C, b.headers, b.baseUrl), ae = o(f), W = o(g), G = a(() => se(O, C), [O, C]), K = n((e, t) => {
|
|
1109
1109
|
k((n) => ({
|
|
1110
1110
|
...n,
|
|
1111
1111
|
[e]: t
|
|
@@ -1161,17 +1161,17 @@ var M = [
|
|
|
1161
1161
|
if (!e) return !1;
|
|
1162
1162
|
if (H) {
|
|
1163
1163
|
let e = await V((e) => {
|
|
1164
|
-
|
|
1164
|
+
m && m(G, { httpResponse: e });
|
|
1165
1165
|
});
|
|
1166
|
-
if (e === null) return
|
|
1166
|
+
if (e === null) return m?.(G), !0;
|
|
1167
1167
|
if (!e.success) return !0;
|
|
1168
|
-
} else
|
|
1168
|
+
} else m && m(G);
|
|
1169
1169
|
return !0;
|
|
1170
1170
|
}, [
|
|
1171
1171
|
J,
|
|
1172
1172
|
H,
|
|
1173
1173
|
V,
|
|
1174
|
-
|
|
1174
|
+
m,
|
|
1175
1175
|
G
|
|
1176
1176
|
]), ue = a(() => {
|
|
1177
1177
|
let e = [];
|
|
@@ -1198,10 +1198,10 @@ var M = [
|
|
|
1198
1198
|
}
|
|
1199
1199
|
N > M.length - 1 && P(M.length - 1);
|
|
1200
1200
|
}, [M.length, N]), i(() => {
|
|
1201
|
-
ae.current =
|
|
1202
|
-
}, [
|
|
1203
|
-
W.current =
|
|
1204
|
-
}, [
|
|
1201
|
+
ae.current = f;
|
|
1202
|
+
}, [f]), i(() => {
|
|
1203
|
+
W.current = g;
|
|
1204
|
+
}, [g]), i(() => {
|
|
1205
1205
|
ae.current?.(G);
|
|
1206
1206
|
}, [G]), i(() => {
|
|
1207
1207
|
b.validationMode === "onChange" && J(W.current);
|
|
@@ -10,14 +10,6 @@ export declare const VERTICAL_NODE_SPACING = 100;
|
|
|
10
10
|
* Horizontal offset when placing sibling nodes (in pixels)
|
|
11
11
|
*/
|
|
12
12
|
export declare const HORIZONTAL_NODE_OFFSET = 50;
|
|
13
|
-
/**
|
|
14
|
-
* Horizontal spacing for AI-generated flows (in pixels)
|
|
15
|
-
*/
|
|
16
|
-
export declare const AI_HORIZONTAL_SPACING = 350;
|
|
17
|
-
/**
|
|
18
|
-
* Position tolerance for detecting nodes at the same Y position (in pixels)
|
|
19
|
-
*/
|
|
20
|
-
export declare const POSITION_TOLERANCE = 20;
|
|
21
13
|
/**
|
|
22
14
|
* Default direction for the auto-layout algorithm.
|
|
23
15
|
* "TB" = top to bottom, "LR" = left to right.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as e, C as t, E as n, F as r, H as i, I as a, L as o, M as s, N as c, O as l, T as u, V as d, _ as f, t as p, v as m, w as h, z as g } from "./ThemeContext-
|
|
2
|
-
import { $ as _, A as v, B as y, D as b, F as x, G as S, H as C, I as w, J as T, K as E, L as D, M as O, N as k, O as A, P as j, Q as M, R as ee, U as te, V as ne, W as N, X as re, Y as ie, Z as P, at as F, c as ae, ct as I, et as oe, g as se, h as ce, it as L, j as le, k as ue, nt as R, o as de, ot as fe, q as pe, rt as z, st as B, t as me, tt as he, z as ge } from "./DefaultInputs-
|
|
1
|
+
import { B as e, C as t, E as n, F as r, H as i, I as a, L as o, M as s, N as c, O as l, T as u, V as d, _ as f, t as p, v as m, w as h, z as g } from "./ThemeContext-ClYtPOGK.js";
|
|
2
|
+
import { $ as _, A as v, B as y, D as b, F as x, G as S, H as C, I as w, J as T, K as E, L as D, M as O, N as k, O as A, P as j, Q as M, R as ee, U as te, V as ne, W as N, X as re, Y as ie, Z as P, at as F, c as ae, ct as I, et as oe, g as se, h as ce, it as L, j as le, k as ue, nt as R, o as de, ot as fe, q as pe, rt as z, st as B, t as me, tt as he, z as ge } from "./DefaultInputs-CoDN_KvC.js";
|
|
3
3
|
import { Background as _e, BackgroundVariant as ve, BaseEdge as ye, ControlButton as be, Controls as xe, EdgeLabelRenderer as Se, Handle as Ce, MiniMap as we, Panel as Te, Position as Ee, ReactFlow as De, ReactFlowProvider as Oe, addEdge as ke, getBezierPath as Ae, useConnection as je, useEdges as Me, useNodes as Ne, useNodesInitialized as Pe, useReactFlow as Fe, useStore as Ie, useUpdateNodeInternals as Le } from "@xyflow/react";
|
|
4
4
|
import * as Re from "react";
|
|
5
5
|
import ze, { createContext as Be, memo as Ve, useCallback as V, useContext as He, useEffect as H, useId as Ue, useMemo as U, useRef as We, useState as W } from "react";
|
|
@@ -1304,7 +1304,7 @@ var Jn = ({ onSelect: e }) => {
|
|
|
1304
1304
|
g || i || (e.preventDefault(), c(!0));
|
|
1305
1305
|
},
|
|
1306
1306
|
"aria-label": h(i ? "editor.stackedEdge.createBranch" : "editor.stackedEdge.addNode"),
|
|
1307
|
-
className: I("tg:flex tg:h-6! tg:w-6! tg:cursor-pointer tg:items-center tg:justify-center tg:rounded-sm tg:transition tg:hover:bg-primary/80!", g ? "tg:pointer-events-none tg:opacity-0" : "tg:relative! tg:
|
|
1307
|
+
className: I("tg:flex tg:h-6! tg:w-6! tg:cursor-pointer tg:items-center tg:justify-center tg:rounded-sm tg:transition tg:hover:bg-primary/80!", g ? "tg:pointer-events-none tg:opacity-0" : "tg:relative! tg:transform-none! tg:inset-auto!"),
|
|
1308
1308
|
children: !g && K(i ? ht : J, { className: "tg:h-4 tg:w-4 tg:text-primary-foreground" })
|
|
1309
1309
|
});
|
|
1310
1310
|
return /* @__PURE__ */ q("div", {
|
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-Cd_ifJTX.js";
|
|
2
|
+
import { n as t, t as n } from "./ThemeContext-ClYtPOGK.js";
|
|
3
3
|
export { n as ThemeProvider, e as TreegeEditor, t as useTheme };
|
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./editor-
|
|
2
|
-
import { A as t, B as n, H as r, R as i, V as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, j as m, l as h, m as g, n as _, o as v, p as y, s as b, t as x, u as S, x as C, y as w, z as T } from "./ThemeContext-
|
|
3
|
-
import { C as E, E as D, S as O, T as k, _ as A, a as j, b as M, d as N, f as P, i as F, l as I, m as L, n as R, p as z, r as B, s as V, t as H, u as U, v as W, w as G, x as K, y as q } from "./DefaultInputs-
|
|
1
|
+
import { t as e } from "./editor-Cd_ifJTX.js";
|
|
2
|
+
import { A as t, B as n, H as r, R as i, V as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, j as m, l as h, m as g, n as _, o as v, p as y, s as b, t as x, u as S, x as C, y as w, z as T } from "./ThemeContext-ClYtPOGK.js";
|
|
3
|
+
import { C as E, E as D, S as O, T as k, _ as A, a as j, b as M, d as N, f as P, i as F, l as I, m as L, n as R, p as z, r as B, s as V, t as H, u as U, v as W, w as G, x as K, y as q } from "./DefaultInputs-CoDN_KvC.js";
|
|
4
4
|
export { D as DefaultAddressInput, k as DefaultAutocompleteInput, G as DefaultCheckboxInput, E as DefaultDateInput, O as DefaultDateRangeInput, K as DefaultFileInput, M as DefaultHiddenInput, q as DefaultHttpInput, W as DefaultNumberInput, A as DefaultPasswordInput, L as DefaultRadioInput, z as DefaultSelectInput, V as DefaultSwitchInput, j as DefaultTextAreaInput, F as DefaultTextInput, B as DefaultTimeInput, R as DefaultTimeRangeInput, U as Divider, x as ThemeProvider, N as Title, S as TreegeConfigProvider, e as TreegeEditor, I as TreegeRenderer, u as applyReferenceTransformation, y as calculateReferenceFieldUpdates, g as checkFormFieldHasValue, f as convertFormValuesToNamedFormat, H as defaultInputRenderers, P as defaultUI, c as evaluateCondition, h as evaluateConditions, w as fileToSerializable, s as filesToSerializable, o as findStartNode, v as getFlowRenderState, i as getStaticTranslations, T as getTranslatedText, d as isFieldEmpty, n as isGroupNode, a as isInputNode, b as isStartNode, r as isUINode, t as sanitize, m as sanitizeHttpResponse, C as serializableToFile, _ as useTheme, l as useTreegeConfig, p as useTreegeRenderer };
|
|
@@ -13,7 +13,7 @@ export interface TreegeRendererContextValue {
|
|
|
13
13
|
* The flow currently being rendered. `null` when the renderer has no flow
|
|
14
14
|
* to display yet.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
flow?: Flow | null;
|
|
17
17
|
/**
|
|
18
18
|
* Validation errors keyed by field id (`node.id`). Empty when the form
|
|
19
19
|
* is valid. Renderers read their own entry to display field-level errors.
|
|
@@ -84,7 +84,7 @@ export declare const useTreegeRendererContext: () => {
|
|
|
84
84
|
* The flow currently being rendered. `null` when the renderer has no flow
|
|
85
85
|
* to display yet.
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
flow?: Flow | null;
|
|
88
88
|
/**
|
|
89
89
|
* Validation errors keyed by field id (`node.id`). Empty when the form
|
|
90
90
|
* is valid. Renderers read their own entry to display field-level errors.
|
|
@@ -16,10 +16,10 @@ import { GroupNodeData, TreegeNodeData } from '../../../shared/types/node';
|
|
|
16
16
|
* - Submit handling (with HTTP integration support)
|
|
17
17
|
* - Side effects (onChange callbacks, validation modes, reference field sync)
|
|
18
18
|
*
|
|
19
|
-
* @param props - Configuration props (
|
|
19
|
+
* @param props - Configuration props (flow, initialValues, callbacks, etc.)
|
|
20
20
|
* @returns Complete form state and control methods
|
|
21
21
|
*/
|
|
22
|
-
export declare const useTreegeRenderer: ({ baseUrl, components,
|
|
22
|
+
export declare const useTreegeRenderer: ({ baseUrl, components, flow, googleApiKey, headers, language, onChange, onSubmit, theme, validate, validationMode, initialValues, }: Pick<TreegeRendererProps, "baseUrl" | "components" | "flow" | "googleApiKey" | "headers" | "initialValues" | "language" | "onChange" | "onSubmit" | "theme" | "validate" | "validationMode">) => {
|
|
23
23
|
canContinueStep: boolean;
|
|
24
24
|
canSubmit: boolean;
|
|
25
25
|
clearSubmitMessage: () => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TreegeRendererProps } from '../../../types/renderer';
|
|
2
|
-
declare const TreegeRenderer: ({ baseUrl, components, className,
|
|
2
|
+
declare const TreegeRenderer: ({ baseUrl, components, className, flow, googleApiKey, headers, language, onChange, onSubmit, theme, validate, validationMode, initialValues, isLoading, }: TreegeRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TreegeRenderer;
|
|
@@ -304,7 +304,7 @@ export type TreegeRendererConfig = {
|
|
|
304
304
|
*
|
|
305
305
|
* @example
|
|
306
306
|
* // In the tree: "url": "/v2/entities/{{nodeId}}/sub-entities"
|
|
307
|
-
* <TreegeRenderer
|
|
307
|
+
* <TreegeRenderer flow={tree} baseUrl={import.meta.env.VITE_API_URL} />
|
|
308
308
|
*
|
|
309
309
|
* Absolute urls (starting with `http://` or `https://`) are left untouched,
|
|
310
310
|
* so a field can still point at an external API. Template variables are
|
|
@@ -317,7 +317,7 @@ export type TreegeRendererConfig = {
|
|
|
317
317
|
*
|
|
318
318
|
* Inherits all configuration fields from TreegeRendererConfig (components,
|
|
319
319
|
* headers, googleApiKey, language, theme, validationMode) and adds the
|
|
320
|
-
* instance-specific ones (
|
|
320
|
+
* instance-specific ones (flow, callbacks, initial values, etc.).
|
|
321
321
|
*/
|
|
322
322
|
export interface TreegeRendererProps extends TreegeRendererConfig {
|
|
323
323
|
/**
|
|
@@ -327,7 +327,7 @@ export interface TreegeRendererProps extends TreegeRendererConfig {
|
|
|
327
327
|
/**
|
|
328
328
|
* Flow to render. `null` / `undefined` renders nothing.
|
|
329
329
|
*/
|
|
330
|
-
|
|
330
|
+
flow?: Flow | null;
|
|
331
331
|
/**
|
|
332
332
|
* Initial form values
|
|
333
333
|
*/
|
package/dist/renderer-native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as e, N as t, O as n, P as r, S as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, k as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, w as C, x as w, y as T, z as E } from "./ThemeContext-
|
|
1
|
+
import { E as e, N as t, O as n, P as r, S as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, k as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, w as C, x as w, y as T, z as E } from "./ThemeContext-ClYtPOGK.js";
|
|
2
2
|
import { useCallback as ee, useEffect as D, useMemo as O, useRef as k, useState as A } from "react";
|
|
3
3
|
import { Fragment as te, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
4
4
|
import { ActivityIndicator as N, Alert as P, Animated as F, FlatList as I, Image as ne, Modal as re, ScrollView as ie, StyleSheet as L, Switch as R, Text as z, TextInput as B, TouchableOpacity as V, View as H } from "react-native";
|
|
@@ -3579,11 +3579,11 @@ var ae = ({ children: e }) => /* @__PURE__ */ j(H, {
|
|
|
3579
3579
|
marginBottom: 24,
|
|
3580
3580
|
width: "33%"
|
|
3581
3581
|
}
|
|
3582
|
-
}), rt = ({ baseUrl: e, components: n, contentContainerStyle: r,
|
|
3582
|
+
}), rt = ({ baseUrl: e, components: n, contentContainerStyle: r, flow: i, googleApiKey: a, headers: o, initialValues: s, isLoading: c = !1, language: l, onChange: u, onSubmit: d, style: p, theme: m, validate: h, validationMode: _ }) => {
|
|
3583
3583
|
let { colors: v } = g(), { canContinueStep: b, canSubmit: x, clearSubmitMessage: S, config: C, currentStep: w, currentStepGroupNode: T, currentStepIndex: E, formErrors: D, formValues: k, goToNextStep: A, goToPreviousStep: te, handleSubmit: N, inputNodes: P, isFirstStep: F, isLastStep: I, isSubmitting: ne, missingRequiredFields: re, setFieldValue: L, steps: R, submitMessage: B, t: V } = f({
|
|
3584
3584
|
baseUrl: e,
|
|
3585
3585
|
components: n,
|
|
3586
|
-
|
|
3586
|
+
flow: i,
|
|
3587
3587
|
googleApiKey: a,
|
|
3588
3588
|
headers: o,
|
|
3589
3589
|
initialValues: s,
|
|
@@ -3628,7 +3628,7 @@ var ae = ({ children: e }) => /* @__PURE__ */ j(H, {
|
|
|
3628
3628
|
children: c ? /* @__PURE__ */ j(U, {}) : /* @__PURE__ */ M(t, {
|
|
3629
3629
|
value: {
|
|
3630
3630
|
baseUrl: C.baseUrl,
|
|
3631
|
-
|
|
3631
|
+
flow: i,
|
|
3632
3632
|
formErrors: D,
|
|
3633
3633
|
formValues: k,
|
|
3634
3634
|
googleApiKey: C.googleApiKey,
|
package/dist/renderer.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, j as l, l as u, m as d, n as f, o as p, p as m, s as h, t as g, u as _, x as v, y, z as b } from "./ThemeContext-
|
|
2
|
-
import { C as x, E as S, S as C, T as w, _ as T, a as E, b as D, d as O, f as k, i as A, l as j, m as M, n as N, p as P, r as F, s as I, t as L, u as R, v as z, w as B, x as V, y as H } from "./DefaultInputs-
|
|
1
|
+
import { A as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, j as l, l as u, m as d, n as f, o as p, p as m, s as h, t as g, u as _, x as v, y, z as b } from "./ThemeContext-ClYtPOGK.js";
|
|
2
|
+
import { C as x, E as S, S as C, T as w, _ as T, a as E, b as D, d as O, f as k, i as A, l as j, m as M, n as N, p as P, r as F, s as I, t as L, u as R, v as z, w as B, x as V, y as H } from "./DefaultInputs-CoDN_KvC.js";
|
|
3
3
|
export { S as DefaultAddressInput, w as DefaultAutocompleteInput, B as DefaultCheckboxInput, x as DefaultDateInput, C as DefaultDateRangeInput, V as DefaultFileInput, D as DefaultHiddenInput, H as DefaultHttpInput, z as DefaultNumberInput, T as DefaultPasswordInput, M as DefaultRadioInput, P as DefaultSelectInput, I as DefaultSwitchInput, E as DefaultTextAreaInput, A as DefaultTextInput, F as DefaultTimeInput, N as DefaultTimeRangeInput, R as Divider, g as ThemeProvider, O as Title, _ as TreegeConfigProvider, j as TreegeRenderer, a as applyReferenceTransformation, m as calculateReferenceFieldUpdates, d as checkFormFieldHasValue, s as convertFormValuesToNamedFormat, L as defaultInputRenderers, k as defaultUI, r as evaluateCondition, u as evaluateConditions, y as fileToSerializable, n as filesToSerializable, t as findStartNode, p as getFlowRenderState, b as getTranslatedText, o as isFieldEmpty, h as isStartNode, e as sanitize, l as sanitizeHttpResponse, v as serializableToFile, f as useTheme, i as useTreegeConfig, c as useTreegeRenderer };
|