@flowgram.ai/form-materials 0.4.2 → 0.4.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 +105 -41
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +25 -3
- package/dist/index.d.ts +25 -3
- package/dist/index.js +95 -33
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/dynamic-value-input/index.tsx +20 -11
- package/src/components/inputs-values/index.tsx +12 -1
- package/src/components/inputs-values-tree/hooks/use-child-list.tsx +1 -1
- package/src/components/inputs-values-tree/index.tsx +7 -1
- package/src/components/inputs-values-tree/row.tsx +5 -1
- package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +1 -1
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +11 -0
- package/src/components/prompt-editor-with-inputs/index.tsx +1 -2
- package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +34 -17
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +1 -1
- package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +13 -1
- package/src/components/type-selector/index.tsx +12 -2
- package/src/index.ts +1 -0
- package/src/shared/flow-value/utils.ts +1 -1
- package/src/typings/flow-value/index.ts +1 -1
- package/src/validate/validate-flow-value/index.tsx +4 -16
package/dist/index.d.mts
CHANGED
|
@@ -183,7 +183,7 @@ interface IFlowValueExtra {
|
|
|
183
183
|
type FlowValueType = 'constant' | 'ref' | 'expression' | 'template';
|
|
184
184
|
interface IFlowConstantValue {
|
|
185
185
|
type: 'constant';
|
|
186
|
-
content?:
|
|
186
|
+
content?: any;
|
|
187
187
|
schema?: IJsonSchema;
|
|
188
188
|
extra?: IFlowValueExtra;
|
|
189
189
|
}
|
|
@@ -327,7 +327,7 @@ declare function PromptEditorWithVariables(props: PromptEditorPropsType): React$
|
|
|
327
327
|
*/
|
|
328
328
|
|
|
329
329
|
interface PropsType$7 extends PromptEditorPropsType {
|
|
330
|
-
inputsValues:
|
|
330
|
+
inputsValues: any;
|
|
331
331
|
}
|
|
332
332
|
declare function PromptEditorWithInputs({ inputsValues, ...restProps }: PropsType$7): React$1.JSX.Element;
|
|
333
333
|
|
|
@@ -866,4 +866,26 @@ declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context):
|
|
|
866
866
|
message: string;
|
|
867
867
|
} | undefined;
|
|
868
868
|
|
|
869
|
-
|
|
869
|
+
/**
|
|
870
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
871
|
+
* SPDX-License-Identifier: MIT
|
|
872
|
+
*/
|
|
873
|
+
interface ListItem<ValueType> {
|
|
874
|
+
id: string;
|
|
875
|
+
key?: string;
|
|
876
|
+
value?: ValueType;
|
|
877
|
+
}
|
|
878
|
+
type ObjectType<ValueType> = Record<string, ValueType | undefined>;
|
|
879
|
+
declare function useObjectList<ValueType>({ value, onChange, sortIndexKey, }: {
|
|
880
|
+
value?: ObjectType<ValueType>;
|
|
881
|
+
onChange: (value?: ObjectType<ValueType>) => void;
|
|
882
|
+
sortIndexKey?: string | ((item: ValueType | undefined) => string);
|
|
883
|
+
}): {
|
|
884
|
+
list: ListItem<ValueType>[];
|
|
885
|
+
add: (defaultValue?: ValueType) => void;
|
|
886
|
+
updateKey: (itemId: string, key: string) => void;
|
|
887
|
+
updateValue: (itemId: string, value: ValueType) => void;
|
|
888
|
+
remove: (itemId: string) => void;
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type Strategy as ConstantInputStrategy, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type FlowValueType, FlowValueUtils, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, 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, useObjectList, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };
|
package/dist/index.d.ts
CHANGED
|
@@ -183,7 +183,7 @@ interface IFlowValueExtra {
|
|
|
183
183
|
type FlowValueType = 'constant' | 'ref' | 'expression' | 'template';
|
|
184
184
|
interface IFlowConstantValue {
|
|
185
185
|
type: 'constant';
|
|
186
|
-
content?:
|
|
186
|
+
content?: any;
|
|
187
187
|
schema?: IJsonSchema;
|
|
188
188
|
extra?: IFlowValueExtra;
|
|
189
189
|
}
|
|
@@ -327,7 +327,7 @@ declare function PromptEditorWithVariables(props: PromptEditorPropsType): React$
|
|
|
327
327
|
*/
|
|
328
328
|
|
|
329
329
|
interface PropsType$7 extends PromptEditorPropsType {
|
|
330
|
-
inputsValues:
|
|
330
|
+
inputsValues: any;
|
|
331
331
|
}
|
|
332
332
|
declare function PromptEditorWithInputs({ inputsValues, ...restProps }: PropsType$7): React$1.JSX.Element;
|
|
333
333
|
|
|
@@ -866,4 +866,26 @@ declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context):
|
|
|
866
866
|
message: string;
|
|
867
867
|
} | undefined;
|
|
868
868
|
|
|
869
|
-
|
|
869
|
+
/**
|
|
870
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
871
|
+
* SPDX-License-Identifier: MIT
|
|
872
|
+
*/
|
|
873
|
+
interface ListItem<ValueType> {
|
|
874
|
+
id: string;
|
|
875
|
+
key?: string;
|
|
876
|
+
value?: ValueType;
|
|
877
|
+
}
|
|
878
|
+
type ObjectType<ValueType> = Record<string, ValueType | undefined>;
|
|
879
|
+
declare function useObjectList<ValueType>({ value, onChange, sortIndexKey, }: {
|
|
880
|
+
value?: ObjectType<ValueType>;
|
|
881
|
+
onChange: (value?: ObjectType<ValueType>) => void;
|
|
882
|
+
sortIndexKey?: string | ((item: ValueType | undefined) => string);
|
|
883
|
+
}): {
|
|
884
|
+
list: ListItem<ValueType>[];
|
|
885
|
+
add: (defaultValue?: ValueType) => void;
|
|
886
|
+
updateKey: (itemId: string, key: string) => void;
|
|
887
|
+
updateValue: (itemId: string, value: ValueType) => void;
|
|
888
|
+
remove: (itemId: string) => void;
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type Strategy as ConstantInputStrategy, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type FlowValueType, FlowValueUtils, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, 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, useObjectList, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };
|
package/dist/index.js
CHANGED
|
@@ -82,6 +82,7 @@ __export(src_exports, {
|
|
|
82
82
|
provideBatchOutputsEffect: () => provideBatchOutputsEffect,
|
|
83
83
|
provideJsonSchemaOutputs: () => provideJsonSchemaOutputs,
|
|
84
84
|
syncVariableTitle: () => syncVariableTitle,
|
|
85
|
+
useObjectList: () => useObjectList,
|
|
85
86
|
useTypeManager: () => useTypeManager,
|
|
86
87
|
useVariableTree: () => useVariableTree,
|
|
87
88
|
validateFlowValue: () => validateFlowValue,
|
|
@@ -274,13 +275,13 @@ var FlowValueUtils;
|
|
|
274
275
|
return;
|
|
275
276
|
}
|
|
276
277
|
FlowValueUtils2.traverse = traverse;
|
|
277
|
-
function
|
|
278
|
-
const keyPathReg =
|
|
278
|
+
function getTemplateKeyPaths(value) {
|
|
279
|
+
const keyPathReg = /\{\{([^\}\{]+)\}\}/g;
|
|
279
280
|
return (0, import_lodash2.uniq)(value.content?.match(keyPathReg) || []).map(
|
|
280
281
|
(_keyPath) => _keyPath.slice(2, -2).split(".")
|
|
281
282
|
);
|
|
282
283
|
}
|
|
283
|
-
FlowValueUtils2.getTemplateKeyPaths =
|
|
284
|
+
FlowValueUtils2.getTemplateKeyPaths = getTemplateKeyPaths;
|
|
284
285
|
function inferConstantJsonSchema(value) {
|
|
285
286
|
if (value?.schema) {
|
|
286
287
|
return value.schema;
|
|
@@ -1128,12 +1129,24 @@ function TypeSelector(props) {
|
|
|
1128
1129
|
}),
|
|
1129
1130
|
[]
|
|
1130
1131
|
);
|
|
1132
|
+
const isDisabled = readonly || disabled;
|
|
1131
1133
|
return /* @__PURE__ */ import_react14.default.createElement(
|
|
1132
1134
|
import_semi_ui8.Cascader,
|
|
1133
1135
|
{
|
|
1134
|
-
disabled:
|
|
1136
|
+
disabled: isDisabled,
|
|
1135
1137
|
size: "small",
|
|
1136
|
-
triggerRender: () => /* @__PURE__ */ import_react14.default.createElement(
|
|
1138
|
+
triggerRender: () => /* @__PURE__ */ import_react14.default.createElement(
|
|
1139
|
+
import_semi_ui8.IconButton,
|
|
1140
|
+
{
|
|
1141
|
+
size: "small",
|
|
1142
|
+
style: {
|
|
1143
|
+
...isDisabled ? { pointerEvents: "none" } : {},
|
|
1144
|
+
...style || {}
|
|
1145
|
+
},
|
|
1146
|
+
disabled: isDisabled,
|
|
1147
|
+
icon
|
|
1148
|
+
}
|
|
1149
|
+
),
|
|
1137
1150
|
treeData: options,
|
|
1138
1151
|
value: selectValue,
|
|
1139
1152
|
leafOnly: true,
|
|
@@ -1720,6 +1733,11 @@ function useIncludeSchema(schemaFromProps) {
|
|
|
1720
1733
|
}
|
|
1721
1734
|
|
|
1722
1735
|
// src/components/dynamic-value-input/index.tsx
|
|
1736
|
+
var DEFAULT_VALUE = {
|
|
1737
|
+
type: "constant",
|
|
1738
|
+
content: "",
|
|
1739
|
+
schema: { type: "string" }
|
|
1740
|
+
};
|
|
1723
1741
|
function DynamicValueInput({
|
|
1724
1742
|
value,
|
|
1725
1743
|
onChange,
|
|
@@ -1731,6 +1749,7 @@ function DynamicValueInput({
|
|
|
1731
1749
|
const refVariable = useRefVariable(value);
|
|
1732
1750
|
const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
|
|
1733
1751
|
const includeSchema = useIncludeSchema(schemaFromProps);
|
|
1752
|
+
const typeManager = (0, import_json_schema7.useTypeManager)();
|
|
1734
1753
|
const renderTypeSelector = () => {
|
|
1735
1754
|
if (schemaFromProps) {
|
|
1736
1755
|
return /* @__PURE__ */ import_react23.default.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
|
|
@@ -1745,20 +1764,18 @@ function DynamicValueInput({
|
|
|
1745
1764
|
value: selectSchema,
|
|
1746
1765
|
onChange: (_v) => {
|
|
1747
1766
|
setSelectSchema(_v || { type: "string" });
|
|
1748
|
-
|
|
1767
|
+
const schema = _v || { type: "string" };
|
|
1768
|
+
let content = typeManager.getDefaultValue(schema);
|
|
1749
1769
|
if (_v?.type === "object") {
|
|
1750
1770
|
content = "{}";
|
|
1751
1771
|
}
|
|
1752
1772
|
if (_v?.type === "array") {
|
|
1753
1773
|
content = "[]";
|
|
1754
1774
|
}
|
|
1755
|
-
if (_v?.type === "boolean") {
|
|
1756
|
-
content = false;
|
|
1757
|
-
}
|
|
1758
1775
|
onChange({
|
|
1759
1776
|
type: "constant",
|
|
1760
1777
|
content,
|
|
1761
|
-
schema
|
|
1778
|
+
schema
|
|
1762
1779
|
});
|
|
1763
1780
|
},
|
|
1764
1781
|
readonly
|
|
@@ -1772,7 +1789,7 @@ function DynamicValueInput({
|
|
|
1772
1789
|
{
|
|
1773
1790
|
style: { width: "100%" },
|
|
1774
1791
|
value: value?.content,
|
|
1775
|
-
onChange: (_v) => onChange(_v ? { type: "ref", content: _v } :
|
|
1792
|
+
onChange: (_v) => onChange(_v ? { type: "ref", content: _v } : DEFAULT_VALUE),
|
|
1776
1793
|
includeSchema,
|
|
1777
1794
|
readonly
|
|
1778
1795
|
}
|
|
@@ -1790,7 +1807,7 @@ function DynamicValueInput({
|
|
|
1790
1807
|
InjectVariableSelector,
|
|
1791
1808
|
{
|
|
1792
1809
|
style: { width: "100%" },
|
|
1793
|
-
onChange: (_v) => onChange(_v ? { type: "ref", content: _v } :
|
|
1810
|
+
onChange: (_v) => onChange(_v ? { type: "ref", content: _v } : DEFAULT_VALUE),
|
|
1794
1811
|
includeSchema,
|
|
1795
1812
|
readonly
|
|
1796
1813
|
}
|
|
@@ -2431,8 +2448,16 @@ function VariableTree() {
|
|
|
2431
2448
|
if (!range) {
|
|
2432
2449
|
return;
|
|
2433
2450
|
}
|
|
2451
|
+
let { from, to } = range;
|
|
2452
|
+
while (editor.$view.state.doc.sliceString(from - 1, from) === "{") {
|
|
2453
|
+
from--;
|
|
2454
|
+
}
|
|
2455
|
+
while (editor.$view.state.doc.sliceString(to, to + 1) === "}") {
|
|
2456
|
+
to++;
|
|
2457
|
+
}
|
|
2434
2458
|
editor.replaceText({
|
|
2435
|
-
|
|
2459
|
+
from,
|
|
2460
|
+
to,
|
|
2436
2461
|
text: "{{" + variablePath + "}}"
|
|
2437
2462
|
});
|
|
2438
2463
|
setVisible(false);
|
|
@@ -2594,7 +2619,7 @@ function VariableTagInject() {
|
|
|
2594
2619
|
const scope = (0, import_editor23.useCurrentScope)();
|
|
2595
2620
|
(0, import_react39.useLayoutEffect)(() => {
|
|
2596
2621
|
const atMatcher = new import_view4.MatchDecorator({
|
|
2597
|
-
regexp: /\{\{([^\}]+)\}\}/g,
|
|
2622
|
+
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
2598
2623
|
decoration: (match) => import_view4.Decoration.replace({
|
|
2599
2624
|
widget: new VariableTagWidget({
|
|
2600
2625
|
keyPath: match[1]?.split(".") ?? [],
|
|
@@ -2682,20 +2707,32 @@ function InputsPicker({
|
|
|
2682
2707
|
children
|
|
2683
2708
|
};
|
|
2684
2709
|
};
|
|
2685
|
-
const
|
|
2686
|
-
|
|
2687
|
-
|
|
2710
|
+
const getTreeData = (value, keyPath) => {
|
|
2711
|
+
const currKey = keyPath.join(".");
|
|
2712
|
+
if (FlowValueUtils.isFlowValue(value)) {
|
|
2713
|
+
if (FlowValueUtils.isRef(value)) {
|
|
2688
2714
|
const variable = available.getByKeyPath(value.content || []);
|
|
2689
2715
|
if (variable) {
|
|
2690
|
-
return renderVariable(variable,
|
|
2716
|
+
return renderVariable(variable, keyPath);
|
|
2691
2717
|
}
|
|
2692
2718
|
}
|
|
2693
2719
|
return {
|
|
2694
|
-
key,
|
|
2695
|
-
value:
|
|
2696
|
-
label:
|
|
2720
|
+
key: currKey,
|
|
2721
|
+
value: currKey,
|
|
2722
|
+
label: (0, import_lodash6.last)(keyPath)
|
|
2697
2723
|
};
|
|
2698
|
-
}
|
|
2724
|
+
}
|
|
2725
|
+
if ((0, import_lodash6.isPlainObject)(value)) {
|
|
2726
|
+
return {
|
|
2727
|
+
key: currKey,
|
|
2728
|
+
value: currKey,
|
|
2729
|
+
label: (0, import_lodash6.last)(keyPath),
|
|
2730
|
+
children: Object.entries(value).map(([key, value2]) => getTreeData(value2, [...keyPath, key])).filter(Boolean)
|
|
2731
|
+
};
|
|
2732
|
+
}
|
|
2733
|
+
};
|
|
2734
|
+
const treeData = (0, import_react42.useMemo)(
|
|
2735
|
+
() => Object.entries(inputsValues).map(([key, value]) => getTreeData(value, [key])).filter(Boolean),
|
|
2699
2736
|
[]
|
|
2700
2737
|
);
|
|
2701
2738
|
return /* @__PURE__ */ import_react42.default.createElement(import_semi_ui18.Tree, { treeData, onSelect: (v) => onSelect(v) });
|
|
@@ -2712,6 +2749,13 @@ function InputsTree({ inputsValues }) {
|
|
|
2712
2749
|
if (!range) {
|
|
2713
2750
|
return;
|
|
2714
2751
|
}
|
|
2752
|
+
let { from, to } = range;
|
|
2753
|
+
while (editor.$view.state.doc.sliceString(from - 1, from) === "{") {
|
|
2754
|
+
from--;
|
|
2755
|
+
}
|
|
2756
|
+
while (editor.$view.state.doc.sliceString(to, to + 1) === "}") {
|
|
2757
|
+
to++;
|
|
2758
|
+
}
|
|
2715
2759
|
editor.replaceText({
|
|
2716
2760
|
...range,
|
|
2717
2761
|
text: "{{" + variablePath + "}}"
|
|
@@ -2936,7 +2980,7 @@ function VariableTagInject2() {
|
|
|
2936
2980
|
const scope = (0, import_editor25.useCurrentScope)();
|
|
2937
2981
|
(0, import_react48.useLayoutEffect)(() => {
|
|
2938
2982
|
const atMatcher = new import_view5.MatchDecorator({
|
|
2939
|
-
regexp: /\{\{([^\}]+)\}\}/g,
|
|
2983
|
+
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
2940
2984
|
decoration: (match) => import_view5.Decoration.replace({
|
|
2941
2985
|
widget: new VariableTagWidget2({
|
|
2942
2986
|
keyPath: match[1]?.split(".") ?? [],
|
|
@@ -3083,7 +3127,20 @@ function InputsValues({
|
|
|
3083
3127
|
size: "small",
|
|
3084
3128
|
onClick: () => remove(item.id)
|
|
3085
3129
|
}
|
|
3086
|
-
)))), /* @__PURE__ */ import_react51.default.createElement(
|
|
3130
|
+
)))), /* @__PURE__ */ import_react51.default.createElement(
|
|
3131
|
+
import_semi_ui23.Button,
|
|
3132
|
+
{
|
|
3133
|
+
disabled: readonly,
|
|
3134
|
+
icon: /* @__PURE__ */ import_react51.default.createElement(import_semi_icons9.IconPlus, null),
|
|
3135
|
+
size: "small",
|
|
3136
|
+
onClick: () => add({
|
|
3137
|
+
type: "constant",
|
|
3138
|
+
content: "",
|
|
3139
|
+
schema: { type: "string" }
|
|
3140
|
+
})
|
|
3141
|
+
},
|
|
3142
|
+
import_editor26.I18n.t("Add")
|
|
3143
|
+
));
|
|
3087
3144
|
}
|
|
3088
3145
|
|
|
3089
3146
|
// src/components/display-schema-tree/index.tsx
|
|
@@ -3712,7 +3769,11 @@ function InputValueRow(props) {
|
|
|
3712
3769
|
theme: "borderless",
|
|
3713
3770
|
icon: /* @__PURE__ */ import_react62.default.createElement(IconAddChildren2, null),
|
|
3714
3771
|
onClick: () => {
|
|
3715
|
-
add(
|
|
3772
|
+
add({
|
|
3773
|
+
type: "constant",
|
|
3774
|
+
content: "",
|
|
3775
|
+
schema: { type: "string" }
|
|
3776
|
+
});
|
|
3716
3777
|
setCollapse(true);
|
|
3717
3778
|
}
|
|
3718
3779
|
}
|
|
@@ -3777,7 +3838,13 @@ function InputsValuesTree(props) {
|
|
|
3777
3838
|
disabled: readonly,
|
|
3778
3839
|
icon: /* @__PURE__ */ import_react63.default.createElement(import_semi_icons14.IconPlus, null),
|
|
3779
3840
|
size: "small",
|
|
3780
|
-
onClick:
|
|
3841
|
+
onClick: () => {
|
|
3842
|
+
add({
|
|
3843
|
+
type: "constant",
|
|
3844
|
+
content: "",
|
|
3845
|
+
schema: { type: "string" }
|
|
3846
|
+
});
|
|
3847
|
+
}
|
|
3781
3848
|
},
|
|
3782
3849
|
import_editor32.I18n.t("Add")
|
|
3783
3850
|
));
|
|
@@ -4145,7 +4212,7 @@ function validateFlowValue(value, ctx) {
|
|
|
4145
4212
|
}
|
|
4146
4213
|
}
|
|
4147
4214
|
if (value?.type === "template") {
|
|
4148
|
-
const allRefs = getTemplateKeyPaths(value);
|
|
4215
|
+
const allRefs = FlowValueUtils.getTemplateKeyPaths(value);
|
|
4149
4216
|
for (const ref of allRefs) {
|
|
4150
4217
|
const variable = (0, import_editor43.getNodeScope)(node).available.getByKeyPath(ref);
|
|
4151
4218
|
if (!variable) {
|
|
@@ -4158,12 +4225,6 @@ function validateFlowValue(value, ctx) {
|
|
|
4158
4225
|
}
|
|
4159
4226
|
return void 0;
|
|
4160
4227
|
}
|
|
4161
|
-
function getTemplateKeyPaths(value) {
|
|
4162
|
-
const keyPathReg = /{{(.*?)}}/g;
|
|
4163
|
-
return (0, import_lodash13.uniq)(value.content?.match(keyPathReg) || []).map(
|
|
4164
|
-
(_keyPath) => _keyPath.slice(2, -2).split(".")
|
|
4165
|
-
);
|
|
4166
|
-
}
|
|
4167
4228
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4168
4229
|
0 && (module.exports = {
|
|
4169
4230
|
AssignRow,
|
|
@@ -4218,6 +4279,7 @@ function getTemplateKeyPaths(value) {
|
|
|
4218
4279
|
provideBatchOutputsEffect,
|
|
4219
4280
|
provideJsonSchemaOutputs,
|
|
4220
4281
|
syncVariableTitle,
|
|
4282
|
+
useObjectList,
|
|
4221
4283
|
useTypeManager,
|
|
4222
4284
|
useVariableTree,
|
|
4223
4285
|
validateFlowValue,
|