@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.js
CHANGED
|
@@ -32,6 +32,7 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
ArrayIcons: () => ArrayIcons,
|
|
34
34
|
BatchVariableSelector: () => BatchVariableSelector,
|
|
35
|
+
ConditionRow: () => ConditionRow,
|
|
35
36
|
ConstantInput: () => ConstantInput,
|
|
36
37
|
DynamicValueInput: () => DynamicValueInput,
|
|
37
38
|
JsonSchemaEditor: () => JsonSchemaEditor,
|
|
@@ -39,6 +40,7 @@ __export(src_exports, {
|
|
|
39
40
|
TypeSelector: () => TypeSelector,
|
|
40
41
|
VariableSelector: () => VariableSelector,
|
|
41
42
|
VariableTypeIcons: () => VariableTypeIcons,
|
|
43
|
+
autoRenameRefEffect: () => autoRenameRefEffect,
|
|
42
44
|
formatLegacyRefOnInit: () => formatLegacyRefOnInit,
|
|
43
45
|
formatLegacyRefOnSubmit: () => formatLegacyRefOnSubmit,
|
|
44
46
|
formatLegacyRefToNewRef: () => formatLegacyRefToNewRef,
|
|
@@ -54,17 +56,17 @@ __export(src_exports, {
|
|
|
54
56
|
module.exports = __toCommonJS(src_exports);
|
|
55
57
|
|
|
56
58
|
// src/components/variable-selector/index.tsx
|
|
57
|
-
var import_react3 = __toESM(require("react"));
|
|
59
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
58
60
|
var import_semi_icons2 = require("@douyinfe/semi-icons");
|
|
59
61
|
|
|
60
62
|
// src/components/variable-selector/use-variable-tree.tsx
|
|
61
|
-
var import_react2 = __toESM(require("react"));
|
|
63
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
62
64
|
var import_editor2 = require("@flowgram.ai/editor");
|
|
63
65
|
var import_semi_ui = require("@douyinfe/semi-ui");
|
|
64
66
|
|
|
65
67
|
// src/components/type-selector/constants.tsx
|
|
66
|
-
var import_react = __toESM(require("react"));
|
|
67
|
-
var import_semi_icons = __toESM(require("@douyinfe/semi-icons"));
|
|
68
|
+
var import_react = __toESM(require("react"), 1);
|
|
69
|
+
var import_semi_icons = __toESM(require("@douyinfe/semi-icons"), 1);
|
|
68
70
|
var VariableTypeIcons = {
|
|
69
71
|
custom: /* @__PURE__ */ import_react.default.createElement(
|
|
70
72
|
"svg",
|
|
@@ -501,7 +503,8 @@ var JsonSchemaUtils;
|
|
|
501
503
|
}
|
|
502
504
|
}
|
|
503
505
|
JsonSchemaUtils2.schemaToAST = schemaToAST;
|
|
504
|
-
function astToSchema(typeAST) {
|
|
506
|
+
function astToSchema(typeAST, options2) {
|
|
507
|
+
const { drilldown = true } = options2 || {};
|
|
505
508
|
if (import_editor.ASTMatch.isString(typeAST)) {
|
|
506
509
|
return {
|
|
507
510
|
type: "string"
|
|
@@ -525,21 +528,21 @@ var JsonSchemaUtils;
|
|
|
525
528
|
if (import_editor.ASTMatch.isObject(typeAST)) {
|
|
526
529
|
return {
|
|
527
530
|
type: "object",
|
|
528
|
-
properties: Object.fromEntries(
|
|
531
|
+
properties: drilldown ? Object.fromEntries(
|
|
529
532
|
Object.entries(typeAST.properties).map(([key, value]) => [key, astToSchema(value)])
|
|
530
|
-
)
|
|
533
|
+
) : {}
|
|
531
534
|
};
|
|
532
535
|
}
|
|
533
536
|
if (import_editor.ASTMatch.isArray(typeAST)) {
|
|
534
537
|
return {
|
|
535
538
|
type: "array",
|
|
536
|
-
items: astToSchema(typeAST.items)
|
|
539
|
+
items: drilldown ? astToSchema(typeAST.items) : void 0
|
|
537
540
|
};
|
|
538
541
|
}
|
|
539
542
|
if (import_editor.ASTMatch.isMap(typeAST)) {
|
|
540
543
|
return {
|
|
541
544
|
type: "map",
|
|
542
|
-
items: astToSchema(typeAST.valueType)
|
|
545
|
+
items: drilldown ? astToSchema(typeAST.valueType) : void 0
|
|
543
546
|
};
|
|
544
547
|
}
|
|
545
548
|
if (import_editor.ASTMatch.isCustomType(typeAST)) {
|
|
@@ -624,7 +627,7 @@ function useVariableTree(params) {
|
|
|
624
627
|
}
|
|
625
628
|
|
|
626
629
|
// src/components/variable-selector/styles.tsx
|
|
627
|
-
var import_styled_components = __toESM(require("styled-components"));
|
|
630
|
+
var import_styled_components = __toESM(require("styled-components"), 1);
|
|
628
631
|
var import_semi_ui2 = require("@douyinfe/semi-ui");
|
|
629
632
|
var UIRootTitle = import_styled_components.default.span`
|
|
630
633
|
margin-right: 4px;
|
|
@@ -734,7 +737,7 @@ var VariableSelector = ({
|
|
|
734
737
|
);
|
|
735
738
|
},
|
|
736
739
|
showClear: false,
|
|
737
|
-
arrowIcon:
|
|
740
|
+
arrowIcon: /* @__PURE__ */ import_react3.default.createElement(import_semi_icons2.IconChevronDownStroked, { size: "small" }),
|
|
738
741
|
triggerRender,
|
|
739
742
|
placeholder: config?.placeholder ?? "Select Variable..."
|
|
740
743
|
}
|
|
@@ -742,7 +745,7 @@ var VariableSelector = ({
|
|
|
742
745
|
};
|
|
743
746
|
|
|
744
747
|
// src/components/type-selector/index.tsx
|
|
745
|
-
var import_react4 = __toESM(require("react"));
|
|
748
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
746
749
|
var import_semi_ui3 = require("@douyinfe/semi-ui");
|
|
747
750
|
var getTypeSelectValue = (value) => {
|
|
748
751
|
if (value?.type === "array" && value?.items) {
|
|
@@ -777,14 +780,14 @@ function TypeSelector(props) {
|
|
|
777
780
|
}
|
|
778
781
|
|
|
779
782
|
// src/components/json-schema-editor/index.tsx
|
|
780
|
-
var
|
|
783
|
+
var import_react8 = __toESM(require("react"), 1);
|
|
781
784
|
var import_semi_ui4 = require("@douyinfe/semi-ui");
|
|
782
785
|
var import_semi_icons4 = require("@douyinfe/semi-icons");
|
|
783
786
|
|
|
784
787
|
// src/components/json-schema-editor/styles.tsx
|
|
785
|
-
var import_react5 = __toESM(require("react"));
|
|
786
|
-
var import_styled_components2 = __toESM(require("styled-components"));
|
|
787
|
-
var import_semi_icons3 = __toESM(require("@douyinfe/semi-icons"));
|
|
788
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
789
|
+
var import_styled_components2 = __toESM(require("styled-components"), 1);
|
|
790
|
+
var import_semi_icons3 = __toESM(require("@douyinfe/semi-icons"), 1);
|
|
788
791
|
var UIContainer = import_styled_components2.default.div`
|
|
789
792
|
/* & .semi-input {
|
|
790
793
|
background-color: #fff;
|
|
@@ -1023,6 +1026,27 @@ function usePropertiesEdit(value, onChange) {
|
|
|
1023
1026
|
};
|
|
1024
1027
|
}
|
|
1025
1028
|
|
|
1029
|
+
// src/components/json-schema-editor/components/blur-input.tsx
|
|
1030
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
1031
|
+
var import_input = __toESM(require("@douyinfe/semi-ui/lib/es/input"), 1);
|
|
1032
|
+
function BlurInput(props) {
|
|
1033
|
+
const [value, setValue] = (0, import_react7.useState)("");
|
|
1034
|
+
(0, import_react7.useEffect)(() => {
|
|
1035
|
+
setValue(props.value);
|
|
1036
|
+
}, [props.value]);
|
|
1037
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
1038
|
+
import_input.default,
|
|
1039
|
+
{
|
|
1040
|
+
...props,
|
|
1041
|
+
value,
|
|
1042
|
+
onChange: (value2) => {
|
|
1043
|
+
setValue(value2);
|
|
1044
|
+
},
|
|
1045
|
+
onBlur: (e) => props.onChange?.(value, e)
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1026
1050
|
// src/components/json-schema-editor/index.tsx
|
|
1027
1051
|
function JsonSchemaEditor(props) {
|
|
1028
1052
|
const { value = { type: "object" }, config = {}, onChange: onChangeProps } = props;
|
|
@@ -1030,7 +1054,7 @@ function JsonSchemaEditor(props) {
|
|
|
1030
1054
|
value,
|
|
1031
1055
|
onChangeProps
|
|
1032
1056
|
);
|
|
1033
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ import_react8.default.createElement(UIContainer, null, /* @__PURE__ */ import_react8.default.createElement(UIProperties, null, propertyList.map((_property) => /* @__PURE__ */ import_react8.default.createElement(
|
|
1034
1058
|
PropertyEdit,
|
|
1035
1059
|
{
|
|
1036
1060
|
key: _property.key,
|
|
@@ -1043,14 +1067,14 @@ function JsonSchemaEditor(props) {
|
|
|
1043
1067
|
onRemoveProperty(_property.key);
|
|
1044
1068
|
}
|
|
1045
1069
|
}
|
|
1046
|
-
))), /* @__PURE__ */
|
|
1070
|
+
))), /* @__PURE__ */ import_react8.default.createElement(import_semi_ui4.Button, { size: "small", style: { marginTop: 10 }, icon: /* @__PURE__ */ import_react8.default.createElement(import_semi_icons4.IconPlus, null), onClick: onAddProperty }, config?.addButtonText ?? "Add"));
|
|
1047
1071
|
}
|
|
1048
1072
|
function PropertyEdit(props) {
|
|
1049
1073
|
const { value, config, onChange: onChangeProps, onRemove, $isLast, $showLine } = props;
|
|
1050
|
-
const [expand, setExpand] = (0,
|
|
1051
|
-
const [collapse, setCollapse] = (0,
|
|
1074
|
+
const [expand, setExpand] = (0, import_react8.useState)(false);
|
|
1075
|
+
const [collapse, setCollapse] = (0, import_react8.useState)(false);
|
|
1052
1076
|
const { name, type, items, description, isPropertyRequired } = value || {};
|
|
1053
|
-
const typeSelectorValue = (0,
|
|
1077
|
+
const typeSelectorValue = (0, import_react8.useMemo)(() => ({ type, items }), [type, items]);
|
|
1054
1078
|
const { propertyList, isDrilldownObject, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(value, onChangeProps);
|
|
1055
1079
|
const onChange = (key, _value) => {
|
|
1056
1080
|
onChangeProps?.({
|
|
@@ -1059,15 +1083,15 @@ function PropertyEdit(props) {
|
|
|
1059
1083
|
});
|
|
1060
1084
|
};
|
|
1061
1085
|
const showCollapse = isDrilldownObject && propertyList.length > 0;
|
|
1062
|
-
return /* @__PURE__ */
|
|
1063
|
-
|
|
1086
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement(UIPropertyLeft, { $isLast, $showLine }, showCollapse && /* @__PURE__ */ import_react8.default.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ import_react8.default.createElement(import_semi_icons4.IconChevronDown, { size: "small" }) : /* @__PURE__ */ import_react8.default.createElement(import_semi_icons4.IconChevronRight, { size: "small" }))), /* @__PURE__ */ import_react8.default.createElement(UIPropertyRight, null, /* @__PURE__ */ import_react8.default.createElement(UIPropertyMain, { $expand: expand }, /* @__PURE__ */ import_react8.default.createElement(UIRow, null, /* @__PURE__ */ import_react8.default.createElement(UIName, null, /* @__PURE__ */ import_react8.default.createElement(
|
|
1087
|
+
BlurInput,
|
|
1064
1088
|
{
|
|
1065
1089
|
placeholder: config?.placeholder ?? "Input Variable Name",
|
|
1066
1090
|
size: "small",
|
|
1067
1091
|
value: name,
|
|
1068
1092
|
onChange: (value2) => onChange("name", value2)
|
|
1069
1093
|
}
|
|
1070
|
-
)), /* @__PURE__ */
|
|
1094
|
+
)), /* @__PURE__ */ import_react8.default.createElement(UIType, null, /* @__PURE__ */ import_react8.default.createElement(
|
|
1071
1095
|
TypeSelector,
|
|
1072
1096
|
{
|
|
1073
1097
|
value: typeSelectorValue,
|
|
@@ -1078,48 +1102,48 @@ function PropertyEdit(props) {
|
|
|
1078
1102
|
});
|
|
1079
1103
|
}
|
|
1080
1104
|
}
|
|
1081
|
-
)), /* @__PURE__ */
|
|
1105
|
+
)), /* @__PURE__ */ import_react8.default.createElement(UIRequired, null, /* @__PURE__ */ import_react8.default.createElement(
|
|
1082
1106
|
import_semi_ui4.Checkbox,
|
|
1083
1107
|
{
|
|
1084
1108
|
checked: isPropertyRequired,
|
|
1085
1109
|
onChange: (e) => onChange("isPropertyRequired", e.target.checked)
|
|
1086
1110
|
}
|
|
1087
|
-
)), /* @__PURE__ */
|
|
1111
|
+
)), /* @__PURE__ */ import_react8.default.createElement(UIActions, null, /* @__PURE__ */ import_react8.default.createElement(
|
|
1088
1112
|
import_semi_ui4.IconButton,
|
|
1089
1113
|
{
|
|
1090
1114
|
size: "small",
|
|
1091
1115
|
theme: "borderless",
|
|
1092
|
-
icon: expand ? /* @__PURE__ */
|
|
1116
|
+
icon: expand ? /* @__PURE__ */ import_react8.default.createElement(import_semi_icons4.IconShrink, { size: "small" }) : /* @__PURE__ */ import_react8.default.createElement(import_semi_icons4.IconExpand, { size: "small" }),
|
|
1093
1117
|
onClick: () => setExpand((_expand) => !_expand)
|
|
1094
1118
|
}
|
|
1095
|
-
), isDrilldownObject && /* @__PURE__ */
|
|
1119
|
+
), isDrilldownObject && /* @__PURE__ */ import_react8.default.createElement(
|
|
1096
1120
|
import_semi_ui4.IconButton,
|
|
1097
1121
|
{
|
|
1098
1122
|
size: "small",
|
|
1099
1123
|
theme: "borderless",
|
|
1100
|
-
icon: /* @__PURE__ */
|
|
1124
|
+
icon: /* @__PURE__ */ import_react8.default.createElement(IconAddChildren, null),
|
|
1101
1125
|
onClick: () => {
|
|
1102
1126
|
onAddProperty();
|
|
1103
1127
|
setCollapse(true);
|
|
1104
1128
|
}
|
|
1105
1129
|
}
|
|
1106
|
-
), /* @__PURE__ */
|
|
1130
|
+
), /* @__PURE__ */ import_react8.default.createElement(
|
|
1107
1131
|
import_semi_ui4.IconButton,
|
|
1108
1132
|
{
|
|
1109
1133
|
size: "small",
|
|
1110
1134
|
theme: "borderless",
|
|
1111
|
-
icon: /* @__PURE__ */
|
|
1135
|
+
icon: /* @__PURE__ */ import_react8.default.createElement(import_semi_icons4.IconMinus, { size: "small" }),
|
|
1112
1136
|
onClick: onRemove
|
|
1113
1137
|
}
|
|
1114
|
-
))), expand && /* @__PURE__ */
|
|
1115
|
-
|
|
1138
|
+
))), expand && /* @__PURE__ */ import_react8.default.createElement(UIExpandDetail, null, /* @__PURE__ */ import_react8.default.createElement(UILabel, null, config?.descTitle ?? "Description"), /* @__PURE__ */ import_react8.default.createElement(
|
|
1139
|
+
BlurInput,
|
|
1116
1140
|
{
|
|
1117
1141
|
size: "small",
|
|
1118
1142
|
value: description,
|
|
1119
1143
|
onChange: (value2) => onChange("description", value2),
|
|
1120
1144
|
placeholder: config?.descPlaceholder ?? "Help LLM to understand the property"
|
|
1121
1145
|
}
|
|
1122
|
-
))), showCollapse && /* @__PURE__ */
|
|
1146
|
+
))), showCollapse && /* @__PURE__ */ import_react8.default.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ import_react8.default.createElement(UIProperties, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ import_react8.default.createElement(
|
|
1123
1147
|
PropertyEdit,
|
|
1124
1148
|
{
|
|
1125
1149
|
key: _property.key,
|
|
@@ -1138,27 +1162,27 @@ function PropertyEdit(props) {
|
|
|
1138
1162
|
}
|
|
1139
1163
|
|
|
1140
1164
|
// src/components/batch-variable-selector/index.tsx
|
|
1141
|
-
var
|
|
1165
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
1142
1166
|
var import_editor3 = require("@flowgram.ai/editor");
|
|
1143
1167
|
var batchVariableSchema = {
|
|
1144
1168
|
type: "array",
|
|
1145
1169
|
extra: { weak: true }
|
|
1146
1170
|
};
|
|
1147
1171
|
function BatchVariableSelector(props) {
|
|
1148
|
-
return /* @__PURE__ */
|
|
1172
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_editor3.PrivateScopeProvider, null, /* @__PURE__ */ import_react9.default.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
|
|
1149
1173
|
}
|
|
1150
1174
|
|
|
1151
1175
|
// src/components/constant-input/index.tsx
|
|
1152
|
-
var
|
|
1176
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
1153
1177
|
var import_semi_ui5 = require("@douyinfe/semi-ui");
|
|
1154
1178
|
var defaultStrategies = [
|
|
1155
1179
|
{
|
|
1156
1180
|
hit: (schema) => schema?.type === "string",
|
|
1157
|
-
Renderer: (props) => /* @__PURE__ */
|
|
1181
|
+
Renderer: (props) => /* @__PURE__ */ import_react10.default.createElement(import_semi_ui5.Input, { placeholder: "Please Input String", size: "small", disabled: props.readonly, ...props })
|
|
1158
1182
|
},
|
|
1159
1183
|
{
|
|
1160
1184
|
hit: (schema) => schema?.type === "number",
|
|
1161
|
-
Renderer: (props) => /* @__PURE__ */
|
|
1185
|
+
Renderer: (props) => /* @__PURE__ */ import_react10.default.createElement(
|
|
1162
1186
|
import_semi_ui5.InputNumber,
|
|
1163
1187
|
{
|
|
1164
1188
|
placeholder: "Please Input Number",
|
|
@@ -1171,7 +1195,7 @@ var defaultStrategies = [
|
|
|
1171
1195
|
},
|
|
1172
1196
|
{
|
|
1173
1197
|
hit: (schema) => schema?.type === "integer",
|
|
1174
|
-
Renderer: (props) => /* @__PURE__ */
|
|
1198
|
+
Renderer: (props) => /* @__PURE__ */ import_react10.default.createElement(
|
|
1175
1199
|
import_semi_ui5.InputNumber,
|
|
1176
1200
|
{
|
|
1177
1201
|
placeholder: "Please Input Integer",
|
|
@@ -1187,7 +1211,7 @@ var defaultStrategies = [
|
|
|
1187
1211
|
hit: (schema) => schema?.type === "boolean",
|
|
1188
1212
|
Renderer: (props) => {
|
|
1189
1213
|
const { value, onChange, ...rest } = props;
|
|
1190
|
-
return /* @__PURE__ */
|
|
1214
|
+
return /* @__PURE__ */ import_react10.default.createElement(
|
|
1191
1215
|
import_semi_ui5.Select,
|
|
1192
1216
|
{
|
|
1193
1217
|
placeholder: "Please Select Boolean",
|
|
@@ -1207,27 +1231,27 @@ var defaultStrategies = [
|
|
|
1207
1231
|
];
|
|
1208
1232
|
function ConstantInput(props) {
|
|
1209
1233
|
const { value, onChange, schema, strategies: extraStrategies, readonly, ...rest } = props;
|
|
1210
|
-
const strategies = (0,
|
|
1234
|
+
const strategies = (0, import_react10.useMemo)(
|
|
1211
1235
|
() => [...defaultStrategies, ...extraStrategies || []],
|
|
1212
1236
|
[extraStrategies]
|
|
1213
1237
|
);
|
|
1214
|
-
const Renderer = (0,
|
|
1238
|
+
const Renderer = (0, import_react10.useMemo)(() => {
|
|
1215
1239
|
const strategy = strategies.find((_strategy) => _strategy.hit(schema));
|
|
1216
1240
|
return strategy?.Renderer;
|
|
1217
1241
|
}, [strategies, schema]);
|
|
1218
1242
|
if (!Renderer) {
|
|
1219
|
-
return /* @__PURE__ */
|
|
1243
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_semi_ui5.Input, { size: "small", disabled: true, placeholder: "Unsupported type" });
|
|
1220
1244
|
}
|
|
1221
|
-
return /* @__PURE__ */
|
|
1245
|
+
return /* @__PURE__ */ import_react10.default.createElement(Renderer, { value, onChange, readonly, ...rest });
|
|
1222
1246
|
}
|
|
1223
1247
|
|
|
1224
1248
|
// src/components/dynamic-value-input/index.tsx
|
|
1225
|
-
var
|
|
1249
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
1226
1250
|
var import_semi_ui6 = require("@douyinfe/semi-ui");
|
|
1227
1251
|
var import_semi_icons5 = require("@douyinfe/semi-icons");
|
|
1228
1252
|
|
|
1229
1253
|
// src/components/dynamic-value-input/styles.tsx
|
|
1230
|
-
var import_styled_components3 = __toESM(require("styled-components"));
|
|
1254
|
+
var import_styled_components3 = __toESM(require("styled-components"), 1);
|
|
1231
1255
|
var UIContainer2 = import_styled_components3.default.div`
|
|
1232
1256
|
display: flex;
|
|
1233
1257
|
align-items: center;
|
|
@@ -1253,19 +1277,25 @@ function DynamicValueInput({
|
|
|
1253
1277
|
schema,
|
|
1254
1278
|
constantProps
|
|
1255
1279
|
}) {
|
|
1280
|
+
const includeSchema = (0, import_react11.useMemo)(() => {
|
|
1281
|
+
if (schema?.type === "number") {
|
|
1282
|
+
return [schema, { type: "integer" }];
|
|
1283
|
+
}
|
|
1284
|
+
return schema;
|
|
1285
|
+
}, [schema]);
|
|
1256
1286
|
const renderMain = () => {
|
|
1257
1287
|
if (value?.type === "ref") {
|
|
1258
|
-
return /* @__PURE__ */
|
|
1288
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
1259
1289
|
VariableSelector,
|
|
1260
1290
|
{
|
|
1261
1291
|
value: value?.content,
|
|
1262
1292
|
onChange: (_v) => onChange(_v ? { type: "ref", content: _v } : void 0),
|
|
1263
|
-
includeSchema
|
|
1293
|
+
includeSchema,
|
|
1264
1294
|
readonly
|
|
1265
1295
|
}
|
|
1266
1296
|
);
|
|
1267
1297
|
}
|
|
1268
|
-
return /* @__PURE__ */
|
|
1298
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
1269
1299
|
ConstantInput,
|
|
1270
1300
|
{
|
|
1271
1301
|
value: value?.content,
|
|
@@ -1276,77 +1306,171 @@ function DynamicValueInput({
|
|
|
1276
1306
|
}
|
|
1277
1307
|
);
|
|
1278
1308
|
};
|
|
1279
|
-
const renderTrigger = () => /* @__PURE__ */
|
|
1309
|
+
const renderTrigger = () => /* @__PURE__ */ import_react11.default.createElement(
|
|
1280
1310
|
VariableSelector,
|
|
1281
1311
|
{
|
|
1282
1312
|
style: { width: "100%" },
|
|
1283
1313
|
value: value?.type === "ref" ? value?.content : void 0,
|
|
1284
1314
|
onChange: (_v) => onChange({ type: "ref", content: _v }),
|
|
1285
|
-
includeSchema
|
|
1315
|
+
includeSchema,
|
|
1286
1316
|
readonly,
|
|
1287
|
-
triggerRender: () => /* @__PURE__ */
|
|
1317
|
+
triggerRender: () => /* @__PURE__ */ import_react11.default.createElement(import_semi_ui6.IconButton, { disabled: readonly, size: "small", icon: /* @__PURE__ */ import_react11.default.createElement(import_semi_icons5.IconSetting, { size: "small" }) })
|
|
1288
1318
|
}
|
|
1289
1319
|
);
|
|
1290
|
-
return /* @__PURE__ */
|
|
1320
|
+
return /* @__PURE__ */ import_react11.default.createElement(UIContainer2, { style }, /* @__PURE__ */ import_react11.default.createElement(UIMain, null, renderMain()), /* @__PURE__ */ import_react11.default.createElement(UITrigger, null, renderTrigger()));
|
|
1291
1321
|
}
|
|
1292
1322
|
|
|
1293
|
-
// src/
|
|
1323
|
+
// src/components/condition-row/index.tsx
|
|
1324
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
1325
|
+
var import_semi_ui8 = require("@douyinfe/semi-ui");
|
|
1326
|
+
|
|
1327
|
+
// src/components/condition-row/styles.tsx
|
|
1328
|
+
var import_styled_components4 = __toESM(require("styled-components"), 1);
|
|
1329
|
+
var UIContainer3 = import_styled_components4.default.div`
|
|
1330
|
+
display: flex;
|
|
1331
|
+
align-items: center;
|
|
1332
|
+
gap: 4px;
|
|
1333
|
+
`;
|
|
1334
|
+
var UIOperator = import_styled_components4.default.div``;
|
|
1335
|
+
var UILeft = import_styled_components4.default.div`
|
|
1336
|
+
width: 100%;
|
|
1337
|
+
`;
|
|
1338
|
+
var UIRight = import_styled_components4.default.div`
|
|
1339
|
+
width: 100%;
|
|
1340
|
+
`;
|
|
1341
|
+
var UIValues = import_styled_components4.default.div`
|
|
1342
|
+
flex-grow: 1;
|
|
1343
|
+
display: flex;
|
|
1344
|
+
flex-direction: column;
|
|
1345
|
+
align-items: center;
|
|
1346
|
+
gap: 4px;
|
|
1347
|
+
`;
|
|
1348
|
+
|
|
1349
|
+
// src/components/condition-row/hooks/useRule.ts
|
|
1350
|
+
var import_react12 = require("react");
|
|
1294
1351
|
var import_editor4 = require("@flowgram.ai/editor");
|
|
1295
|
-
var provideBatchInputEffect = (0, import_editor4.createEffectFromVariableProvider)({
|
|
1296
|
-
private: true,
|
|
1297
|
-
parse: (value, ctx) => [
|
|
1298
|
-
import_editor4.ASTFactory.createVariableDeclaration({
|
|
1299
|
-
key: `${ctx.node.id}_locals`,
|
|
1300
|
-
meta: {
|
|
1301
|
-
title: (0, import_editor4.getNodeForm)(ctx.node)?.getValueIn("title"),
|
|
1302
|
-
icon: ctx.node.getNodeRegistry().info?.icon
|
|
1303
|
-
},
|
|
1304
|
-
type: import_editor4.ASTFactory.createObject({
|
|
1305
|
-
properties: [
|
|
1306
|
-
import_editor4.ASTFactory.createProperty({
|
|
1307
|
-
key: "item",
|
|
1308
|
-
initializer: import_editor4.ASTFactory.createEnumerateExpression({
|
|
1309
|
-
enumerateFor: import_editor4.ASTFactory.createKeyPathExpression({
|
|
1310
|
-
keyPath: value.content || []
|
|
1311
|
-
})
|
|
1312
|
-
})
|
|
1313
|
-
}),
|
|
1314
|
-
import_editor4.ASTFactory.createProperty({
|
|
1315
|
-
key: "index",
|
|
1316
|
-
type: import_editor4.ASTFactory.createNumber()
|
|
1317
|
-
})
|
|
1318
|
-
]
|
|
1319
|
-
})
|
|
1320
|
-
})
|
|
1321
|
-
]
|
|
1322
|
-
});
|
|
1323
1352
|
|
|
1324
|
-
// src/
|
|
1325
|
-
var
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1353
|
+
// src/components/condition-row/constants.ts
|
|
1354
|
+
var rules = {
|
|
1355
|
+
string: {
|
|
1356
|
+
["eq" /* EQ */]: "string",
|
|
1357
|
+
["neq" /* NEQ */]: "string",
|
|
1358
|
+
["contains" /* CONTAINS */]: "string",
|
|
1359
|
+
["not_contains" /* NOT_CONTAINS */]: "string",
|
|
1360
|
+
["in" /* IN */]: "array",
|
|
1361
|
+
["nin" /* NIN */]: "array",
|
|
1362
|
+
["is_empty" /* IS_EMPTY */]: "string",
|
|
1363
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: "string"
|
|
1364
|
+
},
|
|
1365
|
+
number: {
|
|
1366
|
+
["eq" /* EQ */]: "number",
|
|
1367
|
+
["neq" /* NEQ */]: "number",
|
|
1368
|
+
["gt" /* GT */]: "number",
|
|
1369
|
+
["gte" /* GTE */]: "number",
|
|
1370
|
+
["lt" /* LT */]: "number",
|
|
1371
|
+
["lte" /* LTE */]: "number",
|
|
1372
|
+
["in" /* IN */]: "array",
|
|
1373
|
+
["nin" /* NIN */]: "array",
|
|
1374
|
+
["is_empty" /* IS_EMPTY */]: null,
|
|
1375
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1376
|
+
},
|
|
1377
|
+
integer: {
|
|
1378
|
+
["eq" /* EQ */]: "number",
|
|
1379
|
+
["neq" /* NEQ */]: "number",
|
|
1380
|
+
["gt" /* GT */]: "number",
|
|
1381
|
+
["gte" /* GTE */]: "number",
|
|
1382
|
+
["lt" /* LT */]: "number",
|
|
1383
|
+
["lte" /* LTE */]: "number",
|
|
1384
|
+
["in" /* IN */]: "array",
|
|
1385
|
+
["nin" /* NIN */]: "array",
|
|
1386
|
+
["is_empty" /* IS_EMPTY */]: null,
|
|
1387
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1388
|
+
},
|
|
1389
|
+
boolean: {
|
|
1390
|
+
["eq" /* EQ */]: "boolean",
|
|
1391
|
+
["neq" /* NEQ */]: "boolean",
|
|
1392
|
+
["is_true" /* IS_TRUE */]: null,
|
|
1393
|
+
["is_false" /* IS_FALSE */]: null,
|
|
1394
|
+
["in" /* IN */]: "array",
|
|
1395
|
+
["nin" /* NIN */]: "array",
|
|
1396
|
+
["is_empty" /* IS_EMPTY */]: null,
|
|
1397
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1398
|
+
},
|
|
1399
|
+
object: {
|
|
1400
|
+
["is_empty" /* IS_EMPTY */]: null,
|
|
1401
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1402
|
+
},
|
|
1403
|
+
array: {
|
|
1404
|
+
["is_empty" /* IS_EMPTY */]: null,
|
|
1405
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1406
|
+
},
|
|
1407
|
+
map: {
|
|
1408
|
+
["is_empty" /* IS_EMPTY */]: null,
|
|
1409
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
1410
|
+
}
|
|
1411
|
+
};
|
|
1412
|
+
var opConfigs = {
|
|
1413
|
+
["eq" /* EQ */]: {
|
|
1414
|
+
label: "Equal",
|
|
1415
|
+
abbreviation: "="
|
|
1416
|
+
},
|
|
1417
|
+
["neq" /* NEQ */]: {
|
|
1418
|
+
label: "Not Equal",
|
|
1419
|
+
abbreviation: "\u2260"
|
|
1420
|
+
},
|
|
1421
|
+
["gt" /* GT */]: {
|
|
1422
|
+
label: "Greater Than",
|
|
1423
|
+
abbreviation: ">"
|
|
1424
|
+
},
|
|
1425
|
+
["gte" /* GTE */]: {
|
|
1426
|
+
label: "Greater Than or Equal",
|
|
1427
|
+
abbreviation: ">="
|
|
1428
|
+
},
|
|
1429
|
+
["lt" /* LT */]: {
|
|
1430
|
+
label: "Less Than",
|
|
1431
|
+
abbreviation: "<"
|
|
1432
|
+
},
|
|
1433
|
+
["lte" /* LTE */]: {
|
|
1434
|
+
label: "Less Than or Equal",
|
|
1435
|
+
abbreviation: "<="
|
|
1436
|
+
},
|
|
1437
|
+
["in" /* IN */]: {
|
|
1438
|
+
label: "In",
|
|
1439
|
+
abbreviation: "\u2208"
|
|
1440
|
+
},
|
|
1441
|
+
["nin" /* NIN */]: {
|
|
1442
|
+
label: "Not In",
|
|
1443
|
+
abbreviation: "\u2209"
|
|
1444
|
+
},
|
|
1445
|
+
["contains" /* CONTAINS */]: {
|
|
1446
|
+
label: "Contains",
|
|
1447
|
+
abbreviation: "\u2287"
|
|
1448
|
+
},
|
|
1449
|
+
["not_contains" /* NOT_CONTAINS */]: {
|
|
1450
|
+
label: "Not Contains",
|
|
1451
|
+
abbreviation: "\u2289"
|
|
1452
|
+
},
|
|
1453
|
+
["is_empty" /* IS_EMPTY */]: {
|
|
1454
|
+
label: "Is Empty",
|
|
1455
|
+
abbreviation: "=",
|
|
1456
|
+
rightDisplay: "Empty"
|
|
1457
|
+
},
|
|
1458
|
+
["is_not_empty" /* IS_NOT_EMPTY */]: {
|
|
1459
|
+
label: "Is Not Empty",
|
|
1460
|
+
abbreviation: "\u2260",
|
|
1461
|
+
rightDisplay: "Empty"
|
|
1462
|
+
},
|
|
1463
|
+
["is_true" /* IS_TRUE */]: {
|
|
1464
|
+
label: "Is True",
|
|
1465
|
+
abbreviation: "=",
|
|
1466
|
+
rightDisplay: "True"
|
|
1467
|
+
},
|
|
1468
|
+
["is_false" /* IS_FALSE */]: {
|
|
1469
|
+
label: "Is False",
|
|
1470
|
+
abbreviation: "=",
|
|
1471
|
+
rightDisplay: "False"
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1350
1474
|
|
|
1351
1475
|
// src/utils/format-legacy-refs/index.ts
|
|
1352
1476
|
var import_lodash2 = require("lodash");
|
|
@@ -1409,10 +1533,208 @@ function formatNewRefToLegacyRef(value) {
|
|
|
1409
1533
|
content: value.content.join(".")
|
|
1410
1534
|
};
|
|
1411
1535
|
}
|
|
1536
|
+
|
|
1537
|
+
// src/components/condition-row/hooks/useRule.ts
|
|
1538
|
+
function useRule(left) {
|
|
1539
|
+
const available = (0, import_editor4.useScopeAvailable)();
|
|
1540
|
+
const variable = (0, import_react12.useMemo)(() => {
|
|
1541
|
+
if (!left) return void 0;
|
|
1542
|
+
return available.getByKeyPath(left.content);
|
|
1543
|
+
}, [available, left]);
|
|
1544
|
+
const rule = (0, import_react12.useMemo)(() => {
|
|
1545
|
+
if (!variable) return void 0;
|
|
1546
|
+
const schema = JsonSchemaUtils.astToSchema(variable.type, { drilldown: false });
|
|
1547
|
+
return rules[schema?.type];
|
|
1548
|
+
}, [variable?.type]);
|
|
1549
|
+
return { rule };
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
// src/components/condition-row/hooks/useOp.tsx
|
|
1553
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
1554
|
+
var import_semi_ui7 = require("@douyinfe/semi-ui");
|
|
1555
|
+
var import_semi_icons6 = require("@douyinfe/semi-icons");
|
|
1556
|
+
function useOp({ rule, op, onChange }) {
|
|
1557
|
+
const options2 = (0, import_react13.useMemo)(
|
|
1558
|
+
() => Object.keys(rule || {}).map((_op) => ({
|
|
1559
|
+
...opConfigs[_op] || {},
|
|
1560
|
+
value: _op
|
|
1561
|
+
})),
|
|
1562
|
+
[rule]
|
|
1563
|
+
);
|
|
1564
|
+
const opConfig = (0, import_react13.useMemo)(() => opConfigs[op], [op]);
|
|
1565
|
+
const renderOpSelect = () => /* @__PURE__ */ import_react13.default.createElement(
|
|
1566
|
+
import_semi_ui7.Select,
|
|
1567
|
+
{
|
|
1568
|
+
style: { height: 22 },
|
|
1569
|
+
size: "small",
|
|
1570
|
+
value: op,
|
|
1571
|
+
optionList: options2,
|
|
1572
|
+
onChange: (v) => {
|
|
1573
|
+
onChange(v);
|
|
1574
|
+
},
|
|
1575
|
+
triggerRender: ({ value }) => /* @__PURE__ */ import_react13.default.createElement(import_semi_ui7.Button, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ import_react13.default.createElement(import_semi_icons6.IconChevronDownStroked, { size: "small" }))
|
|
1576
|
+
}
|
|
1577
|
+
);
|
|
1578
|
+
return { renderOpSelect, opConfig };
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
// src/components/condition-row/index.tsx
|
|
1582
|
+
function ConditionRow({ style, value, onChange, readonly }) {
|
|
1583
|
+
const { left, operator, right } = value || {};
|
|
1584
|
+
const { rule } = useRule(left);
|
|
1585
|
+
const { renderOpSelect, opConfig } = useOp({
|
|
1586
|
+
rule,
|
|
1587
|
+
op: operator,
|
|
1588
|
+
onChange: (v) => onChange({ ...value, operator: v })
|
|
1589
|
+
});
|
|
1590
|
+
const targetSchema = (0, import_react14.useMemo)(() => {
|
|
1591
|
+
const targetType = rule?.[operator] || null;
|
|
1592
|
+
return targetType ? { type: targetType, extra: { weak: true } } : null;
|
|
1593
|
+
}, [rule, opConfig]);
|
|
1594
|
+
return /* @__PURE__ */ import_react14.default.createElement(UIContainer3, { style }, /* @__PURE__ */ import_react14.default.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ import_react14.default.createElement(UIValues, null, /* @__PURE__ */ import_react14.default.createElement(UILeft, null, /* @__PURE__ */ import_react14.default.createElement(
|
|
1595
|
+
VariableSelector,
|
|
1596
|
+
{
|
|
1597
|
+
readonly,
|
|
1598
|
+
style: { width: "100%" },
|
|
1599
|
+
value: left?.content,
|
|
1600
|
+
onChange: (v) => onChange({
|
|
1601
|
+
...value,
|
|
1602
|
+
left: {
|
|
1603
|
+
type: "ref",
|
|
1604
|
+
content: v
|
|
1605
|
+
}
|
|
1606
|
+
})
|
|
1607
|
+
}
|
|
1608
|
+
)), /* @__PURE__ */ import_react14.default.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ import_react14.default.createElement(
|
|
1609
|
+
DynamicValueInput,
|
|
1610
|
+
{
|
|
1611
|
+
readonly: readonly || !rule,
|
|
1612
|
+
value: right,
|
|
1613
|
+
schema: targetSchema,
|
|
1614
|
+
onChange: (v) => onChange({ ...value, right: v })
|
|
1615
|
+
}
|
|
1616
|
+
) : /* @__PURE__ */ import_react14.default.createElement(import_semi_ui8.Input, { size: "small", disabled: true, value: opConfig?.rightDisplay || "Empty" }))));
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
// src/effects/provide-batch-input/index.ts
|
|
1620
|
+
var import_editor5 = require("@flowgram.ai/editor");
|
|
1621
|
+
var provideBatchInputEffect = (0, import_editor5.createEffectFromVariableProvider)({
|
|
1622
|
+
private: true,
|
|
1623
|
+
parse: (value, ctx) => [
|
|
1624
|
+
import_editor5.ASTFactory.createVariableDeclaration({
|
|
1625
|
+
key: `${ctx.node.id}_locals`,
|
|
1626
|
+
meta: {
|
|
1627
|
+
title: (0, import_editor5.getNodeForm)(ctx.node)?.getValueIn("title"),
|
|
1628
|
+
icon: ctx.node.getNodeRegistry().info?.icon
|
|
1629
|
+
},
|
|
1630
|
+
type: import_editor5.ASTFactory.createObject({
|
|
1631
|
+
properties: [
|
|
1632
|
+
import_editor5.ASTFactory.createProperty({
|
|
1633
|
+
key: "item",
|
|
1634
|
+
initializer: import_editor5.ASTFactory.createEnumerateExpression({
|
|
1635
|
+
enumerateFor: import_editor5.ASTFactory.createKeyPathExpression({
|
|
1636
|
+
keyPath: value.content || []
|
|
1637
|
+
})
|
|
1638
|
+
})
|
|
1639
|
+
}),
|
|
1640
|
+
import_editor5.ASTFactory.createProperty({
|
|
1641
|
+
key: "index",
|
|
1642
|
+
type: import_editor5.ASTFactory.createNumber()
|
|
1643
|
+
})
|
|
1644
|
+
]
|
|
1645
|
+
})
|
|
1646
|
+
})
|
|
1647
|
+
]
|
|
1648
|
+
});
|
|
1649
|
+
|
|
1650
|
+
// src/effects/provide-batch-outputs/index.ts
|
|
1651
|
+
var import_editor6 = require("@flowgram.ai/editor");
|
|
1652
|
+
var provideBatchOutputsEffect = (0, import_editor6.createEffectFromVariableProvider)({
|
|
1653
|
+
private: true,
|
|
1654
|
+
parse: (value, ctx) => [
|
|
1655
|
+
import_editor6.ASTFactory.createVariableDeclaration({
|
|
1656
|
+
key: `${ctx.node.id}`,
|
|
1657
|
+
meta: {
|
|
1658
|
+
title: (0, import_editor6.getNodeForm)(ctx.node)?.getValueIn("title"),
|
|
1659
|
+
icon: ctx.node.getNodeRegistry().info?.icon
|
|
1660
|
+
},
|
|
1661
|
+
type: import_editor6.ASTFactory.createObject({
|
|
1662
|
+
properties: Object.entries(value).map(
|
|
1663
|
+
([_key, value2]) => import_editor6.ASTFactory.createProperty({
|
|
1664
|
+
key: _key,
|
|
1665
|
+
initializer: import_editor6.ASTFactory.createWrapArrayExpression({
|
|
1666
|
+
wrapFor: import_editor6.ASTFactory.createKeyPathExpression({
|
|
1667
|
+
keyPath: value2.content || []
|
|
1668
|
+
})
|
|
1669
|
+
})
|
|
1670
|
+
})
|
|
1671
|
+
)
|
|
1672
|
+
})
|
|
1673
|
+
})
|
|
1674
|
+
]
|
|
1675
|
+
});
|
|
1676
|
+
|
|
1677
|
+
// src/effects/auto-rename-ref/index.ts
|
|
1678
|
+
var import_lodash3 = require("lodash");
|
|
1679
|
+
var import_editor7 = require("@flowgram.ai/editor");
|
|
1680
|
+
var autoRenameRefEffect = [
|
|
1681
|
+
{
|
|
1682
|
+
event: import_editor7.DataEvent.onValueInit,
|
|
1683
|
+
effect: (params) => {
|
|
1684
|
+
const { context, form, name } = params;
|
|
1685
|
+
const renameService = context.node.getService(import_editor7.VariableFieldKeyRenameService);
|
|
1686
|
+
const disposable = renameService.onRename(({ before, after }) => {
|
|
1687
|
+
const beforeKeyPath = [
|
|
1688
|
+
...before.parentFields.map((_field) => _field.key).reverse(),
|
|
1689
|
+
before.key
|
|
1690
|
+
];
|
|
1691
|
+
const afterKeyPath = [
|
|
1692
|
+
...after.parentFields.map((_field) => _field.key).reverse(),
|
|
1693
|
+
after.key
|
|
1694
|
+
];
|
|
1695
|
+
traverseRef(name, form.getValueIn(name), (_drilldownName, _v) => {
|
|
1696
|
+
if (isRefMatch(_v, beforeKeyPath)) {
|
|
1697
|
+
_v.content = [...afterKeyPath, ...(_v.content || [])?.slice(beforeKeyPath.length)];
|
|
1698
|
+
form.setValueIn(_drilldownName, _v);
|
|
1699
|
+
}
|
|
1700
|
+
});
|
|
1701
|
+
});
|
|
1702
|
+
return () => {
|
|
1703
|
+
disposable.dispose();
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
];
|
|
1708
|
+
function isRefMatch(value, targetKeyPath) {
|
|
1709
|
+
return targetKeyPath.every((_key, index) => _key === value.content?.[index]);
|
|
1710
|
+
}
|
|
1711
|
+
function isRef(value) {
|
|
1712
|
+
return value?.type === "ref" && Array.isArray(value?.content) && typeof value?.content[0] === "string";
|
|
1713
|
+
}
|
|
1714
|
+
function traverseRef(name, value, cb) {
|
|
1715
|
+
if ((0, import_lodash3.isObject)(value)) {
|
|
1716
|
+
if (isRef(value)) {
|
|
1717
|
+
cb(name, value);
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
Object.entries(value).forEach(([_key, _value]) => {
|
|
1721
|
+
traverseRef(`${name}.${_key}`, _value, cb);
|
|
1722
|
+
});
|
|
1723
|
+
return;
|
|
1724
|
+
}
|
|
1725
|
+
if ((0, import_lodash3.isArray)(value)) {
|
|
1726
|
+
value.forEach((_value, idx) => {
|
|
1727
|
+
traverseRef(`${name}[${idx}]`, _value, cb);
|
|
1728
|
+
});
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1412
1733
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1413
1734
|
0 && (module.exports = {
|
|
1414
1735
|
ArrayIcons,
|
|
1415
1736
|
BatchVariableSelector,
|
|
1737
|
+
ConditionRow,
|
|
1416
1738
|
ConstantInput,
|
|
1417
1739
|
DynamicValueInput,
|
|
1418
1740
|
JsonSchemaEditor,
|
|
@@ -1420,6 +1742,7 @@ function formatNewRefToLegacyRef(value) {
|
|
|
1420
1742
|
TypeSelector,
|
|
1421
1743
|
VariableSelector,
|
|
1422
1744
|
VariableTypeIcons,
|
|
1745
|
+
autoRenameRefEffect,
|
|
1423
1746
|
formatLegacyRefOnInit,
|
|
1424
1747
|
formatLegacyRefOnSubmit,
|
|
1425
1748
|
formatLegacyRefToNewRef,
|