@flowgram.ai/form-materials 0.2.0 → 0.2.2
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 +544 -107
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +130 -39
- package/dist/index.d.ts +130 -39
- package/dist/index.js +544 -107
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/components/batch-variable-selector/index.tsx +3 -2
- package/src/components/condition-row/config.json +5 -0
- package/src/components/condition-row/constants.ts +123 -0
- package/src/components/condition-row/hooks/useOp.tsx +45 -0
- package/src/components/condition-row/hooks/useRule.ts +26 -0
- package/src/components/condition-row/index.tsx +71 -0
- package/src/components/condition-row/styles.tsx +25 -0
- package/src/components/condition-row/types.ts +37 -0
- package/src/components/constant-input/config.json +1 -1
- package/src/components/constant-input/types.ts +3 -3
- package/src/components/dynamic-value-input/index.tsx +13 -5
- package/src/components/index.ts +1 -0
- package/src/components/json-schema-editor/components/blur-input.tsx +22 -0
- package/src/components/json-schema-editor/config.json +1 -1
- package/src/components/json-schema-editor/hooks.tsx +2 -2
- package/src/components/json-schema-editor/index.tsx +7 -6
- package/src/components/json-schema-editor/types.ts +3 -3
- package/src/components/type-selector/config.json +1 -1
- package/src/components/type-selector/constants.tsx +2 -2
- package/src/components/type-selector/index.tsx +6 -6
- package/src/components/variable-selector/config.json +1 -1
- package/src/components/variable-selector/index.tsx +4 -4
- package/src/components/variable-selector/use-variable-tree.tsx +11 -5
- package/src/effects/auto-rename-ref/config.json +5 -0
- package/src/effects/auto-rename-ref/index.ts +104 -0
- package/src/effects/index.ts +1 -0
- package/src/typings/index.ts +1 -0
- package/src/typings/json-schema/config.json +5 -0
- package/src/typings/json-schema/index.ts +31 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/json-schema/config.json +5 -0
- package/src/utils/json-schema/index.ts +161 -0
- package/src/components/type-selector/types.ts +0 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,25 +1,63 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
-
import { VarJSONSchema, EffectOptions } from '@flowgram.ai/editor';
|
|
3
2
|
import { TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
|
|
3
|
+
import { EffectOptions, ASTNodeJSON, ASTNode, BaseType } from '@flowgram.ai/editor';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type JsonSchemaBasicType = 'boolean' | 'string' | 'integer' | 'number' | 'object' | 'array' | 'map';
|
|
6
|
+
interface IJsonSchema<T = string> {
|
|
7
|
+
type?: T;
|
|
8
|
+
default?: any;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
enum?: (string | number)[];
|
|
12
|
+
properties?: Record<string, IJsonSchema<T>>;
|
|
13
|
+
additionalProperties?: IJsonSchema<T>;
|
|
14
|
+
items?: IJsonSchema<T>;
|
|
15
|
+
required?: string[];
|
|
16
|
+
$ref?: string;
|
|
17
|
+
extra?: {
|
|
18
|
+
index?: number;
|
|
19
|
+
weak?: boolean;
|
|
20
|
+
formComponent?: string;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
type IBasicJsonSchema = IJsonSchema<JsonSchemaBasicType>;
|
|
25
|
+
|
|
26
|
+
interface PropTypes$2 {
|
|
6
27
|
value?: string[];
|
|
7
28
|
config?: {
|
|
8
29
|
placeholder?: string;
|
|
9
30
|
notFoundContent?: string;
|
|
10
31
|
};
|
|
11
32
|
onChange: (value?: string[]) => void;
|
|
12
|
-
includeSchema?:
|
|
13
|
-
excludeSchema?:
|
|
33
|
+
includeSchema?: IJsonSchema | IJsonSchema[];
|
|
34
|
+
excludeSchema?: IJsonSchema | IJsonSchema[];
|
|
14
35
|
readonly?: boolean;
|
|
15
36
|
hasError?: boolean;
|
|
16
37
|
style?: React$1.CSSProperties;
|
|
17
38
|
triggerRender?: (props: TriggerRenderProps) => React$1.ReactNode;
|
|
18
39
|
}
|
|
19
|
-
type VariableSelectorProps = PropTypes$
|
|
20
|
-
declare const VariableSelector: ({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: PropTypes$
|
|
40
|
+
type VariableSelectorProps = PropTypes$2;
|
|
41
|
+
declare const VariableSelector: ({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: PropTypes$2) => React$1.JSX.Element;
|
|
21
42
|
|
|
22
|
-
|
|
43
|
+
interface IFlowConstantValue {
|
|
44
|
+
type: 'constant';
|
|
45
|
+
content?: string | number | boolean;
|
|
46
|
+
}
|
|
47
|
+
interface IFlowRefValue {
|
|
48
|
+
type: 'ref';
|
|
49
|
+
content?: string[];
|
|
50
|
+
}
|
|
51
|
+
interface IFlowExpressionValue {
|
|
52
|
+
type: 'expression';
|
|
53
|
+
content?: string;
|
|
54
|
+
}
|
|
55
|
+
interface IFlowTemplateValue {
|
|
56
|
+
type: 'template';
|
|
57
|
+
content?: string;
|
|
58
|
+
}
|
|
59
|
+
type IFlowValue = IFlowConstantValue | IFlowRefValue | IFlowExpressionValue | IFlowTemplateValue;
|
|
60
|
+
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
23
61
|
|
|
24
62
|
declare const VariableTypeIcons: {
|
|
25
63
|
[key: string]: React$1.ReactNode;
|
|
@@ -27,17 +65,17 @@ declare const VariableTypeIcons: {
|
|
|
27
65
|
declare const ArrayIcons: {
|
|
28
66
|
[key: string]: React$1.ReactNode;
|
|
29
67
|
};
|
|
30
|
-
declare const getSchemaIcon: (value?: Partial<
|
|
68
|
+
declare const getSchemaIcon: (value?: Partial<IJsonSchema>) => React$1.ReactNode;
|
|
31
69
|
|
|
32
|
-
interface PropTypes {
|
|
33
|
-
value?: Partial<
|
|
34
|
-
onChange: (value?: Partial<
|
|
70
|
+
interface PropTypes$1 {
|
|
71
|
+
value?: Partial<IJsonSchema>;
|
|
72
|
+
onChange: (value?: Partial<IJsonSchema>) => void;
|
|
35
73
|
disabled?: boolean;
|
|
36
74
|
style?: React$1.CSSProperties;
|
|
37
75
|
}
|
|
38
|
-
declare const getTypeSelectValue: (value?: Partial<
|
|
39
|
-
declare const parseTypeSelectValue: (value?: string[]) => Partial<
|
|
40
|
-
declare function TypeSelector(props: PropTypes): React$1.JSX.Element;
|
|
76
|
+
declare const getTypeSelectValue: (value?: Partial<IJsonSchema>) => string[] | undefined;
|
|
77
|
+
declare const parseTypeSelectValue: (value?: string[]) => Partial<IJsonSchema> | undefined;
|
|
78
|
+
declare function TypeSelector(props: PropTypes$1): React$1.JSX.Element;
|
|
41
79
|
|
|
42
80
|
interface ConfigType {
|
|
43
81
|
placeholder?: string;
|
|
@@ -47,15 +85,15 @@ interface ConfigType {
|
|
|
47
85
|
}
|
|
48
86
|
|
|
49
87
|
declare function JsonSchemaEditor(props: {
|
|
50
|
-
value?:
|
|
51
|
-
onChange?: (value:
|
|
88
|
+
value?: IJsonSchema;
|
|
89
|
+
onChange?: (value: IJsonSchema) => void;
|
|
52
90
|
config?: ConfigType;
|
|
53
91
|
}): React$1.JSX.Element;
|
|
54
92
|
|
|
55
93
|
declare function BatchVariableSelector(props: VariableSelectorProps): React$1.JSX.Element;
|
|
56
94
|
|
|
57
95
|
interface Strategy<Value = any> {
|
|
58
|
-
hit: (schema:
|
|
96
|
+
hit: (schema: IJsonSchema) => boolean;
|
|
59
97
|
Renderer: React.FC<RendererProps<Value>>;
|
|
60
98
|
}
|
|
61
99
|
interface RendererProps<Value = any> {
|
|
@@ -64,39 +102,20 @@ interface RendererProps<Value = any> {
|
|
|
64
102
|
readonly?: boolean;
|
|
65
103
|
}
|
|
66
104
|
interface PropsType$1 extends RendererProps {
|
|
67
|
-
schema:
|
|
105
|
+
schema: IJsonSchema;
|
|
68
106
|
strategies?: Strategy[];
|
|
69
107
|
[key: string]: any;
|
|
70
108
|
}
|
|
71
109
|
|
|
72
110
|
declare function ConstantInput(props: PropsType$1): React$1.JSX.Element;
|
|
73
111
|
|
|
74
|
-
interface IFlowConstantValue {
|
|
75
|
-
type: 'constant';
|
|
76
|
-
content?: string | number | boolean;
|
|
77
|
-
}
|
|
78
|
-
interface IFlowRefValue {
|
|
79
|
-
type: 'ref';
|
|
80
|
-
content?: string[];
|
|
81
|
-
}
|
|
82
|
-
interface IFlowExpressionValue {
|
|
83
|
-
type: 'expression';
|
|
84
|
-
content?: string;
|
|
85
|
-
}
|
|
86
|
-
interface IFlowTemplateValue {
|
|
87
|
-
type: 'template';
|
|
88
|
-
content?: string;
|
|
89
|
-
}
|
|
90
|
-
type IFlowValue = IFlowConstantValue | IFlowRefValue | IFlowExpressionValue | IFlowTemplateValue;
|
|
91
|
-
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
92
|
-
|
|
93
112
|
interface PropsType {
|
|
94
113
|
value?: IFlowConstantRefValue;
|
|
95
114
|
onChange: (value?: IFlowConstantRefValue) => void;
|
|
96
115
|
readonly?: boolean;
|
|
97
116
|
hasError?: boolean;
|
|
98
117
|
style?: React$1.CSSProperties;
|
|
99
|
-
schema?:
|
|
118
|
+
schema?: IJsonSchema;
|
|
100
119
|
constantProps?: {
|
|
101
120
|
strategies?: Strategy[];
|
|
102
121
|
[key: string]: any;
|
|
@@ -104,10 +123,53 @@ interface PropsType {
|
|
|
104
123
|
}
|
|
105
124
|
declare function DynamicValueInput({ value, onChange, readonly, style, schema, constantProps, }: PropsType): React$1.JSX.Element;
|
|
106
125
|
|
|
126
|
+
declare enum Op {
|
|
127
|
+
EQ = "eq",
|
|
128
|
+
NEQ = "neq",
|
|
129
|
+
GT = "gt",
|
|
130
|
+
GTE = "gte",
|
|
131
|
+
LT = "lt",
|
|
132
|
+
LTE = "lte",
|
|
133
|
+
IN = "in",
|
|
134
|
+
NIN = "nin",
|
|
135
|
+
CONTAINS = "contains",
|
|
136
|
+
NOT_CONTAINS = "not_contains",
|
|
137
|
+
IS_EMPTY = "is_empty",
|
|
138
|
+
IS_NOT_EMPTY = "is_not_empty",
|
|
139
|
+
IS_TRUE = "is_true",
|
|
140
|
+
IS_FALSE = "is_false"
|
|
141
|
+
}
|
|
142
|
+
interface ConditionRowValueType {
|
|
143
|
+
left?: IFlowRefValue;
|
|
144
|
+
operator?: Op;
|
|
145
|
+
right?: IFlowConstantRefValue;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface PropTypes {
|
|
149
|
+
value?: ConditionRowValueType;
|
|
150
|
+
onChange: (value?: ConditionRowValueType) => void;
|
|
151
|
+
style?: React$1.CSSProperties;
|
|
152
|
+
readonly?: boolean;
|
|
153
|
+
}
|
|
154
|
+
declare function ConditionRow({ style, value, onChange, readonly }: PropTypes): React$1.JSX.Element;
|
|
155
|
+
|
|
107
156
|
declare const provideBatchInputEffect: EffectOptions[];
|
|
108
157
|
|
|
109
158
|
declare const provideBatchOutputsEffect: EffectOptions[];
|
|
110
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Auto rename ref when form item's key is renamed
|
|
162
|
+
*
|
|
163
|
+
* Example:
|
|
164
|
+
*
|
|
165
|
+
* formMeta: {
|
|
166
|
+
* effects: {
|
|
167
|
+
* "inputsValues": autoRenameRefEffect,
|
|
168
|
+
* }
|
|
169
|
+
* }
|
|
170
|
+
*/
|
|
171
|
+
declare const autoRenameRefEffect: EffectOptions[];
|
|
172
|
+
|
|
111
173
|
interface LegacyFlowRefValueSchema {
|
|
112
174
|
type: 'ref';
|
|
113
175
|
content: string;
|
|
@@ -188,4 +250,33 @@ declare function formatNewRefToLegacyRef(value: NewFlowRefValueSchema): {
|
|
|
188
250
|
content: string;
|
|
189
251
|
};
|
|
190
252
|
|
|
191
|
-
|
|
253
|
+
declare namespace JsonSchemaUtils {
|
|
254
|
+
/**
|
|
255
|
+
* Converts a JSON schema to an Abstract Syntax Tree (AST) representation.
|
|
256
|
+
* This function recursively processes the JSON schema and creates corresponding AST nodes.
|
|
257
|
+
*
|
|
258
|
+
* For more information on JSON Schema, refer to the official documentation:
|
|
259
|
+
* https://json-schema.org/
|
|
260
|
+
*
|
|
261
|
+
* @param jsonSchema - The JSON schema to convert.
|
|
262
|
+
* @returns An AST node representing the JSON schema, or undefined if the schema type is not recognized.
|
|
263
|
+
*/
|
|
264
|
+
function schemaToAST(jsonSchema: IJsonSchema): ASTNodeJSON | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* Convert AST To JSON Schema
|
|
267
|
+
* @param typeAST
|
|
268
|
+
* @returns
|
|
269
|
+
*/
|
|
270
|
+
function astToSchema(typeAST: ASTNode, options?: {
|
|
271
|
+
drilldown?: boolean;
|
|
272
|
+
}): IJsonSchema | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Check if the AST type is match the JSON Schema
|
|
275
|
+
* @param typeAST
|
|
276
|
+
* @param schema
|
|
277
|
+
* @returns
|
|
278
|
+
*/
|
|
279
|
+
function isASTMatchSchema(typeAST: BaseType, schema: IJsonSchema | IJsonSchema[]): boolean;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export { ArrayIcons, BatchVariableSelector, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,63 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
-
import { VarJSONSchema, EffectOptions } from '@flowgram.ai/editor';
|
|
3
2
|
import { TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
|
|
3
|
+
import { EffectOptions, ASTNodeJSON, ASTNode, BaseType } from '@flowgram.ai/editor';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type JsonSchemaBasicType = 'boolean' | 'string' | 'integer' | 'number' | 'object' | 'array' | 'map';
|
|
6
|
+
interface IJsonSchema<T = string> {
|
|
7
|
+
type?: T;
|
|
8
|
+
default?: any;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
enum?: (string | number)[];
|
|
12
|
+
properties?: Record<string, IJsonSchema<T>>;
|
|
13
|
+
additionalProperties?: IJsonSchema<T>;
|
|
14
|
+
items?: IJsonSchema<T>;
|
|
15
|
+
required?: string[];
|
|
16
|
+
$ref?: string;
|
|
17
|
+
extra?: {
|
|
18
|
+
index?: number;
|
|
19
|
+
weak?: boolean;
|
|
20
|
+
formComponent?: string;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
type IBasicJsonSchema = IJsonSchema<JsonSchemaBasicType>;
|
|
25
|
+
|
|
26
|
+
interface PropTypes$2 {
|
|
6
27
|
value?: string[];
|
|
7
28
|
config?: {
|
|
8
29
|
placeholder?: string;
|
|
9
30
|
notFoundContent?: string;
|
|
10
31
|
};
|
|
11
32
|
onChange: (value?: string[]) => void;
|
|
12
|
-
includeSchema?:
|
|
13
|
-
excludeSchema?:
|
|
33
|
+
includeSchema?: IJsonSchema | IJsonSchema[];
|
|
34
|
+
excludeSchema?: IJsonSchema | IJsonSchema[];
|
|
14
35
|
readonly?: boolean;
|
|
15
36
|
hasError?: boolean;
|
|
16
37
|
style?: React$1.CSSProperties;
|
|
17
38
|
triggerRender?: (props: TriggerRenderProps) => React$1.ReactNode;
|
|
18
39
|
}
|
|
19
|
-
type VariableSelectorProps = PropTypes$
|
|
20
|
-
declare const VariableSelector: ({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: PropTypes$
|
|
40
|
+
type VariableSelectorProps = PropTypes$2;
|
|
41
|
+
declare const VariableSelector: ({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: PropTypes$2) => React$1.JSX.Element;
|
|
21
42
|
|
|
22
|
-
|
|
43
|
+
interface IFlowConstantValue {
|
|
44
|
+
type: 'constant';
|
|
45
|
+
content?: string | number | boolean;
|
|
46
|
+
}
|
|
47
|
+
interface IFlowRefValue {
|
|
48
|
+
type: 'ref';
|
|
49
|
+
content?: string[];
|
|
50
|
+
}
|
|
51
|
+
interface IFlowExpressionValue {
|
|
52
|
+
type: 'expression';
|
|
53
|
+
content?: string;
|
|
54
|
+
}
|
|
55
|
+
interface IFlowTemplateValue {
|
|
56
|
+
type: 'template';
|
|
57
|
+
content?: string;
|
|
58
|
+
}
|
|
59
|
+
type IFlowValue = IFlowConstantValue | IFlowRefValue | IFlowExpressionValue | IFlowTemplateValue;
|
|
60
|
+
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
23
61
|
|
|
24
62
|
declare const VariableTypeIcons: {
|
|
25
63
|
[key: string]: React$1.ReactNode;
|
|
@@ -27,17 +65,17 @@ declare const VariableTypeIcons: {
|
|
|
27
65
|
declare const ArrayIcons: {
|
|
28
66
|
[key: string]: React$1.ReactNode;
|
|
29
67
|
};
|
|
30
|
-
declare const getSchemaIcon: (value?: Partial<
|
|
68
|
+
declare const getSchemaIcon: (value?: Partial<IJsonSchema>) => React$1.ReactNode;
|
|
31
69
|
|
|
32
|
-
interface PropTypes {
|
|
33
|
-
value?: Partial<
|
|
34
|
-
onChange: (value?: Partial<
|
|
70
|
+
interface PropTypes$1 {
|
|
71
|
+
value?: Partial<IJsonSchema>;
|
|
72
|
+
onChange: (value?: Partial<IJsonSchema>) => void;
|
|
35
73
|
disabled?: boolean;
|
|
36
74
|
style?: React$1.CSSProperties;
|
|
37
75
|
}
|
|
38
|
-
declare const getTypeSelectValue: (value?: Partial<
|
|
39
|
-
declare const parseTypeSelectValue: (value?: string[]) => Partial<
|
|
40
|
-
declare function TypeSelector(props: PropTypes): React$1.JSX.Element;
|
|
76
|
+
declare const getTypeSelectValue: (value?: Partial<IJsonSchema>) => string[] | undefined;
|
|
77
|
+
declare const parseTypeSelectValue: (value?: string[]) => Partial<IJsonSchema> | undefined;
|
|
78
|
+
declare function TypeSelector(props: PropTypes$1): React$1.JSX.Element;
|
|
41
79
|
|
|
42
80
|
interface ConfigType {
|
|
43
81
|
placeholder?: string;
|
|
@@ -47,15 +85,15 @@ interface ConfigType {
|
|
|
47
85
|
}
|
|
48
86
|
|
|
49
87
|
declare function JsonSchemaEditor(props: {
|
|
50
|
-
value?:
|
|
51
|
-
onChange?: (value:
|
|
88
|
+
value?: IJsonSchema;
|
|
89
|
+
onChange?: (value: IJsonSchema) => void;
|
|
52
90
|
config?: ConfigType;
|
|
53
91
|
}): React$1.JSX.Element;
|
|
54
92
|
|
|
55
93
|
declare function BatchVariableSelector(props: VariableSelectorProps): React$1.JSX.Element;
|
|
56
94
|
|
|
57
95
|
interface Strategy<Value = any> {
|
|
58
|
-
hit: (schema:
|
|
96
|
+
hit: (schema: IJsonSchema) => boolean;
|
|
59
97
|
Renderer: React.FC<RendererProps<Value>>;
|
|
60
98
|
}
|
|
61
99
|
interface RendererProps<Value = any> {
|
|
@@ -64,39 +102,20 @@ interface RendererProps<Value = any> {
|
|
|
64
102
|
readonly?: boolean;
|
|
65
103
|
}
|
|
66
104
|
interface PropsType$1 extends RendererProps {
|
|
67
|
-
schema:
|
|
105
|
+
schema: IJsonSchema;
|
|
68
106
|
strategies?: Strategy[];
|
|
69
107
|
[key: string]: any;
|
|
70
108
|
}
|
|
71
109
|
|
|
72
110
|
declare function ConstantInput(props: PropsType$1): React$1.JSX.Element;
|
|
73
111
|
|
|
74
|
-
interface IFlowConstantValue {
|
|
75
|
-
type: 'constant';
|
|
76
|
-
content?: string | number | boolean;
|
|
77
|
-
}
|
|
78
|
-
interface IFlowRefValue {
|
|
79
|
-
type: 'ref';
|
|
80
|
-
content?: string[];
|
|
81
|
-
}
|
|
82
|
-
interface IFlowExpressionValue {
|
|
83
|
-
type: 'expression';
|
|
84
|
-
content?: string;
|
|
85
|
-
}
|
|
86
|
-
interface IFlowTemplateValue {
|
|
87
|
-
type: 'template';
|
|
88
|
-
content?: string;
|
|
89
|
-
}
|
|
90
|
-
type IFlowValue = IFlowConstantValue | IFlowRefValue | IFlowExpressionValue | IFlowTemplateValue;
|
|
91
|
-
type IFlowConstantRefValue = IFlowConstantValue | IFlowRefValue;
|
|
92
|
-
|
|
93
112
|
interface PropsType {
|
|
94
113
|
value?: IFlowConstantRefValue;
|
|
95
114
|
onChange: (value?: IFlowConstantRefValue) => void;
|
|
96
115
|
readonly?: boolean;
|
|
97
116
|
hasError?: boolean;
|
|
98
117
|
style?: React$1.CSSProperties;
|
|
99
|
-
schema?:
|
|
118
|
+
schema?: IJsonSchema;
|
|
100
119
|
constantProps?: {
|
|
101
120
|
strategies?: Strategy[];
|
|
102
121
|
[key: string]: any;
|
|
@@ -104,10 +123,53 @@ interface PropsType {
|
|
|
104
123
|
}
|
|
105
124
|
declare function DynamicValueInput({ value, onChange, readonly, style, schema, constantProps, }: PropsType): React$1.JSX.Element;
|
|
106
125
|
|
|
126
|
+
declare enum Op {
|
|
127
|
+
EQ = "eq",
|
|
128
|
+
NEQ = "neq",
|
|
129
|
+
GT = "gt",
|
|
130
|
+
GTE = "gte",
|
|
131
|
+
LT = "lt",
|
|
132
|
+
LTE = "lte",
|
|
133
|
+
IN = "in",
|
|
134
|
+
NIN = "nin",
|
|
135
|
+
CONTAINS = "contains",
|
|
136
|
+
NOT_CONTAINS = "not_contains",
|
|
137
|
+
IS_EMPTY = "is_empty",
|
|
138
|
+
IS_NOT_EMPTY = "is_not_empty",
|
|
139
|
+
IS_TRUE = "is_true",
|
|
140
|
+
IS_FALSE = "is_false"
|
|
141
|
+
}
|
|
142
|
+
interface ConditionRowValueType {
|
|
143
|
+
left?: IFlowRefValue;
|
|
144
|
+
operator?: Op;
|
|
145
|
+
right?: IFlowConstantRefValue;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface PropTypes {
|
|
149
|
+
value?: ConditionRowValueType;
|
|
150
|
+
onChange: (value?: ConditionRowValueType) => void;
|
|
151
|
+
style?: React$1.CSSProperties;
|
|
152
|
+
readonly?: boolean;
|
|
153
|
+
}
|
|
154
|
+
declare function ConditionRow({ style, value, onChange, readonly }: PropTypes): React$1.JSX.Element;
|
|
155
|
+
|
|
107
156
|
declare const provideBatchInputEffect: EffectOptions[];
|
|
108
157
|
|
|
109
158
|
declare const provideBatchOutputsEffect: EffectOptions[];
|
|
110
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Auto rename ref when form item's key is renamed
|
|
162
|
+
*
|
|
163
|
+
* Example:
|
|
164
|
+
*
|
|
165
|
+
* formMeta: {
|
|
166
|
+
* effects: {
|
|
167
|
+
* "inputsValues": autoRenameRefEffect,
|
|
168
|
+
* }
|
|
169
|
+
* }
|
|
170
|
+
*/
|
|
171
|
+
declare const autoRenameRefEffect: EffectOptions[];
|
|
172
|
+
|
|
111
173
|
interface LegacyFlowRefValueSchema {
|
|
112
174
|
type: 'ref';
|
|
113
175
|
content: string;
|
|
@@ -188,4 +250,33 @@ declare function formatNewRefToLegacyRef(value: NewFlowRefValueSchema): {
|
|
|
188
250
|
content: string;
|
|
189
251
|
};
|
|
190
252
|
|
|
191
|
-
|
|
253
|
+
declare namespace JsonSchemaUtils {
|
|
254
|
+
/**
|
|
255
|
+
* Converts a JSON schema to an Abstract Syntax Tree (AST) representation.
|
|
256
|
+
* This function recursively processes the JSON schema and creates corresponding AST nodes.
|
|
257
|
+
*
|
|
258
|
+
* For more information on JSON Schema, refer to the official documentation:
|
|
259
|
+
* https://json-schema.org/
|
|
260
|
+
*
|
|
261
|
+
* @param jsonSchema - The JSON schema to convert.
|
|
262
|
+
* @returns An AST node representing the JSON schema, or undefined if the schema type is not recognized.
|
|
263
|
+
*/
|
|
264
|
+
function schemaToAST(jsonSchema: IJsonSchema): ASTNodeJSON | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* Convert AST To JSON Schema
|
|
267
|
+
* @param typeAST
|
|
268
|
+
* @returns
|
|
269
|
+
*/
|
|
270
|
+
function astToSchema(typeAST: ASTNode, options?: {
|
|
271
|
+
drilldown?: boolean;
|
|
272
|
+
}): IJsonSchema | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Check if the AST type is match the JSON Schema
|
|
275
|
+
* @param typeAST
|
|
276
|
+
* @param schema
|
|
277
|
+
* @returns
|
|
278
|
+
*/
|
|
279
|
+
function isASTMatchSchema(typeAST: BaseType, schema: IJsonSchema | IJsonSchema[]): boolean;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export { ArrayIcons, BatchVariableSelector, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect };
|