@tmagic/editor 1.3.12 → 1.3.14

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('@tmagic/design'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/form'), require('@tmagic/table'), require('@tmagic/utils'), require('gesto'), require('moveable'), require('@tmagic/dep'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', '@tmagic/design', 'emmet-monaco-es', 'monaco-editor', '@tmagic/schema', '@tmagic/form', '@tmagic/table', '@tmagic/utils', 'gesto', 'moveable', '@tmagic/dep', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.design, global.emmetMonacoEs, global.monaco, global.schema, global.form, global.table, global.utils, global.Gesto, global.Moveable, global.dep, global.StageCore, global.events, global.core, global.KeyController));
5
- })(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, schema, form, table, utils, Gesto, Moveable, dep, StageCore, events, core, KeyController) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.design, global.emmetMonacoEs, global.monaco, global.schema, global.form, global.table, global.utils, global.Gesto, global.VanillaMoveable, global.dep, global.StageCore, global.events, global.core, global.KeyController));
5
+ })(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, schema, form, table, utils, Gesto, VanillaMoveable, dep, StageCore, events, core, KeyController) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
@@ -367,13 +367,38 @@
367
367
  name: "hookData",
368
368
  enableToggleMode: false,
369
369
  expandAll: true,
370
- titleKey: "codeId",
370
+ title: (mForm, { model, index }) => {
371
+ if (model.codeType === schema.HookCodeType.DATA_SOURCE_METHOD) {
372
+ if (Array.isArray(model.codeId)) {
373
+ const ds = services?.dataSourceService.getDataSourceById(model.codeId[0]);
374
+ return `${ds?.title} / ${model.codeId[1]}`;
375
+ }
376
+ return Array.isArray(model.codeId) ? model.codeId.join("/") : index;
377
+ }
378
+ return model.codeId || index;
379
+ },
371
380
  items: [
372
381
  {
373
- type: "code-select-col",
374
- name: "codeId",
375
- labelWidth: 0,
376
- disabled: () => !services?.codeBlockService.getEditStatus()
382
+ type: "row",
383
+ items: [
384
+ {
385
+ type: "select",
386
+ name: "codeType",
387
+ span: 8,
388
+ options: [
389
+ { value: schema.HookCodeType.CODE, text: "代码块" },
390
+ { value: schema.HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
391
+ ],
392
+ defaultValue: "code"
393
+ },
394
+ {
395
+ type: (mForm, { model }) => model.codeType === schema.HookCodeType.DATA_SOURCE_METHOD ? "data-source-method-select" : "code-select-col",
396
+ name: "codeId",
397
+ span: 16,
398
+ labelWidth: 0,
399
+ disabled: () => !services?.codeBlockService.getEditStatus()
400
+ }
401
+ ]
377
402
  }
378
403
  ]
379
404
  }));
@@ -2998,6 +3023,7 @@
2998
3023
  this.addModifiedNodeId(config.id);
2999
3024
  this.addModifiedNodeId(parent.id);
3000
3025
  this.pushHistoryState();
3026
+ this.emit("drag-to", { index, targetIndex, config, parent, targetParent });
3001
3027
  }
