@flowgram.ai/form-materials 0.4.6 → 0.4.7
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/{chunk-6OZSB6PD.js → chunk-727SU246.js} +6 -3
- package/dist/esm/chunk-727SU246.js.map +1 -0
- package/dist/esm/{chunk-QIJ4QVB2.js → chunk-DEZUEMUM.js} +17 -4
- package/dist/esm/chunk-DEZUEMUM.js.map +1 -0
- package/dist/esm/{chunk-G4HQ7OSI.js → chunk-MFDEE4HB.js} +5 -5
- package/dist/esm/chunk-MFDEE4HB.js.map +1 -0
- package/dist/esm/{editor-H2R7JJLO.js → editor-2YHACGQ2.js} +4 -4
- package/dist/esm/editor-2YHACGQ2.js.map +1 -0
- package/dist/esm/{editor-JX42GFAZ.js → editor-G63XGWH2.js} +5 -5
- package/dist/esm/editor-G63XGWH2.js.map +1 -0
- package/dist/esm/{editor-YMNCDGUR.js → editor-OXPGKPF5.js} +4 -4
- package/dist/esm/editor-OXPGKPF5.js.map +1 -0
- package/dist/esm/index.js +24 -23
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +336 -313
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/code-editor/index.tsx +2 -2
- package/src/components/display-inputs-values/index.tsx +1 -1
- package/src/components/dynamic-value-input/hooks.ts +1 -1
- package/src/components/inputs-values-tree/hooks/use-child-list.tsx +1 -1
- package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +1 -1
- package/src/components/json-editor-with-variables/index.tsx +2 -2
- package/src/components/json-schema-editor/hooks.tsx +1 -1
- package/src/components/prompt-editor/index.tsx +2 -2
- package/src/components/prompt-editor-with-inputs/index.tsx +2 -2
- package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +1 -1
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +1 -1
- package/src/components/prompt-editor-with-variables/index.tsx +2 -2
- package/src/effects/validate-when-variable-sync/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/hooks/use-object-list/index.tsx +1 -1
- package/src/shared/flow-value/utils.ts +1 -1
- package/src/shared/format-legacy-refs/index.ts +1 -1
- package/src/shared/index.ts +1 -0
- package/src/shared/lazy-suspense/index.tsx +28 -0
- package/src/validate/validate-flow-value/index.tsx +1 -1
- package/dist/esm/chunk-6OZSB6PD.js.map +0 -1
- package/dist/esm/chunk-G4HQ7OSI.js.map +0 -1
- package/dist/esm/chunk-QIJ4QVB2.js.map +0 -1
- package/dist/esm/editor-H2R7JJLO.js.map +0 -1
- package/dist/esm/editor-JX42GFAZ.js.map +0 -1
- package/dist/esm/editor-YMNCDGUR.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var init_cjs_shims = __esm({
|
|
|
42
42
|
|
|
43
43
|
// src/shared/format-legacy-refs/index.ts
|
|
44
44
|
function formatLegacyRefOnSubmit(value) {
|
|
45
|
-
if ((0,
|
|
45
|
+
if ((0, import_lodash_es.isObject)(value)) {
|
|
46
46
|
if (isLegacyFlowRefValueSchema(value)) {
|
|
47
47
|
return formatLegacyRefToNewRef(value);
|
|
48
48
|
}
|
|
@@ -59,7 +59,7 @@ function formatLegacyRefOnSubmit(value) {
|
|
|
59
59
|
return value;
|
|
60
60
|
}
|
|
61
61
|
function formatLegacyRefOnInit(value) {
|
|
62
|
-
if ((0,
|
|
62
|
+
if ((0, import_lodash_es.isObject)(value)) {
|
|
63
63
|
if (isNewFlowRefValueSchema(value)) {
|
|
64
64
|
return formatNewRefToLegacyRef(value);
|
|
65
65
|
}
|
|
@@ -76,10 +76,10 @@ function formatLegacyRefOnInit(value) {
|
|
|
76
76
|
return value;
|
|
77
77
|
}
|
|
78
78
|
function isLegacyFlowRefValueSchema(value) {
|
|
79
|
-
return (0,
|
|
79
|
+
return (0, import_lodash_es.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && typeof value.content === "string";
|
|
80
80
|
}
|
|
81
81
|
function isNewFlowRefValueSchema(value) {
|
|
82
|
-
return (0,
|
|
82
|
+
return (0, import_lodash_es.isObject)(value) && Object.keys(value).length === 2 && value.type === "ref" && Array.isArray(value.content);
|
|
83
83
|
}
|
|
84
84
|
function formatLegacyRefToNewRef(value) {
|
|
85
85
|
const keyPath = value.content.split(".");
|
|
@@ -100,12 +100,12 @@ function formatNewRefToLegacyRef(value) {
|
|
|
100
100
|
content: value.content.join(".")
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
var
|
|
103
|
+
var import_lodash_es;
|
|
104
104
|
var init_format_legacy_refs = __esm({
|
|
105
105
|
"src/shared/format-legacy-refs/index.ts"() {
|
|
106
106
|
"use strict";
|
|
107
107
|
init_cjs_shims();
|
|
108
|
-
|
|
108
|
+
import_lodash_es = require("lodash-es");
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
|
|
@@ -173,12 +173,12 @@ var init_schema = __esm({
|
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
// src/shared/flow-value/utils.ts
|
|
176
|
-
var
|
|
176
|
+
var import_lodash_es2, import_json_schema, FlowValueUtils;
|
|
177
177
|
var init_utils = __esm({
|
|
178
178
|
"src/shared/flow-value/utils.ts"() {
|
|
179
179
|
"use strict";
|
|
180
180
|
init_cjs_shims();
|
|
181
|
-
|
|
181
|
+
import_lodash_es2 = require("lodash-es");
|
|
182
182
|
import_json_schema = require("@flowgram.ai/json-schema");
|
|
183
183
|
init_schema();
|
|
184
184
|
((FlowValueUtils2) => {
|
|
@@ -208,7 +208,7 @@ var init_utils = __esm({
|
|
|
208
208
|
FlowValueUtils2.isFlowValue = isFlowValue;
|
|
209
209
|
function* traverse(value, options) {
|
|
210
210
|
const { includeTypes = ["ref", "template"], path = "" } = options;
|
|
211
|
-
if ((0,
|
|
211
|
+
if ((0, import_lodash_es2.isPlainObject)(value)) {
|
|
212
212
|
if (isRef(value) && includeTypes.includes("ref")) {
|
|
213
213
|
yield { value, path };
|
|
214
214
|
return;
|
|
@@ -230,7 +230,7 @@ var init_utils = __esm({
|
|
|
230
230
|
}
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
|
-
if ((0,
|
|
233
|
+
if ((0, import_lodash_es2.isArray)(value)) {
|
|
234
234
|
for (const [_idx, _value] of value.entries()) {
|
|
235
235
|
yield* traverse(_value, { ...options, path: `${path}[${_idx}]` });
|
|
236
236
|
}
|
|
@@ -241,7 +241,7 @@ var init_utils = __esm({
|
|
|
241
241
|
FlowValueUtils2.traverse = traverse;
|
|
242
242
|
function getTemplateKeyPaths(value) {
|
|
243
243
|
const keyPathReg = /\{\{([^\}\{]+)\}\}/g;
|
|
244
|
-
return (0,
|
|
244
|
+
return (0, import_lodash_es2.uniq)(value.content?.match(keyPathReg) || []).map(
|
|
245
245
|
(_keyPath) => _keyPath.slice(2, -2).split(".")
|
|
246
246
|
);
|
|
247
247
|
}
|
|
@@ -265,7 +265,7 @@ var init_utils = __esm({
|
|
|
265
265
|
type: "boolean"
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
|
-
if ((0,
|
|
268
|
+
if ((0, import_lodash_es2.isObject)(value.content)) {
|
|
269
269
|
return {
|
|
270
270
|
type: "object"
|
|
271
271
|
};
|
|
@@ -274,7 +274,7 @@ var init_utils = __esm({
|
|
|
274
274
|
}
|
|
275
275
|
FlowValueUtils2.inferConstantJsonSchema = inferConstantJsonSchema;
|
|
276
276
|
function inferJsonSchema(values, scope) {
|
|
277
|
-
if ((0,
|
|
277
|
+
if ((0, import_lodash_es2.isPlainObject)(values)) {
|
|
278
278
|
if (isConstant(values)) {
|
|
279
279
|
return inferConstantJsonSchema(values);
|
|
280
280
|
}
|
|
@@ -336,6 +336,24 @@ var init_polyfill_create_root = __esm({
|
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
338
|
|
|
339
|
+
// src/shared/lazy-suspense/index.tsx
|
|
340
|
+
function withSuspense(Component, fallback) {
|
|
341
|
+
const WithSuspenseComponent = (props) => /* @__PURE__ */ import_react2.default.createElement(import_react2.Suspense, { fallback: fallback || /* @__PURE__ */ import_react2.default.createElement(import_semi_ui.Skeleton.Paragraph, { style: { width: "100%" }, rows: 1 }) }, /* @__PURE__ */ import_react2.default.createElement(Component, { ...props }));
|
|
342
|
+
return WithSuspenseComponent;
|
|
343
|
+
}
|
|
344
|
+
function lazySuspense(params, fallback) {
|
|
345
|
+
return withSuspense((0, import_react2.lazy)(params), fallback);
|
|
346
|
+
}
|
|
347
|
+
var import_react2, import_semi_ui;
|
|
348
|
+
var init_lazy_suspense = __esm({
|
|
349
|
+
"src/shared/lazy-suspense/index.tsx"() {
|
|
350
|
+
"use strict";
|
|
351
|
+
init_cjs_shims();
|
|
352
|
+
import_react2 = __toESM(require("react"));
|
|
353
|
+
import_semi_ui = require("@douyinfe/semi-ui");
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
|
|
339
357
|
// src/shared/index.ts
|
|
340
358
|
var init_shared = __esm({
|
|
341
359
|
"src/shared/index.ts"() {
|
|
@@ -345,22 +363,23 @@ var init_shared = __esm({
|
|
|
345
363
|
init_inject_material();
|
|
346
364
|
init_flow_value();
|
|
347
365
|
init_polyfill_create_root();
|
|
366
|
+
init_lazy_suspense();
|
|
348
367
|
}
|
|
349
368
|
});
|
|
350
369
|
|
|
351
370
|
// src/plugins/json-schema-preset/type-definition/string.tsx
|
|
352
|
-
var
|
|
371
|
+
var import_react3, import_editor2, import_semi_ui2, stringRegistry;
|
|
353
372
|
var init_string = __esm({
|
|
354
373
|
"src/plugins/json-schema-preset/type-definition/string.tsx"() {
|
|
355
374
|
"use strict";
|
|
356
375
|
init_cjs_shims();
|
|
357
|
-
|
|
376
|
+
import_react3 = __toESM(require("react"));
|
|
358
377
|
import_editor2 = require("@flowgram.ai/editor");
|
|
359
|
-
|
|
378
|
+
import_semi_ui2 = require("@douyinfe/semi-ui");
|
|
360
379
|
stringRegistry = {
|
|
361
380
|
type: "string",
|
|
362
|
-
ConstantRenderer: (props) => props?.enableMultiLineStr ? /* @__PURE__ */
|
|
363
|
-
|
|
381
|
+
ConstantRenderer: (props) => props?.enableMultiLineStr ? /* @__PURE__ */ import_react3.default.createElement(
|
|
382
|
+
import_semi_ui2.TextArea,
|
|
364
383
|
{
|
|
365
384
|
autosize: true,
|
|
366
385
|
rows: 1,
|
|
@@ -368,8 +387,8 @@ var init_string = __esm({
|
|
|
368
387
|
disabled: props.readonly,
|
|
369
388
|
...props
|
|
370
389
|
}
|
|
371
|
-
) : /* @__PURE__ */
|
|
372
|
-
|
|
390
|
+
) : /* @__PURE__ */ import_react3.default.createElement(
|
|
391
|
+
import_semi_ui2.Input,
|
|
373
392
|
{
|
|
374
393
|
size: "small",
|
|
375
394
|
placeholder: import_editor2.I18n.t("Please Input String"),
|
|
@@ -753,18 +772,18 @@ function CodeEditor({
|
|
|
753
772
|
options,
|
|
754
773
|
readonly
|
|
755
774
|
}) {
|
|
756
|
-
const editorRef = (0,
|
|
757
|
-
(0,
|
|
775
|
+
const editorRef = (0, import_react4.useRef)(null);
|
|
776
|
+
(0, import_react4.useEffect)(() => {
|
|
758
777
|
if (languageId === "typescript") {
|
|
759
778
|
initTsWorker();
|
|
760
779
|
}
|
|
761
780
|
}, [languageId]);
|
|
762
|
-
(0,
|
|
781
|
+
(0, import_react4.useEffect)(() => {
|
|
763
782
|
if (editorRef.current?.getValue() !== value) {
|
|
764
783
|
editorRef.current?.setValue(String(value || ""));
|
|
765
784
|
}
|
|
766
785
|
}, [value]);
|
|
767
|
-
return /* @__PURE__ */
|
|
786
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_react5.EditorProvider, null, /* @__PURE__ */ import_react4.default.createElement(
|
|
768
787
|
OriginCodeEditor,
|
|
769
788
|
{
|
|
770
789
|
defaultValue: String(value || ""),
|
|
@@ -782,24 +801,24 @@ function CodeEditor({
|
|
|
782
801
|
},
|
|
783
802
|
onChange: (e) => onChange?.(e.value)
|
|
784
803
|
},
|
|
785
|
-
activeLinePlaceholder && /* @__PURE__ */
|
|
804
|
+
activeLinePlaceholder && /* @__PURE__ */ import_react4.default.createElement(import_react5.ActiveLinePlaceholder, null, activeLinePlaceholder),
|
|
786
805
|
children
|
|
787
806
|
));
|
|
788
807
|
}
|
|
789
|
-
var
|
|
808
|
+
var import_react4, import_react5, import_preset_code5, import_view, OriginCodeEditor;
|
|
790
809
|
var init_editor = __esm({
|
|
791
810
|
"src/components/code-editor/editor.tsx"() {
|
|
792
811
|
"use strict";
|
|
793
812
|
init_cjs_shims();
|
|
794
|
-
|
|
795
|
-
|
|
813
|
+
import_react4 = __toESM(require("react"));
|
|
814
|
+
import_react5 = require("@coze-editor/editor/react");
|
|
796
815
|
import_preset_code5 = __toESM(require("@coze-editor/editor/preset-code"));
|
|
797
816
|
import_view = require("@codemirror/view");
|
|
798
817
|
init_utils2();
|
|
799
818
|
init_language_features();
|
|
800
819
|
init_theme();
|
|
801
820
|
init_language_features();
|
|
802
|
-
OriginCodeEditor = (0,
|
|
821
|
+
OriginCodeEditor = (0, import_react5.createRenderer)(import_preset_code5.default, [
|
|
803
822
|
import_view.EditorView.theme({
|
|
804
823
|
"&.cm-focused": {
|
|
805
824
|
outline: "none"
|
|
@@ -810,13 +829,13 @@ var init_editor = __esm({
|
|
|
810
829
|
});
|
|
811
830
|
|
|
812
831
|
// src/components/code-editor/index.tsx
|
|
813
|
-
var
|
|
832
|
+
var CodeEditor2;
|
|
814
833
|
var init_code_editor = __esm({
|
|
815
834
|
"src/components/code-editor/index.tsx"() {
|
|
816
835
|
"use strict";
|
|
817
836
|
init_cjs_shims();
|
|
818
|
-
|
|
819
|
-
CodeEditor2 = (
|
|
837
|
+
init_shared();
|
|
838
|
+
CodeEditor2 = lazySuspense(
|
|
820
839
|
() => Promise.resolve().then(() => (init_editor(), editor_exports)).then((module2) => ({ default: module2.CodeEditor }))
|
|
821
840
|
);
|
|
822
841
|
}
|
|
@@ -878,18 +897,18 @@ var init_object = __esm({
|
|
|
878
897
|
});
|
|
879
898
|
|
|
880
899
|
// src/plugins/json-schema-preset/type-definition/number.tsx
|
|
881
|
-
var import_react8, import_editor5,
|
|
900
|
+
var import_react8, import_editor5, import_semi_ui3, numberRegistry;
|
|
882
901
|
var init_number = __esm({
|
|
883
902
|
"src/plugins/json-schema-preset/type-definition/number.tsx"() {
|
|
884
903
|
"use strict";
|
|
885
904
|
init_cjs_shims();
|
|
886
905
|
import_react8 = __toESM(require("react"));
|
|
887
906
|
import_editor5 = require("@flowgram.ai/editor");
|
|
888
|
-
|
|
907
|
+
import_semi_ui3 = require("@douyinfe/semi-ui");
|
|
889
908
|
numberRegistry = {
|
|
890
909
|
type: "number",
|
|
891
910
|
ConstantRenderer: (props) => /* @__PURE__ */ import_react8.default.createElement(
|
|
892
|
-
|
|
911
|
+
import_semi_ui3.InputNumber,
|
|
893
912
|
{
|
|
894
913
|
placeholder: import_editor5.I18n.t("Please Input Number"),
|
|
895
914
|
size: "small",
|
|
@@ -903,18 +922,18 @@ var init_number = __esm({
|
|
|
903
922
|
});
|
|
904
923
|
|
|
905
924
|
// src/plugins/json-schema-preset/type-definition/integer.tsx
|
|
906
|
-
var import_react9, import_editor6,
|
|
925
|
+
var import_react9, import_editor6, import_semi_ui4, integerRegistry;
|
|
907
926
|
var init_integer = __esm({
|
|
908
927
|
"src/plugins/json-schema-preset/type-definition/integer.tsx"() {
|
|
909
928
|
"use strict";
|
|
910
929
|
init_cjs_shims();
|
|
911
930
|
import_react9 = __toESM(require("react"));
|
|
912
931
|
import_editor6 = require("@flowgram.ai/editor");
|
|
913
|
-
|
|
932
|
+
import_semi_ui4 = require("@douyinfe/semi-ui");
|
|
914
933
|
integerRegistry = {
|
|
915
934
|
type: "integer",
|
|
916
935
|
ConstantRenderer: (props) => /* @__PURE__ */ import_react9.default.createElement(
|
|
917
|
-
|
|
936
|
+
import_semi_ui4.InputNumber,
|
|
918
937
|
{
|
|
919
938
|
placeholder: import_editor6.I18n.t("Please Input Integer"),
|
|
920
939
|
size: "small",
|
|
@@ -928,20 +947,20 @@ var init_integer = __esm({
|
|
|
928
947
|
});
|
|
929
948
|
|
|
930
949
|
// src/plugins/json-schema-preset/type-definition/boolean.tsx
|
|
931
|
-
var import_react10, import_editor7,
|
|
950
|
+
var import_react10, import_editor7, import_semi_ui5, booleanRegistry;
|
|
932
951
|
var init_boolean = __esm({
|
|
933
952
|
"src/plugins/json-schema-preset/type-definition/boolean.tsx"() {
|
|
934
953
|
"use strict";
|
|
935
954
|
init_cjs_shims();
|
|
936
955
|
import_react10 = __toESM(require("react"));
|
|
937
956
|
import_editor7 = require("@flowgram.ai/editor");
|
|
938
|
-
|
|
957
|
+
import_semi_ui5 = require("@douyinfe/semi-ui");
|
|
939
958
|
booleanRegistry = {
|
|
940
959
|
type: "boolean",
|
|
941
960
|
ConstantRenderer: (props) => {
|
|
942
961
|
const { value, onChange, ...rest } = props;
|
|
943
962
|
return /* @__PURE__ */ import_react10.default.createElement(
|
|
944
|
-
|
|
963
|
+
import_semi_ui5.Select,
|
|
945
964
|
{
|
|
946
965
|
placeholder: import_editor7.I18n.t("Please Select Boolean"),
|
|
947
966
|
size: "small",
|
|
@@ -1108,7 +1127,7 @@ function useVariableTree(params) {
|
|
|
1108
1127
|
return variable.meta.icon;
|
|
1109
1128
|
}
|
|
1110
1129
|
const schema = import_json_schema5.JsonSchemaUtils.astToSchema(variable.type, { drilldownObject: false });
|
|
1111
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1130
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_semi_ui6.Icon, { size: "small", svg: typeManager.getDisplayIcon(schema || {}) });
|
|
1112
1131
|
}, []);
|
|
1113
1132
|
const renderVariable = (variable, parentFields = []) => {
|
|
1114
1133
|
let type = variable?.type;
|
|
@@ -1143,7 +1162,7 @@ function useVariableTree(params) {
|
|
|
1143
1162
|
};
|
|
1144
1163
|
return [...variables.slice(0).reverse()].map((_variable) => renderVariable(_variable)).filter(Boolean);
|
|
1145
1164
|
}
|
|
1146
|
-
var import_react13, import_json_schema5, import_editor11,
|
|
1165
|
+
var import_react13, import_json_schema5, import_editor11, import_semi_ui6;
|
|
1147
1166
|
var init_use_variable_tree = __esm({
|
|
1148
1167
|
"src/components/variable-selector/use-variable-tree.tsx"() {
|
|
1149
1168
|
"use strict";
|
|
@@ -1151,19 +1170,19 @@ var init_use_variable_tree = __esm({
|
|
|
1151
1170
|
import_react13 = __toESM(require("react"));
|
|
1152
1171
|
import_json_schema5 = require("@flowgram.ai/json-schema");
|
|
1153
1172
|
import_editor11 = require("@flowgram.ai/editor");
|
|
1154
|
-
|
|
1173
|
+
import_semi_ui6 = require("@douyinfe/semi-ui");
|
|
1155
1174
|
init_plugins();
|
|
1156
1175
|
}
|
|
1157
1176
|
});
|
|
1158
1177
|
|
|
1159
1178
|
// src/components/variable-selector/styles.tsx
|
|
1160
|
-
var import_styled_components2,
|
|
1179
|
+
var import_styled_components2, import_semi_ui7, UIRootTitle, UIVarName, UITag, UITreeSelect, UIPopoverContent;
|
|
1161
1180
|
var init_styles = __esm({
|
|
1162
1181
|
"src/components/variable-selector/styles.tsx"() {
|
|
1163
1182
|
"use strict";
|
|
1164
1183
|
init_cjs_shims();
|
|
1165
1184
|
import_styled_components2 = __toESM(require("styled-components"));
|
|
1166
|
-
|
|
1185
|
+
import_semi_ui7 = require("@douyinfe/semi-ui");
|
|
1167
1186
|
UIRootTitle = import_styled_components2.default.div`
|
|
1168
1187
|
margin-right: 4px;
|
|
1169
1188
|
min-width: 20px;
|
|
@@ -1181,7 +1200,7 @@ var init_styles = __esm({
|
|
|
1181
1200
|
min-width: 50%;
|
|
1182
1201
|
`}
|
|
1183
1202
|
`;
|
|
1184
|
-
UITag = (0, import_styled_components2.default)(
|
|
1203
|
+
UITag = (0, import_styled_components2.default)(import_semi_ui7.Tag)`
|
|
1185
1204
|
width: 100%;
|
|
1186
1205
|
display: flex;
|
|
1187
1206
|
align-items: center;
|
|
@@ -1196,7 +1215,7 @@ var init_styles = __esm({
|
|
|
1196
1215
|
height: 22px;
|
|
1197
1216
|
}
|
|
1198
1217
|
`;
|
|
1199
|
-
UITreeSelect = (0, import_styled_components2.default)(
|
|
1218
|
+
UITreeSelect = (0, import_styled_components2.default)(import_semi_ui7.TreeSelect)`
|
|
1200
1219
|
outline: ${({ $error }) => $error ? "1px solid red" : "none"};
|
|
1201
1220
|
|
|
1202
1221
|
& .semi-tree-select-selection {
|
|
@@ -1223,14 +1242,14 @@ var init_styles = __esm({
|
|
|
1223
1242
|
});
|
|
1224
1243
|
|
|
1225
1244
|
// src/components/variable-selector/index.tsx
|
|
1226
|
-
var import_react14, import_editor12,
|
|
1245
|
+
var import_react14, import_editor12, import_semi_ui8, import_semi_icons, VariableSelector, InjectVariableSelector;
|
|
1227
1246
|
var init_variable_selector = __esm({
|
|
1228
1247
|
"src/components/variable-selector/index.tsx"() {
|
|
1229
1248
|
"use strict";
|
|
1230
1249
|
init_cjs_shims();
|
|
1231
1250
|
import_react14 = __toESM(require("react"));
|
|
1232
1251
|
import_editor12 = require("@flowgram.ai/editor");
|
|
1233
|
-
|
|
1252
|
+
import_semi_ui8 = require("@douyinfe/semi-ui");
|
|
1234
1253
|
import_semi_icons = require("@douyinfe/semi-icons");
|
|
1235
1254
|
init_shared();
|
|
1236
1255
|
init_use_variable_tree();
|
|
@@ -1294,7 +1313,7 @@ var init_variable_selector = __esm({
|
|
|
1294
1313
|
const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
|
|
1295
1314
|
const rootTitle = /* @__PURE__ */ import_react14.default.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
|
|
1296
1315
|
return /* @__PURE__ */ import_react14.default.createElement("div", null, /* @__PURE__ */ import_react14.default.createElement(
|
|
1297
|
-
|
|
1316
|
+
import_semi_ui8.Popover,
|
|
1298
1317
|
{
|
|
1299
1318
|
content: /* @__PURE__ */ import_react14.default.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ import_react14.default.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
|
|
1300
1319
|
},
|
|
@@ -1537,13 +1556,13 @@ var init_editor2 = __esm({
|
|
|
1537
1556
|
});
|
|
1538
1557
|
|
|
1539
1558
|
// src/components/prompt-editor/index.tsx
|
|
1540
|
-
var
|
|
1559
|
+
var PromptEditor2;
|
|
1541
1560
|
var init_prompt_editor = __esm({
|
|
1542
1561
|
"src/components/prompt-editor/index.tsx"() {
|
|
1543
1562
|
"use strict";
|
|
1544
1563
|
init_cjs_shims();
|
|
1545
|
-
|
|
1546
|
-
PromptEditor2 = (
|
|
1564
|
+
init_shared();
|
|
1565
|
+
PromptEditor2 = lazySuspense(
|
|
1547
1566
|
() => Promise.resolve().then(() => (init_editor2(), editor_exports2)).then((module2) => ({ default: module2.PromptEditor }))
|
|
1548
1567
|
);
|
|
1549
1568
|
}
|
|
@@ -1551,12 +1570,12 @@ var init_prompt_editor = __esm({
|
|
|
1551
1570
|
|
|
1552
1571
|
// src/components/prompt-editor-with-variables/extensions/variable-tree.tsx
|
|
1553
1572
|
function VariableTree() {
|
|
1554
|
-
const [posKey, setPosKey] = (0,
|
|
1555
|
-
const [visible, setVisible] = (0,
|
|
1556
|
-
const [position, setPosition] = (0,
|
|
1557
|
-
const editor = (0,
|
|
1573
|
+
const [posKey, setPosKey] = (0, import_react42.useState)("");
|
|
1574
|
+
const [visible, setVisible] = (0, import_react42.useState)(false);
|
|
1575
|
+
const [position, setPosition] = (0, import_react42.useState)(-1);
|
|
1576
|
+
const editor = (0, import_react43.useEditor)();
|
|
1558
1577
|
function insert(variablePath) {
|
|
1559
|
-
const range = (0,
|
|
1578
|
+
const range = (0, import_react43.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
1560
1579
|
if (!range) {
|
|
1561
1580
|
return;
|
|
1562
1581
|
}
|
|
@@ -1578,21 +1597,21 @@ function VariableTree() {
|
|
|
1578
1597
|
setPosition(e.state.selection.main.head);
|
|
1579
1598
|
setVisible(e.value);
|
|
1580
1599
|
}
|
|
1581
|
-
(0,
|
|
1600
|
+
(0, import_react42.useEffect)(() => {
|
|
1582
1601
|
if (!editor) {
|
|
1583
1602
|
return;
|
|
1584
1603
|
}
|
|
1585
1604
|
}, [editor, visible]);
|
|
1586
1605
|
const treeData = useVariableTree({});
|
|
1587
|
-
return /* @__PURE__ */
|
|
1588
|
-
|
|
1606
|
+
return /* @__PURE__ */ import_react42.default.createElement(import_react42.default.Fragment, null, /* @__PURE__ */ import_react42.default.createElement(import_react43.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react42.default.createElement(
|
|
1607
|
+
import_semi_ui20.Popover,
|
|
1589
1608
|
{
|
|
1590
1609
|
visible,
|
|
1591
1610
|
trigger: "custom",
|
|
1592
1611
|
position: "topLeft",
|
|
1593
1612
|
rePosKey: posKey,
|
|
1594
|
-
content: /* @__PURE__ */
|
|
1595
|
-
|
|
1613
|
+
content: /* @__PURE__ */ import_react42.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react42.default.createElement(
|
|
1614
|
+
import_semi_ui20.Tree,
|
|
1596
1615
|
{
|
|
1597
1616
|
treeData,
|
|
1598
1617
|
onSelect: (v) => {
|
|
@@ -1601,8 +1620,8 @@ function VariableTree() {
|
|
|
1601
1620
|
}
|
|
1602
1621
|
))
|
|
1603
1622
|
},
|
|
1604
|
-
/* @__PURE__ */
|
|
1605
|
-
|
|
1623
|
+
/* @__PURE__ */ import_react42.default.createElement(
|
|
1624
|
+
import_react43.PositionMirror,
|
|
1606
1625
|
{
|
|
1607
1626
|
position,
|
|
1608
1627
|
onChange: () => setPosKey(String(Math.random()))
|
|
@@ -1610,26 +1629,26 @@ function VariableTree() {
|
|
|
1610
1629
|
)
|
|
1611
1630
|
));
|
|
1612
1631
|
}
|
|
1613
|
-
var
|
|
1632
|
+
var import_react42, import_semi_ui20, import_react43;
|
|
1614
1633
|
var init_variable_tree = __esm({
|
|
1615
1634
|
"src/components/prompt-editor-with-variables/extensions/variable-tree.tsx"() {
|
|
1616
1635
|
"use strict";
|
|
1617
1636
|
init_cjs_shims();
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1637
|
+
import_react42 = __toESM(require("react"));
|
|
1638
|
+
import_semi_ui20 = require("@douyinfe/semi-ui");
|
|
1639
|
+
import_react43 = require("@coze-editor/editor/react");
|
|
1621
1640
|
init_variable_selector();
|
|
1622
1641
|
}
|
|
1623
1642
|
});
|
|
1624
1643
|
|
|
1625
1644
|
// src/components/prompt-editor-with-variables/styles.tsx
|
|
1626
|
-
var import_styled_components9,
|
|
1645
|
+
var import_styled_components9, import_semi_ui21, UIRootTitle2, UIVarName2, UITag2, UIPopoverContent2;
|
|
1627
1646
|
var init_styles3 = __esm({
|
|
1628
1647
|
"src/components/prompt-editor-with-variables/styles.tsx"() {
|
|
1629
1648
|
"use strict";
|
|
1630
1649
|
init_cjs_shims();
|
|
1631
1650
|
import_styled_components9 = __toESM(require("styled-components"));
|
|
1632
|
-
|
|
1651
|
+
import_semi_ui21 = require("@douyinfe/semi-ui");
|
|
1633
1652
|
UIRootTitle2 = import_styled_components9.default.div`
|
|
1634
1653
|
margin-right: 4px;
|
|
1635
1654
|
min-width: 20px;
|
|
@@ -1643,7 +1662,7 @@ var init_styles3 = __esm({
|
|
|
1643
1662
|
text-overflow: ellipsis;
|
|
1644
1663
|
white-space: nowrap;
|
|
1645
1664
|
`;
|
|
1646
|
-
UITag2 = (0, import_styled_components9.default)(
|
|
1665
|
+
UITag2 = (0, import_styled_components9.default)(import_semi_ui21.Tag)`
|
|
1647
1666
|
display: inline-flex;
|
|
1648
1667
|
align-items: center;
|
|
1649
1668
|
justify-content: flex-start;
|
|
@@ -1668,9 +1687,9 @@ var init_styles3 = __esm({
|
|
|
1668
1687
|
|
|
1669
1688
|
// src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
|
|
1670
1689
|
function VariableTagInject() {
|
|
1671
|
-
const injector = (0,
|
|
1690
|
+
const injector = (0, import_react45.useInjector)();
|
|
1672
1691
|
const scope = (0, import_editor25.useCurrentScope)();
|
|
1673
|
-
(0,
|
|
1692
|
+
(0, import_react44.useLayoutEffect)(() => {
|
|
1674
1693
|
const atMatcher = new import_view4.MatchDecorator({
|
|
1675
1694
|
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
1676
1695
|
decoration: (match) => import_view4.Decoration.replace({
|
|
@@ -1704,17 +1723,17 @@ function VariableTagInject() {
|
|
|
1704
1723
|
}, [injector]);
|
|
1705
1724
|
return null;
|
|
1706
1725
|
}
|
|
1707
|
-
var
|
|
1726
|
+
var import_react44, import_lodash_es5, import_editor25, import_semi_ui22, import_semi_icons8, import_react45, import_view4, VariableTagWidget;
|
|
1708
1727
|
var init_variable_tag = __esm({
|
|
1709
1728
|
"src/components/prompt-editor-with-variables/extensions/variable-tag.tsx"() {
|
|
1710
1729
|
"use strict";
|
|
1711
1730
|
init_cjs_shims();
|
|
1712
|
-
|
|
1713
|
-
|
|
1731
|
+
import_react44 = __toESM(require("react"));
|
|
1732
|
+
import_lodash_es5 = require("lodash-es");
|
|
1714
1733
|
import_editor25 = require("@flowgram.ai/editor");
|
|
1715
|
-
|
|
1734
|
+
import_semi_ui22 = require("@douyinfe/semi-ui");
|
|
1716
1735
|
import_semi_icons8 = require("@douyinfe/semi-icons");
|
|
1717
|
-
|
|
1736
|
+
import_react45 = require("@coze-editor/editor/react");
|
|
1718
1737
|
import_view4 = require("@codemirror/view");
|
|
1719
1738
|
init_shared();
|
|
1720
1739
|
init_styles3();
|
|
@@ -1724,7 +1743,7 @@ var init_variable_tag = __esm({
|
|
|
1724
1743
|
this.toDispose = new import_editor25.DisposableCollection();
|
|
1725
1744
|
this.renderIcon = (icon) => {
|
|
1726
1745
|
if (typeof icon === "string") {
|
|
1727
|
-
return /* @__PURE__ */
|
|
1746
|
+
return /* @__PURE__ */ import_react44.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
1728
1747
|
}
|
|
1729
1748
|
return icon;
|
|
1730
1749
|
};
|
|
@@ -1734,20 +1753,20 @@ var init_variable_tag = __esm({
|
|
|
1734
1753
|
renderVariable(v) {
|
|
1735
1754
|
if (!v) {
|
|
1736
1755
|
this.root.render(
|
|
1737
|
-
/* @__PURE__ */
|
|
1756
|
+
/* @__PURE__ */ import_react44.default.createElement(UITag2, { prefixIcon: /* @__PURE__ */ import_react44.default.createElement(import_semi_icons8.IconIssueStroked, null), color: "amber" }, "Unknown")
|
|
1738
1757
|
);
|
|
1739
1758
|
return;
|
|
1740
1759
|
}
|
|
1741
|
-
const rootField = (0,
|
|
1742
|
-
const rootTitle = /* @__PURE__ */
|
|
1760
|
+
const rootField = (0, import_lodash_es5.last)(v.parentFields);
|
|
1761
|
+
const rootTitle = /* @__PURE__ */ import_react44.default.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
|
|
1743
1762
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
1744
1763
|
this.root.render(
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
|
|
1764
|
+
/* @__PURE__ */ import_react44.default.createElement(
|
|
1765
|
+
import_semi_ui22.Popover,
|
|
1747
1766
|
{
|
|
1748
|
-
content: /* @__PURE__ */
|
|
1767
|
+
content: /* @__PURE__ */ import_react44.default.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ import_react44.default.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
|
|
1749
1768
|
},
|
|
1750
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ import_react44.default.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ import_react44.default.createElement(UIVarName2, null, v?.key))
|
|
1751
1770
|
)
|
|
1752
1771
|
);
|
|
1753
1772
|
}
|
|
@@ -1772,7 +1791,7 @@ var init_variable_tag = __esm({
|
|
|
1772
1791
|
return dom;
|
|
1773
1792
|
}
|
|
1774
1793
|
eq(other) {
|
|
1775
|
-
return (0,
|
|
1794
|
+
return (0, import_lodash_es5.isEqual)(this.keyPath, other.keyPath);
|
|
1776
1795
|
}
|
|
1777
1796
|
ignoreEvent() {
|
|
1778
1797
|
return false;
|
|
@@ -1790,14 +1809,14 @@ __export(editor_exports3, {
|
|
|
1790
1809
|
PromptEditorWithVariables: () => PromptEditorWithVariables
|
|
1791
1810
|
});
|
|
1792
1811
|
function PromptEditorWithVariables(props) {
|
|
1793
|
-
return /* @__PURE__ */
|
|
1812
|
+
return /* @__PURE__ */ import_react46.default.createElement(PromptEditor2, { ...props }, /* @__PURE__ */ import_react46.default.createElement(VariableTree, null), /* @__PURE__ */ import_react46.default.createElement(VariableTagInject, null));
|
|
1794
1813
|
}
|
|
1795
|
-
var
|
|
1814
|
+
var import_react46;
|
|
1796
1815
|
var init_editor3 = __esm({
|
|
1797
1816
|
"src/components/prompt-editor-with-variables/editor.tsx"() {
|
|
1798
1817
|
"use strict";
|
|
1799
1818
|
init_cjs_shims();
|
|
1800
|
-
|
|
1819
|
+
import_react46 = __toESM(require("react"));
|
|
1801
1820
|
init_prompt_editor();
|
|
1802
1821
|
init_variable_tree();
|
|
1803
1822
|
init_variable_tag();
|
|
@@ -1837,7 +1856,7 @@ function InputsPicker({
|
|
|
1837
1856
|
const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
|
|
1838
1857
|
return {
|
|
1839
1858
|
key,
|
|
1840
|
-
label: (0,
|
|
1859
|
+
label: (0, import_lodash_es6.last)(keyPath),
|
|
1841
1860
|
value: key,
|
|
1842
1861
|
children
|
|
1843
1862
|
};
|
|
@@ -1854,45 +1873,45 @@ function InputsPicker({
|
|
|
1854
1873
|
return {
|
|
1855
1874
|
key: currKey,
|
|
1856
1875
|
value: currKey,
|
|
1857
|
-
label: (0,
|
|
1876
|
+
label: (0, import_lodash_es6.last)(keyPath)
|
|
1858
1877
|
};
|
|
1859
1878
|
}
|
|
1860
|
-
if ((0,
|
|
1879
|
+
if ((0, import_lodash_es6.isPlainObject)(value)) {
|
|
1861
1880
|
return {
|
|
1862
1881
|
key: currKey,
|
|
1863
1882
|
value: currKey,
|
|
1864
|
-
label: (0,
|
|
1883
|
+
label: (0, import_lodash_es6.last)(keyPath),
|
|
1865
1884
|
children: Object.entries(value).map(([key, value2]) => getTreeData(value2, [...keyPath, key])).filter(Boolean)
|
|
1866
1885
|
};
|
|
1867
1886
|
}
|
|
1868
1887
|
};
|
|
1869
|
-
const treeData = (0,
|
|
1888
|
+
const treeData = (0, import_react47.useMemo)(
|
|
1870
1889
|
() => Object.entries(inputsValues).map(([key, value]) => getTreeData(value, [key])).filter(Boolean),
|
|
1871
1890
|
[]
|
|
1872
1891
|
);
|
|
1873
|
-
return /* @__PURE__ */
|
|
1892
|
+
return /* @__PURE__ */ import_react47.default.createElement(import_semi_ui23.Tree, { treeData, onSelect: (v) => onSelect(v) });
|
|
1874
1893
|
}
|
|
1875
|
-
var
|
|
1894
|
+
var import_react47, import_lodash_es6, import_editor26, import_semi_ui23;
|
|
1876
1895
|
var init_inputs_picker = __esm({
|
|
1877
1896
|
"src/components/prompt-editor-with-inputs/inputs-picker.tsx"() {
|
|
1878
1897
|
"use strict";
|
|
1879
1898
|
init_cjs_shims();
|
|
1880
|
-
|
|
1881
|
-
|
|
1899
|
+
import_react47 = __toESM(require("react"));
|
|
1900
|
+
import_lodash_es6 = require("lodash-es");
|
|
1882
1901
|
import_editor26 = require("@flowgram.ai/editor");
|
|
1883
|
-
|
|
1902
|
+
import_semi_ui23 = require("@douyinfe/semi-ui");
|
|
1884
1903
|
init_shared();
|
|
1885
1904
|
}
|
|
1886
1905
|
});
|
|
1887
1906
|
|
|
1888
1907
|
// src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx
|
|
1889
1908
|
function InputsTree({ inputsValues }) {
|
|
1890
|
-
const [posKey, setPosKey] = (0,
|
|
1891
|
-
const [visible, setVisible] = (0,
|
|
1892
|
-
const [position, setPosition] = (0,
|
|
1893
|
-
const editor = (0,
|
|
1909
|
+
const [posKey, setPosKey] = (0, import_react48.useState)("");
|
|
1910
|
+
const [visible, setVisible] = (0, import_react48.useState)(false);
|
|
1911
|
+
const [position, setPosition] = (0, import_react48.useState)(-1);
|
|
1912
|
+
const editor = (0, import_react49.useEditor)();
|
|
1894
1913
|
function insert(variablePath) {
|
|
1895
|
-
const range = (0,
|
|
1914
|
+
const range = (0, import_react49.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
1896
1915
|
if (!range) {
|
|
1897
1916
|
return;
|
|
1898
1917
|
}
|
|
@@ -1913,19 +1932,19 @@ function InputsTree({ inputsValues }) {
|
|
|
1913
1932
|
setPosition(e.state.selection.main.head);
|
|
1914
1933
|
setVisible(e.value);
|
|
1915
1934
|
}
|
|
1916
|
-
(0,
|
|
1935
|
+
(0, import_react48.useEffect)(() => {
|
|
1917
1936
|
if (!editor) {
|
|
1918
1937
|
return;
|
|
1919
1938
|
}
|
|
1920
1939
|
}, [editor, visible]);
|
|
1921
|
-
return /* @__PURE__ */
|
|
1922
|
-
|
|
1940
|
+
return /* @__PURE__ */ import_react48.default.createElement(import_react48.default.Fragment, null, /* @__PURE__ */ import_react48.default.createElement(import_react49.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react48.default.createElement(
|
|
1941
|
+
import_semi_ui24.Popover,
|
|
1923
1942
|
{
|
|
1924
1943
|
visible,
|
|
1925
1944
|
trigger: "custom",
|
|
1926
1945
|
position: "topLeft",
|
|
1927
1946
|
rePosKey: posKey,
|
|
1928
|
-
content: /* @__PURE__ */
|
|
1947
|
+
content: /* @__PURE__ */ import_react48.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react48.default.createElement(
|
|
1929
1948
|
InputsPicker,
|
|
1930
1949
|
{
|
|
1931
1950
|
inputsValues,
|
|
@@ -1935,8 +1954,8 @@ function InputsTree({ inputsValues }) {
|
|
|
1935
1954
|
}
|
|
1936
1955
|
))
|
|
1937
1956
|
},
|
|
1938
|
-
/* @__PURE__ */
|
|
1939
|
-
|
|
1957
|
+
/* @__PURE__ */ import_react48.default.createElement(
|
|
1958
|
+
import_react49.PositionMirror,
|
|
1940
1959
|
{
|
|
1941
1960
|
position,
|
|
1942
1961
|
onChange: () => setPosKey(String(Math.random()))
|
|
@@ -1944,14 +1963,14 @@ function InputsTree({ inputsValues }) {
|
|
|
1944
1963
|
)
|
|
1945
1964
|
));
|
|
1946
1965
|
}
|
|
1947
|
-
var
|
|
1966
|
+
var import_react48, import_semi_ui24, import_react49;
|
|
1948
1967
|
var init_inputs_tree = __esm({
|
|
1949
1968
|
"src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx"() {
|
|
1950
1969
|
"use strict";
|
|
1951
1970
|
init_cjs_shims();
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1971
|
+
import_react48 = __toESM(require("react"));
|
|
1972
|
+
import_semi_ui24 = require("@douyinfe/semi-ui");
|
|
1973
|
+
import_react49 = require("@coze-editor/editor/react");
|
|
1955
1974
|
init_inputs_picker();
|
|
1956
1975
|
}
|
|
1957
1976
|
});
|
|
@@ -1965,14 +1984,14 @@ function PromptEditorWithInputs({
|
|
|
1965
1984
|
inputsValues,
|
|
1966
1985
|
...restProps
|
|
1967
1986
|
}) {
|
|
1968
|
-
return /* @__PURE__ */
|
|
1987
|
+
return /* @__PURE__ */ import_react50.default.createElement(PromptEditor2, { ...restProps }, /* @__PURE__ */ import_react50.default.createElement(InputsTree, { inputsValues }));
|
|
1969
1988
|
}
|
|
1970
|
-
var
|
|
1989
|
+
var import_react50;
|
|
1971
1990
|
var init_editor4 = __esm({
|
|
1972
1991
|
"src/components/prompt-editor-with-inputs/editor.tsx"() {
|
|
1973
1992
|
"use strict";
|
|
1974
1993
|
init_cjs_shims();
|
|
1975
|
-
|
|
1994
|
+
import_react50 = __toESM(require("react"));
|
|
1976
1995
|
init_prompt_editor();
|
|
1977
1996
|
init_inputs_tree();
|
|
1978
1997
|
}
|
|
@@ -1980,12 +1999,12 @@ var init_editor4 = __esm({
|
|
|
1980
1999
|
|
|
1981
2000
|
// src/components/json-editor-with-variables/extensions/variable-tree.tsx
|
|
1982
2001
|
function VariableTree2() {
|
|
1983
|
-
const [posKey, setPosKey] = (0,
|
|
1984
|
-
const [visible, setVisible] = (0,
|
|
1985
|
-
const [position, setPosition] = (0,
|
|
1986
|
-
const editor = (0,
|
|
2002
|
+
const [posKey, setPosKey] = (0, import_react51.useState)("");
|
|
2003
|
+
const [visible, setVisible] = (0, import_react51.useState)(false);
|
|
2004
|
+
const [position, setPosition] = (0, import_react51.useState)(-1);
|
|
2005
|
+
const editor = (0, import_react52.useEditor)();
|
|
1987
2006
|
function insert(variablePath) {
|
|
1988
|
-
const range = (0,
|
|
2007
|
+
const range = (0, import_react52.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
1989
2008
|
if (!range) {
|
|
1990
2009
|
return;
|
|
1991
2010
|
}
|
|
@@ -1999,21 +2018,21 @@ function VariableTree2() {
|
|
|
1999
2018
|
setPosition(e.state.selection.main.head);
|
|
2000
2019
|
setVisible(e.value);
|
|
2001
2020
|
}
|
|
2002
|
-
(0,
|
|
2021
|
+
(0, import_react51.useEffect)(() => {
|
|
2003
2022
|
if (!editor) {
|
|
2004
2023
|
return;
|
|
2005
2024
|
}
|
|
2006
2025
|
}, [editor, visible]);
|
|
2007
2026
|
const treeData = useVariableTree({});
|
|
2008
|
-
return /* @__PURE__ */
|
|
2009
|
-
|
|
2027
|
+
return /* @__PURE__ */ import_react51.default.createElement(import_react51.default.Fragment, null, /* @__PURE__ */ import_react51.default.createElement(import_react52.Mention, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react51.default.createElement(
|
|
2028
|
+
import_semi_ui25.Popover,
|
|
2010
2029
|
{
|
|
2011
2030
|
visible,
|
|
2012
2031
|
trigger: "custom",
|
|
2013
2032
|
position: "topLeft",
|
|
2014
2033
|
rePosKey: posKey,
|
|
2015
|
-
content: /* @__PURE__ */
|
|
2016
|
-
|
|
2034
|
+
content: /* @__PURE__ */ import_react51.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react51.default.createElement(
|
|
2035
|
+
import_semi_ui25.Tree,
|
|
2017
2036
|
{
|
|
2018
2037
|
treeData,
|
|
2019
2038
|
onSelect: (v) => {
|
|
@@ -2022,8 +2041,8 @@ function VariableTree2() {
|
|
|
2022
2041
|
}
|
|
2023
2042
|
))
|
|
2024
2043
|
},
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
|
|
2044
|
+
/* @__PURE__ */ import_react51.default.createElement(
|
|
2045
|
+
import_react52.PositionMirror,
|
|
2027
2046
|
{
|
|
2028
2047
|
position,
|
|
2029
2048
|
onChange: () => setPosKey(String(Math.random()))
|
|
@@ -2031,26 +2050,26 @@ function VariableTree2() {
|
|
|
2031
2050
|
)
|
|
2032
2051
|
));
|
|
2033
2052
|
}
|
|
2034
|
-
var
|
|
2053
|
+
var import_react51, import_semi_ui25, import_react52;
|
|
2035
2054
|
var init_variable_tree2 = __esm({
|
|
2036
2055
|
"src/components/json-editor-with-variables/extensions/variable-tree.tsx"() {
|
|
2037
2056
|
"use strict";
|
|
2038
2057
|
init_cjs_shims();
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2058
|
+
import_react51 = __toESM(require("react"));
|
|
2059
|
+
import_semi_ui25 = require("@douyinfe/semi-ui");
|
|
2060
|
+
import_react52 = require("@coze-editor/editor/react");
|
|
2042
2061
|
init_variable_selector();
|
|
2043
2062
|
}
|
|
2044
2063
|
});
|
|
2045
2064
|
|
|
2046
2065
|
// src/components/json-editor-with-variables/styles.tsx
|
|
2047
|
-
var import_styled_components10,
|
|
2066
|
+
var import_styled_components10, import_semi_ui26, UIRootTitle3, UIVarName3, UITag3, UIPopoverContent3;
|
|
2048
2067
|
var init_styles4 = __esm({
|
|
2049
2068
|
"src/components/json-editor-with-variables/styles.tsx"() {
|
|
2050
2069
|
"use strict";
|
|
2051
2070
|
init_cjs_shims();
|
|
2052
2071
|
import_styled_components10 = __toESM(require("styled-components"));
|
|
2053
|
-
|
|
2072
|
+
import_semi_ui26 = require("@douyinfe/semi-ui");
|
|
2054
2073
|
UIRootTitle3 = import_styled_components10.default.div`
|
|
2055
2074
|
margin-right: 4px;
|
|
2056
2075
|
min-width: 20px;
|
|
@@ -2064,7 +2083,7 @@ var init_styles4 = __esm({
|
|
|
2064
2083
|
text-overflow: ellipsis;
|
|
2065
2084
|
white-space: nowrap;
|
|
2066
2085
|
`;
|
|
2067
|
-
UITag3 = (0, import_styled_components10.default)(
|
|
2086
|
+
UITag3 = (0, import_styled_components10.default)(import_semi_ui26.Tag)`
|
|
2068
2087
|
display: inline-flex;
|
|
2069
2088
|
align-items: center;
|
|
2070
2089
|
justify-content: flex-start;
|
|
@@ -2089,9 +2108,9 @@ var init_styles4 = __esm({
|
|
|
2089
2108
|
|
|
2090
2109
|
// src/components/json-editor-with-variables/extensions/variable-tag.tsx
|
|
2091
2110
|
function VariableTagInject2() {
|
|
2092
|
-
const injector = (0,
|
|
2111
|
+
const injector = (0, import_react54.useInjector)();
|
|
2093
2112
|
const scope = (0, import_editor27.useCurrentScope)();
|
|
2094
|
-
(0,
|
|
2113
|
+
(0, import_react53.useLayoutEffect)(() => {
|
|
2095
2114
|
const atMatcher = new import_view5.MatchDecorator({
|
|
2096
2115
|
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
2097
2116
|
decoration: (match) => import_view5.Decoration.replace({
|
|
@@ -2125,17 +2144,17 @@ function VariableTagInject2() {
|
|
|
2125
2144
|
}, [injector]);
|
|
2126
2145
|
return null;
|
|
2127
2146
|
}
|
|
2128
|
-
var
|
|
2147
|
+
var import_react53, import_lodash_es7, import_editor27, import_semi_ui27, import_semi_icons9, import_react54, import_view5, VariableTagWidget2;
|
|
2129
2148
|
var init_variable_tag2 = __esm({
|
|
2130
2149
|
"src/components/json-editor-with-variables/extensions/variable-tag.tsx"() {
|
|
2131
2150
|
"use strict";
|
|
2132
2151
|
init_cjs_shims();
|
|
2133
|
-
|
|
2134
|
-
|
|
2152
|
+
import_react53 = __toESM(require("react"));
|
|
2153
|
+
import_lodash_es7 = require("lodash-es");
|
|
2135
2154
|
import_editor27 = require("@flowgram.ai/editor");
|
|
2136
|
-
|
|
2155
|
+
import_semi_ui27 = require("@douyinfe/semi-ui");
|
|
2137
2156
|
import_semi_icons9 = require("@douyinfe/semi-icons");
|
|
2138
|
-
|
|
2157
|
+
import_react54 = require("@coze-editor/editor/react");
|
|
2139
2158
|
import_view5 = require("@codemirror/view");
|
|
2140
2159
|
init_shared();
|
|
2141
2160
|
init_styles4();
|
|
@@ -2145,7 +2164,7 @@ var init_variable_tag2 = __esm({
|
|
|
2145
2164
|
this.toDispose = new import_editor27.DisposableCollection();
|
|
2146
2165
|
this.renderIcon = (icon) => {
|
|
2147
2166
|
if (typeof icon === "string") {
|
|
2148
|
-
return /* @__PURE__ */
|
|
2167
|
+
return /* @__PURE__ */ import_react53.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
2149
2168
|
}
|
|
2150
2169
|
return icon;
|
|
2151
2170
|
};
|
|
@@ -2155,20 +2174,20 @@ var init_variable_tag2 = __esm({
|
|
|
2155
2174
|
renderVariable(v) {
|
|
2156
2175
|
if (!v) {
|
|
2157
2176
|
this.root.render(
|
|
2158
|
-
/* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ import_react53.default.createElement(UITag3, { prefixIcon: /* @__PURE__ */ import_react53.default.createElement(import_semi_icons9.IconIssueStroked, null), color: "amber" }, "Unknown")
|
|
2159
2178
|
);
|
|
2160
2179
|
return;
|
|
2161
2180
|
}
|
|
2162
|
-
const rootField = (0,
|
|
2163
|
-
const rootTitle = /* @__PURE__ */
|
|
2181
|
+
const rootField = (0, import_lodash_es7.last)(v.parentFields);
|
|
2182
|
+
const rootTitle = /* @__PURE__ */ import_react53.default.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
|
|
2164
2183
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
2165
2184
|
this.root.render(
|
|
2166
|
-
/* @__PURE__ */
|
|
2167
|
-
|
|
2185
|
+
/* @__PURE__ */ import_react53.default.createElement(
|
|
2186
|
+
import_semi_ui27.Popover,
|
|
2168
2187
|
{
|
|
2169
|
-
content: /* @__PURE__ */
|
|
2188
|
+
content: /* @__PURE__ */ import_react53.default.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ import_react53.default.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
|
|
2170
2189
|
},
|
|
2171
|
-
/* @__PURE__ */
|
|
2190
|
+
/* @__PURE__ */ import_react53.default.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ import_react53.default.createElement(UIVarName3, null, v?.key))
|
|
2172
2191
|
)
|
|
2173
2192
|
);
|
|
2174
2193
|
}
|
|
@@ -2193,7 +2212,7 @@ var init_variable_tag2 = __esm({
|
|
|
2193
2212
|
return dom;
|
|
2194
2213
|
}
|
|
2195
2214
|
eq(other) {
|
|
2196
|
-
return (0,
|
|
2215
|
+
return (0, import_lodash_es7.isEqual)(this.keyPath, other.keyPath);
|
|
2197
2216
|
}
|
|
2198
2217
|
ignoreEvent() {
|
|
2199
2218
|
return false;
|
|
@@ -2229,7 +2248,7 @@ function findAllMatches(inputString, regex) {
|
|
|
2229
2248
|
return matches;
|
|
2230
2249
|
}
|
|
2231
2250
|
function JsonEditorWithVariables(props) {
|
|
2232
|
-
return /* @__PURE__ */
|
|
2251
|
+
return /* @__PURE__ */ import_react55.default.createElement(
|
|
2233
2252
|
CodeEditor2,
|
|
2234
2253
|
{
|
|
2235
2254
|
languageId: "json",
|
|
@@ -2240,16 +2259,16 @@ function JsonEditorWithVariables(props) {
|
|
|
2240
2259
|
...props.options || {}
|
|
2241
2260
|
}
|
|
2242
2261
|
},
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
2262
|
+
/* @__PURE__ */ import_react55.default.createElement(VariableTree2, null),
|
|
2263
|
+
/* @__PURE__ */ import_react55.default.createElement(VariableTagInject2, null)
|
|
2245
2264
|
);
|
|
2246
2265
|
}
|
|
2247
|
-
var
|
|
2266
|
+
var import_react55, import_editor28, import_preset_code6, transformer;
|
|
2248
2267
|
var init_editor5 = __esm({
|
|
2249
2268
|
"src/components/json-editor-with-variables/editor.tsx"() {
|
|
2250
2269
|
"use strict";
|
|
2251
2270
|
init_cjs_shims();
|
|
2252
|
-
|
|
2271
|
+
import_react55 = __toESM(require("react"));
|
|
2253
2272
|
import_editor28 = require("@flowgram.ai/editor");
|
|
2254
2273
|
import_preset_code6 = require("@coze-editor/editor/preset-code");
|
|
2255
2274
|
init_code_editor();
|
|
@@ -2317,6 +2336,7 @@ __export(src_exports, {
|
|
|
2317
2336
|
getTypeSelectValue: () => getTypeSelectValue,
|
|
2318
2337
|
isLegacyFlowRefValueSchema: () => isLegacyFlowRefValueSchema,
|
|
2319
2338
|
isNewFlowRefValueSchema: () => isNewFlowRefValueSchema,
|
|
2339
|
+
lazySuspense: () => lazySuspense,
|
|
2320
2340
|
listenRefSchemaChange: () => listenRefSchemaChange,
|
|
2321
2341
|
listenRefValueChange: () => listenRefValueChange,
|
|
2322
2342
|
parseTypeSelectValue: () => parseTypeSelectValue,
|
|
@@ -2330,7 +2350,8 @@ __export(src_exports, {
|
|
|
2330
2350
|
useTypeManager: () => useTypeManager,
|
|
2331
2351
|
useVariableTree: () => useVariableTree,
|
|
2332
2352
|
validateFlowValue: () => validateFlowValue,
|
|
2333
|
-
validateWhenVariableSync: () => validateWhenVariableSync
|
|
2353
|
+
validateWhenVariableSync: () => validateWhenVariableSync,
|
|
2354
|
+
withSuspense: () => withSuspense
|
|
2334
2355
|
});
|
|
2335
2356
|
module.exports = __toCommonJS(src_exports);
|
|
2336
2357
|
init_cjs_shims();
|
|
@@ -2342,7 +2363,7 @@ init_variable_selector();
|
|
|
2342
2363
|
// src/components/type-selector/index.tsx
|
|
2343
2364
|
init_cjs_shims();
|
|
2344
2365
|
var import_react15 = __toESM(require("react"));
|
|
2345
|
-
var
|
|
2366
|
+
var import_semi_ui9 = require("@douyinfe/semi-ui");
|
|
2346
2367
|
init_inject_material();
|
|
2347
2368
|
init_plugins();
|
|
2348
2369
|
var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
|
|
@@ -2368,11 +2389,11 @@ function TypeSelector(props) {
|
|
|
2368
2389
|
() => typeManager.getTypeRegistriesWithParentType().map((_type) => {
|
|
2369
2390
|
const isArray2 = _type.type === "array";
|
|
2370
2391
|
return {
|
|
2371
|
-
label: /* @__PURE__ */ import_react15.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react15.default.createElement(
|
|
2392
|
+
label: /* @__PURE__ */ import_react15.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react15.default.createElement(import_semi_ui9.Icon, { size: "small", svg: _type.icon }), typeManager.getTypeBySchema(_type)?.label || _type.type),
|
|
2372
2393
|
value: _type.type,
|
|
2373
2394
|
children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
|
|
2374
2395
|
label: /* @__PURE__ */ import_react15.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react15.default.createElement(
|
|
2375
|
-
|
|
2396
|
+
import_semi_ui9.Icon,
|
|
2376
2397
|
{
|
|
2377
2398
|
size: "small",
|
|
2378
2399
|
svg: typeManager.getDisplayIcon({
|
|
@@ -2389,12 +2410,12 @@ function TypeSelector(props) {
|
|
|
2389
2410
|
);
|
|
2390
2411
|
const isDisabled = readonly || disabled;
|
|
2391
2412
|
return /* @__PURE__ */ import_react15.default.createElement(
|
|
2392
|
-
|
|
2413
|
+
import_semi_ui9.Cascader,
|
|
2393
2414
|
{
|
|
2394
2415
|
disabled: isDisabled,
|
|
2395
2416
|
size: "small",
|
|
2396
2417
|
triggerRender: () => /* @__PURE__ */ import_react15.default.createElement(
|
|
2397
|
-
|
|
2418
|
+
import_semi_ui9.IconButton,
|
|
2398
2419
|
{
|
|
2399
2420
|
size: "small",
|
|
2400
2421
|
style: {
|
|
@@ -2421,7 +2442,7 @@ var InjectTypeSelector = createInjectMaterial(TypeSelector);
|
|
|
2421
2442
|
init_cjs_shims();
|
|
2422
2443
|
var import_react21 = __toESM(require("react"));
|
|
2423
2444
|
var import_editor14 = require("@flowgram.ai/editor");
|
|
2424
|
-
var
|
|
2445
|
+
var import_semi_ui11 = require("@douyinfe/semi-ui");
|
|
2425
2446
|
var import_semi_icons3 = require("@douyinfe/semi-icons");
|
|
2426
2447
|
|
|
2427
2448
|
// src/components/blur-input/index.tsx
|
|
@@ -2587,7 +2608,7 @@ var ConstantInputWrapper = import_styled_components3.default.div`
|
|
|
2587
2608
|
// src/components/json-schema-editor/hooks.tsx
|
|
2588
2609
|
init_cjs_shims();
|
|
2589
2610
|
var import_react18 = require("react");
|
|
2590
|
-
var
|
|
2611
|
+
var import_lodash_es3 = require("lodash-es");
|
|
2591
2612
|
var import_immer = require("immer");
|
|
2592
2613
|
var import_json_schema6 = require("@flowgram.ai/json-schema");
|
|
2593
2614
|
var _id = 0;
|
|
@@ -2610,7 +2631,7 @@ function usePropertiesEdit(value, onChange) {
|
|
|
2610
2631
|
setPropertyList((_list) => {
|
|
2611
2632
|
const newNames = Object.entries(drilldownSchema?.properties || {}).sort(([, a], [, b]) => (a.extra?.index ?? 0) - (b.extra?.index ?? 0)).map(([key]) => key);
|
|
2612
2633
|
const oldNames = _list.map((item) => item.name).filter(Boolean);
|
|
2613
|
-
const addNames = (0,
|
|
2634
|
+
const addNames = (0, import_lodash_es3.difference)(newNames, oldNames);
|
|
2614
2635
|
return _list.filter((item) => !item.name || newNames.includes(item.name)).map((item) => ({
|
|
2615
2636
|
key: item.key,
|
|
2616
2637
|
name: item.name,
|
|
@@ -2636,7 +2657,7 @@ function usePropertiesEdit(value, onChange) {
|
|
|
2636
2657
|
if (!_property.name) {
|
|
2637
2658
|
continue;
|
|
2638
2659
|
}
|
|
2639
|
-
nextProperties[_property.name] = (0,
|
|
2660
|
+
nextProperties[_property.name] = (0, import_lodash_es3.omit)(_property, ["key", "name", "isPropertyRequired"]);
|
|
2640
2661
|
if (_property.isPropertyRequired) {
|
|
2641
2662
|
nextRequired.push(_property.name);
|
|
2642
2663
|
}
|
|
@@ -2690,7 +2711,7 @@ var import_editor13 = require("@flowgram.ai/editor");
|
|
|
2690
2711
|
// src/components/constant-input/index.tsx
|
|
2691
2712
|
init_cjs_shims();
|
|
2692
2713
|
var import_react19 = __toESM(require("react"));
|
|
2693
|
-
var
|
|
2714
|
+
var import_semi_ui10 = require("@douyinfe/semi-ui");
|
|
2694
2715
|
init_plugins();
|
|
2695
2716
|
|
|
2696
2717
|
// src/components/constant-input/types.ts
|
|
@@ -2716,7 +2737,7 @@ function ConstantInput(props) {
|
|
|
2716
2737
|
...rest
|
|
2717
2738
|
});
|
|
2718
2739
|
}
|
|
2719
|
-
return /* @__PURE__ */ import_react19.default.createElement(
|
|
2740
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_semi_ui10.Input, { size: "small", disabled: true, placeholder: "Unsupported type" });
|
|
2720
2741
|
}
|
|
2721
2742
|
return /* @__PURE__ */ import_react19.default.createElement(Renderer2, { value, onChange, readonly, ...rest });
|
|
2722
2743
|
}
|
|
@@ -2759,7 +2780,7 @@ function JsonSchemaEditor(props) {
|
|
|
2759
2780
|
}
|
|
2760
2781
|
}
|
|
2761
2782
|
))), /* @__PURE__ */ import_react21.default.createElement(
|
|
2762
|
-
|
|
2783
|
+
import_semi_ui11.Button,
|
|
2763
2784
|
{
|
|
2764
2785
|
disabled: readonly,
|
|
2765
2786
|
size: "small",
|
|
@@ -2806,14 +2827,14 @@ function PropertyEdit(props) {
|
|
|
2806
2827
|
}
|
|
2807
2828
|
}
|
|
2808
2829
|
)), /* @__PURE__ */ import_react21.default.createElement(UIRequired, null, /* @__PURE__ */ import_react21.default.createElement(
|
|
2809
|
-
|
|
2830
|
+
import_semi_ui11.Checkbox,
|
|
2810
2831
|
{
|
|
2811
2832
|
disabled: readonly,
|
|
2812
2833
|
checked: isPropertyRequired,
|
|
2813
2834
|
onChange: (e) => onChange("isPropertyRequired", e.target.checked)
|
|
2814
2835
|
}
|
|
2815
2836
|
)), /* @__PURE__ */ import_react21.default.createElement(UIActions, null, /* @__PURE__ */ import_react21.default.createElement(
|
|
2816
|
-
|
|
2837
|
+
import_semi_ui11.IconButton,
|
|
2817
2838
|
{
|
|
2818
2839
|
disabled: readonly,
|
|
2819
2840
|
size: "small",
|
|
@@ -2824,7 +2845,7 @@ function PropertyEdit(props) {
|
|
|
2824
2845
|
}
|
|
2825
2846
|
}
|
|
2826
2847
|
), canAddField && /* @__PURE__ */ import_react21.default.createElement(
|
|
2827
|
-
|
|
2848
|
+
import_semi_ui11.IconButton,
|
|
2828
2849
|
{
|
|
2829
2850
|
disabled: readonly,
|
|
2830
2851
|
size: "small",
|
|
@@ -2836,7 +2857,7 @@ function PropertyEdit(props) {
|
|
|
2836
2857
|
}
|
|
2837
2858
|
}
|
|
2838
2859
|
), /* @__PURE__ */ import_react21.default.createElement(
|
|
2839
|
-
|
|
2860
|
+
import_semi_ui11.IconButton,
|
|
2840
2861
|
{
|
|
2841
2862
|
disabled: readonly,
|
|
2842
2863
|
size: "small",
|
|
@@ -2897,7 +2918,7 @@ function BatchVariableSelector(props) {
|
|
|
2897
2918
|
init_cjs_shims();
|
|
2898
2919
|
var import_react24 = __toESM(require("react"));
|
|
2899
2920
|
var import_json_schema7 = require("@flowgram.ai/json-schema");
|
|
2900
|
-
var
|
|
2921
|
+
var import_semi_ui12 = require("@douyinfe/semi-ui");
|
|
2901
2922
|
var import_semi_icons4 = require("@douyinfe/semi-icons");
|
|
2902
2923
|
init_shared();
|
|
2903
2924
|
init_variable_selector();
|
|
@@ -3004,7 +3025,7 @@ function useIncludeSchema(schemaFromProps) {
|
|
|
3004
3025
|
if (schemaFromProps?.type === "number") {
|
|
3005
3026
|
return [schemaFromProps, { type: "integer" }];
|
|
3006
3027
|
}
|
|
3007
|
-
return { ...schemaFromProps, extra: { ...schemaFromProps?.extra
|
|
3028
|
+
return { ...schemaFromProps, extra: { weak: true, ...schemaFromProps?.extra } };
|
|
3008
3029
|
}, [schemaFromProps]);
|
|
3009
3030
|
return includeSchema;
|
|
3010
3031
|
}
|
|
@@ -3102,7 +3123,7 @@ function DynamicValueInput({
|
|
|
3102
3123
|
onChange: (_v) => onChange({ type: "ref", content: _v }),
|
|
3103
3124
|
includeSchema,
|
|
3104
3125
|
readonly,
|
|
3105
|
-
triggerRender: () => /* @__PURE__ */ import_react24.default.createElement(
|
|
3126
|
+
triggerRender: () => /* @__PURE__ */ import_react24.default.createElement(import_semi_ui12.IconButton, { disabled: readonly, size: "small", icon: /* @__PURE__ */ import_react24.default.createElement(import_semi_icons4.IconSetting, { size: "small" }) })
|
|
3106
3127
|
}
|
|
3107
3128
|
);
|
|
3108
3129
|
return /* @__PURE__ */ import_react24.default.createElement(UIContainer2, { style }, /* @__PURE__ */ import_react24.default.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ import_react24.default.createElement(UIMain, null, renderMain()), /* @__PURE__ */ import_react24.default.createElement(UITrigger, null, renderTrigger()));
|
|
@@ -3114,7 +3135,7 @@ var InjectDynamicValueInput = createInjectMaterial(DynamicValueInput);
|
|
|
3114
3135
|
init_cjs_shims();
|
|
3115
3136
|
var import_react27 = __toESM(require("react"));
|
|
3116
3137
|
var import_editor19 = require("@flowgram.ai/editor");
|
|
3117
|
-
var
|
|
3138
|
+
var import_semi_ui14 = require("@douyinfe/semi-ui");
|
|
3118
3139
|
init_variable_selector();
|
|
3119
3140
|
|
|
3120
3141
|
// src/components/condition-row/styles.tsx
|
|
@@ -3292,7 +3313,7 @@ function useRule(left, userRules) {
|
|
|
3292
3313
|
init_cjs_shims();
|
|
3293
3314
|
var import_react26 = __toESM(require("react"));
|
|
3294
3315
|
var import_editor18 = require("@flowgram.ai/editor");
|
|
3295
|
-
var
|
|
3316
|
+
var import_semi_ui13 = require("@douyinfe/semi-ui");
|
|
3296
3317
|
var import_semi_icons5 = require("@douyinfe/semi-icons");
|
|
3297
3318
|
function useOp({ rule, op, onChange, readonly, userOps }) {
|
|
3298
3319
|
const options = (0, import_react26.useMemo)(
|
|
@@ -3306,7 +3327,7 @@ function useOp({ rule, op, onChange, readonly, userOps }) {
|
|
|
3306
3327
|
);
|
|
3307
3328
|
const opConfig = (0, import_react26.useMemo)(() => defaultOpConfigs[op], [op]);
|
|
3308
3329
|
const renderOpSelect = () => /* @__PURE__ */ import_react26.default.createElement(
|
|
3309
|
-
|
|
3330
|
+
import_semi_ui13.Select,
|
|
3310
3331
|
{
|
|
3311
3332
|
style: { height: 22 },
|
|
3312
3333
|
disabled: readonly,
|
|
@@ -3316,7 +3337,7 @@ function useOp({ rule, op, onChange, readonly, userOps }) {
|
|
|
3316
3337
|
onChange: (v) => {
|
|
3317
3338
|
onChange(v);
|
|
3318
3339
|
},
|
|
3319
|
-
triggerRender: ({ value }) => /* @__PURE__ */ import_react26.default.createElement(
|
|
3340
|
+
triggerRender: ({ value }) => /* @__PURE__ */ import_react26.default.createElement(import_semi_ui13.Button, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ import_react26.default.createElement(import_semi_icons5.IconChevronDownStroked, { size: "small" }))
|
|
3320
3341
|
}
|
|
3321
3342
|
);
|
|
3322
3343
|
return { renderOpSelect, opConfig };
|
|
@@ -3370,7 +3391,7 @@ function ConditionRow({
|
|
|
3370
3391
|
onChange: (v) => onChange({ ...value, right: v })
|
|
3371
3392
|
}
|
|
3372
3393
|
) : /* @__PURE__ */ import_react27.default.createElement(
|
|
3373
|
-
|
|
3394
|
+
import_semi_ui14.Input,
|
|
3374
3395
|
{
|
|
3375
3396
|
size: "small",
|
|
3376
3397
|
disabled: true,
|
|
@@ -3386,12 +3407,12 @@ ConditionRow.defaultOpConfigs = defaultOpConfigs;
|
|
|
3386
3407
|
init_cjs_shims();
|
|
3387
3408
|
var import_react31 = __toESM(require("react"));
|
|
3388
3409
|
var import_editor21 = require("@flowgram.ai/editor");
|
|
3389
|
-
var
|
|
3410
|
+
var import_semi_ui18 = require("@douyinfe/semi-ui");
|
|
3390
3411
|
|
|
3391
3412
|
// src/components/db-condition-row/styles.tsx
|
|
3392
3413
|
init_cjs_shims();
|
|
3393
3414
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
3394
|
-
var
|
|
3415
|
+
var import_semi_ui15 = require("@douyinfe/semi-ui");
|
|
3395
3416
|
var UIContainer4 = import_styled_components6.default.div`
|
|
3396
3417
|
display: flex;
|
|
3397
3418
|
align-items: center;
|
|
@@ -3416,7 +3437,7 @@ var UIOptionLabel = import_styled_components6.default.div`
|
|
|
3416
3437
|
align-items: center;
|
|
3417
3438
|
gap: 10px;
|
|
3418
3439
|
`;
|
|
3419
|
-
var UISelect = (0, import_styled_components6.default)(
|
|
3440
|
+
var UISelect = (0, import_styled_components6.default)(import_semi_ui15.Select)`
|
|
3420
3441
|
& .semi-select-selection {
|
|
3421
3442
|
margin-left: 5px;
|
|
3422
3443
|
}
|
|
@@ -3426,7 +3447,7 @@ var UISelect = (0, import_styled_components6.default)(import_semi_ui14.Select)`
|
|
|
3426
3447
|
init_cjs_shims();
|
|
3427
3448
|
var import_react28 = __toESM(require("react"));
|
|
3428
3449
|
var import_editor20 = require("@flowgram.ai/editor");
|
|
3429
|
-
var
|
|
3450
|
+
var import_semi_ui16 = require("@douyinfe/semi-ui");
|
|
3430
3451
|
var import_semi_icons6 = require("@douyinfe/semi-icons");
|
|
3431
3452
|
var defaultOpConfigs2 = ConditionRow.defaultOpConfigs;
|
|
3432
3453
|
function useOp2({ rule, op, onChange, readonly, userOps }) {
|
|
@@ -3441,7 +3462,7 @@ function useOp2({ rule, op, onChange, readonly, userOps }) {
|
|
|
3441
3462
|
);
|
|
3442
3463
|
const opConfig = (0, import_react28.useMemo)(() => defaultOpConfigs2[op], [op]);
|
|
3443
3464
|
const renderOpSelect = () => /* @__PURE__ */ import_react28.default.createElement(
|
|
3444
|
-
|
|
3465
|
+
import_semi_ui16.Select,
|
|
3445
3466
|
{
|
|
3446
3467
|
style: { height: 22 },
|
|
3447
3468
|
disabled: readonly,
|
|
@@ -3451,7 +3472,7 @@ function useOp2({ rule, op, onChange, readonly, userOps }) {
|
|
|
3451
3472
|
onChange: (v) => {
|
|
3452
3473
|
onChange(v);
|
|
3453
3474
|
},
|
|
3454
|
-
triggerRender: ({ value }) => /* @__PURE__ */ import_react28.default.createElement(
|
|
3475
|
+
triggerRender: ({ value }) => /* @__PURE__ */ import_react28.default.createElement(import_semi_ui16.Button, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ import_react28.default.createElement(import_semi_icons6.IconChevronDownStroked, { size: "small" }))
|
|
3455
3476
|
}
|
|
3456
3477
|
);
|
|
3457
3478
|
return { renderOpSelect, opConfig };
|
|
@@ -3462,7 +3483,7 @@ init_cjs_shims();
|
|
|
3462
3483
|
var import_react29 = require("react");
|
|
3463
3484
|
var import_react30 = __toESM(require("react"));
|
|
3464
3485
|
var import_json_schema9 = require("@flowgram.ai/json-schema");
|
|
3465
|
-
var
|
|
3486
|
+
var import_semi_ui17 = require("@douyinfe/semi-ui");
|
|
3466
3487
|
var defaultRules2 = ConditionRow.defaultRules;
|
|
3467
3488
|
function useLeft({ left, options, userRules, readonly, onChange }) {
|
|
3468
3489
|
const rules = (0, import_react29.useMemo)(() => ({ ...defaultRules2, ...userRules || {} }), [userRules]);
|
|
@@ -3484,7 +3505,7 @@ function useLeft({ left, options, userRules, readonly, onChange }) {
|
|
|
3484
3505
|
value: left,
|
|
3485
3506
|
onChange: (v) => onChange(v),
|
|
3486
3507
|
optionList: options?.map((item) => ({
|
|
3487
|
-
label: /* @__PURE__ */ import_react30.default.createElement(UIOptionLabel, null, /* @__PURE__ */ import_react30.default.createElement(
|
|
3508
|
+
label: /* @__PURE__ */ import_react30.default.createElement(UIOptionLabel, null, /* @__PURE__ */ import_react30.default.createElement(import_semi_ui17.Icon, { size: "small", svg: typeManager.getDisplayIcon(item.schema) }), item.label),
|
|
3488
3509
|
value: item.value
|
|
3489
3510
|
})) || []
|
|
3490
3511
|
}
|
|
@@ -3533,7 +3554,7 @@ function DBConditionRow({
|
|
|
3533
3554
|
onChange: (v) => onChange({ ...value, right: v })
|
|
3534
3555
|
}
|
|
3535
3556
|
) : /* @__PURE__ */ import_react31.default.createElement(
|
|
3536
|
-
|
|
3557
|
+
import_semi_ui18.Input,
|
|
3537
3558
|
{
|
|
3538
3559
|
size: "small",
|
|
3539
3560
|
disabled: true,
|
|
@@ -3547,7 +3568,7 @@ function DBConditionRow({
|
|
|
3547
3568
|
init_cjs_shims();
|
|
3548
3569
|
var import_react33 = __toESM(require("react"));
|
|
3549
3570
|
var import_editor22 = require("@flowgram.ai/editor");
|
|
3550
|
-
var
|
|
3571
|
+
var import_semi_ui19 = require("@douyinfe/semi-ui");
|
|
3551
3572
|
var import_semi_icons7 = require("@douyinfe/semi-icons");
|
|
3552
3573
|
|
|
3553
3574
|
// src/hooks/index.tsx
|
|
@@ -3557,7 +3578,7 @@ init_cjs_shims();
|
|
|
3557
3578
|
init_cjs_shims();
|
|
3558
3579
|
var import_react32 = require("react");
|
|
3559
3580
|
var import_nanoid = require("nanoid");
|
|
3560
|
-
var
|
|
3581
|
+
var import_lodash_es4 = require("lodash-es");
|
|
3561
3582
|
function genId2() {
|
|
3562
3583
|
return (0, import_nanoid.nanoid)();
|
|
3563
3584
|
}
|
|
@@ -3571,9 +3592,9 @@ function useObjectList({
|
|
|
3571
3592
|
const changeVersion = (0, import_react32.useRef)(0);
|
|
3572
3593
|
const getSortIndex = (value2) => {
|
|
3573
3594
|
if (typeof sortIndexKey === "function") {
|
|
3574
|
-
return (0,
|
|
3595
|
+
return (0, import_lodash_es4.get)(value2, sortIndexKey(value2)) || 0;
|
|
3575
3596
|
}
|
|
3576
|
-
return (0,
|
|
3597
|
+
return (0, import_lodash_es4.get)(value2, sortIndexKey || "") || 0;
|
|
3577
3598
|
};
|
|
3578
3599
|
(0, import_react32.useEffect)(() => {
|
|
3579
3600
|
effectVersion.current = effectVersion.current + 1;
|
|
@@ -3584,7 +3605,7 @@ function useObjectList({
|
|
|
3584
3605
|
setList((_prevList) => {
|
|
3585
3606
|
const newKeys = Object.entries(value || {}).sort((a, b) => getSortIndex(a[1]) - getSortIndex(b[1])).map(([key]) => key);
|
|
3586
3607
|
const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
|
|
3587
|
-
const addKeys = (0,
|
|
3608
|
+
const addKeys = (0, import_lodash_es4.difference)(newKeys, oldKeys);
|
|
3588
3609
|
return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
|
|
3589
3610
|
id: item.id,
|
|
3590
3611
|
key: item.key,
|
|
@@ -3623,8 +3644,8 @@ function useObjectList({
|
|
|
3623
3644
|
Object.fromEntries(
|
|
3624
3645
|
nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
|
|
3625
3646
|
const indexKey = typeof sortIndexKey === "function" ? sortIndexKey(_res[1]) : sortIndexKey;
|
|
3626
|
-
if ((0,
|
|
3627
|
-
(0,
|
|
3647
|
+
if ((0, import_lodash_es4.isObject)(_res[1]) && indexKey) {
|
|
3648
|
+
(0, import_lodash_es4.set)(_res[1], indexKey, idx);
|
|
3628
3649
|
}
|
|
3629
3650
|
return _res;
|
|
3630
3651
|
})
|
|
@@ -3691,7 +3712,7 @@ function BatchOutputs(props) {
|
|
|
3691
3712
|
const { readonly, style } = props;
|
|
3692
3713
|
const { list, add, updateKey, updateValue, remove } = useObjectList(props);
|
|
3693
3714
|
return /* @__PURE__ */ import_react33.default.createElement("div", null, /* @__PURE__ */ import_react33.default.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ import_react33.default.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ import_react33.default.createElement(
|
|
3694
|
-
|
|
3715
|
+
import_semi_ui19.Input,
|
|
3695
3716
|
{
|
|
3696
3717
|
style: { width: 100 },
|
|
3697
3718
|
disabled: readonly,
|
|
@@ -3708,14 +3729,14 @@ function BatchOutputs(props) {
|
|
|
3708
3729
|
onChange: (v) => updateValue(item.id, { type: "ref", content: v })
|
|
3709
3730
|
}
|
|
3710
3731
|
), /* @__PURE__ */ import_react33.default.createElement(
|
|
3711
|
-
|
|
3732
|
+
import_semi_ui19.Button,
|
|
3712
3733
|
{
|
|
3713
3734
|
disabled: readonly,
|
|
3714
3735
|
icon: /* @__PURE__ */ import_react33.default.createElement(import_semi_icons7.IconDelete, null),
|
|
3715
3736
|
size: "small",
|
|
3716
3737
|
onClick: () => remove(item.id)
|
|
3717
3738
|
}
|
|
3718
|
-
)))), /* @__PURE__ */ import_react33.default.createElement(
|
|
3739
|
+
)))), /* @__PURE__ */ import_react33.default.createElement(import_semi_ui19.Button, { disabled: readonly, icon: /* @__PURE__ */ import_react33.default.createElement(import_semi_icons7.IconPlus, null), size: "small", onClick: () => add() }, import_editor22.I18n.t("Add")));
|
|
3719
3740
|
}
|
|
3720
3741
|
|
|
3721
3742
|
// src/components/index.ts
|
|
@@ -3723,15 +3744,15 @@ init_prompt_editor();
|
|
|
3723
3744
|
|
|
3724
3745
|
// src/components/prompt-editor-with-variables/index.tsx
|
|
3725
3746
|
init_cjs_shims();
|
|
3726
|
-
|
|
3727
|
-
var PromptEditorWithVariables2 = (
|
|
3747
|
+
init_shared();
|
|
3748
|
+
var PromptEditorWithVariables2 = lazySuspense(
|
|
3728
3749
|
() => Promise.resolve().then(() => (init_editor3(), editor_exports3)).then((module2) => ({ default: module2.PromptEditorWithVariables }))
|
|
3729
3750
|
);
|
|
3730
3751
|
|
|
3731
3752
|
// src/components/prompt-editor-with-inputs/index.tsx
|
|
3732
3753
|
init_cjs_shims();
|
|
3733
|
-
|
|
3734
|
-
var PromptEditorWithInputs2 = (
|
|
3754
|
+
init_shared();
|
|
3755
|
+
var PromptEditorWithInputs2 = lazySuspense(
|
|
3735
3756
|
() => Promise.resolve().then(() => (init_editor4(), editor_exports4)).then((module2) => ({ default: module2.PromptEditorWithInputs }))
|
|
3736
3757
|
);
|
|
3737
3758
|
|
|
@@ -3741,16 +3762,16 @@ init_code_editor_mini();
|
|
|
3741
3762
|
|
|
3742
3763
|
// src/components/json-editor-with-variables/index.tsx
|
|
3743
3764
|
init_cjs_shims();
|
|
3744
|
-
|
|
3745
|
-
var JsonEditorWithVariables2 = (
|
|
3765
|
+
init_shared();
|
|
3766
|
+
var JsonEditorWithVariables2 = lazySuspense(
|
|
3746
3767
|
() => Promise.resolve().then(() => (init_editor5(), editor_exports5)).then((module2) => ({ default: module2.JsonEditorWithVariables }))
|
|
3747
3768
|
);
|
|
3748
3769
|
|
|
3749
3770
|
// src/components/inputs-values/index.tsx
|
|
3750
3771
|
init_cjs_shims();
|
|
3751
|
-
var
|
|
3772
|
+
var import_react56 = __toESM(require("react"));
|
|
3752
3773
|
var import_editor29 = require("@flowgram.ai/editor");
|
|
3753
|
-
var
|
|
3774
|
+
var import_semi_ui28 = require("@douyinfe/semi-ui");
|
|
3754
3775
|
var import_semi_icons10 = require("@douyinfe/semi-icons");
|
|
3755
3776
|
|
|
3756
3777
|
// src/components/inputs-values/styles.tsx
|
|
@@ -3783,7 +3804,7 @@ function InputsValues({
|
|
|
3783
3804
|
onChange,
|
|
3784
3805
|
sortIndexKey: "extra.index"
|
|
3785
3806
|
});
|
|
3786
|
-
return /* @__PURE__ */
|
|
3807
|
+
return /* @__PURE__ */ import_react56.default.createElement("div", null, /* @__PURE__ */ import_react56.default.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ import_react56.default.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ import_react56.default.createElement(
|
|
3787
3808
|
BlurInput,
|
|
3788
3809
|
{
|
|
3789
3810
|
style: { width: 100, minWidth: 100, maxWidth: 100 },
|
|
@@ -3793,7 +3814,7 @@ function InputsValues({
|
|
|
3793
3814
|
onChange: (v) => updateKey(item.id, v),
|
|
3794
3815
|
placeholder: import_editor29.I18n.t("Input Key")
|
|
3795
3816
|
}
|
|
3796
|
-
), /* @__PURE__ */
|
|
3817
|
+
), /* @__PURE__ */ import_react56.default.createElement(
|
|
3797
3818
|
InjectDynamicValueInput,
|
|
3798
3819
|
{
|
|
3799
3820
|
style: { flexGrow: 1 },
|
|
@@ -3807,20 +3828,20 @@ function InputsValues({
|
|
|
3807
3828
|
strategies: [...constantProps?.strategies || []]
|
|
3808
3829
|
}
|
|
3809
3830
|
}
|
|
3810
|
-
), /* @__PURE__ */
|
|
3811
|
-
|
|
3831
|
+
), /* @__PURE__ */ import_react56.default.createElement(
|
|
3832
|
+
import_semi_ui28.IconButton,
|
|
3812
3833
|
{
|
|
3813
3834
|
disabled: readonly,
|
|
3814
3835
|
theme: "borderless",
|
|
3815
|
-
icon: /* @__PURE__ */
|
|
3836
|
+
icon: /* @__PURE__ */ import_react56.default.createElement(import_semi_icons10.IconDelete, { size: "small" }),
|
|
3816
3837
|
size: "small",
|
|
3817
3838
|
onClick: () => remove(item.id)
|
|
3818
3839
|
}
|
|
3819
|
-
)))), /* @__PURE__ */
|
|
3820
|
-
|
|
3840
|
+
)))), /* @__PURE__ */ import_react56.default.createElement(
|
|
3841
|
+
import_semi_ui28.Button,
|
|
3821
3842
|
{
|
|
3822
3843
|
disabled: readonly,
|
|
3823
|
-
icon: /* @__PURE__ */
|
|
3844
|
+
icon: /* @__PURE__ */ import_react56.default.createElement(import_semi_icons10.IconPlus, null),
|
|
3824
3845
|
size: "small",
|
|
3825
3846
|
onClick: () => add({
|
|
3826
3847
|
type: "constant",
|
|
@@ -3834,7 +3855,7 @@ function InputsValues({
|
|
|
3834
3855
|
|
|
3835
3856
|
// src/components/display-schema-tree/index.tsx
|
|
3836
3857
|
init_cjs_shims();
|
|
3837
|
-
var
|
|
3858
|
+
var import_react57 = __toESM(require("react"));
|
|
3838
3859
|
init_plugins();
|
|
3839
3860
|
|
|
3840
3861
|
// src/components/display-schema-tree/styles.tsx
|
|
@@ -3920,7 +3941,7 @@ var TreeItem = import_styled_components12.default.div`
|
|
|
3920
3941
|
|
|
3921
3942
|
// src/components/display-schema-tree/index.tsx
|
|
3922
3943
|
function DisplaySchemaTree(props) {
|
|
3923
|
-
return /* @__PURE__ */
|
|
3944
|
+
return /* @__PURE__ */ import_react57.default.createElement(SchemaTree, { ...props });
|
|
3924
3945
|
}
|
|
3925
3946
|
function SchemaTree(props) {
|
|
3926
3947
|
const {
|
|
@@ -3936,31 +3957,31 @@ function SchemaTree(props) {
|
|
|
3936
3957
|
const icon = typeManager?.getDisplayIcon(schema);
|
|
3937
3958
|
let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
|
|
3938
3959
|
const childEntries = Object.entries(properties || {});
|
|
3939
|
-
return /* @__PURE__ */
|
|
3960
|
+
return /* @__PURE__ */ import_react57.default.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ import_react57.default.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ import_react57.default.createElement(HorizontalLine, null), showIcon && icon && import_react57.default.cloneElement(icon, {
|
|
3940
3961
|
className: "tree-icon"
|
|
3941
|
-
}), /* @__PURE__ */
|
|
3962
|
+
}), /* @__PURE__ */ import_react57.default.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ import_react57.default.createElement(import_react57.default.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ import_react57.default.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ import_react57.default.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
|
|
3942
3963
|
}
|
|
3943
3964
|
|
|
3944
3965
|
// src/components/display-outputs/index.tsx
|
|
3945
3966
|
init_cjs_shims();
|
|
3946
|
-
var
|
|
3967
|
+
var import_react59 = __toESM(require("react"));
|
|
3947
3968
|
var import_json_schema10 = require("@flowgram.ai/json-schema");
|
|
3948
3969
|
var import_editor30 = require("@flowgram.ai/editor");
|
|
3949
3970
|
|
|
3950
3971
|
// src/components/display-schema-tag/index.tsx
|
|
3951
3972
|
init_cjs_shims();
|
|
3952
|
-
var
|
|
3953
|
-
var
|
|
3973
|
+
var import_react58 = __toESM(require("react"));
|
|
3974
|
+
var import_semi_ui30 = require("@douyinfe/semi-ui");
|
|
3954
3975
|
init_plugins();
|
|
3955
3976
|
|
|
3956
3977
|
// src/components/display-schema-tag/styles.ts
|
|
3957
3978
|
init_cjs_shims();
|
|
3958
3979
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
3959
|
-
var
|
|
3980
|
+
var import_semi_ui29 = require("@douyinfe/semi-ui");
|
|
3960
3981
|
var PopoverContent = import_styled_components13.default.div`
|
|
3961
3982
|
padding: 10px;
|
|
3962
3983
|
`;
|
|
3963
|
-
var StyledTag = (0, import_styled_components13.default)(
|
|
3984
|
+
var StyledTag = (0, import_styled_components13.default)(import_semi_ui29.Tag)`
|
|
3964
3985
|
padding: 4px;
|
|
3965
3986
|
|
|
3966
3987
|
.tag-icon {
|
|
@@ -3980,14 +4001,14 @@ var TitleSpan = import_styled_components13.default.span`
|
|
|
3980
4001
|
function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
|
|
3981
4002
|
const typeManager = useTypeManager();
|
|
3982
4003
|
const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
|
|
3983
|
-
return /* @__PURE__ */
|
|
3984
|
-
|
|
4004
|
+
return /* @__PURE__ */ import_react58.default.createElement(
|
|
4005
|
+
import_semi_ui30.Popover,
|
|
3985
4006
|
{
|
|
3986
|
-
content: /* @__PURE__ */
|
|
4007
|
+
content: /* @__PURE__ */ import_react58.default.createElement(PopoverContent, null, /* @__PURE__ */ import_react58.default.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
|
|
3987
4008
|
},
|
|
3988
|
-
/* @__PURE__ */
|
|
4009
|
+
/* @__PURE__ */ import_react58.default.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && import_react58.default.cloneElement(icon, {
|
|
3989
4010
|
className: "tag-icon"
|
|
3990
|
-
}), title && /* @__PURE__ */
|
|
4011
|
+
}), title && /* @__PURE__ */ import_react58.default.createElement(TitleSpan, null, title))
|
|
3991
4012
|
);
|
|
3992
4013
|
}
|
|
3993
4014
|
|
|
@@ -4004,7 +4025,7 @@ var DisplayOutputsWrapper = import_styled_components14.default.div`
|
|
|
4004
4025
|
function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
4005
4026
|
const scope = (0, import_editor30.useCurrentScope)();
|
|
4006
4027
|
const refresh = (0, import_editor30.useRefresh)();
|
|
4007
|
-
(0,
|
|
4028
|
+
(0, import_react59.useEffect)(() => {
|
|
4008
4029
|
if (!displayFromScope) {
|
|
4009
4030
|
return () => null;
|
|
4010
4031
|
}
|
|
@@ -4023,7 +4044,7 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
|
4023
4044
|
return acm;
|
|
4024
4045
|
}, {}) : value?.properties || {};
|
|
4025
4046
|
const childEntries = Object.entries(properties || {});
|
|
4026
|
-
return /* @__PURE__ */
|
|
4047
|
+
return /* @__PURE__ */ import_react59.default.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ import_react59.default.createElement(
|
|
4027
4048
|
DisplaySchemaTag,
|
|
4028
4049
|
{
|
|
4029
4050
|
key,
|
|
@@ -4037,14 +4058,14 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
|
4037
4058
|
|
|
4038
4059
|
// src/components/display-flow-value/index.tsx
|
|
4039
4060
|
init_cjs_shims();
|
|
4040
|
-
var
|
|
4061
|
+
var import_react60 = __toESM(require("react"));
|
|
4041
4062
|
var import_json_schema11 = require("@flowgram.ai/json-schema");
|
|
4042
4063
|
var import_editor31 = require("@flowgram.ai/editor");
|
|
4043
4064
|
init_shared();
|
|
4044
4065
|
function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
4045
4066
|
const available = (0, import_editor31.useScopeAvailable)();
|
|
4046
4067
|
const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
|
|
4047
|
-
const schema = (0,
|
|
4068
|
+
const schema = (0, import_react60.useMemo)(() => {
|
|
4048
4069
|
if (value?.type === "ref") {
|
|
4049
4070
|
return import_json_schema11.JsonSchemaUtils.astToSchema(variable?.type);
|
|
4050
4071
|
}
|
|
@@ -4056,7 +4077,7 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
|
4056
4077
|
}
|
|
4057
4078
|
return { type: "unknown" };
|
|
4058
4079
|
}, [value, variable?.hash]);
|
|
4059
|
-
return /* @__PURE__ */
|
|
4080
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
4060
4081
|
DisplaySchemaTag,
|
|
4061
4082
|
{
|
|
4062
4083
|
title,
|
|
@@ -4069,8 +4090,8 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
|
4069
4090
|
|
|
4070
4091
|
// src/components/display-inputs-values/index.tsx
|
|
4071
4092
|
init_cjs_shims();
|
|
4072
|
-
var
|
|
4073
|
-
var
|
|
4093
|
+
var import_react61 = __toESM(require("react"));
|
|
4094
|
+
var import_lodash_es8 = require("lodash-es");
|
|
4074
4095
|
var import_editor32 = require("@flowgram.ai/editor");
|
|
4075
4096
|
init_shared();
|
|
4076
4097
|
|
|
@@ -4086,12 +4107,12 @@ var DisplayInputsWrapper = import_styled_components15.default.div`
|
|
|
4086
4107
|
// src/components/display-inputs-values/index.tsx
|
|
4087
4108
|
function DisplayInputsValues({ value, showIconInTree }) {
|
|
4088
4109
|
const childEntries = Object.entries(value || {});
|
|
4089
|
-
return /* @__PURE__ */
|
|
4110
|
+
return /* @__PURE__ */ import_react61.default.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => {
|
|
4090
4111
|
if (FlowValueUtils.isFlowValue(value2)) {
|
|
4091
|
-
return /* @__PURE__ */
|
|
4112
|
+
return /* @__PURE__ */ import_react61.default.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree });
|
|
4092
4113
|
}
|
|
4093
|
-
if ((0,
|
|
4094
|
-
return /* @__PURE__ */
|
|
4114
|
+
if ((0, import_lodash_es8.isPlainObject)(value2)) {
|
|
4115
|
+
return /* @__PURE__ */ import_react61.default.createElement(
|
|
4095
4116
|
DisplayInputsValueAllInTag,
|
|
4096
4117
|
{
|
|
4097
4118
|
key,
|
|
@@ -4110,37 +4131,37 @@ function DisplayInputsValueAllInTag({
|
|
|
4110
4131
|
showIconInTree
|
|
4111
4132
|
}) {
|
|
4112
4133
|
const available = (0, import_editor32.useScopeAvailable)();
|
|
4113
|
-
const schema = (0,
|
|
4134
|
+
const schema = (0, import_react61.useMemo)(
|
|
4114
4135
|
() => FlowValueUtils.inferJsonSchema(value, available.scope),
|
|
4115
4136
|
[available.version, value]
|
|
4116
4137
|
);
|
|
4117
|
-
return /* @__PURE__ */
|
|
4138
|
+
return /* @__PURE__ */ import_react61.default.createElement(DisplaySchemaTag, { title, value: schema, showIconInTree });
|
|
4118
4139
|
}
|
|
4119
4140
|
|
|
4120
4141
|
// src/components/assign-rows/index.tsx
|
|
4121
4142
|
init_cjs_shims();
|
|
4122
|
-
var
|
|
4143
|
+
var import_react64 = __toESM(require("react"));
|
|
4123
4144
|
var import_editor33 = require("@flowgram.ai/editor");
|
|
4124
|
-
var
|
|
4145
|
+
var import_semi_ui32 = require("@douyinfe/semi-ui");
|
|
4125
4146
|
var import_semi_icons12 = require("@douyinfe/semi-icons");
|
|
4126
4147
|
|
|
4127
4148
|
// src/components/assign-row/index.tsx
|
|
4128
4149
|
init_cjs_shims();
|
|
4129
|
-
var
|
|
4130
|
-
var
|
|
4150
|
+
var import_react63 = __toESM(require("react"));
|
|
4151
|
+
var import_semi_ui31 = require("@douyinfe/semi-ui");
|
|
4131
4152
|
var import_semi_icons11 = require("@douyinfe/semi-icons");
|
|
4132
4153
|
init_variable_selector();
|
|
4133
4154
|
|
|
4134
4155
|
// src/components/assign-row/components/blur-input.tsx
|
|
4135
4156
|
init_cjs_shims();
|
|
4136
|
-
var
|
|
4157
|
+
var import_react62 = __toESM(require("react"));
|
|
4137
4158
|
var import_input2 = __toESM(require("@douyinfe/semi-ui/lib/es/input"));
|
|
4138
4159
|
function BlurInput2(props) {
|
|
4139
|
-
const [value, setValue] = (0,
|
|
4140
|
-
(0,
|
|
4160
|
+
const [value, setValue] = (0, import_react62.useState)("");
|
|
4161
|
+
(0, import_react62.useEffect)(() => {
|
|
4141
4162
|
setValue(props.value);
|
|
4142
4163
|
}, [props.value]);
|
|
4143
|
-
return /* @__PURE__ */
|
|
4164
|
+
return /* @__PURE__ */ import_react62.default.createElement(
|
|
4144
4165
|
import_input2.default,
|
|
4145
4166
|
{
|
|
4146
4167
|
...props,
|
|
@@ -4166,7 +4187,7 @@ function AssignRow(props) {
|
|
|
4166
4187
|
onDelete,
|
|
4167
4188
|
readonly
|
|
4168
4189
|
} = props;
|
|
4169
|
-
return /* @__PURE__ */
|
|
4190
|
+
return /* @__PURE__ */ import_react63.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: 5 } }, /* @__PURE__ */ import_react63.default.createElement("div", { style: { width: 150, minWidth: 150, maxWidth: 150 } }, value?.operator === "assign" ? /* @__PURE__ */ import_react63.default.createElement(
|
|
4170
4191
|
InjectVariableSelector,
|
|
4171
4192
|
{
|
|
4172
4193
|
style: { width: "100%", height: 26 },
|
|
@@ -4177,7 +4198,7 @@ function AssignRow(props) {
|
|
|
4177
4198
|
left: { type: "ref", content: v }
|
|
4178
4199
|
})
|
|
4179
4200
|
}
|
|
4180
|
-
) : /* @__PURE__ */
|
|
4201
|
+
) : /* @__PURE__ */ import_react63.default.createElement(
|
|
4181
4202
|
BlurInput2,
|
|
4182
4203
|
{
|
|
4183
4204
|
style: { height: 26 },
|
|
@@ -4189,7 +4210,7 @@ function AssignRow(props) {
|
|
|
4189
4210
|
left: v
|
|
4190
4211
|
})
|
|
4191
4212
|
}
|
|
4192
|
-
)), /* @__PURE__ */
|
|
4213
|
+
)), /* @__PURE__ */ import_react63.default.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ import_react63.default.createElement(
|
|
4193
4214
|
InjectDynamicValueInput,
|
|
4194
4215
|
{
|
|
4195
4216
|
readonly,
|
|
@@ -4199,12 +4220,12 @@ function AssignRow(props) {
|
|
|
4199
4220
|
right: v
|
|
4200
4221
|
})
|
|
4201
4222
|
}
|
|
4202
|
-
)), onDelete && /* @__PURE__ */
|
|
4203
|
-
|
|
4223
|
+
)), onDelete && /* @__PURE__ */ import_react63.default.createElement("div", null, /* @__PURE__ */ import_react63.default.createElement(
|
|
4224
|
+
import_semi_ui31.IconButton,
|
|
4204
4225
|
{
|
|
4205
4226
|
size: "small",
|
|
4206
4227
|
theme: "borderless",
|
|
4207
|
-
icon: /* @__PURE__ */
|
|
4228
|
+
icon: /* @__PURE__ */ import_react63.default.createElement(import_semi_icons11.IconMinus, null),
|
|
4208
4229
|
onClick: () => onDelete?.()
|
|
4209
4230
|
}
|
|
4210
4231
|
)));
|
|
@@ -4213,7 +4234,7 @@ function AssignRow(props) {
|
|
|
4213
4234
|
// src/components/assign-rows/index.tsx
|
|
4214
4235
|
function AssignRows(props) {
|
|
4215
4236
|
const { name, readonly } = props;
|
|
4216
|
-
return /* @__PURE__ */
|
|
4237
|
+
return /* @__PURE__ */ import_react64.default.createElement(import_editor33.FieldArray, { name }, ({ field }) => /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, field.map((childField, index) => /* @__PURE__ */ import_react64.default.createElement(
|
|
4217
4238
|
AssignRow,
|
|
4218
4239
|
{
|
|
4219
4240
|
key: childField.key,
|
|
@@ -4224,21 +4245,21 @@ function AssignRows(props) {
|
|
|
4224
4245
|
},
|
|
4225
4246
|
onDelete: () => field.remove(index)
|
|
4226
4247
|
}
|
|
4227
|
-
)), /* @__PURE__ */
|
|
4228
|
-
|
|
4248
|
+
)), /* @__PURE__ */ import_react64.default.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ import_react64.default.createElement(
|
|
4249
|
+
import_semi_ui32.Button,
|
|
4229
4250
|
{
|
|
4230
4251
|
size: "small",
|
|
4231
4252
|
theme: "borderless",
|
|
4232
|
-
icon: /* @__PURE__ */
|
|
4253
|
+
icon: /* @__PURE__ */ import_react64.default.createElement(import_semi_icons12.IconPlus, null),
|
|
4233
4254
|
onClick: () => field.append({ operator: "assign" })
|
|
4234
4255
|
},
|
|
4235
4256
|
"Assign"
|
|
4236
|
-
), /* @__PURE__ */
|
|
4237
|
-
|
|
4257
|
+
), /* @__PURE__ */ import_react64.default.createElement(
|
|
4258
|
+
import_semi_ui32.Button,
|
|
4238
4259
|
{
|
|
4239
4260
|
size: "small",
|
|
4240
4261
|
theme: "borderless",
|
|
4241
|
-
icon: /* @__PURE__ */
|
|
4262
|
+
icon: /* @__PURE__ */ import_react64.default.createElement(import_semi_icons12.IconPlus, null),
|
|
4242
4263
|
onClick: () => field.append({ operator: "declare" })
|
|
4243
4264
|
},
|
|
4244
4265
|
"Declaration"
|
|
@@ -4247,15 +4268,15 @@ function AssignRows(props) {
|
|
|
4247
4268
|
|
|
4248
4269
|
// src/components/inputs-values-tree/index.tsx
|
|
4249
4270
|
init_cjs_shims();
|
|
4250
|
-
var
|
|
4271
|
+
var import_react68 = __toESM(require("react"));
|
|
4251
4272
|
var import_editor35 = require("@flowgram.ai/editor");
|
|
4252
|
-
var
|
|
4273
|
+
var import_semi_ui34 = require("@douyinfe/semi-ui");
|
|
4253
4274
|
var import_semi_icons15 = require("@douyinfe/semi-icons");
|
|
4254
4275
|
init_shared();
|
|
4255
4276
|
|
|
4256
4277
|
// src/components/inputs-values-tree/styles.tsx
|
|
4257
4278
|
init_cjs_shims();
|
|
4258
|
-
var
|
|
4279
|
+
var import_react65 = __toESM(require("react"));
|
|
4259
4280
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
4260
4281
|
var import_semi_icons13 = __toESM(require("@douyinfe/semi-icons"));
|
|
4261
4282
|
var UIContainer6 = import_styled_components16.default.div``;
|
|
@@ -4336,7 +4357,7 @@ var UICollapsible2 = import_styled_components16.default.div`
|
|
|
4336
4357
|
var UIActions2 = import_styled_components16.default.div`
|
|
4337
4358
|
white-space: nowrap;
|
|
4338
4359
|
`;
|
|
4339
|
-
var iconAddChildrenSvg2 = /* @__PURE__ */
|
|
4360
|
+
var iconAddChildrenSvg2 = /* @__PURE__ */ import_react65.default.createElement(
|
|
4340
4361
|
"svg",
|
|
4341
4362
|
{
|
|
4342
4363
|
className: "icon-icon icon-icon-coz_add_node ",
|
|
@@ -4346,7 +4367,7 @@ var iconAddChildrenSvg2 = /* @__PURE__ */ import_react69.default.createElement(
|
|
|
4346
4367
|
fill: "currentColor",
|
|
4347
4368
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4348
4369
|
},
|
|
4349
|
-
/* @__PURE__ */
|
|
4370
|
+
/* @__PURE__ */ import_react65.default.createElement(
|
|
4350
4371
|
"path",
|
|
4351
4372
|
{
|
|
4352
4373
|
fillRule: "evenodd",
|
|
@@ -4354,25 +4375,25 @@ var iconAddChildrenSvg2 = /* @__PURE__ */ import_react69.default.createElement(
|
|
|
4354
4375
|
d: "M11 6.49988C11 8.64148 9.50397 10.4337 7.49995 10.8884V15.4998C7.49995 16.0521 7.94767 16.4998 8.49995 16.4998H11.208C11.0742 16.8061 11 17.1443 11 17.4998C11 17.8554 11.0742 18.1936 11.208 18.4998H8.49995C6.8431 18.4998 5.49995 17.1567 5.49995 15.4998V10.8884C3.49599 10.4336 2 8.64145 2 6.49988C2 4.0146 4.01472 1.99988 6.5 1.99988C8.98528 1.99988 11 4.0146 11 6.49988ZM6.5 8.99988C7.88071 8.99988 9 7.88059 9 6.49988C9 5.11917 7.88071 3.99988 6.5 3.99988C5.11929 3.99988 4 5.11917 4 6.49988C4 7.88059 5.11929 8.99988 6.5 8.99988Z"
|
|
4355
4376
|
}
|
|
4356
4377
|
),
|
|
4357
|
-
/* @__PURE__ */
|
|
4378
|
+
/* @__PURE__ */ import_react65.default.createElement("path", { d: "M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z" })
|
|
4358
4379
|
);
|
|
4359
|
-
var IconAddChildren2 = () => /* @__PURE__ */
|
|
4380
|
+
var IconAddChildren2 = () => /* @__PURE__ */ import_react65.default.createElement(import_semi_icons13.default, { size: "small", svg: iconAddChildrenSvg2 });
|
|
4360
4381
|
|
|
4361
4382
|
// src/components/inputs-values-tree/row.tsx
|
|
4362
4383
|
init_cjs_shims();
|
|
4363
|
-
var
|
|
4384
|
+
var import_react67 = __toESM(require("react"));
|
|
4364
4385
|
var import_editor34 = require("@flowgram.ai/editor");
|
|
4365
|
-
var
|
|
4386
|
+
var import_semi_ui33 = require("@douyinfe/semi-ui");
|
|
4366
4387
|
var import_semi_icons14 = require("@douyinfe/semi-icons");
|
|
4367
4388
|
|
|
4368
4389
|
// src/components/inputs-values-tree/hooks/use-child-list.tsx
|
|
4369
4390
|
init_cjs_shims();
|
|
4370
|
-
var
|
|
4371
|
-
var
|
|
4391
|
+
var import_react66 = require("react");
|
|
4392
|
+
var import_lodash_es9 = require("lodash-es");
|
|
4372
4393
|
init_shared();
|
|
4373
4394
|
function useChildList(value, onChange) {
|
|
4374
|
-
const canAddField = (0,
|
|
4375
|
-
if (!(0,
|
|
4395
|
+
const canAddField = (0, import_react66.useMemo)(() => {
|
|
4396
|
+
if (!(0, import_lodash_es9.isPlainObject)(value)) {
|
|
4376
4397
|
return false;
|
|
4377
4398
|
}
|
|
4378
4399
|
if (FlowValueUtils.isFlowValue(value)) {
|
|
@@ -4380,8 +4401,8 @@ function useChildList(value, onChange) {
|
|
|
4380
4401
|
}
|
|
4381
4402
|
return true;
|
|
4382
4403
|
}, [value]);
|
|
4383
|
-
const objectListValue = (0,
|
|
4384
|
-
if ((0,
|
|
4404
|
+
const objectListValue = (0, import_react66.useMemo)(() => {
|
|
4405
|
+
if ((0, import_lodash_es9.isPlainObject)(value)) {
|
|
4385
4406
|
if (FlowValueUtils.isFlowValue(value)) {
|
|
4386
4407
|
return void 0;
|
|
4387
4408
|
}
|
|
@@ -4396,7 +4417,7 @@ function useChildList(value, onChange) {
|
|
|
4396
4417
|
},
|
|
4397
4418
|
sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
|
|
4398
4419
|
});
|
|
4399
|
-
const hasChildren = (0,
|
|
4420
|
+
const hasChildren = (0, import_react66.useMemo)(
|
|
4400
4421
|
() => canAddField && (list.length > 0 || Object.keys(objectListValue || {}).length > 0),
|
|
4401
4422
|
[canAddField, list.length, Object.keys(objectListValue || {}).length]
|
|
4402
4423
|
);
|
|
@@ -4414,8 +4435,8 @@ function useChildList(value, onChange) {
|
|
|
4414
4435
|
// src/components/inputs-values-tree/row.tsx
|
|
4415
4436
|
var AddObjectChildStrategy = {
|
|
4416
4437
|
hit: (schema) => schema.type === "object",
|
|
4417
|
-
Renderer: () => /* @__PURE__ */
|
|
4418
|
-
|
|
4438
|
+
Renderer: () => /* @__PURE__ */ import_react67.default.createElement(
|
|
4439
|
+
import_semi_ui33.Input,
|
|
4419
4440
|
{
|
|
4420
4441
|
size: "small",
|
|
4421
4442
|
disabled: true,
|
|
@@ -4437,23 +4458,23 @@ function InputValueRow(props) {
|
|
|
4437
4458
|
hasError,
|
|
4438
4459
|
readonly
|
|
4439
4460
|
} = props;
|
|
4440
|
-
const [collapse, setCollapse] = (0,
|
|
4461
|
+
const [collapse, setCollapse] = (0, import_react67.useState)(false);
|
|
4441
4462
|
const { canAddField, hasChildren, list, add, updateKey, updateValue, remove } = useChildList(
|
|
4442
4463
|
value,
|
|
4443
4464
|
onUpdateValue
|
|
4444
4465
|
);
|
|
4445
|
-
const strategies = (0,
|
|
4466
|
+
const strategies = (0, import_react67.useMemo)(
|
|
4446
4467
|
() => [...hasChildren ? [AddObjectChildStrategy] : [], ...constantProps?.strategies || []],
|
|
4447
4468
|
[hasChildren, constantProps?.strategies]
|
|
4448
4469
|
);
|
|
4449
|
-
const flowDisplayValue = (0,
|
|
4470
|
+
const flowDisplayValue = (0, import_react67.useMemo)(
|
|
4450
4471
|
() => hasChildren ? {
|
|
4451
4472
|
type: "constant",
|
|
4452
4473
|
schema: { type: "object" }
|
|
4453
4474
|
} : value,
|
|
4454
4475
|
[hasChildren, value]
|
|
4455
4476
|
);
|
|
4456
|
-
return /* @__PURE__ */
|
|
4477
|
+
return /* @__PURE__ */ import_react67.default.createElement(import_react67.default.Fragment, null, /* @__PURE__ */ import_react67.default.createElement(UITreeItemLeft2, { $isLast, $showLine: $level > 0, $showCollapse: hasChildren }, hasChildren && /* @__PURE__ */ import_react67.default.createElement(UICollapseTrigger2, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ import_react67.default.createElement(import_semi_icons14.IconChevronDown, { size: "small" }) : /* @__PURE__ */ import_react67.default.createElement(import_semi_icons14.IconChevronRight, { size: "small" }))), /* @__PURE__ */ import_react67.default.createElement(UITreeItemRight2, null, /* @__PURE__ */ import_react67.default.createElement(UITreeItemMain2, null, /* @__PURE__ */ import_react67.default.createElement(UIRow4, null, /* @__PURE__ */ import_react67.default.createElement(
|
|
4457
4478
|
BlurInput,
|
|
4458
4479
|
{
|
|
4459
4480
|
style: { width: 100, minWidth: 100, maxWidth: 100 },
|
|
@@ -4463,7 +4484,7 @@ function InputValueRow(props) {
|
|
|
4463
4484
|
onChange: (v) => onUpdateKey?.(v),
|
|
4464
4485
|
placeholder: import_editor34.I18n.t("Input Key")
|
|
4465
4486
|
}
|
|
4466
|
-
), /* @__PURE__ */
|
|
4487
|
+
), /* @__PURE__ */ import_react67.default.createElement(
|
|
4467
4488
|
InjectDynamicValueInput,
|
|
4468
4489
|
{
|
|
4469
4490
|
style: { flexGrow: 1 },
|
|
@@ -4476,13 +4497,13 @@ function InputValueRow(props) {
|
|
|
4476
4497
|
strategies
|
|
4477
4498
|
}
|
|
4478
4499
|
}
|
|
4479
|
-
), /* @__PURE__ */
|
|
4480
|
-
|
|
4500
|
+
), /* @__PURE__ */ import_react67.default.createElement(UIActions2, null, canAddField && /* @__PURE__ */ import_react67.default.createElement(
|
|
4501
|
+
import_semi_ui33.IconButton,
|
|
4481
4502
|
{
|
|
4482
4503
|
disabled: readonly,
|
|
4483
4504
|
size: "small",
|
|
4484
4505
|
theme: "borderless",
|
|
4485
|
-
icon: /* @__PURE__ */
|
|
4506
|
+
icon: /* @__PURE__ */ import_react67.default.createElement(IconAddChildren2, null),
|
|
4486
4507
|
onClick: () => {
|
|
4487
4508
|
add({
|
|
4488
4509
|
type: "constant",
|
|
@@ -4492,16 +4513,16 @@ function InputValueRow(props) {
|
|
|
4492
4513
|
setCollapse(true);
|
|
4493
4514
|
}
|
|
4494
4515
|
}
|
|
4495
|
-
), /* @__PURE__ */
|
|
4496
|
-
|
|
4516
|
+
), /* @__PURE__ */ import_react67.default.createElement(
|
|
4517
|
+
import_semi_ui33.IconButton,
|
|
4497
4518
|
{
|
|
4498
4519
|
disabled: readonly,
|
|
4499
4520
|
theme: "borderless",
|
|
4500
|
-
icon: /* @__PURE__ */
|
|
4521
|
+
icon: /* @__PURE__ */ import_react67.default.createElement(import_semi_icons14.IconDelete, { size: "small" }),
|
|
4501
4522
|
size: "small",
|
|
4502
4523
|
onClick: () => onRemove?.()
|
|
4503
4524
|
}
|
|
4504
|
-
)))), hasChildren && /* @__PURE__ */
|
|
4525
|
+
)))), hasChildren && /* @__PURE__ */ import_react67.default.createElement(UICollapsible2, { $collapse: collapse }, /* @__PURE__ */ import_react67.default.createElement(UITreeItems2, { $shrink: true }, list.map((_item, index) => /* @__PURE__ */ import_react67.default.createElement(
|
|
4505
4526
|
InputValueRow,
|
|
4506
4527
|
{
|
|
4507
4528
|
readonly,
|
|
@@ -4533,7 +4554,7 @@ function InputsValuesTree(props) {
|
|
|
4533
4554
|
onChange,
|
|
4534
4555
|
sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
|
|
4535
4556
|
});
|
|
4536
|
-
return /* @__PURE__ */
|
|
4557
|
+
return /* @__PURE__ */ import_react68.default.createElement("div", null, /* @__PURE__ */ import_react68.default.createElement(UITreeItems2, null, list.map((item) => /* @__PURE__ */ import_react68.default.createElement(
|
|
4537
4558
|
InputValueRow,
|
|
4538
4559
|
{
|
|
4539
4560
|
key: item.id,
|
|
@@ -4546,12 +4567,12 @@ function InputsValuesTree(props) {
|
|
|
4546
4567
|
hasError,
|
|
4547
4568
|
constantProps
|
|
4548
4569
|
}
|
|
4549
|
-
))), /* @__PURE__ */
|
|
4550
|
-
|
|
4570
|
+
))), /* @__PURE__ */ import_react68.default.createElement(
|
|
4571
|
+
import_semi_ui34.Button,
|
|
4551
4572
|
{
|
|
4552
4573
|
style: { marginTop: 10, marginLeft: 16 },
|
|
4553
4574
|
disabled: readonly,
|
|
4554
|
-
icon: /* @__PURE__ */
|
|
4575
|
+
icon: /* @__PURE__ */ import_react68.default.createElement(import_semi_icons15.IconPlus, null),
|
|
4555
4576
|
size: "small",
|
|
4556
4577
|
onClick: () => {
|
|
4557
4578
|
add({
|
|
@@ -4704,7 +4725,7 @@ var syncVariableTitle = [
|
|
|
4704
4725
|
|
|
4705
4726
|
// src/effects/validate-when-variable-sync/index.ts
|
|
4706
4727
|
init_cjs_shims();
|
|
4707
|
-
var
|
|
4728
|
+
var import_lodash_es10 = require("lodash-es");
|
|
4708
4729
|
var import_editor40 = require("@flowgram.ai/editor");
|
|
4709
4730
|
var validateWhenVariableSync = ({
|
|
4710
4731
|
scope
|
|
@@ -4714,7 +4735,7 @@ var validateWhenVariableSync = ({
|
|
|
4714
4735
|
effect: ({ context, form }) => {
|
|
4715
4736
|
const nodeScope = scope === "private" ? (0, import_editor40.getNodePrivateScope)(context.node) : (0, import_editor40.getNodeScope)(context.node);
|
|
4716
4737
|
const disposable = nodeScope.available.onListOrAnyVarChange(() => {
|
|
4717
|
-
if (!(0,
|
|
4738
|
+
if (!(0, import_lodash_es10.isEmpty)(form.state.errors)) {
|
|
4718
4739
|
form.validate();
|
|
4719
4740
|
}
|
|
4720
4741
|
});
|
|
@@ -4856,7 +4877,7 @@ var createBatchOutputsFormPlugin = (0, import_editor43.defineFormPluginCreator)(
|
|
|
4856
4877
|
|
|
4857
4878
|
// src/form-plugins/infer-inputs-plugin/index.ts
|
|
4858
4879
|
init_cjs_shims();
|
|
4859
|
-
var
|
|
4880
|
+
var import_lodash_es11 = require("lodash-es");
|
|
4860
4881
|
var import_editor44 = require("@flowgram.ai/editor");
|
|
4861
4882
|
init_shared();
|
|
4862
4883
|
var createInferInputsPlugin = (0, import_editor44.defineFormPluginCreator)({
|
|
@@ -4865,11 +4886,11 @@ var createInferInputsPlugin = (0, import_editor44.defineFormPluginCreator)({
|
|
|
4865
4886
|
return;
|
|
4866
4887
|
}
|
|
4867
4888
|
addFormatOnSubmit((formData, ctx) => {
|
|
4868
|
-
(0,
|
|
4889
|
+
(0, import_lodash_es11.set)(
|
|
4869
4890
|
formData,
|
|
4870
4891
|
targetKey,
|
|
4871
4892
|
FlowValueUtils.inferJsonSchema(
|
|
4872
|
-
(0,
|
|
4893
|
+
(0, import_lodash_es11.get)(formData, sourceKey),
|
|
4873
4894
|
scope === "private" ? (0, import_editor44.getNodePrivateScope)(ctx.node) : (0, import_editor44.getNodeScope)(ctx.node)
|
|
4874
4895
|
)
|
|
4875
4896
|
);
|
|
@@ -4880,7 +4901,7 @@ var createInferInputsPlugin = (0, import_editor44.defineFormPluginCreator)({
|
|
|
4880
4901
|
|
|
4881
4902
|
// src/form-plugins/infer-assign-plugin/index.ts
|
|
4882
4903
|
init_cjs_shims();
|
|
4883
|
-
var
|
|
4904
|
+
var import_lodash_es12 = require("lodash-es");
|
|
4884
4905
|
var import_json_schema14 = require("@flowgram.ai/json-schema");
|
|
4885
4906
|
var import_editor45 = require("@flowgram.ai/editor");
|
|
4886
4907
|
var createInferAssignPlugin = (0, import_editor45.defineFormPluginCreator)({
|
|
@@ -4891,7 +4912,7 @@ var createInferAssignPlugin = (0, import_editor45.defineFormPluginCreator)({
|
|
|
4891
4912
|
mergeEffect({
|
|
4892
4913
|
[assignKey]: (0, import_editor45.createEffectFromVariableProvider)({
|
|
4893
4914
|
parse: (value, ctx) => {
|
|
4894
|
-
const declareRows = (0,
|
|
4915
|
+
const declareRows = (0, import_lodash_es12.uniqBy)(
|
|
4895
4916
|
value.filter((_v) => _v.operator === "declare" && _v.left && _v.right),
|
|
4896
4917
|
"left"
|
|
4897
4918
|
);
|
|
@@ -4919,7 +4940,7 @@ var createInferAssignPlugin = (0, import_editor45.defineFormPluginCreator)({
|
|
|
4919
4940
|
})
|
|
4920
4941
|
});
|
|
4921
4942
|
addFormatOnSubmit((formData, ctx) => {
|
|
4922
|
-
(0,
|
|
4943
|
+
(0, import_lodash_es12.set)(
|
|
4923
4944
|
formData,
|
|
4924
4945
|
outputKey,
|
|
4925
4946
|
import_json_schema14.JsonSchemaUtils.astToSchema((0, import_editor45.getNodeScope)(ctx.node).output.variables?.[0]?.type)
|
|
@@ -4937,7 +4958,7 @@ init_cjs_shims();
|
|
|
4937
4958
|
|
|
4938
4959
|
// src/validate/validate-flow-value/index.tsx
|
|
4939
4960
|
init_cjs_shims();
|
|
4940
|
-
var
|
|
4961
|
+
var import_lodash_es13 = require("lodash-es");
|
|
4941
4962
|
var import_editor46 = require("@flowgram.ai/editor");
|
|
4942
4963
|
init_shared();
|
|
4943
4964
|
function validateFlowValue(value, ctx) {
|
|
@@ -4946,7 +4967,7 @@ function validateFlowValue(value, ctx) {
|
|
|
4946
4967
|
required: requiredMessage = "Field is required",
|
|
4947
4968
|
unknownVariable: unknownVariableMessage = "Unknown Variable"
|
|
4948
4969
|
} = errorMessages || {};
|
|
4949
|
-
if (required && ((0,
|
|
4970
|
+
if (required && ((0, import_lodash_es13.isNil)(value) || (0, import_lodash_es13.isNil)(value?.content) || value?.content === "")) {
|
|
4950
4971
|
return {
|
|
4951
4972
|
level: import_editor46.FeedbackLevel.Error,
|
|
4952
4973
|
message: requiredMessage
|
|
@@ -5023,6 +5044,7 @@ function validateFlowValue(value, ctx) {
|
|
|
5023
5044
|
getTypeSelectValue,
|
|
5024
5045
|
isLegacyFlowRefValueSchema,
|
|
5025
5046
|
isNewFlowRefValueSchema,
|
|
5047
|
+
lazySuspense,
|
|
5026
5048
|
listenRefSchemaChange,
|
|
5027
5049
|
listenRefValueChange,
|
|
5028
5050
|
parseTypeSelectValue,
|
|
@@ -5036,6 +5058,7 @@ function validateFlowValue(value, ctx) {
|
|
|
5036
5058
|
useTypeManager,
|
|
5037
5059
|
useVariableTree,
|
|
5038
5060
|
validateFlowValue,
|
|
5039
|
-
validateWhenVariableSync
|
|
5061
|
+
validateWhenVariableSync,
|
|
5062
|
+
withSuspense
|
|
5040
5063
|
});
|
|
5041
5064
|
//# sourceMappingURL=index.js.map
|