@tmagic/editor 1.3.0-alpha.8 → 1.3.0-alpha.9

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.
@@ -23,7 +23,7 @@
23
23
 
24
24
  const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
25
25
 
26
- const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
26
+ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
27
27
  ...{
28
28
  name: "MEditorCode"
29
29
  },
@@ -62,7 +62,7 @@
62
62
  };
63
63
  const getConfig = (key) => $TMAGIC_EDITOR[key];
64
64
 
65
- const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
65
+ const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
66
66
  ...{
67
67
  name: "MEditorCodeLink"
68
68
  },
@@ -136,7 +136,7 @@
136
136
  }
137
137
  });
138
138
 
139
- const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
139
+ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
140
140
  ...{
141
141
  name: "MEditorCodeSelect"
142
142
  },
@@ -201,8 +201,8 @@
201
201
  }
202
202
  });
203
203
 
204
- const _hoisted_1$n = ["src"];
205
- const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
204
+ const _hoisted_1$o = ["src"];
205
+ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
206
206
  ...{
207
207
  name: "MEditorIcon"
208
208
  },
@@ -225,7 +225,7 @@
225
225
  class: "magic-editor-icon"
226
226
  }, {
227
227
  default: vue.withCtx(() => [
228
- vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$n)
228
+ vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$o)
229
229
  ]),
230
230
  _: 1
231
231
  })) : typeof _ctx.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
@@ -244,9 +244,9 @@
244
244
  }
245
245
  });
246
246
 
247
- const _hoisted_1$m = { class: "m-fields-code-select-col" };
247
+ const _hoisted_1$n = { class: "m-fields-code-select-col" };
248
248
  const _hoisted_2$e = { class: "code-select-container" };
249
- const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
249
+ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
250
250
  ...{
251
251
  name: "MEditorCodeSelectCol"
252
252
  },
@@ -338,7 +338,7 @@
338
338
  };
339
339
  return (_ctx, _cache) => {
340
340
  const _component_m_form_container = vue.resolveComponent("m-form-container");
341
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
341
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
342
342
  vue.createElementVNode("div", _hoisted_2$e, [
343
343
  vue.createVNode(_component_m_form_container, {
344
344
  class: "select",
@@ -346,7 +346,7 @@
346
346
  model: _ctx.model,
347
347
  onChange: onParamsChangeHandler
348
348
  }, null, 8, ["model"]),
349
- vue.createVNode(_sfc_main$B, {
349
+ vue.createVNode(_sfc_main$D, {
350
350
  class: "icon",
351
351
  icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
352
352
  onClick: editCode
@@ -362,9 +362,9 @@
362
362
  }
363
363
  });
364
364
 
365
- const _hoisted_1$l = { class: "m-editor-data-source-fields" };
365
+ const _hoisted_1$m = { class: "m-editor-data-source-fields" };
366
366
  const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
367
- const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
367
+ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
368
368
  ...{
369
369
  name: "MEditorDataSourceFields"
370
370
  },
@@ -510,7 +510,7 @@
510
510
  }
511
511
  ];
512
512
  return (_ctx, _cache) => {
513
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
513
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
514
514
  vue.createVNode(vue.unref(table.MagicTable), {
515
515
  data: _ctx.model[_ctx.name],
516
516
  columns: filedColumns
@@ -543,10 +543,10 @@
543
543
  }
544
544
  });
545
545
 
546
- const _hoisted_1$k = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
546
+ const _hoisted_1$l = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
547
547
  const _hoisted_2$c = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
548
548
  const _hoisted_3$5 = { class: "el-input__inner" };
549
- const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
549
+ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
550
550
  ...{
551
551
  name: "MEditorDataSourceInput"
552
552
  },
@@ -765,10 +765,10 @@
765
765
  }
766
766
  ), {
767
767
  suffix: vue.withCtx(() => [
768
- vue.createVNode(_sfc_main$B, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
768
+ vue.createVNode(_sfc_main$D, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
769
769
  ]),
770
770
  default: vue.withCtx(({ item }) => [
771
- vue.createElementVNode("div", _hoisted_1$k, [
771
+ vue.createElementVNode("div", _hoisted_1$l, [
772
772
  vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
773
773
  vue.createElementVNode("span", _hoisted_2$c, vue.toDisplayString(item.value), 1)
774
774
  ])
@@ -800,7 +800,7 @@
800
800
  }, 1032, ["size"])) : vue.createCommentVNode("", true)
801
801
  ], 64);
802
802
  }), 256)),
803
- vue.createVNode(_sfc_main$B, {
803
+ vue.createVNode(_sfc_main$D, {
804
804
  class: "tmagic-data-source-input-icon",
805
805
  icon: vue.unref(iconsVue.Coin)
806
806
  }, null, 8, ["icon"])
@@ -811,12 +811,65 @@
811
811
  }
812
812
  });
813
813
 
814
- const _hoisted_1$j = { class: "m-fields-event-select" };
814
+ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
815
+ ...{
816
+ name: "MEditorDataSourceSelect"
817
+ },
818
+ __name: "DataSourceSelect",
819
+ props: {
820
+ config: {},
821
+ model: {},
822
+ name: {},
823
+ prop: {},
824
+ disabled: { type: Boolean, default: false },
825
+ lastValues: {},
826
+ size: {}
827
+ },
828
+ emits: ["change"],
829
+ setup(__props, { emit }) {
830
+ const props = __props;
831
+ const { dataSourceService } = vue.inject("services") || {};
832
+ const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
833
+ const selectConfig = vue.computed(() => {
834
+ const { type, dataSourceType, ...config } = props.config;
835
+ return {
836
+ ...config,
837
+ type: "select",
838
+ valueKey: "dataSourceId",
839
+ options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
840
+ value: {
841
+ isBindDataSource: true,
842
+ dataSourceType: ds.type,
843
+ dataSourceId: ds.id
844
+ },
845
+ text: ds.title || ds.id
846
+ }))
847
+ };
848
+ });
849
+ const changeHandler = (value) => {
850
+ emit("change", value);
851
+ };
852
+ return (_ctx, _cache) => {
853
+ return vue.openBlock(), vue.createBlock(vue.unref(form.MSelect), {
854
+ model: _ctx.model,
855
+ name: _ctx.name,
856
+ size: _ctx.size,
857
+ prop: _ctx.prop,
858
+ disabled: _ctx.disabled,
859
+ config: selectConfig.value,
860
+ "last-values": _ctx.lastValues,
861
+ onChange: changeHandler
862
+ }, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]);
863
+ };
864
+ }
865
+ });
866
+
867
+ const _hoisted_1$k = { class: "m-fields-event-select" };
815
868
  const _hoisted_2$b = {
816
869
  key: 1,
817
870
  class: "fullWidth"
818
871
  };