3002
3028
  /**
3003
3029
  * 撤销当前操作
@@ -3463,8 +3489,8 @@
3463
3489
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true)
3464
3490
  ]),
3465
3491
  paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
3466
- key: 0,
3467
3492
  name: "params",
3493
+ key: _ctx.model[_ctx.name],
3468
3494
  model: _ctx.model,
3469
3495
  size: _ctx.size,
3470
3496
  "params-config": paramsConfig.value,
@@ -5223,14 +5249,17 @@
5223
5249
  const selectNode = async (id) => {
5224
5250
  await services?.editorService.select(id);
5225
5251
  services?.editorService.get("stage")?.select(id);
5252
+ services?.stageOverlayService.get("stage")?.select(id);
5226
5253
  };
5227
5254
  const highlight = lodashEs.throttle((id) => {
5228
5255
  services?.editorService.highlight(id);
5229
5256
  services?.editorService.get("stage")?.highlight(id);
5257
+ services?.stageOverlayService.get("stage")?.highlight(id);
5230
5258
  }, 150);
5231
5259
  const unhightlight = () => {
5232
5260
  services?.editorService.set("highlightNode", null);
5233
5261
  services?.editorService.get("stage")?.clearHighlight();
5262
+ services?.stageOverlayService.get("stage")?.clearHighlight();
5234
5263
  };
5235
5264
  return (_ctx, _cache) => {
5236
5265
  return uiSelectMode.value ? (vue.openBlock(), vue.createElementBlock("div", {
@@ -5677,7 +5706,7 @@
5677
5706
  ])
5678
5707
  ]),
5679
5708
  _: 1
5680
- }, 8, ["disabled"])) : _ctx.data.type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.data.component), vue.normalizeProps(vue.mergeProps({ key: 4 }, _ctx.data.props || {})), null, 16)) : vue.createCommentVNode("", true)
5709
+ }, 8, ["disabled"])) : _ctx.data.type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.data.component), vue.mergeProps({ key: 4 }, _ctx.data.props || {}, vue.toHandlers(_ctx.data.listeners || {})), null, 16)) : vue.createCommentVNode("", true)
5681
5710
  ], 34)) : vue.createCommentVNode("", true);
5682
5711
  };
5683
5712
  }
@@ -5953,7 +5982,7 @@
5953
5982
  );
5954
5983
  vue.watch(active, (active2) => {
5955
5984
  if (active2 === schema.NodeType.PAGE) {
5956
- if (!activePage.value) {
5985
+ if (!activePage.value && !pageList.value.length) {
5957
5986
  editorService?.selectRoot();
5958
5987
  return;
5959
5988
  }
@@ -5961,11 +5990,11 @@
5961
5990
  return;
5962
5991
  }
5963
5992
  if (active2 === schema.NodeType.PAGE_FRAGMENT) {
5964
- if (!activePageFragment.value) {
5993
+ if (!activePageFragment.value && !pageFragmentList.value.length) {
5965
5994
  editorService?.selectRoot();
5966
5995
  return;
5967
5996
  }
5968
- switchPage(activePageFragment.value);
5997
+ switchPage(activePageFragment.value || pageFragmentList.value[0].id);
5969
5998
  }
5970
5999
  });
5971
6000
  const switchPage = (id) => {
@@ -6512,108 +6541,141 @@
6512
6541
  }
6513
6542
  });
6514
6543
 
6544
+ const _hoisted_1$a = { class: "m-editor-float-box-body" };
6545
+ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
6546
+ __name: "FloatingBox",
6547
+ props: {
6548
+ visible: { type: Boolean, default: false },
6549
+ position: { default: () => ({ left: 0, top: 0 }) },
6550
+ rect: { default: () => ({ width: "auto", height: "auto" }) },
6551
+ title: { default: "" }
6552
+ },
6553
+ emits: ["update:visible"],
6554
+ setup(__props, { expose: __expose, emit: __emit }) {
6555
+ const props = __props;
6556
+ const emit = __emit;
6557
+ const target = vue.ref();
6558
+ const dragTarget = vue.ref();
6559
+ const style = vue.computed(() => ({
6560
+ left: `${props.position.left}px`,
6561
+ top: `${props.position.top}px`,
6562
+ width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
6563
+ height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
6564
+ }));
6565
+ let moveable = null;
6566
+ const initMoveable = () => {
6567
+ moveable = new VanillaMoveable(globalThis.document.body, {
6568
+ className: "m-editor-floating-box-moveable",
6569
+ target: target.value,
6570
+ draggable: true,
6571
+ resizable: true,
6572
+ edge: true,
6573
+ keepRatio: false,
6574
+ origin: false,
6575
+ snappable: true,
6576
+ dragTarget: dragTarget.value,
6577
+ dragTargetSelf: false,
6578
+ linePadding: 10,
6579
+ controlPadding: 10
6580
+ });
6581
+ moveable.on("drag", (e) => {
6582
+ e.target.style.transform = e.transform;
6583
+ });
6584
+ moveable.on("resize", (e) => {
6585
+ e.target.style.width = `${e.width}px`;
6586
+ e.target.style.height = `${e.height}px`;
6587
+ e.target.style.transform = e.drag.transform;
6588
+ });
6589
+ };
6590
+ const destroyMoveable = () => {
6591
+ moveable?.destroy();
6592
+ moveable = null;
6593
+ };
6594
+ vue.watch(
6595
+ () => props.visible,
6596
+ async (visible) => {
6597
+ if (visible) {
6598
+ await vue.nextTick();
6599
+ initMoveable();
6600
+ } else {
6601
+ destroyMoveable();
6602
+ }
6603
+ },
6604
+ {
6605
+ immediate: true
6606
+ }
6607
+ );
6608
+ vue.onBeforeUnmount(() => {
6609
+ destroyMoveable();
6610
+ });
6611
+ const closeHandler = () => {
6612
+ emit("update:visible", false);
6613
+ };
6614
+ __expose({
6615
+ target
6616
+ });
6617
+ return (_ctx, _cache) => {
6618
+ return _ctx.visible ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
6619
+ key: 0,
6620
+ to: "body"
6621
+ }, [
6622
+ vue.createElementVNode("div", {
6623
+ ref_key: "target",
6624
+ ref: target,
6625
+ class: "m-editor-float-box",
6626
+ style: vue.normalizeStyle(style.value)
6627
+ }, [
6628
+ vue.createElementVNode("div", {
6629
+ ref_key: "dragTarget",
6630
+ ref: dragTarget,
6631
+ class: "m-editor-float-box-title"
6632
+ }, [
6633
+ vue.renderSlot(_ctx.$slots, "title", {}, () => [
6634
+ vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
6635
+ ]),
6636
+ vue.createElementVNode("div", null, [
6637
+ vue.createVNode(vue.unref(design.TMagicButton), {
6638
+ link: "",
6639
+ size: "small",
6640
+ icon: vue.unref(iconsVue.Close),
6641
+ onClick: closeHandler
6642
+ }, null, 8, ["icon"])
6643
+ ])
6644
+ ], 512),
6645
+ vue.createElementVNode("div", _hoisted_1$a, [
6646
+ vue.renderSlot(_ctx.$slots, "body")
6647
+ ])
6648
+ ], 4)
6649
+ ])) : vue.createCommentVNode("", true);
6650
+ };
6651
+ }
6652
+ });
6653
+
6515
6654
  const useFloatBox = (slideKeys) => {
6516
- const services = vue.inject("services");
6517
- const moveable = vue.ref();
6518
- const floatBox = vue.ref();
6519
- const floatBoxStates = vue.computed(() => services?.uiService.get("floatBox"));
6520
- const curKey = vue.ref("");
6521
- const target = vue.computed(
6522
- () => floatBox.value ? floatBox.value.find((item) => item.classList.contains(`m-editor-float-box-${curKey.value}`)) : void 0
6655
+ const floatBoxStates = vue.ref(
6656
+ slideKeys.value.reduce(
6657
+ (total, cur) => ({
6658
+ ...total,
6659
+ [cur]: {
6660
+ status: false,
6661
+ top: 0,
6662
+ left: 0
6663
+ }
6664
+ }),
6665
+ {}
6666
+ )
6523
6667
  );
6524
6668
  const showingBoxKeys = vue.computed(
6525
- () => [...floatBoxStates.value?.keys() ?? []].filter((key) => floatBoxStates.value?.get(key)?.status)
6669
+ () => Object.keys(floatBoxStates.value).filter((key) => floatBoxStates.value[key].status)
6526
6670
  );
6527
6671
  const isDraging = vue.ref(false);
6528
- const showFloatBox = async (key) => {
6529
- const curBoxStatus = floatBoxStates.value?.get(curKey.value)?.status;
6530
- if (curKey.value === key && curBoxStatus)
6531
- return;
6532
- curKey.value = key;
6533
- setSlideState(key, {
6534
- zIndex: getMaxZIndex() + 1,
6535
- status: true
6536
- });
6537
- await vue.nextTick();
6538
- if (moveable.value) {
6539
- moveable.value.target = target.value;
6540
- moveable.value.dragTarget = getDragTarget();
6541
- moveable.value.updateRect();
6542
- } else {
6543
- initFloatBoxMoveable();
6544
- }
6545
- };
6546
- const setSlideState = (key, data) => {
6547
- const slideState = floatBoxStates.value?.get(key);
6548
- if (!slideState)
6549
- return;
6550
- floatBoxStates.value?.set(key, {
6551
- ...slideState,
6552
- ...data
6553
- });
6554
- };
6555
- const getDragTarget = (key) => `.m-editor-float-box-header-${key ?? curKey.value}`;
6556
- const closeFloatBox = (key) => {
6557
- setSlideState(key, {
6558
- status: false
6559
- });
6560
- if (!floatBoxStates.value?.values)
6561
- return;
6562
- const keys = [...floatBoxStates.value?.keys()];
6563
- const values = [...floatBoxStates.value?.values()];
6564
- const lastFloatBoxLen = values.filter((state) => state.status).length;
6565
- if (lastFloatBoxLen === 0) {
6566
- moveable.value?.destroy();
6567
- moveable.value = void 0;
6568
- return;
6569
- }
6570
- if (key === curKey.value) {
6571
- const zIndexList = values.filter((item) => item.status).map((item) => item.zIndex);
6572
- const maxZIndex = Math.max(...zIndexList);
6573
- const key2 = keys.find((key3) => floatBoxStates.value?.get(key3)?.zIndex === maxZIndex);
6574
- if (!key2)
6575
- return;
6576
- showFloatBox(key2);
6577
- }
6578
- };
6579
- const getMaxZIndex = () => {
6580
- if (!floatBoxStates.value?.values())
6581
- return 0;
6582
- const list = [...floatBoxStates.value?.values()].map((state) => state.zIndex);
6583
- return Math.max(...list) ?? 0;
6584
- };
6585
- const initFloatBoxMoveable = () => {
6586
- const dragTarget = getDragTarget();
6587
- moveable.value = new Moveable(document.body, {
6588
- target: target.value,
6589
- draggable: true,
6590
- resizable: true,
6591
- edge: true,
6592
- keepRatio: false,
6593
- origin: false,
6594
- snappable: true,
6595
- dragTarget,
6596
- dragTargetSelf: false,
6597
- linePadding: 10,
6598
- controlPadding: 10,
6599
- elementGuidelines: [...floatBoxStates.value?.keys() ?? []].map((key) => getDragTarget(key)),
6600
- bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
6601
- });
6602
- moveable.value.on("drag", (e) => {
6603
- e.target.style.transform = e.transform;
6604
- });
6605
- moveable.value.on("resize", (e) => {
6606
- e.target.style.width = `${e.width}px`;
6607
- e.target.style.height = `${e.height}px`;
6608
- e.target.style.transform = e.drag.transform;
6609
- });
6610
- };
6672
+ const dragstartHandler = () => isDraging.value = true;
6611
6673
  const dragendHandler = (key, e) => {
6612
- setSlideState(key, {
6674
+ floatBoxStates.value[key] = {
6613
6675
  left: e.clientX,
6614
- top: e.clientY
6615
- });
6616
- showFloatBox(key);
6676
+ top: e.clientY,
6677
+ status: true
6678
+ };
6617
6679
  isDraging.value = false;
6618
6680
  };
6619
6681
  document.body.addEventListener("dragover", (e) => {
@@ -6621,11 +6683,18 @@
6621
6683
  return;
6622
6684
  e.preventDefault();
6623
6685
  });
6624
- const dragstartHandler = () => isDraging.value = true;
6625
6686
  vue.watch(
6626
6687
  () => slideKeys.value,
6627
6688
  () => {
6628
- services?.uiService.setFloatBox(slideKeys.value);
6689
+ for (const key in slideKeys.value) {
6690
+ if (floatBoxStates.value[key])
6691
+ continue;
6692
+ floatBoxStates.value[key] = {
6693
+ status: false,
6694
+ top: 0,
6695
+ left: 0
6696
+ };
6697
+ }
6629
6698
  },
6630
6699
  {
6631
6700
  deep: true,
@@ -6633,17 +6702,14 @@
6633
6702
  }
6634
6703
  );
6635
6704
  return {
6636
- showFloatBox,
6637
- closeFloatBox,
6638
6705
  dragstartHandler,
6639
6706
  dragendHandler,
6640
6707
  floatBoxStates,
6641
- floatBox,
6642
6708
  showingBoxKeys
6643
6709
  };
6644
6710
  };
6645
6711
 
6646
- const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
6712
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
6647
6713
  ...{
6648
6714
  name: "MEditorSearchInput"
6649
6715
  },
@@ -6694,14 +6760,14 @@
6694
6760
  });
6695
6761
  };
6696
6762
 
6697
- const _hoisted_1$a = ["draggable", "data-node-id", "data-is-container"];
6763
+ const _hoisted_1$9 = ["draggable", "data-node-id", "data-is-container"];
6698
6764
  const _hoisted_2$6 = { class: "tree-node-label" };
6699
6765
  const _hoisted_3$3 = { class: "tree-node-tool" };
6700
6766
  const _hoisted_4$3 = {
6701
6767
  key: 0,
6702
6768
  class: "m-editor-tree-node-children"
6703
6769
  };
6704
- const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
6770
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
6705
6771
  ...{
6706
6772
  name: "MEditorTreeNode"
6707
6773
  },
@@ -6811,18 +6877,18 @@
6811
6877
  }, 1032, ["data", "node-status-map", "indent"]);
6812
6878
  }), 128))
6813
6879
  ])) : vue.createCommentVNode("", true)
6814
- ], 40, _hoisted_1$a)), [
6880
+ ], 40, _hoisted_1$9)), [
6815
6881
  [vue.vShow, visible.value]
6816
6882
  ]);
6817
6883
  };
6818
6884
  }
6819
6885
  });
6820
6886
 
6821
- const _hoisted_1$9 = {
6887
+ const _hoisted_1$8 = {
6822
6888
  key: 1,
6823
6889
  class: "m-editor-tree-empty"
6824
6890
  };
6825
- const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
6891
+ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6826
6892
  ...{
6827
6893
  name: "MEditorTree"
6828
6894
  },
@@ -6846,7 +6912,7 @@
6846
6912
  onDragover: handleDragOver
6847
6913
  }, [
6848
6914
  _ctx.data?.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.data, (item) => {
6849
- return vue.openBlock(), vue.createBlock(_sfc_main$o, {
6915
+ return vue.openBlock(), vue.createBlock(_sfc_main$n, {
6850
6916
  key: item.id,
6851
6917
  data: item,
6852
6918
  indent: _ctx.indent,
@@ -6863,7 +6929,7 @@
6863
6929
  ]),
6864
6930
  _: 2
6865
6931
  }, 1032, ["data", "indent", "node-status-map"]);
6866
- }), 128)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
6932
+ }), 128)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
6867
6933
  vue.createElementVNode("p", null, vue.toDisplayString(_ctx.emptyText), 1)
6868
6934
  ]))
6869
6935
  ], 32);
@@ -6943,7 +7009,7 @@
6943
7009
  };
6944
7010
  };
6945
7011
 
6946
- const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
7012
+ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
6947
7013
  ...{
6948
7014
  name: "MEditorCodeBlockList"
6949
7015
  },
@@ -7025,7 +7091,7 @@
7025
7091
  filter: filterTextChangeHandler
7026
7092
  });
7027
7093
  return (_ctx, _cache) => {
7028
- return vue.openBlock(), vue.createBlock(_sfc_main$n, {
7094
+ return vue.openBlock(), vue.createBlock(_sfc_main$m, {
7029
7095
  data: codeList.value,
7030
7096
  "node-status-map": vue.unref(nodeStatusMap),
7031
7097
  onNodeClick: clickHandler
@@ -7081,8 +7147,8 @@
7081
7147
  }
7082
7148
  });
7083
7149
 
7084
- const _hoisted_1$8 = { class: "search-wrapper" };
7085
- const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
7150
+ const _hoisted_1$7 = { class: "search-wrapper" };
7151
+ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
7086
7152
  ...{
7087
7153
  name: "MEditorCodeBlockListPanel"
7088
7154
  },
@@ -7104,8 +7170,8 @@
7104
7170
  vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
7105
7171
  default: vue.withCtx(() => [
7106
7172
  vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
7107
- vue.createElementVNode("div", _hoisted_1$8, [
7108
- vue.createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
7173
+ vue.createElementVNode("div", _hoisted_1$7, [
7174
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7109
7175
  editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
7110
7176
  key: 0,
7111
7177
  class: "create-code-button",
@@ -7121,7 +7187,7 @@
7121
7187
  vue.renderSlot(_ctx.$slots, "code-block-panel-search")
7122
7188
  ])
7123
7189
  ]),
7124
- vue.createVNode(_sfc_main$m, {
7190
+ vue.createVNode(_sfc_main$l, {
7125
7191
  ref_key: "codeBlockList",
7126
7192
  ref: codeBlockList,
7127
7193
  "custom-error": _ctx.customError,
@@ -7153,7 +7219,7 @@
7153
7219
  }
7154
7220
  });
7155
7221
 
7156
- const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
7222
+ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
7157
7223
  ...{
7158
7224
  name: "MEditorDataSourceConfigPanel"
7159
7225
  },
@@ -7209,7 +7275,7 @@
7209
7275
  }
7210
7276
  });
7211
7277
 
7212
- const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
7278
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
7213
7279
  ...{
7214
7280
  name: "MEditorDataSourceList"
7215
7281
  },
@@ -7298,7 +7364,7 @@
7298
7364
  filter: filterTextChangeHandler
7299
7365
  });
7300
7366
  return (_ctx, _cache) => {
7301
- return vue.openBlock(), vue.createBlock(_sfc_main$n, {
7367
+ return vue.openBlock(), vue.createBlock(_sfc_main$m, {
7302
7368
  data: list.value,
7303
7369
  "node-status-map": vue.unref(nodeStatusMap),
7304
7370
  onNodeClick: clickHandler
@@ -7351,9 +7417,9 @@
7351
7417
  }
7352
7418
  });
7353
7419
 
7354
- const _hoisted_1$7 = { class: "search-wrapper" };
7420
+ const _hoisted_1$6 = { class: "search-wrapper" };
7355
7421
  const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
7356
- const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
7422
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
7357
7423
  ...{
7358
7424
  name: "MEditorDataSourceListPanel"
7359
7425
  },
@@ -7417,8 +7483,8 @@
7417
7483
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
7418
7484
  vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
7419
7485
  default: vue.withCtx(() => [
7420
- vue.createElementVNode("div", _hoisted_1$7, [
7421
- vue.createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
7486
+ vue.createElementVNode("div", _hoisted_1$6, [
7487
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7422
7488
  editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
7423
7489
  key: 0,
7424
7490
  placement: "right"
@@ -7453,14 +7519,14 @@
7453
7519
  _: 1
7454
7520
  })) : vue.createCommentVNode("", true)
7455
7521
  ]),
7456
- vue.createVNode(_sfc_main$j, {
7522
+ vue.createVNode(_sfc_main$i, {
7457
7523
  onEdit: editHandler,
7458
7524
  onRemove: removeHandler
7459
7525
  })
7460
7526
  ]),
7461
7527
  _: 1
7462
7528
  }),
7463
- vue.createVNode(_sfc_main$k, {
7529
+ vue.createVNode(_sfc_main$j, {
7464
7530
  ref_key: "editDialog",
7465
7531
  ref: editDialog,
7466
7532
  disabled: !editable.value,
@@ -7474,7 +7540,7 @@
7474
7540
  }
7475
7541
  });
7476
7542
 
7477
- const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
7543
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
7478
7544
  ...{
7479
7545
  name: "MEditorContentMenu"
7480
7546
  },
@@ -7640,7 +7706,7 @@
7640
7706
  }
7641
7707
  });
7642
7708
 
7643
- const _hoisted_1$6 = {
7709
+ const _hoisted_1$5 = {
7644
7710
  width: "1em",
7645
7711
  height: "1em",
7646
7712
  viewBox: "0 0 16 16",
@@ -7660,14 +7726,14 @@
7660
7726
  _hoisted_2$4,
7661
7727
  _hoisted_3$2
7662
7728
  ];
7663
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
7729
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
7664
7730
  ...{
7665
7731
  name: "MEditorFolderMinusIcon"
7666
7732
  },
7667
7733
  __name: "FolderMinusIcon",
7668
7734
  setup(__props) {
7669
7735
  return (_ctx, _cache) => {
7670
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, _hoisted_4$2);
7736
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$5, _hoisted_4$2);
7671
7737
  };
7672
7738
  }
7673
7739
  });
@@ -7745,7 +7811,7 @@
7745
7811
  };
7746
7812
  };
7747
7813
 
7748
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
7814
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
7749
7815
  ...{
7750
7816
  name: "MEditorLayerMenu"
7751
7817
  },
@@ -7812,7 +7878,7 @@
7812
7878
  {
7813
7879
  type: "button",
7814
7880
  text: "全部折叠",
7815
- icon: _sfc_main$g,
7881
+ icon: _sfc_main$f,
7816
7882
  display: () => utils.isPage(node.value) || utils.isPageFragment(node.value),
7817
7883
  handler: () => {
7818
7884
  emit("collapse-all");
@@ -7841,7 +7907,7 @@
7841
7907
  show
7842
7908
  });
7843
7909
  return (_ctx, _cache) => {
7844
- return vue.openBlock(), vue.createBlock(_sfc_main$h, {
7910
+ return vue.openBlock(), vue.createBlock(_sfc_main$g, {
7845
7911
  "menu-data": menuData.value,
7846
7912
  ref_key: "menu",
7847
7913
  ref: menu,
@@ -7851,7 +7917,7 @@
7851
7917
  }
7852
7918
  });
7853
7919
 
7854
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
7920
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
7855
7921
  __name: "LayerNodeTool",
7856
7922
  props: {
7857
7923
  data: {}
@@ -7898,6 +7964,7 @@
7898
7964
  } else {
7899
7965
  await services?.editorService.select(data);
7900
7966
  services?.editorService.get("stage")?.select(data.id);
7967
+ services?.stageOverlayService.get("stage")?.select(data.id);
7901
7968
  }
7902
7969
  };
7903
7970
  const multiSelect = async (data) => {
@@ -7916,6 +7983,7 @@
7916
7983
  }
7917
7984
  await services?.editorService.multiSelect(newNodes);
7918
7985
  services?.editorService.get("stage")?.multiSelect(newNodes);
7986
+ services?.stageOverlayService.get("stage")?.multiSelect(newNodes);
7919
7987
  };
7920
7988
  const throttleTime = 300;
7921
7989
  const highlightHandler = lodashEs.throttle((event, data) => {
@@ -7924,6 +7992,7 @@
7924
7992
  const highlight = (data) => {
7925
7993
  services?.editorService?.highlight(data);
7926
7994
  services?.editorService?.get("stage")?.highlight(data.id);
7995
+ services?.stageOverlayService?.get("stage")?.highlight(data.id);
7927
7996
  };
7928
7997
  const nodeClickHandler = (event, data) => {
7929
7998
  if (!nodeStatusMap?.value)
@@ -7945,7 +8014,7 @@
7945
8014
  return {
7946
8015
  menu,
7947
8016
  nodeClickHandler,
7948
- nodeContentmenuHandler(event, data) {
8017
+ nodeContentMenuHandler(event, data) {
7949
8018
  event.preventDefault();
7950
8019
  const nodes = services?.editorService.get("nodes") || [];
7951
8020
  if (nodes.length < 2 || !nodes.includes(data)) {
@@ -8271,12 +8340,12 @@
8271
8340
  () => page.value ? nodeStatusMaps.value.get(page.value.id) : /* @__PURE__ */ new Map()
