@flowgram.ai/form-materials 0.4.6 → 0.4.8
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-IHOHRV5V.js} +67 -30
- package/dist/esm/chunk-IHOHRV5V.js.map +1 -0
- package/dist/esm/{editor-H2R7JJLO.js → editor-4X7K477H.js} +4 -4
- package/dist/esm/editor-4X7K477H.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/{editor-JX42GFAZ.js → editor-Z24WLBPO.js} +5 -5
- package/dist/esm/editor-Z24WLBPO.js.map +1 -0
- package/dist/esm/index.js +34 -23
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +532 -446
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/code-editor/index.tsx +2 -2
- package/src/components/condition-row/constants.ts +8 -0
- 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/components/variable-selector/context.tsx +28 -0
- package/src/components/variable-selector/index.tsx +10 -1
- package/src/components/variable-selector/use-variable-tree.tsx +3 -3
- 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/plugins/json-schema-preset/type-definition/date-time.tsx +25 -0
- package/src/plugins/json-schema-preset/type-definition/index.tsx +2 -0
- 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",
|
|
@@ -927,21 +946,46 @@ var init_integer = __esm({
|
|
|
927
946
|
}
|
|
928
947
|
});
|
|
929
948
|
|
|
949
|
+
// src/plugins/json-schema-preset/type-definition/date-time.tsx
|
|
950
|
+
var import_react10, import_semi_ui5, dateTimeRegistry;
|
|
951
|
+
var init_date_time = __esm({
|
|
952
|
+
"src/plugins/json-schema-preset/type-definition/date-time.tsx"() {
|
|
953
|
+
"use strict";
|
|
954
|
+
init_cjs_shims();
|
|
955
|
+
import_react10 = __toESM(require("react"));
|
|
956
|
+
import_semi_ui5 = require("@douyinfe/semi-ui");
|
|
957
|
+
dateTimeRegistry = {
|
|
958
|
+
type: "date-time",
|
|
959
|
+
ConstantRenderer: (props) => /* @__PURE__ */ import_react10.default.createElement(
|
|
960
|
+
import_semi_ui5.DatePicker,
|
|
961
|
+
{
|
|
962
|
+
size: "small",
|
|
963
|
+
type: "dateTime",
|
|
964
|
+
density: "compact",
|
|
965
|
+
style: { width: "100%", ...props.style || {} },
|
|
966
|
+
disabled: props.readonly,
|
|
967
|
+
...props
|
|
968
|
+
}
|
|
969
|
+
)
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
|
|
930
974
|
// src/plugins/json-schema-preset/type-definition/boolean.tsx
|
|
931
|
-
var
|
|
975
|
+
var import_react11, import_editor7, import_semi_ui6, booleanRegistry;
|
|
932
976
|
var init_boolean = __esm({
|
|
933
977
|
"src/plugins/json-schema-preset/type-definition/boolean.tsx"() {
|
|
934
978
|
"use strict";
|
|
935
979
|
init_cjs_shims();
|
|
936
|
-
|
|
980
|
+
import_react11 = __toESM(require("react"));
|
|
937
981
|
import_editor7 = require("@flowgram.ai/editor");
|
|
938
|
-
|
|
982
|
+
import_semi_ui6 = require("@douyinfe/semi-ui");
|
|
939
983
|
booleanRegistry = {
|
|
940
984
|
type: "boolean",
|
|
941
985
|
ConstantRenderer: (props) => {
|
|
942
986
|
const { value, onChange, ...rest } = props;
|
|
943
|
-
return /* @__PURE__ */
|
|
944
|
-
|
|
987
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
988
|
+
import_semi_ui6.Select,
|
|
945
989
|
{
|
|
946
990
|
placeholder: import_editor7.I18n.t("Please Select Boolean"),
|
|
947
991
|
size: "small",
|
|
@@ -961,17 +1005,17 @@ var init_boolean = __esm({
|
|
|
961
1005
|
});
|
|
962
1006
|
|
|
963
1007
|
// src/plugins/json-schema-preset/type-definition/array.tsx
|
|
964
|
-
var
|
|
1008
|
+
var import_react12, import_editor8, arrayRegistry;
|
|
965
1009
|
var init_array = __esm({
|
|
966
1010
|
"src/plugins/json-schema-preset/type-definition/array.tsx"() {
|
|
967
1011
|
"use strict";
|
|
968
1012
|
init_cjs_shims();
|
|
969
|
-
|
|
1013
|
+
import_react12 = __toESM(require("react"));
|
|
970
1014
|
import_editor8 = require("@flowgram.ai/editor");
|
|
971
1015
|
init_code_editor_mini();
|
|
972
1016
|
arrayRegistry = {
|
|
973
1017
|
type: "array",
|
|
974
|
-
ConstantRenderer: (props) => /* @__PURE__ */
|
|
1018
|
+
ConstantRenderer: (props) => /* @__PURE__ */ import_react12.default.createElement(
|
|
975
1019
|
CodeEditorMini,
|
|
976
1020
|
{
|
|
977
1021
|
value: props.value,
|
|
@@ -996,6 +1040,7 @@ var init_type_definition = __esm({
|
|
|
996
1040
|
init_object();
|
|
997
1041
|
init_number();
|
|
998
1042
|
init_integer();
|
|
1043
|
+
init_date_time();
|
|
999
1044
|
init_boolean();
|
|
1000
1045
|
init_array();
|
|
1001
1046
|
jsonSchemaTypePreset = [
|
|
@@ -1004,7 +1049,8 @@ var init_type_definition = __esm({
|
|
|
1004
1049
|
numberRegistry,
|
|
1005
1050
|
integerRegistry,
|
|
1006
1051
|
booleanRegistry,
|
|
1007
|
-
arrayRegistry
|
|
1052
|
+
arrayRegistry,
|
|
1053
|
+
dateTimeRegistry
|
|
1008
1054
|
];
|
|
1009
1055
|
jsonSchemaTypePreset.forEach((_type) => import_json_schema2.jsonSchemaTypeManager.register(_type));
|
|
1010
1056
|
}
|
|
@@ -1032,12 +1078,12 @@ var init_create_type_preset_plugin = __esm({
|
|
|
1032
1078
|
});
|
|
1033
1079
|
|
|
1034
1080
|
// src/plugins/json-schema-preset/index.tsx
|
|
1035
|
-
var
|
|
1081
|
+
var import_react13, import_json_schema4, useTypeManager, JsonSchemaTypePresetProvider;
|
|
1036
1082
|
var init_json_schema_preset = __esm({
|
|
1037
1083
|
"src/plugins/json-schema-preset/index.tsx"() {
|
|
1038
1084
|
"use strict";
|
|
1039
1085
|
init_cjs_shims();
|
|
1040
|
-
|
|
1086
|
+
import_react13 = __toESM(require("react"));
|
|
1041
1087
|
import_json_schema4 = require("@flowgram.ai/json-schema");
|
|
1042
1088
|
init_type_definition();
|
|
1043
1089
|
init_create_type_preset_plugin();
|
|
@@ -1045,7 +1091,7 @@ var init_json_schema_preset = __esm({
|
|
|
1045
1091
|
JsonSchemaTypePresetProvider = ({
|
|
1046
1092
|
types = [],
|
|
1047
1093
|
children
|
|
1048
|
-
}) => /* @__PURE__ */
|
|
1094
|
+
}) => /* @__PURE__ */ import_react13.default.createElement(import_json_schema4.TypePresetProvider, { types: [...jsonSchemaTypePreset, ...types] }, children);
|
|
1049
1095
|
}
|
|
1050
1096
|
});
|
|
1051
1097
|
|
|
@@ -1097,18 +1143,18 @@ var init_plugins = __esm({
|
|
|
1097
1143
|
|
|
1098
1144
|
// src/components/variable-selector/use-variable-tree.tsx
|
|
1099
1145
|
function useVariableTree(params) {
|
|
1100
|
-
const { includeSchema, excludeSchema,
|
|
1146
|
+
const { includeSchema, excludeSchema, skipVariable } = params;
|
|
1101
1147
|
const typeManager = useTypeManager();
|
|
1102
1148
|
const variables = (0, import_editor11.useAvailableVariables)();
|
|
1103
|
-
const getVariableTypeIcon = (0,
|
|
1149
|
+
const getVariableTypeIcon = (0, import_react14.useCallback)((variable) => {
|
|
1104
1150
|
if (variable.meta?.icon) {
|
|
1105
1151
|
if (typeof variable.meta.icon === "string") {
|
|
1106
|
-
return /* @__PURE__ */
|
|
1152
|
+
return /* @__PURE__ */ import_react14.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: variable.meta.icon });
|
|
1107
1153
|
}
|
|
1108
1154
|
return variable.meta.icon;
|
|
1109
1155
|
}
|
|
1110
1156
|
const schema = import_json_schema5.JsonSchemaUtils.astToSchema(variable.type, { drilldownObject: false });
|
|
1111
|
-
return /* @__PURE__ */
|
|
1157
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_semi_ui7.Icon, { size: "small", svg: typeManager.getDisplayIcon(schema || {}) });
|
|
1112
1158
|
}, []);
|
|
1113
1159
|
const renderVariable = (variable, parentFields = []) => {
|
|
1114
1160
|
let type = variable?.type;
|
|
@@ -1123,7 +1169,7 @@ function useVariableTree(params) {
|
|
|
1123
1169
|
const key = keyPath.join(".");
|
|
1124
1170
|
const isSchemaInclude = includeSchema ? import_json_schema5.JsonSchemaUtils.isASTMatchSchema(type, includeSchema) : true;
|
|
1125
1171
|
const isSchemaExclude = excludeSchema ? import_json_schema5.JsonSchemaUtils.isASTMatchSchema(type, excludeSchema) : false;
|
|
1126
|
-
const isCustomSkip =
|
|
1172
|
+
const isCustomSkip = skipVariable ? skipVariable(variable) : false;
|
|
1127
1173
|
const isMetaDisabled = variable.meta?.disabled;
|
|
1128
1174
|
const isSchemaMatch = isSchemaInclude && !isSchemaExclude && !isCustomSkip && !isMetaDisabled;
|
|
1129
1175
|
if (!isSchemaMatch && !children?.length) {
|
|
@@ -1143,27 +1189,27 @@ function useVariableTree(params) {
|
|
|
1143
1189
|
};
|
|
1144
1190
|
return [...variables.slice(0).reverse()].map((_variable) => renderVariable(_variable)).filter(Boolean);
|
|
1145
1191
|
}
|
|
1146
|
-
var
|
|
1192
|
+
var import_react14, import_json_schema5, import_editor11, import_semi_ui7;
|
|
1147
1193
|
var init_use_variable_tree = __esm({
|
|
1148
1194
|
"src/components/variable-selector/use-variable-tree.tsx"() {
|
|
1149
1195
|
"use strict";
|
|
1150
1196
|
init_cjs_shims();
|
|
1151
|
-
|
|
1197
|
+
import_react14 = __toESM(require("react"));
|
|
1152
1198
|
import_json_schema5 = require("@flowgram.ai/json-schema");
|
|
1153
1199
|
import_editor11 = require("@flowgram.ai/editor");
|
|
1154
|
-
|
|
1200
|
+
import_semi_ui7 = require("@douyinfe/semi-ui");
|
|
1155
1201
|
init_plugins();
|
|
1156
1202
|
}
|
|
1157
1203
|
});
|
|
1158
1204
|
|
|
1159
1205
|
// src/components/variable-selector/styles.tsx
|
|
1160
|
-
var import_styled_components2,
|
|
1206
|
+
var import_styled_components2, import_semi_ui8, UIRootTitle, UIVarName, UITag, UITreeSelect, UIPopoverContent;
|
|
1161
1207
|
var init_styles = __esm({
|
|
1162
1208
|
"src/components/variable-selector/styles.tsx"() {
|
|
1163
1209
|
"use strict";
|
|
1164
1210
|
init_cjs_shims();
|
|
1165
1211
|
import_styled_components2 = __toESM(require("styled-components"));
|
|
1166
|
-
|
|
1212
|
+
import_semi_ui8 = require("@douyinfe/semi-ui");
|
|
1167
1213
|
UIRootTitle = import_styled_components2.default.div`
|
|
1168
1214
|
margin-right: 4px;
|
|
1169
1215
|
min-width: 20px;
|
|
@@ -1181,7 +1227,7 @@ var init_styles = __esm({
|
|
|
1181
1227
|
min-width: 50%;
|
|
1182
1228
|
`}
|
|
1183
1229
|
`;
|
|
1184
|
-
UITag = (0, import_styled_components2.default)(
|
|
1230
|
+
UITag = (0, import_styled_components2.default)(import_semi_ui8.Tag)`
|
|
1185
1231
|
width: 100%;
|
|
1186
1232
|
display: flex;
|
|
1187
1233
|
align-items: center;
|
|
@@ -1196,7 +1242,7 @@ var init_styles = __esm({
|
|
|
1196
1242
|
height: 22px;
|
|
1197
1243
|
}
|
|
1198
1244
|
`;
|
|
1199
|
-
UITreeSelect = (0, import_styled_components2.default)(
|
|
1245
|
+
UITreeSelect = (0, import_styled_components2.default)(import_semi_ui8.TreeSelect)`
|
|
1200
1246
|
outline: ${({ $error }) => $error ? "1px solid red" : "none"};
|
|
1201
1247
|
|
|
1202
1248
|
& .semi-tree-select-selection {
|
|
@@ -1222,19 +1268,40 @@ var init_styles = __esm({
|
|
|
1222
1268
|
}
|
|
1223
1269
|
});
|
|
1224
1270
|
|
|
1271
|
+
// src/components/variable-selector/context.tsx
|
|
1272
|
+
var import_react15, VariableSelectorContext, useVariableSelectorContext, VariableSelectorProvider;
|
|
1273
|
+
var init_context = __esm({
|
|
1274
|
+
"src/components/variable-selector/context.tsx"() {
|
|
1275
|
+
"use strict";
|
|
1276
|
+
init_cjs_shims();
|
|
1277
|
+
import_react15 = __toESM(require("react"));
|
|
1278
|
+
VariableSelectorContext = (0, import_react15.createContext)({});
|
|
1279
|
+
useVariableSelectorContext = () => (0, import_react15.useContext)(VariableSelectorContext);
|
|
1280
|
+
VariableSelectorProvider = ({
|
|
1281
|
+
children,
|
|
1282
|
+
skipVariable
|
|
1283
|
+
}) => {
|
|
1284
|
+
const context = (0, import_react15.useMemo)(() => ({ skipVariable }), [skipVariable]);
|
|
1285
|
+
return /* @__PURE__ */ import_react15.default.createElement(VariableSelectorContext.Provider, { value: context }, children);
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
|
|
1225
1290
|
// src/components/variable-selector/index.tsx
|
|
1226
|
-
var
|
|
1291
|
+
var import_react16, import_editor12, import_semi_ui9, import_semi_icons, VariableSelector, InjectVariableSelector;
|
|
1227
1292
|
var init_variable_selector = __esm({
|
|
1228
1293
|
"src/components/variable-selector/index.tsx"() {
|
|
1229
1294
|
"use strict";
|
|
1230
1295
|
init_cjs_shims();
|
|
1231
|
-
|
|
1296
|
+
import_react16 = __toESM(require("react"));
|
|
1232
1297
|
import_editor12 = require("@flowgram.ai/editor");
|
|
1233
|
-
|
|
1298
|
+
import_semi_ui9 = require("@douyinfe/semi-ui");
|
|
1234
1299
|
import_semi_icons = require("@douyinfe/semi-icons");
|
|
1235
1300
|
init_shared();
|
|
1236
1301
|
init_use_variable_tree();
|
|
1237
1302
|
init_styles();
|
|
1303
|
+
init_context();
|
|
1304
|
+
init_context();
|
|
1238
1305
|
VariableSelector = ({
|
|
1239
1306
|
value,
|
|
1240
1307
|
config = {},
|
|
@@ -1246,8 +1313,13 @@ var init_variable_selector = __esm({
|
|
|
1246
1313
|
hasError,
|
|
1247
1314
|
triggerRender
|
|
1248
1315
|
}) => {
|
|
1249
|
-
const
|
|
1250
|
-
const
|
|
1316
|
+
const { skipVariable } = useVariableSelectorContext();
|
|
1317
|
+
const treeData = useVariableTree({
|
|
1318
|
+
includeSchema,
|
|
1319
|
+
excludeSchema,
|
|
1320
|
+
skipVariable
|
|
1321
|
+
});
|
|
1322
|
+
const treeValue = (0, import_react16.useMemo)(() => {
|
|
1251
1323
|
if (typeof value === "string") {
|
|
1252
1324
|
console.warn(
|
|
1253
1325
|
"The Value of VariableSelector is a string, it should be an ARRAY. \n",
|
|
@@ -1259,11 +1331,11 @@ var init_variable_selector = __esm({
|
|
|
1259
1331
|
}, [value]);
|
|
1260
1332
|
const renderIcon = (icon) => {
|
|
1261
1333
|
if (typeof icon === "string") {
|
|
1262
|
-
return /* @__PURE__ */
|
|
1334
|
+
return /* @__PURE__ */ import_react16.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
1263
1335
|
}
|
|
1264
1336
|
return icon;
|
|
1265
1337
|
};
|
|
1266
|
-
return /* @__PURE__ */
|
|
1338
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(
|
|
1267
1339
|
UITreeSelect,
|
|
1268
1340
|
{
|
|
1269
1341
|
dropdownMatchSelectWidth: false,
|
|
@@ -1280,10 +1352,10 @@ var init_variable_selector = __esm({
|
|
|
1280
1352
|
},
|
|
1281
1353
|
renderSelectedItem: (_option) => {
|
|
1282
1354
|
if (!_option?.keyPath) {
|
|
1283
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
1284
1356
|
UITag,
|
|
1285
1357
|
{
|
|
1286
|
-
prefixIcon: /* @__PURE__ */
|
|
1358
|
+
prefixIcon: /* @__PURE__ */ import_react16.default.createElement(import_semi_icons.IconIssueStroked, null),
|
|
1287
1359
|
color: "amber",
|
|
1288
1360
|
closable: !readonly,
|
|
1289
1361
|
onClose: () => onChange(void 0)
|
|
@@ -1292,13 +1364,13 @@ var init_variable_selector = __esm({
|
|
|
1292
1364
|
);
|
|
1293
1365
|
}
|
|
1294
1366
|
const rootIcon = renderIcon(_option.rootMeta?.icon || _option?.icon);
|
|
1295
|
-
const rootTitle = /* @__PURE__ */
|
|
1296
|
-
return /* @__PURE__ */
|
|
1297
|
-
|
|
1367
|
+
const rootTitle = /* @__PURE__ */ import_react16.default.createElement(UIRootTitle, null, _option.rootMeta?.title ? `${_option.rootMeta?.title} ${_option.isRoot ? "" : "-"} ` : null);
|
|
1368
|
+
return /* @__PURE__ */ import_react16.default.createElement("div", null, /* @__PURE__ */ import_react16.default.createElement(
|
|
1369
|
+
import_semi_ui9.Popover,
|
|
1298
1370
|
{
|
|
1299
|
-
content: /* @__PURE__ */
|
|
1371
|
+
content: /* @__PURE__ */ import_react16.default.createElement(UIPopoverContent, null, rootIcon, rootTitle, /* @__PURE__ */ import_react16.default.createElement(UIVarName, null, _option.keyPath.slice(1).join(".")))
|
|
1300
1372
|
},
|
|
1301
|
-
/* @__PURE__ */
|
|
1373
|
+
/* @__PURE__ */ import_react16.default.createElement(
|
|
1302
1374
|
UITag,
|
|
1303
1375
|
{
|
|
1304
1376
|
prefixIcon: rootIcon,
|
|
@@ -1306,12 +1378,12 @@ var init_variable_selector = __esm({
|
|
|
1306
1378
|
onClose: () => onChange(void 0)
|
|
1307
1379
|
},
|
|
1308
1380
|
rootTitle,
|
|
1309
|
-
!_option.isRoot && /* @__PURE__ */
|
|
1381
|
+
!_option.isRoot && /* @__PURE__ */ import_react16.default.createElement(UIVarName, { $inSelector: true }, _option.label)
|
|
1310
1382
|
)
|
|
1311
1383
|
));
|
|
1312
1384
|
},
|
|
1313
1385
|
showClear: false,
|
|
1314
|
-
arrowIcon: /* @__PURE__ */
|
|
1386
|
+
arrowIcon: /* @__PURE__ */ import_react16.default.createElement(import_semi_icons.IconChevronDownStroked, { size: "small" }),
|
|
1315
1387
|
triggerRender,
|
|
1316
1388
|
placeholder: config?.placeholder ?? import_editor12.I18n.t("Select Variable")
|
|
1317
1389
|
}
|
|
@@ -1343,8 +1415,8 @@ var init_styles2 = __esm({
|
|
|
1343
1415
|
|
|
1344
1416
|
// src/components/prompt-editor/extensions/markdown.tsx
|
|
1345
1417
|
function MarkdownHighlight() {
|
|
1346
|
-
const injector = (0,
|
|
1347
|
-
(0,
|
|
1418
|
+
const injector = (0, import_react37.useInjector)();
|
|
1419
|
+
(0, import_react36.useLayoutEffect)(
|
|
1348
1420
|
() => injector.inject([
|
|
1349
1421
|
import_editor23.astDecorator.whole.of((cursor) => {
|
|
1350
1422
|
if (cursor.name.startsWith("ATXHeading")) {
|
|
@@ -1392,13 +1464,13 @@ function MarkdownHighlight() {
|
|
|
1392
1464
|
);
|
|
1393
1465
|
return null;
|
|
1394
1466
|
}
|
|
1395
|
-
var
|
|
1467
|
+
var import_react36, import_react37, import_editor23, import_view2, markdown_default;
|
|
1396
1468
|
var init_markdown = __esm({
|
|
1397
1469
|
"src/components/prompt-editor/extensions/markdown.tsx"() {
|
|
1398
1470
|
"use strict";
|
|
1399
1471
|
init_cjs_shims();
|
|
1400
|
-
|
|
1401
|
-
|
|
1472
|
+
import_react36 = require("react");
|
|
1473
|
+
import_react37 = require("@coze-editor/editor/react");
|
|
1402
1474
|
import_editor23 = require("@coze-editor/editor");
|
|
1403
1475
|
import_view2 = require("@codemirror/view");
|
|
1404
1476
|
markdown_default = MarkdownHighlight;
|
|
@@ -1407,17 +1479,17 @@ var init_markdown = __esm({
|
|
|
1407
1479
|
|
|
1408
1480
|
// src/components/prompt-editor/extensions/language-support.tsx
|
|
1409
1481
|
function LanguageSupport() {
|
|
1410
|
-
const injector = (0,
|
|
1411
|
-
(0,
|
|
1482
|
+
const injector = (0, import_react39.useInjector)();
|
|
1483
|
+
(0, import_react38.useLayoutEffect)(() => injector.inject([import_preset_prompt.languageSupport]), [injector]);
|
|
1412
1484
|
return null;
|
|
1413
1485
|
}
|
|
1414
|
-
var
|
|
1486
|
+
var import_react38, import_react39, import_preset_prompt, language_support_default;
|
|
1415
1487
|
var init_language_support = __esm({
|
|
1416
1488
|
"src/components/prompt-editor/extensions/language-support.tsx"() {
|
|
1417
1489
|
"use strict";
|
|
1418
1490
|
init_cjs_shims();
|
|
1419
|
-
|
|
1420
|
-
|
|
1491
|
+
import_react38 = require("react");
|
|
1492
|
+
import_react39 = require("@coze-editor/editor/react");
|
|
1421
1493
|
import_preset_prompt = require("@coze-editor/editor/preset-prompt");
|
|
1422
1494
|
language_support_default = LanguageSupport;
|
|
1423
1495
|
}
|
|
@@ -1425,8 +1497,8 @@ var init_language_support = __esm({
|
|
|
1425
1497
|
|
|
1426
1498
|
// src/components/prompt-editor/extensions/jinja.tsx
|
|
1427
1499
|
function JinjaHighlight() {
|
|
1428
|
-
const injector = (0,
|
|
1429
|
-
(0,
|
|
1500
|
+
const injector = (0, import_react41.useInjector)();
|
|
1501
|
+
(0, import_react40.useLayoutEffect)(
|
|
1430
1502
|
() => injector.inject([
|
|
1431
1503
|
import_editor24.astDecorator.whole.of((cursor) => {
|
|
1432
1504
|
if (cursor.name === "JinjaStatementStart" || cursor.name === "JinjaStatementEnd") {
|
|
@@ -1464,13 +1536,13 @@ function JinjaHighlight() {
|
|
|
1464
1536
|
);
|
|
1465
1537
|
return null;
|
|
1466
1538
|
}
|
|
1467
|
-
var
|
|
1539
|
+
var import_react40, import_react41, import_editor24, import_view3, jinja_default;
|
|
1468
1540
|
var init_jinja = __esm({
|
|
1469
1541
|
"src/components/prompt-editor/extensions/jinja.tsx"() {
|
|
1470
1542
|
"use strict";
|
|
1471
1543
|
init_cjs_shims();
|
|
1472
|
-
|
|
1473
|
-
|
|
1544
|
+
import_react40 = require("react");
|
|
1545
|
+
import_react41 = require("@coze-editor/editor/react");
|
|
1474
1546
|
import_editor24 = require("@coze-editor/editor");
|
|
1475
1547
|
import_view3 = require("@codemirror/view");
|
|
1476
1548
|
jinja_default = JinjaHighlight;
|
|
@@ -1495,14 +1567,14 @@ function PromptEditor(props) {
|
|
|
1495
1567
|
disableMarkdownHighlight,
|
|
1496
1568
|
options
|
|
1497
1569
|
} = props || {};
|
|
1498
|
-
const editorRef = (0,
|
|
1499
|
-
(0,
|
|
1570
|
+
const editorRef = (0, import_react42.useRef)(null);
|
|
1571
|
+
(0, import_react42.useEffect)(() => {
|
|
1500
1572
|
if (editorRef.current?.getValue() !== value?.content) {
|
|
1501
1573
|
editorRef.current?.setValue(String(value?.content || ""));
|
|
1502
1574
|
}
|
|
1503
1575
|
}, [value]);
|
|
1504
|
-
return /* @__PURE__ */
|
|
1505
|
-
|
|
1576
|
+
return /* @__PURE__ */ import_react42.default.createElement(UIContainer5, { $hasError: hasError, style }, /* @__PURE__ */ import_react42.default.createElement(import_react43.EditorProvider, null, /* @__PURE__ */ import_react42.default.createElement(
|
|
1577
|
+
import_react43.Renderer,
|
|
1506
1578
|
{
|
|
1507
1579
|
didMount: (editor) => {
|
|
1508
1580
|
editorRef.current = editor;
|
|
@@ -1519,15 +1591,15 @@ function PromptEditor(props) {
|
|
|
1519
1591
|
onChange({ type: "template", content: e.value });
|
|
1520
1592
|
}
|
|
1521
1593
|
}
|
|
1522
|
-
), activeLinePlaceholder && /* @__PURE__ */
|
|
1594
|
+
), activeLinePlaceholder && /* @__PURE__ */ import_react42.default.createElement(import_react43.ActiveLinePlaceholder, null, activeLinePlaceholder), !disableMarkdownHighlight && /* @__PURE__ */ import_react42.default.createElement(markdown_default, null), /* @__PURE__ */ import_react42.default.createElement(language_support_default, null), /* @__PURE__ */ import_react42.default.createElement(jinja_default, null), children));
|
|
1523
1595
|
}
|
|
1524
|
-
var
|
|
1596
|
+
var import_react42, import_react43, import_preset_prompt2;
|
|
1525
1597
|
var init_editor2 = __esm({
|
|
1526
1598
|
"src/components/prompt-editor/editor.tsx"() {
|
|
1527
1599
|
"use strict";
|
|
1528
1600
|
init_cjs_shims();
|
|
1529
|
-
|
|
1530
|
-
|
|
1601
|
+
import_react42 = __toESM(require("react"));
|
|
1602
|
+
import_react43 = require("@coze-editor/editor/react");
|
|
1531
1603
|
import_preset_prompt2 = __toESM(require("@coze-editor/editor/preset-prompt"));
|
|
1532
1604
|
init_styles2();
|
|
1533
1605
|
init_markdown();
|
|
@@ -1537,13 +1609,13 @@ var init_editor2 = __esm({
|
|
|
1537
1609
|
});
|
|
1538
1610
|
|
|
1539
1611
|
// src/components/prompt-editor/index.tsx
|
|
1540
|
-
var
|
|
1612
|
+
var PromptEditor2;
|
|
1541
1613
|
var init_prompt_editor = __esm({
|
|
1542
1614
|
"src/components/prompt-editor/index.tsx"() {
|
|
1543
1615
|
"use strict";
|
|
1544
1616
|
init_cjs_shims();
|
|
1545
|
-
|
|
1546
|
-
PromptEditor2 = (
|
|
1617
|
+
init_shared();
|
|
1618
|
+
PromptEditor2 = lazySuspense(
|
|
1547
1619
|
() => Promise.resolve().then(() => (init_editor2(), editor_exports2)).then((module2) => ({ default: module2.PromptEditor }))
|
|
1548
1620
|
);
|
|
1549
1621
|
}
|
|
@@ -1551,12 +1623,12 @@ var init_prompt_editor = __esm({
|
|
|
1551
1623
|
|
|
1552
1624
|
// src/components/prompt-editor-with-variables/extensions/variable-tree.tsx
|
|
1553
1625
|
function VariableTree() {
|
|
1554
|
-
const [posKey, setPosKey] = (0,
|
|
1555
|
-
const [visible, setVisible] = (0,
|
|
1556
|
-
const [position, setPosition] = (0,
|
|
1557
|
-
const editor = (0,
|
|
1626
|
+
const [posKey, setPosKey] = (0, import_react44.useState)("");
|
|
1627
|
+
const [visible, setVisible] = (0, import_react44.useState)(false);
|
|
1628
|
+
const [position, setPosition] = (0, import_react44.useState)(-1);
|
|
1629
|
+
const editor = (0, import_react45.useEditor)();
|
|
1558
1630
|
function insert(variablePath) {
|
|
1559
|
-
const range = (0,
|
|
1631
|
+
const range = (0, import_react45.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
1560
1632
|
if (!range) {
|
|
1561
1633
|
return;
|
|
1562
1634
|
}
|
|
@@ -1578,21 +1650,21 @@ function VariableTree() {
|
|
|
1578
1650
|
setPosition(e.state.selection.main.head);
|
|
1579
1651
|
setVisible(e.value);
|
|
1580
1652
|
}
|
|
1581
|
-
(0,
|
|
1653
|
+
(0, import_react44.useEffect)(() => {
|
|
1582
1654
|
if (!editor) {
|
|
1583
1655
|
return;
|
|
1584
1656
|
}
|
|
1585
1657
|
}, [editor, visible]);
|
|
1586
1658
|
const treeData = useVariableTree({});
|
|
1587
|
-
return /* @__PURE__ */
|
|
1588
|
-
|
|
1659
|
+
return /* @__PURE__ */ import_react44.default.createElement(import_react44.default.Fragment, null, /* @__PURE__ */ import_react44.default.createElement(import_react45.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react44.default.createElement(
|
|
1660
|
+
import_semi_ui21.Popover,
|
|
1589
1661
|
{
|
|
1590
1662
|
visible,
|
|
1591
1663
|
trigger: "custom",
|
|
1592
1664
|
position: "topLeft",
|
|
1593
1665
|
rePosKey: posKey,
|
|
1594
|
-
content: /* @__PURE__ */
|
|
1595
|
-
|
|
1666
|
+
content: /* @__PURE__ */ import_react44.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react44.default.createElement(
|
|
1667
|
+
import_semi_ui21.Tree,
|
|
1596
1668
|
{
|
|
1597
1669
|
treeData,
|
|
1598
1670
|
onSelect: (v) => {
|
|
@@ -1601,8 +1673,8 @@ function VariableTree() {
|
|
|
1601
1673
|
}
|
|
1602
1674
|
))
|
|
1603
1675
|
},
|
|
1604
|
-
/* @__PURE__ */
|
|
1605
|
-
|
|
1676
|
+
/* @__PURE__ */ import_react44.default.createElement(
|
|
1677
|
+
import_react45.PositionMirror,
|
|
1606
1678
|
{
|
|
1607
1679
|
position,
|
|
1608
1680
|
onChange: () => setPosKey(String(Math.random()))
|
|
@@ -1610,26 +1682,26 @@ function VariableTree() {
|
|
|
1610
1682
|
)
|
|
1611
1683
|
));
|
|
1612
1684
|
}
|
|
1613
|
-
var
|
|
1685
|
+
var import_react44, import_semi_ui21, import_react45;
|
|
1614
1686
|
var init_variable_tree = __esm({
|
|
1615
1687
|
"src/components/prompt-editor-with-variables/extensions/variable-tree.tsx"() {
|
|
1616
1688
|
"use strict";
|
|
1617
1689
|
init_cjs_shims();
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1690
|
+
import_react44 = __toESM(require("react"));
|
|
1691
|
+
import_semi_ui21 = require("@douyinfe/semi-ui");
|
|
1692
|
+
import_react45 = require("@coze-editor/editor/react");
|
|
1621
1693
|
init_variable_selector();
|
|
1622
1694
|
}
|
|
1623
1695
|
});
|
|
1624
1696
|
|
|
1625
1697
|
// src/components/prompt-editor-with-variables/styles.tsx
|
|
1626
|
-
var import_styled_components9,
|
|
1698
|
+
var import_styled_components9, import_semi_ui22, UIRootTitle2, UIVarName2, UITag2, UIPopoverContent2;
|
|
1627
1699
|
var init_styles3 = __esm({
|
|
1628
1700
|
"src/components/prompt-editor-with-variables/styles.tsx"() {
|
|
1629
1701
|
"use strict";
|
|
1630
1702
|
init_cjs_shims();
|
|
1631
1703
|
import_styled_components9 = __toESM(require("styled-components"));
|
|
1632
|
-
|
|
1704
|
+
import_semi_ui22 = require("@douyinfe/semi-ui");
|
|
1633
1705
|
UIRootTitle2 = import_styled_components9.default.div`
|
|
1634
1706
|
margin-right: 4px;
|
|
1635
1707
|
min-width: 20px;
|
|
@@ -1643,7 +1715,7 @@ var init_styles3 = __esm({
|
|
|
1643
1715
|
text-overflow: ellipsis;
|
|
1644
1716
|
white-space: nowrap;
|
|
1645
1717
|
`;
|
|
1646
|
-
UITag2 = (0, import_styled_components9.default)(
|
|
1718
|
+
UITag2 = (0, import_styled_components9.default)(import_semi_ui22.Tag)`
|
|
1647
1719
|
display: inline-flex;
|
|
1648
1720
|
align-items: center;
|
|
1649
1721
|
justify-content: flex-start;
|
|
@@ -1668,9 +1740,9 @@ var init_styles3 = __esm({
|
|
|
1668
1740
|
|
|
1669
1741
|
// src/components/prompt-editor-with-variables/extensions/variable-tag.tsx
|
|
1670
1742
|
function VariableTagInject() {
|
|
1671
|
-
const injector = (0,
|
|
1743
|
+
const injector = (0, import_react47.useInjector)();
|
|
1672
1744
|
const scope = (0, import_editor25.useCurrentScope)();
|
|
1673
|
-
(0,
|
|
1745
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
1674
1746
|
const atMatcher = new import_view4.MatchDecorator({
|
|
1675
1747
|
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
1676
1748
|
decoration: (match) => import_view4.Decoration.replace({
|
|
@@ -1704,17 +1776,17 @@ function VariableTagInject() {
|
|
|
1704
1776
|
}, [injector]);
|
|
1705
1777
|
return null;
|
|
1706
1778
|
}
|
|
1707
|
-
var
|
|
1779
|
+
var import_react46, import_lodash_es5, import_editor25, import_semi_ui23, import_semi_icons8, import_react47, import_view4, VariableTagWidget;
|
|
1708
1780
|
var init_variable_tag = __esm({
|
|
1709
1781
|
"src/components/prompt-editor-with-variables/extensions/variable-tag.tsx"() {
|
|
1710
1782
|
"use strict";
|
|
1711
1783
|
init_cjs_shims();
|
|
1712
|
-
|
|
1713
|
-
|
|
1784
|
+
import_react46 = __toESM(require("react"));
|
|
1785
|
+
import_lodash_es5 = require("lodash-es");
|
|
1714
1786
|
import_editor25 = require("@flowgram.ai/editor");
|
|
1715
|
-
|
|
1787
|
+
import_semi_ui23 = require("@douyinfe/semi-ui");
|
|
1716
1788
|
import_semi_icons8 = require("@douyinfe/semi-icons");
|
|
1717
|
-
|
|
1789
|
+
import_react47 = require("@coze-editor/editor/react");
|
|
1718
1790
|
import_view4 = require("@codemirror/view");
|
|
1719
1791
|
init_shared();
|
|
1720
1792
|
init_styles3();
|
|
@@ -1724,7 +1796,7 @@ var init_variable_tag = __esm({
|
|
|
1724
1796
|
this.toDispose = new import_editor25.DisposableCollection();
|
|
1725
1797
|
this.renderIcon = (icon) => {
|
|
1726
1798
|
if (typeof icon === "string") {
|
|
1727
|
-
return /* @__PURE__ */
|
|
1799
|
+
return /* @__PURE__ */ import_react46.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
1728
1800
|
}
|
|
1729
1801
|
return icon;
|
|
1730
1802
|
};
|
|
@@ -1734,20 +1806,20 @@ var init_variable_tag = __esm({
|
|
|
1734
1806
|
renderVariable(v) {
|
|
1735
1807
|
if (!v) {
|
|
1736
1808
|
this.root.render(
|
|
1737
|
-
/* @__PURE__ */
|
|
1809
|
+
/* @__PURE__ */ import_react46.default.createElement(UITag2, { prefixIcon: /* @__PURE__ */ import_react46.default.createElement(import_semi_icons8.IconIssueStroked, null), color: "amber" }, "Unknown")
|
|
1738
1810
|
);
|
|
1739
1811
|
return;
|
|
1740
1812
|
}
|
|
1741
|
-
const rootField = (0,
|
|
1742
|
-
const rootTitle = /* @__PURE__ */
|
|
1813
|
+
const rootField = (0, import_lodash_es5.last)(v.parentFields);
|
|
1814
|
+
const rootTitle = /* @__PURE__ */ import_react46.default.createElement(UIRootTitle2, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
|
|
1743
1815
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
1744
1816
|
this.root.render(
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
|
|
1817
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
1818
|
+
import_semi_ui23.Popover,
|
|
1747
1819
|
{
|
|
1748
|
-
content: /* @__PURE__ */
|
|
1820
|
+
content: /* @__PURE__ */ import_react46.default.createElement(UIPopoverContent2, null, rootIcon, rootTitle, /* @__PURE__ */ import_react46.default.createElement(UIVarName2, null, v?.keyPath.slice(1).join(".")))
|
|
1749
1821
|
},
|
|
1750
|
-
/* @__PURE__ */
|
|
1822
|
+
/* @__PURE__ */ import_react46.default.createElement(UITag2, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ import_react46.default.createElement(UIVarName2, null, v?.key))
|
|
1751
1823
|
)
|
|
1752
1824
|
);
|
|
1753
1825
|
}
|
|
@@ -1772,7 +1844,7 @@ var init_variable_tag = __esm({
|
|
|
1772
1844
|
return dom;
|
|
1773
1845
|
}
|
|
1774
1846
|
eq(other) {
|
|
1775
|
-
return (0,
|
|
1847
|
+
return (0, import_lodash_es5.isEqual)(this.keyPath, other.keyPath);
|
|
1776
1848
|
}
|
|
1777
1849
|
ignoreEvent() {
|
|
1778
1850
|
return false;
|
|
@@ -1790,14 +1862,14 @@ __export(editor_exports3, {
|
|
|
1790
1862
|
PromptEditorWithVariables: () => PromptEditorWithVariables
|
|
1791
1863
|
});
|
|
1792
1864
|
function PromptEditorWithVariables(props) {
|
|
1793
|
-
return /* @__PURE__ */
|
|
1865
|
+
return /* @__PURE__ */ import_react48.default.createElement(PromptEditor2, { ...props }, /* @__PURE__ */ import_react48.default.createElement(VariableTree, null), /* @__PURE__ */ import_react48.default.createElement(VariableTagInject, null));
|
|
1794
1866
|
}
|
|
1795
|
-
var
|
|
1867
|
+
var import_react48;
|
|
1796
1868
|
var init_editor3 = __esm({
|
|
1797
1869
|
"src/components/prompt-editor-with-variables/editor.tsx"() {
|
|
1798
1870
|
"use strict";
|
|
1799
1871
|
init_cjs_shims();
|
|
1800
|
-
|
|
1872
|
+
import_react48 = __toESM(require("react"));
|
|
1801
1873
|
init_prompt_editor();
|
|
1802
1874
|
init_variable_tree();
|
|
1803
1875
|
init_variable_tag();
|
|
@@ -1837,7 +1909,7 @@ function InputsPicker({
|
|
|
1837
1909
|
const key = keyPath.map((_key, idx) => _key === "[0]" || idx === 0 ? _key : `.${_key}`).join("");
|
|
1838
1910
|
return {
|
|
1839
1911
|
key,
|
|
1840
|
-
label: (0,
|
|
1912
|
+
label: (0, import_lodash_es6.last)(keyPath),
|
|
1841
1913
|
value: key,
|
|
1842
1914
|
children
|
|
1843
1915
|
};
|
|
@@ -1854,14 +1926,14 @@ function InputsPicker({
|
|
|
1854
1926
|
return {
|
|
1855
1927
|
key: currKey,
|
|
1856
1928
|
value: currKey,
|
|
1857
|
-
label: (0,
|
|
1929
|
+
label: (0, import_lodash_es6.last)(keyPath)
|
|
1858
1930
|
};
|
|
1859
1931
|
}
|
|
1860
|
-
if ((0,
|
|
1932
|
+
if ((0, import_lodash_es6.isPlainObject)(value)) {
|
|
1861
1933
|
return {
|
|
1862
1934
|
key: currKey,
|
|
1863
1935
|
value: currKey,
|
|
1864
|
-
label: (0,
|
|
1936
|
+
label: (0, import_lodash_es6.last)(keyPath),
|
|
1865
1937
|
children: Object.entries(value).map(([key, value2]) => getTreeData(value2, [...keyPath, key])).filter(Boolean)
|
|
1866
1938
|
};
|
|
1867
1939
|
}
|
|
@@ -1870,17 +1942,17 @@ function InputsPicker({
|
|
|
1870
1942
|
() => Object.entries(inputsValues).map(([key, value]) => getTreeData(value, [key])).filter(Boolean),
|
|
1871
1943
|
[]
|
|
1872
1944
|
);
|
|
1873
|
-
return /* @__PURE__ */ import_react49.default.createElement(
|
|
1945
|
+
return /* @__PURE__ */ import_react49.default.createElement(import_semi_ui24.Tree, { treeData, onSelect: (v) => onSelect(v) });
|
|
1874
1946
|
}
|
|
1875
|
-
var import_react49,
|
|
1947
|
+
var import_react49, import_lodash_es6, import_editor26, import_semi_ui24;
|
|
1876
1948
|
var init_inputs_picker = __esm({
|
|
1877
1949
|
"src/components/prompt-editor-with-inputs/inputs-picker.tsx"() {
|
|
1878
1950
|
"use strict";
|
|
1879
1951
|
init_cjs_shims();
|
|
1880
1952
|
import_react49 = __toESM(require("react"));
|
|
1881
|
-
|
|
1953
|
+
import_lodash_es6 = require("lodash-es");
|
|
1882
1954
|
import_editor26 = require("@flowgram.ai/editor");
|
|
1883
|
-
|
|
1955
|
+
import_semi_ui24 = require("@douyinfe/semi-ui");
|
|
1884
1956
|
init_shared();
|
|
1885
1957
|
}
|
|
1886
1958
|
});
|
|
@@ -1919,7 +1991,7 @@ function InputsTree({ inputsValues }) {
|
|
|
1919
1991
|
}
|
|
1920
1992
|
}, [editor, visible]);
|
|
1921
1993
|
return /* @__PURE__ */ import_react50.default.createElement(import_react50.default.Fragment, null, /* @__PURE__ */ import_react50.default.createElement(import_react51.Mention, { triggerCharacters: ["{", "{}", "@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react50.default.createElement(
|
|
1922
|
-
|
|
1994
|
+
import_semi_ui25.Popover,
|
|
1923
1995
|
{
|
|
1924
1996
|
visible,
|
|
1925
1997
|
trigger: "custom",
|
|
@@ -1944,13 +2016,13 @@ function InputsTree({ inputsValues }) {
|
|
|
1944
2016
|
)
|
|
1945
2017
|
));
|
|
1946
2018
|
}
|
|
1947
|
-
var import_react50,
|
|
2019
|
+
var import_react50, import_semi_ui25, import_react51;
|
|
1948
2020
|
var init_inputs_tree = __esm({
|
|
1949
2021
|
"src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx"() {
|
|
1950
2022
|
"use strict";
|
|
1951
2023
|
init_cjs_shims();
|
|
1952
2024
|
import_react50 = __toESM(require("react"));
|
|
1953
|
-
|
|
2025
|
+
import_semi_ui25 = require("@douyinfe/semi-ui");
|
|
1954
2026
|
import_react51 = require("@coze-editor/editor/react");
|
|
1955
2027
|
init_inputs_picker();
|
|
1956
2028
|
}
|
|
@@ -1980,12 +2052,12 @@ var init_editor4 = __esm({
|
|
|
1980
2052
|
|
|
1981
2053
|
// src/components/json-editor-with-variables/extensions/variable-tree.tsx
|
|
1982
2054
|
function VariableTree2() {
|
|
1983
|
-
const [posKey, setPosKey] = (0,
|
|
1984
|
-
const [visible, setVisible] = (0,
|
|
1985
|
-
const [position, setPosition] = (0,
|
|
1986
|
-
const editor = (0,
|
|
2055
|
+
const [posKey, setPosKey] = (0, import_react53.useState)("");
|
|
2056
|
+
const [visible, setVisible] = (0, import_react53.useState)(false);
|
|
2057
|
+
const [position, setPosition] = (0, import_react53.useState)(-1);
|
|
2058
|
+
const editor = (0, import_react54.useEditor)();
|
|
1987
2059
|
function insert(variablePath) {
|
|
1988
|
-
const range = (0,
|
|
2060
|
+
const range = (0, import_react54.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
1989
2061
|
if (!range) {
|
|
1990
2062
|
return;
|
|
1991
2063
|
}
|
|
@@ -1999,21 +2071,21 @@ function VariableTree2() {
|
|
|
1999
2071
|
setPosition(e.state.selection.main.head);
|
|
2000
2072
|
setVisible(e.value);
|
|
2001
2073
|
}
|
|
2002
|
-
(0,
|
|
2074
|
+
(0, import_react53.useEffect)(() => {
|
|
2003
2075
|
if (!editor) {
|
|
2004
2076
|
return;
|
|
2005
2077
|
}
|
|
2006
2078
|
}, [editor, visible]);
|
|
2007
2079
|
const treeData = useVariableTree({});
|
|
2008
|
-
return /* @__PURE__ */
|
|
2009
|
-
|
|
2080
|
+
return /* @__PURE__ */ import_react53.default.createElement(import_react53.default.Fragment, null, /* @__PURE__ */ import_react53.default.createElement(import_react54.Mention, { triggerCharacters: ["@"], onOpenChange: handleOpenChange }), /* @__PURE__ */ import_react53.default.createElement(
|
|
2081
|
+
import_semi_ui26.Popover,
|
|
2010
2082
|
{
|
|
2011
2083
|
visible,
|
|
2012
2084
|
trigger: "custom",
|
|
2013
2085
|
position: "topLeft",
|
|
2014
2086
|
rePosKey: posKey,
|
|
2015
|
-
content: /* @__PURE__ */
|
|
2016
|
-
|
|
2087
|
+
content: /* @__PURE__ */ import_react53.default.createElement("div", { style: { width: 300 } }, /* @__PURE__ */ import_react53.default.createElement(
|
|
2088
|
+
import_semi_ui26.Tree,
|
|
2017
2089
|
{
|
|
2018
2090
|
treeData,
|
|
2019
2091
|
onSelect: (v) => {
|
|
@@ -2022,8 +2094,8 @@ function VariableTree2() {
|
|
|
2022
2094
|
}
|
|
2023
2095
|
))
|
|
2024
2096
|
},
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
|
|
2097
|
+
/* @__PURE__ */ import_react53.default.createElement(
|
|
2098
|
+
import_react54.PositionMirror,
|
|
2027
2099
|
{
|
|
2028
2100
|
position,
|
|
2029
2101
|
onChange: () => setPosKey(String(Math.random()))
|
|
@@ -2031,26 +2103,26 @@ function VariableTree2() {
|
|
|
2031
2103
|
)
|
|
2032
2104
|
));
|
|
2033
2105
|
}
|
|
2034
|
-
var
|
|
2106
|
+
var import_react53, import_semi_ui26, import_react54;
|
|
2035
2107
|
var init_variable_tree2 = __esm({
|
|
2036
2108
|
"src/components/json-editor-with-variables/extensions/variable-tree.tsx"() {
|
|
2037
2109
|
"use strict";
|
|
2038
2110
|
init_cjs_shims();
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2111
|
+
import_react53 = __toESM(require("react"));
|
|
2112
|
+
import_semi_ui26 = require("@douyinfe/semi-ui");
|
|
2113
|
+
import_react54 = require("@coze-editor/editor/react");
|
|
2042
2114
|
init_variable_selector();
|
|
2043
2115
|
}
|
|
2044
2116
|
});
|
|
2045
2117
|
|
|
2046
2118
|
// src/components/json-editor-with-variables/styles.tsx
|
|
2047
|
-
var import_styled_components10,
|
|
2119
|
+
var import_styled_components10, import_semi_ui27, UIRootTitle3, UIVarName3, UITag3, UIPopoverContent3;
|
|
2048
2120
|
var init_styles4 = __esm({
|
|
2049
2121
|
"src/components/json-editor-with-variables/styles.tsx"() {
|
|
2050
2122
|
"use strict";
|
|
2051
2123
|
init_cjs_shims();
|
|
2052
2124
|
import_styled_components10 = __toESM(require("styled-components"));
|
|
2053
|
-
|
|
2125
|
+
import_semi_ui27 = require("@douyinfe/semi-ui");
|
|
2054
2126
|
UIRootTitle3 = import_styled_components10.default.div`
|
|
2055
2127
|
margin-right: 4px;
|
|
2056
2128
|
min-width: 20px;
|
|
@@ -2064,7 +2136,7 @@ var init_styles4 = __esm({
|
|
|
2064
2136
|
text-overflow: ellipsis;
|
|
2065
2137
|
white-space: nowrap;
|
|
2066
2138
|
`;
|
|
2067
|
-
UITag3 = (0, import_styled_components10.default)(
|
|
2139
|
+
UITag3 = (0, import_styled_components10.default)(import_semi_ui27.Tag)`
|
|
2068
2140
|
display: inline-flex;
|
|
2069
2141
|
align-items: center;
|
|
2070
2142
|
justify-content: flex-start;
|
|
@@ -2089,9 +2161,9 @@ var init_styles4 = __esm({
|
|
|
2089
2161
|
|
|
2090
2162
|
// src/components/json-editor-with-variables/extensions/variable-tag.tsx
|
|
2091
2163
|
function VariableTagInject2() {
|
|
2092
|
-
const injector = (0,
|
|
2164
|
+
const injector = (0, import_react56.useInjector)();
|
|
2093
2165
|
const scope = (0, import_editor27.useCurrentScope)();
|
|
2094
|
-
(0,
|
|
2166
|
+
(0, import_react55.useLayoutEffect)(() => {
|
|
2095
2167
|
const atMatcher = new import_view5.MatchDecorator({
|
|
2096
2168
|
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
2097
2169
|
decoration: (match) => import_view5.Decoration.replace({
|
|
@@ -2125,17 +2197,17 @@ function VariableTagInject2() {
|
|
|
2125
2197
|
}, [injector]);
|
|
2126
2198
|
return null;
|
|
2127
2199
|
}
|
|
2128
|
-
var
|
|
2200
|
+
var import_react55, import_lodash_es7, import_editor27, import_semi_ui28, import_semi_icons9, import_react56, import_view5, VariableTagWidget2;
|
|
2129
2201
|
var init_variable_tag2 = __esm({
|
|
2130
2202
|
"src/components/json-editor-with-variables/extensions/variable-tag.tsx"() {
|
|
2131
2203
|
"use strict";
|
|
2132
2204
|
init_cjs_shims();
|
|
2133
|
-
|
|
2134
|
-
|
|
2205
|
+
import_react55 = __toESM(require("react"));
|
|
2206
|
+
import_lodash_es7 = require("lodash-es");
|
|
2135
2207
|
import_editor27 = require("@flowgram.ai/editor");
|
|
2136
|
-
|
|
2208
|
+
import_semi_ui28 = require("@douyinfe/semi-ui");
|
|
2137
2209
|
import_semi_icons9 = require("@douyinfe/semi-icons");
|
|
2138
|
-
|
|
2210
|
+
import_react56 = require("@coze-editor/editor/react");
|
|
2139
2211
|
import_view5 = require("@codemirror/view");
|
|
2140
2212
|
init_shared();
|
|
2141
2213
|
init_styles4();
|
|
@@ -2145,7 +2217,7 @@ var init_variable_tag2 = __esm({
|
|
|
2145
2217
|
this.toDispose = new import_editor27.DisposableCollection();
|
|
2146
2218
|
this.renderIcon = (icon) => {
|
|
2147
2219
|
if (typeof icon === "string") {
|
|
2148
|
-
return /* @__PURE__ */
|
|
2220
|
+
return /* @__PURE__ */ import_react55.default.createElement("img", { style: { marginRight: 8 }, width: 12, height: 12, src: icon });
|
|
2149
2221
|
}
|
|
2150
2222
|
return icon;
|
|
2151
2223
|
};
|
|
@@ -2155,20 +2227,20 @@ var init_variable_tag2 = __esm({
|
|
|
2155
2227
|
renderVariable(v) {
|
|
2156
2228
|
if (!v) {
|
|
2157
2229
|
this.root.render(
|
|
2158
|
-
/* @__PURE__ */
|
|
2230
|
+
/* @__PURE__ */ import_react55.default.createElement(UITag3, { prefixIcon: /* @__PURE__ */ import_react55.default.createElement(import_semi_icons9.IconIssueStroked, null), color: "amber" }, "Unknown")
|
|
2159
2231
|
);
|
|
2160
2232
|
return;
|
|
2161
2233
|
}
|
|
2162
|
-
const rootField = (0,
|
|
2163
|
-
const rootTitle = /* @__PURE__ */
|
|
2234
|
+
const rootField = (0, import_lodash_es7.last)(v.parentFields);
|
|
2235
|
+
const rootTitle = /* @__PURE__ */ import_react55.default.createElement(UIRootTitle3, null, rootField?.meta.title ? `${rootField.meta.title} -` : "");
|
|
2164
2236
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
2165
2237
|
this.root.render(
|
|
2166
|
-
/* @__PURE__ */
|
|
2167
|
-
|
|
2238
|
+
/* @__PURE__ */ import_react55.default.createElement(
|
|
2239
|
+
import_semi_ui28.Popover,
|
|
2168
2240
|
{
|
|
2169
|
-
content: /* @__PURE__ */
|
|
2241
|
+
content: /* @__PURE__ */ import_react55.default.createElement(UIPopoverContent3, null, rootIcon, rootTitle, /* @__PURE__ */ import_react55.default.createElement(UIVarName3, null, v?.keyPath.slice(1).join(".")))
|
|
2170
2242
|
},
|
|
2171
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ import_react55.default.createElement(UITag3, { prefixIcon: rootIcon }, rootTitle, /* @__PURE__ */ import_react55.default.createElement(UIVarName3, null, v?.key))
|
|
2172
2244
|
)
|
|
2173
2245
|
);
|
|
2174
2246
|
}
|
|
@@ -2193,7 +2265,7 @@ var init_variable_tag2 = __esm({
|
|
|
2193
2265
|
return dom;
|
|
2194
2266
|
}
|
|
2195
2267
|
eq(other) {
|
|
2196
|
-
return (0,
|
|
2268
|
+
return (0, import_lodash_es7.isEqual)(this.keyPath, other.keyPath);
|
|
2197
2269
|
}
|
|
2198
2270
|
ignoreEvent() {
|
|
2199
2271
|
return false;
|
|
@@ -2229,7 +2301,7 @@ function findAllMatches(inputString, regex) {
|
|
|
2229
2301
|
return matches;
|
|
2230
2302
|
}
|
|
2231
2303
|
function JsonEditorWithVariables(props) {
|
|
2232
|
-
return /* @__PURE__ */
|
|
2304
|
+
return /* @__PURE__ */ import_react57.default.createElement(
|
|
2233
2305
|
CodeEditor2,
|
|
2234
2306
|
{
|
|
2235
2307
|
languageId: "json",
|
|
@@ -2240,16 +2312,16 @@ function JsonEditorWithVariables(props) {
|
|
|
2240
2312
|
...props.options || {}
|
|
2241
2313
|
}
|
|
2242
2314
|
},
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
2315
|
+
/* @__PURE__ */ import_react57.default.createElement(VariableTree2, null),
|
|
2316
|
+
/* @__PURE__ */ import_react57.default.createElement(VariableTagInject2, null)
|
|
2245
2317
|
);
|
|
2246
2318
|
}
|
|
2247
|
-
var
|
|
2319
|
+
var import_react57, import_editor28, import_preset_code6, transformer;
|
|
2248
2320
|
var init_editor5 = __esm({
|
|
2249
2321
|
"src/components/json-editor-with-variables/editor.tsx"() {
|
|
2250
2322
|
"use strict";
|
|
2251
2323
|
init_cjs_shims();
|
|
2252
|
-
|
|
2324
|
+
import_react57 = __toESM(require("react"));
|
|
2253
2325
|
import_editor28 = require("@flowgram.ai/editor");
|
|
2254
2326
|
import_preset_code6 = require("@coze-editor/editor/preset-code");
|
|
2255
2327
|
init_code_editor();
|
|
@@ -2303,6 +2375,7 @@ __export(src_exports, {
|
|
|
2303
2375
|
PromptEditorWithVariables: () => PromptEditorWithVariables2,
|
|
2304
2376
|
TypeSelector: () => TypeSelector,
|
|
2305
2377
|
VariableSelector: () => VariableSelector,
|
|
2378
|
+
VariableSelectorProvider: () => VariableSelectorProvider,
|
|
2306
2379
|
autoRenameRefEffect: () => autoRenameRefEffect,
|
|
2307
2380
|
createBatchOutputsFormPlugin: () => createBatchOutputsFormPlugin,
|
|
2308
2381
|
createDisableDeclarationPlugin: () => createDisableDeclarationPlugin,
|
|
@@ -2317,6 +2390,7 @@ __export(src_exports, {
|
|
|
2317
2390
|
getTypeSelectValue: () => getTypeSelectValue,
|
|
2318
2391
|
isLegacyFlowRefValueSchema: () => isLegacyFlowRefValueSchema,
|
|
2319
2392
|
isNewFlowRefValueSchema: () => isNewFlowRefValueSchema,
|
|
2393
|
+
lazySuspense: () => lazySuspense,
|
|
2320
2394
|
listenRefSchemaChange: () => listenRefSchemaChange,
|
|
2321
2395
|
listenRefValueChange: () => listenRefValueChange,
|
|
2322
2396
|
parseTypeSelectValue: () => parseTypeSelectValue,
|
|
@@ -2330,7 +2404,8 @@ __export(src_exports, {
|
|
|
2330
2404
|
useTypeManager: () => useTypeManager,
|
|
2331
2405
|
useVariableTree: () => useVariableTree,
|
|
2332
2406
|
validateFlowValue: () => validateFlowValue,
|
|
2333
|
-
validateWhenVariableSync: () => validateWhenVariableSync
|
|
2407
|
+
validateWhenVariableSync: () => validateWhenVariableSync,
|
|
2408
|
+
withSuspense: () => withSuspense
|
|
2334
2409
|
});
|
|
2335
2410
|
module.exports = __toCommonJS(src_exports);
|
|
2336
2411
|
init_cjs_shims();
|
|
@@ -2341,8 +2416,8 @@ init_variable_selector();
|
|
|
2341
2416
|
|
|
2342
2417
|
// src/components/type-selector/index.tsx
|
|
2343
2418
|
init_cjs_shims();
|
|
2344
|
-
var
|
|
2345
|
-
var
|
|
2419
|
+
var import_react17 = __toESM(require("react"));
|
|
2420
|
+
var import_semi_ui10 = require("@douyinfe/semi-ui");
|
|
2346
2421
|
init_inject_material();
|
|
2347
2422
|
init_plugins();
|
|
2348
2423
|
var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
|
|
@@ -2361,18 +2436,18 @@ var parseTypeSelectValue = (value) => {
|
|
|
2361
2436
|
};
|
|
2362
2437
|
function TypeSelector(props) {
|
|
2363
2438
|
const { value, onChange, readonly, disabled, style } = props;
|
|
2364
|
-
const selectValue = (0,
|
|
2439
|
+
const selectValue = (0, import_react17.useMemo)(() => getTypeSelectValue(value), [value]);
|
|
2365
2440
|
const typeManager = useTypeManager();
|
|
2366
2441
|
const icon = typeManager.getDisplayIcon(value || {});
|
|
2367
|
-
const options = (0,
|
|
2442
|
+
const options = (0, import_react17.useMemo)(
|
|
2368
2443
|
() => typeManager.getTypeRegistriesWithParentType().map((_type) => {
|
|
2369
2444
|
const isArray2 = _type.type === "array";
|
|
2370
2445
|
return {
|
|
2371
|
-
label: /* @__PURE__ */
|
|
2446
|
+
label: /* @__PURE__ */ import_react17.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react17.default.createElement(import_semi_ui10.Icon, { size: "small", svg: _type.icon }), typeManager.getTypeBySchema(_type)?.label || _type.type),
|
|
2372
2447
|
value: _type.type,
|
|
2373
2448
|
children: isArray2 ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
|
|
2374
|
-
label: /* @__PURE__ */
|
|
2375
|
-
|
|
2449
|
+
label: /* @__PURE__ */ import_react17.default.createElement("div", { style: labelStyle }, /* @__PURE__ */ import_react17.default.createElement(
|
|
2450
|
+
import_semi_ui10.Icon,
|
|
2376
2451
|
{
|
|
2377
2452
|
size: "small",
|
|
2378
2453
|
svg: typeManager.getDisplayIcon({
|
|
@@ -2388,13 +2463,13 @@ function TypeSelector(props) {
|
|
|
2388
2463
|
[]
|
|
2389
2464
|
);
|
|
2390
2465
|
const isDisabled = readonly || disabled;
|
|
2391
|
-
return /* @__PURE__ */
|
|
2392
|
-
|
|
2466
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
2467
|
+
import_semi_ui10.Cascader,
|
|
2393
2468
|
{
|
|
2394
2469
|
disabled: isDisabled,
|
|
2395
2470
|
size: "small",
|
|
2396
|
-
triggerRender: () => /* @__PURE__ */
|
|
2397
|
-
|
|
2471
|
+
triggerRender: () => /* @__PURE__ */ import_react17.default.createElement(
|
|
2472
|
+
import_semi_ui10.IconButton,
|
|
2398
2473
|
{
|
|
2399
2474
|
size: "small",
|
|
2400
2475
|
style: {
|
|
@@ -2419,21 +2494,21 @@ var InjectTypeSelector = createInjectMaterial(TypeSelector);
|
|
|
2419
2494
|
|
|
2420
2495
|
// src/components/json-schema-editor/index.tsx
|
|
2421
2496
|
init_cjs_shims();
|
|
2422
|
-
var
|
|
2497
|
+
var import_react23 = __toESM(require("react"));
|
|
2423
2498
|
var import_editor14 = require("@flowgram.ai/editor");
|
|
2424
|
-
var
|
|
2499
|
+
var import_semi_ui12 = require("@douyinfe/semi-ui");
|
|
2425
2500
|
var import_semi_icons3 = require("@douyinfe/semi-icons");
|
|
2426
2501
|
|
|
2427
2502
|
// src/components/blur-input/index.tsx
|
|
2428
2503
|
init_cjs_shims();
|
|
2429
|
-
var
|
|
2504
|
+
var import_react18 = __toESM(require("react"));
|
|
2430
2505
|
var import_input = __toESM(require("@douyinfe/semi-ui/lib/es/input"));
|
|
2431
2506
|
function BlurInput(props) {
|
|
2432
|
-
const [value, setValue] = (0,
|
|
2433
|
-
(0,
|
|
2507
|
+
const [value, setValue] = (0, import_react18.useState)("");
|
|
2508
|
+
(0, import_react18.useEffect)(() => {
|
|
2434
2509
|
setValue(props.value);
|
|
2435
2510
|
}, [props.value]);
|
|
2436
|
-
return /* @__PURE__ */
|
|
2511
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
2437
2512
|
import_input.default,
|
|
2438
2513
|
{
|
|
2439
2514
|
...props,
|
|
@@ -2448,7 +2523,7 @@ function BlurInput(props) {
|
|
|
2448
2523
|
|
|
2449
2524
|
// src/components/json-schema-editor/styles.tsx
|
|
2450
2525
|
init_cjs_shims();
|
|
2451
|
-
var
|
|
2526
|
+
var import_react19 = __toESM(require("react"));
|
|
2452
2527
|
var import_styled_components3 = __toESM(require("styled-components"));
|
|
2453
2528
|
var import_semi_icons2 = __toESM(require("@douyinfe/semi-icons"));
|
|
2454
2529
|
var UIContainer = import_styled_components3.default.div`
|
|
@@ -2550,7 +2625,7 @@ var UIRequired = import_styled_components3.default.div``;
|
|
|
2550
2625
|
var UIActions = import_styled_components3.default.div`
|
|
2551
2626
|
white-space: nowrap;
|
|
2552
2627
|
`;
|
|
2553
|
-
var iconAddChildrenSvg = /* @__PURE__ */
|
|
2628
|
+
var iconAddChildrenSvg = /* @__PURE__ */ import_react19.default.createElement(
|
|
2554
2629
|
"svg",
|
|
2555
2630
|
{
|
|
2556
2631
|
className: "icon-icon icon-icon-coz_add_node ",
|
|
@@ -2560,7 +2635,7 @@ var iconAddChildrenSvg = /* @__PURE__ */ import_react17.default.createElement(
|
|
|
2560
2635
|
fill: "currentColor",
|
|
2561
2636
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2562
2637
|
},
|
|
2563
|
-
/* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
2564
2639
|
"path",
|
|
2565
2640
|
{
|
|
2566
2641
|
fillRule: "evenodd",
|
|
@@ -2568,9 +2643,9 @@ var iconAddChildrenSvg = /* @__PURE__ */ import_react17.default.createElement(
|
|
|
2568
2643
|
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"
|
|
2569
2644
|
}
|
|
2570
2645
|
),
|
|
2571
|
-
/* @__PURE__ */
|
|
2646
|
+
/* @__PURE__ */ import_react19.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" })
|
|
2572
2647
|
);
|
|
2573
|
-
var IconAddChildren = () => /* @__PURE__ */
|
|
2648
|
+
var IconAddChildren = () => /* @__PURE__ */ import_react19.default.createElement(import_semi_icons2.default, { size: "small", svg: iconAddChildrenSvg });
|
|
2574
2649
|
var DefaultValueWrapper = import_styled_components3.default.div`
|
|
2575
2650
|
margin: 0;
|
|
2576
2651
|
`;
|
|
@@ -2586,8 +2661,8 @@ var ConstantInputWrapper = import_styled_components3.default.div`
|
|
|
2586
2661
|
|
|
2587
2662
|
// src/components/json-schema-editor/hooks.tsx
|
|
2588
2663
|
init_cjs_shims();
|
|
2589
|
-
var
|
|
2590
|
-
var
|
|
2664
|
+
var import_react20 = require("react");
|
|
2665
|
+
var import_lodash_es3 = require("lodash-es");
|
|
2591
2666
|
var import_immer = require("immer");
|
|
2592
2667
|
var import_json_schema6 = require("@flowgram.ai/json-schema");
|
|
2593
2668
|
var _id = 0;
|
|
@@ -2598,10 +2673,10 @@ function usePropertiesEdit(value, onChange) {
|
|
|
2598
2673
|
const typeManager = (0, import_json_schema6.useTypeManager)();
|
|
2599
2674
|
const drilldownSchema = typeManager.getPropertiesParent(value || {});
|
|
2600
2675
|
const canAddField = typeManager.canAddField(value || {});
|
|
2601
|
-
const [propertyList, setPropertyList] = (0,
|
|
2602
|
-
const effectVersion = (0,
|
|
2603
|
-
const changeVersion = (0,
|
|
2604
|
-
(0,
|
|
2676
|
+
const [propertyList, setPropertyList] = (0, import_react20.useState)([]);
|
|
2677
|
+
const effectVersion = (0, import_react20.useRef)(0);
|
|
2678
|
+
const changeVersion = (0, import_react20.useRef)(0);
|
|
2679
|
+
(0, import_react20.useEffect)(() => {
|
|
2605
2680
|
effectVersion.current = effectVersion.current + 1;
|
|
2606
2681
|
if (effectVersion.current === changeVersion.current) {
|
|
2607
2682
|
return;
|
|
@@ -2610,7 +2685,7 @@ function usePropertiesEdit(value, onChange) {
|
|
|
2610
2685
|
setPropertyList((_list) => {
|
|
2611
2686
|
const newNames = Object.entries(drilldownSchema?.properties || {}).sort(([, a], [, b]) => (a.extra?.index ?? 0) - (b.extra?.index ?? 0)).map(([key]) => key);
|
|
2612
2687
|
const oldNames = _list.map((item) => item.name).filter(Boolean);
|
|
2613
|
-
const addNames = (0,
|
|
2688
|
+
const addNames = (0, import_lodash_es3.difference)(newNames, oldNames);
|
|
2614
2689
|
return _list.filter((item) => !item.name || newNames.includes(item.name)).map((item) => ({
|
|
2615
2690
|
key: item.key,
|
|
2616
2691
|
name: item.name,
|
|
@@ -2636,7 +2711,7 @@ function usePropertiesEdit(value, onChange) {
|
|
|
2636
2711
|
if (!_property.name) {
|
|
2637
2712
|
continue;
|
|
2638
2713
|
}
|
|
2639
|
-
nextProperties[_property.name] = (0,
|
|
2714
|
+
nextProperties[_property.name] = (0, import_lodash_es3.omit)(_property, ["key", "name", "isPropertyRequired"]);
|
|
2640
2715
|
if (_property.isPropertyRequired) {
|
|
2641
2716
|
nextRequired.push(_property.name);
|
|
2642
2717
|
}
|
|
@@ -2668,7 +2743,7 @@ function usePropertiesEdit(value, onChange) {
|
|
|
2668
2743
|
(_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
|
|
2669
2744
|
);
|
|
2670
2745
|
};
|
|
2671
|
-
(0,
|
|
2746
|
+
(0, import_react20.useEffect)(() => {
|
|
2672
2747
|
if (!canAddField) {
|
|
2673
2748
|
setPropertyList([]);
|
|
2674
2749
|
}
|
|
@@ -2684,13 +2759,13 @@ function usePropertiesEdit(value, onChange) {
|
|
|
2684
2759
|
|
|
2685
2760
|
// src/components/json-schema-editor/default-value.tsx
|
|
2686
2761
|
init_cjs_shims();
|
|
2687
|
-
var
|
|
2762
|
+
var import_react22 = __toESM(require("react"));
|
|
2688
2763
|
var import_editor13 = require("@flowgram.ai/editor");
|
|
2689
2764
|
|
|
2690
2765
|
// src/components/constant-input/index.tsx
|
|
2691
2766
|
init_cjs_shims();
|
|
2692
|
-
var
|
|
2693
|
-
var
|
|
2767
|
+
var import_react21 = __toESM(require("react"));
|
|
2768
|
+
var import_semi_ui11 = require("@douyinfe/semi-ui");
|
|
2694
2769
|
init_plugins();
|
|
2695
2770
|
|
|
2696
2771
|
// src/components/constant-input/types.ts
|
|
@@ -2700,7 +2775,7 @@ init_cjs_shims();
|
|
|
2700
2775
|
function ConstantInput(props) {
|
|
2701
2776
|
const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
|
|
2702
2777
|
const typeManager = useTypeManager();
|
|
2703
|
-
const Renderer2 = (0,
|
|
2778
|
+
const Renderer2 = (0, import_react21.useMemo)(() => {
|
|
2704
2779
|
const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
|
|
2705
2780
|
if (!strategy) {
|
|
2706
2781
|
return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
|
|
@@ -2709,22 +2784,22 @@ function ConstantInput(props) {
|
|
|
2709
2784
|
}, [strategies, schema]);
|
|
2710
2785
|
if (!Renderer2) {
|
|
2711
2786
|
if (fallbackRenderer) {
|
|
2712
|
-
return
|
|
2787
|
+
return import_react21.default.createElement(fallbackRenderer, {
|
|
2713
2788
|
value,
|
|
2714
2789
|
onChange,
|
|
2715
2790
|
readonly,
|
|
2716
2791
|
...rest
|
|
2717
2792
|
});
|
|
2718
2793
|
}
|
|
2719
|
-
return /* @__PURE__ */
|
|
2794
|
+
return /* @__PURE__ */ import_react21.default.createElement(import_semi_ui11.Input, { size: "small", disabled: true, placeholder: "Unsupported type" });
|
|
2720
2795
|
}
|
|
2721
|
-
return /* @__PURE__ */
|
|
2796
|
+
return /* @__PURE__ */ import_react21.default.createElement(Renderer2, { value, onChange, readonly, ...rest });
|
|
2722
2797
|
}
|
|
2723
2798
|
|
|
2724
2799
|
// src/components/json-schema-editor/default-value.tsx
|
|
2725
2800
|
function DefaultValue(props) {
|
|
2726
2801
|
const { value, schema, onChange, placeholder } = props;
|
|
2727
|
-
return /* @__PURE__ */
|
|
2802
|
+
return /* @__PURE__ */ import_react22.default.createElement(ConstantInputWrapper, null, /* @__PURE__ */ import_react22.default.createElement(
|
|
2728
2803
|
ConstantInput,
|
|
2729
2804
|
{
|
|
2730
2805
|
value,
|
|
@@ -2744,7 +2819,7 @@ function JsonSchemaEditor(props) {
|
|
|
2744
2819
|
value,
|
|
2745
2820
|
onChangeProps
|
|
2746
2821
|
);
|
|
2747
|
-
return /* @__PURE__ */
|
|
2822
|
+
return /* @__PURE__ */ import_react23.default.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ import_react23.default.createElement(UITreeItems, null, propertyList.map((_property) => /* @__PURE__ */ import_react23.default.createElement(
|
|
2748
2823
|
PropertyEdit,
|
|
2749
2824
|
{
|
|
2750
2825
|
readonly,
|
|
@@ -2758,13 +2833,13 @@ function JsonSchemaEditor(props) {
|
|
|
2758
2833
|
onRemoveProperty(_property.key);
|
|
2759
2834
|
}
|
|
2760
2835
|
}
|
|
2761
|
-
))), /* @__PURE__ */
|
|
2762
|
-
|
|
2836
|
+
))), /* @__PURE__ */ import_react23.default.createElement(
|
|
2837
|
+
import_semi_ui12.Button,
|
|
2763
2838
|
{
|
|
2764
2839
|
disabled: readonly,
|
|
2765
2840
|
size: "small",
|
|
2766
2841
|
style: { marginTop: 10, marginLeft: 16 },
|
|
2767
|
-
icon: /* @__PURE__ */
|
|
2842
|
+
icon: /* @__PURE__ */ import_react23.default.createElement(import_semi_icons3.IconPlus, null),
|
|
2768
2843
|
onClick: onAddProperty
|
|
2769
2844
|
},
|
|
2770
2845
|
config?.addButtonText ?? import_editor14.I18n.t("Add")
|
|
@@ -2772,10 +2847,10 @@ function JsonSchemaEditor(props) {
|
|
|
2772
2847
|
}
|
|
2773
2848
|
function PropertyEdit(props) {
|
|
2774
2849
|
const { value, config, readonly, $level = 0, onChange: onChangeProps, onRemove, $isLast } = props;
|
|
2775
|
-
const [expand, setExpand] = (0,
|
|
2776
|
-
const [collapse, setCollapse] = (0,
|
|
2850
|
+
const [expand, setExpand] = (0, import_react23.useState)(false);
|
|
2851
|
+
const [collapse, setCollapse] = (0, import_react23.useState)(false);
|
|
2777
2852
|
const { name, type, items, default: defaultValue, description, isPropertyRequired } = value || {};
|
|
2778
|
-
const typeSelectorValue = (0,
|
|
2853
|
+
const typeSelectorValue = (0, import_react23.useMemo)(() => ({ type, items }), [type, items]);
|
|
2779
2854
|
const { propertyList, canAddField, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(value, onChangeProps);
|
|
2780
2855
|
const onChange = (key, _value) => {
|
|
2781
2856
|
onChangeProps?.({
|
|
@@ -2784,7 +2859,7 @@ function PropertyEdit(props) {
|
|
|
2784
2859
|
});
|
|
2785
2860
|
};
|
|
2786
2861
|
const showCollapse = canAddField && propertyList.length > 0;
|
|
2787
|
-
return /* @__PURE__ */
|
|
2862
|
+
return /* @__PURE__ */ import_react23.default.createElement(import_react23.default.Fragment, null, /* @__PURE__ */ import_react23.default.createElement(UITreeItemLeft, { $isLast, $showLine: $level > 0, $showCollapse: showCollapse }, showCollapse && /* @__PURE__ */ import_react23.default.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ import_react23.default.createElement(import_semi_icons3.IconChevronDown, { size: "small" }) : /* @__PURE__ */ import_react23.default.createElement(import_semi_icons3.IconChevronRight, { size: "small" }))), /* @__PURE__ */ import_react23.default.createElement(UITreeItemRight, null, /* @__PURE__ */ import_react23.default.createElement(UITreeItemMain, null, /* @__PURE__ */ import_react23.default.createElement(UIRow, null, /* @__PURE__ */ import_react23.default.createElement(UIName, null, /* @__PURE__ */ import_react23.default.createElement(
|
|
2788
2863
|
BlurInput,
|
|
2789
2864
|
{
|
|
2790
2865
|
disabled: readonly,
|
|
@@ -2793,7 +2868,7 @@ function PropertyEdit(props) {
|
|
|
2793
2868
|
value: name,
|
|
2794
2869
|
onChange: (value2) => onChange("name", value2)
|
|
2795
2870
|
}
|
|
2796
|
-
)), /* @__PURE__ */
|
|
2871
|
+
)), /* @__PURE__ */ import_react23.default.createElement(UIType, null, /* @__PURE__ */ import_react23.default.createElement(
|
|
2797
2872
|
InjectTypeSelector,
|
|
2798
2873
|
{
|
|
2799
2874
|
value: typeSelectorValue,
|
|
@@ -2805,46 +2880,46 @@ function PropertyEdit(props) {
|
|
|
2805
2880
|
});
|
|
2806
2881
|
}
|
|
2807
2882
|
}
|
|
2808
|
-
)), /* @__PURE__ */
|
|
2809
|
-
|
|
2883
|
+
)), /* @__PURE__ */ import_react23.default.createElement(UIRequired, null, /* @__PURE__ */ import_react23.default.createElement(
|
|
2884
|
+
import_semi_ui12.Checkbox,
|
|
2810
2885
|
{
|
|
2811
2886
|
disabled: readonly,
|
|
2812
2887
|
checked: isPropertyRequired,
|
|
2813
2888
|
onChange: (e) => onChange("isPropertyRequired", e.target.checked)
|
|
2814
2889
|
}
|
|
2815
|
-
)), /* @__PURE__ */
|
|
2816
|
-
|
|
2890
|
+
)), /* @__PURE__ */ import_react23.default.createElement(UIActions, null, /* @__PURE__ */ import_react23.default.createElement(
|
|
2891
|
+
import_semi_ui12.IconButton,
|
|
2817
2892
|
{
|
|
2818
2893
|
disabled: readonly,
|
|
2819
2894
|
size: "small",
|
|
2820
2895
|
theme: "borderless",
|
|
2821
|
-
icon: expand ? /* @__PURE__ */
|
|
2896
|
+
icon: expand ? /* @__PURE__ */ import_react23.default.createElement(import_semi_icons3.IconShrink, { size: "small" }) : /* @__PURE__ */ import_react23.default.createElement(import_semi_icons3.IconExpand, { size: "small" }),
|
|
2822
2897
|
onClick: () => {
|
|
2823
2898
|
setExpand((_expand) => !_expand);
|
|
2824
2899
|
}
|
|
2825
2900
|
}
|
|
2826
|
-
), canAddField && /* @__PURE__ */
|
|
2827
|
-
|
|
2901
|
+
), canAddField && /* @__PURE__ */ import_react23.default.createElement(
|
|
2902
|
+
import_semi_ui12.IconButton,
|
|
2828
2903
|
{
|
|
2829
2904
|
disabled: readonly,
|
|
2830
2905
|
size: "small",
|
|
2831
2906
|
theme: "borderless",
|
|
2832
|
-
icon: /* @__PURE__ */
|
|
2907
|
+
icon: /* @__PURE__ */ import_react23.default.createElement(IconAddChildren, null),
|
|
2833
2908
|
onClick: () => {
|
|
2834
2909
|
onAddProperty();
|
|
2835
2910
|
setCollapse(true);
|
|
2836
2911
|
}
|
|
2837
2912
|
}
|
|
2838
|
-
), /* @__PURE__ */
|
|
2839
|
-
|
|
2913
|
+
), /* @__PURE__ */ import_react23.default.createElement(
|
|
2914
|
+
import_semi_ui12.IconButton,
|
|
2840
2915
|
{
|
|
2841
2916
|
disabled: readonly,
|
|
2842
2917
|
size: "small",
|
|
2843
2918
|
theme: "borderless",
|
|
2844
|
-
icon: /* @__PURE__ */
|
|
2919
|
+
icon: /* @__PURE__ */ import_react23.default.createElement(import_semi_icons3.IconMinus, { size: "small" }),
|
|
2845
2920
|
onClick: onRemove
|
|
2846
2921
|
}
|
|
2847
|
-
))), expand && /* @__PURE__ */
|
|
2922
|
+
))), expand && /* @__PURE__ */ import_react23.default.createElement(UIExpandDetail, null, /* @__PURE__ */ import_react23.default.createElement(UILabel, null, config?.descTitle ?? import_editor14.I18n.t("Description")), /* @__PURE__ */ import_react23.default.createElement(
|
|
2848
2923
|
BlurInput,
|
|
2849
2924
|
{
|
|
2850
2925
|
disabled: readonly,
|
|
@@ -2853,7 +2928,7 @@ function PropertyEdit(props) {
|
|
|
2853
2928
|
onChange: (value2) => onChange("description", value2),
|
|
2854
2929
|
placeholder: config?.descPlaceholder ?? import_editor14.I18n.t("Help LLM to understand the property")
|
|
2855
2930
|
}
|
|
2856
|
-
), $level === 0 && /* @__PURE__ */
|
|
2931
|
+
), $level === 0 && /* @__PURE__ */ import_react23.default.createElement(import_react23.default.Fragment, null, /* @__PURE__ */ import_react23.default.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? import_editor14.I18n.t("Default Value")), /* @__PURE__ */ import_react23.default.createElement(DefaultValueWrapper, null, /* @__PURE__ */ import_react23.default.createElement(
|
|
2857
2932
|
DefaultValue,
|
|
2858
2933
|
{
|
|
2859
2934
|
value: defaultValue,
|
|
@@ -2861,7 +2936,7 @@ function PropertyEdit(props) {
|
|
|
2861
2936
|
placeholder: config?.defaultValuePlaceholder ?? import_editor14.I18n.t("Default Value"),
|
|
2862
2937
|
onChange: (value2) => onChange("default", value2)
|
|
2863
2938
|
}
|
|
2864
|
-
))))), showCollapse && /* @__PURE__ */
|
|
2939
|
+
))))), showCollapse && /* @__PURE__ */ import_react23.default.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ import_react23.default.createElement(UITreeItems, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ import_react23.default.createElement(
|
|
2865
2940
|
PropertyEdit,
|
|
2866
2941
|
{
|
|
2867
2942
|
readonly,
|
|
@@ -2882,7 +2957,7 @@ function PropertyEdit(props) {
|
|
|
2882
2957
|
|
|
2883
2958
|
// src/components/batch-variable-selector/index.tsx
|
|
2884
2959
|
init_cjs_shims();
|
|
2885
|
-
var
|
|
2960
|
+
var import_react24 = __toESM(require("react"));
|
|
2886
2961
|
var import_editor15 = require("@flowgram.ai/editor");
|
|
2887
2962
|
init_variable_selector();
|
|
2888
2963
|
var batchVariableSchema = {
|
|
@@ -2890,14 +2965,14 @@ var batchVariableSchema = {
|
|
|
2890
2965
|
extra: { weak: true }
|
|
2891
2966
|
};
|
|
2892
2967
|
function BatchVariableSelector(props) {
|
|
2893
|
-
return /* @__PURE__ */
|
|
2968
|
+
return /* @__PURE__ */ import_react24.default.createElement(import_editor15.PrivateScopeProvider, null, /* @__PURE__ */ import_react24.default.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
|
|
2894
2969
|
}
|
|
2895
2970
|
|
|
2896
2971
|
// src/components/dynamic-value-input/index.tsx
|
|
2897
2972
|
init_cjs_shims();
|
|
2898
|
-
var
|
|
2973
|
+
var import_react26 = __toESM(require("react"));
|
|
2899
2974
|
var import_json_schema7 = require("@flowgram.ai/json-schema");
|
|
2900
|
-
var
|
|
2975
|
+
var import_semi_ui13 = require("@douyinfe/semi-ui");
|
|
2901
2976
|
var import_semi_icons4 = require("@douyinfe/semi-icons");
|
|
2902
2977
|
init_shared();
|
|
2903
2978
|
init_variable_selector();
|
|
@@ -2960,11 +3035,11 @@ var UITrigger = import_styled_components4.default.div`
|
|
|
2960
3035
|
|
|
2961
3036
|
// src/components/dynamic-value-input/hooks.ts
|
|
2962
3037
|
init_cjs_shims();
|
|
2963
|
-
var
|
|
3038
|
+
var import_react25 = require("react");
|
|
2964
3039
|
var import_editor16 = require("@flowgram.ai/editor");
|
|
2965
3040
|
function useRefVariable(value) {
|
|
2966
3041
|
const available = (0, import_editor16.useScopeAvailable)();
|
|
2967
|
-
const refVariable = (0,
|
|
3042
|
+
const refVariable = (0, import_react25.useMemo)(() => {
|
|
2968
3043
|
if (value?.type === "ref") {
|
|
2969
3044
|
return available.getByKeyPath(value.content);
|
|
2970
3045
|
}
|
|
@@ -2976,10 +3051,10 @@ function useSelectSchema(schemaFromProps, constantProps, value) {
|
|
|
2976
3051
|
if (value?.type === "constant") {
|
|
2977
3052
|
defaultSelectSchema = value?.schema || defaultSelectSchema;
|
|
2978
3053
|
}
|
|
2979
|
-
const changeVersion = (0,
|
|
2980
|
-
const effectVersion = (0,
|
|
2981
|
-
const [selectSchema, setSelectSchema] = (0,
|
|
2982
|
-
(0,
|
|
3054
|
+
const changeVersion = (0, import_react25.useRef)(0);
|
|
3055
|
+
const effectVersion = (0, import_react25.useRef)(0);
|
|
3056
|
+
const [selectSchema, setSelectSchema] = (0, import_react25.useState)(defaultSelectSchema);
|
|
3057
|
+
(0, import_react25.useEffect)(() => {
|
|
2983
3058
|
effectVersion.current += 1;
|
|
2984
3059
|
if (changeVersion.current === effectVersion.current) {
|
|
2985
3060
|
return;
|
|
@@ -2997,14 +3072,14 @@ function useSelectSchema(schemaFromProps, constantProps, value) {
|
|
|
2997
3072
|
return [selectSchema, setSelectSchemaWithVersionUpdate];
|
|
2998
3073
|
}
|
|
2999
3074
|
function useIncludeSchema(schemaFromProps) {
|
|
3000
|
-
const includeSchema = (0,
|
|
3075
|
+
const includeSchema = (0, import_react25.useMemo)(() => {
|
|
3001
3076
|
if (!schemaFromProps) {
|
|
3002
3077
|
return;
|
|
3003
3078
|
}
|
|
3004
3079
|
if (schemaFromProps?.type === "number") {
|
|
3005
3080
|
return [schemaFromProps, { type: "integer" }];
|
|
3006
3081
|
}
|
|
3007
|
-
return { ...schemaFromProps, extra: { ...schemaFromProps?.extra
|
|
3082
|
+
return { ...schemaFromProps, extra: { weak: true, ...schemaFromProps?.extra } };
|
|
3008
3083
|
}, [schemaFromProps]);
|
|
3009
3084
|
return includeSchema;
|
|
3010
3085
|
}
|
|
@@ -3029,13 +3104,13 @@ function DynamicValueInput({
|
|
|
3029
3104
|
const typeManager = (0, import_json_schema7.useTypeManager)();
|
|
3030
3105
|
const renderTypeSelector = () => {
|
|
3031
3106
|
if (schemaFromProps) {
|
|
3032
|
-
return /* @__PURE__ */
|
|
3107
|
+
return /* @__PURE__ */ import_react26.default.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
|
|
3033
3108
|
}
|
|
3034
3109
|
if (value?.type === "ref") {
|
|
3035
3110
|
const schema = refVariable?.type ? import_json_schema7.JsonSchemaUtils.astToSchema(refVariable?.type) : void 0;
|
|
3036
|
-
return /* @__PURE__ */
|
|
3111
|
+
return /* @__PURE__ */ import_react26.default.createElement(TypeSelector, { value: schema, readonly: true });
|
|
3037
3112
|
}
|
|
3038
|
-
return /* @__PURE__ */
|
|
3113
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
3039
3114
|
TypeSelector,
|
|
3040
3115
|
{
|
|
3041
3116
|
value: selectSchema,
|
|
@@ -3061,7 +3136,7 @@ function DynamicValueInput({
|
|
|
3061
3136
|
};
|
|
3062
3137
|
const renderMain = () => {
|
|
3063
3138
|
if (value?.type === "ref") {
|
|
3064
|
-
return /* @__PURE__ */
|
|
3139
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
3065
3140
|
InjectVariableSelector,
|
|
3066
3141
|
{
|
|
3067
3142
|
style: { width: "100%" },
|
|
@@ -3073,14 +3148,14 @@ function DynamicValueInput({
|
|
|
3073
3148
|
);
|
|
3074
3149
|
}
|
|
3075
3150
|
const constantSchema2 = schemaFromProps || selectSchema || { type: "string" };
|
|
3076
|
-
return /* @__PURE__ */
|
|
3151
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
3077
3152
|
ConstantInput,
|
|
3078
3153
|
{
|
|
3079
3154
|
value: value?.content,
|
|
3080
3155
|
onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema2 }),
|
|
3081
3156
|
schema: constantSchema2 || { type: "string" },
|
|
3082
3157
|
readonly,
|
|
3083
|
-
fallbackRenderer: () => /* @__PURE__ */
|
|
3158
|
+
fallbackRenderer: () => /* @__PURE__ */ import_react26.default.createElement(
|
|
3084
3159
|
InjectVariableSelector,
|
|
3085
3160
|
{
|
|
3086
3161
|
style: { width: "100%" },
|
|
@@ -3094,7 +3169,7 @@ function DynamicValueInput({
|
|
|
3094
3169
|
}
|
|
3095
3170
|
);
|
|
3096
3171
|
};
|
|
3097
|
-
const renderTrigger = () => /* @__PURE__ */
|
|
3172
|
+
const renderTrigger = () => /* @__PURE__ */ import_react26.default.createElement(
|
|
3098
3173
|
InjectVariableSelector,
|
|
3099
3174
|
{
|
|
3100
3175
|
style: { width: "100%" },
|
|
@@ -3102,19 +3177,19 @@ function DynamicValueInput({
|
|
|
3102
3177
|
onChange: (_v) => onChange({ type: "ref", content: _v }),
|
|
3103
3178
|
includeSchema,
|
|
3104
3179
|
readonly,
|
|
3105
|
-
triggerRender: () => /* @__PURE__ */
|
|
3180
|
+
triggerRender: () => /* @__PURE__ */ import_react26.default.createElement(import_semi_ui13.IconButton, { disabled: readonly, size: "small", icon: /* @__PURE__ */ import_react26.default.createElement(import_semi_icons4.IconSetting, { size: "small" }) })
|
|
3106
3181
|
}
|
|
3107
3182
|
);
|
|
3108
|
-
return /* @__PURE__ */
|
|
3183
|
+
return /* @__PURE__ */ import_react26.default.createElement(UIContainer2, { style }, /* @__PURE__ */ import_react26.default.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ import_react26.default.createElement(UIMain, null, renderMain()), /* @__PURE__ */ import_react26.default.createElement(UITrigger, null, renderTrigger()));
|
|
3109
3184
|
}
|
|
3110
3185
|
DynamicValueInput.renderKey = "dynamic-value-input-render-key";
|
|
3111
3186
|
var InjectDynamicValueInput = createInjectMaterial(DynamicValueInput);
|
|
3112
3187
|
|
|
3113
3188
|
// src/components/condition-row/index.tsx
|
|
3114
3189
|
init_cjs_shims();
|
|
3115
|
-
var
|
|
3190
|
+
var import_react29 = __toESM(require("react"));
|
|
3116
3191
|
var import_editor19 = require("@flowgram.ai/editor");
|
|
3117
|
-
var
|
|
3192
|
+
var import_semi_ui15 = require("@douyinfe/semi-ui");
|
|
3118
3193
|
init_variable_selector();
|
|
3119
3194
|
|
|
3120
3195
|
// src/components/condition-row/styles.tsx
|
|
@@ -3142,7 +3217,7 @@ var UIValues = import_styled_components5.default.div`
|
|
|
3142
3217
|
|
|
3143
3218
|
// src/components/condition-row/hooks/useRule.ts
|
|
3144
3219
|
init_cjs_shims();
|
|
3145
|
-
var
|
|
3220
|
+
var import_react27 = require("react");
|
|
3146
3221
|
var import_json_schema8 = require("@flowgram.ai/json-schema");
|
|
3147
3222
|
var import_editor17 = require("@flowgram.ai/editor");
|
|
3148
3223
|
|
|
@@ -3207,6 +3282,14 @@ var defaultRules = {
|
|
|
3207
3282
|
map: {
|
|
3208
3283
|
["is_empty" /* IS_EMPTY */]: null,
|
|
3209
3284
|
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
3285
|
+
},
|
|
3286
|
+
["date-time"]: {
|
|
3287
|
+
["eq" /* EQ */]: "date-time",
|
|
3288
|
+
["neq" /* NEQ */]: "date-time",
|
|
3289
|
+
["gt" /* GT */]: "date-time",
|
|
3290
|
+
["gte" /* GTE */]: "date-time",
|
|
3291
|
+
["lt" /* LT */]: "date-time",
|
|
3292
|
+
["lte" /* LTE */]: "date-time"
|
|
3210
3293
|
}
|
|
3211
3294
|
};
|
|
3212
3295
|
var defaultOpConfigs = {
|
|
@@ -3275,12 +3358,12 @@ var defaultOpConfigs = {
|
|
|
3275
3358
|
// src/components/condition-row/hooks/useRule.ts
|
|
3276
3359
|
function useRule(left, userRules) {
|
|
3277
3360
|
const available = (0, import_editor17.useScopeAvailable)();
|
|
3278
|
-
const rules = (0,
|
|
3279
|
-
const variable = (0,
|
|
3361
|
+
const rules = (0, import_react27.useMemo)(() => ({ ...defaultRules, ...userRules || {} }), [userRules]);
|
|
3362
|
+
const variable = (0, import_react27.useMemo)(() => {
|
|
3280
3363
|
if (!left) return void 0;
|
|
3281
3364
|
return available.getByKeyPath(left.content);
|
|
3282
3365
|
}, [available, left]);
|
|
3283
|
-
const rule = (0,
|
|
3366
|
+
const rule = (0, import_react27.useMemo)(() => {
|
|
3284
3367
|
if (!variable) return void 0;
|
|
3285
3368
|
const schema = import_json_schema8.JsonSchemaUtils.astToSchema(variable.type, { drilldown: false });
|
|
3286
3369
|
return rules[schema?.type];
|
|
@@ -3290,12 +3373,12 @@ function useRule(left, userRules) {
|
|
|
3290
3373
|
|
|
3291
3374
|
// src/components/condition-row/hooks/useOp.tsx
|
|
3292
3375
|
init_cjs_shims();
|
|
3293
|
-
var
|
|
3376
|
+
var import_react28 = __toESM(require("react"));
|
|
3294
3377
|
var import_editor18 = require("@flowgram.ai/editor");
|
|
3295
|
-
var
|
|
3378
|
+
var import_semi_ui14 = require("@douyinfe/semi-ui");
|
|
3296
3379
|
var import_semi_icons5 = require("@douyinfe/semi-icons");
|
|
3297
3380
|
function useOp({ rule, op, onChange, readonly, userOps }) {
|
|
3298
|
-
const options = (0,
|
|
3381
|
+
const options = (0, import_react28.useMemo)(
|
|
3299
3382
|
() => Object.keys(rule || {}).map((_op) => ({
|
|
3300
3383
|
...defaultOpConfigs[_op] || {},
|
|
3301
3384
|
...userOps?.[_op] || {},
|
|
@@ -3304,9 +3387,9 @@ function useOp({ rule, op, onChange, readonly, userOps }) {
|
|
|
3304
3387
|
})),
|
|
3305
3388
|
[rule, userOps]
|
|
3306
3389
|
);
|
|
3307
|
-
const opConfig = (0,
|
|
3308
|
-
const renderOpSelect = () => /* @__PURE__ */
|
|
3309
|
-
|
|
3390
|
+
const opConfig = (0, import_react28.useMemo)(() => defaultOpConfigs[op], [op]);
|
|
3391
|
+
const renderOpSelect = () => /* @__PURE__ */ import_react28.default.createElement(
|
|
3392
|
+
import_semi_ui14.Select,
|
|
3310
3393
|
{
|
|
3311
3394
|
style: { height: 22 },
|
|
3312
3395
|
disabled: readonly,
|
|
@@ -3316,7 +3399,7 @@ function useOp({ rule, op, onChange, readonly, userOps }) {
|
|
|
3316
3399
|
onChange: (v) => {
|
|
3317
3400
|
onChange(v);
|
|
3318
3401
|
},
|
|
3319
|
-
triggerRender: ({ value }) => /* @__PURE__ */
|
|
3402
|
+
triggerRender: ({ value }) => /* @__PURE__ */ import_react28.default.createElement(import_semi_ui14.Button, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ import_react28.default.createElement(import_semi_icons5.IconChevronDownStroked, { size: "small" }))
|
|
3320
3403
|
}
|
|
3321
3404
|
);
|
|
3322
3405
|
return { renderOpSelect, opConfig };
|
|
@@ -3343,11 +3426,11 @@ function ConditionRow({
|
|
|
3343
3426
|
readonly,
|
|
3344
3427
|
userOps: ruleConfig.ops
|
|
3345
3428
|
});
|
|
3346
|
-
const targetSchema = (0,
|
|
3429
|
+
const targetSchema = (0, import_react29.useMemo)(() => {
|
|
3347
3430
|
const targetType = rule?.[operator || ""] || null;
|
|
3348
3431
|
return targetType ? { type: targetType, extra: { weak: true } } : null;
|
|
3349
3432
|
}, [rule, opConfig]);
|
|
3350
|
-
return /* @__PURE__ */
|
|
3433
|
+
return /* @__PURE__ */ import_react29.default.createElement(UIContainer3, { style }, /* @__PURE__ */ import_react29.default.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ import_react29.default.createElement(UIValues, null, /* @__PURE__ */ import_react29.default.createElement(UILeft, null, /* @__PURE__ */ import_react29.default.createElement(
|
|
3351
3434
|
InjectVariableSelector,
|
|
3352
3435
|
{
|
|
3353
3436
|
readonly,
|
|
@@ -3361,7 +3444,7 @@ function ConditionRow({
|
|
|
3361
3444
|
}
|
|
3362
3445
|
})
|
|
3363
3446
|
}
|
|
3364
|
-
)), /* @__PURE__ */
|
|
3447
|
+
)), /* @__PURE__ */ import_react29.default.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ import_react29.default.createElement(
|
|
3365
3448
|
InjectDynamicValueInput,
|
|
3366
3449
|
{
|
|
3367
3450
|
readonly: readonly || !rule,
|
|
@@ -3369,8 +3452,8 @@ function ConditionRow({
|
|
|
3369
3452
|
schema: targetSchema,
|
|
3370
3453
|
onChange: (v) => onChange({ ...value, right: v })
|
|
3371
3454
|
}
|
|
3372
|
-
) : /* @__PURE__ */
|
|
3373
|
-
|
|
3455
|
+
) : /* @__PURE__ */ import_react29.default.createElement(
|
|
3456
|
+
import_semi_ui15.Input,
|
|
3374
3457
|
{
|
|
3375
3458
|
size: "small",
|
|
3376
3459
|
disabled: true,
|
|
@@ -3384,14 +3467,14 @@ ConditionRow.defaultOpConfigs = defaultOpConfigs;
|
|
|
3384
3467
|
|
|
3385
3468
|
// src/components/db-condition-row/index.tsx
|
|
3386
3469
|
init_cjs_shims();
|
|
3387
|
-
var
|
|
3470
|
+
var import_react33 = __toESM(require("react"));
|
|
3388
3471
|
var import_editor21 = require("@flowgram.ai/editor");
|
|
3389
|
-
var
|
|
3472
|
+
var import_semi_ui19 = require("@douyinfe/semi-ui");
|
|
3390
3473
|
|
|
3391
3474
|
// src/components/db-condition-row/styles.tsx
|
|
3392
3475
|
init_cjs_shims();
|
|
3393
3476
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
3394
|
-
var
|
|
3477
|
+
var import_semi_ui16 = require("@douyinfe/semi-ui");
|
|
3395
3478
|
var UIContainer4 = import_styled_components6.default.div`
|
|
3396
3479
|
display: flex;
|
|
3397
3480
|
align-items: center;
|
|
@@ -3416,7 +3499,7 @@ var UIOptionLabel = import_styled_components6.default.div`
|
|
|
3416
3499
|
align-items: center;
|
|
3417
3500
|
gap: 10px;
|
|
3418
3501
|
`;
|
|
3419
|
-
var UISelect = (0, import_styled_components6.default)(
|
|
3502
|
+
var UISelect = (0, import_styled_components6.default)(import_semi_ui16.Select)`
|
|
3420
3503
|
& .semi-select-selection {
|
|
3421
3504
|
margin-left: 5px;
|
|
3422
3505
|
}
|
|
@@ -3424,13 +3507,13 @@ var UISelect = (0, import_styled_components6.default)(import_semi_ui14.Select)`
|
|
|
3424
3507
|
|
|
3425
3508
|
// src/components/db-condition-row/hooks/use-op.tsx
|
|
3426
3509
|
init_cjs_shims();
|
|
3427
|
-
var
|
|
3510
|
+
var import_react30 = __toESM(require("react"));
|
|
3428
3511
|
var import_editor20 = require("@flowgram.ai/editor");
|
|
3429
|
-
var
|
|
3512
|
+
var import_semi_ui17 = require("@douyinfe/semi-ui");
|
|
3430
3513
|
var import_semi_icons6 = require("@douyinfe/semi-icons");
|
|
3431
3514
|
var defaultOpConfigs2 = ConditionRow.defaultOpConfigs;
|
|
3432
3515
|
function useOp2({ rule, op, onChange, readonly, userOps }) {
|
|
3433
|
-
const options = (0,
|
|
3516
|
+
const options = (0, import_react30.useMemo)(
|
|
3434
3517
|
() => Object.keys(rule || {}).map((_op) => ({
|
|
3435
3518
|
...defaultOpConfigs2[_op] || {},
|
|
3436
3519
|
...userOps?.[_op] || {},
|
|
@@ -3439,9 +3522,9 @@ function useOp2({ rule, op, onChange, readonly, userOps }) {
|
|
|
3439
3522
|
})),
|
|
3440
3523
|
[rule, userOps]
|
|
3441
3524
|
);
|
|
3442
|
-
const opConfig = (0,
|
|
3443
|
-
const renderOpSelect = () => /* @__PURE__ */
|
|
3444
|
-
|
|
3525
|
+
const opConfig = (0, import_react30.useMemo)(() => defaultOpConfigs2[op], [op]);
|
|
3526
|
+
const renderOpSelect = () => /* @__PURE__ */ import_react30.default.createElement(
|
|
3527
|
+
import_semi_ui17.Select,
|
|
3445
3528
|
{
|
|
3446
3529
|
style: { height: 22 },
|
|
3447
3530
|
disabled: readonly,
|
|
@@ -3451,7 +3534,7 @@ function useOp2({ rule, op, onChange, readonly, userOps }) {
|
|
|
3451
3534
|
onChange: (v) => {
|
|
3452
3535
|
onChange(v);
|
|
3453
3536
|
},
|
|
3454
|
-
triggerRender: ({ value }) => /* @__PURE__ */
|
|
3537
|
+
triggerRender: ({ value }) => /* @__PURE__ */ import_react30.default.createElement(import_semi_ui17.Button, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ import_react30.default.createElement(import_semi_icons6.IconChevronDownStroked, { size: "small" }))
|
|
3455
3538
|
}
|
|
3456
3539
|
);
|
|
3457
3540
|
return { renderOpSelect, opConfig };
|
|
@@ -3459,15 +3542,15 @@ function useOp2({ rule, op, onChange, readonly, userOps }) {
|
|
|
3459
3542
|
|
|
3460
3543
|
// src/components/db-condition-row/hooks/use-left.tsx
|
|
3461
3544
|
init_cjs_shims();
|
|
3462
|
-
var
|
|
3463
|
-
var
|
|
3545
|
+
var import_react31 = require("react");
|
|
3546
|
+
var import_react32 = __toESM(require("react"));
|
|
3464
3547
|
var import_json_schema9 = require("@flowgram.ai/json-schema");
|
|
3465
|
-
var
|
|
3548
|
+
var import_semi_ui18 = require("@douyinfe/semi-ui");
|
|
3466
3549
|
var defaultRules2 = ConditionRow.defaultRules;
|
|
3467
3550
|
function useLeft({ left, options, userRules, readonly, onChange }) {
|
|
3468
|
-
const rules = (0,
|
|
3551
|
+
const rules = (0, import_react31.useMemo)(() => ({ ...defaultRules2, ...userRules || {} }), [userRules]);
|
|
3469
3552
|
const typeManager = (0, import_json_schema9.useTypeManager)();
|
|
3470
|
-
const rule = (0,
|
|
3553
|
+
const rule = (0, import_react31.useMemo)(() => {
|
|
3471
3554
|
if (!left) return void 0;
|
|
3472
3555
|
const option = options?.find((item) => item.value === left);
|
|
3473
3556
|
if (!option?.schema?.type) {
|
|
@@ -3475,7 +3558,7 @@ function useLeft({ left, options, userRules, readonly, onChange }) {
|
|
|
3475
3558
|
}
|
|
3476
3559
|
return rules[option.schema.type];
|
|
3477
3560
|
}, [left, options, rules]);
|
|
3478
|
-
const renderDBOptionSelect = () => /* @__PURE__ */
|
|
3561
|
+
const renderDBOptionSelect = () => /* @__PURE__ */ import_react32.default.createElement(
|
|
3479
3562
|
UISelect,
|
|
3480
3563
|
{
|
|
3481
3564
|
disabled: readonly,
|
|
@@ -3484,7 +3567,7 @@ function useLeft({ left, options, userRules, readonly, onChange }) {
|
|
|
3484
3567
|
value: left,
|
|
3485
3568
|
onChange: (v) => onChange(v),
|
|
3486
3569
|
optionList: options?.map((item) => ({
|
|
3487
|
-
label: /* @__PURE__ */
|
|
3570
|
+
label: /* @__PURE__ */ import_react32.default.createElement(UIOptionLabel, null, /* @__PURE__ */ import_react32.default.createElement(import_semi_ui18.Icon, { size: "small", svg: typeManager.getDisplayIcon(item.schema) }), item.label),
|
|
3488
3571
|
value: item.value
|
|
3489
3572
|
})) || []
|
|
3490
3573
|
}
|
|
@@ -3520,11 +3603,11 @@ function DBConditionRow({
|
|
|
3520
3603
|
readonly,
|
|
3521
3604
|
userOps: ruleConfig.ops
|
|
3522
3605
|
});
|
|
3523
|
-
const targetSchema = (0,
|
|
3606
|
+
const targetSchema = (0, import_react33.useMemo)(() => {
|
|
3524
3607
|
const targetType = rule?.[operator || ""] || null;
|
|
3525
3608
|
return targetType ? { type: targetType, extra: { weak: true } } : null;
|
|
3526
3609
|
}, [rule, opConfig]);
|
|
3527
|
-
return /* @__PURE__ */
|
|
3610
|
+
return /* @__PURE__ */ import_react33.default.createElement(UIContainer4, { style }, /* @__PURE__ */ import_react33.default.createElement(UIOperator2, null, renderOpSelect()), /* @__PURE__ */ import_react33.default.createElement(UIValues2, null, /* @__PURE__ */ import_react33.default.createElement(UILeft2, null, renderDBOptionSelect()), /* @__PURE__ */ import_react33.default.createElement(UIRight2, null, targetSchema ? /* @__PURE__ */ import_react33.default.createElement(
|
|
3528
3611
|
InjectDynamicValueInput,
|
|
3529
3612
|
{
|
|
3530
3613
|
readonly: readonly || !rule,
|
|
@@ -3532,8 +3615,8 @@ function DBConditionRow({
|
|
|
3532
3615
|
schema: targetSchema,
|
|
3533
3616
|
onChange: (v) => onChange({ ...value, right: v })
|
|
3534
3617
|
}
|
|
3535
|
-
) : /* @__PURE__ */
|
|
3536
|
-
|
|
3618
|
+
) : /* @__PURE__ */ import_react33.default.createElement(
|
|
3619
|
+
import_semi_ui19.Input,
|
|
3537
3620
|
{
|
|
3538
3621
|
size: "small",
|
|
3539
3622
|
disabled: true,
|
|
@@ -3545,9 +3628,9 @@ function DBConditionRow({
|
|
|
3545
3628
|
|
|
3546
3629
|
// src/components/batch-outputs/index.tsx
|
|
3547
3630
|
init_cjs_shims();
|
|
3548
|
-
var
|
|
3631
|
+
var import_react35 = __toESM(require("react"));
|
|
3549
3632
|
var import_editor22 = require("@flowgram.ai/editor");
|
|
3550
|
-
var
|
|
3633
|
+
var import_semi_ui20 = require("@douyinfe/semi-ui");
|
|
3551
3634
|
var import_semi_icons7 = require("@douyinfe/semi-icons");
|
|
3552
3635
|
|
|
3553
3636
|
// src/hooks/index.tsx
|
|
@@ -3555,9 +3638,9 @@ init_cjs_shims();
|
|
|
3555
3638
|
|
|
3556
3639
|
// src/hooks/use-object-list/index.tsx
|
|
3557
3640
|
init_cjs_shims();
|
|
3558
|
-
var
|
|
3641
|
+
var import_react34 = require("react");
|
|
3559
3642
|
var import_nanoid = require("nanoid");
|
|
3560
|
-
var
|
|
3643
|
+
var import_lodash_es4 = require("lodash-es");
|
|
3561
3644
|
function genId2() {
|
|
3562
3645
|
return (0, import_nanoid.nanoid)();
|
|
3563
3646
|
}
|
|
@@ -3566,16 +3649,16 @@ function useObjectList({
|
|
|
3566
3649
|
onChange,
|
|
3567
3650
|
sortIndexKey
|
|
3568
3651
|
}) {
|
|
3569
|
-
const [list, setList] = (0,
|
|
3570
|
-
const effectVersion = (0,
|
|
3571
|
-
const changeVersion = (0,
|
|
3652
|
+
const [list, setList] = (0, import_react34.useState)([]);
|
|
3653
|
+
const effectVersion = (0, import_react34.useRef)(0);
|
|
3654
|
+
const changeVersion = (0, import_react34.useRef)(0);
|
|
3572
3655
|
const getSortIndex = (value2) => {
|
|
3573
3656
|
if (typeof sortIndexKey === "function") {
|
|
3574
|
-
return (0,
|
|
3657
|
+
return (0, import_lodash_es4.get)(value2, sortIndexKey(value2)) || 0;
|
|
3575
3658
|
}
|
|
3576
|
-
return (0,
|
|
3659
|
+
return (0, import_lodash_es4.get)(value2, sortIndexKey || "") || 0;
|
|
3577
3660
|
};
|
|
3578
|
-
(0,
|
|
3661
|
+
(0, import_react34.useEffect)(() => {
|
|
3579
3662
|
effectVersion.current = effectVersion.current + 1;
|
|
3580
3663
|
if (effectVersion.current === changeVersion.current) {
|
|
3581
3664
|
return;
|
|
@@ -3584,7 +3667,7 @@ function useObjectList({
|
|
|
3584
3667
|
setList((_prevList) => {
|
|
3585
3668
|
const newKeys = Object.entries(value || {}).sort((a, b) => getSortIndex(a[1]) - getSortIndex(b[1])).map(([key]) => key);
|
|
3586
3669
|
const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
|
|
3587
|
-
const addKeys = (0,
|
|
3670
|
+
const addKeys = (0, import_lodash_es4.difference)(newKeys, oldKeys);
|
|
3588
3671
|
return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
|
|
3589
3672
|
id: item.id,
|
|
3590
3673
|
key: item.key,
|
|
@@ -3623,8 +3706,8 @@ function useObjectList({
|
|
|
3623
3706
|
Object.fromEntries(
|
|
3624
3707
|
nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
|
|
3625
3708
|
const indexKey = typeof sortIndexKey === "function" ? sortIndexKey(_res[1]) : sortIndexKey;
|
|
3626
|
-
if ((0,
|
|
3627
|
-
(0,
|
|
3709
|
+
if ((0, import_lodash_es4.isObject)(_res[1]) && indexKey) {
|
|
3710
|
+
(0, import_lodash_es4.set)(_res[1], indexKey, idx);
|
|
3628
3711
|
}
|
|
3629
3712
|
return _res;
|
|
3630
3713
|
})
|
|
@@ -3690,8 +3773,8 @@ var UIRow2 = import_styled_components7.default.div`
|
|
|
3690
3773
|
function BatchOutputs(props) {
|
|
3691
3774
|
const { readonly, style } = props;
|
|
3692
3775
|
const { list, add, updateKey, updateValue, remove } = useObjectList(props);
|
|
3693
|
-
return /* @__PURE__ */
|
|
3694
|
-
|
|
3776
|
+
return /* @__PURE__ */ import_react35.default.createElement("div", null, /* @__PURE__ */ import_react35.default.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ import_react35.default.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ import_react35.default.createElement(
|
|
3777
|
+
import_semi_ui20.Input,
|
|
3695
3778
|
{
|
|
3696
3779
|
style: { width: 100 },
|
|
3697
3780
|
disabled: readonly,
|
|
@@ -3699,7 +3782,7 @@ function BatchOutputs(props) {
|
|
|
3699
3782
|
value: item.key,
|
|
3700
3783
|
onChange: (v) => updateKey(item.id, v)
|
|
3701
3784
|
}
|
|
3702
|
-
), /* @__PURE__ */
|
|
3785
|
+
), /* @__PURE__ */ import_react35.default.createElement(
|
|
3703
3786
|
InjectVariableSelector,
|
|
3704
3787
|
{
|
|
3705
3788
|
style: { flexGrow: 1 },
|
|
@@ -3707,15 +3790,15 @@ function BatchOutputs(props) {
|
|
|
3707
3790
|
value: item.value?.content,
|
|
3708
3791
|
onChange: (v) => updateValue(item.id, { type: "ref", content: v })
|
|
3709
3792
|
}
|
|
3710
|
-
), /* @__PURE__ */
|
|
3711
|
-
|
|
3793
|
+
), /* @__PURE__ */ import_react35.default.createElement(
|
|
3794
|
+
import_semi_ui20.Button,
|
|
3712
3795
|
{
|
|
3713
3796
|
disabled: readonly,
|
|
3714
|
-
icon: /* @__PURE__ */
|
|
3797
|
+
icon: /* @__PURE__ */ import_react35.default.createElement(import_semi_icons7.IconDelete, null),
|
|
3715
3798
|
size: "small",
|
|
3716
3799
|
onClick: () => remove(item.id)
|
|
3717
3800
|
}
|
|
3718
|
-
)))), /* @__PURE__ */
|
|
3801
|
+
)))), /* @__PURE__ */ import_react35.default.createElement(import_semi_ui20.Button, { disabled: readonly, icon: /* @__PURE__ */ import_react35.default.createElement(import_semi_icons7.IconPlus, null), size: "small", onClick: () => add() }, import_editor22.I18n.t("Add")));
|
|
3719
3802
|
}
|
|
3720
3803
|
|
|
3721
3804
|
// src/components/index.ts
|
|
@@ -3723,15 +3806,15 @@ init_prompt_editor();
|
|
|
3723
3806
|
|
|
3724
3807
|
// src/components/prompt-editor-with-variables/index.tsx
|
|
3725
3808
|
init_cjs_shims();
|
|
3726
|
-
|
|
3727
|
-
var PromptEditorWithVariables2 = (
|
|
3809
|
+
init_shared();
|
|
3810
|
+
var PromptEditorWithVariables2 = lazySuspense(
|
|
3728
3811
|
() => Promise.resolve().then(() => (init_editor3(), editor_exports3)).then((module2) => ({ default: module2.PromptEditorWithVariables }))
|
|
3729
3812
|
);
|
|
3730
3813
|
|
|
3731
3814
|
// src/components/prompt-editor-with-inputs/index.tsx
|
|
3732
3815
|
init_cjs_shims();
|
|
3733
|
-
|
|
3734
|
-
var PromptEditorWithInputs2 = (
|
|
3816
|
+
init_shared();
|
|
3817
|
+
var PromptEditorWithInputs2 = lazySuspense(
|
|
3735
3818
|
() => Promise.resolve().then(() => (init_editor4(), editor_exports4)).then((module2) => ({ default: module2.PromptEditorWithInputs }))
|
|
3736
3819
|
);
|
|
3737
3820
|
|
|
@@ -3741,16 +3824,16 @@ init_code_editor_mini();
|
|
|
3741
3824
|
|
|
3742
3825
|
// src/components/json-editor-with-variables/index.tsx
|
|
3743
3826
|
init_cjs_shims();
|
|
3744
|
-
|
|
3745
|
-
var JsonEditorWithVariables2 = (
|
|
3827
|
+
init_shared();
|
|
3828
|
+
var JsonEditorWithVariables2 = lazySuspense(
|
|
3746
3829
|
() => Promise.resolve().then(() => (init_editor5(), editor_exports5)).then((module2) => ({ default: module2.JsonEditorWithVariables }))
|
|
3747
3830
|
);
|
|
3748
3831
|
|
|
3749
3832
|
// src/components/inputs-values/index.tsx
|
|
3750
3833
|
init_cjs_shims();
|
|
3751
|
-
var
|
|
3834
|
+
var import_react58 = __toESM(require("react"));
|
|
3752
3835
|
var import_editor29 = require("@flowgram.ai/editor");
|
|
3753
|
-
var
|
|
3836
|
+
var import_semi_ui29 = require("@douyinfe/semi-ui");
|
|
3754
3837
|
var import_semi_icons10 = require("@douyinfe/semi-icons");
|
|
3755
3838
|
|
|
3756
3839
|
// src/components/inputs-values/styles.tsx
|
|
@@ -3783,7 +3866,7 @@ function InputsValues({
|
|
|
3783
3866
|
onChange,
|
|
3784
3867
|
sortIndexKey: "extra.index"
|
|
3785
3868
|
});
|
|
3786
|
-
return /* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ import_react58.default.createElement("div", null, /* @__PURE__ */ import_react58.default.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ import_react58.default.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ import_react58.default.createElement(
|
|
3787
3870
|
BlurInput,
|
|
3788
3871
|
{
|
|
3789
3872
|
style: { width: 100, minWidth: 100, maxWidth: 100 },
|
|
@@ -3793,7 +3876,7 @@ function InputsValues({
|
|
|
3793
3876
|
onChange: (v) => updateKey(item.id, v),
|
|
3794
3877
|
placeholder: import_editor29.I18n.t("Input Key")
|
|
3795
3878
|
}
|
|
3796
|
-
), /* @__PURE__ */
|
|
3879
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
3797
3880
|
InjectDynamicValueInput,
|
|
3798
3881
|
{
|
|
3799
3882
|
style: { flexGrow: 1 },
|
|
@@ -3807,20 +3890,20 @@ function InputsValues({
|
|
|
3807
3890
|
strategies: [...constantProps?.strategies || []]
|
|
3808
3891
|
}
|
|
3809
3892
|
}
|
|
3810
|
-
), /* @__PURE__ */
|
|
3811
|
-
|
|
3893
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
3894
|
+
import_semi_ui29.IconButton,
|
|
3812
3895
|
{
|
|
3813
3896
|
disabled: readonly,
|
|
3814
3897
|
theme: "borderless",
|
|
3815
|
-
icon: /* @__PURE__ */
|
|
3898
|
+
icon: /* @__PURE__ */ import_react58.default.createElement(import_semi_icons10.IconDelete, { size: "small" }),
|
|
3816
3899
|
size: "small",
|
|
3817
3900
|
onClick: () => remove(item.id)
|
|
3818
3901
|
}
|
|
3819
|
-
)))), /* @__PURE__ */
|
|
3820
|
-
|
|
3902
|
+
)))), /* @__PURE__ */ import_react58.default.createElement(
|
|
3903
|
+
import_semi_ui29.Button,
|
|
3821
3904
|
{
|
|
3822
3905
|
disabled: readonly,
|
|
3823
|
-
icon: /* @__PURE__ */
|
|
3906
|
+
icon: /* @__PURE__ */ import_react58.default.createElement(import_semi_icons10.IconPlus, null),
|
|
3824
3907
|
size: "small",
|
|
3825
3908
|
onClick: () => add({
|
|
3826
3909
|
type: "constant",
|
|
@@ -3834,7 +3917,7 @@ function InputsValues({
|
|
|
3834
3917
|
|
|
3835
3918
|
// src/components/display-schema-tree/index.tsx
|
|
3836
3919
|
init_cjs_shims();
|
|
3837
|
-
var
|
|
3920
|
+
var import_react59 = __toESM(require("react"));
|
|
3838
3921
|
init_plugins();
|
|
3839
3922
|
|
|
3840
3923
|
// src/components/display-schema-tree/styles.tsx
|
|
@@ -3920,7 +4003,7 @@ var TreeItem = import_styled_components12.default.div`
|
|
|
3920
4003
|
|
|
3921
4004
|
// src/components/display-schema-tree/index.tsx
|
|
3922
4005
|
function DisplaySchemaTree(props) {
|
|
3923
|
-
return /* @__PURE__ */
|
|
4006
|
+
return /* @__PURE__ */ import_react59.default.createElement(SchemaTree, { ...props });
|
|
3924
4007
|
}
|
|
3925
4008
|
function SchemaTree(props) {
|
|
3926
4009
|
const {
|
|
@@ -3936,31 +4019,31 @@ function SchemaTree(props) {
|
|
|
3936
4019
|
const icon = typeManager?.getDisplayIcon(schema);
|
|
3937
4020
|
let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
|
|
3938
4021
|
const childEntries = Object.entries(properties || {});
|
|
3939
|
-
return /* @__PURE__ */
|
|
4022
|
+
return /* @__PURE__ */ import_react59.default.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ import_react59.default.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ import_react59.default.createElement(HorizontalLine, null), showIcon && icon && import_react59.default.cloneElement(icon, {
|
|
3940
4023
|
className: "tree-icon"
|
|
3941
|
-
}), /* @__PURE__ */
|
|
4024
|
+
}), /* @__PURE__ */ import_react59.default.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ import_react59.default.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ import_react59.default.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
|
|
3942
4025
|
}
|
|
3943
4026
|
|
|
3944
4027
|
// src/components/display-outputs/index.tsx
|
|
3945
4028
|
init_cjs_shims();
|
|
3946
|
-
var
|
|
4029
|
+
var import_react61 = __toESM(require("react"));
|
|
3947
4030
|
var import_json_schema10 = require("@flowgram.ai/json-schema");
|
|
3948
4031
|
var import_editor30 = require("@flowgram.ai/editor");
|
|
3949
4032
|
|
|
3950
4033
|
// src/components/display-schema-tag/index.tsx
|
|
3951
4034
|
init_cjs_shims();
|
|
3952
|
-
var
|
|
3953
|
-
var
|
|
4035
|
+
var import_react60 = __toESM(require("react"));
|
|
4036
|
+
var import_semi_ui31 = require("@douyinfe/semi-ui");
|
|
3954
4037
|
init_plugins();
|
|
3955
4038
|
|
|
3956
4039
|
// src/components/display-schema-tag/styles.ts
|
|
3957
4040
|
init_cjs_shims();
|
|
3958
4041
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
3959
|
-
var
|
|
4042
|
+
var import_semi_ui30 = require("@douyinfe/semi-ui");
|
|
3960
4043
|
var PopoverContent = import_styled_components13.default.div`
|
|
3961
4044
|
padding: 10px;
|
|
3962
4045
|
`;
|
|
3963
|
-
var StyledTag = (0, import_styled_components13.default)(
|
|
4046
|
+
var StyledTag = (0, import_styled_components13.default)(import_semi_ui30.Tag)`
|
|
3964
4047
|
padding: 4px;
|
|
3965
4048
|
|
|
3966
4049
|
.tag-icon {
|
|
@@ -3980,14 +4063,14 @@ var TitleSpan = import_styled_components13.default.span`
|
|
|
3980
4063
|
function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
|
|
3981
4064
|
const typeManager = useTypeManager();
|
|
3982
4065
|
const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
|
|
3983
|
-
return /* @__PURE__ */
|
|
3984
|
-
|
|
4066
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
4067
|
+
import_semi_ui31.Popover,
|
|
3985
4068
|
{
|
|
3986
|
-
content: /* @__PURE__ */
|
|
4069
|
+
content: /* @__PURE__ */ import_react60.default.createElement(PopoverContent, null, /* @__PURE__ */ import_react60.default.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
|
|
3987
4070
|
},
|
|
3988
|
-
/* @__PURE__ */
|
|
4071
|
+
/* @__PURE__ */ import_react60.default.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && import_react60.default.cloneElement(icon, {
|
|
3989
4072
|
className: "tag-icon"
|
|
3990
|
-
}), title && /* @__PURE__ */
|
|
4073
|
+
}), title && /* @__PURE__ */ import_react60.default.createElement(TitleSpan, null, title))
|
|
3991
4074
|
);
|
|
3992
4075
|
}
|
|
3993
4076
|
|
|
@@ -4004,7 +4087,7 @@ var DisplayOutputsWrapper = import_styled_components14.default.div`
|
|
|
4004
4087
|
function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
4005
4088
|
const scope = (0, import_editor30.useCurrentScope)();
|
|
4006
4089
|
const refresh = (0, import_editor30.useRefresh)();
|
|
4007
|
-
(0,
|
|
4090
|
+
(0, import_react61.useEffect)(() => {
|
|
4008
4091
|
if (!displayFromScope) {
|
|
4009
4092
|
return () => null;
|
|
4010
4093
|
}
|
|
@@ -4023,7 +4106,7 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
|
4023
4106
|
return acm;
|
|
4024
4107
|
}, {}) : value?.properties || {};
|
|
4025
4108
|
const childEntries = Object.entries(properties || {});
|
|
4026
|
-
return /* @__PURE__ */
|
|
4109
|
+
return /* @__PURE__ */ import_react61.default.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ import_react61.default.createElement(
|
|
4027
4110
|
DisplaySchemaTag,
|
|
4028
4111
|
{
|
|
4029
4112
|
key,
|
|
@@ -4037,14 +4120,14 @@ function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
|
4037
4120
|
|
|
4038
4121
|
// src/components/display-flow-value/index.tsx
|
|
4039
4122
|
init_cjs_shims();
|
|
4040
|
-
var
|
|
4123
|
+
var import_react62 = __toESM(require("react"));
|
|
4041
4124
|
var import_json_schema11 = require("@flowgram.ai/json-schema");
|
|
4042
4125
|
var import_editor31 = require("@flowgram.ai/editor");
|
|
4043
4126
|
init_shared();
|
|
4044
4127
|
function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
4045
4128
|
const available = (0, import_editor31.useScopeAvailable)();
|
|
4046
4129
|
const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
|
|
4047
|
-
const schema = (0,
|
|
4130
|
+
const schema = (0, import_react62.useMemo)(() => {
|
|
4048
4131
|
if (value?.type === "ref") {
|
|
4049
4132
|
return import_json_schema11.JsonSchemaUtils.astToSchema(variable?.type);
|
|
4050
4133
|
}
|
|
@@ -4056,7 +4139,7 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
|
4056
4139
|
}
|
|
4057
4140
|
return { type: "unknown" };
|
|
4058
4141
|
}, [value, variable?.hash]);
|
|
4059
|
-
return /* @__PURE__ */
|
|
4142
|
+
return /* @__PURE__ */ import_react62.default.createElement(
|
|
4060
4143
|
DisplaySchemaTag,
|
|
4061
4144
|
{
|
|
4062
4145
|
title,
|
|
@@ -4069,8 +4152,8 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
|
4069
4152
|
|
|
4070
4153
|
// src/components/display-inputs-values/index.tsx
|
|
4071
4154
|
init_cjs_shims();
|
|
4072
|
-
var
|
|
4073
|
-
var
|
|
4155
|
+
var import_react63 = __toESM(require("react"));
|
|
4156
|
+
var import_lodash_es8 = require("lodash-es");
|
|
4074
4157
|
var import_editor32 = require("@flowgram.ai/editor");
|
|
4075
4158
|
init_shared();
|
|
4076
4159
|
|
|
@@ -4086,12 +4169,12 @@ var DisplayInputsWrapper = import_styled_components15.default.div`
|
|
|
4086
4169
|
// src/components/display-inputs-values/index.tsx
|
|
4087
4170
|
function DisplayInputsValues({ value, showIconInTree }) {
|
|
4088
4171
|
const childEntries = Object.entries(value || {});
|
|
4089
|
-
return /* @__PURE__ */
|
|
4172
|
+
return /* @__PURE__ */ import_react63.default.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => {
|
|
4090
4173
|
if (FlowValueUtils.isFlowValue(value2)) {
|
|
4091
|
-
return /* @__PURE__ */
|
|
4174
|
+
return /* @__PURE__ */ import_react63.default.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree });
|
|
4092
4175
|
}
|
|
4093
|
-
if ((0,
|
|
4094
|
-
return /* @__PURE__ */
|
|
4176
|
+
if ((0, import_lodash_es8.isPlainObject)(value2)) {
|
|
4177
|
+
return /* @__PURE__ */ import_react63.default.createElement(
|
|
4095
4178
|
DisplayInputsValueAllInTag,
|
|
4096
4179
|
{
|
|
4097
4180
|
key,
|
|
@@ -4110,37 +4193,37 @@ function DisplayInputsValueAllInTag({
|
|
|
4110
4193
|
showIconInTree
|
|
4111
4194
|
}) {
|
|
4112
4195
|
const available = (0, import_editor32.useScopeAvailable)();
|
|
4113
|
-
const schema = (0,
|
|
4196
|
+
const schema = (0, import_react63.useMemo)(
|
|
4114
4197
|
() => FlowValueUtils.inferJsonSchema(value, available.scope),
|
|
4115
4198
|
[available.version, value]
|
|
4116
4199
|
);
|
|
4117
|
-
return /* @__PURE__ */
|
|
4200
|
+
return /* @__PURE__ */ import_react63.default.createElement(DisplaySchemaTag, { title, value: schema, showIconInTree });
|
|
4118
4201
|
}
|
|
4119
4202
|
|
|
4120
4203
|
// src/components/assign-rows/index.tsx
|
|
4121
4204
|
init_cjs_shims();
|
|
4122
|
-
var
|
|
4205
|
+
var import_react66 = __toESM(require("react"));
|
|
4123
4206
|
var import_editor33 = require("@flowgram.ai/editor");
|
|
4124
|
-
var
|
|
4207
|
+
var import_semi_ui33 = require("@douyinfe/semi-ui");
|
|
4125
4208
|
var import_semi_icons12 = require("@douyinfe/semi-icons");
|
|
4126
4209
|
|
|
4127
4210
|
// src/components/assign-row/index.tsx
|
|
4128
4211
|
init_cjs_shims();
|
|
4129
|
-
var
|
|
4130
|
-
var
|
|
4212
|
+
var import_react65 = __toESM(require("react"));
|
|
4213
|
+
var import_semi_ui32 = require("@douyinfe/semi-ui");
|
|
4131
4214
|
var import_semi_icons11 = require("@douyinfe/semi-icons");
|
|
4132
4215
|
init_variable_selector();
|
|
4133
4216
|
|
|
4134
4217
|
// src/components/assign-row/components/blur-input.tsx
|
|
4135
4218
|
init_cjs_shims();
|
|
4136
|
-
var
|
|
4219
|
+
var import_react64 = __toESM(require("react"));
|
|
4137
4220
|
var import_input2 = __toESM(require("@douyinfe/semi-ui/lib/es/input"));
|
|
4138
4221
|
function BlurInput2(props) {
|
|
4139
|
-
const [value, setValue] = (0,
|
|
4140
|
-
(0,
|
|
4222
|
+
const [value, setValue] = (0, import_react64.useState)("");
|
|
4223
|
+
(0, import_react64.useEffect)(() => {
|
|
4141
4224
|
setValue(props.value);
|
|
4142
4225
|
}, [props.value]);
|
|
4143
|
-
return /* @__PURE__ */
|
|
4226
|
+
return /* @__PURE__ */ import_react64.default.createElement(
|
|
4144
4227
|
import_input2.default,
|
|
4145
4228
|
{
|
|
4146
4229
|
...props,
|
|
@@ -4166,7 +4249,7 @@ function AssignRow(props) {
|
|
|
4166
4249
|
onDelete,
|
|
4167
4250
|
readonly
|
|
4168
4251
|
} = props;
|
|
4169
|
-
return /* @__PURE__ */
|
|
4252
|
+
return /* @__PURE__ */ import_react65.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: 5 } }, /* @__PURE__ */ import_react65.default.createElement("div", { style: { width: 150, minWidth: 150, maxWidth: 150 } }, value?.operator === "assign" ? /* @__PURE__ */ import_react65.default.createElement(
|
|
4170
4253
|
InjectVariableSelector,
|
|
4171
4254
|
{
|
|
4172
4255
|
style: { width: "100%", height: 26 },
|
|
@@ -4177,7 +4260,7 @@ function AssignRow(props) {
|
|
|
4177
4260
|
left: { type: "ref", content: v }
|
|
4178
4261
|
})
|
|
4179
4262
|
}
|
|
4180
|
-
) : /* @__PURE__ */
|
|
4263
|
+
) : /* @__PURE__ */ import_react65.default.createElement(
|
|
4181
4264
|
BlurInput2,
|
|
4182
4265
|
{
|
|
4183
4266
|
style: { height: 26 },
|
|
@@ -4189,7 +4272,7 @@ function AssignRow(props) {
|
|
|
4189
4272
|
left: v
|
|
4190
4273
|
})
|
|
4191
4274
|
}
|
|
4192
|
-
)), /* @__PURE__ */
|
|
4275
|
+
)), /* @__PURE__ */ import_react65.default.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ import_react65.default.createElement(
|
|
4193
4276
|
InjectDynamicValueInput,
|
|
4194
4277
|
{
|
|
4195
4278
|
readonly,
|
|
@@ -4199,12 +4282,12 @@ function AssignRow(props) {
|
|
|
4199
4282
|
right: v
|
|
4200
4283
|
})
|
|
4201
4284
|
}
|
|
4202
|
-
)), onDelete && /* @__PURE__ */
|
|
4203
|
-
|
|
4285
|
+
)), onDelete && /* @__PURE__ */ import_react65.default.createElement("div", null, /* @__PURE__ */ import_react65.default.createElement(
|
|
4286
|
+
import_semi_ui32.IconButton,
|
|
4204
4287
|
{
|
|
4205
4288
|
size: "small",
|
|
4206
4289
|
theme: "borderless",
|
|
4207
|
-
icon: /* @__PURE__ */
|
|
4290
|
+
icon: /* @__PURE__ */ import_react65.default.createElement(import_semi_icons11.IconMinus, null),
|
|
4208
4291
|
onClick: () => onDelete?.()
|
|
4209
4292
|
}
|
|
4210
4293
|
)));
|
|
@@ -4213,7 +4296,7 @@ function AssignRow(props) {
|
|
|
4213
4296
|
// src/components/assign-rows/index.tsx
|
|
4214
4297
|
function AssignRows(props) {
|
|
4215
4298
|
const { name, readonly } = props;
|
|
4216
|
-
return /* @__PURE__ */
|
|
4299
|
+
return /* @__PURE__ */ import_react66.default.createElement(import_editor33.FieldArray, { name }, ({ field }) => /* @__PURE__ */ import_react66.default.createElement(import_react66.default.Fragment, null, field.map((childField, index) => /* @__PURE__ */ import_react66.default.createElement(
|
|
4217
4300
|
AssignRow,
|
|
4218
4301
|
{
|
|
4219
4302
|
key: childField.key,
|
|
@@ -4224,21 +4307,21 @@ function AssignRows(props) {
|
|
|
4224
4307
|
},
|
|
4225
4308
|
onDelete: () => field.remove(index)
|
|
4226
4309
|
}
|
|
4227
|
-
)), /* @__PURE__ */
|
|
4228
|
-
|
|
4310
|
+
)), /* @__PURE__ */ import_react66.default.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ import_react66.default.createElement(
|
|
4311
|
+
import_semi_ui33.Button,
|
|
4229
4312
|
{
|
|
4230
4313
|
size: "small",
|
|
4231
4314
|
theme: "borderless",
|
|
4232
|
-
icon: /* @__PURE__ */
|
|
4315
|
+
icon: /* @__PURE__ */ import_react66.default.createElement(import_semi_icons12.IconPlus, null),
|
|
4233
4316
|
onClick: () => field.append({ operator: "assign" })
|
|
4234
4317
|
},
|
|
4235
4318
|
"Assign"
|
|
4236
|
-
), /* @__PURE__ */
|
|
4237
|
-
|
|
4319
|
+
), /* @__PURE__ */ import_react66.default.createElement(
|
|
4320
|
+
import_semi_ui33.Button,
|
|
4238
4321
|
{
|
|
4239
4322
|
size: "small",
|
|
4240
4323
|
theme: "borderless",
|
|
4241
|
-
icon: /* @__PURE__ */
|
|
4324
|
+
icon: /* @__PURE__ */ import_react66.default.createElement(import_semi_icons12.IconPlus, null),
|
|
4242
4325
|
onClick: () => field.append({ operator: "declare" })
|
|
4243
4326
|
},
|
|
4244
4327
|
"Declaration"
|
|
@@ -4247,15 +4330,15 @@ function AssignRows(props) {
|
|
|
4247
4330
|
|
|
4248
4331
|
// src/components/inputs-values-tree/index.tsx
|
|
4249
4332
|
init_cjs_shims();
|
|
4250
|
-
var
|
|
4333
|
+
var import_react70 = __toESM(require("react"));
|
|
4251
4334
|
var import_editor35 = require("@flowgram.ai/editor");
|
|
4252
|
-
var
|
|
4335
|
+
var import_semi_ui35 = require("@douyinfe/semi-ui");
|
|
4253
4336
|
var import_semi_icons15 = require("@douyinfe/semi-icons");
|
|
4254
4337
|
init_shared();
|
|
4255
4338
|
|
|
4256
4339
|
// src/components/inputs-values-tree/styles.tsx
|
|
4257
4340
|
init_cjs_shims();
|
|
4258
|
-
var
|
|
4341
|
+
var import_react67 = __toESM(require("react"));
|
|
4259
4342
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
4260
4343
|
var import_semi_icons13 = __toESM(require("@douyinfe/semi-icons"));
|
|
4261
4344
|
var UIContainer6 = import_styled_components16.default.div``;
|
|
@@ -4336,7 +4419,7 @@ var UICollapsible2 = import_styled_components16.default.div`
|
|
|
4336
4419
|
var UIActions2 = import_styled_components16.default.div`
|
|
4337
4420
|
white-space: nowrap;
|
|
4338
4421
|
`;
|
|
4339
|
-
var iconAddChildrenSvg2 = /* @__PURE__ */
|
|
4422
|
+
var iconAddChildrenSvg2 = /* @__PURE__ */ import_react67.default.createElement(
|
|
4340
4423
|
"svg",
|
|
4341
4424
|
{
|
|
4342
4425
|
className: "icon-icon icon-icon-coz_add_node ",
|
|
@@ -4346,7 +4429,7 @@ var iconAddChildrenSvg2 = /* @__PURE__ */ import_react69.default.createElement(
|
|
|
4346
4429
|
fill: "currentColor",
|
|
4347
4430
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4348
4431
|
},
|
|
4349
|
-
/* @__PURE__ */
|
|
4432
|
+
/* @__PURE__ */ import_react67.default.createElement(
|
|
4350
4433
|
"path",
|
|
4351
4434
|
{
|
|
4352
4435
|
fillRule: "evenodd",
|
|
@@ -4354,25 +4437,25 @@ var iconAddChildrenSvg2 = /* @__PURE__ */ import_react69.default.createElement(
|
|
|
4354
4437
|
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
4438
|
}
|
|
4356
4439
|
),
|
|
4357
|
-
/* @__PURE__ */
|
|
4440
|
+
/* @__PURE__ */ import_react67.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
4441
|
);
|
|
4359
|
-
var IconAddChildren2 = () => /* @__PURE__ */
|
|
4442
|
+
var IconAddChildren2 = () => /* @__PURE__ */ import_react67.default.createElement(import_semi_icons13.default, { size: "small", svg: iconAddChildrenSvg2 });
|
|
4360
4443
|
|
|
4361
4444
|
// src/components/inputs-values-tree/row.tsx
|
|
4362
4445
|
init_cjs_shims();
|
|
4363
|
-
var
|
|
4446
|
+
var import_react69 = __toESM(require("react"));
|
|
4364
4447
|
var import_editor34 = require("@flowgram.ai/editor");
|
|
4365
|
-
var
|
|
4448
|
+
var import_semi_ui34 = require("@douyinfe/semi-ui");
|
|
4366
4449
|
var import_semi_icons14 = require("@douyinfe/semi-icons");
|
|
4367
4450
|
|
|
4368
4451
|
// src/components/inputs-values-tree/hooks/use-child-list.tsx
|
|
4369
4452
|
init_cjs_shims();
|
|
4370
|
-
var
|
|
4371
|
-
var
|
|
4453
|
+
var import_react68 = require("react");
|
|
4454
|
+
var import_lodash_es9 = require("lodash-es");
|
|
4372
4455
|
init_shared();
|
|
4373
4456
|
function useChildList(value, onChange) {
|
|
4374
|
-
const canAddField = (0,
|
|
4375
|
-
if (!(0,
|
|
4457
|
+
const canAddField = (0, import_react68.useMemo)(() => {
|
|
4458
|
+
if (!(0, import_lodash_es9.isPlainObject)(value)) {
|
|
4376
4459
|
return false;
|
|
4377
4460
|
}
|
|
4378
4461
|
if (FlowValueUtils.isFlowValue(value)) {
|
|
@@ -4380,8 +4463,8 @@ function useChildList(value, onChange) {
|
|
|
4380
4463
|
}
|
|
4381
4464
|
return true;
|
|
4382
4465
|
}, [value]);
|
|
4383
|
-
const objectListValue = (0,
|
|
4384
|
-
if ((0,
|
|
4466
|
+
const objectListValue = (0, import_react68.useMemo)(() => {
|
|
4467
|
+
if ((0, import_lodash_es9.isPlainObject)(value)) {
|
|
4385
4468
|
if (FlowValueUtils.isFlowValue(value)) {
|
|
4386
4469
|
return void 0;
|
|
4387
4470
|
}
|
|
@@ -4396,7 +4479,7 @@ function useChildList(value, onChange) {
|
|
|
4396
4479
|
},
|
|
4397
4480
|
sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
|
|
4398
4481
|
});
|
|
4399
|
-
const hasChildren = (0,
|
|
4482
|
+
const hasChildren = (0, import_react68.useMemo)(
|
|
4400
4483
|
() => canAddField && (list.length > 0 || Object.keys(objectListValue || {}).length > 0),
|
|
4401
4484
|
[canAddField, list.length, Object.keys(objectListValue || {}).length]
|
|
4402
4485
|
);
|
|
@@ -4414,8 +4497,8 @@ function useChildList(value, onChange) {
|
|
|
4414
4497
|
// src/components/inputs-values-tree/row.tsx
|
|
4415
4498
|
var AddObjectChildStrategy = {
|
|
4416
4499
|
hit: (schema) => schema.type === "object",
|
|
4417
|
-
Renderer: () => /* @__PURE__ */
|
|
4418
|
-
|
|
4500
|
+
Renderer: () => /* @__PURE__ */ import_react69.default.createElement(
|
|
4501
|
+
import_semi_ui34.Input,
|
|
4419
4502
|
{
|
|
4420
4503
|
size: "small",
|
|
4421
4504
|
disabled: true,
|
|
@@ -4437,23 +4520,23 @@ function InputValueRow(props) {
|
|
|
4437
4520
|
hasError,
|
|
4438
4521
|
readonly
|
|
4439
4522
|
} = props;
|
|
4440
|
-
const [collapse, setCollapse] = (0,
|
|
4523
|
+
const [collapse, setCollapse] = (0, import_react69.useState)(false);
|
|
4441
4524
|
const { canAddField, hasChildren, list, add, updateKey, updateValue, remove } = useChildList(
|
|
4442
4525
|
value,
|
|
4443
4526
|
onUpdateValue
|
|
4444
4527
|
);
|
|
4445
|
-
const strategies = (0,
|
|
4528
|
+
const strategies = (0, import_react69.useMemo)(
|
|
4446
4529
|
() => [...hasChildren ? [AddObjectChildStrategy] : [], ...constantProps?.strategies || []],
|
|
4447
4530
|
[hasChildren, constantProps?.strategies]
|
|
4448
4531
|
);
|
|
4449
|
-
const flowDisplayValue = (0,
|
|
4532
|
+
const flowDisplayValue = (0, import_react69.useMemo)(
|
|
4450
4533
|
() => hasChildren ? {
|
|
4451
4534
|
type: "constant",
|
|
4452
4535
|
schema: { type: "object" }
|
|
4453
4536
|
} : value,
|
|
4454
4537
|
[hasChildren, value]
|
|
4455
4538
|
);
|
|
4456
|
-
return /* @__PURE__ */
|
|
4539
|
+
return /* @__PURE__ */ import_react69.default.createElement(import_react69.default.Fragment, null, /* @__PURE__ */ import_react69.default.createElement(UITreeItemLeft2, { $isLast, $showLine: $level > 0, $showCollapse: hasChildren }, hasChildren && /* @__PURE__ */ import_react69.default.createElement(UICollapseTrigger2, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ import_react69.default.createElement(import_semi_icons14.IconChevronDown, { size: "small" }) : /* @__PURE__ */ import_react69.default.createElement(import_semi_icons14.IconChevronRight, { size: "small" }))), /* @__PURE__ */ import_react69.default.createElement(UITreeItemRight2, null, /* @__PURE__ */ import_react69.default.createElement(UITreeItemMain2, null, /* @__PURE__ */ import_react69.default.createElement(UIRow4, null, /* @__PURE__ */ import_react69.default.createElement(
|
|
4457
4540
|
BlurInput,
|
|
4458
4541
|
{
|
|
4459
4542
|
style: { width: 100, minWidth: 100, maxWidth: 100 },
|
|
@@ -4463,7 +4546,7 @@ function InputValueRow(props) {
|
|
|
4463
4546
|
onChange: (v) => onUpdateKey?.(v),
|
|
4464
4547
|
placeholder: import_editor34.I18n.t("Input Key")
|
|
4465
4548
|
}
|
|
4466
|
-
), /* @__PURE__ */
|
|
4549
|
+
), /* @__PURE__ */ import_react69.default.createElement(
|
|
4467
4550
|
InjectDynamicValueInput,
|
|
4468
4551
|
{
|
|
4469
4552
|
style: { flexGrow: 1 },
|
|
@@ -4476,13 +4559,13 @@ function InputValueRow(props) {
|
|
|
4476
4559
|
strategies
|
|
4477
4560
|
}
|
|
4478
4561
|
}
|
|
4479
|
-
), /* @__PURE__ */
|
|
4480
|
-
|
|
4562
|
+
), /* @__PURE__ */ import_react69.default.createElement(UIActions2, null, canAddField && /* @__PURE__ */ import_react69.default.createElement(
|
|
4563
|
+
import_semi_ui34.IconButton,
|
|
4481
4564
|
{
|
|
4482
4565
|
disabled: readonly,
|
|
4483
4566
|
size: "small",
|
|
4484
4567
|
theme: "borderless",
|
|
4485
|
-
icon: /* @__PURE__ */
|
|
4568
|
+
icon: /* @__PURE__ */ import_react69.default.createElement(IconAddChildren2, null),
|
|
4486
4569
|
onClick: () => {
|
|
4487
4570
|
add({
|
|
4488
4571
|
type: "constant",
|
|
@@ -4492,16 +4575,16 @@ function InputValueRow(props) {
|
|
|
4492
4575
|
setCollapse(true);
|
|
4493
4576
|
}
|
|
4494
4577
|
}
|
|
4495
|
-
), /* @__PURE__ */
|
|
4496
|
-
|
|
4578
|
+
), /* @__PURE__ */ import_react69.default.createElement(
|
|
4579
|
+
import_semi_ui34.IconButton,
|
|
4497
4580
|
{
|
|
4498
4581
|
disabled: readonly,
|
|
4499
4582
|
theme: "borderless",
|
|
4500
|
-
icon: /* @__PURE__ */
|
|
4583
|
+
icon: /* @__PURE__ */ import_react69.default.createElement(import_semi_icons14.IconDelete, { size: "small" }),
|
|
4501
4584
|
size: "small",
|
|
4502
4585
|
onClick: () => onRemove?.()
|
|
4503
4586
|
}
|
|
4504
|
-
)))), hasChildren && /* @__PURE__ */
|
|
4587
|
+
)))), hasChildren && /* @__PURE__ */ import_react69.default.createElement(UICollapsible2, { $collapse: collapse }, /* @__PURE__ */ import_react69.default.createElement(UITreeItems2, { $shrink: true }, list.map((_item, index) => /* @__PURE__ */ import_react69.default.createElement(
|
|
4505
4588
|
InputValueRow,
|
|
4506
4589
|
{
|
|
4507
4590
|
readonly,
|
|
@@ -4533,7 +4616,7 @@ function InputsValuesTree(props) {
|
|
|
4533
4616
|
onChange,
|
|
4534
4617
|
sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
|
|
4535
4618
|
});
|
|
4536
|
-
return /* @__PURE__ */
|
|
4619
|
+
return /* @__PURE__ */ import_react70.default.createElement("div", null, /* @__PURE__ */ import_react70.default.createElement(UITreeItems2, null, list.map((item) => /* @__PURE__ */ import_react70.default.createElement(
|
|
4537
4620
|
InputValueRow,
|
|
4538
4621
|
{
|
|
4539
4622
|
key: item.id,
|
|
@@ -4546,12 +4629,12 @@ function InputsValuesTree(props) {
|
|
|
4546
4629
|
hasError,
|
|
4547
4630
|
constantProps
|
|
4548
4631
|
}
|
|
4549
|
-
))), /* @__PURE__ */
|
|
4550
|
-
|
|
4632
|
+
))), /* @__PURE__ */ import_react70.default.createElement(
|
|
4633
|
+
import_semi_ui35.Button,
|
|
4551
4634
|
{
|
|
4552
4635
|
style: { marginTop: 10, marginLeft: 16 },
|
|
4553
4636
|
disabled: readonly,
|
|
4554
|
-
icon: /* @__PURE__ */
|
|
4637
|
+
icon: /* @__PURE__ */ import_react70.default.createElement(import_semi_icons15.IconPlus, null),
|
|
4555
4638
|
size: "small",
|
|
4556
4639
|
onClick: () => {
|
|
4557
4640
|
add({
|
|
@@ -4704,7 +4787,7 @@ var syncVariableTitle = [
|
|
|
4704
4787
|
|
|
4705
4788
|
// src/effects/validate-when-variable-sync/index.ts
|
|
4706
4789
|
init_cjs_shims();
|
|
4707
|
-
var
|
|
4790
|
+
var import_lodash_es10 = require("lodash-es");
|
|
4708
4791
|
var import_editor40 = require("@flowgram.ai/editor");
|
|
4709
4792
|
var validateWhenVariableSync = ({
|
|
4710
4793
|
scope
|
|
@@ -4714,7 +4797,7 @@ var validateWhenVariableSync = ({
|
|
|
4714
4797
|
effect: ({ context, form }) => {
|
|
4715
4798
|
const nodeScope = scope === "private" ? (0, import_editor40.getNodePrivateScope)(context.node) : (0, import_editor40.getNodeScope)(context.node);
|
|
4716
4799
|
const disposable = nodeScope.available.onListOrAnyVarChange(() => {
|
|
4717
|
-
if (!(0,
|
|
4800
|
+
if (!(0, import_lodash_es10.isEmpty)(form.state.errors)) {
|
|
4718
4801
|
form.validate();
|
|
4719
4802
|
}
|
|
4720
4803
|
});
|
|
@@ -4856,7 +4939,7 @@ var createBatchOutputsFormPlugin = (0, import_editor43.defineFormPluginCreator)(
|
|
|
4856
4939
|
|
|
4857
4940
|
// src/form-plugins/infer-inputs-plugin/index.ts
|
|
4858
4941
|
init_cjs_shims();
|
|
4859
|
-
var
|
|
4942
|
+
var import_lodash_es11 = require("lodash-es");
|
|
4860
4943
|
var import_editor44 = require("@flowgram.ai/editor");
|
|
4861
4944
|
init_shared();
|
|
4862
4945
|
var createInferInputsPlugin = (0, import_editor44.defineFormPluginCreator)({
|
|
@@ -4865,11 +4948,11 @@ var createInferInputsPlugin = (0, import_editor44.defineFormPluginCreator)({
|
|
|
4865
4948
|
return;
|
|
4866
4949
|
}
|
|
4867
4950
|
addFormatOnSubmit((formData, ctx) => {
|
|
4868
|
-
(0,
|
|
4951
|
+
(0, import_lodash_es11.set)(
|
|
4869
4952
|
formData,
|
|
4870
4953
|
targetKey,
|
|
4871
4954
|
FlowValueUtils.inferJsonSchema(
|
|
4872
|
-
(0,
|
|
4955
|
+
(0, import_lodash_es11.get)(formData, sourceKey),
|
|
4873
4956
|
scope === "private" ? (0, import_editor44.getNodePrivateScope)(ctx.node) : (0, import_editor44.getNodeScope)(ctx.node)
|
|
4874
4957
|
)
|
|
4875
4958
|
);
|
|
@@ -4880,7 +4963,7 @@ var createInferInputsPlugin = (0, import_editor44.defineFormPluginCreator)({
|
|
|
4880
4963
|
|
|
4881
4964
|
// src/form-plugins/infer-assign-plugin/index.ts
|
|
4882
4965
|
init_cjs_shims();
|
|
4883
|
-
var
|
|
4966
|
+
var import_lodash_es12 = require("lodash-es");
|
|
4884
4967
|
var import_json_schema14 = require("@flowgram.ai/json-schema");
|
|
4885
4968
|
var import_editor45 = require("@flowgram.ai/editor");
|
|
4886
4969
|
var createInferAssignPlugin = (0, import_editor45.defineFormPluginCreator)({
|
|
@@ -4891,7 +4974,7 @@ var createInferAssignPlugin = (0, import_editor45.defineFormPluginCreator)({
|
|
|
4891
4974
|
mergeEffect({
|
|
4892
4975
|
[assignKey]: (0, import_editor45.createEffectFromVariableProvider)({
|
|
4893
4976
|
parse: (value, ctx) => {
|
|
4894
|
-
const declareRows = (0,
|
|
4977
|
+
const declareRows = (0, import_lodash_es12.uniqBy)(
|
|
4895
4978
|
value.filter((_v) => _v.operator === "declare" && _v.left && _v.right),
|
|
4896
4979
|
"left"
|
|
4897
4980
|
);
|
|
@@ -4919,7 +5002,7 @@ var createInferAssignPlugin = (0, import_editor45.defineFormPluginCreator)({
|
|
|
4919
5002
|
})
|
|
4920
5003
|
});
|
|
4921
5004
|
addFormatOnSubmit((formData, ctx) => {
|
|
4922
|
-
(0,
|
|
5005
|
+
(0, import_lodash_es12.set)(
|
|
4923
5006
|
formData,
|
|
4924
5007
|
outputKey,
|
|
4925
5008
|
import_json_schema14.JsonSchemaUtils.astToSchema((0, import_editor45.getNodeScope)(ctx.node).output.variables?.[0]?.type)
|
|
@@ -4937,7 +5020,7 @@ init_cjs_shims();
|
|
|
4937
5020
|
|
|
4938
5021
|
// src/validate/validate-flow-value/index.tsx
|
|
4939
5022
|
init_cjs_shims();
|
|
4940
|
-
var
|
|
5023
|
+
var import_lodash_es13 = require("lodash-es");
|
|
4941
5024
|
var import_editor46 = require("@flowgram.ai/editor");
|
|
4942
5025
|
init_shared();
|
|
4943
5026
|
function validateFlowValue(value, ctx) {
|
|
@@ -4946,7 +5029,7 @@ function validateFlowValue(value, ctx) {
|
|
|
4946
5029
|
required: requiredMessage = "Field is required",
|
|
4947
5030
|
unknownVariable: unknownVariableMessage = "Unknown Variable"
|
|
4948
5031
|
} = errorMessages || {};
|
|
4949
|
-
if (required && ((0,
|
|
5032
|
+
if (required && ((0, import_lodash_es13.isNil)(value) || (0, import_lodash_es13.isNil)(value?.content) || value?.content === "")) {
|
|
4950
5033
|
return {
|
|
4951
5034
|
level: import_editor46.FeedbackLevel.Error,
|
|
4952
5035
|
message: requiredMessage
|
|
@@ -5009,6 +5092,7 @@ function validateFlowValue(value, ctx) {
|
|
|
5009
5092
|
PromptEditorWithVariables,
|
|
5010
5093
|
TypeSelector,
|
|
5011
5094
|
VariableSelector,
|
|
5095
|
+
VariableSelectorProvider,
|
|
5012
5096
|
autoRenameRefEffect,
|
|
5013
5097
|
createBatchOutputsFormPlugin,
|
|
5014
5098
|
createDisableDeclarationPlugin,
|
|
@@ -5023,6 +5107,7 @@ function validateFlowValue(value, ctx) {
|
|
|
5023
5107
|
getTypeSelectValue,
|
|
5024
5108
|
isLegacyFlowRefValueSchema,
|
|
5025
5109
|
isNewFlowRefValueSchema,
|
|
5110
|
+
lazySuspense,
|
|
5026
5111
|
listenRefSchemaChange,
|
|
5027
5112
|
listenRefValueChange,
|
|
5028
5113
|
parseTypeSelectValue,
|
|
@@ -5036,6 +5121,7 @@ function validateFlowValue(value, ctx) {
|
|
|
5036
5121
|
useTypeManager,
|
|
5037
5122
|
useVariableTree,
|
|
5038
5123
|
validateFlowValue,
|
|
5039
|
-
validateWhenVariableSync
|
|
5124
|
+
validateWhenVariableSync,
|
|
5125
|
+
withSuspense
|
|
5040
5126
|
});
|
|
5041
5127
|
//# sourceMappingURL=index.js.map
|