@tmagic/editor 1.2.14 → 1.3.0-alpha.0

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.
Files changed (59) hide show
  1. package/dist/style.css +173 -80
  2. package/dist/tmagic-editor.js +975 -222
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +984 -230
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +10 -9
  7. package/src/Editor.vue +2 -0
  8. package/src/components/CodeDraftEditor.vue +2 -2
  9. package/src/components/SearchInput.vue +6 -3
  10. package/src/editorProps.ts +5 -0
  11. package/src/fields/CodeSelect.vue +1 -0
  12. package/src/fields/DataSourceFields.vue +178 -0
  13. package/src/fields/EventSelect.vue +1 -0
  14. package/src/fields/KeyValue.vue +93 -0
  15. package/src/icons/AppManageIcon.vue +1 -1
  16. package/src/icons/CodeIcon.vue +1 -10
  17. package/src/index.ts +6 -0
  18. package/src/initService.ts +59 -3
  19. package/src/layouts/sidebar/LayerPanel.vue +2 -0
  20. package/src/layouts/sidebar/Sidebar.vue +24 -14
  21. package/src/layouts/sidebar/code-block/CodeBlockList.vue +11 -4
  22. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +84 -0
  23. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +130 -0
  24. package/src/services/codeBlock.ts +0 -2
  25. package/src/services/dataSource.ts +90 -0
  26. package/src/services/props.ts +2 -15
  27. package/src/theme/code-block.scss +4 -66
  28. package/src/theme/data-source-fields.scss +13 -0
  29. package/src/theme/data-source.scss +17 -0
  30. package/src/theme/dep-list.scss +59 -0
  31. package/src/theme/key-value.scss +13 -0
  32. package/src/theme/sidebar.scss +26 -6
  33. package/src/theme/theme.scss +4 -0
  34. package/src/type.ts +3 -1
  35. package/src/utils/data-source/formConfigs/base.ts +32 -0
  36. package/src/utils/data-source/formConfigs/http.ts +50 -0
  37. package/src/utils/data-source/index.ts +31 -0
  38. package/src/utils/dep.ts +9 -1
  39. package/src/utils/props.ts +1 -0
  40. package/types/Editor.vue.d.ts +9 -0
  41. package/types/components/ContentMenu.vue.d.ts +2 -2
  42. package/types/components/ScrollViewer.vue.d.ts +1 -1
  43. package/types/editorProps.d.ts +4 -0
  44. package/types/fields/DataSourceFields.vue.d.ts +40 -0
  45. package/types/fields/KeyValue.vue.d.ts +50 -0
  46. package/types/index.d.ts +2 -0
  47. package/types/initService.d.ts +1 -1
  48. package/types/layouts/CodeEditor.vue.d.ts +1 -1
  49. package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -2
  50. package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +22 -0
  51. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +12 -0
  52. package/types/services/dataSource.d.ts +25 -0
  53. package/types/services/props.d.ts +17 -12
  54. package/types/type.d.ts +3 -1
  55. package/types/utils/data-source/formConfigs/base.d.ts +3 -0
  56. package/types/utils/data-source/formConfigs/http.d.ts +3 -0
  57. package/types/utils/data-source/index.d.ts +2 -0
  58. package/types/utils/dep.d.ts +2 -1
  59. package/types/utils/props.d.ts +2 -3
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/design'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/form'), require('monaco-editor'), require('gesto'), require('@tmagic/utils'), require('keycon'), require('@tmagic/stage'), require('events'), require('@tmagic/core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/design', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/form', 'monaco-editor', 'gesto', '@tmagic/utils', 'keycon', '@tmagic/stage', 'events', '@tmagic/core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.design, global.schema, global.iconsVue, global.form, global.monaco, global.Gesto, global.utils, global.KeyController, global.StageCore, global.events, global.core));
5
- })(this, (function (exports, vue, serialize, lodashEs, design, schema, iconsVue, form, monaco, Gesto, utils, KeyController, StageCore, events, core) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/design'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/form'), require('@tmagic/table'), require('monaco-editor'), require('gesto'), require('@tmagic/utils'), require('keycon'), require('@tmagic/stage'), require('events'), require('@tmagic/core')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/design', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/form', '@tmagic/table', 'monaco-editor', 'gesto', '@tmagic/utils', 'keycon', '@tmagic/stage', 'events', '@tmagic/core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.design, global.schema, global.iconsVue, global.form, global.table, global.monaco, global.Gesto, global.utils, global.KeyController, global.StageCore, global.events, global.core));
5
+ })(this, (function (exports, vue, serialize, lodashEs, design, schema, iconsVue, form, table, monaco, Gesto, utils, KeyController, StageCore, events, core) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
@@ -23,11 +23,11 @@
23
23
 
24
24
  const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
25
25
 
26
- const __default__$v = vue.defineComponent({
26
+ const __default__$w = vue.defineComponent({
27
27
  name: "MEditorCode"
28
28
  });
29
- const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
30
- ...__default__$v,
29
+ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
30
+ ...__default__$w,
31
31
  props: {
32
32
  model: null,
33
33
  name: null,
@@ -56,11 +56,11 @@
56
56
  }
57
57
  });
58
58
 
59
- const __default__$u = vue.defineComponent({
59
+ const __default__$v = vue.defineComponent({
60
60
  name: "MEditorCodeLink"
61
61
  });
62
- const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
63
- ...__default__$u,
62
+ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
63
+ ...__default__$v,
64
64
  props: {
65
65
  config: null,
66
66
  model: null,
@@ -129,11 +129,11 @@
129
129
  }
130
130
  });
131
131
 
132
- const __default__$t = vue.defineComponent({
132
+ const __default__$u = vue.defineComponent({
133
133
  name: "MEditorCodeSelect"
134
134
  });
135
- const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
136
- ...__default__$t,
135
+ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
136
+ ...__default__$u,
137
137
  props: {
138
138
  config: null,
139
139
  model: null,
@@ -150,7 +150,8 @@
150
150
  enableToggleMode: false,
151
151
  items: [
152
152
  {
153
- type: "code-select-col"
153
+ type: "code-select-col",
154
+ labelWidth: 0
154
155
  }
155
156
  ]
156
157
  }));
@@ -191,12 +192,12 @@
191
192
  }
192
193
  });
193
194
 
194
- const _hoisted_1$j = ["src"];
195
- const __default__$s = vue.defineComponent({
195
+ const _hoisted_1$n = ["src"];
196
+ const __default__$t = vue.defineComponent({
196
197
  name: "MEditorIcon"
197
198
  });
198
- const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
199
- ...__default__$s,
199
+ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
200
+ ...__default__$t,
200
201
  props: {
201
202
  icon: null
202
203
  },
@@ -215,7 +216,7 @@
215
216
  class: "magic-editor-icon"
216
217
  }, {
217
218
  default: vue.withCtx(() => [
218
- vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$j)
219
+ vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$n)
219
220
  ]),
220
221
  _: 1
221
222
  })) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
@@ -234,13 +235,13 @@
234
235
  }
235
236
  });
236
237
 
