@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,16 +1,16 @@
1
- import { defineComponent, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, resolveDynamicComponent, createTextVNode, createCommentVNode, toRaw, nextTick, mergeProps, toDisplayString, renderList, createStaticVNode, watchEffect, withModifiers, renderSlot, normalizeProps, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, provide, Transition, toHandlers, mergeDefaults } from 'vue';
1
+ import { defineComponent, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, resolveDynamicComponent, createTextVNode, createCommentVNode, toRaw, nextTick, mergeProps, toDisplayString, renderList, createStaticVNode, watchEffect, withModifiers, renderSlot, toHandlers, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, provide, Transition, mergeDefaults } from 'vue';
2
2
  import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, ArrowRight, CopyDocument, Files, Hide, Goods, List, EditPen, CloseBold, Top, Bottom } from '@element-plus/icons-vue';
3
3
  import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys } from 'lodash-es';
4
4
  import serialize from 'serialize-javascript';
5
5
  import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
6
6
  import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
7
7
  import * as monaco from 'monaco-editor';
8
- import { HookType, NodeType, ActionType } from '@tmagic/schema';
8
+ import { HookCodeType, HookType, NodeType, ActionType } from '@tmagic/schema';
9
9
  import { MFormBox, MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
10
10
  import { MagicTable } from '@tmagic/table';
11
11
  import { guid, isPage, isPageFragment, isPop, getNodePath, isNumber, toLine, getValueByKeyPath, setValueByKeyPath, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
12
12
  import Gesto from 'gesto';
13
- import Moveable from 'moveable';
13
+ import VanillaMoveable from 'moveable';
14
14
  import { Watcher, DepTargetType, createRelatedCompTarget, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
15
15
  export { DepTargetType } from '@tmagic/dep';
16
16
  import StageCore, { GuidesType, getOffset, calcValueByFontsize, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
@@ -362,13 +362,38 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
362
362
  name: "hookData",
363
363
  enableToggleMode: false,
364
364
  expandAll: true,
365
- titleKey: "codeId",
365
+ title: (mForm, { model, index }) => {
366
+ if (model.codeType === HookCodeType.DATA_SOURCE_METHOD) {
367
+ if (Array.isArray(model.codeId)) {
368
+ const ds = services?.dataSourceService.getDataSourceById(model.codeId[0]);
369
+ return `${ds?.title} / ${model.codeId[1]}`;
370
+ }
371
+ return Array.isArray(model.codeId) ? model.codeId.join("/") : index;
372
+ }
373
+ return model.codeId || index;
374
+ },
366
375
  items: [
367
376
  {
368
- type: "code-select-col",
369
- name: "codeId",
370
- labelWidth: 0,
371
- disabled: () => !services?.codeBlockService.getEditStatus()
377
+ type: "row",
378
+ items: [
379
+ {
380
+ type: "select",
381
+ name: "codeType",
382
+ span: 8,
383
+ options: [
384
+ { value: HookCodeType.CODE, text: "代码块" },
385
+ { value: HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
386
+ ],
387
+ defaultValue: "code"
388
+ },
389
+ {
390
+ type: (mForm, { model }) => model.codeType === HookCodeType.DATA_SOURCE_METHOD ? "data-source-method-select" : "code-select-col",
391
+ name: "codeId",
392
+ span: 16,
393
+ labelWidth: 0,
394
+ disabled: () => !services?.codeBlockService.getEditStatus()
395
+ }
396
+ ]
372
397
  }
373
398
  ]
374
399
  }));
@@ -2993,6 +3018,7 @@ class Editor extends BaseService {
2993
3018
  this.addModifiedNodeId(config.id);
2994
3019
  this.addModifiedNodeId(parent.id);
2995
3020
  this.pushHistoryState();
3021
+ this.emit("drag-to", { index, targetIndex, config, parent, targetParent });
2996
3022
  }
2997
3023
  /**
2998
3024
  * 撤销当前操作
@@ -3458,8 +3484,8 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3458
3484
  }, null, 8, ["icon"])) : createCommentVNode("", true)
3459
3485
  ]),
3460
3486
  paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$P, {
3461
- key: 0,
3462
3487
  name: "params",
3488
+ key: _ctx.model[_ctx.name],
3463
3489
  model: _ctx.model,
3464
3490
  size: _ctx.size,
3465
3491
  "params-config": paramsConfig.value,
@@ -5218,14 +5244,17 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5218
5244
  const selectNode = async (id) => {
5219
5245
  await services?.editorService.select(id);
5220
5246
  services?.editorService.get("stage")?.select(id);
5247
+ services?.stageOverlayService.get("stage")?.select(id);
5221
5248
  };
5222
5249
  const highlight = throttle((id) => {
5223
5250
  services?.editorService.highlight(id);
5224
5251
  services?.editorService.get("stage")?.highlight(id);
5252
+ services?.stageOverlayService.get("stage")?.highlight(id);
5225
5253
  }, 150);
5226
5254
  const unhightlight = () => {
5227
5255
  services?.editorService.set("highlightNode", null);
5228
5256
  services?.editorService.get("stage")?.clearHighlight();
5257
+ services?.stageOverlayService.get("stage")?.clearHighlight();
5229
5258
  };
5230
5259
  return (_ctx, _cache) => {
5231
5260
  return uiSelectMode.value ? (openBlock(), createElementBlock("div", {
@@ -5672,7 +5701,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5672
5701
  ])
5673
5702
  ]),
5674
5703
  _: 1
5675
- }, 8, ["disabled"])) : _ctx.data.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.data.component), normalizeProps(mergeProps({ key: 4 }, _ctx.data.props || {})), null, 16)) : createCommentVNode("", true)
5704
+ }, 8, ["disabled"])) : _ctx.data.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.data.component), mergeProps({ key: 4 }, _ctx.data.props || {}, toHandlers(_ctx.data.listeners || {})), null, 16)) : createCommentVNode("", true)
5676
5705
  ], 34)) : createCommentVNode("", true);
5677
5706
  };
5678
5707
  }
@@ -5948,7 +5977,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5948
5977
  );
5949
5978
  watch(active, (active2) => {
5950
5979
  if (active2 === NodeType.PAGE) {
5951
- if (!activePage.value) {
5980
+ if (!activePage.value && !pageList.value.length) {
5952
5981
  editorService?.selectRoot();
5953
5982
  return;
5954
5983
  }
@@ -5956,11 +5985,11 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5956
5985
  return;
5957
5986
  }
5958
5987
  if (active2 === NodeType.PAGE_FRAGMENT) {
5959
- if (!activePageFragment.value) {
5988
+ if (!activePageFragment.value && !pageFragmentList.value.length) {
5960
5989
  editorService?.selectRoot();
5961
5990
  return;
5962
5991
  }
5963
- switchPage(activePageFragment.value);
5992
+ switchPage(activePageFragment.value || pageFragmentList.value[0].id);
5964
5993
  }
5965
5994
  });
5966
5995
  const switchPage = (id) => {
@@ -6507,108 +6536,141 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
6507
6536
  }
6508
6537
  });
6509
6538
 
6539
+ const _hoisted_1$a = { class: "m-editor-float-box-body" };
6540
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6541
+ __name: "FloatingBox",
6542
+ props: {
6543
+ visible: { type: Boolean, default: false },
6544
+ position: { default: () => ({ left: 0, top: 0 }) },
6545
+ rect: { default: () => ({ width: "auto", height: "auto" }) },
6546
+ title: { default: "" }
6547
+ },
6548
+ emits: ["update:visible"],
6549
+ setup(__props, { expose: __expose, emit: __emit }) {
6550
+ const props = __props;
6551
+ const emit = __emit;
6552
+ const target = ref();
6553
+ const dragTarget = ref();
6554
+ const style = computed(() => ({
6555
+ left: `${props.position.left}px`,
6556
+ top: `${props.position.top}px`,
6557
+ width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
6558
+ height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
6559
+ }));
6560
+ let moveable = null;
6561
+ const initMoveable = () => {
6562
+ moveable = new VanillaMoveable(globalThis.document.body, {
6563
+ className: "m-editor-floating-box-moveable",
6564
+ target: target.value,
6565
+ draggable: true,
6566
+ resizable: true,
6567
+ edge: true,
6568
+ keepRatio: false,
6569
+ origin: false,
6570
+ snappable: true,
6571
+ dragTarget: dragTarget.value,
6572
+ dragTargetSelf: false,
6573
+ linePadding: 10,
6574
+ controlPadding: 10
6575
+ });
6576
+ moveable.on("drag", (e) => {
6577
+ e.target.style.transform = e.transform;
6578
+ });
6579
+ moveable.on("resize", (e) => {
6580
+ e.target.style.width = `${e.width}px`;
6581
+ e.target.style.height = `${e.height}px`;
6582
+ e.target.style.transform = e.drag.transform;
6583
+ });
6584
+ };
6585
+ const destroyMoveable = () => {
6586
+ moveable?.destroy();
6587
+ moveable = null;
6588
+ };
6589
+ watch(
6590
+ () => props.visible,
6591
+ async (visible) => {
6592
+ if (visible) {
6593
+ await nextTick();
6594
+ initMoveable();
6595
+ } else {
6596
+ destroyMoveable();
6597
+ }
6598
+ },
6599
+ {
6600
+ immediate: true
6601
+ }
6602
+ );
6603
+ onBeforeUnmount(() => {
6604
+ destroyMoveable();
6605
+ });
6606
+ const closeHandler = () => {
6607
+ emit("update:visible", false);
6608
+ };
6609
+ __expose({
6610
+ target
6611
+ });
6612
+ return (_ctx, _cache) => {
6613
+ return _ctx.visible ? (openBlock(), createBlock(Teleport, {
6614
+ key: 0,
6615
+ to: "body"
6616
+ }, [
6617
+ createElementVNode("div", {
6618
+ ref_key: "target",
6619
+ ref: target,
6620
+ class: "m-editor-float-box",
6621
+ style: normalizeStyle(style.value)
6622
+ }, [
6623
+ createElementVNode("div", {
6624
+ ref_key: "dragTarget",
6625
+ ref: dragTarget,
6626
+ class: "m-editor-float-box-title"
6627
+ }, [
6628
+ renderSlot(_ctx.$slots, "title", {}, () => [
6629
+ createElementVNode("span", null, toDisplayString(_ctx.title), 1)
6630
+ ]),
6631
+ createElementVNode("div", null, [
6632
+ createVNode(unref(TMagicButton), {
6633
+ link: "",
6634
+ size: "small",
6635
+ icon: unref(Close),
6636
+ onClick: closeHandler
6637
+ }, null, 8, ["icon"])
6638
+ ])
6639
+ ], 512),
6640
+ createElementVNode("div", _hoisted_1$a, [
6641
+ renderSlot(_ctx.$slots, "body")
6642
+ ])
6643
+ ], 4)
6644
+ ])) : createCommentVNode("", true);
6645
+ };
6646
+ }
6647
+ });
6648
+
6510
6649
  const useFloatBox = (slideKeys) => {
6511
- const services = inject("services");
6512
- const moveable = ref();
6513
- const floatBox = ref();
6514
- const floatBoxStates = computed(() => services?.uiService.get("floatBox"));
6515
- const curKey = ref("");
6516
- const target = computed(
6517
- () => floatBox.value ? floatBox.value.find((item) => item.classList.contains(`m-editor-float-box-${curKey.value}`)) : void 0
6650
+ const floatBoxStates = ref(
6651
+ slideKeys.value.reduce(
6652
+ (total, cur) => ({
6653
+ ...total,
6654
+ [cur]: {
6655
+ status: false,
6656
+ top: 0,
6657
+ left: 0
6658
+ }
6659
+ }),
6660
+ {}
6661
+ )
6518
6662
  );
6519
6663
  const showingBoxKeys = computed(
6520
- () => [...floatBoxStates.value?.keys() ?? []].filter((key) => floatBoxStates.value?.get(key)?.status)
6664
+ () => Object.keys(floatBoxStates.value).filter((key) => floatBoxStates.value[key].status)
6521
6665
  );
6522
6666
  const isDraging = ref(false);
6523
- const showFloatBox = async (key) => {
6524
- const curBoxStatus = floatBoxStates.value?.get(curKey.value)?.status;
6525
- if (curKey.value === key && curBoxStatus)
6526
- return;
6527
- curKey.value = key;
6528
- setSlideState(key, {
6529
- zIndex: getMaxZIndex() + 1,
6530
- status: true
6531
- });
6532
- await nextTick();
6533
- if (moveable.value) {
6534
- moveable.value.target = target.value;
6535
- moveable.value.dragTarget = getDragTarget();
6536
- moveable.value.updateRect();
6537
- } else {
6538
- initFloatBoxMoveable();
6539
- }
6540
- };
6541
- const setSlideState = (key, data) => {
6542
- const slideState = floatBoxStates.value?.get(key);
6543
- if (!slideState)
6544
- return;
6545
- floatBoxStates.value?.set(key, {
6546
- ...slideState,
6547
- ...data
6548
- });
6549
- };
6550
- const getDragTarget = (key) => `.m-editor-float-box-header-${key ?? curKey.value}`;
6551
- const closeFloatBox = (key) => {
6552
- setSlideState(key, {
6553
- status: false
6554
- });
6555
- if (!floatBoxStates.value?.values)
6556
- return;
6557
- const keys = [...floatBoxStates.value?.keys()];
6558
- const values = [...floatBoxStates.value?.values()];
6559
- const lastFloatBoxLen = values.filter((state) => state.status).length;
6560
- if (lastFloatBoxLen === 0) {
6561
- moveable.value?.destroy();
6562
- moveable.value = void 0;
6563
- return;
6564
- }
6565
- if (key === curKey.value) {
6566
- const zIndexList = values.filter((item) => item.status).map((item) => item.zIndex);
6567
- const maxZIndex = Math.max(...zIndexList);
6568
- const key2 = keys.find((key3) => floatBoxStates.value?.get(key3)?.zIndex === maxZIndex);
6569
- if (!key2)
6570
- return;
6571
- showFloatBox(key2);
6572
- }
6573
- };
6574
- const getMaxZIndex = () => {
6575
- if (!floatBoxStates.value?.values())
6576
- return 0;
6577
- const list = [...floatBoxStates.value?.values()].map((state) => state.zIndex);
6578
- return Math.max(...list) ?? 0;
6579
- };
6580
- const initFloatBoxMoveable = () => {
6581
- const dragTarget = getDragTarget();
6582
- moveable.value = new Moveable(document.body, {
6583
- target: target.value,
6584
- draggable: true,
6585
- resizable: true,
6586
- edge: true,
6587
- keepRatio: false,
6588
- origin: false,
6589
- snappable: true,
6590
- dragTarget,
6591
- dragTargetSelf: false,
6592
- linePadding: 10,
6593
- controlPadding: 10,
6594
- elementGuidelines: [...floatBoxStates.value?.keys() ?? []].map((key) => getDragTarget(key)),
6595
- bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
6596
- });
6597
- moveable.value.on("drag", (e) => {
6598
- e.target.style.transform = e.transform;
6599
- });
6600
- moveable.value.on("resize", (e) => {
6601
- e.target.style.width = `${e.width}px`;
6602
- e.target.style.height = `${e.height}px`;
6603
- e.target.style.transform = e.drag.transform;
6604
- });
6605
- };
6667
+ const dragstartHandler = () => isDraging.value = true;
6606
6668
  const dragendHandler = (key, e) => {
6607
- setSlideState(key, {
6669
+ floatBoxStates.value[key] = {
6608
6670
  left: e.clientX,
6609
- top: e.clientY
6610
- });
6611
- showFloatBox(key);
6671
+ top: e.clientY,
6672
+ status: true
6673
+ };
6612
6674
  isDraging.value = false;
6613
6675
  };
6614
6676
  document.body.addEventListener("dragover", (e) => {
@@ -6616,11 +6678,18 @@ const useFloatBox = (slideKeys) => {
6616
6678
  return;
6617
6679
  e.preventDefault();
6618
6680
  });
6619
- const dragstartHandler = () => isDraging.value = true;
6620
6681
  watch(
6621
6682
  () => slideKeys.value,
6622
6683
  () => {
6623
- services?.uiService.setFloatBox(slideKeys.value);
6684
+ for (const key in slideKeys.value) {
6685
+ if (floatBoxStates.value[key])
6686
+ continue;
6687
+ floatBoxStates.value[key] = {
6688
+ status: false,
6689
+ top: 0,
6690
+ left: 0
6691
+ };
6692
+ }
6624
6693
  },
6625
6694
  {
6626
6695
  deep: true,
@@ -6628,17 +6697,14 @@ const useFloatBox = (slideKeys) => {
6628
6697
  }
6629
6698
  );
6630
6699
  return {
6631
- showFloatBox,
6632
- closeFloatBox,
6633
6700
  dragstartHandler,
6634
6701
  dragendHandler,
6635
6702
  floatBoxStates,
6636
- floatBox,
6637
6703
  showingBoxKeys
6638
6704
  };
6639
6705
  };
6640
6706
 
6641
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
6707
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6642
6708
  ...{
6643
6709
  name: "MEditorSearchInput"
6644
6710
  },
@@ -6689,14 +6755,14 @@ const updateStatus = (nodeStatusMap, id, status) => {
6689
6755
  });
6690
6756
  };
6691
6757
 
6692
- const _hoisted_1$a = ["draggable", "data-node-id", "data-is-container"];
6758
+ const _hoisted_1$9 = ["draggable", "data-node-id", "data-is-container"];
6693
6759
  const _hoisted_2$6 = { class: "tree-node-label" };
6694
6760
  const _hoisted_3$3 = { class: "tree-node-tool" };
6695
6761
  const _hoisted_4$3 = {
6696
6762
  key: 0,
6697
6763
  class: "m-editor-tree-node-children"
6698
6764
  };
6699
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
6765
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6700
6766
  ...{
6701
6767
  name: "MEditorTreeNode"
6702
6768
  },
@@ -6806,18 +6872,18 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6806
6872
  }, 1032, ["data", "node-status-map", "indent"]);
6807
6873
  }), 128))
6808
6874
  ])) : createCommentVNode("", true)
6809
- ], 40, _hoisted_1$a)), [
6875
+ ], 40, _hoisted_1$9)), [
6810
6876
  [vShow, visible.value]
6811
6877
  ]);
6812
6878
  };
6813
6879
  }
6814
6880
  });
6815
6881
 
6816
- const _hoisted_1$9 = {
6882
+ const _hoisted_1$8 = {
6817
6883
  key: 1,
6818
6884
  class: "m-editor-tree-empty"
6819
6885
  };
6820
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
6886
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6821
6887
  ...{
6822
6888
  name: "MEditorTree"
6823
6889
  },
@@ -6841,7 +6907,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6841
6907
  onDragover: handleDragOver
6842
6908
  }, [
6843
6909
  _ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
6844
- return openBlock(), createBlock(_sfc_main$o, {
6910
+ return openBlock(), createBlock(_sfc_main$n, {
6845
6911
  key: item.id,
6846
6912
  data: item,
6847
6913
  indent: _ctx.indent,
@@ -6858,7 +6924,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6858
6924
  ]),
6859
6925
  _: 2
6860
6926
  }, 1032, ["data", "indent", "node-status-map"]);
6861
- }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$9, [
6927
+ }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$8, [
6862
6928
  createElementVNode("p", null, toDisplayString(_ctx.emptyText), 1)
6863
6929
  ]))
6864
6930
  ], 32);
@@ -6938,7 +7004,7 @@ const useNodeStatus$1 = (nodeData) => {
6938
7004
  };
6939
7005
  };
6940
7006
 
6941
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
7007
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6942
7008
  ...{
6943
7009
  name: "MEditorCodeBlockList"
6944
7010
  },
@@ -7020,7 +7086,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
7020
7086
  filter: filterTextChangeHandler
7021
7087
  });
7022
7088
  return (_ctx, _cache) => {
7023
- return openBlock(), createBlock(_sfc_main$n, {
7089
+ return openBlock(), createBlock(_sfc_main$m, {
7024
7090
  data: codeList.value,
7025
7091
  "node-status-map": unref(nodeStatusMap),
7026
7092
  onNodeClick: clickHandler
@@ -7076,8 +7142,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
7076
7142
  }
7077
7143
  });
7078
7144
 
7079
- const _hoisted_1$8 = { class: "search-wrapper" };
7080
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
7145
+ const _hoisted_1$7 = { class: "search-wrapper" };
7146
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
7081
7147
  ...{
7082
7148
  name: "MEditorCodeBlockListPanel"
7083
7149
  },
@@ -7099,8 +7165,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
7099
7165
  createVNode(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
7100
7166
  default: withCtx(() => [
7101
7167
  renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
7102
- createElementVNode("div", _hoisted_1$8, [
7103
- createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
7168
+ createElementVNode("div", _hoisted_1$7, [
7169
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7104
7170
  editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
7105
7171
  key: 0,
7106
7172
  class: "create-code-button",
@@ -7116,7 +7182,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
7116
7182
  renderSlot(_ctx.$slots, "code-block-panel-search")
7117
7183
  ])
7118
7184
  ]),
7119
- createVNode(_sfc_main$m, {
7185
+ createVNode(_sfc_main$l, {
7120
7186
  ref_key: "codeBlockList",
7121
7187
  ref: codeBlockList,
7122
7188
  "custom-error": _ctx.customError,
@@ -7148,7 +7214,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
7148
7214
  }
7149
7215
  });
7150
7216
 
7151
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
7217
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7152
7218
  ...{
7153
7219
  name: "MEditorDataSourceConfigPanel"
7154
7220
  },
@@ -7204,7 +7270,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
7204
7270
  }
7205
7271
  });
7206
7272
 
7207
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
7273
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7208
7274
  ...{
7209
7275
  name: "MEditorDataSourceList"
7210
7276
  },
@@ -7293,7 +7359,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7293
7359
  filter: filterTextChangeHandler
7294
7360
  });
7295
7361
  return (_ctx, _cache) => {
7296
- return openBlock(), createBlock(_sfc_main$n, {
7362
+ return openBlock(), createBlock(_sfc_main$m, {
7297
7363
  data: list.value,
7298
7364
  "node-status-map": unref(nodeStatusMap),
7299
7365
  onNodeClick: clickHandler
@@ -7346,9 +7412,9 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
7346
7412
  }
7347
7413
  });
7348
7414
 
7349
- const _hoisted_1$7 = { class: "search-wrapper" };
7415
+ const _hoisted_1$6 = { class: "search-wrapper" };
7350
7416
  const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
7351
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
7417
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7352
7418
  ...{
7353
7419
  name: "MEditorDataSourceListPanel"
7354
7420
  },
@@ -7412,8 +7478,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7412
7478
  return openBlock(), createElementBlock(Fragment, null, [
7413
7479
  createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
7414
7480
  default: withCtx(() => [
7415
- createElementVNode("div", _hoisted_1$7, [
7416
- createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
7481
+ createElementVNode("div", _hoisted_1$6, [
7482
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7417
7483
  editable.value ? (openBlock(), createBlock(unref(TMagicPopover), {
7418
7484
  key: 0,
7419
7485
  placement: "right"
@@ -7448,14 +7514,14 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7448
7514
  _: 1
7449
7515
  })) : createCommentVNode("", true)
7450
7516
  ]),
7451
- createVNode(_sfc_main$j, {
7517
+ createVNode(_sfc_main$i, {
7452
7518
  onEdit: editHandler,
7453
7519
  onRemove: removeHandler
7454
7520
  })
7455
7521
  ]),
7456
7522
  _: 1
7457
7523
  }),
7458
- createVNode(_sfc_main$k, {
7524
+ createVNode(_sfc_main$j, {
7459
7525
  ref_key: "editDialog",
7460
7526
  ref: editDialog,
7461
7527
  disabled: !editable.value,
@@ -7469,7 +7535,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7469
7535
  }
7470
7536
  });
7471
7537
 
7472
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
7538
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7473
7539
  ...{
7474
7540
  name: "MEditorContentMenu"
7475
7541
  },
@@ -7635,7 +7701,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7635
7701
  }
7636
7702
  });
7637
7703
 
7638
- const _hoisted_1$6 = {
7704
+ const _hoisted_1$5 = {
7639
7705
  width: "1em",
7640
7706
  height: "1em",
7641
7707
  viewBox: "0 0 16 16",
@@ -7655,14 +7721,14 @@ const _hoisted_4$2 = [
7655
7721
  _hoisted_2$4,
7656
7722
  _hoisted_3$2
7657
7723
  ];
7658
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
7724
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7659
7725
  ...{
7660
7726
  name: "MEditorFolderMinusIcon"
7661
7727
  },
7662
7728
  __name: "FolderMinusIcon",
7663
7729
  setup(__props) {
7664
7730
  return (_ctx, _cache) => {
7665
- return openBlock(), createElementBlock("svg", _hoisted_1$6, _hoisted_4$2);
7731
+ return openBlock(), createElementBlock("svg", _hoisted_1$5, _hoisted_4$2);
7666
7732
  };
7667
7733
  }
7668
7734
  });
@@ -7740,7 +7806,7 @@ const useMoveToMenu = (services) => {
7740
7806
  };
7741
7807
  };
7742
7808
 
7743
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
7809
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7744
7810
  ...{
7745
7811
  name: "MEditorLayerMenu"
7746
7812
  },
@@ -7807,7 +7873,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7807
7873
  {
7808
7874
  type: "button",
7809
7875
  text: "全部折叠",
7810
- icon: _sfc_main$g,
7876
+ icon: _sfc_main$f,
7811
7877
  display: () => isPage(node.value) || isPageFragment(node.value),
7812
7878
  handler: () => {
7813
7879
  emit("collapse-all");
@@ -7836,7 +7902,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7836
7902
  show
7837
7903
  });
7838
7904
  return (_ctx, _cache) => {
7839
- return openBlock(), createBlock(_sfc_main$h, {
7905
+ return openBlock(), createBlock(_sfc_main$g, {
7840
7906
  "menu-data": menuData.value,
7841
7907
  ref_key: "menu",
7842
7908
  ref: menu,
@@ -7846,7 +7912,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7846
7912
  }
7847
7913
  });
7848
7914
 
7849
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
7915
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7850
7916
  __name: "LayerNodeTool",
7851
7917
  props: {
7852
7918
  data: {}
@@ -7893,6 +7959,7 @@ const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
7893
7959
  } else {
7894
7960
  await services?.editorService.select(data);
7895
7961
  services?.editorService.get("stage")?.select(data.id);
7962
+ services?.stageOverlayService.get("stage")?.select(data.id);
7896
7963
  }
7897
7964
  };
7898
7965
  const multiSelect = async (data) => {
@@ -7911,6 +7978,7 @@ const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
7911
7978
  }
7912
7979
  await services?.editorService.multiSelect(newNodes);
7913
7980
  services?.editorService.get("stage")?.multiSelect(newNodes);
7981
+ services?.stageOverlayService.get("stage")?.multiSelect(newNodes);
7914
7982
  };
7915
7983
  const throttleTime = 300;
7916
7984
  const highlightHandler = throttle((event, data) => {
@@ -7919,6 +7987,7 @@ const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
7919
7987
  const highlight = (data) => {
7920
7988
  services?.editorService?.highlight(data);
7921
7989
  services?.editorService?.get("stage")?.highlight(data.id);
7990
+ services?.stageOverlayService?.get("stage")?.highlight(data.id);
7922
7991
  };
7923
7992
  const nodeClickHandler = (event, data) => {
7924
7993
  if (!nodeStatusMap?.value)
@@ -7940,7 +8009,7 @@ const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
7940
8009
  return {
7941
8010
  menu,
7942
8011
  nodeClickHandler,
7943
- nodeContentmenuHandler(event, data) {
8012
+ nodeContentMenuHandler(event, data) {
7944
8013
  event.preventDefault();
7945
8014
  const nodes = services?.editorService.get("nodes") || [];
7946
8015
  if (nodes.length < 2 || !nodes.includes(data)) {
@@ -8266,12 +8335,12 @@ const useNodeStatus = (services) => {
8266
8335
  () => page.value ? nodeStatusMaps.value.get(page.value.id) : /* @__PURE__ */ new Map()
8267
8336
  );
8268
8337
  watch(
8269
- page,
8270
- (page2) => {
8271
- if (!page2) {
8338
+ () => page.value?.id,
8339
+ (pageId) => {
8340
+ if (!pageId) {
8272
8341
  return;
8273
8342
  }
8274
- nodeStatusMaps.value.set(page2.id, createPageNodeStatus(page2, nodeStatusMaps.value.get(page2.id)));
8343
+ nodeStatusMaps.value.set(pageId, createPageNodeStatus(page.value, nodeStatusMaps.value.get(pageId)));
8275
8344
  },
8276
8345
  {
8277
8346
  immediate: true
@@ -8299,6 +8368,8 @@ const useNodeStatus = (services) => {
8299
8368
  );
8300
8369
  services?.editorService.on("add", (newNodes) => {
8301
8370
  newNodes.forEach((node) => {
8371
+ if (isPage(node) || isPageFragment(node))
8372
+ return;
8302
8373
  traverseNode(node, (node2) => {
8303
8374
  nodeStatusMap.value?.set(node2.id, {
8304
8375
  visible: true,
@@ -8322,7 +8393,7 @@ const useNodeStatus = (services) => {
8322
8393
  };
8323
8394
  };
8324
8395
 
8325
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
8396
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8326
8397
  ...{
8327
8398
  name: "MEditorLayerPanel"
8328
8399
  },
@@ -8364,15 +8435,15 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8364
8435
  const {
8365
8436
  menu,
8366
8437
  nodeClickHandler,
8367
- nodeContentmenuHandler,
8438
+ nodeContentMenuHandler,
8368
8439
  highlightHandler: mouseenterHandler
8369
8440
  } = useClick(services, isCtrlKeyDown, nodeStatusMap);
8370
8441
  return (_ctx, _cache) => {
8371
8442
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
8372
8443
  default: withCtx(() => [
8373
8444
  renderSlot(_ctx.$slots, "layer-panel-header"),
8374
- createVNode(_sfc_main$p, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
8375
- page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$n, {
8445
+ createVNode(_sfc_main$o, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
8446
+ page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$m, {
8376
8447
  key: 0,
8377
8448
  tabindex: "-1",
8378
8449
  ref_key: "tree",
@@ -8383,7 +8454,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8383
8454
  onNodeDragstart: unref(handleDragStart),
8384
8455
  onNodeDragleave: unref(handleDragLeave),
8385
8456
  onNodeDragend: unref(handleDragEnd),
8386
- onNodeContextmenu: unref(nodeContentmenuHandler),
8457
+ onNodeContextmenu: unref(nodeContentMenuHandler),
8387
8458
  onNodeMouseenter: unref(mouseenterHandler),
8388
8459
  onNodeClick: unref(nodeClickHandler)
8389
8460
  }, {
@@ -8392,7 +8463,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8392
8463
  ]),
8393
8464
  "tree-node-tool": withCtx(({ data: nodeData2 }) => [
8394
8465
  renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData2 }, () => [
8395
- createVNode(_sfc_main$e, { data: nodeData2 }, null, 8, ["data"])
8466
+ createVNode(_sfc_main$d, { data: nodeData2 }, null, 8, ["data"])
8396
8467
  ])
8397
8468
  ]),
8398
8469
  "tree-node-label": withCtx(({ data: nodeData2 }) => [
@@ -8401,7 +8472,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8401
8472
  _: 3
8402
8473
  }, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
8403
8474
  (openBlock(), createBlock(Teleport, { to: "body" }, [
8404
- createVNode(_sfc_main$f, {
8475
+ createVNode(_sfc_main$e, {
8405
8476
  ref_key: "menu",
8406
8477
  ref: menu,
8407
8478
  "layer-content-menu": _ctx.layerContentMenu,
@@ -8416,9 +8487,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8416
8487
  }
8417
8488
  });
8418
8489
 
8419
- const _hoisted_1$5 = ["onClick", "onDragstart"];
8490
+ const _hoisted_1$4 = ["onClick", "onDragstart"];
8420
8491
  const _hoisted_2$3 = ["title"];
8421
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
8492
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8422
8493
  ...{
8423
8494
  name: "MEditorComponentListPanel"
8424
8495
  },
@@ -8498,7 +8569,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8498
8569
  "model-value": collapseValue.value
8499
8570
  }, {
8500
8571
  default: withCtx(() => [
8501
- createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
8572
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
8502
8573
  (openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
8503
8574
  return openBlock(), createElementBlock(Fragment, null, [
8504
8575
  group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
@@ -8537,7 +8608,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8537
8608
  title: item.text
8538
8609
  }, toDisplayString(item.text), 9, _hoisted_2$3)
8539
8610
  ])
8540
- ], 40, _hoisted_1$5);
8611
+ ], 40, _hoisted_1$4);
8541
8612
  }), 128))
8542
8613
  ]),
8543
8614
  _: 2
@@ -8554,7 +8625,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8554
8625
  }
8555
8626
  });
8556
8627
 
8557
- const _hoisted_1$4 = {
8628
+ const _hoisted_1$3 = {
8558
8629
  key: 0,
8559
8630
  class: "m-editor-sidebar"
8560
8631
  };
@@ -8564,10 +8635,8 @@ const _hoisted_4$1 = {
8564
8635
  key: 1,
8565
8636
  class: "magic-editor-tab-panel-title"
8566
8637
  };
8567
- const _hoisted_5$1 = { class: "m-editor-float-box-list" };
8568
- const _hoisted_6 = ["onClick"];
8569
- const _hoisted_7 = { class: "m-editor-float-box-body" };
8570
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
8638
+ const _hoisted_5$1 = { class: "m-editor-slide-list-box" };
8639
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8571
8640
  ...{
8572
8641
  name: "MEditorSidebar"
8573
8642
  },
@@ -8588,7 +8657,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8588
8657
  type: "component",
8589
8658
  icon: Goods,
8590
8659
  text: "组件",
8591
- component: _sfc_main$c,
8660
+ component: _sfc_main$b,
8592
8661
  slots: {}
8593
8662
  },
8594
8663
  layer: {
@@ -8600,7 +8669,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8600
8669
  layerContentMenu: props.layerContentMenu,
8601
8670
  customContentMenu: props.customContentMenu
8602
8671
  },
8603
- component: _sfc_main$d,
8672
+ component: _sfc_main$c,
8604
8673
  slots: {}
8605
8674
  },
8606
8675
  "code-block": {
@@ -8608,26 +8677,16 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8608
8677
  type: "component",
8609
8678
  icon: EditPen,
8610
8679
  text: "代码编辑",
8611
- component: _sfc_main$l,
8612
- slots: {},
8613
- boxComponentConfig: {
8614
- props: {
8615
- slideType: "box"
8616
- }
8617
- }
8680
+ component: _sfc_main$k,
8681
+ slots: {}
8618
8682
  },
8619
8683
  "data-source": {
8620
8684
  $key: "data-source",
8621
8685
  type: "component",
8622
8686
  icon: Coin,
8623
8687
  text: "数据源",
8624
- component: _sfc_main$i,
8625
- slots: {},
8626
- boxComponentConfig: {
8627
- props: {
8628
- slideType: "box"
8629
- }
8630
- }
8688
+ component: _sfc_main$h,
8689
+ slots: {}
8631
8690
  }
8632
8691
  };
8633
8692
  return typeof data === "string" ? map[data] : data;
@@ -8640,7 +8699,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8640
8699
  }
8641
8700
  );
8642
8701
  const slideKeys = computed(() => sideBarItems.value.map((sideBarItem) => sideBarItem.$key));
8643
- const { showFloatBox, closeFloatBox, dragstartHandler, dragendHandler, floatBoxStates, floatBox, showingBoxKeys } = useFloatBox(slideKeys);
8702
+ const { dragstartHandler, dragendHandler, floatBoxStates, showingBoxKeys } = useFloatBox(slideKeys);
8644
8703
  watch(
8645
8704
  () => showingBoxKeys.value.length,
8646
8705
  () => {
@@ -8664,7 +8723,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8664
8723
  });
8665
8724
  return (_ctx, _cache) => {
8666
8725
  return openBlock(), createElementBlock(Fragment, null, [
8667
- _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
8726
+ _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
8668
8727
  createElementVNode("div", _hoisted_2$2, [
8669
8728
  (openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
8670
8729
  return withDirectives((openBlock(), createElementBlock("div", {
@@ -8682,7 +8741,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8682
8741
  }, null, 8, ["icon"])) : createCommentVNode("", true),
8683
8742
  config.text ? (openBlock(), createElementBlock("div", _hoisted_4$1, toDisplayString(config.text), 1)) : createCommentVNode("", true)
8684
8743
  ], 42, _hoisted_3$1)), [
8685
- [vShow, !unref(floatBoxStates)?.get(config.$key)?.status]
8744
+ [vShow, !unref(floatBoxStates)[config.$key]?.status]
8686
8745
  ]);
8687
8746
  }), 128))
8688
8747
  ]),
@@ -8691,7 +8750,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8691
8750
  class: "m-editor-sidebar-content",
8692
8751
  key: config.$key ?? index
8693
8752
  }, [
8694
- config && !unref(floatBoxStates)?.get(config.$key)?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({ key: 0 }, config.props || {}, toHandlers(config?.listeners || {})), createSlots({ _: 2 }, [
8753
+ config && !unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({ key: 0 }, config.props || {}, toHandlers(config?.listeners || {})), createSlots({ _: 2 }, [
8695
8754
  config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
8696
8755
  name: "component-list-panel-header",
8697
8756
  fn: withCtx(() => [
@@ -8793,39 +8852,27 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8793
8852
  }), 128))
8794
8853
  ])) : createCommentVNode("", true),
