@tmagic/editor 1.3.13 → 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
  }));
@@ -3464,8 +3489,8 @@
3464
3489
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true)
3465
3490
  ]),
3466
3491
  paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
3467
- key: 0,
3468
3492
  name: "params",
3493
+ key: _ctx.model[_ctx.name],
3469
3494
  model: _ctx.model,
3470
3495
  size: _ctx.size,
3471
3496
  "params-config": paramsConfig.value,
@@ -5681,7 +5706,7 @@
5681
5706
  ])
5682
5707
  ]),
5683
5708
  _: 1
5684
- }, 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)
5685
5710
  ], 34)) : vue.createCommentVNode("", true);
5686
5711
  };
5687
5712
  }
@@ -5957,7 +5982,7 @@
5957
5982
  );
5958
5983
  vue.watch(active, (active2) => {
5959
5984
  if (active2 === schema.NodeType.PAGE) {
5960
- if (!activePage.value) {
5985
+ if (!activePage.value && !pageList.value.length) {
5961
5986
  editorService?.selectRoot();
5962
5987
  return;
5963
5988
  }
@@ -5965,11 +5990,11 @@
5965
5990
  return;
5966
5991
  }
5967
5992
  if (active2 === schema.NodeType.PAGE_FRAGMENT) {
5968
- if (!activePageFragment.value) {
5993
+ if (!activePageFragment.value && !pageFragmentList.value.length) {
5969
5994
  editorService?.selectRoot();
5970
5995
  return;
5971
5996
  }
5972
- switchPage(activePageFragment.value);
5997
+ switchPage(activePageFragment.value || pageFragmentList.value[0].id);
5973
5998
  }
5974
5999
  });
5975
6000
  const switchPage = (id) => {
@@ -6516,108 +6541,141 @@
6516
6541
  }
6517
6542
  });
6518
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
+
6519
6654
  const useFloatBox = (slideKeys) => {
6520
- const services = vue.inject("services");
6521
- const moveable = vue.ref();
6522
- const floatBox = vue.ref();
6523
- const floatBoxStates = vue.computed(() => services?.uiService.get("floatBox"));
6524
- const curKey = vue.ref("");
6525
- const target = vue.computed(
6526
- () => 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
+ )
6527
6667
  );
6528
6668
  const showingBoxKeys = vue.computed(
6529
- () => [...floatBoxStates.value?.keys() ?? []].filter((key) => floatBoxStates.value?.get(key)?.status)
6669
+ () => Object.keys(floatBoxStates.value).filter((key) => floatBoxStates.value[key].status)
6530
6670
  );
6531
6671
  const isDraging = vue.ref(false);
6532
- const showFloatBox = async (key) => {
6533
- const curBoxStatus = floatBoxStates.value?.get(curKey.value)?.status;
6534
- if (curKey.value === key && curBoxStatus)
6535
- return;
6536
- curKey.value = key;
6537
- setSlideState(key, {
6538
- zIndex: getMaxZIndex() + 1,
6539
- status: true
6540
- });
6541
- await vue.nextTick();
6542
- if (moveable.value) {
6543
- moveable.value.target = target.value;
6544
- moveable.value.dragTarget = getDragTarget();
6545
- moveable.value.updateRect();
6546
- } else {
6547
- initFloatBoxMoveable();
6548
- }
6549
- };
6550
- const setSlideState = (key, data) => {
6551
- const slideState = floatBoxStates.value?.get(key);
6552
- if (!slideState)
6553
- return;
6554
- floatBoxStates.value?.set(key, {
6555
- ...slideState,
6556
- ...data
6557
- });
6558
- };
6559
- const getDragTarget = (key) => `.m-editor-float-box-header-${key ?? curKey.value}`;
6560
- const closeFloatBox = (key) => {
6561
- setSlideState(key, {
6562
- status: false
6563
- });
6564
- if (!floatBoxStates.value?.values)
6565
- return;
6566
- const keys = [...floatBoxStates.value?.keys()];
6567
- const values = [...floatBoxStates.value?.values()];
6568
- const lastFloatBoxLen = values.filter((state) => state.status).length;
6569
- if (lastFloatBoxLen === 0) {
6570
- moveable.value?.destroy();
6571
- moveable.value = void 0;
6572
- return;
6573
- }
6574
- if (key === curKey.value) {
6575
- const zIndexList = values.filter((item) => item.status).map((item) => item.zIndex);
6576
- const maxZIndex = Math.max(...zIndexList);
6577
- const key2 = keys.find((key3) => floatBoxStates.value?.get(key3)?.zIndex === maxZIndex);
6578
- if (!key2)
6579
- return;
6580
- showFloatBox(key2);
6581
- }
6582
- };
6583
- const getMaxZIndex = () => {
6584
- if (!floatBoxStates.value?.values())
6585
- return 0;
6586
- const list = [...floatBoxStates.value?.values()].map((state) => state.zIndex);
6587
- return Math.max(...list) ?? 0;
6588
- };
6589
- const initFloatBoxMoveable = () => {
6590
- const dragTarget = getDragTarget();
6591
- moveable.value = new Moveable(document.body, {
6592
- target: target.value,
6593
- draggable: true,
6594
- resizable: true,
6595
- edge: true,
6596
- keepRatio: false,
6597
- origin: false,
6598
- snappable: true,
6599
- dragTarget,
6600
- dragTargetSelf: false,
6601
- linePadding: 10,
6602
- controlPadding: 10,
6603
- elementGuidelines: [...floatBoxStates.value?.keys() ?? []].map((key) => getDragTarget(key)),
6604
- bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
6605
- });
6606
- moveable.value.on("drag", (e) => {
6607
- e.target.style.transform = e.transform;
6608
- });
6609
- moveable.value.on("resize", (e) => {
6610
- e.target.style.width = `${e.width}px`;
6611
- e.target.style.height = `${e.height}px`;
6612
- e.target.style.transform = e.drag.transform;
6613
- });
6614
- };
6672
+ const dragstartHandler = () => isDraging.value = true;
6615
6673
  const dragendHandler = (key, e) => {
6616
- setSlideState(key, {
6674
+ floatBoxStates.value[key] = {
6617
6675
  left: e.clientX,
6618
- top: e.clientY
6619
- });
6620
- showFloatBox(key);
6676
+ top: e.clientY,
6677
+ status: true
6678
+ };
6621
6679
  isDraging.value = false;
6622
6680
  };
