@tmagic/editor 1.3.6 → 1.3.7

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.
Files changed (75) hide show
  1. package/LICENSE +5432 -0
  2. package/dist/style.css +15 -11
  3. package/dist/tmagic-editor.js +1312 -949
  4. package/dist/tmagic-editor.js.map +1 -1
  5. package/dist/tmagic-editor.umd.cjs +1334 -969
  6. package/dist/tmagic-editor.umd.cjs.map +1 -1
  7. package/package.json +17 -17
  8. package/src/Editor.vue +10 -7
  9. package/src/components/CodeBlockEditor.vue +2 -2
  10. package/src/components/ContentMenu.vue +5 -5
  11. package/src/components/ScrollBar.vue +2 -2
  12. package/src/components/ScrollViewer.vue +2 -2
  13. package/src/components/SplitView.vue +2 -2
  14. package/src/components/TreeNode.vue +3 -3
  15. package/src/editorProps.ts +14 -4
  16. package/src/fields/PageFragmentSelect.vue +55 -0
  17. package/src/hooks/use-getso.ts +2 -2
  18. package/src/hooks/use-stage.ts +18 -1
  19. package/src/index.ts +3 -0
  20. package/src/initService.ts +15 -5
  21. package/src/layouts/AddPageBox.vue +16 -4
  22. package/src/layouts/CodeEditor.vue +2 -2
  23. package/src/layouts/Framework.vue +17 -3
  24. package/src/layouts/PropsPanel.vue +2 -2
  25. package/src/layouts/page-bar/AddButton.vue +48 -0
  26. package/src/layouts/page-bar/PageBar.vue +158 -0
  27. package/src/layouts/{workspace → page-bar}/PageBarScrollContainer.vue +61 -35
  28. package/src/layouts/page-bar/SwitchTypeButton.vue +45 -0
  29. package/src/layouts/sidebar/Sidebar.vue +2 -0
  30. package/src/layouts/sidebar/layer/LayerMenu.vue +39 -27
  31. package/src/layouts/sidebar/layer/LayerPanel.vue +7 -1
  32. package/src/layouts/sidebar/layer/use-click.ts +5 -3
  33. package/src/layouts/sidebar/layer/use-keybinding.ts +8 -8
  34. package/src/layouts/sidebar/layer/use-node-status.ts +3 -3
  35. package/src/layouts/workspace/Workspace.vue +6 -7
  36. package/src/layouts/workspace/viewer/NodeListMenu.vue +2 -2
  37. package/src/layouts/workspace/viewer/Stage.vue +12 -5
  38. package/src/layouts/workspace/viewer/ViewerMenu.vue +93 -80
  39. package/src/services/editor.ts +65 -34
  40. package/src/services/history.ts +6 -2
  41. package/src/services/keybinding.ts +48 -13
  42. package/src/theme/code-block.scss +0 -16
  43. package/src/theme/page-bar.scss +18 -1
  44. package/src/type.ts +22 -7
  45. package/src/utils/content-menu.ts +2 -2
  46. package/src/utils/editor.ts +22 -15
  47. package/src/utils/operator.ts +4 -4
  48. package/types/components/ToolButton.vue.d.ts +2 -2
  49. package/types/editorProps.d.ts +11 -2
  50. package/types/fields/PageFragmentSelect.vue.d.ts +31 -0
  51. package/types/index.d.ts +1 -0
  52. package/types/layouts/AddPageBox.vue.d.ts +14 -1
  53. package/types/layouts/Framework.vue.d.ts +14 -1
  54. package/types/layouts/PropsPanel.vue.d.ts +9 -9
  55. package/types/layouts/page-bar/AddButton.vue.d.ts +16 -0
  56. package/types/layouts/page-bar/PageBar.vue.d.ts +28 -0
  57. package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +24 -0
  58. package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +20 -0
  59. package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -0
  60. package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +22 -3
  61. package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +2 -0
  62. package/types/layouts/sidebar/layer/use-click.d.ts +25 -3
  63. package/types/layouts/sidebar/layer/use-keybinding.d.ts +1 -1
  64. package/types/layouts/workspace/Workspace.vue.d.ts +2 -0
  65. package/types/layouts/workspace/viewer/Stage.vue.d.ts +2 -0
  66. package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +8 -0
  67. package/types/services/dataSource.d.ts +1 -0
  68. package/types/services/editor.d.ts +3 -2
  69. package/types/services/history.d.ts +3 -2
  70. package/types/services/keybinding.d.ts +21 -1
  71. package/types/type.d.ts +25 -12
  72. package/types/utils/editor.d.ts +9 -7
  73. package/src/layouts/workspace/PageBar.vue +0 -87
  74. package/types/layouts/workspace/PageBar.vue.d.ts +0 -15
  75. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +0 -9
@@ -1,13 +1,13 @@
1
- import { defineComponent, ref, watch, onMounted, onUnmounted, 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, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, provide, Transition, toHandlers, onBeforeUnmount, mergeDefaults } from 'vue';
2
- import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, ArrowRight, CopyDocument, DocumentCopy, Files, Hide, Goods, List, EditPen, Top, Bottom, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons-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, normalizeProps, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, provide, Transition, toHandlers, mergeDefaults } from 'vue';
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, Top, Bottom } from '@element-plus/icons-vue';
3
3
  import { throttle, isEmpty, cloneDeep, mergeWith, get, set, isObject, uniq, map, has, pick, keys } from 'lodash-es';
4
4
  import * as monaco from 'monaco-editor';
5
5
  import serialize from 'serialize-javascript';
6
- import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
6
+ 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';
7
7
  import { HookType, NodeType, ActionType } from '@tmagic/schema';