8272
8341
  );
8273
8342
  vue.watch(
8274
- page,
8275
- (page2) => {
8276
- if (!page2) {
8343
+ () => page.value?.id,
8344
+ (pageId) => {
8345
+ if (!pageId) {
8277
8346
  return;
8278
8347
  }
8279
- nodeStatusMaps.value.set(page2.id, createPageNodeStatus(page2, nodeStatusMaps.value.get(page2.id)));
8348
+ nodeStatusMaps.value.set(pageId, createPageNodeStatus(page.value, nodeStatusMaps.value.get(pageId)));
8280
8349
  },
8281
8350
  {
8282
8351
  immediate: true
@@ -8304,6 +8373,8 @@
8304
8373
  );
8305
8374
  services?.editorService.on("add", (newNodes) => {
8306
8375
  newNodes.forEach((node) => {
8376
+ if (utils.isPage(node) || utils.isPageFragment(node))
8377
+ return;
8307
8378
  traverseNode(node, (node2) => {
8308
8379
  nodeStatusMap.value?.set(node2.id, {
8309
8380
  visible: true,
@@ -8327,7 +8398,7 @@
8327
8398
  };
8328
8399
  };
8329
8400
 
8330
- const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
8401
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
8331
8402
  ...{
8332
8403
  name: "MEditorLayerPanel"
8333
8404
  },
@@ -8369,15 +8440,15 @@
8369
8440
  const {
8370
8441
  menu,
8371
8442
  nodeClickHandler,
8372
- nodeContentmenuHandler,
8443
+ nodeContentMenuHandler,
8373
8444
  highlightHandler: mouseenterHandler
8374
8445
  } = useClick(services, isCtrlKeyDown, nodeStatusMap);
8375
8446
  return (_ctx, _cache) => {
8376
8447
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-layer-panel" }, {
8377
8448
  default: vue.withCtx(() => [
8378
8449
  vue.renderSlot(_ctx.$slots, "layer-panel-header"),
8379
- vue.createVNode(_sfc_main$p, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
8380
- page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
8450
+ vue.createVNode(_sfc_main$o, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
8451
+ page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$m, {
8381
8452
  key: 0,
8382
8453
  tabindex: "-1",
8383
8454
  ref_key: "tree",
@@ -8388,7 +8459,7 @@
8388
8459
  onNodeDragstart: vue.unref(handleDragStart),
8389
8460
  onNodeDragleave: vue.unref(handleDragLeave),
8390
8461
  onNodeDragend: vue.unref(handleDragEnd),
8391
- onNodeContextmenu: vue.unref(nodeContentmenuHandler),
8462
+ onNodeContextmenu: vue.unref(nodeContentMenuHandler),
8392
8463
  onNodeMouseenter: vue.unref(mouseenterHandler),
8393
8464
  onNodeClick: vue.unref(nodeClickHandler)
8394
8465
  }, {
@@ -8397,7 +8468,7 @@
8397
8468
  ]),
8398
8469
  "tree-node-tool": vue.withCtx(({ data: nodeData2 }) => [
8399
8470
  vue.renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData2 }, () => [
8400
- vue.createVNode(_sfc_main$e, { data: nodeData2 }, null, 8, ["data"])
8471
+ vue.createVNode(_sfc_main$d, { data: nodeData2 }, null, 8, ["data"])
8401
8472
  ])
8402
8473
  ]),
8403
8474
  "tree-node-label": vue.withCtx(({ data: nodeData2 }) => [
@@ -8406,7 +8477,7 @@
8406
8477
  _: 3
8407
8478
  }, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : vue.createCommentVNode("", true),
8408
8479
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
8409
- vue.createVNode(_sfc_main$f, {
8480
+ vue.createVNode(_sfc_main$e, {
8410
8481
  ref_key: "menu",
8411
8482
  ref: menu,
8412
8483
  "layer-content-menu": _ctx.layerContentMenu,
@@ -8421,9 +8492,9 @@
8421
8492
  }
8422
8493
  });
8423
8494
 
8424
- const _hoisted_1$5 = ["onClick", "onDragstart"];
8495
+ const _hoisted_1$4 = ["onClick", "onDragstart"];
8425
8496
  const _hoisted_2$3 = ["title"];
8426
- const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
8497
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
8427
8498
  ...{
8428
8499
  name: "MEditorComponentListPanel"
8429
8500
  },
@@ -8503,7 +8574,7 @@
8503
8574
  "model-value": collapseValue.value
8504
8575
  }, {
8505
8576
  default: vue.withCtx(() => [
8506
- vue.createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
8577
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
8507
8578
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
8508
8579
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
8509
8580
  group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
@@ -8542,7 +8613,7 @@
8542
8613
  title: item.text
8543
8614
  }, vue.toDisplayString(item.text), 9, _hoisted_2$3)
8544
8615
  ])
8545
- ], 40, _hoisted_1$5);
8616
+ ], 40, _hoisted_1$4);
8546
8617
  }), 128))
8547
8618
  ]),
8548
8619
  _: 2
@@ -8559,7 +8630,7 @@
8559
8630
  }
