@flowgram.ai/form-materials 0.3.3 → 0.3.5
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 +5 -19
- package/bin/materials.ts +31 -89
- 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 +431 -505
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +77 -23
- package/dist/index.d.ts +77 -23
- package/dist/index.js +657 -731
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/assign-row/index.tsx +4 -4
- package/src/components/assign-rows/index.tsx +1 -1
- package/src/components/batch-outputs/index.tsx +4 -3
- package/src/components/batch-outputs/types.ts +1 -1
- package/src/components/batch-variable-selector/index.tsx +1 -1
- package/src/components/code-editor-mini/index.tsx +1 -1
- package/src/components/condition-row/constants.ts +2 -2
- package/src/components/condition-row/hooks/useOp.tsx +13 -9
- package/src/components/condition-row/hooks/useRule.ts +8 -4
- package/src/components/condition-row/index.tsx +27 -10
- package/src/components/condition-row/types.ts +5 -7
- package/src/components/constant-input/index.tsx +5 -2
- package/src/components/constant-input/types.ts +1 -1
- package/src/components/display-flow-value/index.tsx +2 -2
- package/src/components/display-inputs-values/index.tsx +3 -2
- package/src/components/display-outputs/index.tsx +2 -1
- package/src/components/display-schema-tag/index.tsx +3 -2
- package/src/components/display-schema-tree/index.tsx +2 -1
- package/src/components/dynamic-value-input/hooks.ts +1 -1
- package/src/components/dynamic-value-input/index.tsx +13 -9
- package/src/components/inputs-values/index.tsx +7 -5
- package/src/components/inputs-values/types.ts +3 -3
- 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 +11 -105
- package/src/components/json-schema-editor/hooks.tsx +53 -94
- package/src/components/json-schema-editor/index.tsx +18 -12
- package/src/components/json-schema-editor/styles.tsx +0 -29
- 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 +1 -1
- 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 +9 -7
- package/src/components/variable-selector/index.tsx +9 -5
- package/src/components/variable-selector/use-variable-tree.tsx +1 -1
- package/src/effects/auto-rename-ref/index.ts +1 -1
- package/src/effects/listen-ref-schema-change/index.ts +1 -1
- package/src/effects/listen-ref-value-change/index.ts +1 -1
- package/src/effects/provide-batch-input/index.ts +1 -1
- package/src/form-plugins/batch-outputs-plugin/index.ts +1 -1
- package/src/form-plugins/infer-assign-plugin/index.ts +1 -1
- package/src/form-plugins/infer-inputs-plugin/index.ts +1 -1
- package/src/plugins/json-schema-preset/type-definition/array.tsx +3 -1
- package/src/plugins/json-schema-preset/type-definition/boolean.tsx +4 -3
- package/src/plugins/json-schema-preset/type-definition/integer.tsx +2 -1
- package/src/plugins/json-schema-preset/type-definition/number.tsx +2 -1
- package/src/plugins/json-schema-preset/type-definition/object.tsx +3 -1
- package/src/plugins/json-schema-preset/type-definition/string.tsx +7 -1
- package/src/shared/index.ts +1 -0
- 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/components/assign-row/config.json +0 -11
- package/src/components/assign-rows/config.json +0 -11
- package/src/components/batch-outputs/config.json +0 -13
- package/src/components/batch-variable-selector/config.json +0 -9
- package/src/components/code-editor/config.json +0 -10
- package/src/components/code-editor-mini/config.json +0 -7
- package/src/components/condition-row/config.json +0 -13
- package/src/components/constant-input/config.json +0 -9
- package/src/components/display-flow-value/config.json +0 -8
- package/src/components/display-inputs-values/config.json +0 -9
- package/src/components/display-outputs/config.json +0 -10
- package/src/components/display-schema-tag/config.json +0 -10
- package/src/components/display-schema-tree/config.json +0 -11
- package/src/components/dynamic-value-input/config.json +0 -14
- package/src/components/inputs-values/config.json +0 -13
- 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 -9
- package/src/components/variable-selector/config.json +0 -9
- package/src/effects/auto-rename-ref/config.json +0 -5
- package/src/effects/listen-ref-schema-change/config.json +0 -10
- package/src/effects/listen-ref-value-change/config.json +0 -9
- package/src/effects/provide-batch-input/config.json +0 -5
- package/src/effects/provide-json-schema-outputs/config.json +0 -7
- package/src/effects/sync-variable-title/config.json +0 -5
- package/src/effects/validate-when-variable-sync/config.json +0 -5
- package/src/form-plugins/batch-outputs-plugin/config.json +0 -7
- package/src/form-plugins/infer-assign-plugin/config.json +0 -7
- package/src/form-plugins/infer-inputs-plugin/config.json +0 -9
- package/src/hooks/use-object-list/config.json +0 -8
- package/src/shared/format-legacy-refs/config.json +0 -5
- package/src/typings/flow-value/config.json +0 -7
- package/src/validate/validate-flow-value/config.json +0 -7
package/dist/index.d.mts
CHANGED
|
@@ -30,7 +30,7 @@ declare function useVariableTree(params: {
|
|
|
30
30
|
* SPDX-License-Identifier: MIT
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
interface
|
|
33
|
+
interface VariableSelectorProps {
|
|
34
34
|
value?: string[];
|
|
35
35
|
config?: {
|
|
36
36
|
placeholder?: string;
|
|
@@ -44,16 +44,19 @@ interface PropTypes$2 {
|
|
|
44
44
|
style?: React$1.CSSProperties;
|
|
45
45
|
triggerRender?: (props: TriggerRenderProps) => React$1.ReactNode;
|
|
46
46
|
}
|
|
47
|
-
type VariableSelectorProps = PropTypes$2;
|
|
48
47
|
|
|
49
|
-
declare const VariableSelector:
|
|
48
|
+
declare const VariableSelector: {
|
|
49
|
+
({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: VariableSelectorProps): React$1.JSX.Element;
|
|
50
|
+
renderKey: string;
|
|
51
|
+
};
|
|
52
|
+
declare const InjectVariableSelector: React$1.FC<VariableSelectorProps>;
|
|
50
53
|
|
|
51
54
|
/**
|
|
52
55
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
53
56
|
* SPDX-License-Identifier: MIT
|
|
54
57
|
*/
|
|
55
58
|
|
|
56
|
-
interface
|
|
59
|
+
interface TypeSelectorProps {
|
|
57
60
|
value?: Partial<IJsonSchema>;
|
|
58
61
|
onChange?: (value?: Partial<IJsonSchema>) => void;
|
|
59
62
|
readonly?: boolean;
|
|
@@ -65,7 +68,11 @@ interface PropTypes$1 {
|
|
|
65
68
|
}
|
|
66
69
|
declare const getTypeSelectValue: (value?: Partial<IJsonSchema>) => string[] | undefined;
|
|
67
70
|
declare const parseTypeSelectValue: (value?: string[]) => Partial<IJsonSchema> | undefined;
|
|
68
|
-
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>;
|
|
69
76
|
|
|
70
77
|
/**
|
|
71
78
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -214,31 +221,27 @@ interface PropsType$9 {
|
|
|
214
221
|
};
|
|
215
222
|
}
|
|
216
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>;
|
|
217
228
|
|
|
218
229
|
/**
|
|
219
230
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
220
231
|
* SPDX-License-Identifier: MIT
|
|
221
232
|
*/
|
|
222
233
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
GTE = "gte",
|
|
228
|
-
LT = "lt",
|
|
229
|
-
LTE = "lte",
|
|
230
|
-
IN = "in",
|
|
231
|
-
NIN = "nin",
|
|
232
|
-
CONTAINS = "contains",
|
|
233
|
-
NOT_CONTAINS = "not_contains",
|
|
234
|
-
IS_EMPTY = "is_empty",
|
|
235
|
-
IS_NOT_EMPTY = "is_not_empty",
|
|
236
|
-
IS_TRUE = "is_true",
|
|
237
|
-
IS_FALSE = "is_false"
|
|
234
|
+
interface OpConfig {
|
|
235
|
+
label: string;
|
|
236
|
+
abbreviation: string;
|
|
237
|
+
rightDisplay?: string;
|
|
238
238
|
}
|
|
239
|
+
type OpConfigs = Record<string, OpConfig>;
|
|
240
|
+
type IRule = Partial<Record<string, string | null>>;
|
|
241
|
+
type IRules = Record<string, IRule>;
|
|
239
242
|
interface ConditionRowValueType {
|
|
240
243
|
left?: IFlowRefValue;
|
|
241
|
-
operator?:
|
|
244
|
+
operator?: string;
|
|
242
245
|
right?: IFlowConstantRefValue;
|
|
243
246
|
}
|
|
244
247
|
|
|
@@ -252,8 +255,12 @@ interface PropTypes {
|
|
|
252
255
|
onChange: (value?: ConditionRowValueType) => void;
|
|
253
256
|
style?: React$1.CSSProperties;
|
|
254
257
|
readonly?: boolean;
|
|
258
|
+
ruleConfig?: {
|
|
259
|
+
ops?: OpConfigs;
|
|
260
|
+
rules?: IRules;
|
|
261
|
+
};
|
|
255
262
|
}
|
|
256
|
-
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;
|
|
257
264
|
|
|
258
265
|
/**
|
|
259
266
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -654,6 +661,53 @@ declare function formatNewRefToLegacyRef(value: NewFlowRefValueSchema): {
|
|
|
654
661
|
content: string;
|
|
655
662
|
};
|
|
656
663
|
|
|
664
|
+
/**
|
|
665
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
666
|
+
* SPDX-License-Identifier: MIT
|
|
667
|
+
*/
|
|
668
|
+
|
|
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>;
|
|
710
|
+
|
|
657
711
|
/**
|
|
658
712
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
659
713
|
* SPDX-License-Identifier: MIT
|
|
@@ -706,4 +760,4 @@ declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context):
|
|
|
706
760
|
message: string;
|
|
707
761
|
} | undefined;
|
|
708
762
|
|
|
709
|
-
export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InputsValues, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, type JsonSchemaTypeRegistry, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ declare function useVariableTree(params: {
|
|
|
30
30
|
* SPDX-License-Identifier: MIT
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
interface
|
|
33
|
+
interface VariableSelectorProps {
|
|
34
34
|
value?: string[];
|
|
35
35
|
config?: {
|
|
36
36
|
placeholder?: string;
|
|
@@ -44,16 +44,19 @@ interface PropTypes$2 {
|
|
|
44
44
|
style?: React$1.CSSProperties;
|
|
45
45
|
triggerRender?: (props: TriggerRenderProps) => React$1.ReactNode;
|
|
46
46
|
}
|
|
47
|
-
type VariableSelectorProps = PropTypes$2;
|
|
48
47
|
|
|
49
|
-
declare const VariableSelector:
|
|
48
|
+
declare const VariableSelector: {
|
|
49
|
+
({ value, config, onChange, style, readonly, includeSchema, excludeSchema, hasError, triggerRender, }: VariableSelectorProps): React$1.JSX.Element;
|
|
50
|
+
renderKey: string;
|
|
51
|
+
};
|
|
52
|
+
declare const InjectVariableSelector: React$1.FC<VariableSelectorProps>;
|
|
50
53
|
|
|
51
54
|
/**
|
|
52
55
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
53
56
|
* SPDX-License-Identifier: MIT
|
|
54
57
|
*/
|
|
55
58
|
|
|
56
|
-
interface
|
|
59
|
+
interface TypeSelectorProps {
|
|
57
60
|
value?: Partial<IJsonSchema>;
|
|
58
61
|
onChange?: (value?: Partial<IJsonSchema>) => void;
|
|
59
62
|
readonly?: boolean;
|
|
@@ -65,7 +68,11 @@ interface PropTypes$1 {
|
|
|
65
68
|
}
|
|
66
69
|
declare const getTypeSelectValue: (value?: Partial<IJsonSchema>) => string[] | undefined;
|
|
67
70
|
declare const parseTypeSelectValue: (value?: string[]) => Partial<IJsonSchema> | undefined;
|
|
68
|
-
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>;
|
|
69
76
|
|
|
70
77
|
/**
|
|
71
78
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -214,31 +221,27 @@ interface PropsType$9 {
|
|
|
214
221
|
};
|
|
215
222
|
}
|
|
216
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>;
|
|
217
228
|
|
|
218
229
|
/**
|
|
219
230
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
220
231
|
* SPDX-License-Identifier: MIT
|
|
221
232
|
*/
|
|
222
233
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
GTE = "gte",
|
|
228
|
-
LT = "lt",
|
|
229
|
-
LTE = "lte",
|
|
230
|
-
IN = "in",
|
|
231
|
-
NIN = "nin",
|
|
232
|
-
CONTAINS = "contains",
|
|
233
|
-
NOT_CONTAINS = "not_contains",
|
|
234
|
-
IS_EMPTY = "is_empty",
|
|
235
|
-
IS_NOT_EMPTY = "is_not_empty",
|
|
236
|
-
IS_TRUE = "is_true",
|
|
237
|
-
IS_FALSE = "is_false"
|
|
234
|
+
interface OpConfig {
|
|
235
|
+
label: string;
|
|
236
|
+
abbreviation: string;
|
|
237
|
+
rightDisplay?: string;
|
|
238
238
|
}
|
|
239
|
+
type OpConfigs = Record<string, OpConfig>;
|
|
240
|
+
type IRule = Partial<Record<string, string | null>>;
|
|
241
|
+
type IRules = Record<string, IRule>;
|
|
239
242
|
interface ConditionRowValueType {
|
|
240
243
|
left?: IFlowRefValue;
|
|
241
|
-
operator?:
|
|
244
|
+
operator?: string;
|
|
242
245
|
right?: IFlowConstantRefValue;
|
|
243
246
|
}
|
|
244
247
|
|
|
@@ -252,8 +255,12 @@ interface PropTypes {
|
|
|
252
255
|
onChange: (value?: ConditionRowValueType) => void;
|
|
253
256
|
style?: React$1.CSSProperties;
|
|
254
257
|
readonly?: boolean;
|
|
258
|
+
ruleConfig?: {
|
|
259
|
+
ops?: OpConfigs;
|
|
260
|
+
rules?: IRules;
|
|
261
|
+
};
|
|
255
262
|
}
|
|
256
|
-
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;
|
|
257
264
|
|
|
258
265
|
/**
|
|
259
266
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
@@ -654,6 +661,53 @@ declare function formatNewRefToLegacyRef(value: NewFlowRefValueSchema): {
|
|
|
654
661
|
content: string;
|
|
655
662
|
};
|
|
656
663
|
|
|
664
|
+
/**
|
|
665
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
666
|
+
* SPDX-License-Identifier: MIT
|
|
667
|
+
*/
|
|
668
|
+
|
|
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>;
|
|
710
|
+
|
|
657
711
|
/**
|
|
658
712
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
659
713
|
* SPDX-License-Identifier: MIT
|
|
@@ -706,4 +760,4 @@ declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context):
|
|
|
706
760
|
message: string;
|
|
707
761
|
} | undefined;
|
|
708
762
|
|
|
709
|
-
export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InputsValues, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, type JsonSchemaTypeRegistry, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };
|
|
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 };
|