819
- const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
872
+ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
820
873
  ...{
821
874
  name: "MEditorEventSelect"
822
875
  },
@@ -978,7 +1031,7 @@
978
1031
  const _component_m_form_table = vue.resolveComponent("m-form-table");
979
1032
  const _component_m_form_container = vue.resolveComponent("m-form-container");
980
1033
  const _component_m_form_panel = vue.resolveComponent("m-form-panel");
981
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
1034
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
982
1035
  isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
983
1036
  key: 0,
984
1037
  ref: "eventForm",
@@ -1029,9 +1082,9 @@
1029
1082
  }
1030
1083
  });
1031
1084
 
1032
- const _hoisted_1$i = { class: "m-fields-key-value" };
1085
+ const _hoisted_1$j = { class: "m-fields-key-value" };
1033
1086
  const _hoisted_2$a = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
1034
- const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
1087
+ const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
1035
1088
  ...{
1036
1089
  name: "MEditorKeyValue"
1037
1090
  },
@@ -1074,7 +1127,7 @@
1074
1127
  records.value.splice(index, 1);
1075
1128
  };
1076
1129
  return (_ctx, _cache) => {
1077
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
1130
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
1078
1131
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
1079
1132
  return vue.openBlock(), vue.createElementBlock("div", {
1080
1133
  class: "m-fields-key-value-item",
@@ -1125,7 +1178,7 @@
1125
1178
  }
1126
1179
  });
1127
1180
 
1128
- const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
1181
+ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
1129
1182
  ...{
1130
1183
  name: "MEditorUISelect"
1131
1184
  },
@@ -1239,7 +1292,7 @@
1239
1292
 
1240
1293
  const UISelect_vue_vue_type_style_index_0_lang = '';
1241
1294
 
1242
- const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
1295
+ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
1243
1296
  ...{
1244
1297
  name: "MEditorCodeEditor"
1245
1298
  },
@@ -1260,10 +1313,14 @@
1260
1313
  const toString = (v, language) => {
1261
1314
  let value = "";
1262
1315
  if (typeof v !== "string") {
1263
- value = serialize(v, {
1264
- space: 2,
1265
- unsafe: true
1266
- }).replace(/"(\w+)":\s/g, "$1: ");
1316
+ if (props.language.toLocaleLowerCase() === "json") {
1317
+ value = JSON.stringify(v, null, 2);
1318
+ } else {
1319
+ value = serialize(v, {
1320
+ space: 2,
1321
+ unsafe: true
1322
+ }).replace(/"(\w+)":\s/g, "$1: ");
1323
+ }
1267
1324
  } else {
1268
1325
  value = v;
1269
1326
  }
@@ -1295,7 +1352,7 @@
1295
1352
  }
1296
1353
  return vsEditor?.setValue(values.value);
1297
1354
  };
1298
- const getEditorValue = () => props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue();
1355
+ const getEditorValue = () => (props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue()) || "";
1299
1356
  const init = async () => {
1300
1357
  if (!codeEditor.value)
1301
1358
  return;
@@ -1317,12 +1374,18 @@
1317
1374
  if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
1318
1375
  e.preventDefault();
1319
1376
  e.stopPropagation();
1320
- emit("save", getEditorValue());
1377
+ const newValue = getEditorValue();
1378
+ values.value = newValue;
1379
+ emit("save", newValue);
1321
1380
  }
1322
1381
  });
1323
1382
  if (props.type !== "diff" && props.autoSave) {
1324
1383
  vsEditor?.onDidBlurEditorWidget(() => {
1325
- emit("save", getEditorValue());
1384
+ const newValue = getEditorValue();
1385
+ if (values.value !== newValue) {
1386
+ values.value = newValue;
1387
+ emit("save", newValue);
1388
+ }
1326
1389
  });
1327
1390
  }
1328
1391
  resizeObserver.observe(codeEditor.value);
@@ -1347,9 +1410,16 @@
1347
1410
  resizeObserver.disconnect();
1348
1411
  });
1349
1412
  __expose({
1413
+ values,
1350
1414
  getEditor() {
1351
1415
  return vsEditor || vsDiffEditor;
1352
1416
  },
1417
+ getVsEditor() {
1418
+ return vsEditor;
1419
+ },
1420
+ getVsDiffEditor() {
1421
+ return vsDiffEditor;
1422
+ },
1353
1423
  setEditorValue,
1354
1424
  focus() {
1355
1425
  vsEditor?.focus();
@@ -1366,7 +1436,7 @@
1366
1436
  }
1367
1437
  });
1368
1438
 
1369
- const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
1439
+ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
1370
1440
  ...{
1371
1441
  name: "MEditorResizer"
1372
1442
  },
@@ -1408,7 +1478,7 @@
1408
1478
  }
1409
1479
  });
1410
1480
 
1411
- const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
1481
+ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
1412
1482
  ...{
1413
1483
  name: "MEditorLayout"
1414
1484
  },
@@ -1520,7 +1590,7 @@
1520
1590
  }, [
1521
1591
  vue.renderSlot(_ctx.$slots, "left")
1522
1592
  ], 6),
1523
- vue.createVNode(_sfc_main$t, { onChange: changeLeft })
1593
+ vue.createVNode(_sfc_main$u, { onChange: changeLeft })
1524
1594
  ], 64)) : vue.createCommentVNode("", true),
1525
1595
  vue.createElementVNode("div", {
1526
1596
  class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
@@ -1529,7 +1599,7 @@
1529
1599
  vue.renderSlot(_ctx.$slots, "center")
1530
1600
  ], 6),
1531
1601
  hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
1532
- vue.createVNode(_sfc_main$t, { onChange: changeRight }),
1602
+ vue.createVNode(_sfc_main$u, { onChange: changeRight }),
1533
1603
  vue.createElementVNode("div", {
1534
1604
  class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
1535
1605
  style: vue.normalizeStyle(`width: ${_ctx.right}px`)
@@ -3452,10 +3522,10 @@
3452
3522
  return stage;
3453
3523
  };
3454
3524
 
3455
- const _hoisted_1$h = { class: "m-editor-empty-panel" };
3525
+ const _hoisted_1$i = { class: "m-editor-empty-panel" };
3456
3526
  const _hoisted_2$9 = { class: "m-editor-empty-content" };
3457
3527
  const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
3458
- const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
3528
+ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
3459
3529
  ...{
3460
3530
  name: "MEditorAddPageBox"
3461
3531
  },
@@ -3475,14 +3545,14 @@
3475
3545
  });