8560
8631
  });
8561
8632
 
8562
- const _hoisted_1$4 = {
8633
+ const _hoisted_1$3 = {
8563
8634
  key: 0,
8564
8635
  class: "m-editor-sidebar"
8565
8636
  };
@@ -8569,10 +8640,8 @@
8569
8640
  key: 1,
8570
8641
  class: "magic-editor-tab-panel-title"
8571
8642
  };
8572
- const _hoisted_5$1 = { class: "m-editor-float-box-list" };
8573
- const _hoisted_6 = ["onClick"];
8574
- const _hoisted_7 = { class: "m-editor-float-box-body" };
8575
- const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
8643
+ const _hoisted_5$1 = { class: "m-editor-slide-list-box" };
8644
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
8576
8645
  ...{
8577
8646
  name: "MEditorSidebar"
8578
8647
  },
@@ -8593,7 +8662,7 @@
8593
8662
  type: "component",
8594
8663
  icon: iconsVue.Goods,
8595
8664
  text: "组件",
8596
- component: _sfc_main$c,
8665
+ component: _sfc_main$b,
8597
8666
  slots: {}
8598
8667
  },
8599
8668
  layer: {
@@ -8605,7 +8674,7 @@
8605
8674
  layerContentMenu: props.layerContentMenu,
8606
8675
  customContentMenu: props.customContentMenu
8607
8676
  },