6623
6681
  document.body.addEventListener("dragover", (e) => {
@@ -6625,11 +6683,18 @@
6625
6683
  return;
6626
6684
  e.preventDefault();
6627
6685
  });
6628
- const dragstartHandler = () => isDraging.value = true;
6629
6686
  vue.watch(
6630
6687
  () => slideKeys.value,
6631
6688
  () => {
6632
- 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
+ }
6633
6698
  },
6634
6699
  {
6635
6700
  deep: true,
@@ -6637,17 +6702,14 @@
6637
6702
  }
6638
6703
  );
6639
6704
  return {
6640
- showFloatBox,
6641
- closeFloatBox,
6642
6705
  dragstartHandler,
6643
6706
  dragendHandler,
6644
6707
  floatBoxStates,
6645
- floatBox,
6646
6708
  showingBoxKeys
6647
6709
  };
6648
6710
  };
6649
6711
 
6650
- const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
6712
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
6651
6713
  ...{
6652
6714
  name: "MEditorSearchInput"
6653
6715
  },
@@ -6698,14 +6760,14 @@
6698
6760
  });
6699
6761
  };
6700
6762
 
6701
- const _hoisted_1$a = ["draggable", "data-node-id", "data-is-container"];
6763
+ const _hoisted_1$9 = ["draggable", "data-node-id", "data-is-container"];
6702
6764
  const _hoisted_2$6 = { class: "tree-node-label" };
6703
6765
  const _hoisted_3$3 = { class: "tree-node-tool" };
6704
6766
  const _hoisted_4$3 = {
6705
6767
  key: 0,
6706
6768
  class: "m-editor-tree-node-children"
6707
6769
  };
6708
- const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
6770
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
6709
6771
  ...{
6710
6772
  name: "MEditorTreeNode"
6711
6773
  },
@@ -6815,18 +6877,18 @@
6815
6877
  }, 1032, ["data", "node-status-map", "indent"]);
6816
6878
  }), 128))
6817
6879
  ])) : vue.createCommentVNode("", true)
6818
- ], 40, _hoisted_1$a)), [
6880
+ ], 40, _hoisted_1$9)), [
6819
6881
  [vue.vShow, visible.value]
6820
6882
  ]);
6821
6883
  };
6822
6884
  }
6823
6885
  });
6824
6886
 
6825
- const _hoisted_1$9 = {
6887
+ const _hoisted_1$8 = {
6826
6888
  key: 1,
6827
6889
  class: "m-editor-tree-empty"
6828
6890
  };
6829
- const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
6891
+ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
6830
6892
  ...{
6831
6893
  name: "MEditorTree"
6832
6894
  },
@@ -6850,7 +6912,7 @@
6850
6912
  onDragover: handleDragOver
6851
6913
  }, [
6852
6914
  _ctx.data?.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.data, (item) => {
6853
- return vue.openBlock(), vue.createBlock(_sfc_main$o, {
6915
+ return vue.openBlock(), vue.createBlock(_sfc_main$n, {
6854
6916
  key: item.id,
6855
6917
  data: item,
6856
6918
  indent: _ctx.indent,
@@ -6867,7 +6929,7 @@
6867
6929
  ]),
6868
6930
  _: 2
6869
6931
  }, 1032, ["data", "indent", "node-status-map"]);
6870
- }), 128)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
6932
+ }), 128)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
6871
6933
  vue.createElementVNode("p", null, vue.toDisplayString(_ctx.emptyText), 1)