237
- const _hoisted_1$i = { class: "m-fields-code-select-col" };
238
- const _hoisted_2$a = { class: "code-select-container" };
239
- const __default__$r = vue.defineComponent({
238
+ const _hoisted_1$m = { class: "m-fields-code-select-col" };
239
+ const _hoisted_2$e = { class: "code-select-container" };
240
+ const __default__$s = vue.defineComponent({
240
241
  name: "MEditorCodeSelectCol"
241
242
  });
242
- const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
243
- ...__default__$r,
243
+ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
244
+ ...__default__$s,
244
245
  props: {
245
246
  config: null,
246
247
  model: null,
@@ -328,15 +329,15 @@
328
329
  };
329
330
  return (_ctx, _cache) => {
330
331
  const _component_m_form_container = vue.resolveComponent("m-form-container");
331
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
332
- vue.createElementVNode("div", _hoisted_2$a, [
332
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
333
+ vue.createElementVNode("div", _hoisted_2$e, [
333
334
  vue.createVNode(_component_m_form_container, {
334
335
  class: "select",
335
336
  config: selectConfig,
336
337
  model: __props.model,
337
338
  onChange: onParamsChangeHandler
338
339
  }, null, 8, ["model"]),
339
- vue.createVNode(_sfc_main$w, {
340
+ vue.createVNode(_sfc_main$A, {
340
341
  class: "icon",
341
342
  icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
342
343
  onClick: editCode
@@ -352,17 +353,196 @@
352
353
  }
353
354
  });
354
355
 
355
- const _hoisted_1$h = { class: "m-fields-event-select" };
356
- const _hoisted_2$9 = {
356
+ const _hoisted_1$l = { class: "m-editor-data-source-fields" };
357
+ const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
358
+ const _hoisted_3$8 = /* @__PURE__ */ vue.createTextVNode("添加");
359
+ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
360
+ __name: "DataSourceFields",
361
+ props: {
362
+ config: null,
363
+ model: null,
364
+ prop: null,
365
+ disabled: { type: Boolean, default: false },
366
+ name: null
367
+ },
368
+ emits: ["change"],
369
+ setup(__props, { emit }) {
370
+ const props = __props;
371
+ const addDialog = vue.ref();
372
+ const fieldValues = vue.ref({});
373
+ const filedTitle = vue.ref("");
374
+ const newHandler = () => {
375
+ if (!addDialog.value)
376
+ return;
377
+ fieldValues.value = {};
378
+ filedTitle.value = "新增属性";
379
+ addDialog.value.dialogVisible = true;
380
+ };
381
+ const fieldChange = ({ index, ...value }) => {
382
+ if (!addDialog.value)
383
+ return;
384
+ if (index > -1) {
385
+ props.model[props.name][index] = value;
386
+ } else {
387
+ props.model[props.name].push(value);
388
+ }
389
+ addDialog.value.dialogVisible = false;
390
+ emit("change", props.model[props.name]);
391
+ };
392
+ const filedColumns = [
393
+ {
394
+ label: "属性名称",
395
+ prop: "title"
396
+ },
397
+ {
398
+ label: "属性key",
399
+ prop: "name"
400
+ },
401
+ {
402
+ label: "属性描述",
403
+ prop: "desc"
404
+ },
405
+ {
406
+ label: "操作",
407
+ fixed: "right",
408
+ actions: [
409
+ {
410
+ text: "编辑",
411
+ handler: (row, index) => {
412
+ if (!addDialog.value)
413
+ return;
414
+ fieldValues.value = {
415
+ ...row,
416
+ index
417
+ };
418
+ filedTitle.value = `编辑${row.title}`;
419
+ addDialog.value.dialogVisible = true;
420
+ }
421
+ },
422
+ {
423
+ text: "删除",
424
+ buttonType: "danger",
425
+ handler: async (row, index) => {
426
+ await design.tMagicMessageBox.confirm(`确定删除${row.title}(${row.name})?`, "提示");
427
+ props.model[props.name].splice(index, 1);
428
+ emit("change", props.model[props.name]);
429
+ }
430
+ }
431
+ ]
432
+ }
433
+ ];
434
+ const dataSourceFieldsConfig = [
435
+ { name: "index", type: "hidden", filter: "number", defaultValue: -1 },
436
+ {
437
+ name: "type",
438
+ text: "数据类型",
439
+ type: "select",
440
+ defaultValue: "string",
441
+ options: [
442
+ { text: "字符串", value: "string" },
443
+ { text: "数字", value: "number" },
444
+ { text: "布尔值", value: "boolean" },
445
+ { text: "对象", value: "object" },
446
+ { text: "数组", value: "array" },
447
+ { text: "null", value: "null" },
448
+ { text: "any", value: "any" }
449
+ ]
450
+ },
451
+ {
452
+ name: "name",
453
+ text: "字段名称",
454
+ rules: [
455
+ {
456
+ required: true,
457
+ message: "请输入字段名称"
458
+ },
459
+ {
460
+ validator: ({ value, callback }, { model, parent }) => {
461
+ const index = parent.findIndex((item) => item.name === value);
462
+ if (model.index === -1 && index > -1 || model.index > -1 && index !== model.index) {
463
+ return callback(`属性key(${value})已存在`);
464
+ }
465
+ callback();
466
+ }
467
+ }
468
+ ]
469
+ },
470
+ {
471
+ name: "title",
472
+ text: "展示名称",
473
+ rules: [
474
+ {
475
+ required: true,
476
+ message: "请输入展示名称"
477
+ }
478
+ ]
479
+ },
480
+ {
481
+ name: "description",
482
+ text: "描述"
483
+ },
484
+ {
485
+ name: "defaultValue",
486
+ text: "默认值"
487
+ },
488
+ {
489
+ name: "enable",
490
+ text: "是否可用",
491
+ type: "switch",
492
+ defaultValue: true
493
+ },
494
+ {
495
+ name: "fields",
496
+ type: "data-source-fields",
497
+ defaultValue: [],
498
+ display: (formState, { model }) => model.type === "object"
499
+ }
500
+ ];
501
+ return (_ctx, _cache) => {
502
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
503
+ vue.createVNode(vue.unref(table.MagicTable), {
504
+ data: __props.model[__props.name],
505
+ columns: filedColumns
506
+ }, null, 8, ["data"]),
507
+ vue.createElementVNode("div", _hoisted_2$d, [
508
+ vue.createVNode(vue.unref(design.TMagicButton), {
509
+ size: "small",
510
+ type: "primary",
511
+ disabled: __props.disabled,
512
+ plain: "",
513
+ onClick: _cache[0] || (_cache[0] = ($event) => newHandler())
514
+ }, {
515
+ default: vue.withCtx(() => [
516
+ _hoisted_3$8
517
+ ]),
518
+ _: 1
519
+ }, 8, ["disabled"])
520
+ ]),
521
+ vue.createVNode(vue.unref(form.MFormDialog), {
522
+ ref_key: "addDialog",
523
+ ref: addDialog,
524
+ title: filedTitle.value,
525
+ config: dataSourceFieldsConfig,
526
+ values: fieldValues.value,
527
+ parentValues: __props.model[__props.name],
528
+ onSubmit: fieldChange
529
+ }, null, 8, ["title", "values", "parentValues"])
530
+ ]);
531
+ };
532
+ }
533
+ });
534
+
535
+ const _hoisted_1$k = { class: "m-fields-event-select" };
536
+ const _hoisted_2$c = {
357
537
  key: 1,
358
538
  class: "fullWidth"
359
539
  };
360
- const _hoisted_3$5 = /* @__PURE__ */ vue.createTextVNode("添加事件");
361
- const __default__$q = vue.defineComponent({
540
+ const _hoisted_3$7 = /* @__PURE__ */ vue.createTextVNode("添加事件");
541
+ const __default__$r = vue.defineComponent({
362
542
  name: "MEditorEventSelect"
363
543
  });
364
- const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
365
- ...__default__$q,
544
+ const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
545
+ ...__default__$r,
366
546
  props: {
367
547
  config: null,
368
548
  model: null,
@@ -441,6 +621,7 @@
441
621
  const codeActionConfig = vue.computed(() => {
442
622
  const defaultCodeActionConfig = {
443
623
  type: "code-select-col",
624
+ labelWidth: 0,
444
625
  display: (mForm, { model }) => model.actionType === schema.ActionType.CODE
445
626
  };
446
627
  return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
@@ -518,7 +699,7 @@
518
699
  const _component_m_form_table = vue.resolveComponent("m-form-table");
519
700
  const _component_m_form_container = vue.resolveComponent("m-form-container");
520
701
  const _component_m_form_panel = vue.resolveComponent("m-form-panel");
521
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
702
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
522
703
  vue.unref(isOldVersion) ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
523
704
  key: 0,
524
705
  ref: "eventForm",
@@ -527,7 +708,7 @@
527
708
  name: "events",
528
709
  config: vue.unref(tableConfig),
529
710
  onChange: onChangeHandler
530
- }, null, 8, ["size", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$9, [
711
+ }, null, 8, ["size", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$c, [
531
712
  vue.createVNode(vue.unref(design.TMagicButton), {
532
713
  class: "create-button",
533
714
  type: "primary",
@@ -535,7 +716,7 @@
535
716
  onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
536
717
  }, {
537
718
  default: vue.withCtx(() => [
538
- _hoisted_3$5
719
+ _hoisted_3$7
539
720
  ]),
540
721
  _: 1
541
722
  }),
@@ -569,12 +750,106 @@
569
750
  }
570
751
  });
571
752
 
572
- const _hoisted_1$g = /* @__PURE__ */ vue.createTextVNode("取消");
573
- const __default__$p = vue.defineComponent({
753
+ const _hoisted_1$j = { class: "m-fields-key-value" };
754
+ const _hoisted_2$b = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
755
+ const _hoisted_3$6 = /* @__PURE__ */ vue.createTextVNode("添加");
756
+ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
757
+ __name: "KeyValue",
758
+ props: {
759
+ config: null,
760
+ model: null,
761
+ name: null,
762
+ prop: null,
763
+ disabled: { type: Boolean, default: false },
764
+ lastValues: null,
765
+ size: null
766
+ },
767
+ emits: ["change"],
768
+ setup(__props, { emit }) {
769
+ const props = __props;
770
+ const records = vue.ref([]);
771
+ vue.watchEffect(() => {
772
+ records.value = Object.entries(props.model[props.name] || {});
773
+ });
774
+ const getValue = () => {
775
+ const record = {};
776
+ records.value.forEach(([key, value]) => {
777
+ if (key) {
778
+ record[key] = value;
779
+ }
780
+ });
781
+ return record;
782
+ };
783
+ const keyChangeHandler = () => {
784
+ emit("change", getValue());
785
+ };
786
+ const valueChangeHandler = () => {
787
+ emit("change", getValue());
788
+ };
789
+ const addHandler = () => {
790
+ records.value.push(["", ""]);
791
+ };
792
+ const deleteHandler = (index) => {
793
+ records.value.splice(index, 1);
794
+ };
795
+ return (_ctx, _cache) => {
796
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
797
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
798
+ return vue.openBlock(), vue.createElementBlock("div", {
799
+ class: "m-fields-key-value-item",
800
+ key: index
801
+ }, [
802
+ vue.createVNode(vue.unref(design.TMagicInput), {
803
+ placeholder: "key",
804
+ modelValue: records.value[index][0],
805
+ "onUpdate:modelValue": ($event) => records.value[index][0] = $event,
806
+ disabled: __props.disabled,
807
+ size: __props.size,
808
+ onChange: keyChangeHandler
809
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
810
+ _hoisted_2$b,
811
+ vue.createVNode(vue.unref(design.TMagicInput), {
812
+ placeholder: "value",
813
+ modelValue: records.value[index][1],
814
+ "onUpdate:modelValue": ($event) => records.value[index][1] = $event,
815
+ disabled: __props.disabled,
816
+ size: __props.size,
817
+ onChange: valueChangeHandler
818
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
819
+ vue.createVNode(vue.unref(design.TMagicButton), {
820
+ class: "m-fileds-key-value-delete",
821
+ type: "danger",
822
+ size: __props.size,
823
+ circle: "",
824
+ plain: "",
825
+ icon: vue.unref(iconsVue.Delete),
826
+ onClick: ($event) => deleteHandler(index)
827
+ }, null, 8, ["size", "icon", "onClick"])
828
+ ]);
829
+ }), 128)),
830
+ vue.createVNode(vue.unref(design.TMagicButton), {
831
+ type: "primary",
832
+ size: __props.size,
833
+ plain: "",
834
+ icon: vue.unref(iconsVue.Plus),
835
+ onClick: addHandler
836
+ }, {
837
+ default: vue.withCtx(() => [
838
+ _hoisted_3$6
839
+ ]),
840
+ _: 1
841
+ }, 8, ["size", "icon"])
842
+ ]);
843
+ };
844
+ }
845
+ });
846
+
847
+ const _hoisted_1$i = /* @__PURE__ */ vue.createTextVNode("取消");
848
+ const __default__$q = vue.defineComponent({
574
849
  name: "MEditorUISelect"
575
850
  });
576
- const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
577
- ...__default__$p,
851
+ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
852
+ ...__default__$q,
578
853
  props: {
579
854
  config: null,
580
855
  model: null,
@@ -636,7 +911,7 @@
636
911
  style: { "padding": "0" }
637
912
  }, {
638
913
  default: vue.withCtx(() => [
639
- _hoisted_1$g
914
+ _hoisted_1$i
640
915
  ]),
641
916
  _: 1
642
917
  }, 8, ["icon"])
@@ -684,11 +959,11 @@
684
959
 
685
960
  const UISelect_vue_vue_type_style_index_0_lang = '';
686
961
 
687
- const __default__$o = vue.defineComponent({
962
+ const __default__$p = vue.defineComponent({
688
963
  name: "MEditorCodeEditor"
689
964
  });
690
- const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
691
- ...__default__$o,
965
+ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
966
+ ...__default__$p,
692
967
  props: {
693
968
  initValues: null,
694
969
  modifiedValues: null,
@@ -817,11 +1092,11 @@
817
1092
  };
818
1093
  const getConfig = (key) => $TMAGIC_EDITOR[key];
819
1094
 
820
- const __default__$n = vue.defineComponent({
1095
+ const __default__$o = vue.defineComponent({
821
1096
  name: "MEditorResizer"
822
1097
  });
823
- const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
824
- ...__default__$n,
1098
+ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
1099
+ ...__default__$o,
825
1100
  emits: ["change"],
826
1101
  setup(__props, { emit }) {
827
1102
  const target = vue.ref();
@@ -853,11 +1128,11 @@
853
1128
  }
854
1129
  });
855
1130
 
856
- const __default__$m = vue.defineComponent({
1131
+ const __default__$n = vue.defineComponent({
857
1132
  name: "MEditorLayout"
858
1133
  });
859
- const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
860
- ...__default__$m,
1134
+ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
1135
+ ...__default__$n,
861
1136
  props: {
862
1137
  left: null,
863
1138
  right: null,
@@ -965,7 +1240,7 @@
965
1240
  }, [
966
1241
  vue.renderSlot(_ctx.$slots, "left")
967
1242
  ], 6),
968
- vue.createVNode(_sfc_main$r, { onChange: changeLeft })
1243
+ vue.createVNode(_sfc_main$t, { onChange: changeLeft })
969
1244
  ], 64)) : vue.createCommentVNode("", true),
970
1245
  vue.createElementVNode("div", {
971
1246
  class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
@@ -974,7 +1249,7 @@
974
1249
  vue.renderSlot(_ctx.$slots, "center")
975
1250
  ], 6),
976
1251
  vue.unref(hasRight) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
977
- vue.createVNode(_sfc_main$r, { onChange: changeRight }),
1252
+ vue.createVNode(_sfc_main$t, { onChange: changeRight }),
978
1253
  vue.createElementVNode("div", {
979
1254
  class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
980
1255
  style: vue.normalizeStyle(`width: ${__props.right}px`)
@@ -987,7 +1262,7 @@
987
1262
  }
988
1263
  });
989
1264
 
990
- const fillConfig = (config = []) => [
1265
+ const fillConfig$1 = (config = []) => [
991
1266
  {
992
1267
  type: "tab",
993
1268
  items: [
@@ -1143,7 +1418,8 @@
1143
1418
  items: [
1144
1419
  {
1145
1420
  name: "events",
1146
- type: "event-select"
1421
+ type: "event-select",
1422
+ labelWidth: 0
1147
1423
  }
1148
1424
  ]
1149
1425
  },
@@ -1773,7 +2049,7 @@
1773
2049
  this.emit("props-configs-change");
1774
2050
  }
1775
2051
  async fillConfig(config) {
1776
- return fillConfig(config);
2052
+ return fillConfig$1(config);
1777
2053
  }
1778
2054
  /**
1779
2055
  * 为指定类型组件设置组件属性表单配置
@@ -1839,7 +2115,7 @@
1839
2115
  };
1840
2116
  }
1841
2117
  async createId(type) {
1842
- return `${type}_${this.guid()}`;
2118
+ return `${type}_${utils.guid()}`;
1843
2119
  }
1844
2120
  /**
1845
2121
  * 将组件与组件的子元素配置中的id都设置成一个新的ID
@@ -1882,18 +2158,6 @@
1882
2158
  this.removeAllListeners();
1883
2159
  this.removeAllPlugins();
1884
2160
  }
1885
- /**
1886
- * 生成指定位数的GUID,无【-】格式
1887
- * @param digit 位数,默认值8
1888
- * @returns
1889
- */
1890
- guid(digit = 8) {
1891
- return "x".repeat(digit).replace(/[xy]/g, (c) => {
1892
- const r = Math.random() * 16 | 0;
1893
- const v = c === "x" ? r : r & 3 | 8;
1894
- return v.toString(16);
1895
- });
1896
- }
1897
2161
  }
1898
2162
  const propsService = new Props();
1899
2163
 
@@ -2852,14 +3116,14 @@
2852
3116
  return stage;
2853
3117
  };
2854
3118
 
2855
- const _hoisted_1$f = { class: "m-editor-empty-panel" };
2856
- const _hoisted_2$8 = { class: "m-editor-empty-content" };
2857
- const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
2858
- const __default__$l = vue.defineComponent({
3119
+ const _hoisted_1$h = { class: "m-editor-empty-panel" };
3120
+ const _hoisted_2$a = { class: "m-editor-empty-content" };
3121
+ const _hoisted_3$5 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
3122
+ const __default__$m = vue.defineComponent({
2859
3123
  name: "MEditorAddPageBox"
2860
3124
  });
2861
- const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
2862
- ...__default__$l,
3125
+ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
3126
+ ...__default__$m,
2863
3127
  setup(__props) {
2864
3128
  const services = vue.inject("services");
2865
3129
  const clickHandler = () => {
@@ -2875,16 +3139,16 @@
2875
3139
  });
2876
3140
  };
2877
3141
  return (_ctx, _cache) => {
2878
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
2879
- vue.createElementVNode("div", _hoisted_2$8, [
3142
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
3143
+ vue.createElementVNode("div", _hoisted_2$a, [
2880
3144
  vue.createElementVNode("div", {
2881
3145
  class: "m-editor-empty-button",
2882
3146
  onClick: clickHandler
2883
3147
  }, [
2884
3148
  vue.createElementVNode("div", null, [
2885
- vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
3149
+ vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
2886
3150
  ]),
2887
- _hoisted_3$4
3151
+ _hoisted_3$5
2888
3152
  ])
2889
3153
  ])
2890
3154
  ]);
@@ -2892,12 +3156,12 @@
2892
3156
  }
2893
3157
  });
2894
3158
 
2895
- const _hoisted_1$e = { class: "m-editor" };
2896
- const __default__$k = vue.defineComponent({
3159
+ const _hoisted_1$g = { class: "m-editor" };
3160
+ const __default__$l = vue.defineComponent({
2897
3161
  name: "MEditorFramework"
2898
3162
  });
2899
- const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
2900
- ...__default__$k,
3163
+ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
3164
+ ...__default__$l,
2901
3165
  props: {
2902
3166
  codeOptions: { default: () => ({}) }
2903
3167
  },
@@ -2966,7 +3230,7 @@
2966
3230
  };
2967
3231
  return (_ctx, _cache) => {
2968
3232
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
2969
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
3233
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
2970
3234
  vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
2971
3235
  vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
2972
3236
  key: 0,
@@ -2974,7 +3238,7 @@
2974
3238
  "init-values": vue.unref(root),
2975
3239
  options: __props.codeOptions,
2976
3240
  onSave: saveCode
2977
- }, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$q, {
3241
+ }, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$s, {
2978
3242
  key: 1,
2979
3243
  class: "m-editor-content",
2980
3244
  "left-class": "m-editor-framework-left",
@@ -2993,7 +3257,7 @@
2993
3257
  ]),
2994
3258
  center: vue.withCtx(() => [
2995
3259
  vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
2996
- vue.createVNode(_sfc_main$p)
3260
+ vue.createVNode(_sfc_main$r)
2997
3261
  ])
2998
3262
  ]),
2999
3263
  _: 2
@@ -3015,16 +3279,16 @@
3015
3279
  }
3016
3280
  });