8608
- component: _sfc_main$d,
8677
+ component: _sfc_main$c,
8609
8678
  slots: {}
8610
8679
  },
8611
8680
  "code-block": {
@@ -8613,26 +8682,16 @@
8613
8682
  type: "component",
8614
8683
  icon: iconsVue.EditPen,
8615
8684
  text: "代码编辑",
8616
- component: _sfc_main$l,
8617
- slots: {},
8618
- boxComponentConfig: {
8619
- props: {
8620
- slideType: "box"
8621
- }
8622
- }
8685
+ component: _sfc_main$k,
8686
+ slots: {}
8623
8687
  },
8624
8688
  "data-source": {
8625
8689
  $key: "data-source",
8626
8690
  type: "component",
8627
8691
  icon: iconsVue.Coin,
8628
8692
  text: "数据源",
8629
- component: _sfc_main$i,
8630
- slots: {},
8631
- boxComponentConfig: {
8632
- props: {
8633
- slideType: "box"
8634
- }
8635
- }
8693
+ component: _sfc_main$h,
8694
+ slots: {}
8636
8695
  }
8637
8696
  };
8638
8697
  return typeof data === "string" ? map[data] : data;
@@ -8645,7 +8704,7 @@
8645
8704
  }
8646
8705
  );
8647
8706
  const slideKeys = vue.computed(() => sideBarItems.value.map((sideBarItem) => sideBarItem.$key));