8795
8854
  (openBlock(), createBlock(Teleport, { to: "body" }, [
8796
- createElementVNode("div", _hoisted_5$1, [
8797
- (openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
8798
- return withDirectives((openBlock(), createElementBlock("div", {
8855
+ (openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
8856
+ return openBlock(), createElementBlock(Fragment, null, [
8857
+ unref(floatBoxStates)[config.$key]?.status ? (openBlock(), createBlock(_sfc_main$p, {
8799
8858
  key: config.$key ?? index,
8800
- ref_for: true,
8801
- ref_key: "floatBox",
8802
- ref: floatBox,
8803
- class: normalizeClass(["m-editor-float-box", `m-editor-float-box-${config.$key}`]),
8804
- style: normalizeStyle({
8805
- left: `${unref(floatBoxStates)?.get(config.$key)?.left}px`,
8806
- top: `${unref(floatBoxStates)?.get(config.$key)?.top}px`,
8807
- zIndex: unref(floatBoxStates)?.get(config.$key)?.zIndex
8808
- })
8809
- }, [
8810
- createElementVNode("div", {
8811
- class: normalizeClass(["m-editor-float-box-header", `m-editor-float-box-header-${config.$key}`]),
8812
- onClick: ($event) => unref(showFloatBox)(config.$key)
8813
- }, [
8814
- createElementVNode("div", null, toDisplayString(config.text), 1),
8815
- createVNode(_sfc_main$O, {
8816
- class: "m-editor-float-box-close",
8817
- icon: unref(Close),
8818
- onClick: withModifiers(($event) => unref(closeFloatBox)(config.$key), ["stop"])
8819
- }, null, 8, ["icon", "onClick"])
8820
- ], 10, _hoisted_6),
8821
- createElementVNode("div", _hoisted_7, [
8822
- config && unref(floatBoxStates)?.get(config.$key)?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.boxComponentConfig?.component || config.component), mergeProps({ key: 0 }, config.boxComponentConfig?.props || config.props || {}, toHandlers(config?.listeners || {})), null, 16)) : createCommentVNode("", true)
8823
- ])
8824
- ], 6)), [
8825
- [vShow, unref(floatBoxStates)?.get(config.$key)?.status]
8826
- ]);
8827
- }), 128))
8828
- ])
8859
+ visible: unref(floatBoxStates)[config.$key].status,
8860
+ "onUpdate:visible": ($event) => unref(floatBoxStates)[config.$key].status = $event,
8861
+ title: config.text,
8862
+ position: {
8863
+ left: unref(floatBoxStates)[config.$key].left,
8864
+ top: unref(floatBoxStates)[config.$key].top
8865
+ }
8866
+ }, {
8867
+ body: withCtx(() => [
8868
+ createElementVNode("div", _hoisted_5$1, [
8869
+ config && unref(floatBoxStates)[config.$key].status ? (openBlock(), createBlock(resolveDynamicComponent(config.boxComponentConfig?.component || config.component), mergeProps({ key: 0 }, config.boxComponentConfig?.props || config.props || {}, toHandlers(config?.listeners || {})), null, 16)) : createCommentVNode("", true)
8870
+ ])
8871
+ ]),
8872
+ _: 2
8873
+ }, 1032, ["visible", "onUpdate:visible", "title", "position"])) : createCommentVNode("", true)
8874
+ ], 64);
8875
+ }), 256))
8829
8876
  ]))