3017
3281
 
3018
- const _hoisted_1$d = {
3282
+ const _hoisted_1$f = {
3019
3283
  key: 1,
3020
3284
  class: "menu-item-text"
3021
3285
  };
3022
- const _hoisted_2$7 = { class: "el-dropdown-link menubar-menu-button" };
3023
- const __default__$j = vue.defineComponent({
3286
+ const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
3287
+ const __default__$k = vue.defineComponent({
3024
3288
  name: "MEditorToolButton"
3025
3289
  });
3026
- const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
3027
- ...__default__$j,
3290
+ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
3291
+ ...__default__$k,
3028
3292
  props: {
3029
3293
  data: { default: () => ({
3030
3294
  type: "text",
@@ -3099,7 +3363,7 @@
3099
3363
  __props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
3100
3364
  key: 0,
3101
3365
  direction: __props.data.direction || "vertical"
3102
- }, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3366
+ }, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3103
3367
  __props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3104
3368
  key: 0,
3105
3369
  effect: "dark",
@@ -3113,7 +3377,7 @@
3113
3377
  disabled: vue.unref(disabled)
3114
3378
  }, {
3115
3379
  default: vue.withCtx(() => [
3116
- __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
3380
+ __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
3117
3381
  key: 0,
3118
3382
  icon: __props.data.icon
3119
3383
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -3130,7 +3394,7 @@
3130
3394
  disabled: vue.unref(disabled)
3131
3395
  }, {
3132
3396
  default: vue.withCtx(() => [
3133
- __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
3397
+ __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
3134
3398
  key: 0,
3135
3399
  icon: __props.data.icon
3136
3400
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -3163,7 +3427,7 @@
3163
3427
  })) : vue.createCommentVNode("", true)
3164
3428
  ]),
3165
3429
  default: vue.withCtx(() => [
3166
- vue.createElementVNode("span", _hoisted_2$7, [
3430
+ vue.createElementVNode("span", _hoisted_2$9, [
3167
3431
  vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
3168
3432
  vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
3169
3433
  default: vue.withCtx(() => [
@@ -3180,11 +3444,11 @@
3180
3444
  }
3181
3445
  });
3182
3446
 
3183
- const __default__$i = vue.defineComponent({
3447
+ const __default__$j = vue.defineComponent({
3184
3448
  name: "MEditorNavMenu"
3185
3449
  });
3186
- const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
3187
- ...__default__$i,
3450
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
3451
+ ...__default__$j,
3188
3452
  props: {
3189
3453
  data: { default: () => ({}) },
3190
3454
  height: { default: 35 }
@@ -3342,7 +3606,7 @@
3342
3606
  style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
3343
3607
  }, [
3344
3608
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
3345
- return vue.openBlock(), vue.createBlock(_sfc_main$n, {
3609
+ return vue.openBlock(), vue.createBlock(_sfc_main$p, {
3346
3610
  data: item,
3347
3611
  key: index
3348
3612
  }, null, 8, ["data"]);
@@ -3354,12 +3618,12 @@
3354
3618
  }
3355
3619
  });
3356
3620
 
3357
- const _hoisted_1$c = { class: "m-editor-props-panel" };
3358
- const __default__$h = vue.defineComponent({
3621
+ const _hoisted_1$e = { class: "m-editor-props-panel" };
3622
+ const __default__$i = vue.defineComponent({
3359
3623
  name: "MEditorPropsPanel"
3360
3624
  });
3361
- const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
3362
- ...__default__$h,
3625
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
3626
+ ...__default__$i,
3363
3627
  emits: ["mounted"],
3364
3628
  setup(__props, { expose, emit }) {
3365
3629
  const internalInstance = vue.getCurrentInstance();
@@ -3404,7 +3668,7 @@
3404
3668
  };
3405
3669
  expose({ submit });
3406
3670
  return (_ctx, _cache) => {
3407
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
3671
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
3408
3672
  vue.renderSlot(_ctx.$slots, "props-panel-header"),
3409
3673
  vue.createVNode(vue.unref(form.MForm), {
3410
3674
  ref_key: "configForm",
@@ -3421,7 +3685,7 @@
3421
3685
  }
3422
3686
  });
3423
3687
 
3424
- const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
3688
+ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
3425
3689
  __name: "SearchInput",
3426
3690
  emits: ["search"],
3427
3691
  setup(__props, { emit }) {
@@ -3437,9 +3701,18 @@
3437
3701
  size: "small",
3438
3702
  placeholder: "输入关键字进行过滤",
3439
3703
  clearable: "",
3440
- "prefix-icon": vue.unref(iconsVue.Search),
3441
3704
  onInput: filterTextChangeHandler
3442
- }, null, 8, ["modelValue", "prefix-icon"]);
3705
+ }, {
3706
+ prefix: vue.withCtx(() => [
3707
+ vue.createVNode(vue.unref(design.TMagicIcon), null, {
3708
+ default: vue.withCtx(() => [
3709
+ vue.createVNode(vue.unref(iconsVue.Search))
3710
+ ]),
3711
+ _: 1
3712
+ })
3713
+ ]),
3714
+ _: 1
3715
+ }, 8, ["modelValue"]);
3443
3716
  };
3444
3717
  }
3445
3718
  });
@@ -3452,14 +3725,10 @@
3452
3725
  return target;
3453
3726
  };
3454
3727
 
3455
- const _sfc_main$j = {};
3728
+ const _sfc_main$l = {};
3456
3729
 
3457
- const _hoisted_1$b = {
3458
- width: "16px",
3459
- height: "16px",
3460
- xmlns: "http://www.w3.org/2000/svg"
3461
- };
3462
- const _hoisted_2$6 = /*#__PURE__*/vue.createElementVNode("g", {
3730
+ const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
3731
+ const _hoisted_2$8 = /*#__PURE__*/vue.createElementVNode("g", {
3463
3732
  fill: "#7C878E",
3464
3733
  "fill-rule": "evenodd"
3465
3734
  }, [
@@ -3469,51 +3738,49 @@
3469
3738
  }),
3470
3739
  /*#__PURE__*/vue.createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
3471
3740
  ], -1);
3472
- const _hoisted_3$3 = [
3473
- _hoisted_2$6
3741
+ const _hoisted_3$4 = [
3742
+ _hoisted_2$8
3474
3743
  ];
3475
3744
 
3476
3745
  function _sfc_render$2(_ctx, _cache) {
3477
- return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$b, _hoisted_3$3))
3746
+ return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _hoisted_3$4))
3478
3747
  }
3479
- const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$j, [['render',_sfc_render$2]]);
3748
+ const AppManageIcon = /*#__PURE__*/_export_sfc(_sfc_main$l, [['render',_sfc_render$2]]);
3480
3749
 
3481
- const _sfc_main$i = {};
3750
+ const _sfc_main$k = {};
3482
3751
 
3483
- const _hoisted_1$a = {
3484
- width: "32px",
3485
- height: "32px",
3752
+ const _hoisted_1$c = {
3486
3753
  viewBox: "0 0 32 32",
3487
3754
  version: "1.1",
3488
3755
  xmlns: "http://www.w3.org/2000/svg",
3489
3756
  "xmlns:xlink": "http://www.w3.org/1999/xlink"
3490
3757
  };
3491
- const _hoisted_2$5 = /*#__PURE__*/vue.createStaticVNode("<title>gsd-icon-line-Universal-code</title><desc>Created with Sketch.</desc><defs><rect id=\"path-1\" x=\"0\" y=\"0\" width=\"32\" height=\"32\"></rect></defs><g id=\"组件规范\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"03图标\" transform=\"translate(-561.000000, -2356.000000)\"><g id=\"icon/line/Universal/code\" transform=\"translate(561.000000, 2356.000000)\"><g id=\"路径\"><mask id=\"mask-2\" fill=\"white\"><use xlink:href=\"#path-1\"></use></mask><use id=\"蒙版\" fill=\"#D8D8D8\" opacity=\"0\" xlink:href=\"#path-1\"></use><path d=\"M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z\" id=\"形状\" fill=\"#1D1F24\" mask=\"url(#mask-2)\"></path></g></g><g id=\"icon切图\" transform=\"translate(226.000000, 1782.000000)\"></g></g></g>", 4);
3492
- const _hoisted_6 = [
3493
- _hoisted_2$5
3758
+ const _hoisted_2$7 = /*#__PURE__*/vue.createStaticVNode("<defs><rect id=\"path-1\" x=\"0\" y=\"0\" width=\"32\" height=\"32\"></rect></defs><g id=\"组件规范\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"03图标\" transform=\"translate(-561.000000, -2356.000000)\"><g id=\"icon/line/Universal/code\" transform=\"translate(561.000000, 2356.000000)\"><g id=\"路径\"><mask id=\"mask-2\" fill=\"white\"><use xlink:href=\"#path-1\"></use></mask><use id=\"蒙版\" fill=\"#D8D8D8\" opacity=\"0\" xlink:href=\"#path-1\"></use><path d=\"M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z\" id=\"形状\" fill=\"#1D1F24\" mask=\"url(#mask-2)\"></path></g></g><g id=\"icon切图\" transform=\"translate(226.000000, 1782.000000)\"></g></g></g>", 2);
3759
+ const _hoisted_4$4 = [
3760
+ _hoisted_2$7
3494
3761
  ];
3495
3762
 
3496
3763
  function _sfc_render$1(_ctx, _cache) {
3497
- return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$a, _hoisted_6))
3764
+ return (vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$c, _hoisted_4$4))
3498
3765
  }