6872
6934
  ]))
6873
6935
  ], 32);
@@ -6947,7 +7009,7 @@
6947
7009
  };
6948
7010
  };
6949
7011
 
6950
- const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
7012
+ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
6951
7013
  ...{
6952
7014
  name: "MEditorCodeBlockList"
6953
7015
  },
@@ -7029,7 +7091,7 @@
7029
7091
  filter: filterTextChangeHandler
7030
7092
  });
7031
7093
  return (_ctx, _cache) => {
7032
- return vue.openBlock(), vue.createBlock(_sfc_main$n, {
7094
+ return vue.openBlock(), vue.createBlock(_sfc_main$m, {
7033
7095
  data: codeList.value,
7034
7096
  "node-status-map": vue.unref(nodeStatusMap),
7035
7097
  onNodeClick: clickHandler
@@ -7085,8 +7147,8 @@
7085
7147
  }
7086
7148
  });
7087
7149
 
7088
- const _hoisted_1$8 = { class: "search-wrapper" };
7089
- const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
7150
+ const _hoisted_1$7 = { class: "search-wrapper" };
7151
+ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
7090
7152
  ...{
7091
7153
  name: "MEditorCodeBlockListPanel"
7092
7154
  },
@@ -7108,8 +7170,8 @@
7108
7170
  vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
7109
7171
  default: vue.withCtx(() => [
7110
7172
  vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
7111
- vue.createElementVNode("div", _hoisted_1$8, [
7112
- vue.createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
7173
+ vue.createElementVNode("div", _hoisted_1$7, [
7174
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7113
7175
  editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
7114
7176
  key: 0,
7115
7177
  class: "create-code-button",
@@ -7125,7 +7187,7 @@
7125
7187
  vue.renderSlot(_ctx.$slots, "code-block-panel-search")
7126
7188
  ])
7127
7189
  ]),
7128
- vue.createVNode(_sfc_main$m, {
7190
+ vue.createVNode(_sfc_main$l, {
7129
7191
  ref_key: "codeBlockList",
7130
7192
  ref: codeBlockList,
7131
7193
  "custom-error": _ctx.customError,
@@ -7157,7 +7219,7 @@
7157
7219
  }
7158
7220
  });
7159
7221
 
7160
- const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
7222
+ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
7161
7223
  ...{
7162
7224
  name: "MEditorDataSourceConfigPanel"
7163
7225
  },
@@ -7213,7 +7275,7 @@
7213
7275
  }
7214
7276
  });
7215
7277
 
7216
- const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
7278
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
7217
7279
  ...{
7218
7280
  name: "MEditorDataSourceList"
7219
7281
  },
@@ -7302,7 +7364,7 @@
7302
7364
  filter: filterTextChangeHandler
7303
7365
  });
7304
7366
  return (_ctx, _cache) => {
7305
- return vue.openBlock(), vue.createBlock(_sfc_main$n, {
7367
+ return vue.openBlock(), vue.createBlock(_sfc_main$m, {
7306
7368
  data: list.value,
7307
7369
  "node-status-map": vue.unref(nodeStatusMap),
7308
7370
  onNodeClick: clickHandler
@@ -7355,9 +7417,9 @@
7355
7417
  }
7356
7418
  });
7357
7419
 
7358
- const _hoisted_1$7 = { class: "search-wrapper" };
7420
+ const _hoisted_1$6 = { class: "search-wrapper" };
7359
7421
  const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
7360
- const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
7422
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
7361
7423
  ...{
7362
7424
  name: "MEditorDataSourceListPanel"
7363
7425
  },
@@ -7421,8 +7483,8 @@
7421
7483
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
7422
7484
  vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
7423
7485
  default: vue.withCtx(() => [
7424
- vue.createElementVNode("div", _hoisted_1$7, [
7425
- vue.createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
7486
+ vue.createElementVNode("div", _hoisted_1$6, [
7487
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7426
7488
  editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
7427
7489
  key: 0,
7428
7490
  placement: "right"
@@ -7457,14 +7519,14 @@
7457
7519
  _: 1
7458
7520
  })) : vue.createCommentVNode("", true)
7459
7521
  ]),
7460
- vue.createVNode(_sfc_main$j, {
7522
+ vue.createVNode(_sfc_main$i, {
7461
7523
  onEdit: editHandler,
7462
7524
  onRemove: removeHandler
7463
7525
  })
7464
7526
  ]),
7465
7527
  _: 1
7466
7528
  }),
7467
- vue.createVNode(_sfc_main$k, {
7529
+ vue.createVNode(_sfc_main$j, {
7468
7530
  ref_key: "editDialog",
7469
7531
  ref: editDialog,
7470
7532
  disabled: !editable.value,
@@ -7478,7 +7540,7 @@
7478
7540
  }
7479
7541
  });
7480
7542
 
7481
- const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
7543
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
7482
7544
  ...{
7483
7545
  name: "MEditorContentMenu"
7484
7546
  },
@@ -7644,7 +7706,7 @@
7644
7706
  }
7645
7707
  });