8
8
  import { MFormBox, MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
9
9
  import { MagicTable } from '@tmagic/table';
10
- import { guid, isPop, getNodePath, isNumber, isPage, toLine, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
10
+ import { guid, isPage, isPageFragment, isPop, getNodePath, isNumber, toLine, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
11
11
  import Gesto from 'gesto';
12
12
  import Moveable from 'moveable';
13
13
  import { Watcher, DepTargetType, createRelatedCompTarget, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
@@ -23,10 +23,10 @@ const setConfig = (option) => {
23
23
  };
24
24
  const getConfig = (key) => $TMAGIC_EDITOR[key];
25
25
 
26
- const _hoisted_1$s = {
26
+ const _hoisted_1$t = {
27
27
  class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
28
28
  };
29
- const _sfc_main$Q = /* @__PURE__ */ defineComponent({
29
+ const _sfc_main$T = /* @__PURE__ */ defineComponent({
30
30
  ...{
31
31
  name: "MEditorCodeEditor"
32
32
  },
@@ -152,7 +152,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
152
152
  loading.value = true;
153
153
  init();
154
154
  });
155
- onUnmounted(() => {
155
+ onBeforeUnmount(() => {
156
156
  resizeObserver.disconnect();
157
157
  });
158
158
  const fullScreen = ref(false);
@@ -184,7 +184,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
184
184
  }
185
185
  });
186
186
  return (_ctx, _cache) => {
187
- return openBlock(), createElementBlock("div", _hoisted_1$s, [
187
+ return openBlock(), createElementBlock("div", _hoisted_1$t, [
188
188
  (openBlock(), createBlock(Teleport, {
189
189
  to: "body",
190
190
  disabled: !fullScreen.value
@@ -212,7 +212,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
212
212
  }
213
213
  });
214
214
 
215
- const _sfc_main$P = /* @__PURE__ */ defineComponent({
215
+ const _sfc_main$S = /* @__PURE__ */ defineComponent({
216
216
  ...{
217
217
  name: "MEditorCode"
218
218
  },
@@ -237,7 +237,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
237
237
  emit("change", v);
238
238
  };
239
239
  return (_ctx, _cache) => {
240
- return openBlock(), createBlock(_sfc_main$Q, {
240
+ return openBlock(), createBlock(_sfc_main$T, {
241
241
  height: _ctx.config.height,
242
242
  "init-values": _ctx.model[_ctx.name],
243
243
  language: _ctx.config.language,
@@ -252,7 +252,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
252
252
  }
253
253
  });
254
254
 
255
- const _sfc_main$O = /* @__PURE__ */ defineComponent({
255
+ const _sfc_main$R = /* @__PURE__ */ defineComponent({
256
256
  ...{
257
257
  name: "MEditorCodeLink"
258
258
  },
@@ -332,7 +332,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
332
332
  }
333
333
  });
334
334
 
335
- const _sfc_main$N = /* @__PURE__ */ defineComponent({
335
+ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
336
336
  ...{
337
337
  name: "MEditorCodeSelect"
338
338
  },
@@ -405,11 +405,11 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
405
405
  }
406
406
  });
407
407
 
408
- const _hoisted_1$r = { style: { "display": "flex", "margin-bottom": "10px" } };
409
- const _hoisted_2$j = { style: { "flex": "1" } };
410
- const _hoisted_3$7 = { style: { "flex": "1" } };
411
- const _hoisted_4$5 = { class: "dialog-footer" };
412
- const _sfc_main$M = /* @__PURE__ */ defineComponent({
408
+ const _hoisted_1$s = { style: { "display": "flex", "margin-bottom": "10px" } };
409
+ const _hoisted_2$k = { style: { "flex": "1" } };
410
+ const _hoisted_3$8 = { style: { "flex": "1" } };
411
+ const _hoisted_4$7 = { class: "dialog-footer" };
412
+ const _sfc_main$P = /* @__PURE__ */ defineComponent({
413
413
  ...{
414
414
  name: "MEditorCodeBlockEditor"
415
415
  },
@@ -432,7 +432,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
432
432
  height.value = globalThis.innerHeight;
433
433
  };
434
434
  globalThis.addEventListener("resize", windowReizehandler);
435
- onUnmounted(() => {
435
+ onBeforeUnmount(() => {
436
436
  globalThis.removeEventListener("resize", windowReizehandler);
437
437
  });
438
438
  const magicVsEditor = ref();
@@ -630,7 +630,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
630
630
  fullscreen: ""
631
631
  }, {
632
632
  footer: withCtx(() => [
633
- createElementVNode("span", _hoisted_4$5, [
633
+ createElementVNode("span", _hoisted_4$7, [
634
634
  createVNode(unref(TMagicButton), {
635
635
  size: "small",
636
636
  onClick: _cache[1] || (_cache[1] = ($event) => difVisible.value = false)
@@ -653,8 +653,8 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
653
653
  ])
654
654
  ]),
655
655
  default: withCtx(() => [
656
- createElementVNode("div", _hoisted_1$r, [
657
- createElementVNode("div", _hoisted_2$j, [
656
+ createElementVNode("div", _hoisted_1$s, [
657
+ createElementVNode("div", _hoisted_2$k, [
658
658
  createVNode(unref(TMagicTag), {
659
659
  size: "small",
660
660
  type: "info"
@@ -665,7 +665,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
665
665
  _: 1
666
666
  })
667
667
  ]),
668
- createElementVNode("div", _hoisted_3$7, [
668
+ createElementVNode("div", _hoisted_3$8, [
669
669
  createVNode(unref(TMagicTag), {
670
670
  size: "small",
671
671
  type: "success"
@@ -677,7 +677,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
677
677
  })
678
678
  ])
679
679
  ]),
680
- difVisible.value ? (openBlock(), createBlock(_sfc_main$Q, {
680
+ difVisible.value ? (openBlock(), createBlock(_sfc_main$T, {
681
681
  key: 0,
682
682
  ref_key: "magicVsEditor",
683
683
  ref: magicVsEditor,
@@ -1608,25 +1608,33 @@ var DragType = /* @__PURE__ */ ((DragType2) => {
1608
1608
  const UI_SELECT_MODE_EVENT_NAME = "ui-select";
1609
1609
 
1610
1610
  const COPY_STORAGE_KEY = "$MagicEditorCopyData";
1611
- const getPageList = (app) => {
1612
- if (app.items && Array.isArray(app.items)) {
1613
- return app.items.filter((item) => item.type === NodeType.PAGE);
1614
- }
1615
- return [];
1611
+ const getPageList = (root) => {
1612
+ if (!root)
1613
+ return [];
1614
+ if (!Array.isArray(root.items))
1615
+ return [];
1616
+ return root.items.filter((item) => isPage(item));
1617
+ };
1618
+ const getPageFragmentList = (root) => {
1619
+ if (!root)
1620
+ return [];
1621
+ if (!Array.isArray(root.items))
1622
+ return [];
1623
+ return root.items.filter((item) => isPageFragment(item));
1616
1624
  };
1617
1625
  const getPageNameList = (pages) => pages.map((page) => page.name || "index");
1618
- const generatePageName = (pageNameList) => {
1626
+ const generatePageName = (pageNameList, type) => {
1619
1627
  let pageLength = pageNameList.length;
1620
1628
  if (!pageLength)
1621
- return "index";
1622
- let pageName = `page_${pageLength}`;
1629
+ return `${type}_index`;
1630
+ let pageName = `${type}_${pageLength}`;
1623
1631
  while (pageNameList.includes(pageName)) {
1624
1632
  pageLength += 1;
1625
- pageName = `page_${pageLength}`;
1633
+ pageName = `${type}_${pageLength}`;
1626
1634
  }
1627
1635
  return pageName;
1628
1636
  };
1629
- const generatePageNameByApp = (app) => generatePageName(getPageNameList(getPageList(app)));
1637
+ const generatePageNameByApp = (app, type) => generatePageName(getPageNameList(type === "page" ? getPageList(app) : getPageFragmentList(app)), type);
1630
1638
  const isFixed = (node) => node.style?.position === "fixed";
1631
1639
  const getNodeIndex = (id, parent) => {
1632
1640
  const items = parent?.items || [];
@@ -1668,7 +1676,7 @@ const getInitPositionStyle = (style = {}, layout) => {
1668
1676
  }
1669
1677
  return style;
1670
1678
  };
1671
- const setChilrenLayout = (node, layout) => {
1679
+ const setChildrenLayout = (node, layout) => {
1672
1680
  node.items?.forEach((child) => {
1673
1681
  setLayout(child, layout);
1674
1682
  });
@@ -1880,6 +1888,9 @@ class History extends BaseService {
1880
1888
  }
1881
1889
  reset() {
1882
1890
  this.state.pageSteps = {};
1891
+ this.resetPage();
1892
+ }
1893
+ resetPage() {
1883
1894
  this.state.pageId = void 0;
1884
1895
  this.state.canRedo = false;
1885
1896
  this.state.canUndo = false;
@@ -2269,9 +2280,12 @@ class Editor extends BaseService {
2269
2280
  node: null,
2270
2281
  nodes: [],
2271
2282
  stage: null,
2283
+ stageLoading: true,
2272
2284
  highlightNode: null,
2273
2285
  modifiedNodeIds: /* @__PURE__ */ new Map(),
2274
- pageLength: 0
2286
+ pageLength: 0,
2287
+ pageFragmentLength: 0,
2288
+ disabledMultiSelect: false
2275
2289
  });
2276
2290
  isHistoryStateChange = false;
2277
2291
  constructor() {
@@ -2305,7 +2319,7 @@ class Editor extends BaseService {
2305
2319
  }
2306
2320
  /**
2307
2321
  * 设置当前指点节点配置
2308
- * @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
2322
+ * @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength' | 'pageFragmentLength
2309
2323
  * @param value MNode
2310
2324
  */
2311
2325
  set(name, value) {
@@ -2318,17 +2332,22 @@ class Editor extends BaseService {
2318
2332
  if (Array.isArray(value)) {
2319
2333
  throw new Error("root 不能为数组");
2320
2334
  }
2321
- if (value && isObject(value) && !(value instanceof StageCore) && !(value instanceof Map)) {
2322
- this.state.pageLength = value.items?.length || 0;
2335
+ if (value && isObject(value)) {
2336
+ const app = value;
2337
+ this.state.pageLength = getPageList(app).length || 0;
2338
+ this.state.pageFragmentLength = getPageFragmentList(app).length || 0;
2339
+ this.state.stageLoading = this.state.pageLength !== 0;
2323
2340
  } else {
2324
2341
  this.state.pageLength = 0;
2342
+ this.state.pageFragmentLength = 0;
2343
+ this.state.stageLoading = false;
2325
2344
  }
2326
2345
  this.emit("root-change", value, preValue);
2327
2346
  }
2328
2347
  }
2329
2348
  /**
2330
2349
  * 获取当前指点节点配置
2331
- * @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength'
2350
+ * @param name 'root' | 'page' | 'parent' | 'node' | 'highlightNode' | 'nodes' | 'stage' | 'modifiedNodeIds' | 'pageLength' | 'pageFragmentLength'
2332
2351
  * @returns MNode
2333
2352
  */
2334
2353
  get(name) {
@@ -2363,7 +2382,7 @@ class Editor extends BaseService {
2363
2382
  info.node = path[path.length - 1];
2364
2383
  info.parent = path[path.length - 2];
2365
2384
  path.forEach((item) => {
2366
- if (item.type === NodeType.PAGE) {
2385
+ if (isPage(item) || isPageFragment(item)) {
2367
2386
  info.page = item;
2368
2387
  return;
2369
2388
  }
@@ -2487,6 +2506,16 @@ class Editor extends BaseService {
2487
2506
  });
2488
2507
  this.set("nodes", nodes);
2489
2508
  }
2509
+ selectRoot() {
2510
+ const root = this.get("root");
2511
+ if (!root)
2512
+ return;
2513
+ this.set("nodes", [root]);
2514
+ this.set("parent", null);
2515
+ this.set("page", null);
2516
+ this.set("stage", null);
2517
+ this.set("highlightNode", null);
2518
+ }
2490
2519
  async doAdd(node, parent) {
2491
2520
  const root = this.get("root");
2492
2521
  if (!root)
@@ -2495,10 +2524,10 @@ class Editor extends BaseService {
2495
2524
  const stage = this.get("stage");
2496
2525
  if (!curNode)
2497
2526
  throw new Error("当前选中节点为空");
2498
- if ((parent.type === NodeType.ROOT || curNode?.type === NodeType.ROOT) && node.type !== NodeType.PAGE) {
2527
+ if ((parent.type === NodeType.ROOT || curNode?.type === NodeType.ROOT) && !(isPage(node) || isPageFragment(node))) {
2499
2528
  throw new Error("app下不能添加组件");
2500
2529
  }
2501
- if (parent.id !== curNode.id && node.type !== NodeType.PAGE) {
2530
+ if (parent.id !== curNode.id && !(isPage(node) || isPageFragment(node))) {
2502
2531
  const index = parent.items.indexOf(curNode);
2503
2532
  parent.items?.splice(index + 1, 0, node);
2504
2533
  } else {
@@ -2540,7 +2569,7 @@ class Editor extends BaseService {
2540
2569
  const newNodes = await Promise.all(
2541
2570
  addNodes.map((node) => {
2542
2571
  const root = this.get("root");
2543
- if (isPage(node) && root) {
2572
+ if ((isPage(node) || isPageFragment(node)) && root) {
2544
2573
  return this.doAdd(node, root);
2545
2574
  }
2546
2575
  const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
@@ -2557,11 +2586,13 @@ class Editor extends BaseService {
2557
2586
  await this.select(newNodes[0]);
2558
2587
  if (isPage(newNodes[0])) {
2559
2588
  this.state.pageLength += 1;
2589
+ } else if (isPageFragment(newNodes[0])) {
2590
+ this.state.pageFragmentLength += 1;
2560
2591
  } else {
2561
2592
  stage?.select(newNodes[0].id);
2562
2593
  }
2563
2594
  }
2564
- if (!isPage(newNodes[0])) {
2595
+ if (!(isPage(newNodes[0]) || isPageFragment(newNodes[0]))) {
2565
2596
  this.pushHistoryState();
2566
2597
  }
2567
2598
  this.emit("add", newNodes);
@@ -2571,7 +2602,7 @@ class Editor extends BaseService {
2571
2602
  const root = this.get("root");
2572
2603
  if (!root)
2573
2604
  throw new Error("root不能为空");
2574
- const { parent, node: curNode } = this.getNodeInfo(node.id);
2605
+ const { parent, node: curNode } = this.getNodeInfo(node.id, false);
2575
2606
  if (!parent || !curNode)
2576
2607
  throw new Error("找不要删除的节点");
2577
2608
  const index = getNodeIndex(curNode.id, parent);
@@ -2580,26 +2611,31 @@ class Editor extends BaseService {
2580
2611
  parent.items?.splice(index, 1);
2581
2612
  const stage = this.get("stage");
2582
2613
  stage?.remove({ id: node.id, parentId: parent.id, root: cloneDeep(root) });
2583
- if (node.type === NodeType.PAGE) {
2584
- this.state.pageLength -= 1;
2585
- if (root.items[0]) {
2586
- await this.select(root.items[0]);
2587
- stage?.select(root.items[0].id);
2614
+ const selectDefault = async (pages) => {
2615
+ if (pages[0]) {
2616
+ await this.select(pages[0]);
2617
+ stage?.select(pages[0].id);
2588
2618
  } else {
2589
- this.set("nodes", [root]);
2590
- this.set("parent", null);
2591
- this.set("page", null);
2592
- this.set("stage", null);
2593
- this.set("highlightNode", null);
2594
- this.resetModifiedNodeId();
2595
- historyService.reset();
2596
- return;
2619
+ this.selectRoot();
2620
+ historyService.resetPage();
2597
2621
  }
2622
+ };
2623
+ const rootItems = root.items || [];
2624
+ if (isPage(node)) {
2625
+ this.state.pageLength -= 1;
2626
+ await selectDefault(getPageList(root));
2627
+ } else if (isPageFragment(node)) {
2628
+ this.state.pageFragmentLength -= 1;
2629
+ await selectDefault(getPageFragmentList(root));
2598
2630
  } else {
2599
2631
  await this.select(parent);
2600
2632
  stage?.select(parent.id);
2633
+ this.addModifiedNodeId(parent.id);
2634
+ }
2635
+ if (!rootItems.length) {
2636
+ this.resetModifiedNodeId();
2637
+ historyService.reset();
2601
2638
  }
2602
- this.addModifiedNodeId(parent.id);
2603
2639
  }
2604
2640
  /**
2605
2641
  * 删除组件
@@ -2608,7 +2644,7 @@ class Editor extends BaseService {
2608
2644
  async remove(nodeOrNodeList) {
2609
2645
  const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
2610
2646
  await Promise.all(nodes.map((node) => this.doRemove(node)));
2611
- if (!isPage(nodes[0])) {
2647
+ if (!(isPage(nodes[0]) || isPageFragment(nodes[0]))) {
2612
2648
  this.pushHistoryState();
2613
2649
  }
2614
2650
  this.emit("remove", nodes);
@@ -2648,7 +2684,7 @@ class Editor extends BaseService {
2648
2684
  const newLayout = await this.getLayout(newConfig);
2649
2685
  const layout = await this.getLayout(node);
2650
2686
  if (Array.isArray(newConfig.items) && newLayout !== layout) {
2651
- newConfig = setChilrenLayout(newConfig, newLayout);
2687
+ newConfig = setChildrenLayout(newConfig, newLayout);
2652
2688
  }
2653
2689
  parentNodeItems[index] = newConfig;
2654
2690
  const nodes = this.get("nodes");
@@ -2660,7 +2696,7 @@ class Editor extends BaseService {
2660
2696
  parentId: parent.id,
2661
2697
  root: cloneDeep(root)
2662
2698
  });
2663
- if (newConfig.type === NodeType.PAGE) {
2699
+ if (isPage(newConfig) || isPageFragment(newConfig)) {
2664
2700
  this.set("page", newConfig);
2665
2701
  }
2666
2702
  this.addModifiedNodeId(newConfig.id);
@@ -3109,8 +3145,8 @@ const beforePaste = async (position, config) => {
3109
3145
  };
3110
3146
  }
3111
3147
  const root = editorService.get("root");
3112
- if (isPage(pasteConfig) && root) {
3113
- pasteConfig.name = generatePageNameByApp(root);
3148
+ if ((isPage(pasteConfig) || isPageFragment(pasteConfig)) && root) {
3149
+ pasteConfig.name = generatePageNameByApp(root, isPage(pasteConfig) ? NodeType.PAGE : NodeType.PAGE_FRAGMENT);
3114
3150
  }
3115
3151
  return pasteConfig;
3116
3152
  })
@@ -3148,7 +3184,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
3148
3184
  return newNode;
3149
3185
  };
3150
3186
 
3151
- const _sfc_main$L = /* @__PURE__ */ defineComponent({
3187
+ const _sfc_main$O = /* @__PURE__ */ defineComponent({
3152
3188
  ...{
3153
3189
  name: "MEditorCodeParams"
3154
3190
  },
@@ -3198,8 +3234,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
3198
3234
  }
3199
3235
  });
3200
3236
 
3201
- const _hoisted_1$q = ["src"];
3202
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
3237
+ const _hoisted_1$r = ["src"];
3238
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
3203
3239
  ...{
3204
3240
  name: "MEditorIcon"
3205
3241
  },
@@ -3223,7 +3259,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
3223
3259
  class: "magic-editor-icon"
3224
3260
  }, {
3225
3261
  default: withCtx(() => [
3226
- createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$q)
3262
+ createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$r)
3227
3263
  ]),
3228
3264
  _: 1
3229
3265
  })) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
@@ -3301,9 +3337,9 @@ const useCodeBlockEdit = (codeBlockService) => {
3301
3337
  };
3302
3338
  };
3303
3339
 
3304
- const _hoisted_1$p = { class: "m-fields-code-select-col" };
3305
- const _hoisted_2$i = { class: "code-select-container" };
3306
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
3340
+ const _hoisted_1$q = { class: "m-fields-code-select-col" };
3341
+ const _hoisted_2$j = { class: "code-select-container" };
3342
+ const _sfc_main$M = /* @__PURE__ */ defineComponent({
3307
3343
  ...{
3308
3344
  name: "MEditorCodeSelectCol"
3309
3345
  },
@@ -3376,8 +3412,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
3376
3412
  const { codeBlockEditor, codeConfig, editCode, submitCodeBlockHandler } = useCodeBlockEdit(services?.codeBlockService);
3377
3413
  return (_ctx, _cache) => {
3378
3414
  const _component_m_form_container = resolveComponent("m-form-container");
3379
- return openBlock(), createElementBlock("div", _hoisted_1$p, [
3380
- createElementVNode("div", _hoisted_2$i, [
3415
+ return openBlock(), createElementBlock("div", _hoisted_1$q, [
3416
+ createElementVNode("div", _hoisted_2$j, [
3381
3417
  createVNode(_component_m_form_container, {
3382
3418
  class: "select",
3383
3419
  config: selectConfig,
@@ -3385,14 +3421,14 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
3385
3421
  size: _ctx.size,
3386
3422
  onChange: onParamsChangeHandler
3387
3423
  }, null, 8, ["model", "size"]),
3388
- _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$K, {
3424
+ _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
3389
3425
  key: 0,
3390
3426
  class: "icon",
3391
3427
  icon: !_ctx.disabled ? unref(Edit) : unref(View),
3392
3428
  onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
3393
3429
  }, null, 8, ["icon"])) : createCommentVNode("", true)
3394
3430
  ]),
3395
- paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$L, {
3431
+ paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$O, {
3396
3432
  key: 0,
3397
3433
  name: "params",
3398
3434
  model: _ctx.model,
@@ -3400,7 +3436,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
3400
3436
  "params-config": paramsConfig.value,
3401
3437
  onChange: onParamsChangeHandler
3402
3438
  }, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true),
3403
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
3439
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
3404
3440
  key: 1,
3405
3441
  ref_key: "codeBlockEditor",
3406
3442
  ref: codeBlockEditor,
@@ -3413,9 +3449,9 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
3413
3449
  }
3414
3450
  });
3415
3451
 
3416
- const _hoisted_1$o = { class: "m-editor-data-source-fields" };
3417
- const _hoisted_2$h = { class: "m-editor-data-source-fields-footer" };
3418
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
3452
+ const _hoisted_1$p = { class: "m-editor-data-source-fields" };
3453
+ const _hoisted_2$i = { class: "m-editor-data-source-fields-footer" };
3454
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
3419
3455
  ...{
3420
3456
  name: "MEditorDataSourceFields"
3421
3457
  },
@@ -3650,12 +3686,12 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
3650
3686
  }
3651
3687
  };
3652
3688
  return (_ctx, _cache) => {
3653
- return openBlock(), createElementBlock("div", _hoisted_1$o, [
3689
+ return openBlock(), createElementBlock("div", _hoisted_1$p, [
3654
3690
  createVNode(unref(MagicTable), {
3655
3691
  data: _ctx.model[_ctx.name],
3656
3692
  columns: fieldColumns
3657
3693
  }, null, 8, ["data"]),
3658
- createElementVNode("div", _hoisted_2$h, [
3694
+ createElementVNode("div", _hoisted_2$i, [
3659
3695
  createVNode(unref(TMagicButton), {
3660
3696
  size: "small",
3661
3697
  disabled: _ctx.disabled,
@@ -3707,7 +3743,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
3707
3743
  }
3708
3744
  });
3709
3745
 
3710
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
3746
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
3711
3747
  __name: "DataSourceFieldSelect",
3712
3748
  props: {
3713
3749
  config: {},
@@ -3762,10 +3798,10 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
3762
3798
  }
3763
3799
  });
3764
3800
 
3765
- const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
3766
- const _hoisted_2$g = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3767
- const _hoisted_3$6 = { class: "el-input__inner" };
3768
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
3801
+ const _hoisted_1$o = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
3802
+ const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3803
+ const _hoisted_3$7 = { class: "el-input__inner" };
3804
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
3769
3805
  ...{
3770
3806
  name: "MEditorDataSourceInput"
3771
3807
  },
@@ -3955,12 +3991,12 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
3955
3991
  }
3956
3992
  ), {
3957
3993
  suffix: withCtx(() => [
3958
- createVNode(_sfc_main$K, { icon: unref(Coin) }, null, 8, ["icon"])
3994
+ createVNode(_sfc_main$N, { icon: unref(Coin) }, null, 8, ["icon"])
3959
3995
  ]),
3960
3996
  default: withCtx(({ item }) => [
3961
- createElementVNode("div", _hoisted_1$n, [
3997
+ createElementVNode("div", _hoisted_1$o, [
3962
3998
  createElementVNode("div", null, toDisplayString(item.text), 1),
3963
- createElementVNode("span", _hoisted_2$g, toDisplayString(item.value), 1)
3999
+ createElementVNode("span", _hoisted_2$h, toDisplayString(item.value), 1)
3964
4000
  ])
3965
4001
  ]),
3966
4002
  _: 1
@@ -3972,7 +4008,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
3972
4008
  createElementVNode("div", {
3973
4009
  class: normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
3974
4010
  }, [
3975
- createElementVNode("div", _hoisted_3$6, [
4011
+ createElementVNode("div", _hoisted_3$7, [
3976
4012
  (openBlock(true), createElementBlock(Fragment, null, renderList(displayState.value, (item, index) => {
3977
4013
  return openBlock(), createElementBlock(Fragment, null, [
3978
4014
  item.type === "text" ? (openBlock(), createElementBlock("span", {
@@ -3990,7 +4026,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
3990
4026
  }, 1032, ["size"])) : createCommentVNode("", true)
3991
4027
  ], 64);
3992
4028
  }), 256)),
3993
- createVNode(_sfc_main$K, {
4029
+ createVNode(_sfc_main$N, {
3994
4030
  class: "tmagic-data-source-input-icon",
3995
4031
  icon: unref(Coin)
3996
4032
  }, null, 8, ["icon"])
@@ -4073,9 +4109,9 @@ const useDataSourceMethod = () => {
4073
4109
  };
4074
4110
  };
4075
4111
 
4076
- const _hoisted_1$m = { class: "m-editor-data-source-methods" };
4077
- const _hoisted_2$f = { class: "m-editor-data-source-methods-footer" };
4078
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
4112
+ const _hoisted_1$n = { class: "m-editor-data-source-methods" };
4113
+ const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
4114
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
4079
4115
  ...{
4080
4116
  name: "MEditorDataSourceMethods"
4081
4117
  },
@@ -4145,12 +4181,12 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4145
4181
  emit("change", props.model[props.name]);
4146
4182
  };
4147
4183
  return (_ctx, _cache) => {
4148
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
4184
+ return openBlock(), createElementBlock("div", _hoisted_1$n, [
4149
4185
  createVNode(unref(MagicTable), {
4150
4186
  data: _ctx.model[_ctx.name],
4151
4187
  columns: methodColumns
4152
4188
  }, null, 8, ["data"]),
4153
- createElementVNode("div", _hoisted_2$f, [
4189
+ createElementVNode("div", _hoisted_2$g, [
4154
4190
  createVNode(unref(TMagicButton), {
4155
4191
  size: "small",
4156
4192
  type: "primary",
@@ -4164,7 +4200,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4164
4200
  _: 1
4165
4201
  }, 8, ["disabled"])
4166
4202
  ]),
4167
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
4203
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
4168
4204
  key: 0,
4169
4205
  ref_key: "codeBlockEditor",
4170
4206
  ref: codeBlockEditor,
@@ -4179,9 +4215,9 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4179
4215
  }
4180
4216
  });
4181
4217
 
4182
- const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
4183
- const _hoisted_2$e = { class: "data-source-method-select-container" };
4184
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
4218
+ const _hoisted_1$m = { class: "m-fields-data-source-method-select" };
4219
+ const _hoisted_2$f = { class: "data-source-method-select-container" };
4220
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
4185
4221
  ...{
4186
4222
  name: "MEditorDataSourceMethodSelect"
4187
4223
  },
@@ -4264,22 +4300,22 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4264
4300
  };
4265
4301
  return (_ctx, _cache) => {
4266
4302
  const _component_m_form_container = resolveComponent("m-form-container");
4267
- return openBlock(), createElementBlock("div", _hoisted_1$l, [
4268
- createElementVNode("div", _hoisted_2$e, [
4303
+ return openBlock(), createElementBlock("div", _hoisted_1$m, [
4304
+ createElementVNode("div", _hoisted_2$f, [
4269
4305
  createVNode(_component_m_form_container, {
4270
4306
  class: "select",
4271
4307
  config: cascaderConfig.value,
4272
4308
  model: _ctx.model,
4273
4309
  onChange: onChangeHandler
4274
4310
  }, null, 8, ["config", "model"]),
4275
- _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$K, {
4311
+ _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$N, {
4276
4312
  key: 0,
4277
4313
  class: "icon",
4278
4314
  icon: !_ctx.disabled ? unref(Edit) : unref(View),
4279
4315
  onClick: editCodeHandler
4280
4316
  }, null, 8, ["icon"])) : createCommentVNode("", true)
4281
4317
  ]),
4282
- paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$L, {
4318
+ paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$O, {
4283
4319
  key: 0,
4284
4320
  name: "params",
4285
4321
  model: _ctx.model,
@@ -4288,7 +4324,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4288
4324
  "params-config": paramsConfig.value,
4289
4325
  onChange: onChangeHandler
4290
4326
  }, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true),
4291
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
4327
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
4292
4328
  key: 1,
4293
4329
  ref_key: "codeBlockEditor",
4294
4330
  ref: codeBlockEditor,
@@ -4301,9 +4337,9 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4301
4337
  }
4302
4338
  });
4303
4339
 
4304
- const _hoisted_1$k = { class: "m-editor-data-source-fields" };
4305
- const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
4306
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
4340
+ const _hoisted_1$l = { class: "m-editor-data-source-fields" };
4341
+ const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
4342
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
4307
4343
  ...{
4308
4344
  name: "MEditorDataSourceMocks"
4309
4345
  },
@@ -4390,7 +4426,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4390
4426
  const columns = [
4391
4427
  {
4392
4428
  type: "expand",
4393
- component: _sfc_main$Q,
4429
+ component: _sfc_main$T,
4394
4430
  props: (row) => ({
4395
4431
  initValues: row.data,
4396
4432
  language: "json",
@@ -4499,12 +4535,12 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4499
4535
  });
4500
4536
  };
4501
4537
  return (_ctx, _cache) => {
4502
- return openBlock(), createElementBlock("div", _hoisted_1$k, [
4538
+ return openBlock(), createElementBlock("div", _hoisted_1$l, [
4503
4539
  createVNode(unref(MagicTable), {
4504
4540
  data: _ctx.model[_ctx.name],
4505
4541
  columns
4506
4542
  }, null, 8, ["data"]),
4507
- createElementVNode("div", _hoisted_2$d, [
4543
+ createElementVNode("div", _hoisted_2$e, [
4508
4544
  createVNode(unref(TMagicButton), {
4509
4545
  size: "small",
4510
4546
  type: "primary",
@@ -4535,7 +4571,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4535
4571
  }
4536
4572
  });
4537
4573
 
4538
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
4574
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
4539
4575
  ...{
4540
4576
  name: "MEditorDataSourceSelect"
4541
4577
  },
@@ -4592,12 +4628,12 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
4592
4628
  }
4593
4629
  });
4594
4630
 
4595
- const _hoisted_1$j = { class: "m-fields-event-select" };
4596
- const _hoisted_2$c = {
4631
+ const _hoisted_1$k = { class: "m-fields-event-select" };
4632
+ const _hoisted_2$d = {
4597
4633
  key: 1,
4598
4634
  class: "fullWidth"
4599
4635
  };
4600
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
4636
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4601
4637
  ...{
4602
4638
  name: "MEditorEventSelect"
4603
4639
  },
@@ -4800,7 +4836,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
4800
4836
  const _component_m_form_table = resolveComponent("m-form-table");
4801
4837
  const _component_m_form_container = resolveComponent("m-form-container");
4802
4838
  const _component_m_form_panel = resolveComponent("m-form-panel");
4803
- return openBlock(), createElementBlock("div", _hoisted_1$j, [
4839
+ return openBlock(), createElementBlock("div", _hoisted_1$k, [
4804
4840
  isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
4805
4841
  key: 0,
4806
4842
  ref: "eventForm",
@@ -4810,7 +4846,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
4810
4846
  model: _ctx.model,
4811
4847
  config: tableConfig.value,
4812
4848
  onChange: onChangeHandler
4813
- }, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$c, [
4849
+ }, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$d, [
4814
4850
  createVNode(unref(TMagicButton), {
4815
4851
  class: "create-button",
4816
4852
  type: "primary",
@@ -4860,32 +4896,32 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
4860
4896
  }
4861
4897
  });
4862
4898
 
4863
- const _hoisted_1$i = {
4899
+ const _hoisted_1$j = {
4864
4900
  viewBox: "0 0 32 32",
4865
4901
  version: "1.1",
4866
4902
  xmlns: "http://www.w3.org/2000/svg",
4867
4903
  "xmlns:xlink": "http://www.w3.org/1999/xlink"
4868
4904
  };
4869
- const _hoisted_2$b = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2);
4870
- const _hoisted_4$4 = [
4871
- _hoisted_2$b
4905
+ const _hoisted_2$c = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2);
4906
+ const _hoisted_4$6 = [
4907
+ _hoisted_2$c
4872
4908
  ];
4873
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
4909
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
4874
4910
  ...{
4875
4911
  name: "MEditorCodeIcon"
4876
4912
  },
4877
4913
  __name: "CodeIcon",
4878
4914
  setup(__props) {
4879
4915
  return (_ctx, _cache) => {
4880
- return openBlock(), createElementBlock("svg", _hoisted_1$i, _hoisted_4$4);
4916
+ return openBlock(), createElementBlock("svg", _hoisted_1$j, _hoisted_4$6);
4881
4917
  };
4882
4918
  }
4883
4919
  });
4884
4920
 
4885
- const _hoisted_1$h = { class: "m-fields-key-value" };
4886
- const _hoisted_2$a = { key: 0 };
4887
- const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
4888
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
4921
+ const _hoisted_1$i = { class: "m-fields-key-value" };
4922
+ const _hoisted_2$b = { key: 0 };
4923
+ const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
4924
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
4889
4925
  ...{
4890
4926
  name: "MEditorKeyValue"
4891
4927
  },
@@ -4943,8 +4979,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
4943
4979
  emit("change", v);
4944
4980
  };
4945
4981
  return (_ctx, _cache) => {
4946
- return openBlock(), createElementBlock("div", _hoisted_1$h, [
4947
- !showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
4982
+ return openBlock(), createElementBlock("div", _hoisted_1$i, [
4983
+ !showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
4948
4984
  (openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
4949
4985
  return openBlock(), createElementBlock("div", {
4950
4986
  class: "m-fields-key-value-item",
@@ -4958,7 +4994,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
4958
4994
  size: _ctx.size,
4959
4995
  onChange: keyChangeHandler
4960
4996
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
4961
- _hoisted_3$5,
4997
+ _hoisted_3$6,
4962
4998
  createVNode(unref(TMagicInput), {
4963
4999
  placeholder: "value",
4964
5000
  modelValue: records.value[index][1],
@@ -4993,7 +5029,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
4993
5029
  _: 1
4994
5030
  }, 8, ["size", "disabled", "icon"])
4995
5031
  ])) : createCommentVNode("", true),
4996
- _ctx.config.advanced && showCode.value ? (openBlock(), createBlock(_sfc_main$Q, {
5032
+ _ctx.config.advanced && showCode.value ? (openBlock(), createBlock(_sfc_main$T, {
4997
5033
  key: 1,
4998
5034
  height: "200px",
4999
5035
  "init-values": _ctx.model[_ctx.name],
@@ -5009,7 +5045,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5009
5045
  size: "default",
5010
5046
  disabled: _ctx.disabled,
5011
5047
  text: "",
5012
- icon: _sfc_main$A,
5048
+ icon: _sfc_main$D,
5013
5049
  onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
5014
5050
  }, null, 8, ["disabled"])) : createCommentVNode("", true)
5015
5051
  ]);
@@ -5017,12 +5053,72 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5017
5053
  }
5018
5054
  });
5019
5055
 
5056
+ const _hoisted_1$h = { class: "m-fields-page-fragment-select" };
5057
+ const _hoisted_2$a = { class: "page-fragment-select-container" };
5058
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5059
+ ...{
5060
+ name: "MEditorPageFragmentSelect"
5061
+ },
5062
+ __name: "PageFragmentSelect",
5063
+ props: {
5064
+ config: {},
5065
+ model: {},
5066
+ initValues: {},
5067
+ values: {},
5068
+ name: {},
5069
+ prop: {},
5070
+ disabled: { type: Boolean, default: false },
5071
+ size: {},
5072
+ lastValues: {}
5073
+ },
5074
+ emits: ["change"],
5075
+ setup(__props, { emit: __emit }) {
5076
+ const services = inject("services");
5077
+ const emit = __emit;
5078
+ const props = __props;
5079
+ const pageList = computed(
5080
+ () => services?.editorService.get("root")?.items.filter((item) => item.type === NodeType.PAGE_FRAGMENT)
5081
+ );
5082
+ const selectConfig = {
5083
+ type: "select",
5084
+ name: props.name,
5085
+ options: () => {
5086
+ if (pageList.value) {
5087
+ return pageList.value.map((item) => ({
5088
+ text: `${item.name}(${item.id})`,
5089
+ label: `${item.name}(${item.id})`,
5090
+ value: item.id
5091
+ }));
5092
+ }
5093
+ return [];
5094
+ }
5095
+ };
5096
+ const changeHandler = async () => {
5097
+ emit("change", props.model[props.name]);
5098
+ };
5099
+ return (_ctx, _cache) => {
5100
+ const _component_m_form_container = resolveComponent("m-form-container");
5101
+ return openBlock(), createElementBlock("div", _hoisted_1$h, [
5102
+ createElementVNode("div", _hoisted_2$a, [
5103
+ createVNode(_component_m_form_container, {
5104
+ class: "select",
5105
+ config: selectConfig,
5106
+ model: _ctx.model,
5107
+ size: _ctx.size,
5108
+ onChange: changeHandler
5109
+ }, null, 8, ["model", "size"])
5110
+ ])
5111
+ ]);
5112
+ };
5113
+ }
5114
+ });
5115
+
5020
5116
  const _hoisted_1$g = {
5021
5117
  key: 1,
5022
5118
  class: "m-fields-ui-select",
5023
5119
  style: { "display": "flex" }
5024
5120
  };
5025
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
5121
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5026
5122
  ...{
5027
5123
  name: "MEditorUISelect"
5028
5124
  },
@@ -5198,7 +5294,7 @@ const useGetSo = (target, emit) => {
5198
5294
  isDraging.value = false;
5199
5295
  });
5200
5296
  });
5201
- onUnmounted(() => {
5297
+ onBeforeUnmount(() => {
5202
5298
  getso?.unset();
5203
5299
  isDraging.value = false;
5204
5300
  });
@@ -5207,7 +5303,7 @@ const useGetSo = (target, emit) => {
5207
5303
  };
5208
5304
  };
5209
5305
 
5210
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
5306
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5211
5307
  ...{
5212
5308
  name: "MEditorResizer"
5213
5309
  },
@@ -5229,7 +5325,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5229
5325
  }
5230
5326
  });
5231
5327
 
5232
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
5328
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
5233
5329
  ...{
5234
5330
  name: "MEditorLayout"
5235
5331
  },
@@ -5296,7 +5392,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5296
5392
  resizerObserver.observe(el.value);
5297
5393
  }
5298
5394
  });
5299
- onUnmounted(() => {
5395
+ onBeforeUnmount(() => {
5300
5396
  resizerObserver.disconnect();
5301
5397
  });
5302
5398
  const center = ref(0);
@@ -5356,7 +5452,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5356
5452
  }, [
5357
5453
  renderSlot(_ctx.$slots, "left")
5358
5454
  ], 6),
5359
- createVNode(_sfc_main$x, { onChange: changeLeft })
5455
+ createVNode(_sfc_main$z, { onChange: changeLeft })
5360
5456
  ], 64)) : createCommentVNode("", true),
5361
5457
  createElementVNode("div", {
5362
5458
  class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
@@ -5365,7 +5461,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5365
5461
  renderSlot(_ctx.$slots, "center")
5366
5462
  ], 6),
5367
5463
  hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
5368
- createVNode(_sfc_main$x, { onChange: changeRight }),
5464
+ createVNode(_sfc_main$z, { onChange: changeRight }),
5369
5465
  createElementVNode("div", {
5370
5466
  class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
5371
5467
  style: normalizeStyle(`width: ${_ctx.right}px`)
@@ -5378,345 +5474,749 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5378
5474
  }
5379
5475
  });
5380
5476
 
5381
- const _hoisted_1$f = { class: "m-editor-empty-panel" };
5382
- const _hoisted_2$9 = { class: "m-editor-empty-content" };
5383
- const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
5384
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
5477
+ const _hoisted_1$f = {
5478
+ key: 1,
5479
+ class: "menu-item-text"
5480
+ };
5481
+ const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
5482
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5385
5483
  ...{
5386
- name: "MEditorAddPageBox"
5484
+ name: "MEditorToolButton"
5387
5485
  },
5388
- __name: "AddPageBox",
5389
- setup(__props) {
5390
- const services = inject("services");
5391
- const clickHandler = () => {
5392
- const { editorService } = services || {};
5393
- if (!editorService)
5394
- return;
5395
- const root = toRaw(editorService.get("root"));
5396
- if (!root)
5397
- throw new Error("root 不能为空");
5398
- editorService.add({
5399
- type: NodeType.PAGE,
5400
- name: generatePageNameByApp(root)
5401
- });
5402
- };
5403
- return (_ctx, _cache) => {
5404
- return openBlock(), createElementBlock("div", _hoisted_1$f, [
5405
- createElementVNode("div", _hoisted_2$9, [
5406
- createElementVNode("div", {
5407
- class: "m-editor-empty-button",
5408
- onClick: clickHandler
5409
- }, [
5410
- createElementVNode("div", null, [
5411
- createVNode(_sfc_main$K, { icon: unref(Plus) }, null, 8, ["icon"])
5412
- ]),
5413
- _hoisted_3$4
5414
- ])
5415
- ])
5416
- ]);
5417
- };
5418
- }
5419
- });
5420
-
5421
- const DEFAULT_LEFT_COLUMN_WIDTH = 310;
5422
- const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
5423
- const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
5424
- const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
5425
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
5426
- ...{
5427
- name: "MEditorFramework"
5486
+ __name: "ToolButton",
5487
+ props: {
5488
+ data: { default: () => ({
5489
+ type: "text",
5490
+ display: false
5491
+ }) },
5492
+ eventType: { default: "click" }
5428
5493
  },
5429
- __name: "Framework",
5430
5494
  setup(__props) {
5431
- const codeOptions = inject("codeOptions", {});
5432
- const { editorService, uiService } = inject("services") || {};
5433
- const content = ref();
5434
- const splitView = ref();
5435
- const root = computed(() => editorService?.get("root"));
5436
- const pageLength = computed(() => editorService?.get("pageLength") || 0);
5437
- const showSrc = computed(() => uiService?.get("showSrc"));
5438
- const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
5439
- const leftColumnWidthCacheData = getLeftColumnWidthCacheData();
5440
- const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
5441
- const columnWidth = ref({
5442
- left: leftColumnWidthCacheData,
5443
- center: 0,
5444
- right: RightColumnWidthCacheData
5495
+ const props = __props;
5496
+ const services = inject("services");
5497
+ const disabled = computed(() => {
5498
+ if (typeof props.data === "string")
5499
+ return false;
5500
+ if (props.data.type === "component")
5501
+ return false;
5502
+ if (typeof props.data.disabled === "function") {
5503
+ return props.data.disabled(services);
5504
+ }
5505
+ return props.data.disabled;
5445
5506
  });
5446
- watch(
5447
- [pageLength, splitView],
5448
- () => {
5449
- splitView.value?.updateWidth();
5450
- },
5451
- {
5452
- immediate: true
5507
+ const display = computed(() => {
5508
+ if (!props.data)
5509
+ return false;
5510
+ if (typeof props.data === "string")
5511
+ return true;
5512
+ if (typeof props.data.display === "function") {
5513
+ return props.data.display(services);
5453
5514
  }
5454
- );
5455
- watch(
5456
- () => columnWidth.value.right,
5457
- (right) => {
5458
- if (typeof right === "undefined")
5459
- return;
5460
- globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${right}`);
5515
+ return props.data.display ?? true;
5516
+ });
5517
+ const buttonHandler = (item, event) => {
5518
+ if (disabled.value)
5519
+ return;
5520
+ if (typeof item.handler === "function" && services) {
5521
+ item.handler?.(services, event);
5461
5522
  }
5462
- );
5463
- watch(
5464
- () => columnWidth.value.left,
5465
- (left) => {
5466
- globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
5523
+ };
5524
+ const dropdownHandler = (command) => {
5525
+ if (command.item.handler) {
5526
+ command.item.handler(services);
5467
5527
  }
5468
- );
5469
- watch(
5470
- () => uiService?.get("hideSlideBar"),
5471
- (hideSlideBar) => {
5472
- columnWidth.value.left = hideSlideBar ? 0 : getLeftColumnWidthCacheData();
5528
+ };
5529
+ const clickHandler = (item, event) => {
5530
+ if (props.eventType !== "click")
5531
+ return;
5532
+ if (item.type === "button") {
5533
+ buttonHandler(item, event);
5473
5534
  }
5474
- );
5475
- const columnWidthChange = (columnW) => {
5476
- columnWidth.value.left = columnW.left;
5477
- columnWidth.value.center = columnW.center;
5478
- columnWidth.value.right = columnW.right;
5479
- uiService?.set("columnWidth", columnW);
5480
5535
  };
5481
- const saveCode = (value) => {
5482
- try {
5483
- const parseDSL = getConfig("parseDSL");
5484
- editorService?.set("root", parseDSL(value));
5485
- } catch (e) {
5486
- console.error(e);
5536
+ const mousedownHandler = (item, event) => {
5537
+ if (props.eventType !== "mousedown")
5538
+ return;
5539
+ if (item.type === "button") {
5540
+ buttonHandler(item, event);
5541
+ }
5542
+ };
5543
+ const mouseupHandler = (item, event) => {
5544
+ if (props.eventType !== "mouseup")
5545
+ return;
5546
+ if (item.type === "button") {
5547
+ buttonHandler(item, event);
5487
5548
  }
5488
5549
  };
5489
5550
  return (_ctx, _cache) => {
5490
- return openBlock(), createElementBlock("div", {
5491
- class: "m-editor",
5492
- ref_key: "content",
5493
- ref: content,
5494
- style: { "min-width": "180px" }
5551
+ return display.value ? (openBlock(), createElementBlock("div", {
5552
+ key: 0,
5553
+ class: normalizeClass(["menu-item", `${_ctx.data.type} ${_ctx.data.className || ""}`]),
5554
+ onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(_ctx.data, $event)),
5555
+ onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(_ctx.data, $event)),
5556
+ onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(_ctx.data, $event))
5495
5557
  }, [
5496
- renderSlot(_ctx.$slots, "header"),
5497
- renderSlot(_ctx.$slots, "nav"),
5498
- renderSlot(_ctx.$slots, "content-before"),
5499
- showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
5500
- createVNode(_sfc_main$Q, {
5501
- class: "m-editor-content",
5502
- "init-values": root.value,
5503
- options: unref(codeOptions),
5504
- onSave: saveCode
5505
- }, null, 8, ["init-values", "options"])
5506
- ]) : (openBlock(), createBlock(_sfc_main$w, {
5507
- key: 1,
5508
- ref_key: "splitView",
5509
- ref: splitView,
5510
- class: "m-editor-content",
5511
- "left-class": "m-editor-framework-left",
5512
- "center-class": "m-editor-framework-center",
5513
- "right-class": "m-editor-framework-right",
5514
- left: columnWidth.value.left,
5515
- "onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
5516
- right: columnWidth.value.right,
5517
- "onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
5518
- "min-left": 65,
5519
- "min-right": 20,
5520
- "min-center": 100,
5521
- onChange: columnWidthChange
5522
- }, createSlots({
5523
- left: withCtx(() => [
5524
- renderSlot(_ctx.$slots, "sidebar")
5525
- ]),
5526
- center: withCtx(() => [
5527
- pageLength.value > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
5528
- createVNode(_sfc_main$v)
5529
- ])
5558
+ _ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
5559
+ key: 0,
5560
+ direction: _ctx.data.direction || "vertical"
5561
+ }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$f, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
5562
+ _ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
5563
+ key: 0,
5564
+ effect: "dark",
5565
+ placement: "bottom-start",
5566
+ content: _ctx.data.tooltip
5567
+ }, {
5568
+ default: withCtx(() => [
5569
+ createVNode(unref(TMagicButton), {
5570
+ size: "small",
5571
+ text: "",
5572
+ disabled: disabled.value
5573
+ }, {
5574
+ default: withCtx(() => [
5575
+ _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$N, {
5576
+ key: 0,
5577
+ icon: _ctx.data.icon
5578
+ }, null, 8, ["icon"])) : createCommentVNode("", true),
5579
+ createElementVNode("span", null, toDisplayString(_ctx.data.text), 1)
5580
+ ]),
5581
+ _: 1
5582
+ }, 8, ["disabled"])
5583
+ ]),
5584
+ _: 1
5585
+ }, 8, ["content"])) : (openBlock(), createBlock(unref(TMagicButton), {
5586
+ key: 1,
5587
+ size: "small",
5588
+ text: "",
5589
+ disabled: disabled.value,
5590
+ title: _ctx.data.text
5591
+ }, {
5592
+ default: withCtx(() => [
5593
+ _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$N, {
5594
+ key: 0,
5595
+ icon: _ctx.data.icon
5596
+ }, null, 8, ["icon"])) : createCommentVNode("", true),
5597
+ createElementVNode("span", null, toDisplayString(_ctx.data.text), 1)
5598
+ ]),
5599
+ _: 1
5600
+ }, 8, ["disabled", "title"]))
5601
+ ], 64)) : _ctx.data.type === "dropdown" ? (openBlock(), createBlock(unref(TMagicDropdown), {
5602
+ key: 3,
5603
+ trigger: "click",
5604
+ disabled: disabled.value,
5605
+ onCommand: dropdownHandler
5606
+ }, {
5607
+ dropdown: withCtx(() => [
5608
+ _ctx.data.items && _ctx.data.items.length ? (openBlock(), createBlock(unref(TMagicDropdownMenu), { key: 0 }, {
5609
+ default: withCtx(() => [
5610
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (subItem, index) => {
5611
+ return openBlock(), createBlock(unref(TMagicDropdownItem), {
5612
+ key: index,
5613
+ command: { data: _ctx.data, subItem }
5614
+ }, {
5615
+ default: withCtx(() => [
5616
+ createTextVNode(toDisplayString(subItem.text), 1)
5617
+ ]),
5618
+ _: 2
5619
+ }, 1032, ["command"]);
5620
+ }), 128))
5621
+ ]),
5622
+ _: 1
5623
+ })) : createCommentVNode("", true)
5530
5624
  ]),
5531
- _: 2
5532
- }, [
5533
- pageLength.value > 0 ? {
5534
- name: "right",
5535
- fn: withCtx(() => [
5536
- createVNode(unref(TMagicScrollbar), null, {
5625
+ default: withCtx(() => [
5626
+ createElementVNode("span", _hoisted_2$9, [
5627
+ createTextVNode(toDisplayString(_ctx.data.text), 1),
5628
+ createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
5537
5629
  default: withCtx(() => [
5538
- renderSlot(_ctx.$slots, "props-panel")
5630
+ createVNode(unref(ArrowDown))
5539
5631
  ]),
5540
- _: 3
5632
+ _: 1
5541
5633
  })
5542
- ]),
5543
- key: "0"
5544
- } : void 0
5545
- ]), 1032, ["left", "right"])),
5546
- renderSlot(_ctx.$slots, "content-after"),
5547
- renderSlot(_ctx.$slots, "footer")
5548
- ], 512);
5634
+ ])
5635
+ ]),
5636
+ _: 1
5637
+ }, 8, ["disabled"])) : _ctx.data.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.data.component), normalizeProps(mergeProps({ key: 4 }, _ctx.data.props || {})), null, 16)) : createCommentVNode("", true)
5638
+ ], 34)) : createCommentVNode("", true);
5549
5639
  };
5550
5640
  }
5551
5641
  });
5552
5642
 
5553
5643
  const _hoisted_1$e = {
5554
5644
  key: 1,
5555
- class: "menu-item-text"
5645
+ style: { "width": "21px" }
5556
5646
  };
5557
- const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
5558
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
5647
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5559
5648
  ...{
5560
- name: "MEditorToolButton"
5649
+ name: "MEditorPageBarAddButton"
5561
5650
  },
5562
- __name: "ToolButton",
5651
+ __name: "AddButton",
5563
5652
  props: {
5564
- data: { default: () => ({
5565
- type: "text",
5566
- display: false
5567
- }) },
5568
- eventType: { default: "click" }
5653
+ type: {}
5569
5654
  },
5570
5655
  setup(__props) {
5571
5656
  const props = __props;
5572
5657
  const services = inject("services");
5573
- const disabled = computed(() => {
5574
- if (typeof props.data === "string")
5575
- return false;
5576
- if (props.data.type === "component")
5577
- return false;
5578
- if (typeof props.data.disabled === "function") {
5579
- return props.data.disabled(services);
5580
- }
5581
- return props.data.disabled;
5658
+ const uiService = services?.uiService;
5659
+ const editorService = services?.editorService;
5660
+ const showAddPageButton = computed(() => uiService?.get("showAddPageButton"));
5661
+ const addPage = () => {
5662
+ if (!editorService)
5663
+ return;
5664
+ const root = toRaw(editorService.get("root"));
5665
+ if (!root)
5666
+ throw new Error("root 不能为空");
5667
+ const pageConfig = {
5668
+ type: props.type,
5669
+ name: generatePageNameByApp(root, props.type),
5670
+ items: []
5671
+ };
5672
+ editorService.add(pageConfig);
5673
+ };
5674
+ return (_ctx, _cache) => {
5675
+ return showAddPageButton.value ? (openBlock(), createElementBlock("div", {
5676
+ key: 0,
5677
+ id: "m-editor-page-bar-add-icon",
5678
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5679
+ onClick: addPage
5680
+ }, [
5681
+ createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
5682
+ ])) : (openBlock(), createElementBlock("div", _hoisted_1$e));
5683
+ };
5684
+ }
5685
+ });
5686
+
5687
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
5688
+ ...{
5689
+ name: "MEditorPageBarScrollContainer"
5690
+ },
5691
+ __name: "PageBarScrollContainer",
5692
+ props: {
5693
+ type: {}
5694
+ },
5695
+ setup(__props) {
5696
+ const props = __props;
5697
+ const services = inject("services");
5698
+ const editorService = services?.editorService;
5699
+ const uiService = services?.uiService;
5700
+ const itemsContainer = ref();
5701
+ const canScroll = ref(false);
5702
+ const showAddPageButton = computed(() => uiService?.get("showAddPageButton"));
5703
+ const itemsContainerWidth = ref(0);
5704
+ const setCanScroll = () => {
5705
+ itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - (showAddPageButton.value ? 37 : 21);
5706
+ nextTick(() => {
5707
+ if (itemsContainer.value) {
5708
+ canScroll.value = itemsContainer.value.scrollWidth - itemsContainerWidth.value > 1;
5709
+ }
5710
+ });
5711
+ };
5712
+ const resizeObserver = new ResizeObserver(() => {
5713
+ setCanScroll();
5582
5714
  });
5583
- const display = computed(() => {
5584
- if (!props.data)
5585
- return false;
5586
- if (typeof props.data === "string")
5587
- return true;
5588
- if (typeof props.data.display === "function") {
5589
- return props.data.display(services);
5590
- }
5591
- return props.data.display ?? true;
5715
+ const pageBar = ref();
5716
+ onMounted(() => {
5717
+ pageBar.value && resizeObserver.observe(pageBar.value);
5592
5718
  });
5593
- const buttonHandler = (item, event) => {
5594
- if (disabled.value)
5719
+ onBeforeUnmount(() => {
5720
+ resizeObserver.disconnect();
5721
+ });
5722
+ let translateLeft = 0;
5723
+ const scroll = (type) => {
5724
+ if (!itemsContainer.value)
5595
5725
  return;
5596
- if (typeof item.handler === "function" && services) {
5597
- item.handler?.(services, event);
5726
+ const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
5727
+ if (type === "left") {
5728
+ translateLeft += 100;
5729
+ if (translateLeft > 0) {
5730
+ translateLeft = 0;
5731
+ }
5732
+ } else if (type === "right") {
5733
+ translateLeft -= 100;
5734
+ if (-translateLeft > maxScrollLeft) {
5735
+ translateLeft = -maxScrollLeft;
5736
+ }
5737
+ } else if (type === "start") {
5738
+ translateLeft = 0;
5739
+ } else if (type === "end") {
5740
+ translateLeft = -maxScrollLeft;
5598
5741
  }
5742
+ itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
5599
5743
  };
5600
- const dropdownHandler = (command) => {
5601
- if (command.item.handler) {
5602
- command.item.handler(services);
5744
+ const pageLength = computed(() => editorService?.get("pageLength") || 0);
5745
+ const pageFragmentLength = computed(() => editorService?.get("pageFragmentLength") || 0);
5746
+ const crateWatchLength = (length) => watch(
5747
+ length,
5748
+ (length2 = 0, preLength = 0) => {
5749
+ setTimeout(() => {
5750
+ setCanScroll();
5751
+ if (length2 < preLength) {
5752
+ scroll("start");
5753
+ } else {
5754
+ scroll("end");
5755
+ }
5756
+ });
5757
+ },
5758
+ {
5759
+ immediate: true
5603
5760
  }
5761
+ );
5762
+ let unWatchPageLength;
5763
+ let unWatchPageFragmentLength;
5764
+ watch(
5765
+ () => props.type,
5766
+ (type) => {
5767
+ if (type === NodeType.PAGE) {
5768
+ unWatchPageFragmentLength?.();
5769
+ unWatchPageFragmentLength = null;
5770
+ unWatchPageLength = crateWatchLength(pageLength);
5771
+ } else {
5772
+ unWatchPageLength?.();
5773
+ unWatchPageLength = null;
5774
+ unWatchPageFragmentLength = crateWatchLength(pageFragmentLength);
5775
+ }
5776
+ },
5777
+ {
5778
+ immediate: true
5779
+ }
5780
+ );
5781
+ return (_ctx, _cache) => {
5782
+ return openBlock(), createElementBlock("div", {
5783
+ class: "m-editor-page-bar",
5784
+ ref_key: "pageBar",
5785
+ ref: pageBar
5786
+ }, [
5787
+ renderSlot(_ctx.$slots, "prepend"),
5788
+ canScroll.value ? (openBlock(), createElementBlock("div", {
5789
+ key: 0,
5790
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5791
+ onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
5792
+ }, [
5793
+ createVNode(_sfc_main$N, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
5794
+ ])) : createCommentVNode("", true),
5795
+ _ctx.type === unref(NodeType).PAGE && pageLength.value || _ctx.type === unref(NodeType).PAGE_FRAGMENT && pageFragmentLength.value ? (openBlock(), createElementBlock("div", {
5796
+ key: 1,
5797
+ class: "m-editor-page-bar-items",
5798
+ ref_key: "itemsContainer",
5799
+ ref: itemsContainer,
5800
+ style: normalizeStyle(`width: ${itemsContainerWidth.value}px`)
5801
+ }, [
5802
+ renderSlot(_ctx.$slots, "default")
5803
+ ], 4)) : createCommentVNode("", true),
5804
+ canScroll.value ? (openBlock(), createElementBlock("div", {
5805
+ key: 2,
5806
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
5807
+ onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
5808
+ }, [
5809
+ createVNode(_sfc_main$N, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
5810
+ ])) : createCommentVNode("", true)
5811
+ ], 512);
5604
5812
  };
5605
- const clickHandler = (item, event) => {
5606
- if (props.eventType !== "click")
5813
+ }
5814
+ });
5815
+
5816
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5817
+ ...{
5818
+ name: "MEditorPageBarSwitchTypeButton"
5819
+ },
5820
+ __name: "SwitchTypeButton",
5821
+ props: {
5822
+ modelValue: {}
5823
+ },
5824
+ emits: ["update:modelValue"],
5825
+ setup(__props, { emit: __emit }) {
5826
+ const data = [
5827
+ {
5828
+ type: NodeType.PAGE,
5829
+ text: "页面"
5830
+ },
5831
+ {
5832
+ type: NodeType.PAGE_FRAGMENT,
5833
+ text: "页面片"
5834
+ }
5835
+ ];
5836
+ const emit = __emit;
5837
+ const clickHandler = (value) => {
5838
+ emit("update:modelValue", value);
5839
+ };
5840
+ return (_ctx, _cache) => {
5841
+ return openBlock(), createElementBlock(Fragment, null, renderList(data, (item) => {
5842
+ return createVNode(unref(TMagicButton), {
5843
+ class: normalizeClass(["m-editor-page-bar-switch-type-button", { active: _ctx.modelValue === item.type }]),
5844
+ size: "small",
5845
+ key: item.type,
5846
+ text: "",
5847
+ type: _ctx.modelValue === item.type ? "primary" : "",
5848
+ onClick: ($event) => clickHandler(item.type)
5849
+ }, {
5850
+ default: withCtx(() => [
5851
+ createTextVNode(toDisplayString(item.text), 1)
5852
+ ]),
5853
+ _: 2
5854
+ }, 1032, ["class", "type", "onClick"]);
5855
+ }), 64);
5856
+ };
5857
+ }
5858
+ });
5859
+
5860
+ const _hoisted_1$d = { class: "m-editor-page-bar-tabs" };
5861
+ const _hoisted_2$8 = ["onClick"];
5862
+ const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
5863
+ const _hoisted_4$5 = ["title"];
5864
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
5865
+ ...{
5866
+ name: "MEditorPageBar"
5867
+ },
5868
+ __name: "PageBar",
5869
+ props: {
5870
+ disabledPageFragment: { type: Boolean }
5871
+ },
5872
+ setup(__props) {
5873
+ const active = ref(NodeType.PAGE);
5874
+ const services = inject("services");
5875
+ const editorService = services?.editorService;
5876
+ const root = computed(() => editorService?.get("root"));
5877
+ const page = computed(() => editorService?.get("page"));
5878
+ const pageList = computed(() => getPageList(root.value));
5879
+ const pageFragmentList = computed(() => getPageFragmentList(root.value));
5880
+ const list = computed(() => active.value === NodeType.PAGE ? pageList.value : pageFragmentList.value);
5881
+ const activePage = ref("");
5882
+ const activePageFragment = ref("");
5883
+ watch(
5884
+ page,
5885
+ (page2) => {
5886
+ if (!page2) {
5887
+ if (active.value === NodeType.PAGE) {
5888
+ activePage.value = "";
5889
+ }
5890
+ if (active.value === NodeType.PAGE_FRAGMENT) {
5891
+ activePageFragment.value = "";
5892
+ }
5893
+ return;
5894
+ }
5895
+ if (isPage(page2)) {
5896
+ activePage.value = page2?.id;
5897
+ if (active.value !== NodeType.PAGE) {
5898
+ active.value = NodeType.PAGE;
5899
+ }
5900
+ } else if (isPageFragment(page2)) {
5901
+ activePageFragment.value = page2?.id;
5902
+ if (active.value !== NodeType.PAGE_FRAGMENT) {
5903
+ active.value = NodeType.PAGE_FRAGMENT;
5904
+ }
5905
+ }
5906
+ },
5907
+ {
5908
+ immediate: true
5909
+ }
5910
+ );
5911
+ watch(active, (active2) => {
5912
+ if (active2 === NodeType.PAGE) {
5913
+ if (!activePage.value) {
5914
+ editorService?.selectRoot();
5915
+ return;
5916
+ }
5917
+ switchPage(activePage.value);
5607
5918
  return;
5608
- if (item.type === "button") {
5609
- buttonHandler(item, event);
5610
5919
  }
5920
+ if (active2 === NodeType.PAGE_FRAGMENT) {
5921
+ if (!activePageFragment.value) {
5922
+ editorService?.selectRoot();
5923
+ return;
5924
+ }
5925
+ switchPage(activePageFragment.value);
5926
+ }
5927
+ });
5928
+ const switchPage = (id) => {
5929
+ editorService?.select(id);
5611
5930
  };
5612
- const mousedownHandler = (item, event) => {
5613
- if (props.eventType !== "mousedown")
5931
+ const copy = (node) => {
5932
+ node && editorService?.copy(node);
5933
+ editorService?.paste({
5934
+ left: 0,
5935
+ top: 0
5936
+ });
5937
+ };
5938
+ const remove = (node) => {
5939
+ editorService?.remove(node);
5940
+ };
5941
+ return (_ctx, _cache) => {
5942
+ return openBlock(), createElementBlock("div", _hoisted_1$d, [
5943
+ !_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$u, {
5944
+ key: 0,
5945
+ modelValue: active.value,
5946
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
5947
+ }, null, 8, ["modelValue"])) : createCommentVNode("", true),
5948
+ createVNode(_sfc_main$v, { type: active.value }, {
5949
+ prepend: withCtx(() => [
5950
+ createVNode(_sfc_main$w, { type: active.value }, null, 8, ["type"])
5951
+ ]),
5952
+ default: withCtx(() => [
5953
+ (openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (item) => {
5954
+ return openBlock(), createElementBlock("div", {
5955
+ class: normalizeClass(["m-editor-page-bar-item", { active: page.value?.id === item.id }]),
5956
+ key: item.id,
5957
+ onClick: ($event) => switchPage(item.id)
5958
+ }, [
5959
+ createElementVNode("div", _hoisted_3$5, [
5960
+ renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
5961
+ createElementVNode("span", {
5962
+ title: item.name
5963
+ }, toDisplayString(item.name || item.id), 9, _hoisted_4$5)
5964
+ ])
5965
+ ]),
5966
+ createVNode(unref(TMagicPopover), {
5967
+ "popper-class": "page-bar-popover",
5968
+ placement: "top",
5969
+ width: 160,
5970
+ trigger: "hover"
5971
+ }, {
5972
+ reference: withCtx(() => [
5973
+ createVNode(unref(TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
5974
+ default: withCtx(() => [
5975
+ createVNode(unref(CaretBottom))
5976
+ ]),
5977
+ _: 1
5978
+ })
5979
+ ]),
5980
+ default: withCtx(() => [
5981
+ createElementVNode("div", null, [
5982
+ renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
5983
+ createVNode(_sfc_main$x, {
5984
+ data: {
5985
+ type: "button",
5986
+ text: "复制",
5987
+ icon: unref(DocumentCopy),
5988
+ handler: () => copy(item)
5989
+ }
5990
+ }, null, 8, ["data"]),
5991
+ createVNode(_sfc_main$x, {
5992
+ data: {
5993
+ type: "button",
5994
+ text: "删除",
5995
+ icon: unref(Delete),
5996
+ handler: () => remove(item)
5997
+ }
5998
+ }, null, 8, ["data"])
5999
+ ])
6000
+ ])
6001
+ ]),
6002
+ _: 2
6003
+ }, 1024)
6004
+ ], 10, _hoisted_2$8);
6005
+ }), 128))
6006
+ ]),
6007
+ _: 3
6008
+ }, 8, ["type"])
6009
+ ]);
6010
+ };
6011
+ }
6012
+ });
6013
+
6014
+ const _hoisted_1$c = { class: "m-editor-empty-panel" };
6015
+ const _hoisted_2$7 = { class: "m-editor-empty-content" };
6016
+ const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
6017
+ const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面片", -1);
6018
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
6019
+ ...{
6020
+ name: "MEditorAddPageBox"
6021
+ },
6022
+ __name: "AddPageBox",
6023
+ props: {
6024
+ disabledPageFragment: { type: Boolean }
6025
+ },
6026
+ setup(__props) {
6027
+ const services = inject("services");
6028
+ const clickHandler = (type) => {
6029
+ const { editorService } = services || {};
6030
+ if (!editorService)
5614
6031
  return;
5615
- if (item.type === "button") {
5616
- buttonHandler(item, event);
6032
+ const root = toRaw(editorService.get("root"));
6033
+ if (!root)
6034
+ throw new Error("root 不能为空");
6035
+ editorService.add({
6036
+ type,
6037
+ name: generatePageNameByApp(root, type),
6038
+ items: []
6039
+ });
6040
+ };
6041
+ return (_ctx, _cache) => {
6042
+ return openBlock(), createElementBlock("div", _hoisted_1$c, [
6043
+ createElementVNode("div", _hoisted_2$7, [
6044
+ createElementVNode("div", {
6045
+ class: "m-editor-empty-button",
6046
+ onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(unref(NodeType).PAGE))
6047
+ }, [
6048
+ createElementVNode("div", null, [
6049
+ createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
6050
+ ]),
6051
+ _hoisted_3$4
6052
+ ]),
6053
+ !_ctx.disabledPageFragment ? (openBlock(), createElementBlock("div", {
6054
+ key: 0,
6055
+ class: "m-editor-empty-button",
6056
+ onClick: _cache[1] || (_cache[1] = ($event) => clickHandler(unref(NodeType).PAGE_FRAGMENT))
6057
+ }, [
6058
+ createElementVNode("div", null, [
6059
+ createVNode(_sfc_main$N, { icon: unref(Plus) }, null, 8, ["icon"])
6060
+ ]),
6061
+ _hoisted_4$4
6062
+ ])) : createCommentVNode("", true)
6063
+ ])
6064
+ ]);
6065
+ };
6066
+ }
6067
+ });
6068
+
6069
+ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
6070
+ const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
6071
+ const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
6072
+ const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
6073
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
6074
+ ...{
6075
+ name: "MEditorFramework"
6076
+ },
6077
+ __name: "Framework",
6078
+ props: {
6079
+ disabledPageFragment: { type: Boolean }
6080
+ },
6081
+ setup(__props) {
6082
+ const codeOptions = inject("codeOptions", {});
6083
+ const { editorService, uiService } = inject("services") || {};
6084
+ const content = ref();
6085
+ const splitView = ref();
6086
+ const root = computed(() => editorService?.get("root"));
6087
+ const page = computed(() => editorService?.get("page"));
6088
+ const pageLength = computed(() => editorService?.get("pageLength") || 0);
6089
+ const stageLoading = computed(() => editorService?.get("stageLoading") || false);
6090
+ const showSrc = computed(() => uiService?.get("showSrc"));
6091
+ const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
6092
+ const leftColumnWidthCacheData = getLeftColumnWidthCacheData();
6093
+ const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
6094
+ const columnWidth = ref({
6095
+ left: leftColumnWidthCacheData,
6096
+ center: 0,
6097
+ right: RightColumnWidthCacheData
6098
+ });
6099
+ watch(
6100
+ [pageLength, splitView],
6101
+ () => {
6102
+ splitView.value?.updateWidth();
6103
+ },
6104
+ {
6105
+ immediate: true
6106
+ }
6107
+ );
6108
+ watch(
6109
+ () => columnWidth.value.right,
6110
+ (right) => {
6111
+ if (typeof right === "undefined")
6112
+ return;
6113
+ globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${right}`);
6114
+ }
6115
+ );
6116
+ watch(
6117
+ () => columnWidth.value.left,
6118
+ (left) => {
6119
+ globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
5617
6120
  }
6121
+ );
6122
+ watch(
6123
+ () => uiService?.get("hideSlideBar"),
6124
+ (hideSlideBar) => {
6125
+ columnWidth.value.left = hideSlideBar ? 0 : getLeftColumnWidthCacheData();
6126
+ }
6127
+ );
6128
+ const columnWidthChange = (columnW) => {
6129
+ columnWidth.value.left = columnW.left;
6130
+ columnWidth.value.center = columnW.center;
6131
+ columnWidth.value.right = columnW.right;
6132
+ uiService?.set("columnWidth", columnW);
5618
6133
  };
5619
- const mouseupHandler = (item, event) => {
5620
- if (props.eventType !== "mouseup")
5621
- return;
5622
- if (item.type === "button") {
5623
- buttonHandler(item, event);
6134
+ const saveCode = (value) => {
6135
+ try {
6136
+ const parseDSL = getConfig("parseDSL");
6137
+ editorService?.set("root", parseDSL(value));
6138
+ } catch (e) {
6139
+ console.error(e);
5624
6140
  }
5625
6141
  };
5626
6142
  return (_ctx, _cache) => {
5627
- return display.value ? (openBlock(), createElementBlock("div", {
5628
- key: 0,
5629
- class: normalizeClass(["menu-item", `${_ctx.data.type} ${_ctx.data.className || ""}`]),
5630
- onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(_ctx.data, $event)),
5631
- onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(_ctx.data, $event)),
5632
- onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(_ctx.data, $event))
6143
+ const _directive_loading = resolveDirective("loading");
6144
+ return openBlock(), createElementBlock("div", {
6145
+ class: "m-editor",
6146
+ ref_key: "content",
6147
+ ref: content,
6148
+ style: { "min-width": "180px" }
5633
6149
  }, [
5634
- _ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
5635
- key: 0,
5636
- direction: _ctx.data.direction || "vertical"
5637
- }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$e, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
5638
- _ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
5639
- key: 0,
5640
- effect: "dark",
5641
- placement: "bottom-start",
5642
- content: _ctx.data.tooltip
5643
- }, {
5644
- default: withCtx(() => [
5645
- createVNode(unref(TMagicButton), {
5646
- size: "small",
5647
- text: "",
5648
- disabled: disabled.value
5649
- }, {
5650
- default: withCtx(() => [
5651
- _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$K, {
5652
- key: 0,
5653
- icon: _ctx.data.icon
5654
- }, null, 8, ["icon"])) : createCommentVNode("", true),
5655
- createElementVNode("span", null, toDisplayString(_ctx.data.text), 1)
5656
- ]),
5657
- _: 1
5658
- }, 8, ["disabled"])
5659
- ]),
5660
- _: 1
5661
- }, 8, ["content"])) : (openBlock(), createBlock(unref(TMagicButton), {
5662
- key: 1,
5663
- size: "small",
5664
- text: "",
5665
- disabled: disabled.value,
5666
- title: _ctx.data.text
5667
- }, {
5668
- default: withCtx(() => [
5669
- _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$K, {
5670
- key: 0,
5671
- icon: _ctx.data.icon
5672
- }, null, 8, ["icon"])) : createCommentVNode("", true),
5673
- createElementVNode("span", null, toDisplayString(_ctx.data.text), 1)
6150
+ renderSlot(_ctx.$slots, "header"),
6151
+ renderSlot(_ctx.$slots, "nav"),
6152
+ renderSlot(_ctx.$slots, "content-before"),
6153
+ showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
6154
+ createVNode(_sfc_main$T, {
6155
+ class: "m-editor-content",
6156
+ "init-values": root.value,
6157
+ options: unref(codeOptions),
6158
+ onSave: saveCode
6159
+ }, null, 8, ["init-values", "options"])
6160
+ ]) : withDirectives((openBlock(), createBlock(_sfc_main$y, {
6161
+ key: 1,
6162
+ "element-loading-text": "Runtime 加载中...",
6163
+ ref_key: "splitView",
6164
+ ref: splitView,
6165
+ class: "m-editor-content",
6166
+ "left-class": "m-editor-framework-left",
6167
+ "center-class": "m-editor-framework-center",
6168
+ "right-class": "m-editor-framework-right",
6169
+ left: columnWidth.value.left,
6170
+ "onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
6171
+ right: columnWidth.value.right,
6172
+ "onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
6173
+ "min-left": 65,
6174
+ "min-right": 20,
6175
+ "min-center": 100,
6176
+ onChange: columnWidthChange
6177
+ }, createSlots({
6178
+ left: withCtx(() => [
6179
+ renderSlot(_ctx.$slots, "sidebar")
6180
+ ]),
6181
+ center: withCtx(() => [
6182
+ page.value ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
6183
+ createVNode(_sfc_main$s, { "disabled-page-fragment": _ctx.disabledPageFragment }, null, 8, ["disabled-page-fragment"])
5674
6184
  ]),
5675
- _: 1
5676
- }, 8, ["disabled", "title"]))
5677
- ], 64)) : _ctx.data.type === "dropdown" ? (openBlock(), createBlock(unref(TMagicDropdown), {
5678
- key: 3,
5679
- trigger: "click",
5680
- disabled: disabled.value,
5681
- onCommand: dropdownHandler
5682
- }, {
5683
- dropdown: withCtx(() => [
5684
- _ctx.data.items && _ctx.data.items.length ? (openBlock(), createBlock(unref(TMagicDropdownMenu), { key: 0 }, {
5685
- default: withCtx(() => [
5686
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (subItem, index) => {
5687
- return openBlock(), createBlock(unref(TMagicDropdownItem), {
5688
- key: index,
5689
- command: { data: _ctx.data, subItem }
5690
- }, {
5691
- default: withCtx(() => [
5692
- createTextVNode(toDisplayString(subItem.text), 1)
5693
- ]),
5694
- _: 2
5695
- }, 1032, ["command"]);
5696
- }), 128))
6185
+ createVNode(_sfc_main$t, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
6186
+ "page-bar-title": withCtx(({ page: page2 }) => [
6187
+ renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
5697
6188
  ]),
5698
- _: 1
5699
- })) : createCommentVNode("", true)
6189
+ "page-bar-popover": withCtx(({ page: page2 }) => [
6190
+ renderSlot(_ctx.$slots, "page-bar-popover", { page: page2 })
6191
+ ]),
6192
+ _: 3
6193
+ }, 8, ["disabled-page-fragment"])
5700
6194
  ]),
5701
- default: withCtx(() => [
5702
- createElementVNode("span", _hoisted_2$8, [
5703
- createTextVNode(toDisplayString(_ctx.data.text), 1),
5704
- createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
6195
+ _: 2
6196
+ }, [
6197
+ page.value ? {
6198
+ name: "right",
6199
+ fn: withCtx(() => [
6200
+ createVNode(unref(TMagicScrollbar), null, {
5705
6201
  default: withCtx(() => [
5706
- createVNode(unref(ArrowDown))
6202
+ renderSlot(_ctx.$slots, "props-panel")
5707
6203
  ]),
5708
- _: 1
6204
+ _: 3
5709
6205
  })
5710
- ])
5711
- ]),
5712
- _: 1
5713
- }, 8, ["disabled"])) : _ctx.data.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.data.component), normalizeProps(mergeProps({ key: 4 }, _ctx.data.props || {})), null, 16)) : createCommentVNode("", true)
5714
- ], 34)) : createCommentVNode("", true);
6206
+ ]),
6207
+ key: "0"
6208
+ } : void 0
6209
+ ]), 1032, ["left", "right"])), [
6210
+ [_directive_loading, stageLoading.value]
6211
+ ]),
6212
+ renderSlot(_ctx.$slots, "content-after"),
6213
+ renderSlot(_ctx.$slots, "footer")
6214
+ ], 512);
5715
6215
  };
5716
6216
  }
5717
6217
  });
5718
6218
 
5719
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
6219
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
5720
6220
  ...{
5721
6221
  name: "MEditorNavMenu"
5722
6222
  },
@@ -5878,7 +6378,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
5878
6378
  style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
5879
6379
  }, [
5880
6380
  (openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
5881
- return openBlock(), createBlock(_sfc_main$t, {
6381
+ return openBlock(), createBlock(_sfc_main$x, {
5882
6382
  data: item,
5883
6383
  key: index
5884
6384
  }, null, 8, ["data"]);
@@ -5890,8 +6390,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
5890
6390
  }
5891
6391
  });
5892
6392
 
5893
- const _hoisted_1$d = { class: "m-editor-props-panel" };
5894
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
6393
+ const _hoisted_1$b = { class: "m-editor-props-panel" };
6394
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
5895
6395
  ...{
5896
6396
  name: "MEditorPropsPanel"
5897
6397
  },
@@ -5925,7 +6425,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
5925
6425
  onMounted(() => {
5926
6426
  emit("mounted", internalInstance);
5927
6427
  });
5928
- onUnmounted(() => {
6428
+ onBeforeUnmount(() => {
5929
6429
  services?.propsService.off("props-configs-change", init);
5930
6430
  });
5931
6431
  watchEffect(() => {
@@ -5945,7 +6445,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
5945
6445
  };
5946
6446
  __expose({ configForm, submit });
5947
6447
  return (_ctx, _cache) => {
5948
- return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$d, [
6448
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$b, [
5949
6449
  renderSlot(_ctx.$slots, "props-panel-header"),
5950
6450
  createVNode(unref(MForm), {
5951
6451
  ref_key: "configForm",
@@ -6096,7 +6596,7 @@ const useFloatBox = (slideKeys) => {
6096
6596
  };
6097
6597
  };
6098
6598
 
6099
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
6599
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6100
6600
  ...{
6101
6601
  name: "MEditorSearchInput"
6102
6602
  },
@@ -6147,14 +6647,14 @@ const updateStatus = (nodeStatusMap, id, status) => {
6147
6647
  });
6148
6648
  };
6149
6649
 
6150
- const _hoisted_1$c = ["draggable", "data-node-id", "data-is-container"];
6151
- const _hoisted_2$7 = { class: "tree-node-label" };
6650
+ const _hoisted_1$a = ["draggable", "data-node-id", "data-is-container"];
6651
+ const _hoisted_2$6 = { class: "tree-node-label" };
6152
6652
  const _hoisted_3$3 = { class: "tree-node-tool" };
6153
6653
  const _hoisted_4$3 = {
6154
6654
  key: 0,
6155
6655
  class: "m-editor-tree-node-children"
6156
6656
  };
6157
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
6657
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6158
6658
  ...{
6159
6659
  name: "MEditorTreeNode"
6160
6660
  },
@@ -6180,7 +6680,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6180
6680
  const selected = computed(() => nodeStatus.value.selected);
6181
6681
  const visible = computed(() => nodeStatus.value.visible);
6182
6682
  const draggable = computed(() => nodeStatus.value.draggable);
6183
- const hasChilren = computed(() => props.data.items?.some((item) => props.nodeStatusMap.get(item.id)?.visible));
6683
+ const hasChildren = computed(() => props.data.items?.some((item) => props.nodeStatusMap.get(item.id)?.visible));
6184
6684
  const handleDragStart = (event) => {
6185
6685
  treeEmit?.("node-dragstart", event, props.data);
6186
6686
  };
@@ -6221,9 +6721,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6221
6721
  onContextmenu: nodeContentmenuHandler,
6222
6722
  onMouseenter: mouseenterHandler
6223
6723
  }, [
6224
- createVNode(_sfc_main$K, {
6724
+ createVNode(_sfc_main$N, {
6225
6725
  class: "expand-icon",
6226
- style: normalizeStyle(hasChilren.value ? "" : "color: transparent; cursor: default"),
6726
+ style: normalizeStyle(hasChildren.value ? "" : "color: transparent; cursor: default"),
6227
6727
  icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
6228
6728
  onClick: expandHandler
6229
6729
  }, null, 8, ["style", "icon"]),
@@ -6232,7 +6732,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6232
6732
  onClick: nodeClickHandler
6233
6733
  }, [
6234
6734
  renderSlot(_ctx.$slots, "tree-node-content", { data: _ctx.data }, () => [
6235
- createElementVNode("div", _hoisted_2$7, [
6735
+ createElementVNode("div", _hoisted_2$6, [
6236
6736
  renderSlot(_ctx.$slots, "tree-node-label", { data: _ctx.data }, () => [
6237
6737
  createTextVNode(toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1)
6238
6738
  ])
@@ -6243,7 +6743,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6243
6743
  ])
6244
6744
  ])
6245
6745
  ], 38),
6246
- hasChilren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
6746
+ hasChildren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
6247
6747
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (item) => {
6248
6748
  return openBlock(), createBlock(_component_TreeNode, {
6249
6749
  key: item.id,
@@ -6264,15 +6764,15 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6264
6764
  }, 1032, ["data", "node-status-map", "indent"]);
6265
6765
  }), 128))
6266
6766
  ])) : createCommentVNode("", true)
6267
- ], 40, _hoisted_1$c)), [
6767
+ ], 40, _hoisted_1$a)), [
6268
6768
  [vShow, visible.value]
6269
6769
  ]);
6270
6770
  };
6271
6771
  }
6272
6772
  });
6273
6773
 
6274
- const _hoisted_1$b = { key: 1 };
6275
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
6774
+ const _hoisted_1$9 = { key: 1 };
6775
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6276
6776
  ...{
6277
6777
  name: "MEditorTree"
6278
6778
  },
@@ -6296,7 +6796,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6296
6796
  onDragover: handleDragOver
6297
6797
  }, [
6298
6798
  _ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
6299
- return openBlock(), createBlock(_sfc_main$p, {
6799
+ return openBlock(), createBlock(_sfc_main$n, {
6300
6800
  key: item.id,
6301
6801
  data: item,
6302
6802
  indent: _ctx.indent,
@@ -6313,7 +6813,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6313
6813
  ]),
6314
6814
  _: 2
6315
6815
  }, 1032, ["data", "indent", "node-status-map"]);
6316
- }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$b, [
6816
+ }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$9, [
6317
6817
  createElementVNode("p", null, toDisplayString(_ctx.emptyText), 1)
6318
6818
  ]))
6319
6819
  ], 32);
@@ -6393,7 +6893,7 @@ const useNodeStatus$1 = (nodeData) => {
6393
6893
  };
6394
6894
  };
6395
6895
 
6396
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
6896
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6397
6897
  ...{
6398
6898
  name: "MEditorCodeBlockList"
6399
6899
  },
@@ -6475,7 +6975,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6475
6975
  filter: filterTextChangeHandler
6476
6976
  });
6477
6977
  return (_ctx, _cache) => {
6478
- return openBlock(), createBlock(_sfc_main$o, {
6978
+ return openBlock(), createBlock(_sfc_main$m, {
6479
6979
  data: codeList.value,
6480
6980
  "node-status-map": unref(nodeStatusMap),
6481
6981
  onNodeClick: clickHandler
@@ -6497,7 +6997,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6497
6997
  placement: "bottom"
6498
6998
  }, {
6499
6999
  default: withCtx(() => [
6500
- createVNode(_sfc_main$K, {
7000
+ createVNode(_sfc_main$N, {
6501
7001
  icon: editable.value ? unref(Edit) : unref(View),
6502
7002
  class: "edit-icon",
6503
7003
  onClick: withModifiers(($event) => editCode(`${data.key}`), ["stop"])
@@ -6512,7 +7012,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6512
7012
  placement: "bottom"
6513
7013
  }, {
6514
7014
  default: withCtx(() => [
6515
- createVNode(_sfc_main$K, {
7015
+ createVNode(_sfc_main$N, {
6516
7016
  icon: unref(Close),
6517
7017
  class: "edit-icon",
6518
7018
  onClick: withModifiers(($event) => deleteCode(`${data.key}`), ["stop"])
@@ -6531,8 +7031,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6531
7031
  }
6532
7032
  });
6533
7033
 
6534
- const _hoisted_1$a = { class: "search-wrapper" };
6535
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
7034
+ const _hoisted_1$8 = { class: "search-wrapper" };
7035
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6536
7036
  ...{
6537
7037
  name: "MEditorCodeBlockListPanel"
6538
7038
  },
@@ -6554,8 +7054,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6554
7054
  createVNode(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
6555
7055
  default: withCtx(() => [
6556
7056
  renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
6557
- createElementVNode("div", _hoisted_1$a, [
6558
- createVNode(_sfc_main$q, { onSearch: filterTextChangeHandler }),
7057
+ createElementVNode("div", _hoisted_1$8, [
7058
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
6559
7059
  editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
6560
7060
  key: 0,
6561
7061
  class: "create-code-button",
@@ -6571,7 +7071,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6571
7071
  renderSlot(_ctx.$slots, "code-block-panel-search")
6572
7072
  ])
6573
7073
  ]),
6574
- createVNode(_sfc_main$n, {
7074
+ createVNode(_sfc_main$l, {
6575
7075
  ref_key: "codeBlockList",
6576
7076
  ref: codeBlockList,
6577
7077
  "custom-error": _ctx.customError,
@@ -6589,7 +7089,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6589
7089
  ]),
6590
7090
  _: 3
6591
7091
  }),
6592
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
7092
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
6593
7093
  key: 0,
6594
7094
  ref_key: "codeBlockEditor",
6595
7095
  ref: codeBlockEditor,
@@ -6603,7 +7103,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6603
7103
  }
6604
7104
  });
6605
7105
 
6606
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
7106
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6607
7107
  ...{
6608
7108
  name: "MEditorDataSourceConfigPanel"
6609
7109
  },
@@ -6659,7 +7159,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6659
7159
  }
6660
7160
  });
6661
7161
 
6662
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
7162
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
6663
7163
  ...{
6664
7164
  name: "MEditorDataSourceList"
6665
7165
  },
@@ -6748,7 +7248,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6748
7248
  filter: filterTextChangeHandler
6749
7249
  });
6750
7250
  return (_ctx, _cache) => {
6751
- return openBlock(), createBlock(_sfc_main$o, {
7251
+ return openBlock(), createBlock(_sfc_main$m, {
6752
7252
  data: list.value,
6753
7253
  "node-status-map": unref(nodeStatusMap),
6754
7254
  onNodeClick: clickHandler
@@ -6770,7 +7270,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6770
7270
  placement: "bottom"
6771
7271
  }, {
6772
7272
  default: withCtx(() => [
6773
- createVNode(_sfc_main$K, {
7273
+ createVNode(_sfc_main$N, {
6774
7274
  icon: editable.value ? unref(Edit) : unref(View),
6775
7275
  class: "edit-icon",
6776
7276
  onClick: withModifiers(($event) => editHandler(`${data.key}`), ["stop"])
@@ -6785,7 +7285,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6785
7285
  placement: "bottom"
6786
7286
  }, {
6787
7287
  default: withCtx(() => [
6788
- createVNode(_sfc_main$K, {
7288
+ createVNode(_sfc_main$N, {
6789
7289
  icon: unref(Close),
6790
7290
  class: "edit-icon",
6791
7291
  onClick: withModifiers(($event) => removeHandler(`${data.key}`), ["stop"])
@@ -6801,9 +7301,9 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6801
7301
  }
6802
7302
  });
6803
7303
 
6804
- const _hoisted_1$9 = { class: "search-wrapper" };
6805
- const _hoisted_2$6 = { class: "data-source-list-panel-add-menu" };
6806
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
7304
+ const _hoisted_1$7 = { class: "search-wrapper" };
7305
+ const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
7306
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
6807
7307
  ...{
6808
7308
  name: "MEditorDataSourceListPanel"
6809
7309
  },
@@ -6867,8 +7367,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6867
7367
  return openBlock(), createElementBlock(Fragment, null, [
6868
7368
  createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
6869
7369
  default: withCtx(() => [
6870
- createElementVNode("div", _hoisted_1$9, [
6871
- createVNode(_sfc_main$q, { onSearch: filterTextChangeHandler }),
7370
+ createElementVNode("div", _hoisted_1$7, [
7371
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
6872
7372
  editable.value ? (openBlock(), createBlock(unref(TMagicPopover), {
6873
7373
  key: 0,
6874
7374
  placement: "right"
@@ -6885,9 +7385,9 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6885
7385
  })
6886
7386
  ]),
6887
7387
  default: withCtx(() => [
6888
- createElementVNode("div", _hoisted_2$6, [
7388
+ createElementVNode("div", _hoisted_2$5, [
6889
7389
  (openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
6890
- return openBlock(), createBlock(_sfc_main$t, {
7390
+ return openBlock(), createBlock(_sfc_main$x, {
6891
7391
  data: {
6892
7392
  type: "button",
6893
7393
  text: item.text,
@@ -6903,14 +7403,14 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6903
7403
  _: 1
6904
7404
  })) : createCommentVNode("", true)
6905
7405
  ]),
6906
- createVNode(_sfc_main$k, {
7406
+ createVNode(_sfc_main$i, {
6907
7407
  onEdit: editHandler,
6908
7408
  onRemove: removeHandler
6909
7409
  })
6910
7410
  ]),
6911
7411
  _: 1
6912
7412
  }),
6913
- createVNode(_sfc_main$l, {
7413
+ createVNode(_sfc_main$j, {
6914
7414
  ref_key: "editDialog",
6915
7415
  ref: editDialog,
6916
7416
  disabled: !editable.value,
@@ -6924,7 +7424,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6924
7424
  }
6925
7425
  });
6926
7426
 
6927
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
7427
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
6928
7428
  ...{
6929
7429
  name: "MEditorContentMenu"
6930
7430
  },
@@ -6965,7 +7465,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
6965
7465
  return;
6966
7466
  hide();
6967
7467
  };
6968
- const outsideClickhideHandler = (e) => {
7468
+ const outsideClickHideHandler = (e) => {
6969
7469
  if (!props.autoHide)
6970
7470
  return;
6971
7471
  const target = e.target;
@@ -7026,12 +7526,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7026
7526
  onMounted(() => {
7027
7527
  if (props.isSubMenu)
7028
7528
  return;
7029
- globalThis.addEventListener("mousedown", outsideClickhideHandler, true);
7529
+ globalThis.addEventListener("mousedown", outsideClickHideHandler, true);
7030
7530
  });
7031
- onUnmounted(() => {
7531
+ onBeforeUnmount(() => {
7032
7532
  if (props.isSubMenu)
7033
7533
  return;
7034
- globalThis.removeEventListener("mousedown", outsideClickhideHandler, true);
7534
+ globalThis.removeEventListener("mousedown", outsideClickHideHandler, true);
7035
7535
  });
7036
7536
  __expose({
7037
7537
  menu,
@@ -7055,7 +7555,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7055
7555
  renderSlot(_ctx.$slots, "title"),
7056
7556
  createElementVNode("div", null, [
7057
7557
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
7058
- return openBlock(), createBlock(_sfc_main$t, {
7558
+ return openBlock(), createBlock(_sfc_main$x, {
7059
7559
  "event-type": "mouseup",
7060
7560
  ref_for: true,
7061
7561
  ref_key: "buttons",
@@ -7090,7 +7590,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7090
7590
  }
7091
7591
  });
7092
7592
 
7093
- const _hoisted_1$8 = {
7593
+ const _hoisted_1$6 = {
7094
7594
  width: "1em",
7095
7595
  height: "1em",
7096
7596
  viewBox: "0 0 16 16",
@@ -7098,7 +7598,7 @@ const _hoisted_1$8 = {
7098
7598
  fill: "currentColor",
7099
7599
  xmlns: "http://www.w3.org/2000/svg"
7100
7600
  };
7101
- const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("path", {
7601
+ const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("path", {
7102
7602
  "fill-rule": "evenodd",
7103
7603
  d: "M9.828 4H2.19a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91H9v1H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31L.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181L15.546 8H14.54l.265-2.91A1 1 0 0 0 13.81 4H9.828zm-2.95-1.707L7.587 3H2.19c-.24 0-.47.042-.684.12L1.5 2.98a1 1 0 0 1 1-.98h3.672a1 1 0 0 1 .707.293z"
7104
7604
  }, null, -1);
@@ -7107,17 +7607,17 @@ const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("path", {
7107
7607
  d: "M11 11.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5z"
7108
7608
  }, null, -1);
7109
7609
  const _hoisted_4$2 = [
7110
- _hoisted_2$5,
7610
+ _hoisted_2$4,
7111
7611
  _hoisted_3$2
7112
7612
  ];
7113
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
7613
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7114
7614
  ...{
7115
7615
  name: "MEditorFolderMinusIcon"
7116
7616
  },
7117
7617
  __name: "FolderMinusIcon",
7118
7618
  setup(__props) {
7119
7619
  return (_ctx, _cache) => {
7120
- return openBlock(), createElementBlock("svg", _hoisted_1$8, _hoisted_4$2);
7620
+ return openBlock(), createElementBlock("svg", _hoisted_1$6, _hoisted_4$2);
7121
7621
  };
7122
7622
  }
7123
7623
  });
@@ -7128,7 +7628,7 @@ const useDeleteMenu = () => ({
7128
7628
  icon: Delete,
7129
7629
  display: (services) => {
7130
7630
  const node = services?.editorService?.get("node");
7131
- return node?.type !== NodeType.ROOT && !isPage(node);
7631
+ return node?.type !== NodeType.ROOT && !isPage(node) && !isPageFragment(node);
7132
7632
  },
7133
7633
  handler: (services) => {
7134
7634
  const nodes = services?.editorService?.get("nodes");
@@ -7195,13 +7695,14 @@ const useMoveToMenu = (services) => {
7195
7695
  };
7196
7696
  };
7197
7697
 
7198
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
7698
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7199
7699
  ...{
7200
7700
  name: "MEditorLayerMenu"
7201
7701
  },
7202
7702
  __name: "LayerMenu",
7203
7703
  props: {
7204
- layerContentMenu: {}
7704
+ layerContentMenu: { default: () => [] },
7705
+ customContentMenu: { type: Function, default: (menus) => menus }
7205
7706
  },
7206
7707
  emits: ["collapse-all"],
7207
7708
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -7255,29 +7756,34 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7255
7756
  }
7256
7757
  return [];
7257
7758
  });
7258
- const menuData = computed(() => [
7259
- {
7260
- type: "button",
7261
- text: "全部折叠",
7262
- icon: _sfc_main$h,
7263
- display: () => isPage(node.value),
7264
- handler: () => {
7265
- emit("collapse-all");
7266
- }
7267
- },
7268
- {
7269
- type: "button",
7270
- text: "新增",
7271
- icon: markRaw(Plus),
7272
- display: () => node.value?.items && nodes.value?.length === 1,
7273
- items: getSubMenuData.value
7274
- },
7275
- useCopyMenu(),
7276
- usePasteMenu(),
7277
- useDeleteMenu(),
7278
- useMoveToMenu(services),
7279
- ...props.layerContentMenu
7280
- ]);
7759
+ const menuData = computed(
7760
+ () => props.customContentMenu(
7761
+ [
7762
+ {
7763
+ type: "button",
7764
+ text: "全部折叠",
7765
+ icon: _sfc_main$f,
7766
+ display: () => isPage(node.value) || isPageFragment(node.value),
7767
+ handler: () => {
7768
+ emit("collapse-all");
7769
+ }
7770
+ },
7771
+ {
7772
+ type: "button",
7773
+ text: "新增",
7774
+ icon: markRaw(Plus),
7775
+ display: () => node.value?.items && nodes.value?.length === 1,
7776
+ items: getSubMenuData.value
7777
+ },
7778
+ useCopyMenu(),
7779
+ usePasteMenu(),
7780
+ useDeleteMenu(),
7781
+ useMoveToMenu(services),
7782
+ ...props.layerContentMenu
7783
+ ],
7784
+ "layer"
7785
+ )
7786
+ );
7281
7787
  const show = (e) => {
7282
7788
  menu.value?.show(e);
7283
7789
  };
@@ -7285,7 +7791,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7285
7791
  show
7286
7792
  });
7287
7793
  return (_ctx, _cache) => {
7288
- return openBlock(), createBlock(_sfc_main$i, {
7794
+ return openBlock(), createBlock(_sfc_main$g, {
7289
7795
  "menu-data": menuData.value,
7290
7796
  ref_key: "menu",
7291
7797
  ref: menu,
@@ -7295,7 +7801,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7295
7801
  }
7296
7802
  });
7297
7803
 
7298
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
7804
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7299
7805
  __name: "LayerNodeTool",
7300
7806
  props: {
7301
7807
  data: {}
@@ -7314,12 +7820,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7314
7820
  };
7315
7821
  return (_ctx, _cache) => {
7316
7822
  return _ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7317
- _ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$K, {
7823
+ _ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$N, {
7318
7824
  key: 0,
7319
7825
  icon: unref(Hide),
7320
7826
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
7321
7827
  title: "点击显示"
7322
- }, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$K, {
7828
+ }, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$N, {
7323
7829
  key: 1,
7324
7830
  icon: unref(View),
7325
7831
  onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
@@ -7332,11 +7838,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7332
7838
  });
7333
7839
 
7334
7840
  const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
7841
+ const isMultiSelect = computed(() => isCtrlKeyDown.value && !services?.editorService.get("disabledMultiSelect"));
7335
7842
  const select = async (data) => {
7336
7843
  if (!data.id) {
7337
7844
  throw new Error("没有id");
7338
7845
  }
7339
- if (isCtrlKeyDown.value) {
7846
+ if (isMultiSelect.value) {
7340
7847
  multiSelect(data);
7341
7848
  } else {
7342
7849
  await services?.editorService.select(data);
@@ -7375,7 +7882,7 @@ const useClick = (services, isCtrlKeyDown, nodeStatusMap) => {
7375
7882
  document.dispatchEvent(new CustomEvent(UI_SELECT_MODE_EVENT_NAME, { detail: data }));
7376
7883
  return;
7377
7884
  }
7378
- if (data.items && data.items.length > 0 && !isCtrlKeyDown.value) {
7885
+ if (data.items && data.items.length > 0 && !isMultiSelect.value) {
7379
7886
  updateStatus(nodeStatusMap.value, data.id, {
7380
7887
  expand: true
7381
7888
  });
@@ -7645,21 +8152,21 @@ const keybindingConfig = [
7645
8152
  }
7646
8153
  ];
7647
8154
 
7648
- const useKeybinding = (services, contianer) => {
8155
+ const useKeybinding = (services, container) => {
7649
8156
  const keybindingService = services?.keybindingService;
7650
8157
  const isCtrlKeyDown = ref(false);
7651
8158
  const windowBlurHandler = () => {
7652
8159
  isCtrlKeyDown.value = false;
7653
8160
  };
7654
- keybindingService?.registeCommand("layer-panel-global-keyup", () => {
8161
+ keybindingService?.registerCommand("layer-panel-global-keyup", () => {
7655
8162
  isCtrlKeyDown.value = false;
7656
8163
  });
7657
- keybindingService?.registeCommand("layer-panel-global-keydwon", () => {
8164
+ keybindingService?.registerCommand("layer-panel-global-keydown", () => {
7658
8165
  isCtrlKeyDown.value = true;
7659
8166
  });
7660
- keybindingService?.registe([
8167
+ keybindingService?.register([
7661
8168
  {
7662
- command: "layer-panel-global-keydwon",
8169
+ command: "layer-panel-global-keydown",
7663
8170
  keybinding: "ctrl",
7664
8171
  when: [["global", "keydown"]]
7665
8172
  },
@@ -7670,12 +8177,12 @@ const useKeybinding = (services, contianer) => {
7670
8177
  }
7671
8178
  ]);
7672
8179
  watchEffect(() => {
7673
- if (contianer.value) {
8180
+ if (container.value) {
7674
8181
  globalThis.addEventListener("blur", windowBlurHandler);
7675
- keybindingService?.registeEl(KeyBindingContainerKey.LAYER_PANEL, contianer.value.$el);
8182
+ keybindingService?.registerEl(KeyBindingContainerKey.LAYER_PANEL, container.value.$el);
7676
8183
  } else {
7677
8184
  globalThis.removeEventListener("blur", windowBlurHandler);
7678
- keybindingService?.unregisteEl(KeyBindingContainerKey.LAYER_PANEL);
8185
+ keybindingService?.unregisterEl(KeyBindingContainerKey.LAYER_PANEL);
7679
8186
  }
7680
8187
  });
7681
8188
  return {
@@ -7683,7 +8190,7 @@ const useKeybinding = (services, contianer) => {
7683
8190
  };
7684
8191
  };
7685
8192
 
7686
- const createPageNodeStatus = (page, initalLayerNodeStatus) => {
8193
+ const createPageNodeStatus = (page, initialLayerNodeStatus) => {
7687
8194
  const map = /* @__PURE__ */ new Map();
7688
8195
  map.set(page.id, {
7689
8196
  visible: true,
@@ -7695,7 +8202,7 @@ const createPageNodeStatus = (page, initalLayerNodeStatus) => {
7695
8202
  (node) => traverseNode(node, (node2) => {
7696
8203
  map.set(
7697
8204
  node2.id,
7698
- initalLayerNodeStatus?.get(node2.id) || {
8205
+ initialLayerNodeStatus?.get(node2.id) || {
7699
8206
  visible: true,
7700
8207
  expand: false,
7701
8208
  selected: false,
@@ -7770,13 +8277,14 @@ const useNodeStatus = (services) => {
7770
8277
  };
7771
8278
  };
7772
8279
 
7773
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
8280
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
7774
8281
  ...{
7775
8282
  name: "MEditorLayerPanel"
7776
8283
  },
7777
8284
  __name: "LayerPanel",
7778
8285
  props: {
7779
- layerContentMenu: {}
8286
+ layerContentMenu: {},
8287
+ customContentMenu: { type: Function }
7780
8288
  },
7781
8289
  setup(__props) {
7782
8290
  const services = inject("services");
@@ -7818,8 +8326,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7818
8326
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
7819
8327
  default: withCtx(() => [
7820
8328
  renderSlot(_ctx.$slots, "layer-panel-header"),
7821
- createVNode(_sfc_main$q, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
7822
- page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$o, {
8329
+ createVNode(_sfc_main$o, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
8330
+ page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$m, {
7823
8331
  key: 0,
7824
8332
  tabindex: "-1",
7825
8333
  ref_key: "tree",
@@ -7839,7 +8347,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7839
8347
  ]),
7840
8348
  "tree-node-tool": withCtx(({ data: nodeData2 }) => [
7841
8349
  renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData2 }, () => [
7842
- createVNode(_sfc_main$f, { data: nodeData2 }, null, 8, ["data"])
8350
+ createVNode(_sfc_main$d, { data: nodeData2 }, null, 8, ["data"])
7843
8351
  ])
7844
8352
  ]),
7845
8353
  "tree-node-label": withCtx(({ data: nodeData2 }) => [
@@ -7848,12 +8356,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7848
8356
  _: 3
7849
8357
  }, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
7850
8358
  (openBlock(), createBlock(Teleport, { to: "body" }, [
7851
- createVNode(_sfc_main$g, {
8359
+ createVNode(_sfc_main$e, {
7852
8360
  ref_key: "menu",
7853
8361
  ref: menu,
7854
8362
  "layer-content-menu": _ctx.layerContentMenu,
8363
+ "custom-content-menu": _ctx.customContentMenu,
7855
8364
  onCollapseAll: collapseAllHandler
7856
- }, null, 8, ["layer-content-menu"])
8365
+ }, null, 8, ["layer-content-menu", "custom-content-menu"])
7857
8366
  ]))
7858
8367
  ]),
7859
8368
  _: 3
@@ -7862,9 +8371,9 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7862
8371
  }
7863
8372
  });
7864
8373
 
7865
- const _hoisted_1$7 = ["onClick", "onDragstart"];
7866
- const _hoisted_2$4 = ["title"];
7867
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
8374
+ const _hoisted_1$5 = ["onClick", "onDragstart"];
8375
+ const _hoisted_2$3 = ["title"];
8376
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
7868
8377
  ...{
7869
8378
  name: "MEditorComponentListPanel"
7870
8379
  },
@@ -7944,7 +8453,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7944
8453
  "model-value": collapseValue.value
7945
8454
  }, {
7946
8455
  default: withCtx(() => [
7947
- createVNode(_sfc_main$q, { onSearch: filterTextChangeHandler }),
8456
+ createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
7948
8457
  (openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
7949
8458
  return openBlock(), createElementBlock(Fragment, null, [
7950
8459
  group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
@@ -7952,7 +8461,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7952
8461
  name: `${index}`
7953
8462
  }, {
7954
8463
  title: withCtx(() => [
7955
- createVNode(_sfc_main$K, { icon: unref(Grid) }, null, 8, ["icon"]),
8464
+ createVNode(_sfc_main$N, { icon: unref(Grid) }, null, 8, ["icon"]),
7956
8465
  createTextVNode(toDisplayString(group.title), 1)
7957
8466
  ]),
7958
8467
  default: withCtx(() => [
@@ -7973,7 +8482,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7973
8482
  content: item.desc
7974
8483
  }, {
7975
8484
  default: withCtx(() => [
7976
- createVNode(_sfc_main$K, {
8485
+ createVNode(_sfc_main$N, {
7977
8486
  icon: item.icon
7978
8487
  }, null, 8, ["icon"])
7979
8488
  ]),
@@ -7981,9 +8490,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
7981
8490
  }, 1032, ["disabled", "content"]),
7982
8491
  createElementVNode("span", {
7983
8492
  title: item.text
7984
- }, toDisplayString(item.text), 9, _hoisted_2$4)
8493
+ }, toDisplayString(item.text), 9, _hoisted_2$3)
7985
8494
  ])
7986
- ], 40, _hoisted_1$7);
8495
+ ], 40, _hoisted_1$5);
7987
8496
  }), 128))
7988
8497
  ]),
7989
8498
  _: 2
@@ -8000,11 +8509,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
8000
8509
  }
8001
8510
  });
8002
8511
 
8003
- const _hoisted_1$6 = {
8512
+ const _hoisted_1$4 = {
8004
8513
  key: 0,
8005
8514
  class: "m-editor-sidebar"
8006
8515
  };
8007
- const _hoisted_2$3 = { class: "m-editor-sidebar-header" };
8516
+ const _hoisted_2$2 = { class: "m-editor-sidebar-header" };
8008
8517
  const _hoisted_3$1 = ["onClick", "onDragend"];
8009
8518
  const _hoisted_4$1 = {
8010
8519
  key: 1,
@@ -8013,14 +8522,15 @@ const _hoisted_4$1 = {
8013
8522
  const _hoisted_5$1 = { class: "m-editor-float-box-list" };
8014
8523
  const _hoisted_6 = ["onClick"];
8015
8524
  const _hoisted_7 = { class: "m-editor-float-box-body" };
8016
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
8525
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8017
8526
  ...{
8018
8527
  name: "MEditorSidebar"
8019
8528
  },
8020
8529
  __name: "Sidebar",
8021
8530
  props: {
8022
8531
  data: { default: () => ({ type: "tabs", status: "组件", items: ["component-list", "layer", "code-block", "data-source"] }) },
8023
- layerContentMenu: {}
8532
+ layerContentMenu: {},
8533
+ customContentMenu: {}
8024
8534
  },
8025
8535
  setup(__props, { expose: __expose }) {
8026
8536
  const props = __props;
@@ -8033,7 +8543,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8033
8543
  type: "component",
8034
8544
  icon: Goods,
8035
8545
  text: "组件",
8036
- component: _sfc_main$d,
8546
+ component: _sfc_main$b,
8037
8547
  slots: {}
8038
8548
  },
8039
8549
  layer: {
@@ -8042,9 +8552,10 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8042
8552
  icon: List,
8043
8553
  text: "已选组件",
8044
8554
  props: {
8045
- layerContentMenu: props.layerContentMenu
8555
+ layerContentMenu: props.layerContentMenu,
8556
+ customContentMenu: props.customContentMenu
8046
8557
  },
8047
- component: _sfc_main$e,
8558
+ component: _sfc_main$c,
8048
8559
  slots: {}
8049
8560
  },
8050
8561
  "code-block": {
@@ -8052,7 +8563,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8052
8563
  type: "component",
8053
8564
  icon: EditPen,
8054
8565
  text: "代码编辑",
8055
- component: _sfc_main$m,
8566
+ component: _sfc_main$k,
8056
8567
  slots: {},
8057
8568
  boxComponentConfig: {
8058
8569
  props: {
@@ -8065,7 +8576,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8065
8576
  type: "component",
8066
8577
  icon: Coin,
8067
8578
  text: "数据源",
8068
- component: _sfc_main$j,
8579
+ component: _sfc_main$h,
8069
8580
  slots: {},
8070
8581
  boxComponentConfig: {
8071
8582
  props: {
@@ -8108,8 +8619,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8108
8619
  });
8109
8620
  return (_ctx, _cache) => {
8110
8621
  return openBlock(), createElementBlock(Fragment, null, [
8111
- _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
8112
- createElementVNode("div", _hoisted_2$3, [
8622
+ _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
8623
+ createElementVNode("div", _hoisted_2$2, [
8113
8624
  (openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
8114
8625
  return withDirectives((openBlock(), createElementBlock("div", {
8115
8626
  class: normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
@@ -8120,7 +8631,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8120
8631
  (...args) => unref(dragstartHandler) && unref(dragstartHandler)(...args)),
8121
8632
  onDragend: ($event) => unref(dragendHandler)(config.$key, $event)
8122
8633
  }, [
8123
- config.icon ? (openBlock(), createBlock(_sfc_main$K, {
8634
+ config.icon ? (openBlock(), createBlock(_sfc_main$N, {
8124
8635
  key: 0,
8125
8636
  icon: config.icon
8126
8637
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -8256,7 +8767,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
8256
8767
  onClick: ($event) => unref(showFloatBox)(config.$key)
8257
8768
  }, [
8258
8769
  createElementVNode("div", null, toDisplayString(config.text), 1),
8259
- createVNode(_sfc_main$K, {
8770
+ createVNode(_sfc_main$N, {
8260
8771
  class: "m-editor-float-box-close",
8261
8772
  icon: unref(Close),
8262
8773
  onClick: withModifiers(($event) => unref(closeFloatBox)(config.$key), ["stop"])
@@ -8404,7 +8915,7 @@ class ScrollViewer extends EventEmitter {
8404
8915
  };
8405
8916
  }
8406
8917
 
8407
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
8918
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8408
8919
  ...{
8409
8920
  name: "MEditorScrollBar"
8410
8921
  },
@@ -8443,7 +8954,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8443
8954
  });
8444
8955
  bar.value?.addEventListener("wheel", wheelHandler, false);
8445
8956
  });
8446
- onUnmounted(() => {
8957
+ onBeforeUnmount(() => {
8447
8958
  if (gesto)
8448
8959
  gesto.off();
8449
8960
  bar.value?.removeEventListener("wheel", wheelHandler, false);
@@ -8492,7 +9003,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
8492
9003
  }
8493
9004
  });
8494
9005
 
8495
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
9006
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8496
9007
  ...{
8497
9008
  name: "MEditorScrollViewer"
8498
9009
  },
@@ -8539,7 +9050,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8539
9050
  scrollHeight.value = data.scrollHeight;
8540
9051
  });
8541
9052
  });
8542
- onUnmounted(() => {
9053
+ onBeforeUnmount(() => {
8543
9054
  scrollViewer.destroy();
8544
9055
  });
8545
9056
  watch(
@@ -8578,14 +9089,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8578
9089
  }, [
8579
9090
  renderSlot(_ctx.$slots, "default")
8580
9091
  ], 4),
8581
- scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$b, {
9092
+ scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$9, {
8582
9093
  key: 0,
8583
9094
  "scroll-size": scrollHeight.value,
8584
9095
  size: _ctx.wrapHeight,
8585
9096
  pos: vOffset.value,
8586
9097
  onScroll: vScrollHandler
8587
9098
  }, null, 8, ["scroll-size", "size", "pos"])) : createCommentVNode("", true),
8588
- scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$b, {
9099
+ scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$9, {
8589
9100
  key: 1,
8590
9101
  "is-horizontal": true,
8591
9102
  "scroll-size": scrollWidth.value,
@@ -8728,12 +9239,27 @@ const useStage = (stageOptions) => {
8728
9239
  return elCanSelect;
8729
9240
  },
8730
9241
  moveableOptions: stageOptions.moveableOptions,
8731
- updateDragEl: stageOptions.updateDragEl
9242
+ updateDragEl: stageOptions.updateDragEl,
9243
+ guidesOptions: stageOptions.guidesOptions,
9244
+ disabledMultiSelect: stageOptions.disabledMultiSelect
8732
9245
  });
9246
+ watch(
9247
+ () => editorService.get("disabledMultiSelect"),
9248
+ (disabledMultiSelect) => {
9249
+ if (disabledMultiSelect) {
9250
+ stage.disableMultiSelect();
9251
+ } else {
9252
+ stage.enableMultiSelect();
9253
+ }
9254
+ }
9255
+ );
8733
9256
  stage.mask.setGuides([
8734
9257
  getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)),
8735
9258
  getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
8736
9259
  ]);
9260
+ stage.on("page-el-update", () => {
9261
+ editorService.set("stageLoading", false);
9262
+ });
8737
9263
  stage.on("select", (el) => {
8738
9264
  if (`${editorService.get("node")?.id}` === el.id && editorService.get("nodes").length === 1)
8739
9265
  return;
@@ -8784,8 +9310,8 @@ const useStage = (stageOptions) => {
8784
9310
  return stage;
8785
9311
  };
8786
9312
 
8787
- const _hoisted_1$5 = { class: "m-editor-float-box-body" };
8788
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
9313
+ const _hoisted_1$3 = { class: "m-editor-float-box-body" };
9314
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
8789
9315
  __name: "FloatingBox",
8790
9316
  props: {
8791
9317
  visible: { type: Boolean, default: false },
@@ -8885,7 +9411,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8885
9411
  }, null, 8, ["icon"])
8886
9412
  ])
8887
9413
  ], 512),
8888
- createElementVNode("div", _hoisted_1$5, [
9414
+ createElementVNode("div", _hoisted_1$3, [
8889
9415
  renderSlot(_ctx.$slots, "body")
8890
9416
  ])
8891
9417
  ], 4)
@@ -8894,7 +9420,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8894
9420
  }
8895
9421
  });
8896
9422
 
8897
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9423
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8898
9424
  __name: "NodeListMenu",
8899
9425
  setup(__props) {
8900
9426
  const services = inject("services");
@@ -8915,13 +9441,13 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8915
9441
  (stage2) => {
8916
9442
  if (!stage2)
8917
9443
  return;
9444
+ nextTick(() => unWatch());
8918
9445
  stage2.on("select", (el, event) => {
8919
9446
  const els = stage2.renderer.getElementsFromPoint(event) || [];
8920
9447
  const ids = els.map((el2) => el2.id).filter((id) => Boolean(id));
8921
9448
  buttonVisible.value = ids.length > 3;
8922
9449
  filterTextChangeHandler(ids);
8923
9450
  });
8924
- unWatch();
8925
9451
  },
8926
9452
  {
8927
9453
  immediate: true
@@ -8976,7 +9502,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8976
9502
  ]),
8977
9503
  _: 1
8978
9504
  })) : createCommentVNode("", true),
8979
- page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$9, {
9505
+ page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$7, {
8980
9506
  key: 1,
8981
9507
  ref_key: "box",
8982
9508
  ref: box,
@@ -8986,7 +9512,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8986
9512
  position: menuPosition.value
8987
9513
  }, {
8988
9514
  body: withCtx(() => [
8989
- createVNode(_sfc_main$o, {
9515
+ createVNode(_sfc_main$m, {
8990
9516
  class: "m-editor-node-list-menu magic-editor-layer-tree",
8991
9517
  data: nodeData.value,
8992
9518
  "node-status-map": unref(nodeStatusMap),
@@ -9000,12 +9526,12 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
9000
9526
  }
9001
9527
  });
9002
9528
 
9003
- const _hoisted_1$4 = {
9529
+ const _hoisted_1$2 = {
9004
9530
  viewBox: "0 0 24 24",
9005
9531
  fill: "none",
9006
9532
  xmlns: "http://www.w3.org/2000/svg"
9007
9533
  };
9008
- const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("path", {
9534
+ const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("path", {
9009
9535
  "fill-rule": "evenodd",
9010
9536
  "clip-rule": "evenodd",
9011
9537
  d: "M2 4H21V6H2V4Z",
@@ -9027,119 +9553,125 @@ const _hoisted_4 = /* @__PURE__ */ createElementVNode("path", {
9027
9553
  "fill-opacity": "0.9"
9028
9554
  }, null, -1);
9029
9555
  const _hoisted_5 = [
9030
- _hoisted_2$2,
9556
+ _hoisted_2$1,
9031
9557
  _hoisted_3,
9032
9558
  _hoisted_4
9033
9559
  ];
9034
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
9560
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9035
9561
  ...{
9036
9562
  name: "MEditorCenterIcon"
9037
9563
  },
9038
9564
  __name: "CenterIcon",
9039
9565
  setup(__props) {
9040
9566
  return (_ctx, _cache) => {
9041
- return openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_5);
9567
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_5);
9042
9568
  };
9043
9569
  }
9044
9570
  });
9045
9571
 
9046
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
9572
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9047
9573
  ...{
9048
9574
  name: "MEditorViewerMenu"
9049
9575
  },
9050
9576
  __name: "ViewerMenu",
9051
9577
  props: {
9052
9578
  isMultiSelect: { type: Boolean, default: false },
9053
- stageContentMenu: {}
9579
+ stageContentMenu: { default: () => [] },
9580
+ customContentMenu: { type: Function, default: (menus) => menus }
9054
9581
  },
9055
9582
  setup(__props, { expose: __expose }) {
9056
- const props = __props;
9057
- const services = inject("services");
9058
- const editorService = services?.editorService;
9059
- const menu = ref();
9060
- const canCenter = ref(false);
9061
- const node = computed(() => editorService?.get("node"));
9062
- const nodes = computed(() => editorService?.get("nodes"));
9063
- const parent = computed(() => editorService?.get("parent"));
9064
- const menuData = computed(() => [
9065
- {
9066
- type: "button",
9067
- text: "水平居中",
9068
- icon: markRaw(_sfc_main$7),
9069
- display: () => canCenter.value,
9070
- handler: () => {
9071
- if (!nodes.value)
9072
- return;
9073
- editorService?.alignCenter(nodes.value);
9074
- }
9075
- },
9076
- useCopyMenu(),
9077
- usePasteMenu(menu),
9078
- {
9079
- type: "divider",
9080
- direction: "horizontal",
9081
- display: () => {
9082
- if (!node.value)
9083
- return false;
9084
- return !isPage(node.value);
9085
- }
9086
- },
9087
- {
9088
- type: "button",
9089
- text: "上移一层",
9090
- icon: markRaw(Top),
9091
- display: () => !isPage(node.value) && !props.isMultiSelect,
9092
- handler: () => {
9093
- editorService?.moveLayer(1);
9094
- }
9095
- },
9096
- {
9097
- type: "button",
9098
- text: "下移一层",
9099
- icon: markRaw(Bottom),
9100
- display: () => !isPage(node.value) && !props.isMultiSelect,
9101
- handler: () => {
9102
- editorService?.moveLayer(-1);
9103
- }
9104
- },
9105
- {
9106
- type: "button",
9107
- text: "置顶",
9108
- icon: markRaw(Top),
9109
- display: () => !isPage(node.value) && !props.isMultiSelect,
9110
- handler: () => {
9111
- editorService?.moveLayer(LayerOffset.TOP);
9112
- }
9113
- },
9114
- {
9115
- type: "button",
9116
- text: "置底",
9117
- icon: markRaw(Bottom),
9118
- display: () => !isPage(node.value) && !props.isMultiSelect,
9119
- handler: () => {
9120
- editorService?.moveLayer(LayerOffset.BOTTOM);
9121
- }
9122
- },
9123
- useMoveToMenu(services),
9124
- {
9125
- type: "divider",
9126
- direction: "horizontal",
9127
- display: () => !isPage(node.value) && !props.isMultiSelect
9128
- },
9129
- useDeleteMenu(),
9130
- {
9131
- type: "divider",
9132
- direction: "horizontal"
9133
- },
9134
- {
9135
- type: "button",
9136
- text: "清空参考线",
9137
- handler: () => {
9138
- editorService?.get("stage")?.clearGuides();
9139
- }
9140
- },
9141
- ...props.stageContentMenu
9142
- ]);
9583
+ const props = __props;
9584
+ const services = inject("services");
9585
+ const editorService = services?.editorService;
9586
+ const menu = ref();
9587
+ const canCenter = ref(false);
9588
+ const node = computed(() => editorService?.get("node"));
9589
+ const nodes = computed(() => editorService?.get("nodes"));
9590
+ const parent = computed(() => editorService?.get("parent"));
9591
+ const menuData = computed(
9592
+ () => props.customContentMenu(
9593
+ [
9594
+ {
9595
+ type: "button",
9596
+ text: "水平居中",
9597
+ icon: markRaw(_sfc_main$5),
9598
+ display: () => canCenter.value,
9599
+ handler: () => {
9600
+ if (!nodes.value)
9601
+ return;
9602
+ editorService?.alignCenter(nodes.value);
9603
+ }
9604
+ },
9605
+ useCopyMenu(),
9606
+ usePasteMenu(menu),
9607
+ {
9608
+ type: "divider",
9609
+ direction: "horizontal",
9610
+ display: () => {
9611
+ if (!node.value)
9612
+ return false;
9613
+ return !isPage(node.value) && !isPageFragment(node.value);
9614
+ }
9615
+ },
9616
+ {
9617
+ type: "button",
9618
+ text: "上移一层",
9619
+ icon: markRaw(Top),
9620
+ display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
9621
+ handler: () => {
9622
+ editorService?.moveLayer(1);
9623
+ }
9624
+ },
9625
+ {
9626
+ type: "button",
9627
+ text: "下移一层",
9628
+ icon: markRaw(Bottom),
9629
+ display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
9630
+ handler: () => {
9631
+ editorService?.moveLayer(-1);
9632
+ }
9633
+ },
9634
+ {
9635
+ type: "button",
9636
+ text: "置顶",
9637
+ icon: markRaw(Top),
9638
+ display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
9639
+ handler: () => {
9640
+ editorService?.moveLayer(LayerOffset.TOP);
9641
+ }
9642
+ },
9643
+ {
9644
+ type: "button",
9645
+ text: "置底",
9646
+ icon: markRaw(Bottom),
9647
+ display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
9648
+ handler: () => {
9649
+ editorService?.moveLayer(LayerOffset.BOTTOM);
9650
+ }
9651
+ },
9652
+ useMoveToMenu(services),
9653
+ {
9654
+ type: "divider",
9655
+ direction: "horizontal",
9656
+ display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect
9657
+ },
9658
+ useDeleteMenu(),
9659
+ {
9660
+ type: "divider",
9661
+ direction: "horizontal"
9662
+ },
9663
+ {
9664
+ type: "button",
9665
+ text: "清空参考线",
9666
+ handler: () => {
9667
+ editorService?.get("stage")?.clearGuides();
9668
+ }
9669
+ },
9670
+ ...props.stageContentMenu
9671
+ ],
9672
+ "viewer"
9673
+ )
9674
+ );
9143
9675
  watch(
9144
9676
  parent,
9145
9677
  async () => {
@@ -9159,7 +9691,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
9159
9691
  };
9160
9692
  __expose({ show });
9161
9693
  return (_ctx, _cache) => {
9162
- return openBlock(), createBlock(_sfc_main$i, {
9694
+ return openBlock(), createBlock(_sfc_main$g, {
9163
9695
  "menu-data": menuData.value,
9164
9696
  ref_key: "menu",
9165
9697
  ref: menu
@@ -9168,13 +9700,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
9168
9700
  }
9169
9701
  });
9170
9702
 
9171
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9703
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9172
9704
  ...{
9173
9705
  name: "MEditorStage"
9174
9706
  },
9175
9707
  __name: "Stage",
9176
9708
  props: {
9177
- stageContentMenu: {}
9709
+ stageContentMenu: {},
9710
+ customContentMenu: { type: Function }
9178
9711
  },
9179
9712
  setup(__props) {
9180
9713
  let stage = null;
@@ -9223,6 +9756,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9223
9756
  });
9224
9757
  watch(page, (page2) => {
9225
9758
  if (runtime && page2) {
9759
+ services?.editorService.set("stageLoading", true);
9226
9760
  runtime.updatePageId?.(page2.id);
9227
9761
  nextTick(() => {
9228
9762
  stage?.select(page2.id);
@@ -9246,14 +9780,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9246
9780
  onMounted(() => {
9247
9781
  if (stageWrap.value?.container) {
9248
9782
  resizeObserver.observe(stageWrap.value.container);
9249
- services?.keybindingService.registeEl(KeyBindingContainerKey.STAGE, stageWrap.value.container);
9783
+ services?.keybindingService.registerEl(KeyBindingContainerKey.STAGE, stageWrap.value.container);
9250
9784
  }
9251
9785
  });
9252
- onUnmounted(() => {
9786
+ onBeforeUnmount(() => {
9253
9787
  stage?.destroy();
9254
9788
  resizeObserver.disconnect();
9255
9789
  services?.editorService.set("stage", null);
9256
- services?.keybindingService.unregisteEl("stage");
9790
+ services?.keybindingService.unregisterEl("stage");
9257
9791
  services?.editorService.off("root-change", rootChangeHandler);
9258
9792
  });
9259
9793
  const parseDSL = getConfig("parseDSL");
@@ -9316,7 +9850,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9316
9850
  }
9317
9851
  };
9318
9852
  return (_ctx, _cache) => {
9319
- return openBlock(), createBlock(_sfc_main$a, {
9853
+ return openBlock(), createBlock(_sfc_main$8, {
9320
9854
  class: "m-editor-stage",
9321
9855
  ref_key: "stageWrap",
9322
9856
  ref: stageWrap,
@@ -9342,14 +9876,15 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9342
9876
  onDrop: dropHandler,
9343
9877
  onDragover: dragoverHandler
9344
9878
  }, null, 36),
9345
- createVNode(_sfc_main$8),
9879
+ createVNode(_sfc_main$6),
9346
9880
  (openBlock(), createBlock(Teleport, { to: "body" }, [
9347
- createVNode(_sfc_main$6, {
9881
+ createVNode(_sfc_main$4, {
9348
9882
  ref_key: "menu",
9349
9883
  ref: menu,
9350
9884
  "is-multi-select": isMultiSelect.value,
9351
- "stage-content-menu": _ctx.stageContentMenu
9352
- }, null, 8, ["is-multi-select", "stage-content-menu"])
9885
+ "stage-content-menu": _ctx.stageContentMenu,
9886
+ "custom-content-menu": _ctx.customContentMenu
9887
+ }, null, 8, ["is-multi-select", "stage-content-menu", "custom-content-menu"])
9353
9888
  ]))
9354
9889
  ]),
9355
9890
  _: 1
@@ -9358,12 +9893,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
9358
9893
  }
9359
9894
  });
9360
9895
 
9361
- const _hoisted_1$3 = {
9896
+ const _hoisted_1$1 = {
9362
9897
  key: 0,
9363
9898
  class: "m-editor-breadcrumb"
9364
9899
  };
9365
- const _hoisted_2$1 = { key: 0 };
9366
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9900
+ const _hoisted_2 = { key: 0 };
9901
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9367
9902
  ...{
9368
9903
  name: "MEditorBreadcrumb"
9369
9904
  },
@@ -9380,7 +9915,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9380
9915
  editorService?.get("stage")?.select(node2.id);
9381
9916
  };
9382
9917
  return (_ctx, _cache) => {
9383
- return nodes.value.length === 1 ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
9918
+ return nodes.value.length === 1 ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
9384
9919
  (openBlock(true), createElementBlock(Fragment, null, renderList(path.value, (item, index) => {
9385
9920
  return openBlock(), createElementBlock(Fragment, {
9386
9921
  key: item.id
@@ -9395,7 +9930,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9395
9930
  ]),
9396
9931
  _: 2
9397
9932
  }, 1032, ["disabled", "onClick"]),
9398
- index < path.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_2$1, "/")) : createCommentVNode("", true)
9933
+ index < path.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_2, "/")) : createCommentVNode("", true)
9399
9934
  ], 64);
9400
9935
  }), 128))
9401
9936
  ])) : createCommentVNode("", true);
@@ -9403,223 +9938,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9403
9938
  }
9404
9939
  });
9405
9940
 
9406
- const _hoisted_1$2 = {
9407
- key: 1,
9408
- style: { "width": "21px" }
9409
- };
9410
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
9411
- ...{
9412
- name: "MEditorPageBarScrollContainer"
9413
- },
9414
- __name: "PageBarScrollContainer",
9415
- setup(__props) {
9416
- const services = inject("services");
9417
- const editorService = services?.editorService;
9418
- const uiService = services?.uiService;
9419
- const itemsContainer = ref();
9420
- const canScroll = ref(false);
9421
- const showAddPageButton = computed(() => uiService?.get("showAddPageButton"));
9422
- const itemsContainerWidth = ref(0);
9423
- const setCanScroll = () => {
9424
- itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - (showAddPageButton.value ? 37 : 21);
9425
- nextTick(() => {
9426
- if (itemsContainer.value) {
9427
- canScroll.value = itemsContainer.value.scrollWidth - itemsContainerWidth.value > 1;
9428
- }
9429
- });
9430
- };
9431
- const resizeObserver = new ResizeObserver(() => {
9432
- setCanScroll();
9433
- });
9434
- const pageBar = ref();
9435
- onMounted(() => {
9436
- pageBar.value && resizeObserver.observe(pageBar.value);
9437
- });
9438
- onUnmounted(() => {
9439
- resizeObserver.disconnect();
9440
- });
9441
- let translateLeft = 0;
9442
- const scroll = (type) => {
9443
- if (!itemsContainer.value)
9444
- return;
9445
- const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
9446
- if (type === "left") {
9447
- translateLeft += 100;
9448
- if (translateLeft > 0) {
9449
- translateLeft = 0;
9450
- }
9451
- } else if (type === "right") {
9452
- translateLeft -= 100;
9453
- if (-translateLeft > maxScrollLeft) {
9454
- translateLeft = -maxScrollLeft;
9455
- }
9456
- } else if (type === "start") {
9457
- translateLeft = 0;
9458
- } else if (type === "end") {
9459
- translateLeft = -maxScrollLeft;
9460
- }
9461
- itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
9462
- };
9463
- const pageLength = computed(() => editorService?.get("pageLength"));
9464
- watch(pageLength, (length = 0, preLength = 0) => {
9465
- setTimeout(() => {
9466
- setCanScroll();
9467
- if (length < preLength) {
9468
- scroll("start");
9469
- } else {
9470
- scroll("end");
9471
- }
9472
- });
9473
- });
9474
- const addPage = () => {
9475
- if (!editorService)
9476
- return;
9477
- const root = toRaw(editorService.get("root"));
9478
- if (!root)
9479
- throw new Error("root 不能为空");
9480
- const pageConfig = {
9481
- type: NodeType.PAGE,
9482
- name: generatePageNameByApp(root)
9483
- };
9484
- editorService.add(pageConfig);
9485
- };
9486
- return (_ctx, _cache) => {
9487
- return openBlock(), createElementBlock("div", {
9488
- class: "m-editor-page-bar",
9489
- ref_key: "pageBar",
9490
- ref: pageBar
9491
- }, [
9492
- showAddPageButton.value ? (openBlock(), createElementBlock("div", {
9493
- key: 0,
9494
- id: "m-editor-page-bar-add-icon",
9495
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
9496
- onClick: addPage
9497
- }, [
9498
- createVNode(_sfc_main$K, { icon: unref(Plus) }, null, 8, ["icon"])
9499
- ])) : (openBlock(), createElementBlock("div", _hoisted_1$2)),
9500
- canScroll.value ? (openBlock(), createElementBlock("div", {
9501
- key: 2,
9502
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
9503
- onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
9504
- }, [
9505
- createVNode(_sfc_main$K, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
9506
- ])) : createCommentVNode("", true),
9507
- pageLength.value ? (openBlock(), createElementBlock("div", {
9508
- key: 3,
9509
- class: "m-editor-page-bar-items",
9510
- ref_key: "itemsContainer",
9511
- ref: itemsContainer,
9512
- style: normalizeStyle(`width: ${itemsContainerWidth.value}px`)
9513
- }, [
9514
- renderSlot(_ctx.$slots, "default")
9515
- ], 4)) : createCommentVNode("", true),
9516
- canScroll.value ? (openBlock(), createElementBlock("div", {
9517
- key: 4,
9518
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
9519
- onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
9520
- }, [
9521
- createVNode(_sfc_main$K, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
9522
- ])) : createCommentVNode("", true)
9523
- ], 512);
9524
- };
9525
- }
9526
- });
9527
-
9528
- const _hoisted_1$1 = ["onClick"];
9529
- const _hoisted_2 = { class: "m-editor-page-bar-title" };
9530
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9531
- ...{
9532
- name: "MEditorPageBar"
9533
- },
9534
- __name: "PageBar",
9535
- setup(__props) {
9536
- const services = inject("services");
9537
- const editorService = services?.editorService;
9538
- const root = computed(() => editorService?.get("root"));
9539
- const page = computed(() => editorService?.get("page"));
9540
- const switchPage = (page2) => {
9541
- editorService?.select(page2);
9542
- };
9543
- const copy = (node) => {
9544
- node && editorService?.copy(node);
9545
- editorService?.paste({
9546
- left: 0,
9547
- top: 0
9548
- });
9549
- };
9550
- const remove = (node) => {
9551
- editorService?.remove(node);
9552
- };
9553
- return (_ctx, _cache) => {
9554
- return openBlock(), createBlock(_sfc_main$3, null, {
9555
- default: withCtx(() => [
9556
- (openBlock(true), createElementBlock(Fragment, null, renderList(root.value && root.value.items || [], (item) => {
9557
- return openBlock(), createElementBlock("div", {
9558
- class: normalizeClass(["m-editor-page-bar-item", { active: page.value?.id === item.id }]),
9559
- key: item.key,
9560
- onClick: ($event) => switchPage(item)
9561
- }, [
9562
- createElementVNode("div", _hoisted_2, [
9563
- renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
9564
- createVNode(unref(TMagicTooltip), {
9565
- effect: "dark",
9566
- placement: "top-start",
9567
- content: item.name
9568
- }, {
9569
- default: withCtx(() => [
9570
- createElementVNode("span", null, toDisplayString(item.name || item.id), 1)
9571
- ]),
9572
- _: 2
9573
- }, 1032, ["content"])
9574
- ])
9575
- ]),
9576
- createVNode(unref(TMagicPopover), {
9577
- "popper-class": "page-bar-popover",
9578
- placement: "top",
9579
- width: 160,
9580
- trigger: "hover"
9581
- }, {
9582
- reference: withCtx(() => [
9583
- createVNode(unref(TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
9584
- default: withCtx(() => [
9585
- createVNode(unref(CaretBottom))
9586
- ]),
9587
- _: 1
9588
- })
9589
- ]),
9590
- default: withCtx(() => [
9591
- createElementVNode("div", null, [
9592
- renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
9593
- createVNode(_sfc_main$t, {
9594
- data: {
9595
- type: "button",
9596
- text: "复制",
9597
- icon: unref(DocumentCopy),
9598
- handler: () => copy(item)
9599
- }
9600
- }, null, 8, ["data"]),
9601
- createVNode(_sfc_main$t, {
9602
- data: {
9603
- type: "button",
9604
- text: "删除",
9605
- icon: unref(Delete),
9606
- handler: () => remove(item)
9607
- }
9608
- }, null, 8, ["data"])
9609
- ])
9610
- ])
9611
- ]),
9612
- _: 2
9613
- }, 1024)
9614
- ], 10, _hoisted_1$1);
9615
- }), 128))
9616
- ]),
9617
- _: 3
9618
- });
9619
- };
9620
- }
9621
- });
9622
-
9623
9941
  const _hoisted_1 = { class: "m-editor-workspace" };
9624
9942
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9625
9943
  ...{
@@ -9627,30 +9945,23 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
9627
9945
  },
9628
9946
  __name: "Workspace",
9629
9947
  props: {
9630
- stageContentMenu: {}
9948
+ stageContentMenu: {},
9949
+ customContentMenu: { type: Function }
9631
9950
  },
9632
9951
  setup(__props) {
9633
9952
  const services = inject("services");
9634
9953
  const page = computed(() => services?.editorService.get("page"));
9635
9954
  return (_ctx, _cache) => {
9636
9955
  return openBlock(), createElementBlock("div", _hoisted_1, [
9637
- createVNode(_sfc_main$4),
9956
+ createVNode(_sfc_main$2),
9638
9957
  renderSlot(_ctx.$slots, "stage", {}, () => [
9639
- page.value ? (openBlock(), createBlock(_sfc_main$5, {
9958
+ page.value ? (openBlock(), createBlock(_sfc_main$3, {
9640
9959
  key: 0,
9641
- "stage-content-menu": _ctx.stageContentMenu
9642
- }, null, 8, ["stage-content-menu"])) : createCommentVNode("", true)
9960
+ "stage-content-menu": _ctx.stageContentMenu,
9961
+ "custom-content-menu": _ctx.customContentMenu
9962
+ }, null, 8, ["stage-content-menu", "custom-content-menu"])) : createCommentVNode("", true)
9643
9963
  ]),
9644
- renderSlot(_ctx.$slots, "workspace-content"),
9645
- createVNode(_sfc_main$2, null, {
9646
- "page-bar-title": withCtx(({ page: page2 }) => [
9647
- renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
9648
- ]),
9649
- "page-bar-popover": withCtx(({ page: page2 }) => [
9650
- renderSlot(_ctx.$slots, "page-bar-popover", { page: page2 })
9651
- ]),
9652
- _: 3
9653
- })
9964
+ renderSlot(_ctx.$slots, "workspace-content")
9654
9965
  ]);
9655
9966
  };
9656
9967
  }
@@ -9934,7 +10245,7 @@ class Keybinding extends BaseService {
9934
10245
  commands = {
9935
10246
  [KeyBindingCommand.DELETE_NODE]: () => {
9936
10247
  const nodes = editorService.get("nodes");
9937
- if (!nodes || isPage(nodes[0]))
10248
+ if (!nodes || isPage(nodes[0]) || isPageFragment(nodes[0]))
9938
10249
  return;
9939
10250
  editorService.remove(nodes);
9940
10251
  },
@@ -9944,7 +10255,7 @@ class Keybinding extends BaseService {
9944
10255
  },
9945
10256
  [KeyBindingCommand.CUT_NODE]: () => {
9946
10257
  const nodes = editorService.get("nodes");
9947
- if (!nodes || isPage(nodes[0]))
10258
+ if (!nodes || isPage(nodes[0]) || isPageFragment(nodes[0]))
9948
10259
  return;
9949
10260
  editorService.copy(nodes);
9950
10261
  editorService.remove(nodes);
@@ -9999,13 +10310,25 @@ class Keybinding extends BaseService {
9999
10310
  editorService.selectNextNode();
10000
10311
  }
10001
10312
  };
10002
- registeCommand(command, handler) {
10313
+ registerCommand(command, handler) {
10003
10314
  this.commands[command] = handler;
10004
10315
  }
10005
- unregisteCommand(command) {
10316
+ /**
10317
+ * @deprecated
10318
+ */
10319
+ registeCommand(command, handler) {
10320
+ this.registerCommand(command, handler);
10321
+ }
10322
+ unregisterCommand(command) {
10006
10323
  delete this.commands[command];
10007
10324
  }
10008
- registeEl(name, el) {
10325
+ /**
10326
+ * @deprecated
10327
+ */
10328
+ unregisteCommand(command) {
10329
+ this.unregisterCommand(command);
10330
+ }
10331
+ registerEl(name, el) {
10009
10332
  if (name !== "global" && !el) {
10010
10333
  throw new Error("只有name为global可以不传el");
10011
10334
  }
@@ -10013,23 +10336,41 @@ class Keybinding extends BaseService {
10013
10336
  this.controllers.set(name, keycon);
10014
10337
  this.bind(name);
10015
10338
  }
10016
- unregisteEl(name) {
10339
+ /**
10340
+ * @deprecated
10341
+ */
10342
+ registeEl(name, el) {
10343
+ this.registerEl(name, el);
10344
+ }
10345
+ unregisterEl(name) {
10017
10346
  this.controllers.get(name)?.destroy();
10018
10347
  this.controllers.delete(name);
10019
10348
  this.bindingList.forEach((item) => {
10020
- item.binded = false;
10349
+ item.bound = false;
10021
10350
  });
10022
10351
  }
10023
- registe(maps) {
10352
+ /**
10353
+ * @deprecated
10354
+ */
10355
+ unregisteEl(name) {
10356
+ this.unregisterEl(name);
10357
+ }
10358
+ register(maps) {
10024
10359
  for (const keybindingItem of maps) {
10025
10360
  const { command, keybinding, when } = keybindingItem;
10026
10361
  for (const [type = "", eventType = "keydown"] of when) {
10027
- const cacheItem = { type, command, keybinding, eventType, binded: false };
10362
+ const cacheItem = { type, command, keybinding, eventType, bound: false };
10028
10363
  this.bindingList.push(cacheItem);
10029
10364
  }
10030
10365
  }
10031
10366
  this.bind();
10032
10367
  }
10368
+ /**
10369
+ * @deprecated
10370
+ */
10371
+ registe(map) {
10372
+ this.register(map);
10373
+ }
10033
10374
  reset() {
10034
10375
  this.controllers.forEach((keycon) => {
10035
10376
  keycon.destroy();
@@ -10042,11 +10383,11 @@ class Keybinding extends BaseService {
10042
10383
  }
10043
10384
  bind(name) {
10044
10385
  for (const item of this.bindingList) {
10045
- const { type, eventType, command, keybinding, binded } = item;
10386
+ const { type, eventType, command, keybinding, bound } = item;
10046
10387
  if (name && name !== type) {
10047
10388
  continue;
10048
10389
  }
10049
- if (binded) {
10390
+ if (bound) {
10050
10391
  continue;
10051
10392
  }
10052
10393
  const keycon = this.controllers.get(type);
@@ -10064,7 +10405,7 @@ class Keybinding extends BaseService {
10064
10405
  keycon[eventType](handler);
10065
10406
  }
10066
10407
  });
10067
- item.binded = true;
10408
+ item.bound = true;
10068
10409
  }
10069
10410
  }
10070
10411
  getKeyconKeys(keybinding = "") {
@@ -10094,7 +10435,9 @@ const defaultEditorProps = {
10094
10435
  containerHighlightDuration: 800,
10095
10436
  containerHighlightType: ContainerHighlightType.DEFAULT,
10096
10437
  codeOptions: () => ({}),
10097
- renderType: RenderType.IFRAME
10438
+ renderType: RenderType.IFRAME,
10439
+ disabledMultiSelect: false,
10440
+ disabledPageFragment: false
10098
10441
  };
10099
10442
 
10100
10443
  const initServiceState = (props, {
@@ -10117,6 +10460,15 @@ const initServiceState = (props, {
10117
10460
  immediate: true
10118
10461
  }
10119
10462
  );
10463
+ watch(
10464
+ () => props.disabledMultiSelect,
10465
+ (disabledMultiSelect) => {
10466
+ editorService.set("disabledMultiSelect", disabledMultiSelect || false);
10467
+ },
10468
+ {
10469
+ immediate: true
10470
+ }
10471
+ );
10120
10472
  watch(
10121
10473
  () => props.componentGroupList,
10122
10474
  (componentGroupList) => componentGroupList && componentListService.setList(componentGroupList),
@@ -10217,7 +10569,7 @@ const initServiceState = (props, {
10217
10569
  immediate: true
10218
10570
  }
10219
10571
  );
10220
- onUnmounted(() => {
10572
+ onBeforeUnmount(() => {
10221
10573
  editorService.resetState();
10222
10574
  historyService.resetState();
10223
10575
  propsService.resetState();
@@ -10401,7 +10753,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
10401
10753
  if (props.collectorOptions && !depService.hasTarget(DepTargetType.RELATED_COMP_WHEN_COPY)) {
10402
10754
  depService.addTarget(createRelatedCompTarget(props.collectorOptions));
10403
10755
  }
10404
- onUnmounted(() => {
10756
+ onBeforeUnmount(() => {
10405
10757
  depService.off("add-target", targetAddHandler);
10406
10758
  depService.off("remove-target", targetRemoveHandler);
10407
10759
  depService.off("dep-update", depUpdateHandler);
@@ -10454,7 +10806,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10454
10806
  updateDragEl: { type: Function },
10455
10807
  disabledDragStart: { type: Boolean },
10456
10808
  extendFormState: { type: Function },
10457
- collectorOptions: {}
10809
+ collectorOptions: {},
10810
+ guidesOptions: {},
10811
+ disabledMultiSelect: { type: Boolean },
10812
+ disabledPageFragment: { type: Boolean },
10813
+ customContentMenu: { type: Function }
10458
10814
  }, defaultEditorProps),
10459
10815
  emits: ["props-panel-mounted", "update:modelValue"],
10460
10816
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -10475,8 +10831,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10475
10831
  };
10476
10832
  initServiceEvents(props, emit, services);
10477
10833
  initServiceState(props, services);
10478
- keybindingService.registe(keybindingConfig);
10479
- keybindingService.registeEl("global");
10834
+ keybindingService.register(keybindingConfig);
10835
+ keybindingService.registerEl("global");
10480
10836
  provide("services", services);
10481
10837
  provide("codeOptions", props.codeOptions);
10482
10838
  provide(
@@ -10493,18 +10849,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10493
10849
  containerHighlightDuration: props.containerHighlightDuration,
10494
10850
  containerHighlightType: props.containerHighlightType,
10495
10851
  disabledDragStart: props.disabledDragStart,
10496
- renderType: props.renderType
10852
+ renderType: props.renderType,
10853
+ guidesOptions: props.guidesOptions,
10854
+ disabledMultiSelect: props.disabledMultiSelect
10497
10855
  })
10498
10856
  );
10499
10857
  __expose(services);
10500
10858
  return (_ctx, _cache) => {
10501
- return openBlock(), createBlock(_sfc_main$u, null, {
10859
+ return openBlock(), createBlock(_sfc_main$r, { "disabled-page-fragment": _ctx.disabledPageFragment }, {
10502
10860
  header: withCtx(() => [
10503
10861
  renderSlot(_ctx.$slots, "header")
10504
10862
  ]),
10505
10863
  nav: withCtx(() => [
10506
10864
  renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
10507
- createVNode(_sfc_main$s, { data: _ctx.menu }, null, 8, ["data"])
10865
+ createVNode(_sfc_main$q, { data: _ctx.menu }, null, 8, ["data"])
10508
10866
  ])
10509
10867
  ]),
10510
10868
  "content-before": withCtx(() => [
@@ -10515,9 +10873,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10515
10873
  ]),
10516
10874
  sidebar: withCtx(() => [
10517
10875
  renderSlot(_ctx.$slots, "sidebar", { editorService: unref(editorService) }, () => [
10518
- createVNode(_sfc_main$c, {
10876
+ createVNode(_sfc_main$a, {
10519
10877
  data: _ctx.sidebar,
10520
- "layer-content-menu": _ctx.layerContentMenu
10878
+ "layer-content-menu": _ctx.layerContentMenu,
10879
+ "custom-content-menu": _ctx.customContentMenu
10521
10880
  }, {
10522
10881
  "layer-panel-header": withCtx(() => [
10523
10882
  renderSlot(_ctx.$slots, "layer-panel-header")
@@ -10550,31 +10909,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10550
10909
  renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
10551
10910
  ]),
10552
10911
  _: 3
10553
- }, 8, ["data", "layer-content-menu"])
10912
+ }, 8, ["data", "layer-content-menu", "custom-content-menu"])
10554
10913
  ])
10555
10914
  ]),
10556
10915
  workspace: withCtx(() => [
10557
10916
  renderSlot(_ctx.$slots, "workspace", { editorService: unref(editorService) }, () => [
10558
- createVNode(_sfc_main$1, { "stage-content-menu": _ctx.stageContentMenu }, {
10917
+ createVNode(_sfc_main$1, {
10918
+ "stage-content-menu": _ctx.stageContentMenu,
10919
+ "custom-content-menu": _ctx.customContentMenu
10920
+ }, {
10559
10921
  stage: withCtx(() => [
10560
10922
  renderSlot(_ctx.$slots, "stage")
10561
10923
  ]),
10562
10924
  "workspace-content": withCtx(() => [
10563
10925
  renderSlot(_ctx.$slots, "workspace-content", { editorService: unref(editorService) })
10564
10926
  ]),
10565
- "page-bar-title": withCtx(({ page }) => [
10566
- renderSlot(_ctx.$slots, "page-bar-title", { page })
10567
- ]),
10568
- "page-bar-popover": withCtx(({ page }) => [
10569
- renderSlot(_ctx.$slots, "page-bar-popover", { page })
10570
- ]),
10571
10927
  _: 3
10572
- }, 8, ["stage-content-menu"])
10928
+ }, 8, ["stage-content-menu", "custom-content-menu"])
10573
10929
  ])
10574
10930
  ]),
10575
10931
  "props-panel": withCtx(() => [
10576
10932
  renderSlot(_ctx.$slots, "props-panel", {}, () => [
10577
- createVNode(_sfc_main$r, {
10933
+ createVNode(_sfc_main$p, {
10578
10934
  "extend-state": _ctx.extendFormState,
10579
10935
  onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
10580
10936
  }, {
@@ -10594,8 +10950,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10594
10950
  footer: withCtx(() => [
10595
10951
  renderSlot(_ctx.$slots, "footer")
10596
10952
  ]),
10953
+ "page-bar-title": withCtx(({ page }) => [
10954
+ renderSlot(_ctx.$slots, "page-bar-title", { page })
10955
+ ]),
10956
+ "page-bar-popover": withCtx(({ page }) => [
10957
+ renderSlot(_ctx.$slots, "page-bar-popover", { page })
10958
+ ]),
10597
10959
  _: 3
10598
- });
10960
+ }, 8, ["disabled-page-fragment"]);
10599
10961
  };
10600
10962
  }
10601
10963
  });
@@ -10610,23 +10972,24 @@ const index = {
10610
10972
  app.config.globalProperties.$TMAGIC_EDITOR = option;
10611
10973
  setConfig(option);
10612
10974
  app.component(_sfc_main.name, _sfc_main);
10613
- app.component("m-fields-ui-select", _sfc_main$y);
10614
- app.component("m-fields-code-link", _sfc_main$O);
10615
- app.component("m-fields-vs-code", _sfc_main$P);
10616
- app.component("magic-code-editor", _sfc_main$Q);
10617
- app.component("m-fields-code-select", _sfc_main$N);
10618
- app.component("m-fields-code-select-col", _sfc_main$J);
10619
- app.component("m-fields-event-select", _sfc_main$B);
10620
- app.component("m-fields-data-source-fields", _sfc_main$I);
10621
- app.component("m-fields-data-source-mocks", _sfc_main$D);
10622
- app.component("m-fields-key-value", _sfc_main$z);
10623
- app.component("m-fields-data-source-input", _sfc_main$G);
10624
- app.component("m-fields-data-source-select", _sfc_main$C);
10625
- app.component("m-fields-data-source-methods", _sfc_main$F);
10626
- app.component("m-fields-data-source-method-select", _sfc_main$E);
10627
- app.component("m-fields-data-source-field-select", _sfc_main$H);
10975
+ app.component("m-fields-ui-select", _sfc_main$A);
10976
+ app.component("m-fields-code-link", _sfc_main$R);
10977
+ app.component("m-fields-vs-code", _sfc_main$S);
10978
+ app.component("magic-code-editor", _sfc_main$T);
10979
+ app.component("m-fields-code-select", _sfc_main$Q);
10980
+ app.component("m-fields-code-select-col", _sfc_main$M);
10981
+ app.component("m-fields-event-select", _sfc_main$E);
10982
+ app.component("m-fields-data-source-fields", _sfc_main$L);
10983
+ app.component("m-fields-data-source-mocks", _sfc_main$G);
10984
+ app.component("m-fields-key-value", _sfc_main$C);
10985
+ app.component("m-fields-data-source-input", _sfc_main$J);
10986
+ app.component("m-fields-data-source-select", _sfc_main$F);
10987
+ app.component("m-fields-data-source-methods", _sfc_main$I);
10988
+ app.component("m-fields-data-source-method-select", _sfc_main$H);
10989
+ app.component("m-fields-data-source-field-select", _sfc_main$K);
10990
+ app.component("m-fields-page-fragment-select", _sfc_main$B);
10628
10991
  }
10629
10992
  };
10630
10993
 
10631
- export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$M as CodeBlockEditor, _sfc_main$n as CodeBlockList, _sfc_main$m as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$N as CodeSelect, _sfc_main$J as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$i as ContentMenu, _sfc_main$H as DataSourceFieldSelect, _sfc_main$I as DataSourceFields, _sfc_main$G as DataSourceInput, _sfc_main$E as DataSourceMethodSelect, _sfc_main$F as DataSourceMethods, _sfc_main$D as DataSourceMocks, _sfc_main$C as DataSourceSelect, DragType, _sfc_main$B as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$K as Icon, KeyBindingCommand, _sfc_main$z as KeyValue, Keys, LayerOffset, _sfc_main$e as LayerPanel, Layout, _sfc_main$w as LayoutContainer, _sfc_main$r as PropsPanel, _sfc_main$x as Resizer, _sfc_main$w as SplitView, _sfc_main$Q as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$t 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, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChilrenLayout, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };
10994
+ export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$P as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$Q as CodeSelect, _sfc_main$M as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$g as ContentMenu, _sfc_main$K as DataSourceFieldSelect, _sfc_main$L as DataSourceFields, _sfc_main$J as DataSourceInput, _sfc_main$H as DataSourceMethodSelect, _sfc_main$I as DataSourceMethods, _sfc_main$G as DataSourceMocks, _sfc_main$F as DataSourceSelect, DragType, _sfc_main$E as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$N as Icon, KeyBindingCommand, _sfc_main$C as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$y as LayoutContainer, _sfc_main$B as PageFragmentSelect, _sfc_main$p as PropsPanel, _sfc_main$z as Resizer, _sfc_main$y as SplitView, _sfc_main$T as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$x 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, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };
10632
10995
  //# sourceMappingURL=tmagic-editor.js.map