@flowgram.ai/form-materials 0.1.0-alpha.11 → 0.1.0-alpha.13
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/bin/index.ts +14 -22
- package/bin/materials.ts +41 -90
- package/bin/project.ts +4 -0
- package/bin/utils/import.ts +127 -0
- package/bin/utils/traverse-file.ts +60 -0
- package/dist/esm/index.js +2073 -1601
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +392 -131
- package/dist/index.d.ts +392 -131
- package/dist/index.js +2175 -1710
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/components/assign-row/components/blur-input.tsx +27 -0
- package/src/components/assign-row/index.tsx +84 -0
- package/src/components/assign-row/types.ts +25 -0
- package/src/components/assign-rows/index.tsx +59 -0
- package/src/components/batch-outputs/index.tsx +7 -14
- package/src/components/batch-outputs/types.ts +1 -1
- package/src/components/batch-variable-selector/index.tsx +2 -2
- package/src/components/code-editor/index.tsx +7 -0
- package/src/components/code-editor/language-features.ts +22 -1
- package/src/components/code-editor/theme/light.ts +1 -1
- package/src/components/code-editor-mini/index.tsx +31 -0
- package/src/components/condition-row/constants.ts +8 -10
- package/src/components/condition-row/hooks/useOp.tsx +15 -9
- package/src/components/condition-row/hooks/useRule.ts +9 -5
- package/src/components/condition-row/index.tsx +28 -10
- package/src/components/condition-row/types.ts +5 -5
- package/src/components/constant-input/index.tsx +20 -61
- package/src/components/constant-input/types.ts +6 -9
- package/src/components/display-flow-value/index.tsx +59 -0
- package/src/components/display-inputs-values/index.tsx +28 -0
- package/src/components/display-inputs-values/styles.ts +12 -0
- package/src/components/display-outputs/index.tsx +65 -0
- package/src/components/display-outputs/styles.ts +12 -0
- package/src/components/display-schema-tag/index.tsx +45 -0
- package/src/components/display-schema-tag/styles.ts +28 -0
- package/src/components/display-schema-tree/index.tsx +75 -0
- package/src/components/display-schema-tree/styles.tsx +90 -0
- package/src/components/dynamic-value-input/hooks.ts +53 -0
- package/src/components/dynamic-value-input/index.tsx +74 -19
- package/src/components/dynamic-value-input/styles.tsx +28 -2
- package/src/components/index.ts +9 -0
- package/src/components/inputs-values/components/blur-input.tsx +27 -0
- package/src/components/inputs-values/index.tsx +75 -0
- package/src/components/inputs-values/styles.tsx +19 -0
- package/src/components/inputs-values/types.ts +22 -0
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +1 -1
- package/src/components/json-editor-with-variables/index.tsx +2 -1
- package/src/components/json-schema-editor/default-value.tsx +12 -106
- package/src/components/json-schema-editor/hooks.tsx +53 -94
- package/src/components/json-schema-editor/index.tsx +32 -13
- package/src/components/json-schema-editor/styles.tsx +0 -29
- package/src/components/json-schema-editor/types.ts +1 -1
- package/src/components/prompt-editor/types.tsx +1 -1
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +2 -1
- package/src/components/prompt-editor-with-inputs/index.tsx +3 -2
- package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +2 -2
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +6 -3
- package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +1 -1
- package/src/components/prompt-editor-with-variables/index.tsx +2 -1
- package/src/components/type-selector/index.tsx +58 -13
- package/src/components/variable-selector/index.tsx +42 -17
- package/src/components/variable-selector/styles.tsx +18 -8
- package/src/components/variable-selector/use-variable-tree.tsx +19 -22
- package/src/effects/auto-rename-ref/index.ts +1 -1
- package/src/effects/index.ts +3 -1
- package/src/effects/listen-ref-schema-change/index.ts +56 -0
- package/src/effects/listen-ref-value-change/index.ts +53 -0
- package/src/effects/provide-batch-input/index.ts +1 -1
- package/src/effects/provide-json-schema-outputs/index.ts +1 -3
- package/src/effects/sync-variable-title/index.ts +1 -0
- package/src/effects/validate-when-variable-sync/index.ts +35 -0
- package/src/form-plugins/batch-outputs-plugin/index.ts +1 -1
- package/src/form-plugins/index.ts +3 -1
- package/src/form-plugins/infer-assign-plugin/index.ts +90 -0
- package/src/form-plugins/infer-inputs-plugin/index.ts +108 -0
- package/src/hooks/index.tsx +6 -0
- package/src/hooks/use-object-list/index.tsx +136 -0
- package/src/index.ts +3 -1
- package/src/{utils/format-legacy-refs → plugins/disable-declaration-plugin}/config.json +1 -1
- package/src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts +31 -0
- package/src/plugins/disable-declaration-plugin/index.tsx +6 -0
- package/src/plugins/index.ts +7 -0
- package/src/plugins/json-schema-preset/config.json +9 -0
- package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +28 -0
- package/src/plugins/json-schema-preset/index.tsx +41 -0
- package/src/plugins/json-schema-preset/manager.ts +18 -0
- package/src/plugins/json-schema-preset/type-definition/array.tsx +26 -0
- package/src/plugins/json-schema-preset/type-definition/boolean.tsx +33 -0
- package/src/plugins/json-schema-preset/type-definition/index.tsx +24 -0
- package/src/plugins/json-schema-preset/type-definition/integer.tsx +25 -0
- package/src/plugins/json-schema-preset/type-definition/number.tsx +25 -0
- package/src/plugins/json-schema-preset/type-definition/object.tsx +26 -0
- package/src/plugins/json-schema-preset/type-definition/string.tsx +24 -0
- package/src/{utils → shared}/index.ts +1 -1
- package/src/shared/inject-material/README.md +170 -0
- package/src/shared/inject-material/README.zh.md +174 -0
- package/src/shared/inject-material/index.tsx +87 -0
- package/src/typings/flow-value/index.ts +11 -0
- package/src/typings/index.ts +0 -1
- package/src/validate/index.tsx +6 -0
- package/src/validate/validate-flow-value/index.tsx +73 -0
- package/src/components/batch-outputs/config.json +0 -12
- package/src/components/batch-outputs/use-list.ts +0 -86
- package/src/components/batch-variable-selector/config.json +0 -5
- package/src/components/code-editor/config.json +0 -10
- package/src/components/condition-row/config.json +0 -5
- package/src/components/constant-input/config.json +0 -6
- package/src/components/dynamic-value-input/config.json +0 -5
- package/src/components/json-editor-with-variables/config.json +0 -13
- package/src/components/json-schema-editor/config.json +0 -13
- package/src/components/json-schema-editor/utils.ts +0 -29
- package/src/components/prompt-editor/config.json +0 -9
- package/src/components/prompt-editor-with-inputs/config.json +0 -13
- package/src/components/prompt-editor-with-variables/config.json +0 -13
- package/src/components/type-selector/config.json +0 -5
- package/src/components/type-selector/constants.tsx +0 -364
- package/src/components/variable-selector/config.json +0 -5
- package/src/effects/auto-rename-ref/config.json +0 -5
- package/src/effects/provide-batch-input/config.json +0 -5
- package/src/effects/provide-batch-outputs/config.json +0 -5
- package/src/effects/provide-batch-outputs/index.ts +0 -38
- package/src/effects/provide-json-schema-outputs/config.json +0 -8
- package/src/effects/sync-variable-title/config.json +0 -5
- package/src/form-plugins/batch-outputs-plugin/config.json +0 -7
- package/src/typings/flow-value/config.json +0 -5
- package/src/typings/json-schema/config.json +0 -5
- package/src/typings/json-schema/index.ts +0 -36
- package/src/utils/json-schema/config.json +0 -5
- package/src/utils/json-schema/index.ts +0 -180
- /package/src/{utils → shared}/format-legacy-refs/index.ts +0 -0
- /package/src/{utils → shared}/format-legacy-refs/readme.md +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,28 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
+
import { IJsonSchema, JsonSchemaTypeRegistry as JsonSchemaTypeRegistry$1, JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
|
|
3
|
+
export { IJsonSchema, JsonSchemaBasicType, JsonSchemaUtils } from '@flowgram.ai/json-schema';
|
|
2
4
|
import { TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
|
|
3
5
|
import { InferValues } from '@coze-editor/editor/react';
|
|
4
6
|
import preset from '@coze-editor/editor/preset-code';
|
|
5
|
-
import { EffectOptions,
|
|
7
|
+
import { BaseVariableField, EffectOptions, EffectFuncProps, FormPluginCreator, FeedbackLevel, FlowNodeEntity } from '@flowgram.ai/editor';
|
|
8
|
+
import * as _flowgram_ai_node from '@flowgram.ai/node';
|
|
9
|
+
import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
6
10
|
import { TreeNodeData } from '@douyinfe/semi-ui/lib/es/tree';
|
|
7
11
|
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
10
|
-
* SPDX-License-Identifier: MIT
|
|
11
|
-
*/
|
|
12
|
-
type JsonSchemaBasicType = 'boolean' | 'string' | 'integer' | 'number' | 'object' | 'array' | 'map';
|
|
13
|
-
interface IJsonSchema<T = string> {
|
|
14
|
-
type?: T;
|
|
15
|
-
default?: any;
|
|
16
|
-
title?: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
enum?: (string | number)[];
|
|
19
|
-
properties?: Record<string, IJsonSchema<T>>;
|
|
20
|
-
additionalProperties?: IJsonSchema<T>;
|
|
21
|
-
items?: IJsonSchema<T>;
|
|
22
|
-
required?: string[];
|
|
23
|
-
$ref?: string;
|
|
24
|
-
extra?: {
|
|
25
|
-
index?: number;
|
|
26
|
-
weak?: boolean;
|
|
27
|
-
formComponent?: string;
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
type IBasicJsonSchema = IJsonSchema<JsonSchemaBasicType>;
|
|
32
|
-
|
|
33
12
|
/**
|
|
34
13
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
35
14
|
* SPDX-License-Identifier: MIT
|
|
36
15
|
*/
|
|
37
16
|
|
|
17
|
+
type VariableField = BaseVariableField<{
|
|
18
|
+
icon?: string | JSX.Element;
|
|
19
|
+
title?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}>;
|
|
38
22
|
declare function useVariableTree(params: {
|
|
39
23
|
includeSchema?: IJsonSchema | IJsonSchema[];
|
|
40
24
|
excludeSchema?: IJsonSchema | IJsonSchema[];
|
|
25
|
+
customSkip?: (variable: VariableField) => boolean;
|
|
41
26
|
}): TreeNodeData[];
|
|
42
27
|
|
|
43
28
|
/**
|
|
@@ -45,7 +30,7 @@ declare function useVariableTree(params: {
|
|
|
45
30
|
* SPDX-License-Identifier: MIT
|
|
46
31
|
*/
|
|
47
32
|
|
|
48
|
-
interface
|
|
33
|
+
interface VariableSelectorProps {
|
|
49
34
|
value?: string[];
|
|
50
35
|
config?: {
|
|
51
36
|
placeholder?: string;
|
|
@@ -59,60 +44,35 @@ interface PropTypes$2 {
|
|
|
59
44
|
style?: React$1.CSSProperties;
|
|
60
45
|
triggerRender?: (props: TriggerRenderProps) => React$1.ReactNode;
|
|
61
46
|
}
|
|
62
|
-
type VariableSelectorProps = PropTypes$2;
|
|
63
|
-
|
|
64
|
-
declare const VariableSelector: ({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: PropTypes$2) => React$1.JSX.Element;
|
|
65
47
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*/
|
|
70
|
-
interface IFlowConstantValue {
|
|
71
|
-
type: 'constant';
|
|
72
|
-
content?: string | number | boolean;
|
|
73
|
-
}
|
|
74
|
-
interface IFlowRefValue {
|
|
75
|
-
type: 'ref';
|
|
76
|
-
content?: string[];
|
|
77
|
-
}
|
|
78
|
-
interface IFlowExpressionValue {
|
|
79
|
-
type: 'expression';
|
|
80
|
-
content?: string;
|
|
81
|
-
}
|
|
82
|
-
interface IFlowTemplateValue {
|
|
83
|
-
type: 'template';
|
|
84
|
-
content?: string;
|
|
85
|
-
}
|
|
86
|
-
type IFlowValue = IFlowConstantValue | IFlowRefValue | IFlowExpressionValue | IFlowTemplateValue;
|
|
87
|
-
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
91
|
-
* SPDX-License-Identifier: MIT
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
declare const VariableTypeIcons: {
|
|
95
|
-
[key: string]: React$1.ReactNode;
|
|
48
|
+
declare const VariableSelector: {
|
|
49
|
+
({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: VariableSelectorProps): React$1.JSX.Element;
|
|
50
|
+
renderKey: string;
|
|
96
51
|
};
|
|
97
|
-
declare const
|
|
98
|
-
[key: string]: React$1.ReactNode;
|
|
99
|
-
};
|
|
100
|
-
declare const getSchemaIcon: (value?: Partial<IJsonSchema>) => React$1.ReactNode;
|
|
52
|
+
declare const InjectVariableSelector: React$1.FC<VariableSelectorProps>;
|
|
101
53
|
|
|
102
54
|
/**
|
|
103
55
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
104
56
|
* SPDX-License-Identifier: MIT
|
|
105
57
|
*/
|
|
106
58
|
|
|
107
|
-
interface
|
|
59
|
+
interface TypeSelectorProps {
|
|
108
60
|
value?: Partial<IJsonSchema>;
|
|
109
|
-
onChange
|
|
61
|
+
onChange?: (value?: Partial<IJsonSchema>) => void;
|
|
62
|
+
readonly?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated use readonly instead
|
|
65
|
+
*/
|
|
110
66
|
disabled?: boolean;
|
|
111
67
|
style?: React$1.CSSProperties;
|
|
112
68
|
}
|
|
113
69
|
declare const getTypeSelectValue: (value?: Partial<IJsonSchema>) => string[] | undefined;
|
|
114
70
|
declare const parseTypeSelectValue: (value?: string[]) => Partial<IJsonSchema> | undefined;
|
|
115
|
-
declare function TypeSelector(props:
|
|
71
|
+
declare function TypeSelector(props: TypeSelectorProps): React$1.JSX.Element;
|
|
72
|
+
declare namespace TypeSelector {
|
|
73
|
+
var renderKey: string;
|
|
74
|
+
}
|
|
75
|
+
declare const InjectTypeSelector: React$1.FC<TypeSelectorProps>;
|
|
116
76
|
|
|
117
77
|
/**
|
|
118
78
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -139,6 +99,7 @@ declare function JsonSchemaEditor(props: {
|
|
|
139
99
|
onChange?: (value: IJsonSchema) => void;
|
|
140
100
|
config?: ConfigType;
|
|
141
101
|
className?: string;
|
|
102
|
+
readonly?: boolean;
|
|
142
103
|
}): React$1.JSX.Element;
|
|
143
104
|
|
|
144
105
|
/**
|
|
@@ -153,18 +114,52 @@ declare function BatchVariableSelector(props: VariableSelectorProps): React$1.JS
|
|
|
153
114
|
* SPDX-License-Identifier: MIT
|
|
154
115
|
*/
|
|
155
116
|
|
|
156
|
-
interface
|
|
157
|
-
hit: (schema: IJsonSchema) => boolean;
|
|
158
|
-
Renderer: React.FC<RendererProps<Value>>;
|
|
159
|
-
}
|
|
160
|
-
interface RendererProps<Value = any> {
|
|
117
|
+
interface ConstantRendererProps<Value = any> {
|
|
161
118
|
value?: Value;
|
|
162
119
|
onChange?: (value: Value) => void;
|
|
163
120
|
readonly?: boolean;
|
|
164
121
|
}
|
|
165
|
-
interface
|
|
122
|
+
interface JsonSchemaTypeRegistry<Value = any> extends JsonSchemaTypeRegistry$1 {
|
|
123
|
+
/**
|
|
124
|
+
* Render Constant Input
|
|
125
|
+
*/
|
|
126
|
+
ConstantRenderer: React.FC<ConstantRendererProps<Value>>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare const createTypePresetPlugin: _flowgram_ai_core.PluginCreator<{
|
|
130
|
+
types?: Partial<JsonSchemaTypeRegistry> & Pick<JsonSchemaTypeRegistry, "type">[];
|
|
131
|
+
unregisterTypes?: string[];
|
|
132
|
+
}>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
136
|
+
* SPDX-License-Identifier: MIT
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
declare const useTypeManager: () => JsonSchemaTypeManager<IJsonSchema, JsonSchemaTypeRegistry>;
|
|
140
|
+
declare const JsonSchemaTypePresetProvider: ({ types, children, }: React$1.PropsWithChildren<{
|
|
141
|
+
types: JsonSchemaTypeRegistry[];
|
|
142
|
+
}>) => React$1.JSX.Element;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
146
|
+
* SPDX-License-Identifier: MIT
|
|
147
|
+
*/
|
|
148
|
+
declare const createDisableDeclarationPlugin: _flowgram_ai_core.PluginCreator<void>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
152
|
+
* SPDX-License-Identifier: MIT
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
interface Strategy<Value = any> {
|
|
156
|
+
hit: (schema: IJsonSchema) => boolean;
|
|
157
|
+
Renderer: React.FC<ConstantRendererProps<Value>>;
|
|
158
|
+
}
|
|
159
|
+
interface PropsType$a extends ConstantRendererProps {
|
|
166
160
|
schema: IJsonSchema;
|
|
167
161
|
strategies?: Strategy[];
|
|
162
|
+
fallbackRenderer?: React.FC<ConstantRendererProps>;
|
|
168
163
|
[key: string]: any;
|
|
169
164
|
}
|
|
170
165
|
|
|
@@ -173,14 +168,46 @@ interface PropsType$4 extends RendererProps {
|
|
|
173
168
|
* SPDX-License-Identifier: MIT
|
|
174
169
|
*/
|
|
175
170
|
|
|
176
|
-
declare function ConstantInput(props: PropsType$
|
|
171
|
+
declare function ConstantInput(props: PropsType$a): React$1.JSX.Element;
|
|
177
172
|
|
|
178
173
|
/**
|
|
179
174
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
180
175
|
* SPDX-License-Identifier: MIT
|
|
181
176
|
*/
|
|
182
177
|
|
|
183
|
-
interface
|
|
178
|
+
interface IFlowValueExtra {
|
|
179
|
+
index?: number;
|
|
180
|
+
}
|
|
181
|
+
interface IFlowConstantValue {
|
|
182
|
+
type: 'constant';
|
|
183
|
+
content?: string | number | boolean;
|
|
184
|
+
schema?: IJsonSchema;
|
|
185
|
+
extra?: IFlowValueExtra;
|
|
186
|
+
}
|
|
187
|
+
interface IFlowRefValue {
|
|
188
|
+
type: 'ref';
|
|
189
|
+
content?: string[];
|
|
190
|
+
extra?: IFlowValueExtra;
|
|
191
|
+
}
|
|
192
|
+
interface IFlowExpressionValue {
|
|
193
|
+
type: 'expression';
|
|
194
|
+
content?: string;
|
|
195
|
+
extra?: IFlowValueExtra;
|
|
196
|
+
}
|
|
197
|
+
interface IFlowTemplateValue {
|
|
198
|
+
type: 'template';
|
|
199
|
+
content?: string;
|
|
200
|
+
extra?: IFlowValueExtra;
|
|
201
|
+
}
|
|
202
|
+
type IFlowValue = IFlowConstantValue | IFlowRefValue | IFlowExpressionValue | IFlowTemplateValue;
|
|
203
|
+
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
207
|
+
* SPDX-License-Identifier: MIT
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
interface PropsType$9 {
|
|
184
211
|
value?: IFlowConstantRefValue;
|
|
185
212
|
onChange: (value?: IFlowConstantRefValue) => void;
|
|
186
213
|
readonly?: boolean;
|
|
@@ -193,32 +220,28 @@ interface PropsType$3 {
|
|
|
193
220
|
[key: string]: any;
|
|
194
221
|
};
|
|
195
222
|
}
|
|
196
|
-
declare function DynamicValueInput({ value, onChange, readonly, style, schema, constantProps, }: PropsType$
|
|
223
|
+
declare function DynamicValueInput({ value, onChange, readonly, style, schema: schemaFromProps, constantProps, }: PropsType$9): React$1.JSX.Element;
|
|
224
|
+
declare namespace DynamicValueInput {
|
|
225
|
+
var renderKey: string;
|
|
226
|
+
}
|
|
227
|
+
declare const InjectDynamicValueInput: React$1.FC<PropsType$9>;
|
|
197
228
|
|
|
198
229
|
/**
|
|
199
230
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
200
231
|
* SPDX-License-Identifier: MIT
|
|
201
232
|
*/
|
|
202
233
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
GTE = "gte",
|
|
208
|
-
LT = "lt",
|
|
209
|
-
LTE = "lte",
|
|
210
|
-
IN = "in",
|
|
211
|
-
NIN = "nin",
|
|
212
|
-
CONTAINS = "contains",
|
|
213
|
-
NOT_CONTAINS = "not_contains",
|
|
214
|
-
IS_EMPTY = "is_empty",
|
|
215
|
-
IS_NOT_EMPTY = "is_not_empty",
|
|
216
|
-
IS_TRUE = "is_true",
|
|
217
|
-
IS_FALSE = "is_false"
|
|
234
|
+
interface OpConfig {
|
|
235
|
+
label: string;
|
|
236
|
+
abbreviation: string;
|
|
237
|
+
rightDisplay?: string;
|
|
218
238
|
}
|
|
239
|
+
type OpConfigs = Record<string, OpConfig>;
|
|
240
|
+
type IRule = Partial<Record<string, string | null>>;
|
|
241
|
+
type IRules = Record<string, IRule>;
|
|
219
242
|
interface ConditionRowValueType {
|
|
220
243
|
left?: IFlowRefValue;
|
|
221
|
-
operator?:
|
|
244
|
+
operator?: string;
|
|
222
245
|
right?: IFlowConstantRefValue;
|
|
223
246
|
}
|
|
224
247
|
|
|
@@ -232,8 +255,12 @@ interface PropTypes {
|
|
|
232
255
|
onChange: (value?: ConditionRowValueType) => void;
|
|
233
256
|
style?: React$1.CSSProperties;
|
|
234
257
|
readonly?: boolean;
|
|
258
|
+
ruleConfig?: {
|
|
259
|
+
ops?: OpConfigs;
|
|
260
|
+
rules?: IRules;
|
|
261
|
+
};
|
|
235
262
|
}
|
|
236
|
-
declare function ConditionRow({ style, value, onChange, readonly }: PropTypes): React$1.JSX.Element;
|
|
263
|
+
declare function ConditionRow({ style, value, onChange, readonly, ruleConfig, }: PropTypes): React$1.JSX.Element;
|
|
237
264
|
|
|
238
265
|
/**
|
|
239
266
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -241,7 +268,7 @@ declare function ConditionRow({ style, value, onChange, readonly }: PropTypes):
|
|
|
241
268
|
*/
|
|
242
269
|
|
|
243
270
|
type ValueType = Record<string, IFlowRefValue | undefined>;
|
|
244
|
-
interface PropsType$
|
|
271
|
+
interface PropsType$8 {
|
|
245
272
|
value?: ValueType;
|
|
246
273
|
onChange: (value?: ValueType) => void;
|
|
247
274
|
readonly?: boolean;
|
|
@@ -254,14 +281,14 @@ interface PropsType$2 {
|
|
|
254
281
|
* SPDX-License-Identifier: MIT
|
|
255
282
|
*/
|
|
256
283
|
|
|
257
|
-
declare function BatchOutputs(props: PropsType$
|
|
284
|
+
declare function BatchOutputs(props: PropsType$8): React$1.JSX.Element;
|
|
258
285
|
|
|
259
286
|
/**
|
|
260
287
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
261
288
|
* SPDX-License-Identifier: MIT
|
|
262
289
|
*/
|
|
263
290
|
|
|
264
|
-
type PropsType$
|
|
291
|
+
type PropsType$7 = React$1.PropsWithChildren<{
|
|
265
292
|
value?: IFlowTemplateValue;
|
|
266
293
|
onChange: (value?: IFlowTemplateValue) => void;
|
|
267
294
|
readonly?: boolean;
|
|
@@ -277,8 +304,8 @@ type PropsType$1 = React$1.PropsWithChildren<{
|
|
|
277
304
|
* SPDX-License-Identifier: MIT
|
|
278
305
|
*/
|
|
279
306
|
|
|
280
|
-
type PromptEditorPropsType = PropsType$
|
|
281
|
-
declare function PromptEditor(props: PropsType$
|
|
307
|
+
type PromptEditorPropsType = PropsType$7;
|
|
308
|
+
declare function PromptEditor(props: PropsType$7): React$1.JSX.Element;
|
|
282
309
|
|
|
283
310
|
/**
|
|
284
311
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -292,10 +319,10 @@ declare function PromptEditorWithVariables(props: PromptEditorPropsType): React$
|
|
|
292
319
|
* SPDX-License-Identifier: MIT
|
|
293
320
|
*/
|
|
294
321
|
|
|
295
|
-
interface PropsType extends PromptEditorPropsType {
|
|
322
|
+
interface PropsType$6 extends PromptEditorPropsType {
|
|
296
323
|
inputsValues: Record<string, IFlowValue>;
|
|
297
324
|
}
|
|
298
|
-
declare function PromptEditorWithInputs({ inputsValues, ...restProps }: PropsType): React$1.JSX.Element;
|
|
325
|
+
declare function PromptEditorWithInputs({ inputsValues, ...restProps }: PropsType$6): React$1.JSX.Element;
|
|
299
326
|
|
|
300
327
|
/**
|
|
301
328
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -316,6 +343,13 @@ interface CodeEditorPropsType extends React$1.PropsWithChildren<{}> {
|
|
|
316
343
|
}
|
|
317
344
|
declare function CodeEditor({ value, onChange, languageId, theme, children, placeholder, activeLinePlaceholder, options, readonly, }: CodeEditorPropsType): React$1.JSX.Element;
|
|
318
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
348
|
+
* SPDX-License-Identifier: MIT
|
|
349
|
+
*/
|
|
350
|
+
|
|
351
|
+
declare function CodeEditorMini(props: CodeEditorPropsType): React$1.JSX.Element;
|
|
352
|
+
|
|
319
353
|
/**
|
|
320
354
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
321
355
|
* SPDX-License-Identifier: MIT
|
|
@@ -328,14 +362,136 @@ declare function JsonEditorWithVariables(props: Omit<CodeEditorPropsType, 'langu
|
|
|
328
362
|
* SPDX-License-Identifier: MIT
|
|
329
363
|
*/
|
|
330
364
|
|
|
331
|
-
|
|
365
|
+
interface PropsType$5 {
|
|
366
|
+
value?: Record<string, IFlowValue | undefined>;
|
|
367
|
+
onChange: (value?: Record<string, IFlowValue | undefined>) => void;
|
|
368
|
+
readonly?: boolean;
|
|
369
|
+
hasError?: boolean;
|
|
370
|
+
schema?: IJsonSchema;
|
|
371
|
+
style?: React.CSSProperties;
|
|
372
|
+
constantProps?: {
|
|
373
|
+
strategies?: Strategy[];
|
|
374
|
+
[key: string]: any;
|
|
375
|
+
};
|
|
376
|
+
}
|
|
332
377
|
|
|
333
378
|
/**
|
|
334
379
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
335
380
|
* SPDX-License-Identifier: MIT
|
|
336
381
|
*/
|
|
337
382
|
|
|
338
|
-
declare
|
|
383
|
+
declare function InputsValues({ value, onChange, style, readonly, constantProps, schema, hasError, }: PropsType$5): React$1.JSX.Element;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
387
|
+
* SPDX-License-Identifier: MIT
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
interface PropsType$4 {
|
|
391
|
+
value?: IJsonSchema;
|
|
392
|
+
parentKey?: string;
|
|
393
|
+
depth?: number;
|
|
394
|
+
drilldown?: boolean;
|
|
395
|
+
showIcon?: boolean;
|
|
396
|
+
typeManager?: JsonSchemaTypeManager;
|
|
397
|
+
}
|
|
398
|
+
declare function DisplaySchemaTree(props: Omit<PropsType$4, 'parentKey' | 'depth'>): React$1.JSX.Element;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
402
|
+
* SPDX-License-Identifier: MIT
|
|
403
|
+
*/
|
|
404
|
+
|
|
405
|
+
interface PropsType$3 {
|
|
406
|
+
value?: IJsonSchema;
|
|
407
|
+
showIconInTree?: boolean;
|
|
408
|
+
displayFromScope?: boolean;
|
|
409
|
+
typeManager?: JsonSchemaTypeManager;
|
|
410
|
+
}
|
|
411
|
+
declare function DisplayOutputs({ value, showIconInTree, displayFromScope }: PropsType$3): React$1.JSX.Element;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
415
|
+
* SPDX-License-Identifier: MIT
|
|
416
|
+
*/
|
|
417
|
+
|
|
418
|
+
interface PropsType$2 {
|
|
419
|
+
title?: JSX.Element | string;
|
|
420
|
+
value?: IJsonSchema;
|
|
421
|
+
showIconInTree?: boolean;
|
|
422
|
+
warning?: boolean;
|
|
423
|
+
}
|
|
424
|
+
declare function DisplaySchemaTag({ value, showIconInTree, title, warning }: PropsType$2): React$1.JSX.Element;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
428
|
+
* SPDX-License-Identifier: MIT
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
interface PropsType$1 {
|
|
432
|
+
value?: IFlowValue;
|
|
433
|
+
title?: JSX.Element | string;
|
|
434
|
+
showIconInTree?: boolean;
|
|
435
|
+
typeManager?: JsonSchemaTypeManager;
|
|
436
|
+
}
|
|
437
|
+
declare function DisplayFlowValue({ value, title, showIconInTree }: PropsType$1): React$1.JSX.Element;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
441
|
+
* SPDX-License-Identifier: MIT
|
|
442
|
+
*/
|
|
443
|
+
|
|
444
|
+
interface PropsType {
|
|
445
|
+
value?: Record<string, IFlowValue | undefined>;
|
|
446
|
+
showIconInTree?: boolean;
|
|
447
|
+
}
|
|
448
|
+
declare function DisplayInputsValues({ value, showIconInTree }: PropsType): React$1.JSX.Element;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
452
|
+
* SPDX-License-Identifier: MIT
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
interface AssignRowsProps {
|
|
456
|
+
name: string;
|
|
457
|
+
readonly?: boolean;
|
|
458
|
+
}
|
|
459
|
+
declare function AssignRows(props: AssignRowsProps): React$1.JSX.Element;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
463
|
+
* SPDX-License-Identifier: MIT
|
|
464
|
+
*/
|
|
465
|
+
|
|
466
|
+
type AssignValueType = {
|
|
467
|
+
operator: 'assign';
|
|
468
|
+
left?: IFlowRefValue;
|
|
469
|
+
right?: IFlowValue;
|
|
470
|
+
} | {
|
|
471
|
+
operator: 'declare';
|
|
472
|
+
left?: string;
|
|
473
|
+
right?: IFlowValue;
|
|
474
|
+
};
|
|
475
|
+
interface AssignRowProps {
|
|
476
|
+
value?: AssignValueType;
|
|
477
|
+
onChange?: (value?: AssignValueType) => void;
|
|
478
|
+
onDelete?: () => void;
|
|
479
|
+
readonly?: boolean;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
484
|
+
* SPDX-License-Identifier: MIT
|
|
485
|
+
*/
|
|
486
|
+
|
|
487
|
+
declare function AssignRow(props: AssignRowProps): React$1.JSX.Element;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
491
|
+
* SPDX-License-Identifier: MIT
|
|
492
|
+
*/
|
|
493
|
+
|
|
494
|
+
declare const provideBatchInputEffect: EffectOptions[];
|
|
339
495
|
|
|
340
496
|
/**
|
|
341
497
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -369,6 +525,58 @@ declare const provideJsonSchemaOutputs: EffectOptions[];
|
|
|
369
525
|
|
|
370
526
|
declare const syncVariableTitle: EffectOptions[];
|
|
371
527
|
|
|
528
|
+
/**
|
|
529
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
530
|
+
* SPDX-License-Identifier: MIT
|
|
531
|
+
*/
|
|
532
|
+
|
|
533
|
+
declare const validateWhenVariableSync: ({ scope, }?: {
|
|
534
|
+
scope?: "private" | "public";
|
|
535
|
+
}) => EffectOptions[];
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
539
|
+
* SPDX-License-Identifier: MIT
|
|
540
|
+
*/
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Example:
|
|
544
|
+
* const formMeta = {
|
|
545
|
+
* effect: {
|
|
546
|
+
* 'inputsValues.*': listenRefValueChange(({ name, variable, form }) => {
|
|
547
|
+
* const schema = JsonSchemaUtils.astToSchema(variable?.type);
|
|
548
|
+
* form.setValueIn(`${name}.schema`, schema);
|
|
549
|
+
* })
|
|
550
|
+
* }
|
|
551
|
+
* }
|
|
552
|
+
* @param cb
|
|
553
|
+
* @returns
|
|
554
|
+
*/
|
|
555
|
+
declare const listenRefValueChange: (cb: (props: EffectFuncProps<IFlowRefValue> & {
|
|
556
|
+
variable?: BaseVariableField;
|
|
557
|
+
}) => void) => EffectOptions[];
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
561
|
+
* SPDX-License-Identifier: MIT
|
|
562
|
+
*/
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Example:
|
|
566
|
+
* const formMeta = {
|
|
567
|
+
* effect: {
|
|
568
|
+
* 'inputsValues.*': listenRefSchemaChange(({ name, schema, form }) => {
|
|
569
|
+
* form.setValueIn(`${name}.schema`, schema);
|
|
570
|
+
* })
|
|
571
|
+
* }
|
|
572
|
+
* }
|
|
573
|
+
* @param cb
|
|
574
|
+
* @returns
|
|
575
|
+
*/
|
|
576
|
+
declare const listenRefSchemaChange: (cb: (props: EffectFuncProps<IFlowRefValue> & {
|
|
577
|
+
schema?: IJsonSchema;
|
|
578
|
+
}) => void) => EffectOptions[];
|
|
579
|
+
|
|
372
580
|
/**
|
|
373
581
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
374
582
|
* SPDX-License-Identifier: MIT
|
|
@@ -458,40 +666,54 @@ declare function formatNewRefToLegacyRef(value: NewFlowRefValueSchema): {
|
|
|
458
666
|
* SPDX-License-Identifier: MIT
|
|
459
667
|
*/
|
|
460
668
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
669
|
+
/**
|
|
670
|
+
* Creates a material component wrapper with dependency injection support
|
|
671
|
+
*
|
|
672
|
+
* This Higher-Order Component (HOC) implements a dynamic component replacement mechanism
|
|
673
|
+
* for material components. It automatically checks if a custom renderer is registered
|
|
674
|
+
* in the editor context, using the injected component if available, otherwise
|
|
675
|
+
* falling back to the default component.
|
|
676
|
+
*
|
|
677
|
+
* @example
|
|
678
|
+
* ```tsx
|
|
679
|
+
* // 1.Create an injectable material component
|
|
680
|
+
* const InjectVariableSelector = createInjectMaterial(VariableSelector)
|
|
681
|
+
*
|
|
682
|
+
* // 2. Register custom components in editor
|
|
683
|
+
* // Configure in use-editor-props.tsx:
|
|
684
|
+
* const editorProps = {
|
|
685
|
+
* materials: {
|
|
686
|
+
* components: {
|
|
687
|
+
* [VariableSelector.renderKey]: YourCustomVariableSelector
|
|
688
|
+
* }
|
|
689
|
+
* }
|
|
690
|
+
* }
|
|
691
|
+
* ```
|
|
692
|
+
*
|
|
693
|
+
* @description
|
|
694
|
+
* Data flow explanation:
|
|
695
|
+
* - Register components to FlowRendererRegistry in use-editor-props
|
|
696
|
+
* - InjectMaterial reads renderers from FlowRendererRegistry
|
|
697
|
+
* - If registered renderer exists and type is REACT, use injected component
|
|
698
|
+
* - If not exists or type mismatch, fallback to default component
|
|
699
|
+
*
|
|
700
|
+
* @param Component - Default React component
|
|
701
|
+
* @param params - Optional parameters
|
|
702
|
+
* @param params.renderKey - Custom render key name, highest priority
|
|
703
|
+
* @returns Wrapper component with dependency injection support
|
|
704
|
+
*/
|
|
705
|
+
declare function createInjectMaterial<Props>(Component: React$1.FC<Props> & {
|
|
706
|
+
renderKey?: string;
|
|
707
|
+
}, params?: {
|
|
708
|
+
renderKey?: string;
|
|
709
|
+
}): React$1.FC<Props>;
|
|
489
710
|
|
|
490
711
|
/**
|
|
491
712
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
492
713
|
* SPDX-License-Identifier: MIT
|
|
493
714
|
*/
|
|
494
715
|
|
|
716
|
+
declare const provideBatchOutputsEffect: EffectOptions[];
|
|
495
717
|
/**
|
|
496
718
|
* Free Layout only right now
|
|
497
719
|
*/
|
|
@@ -499,4 +721,43 @@ declare const createBatchOutputsFormPlugin: FormPluginCreator<{
|
|
|
499
721
|
outputKey: string;
|
|
500
722
|
}>;
|
|
501
723
|
|
|
502
|
-
|
|
724
|
+
/**
|
|
725
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
726
|
+
* SPDX-License-Identifier: MIT
|
|
727
|
+
*/
|
|
728
|
+
interface InputConfig$1 {
|
|
729
|
+
sourceKey: string;
|
|
730
|
+
targetKey: string;
|
|
731
|
+
scope?: 'private' | 'public';
|
|
732
|
+
}
|
|
733
|
+
declare const createInferInputsPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig$1>;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
737
|
+
* SPDX-License-Identifier: MIT
|
|
738
|
+
*/
|
|
739
|
+
interface InputConfig {
|
|
740
|
+
assignKey: string;
|
|
741
|
+
outputKey: string;
|
|
742
|
+
}
|
|
743
|
+
declare const createInferAssignPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig>;
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
747
|
+
* SPDX-License-Identifier: MIT
|
|
748
|
+
*/
|
|
749
|
+
|
|
750
|
+
interface Context {
|
|
751
|
+
node: FlowNodeEntity;
|
|
752
|
+
required?: boolean;
|
|
753
|
+
errorMessages?: {
|
|
754
|
+
required?: string;
|
|
755
|
+
unknownVariable?: string;
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context): {
|
|
759
|
+
level: FeedbackLevel;
|
|
760
|
+
message: string;
|
|
761
|
+
} | undefined;
|
|
762
|
+
|
|
763
|
+
export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type Strategy as ConstantInputStrategy, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, type JsonSchemaTypeRegistry, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, type TypeSelectorProps, VariableSelector, type VariableSelectorProps, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createInjectMaterial, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };
|