7646
7708
 
7647
- const _hoisted_1$6 = {
7709
+ const _hoisted_1$5 = {
7648
7710
  width: "1em",
7649
7711
  height: "1em",
7650
7712
  viewBox: "0 0 16 16",
@@ -7664,14 +7726,14 @@
7664
7726
  _hoisted_2$4,
7665
7727
  _hoisted_3$2
7666
7728
  ];
7667
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
7729
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
7668
7730
  ...{
7669
7731
  name: "MEditorFolderMinusIcon"
7670
7732
  },
7671
7733
  __name: "FolderMinusIcon",
7672
7734
  setup(__props) {
7673
7735
  return (_ctx, _cache) => {
7674
- 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);
7675
7737
  };
7676
7738
  }
7677
7739
  });
@@ -7749,7 +7811,7 @@
7749
7811
  };
7750
7812
  };
7751
7813
 
7752
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
7814
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
7753
7815
  ...{
7754
7816
  name: "MEditorLayerMenu"
7755
7817
  },
@@ -7816,7 +7878,7 @@
7816
7878
  {
7817
7879
  type: "button",
7818
7880
  text: "全部折叠",
7819
- icon: _sfc_main$g,
7881
+ icon: _sfc_main$f,
7820
7882
  display: () => utils.isPage(node.value) || utils.isPageFragment(node.value),
7821
7883
  handler: () => {
7822
7884
  emit("collapse-all");
@@ -7845,7 +7907,7 @@
7845
7907
  show
7846
7908
  });