3499
- const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$i, [['render',_sfc_render$1]]);
3766
+ const CodeIcon = /*#__PURE__*/_export_sfc(_sfc_main$k, [['render',_sfc_render$1]]);
3500
3767
 
3501
- const _hoisted_1$9 = {
3768
+ const _hoisted_1$b = {
3502
3769
  key: 0,
3503
3770
  class: "m-editor-content-bottom"
3504
3771
  };
3505
- const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("确认");
3506
- const _hoisted_3$2 = /* @__PURE__ */ vue.createTextVNode("关闭");
3507
- const _hoisted_4$2 = {
3772
+ const _hoisted_2$6 = /* @__PURE__ */ vue.createTextVNode("确认");
3773
+ const _hoisted_3$3 = /* @__PURE__ */ vue.createTextVNode("关闭");
3774
+ const _hoisted_4$3 = {
3508
3775
  key: 1,
3509
3776
  class: "m-editor-content-bottom"
3510
3777
  };
3511
- const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode("关闭");
3512
- const __default__$g = vue.defineComponent({
3778
+ const _hoisted_5$2 = /* @__PURE__ */ vue.createTextVNode("关闭");
3779
+ const __default__$h = vue.defineComponent({
3513
3780
  name: "MEditorCodeDraftEditor"
3514
3781
  });
3515
- const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
3516
- ...__default__$g,
3782
+ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
3783
+ ...__default__$h,
3517
3784
  props: {
3518
3785
  id: null,
3519
3786
  content: null,
@@ -3596,7 +3863,7 @@
3596
3863
  return vue.openBlock(), vue.createElementBlock("div", {
3597
3864
  class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
3598
3865
  }, [
3599
- vue.createVNode(_sfc_main$s, {
3866
+ vue.createVNode(_sfc_main$u, {
3600
3867
  ref_key: "codeEditor",
3601
3868
  ref: codeEditor,
3602
3869
  class: "m-editor-container",
@@ -3605,7 +3872,7 @@
3605
3872
  language: __props.language,
3606
3873
  options: vue.unref(codeOptions)
3607
3874
  }, null, 8, ["init-values", "language", "options"]),
3608
- __props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
3875
+ __props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
3609
3876
  vue.createVNode(vue.unref(design.TMagicButton), {
3610
3877
  type: "primary",
3611
3878
  class: "button",
@@ -3622,21 +3889,20 @@
3622
3889
  onClick: saveAndClose
3623
3890
  }, {
3624
3891
  default: vue.withCtx(() => [
3625
- _hoisted_2$4
3892
+ _hoisted_2$6
3626
3893
  ]),
3627
3894
  _: 1
3628
3895
  }),
3629
3896
  vue.createVNode(vue.unref(design.TMagicButton), {
3630
- type: "primary",
3631
3897
  class: "button",
3632
3898
  onClick: close
3633
3899
  }, {
3634
3900
  default: vue.withCtx(() => [
3635
- _hoisted_3$2
3901
+ _hoisted_3$3
3636
3902
  ]),
3637
3903
  _: 1
3638
3904
  })
3639
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, [
3905
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$3, [
3640
3906
  vue.createVNode(vue.unref(design.TMagicButton), {
3641
3907
  type: "primary",
3642
3908
  class: "button",
@@ -3648,12 +3914,11 @@
3648
3914
  _: 1
3649
3915
  }),
3650
3916
  vue.createVNode(vue.unref(design.TMagicButton), {
3651
- type: "primary",
3652
3917
  class: "button",
3653
3918
  onClick: close
3654
3919
  }, {
3655
3920
  default: vue.withCtx(() => [
3656
- _hoisted_5$1
3921
+ _hoisted_5$2
3657
3922
  ]),
3658
3923
  _: 1
3659
3924
  })
@@ -3663,15 +3928,15 @@
3663
3928
  }
3664
3929
  });
3665
3930
 
3666
- const _hoisted_1$8 = { class: "code-name-wrapper" };
3667
- const _hoisted_2$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
3668
- const _hoisted_3$1 = { class: "code-name-wrapper" };
3669
- const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
3670
- const __default__$f = vue.defineComponent({
3931
+ const _hoisted_1$a = { class: "code-name-wrapper" };
3932
+ const _hoisted_2$5 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
3933
+ const _hoisted_3$2 = { class: "code-name-wrapper" };
3934
+ const _hoisted_4$2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
3935
+ const __default__$g = vue.defineComponent({
3671
3936
  name: "MEditorFunctionEditor"
3672
3937
  });
3673
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
3674
- ...__default__$f,
3938
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
3939
+ ...__default__$g,
3675
3940
  props: {
3676
3941
  id: null,
3677
3942
  name: null,
@@ -3789,8 +4054,8 @@
3789
4054
  const _component_m_form_table = vue.resolveComponent("m-form-table");
3790
4055
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
3791
4056
  header: vue.withCtx(() => [
3792
- vue.createElementVNode("div", _hoisted_1$8, [
3793
- _hoisted_2$3,
4057
+ vue.createElementVNode("div", _hoisted_1$a, [
4058
+ _hoisted_2$5,
3794
4059
  vue.createVNode(vue.unref(design.TMagicInput), {
3795
4060
  class: "code-name-input",
3796
4061
  modelValue: codeName.value,
@@ -3798,8 +4063,8 @@
3798
4063
  disabled: !__props.editable
3799
4064
  }, null, 8, ["modelValue", "disabled"])
3800
4065
  ]),
3801
- vue.createElementVNode("div", _hoisted_3$1, [
3802
- _hoisted_4$1,
4066
+ vue.createElementVNode("div", _hoisted_3$2, [
4067
+ _hoisted_4$2,
3803
4068
  vue.createVNode(_component_m_form_table, {
3804
4069
  style: { "width": "800px" },
3805
4070
  config: tableConfig,
@@ -3812,7 +4077,7 @@
3812
4077
  ])
3813
4078
  ]),
3814
4079
  default: vue.withCtx(() => [
3815
- vue.createVNode(_sfc_main$h, {
4080
+ vue.createVNode(_sfc_main$j, {
3816
4081
  ref_key: "codeDraftEditor",
3817
4082
  ref: codeDraftEditor,
3818
4083
  id: __props.id,
@@ -3831,15 +4096,15 @@
3831
4096
  }
3832
4097
  });
3833
4098
 
3834
- const _hoisted_1$7 = {
4099
+ const _hoisted_1$9 = {
3835
4100
  key: 0,
3836
4101
  class: "m-editor-code-block-editor-panel"
3837
4102
  };
3838
- const __default__$e = vue.defineComponent({
4103
+ const __default__$f = vue.defineComponent({
3839
4104
  name: "MEditorCodeBlockEditor"
3840
4105
  });
3841
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
3842
- ...__default__$e,
4106
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
4107
+ ...__default__$f,
3843
4108
  props: {
3844
4109
  paramsColConfig: null
3845
4110
  },
@@ -3892,16 +4157,16 @@
3892
4157
  "before-close": handleClose
3893
4158
  }, {
3894
4159
  default: vue.withCtx(() => [
3895
- vue.createVNode(_sfc_main$q, {
4160
+ vue.createVNode(_sfc_main$s, {
3896
4161
  left: left.value,
3897
4162
  "onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
3898
4163
  "min-left": 45,
3899
4164
  class: "code-editor-layout"
3900
4165
  }, {
3901
4166
  center: vue.withCtx(() => [
3902
- !vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
4167
+ !vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
3903
4168
  vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
3904
- codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$g, {
4169
+ codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
3905
4170
  key: 0,
3906
4171
  ref_key: "functionEditor",
3907
4172
  ref: functionEditor,
@@ -3924,25 +4189,30 @@
3924
4189
  }
3925
4190
  });
3926
4191
 
3927
- const _hoisted_1$6 = { class: "code-header-wrapper" };
3928
- const _hoisted_2$2 = /* @__PURE__ */ vue.createTextVNode("新增");
3929
- const _hoisted_3 = ["id"];
3930
- const _hoisted_4 = { class: "list-item" };
3931
- const _hoisted_5 = {
4192
+ const _hoisted_1$8 = { class: "search-wrapper" };
4193
+ const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("新增");
4194
+ const _hoisted_3$1 = ["id"];
4195
+ const _hoisted_4$1 = { class: "list-item" };
4196
+ const _hoisted_5$1 = {
3932
4197
  key: 2,
3933
4198
  class: "right-tool"
3934
4199
  };
3935
- const __default__$d = vue.defineComponent({
4200
+ const __default__$e = vue.defineComponent({
3936
4201
  name: "MEditorCodeBlockList"
3937
4202
  });
3938
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
3939
- ...__default__$d,
4203
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
4204
+ ...__default__$e,
3940
4205
  props: {
3941
4206
  customError: null,
3942
4207
  paramsColConfig: null
3943
4208
  },
3944
4209
  setup(__props) {
3945
4210
  const props = __props;
4211
+ const treeProps = {
4212
+ children: "children",
4213
+ label: "name",
4214
+ value: "id"
4215
+ };
3946
4216
  const { codeBlockService, depService, editorService } = vue.inject("services") || {};
3947
4217
  const codeList = vue.computed(
3948
4218
  () => Object.values(depService?.targets["code-block"] || {}).map((target) => {
@@ -4020,11 +4290,11 @@
4020
4290
  }
4021
4291
  };
4022
4292
  return (_ctx, _cache) => {
4023
- return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list" }, {
4293
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
4024
4294
  default: vue.withCtx(() => [
4025
4295
  vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
4026
- vue.createElementVNode("div", _hoisted_1$6, [
4027
- vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
4296
+ vue.createElementVNode("div", _hoisted_1$8, [
4297
+ vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4028
4298
  vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4029
4299
  key: 0,
4030
4300
  class: "create-code-button",
@@ -4033,7 +4303,7 @@
4033
4303
  onClick: createCodeBlock
4034
4304
  }, {
4035
4305
  default: vue.withCtx(() => [
4036
- _hoisted_2$2
4306
+ _hoisted_2$4
4037
4307
  ]),
4038
4308
  _: 1
4039
4309
  })) : vue.createCommentVNode("", true)
@@ -4048,6 +4318,7 @@
4048
4318
  "default-expanded-keys": vue.unref(expandedKeys),
4049
4319
  "expand-on-click-node": false,
4050
4320
  data: vue.unref(codeList),
4321
+ props: treeProps,
4051
4322
  "highlight-current": true,
4052
4323
  "filter-node-method": filterNode,
4053
4324
  onNodeClick: clickHandler
@@ -4057,7 +4328,7 @@
4057
4328
  id: data.id,
4058
4329
  class: "list-container"
4059
4330
  }, [
4060
- vue.createElementVNode("div", _hoisted_4, [
4331
+ vue.createElementVNode("div", _hoisted_4$1, [
4061
4332
  data.type === "code" ? (vue.openBlock(), vue.createBlock(CodeIcon, {
4062
4333
  key: 0,
4063
4334
  class: "codeIcon"
@@ -4067,16 +4338,16 @@
4067
4338
  class: "compIcon"
4068
4339
  })) : vue.createCommentVNode("", true),
4069
4340
  vue.createElementVNode("span", {
4070
- class: vue.normalizeClass(["code-name", { code: data.type === "code", hook: data.type === "key" }])
4071
- }, vue.toDisplayString(data.name) + "" + vue.toDisplayString(data.id) + "", 3),
4072
- data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
4341
+ class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
4342
+ }, vue.toDisplayString(data.name) + " (" + vue.toDisplayString(data.id) + ")", 3),
4343
+ data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [
4073
4344
  vue.createVNode(vue.unref(design.TMagicTooltip), {
4074
4345
  effect: "dark",
4075
4346
  content: vue.unref(editable) ? "编辑" : "查看",
4076
4347
  placement: "bottom"
4077
4348
  }, {
4078
4349
  default: vue.withCtx(() => [
4079
- vue.createVNode(_sfc_main$w, {
4350
+ vue.createVNode(_sfc_main$A, {
4080
4351
  icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
4081
4352
  class: "edit-icon",
4082
4353
  onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
@@ -4091,7 +4362,7 @@
4091
4362
  placement: "bottom"
4092
4363
  }, {
4093
4364
  default: vue.withCtx(() => [
4094
- vue.createVNode(_sfc_main$w, {
4365
+ vue.createVNode(_sfc_main$A, {
4095
4366
  icon: vue.unref(iconsVue.Close),
4096
4367
  class: "edit-icon",
4097
4368
  onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -4105,11 +4376,11 @@
4105
4376
  })
4106
4377
  ])) : vue.createCommentVNode("", true)
4107
4378
  ])
4108
- ], 8, _hoisted_3)
4379
+ ], 8, _hoisted_3$1)
4109
4380
  ]),
4110
4381
  _: 3
4111
4382
  }, 8, ["default-expanded-keys", "data"]),
4112
- vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, {
4383
+ vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
4113
4384
  key: 0,
4114
4385
  paramsColConfig: __props.paramsColConfig
4115
4386
  }, {
@@ -4125,6 +4396,263 @@
4125
4396
  }
4126
4397
  });
4127
4398
 
4399
+ const _hoisted_1$7 = /* @__PURE__ */ vue.createTextVNode("确定");
4400
+ const _hoisted_2$3 = /* @__PURE__ */ vue.createTextVNode("关闭");
4401
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
4402
+ __name: "DataSourceConfigPanel",
4403
+ props: {
4404
+ title: null,
4405
+ values: null
4406
+ },
4407
+ emits: ["submit"],
4408
+ setup(__props, { expose, emit }) {
4409
+ const props = __props;
4410
+ const type = vue.ref("base");
4411
+ const services = vue.inject("services");
4412
+ const size = vue.computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
4413
+ const dataSourceConfig = vue.computed(() => services?.dataSourceService.getFormConfig(type.value) || []);
4414
+ const form$1 = vue.ref();
4415
+ const initValues = vue.ref({});
4416
+ vue.watchEffect(() => {
4417
+ initValues.value = props.values;
4418
+ type.value = props.values.type || "base";
4419
+ });
4420
+ const changeHandler = (value) => {
4421
+ if (value.type === type.value) {
4422
+ return;
4423
+ }
4424
+ type.value = value.type || "base";
4425
+ initValues.value = value;
4426
+ };
4427
+ const submitHandler = async () => {
4428
+ try {
4429
+ const values = await form$1.value?.submitForm();
4430
+ emit("submit", values);
4431
+ } catch (error) {
4432
+ design.tMagicMessage.error(error.message);
4433
+ }
4434
+ };
4435
+ const visible = vue.ref(false);
4436
+ const hide = () => {
4437
+ visible.value = false;
4438
+ };
4439
+ expose({
4440
+ show() {
4441
+ visible.value = true;
4442
+ },
4443
+ hide
4444
+ });
4445
+ return (_ctx, _cache) => {
4446
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDrawer), {
4447
+ modelValue: visible.value,
4448
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
4449
+ title: __props.title,
4450
+ "close-on-press-escape": true,
4451
+ "append-to-body": true,
4452
+ "show-close": true,
4453
+ "close-on-click-modal": true,
4454
+ size: vue.unref(size)
4455
+ }, {
4456
+ footer: vue.withCtx(() => [
4457
+ vue.createElementVNode("div", null, [
4458
+ vue.createVNode(vue.unref(design.TMagicButton), {
4459
+ type: "primary",
4460
+ onClick: submitHandler
4461
+ }, {
4462
+ default: vue.withCtx(() => [
4463
+ _hoisted_1$7
4464
+ ]),
4465
+ _: 1
4466
+ }),
4467
+ vue.createVNode(vue.unref(design.TMagicButton), { onClick: hide }, {
4468
+ default: vue.withCtx(() => [
4469
+ _hoisted_2$3
4470
+ ]),
4471
+ _: 1
4472
+ })
4473
+ ])
4474
+ ]),
4475
+ default: vue.withCtx(() => [
4476
+ vue.createVNode(vue.unref(form.MForm), {
4477
+ ref_key: "form",
4478
+ ref: form$1,
4479
+ config: vue.unref(dataSourceConfig),
4480
+ "init-values": initValues.value,
4481
+ onChange: changeHandler
4482
+ }, null, 8, ["config", "init-values"])
4483
+ ]),
4484
+ _: 1
4485
+ }, 8, ["modelValue", "title", "size"]);
4486
+ };
4487
+ }
4488
+ });
4489
+
4490
+ const _hoisted_1$6 = { class: "search-wrapper" };
4491
+ const _hoisted_2$2 = /* @__PURE__ */ vue.createTextVNode("新增");
4492
+ const _hoisted_3 = ["id"];
4493
+ const _hoisted_4 = { class: "list-item" };
4494
+ const _hoisted_5 = {
4495
+ key: 2,
4496
+ class: "right-tool"
4497
+ };
4498
+ const __default__$d = vue.defineComponent({
4499
+ name: "MEditorDataSourceListPanel"
4500
+ });
4501
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
4502
+ ...__default__$d,
4503
+ setup(__props) {
4504
+ const services = vue.inject("services", {});
4505
+ const { dataSourceService, depService } = vue.inject("services") || {};
4506
+ const list = vue.computed(
4507
+ () => Object.values(depService?.targets["data-source"] || {}).map((target) => ({
4508
+ id: target.id,
4509
+ name: target.name,
4510
+ type: "code",
4511
+ children: Object.entries(target.deps).map(([id, dep]) => ({
4512
+ name: dep.name,
4513
+ type: "node",
4514
+ id,
4515
+ children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
4516
+ }))
4517
+ }))
4518
+ );
4519
+ const editDialog = vue.ref();
4520
+ const dataSourceValues = vue.ref({});
4521
+ const addHandler = () => {
4522
+ if (!editDialog.value)
4523
+ return;
4524
+ dataSourceValues.value = {};
4525
+ editDialog.value.show();
4526
+ };
4527
+ const editHandler = (id) => {
4528
+ if (!editDialog.value || !services)
4529
+ return;
4530
+ dataSourceValues.value = {
4531
+ ...dataSourceService?.getDataSourceById(id)
4532
+ };
4533
+ editDialog.value.show();
4534
+ };
4535
+ const removeHandler = async (id) => {
4536
+ await design.tMagicMessageBox.confirm("确定删除?", "提示", {
4537
+ confirmButtonText: "确定",
4538
+ cancelButtonText: "取消",
4539
+ type: "warning"
4540
+ });
4541
+ dataSourceService?.remove(id);
4542
+ };
4543
+ const submitDataSourceHandler = (value) => {
4544
+ if (!services)
4545
+ return;
4546
+ if (value.id) {
4547
+ dataSourceService?.update(value);
4548
+ } else {
4549
+ dataSourceService?.add(value);
4550
+ }
4551
+ editDialog.value?.hide();
4552
+ };
4553
+ const tree = vue.ref();
4554
+ const filterTextChangeHandler = (val) => {
4555
+ tree.value?.filter(val);
4556
+ };
4557
+ return (_ctx, _cache) => {
4558
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
4559
+ default: vue.withCtx(() => [
4560
+ vue.createElementVNode("div", _hoisted_1$6, [
4561
+ vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4562
+ vue.createVNode(vue.unref(design.TMagicButton), {
4563
+ type: "primary",
4564
+ size: "small",
4565
+ onClick: addHandler
4566
+ }, {
4567
+ default: vue.withCtx(() => [
4568
+ _hoisted_2$2
4569
+ ]),
4570
+ _: 1
4571
+ })
4572
+ ]),
4573
+ vue.createVNode(vue.unref(design.TMagicTree), {
4574
+ ref_key: "tree",
4575
+ ref: tree,
4576
+ class: "magic-editor-layer-tree",
4577
+ "node-key": "id",
4578
+ "empty-text": "暂无代码块",
4579
+ "default-expand-all": "",
4580
+ "expand-on-click-node": false,
4581
+ data: vue.unref(list),
4582
+ "highlight-current": true
4583
+ }, {
4584
+ default: vue.withCtx(({ data }) => [
4585
+ vue.createElementVNode("div", {
4586
+ id: data.id,
4587
+ class: "list-container"
4588
+ }, [
4589
+ vue.createElementVNode("div", _hoisted_4, [
4590
+ data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
4591
+ key: 0,
4592
+ class: "codeIcon",
4593
+ icon: vue.unref(iconsVue.Coin)
4594
+ }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
4595
+ data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
4596
+ key: 1,
4597
+ class: "compIcon",
4598
+ icon: vue.unref(iconsVue.Aim)
4599
+ }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
4600
+ vue.createElementVNode("span", {
4601
+ class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
4602
+ }, vue.toDisplayString(data.name) + "(" + vue.toDisplayString(data.id) + ")", 3),
4603
+ data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
4604
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
4605
+ effect: "dark",
4606
+ content: "编辑",
4607
+ placement: "bottom"
4608
+ }, {
4609
+ default: vue.withCtx(() => [
4610
+ vue.createVNode(_sfc_main$A, {
4611
+ class: "edit-icon",
4612
+ icon: vue.unref(iconsVue.Edit),
4613
+ onClick: vue.withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
4614
+ }, null, 8, ["icon", "onClick"])
4615
+ ]),
4616
+ _: 2
4617
+ }, 1024),
4618
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
4619
+ effect: "dark",
4620
+ content: "删除",
4621
+ placement: "bottom"
4622
+ }, {
4623
+ default: vue.withCtx(() => [
4624
+ vue.createVNode(_sfc_main$A, {
4625
+ icon: vue.unref(iconsVue.Close),
4626
+ class: "edit-icon",
4627
+ onClick: vue.withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
4628
+ }, null, 8, ["icon", "onClick"])
4629
+ ]),
4630
+ _: 2
4631
+ }, 1024),
4632
+ vue.renderSlot(_ctx.$slots, "data-source-panel-tool", {
4633
+ id: data.id,
4634
+ data: data.codeBlockContent
4635
+ })
4636
+ ])) : vue.createCommentVNode("", true)
4637
+ ])
4638
+ ], 8, _hoisted_3)
4639
+ ]),
4640
+ _: 3
4641
+ }, 8, ["data"]),
4642
+ vue.createVNode(_sfc_main$f, {
4643
+ ref_key: "editDialog",
4644
+ ref: editDialog,
4645
+ values: dataSourceValues.value,
4646
+ title: typeof dataSourceValues.value.id !== "undefined" ? `编辑${dataSourceValues.value.title}` : "新增",
4647
+ onSubmit: submitDataSourceHandler
4648
+ }, null, 8, ["values", "title"])
4649
+ ]),
4650
+ _: 3
4651
+ });
4652
+ };
4653
+ }
4654
+ });
4655
+
4128
4656
  const _hoisted_1$5 = ["onClick", "onDragstart"];
4129
4657
  const __default__$c = vue.defineComponent({
4130
4658
  name: "MEditorComponentListPanel"
@@ -4206,7 +4734,7 @@
4206
4734
  "model-value": vue.unref(collapseValue)
4207
4735
  }, {
4208
4736
  default: vue.withCtx(() => [
4209
- vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
4737
+ vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4210
4738
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
4211
4739
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
4212
4740
  group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
@@ -4214,7 +4742,7 @@
4214
4742
  name: `${index}`
4215
4743
  }, {
4216
4744
  title: vue.withCtx(() => [
4217
- vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
4745
+ vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
4218
4746
  vue.createTextVNode(vue.toDisplayString(group.title), 1)
4219
4747
  ]),
4220
4748
  default: vue.withCtx(() => [
@@ -4229,7 +4757,7 @@
4229
4757
  onDrag: dragHandler
4230
4758
  }, [
4231
4759
  vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
4232
- vue.createVNode(_sfc_main$w, {
4760
+ vue.createVNode(_sfc_main$A, {
4233
4761
  icon: item.icon
4234
4762
  }, null, 8, ["icon"]),
4235
4763
  vue.createVNode(vue.unref(design.TMagicTooltip), {
@@ -4352,7 +4880,7 @@
4352
4880
  }, [
4353
4881
  vue.createElementVNode("div", null, [
4354
4882
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
4355
- return vue.openBlock(), vue.createBlock(_sfc_main$n, {
4883
+ return vue.openBlock(), vue.createBlock(_sfc_main$p, {
4356
4884
  "event-type": "mouseup",
4357
4885
  data: item,
4358
4886
  key: index,
@@ -4504,6 +5032,8 @@
4504
5032
  const clicked = vue.ref(false);
4505
5033
  const treeProps = {
4506
5034
  children: "items",
5035
+ label: "name",
5036
+ value: "id",
4507
5037
  disabled: (data) => Boolean(data.items?.length),
4508
5038
  class: (data) => {
4509
5039
  if (clicked.value || utils.isPage(data))
@@ -4683,7 +5213,7 @@
4683
5213
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
4684
5214
  default: vue.withCtx(() => [
4685
5215
  vue.renderSlot(_ctx.$slots, "layer-panel-header"),
4686
- vue.createVNode(_sfc_main$k, { onSearch: filterTextChangeHandler }),
5216
+ vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4687
5217
  vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
4688
5218
  key: 0,
4689
5219
  class: "magic-editor-layer-tree",
@@ -4752,19 +5282,20 @@
4752
5282
  const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
4753
5283
  ...__default__$8,
4754
5284
  props: {
4755
- data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block"] }) },
5285
+ data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block", "data-source"] }) },
4756
5286
  layerContentMenu: null
4757
5287
  },
4758
5288
  setup(__props, { expose }) {
4759
5289
  const props = __props;
4760
- const uiComponent = design.getConfig("components").tabPane;
5290
+ const tabPaneComponent = design.getConfig("components").tabPane;
5291
+ const tabsComponent = design.getConfig("components").tabs;
4761
5292
  const activeTabName = vue.ref(props.data?.status);
4762
5293
  const getItemConfig = (data) => {
4763
5294
  const map = {
4764
5295
  "component-list": {
4765
5296
  $key: "component-list",
4766
5297
  type: "component",
4767
- icon: iconsVue.Coin,
5298
+ icon: iconsVue.Goods,
4768
5299
  text: "组件",
4769
5300
  component: _sfc_main$d,
4770
5301
  slots: {}
@@ -4772,7 +5303,7 @@
4772
5303
  layer: {
4773
5304
  $key: "layer",
4774
5305
  type: "component",
4775
- icon: iconsVue.Files,
5306
+ icon: iconsVue.List,
4776
5307
  text: "已选组件",
4777
5308
  props: {
4778
5309
  layerContentMenu: props.layerContentMenu
@@ -4785,6 +5316,14 @@
4785
5316
  type: "component",
4786
5317
  icon: iconsVue.EditPen,
4787
5318
  text: "代码编辑",
5319
+ component: _sfc_main$g,
5320
+ slots: {}
5321
+ },
5322
+ "data-source": {
5323
+ $key: "data-source",
5324
+ type: "component",
5325
+ icon: iconsVue.Coin,
5326
+ text: "数据源",
4788
5327
  component: _sfc_main$e,
4789
5328
  slots: {}
4790
5329
  }
@@ -4802,25 +5341,22 @@
4802
5341
  activeTabName
4803
5342
  });
4804
5343
  return (_ctx, _cache) => {
4805
- return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabs), {
5344
+ return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabsComponent).component), vue.mergeProps({
4806
5345
  key: 0,
4807
- class: "m-editor-sidebar",
4808
5346
  modelValue: activeTabName.value,
4809
5347
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
4810
- type: "card",
4811
- "tab-position": "left"
4812
- }, {
5348
+ class: "m-editor-sidebar tmagic-design-tabs"
5349
+ }, vue.unref(tabsComponent).props({ type: "card", tabPosition: "left" })), {
4813
5350
  default: vue.withCtx(() => [
4814
5351
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(sideBarItems), (config, index) => {
4815
- return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(uiComponent).component), {
4816
- key: config.$key || index,
4817
- name: config.text
4818
- }, {
5352
+ return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabPaneComponent).component), vue.mergeProps(vue.unref(tabPaneComponent).props({ name: config.text }), {
5353
+ key: config.$key || index
5354
+ }), {
4819
5355
  label: vue.withCtx(() => [
4820
5356
  (vue.openBlock(), vue.createElementBlock("div", {
4821
5357
  key: config.text
4822
5358
  }, [
4823
- config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$w, {
5359
+ config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
4824
5360
  key: 0,
4825
5361
  icon: config.icon
4826
5362
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -4895,11 +5431,11 @@
4895
5431
  ]), 1040)) : vue.createCommentVNode("", true)
4896
5432
  ]),
4897
5433
  _: 2
4898
- }, 1032, ["name"]);
5434
+ }, 1040);
4899
5435
  }), 128))
4900
5436
  ]),
4901
5437
  _: 3
4902
- }, 8, ["modelValue"])) : vue.createCommentVNode("", true);
5438
+ }, 16, ["modelValue"])) : vue.createCommentVNode("", true);
4903
5439
  };
4904
5440
  }
4905
5441
  });
@@ -5041,14 +5577,14 @@
5041
5577
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5042
5578
  onClick: addPage
5043
5579
  }, [
5044
- vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
5580
+ vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
5045
5581
  ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
5046
5582
  canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
5047
5583
  key: 2,
5048
5584
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5049
5585
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
5050
5586
  }, [
5051
- vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
5587
+ vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
5052
5588
  ])) : vue.createCommentVNode("", true),
5053
5589
  vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
5054
5590
  key: 3,
@@ -5064,7 +5600,7 @@
5064
5600
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5065
5601
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
5066
5602
  }, [
5067
- vue.createVNode(_sfc_main$w, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
5603
+ vue.createVNode(_sfc_main$A, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
5068
5604
  ])) : vue.createCommentVNode("", true)
5069
5605
  ], 512);
5070
5606
  };
@@ -5136,7 +5672,7 @@
5136
5672
  default: vue.withCtx(() => [
5137
5673
  vue.createElementVNode("div", null, [
5138
5674
  vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
5139
- vue.createVNode(_sfc_main$n, {
5675
+ vue.createVNode(_sfc_main$p, {
5140
5676
  data: {
5141
5677
  type: "button",
5142
5678
  text: "复制",
@@ -5144,7 +5680,7 @@
5144
5680
  handler: () => copy(item)
5145
5681
  }
5146
5682
  }, null, 8, ["data"]),
5147
- vue.createVNode(_sfc_main$n, {
5683
+ vue.createVNode(_sfc_main$p, {
5148
5684
  data: {
5149
5685
  type: "button",
5150
5686
  text: "删除",
@@ -5974,7 +6510,6 @@
5974
6510
  */
5975
6511
  async setCodeDsl(codeDsl2) {
5976
6512
  this.state.codeDsl = codeDsl2;
5977
- info("[code-block]:code-dsl-change", this.state.codeDsl);
5978
6513
  this.emit("code-dsl-change", this.state.codeDsl);
5979
6514
  }
5980
6515
  /**
@@ -6212,6 +6747,166 @@
6212
6747
  }
6213
6748
  const componentListService = new ComponentList();
6214
6749
 
6750
+ const BaseFormConfig = [
6751
+ {
6752
+ name: "id",
6753
+ type: "hidden"
6754
+ },
6755
+ {
6756
+ name: "type",
6757
+ text: "类型",
6758
+ type: "select",
6759
+ options: [
6760
+ { text: "基础", value: "base" },
6761
+ { text: "HTTP", value: "http" }
6762
+ ],
6763
+ defaultValue: "base"
6764
+ },
6765
+ {
6766
+ name: "title",
6767
+ text: "名称",
6768
+ rules: [
6769
+ {
6770
+ required: true,
6771
+ message: "请输入名称"
6772
+ }
6773
+ ]
6774
+ },
6775
+ {
6776
+ name: "description",
6777
+ text: "描述"
6778
+ }
6779
+ ];
6780
+
6781
+ const HttpFormConfig = [
6782
+ {
6783
+ name: "autoFetch",
6784
+ text: "自动请求",
6785
+ type: "switch",
6786
+ defaultValue: true
6787
+ },
6788
+ {
6789
+ type: "fieldset",
6790
+ name: "options",
6791
+ legend: "HTTP 配置",
6792
+ items: [
6793
+ {
6794
+ name: "url",
6795
+ text: "URL"
6796
+ },
6797
+ {
6798
+ name: "method",
6799
+ text: "Method",
6800
+ type: "select",
6801
+ options: [
6802
+ { text: "GET", value: "GET" },
6803
+ { text: "POST", value: "POST" },
6804
+ { text: "PUT", value: "PUT" },
6805
+ { text: "DELETE", value: "DELETE" }
6806
+ ]
6807
+ },
6808
+ {
6809
+ name: "params",
6810
+ type: "key-value",
6811
+ defaultValue: {},
6812
+ text: "参数"
6813
+ },
6814
+ {
6815
+ name: "data",
6816
+ type: "key-value",
6817
+ defaultValue: {},
6818
+ text: "请求体"
6819
+ },
6820
+ {
6821
+ name: "headers",
6822
+ type: "key-value",
6823
+ defaultValue: {},
6824
+ text: "请求头"
6825
+ }
6826
+ ]
6827
+ }
6828
+ ];
6829
+
6830
+ const fillConfig = (config) => [
6831
+ ...BaseFormConfig,
6832
+ ...config,
6833
+ {
6834
+ type: "panel",
6835
+ title: "数据定义",
6836
+ items: [
6837
+ {
6838
+ name: "fields",
6839
+ type: "data-source-fields",
6840
+ defaultValue: []
6841
+ }
6842
+ ]
6843
+ }
6844
+ ];
6845
+ const getFormConfig = (type, configs) => {
6846
+ switch (type) {
6847
+ case "base":
6848
+ return fillConfig([]);
6849
+ case "http":
6850
+ return fillConfig(HttpFormConfig);
6851
+ default:
6852
+ return fillConfig(configs[type] || []);
6853
+ }
6854
+ };
6855
+
6856
+ class DataSource extends BaseService {
6857
+ state = vue.reactive({
6858
+ dataSources: [],
6859
+ configs: {}
6860
+ });
6861
+ set(name, value) {
6862
+ this.state[name] = value;
6863
+ }
6864
+ get(name) {
6865
+ return this.state[name];
6866
+ }
6867
+ getFormConfig(type = "base") {
6868
+ return getFormConfig(type, this.get("configs"));
6869
+ }
6870
+ setFormConfig(type, config) {
6871
+ this.get("configs")[type] = config;
6872
+ }
6873
+ add(config) {
6874
+ const newConfig = {
6875
+ ...config,
6876
+ id: this.createId()
6877
+ };
6878
+ this.get("dataSources").push(newConfig);
6879
+ this.emit("add", newConfig);
6880
+ }
6881
+ update(config) {
6882
+ const dataSources = this.get("dataSources");
6883
+ const index = dataSources.findIndex((ds) => ds.id === config.id);
6884
+ dataSources[index] = lodashEs.cloneDeep(config);
6885
+ this.emit("update", config);
6886
+ }
6887
+ remove(id) {
6888
+ const dataSources = this.get("dataSources");
6889
+ const index = dataSources.findIndex((ds) => ds.id === id);
6890
+ dataSources.splice(index, 1);
6891
+ this.emit("remove", id);
6892
+ }
6893
+ getDataSourceById(id) {
6894
+ return this.get("dataSources").find((ds) => ds.id === id);
6895
+ }
6896
+ resetState() {
6897
+ this.set("dataSources", []);
6898
+ }
6899
+ destroy() {
6900
+ this.removeAllListeners();
6901
+ this.resetState();
6902
+ this.removeAllPlugins();
6903
+ }
6904
+ createId() {
6905
+ return `ds_${utils.guid()}`;
6906
+ }
6907
+ }
6908
+ const dataSourceService = new DataSource();
6909
+
6215
6910
  class Target extends events.EventEmitter {
6216
6911
  /**
6217
6912
  * 如何识别目标
@@ -6560,6 +7255,10 @@
6560
7255
  type: Object,
6561
7256
  default: () => ({})
6562
7257
  },
7258
+ dataScourceConfigs: {
7259
+ type: Object,
7260
+ default: () => ({})
7261
+ },
6563
7262
  /** 画布中组件选中框的移动范围 */
6564
7263
  moveableOptions: {
6565
7264
  type: [Object, Function]
@@ -6615,6 +7314,12 @@
6615
7314
  return false;
6616
7315
  }
6617
7316
  });
7317
+ const createDataSourceTarget = (id, ds) => new Target({
7318
+ type: "data-source",
7319
+ id,
7320
+ name: ds.title || `${id}`,
7321
+ isTarget: (key, value) => typeof value === "string" && value.includes(`${id}`)
7322
+ });
6618
7323
 
6619
7324
  const initServiceState = (props, {
6620
7325
  editorService,
@@ -6694,7 +7399,26 @@
6694
7399
  codeBlockService.resetState();
6695
7400
  });
6696
7401
  };
6697
- const initServiceEvents = (props, emit, { editorService, codeBlockService, depService }) => {
7402
+ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataSourceService, depService }) => {
7403
+ const targetAddHandler = (target) => {
7404
+ if (target.type !== "data-source")
7405
+ return;
7406
+ const root = editorService.get("root");
7407
+ if (!root)
7408
+ return;
7409
+ if (!root.dataSourceDeps) {
7410
+ root.dataSourceDeps = {};
7411
+ }
7412
+ root.dataSourceDeps[target.id] = target.deps;
7413
+ };
7414
+ const targetRemoveHandler = (id) => {
7415
+ const root = editorService.get("root");
7416
+ if (!root?.dataSourceDeps)
7417
+ return;
7418
+ delete root.dataSourceDeps[id];
7419
+ };
7420
+ depService.on("add-target", targetAddHandler);
7421
+ depService.on("remove-target", targetRemoveHandler);
6698
7422
  const rootChangeHandler = async (value, preValue) => {
6699
7423
  const nodeId = editorService.get("node")?.id || props.defaultSelected;
6700
7424
  let node;
@@ -6714,15 +7438,21 @@
6714
7438
  emit("update:modelValue", value);
6715
7439
  }
6716
7440
  value.codeBlocks = value.codeBlocks || {};
7441
+ value.dataSources = value.dataSources || [];
6717
7442
  codeBlockService.setCodeDsl(value.codeBlocks);
7443
+ dataSourceService.set("dataSources", value.dataSources);
6718
7444
  depService.removeTargets("code-block");
6719
7445
  Object.entries(value.codeBlocks).forEach(([id, code]) => {
6720
7446
  depService.addTarget(createCodeBlockTarget(id, code));
6721
7447
  });
7448
+ value.dataSources.forEach((ds) => {
7449
+ depService.addTarget(createDataSourceTarget(ds.id, ds));
7450
+ });
6722
7451
  if (value && Array.isArray(value.items)) {
6723
7452
  depService.collect(value.items, true);
6724
7453
  } else {
6725
7454
  depService.clear();
7455
+ delete value.dataSourceDeps;
6726
7456
  }
6727
7457
  };
6728
7458
  const nodeAddHandler = (nodes) => {
@@ -6754,7 +7484,23 @@
6754
7484
  };
6755
7485
  codeBlockService.on("addOrUpdate", codeBlockAddOrUpdateHandler);
6756
7486
  codeBlockService.on("remove", codeBlockRemoveHandler);
7487
+ const dataSourceAddHandler = (config) => {
7488
+ depService.addTarget(createDataSourceTarget(config.id, config));
7489
+ };
7490
+ const dataSourceUpdateHandler = (config) => {
7491
+ if (config.title) {
7492
+ depService.getTarget(config.id).name = config.title;
7493
+ }
7494
+ };
7495
+ const dataSourceRemoveHandler = (id) => {
7496
+ depService.removeTarget(id);
7497
+ };
7498
+ dataSourceService.on("add", dataSourceAddHandler);
7499
+ dataSourceService.on("update", dataSourceUpdateHandler);
7500
+ dataSourceService.on("remove", dataSourceRemoveHandler);
6757
7501
  vue.onUnmounted(() => {
7502
+ depService.off("add-target", targetAddHandler);
7503
+ depService.off("remove-target", targetRemoveHandler);
6758
7504
  editorService.off("history-change", historyChangeHandler);
6759
7505
  editorService.off("root-change", rootChangeHandler);
6760
7506
  editorService.off("add", nodeAddHandler);
@@ -6762,17 +7508,20 @@
6762
7508
  editorService.off("update", nodeUpdateHandler);
6763
7509
  codeBlockService.off("addOrUpdate", codeBlockAddOrUpdateHandler);
6764
7510
  codeBlockService.off("remove", codeBlockRemoveHandler);
7511
+ dataSourceService.off("add", dataSourceAddHandler);
7512
+ dataSourceService.off("update", dataSourceUpdateHandler);
7513
+ dataSourceService.off("remove", dataSourceRemoveHandler);
6765
7514
  });
6766
7515
  };
6767
7516
 
6768
7517
  const _sfc_main = vue.defineComponent({
6769
7518
  name: "m-editor",
6770
7519
  components: {
6771
- TMagicNavMenu: _sfc_main$m,
7520
+ TMagicNavMenu: _sfc_main$o,
6772
7521
  Sidebar: _sfc_main$9,
6773
7522
  Workspace: _sfc_main$1,
6774
- PropsPanel: _sfc_main$l,
6775
- Framework: _sfc_main$o
7523
+ PropsPanel: _sfc_main$n,
7524
+ Framework: _sfc_main$q
6776
7525
  },
6777
7526
  props: editorProps,
6778
7527
  emits: ["props-panel-mounted", "update:modelValue"],
@@ -6786,7 +7535,8 @@
6786
7535
  uiService,
6787
7536
  storageService,
6788
7537
  codeBlockService,
6789
- depService
7538
+ depService,
7539
+ dataSourceService
6790
7540
  };
6791
7541
  initServiceEvents(props, emit, services);
6792
7542
  initServiceState(props, services);
@@ -6911,38 +7661,42 @@
6911
7661
  app.config.globalProperties.$TMAGIC_EDITOR = option;
6912
7662
  setConfig(option);
6913
7663
  app.component(Editor.name, Editor);
6914
- app.component("m-fields-ui-select", _sfc_main$t);
6915
- app.component("m-fields-code-link", _sfc_main$y);
6916
- app.component("m-fields-vs-code", _sfc_main$z);
6917
- app.component("magic-code-editor", _sfc_main$s);
6918
- app.component("m-fields-code-select", _sfc_main$x);
6919
- app.component("m-fields-code-select-col", _sfc_main$v);
6920
- app.component("m-fields-event-select", _sfc_main$u);
7664
+ app.component("m-fields-ui-select", _sfc_main$v);
7665
+ app.component("m-fields-code-link", _sfc_main$C);
7666
+ app.component("m-fields-vs-code", _sfc_main$D);
7667
+ app.component("magic-code-editor", _sfc_main$u);
7668
+ app.component("m-fields-code-select", _sfc_main$B);
7669
+ app.component("m-fields-code-select-col", _sfc_main$z);
7670
+ app.component("m-fields-event-select", _sfc_main$x);
7671
+ app.component("m-fields-data-source-fields", _sfc_main$y);
7672
+ app.component("m-fields-key-value", _sfc_main$w);
6921
7673
  }
6922
7674
  };
6923
7675
 
6924
7676
  exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
6925
7677
  exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
6926
- exports.CodeBlockList = _sfc_main$e;
7678
+ exports.CodeBlockList = _sfc_main$g;
6927
7679
  exports.CodeDeleteErrorType = CodeDeleteErrorType;
6928
- exports.CodeSelect = _sfc_main$x;
6929
- exports.CodeSelectCol = _sfc_main$v;
7680
+ exports.CodeSelect = _sfc_main$B;
7681
+ exports.CodeSelectCol = _sfc_main$z;
6930
7682
  exports.ColumnLayout = ColumnLayout;
6931
7683
  exports.ComponentListPanel = _sfc_main$d;
6932
7684
  exports.ContentMenu = _sfc_main$c;
6933
- exports.EventSelect = _sfc_main$u;
7685
+ exports.DataSourceFields = _sfc_main$y;
7686
+ exports.EventSelect = _sfc_main$x;
6934
7687
  exports.Fixed2Other = Fixed2Other;
6935
7688
  exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
6936
- exports.Icon = _sfc_main$w;
7689
+ exports.Icon = _sfc_main$A;
7690
+ exports.KeyValue = _sfc_main$w;
6937
7691
  exports.Keys = Keys;
6938
7692
  exports.LayerOffset = LayerOffset;
6939
7693
  exports.LayerPanel = _sfc_main$a;
6940
7694
  exports.Layout = Layout;
6941
- exports.LayoutContainer = _sfc_main$q;
6942
- exports.PropsPanel = _sfc_main$l;
6943
- exports.TMagicCodeEditor = _sfc_main$s;
7695
+ exports.LayoutContainer = _sfc_main$s;
7696
+ exports.PropsPanel = _sfc_main$n;
7697
+ exports.TMagicCodeEditor = _sfc_main$u;
6944
7698
  exports.TMagicEditor = Editor;
6945
- exports.ToolButton = _sfc_main$n;
7699
+ exports.ToolButton = _sfc_main$p;
6946
7700
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
6947
7701
  exports.beforePaste = beforePaste;
6948
7702
  exports.change2Fixed = change2Fixed;
@@ -6953,7 +7707,7 @@
6953
7707
  exports.editorService = editorService;
6954
7708
  exports.error = error;
6955
7709
  exports.eventsService = eventsService;
6956
- exports.fillConfig = fillConfig;
7710
+ exports.fillConfig = fillConfig$1;
6957
7711
  exports.fixNodeLeft = fixNodeLeft;
6958
7712
  exports.fixNodePosition = fixNodePosition;
6959
7713
  exports.generatePageName = generatePageName;