8648
- const { showFloatBox, closeFloatBox, dragstartHandler, dragendHandler, floatBoxStates, floatBox, showingBoxKeys } = useFloatBox(slideKeys);
8707
+ const { dragstartHandler, dragendHandler, floatBoxStates, showingBoxKeys } = useFloatBox(slideKeys);
8649
8708
  vue.watch(
8650
8709
  () => showingBoxKeys.value.length,
8651
8710
  () => {
@@ -8669,7 +8728,7 @@
8669
8728
  });
8670
8729
  return (_ctx, _cache) => {
8671
8730
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
8672
- _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
8731
+ _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
8673
8732
  vue.createElementVNode("div", _hoisted_2$2, [
8674
8733
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
8675
8734
  return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
@@ -8687,7 +8746,7 @@
8687
8746
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
8688
8747
  config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
8689
8748
  ], 42, _hoisted_3$1)), [
8690
- [vue.vShow, !vue.unref(floatBoxStates)?.get(config.$key)?.status]
8749
+ [vue.vShow, !vue.unref(floatBoxStates)[config.$key]?.status]
8691
8750
  ]);
8692
8751
  }), 128))
8693
8752
  ]),
@@ -8696,7 +8755,7 @@
8696
8755
  class: "m-editor-sidebar-content",
8697
8756
  key: config.$key ?? index
8698
8757
  }, [
8699
- config && !vue.unref(floatBoxStates)?.get(config.$key)?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({ key: 0 }, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
8758
+ config && !vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({ key: 0 }, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
8700
8759
  config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
8701
8760
  name: "component-list-panel-header",
8702
8761
  fn: vue.withCtx(() => [
@@ -8798,39 +8857,27 @@
8798
8857
  }), 128))
8799
8858
  ])) : vue.createCommentVNode("", true),
8800
8859
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
8801
- vue.createElementVNode("div", _hoisted_5$1, [
8802
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
8803
- return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
8860
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
8861
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
8862
+ vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(_sfc_main$p, {
8804
8863
  key: config.$key ?? index,
8805
- ref_for: true,
8806
- ref_key: "floatBox",
8807
- ref: floatBox,
8808
- class: vue.normalizeClass(["m-editor-float-box", `m-editor-float-box-${config.$key}`]),
8809
- style: vue.normalizeStyle({
8810
- left: `${vue.unref(floatBoxStates)?.get(config.$key)?.left}px`,
8811
- top: `${vue.unref(floatBoxStates)?.get(config.$key)?.top}px`,
8812
- zIndex: vue.unref(floatBoxStates)?.get(config.$key)?.zIndex
8813
- })
8814
- }, [
8815
- vue.createElementVNode("div", {
8816
- class: vue.normalizeClass(["m-editor-float-box-header", `m-editor-float-box-header-${config.$key}`]),
8817
- onClick: ($event) => vue.unref(showFloatBox)(config.$key)
8818
- }, [
8819
- vue.createElementVNode("div", null, vue.toDisplayString(config.text), 1),
8820
- vue.createVNode(_sfc_main$O, {
8821
- class: "m-editor-float-box-close",
8822
- icon: vue.unref(iconsVue.Close),
8823
- onClick: vue.withModifiers(($event) => vue.unref(closeFloatBox)(config.$key), ["stop"])
8824
- }, null, 8, ["icon", "onClick"])
8825
- ], 10, _hoisted_6),
8826
- vue.createElementVNode("div", _hoisted_7, [
8827
- config && vue.unref(floatBoxStates)?.get(config.$key)?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.boxComponentConfig?.component || config.component), vue.mergeProps({ key: 0 }, config.boxComponentConfig?.props || config.props || {}, vue.toHandlers(config?.listeners || {})), null, 16)) : vue.createCommentVNode("", true)
8828
- ])
8829
- ], 6)), [
8830
- [vue.vShow, vue.unref(floatBoxStates)?.get(config.$key)?.status]
8831
- ]);
8832
- }), 128))
8833
- ])
8864
+ visible: vue.unref(floatBoxStates)[config.$key].status,
8865
+ "onUpdate:visible": ($event) => vue.unref(floatBoxStates)[config.$key].status = $event,
8866
+ title: config.text,
8867
+ position: {
8868
+ left: vue.unref(floatBoxStates)[config.$key].left,
8869
+ top: vue.unref(floatBoxStates)[config.$key].top
8870
+ }
8871
+ }, {
8872
+ body: vue.withCtx(() => [
8873
+ vue.createElementVNode("div", _hoisted_5$1, [
8874
+ config && vue.unref(floatBoxStates)[config.$key].status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.boxComponentConfig?.component || config.component), vue.mergeProps({ key: 0 }, config.boxComponentConfig?.props || config.props || {}, vue.toHandlers(config?.listeners || {})), null, 16)) : vue.createCommentVNode("", true)
8875
+ ])
8876
+ ]),
8877
+ _: 2
8878
+ }, 1032, ["visible", "onUpdate:visible", "title", "position"])) : vue.createCommentVNode("", true)
8879
+ ], 64);
8880
+ }), 256))
8834
8881
  ]))
8835
8882
  ], 64);
8836
8883
  };
@@ -8965,7 +9012,7 @@
8965
9012
  };
8966
9013
  }
8967
9014
 
8968
- const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
9015
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
8969
9016
  ...{
8970
9017
  name: "MEditorScrollBar"
8971
9018
  },
@@ -9053,7 +9100,7 @@
9053
9100
  }
9054
9101
  });
9055
9102
 
9056
- const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
9103
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
9057
9104
  ...{
9058
9105
  name: "MEditorScrollViewer"
9059
9106
  },
@@ -9140,14 +9187,14 @@
9140
9187
  vue.renderSlot(_ctx.$slots, "default")
9141
9188
  ], 4),
9142
9189
  vue.renderSlot(_ctx.$slots, "content"),
9143
- scrollHeight.value > _ctx.wrapHeight ? (vue.openBlock(), vue.createBlock(_sfc_main$a, {
9190
+ scrollHeight.value > _ctx.wrapHeight ? (vue.openBlock(), vue.createBlock(_sfc_main$9, {
9144
9191
  key: 0,
9145
9192
  "scroll-size": scrollHeight.value,
9146
9193
  pos: vOffset.value,
9147
9194
  size: _ctx.wrapHeight,
9148
9195
  onScroll: vScrollHandler
9149
9196
  }, null, 8, ["scroll-size", "pos", "size"])) : vue.createCommentVNode("", true),
9150
- scrollWidth.value > _ctx.wrapWidth ? (vue.openBlock(), vue.createBlock(_sfc_main$a, {
9197
+ scrollWidth.value > _ctx.wrapWidth ? (vue.openBlock(), vue.createBlock(_sfc_main$9, {
9151
9198
  key: 1,
9152
9199
  "is-horizontal": true,
9153
9200
  "scroll-size": scrollWidth.value,
@@ -9363,116 +9410,6 @@
9363
9410
  return stage;
9364
9411
  };
9365
9412
 
9366
- const _hoisted_1$3 = { class: "m-editor-float-box-body" };
9367
- const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
9368
- __name: "FloatingBox",
9369
- props: {
9370
- visible: { type: Boolean, default: false },
9371
- position: { default: () => ({ left: 0, top: 0 }) },
9372
- rect: { default: () => ({ width: "auto", height: "auto" }) },
9373
- title: { default: "" }
9374
- },
9375
- emits: ["update:visible"],
9376
- setup(__props, { expose: __expose, emit: __emit }) {
9377
- const props = __props;
9378
- const emit = __emit;
9379
- const target = vue.ref();
9380
- const dragTarget = vue.ref();
9381
- const style = vue.computed(() => ({
9382
- left: `${props.position.left}px`,
9383
- top: `${props.position.top}px`,
9384
- width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
9385
- height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
9386
- }));
9387
- let moveable = null;
9388
- const initMoveable = () => {
9389
- moveable = new Moveable(globalThis.document.body, {
9390
- className: "m-editor-floating-box-moveable",
9391
- target: target.value,
9392
- draggable: true,
9393
- resizable: true,
9394
- edge: true,
9395
- keepRatio: false,
9396
- origin: false,
9397
- snappable: true,
9398
- dragTarget: dragTarget.value,
9399
- dragTargetSelf: false,
9400
- linePadding: 10,
9401
- controlPadding: 10
9402
- });
9403
- moveable.on("drag", (e) => {
9404
- e.target.style.transform = e.transform;
9405
- });
9406
- moveable.on("resize", (e) => {
9407
- e.target.style.width = `${e.width}px`;
9408
- e.target.style.height = `${e.height}px`;
9409
- e.target.style.transform = e.drag.transform;
9410
- });
9411
- };
9412
- const destroyMoveable = () => {
9413
- moveable?.destroy();
9414
- moveable = null;
9415
- };
9416
- vue.watch(
9417
- () => props.visible,
9418
- async (visible) => {
9419
- if (visible) {
9420
- await vue.nextTick();
9421
- initMoveable();
9422
- } else {
9423
- destroyMoveable();
9424
- }
9425
- },
9426
- {
9427
- immediate: true
9428
- }
9429
- );
9430
- vue.onBeforeUnmount(() => {
9431
- destroyMoveable();
9432
- });
9433
- const closeHandler = () => {
9434
- emit("update:visible", false);
9435
- };
9436
- __expose({
9437
- target
9438
- });
9439
- return (_ctx, _cache) => {
9440
- return _ctx.visible ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
9441
- key: 0,
9442
- to: "body"
9443
- }, [
9444
- vue.createElementVNode("div", {
9445
- ref_key: "target",
9446
- ref: target,
9447
- class: "m-editor-float-box",
9448
- style: vue.normalizeStyle(style.value)
9449
- }, [
9450
- vue.createElementVNode("div", {
9451
- ref_key: "dragTarget",
9452
- ref: dragTarget,
9453
- class: "m-editor-float-box-title"
9454
- }, [
9455
- vue.renderSlot(_ctx.$slots, "title", {}, () => [
9456
- vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
9457
- ]),
9458
- vue.createElementVNode("div", null, [
9459
- vue.createVNode(vue.unref(design.TMagicButton), {
9460
- link: "",
9461
- size: "small",
9462
- icon: vue.unref(iconsVue.Close),
9463
- onClick: closeHandler
9464
- }, null, 8, ["icon"])
9465
- ])
9466
- ], 512),
9467
- vue.createElementVNode("div", _hoisted_1$3, [
9468
- vue.renderSlot(_ctx.$slots, "body")
9469
- ])
9470
- ], 4)
9471
- ])) : vue.createCommentVNode("", true);
9472
- };
9473
- }
9474
- });
9475
-
9476
9413
  const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
9477
9414
  __name: "NodeListMenu",
9478
9415
  setup(__props) {
@@ -9555,7 +9492,7 @@
9555
9492
  ]),
9556
9493
  _: 1
9557
9494
  })) : vue.createCommentVNode("", true),
9558
- page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$8, {
9495
+ page.value && vue.unref(nodeStatusMap) && buttonVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$p, {
9559
9496
  key: 1,
9560
9497
  ref_key: "box",
9561
9498
  ref: box,
@@ -9565,7 +9502,7 @@
9565
9502
  position: menuPosition.value
9566
9503
  }, {
9567
9504
  body: vue.withCtx(() => [
9568
- vue.createVNode(_sfc_main$n, {
9505
+ vue.createVNode(_sfc_main$m, {
9569
9506
  class: "m-editor-node-list-menu magic-editor-layer-tree",
9570
9507
  data: nodeData.value,
9571
9508
  "node-status-map": vue.unref(nodeStatusMap),
@@ -9814,7 +9751,7 @@
9814
9751
  };
9815
9752
  __expose({ show });
9816
9753
  return (_ctx, _cache) => {
9817
- return vue.openBlock(), vue.createBlock(_sfc_main$h, {
9754
+ return vue.openBlock(), vue.createBlock(_sfc_main$g, {
9818
9755
  "menu-data": menuData.value,
9819
9756
  ref_key: "menu",
9820
9757
  ref: menu
@@ -9975,7 +9912,7 @@
9975
9912
  }
9976
9913
  };
9977
9914
  return (_ctx, _cache) => {
9978
- return vue.openBlock(), vue.createBlock(_sfc_main$9, {
9915
+ return vue.openBlock(), vue.createBlock(_sfc_main$8, {
9979
9916
  class: "m-editor-stage",
9980
9917
  ref_key: "stageWrap",
9981
9918
  ref: stageWrap,
@@ -10584,6 +10521,8 @@
10584
10521
  editorService.on("update", this.updateHandler);
10585
10522
  editorService.on("add", this.addHandler);
10586
10523
  editorService.on("remove", this.removeHandler);
10524
+ editorService.on("drag-to", this.updateHandler);
10525
+ editorService.on("move-layer", this.updateHandler);
10587
10526
  }
10588
10527
  closeOverlay() {
10589
10528
  this.set("stageOverlayVisible", false);
@@ -10597,6 +10536,8 @@
10597
10536
  editorService.off("update", this.updateHandler);
10598
10537
  editorService.off("add", this.addHandler);
10599
10538
  editorService.off("remove", this.removeHandler);
10539
+ editorService.off("drag-to", this.updateHandler);
10540
+ editorService.off("move-layer", this.updateHandler);
10600
10541
  }
10601
10542
  updateOverlay() {
10602
10543
  const sourceEl = this.get("sourceEl");
@@ -10623,12 +10564,6 @@
10623
10564
  });
10624
10565
  }
10625
10566
  const wrapDiv = this.get("wrapDiv");
10626
- const sourceEl = this.get("sourceEl");
10627
- wrapDiv.style.cssText = `
10628
- width: ${sourceEl?.scrollWidth}px;
10629
- height: ${sourceEl?.scrollHeight}px;
10630
- background-color: #fff;
10631
- `;
10632
10567
  await this.render();
10633
10568
  return wrapDiv;
10634
10569
  }
@@ -10655,11 +10590,17 @@
10655
10590
  async render() {
10656
10591
  this.createContentEl();
10657
10592
  const contentEl = this.get("contentEl");
10593
+ const sourceEl = this.get("sourceEl");
10658
10594
  const wrapDiv = this.get("wrapDiv");
10659
10595
  const subStage = this.get("stage");
10660
10596
  const stageOptions = this.get("stageOptions");
10661
10597
  if (!contentEl)
10662
10598
  return;
10599
+ wrapDiv.style.cssText = `
10600
+ width: ${sourceEl?.scrollWidth}px;
10601
+ height: ${sourceEl?.scrollHeight}px;
10602
+ background-color: #fff;
10603
+ `;
10663
10604
  Array.from(wrapDiv.children).forEach((element) => {
10664
10605
  element.remove();
10665
10606
  });
@@ -10672,17 +10613,31 @@
10672
10613
  }
10673
10614
  }
10674
10615
  updateHandler = () => {
10675
- this.render();
10676
- this.updateOverlay();
10616
+ setTimeout(() => {
10617
+ this.render();
10618
+ this.updateOverlay();
10619
+ this.updateSelectStatus();
10620
+ });
10677
10621
  };
10678
10622
  addHandler = () => {
10679
10623
  this.render();
10680
10624
  this.updateOverlay();
10625
+ this.updateSelectStatus();
10681
10626
  };
10682
10627
  removeHandler = () => {
10683
10628
  this.render();
10684
10629
  this.updateOverlay();
10630
+ this.updateSelectStatus();
10685
10631
  };
10632
+ updateSelectStatus() {
10633
+ const subStage = this.get("stage");
10634
+ const nodes = editorService.get("nodes");
10635
+ if (nodes.length > 1) {
10636
+ subStage?.multiSelect(nodes.map((n) => n.id));
10637
+ } else {
10638
+ subStage?.select(nodes[0].id);
10639
+ }
10640
+ }
10686
10641
  }
10687
10642
  const stageOverlayService = new StageOverlay();
10688
10643
 
@@ -11143,7 +11098,7 @@
11143
11098
  ]),
11144
11099
  sidebar: vue.withCtx(() => [
11145
11100
  vue.renderSlot(_ctx.$slots, "sidebar", { editorService: vue.unref(editorService) }, () => [
11146
- vue.createVNode(_sfc_main$b, {
11101
+ vue.createVNode(_sfc_main$a, {
11147
11102
  data: _ctx.sidebar,
11148
11103
  "layer-content-menu": _ctx.layerContentMenu,
11149
11104
  "custom-content-menu": _ctx.customContentMenu
@@ -11274,14 +11229,14 @@
11274
11229
  exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
11275
11230
  exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
11276
11231
  exports.CodeBlockEditor = _sfc_main$Q;
11277
- exports.CodeBlockList = _sfc_main$m;
11278
- exports.CodeBlockListPanel = _sfc_main$l;
11232
+ exports.CodeBlockList = _sfc_main$l;
11233
+ exports.CodeBlockListPanel = _sfc_main$k;
11279
11234
  exports.CodeDeleteErrorType = CodeDeleteErrorType;
11280
11235
  exports.CodeSelect = _sfc_main$R;
11281
11236
  exports.CodeSelectCol = _sfc_main$N;
11282
11237
  exports.ColumnLayout = ColumnLayout;
11283
- exports.ComponentListPanel = _sfc_main$c;
11284
- exports.ContentMenu = _sfc_main$h;
11238
+ exports.ComponentListPanel = _sfc_main$b;
11239
+ exports.ContentMenu = _sfc_main$g;
11285
11240
  exports.DataSourceFieldSelect = _sfc_main$L;
11286
11241
  exports.DataSourceFields = _sfc_main$M;
11287
11242
  exports.DataSourceInput = _sfc_main$K;
@@ -11298,7 +11253,7 @@
11298
11253
  exports.KeyValue = _sfc_main$D;
11299
11254
  exports.Keys = Keys;
11300
11255
  exports.LayerOffset = LayerOffset;
11301
- exports.LayerPanel = _sfc_main$d;
11256
+ exports.LayerPanel = _sfc_main$c;
11302
11257
  exports.Layout = Layout;
11303
11258
  exports.LayoutContainer = _sfc_main$z;
11304
11259
  exports.PageFragmentSelect = _sfc_main$C;