@flowgram.ai/form-materials 0.2.30 → 0.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +553 -0
- package/dist/index.js +3697 -0
- package/dist/index.js.map +1 -0
- package/package.json +5 -5
- package/src/components/condition-row/hooks/useOp.tsx +3 -1
- package/src/components/condition-row/index.tsx +1 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import React$1 from 'react';
|
|
2
|
+
import { TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
|
|
3
|
+
import { InferValues } from '@coze-editor/editor/react';
|
|
4
|
+
import preset from '@coze-editor/editor/preset-code';
|
|
5
|
+
import { BaseVariableField, EffectOptions, ASTNodeJSON, ASTNode, BaseType, FormPluginCreator } from '@flowgram.ai/editor';
|
|
6
|
+
import * as _flowgram_ai_node from '@flowgram.ai/node';
|
|
7
|
+
import { TreeNodeData } from '@douyinfe/semi-ui/lib/es/tree';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
11
|
+
* SPDX-License-Identifier: MIT
|
|
12
|
+
*/
|
|
13
|
+
type JsonSchemaBasicType = 'boolean' | 'string' | 'integer' | 'number' | 'object' | 'array' | 'map';
|
|
14
|
+
interface IJsonSchema<T = string> {
|
|
15
|
+
type?: T;
|
|
16
|
+
default?: any;
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
enum?: (string | number)[];
|
|
20
|
+
properties?: Record<string, IJsonSchema<T>>;
|
|
21
|
+
additionalProperties?: IJsonSchema<T>;
|
|
22
|
+
items?: IJsonSchema<T>;
|
|
23
|
+
required?: string[];
|
|
24
|
+
$ref?: string;
|
|
25
|
+
extra?: {
|
|
26
|
+
index?: number;
|
|
27
|
+
weak?: boolean;
|
|
28
|
+
formComponent?: string;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
type IBasicJsonSchema = IJsonSchema<JsonSchemaBasicType>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
36
|
+
* SPDX-License-Identifier: MIT
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
type VariableField = BaseVariableField<{
|
|
40
|
+
icon?: string | JSX.Element;
|
|
41
|
+
title?: string;
|
|
42
|
+
}>;
|
|
43
|
+
declare function useVariableTree(params: {
|
|
44
|
+
includeSchema?: IJsonSchema | IJsonSchema[];
|
|
45
|
+
excludeSchema?: IJsonSchema | IJsonSchema[];
|
|
46
|
+
customSkip?: (variable: VariableField) => boolean;
|
|
47
|
+
}): TreeNodeData[];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
51
|
+
* SPDX-License-Identifier: MIT
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
interface PropTypes$2 {
|
|
55
|
+
value?: string[];
|
|
56
|
+
config?: {
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
notFoundContent?: string;
|
|
59
|
+
};
|
|
60
|
+
onChange: (value?: string[]) => void;
|
|
61
|
+
includeSchema?: IJsonSchema | IJsonSchema[];
|
|
62
|
+
excludeSchema?: IJsonSchema | IJsonSchema[];
|
|
63
|
+
readonly?: boolean;
|
|
64
|
+
hasError?: boolean;
|
|
65
|
+
style?: React$1.CSSProperties;
|
|
66
|
+
triggerRender?: (props: TriggerRenderProps) => React$1.ReactNode;
|
|
67
|
+
}
|
|
68
|
+
type VariableSelectorProps = PropTypes$2;
|
|
69
|
+
|
|
70
|
+
declare const VariableSelector: ({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: PropTypes$2) => React$1.JSX.Element;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
74
|
+
* SPDX-License-Identifier: MIT
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
interface IFlowValueExtra {
|
|
78
|
+
index?: number;
|
|
79
|
+
}
|
|
80
|
+
interface IFlowConstantValue {
|
|
81
|
+
type: 'constant';
|
|
82
|
+
content?: string | number | boolean;
|
|
83
|
+
schema?: IJsonSchema;
|
|
84
|
+
extra?: IFlowValueExtra;
|
|
85
|
+
}
|
|
86
|
+
interface IFlowRefValue {
|
|
87
|
+
type: 'ref';
|
|
88
|
+
content?: string[];
|
|
89
|
+
extra?: IFlowValueExtra;
|
|
90
|
+
}
|
|
91
|
+
interface IFlowExpressionValue {
|
|
92
|
+
type: 'expression';
|
|
93
|
+
content?: string;
|
|
94
|
+
extra?: IFlowValueExtra;
|
|
95
|
+
}
|
|
96
|
+
interface IFlowTemplateValue {
|
|
97
|
+
type: 'template';
|
|
98
|
+
content?: string;
|
|
99
|
+
extra?: IFlowValueExtra;
|
|
100
|
+
}
|
|
101
|
+
type IFlowValue = IFlowConstantValue | IFlowRefValue | IFlowExpressionValue | IFlowTemplateValue;
|
|
102
|
+
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
106
|
+
* SPDX-License-Identifier: MIT
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
declare const VariableTypeIcons: {
|
|
110
|
+
[key: string]: React$1.ReactNode;
|
|
111
|
+
};
|
|
112
|
+
declare const ArrayIcons: {
|
|
113
|
+
[key: string]: React$1.ReactNode;
|
|
114
|
+
};
|
|
115
|
+
declare const getSchemaIcon: (value?: Partial<IJsonSchema>) => React$1.ReactNode;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
119
|
+
* SPDX-License-Identifier: MIT
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
interface PropTypes$1 {
|
|
123
|
+
value?: Partial<IJsonSchema>;
|
|
124
|
+
onChange?: (value?: Partial<IJsonSchema>) => void;
|
|
125
|
+
readonly?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated use readonly instead
|
|
128
|
+
*/
|
|
129
|
+
disabled?: boolean;
|
|
130
|
+
style?: React$1.CSSProperties;
|
|
131
|
+
}
|
|
132
|
+
declare const getTypeSelectValue: (value?: Partial<IJsonSchema>) => string[] | undefined;
|
|
133
|
+
declare const parseTypeSelectValue: (value?: string[]) => Partial<IJsonSchema> | undefined;
|
|
134
|
+
declare function TypeSelector(props: PropTypes$1): React$1.JSX.Element;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
138
|
+
* SPDX-License-Identifier: MIT
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
interface ConfigType {
|
|
142
|
+
placeholder?: string;
|
|
143
|
+
descTitle?: string;
|
|
144
|
+
descPlaceholder?: string;
|
|
145
|
+
defaultValueTitle?: string;
|
|
146
|
+
defaultValuePlaceholder?: string;
|
|
147
|
+
addButtonText?: string;
|
|
148
|
+
jsonFormatText?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
153
|
+
* SPDX-License-Identifier: MIT
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
declare function JsonSchemaEditor(props: {
|
|
157
|
+
value?: IJsonSchema;
|
|
158
|
+
onChange?: (value: IJsonSchema) => void;
|
|
159
|
+
config?: ConfigType;
|
|
160
|
+
className?: string;
|
|
161
|
+
readonly?: boolean;
|
|
162
|
+
}): React$1.JSX.Element;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
166
|
+
* SPDX-License-Identifier: MIT
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
declare function BatchVariableSelector(props: VariableSelectorProps): React$1.JSX.Element;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
173
|
+
* SPDX-License-Identifier: MIT
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
interface Strategy<Value = any> {
|
|
177
|
+
hit: (schema: IJsonSchema) => boolean;
|
|
178
|
+
Renderer: React.FC<RendererProps<Value>>;
|
|
179
|
+
}
|
|
180
|
+
interface RendererProps<Value = any> {
|
|
181
|
+
value?: Value;
|
|
182
|
+
onChange?: (value: Value) => void;
|
|
183
|
+
readonly?: boolean;
|
|
184
|
+
}
|
|
185
|
+
interface PropsType$5 extends RendererProps {
|
|
186
|
+
schema: IJsonSchema;
|
|
187
|
+
strategies?: Strategy[];
|
|
188
|
+
fallbackRenderer?: React.FC<RendererProps>;
|
|
189
|
+
[key: string]: any;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
194
|
+
* SPDX-License-Identifier: MIT
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
declare function ConstantInput(props: PropsType$5): React$1.JSX.Element;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
201
|
+
* SPDX-License-Identifier: MIT
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
interface PropsType$4 {
|
|
205
|
+
value?: IFlowConstantRefValue;
|
|
206
|
+
onChange: (value?: IFlowConstantRefValue) => void;
|
|
207
|
+
readonly?: boolean;
|
|
208
|
+
hasError?: boolean;
|
|
209
|
+
style?: React$1.CSSProperties;
|
|
210
|
+
schema?: IJsonSchema;
|
|
211
|
+
constantProps?: {
|
|
212
|
+
strategies?: Strategy[];
|
|
213
|
+
schema?: IJsonSchema;
|
|
214
|
+
[key: string]: any;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
declare function DynamicValueInput({ value, onChange, readonly, style, schema: schemaFromProps, constantProps, }: PropsType$4): React$1.JSX.Element;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
221
|
+
* SPDX-License-Identifier: MIT
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
declare enum Op {
|
|
225
|
+
EQ = "eq",
|
|
226
|
+
NEQ = "neq",
|
|
227
|
+
GT = "gt",
|
|
228
|
+
GTE = "gte",
|
|
229
|
+
LT = "lt",
|
|
230
|
+
LTE = "lte",
|
|
231
|
+
IN = "in",
|
|
232
|
+
NIN = "nin",
|
|
233
|
+
CONTAINS = "contains",
|
|
234
|
+
NOT_CONTAINS = "not_contains",
|
|
235
|
+
IS_EMPTY = "is_empty",
|
|
236
|
+
IS_NOT_EMPTY = "is_not_empty",
|
|
237
|
+
IS_TRUE = "is_true",
|
|
238
|
+
IS_FALSE = "is_false"
|
|
239
|
+
}
|
|
240
|
+
interface ConditionRowValueType {
|
|
241
|
+
left?: IFlowRefValue;
|
|
242
|
+
operator?: Op;
|
|
243
|
+
right?: IFlowConstantRefValue;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
248
|
+
* SPDX-License-Identifier: MIT
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
interface PropTypes {
|
|
252
|
+
value?: ConditionRowValueType;
|
|
253
|
+
onChange: (value?: ConditionRowValueType) => void;
|
|
254
|
+
style?: React$1.CSSProperties;
|
|
255
|
+
readonly?: boolean;
|
|
256
|
+
}
|
|
257
|
+
declare function ConditionRow({ style, value, onChange, readonly }: PropTypes): React$1.JSX.Element;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
261
|
+
* SPDX-License-Identifier: MIT
|
|
262
|
+
*/
|
|
263
|
+
|
|
264
|
+
type ValueType = Record<string, IFlowRefValue | undefined>;
|
|
265
|
+
interface PropsType$3 {
|
|
266
|
+
value?: ValueType;
|
|
267
|
+
onChange: (value?: ValueType) => void;
|
|
268
|
+
readonly?: boolean;
|
|
269
|
+
hasError?: boolean;
|
|
270
|
+
style?: React.CSSProperties;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
275
|
+
* SPDX-License-Identifier: MIT
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
declare function BatchOutputs(props: PropsType$3): React$1.JSX.Element;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
282
|
+
* SPDX-License-Identifier: MIT
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
type PropsType$2 = React$1.PropsWithChildren<{
|
|
286
|
+
value?: IFlowTemplateValue;
|
|
287
|
+
onChange: (value?: IFlowTemplateValue) => void;
|
|
288
|
+
readonly?: boolean;
|
|
289
|
+
hasError?: boolean;
|
|
290
|
+
placeholder?: string;
|
|
291
|
+
activeLinePlaceholder?: string;
|
|
292
|
+
disableMarkdownHighlight?: boolean;
|
|
293
|
+
style?: React$1.CSSProperties;
|
|
294
|
+
}>;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
298
|
+
* SPDX-License-Identifier: MIT
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
type PromptEditorPropsType = PropsType$2;
|
|
302
|
+
declare function PromptEditor(props: PropsType$2): React$1.JSX.Element;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
306
|
+
* SPDX-License-Identifier: MIT
|
|
307
|
+
*/
|
|
308
|
+
|
|
309
|
+
declare function PromptEditorWithVariables(props: PromptEditorPropsType): React$1.JSX.Element;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
313
|
+
* SPDX-License-Identifier: MIT
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
interface PropsType$1 extends PromptEditorPropsType {
|
|
317
|
+
inputsValues: Record<string, IFlowValue>;
|
|
318
|
+
}
|
|
319
|
+
declare function PromptEditorWithInputs({ inputsValues, ...restProps }: PropsType$1): React$1.JSX.Element;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
323
|
+
* SPDX-License-Identifier: MIT
|
|
324
|
+
*/
|
|
325
|
+
|
|
326
|
+
type Preset = typeof preset;
|
|
327
|
+
type Options = Partial<InferValues<Preset[number]>>;
|
|
328
|
+
interface CodeEditorPropsType extends React$1.PropsWithChildren<{}> {
|
|
329
|
+
value?: string;
|
|
330
|
+
onChange?: (value: string) => void;
|
|
331
|
+
languageId: 'python' | 'typescript' | 'shell' | 'json';
|
|
332
|
+
theme?: 'dark' | 'light';
|
|
333
|
+
placeholder?: string;
|
|
334
|
+
activeLinePlaceholder?: string;
|
|
335
|
+
readonly?: boolean;
|
|
336
|
+
options?: Options;
|
|
337
|
+
}
|
|
338
|
+
declare function CodeEditor({ value, onChange, languageId, theme, children, placeholder, activeLinePlaceholder, options, readonly, }: CodeEditorPropsType): React$1.JSX.Element;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
342
|
+
* SPDX-License-Identifier: MIT
|
|
343
|
+
*/
|
|
344
|
+
|
|
345
|
+
declare function JsonEditorWithVariables(props: Omit<CodeEditorPropsType, 'languageId'>): React$1.JSX.Element;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
349
|
+
* SPDX-License-Identifier: MIT
|
|
350
|
+
*/
|
|
351
|
+
|
|
352
|
+
interface PropsType {
|
|
353
|
+
value?: Record<string, IFlowValue | undefined>;
|
|
354
|
+
onChange: (value?: Record<string, IFlowValue | undefined>) => void;
|
|
355
|
+
readonly?: boolean;
|
|
356
|
+
hasError?: boolean;
|
|
357
|
+
schema?: IJsonSchema;
|
|
358
|
+
style?: React.CSSProperties;
|
|
359
|
+
constantProps?: {
|
|
360
|
+
strategies?: Strategy[];
|
|
361
|
+
[key: string]: any;
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
367
|
+
* SPDX-License-Identifier: MIT
|
|
368
|
+
*/
|
|
369
|
+
|
|
370
|
+
declare function InputsValues({ value, onChange, style, readonly, constantProps, schema, hasError, }: PropsType): React$1.JSX.Element;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
374
|
+
* SPDX-License-Identifier: MIT
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
declare const provideBatchInputEffect: EffectOptions[];
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
381
|
+
* SPDX-License-Identifier: MIT
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Auto rename ref when form item's key is renamed
|
|
386
|
+
*
|
|
387
|
+
* Example:
|
|
388
|
+
*
|
|
389
|
+
* formMeta: {
|
|
390
|
+
* effects: {
|
|
391
|
+
* "inputsValues": autoRenameRefEffect,
|
|
392
|
+
* }
|
|
393
|
+
* }
|
|
394
|
+
*/
|
|
395
|
+
declare const autoRenameRefEffect: EffectOptions[];
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
399
|
+
* SPDX-License-Identifier: MIT
|
|
400
|
+
*/
|
|
401
|
+
|
|
402
|
+
declare const provideJsonSchemaOutputs: EffectOptions[];
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
406
|
+
* SPDX-License-Identifier: MIT
|
|
407
|
+
*/
|
|
408
|
+
|
|
409
|
+
declare const syncVariableTitle: EffectOptions[];
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
413
|
+
* SPDX-License-Identifier: MIT
|
|
414
|
+
*/
|
|
415
|
+
interface LegacyFlowRefValueSchema {
|
|
416
|
+
type: 'ref';
|
|
417
|
+
content: string;
|
|
418
|
+
}
|
|
419
|
+
interface NewFlowRefValueSchema {
|
|
420
|
+
type: 'ref';
|
|
421
|
+
content: string[];
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* In flowgram 0.2.0, for introducing Loop variable functionality,
|
|
425
|
+
* the FlowRefValueSchema type definition is updated:
|
|
426
|
+
*
|
|
427
|
+
* interface LegacyFlowRefValueSchema {
|
|
428
|
+
* type: 'ref';
|
|
429
|
+
* content: string;
|
|
430
|
+
* }
|
|
431
|
+
*
|
|
432
|
+
* interface NewFlowRefValueSchema {
|
|
433
|
+
* type: 'ref';
|
|
434
|
+
* content: string[];
|
|
435
|
+
* }
|
|
436
|
+
*
|
|
437
|
+
*
|
|
438
|
+
* For making sure backend json will not be changed, we provide format legacy ref utils for updating the formData
|
|
439
|
+
*
|
|
440
|
+
* How to use:
|
|
441
|
+
*
|
|
442
|
+
* 1. Call formatLegacyRefOnSubmit on the formData before submitting
|
|
443
|
+
* 2. Call formatLegacyRefOnInit on the formData after submitting
|
|
444
|
+
*
|
|
445
|
+
* Example:
|
|
446
|
+
* import { formatLegacyRefOnSubmit, formatLegacyRefOnInit } from '@flowgram.ai/form-materials';
|
|
447
|
+
* formMeta: {
|
|
448
|
+
* formatOnSubmit: (data) => formatLegacyRefOnSubmit(data),
|
|
449
|
+
* formatOnInit: (data) => formatLegacyRefOnInit(data),
|
|
450
|
+
* }
|
|
451
|
+
*/
|
|
452
|
+
declare function formatLegacyRefOnSubmit(value: any): any;
|
|
453
|
+
/**
|
|
454
|
+
* In flowgram 0.2.0, for introducing Loop variable functionality,
|
|
455
|
+
* the FlowRefValueSchema type definition is updated:
|
|
456
|
+
*
|
|
457
|
+
* interface LegacyFlowRefValueSchema {
|
|
458
|
+
* type: 'ref';
|
|
459
|
+
* content: string;
|
|
460
|
+
* }
|
|
461
|
+
*
|
|
462
|
+
* interface NewFlowRefValueSchema {
|
|
463
|
+
* type: 'ref';
|
|
464
|
+
* content: string[];
|
|
465
|
+
* }
|
|
466
|
+
*
|
|
467
|
+
*
|
|
468
|
+
* For making sure backend json will not be changed, we provide format legacy ref utils for updating the formData
|
|
469
|
+
*
|
|
470
|
+
* How to use:
|
|
471
|
+
*
|
|
472
|
+
* 1. Call formatLegacyRefOnSubmit on the formData before submitting
|
|
473
|
+
* 2. Call formatLegacyRefOnInit on the formData after submitting
|
|
474
|
+
*
|
|
475
|
+
* Example:
|
|
476
|
+
* import { formatLegacyRefOnSubmit, formatLegacyRefOnInit } from '@flowgram.ai/form-materials';
|
|
477
|
+
*
|
|
478
|
+
* formMeta: {
|
|
479
|
+
* formatOnSubmit: (data) => formatLegacyRefOnSubmit(data),
|
|
480
|
+
* formatOnInit: (data) => formatLegacyRefOnInit(data),
|
|
481
|
+
* }
|
|
482
|
+
*/
|
|
483
|
+
declare function formatLegacyRefOnInit(value: any): any;
|
|
484
|
+
declare function isLegacyFlowRefValueSchema(value: any): value is LegacyFlowRefValueSchema;
|
|
485
|
+
declare function isNewFlowRefValueSchema(value: any): value is NewFlowRefValueSchema;
|
|
486
|
+
declare function formatLegacyRefToNewRef(value: LegacyFlowRefValueSchema): {
|
|
487
|
+
type: string;
|
|
488
|
+
content: string[];
|
|
489
|
+
};
|
|
490
|
+
declare function formatNewRefToLegacyRef(value: NewFlowRefValueSchema): {
|
|
491
|
+
type: string;
|
|
492
|
+
content: string;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
497
|
+
* SPDX-License-Identifier: MIT
|
|
498
|
+
*/
|
|
499
|
+
|
|
500
|
+
declare namespace JsonSchemaUtils {
|
|
501
|
+
/**
|
|
502
|
+
* Converts a JSON schema to an Abstract Syntax Tree (AST) representation.
|
|
503
|
+
* This function recursively processes the JSON schema and creates corresponding AST nodes.
|
|
504
|
+
*
|
|
505
|
+
* For more information on JSON Schema, refer to the official documentation:
|
|
506
|
+
* https://json-schema.org/
|
|
507
|
+
*
|
|
508
|
+
* @param jsonSchema - The JSON schema to convert.
|
|
509
|
+
* @returns An AST node representing the JSON schema, or undefined if the schema type is not recognized.
|
|
510
|
+
*/
|
|
511
|
+
function schemaToAST(jsonSchema: IJsonSchema): ASTNodeJSON | undefined;
|
|
512
|
+
/**
|
|
513
|
+
* Convert AST To JSON Schema
|
|
514
|
+
* @param typeAST
|
|
515
|
+
* @returns
|
|
516
|
+
*/
|
|
517
|
+
function astToSchema(typeAST: ASTNode, options?: {
|
|
518
|
+
drilldown?: boolean;
|
|
519
|
+
}): IJsonSchema | undefined;
|
|
520
|
+
/**
|
|
521
|
+
* Check if the AST type is match the JSON Schema
|
|
522
|
+
* @param typeAST
|
|
523
|
+
* @param schema
|
|
524
|
+
* @returns
|
|
525
|
+
*/
|
|
526
|
+
function isASTMatchSchema(typeAST: BaseType, schema: IJsonSchema | IJsonSchema[]): boolean;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
531
|
+
* SPDX-License-Identifier: MIT
|
|
532
|
+
*/
|
|
533
|
+
|
|
534
|
+
declare const provideBatchOutputsEffect: EffectOptions[];
|
|
535
|
+
/**
|
|
536
|
+
* Free Layout only right now
|
|
537
|
+
*/
|
|
538
|
+
declare const createBatchOutputsFormPlugin: FormPluginCreator<{
|
|
539
|
+
outputKey: string;
|
|
540
|
+
}>;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
544
|
+
* SPDX-License-Identifier: MIT
|
|
545
|
+
*/
|
|
546
|
+
interface InputConfig {
|
|
547
|
+
sourceKey: string;
|
|
548
|
+
targetKey: string;
|
|
549
|
+
scope?: 'private' | 'public';
|
|
550
|
+
}
|
|
551
|
+
declare const createInferInputsPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig>;
|
|
552
|
+
|
|
553
|
+
export { ArrayIcons, BatchOutputs, BatchVariableSelector, CodeEditor, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, type IJsonSchema, InputsValues, JsonEditorWithVariables, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, createBatchOutputsFormPlugin, createInferInputsPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useVariableTree };
|