3476
3546
  };
3477
3547
  return (_ctx, _cache) => {
3478
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
3548
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
3479
3549
  vue.createElementVNode("div", _hoisted_2$9, [
3480
3550
  vue.createElementVNode("div", {
3481
3551
  class: "m-editor-empty-button",
3482
3552
  onClick: clickHandler
3483
3553
  }, [
3484
3554
  vue.createElementVNode("div", null, [
3485
- vue.createVNode(_sfc_main$B, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
3555
+ vue.createVNode(_sfc_main$D, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
3486
3556
  ]),
3487
3557
  _hoisted_3$4
3488
3558
  ])
@@ -3492,12 +3562,12 @@
3492
3562
  }
3493
3563
  });
3494
3564
 
3495
- const _hoisted_1$g = { class: "m-editor" };
3565
+ const _hoisted_1$h = { class: "m-editor" };
3496
3566
  const DEFAULT_LEFT_COLUMN_WIDTH = 310;
3497
3567
  const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
3498
3568
  const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
3499
3569
  const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
3500
- const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
3570
+ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
3501
3571
  ...{
3502
3572
  name: "MEditorFramework"
3503
3573
  },
@@ -3563,18 +3633,18 @@
3563
3633
  }
3564
3634
  };
3565
3635
  return (_ctx, _cache) => {
3566
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
3636
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
3567
3637
  vue.renderSlot(_ctx.$slots, "header"),
3568
3638
  vue.renderSlot(_ctx.$slots, "nav"),
3569
3639
  vue.renderSlot(_ctx.$slots, "content-before"),
3570
3640
  showSrc.value ? vue.renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
3571
- vue.createVNode(_sfc_main$u, {
3641
+ vue.createVNode(_sfc_main$v, {
3572
3642
  class: "m-editor-content",
3573
3643
  "init-values": root.value,
3574
3644
  options: vue.unref(codeOptions),
3575
3645
  onSave: saveCode
3576
3646
  }, null, 8, ["init-values", "options"])
3577
- ]) : (vue.openBlock(), vue.createBlock(_sfc_main$s, {
3647
+ ]) : (vue.openBlock(), vue.createBlock(_sfc_main$t, {
3578
3648
  key: 1,
3579
3649
  class: "m-editor-content",
3580
3650
  "left-class": "m-editor-framework-left",
@@ -3593,7 +3663,7 @@
3593
3663
  ]),
3594
3664
  center: vue.withCtx(() => [
3595
3665
  pageLength.value > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
3596
- vue.createVNode(_sfc_main$r)
3666
+ vue.createVNode(_sfc_main$s)
3597
3667
  ])
3598
3668
  ]),
3599
3669
  _: 2
@@ -3618,12 +3688,12 @@
3618
3688
  }
3619
3689
  });
3620
3690
 
3621
- const _hoisted_1$f = {
3691
+ const _hoisted_1$g = {
3622
3692
  key: 1,
3623
3693
  class: "menu-item-text"
3624
3694
  };
3625
3695
  const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
3626
- const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
3696
+ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
3627
3697
  ...{
3628
3698
  name: "MEditorToolButton"
3629
3699
  },
@@ -3702,7 +3772,7 @@
3702
3772
  _ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
3703
3773
  key: 0,
3704
3774
  direction: _ctx.data.direction || "vertical"
3705
- }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3775
+ }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
3706
3776
  _ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3707
3777
  key: 0,
3708
3778
  effect: "dark",
@@ -3716,7 +3786,7 @@
3716
3786
  disabled: disabled.value
3717
3787
  }, {
3718
3788
  default: vue.withCtx(() => [
3719
- _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$B, {
3789
+ _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
3720
3790
  key: 0,
3721
3791
  icon: _ctx.data.icon
3722
3792
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -3733,7 +3803,7 @@
3733
3803
  disabled: disabled.value
3734
3804
  }, {
3735
3805
  default: vue.withCtx(() => [
3736
- _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$B, {
3806
+ _ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
3737
3807
  key: 0,
3738
3808
  icon: _ctx.data.icon
3739
3809
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -3783,7 +3853,7 @@
3783
3853
  }
3784
3854
  });
3785
3855
 
3786
- const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
3856
+ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
3787
3857
  ...{
3788
3858
  name: "MEditorNavMenu"
3789
3859
  },
@@ -3945,7 +4015,7 @@
3945
4015
  style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
3946
4016
  }, [
3947
4017
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
3948
- return vue.openBlock(), vue.createBlock(_sfc_main$p, {
4018
+ return vue.openBlock(), vue.createBlock(_sfc_main$q, {
3949
4019
  data: item,
3950
4020
  key: index
3951
4021
  }, null, 8, ["data"]);
@@ -3957,11 +4027,11 @@
3957
4027
  }
3958
4028
  });
3959
4029
 
3960
- const _hoisted_1$e = {
4030
+ const _hoisted_1$f = {
3961
4031
  key: 0,
3962
4032
  class: "m-editor-props-panel"
3963
4033
  };
3964
- const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
4034
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
3965
4035
  ...{
3966
4036
  name: "MEditorPropsPanel"
3967
4037
  },
@@ -4011,7 +4081,7 @@
4011
4081
  };
4012
4082
  __expose({ submit });
4013
4083
  return (_ctx, _cache) => {
4014
- return nodes.value.length === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
4084
+ return nodes.value.length === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
4015
4085
  vue.renderSlot(_ctx.$slots, "props-panel-header"),
4016
4086
  vue.createVNode(vue.unref(form.MForm), {
4017
4087
  ref_key: "configForm",
@@ -4028,7 +4098,7 @@
4028
4098
  }
4029
4099
  });
4030
4100
 
4031
- const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
4101
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
4032
4102
  ...{
4033
4103
  name: "MEditorSearchInput"
4034
4104
  },
@@ -4063,7 +4133,7 @@
4063
4133
  }
4064
4134
  });
4065
4135
 
