@flowgram.ai/form-materials 0.2.1 → 0.2.3
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 +420 -96
- package/dist/esm/index.js.map +1 -1
- package/dist/{index.d.mts → index.d.cts} +52 -7
- package/dist/index.d.ts +52 -7
- package/dist/index.js +432 -109
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- 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/dynamic-value-input/index.tsx +11 -3
- 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/index.tsx +4 -3
- package/src/components/variable-selector/index.tsx +1 -1
- 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/utils/json-schema/index.ts +13 -6
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ interface IJsonSchema<T = string> {
|
|
|
23
23
|
}
|
|
24
24
|
type IBasicJsonSchema = IJsonSchema<JsonSchemaBasicType>;
|
|
25
25
|
|
|
26
|
-
interface PropTypes$
|
|
26
|
+
interface PropTypes$2 {
|
|
27
27
|
value?: string[];
|
|
28
28
|
config?: {
|
|
29
29
|
placeholder?: string;
|
|
@@ -37,8 +37,8 @@ interface PropTypes$1 {
|
|
|
37
37
|
style?: React$1.CSSProperties;
|
|
38
38
|
triggerRender?: (props: TriggerRenderProps) => React$1.ReactNode;
|
|
39
39
|
}
|
|
40
|
-
type VariableSelectorProps = PropTypes$
|
|
41
|
-
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;
|
|
42
42
|
|
|
43
43
|
interface IFlowConstantValue {
|
|
44
44
|
type: 'constant';
|
|
@@ -67,7 +67,7 @@ declare const ArrayIcons: {
|
|
|
67
67
|
};
|
|
68
68
|
declare const getSchemaIcon: (value?: Partial<IJsonSchema>) => React$1.ReactNode;
|
|
69
69
|
|
|
70
|
-
interface PropTypes {
|
|
70
|
+
interface PropTypes$1 {
|
|
71
71
|
value?: Partial<IJsonSchema>;
|
|
72
72
|
onChange: (value?: Partial<IJsonSchema>) => void;
|
|
73
73
|
disabled?: boolean;
|
|
@@ -75,7 +75,7 @@ interface PropTypes {
|
|
|
75
75
|
}
|
|
76
76
|
declare const getTypeSelectValue: (value?: Partial<IJsonSchema>) => string[] | undefined;
|
|
77
77
|
declare const parseTypeSelectValue: (value?: string[]) => Partial<IJsonSchema> | undefined;
|
|
78
|
-
declare function TypeSelector(props: PropTypes): React$1.JSX.Element;
|
|
78
|
+
declare function TypeSelector(props: PropTypes$1): React$1.JSX.Element;
|
|
79
79
|
|
|
80
80
|
interface ConfigType {
|
|
81
81
|
placeholder?: string;
|
|
@@ -123,10 +123,53 @@ interface PropsType {
|
|
|
123
123
|
}
|
|
124
124
|
declare function DynamicValueInput({ value, onChange, readonly, style, schema, constantProps, }: PropsType): React$1.JSX.Element;
|
|
125
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
|
+
|
|
126
156
|
declare const provideBatchInputEffect: EffectOptions[];
|
|
127
157
|
|
|
128
158
|
declare const provideBatchOutputsEffect: EffectOptions[];
|
|
129
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
|
+
|
|
130
173
|
interface LegacyFlowRefValueSchema {
|
|
131
174
|
type: 'ref';
|
|
132
175
|
content: string;
|
|
@@ -224,7 +267,9 @@ declare namespace JsonSchemaUtils {
|
|
|
224
267
|
* @param typeAST
|
|
225
268
|
* @returns
|
|
226
269
|
*/
|
|
227
|
-
function astToSchema(typeAST: ASTNode
|
|
270
|
+
function astToSchema(typeAST: ASTNode, options?: {
|
|
271
|
+
drilldown?: boolean;
|
|
272
|
+
}): IJsonSchema | undefined;
|
|
228
273
|
/**
|
|
229
274
|
* Check if the AST type is match the JSON Schema
|
|
230
275
|
* @param typeAST
|
|
@@ -234,4 +279,4 @@ declare namespace JsonSchemaUtils {
|
|
|
234
279
|
function isASTMatchSchema(typeAST: BaseType, schema: IJsonSchema | IJsonSchema[]): boolean;
|
|
235
280
|
}
|
|
236
281
|
|
|
237
|
-
export { ArrayIcons, BatchVariableSelector, 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, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect };
|
|
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 };
|