7847
7909
  return (_ctx, _cache) => {
7848
- return vue.openBlock(), vue.createBlock(_sfc_main$h, {
7910
+ return vue.openBlock(), vue.createBlock(_sfc_main$g, {
7849
7911
  "menu-data": menuData.value,
7850
7912
  ref_key: "menu",
7851
7913
  ref: menu,
@@ -7855,7 +7917,7 @@
7855
7917
  }
7856
7918
  });
7857
7919
 
7858
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
7920
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
7859
7921
  __name: "LayerNodeTool",
7860
7922
  props: {
7861
7923
  data: {}
@@ -7952,7 +8014,7 @@
7952
8014
  return {
7953
8015
  menu,
7954
8016
  nodeClickHandler,
7955
- nodeContentmenuHandler(event, data) {
8017
+ nodeContentMenuHandler(event, data) {
7956
8018
  event.preventDefault();
7957
8019
  const nodes = services?.editorService.get("nodes") || [];
7958
8020
  if (nodes.length < 2 || !nodes.includes(data)) {
@@ -8278,12 +8340,12 @@
8278
8340
  () => page.value ? nodeStatusMaps.value.get(page.value.id) : /* @__PURE__ */ new Map()
8279
8341
  );
8280
8342
  vue.watch(
8281
- page,
8282
- (page2) => {
8283
- if (!page2) {
8343
+ () => page.value?.id,
8344
+ (pageId) => {
8345
+ if (!pageId) {
8284
8346
  return;
8285
8347
  }
8286
- nodeStatusMaps.value.set(page2.id, createPageNodeStatus(page2, nodeStatusMaps.value.get(page2.id)));
8348
+ nodeStatusMaps.value.set(pageId, createPageNodeStatus(page.value, nodeStatusMaps.value.get(pageId)));
8287
8349
  },
8288
8350
  {
8289
8351
  immediate: true
@@ -8311,6 +8373,8 @@
8311
8373
  );
8312
8374
  services?.editorService.on("add", (newNodes) => {
8313
8375
  newNodes.forEach((node) => {
8376
+ if (utils.isPage(node) || utils.isPageFragment(node))
8377
+ return;
8314
8378
  traverseNode(node, (node2) => {
8315
8379
  nodeStatusMap.value?.set(node2.id, {
8316
8380
  visible: true,
@@ -8334,7 +8398,7 @@
8334
8398
  };
8335
8399
  };
8336
8400
 
8337
- const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
8401
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
8338
8402
  ...{
8339
8403
  name: "MEditorLayerPanel"
8340
8404
  },
@@ -8376,15 +8440,15 @@
8376
8440
  const {
8377
8441
  menu,
8378
8442
  nodeClickHandler,
8379
- nodeContentmenuHandler,
8443
+ nodeContentMenuHandler,
8380
8444
  highlightHandler: mouseenterHandler
8381
8445
  } = useClick(services, isCtrlKeyDown, nodeStatusMap);
8382
8446
  return (_ctx, _cache) => {
8383
8447
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-layer-panel" }, {
8384
8448
  default: vue.withCtx(() => [
8385
8449
  vue.renderSlot(_ctx.$slots, "layer-panel-header"),
8386
- vue.createVNode(_sfc_main$p, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
8387
- 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, {
8388
8452
  key: 0,
8389
8453
  tabindex: "-1",
8390
8454
  ref_key: "tree",
@@ -8395,7 +8459,7 @@
8395
8459
  onNodeDragstart: vue.unref(handleDragStart),
8396
8460
  onNodeDragleave: vue.unref(handleDragLeave),
8397
8461
  onNodeDragend: vue.unref(handleDragEnd),
8398
- onNodeContextmenu: vue.unref(nodeContentmenuHandler),
8462
+ onNodeContextmenu: vue.unref(nodeContentMenuHandler),
8399
8463
  onNodeMouseenter: vue.unref(mouseenterHandler),
8400
8464
  onNodeClick: vue.unref(nodeClickHandler)
8401
8465
  }, {
@@ -8404,7 +8468,7 @@
8404
8468
  ]),
8405
8469
  "tree-node-tool": vue.withCtx(({ data: nodeData2 }) => [
8406
8470
  vue.renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData2 }, () => [
8407
- vue.createVNode(_sfc_main$e, { data: nodeData2 }, null, 8, ["data"])
8471
+ vue.createVNode(_sfc_main$d, { data: nodeData2 }, null, 8, ["data"])
8408
8472
  ])
8409
8473
  ]),
8410
8474
  "tree-node-label": vue.withCtx(({ data: nodeData2 }) => [
@@ -8413,7 +8477,7 @@
8413
8477
  _: 3
8414
8478
  }, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : vue.createCommentVNode("", true),
8415
8479
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
8416
- vue.createVNode(_sfc_main$f, {
8480
+ vue.createVNode(_sfc_main$e, {
8417
8481
  ref_key: "menu",
8418
8482
  ref: menu,
8419
8483
  "layer-content-menu": _ctx.layerContentMenu,
@@ -8428,9 +8492,9 @@
8428
8492
  }
8429
8493
  });
8430
8494
 
8431
- const _hoisted_1$5 = ["onClick", "onDragstart"];
8495
+ const _hoisted_1$4 = ["onClick", "onDragstart"];
8432
8496
  const _hoisted_2$3 = ["title"];
8433
- const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
8497
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
8434
8498
  ...{
8435
8499
  name: "MEditorComponentListPanel"
8436
8500
  },
@@ -8510,7 +8574,7 @@
8510
8574
  "model-value": collapseValue.value
8511
8575
  }, {
8512
8576
  default: vue.withCtx(() => [
8513
- vue.createVNode(_sfc_main$p, { onSearch: filterTextChangeHandler }),
8577
+ vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
8514
8578
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
8515
8579
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
8516
8580
  group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
@@ -8549,7 +8613,7 @@
8549
8613
  title: item.text
8550
8614
  }, vue.toDisplayString(item.text), 9, _hoisted_2$3)
8551
8615
  ])
8552
- ], 40, _hoisted_1$5);
8616
+ ], 40, _hoisted_1$4);
8553
8617
  }), 128))
8554
8618
  ]),
8555
8619
  _: 2
@@ -8566,7 +8630,7 @@
8566
8630
  }
8567
8631
  });
8568
8632
 
8569
- const _hoisted_1$4 = {
8633
+ const _hoisted_1$3 = {
8570
8634
  key: 0,
8571
8635
  class: "m-editor-sidebar"
8572
8636
  };
@@ -8576,10 +8640,8 @@
8576
8640
  key: 1,
8577
8641
  class: "magic-editor-tab-panel-title"
8578
8642
  };
8579
- const _hoisted_5$1 = { class: "m-editor-float-box-list" };
8580
- const _hoisted_6 = ["onClick"];
8581
- const _hoisted_7 = { class: "m-editor-float-box-body" };
8582
- 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({
8583
8645
  ...{
8584
8646
  name: "MEditorSidebar"
8585
8647
  },
@@ -8600,7 +8662,7 @@
8600
8662
  type: "component",
8601
8663
  icon: iconsVue.Goods,
8602
8664
  text: "组件",
8603
- component: _sfc_main$c,
8665
+ component: _sfc_main$b,
8604
8666
  slots: {}
8605
8667
  },
8606
8668
  layer: {
@@ -8612,7 +8674,7 @@
8612
8674
  layerContentMenu: props.layerContentMenu,
8613
8675
  customContentMenu: props.customContentMenu
8614
8676
  },
8615
- component: _sfc_main$d,
8677
+ component: _sfc_main$c,
8616
8678
  slots: {}
8617
8679
  },
8618
8680
  "code-block": {
@@ -8620,26 +8682,16 @@
8620
8682
  type: "component",
8621
8683
  icon: iconsVue.EditPen,
8622
8684
  text: "代码编辑",
8623
- component: _sfc_main$l,
8624
- slots: {},
8625
- boxComponentConfig: {
8626
- props: {
8627
- slideType: "box"
8628
- }
8629
- }
8685
+ component: _sfc_main$k,
8686
+ slots: {}
8630
8687
  },
8631
8688
  "data-source": {
8632
8689
  $key: "data-source",
8633
8690
  type: "component",
8634
8691
  icon: iconsVue.Coin,
8635
8692
  text: "数据源",
8636
- component: _sfc_main$i,
8637
- slots: {},
8638
- boxComponentConfig: {
8639
- props: {
8640
- slideType: "box"
8641
- }
8642
- }
8693
+ component: _sfc_main$h,
8694
+ slots: {}
8643
8695
  }
8644
8696
  };
8645
8697
  return typeof data === "string" ? map[data] : data;
@@ -8652,7 +8704,7 @@
8652
8704
  }
8653
8705
  );
8654
8706
  const slideKeys = vue.computed(() => sideBarItems.value.map((sideBarItem) => sideBarItem.$key));
8655
- const { showFloatBox, closeFloatBox, dragstartHandler, dragendHandler, floatBoxStates, floatBox, showingBoxKeys } = useFloatBox(slideKeys);
8707
+ const { dragstartHandler, dragendHandler, floatBoxStates, showingBoxKeys } = useFloatBox(slideKeys);
8656
8708
  vue.watch(
8657
8709
  () => showingBoxKeys.value.length,
8658
8710
  () => {
@@ -8676,7 +8728,7 @@
8676
8728
  });
8677
8729
  return (_ctx, _cache) => {
8678
8730
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
8679
- _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, [
8680
8732
  vue.createElementVNode("div", _hoisted_2$2, [
8681
8733
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
8682
8734
  return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
@@ -8694,7 +8746,7 @@
8694
8746
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
8695
8747
  config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
8696
8748
  ], 42, _hoisted_3$1)), [
8697
- [vue.vShow, !vue.unref(floatBoxStates)?.get(config.$key)?.status]
8749
+ [vue.vShow, !vue.unref(floatBoxStates)[config.$key]?.status]
8698
8750
  ]);
8699
8751
  }), 128))
8700
8752
  ]),
@@ -8703,7 +8755,7 @@
8703
8755
  class: "m-editor-sidebar-content",
8704
8756
  key: config.$key ?? index
8705
8757
  }, [
8706
- 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 }, [
8707
8759
  config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
8708
8760
  name: "component-list-panel-header",
8709
8761
  fn: vue.withCtx(() => [
@@ -8805,39 +8857,27 @@
8805
8857
  }), 128))
8806
8858
  ])) : vue.createCommentVNode("", true),
8807
8859
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
8808
- vue.createElementVNode("div", _hoisted_5$1, [
8809
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
8810
- 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, {
8811
8863
  key: config.$key ?? index,
8812
- ref_for: true,
8813
- ref_key: "floatBox",
8814
- ref: floatBox,
8815
- class: vue.normalizeClass(["m-editor-float-box", `m-editor-float-box-${config.$key}`]),
8816
- style: vue.normalizeStyle({
8817
- left: `${vue.unref(floatBoxStates)?.get(config.$key)?.left}px`,
8818
- top: `${vue.unref(floatBoxStates)?.get(config.$key)?.top}px`,
8819
- zIndex: vue.unref(floatBoxStates)?.get(config.$key)?.zIndex
8820
- })
8821
- }, [
8822
- vue.createElementVNode("div", {
8823
- class: vue.normalizeClass(["m-editor-float-box-header", `m-editor-float-box-header-${config.$key}`]),
8824
- onClick: ($event) => vue.unref(showFloatBox)(config.$key)
8825
- }, [
8826
- vue.createElementVNode("div", null, vue.toDisplayString(config.text), 1),
8827
- vue.createVNode(_sfc_main$O, {
8828
- class: "m-editor-float-box-close",
8829
- icon: vue.unref(iconsVue.Close),
8830
- onClick: vue.withModifiers(($event) => vue.unref(closeFloatBox)(config.$key), ["stop"])
8831
- }, null, 8, ["icon", "onClick"])
8832
- ], 10, _hoisted_6),
8833
- vue.createElementVNode("div", _hoisted_7, [
8834
- 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)
8835
- ])
8836
- ], 6)), [
8837
- [vue.vShow, vue.unref(floatBoxStates)?.get(config.$key)?.status]
8838
- ]);
8839
- }), 128))
8840
- ])
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))
8841
8881
  ]))
8842
8882
  ], 64);
8843
8883
  };
@@ -8972,7 +9012,7 @@
8972
9012
  };
8973
9013
  }
8974
9014
 
8975
- const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
9015
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
8976
9016
  ...{
8977
9017
  name: "MEditorScrollBar"
8978
9018
  },
@@ -9060,7 +9100,7 @@
9060
9100
  }
9061
9101
  });
9062
9102
 
9063
- const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
9103
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
9064
9104
  ...{
9065
9105
  name: "MEditorScrollViewer"
9066
9106
  },
@@ -9147,14 +9187,14 @@
9147
9187
  vue.renderSlot(_ctx.$slots, "default")
9148
9188
  ], 4),
9149
9189
  vue.renderSlot(_ctx.$slots, "content"),
9150
- scrollHeight.value > _ctx.wrapHeight ? (vue.openBlock(), vue.createBlock(_sfc_main$a, {
9190
+ scrollHeight.value > _ctx.wrapHeight ? (vue.openBlock(), vue.createBlock(_sfc_main$9, {
9151
9191
  key: 0,
9152
9192
  "scroll-size": scrollHeight.value,
9153
9193
  pos: vOffset.value,
9154
9194
  size: _ctx.wrapHeight,
9155
9195
  onScroll: vScrollHandler
9156
9196
  }, null, 8, ["scroll-size", "pos", "size"])) : vue.createCommentVNode("", true),
9157
- scrollWidth.value > _ctx.wrapWidth ? (vue.openBlock(), vue.createBlock(_sfc_main$a, {
9197
+ scrollWidth.value > _ctx.wrapWidth ? (vue.openBlock(), vue.createBlock(_sfc_main$9, {
9158
9198
  key: 1,
9159
9199
  "is-horizontal": true,
9160
9200
  "scroll-size": scrollWidth.value,
@@ -9370,116 +9410,6 @@
9370
9410
  return stage;
9371
9411
  };
9372
9412
 
9373
- const _hoisted_1$3 = { class: "m-editor-float-box-body" };
9374
- const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
9375
- __name: "FloatingBox",
9376
- props: {
9377
- visible: { type: Boolean, default: false },
9378
- position: { default: () => ({ left: 0, top: 0 }) },
9379
- rect: { default: () => ({ width: "auto", height: "auto" }) },
9380
- title: { default: "" }
9381
- },
9382
- emits: ["update:visible"],
9383
- setup(__props, { expose: __expose, emit: __emit }) {
9384
- const props = __props;
9385
- const emit = __emit;
9386
- const target = vue.ref();
9387
- const dragTarget = vue.ref();
9388
- const style = vue.computed(() => ({
9389
- left: `${props.position.left}px`,
9390
- top: `${props.position.top}px`,
9391
- width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
9392
- height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
9393
- }));
9394
- let moveable = null;
9395
- const initMoveable = () => {
9396
- moveable = new Moveable(globalThis.document.body, {
9397
- className: "m-editor-floating-box-moveable",
9398
- target: target.value,
9399
- draggable: true,
9400
- resizable: true,
9401
- edge: true,
9402
- keepRatio: false,
9403
- origin: false,
9404
- snappable: true,
9405
- dragTarget: dragTarget.value,
9406
- dragTargetSelf: false,
9407
- linePadding: 10,
9408
- controlPadding: 10
9409
- });
9410
- moveable.on("drag", (e) => {
9411
- e.target.style.transform = e.transform;
9412
- });
9413
- moveable.on("resize", (e) => {
9414
- e.target.style.width = `${e.width}px`;
9415
- e.target.style.height = `${e.height}px`;
9416
- e.target.style.transform = e.drag.transform;
9417
- });
9418
- };
9419
- const destroyMoveable = () => {
9420
- moveable?.destroy();
9421
- moveable = null;
9422
- };
9423
- vue.watch(
9424
- () => props.visible,
9425
- async (visible) => {
9426
- if (visible) {
9427
- await vue.nextTick();
9428
- initMoveable();
9429
- } else {
9430
- destroyMoveable();
9431
- }
9432
- },
9433
- {
9434
- immediate: true
9435
- }
9436
- );
9437
- vue.onBeforeUnmount(() => {
9438
- destroyMoveable();
9439
- });
9440
- const closeHandler = () => {
9441
- emit("update:visible", false);
9442
- };
9443
- __expose({
9444
- target
9445
- });
9446
- return (_ctx, _cache) => {
9447
- return _ctx.visible ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
9448
- key: 0,
9449
- to: "body"
9450
- }, [
9451
- vue.createElementVNode("div", {
9452
- ref_key: "target",
9453
- ref: target,
9454
- class: "m-editor-float-box",
9455
- style: vue.normalizeStyle(style.value)
9456
- }, [
9457
- vue.createElementVNode("div", {
9458
- ref_key: "dragTarget",
9459
- ref: dragTarget,
9460
- class: "m-editor-float-box-title"
9461
- }, [
9462
- vue.renderSlot(_ctx.$slots, "title", {}, () => [
9463
- vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
9464
- ]),
9465
- vue.createElementVNode("div", null, [
9466
- vue.createVNode(vue.unref(design.TMagicButton), {
9467
- link: "",
9468
- size: "small",
9469
- icon: vue.unref(iconsVue.Close),
9470
- onClick: closeHandler
9471
- }, null, 8, ["icon"])
9472
- ])
9473
- ], 512),
9474
- vue.createElementVNode("div", _hoisted_1$3, [
9475
- vue.renderSlot(_ctx.$slots, "body")
9476
- ])
9477
- ], 4)
9478
- ])) : vue.createCommentVNode("", true);
9479
- };
9480
- }
9481
- });
9482
-
9483
9413
  const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
9484
9414
  __name: "NodeListMenu",
9485
9415
  setup(__props) {
@@ -9562,7 +9492,7 @@
9562
9492
  ]),
9563
9493
  _: 1
9564
9494
  })) : vue.createCommentVNode("", true),
9565
- 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, {
9566
9496
  key: 1,
9567
9497
  ref_key: "box",
9568
9498
  ref: box,
@@ -9572,7 +9502,7 @@
9572
9502
  position: menuPosition.value
9573
9503
  }, {
9574
9504
  body: vue.withCtx(() => [
9575
- vue.createVNode(_sfc_main$n, {
9505
+ vue.createVNode(_sfc_main$m, {
9576
9506
  class: "m-editor-node-list-menu magic-editor-layer-tree",
9577
9507
  data: nodeData.value,
9578
9508
  "node-status-map": vue.unref(nodeStatusMap),
@@ -9821,7 +9751,7 @@
9821
9751
  };
9822
9752
  __expose({ show });
9823
9753
  return (_ctx, _cache) => {
9824
- return vue.openBlock(), vue.createBlock(_sfc_main$h, {
9754
+ return vue.openBlock(), vue.createBlock(_sfc_main$g, {
9825
9755
  "menu-data": menuData.value,
9826
9756
  ref_key: "menu",
9827
9757
  ref: menu
@@ -9982,7 +9912,7 @@
9982
9912
  }
9983
9913
  };
9984
9914
  return (_ctx, _cache) => {
9985
- return vue.openBlock(), vue.createBlock(_sfc_main$9, {
9915
+ return vue.openBlock(), vue.createBlock(_sfc_main$8, {
9986
9916
  class: "m-editor-stage",
9987
9917
  ref_key: "stageWrap",
9988
9918
  ref: stageWrap,
@@ -11168,7 +11098,7 @@
11168
11098
  ]),
11169
11099
  sidebar: vue.withCtx(() => [
11170
11100
  vue.renderSlot(_ctx.$slots, "sidebar", { editorService: vue.unref(editorService) }, () => [
11171
- vue.createVNode(_sfc_main$b, {
11101
+ vue.createVNode(_sfc_main$a, {
11172
11102
  data: _ctx.sidebar,
11173
11103
  "layer-content-menu": _ctx.layerContentMenu,
11174
11104
  "custom-content-menu": _ctx.customContentMenu
@@ -11299,14 +11229,14 @@
11299
11229
  exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
11300
11230
  exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
11301
11231
  exports.CodeBlockEditor = _sfc_main$Q;
11302
- exports.CodeBlockList = _sfc_main$m;
11303
- exports.CodeBlockListPanel = _sfc_main$l;
11232
+ exports.CodeBlockList = _sfc_main$l;
11233
+ exports.CodeBlockListPanel = _sfc_main$k;
11304
11234
  exports.CodeDeleteErrorType = CodeDeleteErrorType;
11305
11235
  exports.CodeSelect = _sfc_main$R;
11306
11236
  exports.CodeSelectCol = _sfc_main$N;
11307
11237
  exports.ColumnLayout = ColumnLayout;
11308
- exports.ComponentListPanel = _sfc_main$c;
11309
- exports.ContentMenu = _sfc_main$h;
11238
+ exports.ComponentListPanel = _sfc_main$b;
11239
+ exports.ContentMenu = _sfc_main$g;
11310
11240
  exports.DataSourceFieldSelect = _sfc_main$L;
11311
11241
  exports.DataSourceFields = _sfc_main$M;
11312
11242
  exports.DataSourceInput = _sfc_main$K;
@@ -11323,7 +11253,7 @@
11323
11253
  exports.KeyValue = _sfc_main$D;
11324
11254
  exports.Keys = Keys;
11325
11255
  exports.LayerOffset = LayerOffset;
11326
- exports.LayerPanel = _sfc_main$d;
11256
+ exports.LayerPanel = _sfc_main$c;
11327
11257
  exports.Layout = Layout;
11328
11258
  exports.LayoutContainer = _sfc_main$z;
11329
11259
  exports.PageFragmentSelect = _sfc_main$C;