8830
8877
  ], 64);
8831
8878
  };
@@ -8960,7 +9007,7 @@ class ScrollViewer extends EventEmitter {
8960
9007
  };
8961
9008
  }
8962
9009
 
8963
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
9010
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8964
9011
  ...{
8965
9012
  name: "MEditorScrollBar"
8966
9013
  },
@@ -9048,7 +9095,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
9048
9095
  }
9049
9096
  });
9050
9097
 
9051
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9098
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9052
9099
  ...{
9053
9100
  name: "MEditorScrollViewer"
9054
9101
  },
@@ -9135,14 +9182,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9135
9182
  renderSlot(_ctx.$slots, "default")
9136
9183
  ], 4),
9137
9184
  renderSlot(_ctx.$slots, "content"),
9138
- scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$a, {
9185
+ scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$9, {
9139
9186
  key: 0,
9140
9187
  "scroll-size": scrollHeight.value,
9141
9188
  pos: vOffset.value,
9142
9189
  size: _ctx.wrapHeight,
9143
9190
  onScroll: vScrollHandler
9144
9191
  }, null, 8, ["scroll-size", "pos", "size"])) : createCommentVNode("", true),
9145
- scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$a, {
9192
+ scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$9, {
9146
9193
  key: 1,
9147
9194
  "is-horizontal": true,
9148
9195
  "scroll-size": scrollWidth.value,
@@ -9358,116 +9405,6 @@ const useStage = (stageOptions) => {
9358
9405
  return stage;
9359
9406
  };
9360
9407
 
9361
- const _hoisted_1$3 = { class: "m-editor-float-box-body" };
9362
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9363
- __name: "FloatingBox",
9364
- props: {
9365
- visible: { type: Boolean, default: false },
9366
- position: { default: () => ({ left: 0, top: 0 }) },
9367
- rect: { default: () => ({ width: "auto", height: "auto" }) },
9368
- title: { default: "" }
9369
- },
9370
- emits: ["update:visible"],
9371
- setup(__props, { expose: __expose, emit: __emit }) {
9372
- const props = __props;
9373
- const emit = __emit;
9374
- const target = ref();
9375
- const dragTarget = ref();
9376
- const style = computed(() => ({
9377
- left: `${props.position.left}px`,
9378
- top: `${props.position.top}px`,
9379
- width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
9380
- height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
9381
- }));
9382
- let moveable = null;
9383
- const initMoveable = () => {
9384
- moveable = new Moveable(globalThis.document.body, {
9385
- className: "m-editor-floating-box-moveable",
9386
- target: target.value,
9387
- draggable: true,
9388
- resizable: true,
9389
- edge: true,
9390
- keepRatio: false,
9391
- origin: false,
9392
- snappable: true,
9393
- dragTarget: dragTarget.value,
9394
- dragTargetSelf: false,
9395
- linePadding: 10,
9396
- controlPadding: 10
9397
- });
9398
- moveable.on("drag", (e) => {
9399
- e.target.style.transform = e.transform;
9400
- });
9401
- moveable.on("resize", (e) => {
9402
- e.target.style.width = `${e.width}px`;
9403
- e.target.style.height = `${e.height}px`;
9404
- e.target.style.transform = e.drag.transform;
9405
- });
9406
- };
9407
- const destroyMoveable = () => {
9408
- moveable?.destroy();
9409
- moveable = null;
9410
- };
9411
- watch(
9412
- () => props.visible,
9413
- async (visible) => {
9414
- if (visible) {
9415
- await nextTick();
9416
- initMoveable();
9417
- } else {
9418
- destroyMoveable();
9419
- }
9420
- },
9421
- {
9422
- immediate: true
9423
- }
9424
- );
9425
- onBeforeUnmount(() => {
9426
- destroyMoveable();
9427
- });
9428
- const closeHandler = () => {
9429
- emit("update:visible", false);
9430
- };
9431
- __expose({
9432
- target
9433
- });
9434
- return (_ctx, _cache) => {
9435
- return _ctx.visible ? (openBlock(), createBlock(Teleport, {
9436
- key: 0,
9437
- to: "body"
9438
- }, [
9439
- createElementVNode("div", {
9440
- ref_key: "target",
9441
- ref: target,
9442
- class: "m-editor-float-box",
9443
- style: normalizeStyle(style.value)
9444
- }, [
9445
- createElementVNode("div", {
9446
- ref_key: "dragTarget",
9447
- ref: dragTarget,
9448
- class: "m-editor-float-box-title"
9449
- }, [
9450
- renderSlot(_ctx.$slots, "title", {}, () => [
9451
- createElementVNode("span", null, toDisplayString(_ctx.title), 1)
9452
- ]),
9453
- createElementVNode("div", null, [
9454
- createVNode(unref(TMagicButton), {
9455
- link: "",
9456
- size: "small",
9457
- icon: unref(Close),
9458
- onClick: closeHandler
9459
- }, null, 8, ["icon"])
9460
- ])
9461
- ], 512),
9462
- createElementVNode("div", _hoisted_1$3, [
9463
- renderSlot(_ctx.$slots, "body")
9464
- ])
9465
- ], 4)
9466
- ])) : createCommentVNode("", true);
9467
- };
9468
- }
9469
- });
9470
-
9471
9408
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
9472
9409
  __name: "NodeListMenu",