4066
- const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
4136
+ const _hoisted_1$e = { xmlns: "http://www.w3.org/2000/svg" };
4067
4137
  const _hoisted_2$7 = /* @__PURE__ */ vue.createElementVNode("g", {
4068
4138
  fill: "#7C878E",
4069
4139
  "fill-rule": "evenodd"
@@ -4077,19 +4147,19 @@
4077
4147
  const _hoisted_3$3 = [
4078
4148
  _hoisted_2$7
4079
4149
  ];
4080
- const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
4150
+ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
4081
4151
  ...{
4082
4152
  name: "MEditorAppManageIcon"
4083
4153
  },
4084
4154
  __name: "AppManageIcon",
4085
4155
  setup(__props) {
4086
4156
  return (_ctx, _cache) => {
4087
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _hoisted_3$3);
4157
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$e, _hoisted_3$3);
4088
4158
  };
4089
4159
  }
4090
4160
  });
4091
4161
 
4092
- const _hoisted_1$c = {
4162
+ const _hoisted_1$d = {
4093
4163
  viewBox: "0 0 32 32",
4094
4164
  version: "1.1",
4095
4165
  xmlns: "http://www.w3.org/2000/svg",
@@ -4099,19 +4169,19 @@
4099
4169
  const _hoisted_4$3 = [
4100
4170
  _hoisted_2$6
4101
4171
  ];
4102
- const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
4172
+ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
4103
4173
  ...{
4104
4174
  name: "MEditorCodeIcon"
4105
4175
  },
4106
4176
  __name: "CodeIcon",
4107
4177
  setup(__props) {
4108
4178
  return (_ctx, _cache) => {
4109
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$c, _hoisted_4$3);
4179
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _hoisted_4$3);
4110
4180
  };
4111
4181
  }
4112
4182
  });
4113
4183
 
4114
- const _hoisted_1$b = {
4184
+ const _hoisted_1$c = {
4115
4185
  key: 0,
4116
4186
  class: "m-editor-content-bottom"
4117
4187
  };
@@ -4119,7 +4189,7 @@
4119
4189
  key: 1,
4120
4190
  class: "m-editor-content-bottom"
4121
4191
  };
4122
- const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
4192
+ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
4123
4193
  ...{
4124
4194
  name: "MEditorCodeDraftEditor"
4125
4195
  },
