treege 3.0.0-beta.9 → 3.0.0-beta.91
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/LICENSE +18 -12
- package/README.md +598 -79
- package/dist/DefaultSubmitButton-NeSDqyzv.js +1909 -0
- package/dist/ThemeContext-CPsC8QIP.js +1008 -0
- package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
- package/dist/editor/components/styles/EditorStyles.d.ts +2 -0
- package/dist/editor/constants/defaultNode.d.ts +1 -1
- package/dist/editor/constants/edgeTypes.d.ts +3 -2
- package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
- package/dist/editor/constants/nodeSpacing.d.ts +25 -0
- package/dist/editor/constants/nodeTypes.d.ts +4 -5
- package/dist/editor/context/OpenApiContext.d.ts +79 -0
- package/dist/editor/context/TreegeEditorRuntimeProvider.d.ts +78 -0
- package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
- package/dist/editor/features/TreegeEditor/controls/MiniMapControl.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/dialogs/AuthorizeDialog.d.ts +20 -0
- package/dist/editor/features/TreegeEditor/dialogs/ChangeNodeTypeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/dialogs/DeleteNodeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/dialogs/HeadersDialog.d.ts +19 -0
- package/dist/editor/features/TreegeEditor/dialogs/OpenApiDialog.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
- package/dist/editor/features/TreegeEditor/forms/HttpConfigForm.d.ts +4 -1
- package/dist/editor/features/TreegeEditor/forms/JsonTemplateEditor.d.ts +13 -0
- package/dist/editor/features/TreegeEditor/forms/OptionsMappingFields.d.ts +34 -0
- package/dist/editor/features/TreegeEditor/forms/OptionsSourceForm.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/forms/SensitiveHeaderWarning.d.ts +13 -0
- package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/inputs/ApiUrlCombobox.d.ts +20 -0
- package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
- package/dist/editor/features/TreegeEditor/inputs/DefaultFileValueField.d.ts +14 -0
- package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/inputs/SelectNodeGroup.d.ts +22 -1
- package/dist/editor/features/TreegeEditor/inputs/TranslatableInput.d.ts +20 -0
- package/dist/editor/features/TreegeEditor/layout/AutoLayout.d.ts +15 -0
- package/dist/editor/features/TreegeEditor/listeners/FlowChangeEmitter.d.ts +19 -0
- package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +5 -0
- package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +25 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeImage.d.ts +5 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeImageButton.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +12 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +10 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeRequiredButton.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeStackOrderButtons.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeTypeBadge.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeTypePickerMenuContent.d.ts +12 -0
- package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +4 -2
- package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
- package/dist/editor/features/TreegeEditor/panel/ActionsPanel.d.ts +7 -2
- package/dist/editor/features/TreegeEditor/panel/MultiSelectionPanel.d.ts +7 -0
- package/dist/editor/hooks/useAvailableParentFields.d.ts +13 -0
- package/dist/editor/hooks/useFlowActions.d.ts +6 -2
- package/dist/editor/hooks/useFlowConnections.d.ts +14 -0
- package/dist/editor/hooks/useFlowContent.d.ts +16 -0
- package/dist/editor/hooks/useHistoryStore.d.ts +26 -0
- package/dist/editor/hooks/useIsStackedEdge.d.ts +8 -0
- package/dist/editor/hooks/useKeyValueRows.d.ts +15 -0
- package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
- package/dist/editor/hooks/useStackPosition.d.ts +14 -0
- package/dist/editor/hooks/useTranslate.d.ts +1 -1
- package/dist/editor/hooks/useUndoRedo.d.ts +31 -0
- package/dist/editor/types/ai.d.ts +65 -0
- package/dist/editor/types/editor.d.ts +106 -10
- package/dist/editor/types/openapi.d.ts +106 -0
- package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
- package/dist/editor/utils/cleanEmptyData.d.ts +18 -0
- package/dist/editor/utils/cleanNodeConfig.d.ts +5 -0
- package/dist/editor/utils/dagreLayout.d.ts +8 -0
- package/dist/editor/utils/edge.d.ts +50 -0
- package/dist/editor/utils/groupColor.d.ts +14 -0
- package/dist/editor/utils/image.d.ts +7 -0
- package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
- package/dist/editor/utils/jsonBindTarget.d.ts +15 -0
- package/dist/editor/utils/openApiPayload.d.ts +12 -0
- package/dist/editor/utils/openapi.d.ts +35 -0
- package/dist/editor/utils/sensitiveHeaders.d.ts +20 -0
- package/dist/editor/utils/stackPositionIndex.d.ts +9 -0
- package/dist/editor-DJbNgLSF.js +6485 -0
- package/dist/editor.js +3 -7
- package/dist/main.js +6 -52
- package/dist/renderer/context/TreegeRenderRuntimeProvider.d.ts +135 -0
- package/dist/renderer/context/TreegeRendererProvider.d.ts +15 -0
- package/dist/renderer/context/TreegeViewerProvider.d.ts +28 -0
- package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputLabel.d.ts +10 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputWrapper.d.ts +9 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +20 -15
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultLoadingSkeleton.d.ts +8 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultStep.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DependencyHint.d.ts +15 -0
- package/dist/renderer/features/TreegeRenderer/native/components/OptionItemContent.d.ts +17 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSubmitInput.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +97 -24
- package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultFormWrapper.d.ts +3 -2
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputLabel.d.ts +9 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputWrapper.d.ts +9 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultLoadingSkeleton.d.ts +7 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultStep.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +5 -1
- package/dist/renderer/features/TreegeRenderer/web/components/DependencyHint.d.ts +22 -0
- package/dist/renderer/features/TreegeRenderer/web/components/OptionItemContent.d.ts +17 -0
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/styles/RendererStyles.d.ts +2 -0
- package/dist/renderer/features/TreegeViewer/utils/viewerFields.d.ts +102 -0
- package/dist/renderer/features/TreegeViewer/web/TreegeViewer.d.ts +94 -0
- package/dist/renderer/hooks/useInputOptions.d.ts +28 -0
- package/dist/renderer/hooks/useRenderNode.d.ts +62 -0
- package/dist/renderer/hooks/useSubmitHandler.d.ts +37 -0
- package/dist/renderer/hooks/useTranslate.d.ts +7 -5
- package/dist/renderer/index.d.ts +10 -2
- package/dist/renderer/index.native.d.ts +20 -0
- package/dist/renderer/types/renderer.d.ts +332 -49
- package/dist/renderer/utils/extraPayload.d.ts +21 -0
- package/dist/renderer/utils/file.d.ts +24 -10
- package/dist/renderer/utils/flow.d.ts +1 -18
- package/dist/renderer/utils/form.d.ts +54 -2
- package/dist/renderer/utils/http.d.ts +177 -0
- package/dist/renderer/utils/jsonTemplate.d.ts +30 -0
- package/dist/renderer/utils/node.d.ts +29 -1
- package/dist/renderer/utils/sanitize.d.ts +85 -0
- package/dist/renderer/utils/sanitize.native.d.ts +69 -0
- package/dist/renderer/utils/step.d.ts +27 -0
- package/dist/renderer/utils/submit.d.ts +50 -0
- package/dist/renderer/utils/templateDependencies.d.ts +17 -0
- package/dist/renderer-CNbSt_QW.js +446 -0
- package/dist/renderer-native.d.ts +2 -0
- package/dist/renderer-native.js +3696 -0
- package/dist/renderer.js +5 -45
- package/dist/shared/components/ui/badge.d.ts +2 -2
- package/dist/shared/components/ui/button.d.ts +3 -3
- package/dist/shared/components/ui/collapsible.d.ts +1 -1
- package/dist/shared/components/ui/command.d.ts +1 -1
- package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/shared/components/ui/field.d.ts +24 -0
- package/dist/shared/components/ui/form.d.ts +1 -1
- package/dist/shared/components/ui/item.d.ts +23 -0
- package/dist/shared/components/ui/popover.d.ts +10 -2
- package/dist/shared/components/ui/select.d.ts +3 -1
- package/dist/shared/components/ui/sheet.d.ts +1 -1
- package/dist/shared/components/ui/skeleton.d.ts +3 -0
- package/dist/shared/components/ui/toggle-group.d.ts +7 -0
- package/dist/shared/components/ui/toggle.d.ts +9 -0
- package/dist/shared/components/ui/tooltip.d.ts +1 -1
- package/dist/shared/constants/colors.d.ts +45 -0
- package/dist/shared/constants/inputType.d.ts +6 -0
- package/dist/shared/constants/node.d.ts +0 -1
- package/dist/shared/context/PortalContainerContext.d.ts +5 -0
- package/dist/shared/context/ThemeContext.d.ts +2 -0
- package/dist/shared/context/ThemeContext.native.d.ts +22 -0
- package/dist/shared/hooks/useMediaQuery.d.ts +12 -0
- package/dist/shared/hooks/useThemeColors.d.ts +37 -0
- package/dist/shared/locales/ar.json.d.ts +259 -19
- package/dist/shared/locales/de.json.d.ts +260 -20
- package/dist/shared/locales/en.json.d.ts +261 -21
- package/dist/shared/locales/es.json.d.ts +260 -20
- package/dist/shared/locales/fr.json.d.ts +260 -20
- package/dist/shared/locales/it.json.d.ts +260 -20
- package/dist/shared/locales/pt.json.d.ts +260 -20
- package/dist/shared/types/edge.d.ts +6 -0
- package/dist/shared/types/file.d.ts +14 -0
- package/dist/shared/types/node.d.ts +155 -19
- package/dist/shared/utils/httpRecord.d.ts +20 -0
- package/dist/shared/utils/inputTypeGuards.d.ts +7 -0
- package/dist/shared/utils/nodeTypeGuards.d.ts +1 -6
- package/dist/shared/utils/normalizeLabel.d.ts +22 -0
- package/dist/shared/utils/translations.d.ts +21 -1
- package/dist/useRenderNode-CG466pNk.js +538 -0
- package/package.json +54 -22
- package/dist/ThemeContext-BIvs8Kw-.js +0 -758
- package/dist/TreegeEditor-Lv5Tn9_F.js +0 -2152
- package/dist/TreegeRenderer-BVaqgInZ.js +0 -1405
- package/dist/editor/context/TreegeEditorContext.d.ts +0 -12
- package/dist/editor/features/TreegeEditor/forms/FlowNodeForm.d.ts +0 -2
- package/dist/editor/features/TreegeEditor/inputs/SelectInputType.d.ts +0 -7
- package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
- package/dist/editor/hooks/useEdgesSelection.d.ts +0 -11
- package/dist/renderer/context/TreegeConfigContext.d.ts +0 -39
- package/dist/renderer/context/TreegeRendererContext.d.ts +0 -25
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +0 -7
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultGroup.d.ts +0 -6
- /package/dist/editor/components/{data-display/logo.d.ts → branding/Logo.d.ts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Edge, Node } from '@xyflow/react';
|
|
2
2
|
import { INPUT_TYPE } from '../constants/inputType';
|
|
3
3
|
import { UI_TYPE } from '../constants/uiType';
|
|
4
|
+
import { SerializableFile } from './file';
|
|
4
5
|
import { Translatable } from './translate';
|
|
5
6
|
export type UIType = (typeof UI_TYPE)[keyof typeof UI_TYPE];
|
|
6
7
|
export type InputType = (typeof INPUT_TYPE)[keyof typeof INPUT_TYPE];
|
|
@@ -18,10 +19,19 @@ export type InputOption = {
|
|
|
18
19
|
* The label of the option, which can be translated
|
|
19
20
|
*/
|
|
20
21
|
label: Translatable;
|
|
22
|
+
/**
|
|
23
|
+
* Optional secondary description, shown under the label (translatable)
|
|
24
|
+
*/
|
|
25
|
+
description?: Translatable;
|
|
21
26
|
/**
|
|
22
27
|
* Whether the option is disabled and cannot be selected
|
|
23
28
|
*/
|
|
24
29
|
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Optional image for the option, stored as base64 data URL or remote URL.
|
|
32
|
+
* Currently displayed by radio inputs; uploads are automatically resized and compressed.
|
|
33
|
+
*/
|
|
34
|
+
image?: string;
|
|
25
35
|
};
|
|
26
36
|
export type BaseNodeData = {
|
|
27
37
|
/**
|
|
@@ -29,28 +39,24 @@ export type BaseNodeData = {
|
|
|
29
39
|
*/
|
|
30
40
|
label?: Translatable;
|
|
31
41
|
};
|
|
32
|
-
export type FlowNodeData = BaseNodeData & {
|
|
33
|
-
/**
|
|
34
|
-
* The ID of the target node to connect to
|
|
35
|
-
*/
|
|
36
|
-
targetId?: string;
|
|
37
|
-
};
|
|
38
42
|
export type GroupNodeData = BaseNodeData & {
|
|
39
43
|
/**
|
|
40
44
|
* A label for the group node, which can be translated
|
|
41
45
|
*/
|
|
42
46
|
label: Translatable;
|
|
43
47
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
48
|
+
/**
|
|
49
|
+
* HTTP headers as a plain object keyed by header name, e.g.
|
|
50
|
+
* `{ Authorization: "Bearer xyz", "Content-Type": "application/json" }`.
|
|
51
|
+
* Values support template variables like `{{fieldId}}`.
|
|
52
|
+
*/
|
|
53
|
+
export type HttpHeaders = Record<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* Query parameters as a plain object keyed by parameter name, e.g.
|
|
56
|
+
* `{ limit: "10", sort: "asc" }`. Values support template variables like
|
|
57
|
+
* `{{fieldId}}`.
|
|
58
|
+
*/
|
|
59
|
+
export type QueryParams = Record<string, string>;
|
|
54
60
|
export type HttpConfig = {
|
|
55
61
|
/**
|
|
56
62
|
* The HTTP method to use
|
|
@@ -63,11 +69,19 @@ export type HttpConfig = {
|
|
|
63
69
|
/**
|
|
64
70
|
* Custom headers for the HTTP request
|
|
65
71
|
*/
|
|
66
|
-
headers?:
|
|
72
|
+
headers?: HttpHeaders;
|
|
73
|
+
/**
|
|
74
|
+
* Query parameters appended to the URL (supports template variables like {{fieldId}})
|
|
75
|
+
*/
|
|
76
|
+
queryParams?: QueryParams;
|
|
67
77
|
/**
|
|
68
78
|
* Request body (for POST/PUT/PATCH methods)
|
|
69
79
|
*/
|
|
70
80
|
body?: string;
|
|
81
|
+
/**
|
|
82
|
+
* If true, automatically sends all form data as JSON body (overrides custom body)
|
|
83
|
+
*/
|
|
84
|
+
sendAllFormValues?: boolean;
|
|
71
85
|
/**
|
|
72
86
|
* JSONPath or key to extract from the response
|
|
73
87
|
* Examples: "data.users", "results[0].name"
|
|
@@ -85,6 +99,14 @@ export type HttpConfig = {
|
|
|
85
99
|
* Path to the label field in response items
|
|
86
100
|
*/
|
|
87
101
|
labelField?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Path to the field used as the option description (optional)
|
|
104
|
+
*/
|
|
105
|
+
descriptionField?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Path to the field used as the option image — base64 data URL or remote URL (optional)
|
|
108
|
+
*/
|
|
109
|
+
imageField?: string;
|
|
88
110
|
};
|
|
89
111
|
/**
|
|
90
112
|
* Query parameter name for search (enables combobox with search)
|
|
@@ -100,6 +122,90 @@ export type HttpConfig = {
|
|
|
100
122
|
*/
|
|
101
123
|
showLoading?: boolean;
|
|
102
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* Maps response item fields to InputOption properties.
|
|
127
|
+
* Each value is a path expression (e.g., "id", "user.name", "items[0].title").
|
|
128
|
+
*/
|
|
129
|
+
export type OptionsSourceMapping = {
|
|
130
|
+
/** Path to the field used as InputOption.value */
|
|
131
|
+
valueField: string;
|
|
132
|
+
/** Path to the field used as InputOption.label */
|
|
133
|
+
labelField: string;
|
|
134
|
+
/** Path to the field used as InputOption.description (optional) */
|
|
135
|
+
descriptionField?: string;
|
|
136
|
+
/** Path to the field used as InputOption.image (optional) */
|
|
137
|
+
imageField?: string;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Dynamic options source — fetches the option list from an HTTP endpoint
|
|
141
|
+
* at runtime. Applies to inputs that use options (radio, checkbox, select,
|
|
142
|
+
* autocomplete). When set, overrides the static `options` array.
|
|
143
|
+
*/
|
|
144
|
+
export type OptionsSource = {
|
|
145
|
+
/** API URL (supports template variables like {{fieldId}}) */
|
|
146
|
+
url?: string;
|
|
147
|
+
/** HTTP method */
|
|
148
|
+
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
149
|
+
/** Custom headers (merged with global headers; field-level wins) */
|
|
150
|
+
headers?: HttpHeaders;
|
|
151
|
+
/** Query parameters appended to the URL (supports template variables like {{fieldId}}) */
|
|
152
|
+
queryParams?: QueryParams;
|
|
153
|
+
/** Request body (for POST/PUT/PATCH; supports template variables) */
|
|
154
|
+
body?: string;
|
|
155
|
+
/** JSONPath to extract the array from the response (e.g., "data.users") */
|
|
156
|
+
responsePath?: string;
|
|
157
|
+
/** Field-to-property mapping for each response item */
|
|
158
|
+
mapping?: OptionsSourceMapping;
|
|
159
|
+
};
|
|
160
|
+
export type SubmitConfig = {
|
|
161
|
+
/**
|
|
162
|
+
* The HTTP method to use for form submission
|
|
163
|
+
*/
|
|
164
|
+
method?: "POST" | "PUT" | "PATCH" | "DELETE";
|
|
165
|
+
/**
|
|
166
|
+
* The API URL to call on submit (supports template variables like {{fieldId}})
|
|
167
|
+
*/
|
|
168
|
+
url?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Custom headers for the HTTP request
|
|
171
|
+
*/
|
|
172
|
+
headers?: HttpHeaders;
|
|
173
|
+
/**
|
|
174
|
+
* Query parameters appended to the URL (supports template variables like {{fieldId}})
|
|
175
|
+
*/
|
|
176
|
+
queryParams?: QueryParams;
|
|
177
|
+
/**
|
|
178
|
+
* Free-form JSON template that defines the submitted payload. Field tokens
|
|
179
|
+
* sit inside string positions, e.g. `{"data": {"name": "{{firstName}}"}}`,
|
|
180
|
+
* where `{{token}}` is a field's node id (or its token-safe `name`) and is
|
|
181
|
+
* replaced by the field value with its JSON type preserved.
|
|
182
|
+
*
|
|
183
|
+
* This is the single source of truth for the payload: it is delivered to the
|
|
184
|
+
* `onSubmit` callback AND, when a `url` is configured, sent as the HTTP request
|
|
185
|
+
* body. Takes precedence over `sendAllFormValues`.
|
|
186
|
+
*/
|
|
187
|
+
payloadTemplate?: string;
|
|
188
|
+
/**
|
|
189
|
+
* If true, automatically sends all form data as JSON body (overrides custom body)
|
|
190
|
+
*/
|
|
191
|
+
sendAllFormValues?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* URL to redirect to after successful submission (supports template variables from response)
|
|
194
|
+
*/
|
|
195
|
+
redirectUrl?: string;
|
|
196
|
+
/**
|
|
197
|
+
* Success message to display after successful submission (translatable)
|
|
198
|
+
*/
|
|
199
|
+
successMessage?: Translatable;
|
|
200
|
+
/**
|
|
201
|
+
* Error message to display if submission fails (translatable)
|
|
202
|
+
*/
|
|
203
|
+
errorMessage?: Translatable;
|
|
204
|
+
/**
|
|
205
|
+
* Whether to show a loading state while submitting
|
|
206
|
+
*/
|
|
207
|
+
showLoading?: boolean;
|
|
208
|
+
};
|
|
103
209
|
export type InputNodeData = BaseNodeData & {
|
|
104
210
|
/**
|
|
105
211
|
* The name of the input field, used for identification and form submission
|
|
@@ -137,12 +243,20 @@ export type InputNodeData = BaseNodeData & {
|
|
|
137
243
|
* Whether multiple selections are allowed (for select and checkbox types)
|
|
138
244
|
*/
|
|
139
245
|
multiple?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Visual variant (currently used by radio inputs)
|
|
248
|
+
*/
|
|
249
|
+
variant?: "default" | "card";
|
|
250
|
+
/**
|
|
251
|
+
* Whether past dates should be disabled (for date and daterange types)
|
|
252
|
+
*/
|
|
253
|
+
disablePast?: boolean;
|
|
140
254
|
/**
|
|
141
255
|
* The default value config for the input field
|
|
142
256
|
*/
|
|
143
257
|
defaultValue?: null | {
|
|
144
258
|
type?: "static" | "reference";
|
|
145
|
-
staticValue?: string | string[] | boolean;
|
|
259
|
+
staticValue?: string | string[] | boolean | SerializableFile | SerializableFile[];
|
|
146
260
|
referenceField?: string;
|
|
147
261
|
transformFunction?: null | "toString" | "toNumber" | "toBoolean" | "toArray" | "toObject";
|
|
148
262
|
objectMapping?: Array<{
|
|
@@ -154,6 +268,28 @@ export type InputNodeData = BaseNodeData & {
|
|
|
154
268
|
* HTTP configuration for the input field (used with type="http")
|
|
155
269
|
*/
|
|
156
270
|
httpConfig?: HttpConfig;
|
|
271
|
+
/**
|
|
272
|
+
* Dynamic options source — fetches the option list from an HTTP endpoint
|
|
273
|
+
* at runtime. Used by option-based inputs (radio, checkbox, select, autocomplete).
|
|
274
|
+
* When set, overrides the static `options` array.
|
|
275
|
+
*/
|
|
276
|
+
optionsSource?: OptionsSource;
|
|
277
|
+
/**
|
|
278
|
+
* Whether labels fetched from an API (dynamic `optionsSource` or an `http`
|
|
279
|
+
* input's `responseMapping`) are normalized to a uniform, readable Title Case
|
|
280
|
+
* form (e.g. "DUPONT JEAN" -> "Dupont Jean"). Manually-typed static option
|
|
281
|
+
* labels are never affected. Defaults to `true` when unset.
|
|
282
|
+
*/
|
|
283
|
+
normalizeOptionLabels?: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Submit configuration for the input field (used with type="submit")
|
|
286
|
+
*/
|
|
287
|
+
submitConfig?: SubmitConfig;
|
|
288
|
+
/**
|
|
289
|
+
* Optional illustrative image displayed above the input label.
|
|
290
|
+
* Stored as a base64 data URL (uploads are resized/compressed) or a remote URL.
|
|
291
|
+
*/
|
|
292
|
+
image?: string;
|
|
157
293
|
};
|
|
158
294
|
export type UINodeData = BaseNodeData & {
|
|
159
295
|
/**
|
|
@@ -164,7 +300,7 @@ export type UINodeData = BaseNodeData & {
|
|
|
164
300
|
/**
|
|
165
301
|
* Union type representing all possible node data types in the Treege system
|
|
166
302
|
*/
|
|
167
|
-
export type TreegeNodeData = InputNodeData | UINodeData |
|
|
303
|
+
export type TreegeNodeData = InputNodeData | UINodeData | GroupNodeData;
|
|
168
304
|
/**
|
|
169
305
|
* A TreegeNode represents a node in the flowchart with specific data and properties
|
|
170
306
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single editable key/value row. Editor forms work on lists of these while
|
|
3
|
+
* the user types (they tolerate transient empty keys), then serialize back to
|
|
4
|
+
* the persisted `Record<string, string>` form via `entriesToRecord`.
|
|
5
|
+
*/
|
|
6
|
+
export type KeyValueEntry = {
|
|
7
|
+
key: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Expand a `{ key: value }` record into editor rows, preserving insertion
|
|
12
|
+
* order. Returns an empty list for `undefined`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const recordToEntries: (record?: Record<string, string>) => KeyValueEntry[];
|
|
15
|
+
/**
|
|
16
|
+
* Collapse editor rows back into a `{ key: value }` record. Rows with an empty
|
|
17
|
+
* key are dropped (they're transient editing artifacts), and on duplicate keys
|
|
18
|
+
* the last occurrence wins.
|
|
19
|
+
*/
|
|
20
|
+
export declare const entriesToRecord: (entries?: KeyValueEntry[]) => Record<string, string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InputNodeData, TreegeNodeData } from '../types/node';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard: narrows the node `data` to an `InputNodeData` whose type
|
|
4
|
+
* supports an option list. After a truthy check, `data.options`,
|
|
5
|
+
* `data.optionsSource`, etc. are accessible without casts.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isOptionsInputData: (data: TreegeNodeData | undefined) => data is InputNodeData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node } from '@xyflow/react';
|
|
2
|
-
import {
|
|
2
|
+
import { GroupNodeData, InputNodeData, TreegeNode, UINodeData } from '../types/node';
|
|
3
3
|
/**
|
|
4
4
|
* Type guard to check if a node is an InputNode
|
|
5
5
|
* @param node
|
|
@@ -10,11 +10,6 @@ export declare const isInputNode: (node: TreegeNode | undefined) => node is Node
|
|
|
10
10
|
* @param node
|
|
11
11
|
*/
|
|
12
12
|
export declare const isUINode: (node: TreegeNode | undefined) => node is Node<UINodeData, "ui">;
|
|
13
|
-
/**
|
|
14
|
-
* Type guard to check if a node is a FlowNode
|
|
15
|
-
* @param node
|
|
16
|
-
*/
|
|
17
|
-
export declare const isFlowNode: (node: TreegeNode | undefined) => node is Node<FlowNodeData, "flow">;
|
|
18
13
|
/**
|
|
19
14
|
* Type guard to check if a node is a GroupNode
|
|
20
15
|
* @param node
|
|
@@ -0,0 +1,22 @@
|
|
|
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. Labels are always the object form here — plain
|
|
20
|
+
* strings are coerced upstream by `normalizeFlowLabels` on ingestion.
|
|
21
|
+
*/
|
|
22
|
+
export declare const normalizeTranslatableLabel: (label: Translatable) => Translatable;
|
|
@@ -21,7 +21,27 @@ export type TranslationKey = DotNotationKeys<typeof en>;
|
|
|
21
21
|
* @param language - Optional preferred language (defaults to 'en')
|
|
22
22
|
* @returns The translated string or empty string if none available
|
|
23
23
|
*/
|
|
24
|
-
export declare const getTranslatedText: (text?: Translatable
|
|
24
|
+
export declare const getTranslatedText: (text?: Translatable, language?: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Reads the value of a translatable field for a given language while tolerating a
|
|
27
|
+
* value for a language. Returns "" when the value or the language entry is absent.
|
|
28
|
+
*
|
|
29
|
+
* Use this for editor inputs instead of `value?.[language]` so reads/writes stay
|
|
30
|
+
* consistent with {@link setTranslatableValue}.
|
|
31
|
+
*/
|
|
32
|
+
export declare const getTranslatableValue: (value: Translatable | undefined, language: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Sets `language` to `next` on a translatable field and returns a NEW Translatable,
|
|
35
|
+
* preserving the other language entries. Always use this when writing a
|
|
36
|
+
* translatable field from the editor rather than spreading the previous value
|
|
37
|
+
* inline.
|
|
38
|
+
*
|
|
39
|
+
* The `typeof === "object"` guard is purely defensive: the type system guarantees
|
|
40
|
+
* an object, but should a stray non-object (e.g. unsupported legacy string data)
|
|
41
|
+
* reach this at runtime, it is dropped rather than spread into indexed character
|
|
42
|
+
* keys (`"Hi"` → `{ "0": "H", "1": "i" }`).
|
|
43
|
+
*/
|
|
44
|
+
export declare const setTranslatableValue: (value: Translatable | undefined, language: string, next: string) => Translatable;
|
|
25
45
|
/**
|
|
26
46
|
* Get static translations for a specific language
|
|
27
47
|
* Falls back to English if language not found
|