9473
9410
  setup(__props) {
@@ -9550,7 +9487,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
9550
9487
  ]),
9551
9488
  _: 1
9552
9489
  })) : createCommentVNode("", true),
9553
- page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$8, {
9490
+ page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$p, {
9554
9491
  key: 1,
9555
9492
  ref_key: "box",
9556
9493
  ref: box,
@@ -9560,7 +9497,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
9560
9497
  position: menuPosition.value
9561
9498
  }, {
9562
9499
  body: withCtx(() => [
9563
- createVNode(_sfc_main$n, {
9500
+ createVNode(_sfc_main$m, {
9564
9501
  class: "m-editor-node-list-menu magic-editor-layer-tree",
9565
9502
  data: nodeData.value,
9566
9503
  "node-status-map": unref(nodeStatusMap),
@@ -9809,7 +9746,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9809
9746
  };
9810
9747
  __expose({ show });
9811
9748
  return (_ctx, _cache) => {
9812
- return openBlock(), createBlock(_sfc_main$h, {
9749
+ return openBlock(), createBlock(_sfc_main$g, {
9813
9750
  "menu-data": menuData.value,
9814
9751
  ref_key: "menu",
9815
9752
  ref: menu
@@ -9970,7 +9907,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9970
9907
  }
9971
9908
  };
9972
9909
  return (_ctx, _cache) => {
9973
- return openBlock(), createBlock(_sfc_main$9, {
9910
+ return openBlock(), createBlock(_sfc_main$8, {
9974
9911
  class: "m-editor-stage",
9975
9912
  ref_key: "stageWrap",
9976
9913
  ref: stageWrap,
@@ -10579,6 +10516,8 @@ class StageOverlay extends BaseService {
10579
10516
  editorService.on("update", this.updateHandler);
10580
10517
  editorService.on("add", this.addHandler);
10581
10518
  editorService.on("remove", this.removeHandler);
10519
+ editorService.on("drag-to", this.updateHandler);
10520
+ editorService.on("move-layer", this.updateHandler);
10582
10521
  }
10583
10522
  closeOverlay() {
10584
10523
  this.set("stageOverlayVisible", false);
@@ -10592,6 +10531,8 @@ class StageOverlay extends BaseService {
10592
10531
  editorService.off("update", this.updateHandler);
10593
10532
  editorService.off("add", this.addHandler);
10594
10533
  editorService.off("remove", this.removeHandler);
10534
+ editorService.off("drag-to", this.updateHandler);
10535
+ editorService.off("move-layer", this.updateHandler);
10595
10536
  }
10596
10537
  updateOverlay() {
10597
10538
  const sourceEl = this.get("sourceEl");
@@ -10618,12 +10559,6 @@ class StageOverlay extends BaseService {
10618
10559
  });
10619
10560
  }
10620
10561
  const wrapDiv = this.get("wrapDiv");
10621
- const sourceEl = this.get("sourceEl");
10622
- wrapDiv.style.cssText = `
10623
- width: ${sourceEl?.scrollWidth}px;
10624
- height: ${sourceEl?.scrollHeight}px;
10625
- background-color: #fff;
10626
- `;
10627
10562
  await this.render();
10628
10563
  return wrapDiv;
10629
10564
  }
@@ -10650,11 +10585,17 @@ class StageOverlay extends BaseService {
10650
10585
  async render() {
10651
10586
  this.createContentEl();
10652
10587
  const contentEl = this.get("contentEl");
10588
+ const sourceEl = this.get("sourceEl");
10653
10589
  const wrapDiv = this.get("wrapDiv");
10654
10590
  const subStage = this.get("stage");
10655
10591
  const stageOptions = this.get("stageOptions");
10656
10592
  if (!contentEl)
10657
10593
  return;
10594
+ wrapDiv.style.cssText = `
10595
+ width: ${sourceEl?.scrollWidth}px;
10596
+ height: ${sourceEl?.scrollHeight}px;
10597
+ background-color: #fff;
10598
+ `;
10658
10599
  Array.from(wrapDiv.children).forEach((element) => {
10659
10600
  element.remove();
10660
10601
  });
@@ -10667,17 +10608,31 @@ class StageOverlay extends BaseService {
10667
10608
  }
10668
10609
  }
10669
10610
  updateHandler = () => {
10670
- this.render();
10671
- this.updateOverlay();
10611
+ setTimeout(() => {
10612
+ this.render();
10613
+ this.updateOverlay();
10614
+ this.updateSelectStatus();
10615
+ });
10672
10616
  };
10673
10617
  addHandler = () => {
10674
10618
  this.render();
10675
10619
  this.updateOverlay();
10620
+ this.updateSelectStatus();
10676
10621
  };
10677
10622
  removeHandler = () => {
10678
10623
  this.render();
10679
10624
  this.updateOverlay();
10625
+ this.updateSelectStatus();
10680
10626
  };
10627
+ updateSelectStatus() {
10628
+ const subStage = this.get("stage");
10629
+ const nodes = editorService.get("nodes");
10630
+ if (nodes.length > 1) {
10631
+ subStage?.multiSelect(nodes.map((n) => n.id));
10632
+ } else {
10633
+ subStage?.select(nodes[0].id);
10634
+ }
10635
+ }
10681
10636
  }
10682
10637
  const stageOverlayService = new StageOverlay();
10683
10638
 
@@ -11138,7 +11093,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11138
11093
  ]),
11139
11094
  sidebar: withCtx(() => [
11140
11095
  renderSlot(_ctx.$slots, "sidebar", { editorService: unref(editorService) }, () => [
11141
- createVNode(_sfc_main$b, {
11096
+ createVNode(_sfc_main$a, {
11142
11097
  data: _ctx.sidebar,
11143
11098
  "layer-content-menu": _ctx.layerContentMenu,
11144
11099
  "custom-content-menu": _ctx.customContentMenu
@@ -11262,4 +11217,4 @@ const index = {
11262
11217
  }
11263
11218
  };
11264
11219
 
11265
- export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$Q as CodeBlockEditor, _sfc_main$m as CodeBlockList, _sfc_main$l as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$R as CodeSelect, _sfc_main$N as CodeSelectCol, ColumnLayout, _sfc_main$c as ComponentListPanel, _sfc_main$h as ContentMenu, _sfc_main$L as DataSourceFieldSelect, _sfc_main$M as DataSourceFields, _sfc_main$K as DataSourceInput, _sfc_main$I as DataSourceMethodSelect, _sfc_main$J as DataSourceMethods, _sfc_main$H as DataSourceMocks, _sfc_main$G as DataSourceSelect, DragType, _sfc_main$F as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$O as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$d as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$q as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$U as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };
11220
+ export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$Q as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$R as CodeSelect, _sfc_main$N as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$g as ContentMenu, _sfc_main$L as DataSourceFieldSelect, _sfc_main$M as DataSourceFields, _sfc_main$K as DataSourceInput, _sfc_main$I as DataSourceMethodSelect, _sfc_main$J as DataSourceMethods, _sfc_main$H as DataSourceMocks, _sfc_main$G as DataSourceSelect, DragType, _sfc_main$F as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$O as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$q as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$U as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };