treege 3.0.0-beta.60 → 3.0.0-beta.62
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 +46 -46
- package/dist/DefaultInputs-DamDWb5R.js +1988 -0
- package/dist/{ThemeContext-Ddk_Y-Dz.js → ThemeContext-cGSTk24y.js} +121 -126
- package/dist/editor/context/TreegeEditorRuntimeProvider.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
- package/dist/editor/features/TreegeEditor/dialogs/AuthorizeDialog.d.ts +3 -3
- package/dist/editor/features/TreegeEditor/dialogs/HeadersDialog.d.ts +3 -3
- package/dist/editor/features/TreegeEditor/forms/OptionsMappingFields.d.ts +3 -3
- package/dist/editor/features/TreegeEditor/forms/SensitiveHeaderWarning.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/panel/ActionsPanel.d.ts +4 -4
- package/dist/editor/hooks/useKeyValueRows.d.ts +15 -0
- package/dist/editor/types/editor.d.ts +4 -10
- package/dist/editor/utils/sensitiveHeaders.d.ts +8 -3
- package/dist/{editor-D2pBjE7E.js → editor-K1jjfc5n.js} +1350 -1324
- package/dist/editor.js +2 -2
- package/dist/main.js +4 -4
- package/dist/renderer/context/TreegeRenderRuntimeProvider.d.ts +3 -3
- package/dist/renderer/features/TreegeRenderer/native/components/OptionItemContent.d.ts +17 -0
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/OptionItemContent.d.ts +17 -0
- package/dist/renderer/hooks/useSubmitHandler.d.ts +2 -2
- package/dist/renderer/types/renderer.d.ts +5 -2
- package/dist/renderer/utils/http.d.ts +14 -5
- package/dist/renderer/utils/submit.d.ts +2 -2
- package/dist/renderer-native.js +1114 -1080
- package/dist/renderer.js +3 -3
- package/dist/shared/components/ui/item.d.ts +23 -0
- package/dist/shared/components/ui/popover.d.ts +7 -1
- package/dist/shared/context/PortalContainerContext.d.ts +5 -0
- package/dist/shared/types/node.d.ts +26 -26
- package/dist/shared/utils/httpRecord.d.ts +20 -0
- package/package.json +1 -1
- package/dist/DefaultInputs-nRQc9BHG.js +0 -1881
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-K1jjfc5n.js";
|
|
2
|
+
import { n as t, t as n } from "./ThemeContext-cGSTk24y.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 {
|
|
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-
|
|
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, e as TreegeEditor, I as TreegeRenderer, S as TreegeRendererProvider, 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,
|
|
1
|
+
import { t as e } from "./editor-K1jjfc5n.js";
|
|
2
|
+
import { B as t, H as n, M as r, U 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-cGSTk24y.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-DamDWb5R.js";
|
|
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, e as TreegeEditor, I as TreegeRenderer, S as TreegeRendererProvider, 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, T as getStaticTranslations, t as getTranslatedText, d as isFieldEmpty, a as isGroupNode, n as isInputNode, b as isStartNode, i as isUINode, m as sanitize, r as sanitizeHttpResponse, C as serializableToFile, _ as useTheme, p as useTreegeRenderer, l as useTreegeRendererConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Node } from '@xyflow/react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { FormValues } from '../types/renderer';
|
|
4
|
-
import { Flow,
|
|
4
|
+
import { Flow, HttpHeaders, InputNodeData } from '../../shared/types/node';
|
|
5
5
|
export interface TreegeRenderRuntimeContextValue {
|
|
6
6
|
/**
|
|
7
7
|
* Base URL prepended to every relative HTTP url issued by inputs. Absolute
|
|
@@ -35,7 +35,7 @@ export interface TreegeRenderRuntimeContextValue {
|
|
|
35
35
|
* to every request issued by inputs. Field-level headers override these
|
|
36
36
|
* on key collision (case-insensitive).
|
|
37
37
|
*/
|
|
38
|
-
headers?:
|
|
38
|
+
headers?: HttpHeaders;
|
|
39
39
|
/**
|
|
40
40
|
* The flow's input nodes — exposed so renderers can resolve references
|
|
41
41
|
* between fields (e.g. `convertFormValuesToNamedFormat`, reference-field
|
|
@@ -106,7 +106,7 @@ export declare const useTreegeRenderRuntime: () => {
|
|
|
106
106
|
* to every request issued by inputs. Field-level headers override these
|
|
107
107
|
* on key collision (case-insensitive).
|
|
108
108
|
*/
|
|
109
|
-
headers?:
|
|
109
|
+
headers?: HttpHeaders;
|
|
110
110
|
/**
|
|
111
111
|
* The flow's input nodes — exposed so renderers can resolve references
|
|
112
112
|
* between fields (e.g. `convertFormValuesToNamedFormat`, reference-field
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface OptionItemContentProps {
|
|
2
|
+
/** Already-translated option label. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Already-translated option description (optional). */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** Option image — base64 data URL or remote URL (optional). */
|
|
7
|
+
image?: string;
|
|
8
|
+
/** Muted styling when the option is disabled. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Shared content for an option row in a dropdown/select modal: an optional
|
|
13
|
+
* leading image, the label, and an optional muted description underneath. The
|
|
14
|
+
* selection indicator is left to the caller so it can sit outside this block.
|
|
15
|
+
*/
|
|
16
|
+
declare const OptionItemContent: ({ label, description, image, disabled }: OptionItemContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default OptionItemContent;
|
|
@@ -73,7 +73,7 @@ export declare const useTreegeRenderer: ({ baseUrl, components, flow, googleApiK
|
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
75
|
googleApiKey: string | undefined;
|
|
76
|
-
headers: import('../../../shared/types/node').
|
|
76
|
+
headers: import('../../../shared/types/node').HttpHeaders;
|
|
77
77
|
language: string;
|
|
78
78
|
theme: "dark" | "light";
|
|
79
79
|
validationMode: "onChange" | "onSubmit";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface OptionItemContentProps {
|
|
2
|
+
/** Already-translated option label. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Already-translated option description (optional). */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** Option image — base64 data URL or remote URL (optional). */
|
|
7
|
+
image?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Shared content for an option row in a dropdown/combobox/select, built from the
|
|
11
|
+
* shadcn `Item` primitives: an optional leading image, the label, and an
|
|
12
|
+
* optional muted description underneath. Rendered as a fragment — the enclosing
|
|
13
|
+
* `CommandItem`/`SelectItem` already provides the flex row. The selection
|
|
14
|
+
* indicator (check) is left to the caller so it can sit outside this block.
|
|
15
|
+
*/
|
|
16
|
+
declare const OptionItemContent: ({ label, description, image }: OptionItemContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default OptionItemContent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Node } from '@xyflow/react';
|
|
2
2
|
import { FormValues } from '../types/renderer';
|
|
3
3
|
import { SubmitResult } from '../utils/submit';
|
|
4
|
-
import {
|
|
4
|
+
import { HttpHeaders, InputNodeData, TreegeNodeData } from '../../shared/types/node';
|
|
5
5
|
/**
|
|
6
6
|
* Hook for handling form submission with submit button configuration
|
|
7
7
|
*
|
|
@@ -20,7 +20,7 @@ import { HttpHeader, InputNodeData, TreegeNodeData } from '../../shared/types/no
|
|
|
20
20
|
* @param baseUrl - Base URL prepended to a relative submit url
|
|
21
21
|
* @returns Submit handler state and functions
|
|
22
22
|
*/
|
|
23
|
-
export declare const useSubmitHandler: (visibleNodes: Node<TreegeNodeData>[], formValues: FormValues, language: string, inputNodes: Node<InputNodeData>[], headers?:
|
|
23
|
+
export declare const useSubmitHandler: (visibleNodes: Node<TreegeNodeData>[], formValues: FormValues, language: string, inputNodes: Node<InputNodeData>[], headers?: HttpHeaders, baseUrl?: string) => {
|
|
24
24
|
clearSubmitMessage: () => void;
|
|
25
25
|
handleSubmitWithConfig: (onSuccess?: (data: unknown) => void) => Promise<SubmitResult | null>;
|
|
26
26
|
hasSubmitConfig: boolean;
|
|
@@ -2,7 +2,7 @@ import { Node } from '@xyflow/react';
|
|
|
2
2
|
import { FormEvent, ReactNode } from 'react';
|
|
3
3
|
import { SerializableFile } from '../utils/file';
|
|
4
4
|
import { FlowStep } from '../utils/step';
|
|
5
|
-
import { Flow, GroupNodeData,
|
|
5
|
+
import { Flow, GroupNodeData, HttpHeaders, InputNodeData, InputOption, InputType, TreegeNodeData, UINodeData, UIType } from '../../shared/types/node';
|
|
6
6
|
/**
|
|
7
7
|
* Type mapping for input values based on input type
|
|
8
8
|
*/
|
|
@@ -274,8 +274,11 @@ export type TreegeRendererConfig = {
|
|
|
274
274
|
* Global HTTP headers applied to every request issued by the renderer
|
|
275
275
|
* (HTTP inputs, submit buttons). Field-level headers with the same key
|
|
276
276
|
* (case-insensitive) take precedence over these.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* headers={{ Authorization: `Bearer ${accessToken}` }}
|
|
277
280
|
*/
|
|
278
|
-
headers?:
|
|
281
|
+
headers?: HttpHeaders;
|
|
279
282
|
/**
|
|
280
283
|
* Google Maps API key for address autocomplete
|
|
281
284
|
* If not provided, falls back to free Nominatim (OpenStreetMap)
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { FormValues } from '../types/renderer';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpHeaders, InputOption, OptionsSourceMapping, QueryParams } from '../../shared/types/node';
|
|
3
3
|
/**
|
|
4
4
|
* Merge multiple lists of HTTP headers. Later sources override earlier ones
|
|
5
5
|
* when they specify the same key (case-insensitive comparison, since HTTP
|
|
6
6
|
* header names are case-insensitive). The casing of the latest occurrence
|
|
7
7
|
* is preserved in the output.
|
|
8
8
|
*/
|
|
9
|
-
export declare const mergeHttpHeaders: (...sources: (
|
|
9
|
+
export declare const mergeHttpHeaders: (...sources: (HttpHeaders | undefined)[]) => HttpHeaders;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve `{{templateVar}}` placeholders in every value of a header/query-param
|
|
12
|
+
* record, leaving the keys untouched. Returns `undefined` for `undefined` so
|
|
13
|
+
* callers can pass the result straight into `mergeHttpHeaders`/`makeHttpRequest`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const resolveTemplateRecord: (record: Record<string, string> | undefined, values: FormValues, options?: {
|
|
16
|
+
encode?: boolean;
|
|
17
|
+
json?: boolean;
|
|
18
|
+
}) => Record<string, string> | undefined;
|
|
10
19
|
/**
|
|
11
20
|
* Append query parameters to a URL. Entries with an empty key are skipped,
|
|
12
21
|
* keys and values are URL-encoded, and `?` or `&` is chosen automatically
|
|
13
22
|
* based on whether the URL already has a query string. Values are expected
|
|
14
23
|
* to already have their template variables resolved.
|
|
15
24
|
*/
|
|
16
|
-
export declare const appendQueryParams: (url: string, params?:
|
|
25
|
+
export declare const appendQueryParams: (url: string, params?: QueryParams) => string;
|
|
17
26
|
/**
|
|
18
27
|
* Prepend a base URL to a relative URL. Absolute urls (starting with
|
|
19
28
|
* `http://` or `https://`, case-insensitive) and protocol-relative urls
|
|
@@ -65,12 +74,12 @@ export interface HttpRequestOptions {
|
|
|
65
74
|
/**
|
|
66
75
|
* Request headers
|
|
67
76
|
*/
|
|
68
|
-
headers?:
|
|
77
|
+
headers?: HttpHeaders;
|
|
69
78
|
/**
|
|
70
79
|
* Query parameters appended to the URL (values should already have their
|
|
71
80
|
* template variables resolved; keys/values are URL-encoded here)
|
|
72
81
|
*/
|
|
73
|
-
queryParams?:
|
|
82
|
+
queryParams?: QueryParams;
|
|
74
83
|
/**
|
|
75
84
|
* Request body (for POST/PUT/PATCH)
|
|
76
85
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node } from '@xyflow/react';
|
|
2
2
|
import { FormValues } from '../types/renderer';
|
|
3
|
-
import {
|
|
3
|
+
import { HttpHeaders, InputNodeData, SubmitConfig } from '../../shared/types/node';
|
|
4
4
|
/**
|
|
5
5
|
* Result of a form submission
|
|
6
6
|
*/
|
|
@@ -38,7 +38,7 @@ export interface SubmitResult {
|
|
|
38
38
|
* @param baseUrl - Base URL prepended to a relative submit url
|
|
39
39
|
* @returns Promise with submission result
|
|
40
40
|
*/
|
|
41
|
-
export declare const submitFormData: (config: SubmitConfig, formValues: FormValues, inputNodes: Node<InputNodeData>[], headers?:
|
|
41
|
+
export declare const submitFormData: (config: SubmitConfig, formValues: FormValues, inputNodes: Node<InputNodeData>[], headers?: HttpHeaders, baseUrl?: string) => Promise<SubmitResult>;
|
|
42
42
|
/**
|
|
43
43
|
* Perform redirect to the specified URL
|
|
44
44
|
*
|