@tmagic/editor 1.3.0-alpha.7 → 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.
@@ -3,8 +3,8 @@ import serialize from 'serialize-javascript';
3
3
  import { isEmpty, map, has, throttle, cloneDeep, mergeWith, isObject, uniq, forIn, difference, union, pick, keys } from 'lodash-es';
4
4
  import { TMagicCard, TMagicIcon, TMagicButton, tMagicMessageBox, getConfig as getConfig$1, TMagicTag, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, TMagicDrawer, TMagicTree, TMagicCollapse, TMagicCollapseItem, TMagicPopover } from '@tmagic/design';
5
5
  import { HookType, ActionType, NodeType } from '@tmagic/schema';
6
- import { Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, Files, CopyDocument, Goods, List, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Top, Bottom } from '@element-plus/icons-vue';
7
- import { createValues, MFormDialog, MForm } from '@tmagic/form';
6
+ import { Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, Files, CopyDocument, Hide, Goods, List, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Top, Bottom } from '@element-plus/icons-vue';
7
+ import { createValues, MFormDialog, MSelect, MForm } from '@tmagic/form';
8
8
  import { MagicTable } from '@tmagic/table';
9
9
  import * as monaco from 'monaco-editor';
10
10
  import Gesto from 'gesto';
@@ -14,7 +14,7 @@ import { EventEmitter } from 'events';
14
14
  import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
15
15
  import KeyController from 'keycon';
16
16
 
17
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
17
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
18
18
  ...{
19
19
  name: "MEditorCode"
20
20
  },
@@ -53,7 +53,7 @@ const setConfig = (option) => {
53
53
  };
54
54
  const getConfig = (key) => $TMAGIC_EDITOR[key];
55
55
 
56
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
56
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
57
57
  ...{
58
58
  name: "MEditorCodeLink"
59
59
  },
@@ -127,7 +127,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
127
127
  }
128
128
  });
129
129
 
130
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
130
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
131
131
  ...{
132
132
  name: "MEditorCodeSelect"
133
133
  },
@@ -192,8 +192,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
192
192
  }
193
193
  });
194
194
 
195
- const _hoisted_1$n = ["src"];
196
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
195
+ const _hoisted_1$o = ["src"];
196
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
197
197
  ...{
198
198
  name: "MEditorIcon"
199
199
  },
@@ -216,7 +216,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
216
216
  class: "magic-editor-icon"
217
217
  }, {
218
218
  default: withCtx(() => [
219
- createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$n)
219
+ createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$o)
220
220
  ]),
221
221
  _: 1
222
222
  })) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
@@ -235,9 +235,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
235
235
  }
236
236
  });
237
237
 
238
- const _hoisted_1$m = { class: "m-fields-code-select-col" };
238
+ const _hoisted_1$n = { class: "m-fields-code-select-col" };
239
239
  const _hoisted_2$e = { class: "code-select-container" };
240
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
240
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
241
241
  ...{
242
242
  name: "MEditorCodeSelectCol"
243
243
  },
@@ -329,7 +329,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
329
329
  };