@@ -4206,7 +4276,7 @@
4206
4276
  return vue.openBlock(), vue.createElementBlock("div", {
4207
4277
  class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
4208
4278
  }, [
4209
- vue.createVNode(_sfc_main$u, {
4279
+ vue.createVNode(_sfc_main$v, {
4210
4280
  ref_key: "codeEditor",
4211
4281
  ref: codeEditor,
4212
4282
  class: "m-editor-container",
@@ -4215,7 +4285,7 @@
4215
4285
  language: _ctx.language,
4216
4286
  options: codeOptions.value
4217
4287
  }, null, 8, ["init-values", "language", "options"]),
4218
- _ctx.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
4288
+ _ctx.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
4219
4289
  vue.createVNode(vue.unref(design.TMagicButton), {
4220
4290
  type: "primary",
4221
4291
  class: "button",
@@ -4271,11 +4341,11 @@
4271
4341
  }
4272
4342
  });
4273
4343
 
4274
- const _hoisted_1$a = { class: "code-name-wrapper" };
4344
+ const _hoisted_1$b = { class: "code-name-wrapper" };
4275
4345
  const _hoisted_2$4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
4276
4346
  const _hoisted_3$2 = { class: "code-name-wrapper" };
4277
4347
  const _hoisted_4$2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
4278
- const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
4348
+ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
4279
4349
  ...{
4280
4350
  name: "MEditorFunctionEditor"
4281
4351
  },
@@ -4291,7 +4361,7 @@
4291
4361
  },
4292
4362
  setup(__props, { expose: __expose }) {
4293
4363
  const props = __props;
4294
- vue.provide("mForm", {});
4364
+ vue.provide("mForm", null);
4295
4365
  const defaultParamColConfig = {
4296
4366
  type: "row",
4297
4367
  label: "参数类型",
@@ -4398,7 +4468,7 @@
4398
4468
  const _component_m_form_table = vue.resolveComponent("m-form-table");
4399
4469
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
4400
4470
  header: vue.withCtx(() => [
4401
- vue.createElementVNode("div", _hoisted_1$a, [
4471
+ vue.createElementVNode("div", _hoisted_1$b, [
4402
4472
  _hoisted_2$4,
4403
4473
  vue.createVNode(vue.unref(design.TMagicInput), {
4404
4474
  class: "code-name-input",
@@ -4421,7 +4491,7 @@
4421
4491
  ])
4422
4492
  ]),
4423
4493
  default: vue.withCtx(() => [
4424
- vue.createVNode(_sfc_main$j, {
4494
+ vue.createVNode(_sfc_main$k, {
4425
4495
  ref_key: "codeDraftEditor",
4426
4496
  ref: codeDraftEditor,
4427
4497
  id: _ctx.id,
@@ -4440,11 +4510,11 @@
4440
4510
  }
4441
4511
  });
4442
4512
 
4443
- const _hoisted_1$9 = {
4513
+ const _hoisted_1$a = {
4444
4514
  key: 0,
4445
4515
  class: "m-editor-code-block-editor-panel"
4446
4516
  };
4447
- const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
4517
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
4448
4518
  ...{
4449
4519
  name: "MEditorCodeBlockEditor"
4450
4520
  },
@@ -4501,16 +4571,16 @@
4501
4571
  "before-close": handleClose
4502
4572
  }, {
4503
4573
  default: vue.withCtx(() => [
4504
- vue.createVNode(_sfc_main$s, {
4574
+ vue.createVNode(_sfc_main$t, {
4505
4575
  left: left.value,
4506
4576
  "onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
4507
4577
  "min-left": 45,
4508
4578
  class: "code-editor-layout"
4509
4579
  }, {
4510
4580
  center: vue.withCtx(() => [
4511
- !vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
4581
+ !vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
4512
4582
  vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: id.value }),
4513
- codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
4583
+ codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
4514
4584
  key: 0,
4515
4585
  ref_key: "functionEditor",
4516
4586
  ref: functionEditor,
@@ -4533,14 +4603,14 @@
4533
4603
  }
4534
4604
  });
4535
4605
 
4536
- const _hoisted_1$8 = { class: "search-wrapper" };
4606
+ const _hoisted_1$9 = { class: "search-wrapper" };
4537
4607
  const _hoisted_2$3 = ["id"];
4538
4608
  const _hoisted_3$1 = { class: "list-item" };
4539
4609
  const _hoisted_4$1 = {
4540
4610
  key: 2,
4541
4611
  class: "right-tool"
4542
4612
  };
4543
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
4613
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
4544
4614
  ...{
4545
4615
  name: "MEditorCodeBlockList"
4546
4616
  },
@@ -4636,8 +4706,8 @@
4636
4706
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
4637
4707
  default: vue.withCtx(() => [
4638
4708
  vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
4639
- vue.createElementVNode("div", _hoisted_1$8, [
4640
- vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4709
+ vue.createElementVNode("div", _hoisted_1$9, [
4710
+ vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
4641
4711
  editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4642
4712
  key: 0,
4643
4713
  class: "create-code-button",
@@ -4672,11 +4742,11 @@
4672
4742
  class: "list-container"
4673
4743
  }, [
4674
4744
  vue.createElementVNode("div", _hoisted_3$1, [
4675
- data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$k, {
4745
+ data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
4676
4746
  key: 0,
4677
4747
  class: "codeIcon"
4678
4748
  })) : vue.createCommentVNode("", true),
4679
- data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
4749
+ data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$m, {
4680
4750
  key: 1,
4681
4751
  class: "compIcon"
4682
4752
  })) : vue.createCommentVNode("", true),
@@ -4690,7 +4760,7 @@
4690
4760
  placement: "bottom"
4691
4761
  }, {
4692
4762
  default: vue.withCtx(() => [
4693
- vue.createVNode(_sfc_main$B, {
4763
+ vue.createVNode(_sfc_main$D, {
4694
4764
  icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
4695
4765
  class: "edit-icon",
4696
4766
  onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
@@ -4705,7 +4775,7 @@
4705
4775
  placement: "bottom"
4706
4776
  }, {
4707
4777
  default: vue.withCtx(() => [
4708
- vue.createVNode(_sfc_main$B, {
4778
+ vue.createVNode(_sfc_main$D, {
4709
4779
  icon: vue.unref(iconsVue.Close),
4710
4780
  class: "edit-icon",
4711
4781
  onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -4723,7 +4793,7 @@
4723
4793
  ]),
4724
4794
  _: 3
4725
4795
  }, 8, ["default-expanded-keys", "data"]),
4726
- isShowCodeBlockEditor.value ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
4796
+ isShowCodeBlockEditor.value ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
4727
4797
  key: 0,
4728
4798
  paramsColConfig: _ctx.paramsColConfig
4729
4799
  }, {
@@ -4739,7 +4809,7 @@
4739
4809
  }
4740
4810
  });
4741
4811
 
4742
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
4812
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
4743
4813
  ...{
4744
4814
  name: "MEditorDataSourceConfigPanel"
4745
4815
  },
@@ -4831,21 +4901,21 @@
4831
4901
  }
4832
4902
  });
4833
4903
 
4834
- const _hoisted_1$7 = { class: "search-wrapper" };
4904
+ const _hoisted_1$8 = { class: "search-wrapper" };
4835
4905
  const _hoisted_2$2 = ["id"];
4836
4906
  const _hoisted_3 = { class: "list-item" };
4837
4907
  const _hoisted_4 = {
4838
4908
  key: 2,
4839
4909
  class: "right-tool"
4840
4910
  };
4841
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
4911
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
4842
4912
  ...{
4843
4913
  name: "MEditorDataSourceListPanel"
4844
4914
  },
4845
4915
  __name: "DataSourceListPanel",
4846
4916
  setup(__props) {
4847
4917
  const services = vue.inject("services", {});
4848
- const { dataSourceService, depService } = vue.inject("services") || {};
4918
+ const { dataSourceService, depService, editorService } = vue.inject("services") || {};
4849
4919
  const list = vue.computed(
4850
4920
  () => Object.values(depService?.targets["data-source"] || {}).map((target) => ({
4851
4921
  id: target.id,
@@ -4897,11 +4967,23 @@
4897
4967
  const filterTextChangeHandler = (val) => {
4898
4968
  tree.value?.filter(val);
4899
4969
  };
4970
+ const selectComp = (compId) => {
4971
+ const stage = editorService?.get("stage");
4972
+ editorService?.select(compId);
4973
+ stage?.select(compId);
4974
+ };
4975
+ const clickHandler = (data, node) => {
4976
+ if (data.type === "node") {
4977
+ selectComp(data.id);
4978
+ } else if (data.type === "key") {
4979
+ selectComp(node.parent.data.id);
4980
+ }
4981
+ };
4900
4982
  return (_ctx, _cache) => {
4901
4983
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
4902
4984
  default: vue.withCtx(() => [
4903
- vue.createElementVNode("div", _hoisted_1$7, [
4904
- vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4985
+ vue.createElementVNode("div", _hoisted_1$8, [
4986
+ vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
4905
4987
  vue.createVNode(vue.unref(design.TMagicButton), {
4906
4988
  type: "primary",
4907
4989
  size: "small",
@@ -4922,7 +5004,8 @@
4922
5004
  "default-expand-all": "",
4923
5005
  "expand-on-click-node": false,
4924
5006
  data: list.value,
4925
- "highlight-current": true
5007
+ "highlight-current": true,
5008
+ onNodeClick: clickHandler
4926
5009
  }, {
4927
5010
  default: vue.withCtx(({ data }) => [
4928
5011
  vue.createElementVNode("div", {
@@ -4930,12 +5013,12 @@
4930
5013
  class: "list-container"
4931
5014
  }, [
4932
5015
  vue.createElementVNode("div", _hoisted_3, [
4933
- data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$B, {
5016
+ data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
4934
5017
  key: 0,
4935
5018
  class: "codeIcon",
4936
5019
  icon: vue.unref(iconsVue.Coin)
4937
5020
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
4938
- data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$B, {
5021
+ data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
4939
5022
  key: 1,
4940
5023
  class: "compIcon",
4941
5024
  icon: vue.unref(iconsVue.Aim)
@@ -4950,7 +5033,7 @@
4950
5033
  placement: "bottom"
4951
5034
  }, {
4952
5035
  default: vue.withCtx(() => [
4953
- vue.createVNode(_sfc_main$B, {
5036
+ vue.createVNode(_sfc_main$D, {
4954
5037
  class: "edit-icon",
4955
5038
  icon: vue.unref(iconsVue.Edit),
4956
5039
  onClick: vue.withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
@@ -4964,7 +5047,7 @@
4964
5047
  placement: "bottom"
4965
5048
  }, {
4966
5049
  default: vue.withCtx(() => [
4967
- vue.createVNode(_sfc_main$B, {
5050
+ vue.createVNode(_sfc_main$D, {
4968
5051
  icon: vue.unref(iconsVue.Close),
4969
5052
  class: "edit-icon",
4970
5053
  onClick: vue.withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
@@ -4982,7 +5065,7 @@
4982
5065
  ]),
4983
5066
  _: 3
4984
5067
  }, 8, ["data"]),
4985
- vue.createVNode(_sfc_main$f, {
5068
+ vue.createVNode(_sfc_main$g, {
4986
5069
  ref_key: "editDialog",
4987
5070
  ref: editDialog,
4988
5071
  values: dataSourceValues.value,
@@ -4996,8 +5079,8 @@
4996
5079
  }
4997
5080
  });
4998
5081
 
4999
- const _hoisted_1$6 = ["onClick", "onDragstart"];
5000
- const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
5082
+ const _hoisted_1$7 = ["onClick", "onDragstart"];
5083
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
5001
5084
  ...{
5002
5085
  name: "MEditorComponentListPanel"
5003
5086
  },
@@ -5031,14 +5114,13 @@
5031
5114
  };
5032
5115
  const dragstartHandler = ({ text, type, data = {} }, e) => {
5033
5116
  if (e.dataTransfer) {
5034
- e.dataTransfer.effectAllowed = "move";
5035
5117
  e.dataTransfer.setData(
5036
- "data",
5118
+ "text/html",
5037
5119
  serialize({
5038
5120
  name: text,
5039
5121
  type,
5040
5122
  ...data
5041
- }).replace(/"(\w+)":\s/g, "$1: ")
5123
+ })
5042
5124
  );
5043
5125
  }
5044
5126
  };
@@ -5066,7 +5148,7 @@
5066
5148
  }
5067
5149
  if (timeout || !stage.value)
5068
5150
  return;
5069
- timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
5151
+ timeout = stage.value.delayedMarkContainer(e);
5070
5152
  };
5071
5153
  return (_ctx, _cache) => {
5072
5154
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), null, {
@@ -5077,7 +5159,7 @@
5077
5159
  "model-value": collapseValue.value
5078
5160
  }, {
5079
5161
  default: vue.withCtx(() => [
5080
- vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
5162
+ vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
5081
5163
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
5082
5164
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
5083
5165
  group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
@@ -5085,7 +5167,7 @@
5085
5167
  name: `${index}`
5086
5168
  }, {
5087
5169
  title: vue.withCtx(() => [
5088
- vue.createVNode(_sfc_main$B, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
5170
+ vue.createVNode(_sfc_main$D, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
5089
5171
  vue.createTextVNode(vue.toDisplayString(group.title), 1)
5090
5172
  ]),
5091
5173
  default: vue.withCtx(() => [
@@ -5100,7 +5182,7 @@
5100
5182
  onDrag: dragHandler
5101
5183
  }, [
5102
5184
  vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
5103
- vue.createVNode(_sfc_main$B, {
5185
+ vue.createVNode(_sfc_main$D, {
5104
5186
  icon: item.icon
5105
5187
  }, null, 8, ["icon"]),
5106
5188
  vue.createVNode(vue.unref(design.TMagicTooltip), {
@@ -5114,7 +5196,7 @@
5114
5196
  _: 2
5115
5197
  }, 1032, ["content"])
5116
5198
  ])
5117
- ], 40, _hoisted_1$6);
5199
+ ], 40, _hoisted_1$7);
5118
5200
  }), 128))
5119
5201
  ]),
5120
5202
  _: 2
@@ -5131,7 +5213,7 @@
5131
5213
  }
5132
5214
  });
5133
5215
 
5134
- const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
5216
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
5135
5217
  ...{
5136
5218
  name: "MEditorContentMenu"
5137
5219
  },
@@ -5228,7 +5310,7 @@
5228
5310
  }, [
5229
5311
  vue.createElementVNode("div", null, [
5230
5312
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
5231
- return vue.openBlock(), vue.createBlock(_sfc_main$p, {
5313
+ return vue.openBlock(), vue.createBlock(_sfc_main$q, {
5232
5314
  "event-type": "mouseup",
5233
5315
  data: item,
5234
5316
  key: index,
@@ -5255,7 +5337,7 @@
5255
5337
  }
5256
5338
  });
5257
5339
 
5258
- const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
5340
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
5259
5341
  ...{
5260
5342
  name: "MEditorLayerMenu"
5261
5343
  },
@@ -5350,7 +5432,7 @@
5350
5432
  show
5351
5433
  });
5352
5434
  return (_ctx, _cache) => {
5353
- return vue.openBlock(), vue.createBlock(_sfc_main$c, {
5435
+ return vue.openBlock(), vue.createBlock(_sfc_main$d, {
5354
5436
  "menu-data": menuData.value,
5355
5437
  ref_key: "menu",
5356
5438
  ref: menu,
@@ -5360,6 +5442,57 @@
5360
5442
  }
5361
5443
  });
5362
5444
 
5445
+ const _hoisted_1$6 = { class: "layer-node-tool" };
5446
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
5447
+ __name: "LayerNode",
5448
+ props: {
5449
+ data: {}
5450
+ },
5451
+ setup(__props) {
5452
+ const props = __props;
5453
+ const services = vue.inject("services");
5454
+ const editorService = services?.editorService;
5455
+ const setNodeVisible = (visible) => {
5456
+ if (!editorService)
5457
+ return;
5458
+ editorService.update({
5459
+ id: props.data.id,
5460
+ visible
5461
+ });
5462
+ };
5463
+ return (_ctx, _cache) => {
5464
+ const _component_el_icon = vue.resolveComponent("el-icon");
5465
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
5466
+ vue.createElementVNode("div", null, vue.toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
5467
+ vue.createElementVNode("div", _hoisted_1$6, [
5468
+ _ctx.data.type !== "page" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
5469
+ _ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
5470
+ key: 0,
5471
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => setNodeVisible(true), ["stop"])),
5472
+ title: "点击显示"
5473
+ }, {
5474
+ default: vue.withCtx(() => [
5475
+ vue.createVNode(vue.unref(iconsVue.Hide))
5476
+ ]),
5477
+ _: 1
5478
+ })) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
5479
+ key: 1,
5480
+ onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => setNodeVisible(false), ["stop"])),
5481
+ class: "node-lock",
5482
+ title: "点击隐藏"
5483
+ }, {
5484
+ default: vue.withCtx(() => [
5485
+ vue.createVNode(vue.unref(iconsVue.View))
5486
+ ]),
5487
+ _: 1
5488
+ }))
5489
+ ], 64)) : vue.createCommentVNode("", true)
5490
+ ])
5491
+ ], 64);
5492
+ };
5493
+ }
5494
+ });
5495
+
5363
5496
  const _hoisted_1$5 = ["id", "onMouseenter"];
5364
5497
  const throttleTime = 150;
5365
5498
  const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
@@ -5600,7 +5733,7 @@
5600
5733
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
5601
5734
  default: vue.withCtx(() => [
5602
5735
  vue.renderSlot(_ctx.$slots, "layer-panel-header"),
5603
- vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
5736
+ vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
5604
5737
  values.value.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
5605
5738
  key: 0,
5606
5739
  class: "magic-editor-layer-tree",
@@ -5640,14 +5773,14 @@
5640
5773
  node,
5641
5774
  data
5642
5775
  }, () => [
5643
- vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
5776
+ vue.createVNode(_sfc_main$b, { data }, null, 8, ["data"])
5644
5777
  ])
5645
5778
  ], 40, _hoisted_1$5)
5646
5779
  ]),
5647
5780
  _: 3
5648
5781
  }, 8, ["default-expanded-keys", "default-checked-keys", "current-node-key", "data", "highlight-current", "show-checkbox"])) : vue.createCommentVNode("", true),
5649
5782
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
5650
- vue.createVNode(_sfc_main$b, {
5783
+ vue.createVNode(_sfc_main$c, {
5651
5784
  ref_key: "menu",
5652
5785
  ref: menu,
5653
5786
  "layer-content-menu": _ctx.layerContentMenu
@@ -5685,7 +5818,7 @@
5685
5818
  type: "component",
5686
5819
  icon: iconsVue.Goods,
5687
5820
  text: "组件",
5688
- component: _sfc_main$d,
5821
+ component: _sfc_main$e,
5689
5822
  slots: {}
5690
5823
  },
5691
5824
  layer: {
@@ -5704,7 +5837,7 @@
5704
5837
  type: "component",
5705
5838
  icon: iconsVue.EditPen,
5706
5839
  text: "代码编辑",
5707
- component: _sfc_main$g,
5840
+ component: _sfc_main$h,
5708
5841
  slots: {}
5709
5842
  },
5710
5843
  "data-source": {
@@ -5712,7 +5845,7 @@
5712
5845
  type: "component",
5713
5846
  icon: iconsVue.Coin,
5714
5847
  text: "数据源",
5715
- component: _sfc_main$e,
5848
+ component: _sfc_main$f,
5716
5849
  slots: {}
5717
5850
  }
5718
5851
  };
@@ -5744,7 +5877,7 @@
5744
5877
  (vue.openBlock(), vue.createElementBlock("div", {
5745
5878
  key: config.text
5746
5879
  }, [
5747
- config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$B, {
5880
+ config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
5748
5881
  key: 0,
5749
5882
  icon: config.icon
5750
5883
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -5972,14 +6105,14 @@
5972
6105
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5973
6106
  onClick: addPage
5974
6107
  }, [
5975
- vue.createVNode(_sfc_main$B, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
6108
+ vue.createVNode(_sfc_main$D, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
5976
6109
  ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2)),
5977
6110
  canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
5978
6111
  key: 2,
5979
6112
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5980
6113
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
5981
6114
  }, [
5982
- vue.createVNode(_sfc_main$B, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
6115
+ vue.createVNode(_sfc_main$D, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
5983
6116
  ])) : vue.createCommentVNode("", true),
5984
6117
  pageLength.value ? (vue.openBlock(), vue.createElementBlock("div", {
5985
6118
  key: 3,
@@ -5995,7 +6128,7 @@
5995
6128
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5996
6129
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
5997
6130
  }, [
5998
- vue.createVNode(_sfc_main$B, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
6131
+ vue.createVNode(_sfc_main$D, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
5999
6132
  ])) : vue.createCommentVNode("", true)
6000
6133
  ], 512);
6001
6134
  };
@@ -6067,7 +6200,7 @@
6067
6200
  default: vue.withCtx(() => [
6068
6201
  vue.createElementVNode("div", null, [
6069
6202
  vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
6070
- vue.createVNode(_sfc_main$p, {
6203
+ vue.createVNode(_sfc_main$q, {
6071
6204
  data: {
6072
6205
  type: "button",
6073
6206
  text: "复制",
@@ -6075,7 +6208,7 @@
6075
6208
  handler: () => copy(item)
6076
6209
  }
6077
6210
  }, null, 8, ["data"]),
6078
- vue.createVNode(_sfc_main$p, {
6211
+ vue.createVNode(_sfc_main$q, {
6079
6212
  data: {
6080
6213
  type: "button",
6081
6214
  text: "删除",
@@ -6566,7 +6699,7 @@
6566
6699
  };
6567
6700
  __expose({ show });
6568
6701
  return (_ctx, _cache) => {
6569
- return vue.openBlock(), vue.createBlock(_sfc_main$c, {
6702
+ return vue.openBlock(), vue.createBlock(_sfc_main$d, {
6570
6703
  "menu-data": menuData.value,
6571
6704
  ref_key: "menu",
6572
6705
  ref: menu
@@ -6667,9 +6800,9 @@
6667
6800
  };
6668
6801
  const dragoverHandler = (e) => {
6669
6802
  e.preventDefault();
6670
- if (e.dataTransfer) {
6671
- e.dataTransfer.dropEffect = "move";
6672
- }
6803
+ if (!e.dataTransfer)
6804
+ return;
6805
+ e.dataTransfer.dropEffect = "move";
6673
6806
  };
6674
6807
  const dropHandler = async (e) => {
6675
6808
  e.preventDefault();
@@ -6681,7 +6814,12 @@
6681
6814
  }
6682
6815
  if (e.dataTransfer && parent && stageContainer.value && stage) {
6683
6816
  const parseDSL = getConfig("parseDSL");
6684
- const config = parseDSL(`(${e.dataTransfer.getData("data")})`);
6817
+ const data = e.dataTransfer.getData("text/html");
6818
+ if (!data)
6819
+ return;
6820
+ const config = parseDSL(`(${data})`);
6821
+ if (!config)
6822
+ return;
6685
6823
  const layout = await services?.editorService.getLayout(parent);
6686
6824
  const containerRect = stageContainer.value.getBoundingClientRect();
6687
6825
  const { scrollTop, scrollLeft } = stage.mask;
@@ -7881,6 +8019,9 @@
7881
8019
  id,
7882
8020
  name: codeBlock.name,
7883
8021
  isTarget: (key, value) => {
8022
+ if (id === value) {
8023
+ return true;
8024
+ }
7884
8025
  if (value?.hookType === schema.HookType.CODE && !lodashEs.isEmpty(value.hookData)) {
7885
8026
  const index = value.hookData.findIndex((item) => item.codeId === id);
7886
8027
  return Boolean(index > -1);
@@ -7892,7 +8033,10 @@
7892
8033
  type: "data-source",
7893
8034
  id,
7894
8035
  name: ds.title || `${id}`,
7895
- isTarget: (key, value) => typeof value === "string" && value.includes(`${id}`)
8036
+ isTarget: (key, value) => (
8037
+ // 关联数据源对象或者在模板在使用数据源
8038
+ value.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)
8039
+ )
7896
8040
  });
7897
8041
 
7898
8042
  const initServiceState = (props, {
@@ -8145,11 +8289,11 @@
8145
8289
  const _sfc_main = vue.defineComponent({
8146
8290
  name: "MEditor",
8147
8291
  components: {
8148
- TMagicNavMenu: _sfc_main$o,
8292
+ TMagicNavMenu: _sfc_main$p,
8149
8293
  Sidebar: _sfc_main$9,
8150
8294
  Workspace: _sfc_main$1,
8151
- PropsPanel: _sfc_main$n,
8152
- Framework: _sfc_main$q
8295
+ PropsPanel: _sfc_main$o,
8296
+ Framework: _sfc_main$r
8153
8297
  },
8154
8298
  props: editorProps,
8155
8299
  emits: ["props-panel-mounted", "update:modelValue"],
@@ -8316,47 +8460,49 @@
8316
8460
  app.config.globalProperties.$TMAGIC_EDITOR = option;
8317
8461
  setConfig(option);
8318
8462
  app.component(Editor.name, Editor);
8319
- app.component("m-fields-ui-select", _sfc_main$v);
8320
- app.component("m-fields-code-link", _sfc_main$D);
8321
- app.component("m-fields-vs-code", _sfc_main$E);
8322
- app.component("magic-code-editor", _sfc_main$u);
8323
- app.component("m-fields-code-select", _sfc_main$C);
8324
- app.component("m-fields-code-select-col", _sfc_main$A);
8325
- app.component("m-fields-event-select", _sfc_main$x);
8326
- app.component("m-fields-data-source-fields", _sfc_main$z);
8327
- app.component("m-fields-key-value", _sfc_main$w);
8328
- app.component("m-fields-data-source-input", _sfc_main$y);
8463
+ app.component("m-fields-ui-select", _sfc_main$w);
8464
+ app.component("m-fields-code-link", _sfc_main$F);
8465
+ app.component("m-fields-vs-code", _sfc_main$G);
8466
+ app.component("magic-code-editor", _sfc_main$v);
8467
+ app.component("m-fields-code-select", _sfc_main$E);
8468
+ app.component("m-fields-code-select-col", _sfc_main$C);
8469
+ app.component("m-fields-event-select", _sfc_main$y);
8470
+ app.component("m-fields-data-source-fields", _sfc_main$B);
8471
+ app.component("m-fields-key-value", _sfc_main$x);
8472
+ app.component("m-fields-data-source-input", _sfc_main$A);
8473
+ app.component("m-fields-data-source-select", _sfc_main$z);
8329
8474
  }
8330
8475
  };
8331
8476
 
8332
8477
  exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
8333
8478
  exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
8334
- exports.CodeBlockList = _sfc_main$g;
8479
+ exports.CodeBlockList = _sfc_main$h;
8335
8480
  exports.CodeDeleteErrorType = CodeDeleteErrorType;
8336
- exports.CodeSelect = _sfc_main$C;
8337
- exports.CodeSelectCol = _sfc_main$A;
8481
+ exports.CodeSelect = _sfc_main$E;
8482
+ exports.CodeSelectCol = _sfc_main$C;
8338
8483
  exports.ColumnLayout = ColumnLayout;
8339
- exports.ComponentListPanel = _sfc_main$d;
8340
- exports.ContentMenu = _sfc_main$c;
8341
- exports.DataSourceFields = _sfc_main$z;
8342
- exports.DataSourceInput = _sfc_main$y;
8343
- exports.EventSelect = _sfc_main$x;
8484
+ exports.ComponentListPanel = _sfc_main$e;
8485
+ exports.ContentMenu = _sfc_main$d;
8486
+ exports.DataSourceFields = _sfc_main$B;
8487
+ exports.DataSourceInput = _sfc_main$A;
8488
+ exports.DataSourceSelect = _sfc_main$z;
8489
+ exports.EventSelect = _sfc_main$y;
8344
8490
  exports.Fixed2Other = Fixed2Other;
8345
8491
  exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
8346
- exports.Icon = _sfc_main$B;
8492
+ exports.Icon = _sfc_main$D;
8347
8493
  exports.KeyBindingCommand = KeyBindingCommand;
8348
- exports.KeyValue = _sfc_main$w;
8494
+ exports.KeyValue = _sfc_main$x;
8349
8495
  exports.Keys = Keys;
8350
8496
  exports.LayerOffset = LayerOffset;
8351
8497
  exports.LayerPanel = _sfc_main$a;
8352
8498
  exports.Layout = Layout;
8353
- exports.LayoutContainer = _sfc_main$s;
8354
- exports.PropsPanel = _sfc_main$n;
8355
- exports.Resizer = _sfc_main$t;
8356
- exports.SplitView = _sfc_main$s;
8357
- exports.TMagicCodeEditor = _sfc_main$u;
8499
+ exports.LayoutContainer = _sfc_main$t;
8500
+ exports.PropsPanel = _sfc_main$o;
8501
+ exports.Resizer = _sfc_main$u;
8502
+ exports.SplitView = _sfc_main$t;
8503
+ exports.TMagicCodeEditor = _sfc_main$v;
8358
8504
  exports.TMagicEditor = Editor;
8359
- exports.ToolButton = _sfc_main$p;
8505
+ exports.ToolButton = _sfc_main$q;
8360
8506
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
8361
8507
  exports.beforePaste = beforePaste;
8362
8508
  exports.change2Fixed = change2Fixed;