330
330
  return (_ctx, _cache) => {
331
331
  const _component_m_form_container = resolveComponent("m-form-container");
332
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
332
+ return openBlock(), createElementBlock("div", _hoisted_1$n, [
333
333
  createElementVNode("div", _hoisted_2$e, [
334
334
  createVNode(_component_m_form_container, {
335
335
  class: "select",
@@ -337,7 +337,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
337
337
  model: _ctx.model,
338
338
  onChange: onParamsChangeHandler
339
339
  }, null, 8, ["model"]),
340
- createVNode(_sfc_main$B, {
340
+ createVNode(_sfc_main$D, {
341
341
  class: "icon",
342
342
  icon: editable.value ? unref(Edit) : unref(View),
343
343
  onClick: editCode
@@ -353,9 +353,9 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
353
353
  }
354
354
  });
355
355
 
356
- const _hoisted_1$l = { class: "m-editor-data-source-fields" };
356
+ const _hoisted_1$m = { class: "m-editor-data-source-fields" };
357
357
  const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
358
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
358
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
359
359
  ...{
360
360
  name: "MEditorDataSourceFields"
361
361
  },
@@ -501,7 +501,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
501
501
  }
502
502
  ];
503
503
  return (_ctx, _cache) => {
504
- return openBlock(), createElementBlock("div", _hoisted_1$l, [
504
+ return openBlock(), createElementBlock("div", _hoisted_1$m, [
505
505
  createVNode(unref(MagicTable), {
506
506
  data: _ctx.model[_ctx.name],
507
507
  columns: filedColumns
@@ -534,10 +534,10 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
534
534
  }
535
535
  });
536
536
 
537
- const _hoisted_1$k = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
537
+ const _hoisted_1$l = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
538
538
  const _hoisted_2$c = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
539
539
  const _hoisted_3$5 = { class: "el-input__inner" };
540
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
540
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
541
541
  ...{
542
542
  name: "MEditorDataSourceInput"
543
543
  },
@@ -563,7 +563,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
563
563
  const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
564
564
  const setDisplayState = () => {
565
565
  displayState.value = [];
566
- const matches = state.value.matchAll(/\{\{([\s\S]+?)\}\}/g);
566
+ const matches = state.value.matchAll(/\$\{([\s\S]+?)\}/g);
567
567
  let index = 0;
568
568
  for (const match of matches) {
569
569
  if (typeof match.index === "undefined")
@@ -636,13 +636,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
636
636
  }
637
637
  return selectionStart;
638
638
  };
639
- const curCharIsLeftCurlyBracket = (leftCurlyBracketIndex) => leftCurlyBracketIndex > -1 && leftCurlyBracketIndex === getSelectionStart() - 1;
639
+ const curCharIsLeftCurlyBracket = (leftCurlyBracketIndex) => leftCurlyBracketIndex > 0 && leftCurlyBracketIndex === getSelectionStart() - 1;
640
640
  const curCharIsDot = (dotIndex) => dotIndex > -1 && dotIndex === getSelectionStart() - 1;
641
641
  const dsQuerySearch = (queryString, leftCurlyBracketIndex, cb) => {
642
642
  let result = [];
643
643
  if (curCharIsLeftCurlyBracket(leftCurlyBracketIndex)) {
644
644
  result = dataSources.value;
645
- } else if (leftCurlyBracketIndex > -1) {
645
+ } else if (leftCurlyBracketIndex > 0) {
646
646
  const queryName = queryString.substring(leftCurlyBracketIndex + 1).toLowerCase();
647
647
  result = dataSources.value.filter((ds) => ds.title?.toLowerCase().includes(queryName) || ds.id.includes(queryName));
648
648
  }
@@ -694,7 +694,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
694
694
  const selectionStart = getSelectionStart();
695
695
  const curQueryString = queryString.substring(0, selectionStart);
696
696
  const fieldKeyStringLastIndex = curQueryString.lastIndexOf(".");
697
- const dsKeyStringLastIndex = curQueryString.lastIndexOf("{");
697
+ const dsKeyStringLastIndex = curQueryString.lastIndexOf("${") + 1;
698
698
  const isFieldTip = fieldKeyStringLastIndex > dsKeyStringLastIndex;
699
699
  if (isFieldTip) {
700
700
  fieldQuerySearch(curQueryString, dsKeyStringLastIndex, fieldKeyStringLastIndex, cb);
@@ -707,7 +707,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
707
707
  const selectionStart = input.value?.selectionStart || 0;
708
708
  let startText = inputText.substring(0, selectionStart);
709
709
  const dotIndex = startText.lastIndexOf(".");
710
- const leftCurlyBracketIndex = startText.lastIndexOf("{");
710
+ const leftCurlyBracketIndex = startText.lastIndexOf("${") + 1;
711
711
  const endText = inputText.substring(selectionStart);
712
712
  let suggestText = value;
713
713
  if (isDataSource) {
@@ -717,7 +717,6 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
717
717
  if (!isRightCurlyBracket(selectionStart + 1)) {
718
718
  suggestText = `${suggestText}}`;
719
719
  }
720
- suggestText = `{${suggestText}}`;
721
720
  } else if (!curCharIsDot(dotIndex)) {
722
721
  startText = startText.substring(0, dotIndex + 1);
723
722
  }
@@ -725,7 +724,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
725
724
  await nextTick();
726
725
  let newSelectionStart = 0;
727
726
  if (isDataSource) {
728
- newSelectionStart = leftCurlyBracketIndex + suggestText.length - 1;
727
+ newSelectionStart = leftCurlyBracketIndex + suggestText.length;
729
728
  } else {
730
729
  newSelectionStart = dotIndex + suggestText.length + 1;
731
730
  }
@@ -757,10 +756,10 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
757
756
  }
758
757
  ), {
759
758
  suffix: withCtx(() => [
760
- createVNode(_sfc_main$B, { icon: unref(Coin) }, null, 8, ["icon"])
759
+ createVNode(_sfc_main$D, { icon: unref(Coin) }, null, 8, ["icon"])
761
760
  ]),
762
761
  default: withCtx(({ item }) => [
763
- createElementVNode("div", _hoisted_1$k, [
762
+ createElementVNode("div", _hoisted_1$l, [
764
763
  createElementVNode("div", null, toDisplayString(item.text), 1),
765
764
  createElementVNode("span", _hoisted_2$c, toDisplayString(item.value), 1)
766
765
  ])
@@ -768,11 +767,11 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
768
767
  _: 1
769
768
  }, 16, ["modelValue"])) : (openBlock(), createElementBlock("div", {
770
769
  key: 1,
771
- class: normalizeClass(`el-input el-input--${_ctx.size}`),
770
+ class: normalizeClass(`tmagic-data-source-input-text el-input el-input--${_ctx.size}`),
772
771
  onMouseup: mouseupHandler
773
772
  }, [
774
773
  createElementVNode("div", {
775
- class: normalizeClass(`el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
774
+ class: normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
776
775
  }, [
777
776
  createElementVNode("div", _hoisted_3$5, [
778
777
  (openBlock(true), createElementBlock(Fragment, null, renderList(displayState.value, (item, index) => {
@@ -791,7 +790,11 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
791
790
  _: 2
792
791
  }, 1032, ["size"])) : createCommentVNode("", true)
793
792
  ], 64);
794
- }), 256))
793
+ }), 256)),
794
+ createVNode(_sfc_main$D, {
795
+ class: "tmagic-data-source-input-icon",
796
+ icon: unref(Coin)
797
+ }, null, 8, ["icon"])
795
798
  ])
796
799
  ], 2)
797
800
  ], 34));
@@ -799,12 +802,65 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
799
802
  }
800
803
  });
801
804
 
802
- const _hoisted_1$j = { class: "m-fields-event-select" };
805
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
806
+ ...{
807
+ name: "MEditorDataSourceSelect"
808
+ },
809
+ __name: "DataSourceSelect",
810
+ props: {
811
+ config: {},
812
+ model: {},
813
+ name: {},
814
+ prop: {},
815
+ disabled: { type: Boolean, default: false },
816
+ lastValues: {},
817
+ size: {}
818
+ },
819
+ emits: ["change"],
820
+ setup(__props, { emit }) {
821
+ const props = __props;
822
+ const { dataSourceService } = inject("services") || {};
823
+ const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
824
+ const selectConfig = computed(() => {
825
+ const { type, dataSourceType, ...config } = props.config;
826
+ return {
827
+ ...config,
828
+ type: "select",
829
+ valueKey: "dataSourceId",
830
+ options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
831
+ value: {
832
+ isBindDataSource: true,
833
+ dataSourceType: ds.type,
834
+ dataSourceId: ds.id
835
+ },
836
+ text: ds.title || ds.id
837
+ }))
838
+ };
839
+ });
840
+ const changeHandler = (value) => {
841
+ emit("change", value);
842
+ };
843
+ return (_ctx, _cache) => {
844
+ return openBlock(), createBlock(unref(MSelect), {
845
+ model: _ctx.model,
846
+ name: _ctx.name,
847
+ size: _ctx.size,
848
+ prop: _ctx.prop,
849
+ disabled: _ctx.disabled,
850
+ config: selectConfig.value,
851
+ "last-values": _ctx.lastValues,
852
+ onChange: changeHandler
853
+ }, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]);
854
+ };
855
+ }
856
+ });
857
+
858
+ const _hoisted_1$k = { class: "m-fields-event-select" };
803
859
  const _hoisted_2$b = {
804
860
  key: 1,
805
861
  class: "fullWidth"
806
862
  };
807
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
863
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
808
864
  ...{
809
865
  name: "MEditorEventSelect"
810
866
  },
@@ -966,7 +1022,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
966
1022
  const _component_m_form_table = resolveComponent("m-form-table");
967
1023
  const _component_m_form_container = resolveComponent("m-form-container");
968
1024
  const _component_m_form_panel = resolveComponent("m-form-panel");
969
- return openBlock(), createElementBlock("div", _hoisted_1$j, [
1025
+ return openBlock(), createElementBlock("div", _hoisted_1$k, [
970
1026
  isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
971
1027
  key: 0,
972
1028
  ref: "eventForm",
@@ -1017,9 +1073,9 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1017
1073
  }
1018
1074
  });
1019
1075
 
1020
- const _hoisted_1$i = { class: "m-fields-key-value" };
1076
+ const _hoisted_1$j = { class: "m-fields-key-value" };
1021
1077
  const _hoisted_2$a = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
1022
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
1078
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1023
1079
  ...{
1024
1080
  name: "MEditorKeyValue"
1025
1081
  },
@@ -1062,7 +1118,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1062
1118
  records.value.splice(index, 1);
1063
1119
  };
1064
1120
  return (_ctx, _cache) => {
1065
- return openBlock(), createElementBlock("div", _hoisted_1$i, [
1121
+ return openBlock(), createElementBlock("div", _hoisted_1$j, [
1066
1122
  (openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
1067
1123
  return openBlock(), createElementBlock("div", {
1068
1124
  class: "m-fields-key-value-item",
@@ -1113,7 +1169,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1113
1169
  }
1114
1170
  });
1115
1171
 
1116
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
1172
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1117
1173
  ...{
1118
1174
  name: "MEditorUISelect"
1119
1175
  },
@@ -1227,7 +1283,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1227
1283
 
1228
1284
  const UISelect_vue_vue_type_style_index_0_lang = '';
1229
1285
 
1230
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
1286
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1231
1287
  ...{
1232
1288
  name: "MEditorCodeEditor"
1233
1289
  },
@@ -1248,10 +1304,14 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1248
1304
  const toString = (v, language) => {
1249
1305
  let value = "";
1250
1306
  if (typeof v !== "string") {
1251
- value = serialize(v, {
1252
- space: 2,
1253
- unsafe: true
1254
- }).replace(/"(\w+)":\s/g, "$1: ");
1307
+ if (props.language.toLocaleLowerCase() === "json") {
1308
+ value = JSON.stringify(v, null, 2);
1309
+ } else {
1310
+ value = serialize(v, {
1311
+ space: 2,
1312
+ unsafe: true
1313
+ }).replace(/"(\w+)":\s/g, "$1: ");
1314
+ }
1255
1315
  } else {
1256
1316
  value = v;
1257
1317
  }
@@ -1283,7 +1343,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1283
1343
  }
1284
1344
  return vsEditor?.setValue(values.value);
1285
1345
  };
1286
- const getEditorValue = () => props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue();
1346
+ const getEditorValue = () => (props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue()) || "";
1287
1347
  const init = async () => {
1288
1348
  if (!codeEditor.value)
1289
1349
  return;
@@ -1305,12 +1365,18 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1305
1365
  if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
1306
1366
  e.preventDefault();
1307
1367
  e.stopPropagation();
1308
- emit("save", getEditorValue());
1368
+ const newValue = getEditorValue();
1369
+ values.value = newValue;
1370
+ emit("save", newValue);
1309
1371
  }
1310
1372
  });
1311
1373
  if (props.type !== "diff" && props.autoSave) {
1312
1374
  vsEditor?.onDidBlurEditorWidget(() => {
1313
- emit("save", getEditorValue());
1375
+ const newValue = getEditorValue();
1376
+ if (values.value !== newValue) {
1377
+ values.value = newValue;
1378
+ emit("save", newValue);
1379
+ }
1314
1380
  });
1315
1381
  }
1316
1382
  resizeObserver.observe(codeEditor.value);
@@ -1335,9 +1401,16 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1335
1401
  resizeObserver.disconnect();
1336
1402
  });
1337
1403
  __expose({
1404
+ values,
1338
1405
  getEditor() {
1339
1406
  return vsEditor || vsDiffEditor;
1340
1407
  },
1408
+ getVsEditor() {
1409
+ return vsEditor;
1410
+ },
1411
+ getVsDiffEditor() {
1412
+ return vsDiffEditor;
1413
+ },
1341
1414
  setEditorValue,
1342
1415
  focus() {
1343
1416
  vsEditor?.focus();
@@ -1354,7 +1427,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1354
1427
  }
1355
1428
  });
1356
1429
 
1357
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
1430
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1358
1431
  ...{
1359
1432
  name: "MEditorResizer"
1360
1433
  },
@@ -1396,7 +1469,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1396
1469
  }
1397
1470
  });
1398
1471
 
1399
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
1472
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1400
1473
  ...{
1401
1474
  name: "MEditorLayout"
1402
1475
  },
@@ -1501,14 +1574,14 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1501
1574
  ref: el,
1502
1575
  class: "m-editor-layout"
1503
1576
  }, [
1504
- hasLeft.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1577
+ hasLeft.value && _ctx.$slots.left ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1505
1578
  createElementVNode("div", {
1506
1579
  class: normalizeClass(["m-editor-layout-left", _ctx.leftClass]),
1507
1580
  style: normalizeStyle(`width: ${_ctx.left}px`)
1508
1581
  }, [
1509
1582
  renderSlot(_ctx.$slots, "left")
1510
1583
  ], 6),
1511
- createVNode(_sfc_main$t, { onChange: changeLeft })
1584
+ createVNode(_sfc_main$u, { onChange: changeLeft })
1512
1585
  ], 64)) : createCommentVNode("", true),
1513
1586
  createElementVNode("div", {
1514
1587
  class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
@@ -1516,8 +1589,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1516
1589
  }, [
1517
1590
  renderSlot(_ctx.$slots, "center")
1518
1591
  ], 6),
1519
- hasRight.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1520
- createVNode(_sfc_main$t, { onChange: changeRight }),
1592
+ hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1593
+ createVNode(_sfc_main$u, { onChange: changeRight }),
1521
1594
  createElementVNode("div", {
1522
1595
  class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
1523
1596
  style: normalizeStyle(`width: ${_ctx.right}px`)
@@ -1610,6 +1683,40 @@ const fillConfig$1 = (config = []) => [
1610
1683
  }
1611
1684
  ]
1612
1685
  },
1686
+ {
1687
+ type: "fieldset",
1688
+ legend: "边框",
1689
+ items: [
1690
+ {
1691
+ name: "borderWidth",
1692
+ text: "宽度",
1693
+ defaultValue: "0"
1694
+ },
1695
+ {
1696
+ name: "borderColor",
1697
+ text: "颜色",
1698
+ type: "colorPicker"
1699
+ },
1700
+ {
1701
+ name: "borderStyle",
1702
+ text: "样式",
1703
+ type: "select",
1704
+ defaultValue: "none",
1705
+ options: [
1706
+ { text: "none", value: "none" },
1707
+ { text: "hidden", value: "hidden" },
1708
+ { text: "dotted", value: "dotted" },
1709
+ { text: "dashed", value: "dashed" },
1710
+ { text: "solid", value: "solid" },
1711
+ { text: "double", value: "double" },
1712
+ { text: "groove", value: "groove" },
1713
+ { text: "ridge", value: "ridge" },
1714
+ { text: "inset", value: "inset" },
1715
+ { text: "outset", value: "outset" }
1716
+ ]
1717
+ }
1718
+ ]
1719
+ },
1613
1720
  {
1614
1721
  type: "fieldset",
1615
1722
  legend: "背景",
@@ -3406,10 +3513,10 @@ const useStage = (stageOptions) => {
3406
3513
  return stage;
3407
3514
  };
3408
3515
 
3409
- const _hoisted_1$h = { class: "m-editor-empty-panel" };
3516
+ const _hoisted_1$i = { class: "m-editor-empty-panel" };
3410
3517
  const _hoisted_2$9 = { class: "m-editor-empty-content" };
3411
3518
  const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
3412
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
3519
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
3413
3520
  ...{
3414
3521
  name: "MEditorAddPageBox"
3415
3522
  },
@@ -3429,14 +3536,14 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
3429
3536
  });
3430
3537
  };
3431
3538
  return (_ctx, _cache) => {
3432
- return openBlock(), createElementBlock("div", _hoisted_1$h, [
3539
+ return openBlock(), createElementBlock("div", _hoisted_1$i, [
3433
3540
  createElementVNode("div", _hoisted_2$9, [
3434
3541
  createElementVNode("div", {
3435
3542
  class: "m-editor-empty-button",
3436
3543
  onClick: clickHandler
3437
3544
  }, [
3438
3545
  createElementVNode("div", null, [
3439
- createVNode(_sfc_main$B, { icon: unref(Plus) }, null, 8, ["icon"])
3546
+ createVNode(_sfc_main$D, { icon: unref(Plus) }, null, 8, ["icon"])
3440
3547
  ]),
3441
3548
  _hoisted_3$4
3442
3549
  ])
@@ -3446,12 +3553,12 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
3446
3553
  }
3447
3554
  });
3448
3555
 
3449
- const _hoisted_1$g = { class: "m-editor" };
3556
+ const _hoisted_1$h = { class: "m-editor" };
3450
3557
  const DEFAULT_LEFT_COLUMN_WIDTH = 310;
3451
3558
  const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
3452
3559
  const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
3453
3560
  const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
3454
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
3561
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
3455
3562
  ...{
3456
3563
  name: "MEditorFramework"
3457
3564
  },
@@ -3460,7 +3567,6 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
3460
3567
  const codeOptions = inject("codeOptions", {});
3461
3568
  const { editorService, uiService } = inject("services") || {};
3462
3569
  const root = computed(() => editorService?.get("root"));
3463
- const nodes = computed(() => editorService?.get("nodes") || []);
3464
3570
  const pageLength = computed(() => editorService?.get("pageLength") || 0);
3465
3571
  const showSrc = computed(() => uiService?.get("showSrc"));
3466
3572
  const leftColumnWidthCacheData = Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY));
@@ -3518,18 +3624,18 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
3518
3624
  }
3519
3625
  };
3520
3626
  return (_ctx, _cache) => {
3521
- return openBlock(), createElementBlock("div", _hoisted_1$g, [
3627
+ return openBlock(), createElementBlock("div", _hoisted_1$h, [
3522
3628
  renderSlot(_ctx.$slots, "header"),
3523
3629
  renderSlot(_ctx.$slots, "nav"),
3524
3630
  renderSlot(_ctx.$slots, "content-before"),
3525
3631
  showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
3526
- createVNode(_sfc_main$u, {
3632
+ createVNode(_sfc_main$v, {
3527
3633
  class: "m-editor-content",
3528
3634
  "init-values": root.value,
3529
3635
  options: unref(codeOptions),
3530
3636
  onSave: saveCode
3531
3637
  }, null, 8, ["init-values", "options"])
3532
- ]) : (openBlock(), createBlock(_sfc_main$s, {
3638
+ ]) : (openBlock(), createBlock(_sfc_main$t, {
3533
3639
  key: 1,
3534
3640
  class: "m-editor-content",
3535
3641
  "left-class": "m-editor-framework-left",
@@ -3548,12 +3654,12 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
3548
3654
  ]),
3549
3655
  center: withCtx(() => [
3550
3656
  pageLength.value > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
3551
- createVNode(_sfc_main$r)
3657
+ createVNode(_sfc_main$s)
3552
3658
  ])
3553
3659
  ]),
3554
3660
  _: 2
3555
3661
  }, [
3556
- pageLength.value > 0 && nodes.value.length === 1 ? {
3662
+ pageLength.value > 0 ? {
3557
3663
  name: "right",
3558
3664
  fn: withCtx(() => [
3559
3665
  createVNode(unref(TMagicScrollbar), null, {
@@ -3573,12 +3679,12 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
3573
3679
  }
3574
3680
  });
3575
3681
 
3576
- const _hoisted_1$f = {
3682
+ const _hoisted_1$g = {
3577
3683
  key: 1,
3578
3684
  class: "menu-item-text"
3579
3685
  };
3580
3686
  const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
3581
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
3687
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
3582
3688
  ...{
3583
3689
  name: "MEditorToolButton"
3584
3690
  },
@@ -3657,7 +3763,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
3657
3763
  _ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
3658
3764
  key: 0,
3659
3765
  direction: _ctx.data.direction || "vertical"
3660
- }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$f, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
3766
+ }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$g, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
3661
3767
  _ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
3662
3768
  key: 0,
3663
3769
  effect: "dark",
@@ -3671,7 +3777,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
3671
3777
  disabled: disabled.value
3672
3778
  }, {
3673
3779
  default: withCtx(() => [
3674
- _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$B, {
3780
+ _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$D, {
3675
3781
  key: 0,
3676
3782
  icon: _ctx.data.icon
3677
3783
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -3688,7 +3794,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
3688
3794
  disabled: disabled.value
3689
3795
  }, {
3690
3796
  default: withCtx(() => [
3691
- _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$B, {
3797
+ _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$D, {
3692
3798
  key: 0,
3693
3799
  icon: _ctx.data.icon
3694
3800
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -3738,7 +3844,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
3738
3844
  }
3739
3845
  });
3740
3846
 
3741
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
3847
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
3742
3848
  ...{
3743
3849
  name: "MEditorNavMenu"
3744
3850
  },
@@ -3900,7 +4006,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
3900
4006
  style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
3901
4007
  }, [
3902
4008
  (openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
3903
- return openBlock(), createBlock(_sfc_main$p, {
4009
+ return openBlock(), createBlock(_sfc_main$q, {
3904
4010
  data: item,
3905
4011
  key: index
3906
4012
  }, null, 8, ["data"]);
@@ -3912,8 +4018,11 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
3912
4018
  }
3913
4019
  });
3914
4020
 
3915
- const _hoisted_1$e = { class: "m-editor-props-panel" };
3916
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
4021
+ const _hoisted_1$f = {
4022
+ key: 0,
4023
+ class: "m-editor-props-panel"
4024
+ };
4025
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
3917
4026
  ...{
3918
4027
  name: "MEditorPropsPanel"
3919
4028
  },
@@ -3926,6 +4035,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3926
4035
  const curFormConfig = ref([]);
3927
4036
  const services = inject("services");
3928
4037
  const node = computed(() => services?.editorService.get("node"));
4038
+ const nodes = computed(() => services?.editorService.get("nodes") || []);
3929
4039
  const propsPanelSize = computed(() => services?.uiService.get("propsPanelSize") || "small");
3930
4040
  const stage = computed(() => services?.editorService.get("stage"));
3931
4041
  const init = async () => {
@@ -3962,7 +4072,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3962
4072
  };
3963
4073
  __expose({ submit });
3964
4074
  return (_ctx, _cache) => {
3965
- return openBlock(), createElementBlock("div", _hoisted_1$e, [
4075
+ return nodes.value.length === 1 ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
3966
4076
  renderSlot(_ctx.$slots, "props-panel-header"),
3967
4077
  createVNode(unref(MForm), {
3968
4078
  ref_key: "configForm",
@@ -3974,12 +4084,12 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3974
4084
  config: curFormConfig.value,
3975
4085
  onChange: submit
3976
4086
  }, null, 8, ["class", "popper-class", "size", "init-values", "config"])
3977
- ]);
4087
+ ])) : createCommentVNode("", true);
3978
4088
  };
3979
4089
  }
3980
4090
  });
3981
4091
 
3982
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
4092
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3983
4093
  ...{
3984
4094
  name: "MEditorSearchInput"
3985
4095
  },
@@ -4014,7 +4124,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
4014
4124
  }
4015
4125
  });
4016
4126
 
4017
- const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
4127
+ const _hoisted_1$e = { xmlns: "http://www.w3.org/2000/svg" };
4018
4128
  const _hoisted_2$7 = /* @__PURE__ */ createElementVNode("g", {
4019
4129
  fill: "#7C878E",
4020
4130
  "fill-rule": "evenodd"
@@ -4028,19 +4138,19 @@ const _hoisted_2$7 = /* @__PURE__ */ createElementVNode("g", {
4028
4138
  const _hoisted_3$3 = [
4029
4139
  _hoisted_2$7
4030
4140
  ];
4031
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
4141
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
4032
4142
  ...{
4033
4143
  name: "MEditorAppManageIcon"
4034
4144
  },
4035
4145
  __name: "AppManageIcon",
4036
4146
  setup(__props) {
4037
4147
  return (_ctx, _cache) => {
4038
- return openBlock(), createElementBlock("svg", _hoisted_1$d, _hoisted_3$3);
4148
+ return openBlock(), createElementBlock("svg", _hoisted_1$e, _hoisted_3$3);
4039
4149
  };
4040
4150
  }
4041
4151
  });
4042
4152
 
4043
- const _hoisted_1$c = {
4153
+ const _hoisted_1$d = {
4044
4154
  viewBox: "0 0 32 32",
4045
4155
  version: "1.1",
4046
4156
  xmlns: "http://www.w3.org/2000/svg",
@@ -4050,19 +4160,19 @@ const _hoisted_2$6 = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1"
4050
4160
  const _hoisted_4$3 = [
4051
4161
  _hoisted_2$6
4052
4162
  ];
4053
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
4163
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
4054
4164
  ...{
4055
4165
  name: "MEditorCodeIcon"
4056
4166
  },
4057
4167
  __name: "CodeIcon",
4058
4168
  setup(__props) {
4059
4169
  return (_ctx, _cache) => {
4060
- return openBlock(), createElementBlock("svg", _hoisted_1$c, _hoisted_4$3);
4170
+ return openBlock(), createElementBlock("svg", _hoisted_1$d, _hoisted_4$3);
4061
4171
  };
4062
4172
  }
4063
4173
  });
4064
4174
 
4065
- const _hoisted_1$b = {
4175
+ const _hoisted_1$c = {
4066
4176
  key: 0,
4067
4177
  class: "m-editor-content-bottom"
4068
4178
  };
@@ -4070,7 +4180,7 @@ const _hoisted_2$5 = {
4070
4180
  key: 1,
4071
4181
  class: "m-editor-content-bottom"
4072
4182
  };
4073
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
4183
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
4074
4184
  ...{
4075
4185
  name: "MEditorCodeDraftEditor"
4076
4186
  },
@@ -4157,7 +4267,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
4157
4267
  return openBlock(), createElementBlock("div", {
4158
4268
  class: normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
4159
4269
  }, [
4160
- createVNode(_sfc_main$u, {
4270
+ createVNode(_sfc_main$v, {
4161
4271
  ref_key: "codeEditor",
4162
4272
  ref: codeEditor,
4163
4273
  class: "m-editor-container",
@@ -4166,7 +4276,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
4166
4276
  language: _ctx.language,
4167
4277
  options: codeOptions.value
4168
4278
  }, null, 8, ["init-values", "language", "options"]),
4169
- _ctx.editable ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
4279
+ _ctx.editable ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
4170
4280
  createVNode(unref(TMagicButton), {
4171
4281
  type: "primary",
4172
4282
  class: "button",
@@ -4222,11 +4332,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
4222
4332
  }
4223
4333
  });
4224
4334
 
4225
- const _hoisted_1$a = { class: "code-name-wrapper" };
4335
+ const _hoisted_1$b = { class: "code-name-wrapper" };
4226
4336
  const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
4227
4337
  const _hoisted_3$2 = { class: "code-name-wrapper" };
4228
4338
  const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "参数", -1);
4229
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
4339
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
4230
4340
  ...{
4231
4341
  name: "MEditorFunctionEditor"
4232
4342
  },
@@ -4242,7 +4352,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
4242
4352
  },
4243
4353
  setup(__props, { expose: __expose }) {
4244
4354
  const props = __props;
4245
- provide("mForm", {});
4355
+ provide("mForm", null);
4246
4356
  const defaultParamColConfig = {
4247
4357
  type: "row",
4248
4358
  label: "参数类型",
@@ -4349,7 +4459,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
4349
4459
  const _component_m_form_table = resolveComponent("m-form-table");
4350
4460
  return openBlock(), createBlock(unref(TMagicCard), { shadow: "never" }, {
4351
4461
  header: withCtx(() => [
4352
- createElementVNode("div", _hoisted_1$a, [
4462
+ createElementVNode("div", _hoisted_1$b, [
4353
4463
  _hoisted_2$4,
4354
4464
  createVNode(unref(TMagicInput), {
4355
4465
  class: "code-name-input",
@@ -4372,7 +4482,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
4372
4482
  ])
4373
4483
  ]),
4374
4484
  default: withCtx(() => [
4375
- createVNode(_sfc_main$j, {
4485
+ createVNode(_sfc_main$k, {
4376
4486
  ref_key: "codeDraftEditor",
4377
4487
  ref: codeDraftEditor,
4378
4488
  id: _ctx.id,
@@ -4391,11 +4501,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
4391
4501
  }
4392
4502
  });
4393
4503
 
4394
- const _hoisted_1$9 = {
4504
+ const _hoisted_1$a = {
4395
4505
  key: 0,
4396
4506
  class: "m-editor-code-block-editor-panel"
4397
4507
  };
4398
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
4508
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
4399
4509
  ...{
4400
4510
  name: "MEditorCodeBlockEditor"
4401
4511
  },
@@ -4452,16 +4562,16 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
4452
4562
  "before-close": handleClose
4453
4563
  }, {
4454
4564
  default: withCtx(() => [
4455
- createVNode(_sfc_main$s, {
4565
+ createVNode(_sfc_main$t, {
4456
4566
  left: left.value,
4457
4567
  "onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
4458
4568
  "min-left": 45,
4459
4569
  class: "code-editor-layout"
4460
4570
  }, {
4461
4571
  center: withCtx(() => [
4462
- !unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
4572
+ !unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$a, [
4463
4573
  renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: id.value }),
4464
- codeConfig.value ? (openBlock(), createBlock(_sfc_main$i, {
4574
+ codeConfig.value ? (openBlock(), createBlock(_sfc_main$j, {
4465
4575
  key: 0,
4466
4576
  ref_key: "functionEditor",
4467
4577
  ref: functionEditor,
@@ -4484,14 +4594,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
4484
4594
  }
4485
4595
  });
4486
4596
 
4487
- const _hoisted_1$8 = { class: "search-wrapper" };
4597
+ const _hoisted_1$9 = { class: "search-wrapper" };
4488
4598
  const _hoisted_2$3 = ["id"];
4489
4599
  const _hoisted_3$1 = { class: "list-item" };
4490
4600
  const _hoisted_4$1 = {
4491
4601
  key: 2,
4492
4602
  class: "right-tool"
4493
4603
  };
4494
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
4604
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
4495
4605
  ...{
4496
4606
  name: "MEditorCodeBlockList"
4497
4607
  },
@@ -4587,8 +4697,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4587
4697
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
4588
4698
  default: withCtx(() => [
4589
4699
  renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
4590
- createElementVNode("div", _hoisted_1$8, [
4591
- createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4700
+ createElementVNode("div", _hoisted_1$9, [
4701
+ createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
4592
4702
  editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
4593
4703
  key: 0,
4594
4704
  class: "create-code-button",
@@ -4623,11 +4733,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4623
4733
  class: "list-container"
4624
4734
  }, [
4625
4735
  createElementVNode("div", _hoisted_3$1, [
4626
- data.type === "code" ? (openBlock(), createBlock(_sfc_main$k, {
4736
+ data.type === "code" ? (openBlock(), createBlock(_sfc_main$l, {
4627
4737
  key: 0,
4628
4738
  class: "codeIcon"
4629
4739
  })) : createCommentVNode("", true),
4630
- data.type === "node" ? (openBlock(), createBlock(_sfc_main$l, {
4740
+ data.type === "node" ? (openBlock(), createBlock(_sfc_main$m, {
4631
4741
  key: 1,
4632
4742
  class: "compIcon"
4633
4743
  })) : createCommentVNode("", true),
@@ -4641,7 +4751,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4641
4751
  placement: "bottom"
4642
4752
  }, {
4643
4753
  default: withCtx(() => [
4644
- createVNode(_sfc_main$B, {
4754
+ createVNode(_sfc_main$D, {
4645
4755
  icon: editable.value ? unref(Edit) : unref(View),
4646
4756
  class: "edit-icon",
4647
4757
  onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
@@ -4656,7 +4766,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4656
4766
  placement: "bottom"
4657
4767
  }, {
4658
4768
  default: withCtx(() => [
4659
- createVNode(_sfc_main$B, {
4769
+ createVNode(_sfc_main$D, {
4660
4770
  icon: unref(Close),
4661
4771
  class: "edit-icon",
4662
4772
  onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -4674,7 +4784,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4674
4784
  ]),
4675
4785
  _: 3
4676
4786
  }, 8, ["default-expanded-keys", "data"]),
4677
- isShowCodeBlockEditor.value ? (openBlock(), createBlock(_sfc_main$h, {
4787
+ isShowCodeBlockEditor.value ? (openBlock(), createBlock(_sfc_main$i, {
4678
4788
  key: 0,
4679
4789
  paramsColConfig: _ctx.paramsColConfig
4680
4790
  }, {
@@ -4690,7 +4800,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4690
4800
  }
4691
4801
  });
4692
4802
 
4693
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
4803
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
4694
4804
  ...{
4695
4805
  name: "MEditorDataSourceConfigPanel"
4696
4806
  },
@@ -4782,21 +4892,21 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4782
4892
  }
4783
4893
  });
4784
4894
 
4785
- const _hoisted_1$7 = { class: "search-wrapper" };
4895
+ const _hoisted_1$8 = { class: "search-wrapper" };
4786
4896
  const _hoisted_2$2 = ["id"];
4787
4897
  const _hoisted_3 = { class: "list-item" };
4788
4898
  const _hoisted_4 = {
4789
4899
  key: 2,
4790
4900
  class: "right-tool"
4791
4901
  };
4792
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
4902
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4793
4903
  ...{
4794
4904
  name: "MEditorDataSourceListPanel"
4795
4905
  },
4796
4906
  __name: "DataSourceListPanel",
4797
4907
  setup(__props) {
4798
4908
  const services = inject("services", {});
4799
- const { dataSourceService, depService } = inject("services") || {};
4909
+ const { dataSourceService, depService, editorService } = inject("services") || {};
4800
4910
  const list = computed(
4801
4911
  () => Object.values(depService?.targets["data-source"] || {}).map((target) => ({
4802
4912
  id: target.id,
@@ -4848,11 +4958,23 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4848
4958
  const filterTextChangeHandler = (val) => {
4849
4959
  tree.value?.filter(val);
4850
4960
  };
4961
+ const selectComp = (compId) => {
4962
+ const stage = editorService?.get("stage");
4963
+ editorService?.select(compId);
4964
+ stage?.select(compId);
4965
+ };
4966
+ const clickHandler = (data, node) => {
4967
+ if (data.type === "node") {
4968
+ selectComp(data.id);
4969
+ } else if (data.type === "key") {
4970
+ selectComp(node.parent.data.id);
4971
+ }
4972
+ };
4851
4973
  return (_ctx, _cache) => {
4852
4974
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
4853
4975
  default: withCtx(() => [
4854
- createElementVNode("div", _hoisted_1$7, [
4855
- createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
4976
+ createElementVNode("div", _hoisted_1$8, [
4977
+ createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
4856
4978
  createVNode(unref(TMagicButton), {
4857
4979
  type: "primary",
4858
4980
  size: "small",
@@ -4873,7 +4995,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4873
4995
  "default-expand-all": "",
4874
4996
  "expand-on-click-node": false,
4875
4997
  data: list.value,
4876
- "highlight-current": true
4998
+ "highlight-current": true,
4999
+ onNodeClick: clickHandler
4877
5000
  }, {
4878
5001
  default: withCtx(({ data }) => [
4879
5002
  createElementVNode("div", {
@@ -4881,12 +5004,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4881
5004
  class: "list-container"
4882
5005
  }, [
4883
5006
  createElementVNode("div", _hoisted_3, [
4884
- data.type === "code" ? (openBlock(), createBlock(_sfc_main$B, {
5007
+ data.type === "code" ? (openBlock(), createBlock(_sfc_main$D, {
4885
5008
  key: 0,
4886
5009
  class: "codeIcon",
4887
5010
  icon: unref(Coin)
4888
5011
  }, null, 8, ["icon"])) : createCommentVNode("", true),
4889
- data.type === "node" ? (openBlock(), createBlock(_sfc_main$B, {
5012
+ data.type === "node" ? (openBlock(), createBlock(_sfc_main$D, {
4890
5013
  key: 1,
4891
5014
  class: "compIcon",
4892
5015
  icon: unref(Aim)
@@ -4901,7 +5024,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4901
5024
  placement: "bottom"
4902
5025
  }, {
4903
5026
  default: withCtx(() => [
4904
- createVNode(_sfc_main$B, {
5027
+ createVNode(_sfc_main$D, {
4905
5028
  class: "edit-icon",
4906
5029
  icon: unref(Edit),
4907
5030
  onClick: withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
@@ -4915,7 +5038,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4915
5038
  placement: "bottom"
4916
5039
  }, {
4917
5040
  default: withCtx(() => [
4918
- createVNode(_sfc_main$B, {
5041
+ createVNode(_sfc_main$D, {
4919
5042
  icon: unref(Close),
4920
5043
  class: "edit-icon",
4921
5044
  onClick: withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
@@ -4933,7 +5056,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4933
5056
  ]),
4934
5057
  _: 3
4935
5058
  }, 8, ["data"]),
4936
- createVNode(_sfc_main$f, {
5059
+ createVNode(_sfc_main$g, {
4937
5060
  ref_key: "editDialog",
4938
5061
  ref: editDialog,
4939
5062
  values: dataSourceValues.value,
@@ -4947,8 +5070,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4947
5070
  }
4948
5071
  });
4949
5072
 
4950
- const _hoisted_1$6 = ["onClick", "onDragstart"];
4951
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
5073
+ const _hoisted_1$7 = ["onClick", "onDragstart"];
5074
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4952
5075
  ...{
4953
5076
  name: "MEditorComponentListPanel"
4954
5077
  },
@@ -4982,14 +5105,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4982
5105
  };
4983
5106
  const dragstartHandler = ({ text, type, data = {} }, e) => {
4984
5107
  if (e.dataTransfer) {
4985
- e.dataTransfer.effectAllowed = "move";
4986
5108
  e.dataTransfer.setData(
4987
- "data",
5109
+ "text/html",
4988
5110
  serialize({
4989
5111
  name: text,
4990
5112
  type,
4991
5113
  ...data
4992
- }).replace(/"(\w+)":\s/g, "$1: ")
5114
+ })
4993
5115
  );
4994
5116
  }
4995
5117
  };
@@ -5017,7 +5139,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5017
5139
  }
5018
5140
  if (timeout || !stage.value)
5019
5141
  return;
5020
- timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
5142
+ timeout = stage.value.delayedMarkContainer(e);
5021
5143
  };
5022
5144
  return (_ctx, _cache) => {
5023
5145
  return openBlock(), createBlock(unref(TMagicScrollbar), null, {
@@ -5028,7 +5150,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5028
5150
  "model-value": collapseValue.value
5029
5151
  }, {
5030
5152
  default: withCtx(() => [
5031
- createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
5153
+ createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
5032
5154
  (openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
5033
5155
  return openBlock(), createElementBlock(Fragment, null, [
5034
5156
  group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
@@ -5036,7 +5158,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5036
5158
  name: `${index}`
5037
5159
  }, {
5038
5160
  title: withCtx(() => [
5039
- createVNode(_sfc_main$B, { icon: unref(Grid) }, null, 8, ["icon"]),
5161
+ createVNode(_sfc_main$D, { icon: unref(Grid) }, null, 8, ["icon"]),
5040
5162
  createTextVNode(toDisplayString(group.title), 1)
5041
5163
  ]),
5042
5164
  default: withCtx(() => [
@@ -5051,7 +5173,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5051
5173
  onDrag: dragHandler
5052
5174
  }, [
5053
5175
  renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
5054
- createVNode(_sfc_main$B, {
5176
+ createVNode(_sfc_main$D, {
5055
5177
  icon: item.icon
5056
5178
  }, null, 8, ["icon"]),
5057
5179
  createVNode(unref(TMagicTooltip), {
@@ -5065,7 +5187,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5065
5187
  _: 2
5066
5188
  }, 1032, ["content"])
5067
5189
  ])
5068
- ], 40, _hoisted_1$6);
5190
+ ], 40, _hoisted_1$7);
5069
5191
  }), 128))
5070
5192
  ]),
5071
5193
  _: 2
@@ -5082,7 +5204,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5082
5204
  }
5083
5205
  });
5084
5206
 
5085
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
5207
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5086
5208
  ...{
5087
5209
  name: "MEditorContentMenu"
5088
5210
  },
@@ -5179,7 +5301,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
5179
5301
  }, [
5180
5302
  createElementVNode("div", null, [
5181
5303
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
5182
- return openBlock(), createBlock(_sfc_main$p, {
5304
+ return openBlock(), createBlock(_sfc_main$q, {
5183
5305
  "event-type": "mouseup",
5184
5306
  data: item,
5185
5307
  key: index,
@@ -5206,7 +5328,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
5206
5328
  }
5207
5329
  });
5208
5330
 
5209
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
5331
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
5210
5332
  ...{
5211
5333
  name: "MEditorLayerMenu"
5212
5334
  },
@@ -5219,6 +5341,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5219
5341
  const services = inject("services");
5220
5342
  const menu = ref();
5221
5343
  const node = computed(() => services?.editorService.get("node"));
5344
+ const nodes = computed(() => services?.editorService.get("nodes"));
5222
5345
  const isRoot = computed(() => node.value?.type === NodeType.ROOT);
5223
5346
  const isPage = computed(() => node.value?.type === NodeType.PAGE);
5224
5347
  const componentList = computed(() => services?.componentListService.getList() || []);
@@ -5270,7 +5393,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5270
5393
  type: "button",
5271
5394
  text: "新增",
5272
5395
  icon: markRaw(Plus),
5273
- display: () => node.value?.items,
5396
+ display: () => node.value?.items && nodes.value?.length === 1,
5274
5397
  items: getSubMenuData.value
5275
5398
  },
5276
5399
  {
@@ -5279,7 +5402,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5279
5402
  icon: markRaw(CopyDocument),
5280
5403
  display: () => !isRoot.value,
5281
5404
  handler: () => {
5282
- node.value && services?.editorService.copy(node.value);
5405
+ node.value && services?.editorService.copy(nodes.value || []);
5283
5406
  }
5284
5407
  },
5285
5408
  {
@@ -5288,7 +5411,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5288
5411
  icon: markRaw(Delete),
5289
5412
  display: () => !isRoot.value && !isPage.value,
5290
5413
  handler: () => {
5291
- node.value && services?.editorService.remove(node.value);
5414
+ node.value && services?.editorService.remove(nodes.value || []);
5292
5415
  }
5293
5416
  },
5294
5417
  ...props.layerContentMenu
@@ -5300,7 +5423,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5300
5423
  show
5301
5424
  });
5302
5425
  return (_ctx, _cache) => {
5303
- return openBlock(), createBlock(_sfc_main$c, {
5426
+ return openBlock(), createBlock(_sfc_main$d, {
5304
5427
  "menu-data": menuData.value,
5305
5428
  ref_key: "menu",
5306
5429
  ref: menu,
@@ -5310,6 +5433,57 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5310
5433
  }
5311
5434
  });
5312
5435
 
5436
+ const _hoisted_1$6 = { class: "layer-node-tool" };
5437
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5438
+ __name: "LayerNode",
5439
+ props: {
5440
+ data: {}
5441
+ },
5442
+ setup(__props) {
5443
+ const props = __props;
5444
+ const services = inject("services");
5445
+ const editorService = services?.editorService;
5446
+ const setNodeVisible = (visible) => {
5447
+ if (!editorService)
5448
+ return;
5449
+ editorService.update({
5450
+ id: props.data.id,
5451
+ visible
5452
+ });
5453
+ };
5454
+ return (_ctx, _cache) => {
5455
+ const _component_el_icon = resolveComponent("el-icon");
5456
+ return openBlock(), createElementBlock(Fragment, null, [
5457
+ createElementVNode("div", null, toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
5458
+ createElementVNode("div", _hoisted_1$6, [
5459
+ _ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5460
+ _ctx.data.visible === false ? (openBlock(), createBlock(_component_el_icon, {
5461
+ key: 0,
5462
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
5463
+ title: "点击显示"
5464
+ }, {
5465
+ default: withCtx(() => [
5466
+ createVNode(unref(Hide))
5467
+ ]),
5468
+ _: 1
5469
+ })) : (openBlock(), createBlock(_component_el_icon, {
5470
+ key: 1,
5471
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
5472
+ class: "node-lock",
5473
+ title: "点击隐藏"
5474
+ }, {
5475
+ default: withCtx(() => [
5476
+ createVNode(unref(View))
5477
+ ]),
5478
+ _: 1
5479
+ }))
5480
+ ], 64)) : createCommentVNode("", true)
5481
+ ])
5482
+ ], 64);
5483
+ };
5484
+ }
5485
+ });
5486
+
5313
5487
  const _hoisted_1$5 = ["id", "onMouseenter"];
5314
5488
  const throttleTime = 150;
5315
5489
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
@@ -5541,14 +5715,16 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5541
5715
  };
5542
5716
  const contextmenu = async (event, data) => {
5543
5717
  event.preventDefault();
5544
- await select(data);
5718
+ if (nodes.value.length < 2) {
5719
+ await select(data);
5720
+ }
5545
5721
  menu.value?.show(event);
5546
5722
  };
5547
5723
  return (_ctx, _cache) => {
5548
5724
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
5549
5725
  default: withCtx(() => [
5550
5726
  renderSlot(_ctx.$slots, "layer-panel-header"),
5551
- createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
5727
+ createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
5552
5728
  values.value.length ? (openBlock(), createBlock(unref(TMagicTree), {
5553
5729
  key: 0,
5554
5730
  class: "magic-editor-layer-tree",
@@ -5588,14 +5764,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5588
5764
  node,
5589
5765
  data
5590
5766
  }, () => [
5591
- createElementVNode("span", null, toDisplayString(`${data.name} (${data.id})`), 1)
5767
+ createVNode(_sfc_main$b, { data }, null, 8, ["data"])
5592
5768
  ])
5593
5769
  ], 40, _hoisted_1$5)
5594
5770
  ]),
5595
5771
  _: 3
5596
5772
  }, 8, ["default-expanded-keys", "default-checked-keys", "current-node-key", "data", "highlight-current", "show-checkbox"])) : createCommentVNode("", true),
5597
5773
  (openBlock(), createBlock(Teleport, { to: "body" }, [
5598
- createVNode(_sfc_main$b, {
5774
+ createVNode(_sfc_main$c, {
5599
5775
  ref_key: "menu",
5600
5776
  ref: menu,
5601
5777
  "layer-content-menu": _ctx.layerContentMenu
@@ -5633,7 +5809,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5633
5809
  type: "component",
5634
5810
  icon: Goods,
5635
5811
  text: "组件",
5636
- component: _sfc_main$d,
5812
+ component: _sfc_main$e,
5637
5813
  slots: {}
5638
5814
  },
5639
5815
  layer: {
@@ -5652,7 +5828,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5652
5828
  type: "component",
5653
5829
  icon: EditPen,
5654
5830
  text: "代码编辑",
5655
- component: _sfc_main$g,
5831
+ component: _sfc_main$h,
5656
5832
  slots: {}
5657
5833
  },
5658
5834
  "data-source": {
@@ -5660,7 +5836,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5660
5836
  type: "component",
5661
5837
  icon: Coin,
5662
5838
  text: "数据源",
5663
- component: _sfc_main$e,
5839
+ component: _sfc_main$f,
5664
5840
  slots: {}
5665
5841
  }
5666
5842
  };
@@ -5692,7 +5868,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5692
5868
  (openBlock(), createElementBlock("div", {
5693
5869
  key: config.text
5694
5870
  }, [
5695
- config.icon ? (openBlock(), createBlock(_sfc_main$B, {
5871
+ config.icon ? (openBlock(), createBlock(_sfc_main$D, {
5696
5872
  key: 0,
5697
5873
  icon: config.icon
5698
5874
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -5920,14 +6096,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5920
6096
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5921
6097
  onClick: addPage
5922
6098
  }, [
5923
- createVNode(_sfc_main$B, { icon: unref(Plus) }, null, 8, ["icon"])
6099
+ createVNode(_sfc_main$D, { icon: unref(Plus) }, null, 8, ["icon"])
5924
6100
  ])) : (openBlock(), createElementBlock("div", _hoisted_1$2)),
5925
6101
  canScroll.value ? (openBlock(), createElementBlock("div", {
5926
6102
  key: 2,
5927
6103
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5928
6104
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
5929
6105
  }, [
5930
- createVNode(_sfc_main$B, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
6106
+ createVNode(_sfc_main$D, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
5931
6107
  ])) : createCommentVNode("", true),
5932
6108
  pageLength.value ? (openBlock(), createElementBlock("div", {
5933
6109
  key: 3,
@@ -5943,7 +6119,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
5943
6119
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5944
6120
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
5945
6121
  }, [
5946
- createVNode(_sfc_main$B, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
6122
+ createVNode(_sfc_main$D, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
5947
6123
  ])) : createCommentVNode("", true)
5948
6124
  ], 512);
5949
6125
  };
@@ -6015,7 +6191,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
6015
6191
  default: withCtx(() => [
6016
6192
  createElementVNode("div", null, [
6017
6193
  renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
6018
- createVNode(_sfc_main$p, {
6194
+ createVNode(_sfc_main$q, {
6019
6195
  data: {
6020
6196
  type: "button",
6021
6197
  text: "复制",
@@ -6023,7 +6199,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
6023
6199
  handler: () => copy(item)
6024
6200
  }
6025
6201
  }, null, 8, ["data"]),
6026
- createVNode(_sfc_main$p, {
6202
+ createVNode(_sfc_main$q, {
6027
6203
  data: {
6028
6204
  type: "button",
6029
6205
  text: "删除",
@@ -6514,7 +6690,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
6514
6690
  };
6515
6691
  __expose({ show });
6516
6692
  return (_ctx, _cache) => {
6517
- return openBlock(), createBlock(_sfc_main$c, {
6693
+ return openBlock(), createBlock(_sfc_main$d, {
6518
6694
  "menu-data": menuData.value,
6519
6695
  ref_key: "menu",
6520
6696
  ref: menu
@@ -6615,9 +6791,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6615
6791
  };
6616
6792
  const dragoverHandler = (e) => {
6617
6793
  e.preventDefault();
6618
- if (e.dataTransfer) {
6619
- e.dataTransfer.dropEffect = "move";
6620
- }
6794
+ if (!e.dataTransfer)
6795
+ return;
6796
+ e.dataTransfer.dropEffect = "move";
6621
6797
  };
6622
6798
  const dropHandler = async (e) => {
6623
6799
  e.preventDefault();
@@ -6629,7 +6805,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6629
6805
  }
6630
6806
  if (e.dataTransfer && parent && stageContainer.value && stage) {
6631
6807
  const parseDSL = getConfig("parseDSL");
6632
- const config = parseDSL(`(${e.dataTransfer.getData("data")})`);
6808
+ const data = e.dataTransfer.getData("text/html");
6809
+ if (!data)
6810
+ return;
6811
+ const config = parseDSL(`(${data})`);
6812
+ if (!config)
6813
+ return;
6633
6814
  const layout = await services?.editorService.getLayout(parent);
6634
6815
  const containerRect = stageContainer.value.getBoundingClientRect();
6635
6816
  const { scrollTop, scrollLeft } = stage.mask;
@@ -7829,6 +8010,9 @@ const createCodeBlockTarget = (id, codeBlock) => new Target({
7829
8010
  id,
7830
8011
  name: codeBlock.name,
7831
8012
  isTarget: (key, value) => {
8013
+ if (id === value) {
8014
+ return true;
8015
+ }
7832
8016
  if (value?.hookType === HookType.CODE && !isEmpty(value.hookData)) {
7833
8017
  const index = value.hookData.findIndex((item) => item.codeId === id);
7834
8018
  return Boolean(index > -1);
@@ -7840,7 +8024,10 @@ const createDataSourceTarget = (id, ds) => new Target({
7840
8024
  type: "data-source",
7841
8025
  id,
7842
8026
  name: ds.title || `${id}`,
7843
- isTarget: (key, value) => typeof value === "string" && value.includes(`${id}`)
8027
+ isTarget: (key, value) => (
8028
+ // 关联数据源对象或者在模板在使用数据源
8029
+ value.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)
8030
+ )
7844
8031
  });
7845
8032
 
7846
8033
  const initServiceState = (props, {
@@ -8093,11 +8280,11 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
8093
8280
  const _sfc_main = defineComponent({
8094
8281
  name: "MEditor",
8095
8282
  components: {
8096
- TMagicNavMenu: _sfc_main$o,
8283
+ TMagicNavMenu: _sfc_main$p,
8097
8284
  Sidebar: _sfc_main$9,
8098
8285
  Workspace: _sfc_main$1,
8099
- PropsPanel: _sfc_main$n,
8100
- Framework: _sfc_main$q
8286
+ PropsPanel: _sfc_main$o,
8287
+ Framework: _sfc_main$r
8101
8288
  },
8102
8289
  props: editorProps,
8103
8290
  emits: ["props-panel-mounted", "update:modelValue"],
@@ -8264,18 +8451,19 @@ const index = {
8264
8451
  app.config.globalProperties.$TMAGIC_EDITOR = option;
8265
8452
  setConfig(option);
8266
8453
  app.component(Editor.name, Editor);
8267
- app.component("m-fields-ui-select", _sfc_main$v);
8268
- app.component("m-fields-code-link", _sfc_main$D);
8269
- app.component("m-fields-vs-code", _sfc_main$E);
8270
- app.component("magic-code-editor", _sfc_main$u);
8271
- app.component("m-fields-code-select", _sfc_main$C);
8272
- app.component("m-fields-code-select-col", _sfc_main$A);
8273
- app.component("m-fields-event-select", _sfc_main$x);
8274
- app.component("m-fields-data-source-fields", _sfc_main$z);
8275
- app.component("m-fields-key-value", _sfc_main$w);
8276
- app.component("m-fields-data-source-input", _sfc_main$y);
8454
+ app.component("m-fields-ui-select", _sfc_main$w);
8455
+ app.component("m-fields-code-link", _sfc_main$F);
8456
+ app.component("m-fields-vs-code", _sfc_main$G);
8457
+ app.component("magic-code-editor", _sfc_main$v);
8458
+ app.component("m-fields-code-select", _sfc_main$E);
8459
+ app.component("m-fields-code-select-col", _sfc_main$C);
8460
+ app.component("m-fields-event-select", _sfc_main$y);
8461
+ app.component("m-fields-data-source-fields", _sfc_main$B);
8462
+ app.component("m-fields-key-value", _sfc_main$x);
8463
+ app.component("m-fields-data-source-input", _sfc_main$A);
8464
+ app.component("m-fields-data-source-select", _sfc_main$z);
8277
8465
  }
8278
8466
  };
8279
8467
 
8280
- export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$g as CodeBlockList, CodeDeleteErrorType, _sfc_main$C as CodeSelect, _sfc_main$A as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, _sfc_main$z as DataSourceFields, _sfc_main$y as DataSourceInput, _sfc_main$x as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$B as Icon, KeyBindingCommand, _sfc_main$w as KeyValue, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$s as LayoutContainer, _sfc_main$n as PropsPanel, _sfc_main$s as SplitView, _sfc_main$u as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$p as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, editorService, error, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
8468
+ export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$h as CodeBlockList, CodeDeleteErrorType, _sfc_main$E as CodeSelect, _sfc_main$C as CodeSelectCol, ColumnLayout, _sfc_main$e as ComponentListPanel, _sfc_main$d as ContentMenu, _sfc_main$B as DataSourceFields, _sfc_main$A as DataSourceInput, _sfc_main$z as DataSourceSelect, _sfc_main$y as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$D as Icon, KeyBindingCommand, _sfc_main$x as KeyValue, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$t as LayoutContainer, _sfc_main$o as PropsPanel, _sfc_main$u as Resizer, _sfc_main$t as SplitView, _sfc_main$v as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$q as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, editorService, error, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
8281
8469
  //# sourceMappingURL=tmagic-editor.js.map