@tmagic/editor 1.5.0-beta.0 → 1.5.0-beta.10

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 (81) hide show
  1. package/dist/style.css +285 -8
  2. package/dist/tmagic-editor.js +396 -332
  3. package/dist/tmagic-editor.umd.cjs +628 -533
  4. package/package.json +13 -14
  5. package/src/Editor.vue +18 -4
  6. package/src/components/CodeBlockEditor.vue +5 -5
  7. package/src/components/SearchInput.vue +1 -0
  8. package/src/components/Tree.vue +10 -2
  9. package/src/components/TreeNode.vue +4 -2
  10. package/src/editorProps.ts +6 -3
  11. package/src/fields/CodeLink.vue +2 -2
  12. package/src/fields/CodeSelect.vue +1 -1
  13. package/src/fields/CodeSelectCol.vue +1 -1
  14. package/src/fields/CondOpSelect.vue +1 -1
  15. package/src/fields/DataSourceFieldSelect/FieldSelect.vue +2 -8
  16. package/src/fields/DataSourceFieldSelect/Index.vue +2 -2
  17. package/src/fields/DataSourceFields.vue +1 -1
  18. package/src/fields/DataSourceInput.vue +4 -4
  19. package/src/fields/DataSourceMethodSelect.vue +1 -1
  20. package/src/fields/DataSourceMethods.vue +1 -1
  21. package/src/fields/DataSourceMocks.vue +1 -1
  22. package/src/fields/DisplayConds.vue +1 -1
  23. package/src/fields/EventSelect.vue +4 -4
  24. package/src/fields/PageFragmentSelect.vue +1 -1
  25. package/src/fields/UISelect.vue +1 -1
  26. package/src/hooks/index.ts +7 -0
  27. package/src/hooks/use-code-block-edit.ts +1 -1
  28. package/src/hooks/use-data-source-edit.ts +1 -1
  29. package/src/hooks/use-data-source-method.ts +3 -3
  30. package/src/hooks/use-filter.ts +2 -2
  31. package/src/hooks/use-node-status.ts +3 -3
  32. package/src/hooks/use-stage.ts +2 -2
  33. package/src/index.ts +30 -8
  34. package/src/initService.ts +17 -10
  35. package/src/layouts/AddPageBox.vue +1 -1
  36. package/src/layouts/CodeEditor.vue +5 -5
  37. package/src/layouts/Framework.vue +2 -2
  38. package/src/layouts/NavMenu.vue +1 -1
  39. package/src/layouts/PropsPanel.vue +1 -1
  40. package/src/layouts/page-bar/AddButton.vue +1 -1
  41. package/src/layouts/page-bar/PageBar.vue +8 -2
  42. package/src/layouts/page-bar/PageBarScrollContainer.vue +1 -1
  43. package/src/layouts/page-bar/PageList.vue +8 -2
  44. package/src/layouts/page-bar/SwitchTypeButton.vue +1 -1
  45. package/src/layouts/sidebar/ComponentListPanel.vue +1 -1
  46. package/src/layouts/sidebar/Sidebar.vue +31 -3
  47. package/src/layouts/sidebar/code-block/CodeBlockList.vue +11 -3
  48. package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +11 -2
  49. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +1 -1
  50. package/src/layouts/sidebar/data-source/DataSourceList.vue +13 -3
  51. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +30 -15
  52. package/src/layouts/sidebar/layer/LayerNodeTool.vue +1 -1
  53. package/src/layouts/sidebar/layer/LayerPanel.vue +5 -1
  54. package/src/layouts/sidebar/layer/use-click.ts +1 -1
  55. package/src/layouts/sidebar/layer/use-drag.ts +1 -1
  56. package/src/layouts/sidebar/layer/use-node-status.ts +3 -4
  57. package/src/layouts/workspace/Breadcrumb.vue +1 -1
  58. package/src/layouts/workspace/viewer/NodeListMenu.vue +2 -2
  59. package/src/layouts/workspace/viewer/Stage.vue +9 -5
  60. package/src/layouts/workspace/viewer/StageOverlay.vue +9 -4
  61. package/src/layouts/workspace/viewer/ViewerMenu.vue +1 -1
  62. package/src/services/codeBlock.ts +7 -7
  63. package/src/services/dataSource.ts +3 -4
  64. package/src/services/dep.ts +2 -2
  65. package/src/services/editor.ts +10 -11
  66. package/src/services/history.ts +1 -1
  67. package/src/services/props.ts +3 -3
  68. package/src/services/stageOverlay.ts +15 -7
  69. package/src/services/storage.ts +2 -2
  70. package/src/theme/data-source.scss +8 -5
  71. package/src/theme/index.scss +3 -0
  72. package/src/theme/page-bar.scss +2 -1
  73. package/src/type.ts +14 -11
  74. package/src/utils/config.ts +5 -5
  75. package/src/utils/content-menu.ts +3 -3
  76. package/src/utils/data-source/index.ts +1 -1
  77. package/src/utils/editor.ts +13 -35
  78. package/src/utils/operator.ts +2 -1
  79. package/src/utils/props.ts +1 -1
  80. package/src/utils/tree.ts +1 -1
  81. package/types/index.d.ts +1664 -3039
@@ -1,22 +1,29 @@
1
+ import designPlugin__default, { TMagicIcon, TMagicButton, TMagicCard, getDesignConfig, TMagicSelect, useZIndex, tMagicMessage, tMagicMessageBox, TMagicCascader, TMagicTooltip, TMagicTag, TMagicDialog, TMagicSwitch, TMagicInput, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
2
+ export * from '@tmagic/design';
3
+ export { default as designPlugin } from '@tmagic/design';
4
+ import formPlugin__default, { MContainer, MForm, filterFunction, createValues, MFormBox, MSelect, MGroupList, MPanel } from '@tmagic/form';
5
+ export * from '@tmagic/form';
6
+ export { default as formPlugin } from '@tmagic/form';
7
+ import tablePlugin__default, { MagicTable } from '@tmagic/table';
8
+ export * from '@tmagic/table';
9
+ export { default as tablePlugin } from '@tmagic/table';
1
10
  import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createElementBlock, normalizeClass, resolveDynamicComponent, toRaw, ref, watch, onMounted, onBeforeUnmount, Teleport, normalizeStyle, computed, reactive, resolveComponent, inject, createCommentVNode, Fragment, renderList, mergeProps, mergeModels, useModel, nextTick, provide, renderSlot, toDisplayString, createTextVNode, isRef, createStaticVNode, watchEffect, withModifiers, toHandlers, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, Transition, mergeDefaults } from 'vue';
2
11
  import { Edit, FullScreen, View, Close, Coin, Delete, Plus, ArrowDown, ArrowLeftBold, ArrowRightBold, Files, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Document, Search, ArrowRight, CopyDocument, Hide, Goods, List, EditPen, CloseBold, Top, Bottom } from '@element-plus/icons-vue';
3
- import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys } from 'lodash-es';
12
+ import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys, debounce } from 'lodash-es';
4
13
  import serialize from 'serialize-javascript';
5
- import { TMagicIcon, TMagicButton, TMagicCard, getConfig as getConfig$1, TMagicSelect, useZIndex, tMagicMessage, tMagicMessageBox, TMagicCascader, TMagicTooltip, TMagicTag, TMagicDialog, TMagicSwitch, TMagicInput, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
6
14
  import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
7
15
  import * as monaco from 'monaco-editor';
8
- import { MContainer, MForm, filterFunction, createValues, MFormBox, MSelect, MGroupList, MPanel } from '@tmagic/form';
9
- import { HookCodeType, HookType, NODE_CONDS_KEY, NodeType, ActionType } from '@tmagic/schema';
10
- import { MagicTable } from '@tmagic/table';
11
- import { isPage, isPageFragment, isPop, getNodePath, isNumber, getElById, calcValueByFontsize, toLine, guid, getValueByKeyPath, setValueByKeyPath, dataSourceTemplateRegExp, getKeysArray, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, convertToNumber, getIdFromEl, getDefaultValueFromFields, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, removeClassName, addClassName, removeClassNameByClassName } from '@tmagic/utils';
16
+ import { HookCodeType, HookType, NODE_CONDS_KEY, Target, Watcher, NodeType, ActionType, DepTargetType, DEFAULT_EVENTS, DEFAULT_METHODS, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/core';
17
+ export { DepTargetType } from '@tmagic/core';
18
+ import { isPage, isPageFragment, isPop, getNodePath, isNumber, getElById, calcValueByFontsize, toLine, guid, getValueByKeyPath, setValueByKeyPath, dataSourceTemplateRegExp, getKeysArray, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, convertToNumber, getIdFromEl, traverseNode, getDefaultValueFromFields, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, removeClassName, addClassName, removeClassNameByClassName } from '@tmagic/utils';
19
+ export * from '@tmagic/utils';
12
20
  import VanillaMoveable from 'moveable';
13
- import { Target, Watcher, DepTargetType, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
14
- export { DepTargetType } from '@tmagic/dep';
21
+ import StageCore__default, { isFixed, GuidesType, getOffset, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
22
+ export * from '@tmagic/stage';
23
+ export { default as StageCore } from '@tmagic/stage';
15
24
  import { EventEmitter } from 'events';
16
25
  import Gesto from 'gesto';
17
26
  import Sortable from 'sortablejs';
18
- import StageCore, { GuidesType, getOffset, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
19
- import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
20
27
  import KeyController from 'keycon';
21
28
 
22
29
  const _hoisted_1$w = ["src"];
@@ -64,10 +71,10 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
64
71
  });
65
72
 
66
73
  let $TMAGIC_EDITOR = {};
67
- const setConfig = (option) => {
74
+ const setEditorConfig = (option) => {
68
75
  $TMAGIC_EDITOR = option;
69
76
  };
70
- const getConfig = (key) => $TMAGIC_EDITOR[key];
77
+ const getEditorConfig = (key) => $TMAGIC_EDITOR[key];
71
78
 
72
79
  emmetHTML(monaco);
73
80
  emmetCSS(monaco, ["css", "scss"]);
@@ -115,14 +122,14 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
115
122
  }
116
123
  return value;
117
124
  };
118
- const parse = (v, language) => {
125
+ const parseCode = (v, language) => {
119
126
  if (typeof v !== "string") {
120
127
  return v;
121
128
  }
122
129
  if (language === "json") {
123
130
  return JSON.parse(v);
124
131
  }
125
- return getConfig("parseDSL")(v);
132
+ return getEditorConfig("parseDSL")(v);
126
133
  };
127
134
  let vsEditor = null;
128
135
  let vsDiffEditor = null;
@@ -170,7 +177,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
170
177
  e.stopPropagation();
171
178
  const newValue = getEditorValue();
172
179
  values.value = newValue;
173
- emit("save", props.parse ? parse(newValue, props.language) : newValue);
180
+ emit("save", props.parse ? parseCode(newValue, props.language) : newValue);
174
181
  }
175
182
  });
176
183
  if (props.type !== "diff" && props.autoSave) {
@@ -178,7 +185,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
178
185
  const newValue = getEditorValue();
179
186
  if (values.value !== newValue) {
180
187
  values.value = newValue;
181
- emit("save", props.parse ? parse(newValue, props.language) : newValue);
188
+ emit("save", props.parse ? parseCode(newValue, props.language) : newValue);
182
189
  }
183
190
  });
184
191
  }
@@ -364,7 +371,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
364
371
  const changeHandler = (v) => {
365
372
  if (!props.name || !props.model) return;
366
373
  try {
367
- const parseDSL = getConfig("parseDSL");
374
+ const parseDSL = getEditorConfig("parseDSL");
368
375
  props.model[props.name] = parseDSL(`(${v[props.name]})`);
369
376
  emit("change", props.model[props.name]);
370
377
  } catch (e) {
@@ -994,7 +1001,6 @@ const generatePageName = (pageNameList, type) => {
994
1001
  return pageName;
995
1002
  };
996
1003
  const generatePageNameByApp = (app, type) => generatePageName(getPageNameList(type === "page" ? getPageList(app) : getPageFragmentList(app)), type);
997
- const isFixed = (node) => node.style?.position === "fixed";
998
1004
  const getNodeIndex = (id, parent) => {
999
1005
  const items = parent?.items || [];
1000
1006
  return items.findIndex((item) => `${item.id}` === `${id}`);
@@ -1012,11 +1018,14 @@ const getMiddleTop = (node, parentNode, stage) => {
1012
1018
  height = 0;
1013
1019
  }
1014
1020
  const { height: parentHeight } = parentNode.style;
1015
- const { scrollTop = 0, wrapperHeight } = stage.mask;
1016
- const wrapperHeightDeal = calcValueByFontsize(stage.renderer.getDocument(), wrapperHeight);
1017
- const scrollTopDeal = calcValueByFontsize(stage.renderer.getDocument(), scrollTop);
1018
- if (isPage(parentNode)) {
1019
- return (wrapperHeightDeal - height) / 2 + scrollTopDeal;
1021
+ let wrapperHeightDeal = parentHeight;
1022
+ if (stage.mask && stage.renderer) {
1023
+ const { scrollTop = 0, wrapperHeight } = stage.mask;
1024
+ wrapperHeightDeal = calcValueByFontsize(stage.renderer.getDocument(), wrapperHeight);
1025
+ const scrollTopDeal = calcValueByFontsize(stage.renderer.getDocument(), scrollTop);
1026
+ if (isPage(parentNode)) {
1027
+ return (wrapperHeightDeal - height) / 2 + scrollTopDeal;
1028
+ }
1020
1029
  }
1021
1030
  return (Math.min(parentHeight, wrapperHeightDeal) - height) / 2;
1022
1031
  };
@@ -1131,22 +1140,13 @@ const fixNodePosition = (config, parent, stage) => {
1131
1140
  return {
1132
1141
  ...config.style || {},
1133
1142
  top: getMiddleTop(config, parent, stage),
1134
- left: fixNodeLeft(config, parent, stage?.renderer.contentWindow?.document)
1143
+ left: fixNodeLeft(config, parent, stage?.renderer?.contentWindow?.document)
1135
1144
  };
1136
1145
  };
1137
1146
  const serializeConfig = (config) => serialize(config, {
1138
1147
  space: 2,
1139
1148
  unsafe: true
1140
1149
  }).replace(/"(\w+)":\s/g, "$1: ");
1141
- const traverseNode = (node, cb, parents = []) => {
1142
- cb(node, parents);
1143
- if (Array.isArray(node.items) && node.items.length) {
1144
- parents.push(node);
1145
- node.items.forEach((item) => {
1146
- traverseNode(item, cb, [...parents]);
1147
- });
1148
- }
1149
- };
1150
1150
  const moveItemsInContainer = (sourceIndices, parent, targetIndex) => {
1151
1151
  sourceIndices.sort((a, b) => a - b);
1152
1152
  for (let i = sourceIndices.length - 1; i >= 0; i--) {
@@ -1703,7 +1703,7 @@ class WebStorage extends BaseService {
1703
1703
  if (item === null) return null;
1704
1704
  switch (protocol) {
1705
1705
  case "object" /* OBJECT */:
1706
- return getConfig("parseDSL")(`(${item})`);
1706
+ return getEditorConfig("parseDSL")(`(${item})`);
1707
1707
  case "json" /* JSON */:
1708
1708
  return JSON.parse(item);
1709
1709
  case "number" /* NUMBER */:
@@ -1915,7 +1915,7 @@ class Editor extends BaseService {
1915
1915
  * 只有容器拥有布局
1916
1916
  */
1917
1917
  async getLayout(parent, node) {
1918
- if (node && typeof node !== "function" && isFixed(node)) return Layout.FIXED;
1918
+ if (node && typeof node !== "function" && isFixed(node.style || {})) return Layout.FIXED;
1919
1919
  if (parent.layout) {
1920
1920
  return parent.layout;
1921
1921
  }
@@ -1940,7 +1940,7 @@ class Editor extends BaseService {
1940
1940
  historyService.resetState();
1941
1941
  }
1942
1942
  if (node?.id) {
1943
- this.get("stage")?.renderer.runtime?.getApp?.()?.page?.emit(
1943
+ this.get("stage")?.renderer?.runtime?.getApp?.()?.page?.emit(
1944
1944
  "editor:select",
1945
1945
  {
1946
1946
  node,
@@ -2294,7 +2294,7 @@ class Editor extends BaseService {
2294
2294
  }
2295
2295
  async doPaste(config, position = {}) {
2296
2296
  propsService.clearRelateId();
2297
- const doc = this.get("stage")?.renderer.contentWindow?.document;
2297
+ const doc = this.get("stage")?.renderer?.contentWindow?.document;
2298
2298
  const pasteConfigs = beforePaste(position, cloneDeep(config), doc);
2299
2299
  return pasteConfigs;
2300
2300
  }
@@ -2308,7 +2308,7 @@ class Editor extends BaseService {
2308
2308
  }
2309
2309
  if (!node.style) return config;
2310
2310
  const stage = this.get("stage");
2311
- const doc = stage?.renderer.contentWindow?.document;
2311
+ const doc = stage?.renderer?.contentWindow?.document;
2312
2312
  if (doc) {
2313
2313
  const el = getElById()(doc, node.id);
2314
2314
  const parentEl = layout === Layout.FIXED ? doc.body : el?.offsetParent;
@@ -2583,9 +2583,9 @@ class Editor extends BaseService {
2583
2583
  async toggleFixedPosition(dist, src, root) {
2584
2584
  const newConfig = cloneDeep(dist);
2585
2585
  if (!isPop(src) && newConfig.style?.position) {
2586
- if (isFixed(newConfig) && !isFixed(src)) {
2586
+ if (isFixed(newConfig.style) && !isFixed(src.style || {})) {
2587
2587
  newConfig.style = change2Fixed(newConfig, root);
2588
- } else if (!isFixed(newConfig) && isFixed(src)) {
2588
+ } else if (!isFixed(newConfig.style) && isFixed(src.style || {})) {
2589
2589
  newConfig.style = await Fixed2Other(newConfig, root, this.getLayout);
2590
2590
  }
2591
2591
  }
@@ -3230,7 +3230,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3230
3230
  });
3231
3231
 
3232
3232
  const _hoisted_1$u = { class: "m-fields-code-select-col" };
3233
- const _hoisted_2$k = { class: "code-select-container" };
3233
+ const _hoisted_2$g = { class: "code-select-container" };
3234
3234
  const _sfc_main$S = /* @__PURE__ */ defineComponent({
3235
3235
  ...{
3236
3236
  name: "MFieldsCodeSelectCol"
@@ -3311,7 +3311,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
3311
3311
  };
3312
3312
  return (_ctx, _cache) => {
3313
3313
  return openBlock(), createElementBlock("div", _hoisted_1$u, [
3314
- createElementVNode("div", _hoisted_2$k, [
3314
+ createElementVNode("div", _hoisted_2$g, [
3315
3315
  createVNode(unref(MContainer), {
3316
3316
  class: "select",
3317
3317
  config: selectConfig,
@@ -3367,7 +3367,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
3367
3367
  const emit = __emit;
3368
3368
  const { dataSourceService } = inject("services") || {};
3369
3369
  const props = __props;
3370
- const optionComponent = getConfig$1("components")?.option;
3370
+ const optionComponent = getDesignConfig("components")?.option;
3371
3371
  const options = computed(() => {
3372
3372
  const [id, ...fieldNames] = [...props.config.parentFields || [], ...props.model.field];
3373
3373
  const ds = dataSourceService?.getDataSourceById(id);
@@ -3718,7 +3718,7 @@ const useDataSourceMethod = () => {
3718
3718
  dataSource.value.methods = [];
3719
3719
  }
3720
3720
  if (values.content) {
3721
- const parseDSL = getConfig("parseDSL");
3721
+ const parseDSL = getEditorConfig("parseDSL");
3722
3722
  if (typeof values.content === "string") {
3723
3723
  values.content = parseDSL(values.content);
3724
3724
  }
@@ -3846,7 +3846,7 @@ const zoom = computed(() => uiService.get("zoom") || 1);
3846
3846
  const uiSelectMode = computed(() => uiService.get("uiSelectMode"));
3847
3847
  const getGuideLineKey = (key) => `${key}_${root.value?.id}_${page.value?.id}`;
3848
3848
  const useStage = (stageOptions) => {
3849
- const stage = new StageCore({
3849
+ const stage = new StageCore__default({
3850
3850
  render: stageOptions.render,
3851
3851
  runtimeUrl: stageOptions.runtimeUrl,
3852
3852
  zoom: stageOptions.zoom ?? zoom.value,
@@ -3881,7 +3881,7 @@ const useStage = (stageOptions) => {
3881
3881
  }
3882
3882
  }
3883
3883
  );
3884
- stage.mask.setGuides([
3884
+ stage.mask?.setGuides([
3885
3885
  getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)),
3886
3886
  getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
3887
3887
  ]);
@@ -4061,6 +4061,68 @@ const useEditorContentHeight = () => {
4061
4061
  };
4062
4062
  };
4063
4063
 
4064
+ const useFilter = (nodeData, nodeStatusMap, filterNodeMethod) => {
4065
+ const filterIsMatch = (value, data) => {
4066
+ const string = !Array.isArray(value) ? [value] : value;
4067
+ if (!string.length) {
4068
+ return true;
4069
+ }
4070
+ return string.some((v) => filterNodeMethod(v, data));
4071
+ };
4072
+ const filter = (text) => {
4073
+ if (!nodeData.value.length) return;
4074
+ nodeData.value.forEach((node) => {
4075
+ traverseNode(node, (node2, parents) => {
4076
+ if (!nodeStatusMap.value) return;
4077
+ const visible = filterIsMatch(text, node2);
4078
+ if (visible && parents.length) {
4079
+ parents.forEach((parent) => {
4080
+ updateStatus(nodeStatusMap.value, parent.id, {
4081
+ visible,
4082
+ expand: true
4083
+ });
4084
+ });
4085
+ }
4086
+ updateStatus(nodeStatusMap.value, node2.id, {
4087
+ visible
4088
+ });
4089
+ });
4090
+ });
4091
+ };
4092
+ return {
4093
+ filterText: ref(""),
4094
+ filterTextChangeHandler(text) {
4095
+ filter(text);
4096
+ }
4097
+ };
4098
+ };
4099
+
4100
+ const useGetSo = (target, emit) => {
4101
+ let getso;
4102
+ const isDraging = ref(false);
4103
+ onMounted(() => {
4104
+ if (!target.value) return;
4105
+ getso = new Gesto(target.value, {
4106
+ container: window,
4107
+ pinchOutside: true
4108
+ }).on("drag", (e) => {
4109
+ if (!target.value) return;
4110
+ emit("change", e);
4111
+ }).on("dragStart", () => {
4112
+ isDraging.value = true;
4113
+ }).on("dragEnd", () => {
4114
+ isDraging.value = false;
4115
+ });
4116
+ });
4117
+ onBeforeUnmount(() => {
4118
+ getso?.unset();
4119
+ isDraging.value = false;
4120
+ });
4121
+ return {
4122
+ isDraging
4123
+ };
4124
+ };
4125
+
4064
4126
  const useNextFloatBoxPosition = (uiService, parent) => {
4065
4127
  const boxPosition = ref({
4066
4128
  left: 0,
@@ -4085,8 +4147,42 @@ const useNextFloatBoxPosition = (uiService, parent) => {
4085
4147
  };
4086
4148
  };
4087
4149
 
4150
+ const createPageNodeStatus$1 = (nodeData, initialLayerNodeStatus) => {
4151
+ const map = /* @__PURE__ */ new Map();
4152
+ nodeData.forEach(
4153
+ (node) => traverseNode(node, (node2) => {
4154
+ map.set(
4155
+ node2.id,
4156
+ initialLayerNodeStatus?.get(node2.id) || {
4157
+ visible: true,
4158
+ expand: false,
4159
+ selected: false,
4160
+ draggable: false
4161
+ }
4162
+ );
4163
+ })
4164
+ );
4165
+ return map;
4166
+ };
4167
+ const useNodeStatus$1 = (nodeData) => {
4168
+ const nodeStatusMap = ref(/* @__PURE__ */ new Map());
4169
+ watch(
4170
+ nodeData,
4171
+ (nodeData2) => {
4172
+ nodeStatusMap.value = createPageNodeStatus$1(nodeData2, nodeStatusMap.value);
4173
+ },
4174
+ {
4175
+ immediate: true,
4176
+ deep: true
4177
+ }
4178
+ );
4179
+ return {
4180
+ nodeStatusMap
4181
+ };
4182
+ };
4183
+
4088
4184
  const _hoisted_1$t = { class: "m-editor-data-source-fields" };
4089
- const _hoisted_2$j = { class: "m-editor-data-source-fields-footer" };
4185
+ const _hoisted_2$f = { class: "m-editor-data-source-fields-footer" };
4090
4186
  const _sfc_main$P = /* @__PURE__ */ defineComponent({
4091
4187
  ...{
4092
4188
  name: "MFieldsDataSourceFields"
@@ -4343,16 +4439,16 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
4343
4439
  data: _ctx.model[_ctx.name],
4344
4440
  columns: fieldColumns
4345
4441
  }, null, 8, ["data"]),
4346
- createElementVNode("div", _hoisted_2$j, [
4442
+ createElementVNode("div", _hoisted_2$f, [
4347
4443
  createVNode(unref(TMagicButton), {
4348
4444
  size: "small",
4349
4445
  disabled: _ctx.disabled,
4350
4446
  plain: "",
4351
4447
  onClick: _cache[0] || (_cache[0] = ($event) => newFromJsonHandler())
4352
4448
  }, {
4353
- default: withCtx(() => [
4449
+ default: withCtx(() => _cache[8] || (_cache[8] = [
4354
4450
  createTextVNode("快速添加")
4355
- ]),
4451
+ ])),
4356
4452
  _: 1
4357
4453
  }, 8, ["disabled"]),
4358
4454
  createVNode(unref(TMagicButton), {
@@ -4362,9 +4458,9 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
4362
4458
  plain: "",
4363
4459
  onClick: _cache[1] || (_cache[1] = ($event) => newHandler())
4364
4460
  }, {
4365
- default: withCtx(() => [
4461
+ default: withCtx(() => _cache[9] || (_cache[9] = [
4366
4462
  createTextVNode("添加")
4367
- ]),
4463
+ ])),
4368
4464
  _: 1
4369
4465
  }, 8, ["disabled"])
4370
4466
  ]),
@@ -4435,7 +4531,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
4435
4531
  const props = __props;
4436
4532
  const emit = __emit;
4437
4533
  const modelValue = useModel(__props, "modelValue");
4438
- const optionComponent = getConfig$1("components")?.option;
4534
+ const optionComponent = getDesignConfig("components")?.option;
4439
4535
  const services = inject("services");
4440
4536
  const mForm = inject("mForm");
4441
4537
  const eventBus = inject("eventBus");
@@ -4702,7 +4798,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
4702
4798
  "last-values": _ctx.lastValues,
4703
4799
  "init-values": _ctx.initValues,
4704
4800
  values: _ctx.values,
4705
- prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
4801
+ prop: _ctx.prop,
4706
4802
  onChange: onChangeHandler
4707
4803
  }, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
4708
4804
  _ctx.config.fieldConfig ? (openBlock(), createBlock(unref(TMagicTooltip), {
@@ -4731,8 +4827,8 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
4731
4827
  });
4732
4828
 
4733
4829
  const _hoisted_1$q = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
4734
- const _hoisted_2$i = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
4735
- const _hoisted_3$8 = { class: "el-input__inner t-input__inner" };
4830
+ const _hoisted_2$e = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
4831
+ const _hoisted_3$4 = { class: "el-input__inner t-input__inner" };
4736
4832
  const _sfc_main$M = /* @__PURE__ */ defineComponent({
4737
4833
  ...{
4738
4834
  name: "MFieldsDataSourceInput"
@@ -4909,7 +5005,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4909
5005
  changeHandler(state.value);
4910
5006
  };
4911
5007
  return (_ctx, _cache) => {
4912
- return _ctx.disabled || isFocused.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(getConfig$1)("components")?.autocomplete.component || "el-autocomplete"), mergeProps(
5008
+ return _ctx.disabled || isFocused.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(getDesignConfig)("components")?.autocomplete.component || "el-autocomplete"), mergeProps(
4913
5009
  {
4914
5010
  key: 0,
4915
5011
  class: "tmagic-design-auto-complete",
@@ -4918,7 +5014,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4918
5014
  modelValue: state.value,
4919
5015
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.value = $event)
4920
5016
  },
4921
- unref(getConfig$1)("components")?.autocomplete.props({
5017
+ unref(getDesignConfig)("components")?.autocomplete.props({
4922
5018
  disabled: _ctx.disabled,
4923
5019
  size: _ctx.size,
4924
5020
  fetchSuggestions: querySearch,
@@ -4938,7 +5034,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4938
5034
  default: withCtx(({ item }) => [
4939
5035
  createElementVNode("div", _hoisted_1$q, [
4940
5036
  createElementVNode("div", null, toDisplayString(item.text), 1),
4941
- createElementVNode("span", _hoisted_2$i, toDisplayString(item.value), 1)
5037
+ createElementVNode("span", _hoisted_2$e, toDisplayString(item.value), 1)
4942
5038
  ])
4943
5039
  ]),
4944
5040
  _: 1
@@ -4950,7 +5046,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4950
5046
  createElementVNode("div", {
4951
5047
  class: normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
4952
5048
  }, [
4953
- createElementVNode("div", _hoisted_3$8, [
5049
+ createElementVNode("div", _hoisted_3$4, [
4954
5050
  (openBlock(true), createElementBlock(Fragment, null, renderList(displayState.value, (item, index) => {
4955
5051
  return openBlock(), createElementBlock(Fragment, null, [
4956
5052
  item.type === "text" ? (openBlock(), createElementBlock("span", {
@@ -4980,9 +5076,9 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4980
5076
  });
4981
5077
 
4982
5078
  const _hoisted_1$p = { style: { "display": "flex", "margin-bottom": "10px" } };
4983
- const _hoisted_2$h = { style: { "flex": "1" } };
4984
- const _hoisted_3$7 = { style: { "flex": "1" } };
4985
- const _hoisted_4$7 = { class: "dialog-footer" };
5079
+ const _hoisted_2$d = { style: { "flex": "1" } };
5080
+ const _hoisted_3$3 = { style: { "flex": "1" } };
5081
+ const _hoisted_4$3 = { class: "dialog-footer" };
4986
5082
  const _sfc_main$L = /* @__PURE__ */ defineComponent({
4987
5083
  ...{
4988
5084
  name: "MEditorCodeBlockEditor"
@@ -5102,7 +5198,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
5102
5198
  height: "500px",
5103
5199
  onChange: (formState, code) => {
5104
5200
  try {
5105
- getConfig("parseDSL")(code);
5201
+ getEditorConfig("parseDSL")(code);
5106
5202
  return code;
5107
5203
  } catch (error) {
5108
5204
  tMagicMessage.error(error.message);
@@ -5191,9 +5287,9 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
5191
5287
  link: "",
5192
5288
  onClick: _cache[0] || (_cache[0] = ($event) => difVisible.value = true)
5193
5289
  }, {
5194
- default: withCtx(() => [
5290
+ default: withCtx(() => _cache[6] || (_cache[6] = [
5195
5291
  createTextVNode("查看修改")
5196
- ]),
5292
+ ])),
5197
5293
  _: 1
5198
5294
  })) : createCommentVNode("", true)
5199
5295
  ]),
@@ -5210,14 +5306,14 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
5210
5306
  fullscreen: ""
5211
5307
  }, {
5212
5308
  footer: withCtx(() => [
5213
- createElementVNode("span", _hoisted_4$7, [
5309
+ createElementVNode("span", _hoisted_4$3, [
5214
5310
  createVNode(unref(TMagicButton), {
5215
5311
  size: "small",
5216
5312
  onClick: _cache[4] || (_cache[4] = ($event) => difVisible.value = false)
5217
5313
  }, {
5218
- default: withCtx(() => [
5314
+ default: withCtx(() => _cache[9] || (_cache[9] = [
5219
5315
  createTextVNode("取消")
5220
- ]),
5316
+ ])),
5221
5317
  _: 1
5222
5318
  }),
5223
5319
  createVNode(unref(TMagicButton), {
@@ -5225,34 +5321,34 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
5225
5321
  type: "primary",
5226
5322
  onClick: diffChange
5227
5323
  }, {
5228
- default: withCtx(() => [
5324
+ default: withCtx(() => _cache[10] || (_cache[10] = [
5229
5325
  createTextVNode("确定")
5230
- ]),
5326
+ ])),
5231
5327
  _: 1
5232
5328
  })
5233
5329
  ])
5234
5330
  ]),
5235
5331
  default: withCtx(() => [
5236
5332
  createElementVNode("div", _hoisted_1$p, [
5237
- createElementVNode("div", _hoisted_2$h, [
5333
+ createElementVNode("div", _hoisted_2$d, [
5238
5334
  createVNode(unref(TMagicTag), {
5239
5335
  size: "small",
5240
5336
  type: "info"
5241
5337
  }, {
5242
- default: withCtx(() => [
5338
+ default: withCtx(() => _cache[7] || (_cache[7] = [
5243
5339
  createTextVNode("修改前")
5244
- ]),
5340
+ ])),
5245
5341
  _: 1
5246
5342
  })
5247
5343
  ]),
5248
- createElementVNode("div", _hoisted_3$7, [
5344
+ createElementVNode("div", _hoisted_3$3, [
5249
5345
  createVNode(unref(TMagicTag), {
5250
5346
  size: "small",
5251
5347
  type: "success"
5252
5348
  }, {
5253
- default: withCtx(() => [
5349
+ default: withCtx(() => _cache[8] || (_cache[8] = [
5254
5350
  createTextVNode("修改后")
5255
- ]),
5351
+ ])),
5256
5352
  _: 1
5257
5353
  })
5258
5354
  ])
@@ -5277,7 +5373,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
5277
5373
  });
5278
5374
 
5279
5375
  const _hoisted_1$o = { class: "m-editor-data-source-methods" };
5280
- const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
5376
+ const _hoisted_2$c = { class: "m-editor-data-source-methods-footer" };
5281
5377
  const _sfc_main$K = /* @__PURE__ */ defineComponent({
5282
5378
  ...{
5283
5379
  name: "MFieldsDataSourceMethods"
@@ -5353,7 +5449,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
5353
5449
  data: _ctx.model[_ctx.name],
5354
5450
  columns: methodColumns
5355
5451
  }, null, 8, ["data"]),
5356
- createElementVNode("div", _hoisted_2$g, [
5452
+ createElementVNode("div", _hoisted_2$c, [
5357
5453
  createVNode(unref(TMagicButton), {
5358
5454
  size: "small",
5359
5455
  type: "primary",
@@ -5361,9 +5457,9 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
5361
5457
  plain: "",
5362
5458
  onClick: createCodeHandler
5363
5459
  }, {
5364
- default: withCtx(() => [
5460
+ default: withCtx(() => _cache[0] || (_cache[0] = [
5365
5461
  createTextVNode("添加")
5366
- ]),
5462
+ ])),
5367
5463
  _: 1
5368
5464
  }, 8, ["disabled"])
5369
5465
  ]),
@@ -5383,7 +5479,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
5383
5479
  });
5384
5480
 
5385
5481
  const _hoisted_1$n = { class: "m-fields-data-source-method-select" };
5386
- const _hoisted_2$f = { class: "data-source-method-select-container" };
5482
+ const _hoisted_2$b = { class: "data-source-method-select-container" };
5387
5483
  const _sfc_main$J = /* @__PURE__ */ defineComponent({
5388
5484
  ...{
5389
5485
  name: "MFieldsDataSourceMethodSelect"
@@ -5471,7 +5567,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
5471
5567
  };
5472
5568
  return (_ctx, _cache) => {
5473
5569
  return openBlock(), createElementBlock("div", _hoisted_1$n, [
5474
- createElementVNode("div", _hoisted_2$f, [
5570
+ createElementVNode("div", _hoisted_2$b, [
5475
5571
  createVNode(unref(MContainer), {
5476
5572
  class: "select",
5477
5573
  config: cascaderConfig.value,
@@ -5515,7 +5611,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
5515
5611
  });
5516
5612
 
5517
5613
  const _hoisted_1$m = { class: "m-editor-data-source-fields" };
5518
- const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
5614
+ const _hoisted_2$a = { class: "m-editor-data-source-fields-footer" };
5519
5615
  const _sfc_main$I = /* @__PURE__ */ defineComponent({
5520
5616
  ...{
5521
5617
  name: "MFieldsDataSourceMocks"
@@ -5725,7 +5821,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
5725
5821
  data: _ctx.model[_ctx.name],
5726
5822
  columns
5727
5823
  }, null, 8, ["data"]),
5728
- createElementVNode("div", _hoisted_2$e, [
5824
+ createElementVNode("div", _hoisted_2$a, [
5729
5825
  createVNode(unref(TMagicButton), {
5730
5826
  size: "small",
5731
5827
  type: "primary",
@@ -5733,9 +5829,9 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
5733
5829
  plain: "",
5734
5830
  onClick: _cache[0] || (_cache[0] = ($event) => newHandler())
5735
5831
  }, {
5736
- default: withCtx(() => [
5832
+ default: withCtx(() => _cache[4] || (_cache[4] = [
5737
5833
  createTextVNode("添加")
5738
- ]),
5834
+ ])),
5739
5835
  _: 1
5740
5836
  }, 8, ["disabled"])
5741
5837
  ]),
@@ -5990,7 +6086,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5990
6086
  });
5991
6087
 
5992
6088
  const _hoisted_1$k = { class: "m-fields-event-select" };
5993
- const _hoisted_2$d = {
6089
+ const _hoisted_2$9 = {
5994
6090
  key: 1,
5995
6091
  class: "fullWidth"
5996
6092
  };
@@ -6278,7 +6374,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6278
6374
  model: _ctx.model,
6279
6375
  config: tableConfig.value,
6280
6376
  onChange: onChangeHandler
6281
- }, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$d, [
6377
+ }, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$9, [
6282
6378
  createVNode(unref(TMagicButton), {
6283
6379
  class: "create-button",
6284
6380
  type: "primary",
@@ -6286,9 +6382,9 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6286
6382
  disabled: _ctx.disabled,
6287
6383
  onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
6288
6384
  }, {
6289
- default: withCtx(() => [
6385
+ default: withCtx(() => _cache[1] || (_cache[1] = [
6290
6386
  createTextVNode("添加事件")
6291
- ]),
6387
+ ])),
6292
6388
  _: 1
6293
6389
  }, 8, ["size", "disabled"]),
6294
6390
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model[_ctx.name], (cardItem, index) => {
@@ -6334,10 +6430,6 @@ const _hoisted_1$j = {
6334
6430
  xmlns: "http://www.w3.org/2000/svg",
6335
6431
  "xmlns:xlink": "http://www.w3.org/1999/xlink"
6336
6432
  };
6337
- 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);
6338
- const _hoisted_4$6 = [
6339
- _hoisted_2$c
6340
- ];
6341
6433
  const _sfc_main$E = /* @__PURE__ */ defineComponent({
6342
6434
  ...{
6343
6435
  name: "MEditorCodeIcon"
@@ -6345,14 +6437,15 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
6345
6437
  __name: "CodeIcon",
6346
6438
  setup(__props) {
6347
6439
  return (_ctx, _cache) => {
6348
- return openBlock(), createElementBlock("svg", _hoisted_1$j, _hoisted_4$6);
6440
+ return openBlock(), createElementBlock("svg", _hoisted_1$j, _cache[0] || (_cache[0] = [
6441
+ 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)
6442
+ ]));
6349
6443
  };
6350
6444
  }
6351
6445
  });
6352
6446
 
6353
6447
  const _hoisted_1$i = { class: "m-fields-key-value" };
6354
- const _hoisted_2$b = { key: 0 };
6355
- const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
6448
+ const _hoisted_2$8 = { key: 0 };
6356
6449
  const _sfc_main$D = /* @__PURE__ */ defineComponent({
6357
6450
  ...{
6358
6451
  name: "MFieldsKeyValue"
@@ -6412,7 +6505,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
6412
6505
  };
6413
6506
  return (_ctx, _cache) => {
6414
6507
  return openBlock(), createElementBlock("div", _hoisted_1$i, [
6415
- !showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
6508
+ !showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
6416
6509
  (openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
6417
6510
  return openBlock(), createElementBlock("div", {
6418
6511
  class: "m-fields-key-value-item",
@@ -6426,7 +6519,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
6426
6519
  size: _ctx.size,
6427
6520
  onChange: keyChangeHandler
6428
6521
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
6429
- _hoisted_3$6,
6522
+ _cache[1] || (_cache[1] = createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1)),
6430
6523
  createVNode(unref(TMagicInput), {
6431
6524
  placeholder: "value",
6432
6525
  modelValue: records.value[index][1],
@@ -6455,9 +6548,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
6455
6548
  icon: unref(Plus),
6456
6549
  onClick: addHandler
6457
6550
  }, {
6458
- default: withCtx(() => [
6551
+ default: withCtx(() => _cache[2] || (_cache[2] = [
6459
6552
  createTextVNode("添加")
6460
- ]),
6553
+ ])),
6461
6554
  _: 1
6462
6555
  }, 8, ["size", "disabled", "icon"])
6463
6556
  ])) : createCommentVNode("", true),
@@ -6486,7 +6579,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
6486
6579
  });
6487
6580
 
6488
6581
  const _hoisted_1$h = { class: "m-fields-page-fragment-select" };
6489
- const _hoisted_2$a = { class: "page-fragment-select-container" };
6582
+ const _hoisted_2$7 = { class: "page-fragment-select-container" };
6490
6583
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
6491
6584
  ...{
6492
6585
  name: "MFieldsPageFragmentSelect"
@@ -6534,7 +6627,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6534
6627
  return (_ctx, _cache) => {
6535
6628
  const _component_m_form_container = resolveComponent("m-form-container");
6536
6629
  return openBlock(), createElementBlock("div", _hoisted_1$h, [
6537
- createElementVNode("div", _hoisted_2$a, [
6630
+ createElementVNode("div", _hoisted_2$7, [
6538
6631
  createVNode(_component_m_form_container, {
6539
6632
  class: "select",
6540
6633
  config: selectConfig,
@@ -6649,9 +6742,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
6649
6742
  link: "",
6650
6743
  style: { "padding": "0" }
6651
6744
  }, {
6652
- default: withCtx(() => [
6745
+ default: withCtx(() => _cache[2] || (_cache[2] = [
6653
6746
  createTextVNode("取消")
6654
- ]),
6747
+ ])),
6655
6748
  _: 1
6656
6749
  }, 8, ["icon", "disabled", "size"])
6657
6750
  ])) : (openBlock(), createElementBlock("div", _hoisted_1$g, [
@@ -6708,9 +6801,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
6708
6801
  size: _ctx.size,
6709
6802
  onClick: startSelect
6710
6803
  }, {
6711
- default: withCtx(() => [
6804
+ default: withCtx(() => _cache[3] || (_cache[3] = [
6712
6805
  createTextVNode("点击此处选择")
6713
- ]),
6806
+ ])),
6714
6807
  _: 1
6715
6808
  }, 8, ["disabled", "size"])
6716
6809
  ]),
@@ -6721,32 +6814,6 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
6721
6814
  }
6722
6815
  });
6723
6816
 
6724
- const useGetSo = (target, emit) => {
6725
- let getso;
6726
- const isDraging = ref(false);
6727
- onMounted(() => {
6728
- if (!target.value) return;
6729
- getso = new Gesto(target.value, {
6730
- container: window,
6731
- pinchOutside: true
6732
- }).on("drag", (e) => {
6733
- if (!target.value) return;
6734
- emit("change", e);
6735
- }).on("dragStart", () => {
6736
- isDraging.value = true;
6737
- }).on("dragEnd", () => {
6738
- isDraging.value = false;
6739
- });
6740
- });
6741
- onBeforeUnmount(() => {
6742
- getso?.unset();
6743
- isDraging.value = false;
6744
- });
6745
- return {
6746
- isDraging
6747
- };
6748
- };
6749
-
6750
6817
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
6751
6818
  ...{
6752
6819
  name: "MEditorResizer"
@@ -6933,7 +7000,7 @@ const _hoisted_1$f = {
6933
7000
  key: 1,
6934
7001
  class: "menu-item-text"
6935
7002
  };
6936
- const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
7003
+ const _hoisted_2$6 = { class: "el-dropdown-link menubar-menu-button" };
6937
7004
  const _sfc_main$y = /* @__PURE__ */ defineComponent({
6938
7005
  ...{
6939
7006
  name: "MEditorToolButton"
@@ -7070,7 +7137,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7070
7137
  })) : createCommentVNode("", true)
7071
7138
  ]),
7072
7139
  default: withCtx(() => [
7073
- createElementVNode("span", _hoisted_2$9, [
7140
+ createElementVNode("span", _hoisted_2$6, [
7074
7141
  createTextVNode(toDisplayString(_ctx.data.text), 1),
7075
7142
  createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
7076
7143
  default: withCtx(() => [
@@ -7315,8 +7382,9 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
7315
7382
  createVNode(unref(TMagicPopover), {
7316
7383
  "popper-class": "page-bar-popover",
7317
7384
  placement: "top",
7385
+ trigger: "hover",
7318
7386
  width: 160,
7319
- trigger: "hover"
7387
+ "destroy-on-close": true
7320
7388
  }, {
7321
7389
  reference: withCtx(() => [
7322
7390
  createVNode(unref(TMagicIcon), { class: "m-editor-page-list-menu-icon" }, {
@@ -7394,9 +7462,9 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
7394
7462
  });
7395
7463
 
7396
7464
  const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
7397
- const _hoisted_2$8 = ["page-id", "onClick"];
7398
- const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
7399
- const _hoisted_4$5 = ["title"];
7465
+ const _hoisted_2$5 = ["page-id", "onClick"];
7466
+ const _hoisted_3$2 = { class: "m-editor-page-bar-title" };
7467
+ const _hoisted_4$2 = ["title"];
7400
7468
  const _sfc_main$t = /* @__PURE__ */ defineComponent({
7401
7469
  ...{
7402
7470
  name: "MEditorPageBar"
@@ -7503,18 +7571,19 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
7503
7571
  "page-id": item.id,
7504
7572
  onClick: ($event) => switchPage(item.id)
7505
7573
  }, [
7506
- createElementVNode("div", _hoisted_3$5, [
7574
+ createElementVNode("div", _hoisted_3$2, [
7507
7575
  renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
7508
7576
  createElementVNode("span", {
7509
7577
  title: item.name
7510
- }, toDisplayString(item.name || item.id), 9, _hoisted_4$5)
7578
+ }, toDisplayString(item.name || item.id), 9, _hoisted_4$2)
7511
7579
  ])
7512
7580
  ]),
7513
7581
  createVNode(unref(TMagicPopover), {
7514
7582
  "popper-class": "page-bar-popover",
7515
7583
  placement: "top",
7584
+ trigger: "hover",
7516
7585
  width: 160,
7517
- trigger: "hover"
7586
+ "destroy-on-close": true
7518
7587
  }, {
7519
7588
  reference: withCtx(() => [
7520
7589
  createVNode(unref(TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
@@ -7548,7 +7617,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
7548
7617
  ]),
7549
7618
  _: 2
7550
7619
  }, 1024)
7551
- ], 10, _hoisted_2$8);
7620
+ ], 10, _hoisted_2$5);
7552
7621
  }), 128))
7553
7622
  ]),
7554
7623
  _: 3
@@ -7559,9 +7628,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
7559
7628
  });
7560
7629
 
7561
7630
  const _hoisted_1$b = { class: "m-editor-empty-panel" };
7562
- const _hoisted_2$7 = { class: "m-editor-empty-content" };
7563
- const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
7564
- const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面片", -1);
7631
+ const _hoisted_2$4 = { class: "m-editor-empty-content" };
7565
7632
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
7566
7633
  ...{
7567
7634
  name: "MEditorAddPageBox"
@@ -7585,7 +7652,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
7585
7652
  };
7586
7653
  return (_ctx, _cache) => {
7587
7654
  return openBlock(), createElementBlock("div", _hoisted_1$b, [
7588
- createElementVNode("div", _hoisted_2$7, [
7655
+ createElementVNode("div", _hoisted_2$4, [
7589
7656
  createElementVNode("div", {
7590
7657
  class: "m-editor-empty-button",
7591
7658
  onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(unref(NodeType).PAGE))
@@ -7593,7 +7660,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
7593
7660
  createElementVNode("div", null, [
7594
7661
  createVNode(_sfc_main$Y, { icon: unref(Plus) }, null, 8, ["icon"])
7595
7662
  ]),
7596
- _hoisted_3$4
7663
+ _cache[2] || (_cache[2] = createElementVNode("p", null, "新增页面", -1))
7597
7664
  ]),
7598
7665
  !_ctx.disabledPageFragment ? (openBlock(), createElementBlock("div", {
7599
7666
  key: 0,
@@ -7603,7 +7670,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
7603
7670
  createElementVNode("div", null, [
7604
7671
  createVNode(_sfc_main$Y, { icon: unref(Plus) }, null, 8, ["icon"])
7605
7672
  ]),
7606
- _hoisted_4$4
7673
+ _cache[3] || (_cache[3] = createElementVNode("p", null, "新增页面片", -1))
7607
7674
  ])) : createCommentVNode("", true)
7608
7675
  ])
7609
7676
  ]);
@@ -7676,7 +7743,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
7676
7743
  });
7677
7744
  const saveCode = (value) => {
7678
7745
  try {
7679
- const parseDSL = getConfig("parseDSL");
7746
+ const parseDSL = getEditorConfig("parseDSL");
7680
7747
  editorService?.set("root", parseDSL(value));
7681
7748
  } catch (e) {
7682
7749
  console.error(e);
@@ -8083,6 +8150,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8083
8150
  timer && clearTimeout(timer);
8084
8151
  timer = setTimeout(() => {
8085
8152
  emit("search", filterText.value);
8153
+ timer = null;
8086
8154
  }, 300);
8087
8155
  };
8088
8156
  return (_ctx, _cache) => {
@@ -8110,9 +8178,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8110
8178
  });
8111
8179
 
8112
8180
  const _hoisted_1$9 = ["draggable", "data-node-id", "data-parent-id", "data-parents-id", "data-is-container"];
8113
- const _hoisted_2$6 = { class: "tree-node-label" };
8114
- const _hoisted_3$3 = { class: "tree-node-tool" };
8115
- const _hoisted_4$3 = {
8181
+ const _hoisted_2$3 = { class: "tree-node-label" };
8182
+ const _hoisted_3$1 = { class: "tree-node-tool" };
8183
+ const _hoisted_4$1 = {
8116
8184
  key: 0,
8117
8185
  class: "m-editor-tree-node-children"
8118
8186
  };
@@ -8126,7 +8194,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8126
8194
  parent: {},
8127
8195
  parentsId: { default: () => [] },
8128
8196
  nodeStatusMap: {},
8129
- indent: { default: 0 }
8197
+ indent: { default: 0 },
8198
+ nextLevelIndentIncrement: { default: 11 }
8130
8199
  },
8131
8200
  emits: ["node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
8132
8201
  setup(__props, { emit: __emit }) {
@@ -8200,18 +8269,18 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8200
8269
  onClick: nodeClickHandler
8201
8270
  }, [
8202
8271
  renderSlot(_ctx.$slots, "tree-node-content", { data: _ctx.data }, () => [
8203
- createElementVNode("div", _hoisted_2$6, [
8272
+ createElementVNode("div", _hoisted_2$3, [
8204
8273
  renderSlot(_ctx.$slots, "tree-node-label", { data: _ctx.data }, () => [
8205
8274
  createTextVNode(toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1)
8206
8275
  ])
8207
8276
  ]),
8208
- createElementVNode("div", _hoisted_3$3, [
8277
+ createElementVNode("div", _hoisted_3$1, [
8209
8278
  renderSlot(_ctx.$slots, "tree-node-tool", { data: _ctx.data })
8210
8279
  ])
8211
8280
  ])
8212
8281
  ])
8213
8282
  ], 38),
8214
- hasChildren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
8283
+ hasChildren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
8215
8284
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (item) => {
8216
8285
  return openBlock(), createBlock(_component_TreeNode, {
8217
8286
  key: item.id,
@@ -8219,7 +8288,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8219
8288
  parent: _ctx.data,
8220
8289
  parentsId: [..._ctx.parentsId, _ctx.data.id],
8221
8290
  "node-status-map": _ctx.nodeStatusMap,
8222
- indent: _ctx.indent + 11
8291
+ indent: _ctx.indent + _ctx.nextLevelIndentIncrement
8223
8292
  }, {
8224
8293
  "tree-node-content": withCtx(({ data: nodeData }) => [
8225
8294
  renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })
@@ -8254,6 +8323,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8254
8323
  data: {},
8255
8324
  nodeStatusMap: {},
8256
8325
  indent: { default: 0 },
8326
+ nextLevelIndentIncrement: {},
8257
8327
  emptyText: { default: "暂无数据" }
8258
8328
  },
8259
8329
  emits: ["node-dragover", "node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
@@ -8273,6 +8343,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8273
8343
  key: item.id,
8274
8344
  data: item,
8275
8345
  indent: _ctx.indent,
8346
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8276
8347
  "node-status-map": _ctx.nodeStatusMap
8277
8348
  }, {
8278
8349
  "tree-node-content": withCtx(({ data: nodeData }) => [
@@ -8285,7 +8356,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8285
8356
  renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
8286
8357
  ]),
8287
8358
  _: 2
8288
- }, 1032, ["data", "indent", "node-status-map"]);
8359
+ }, 1032, ["data", "indent", "next-level-indent-increment", "node-status-map"]);
8289
8360
  }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$8, [
8290
8361
  createElementVNode("p", null, toDisplayString(_ctx.emptyText), 1)
8291
8362
  ]))
@@ -8294,82 +8365,14 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8294
8365
  }
8295
8366
  });
8296
8367
 
8297
- const useFilter = (nodeData, nodeStatusMap, filterNodeMethod) => {
8298
- const filterIsMatch = (value, data) => {
8299
- const string = !Array.isArray(value) ? [value] : value;
8300
- if (!string.length) {
8301
- return true;
8302
- }
8303
- return string.some((v) => filterNodeMethod(v, data));
8304
- };
8305
- const filter = (text) => {
8306
- if (!nodeData.value.length) return;
8307
- nodeData.value.forEach((node) => {
8308
- traverseNode(node, (node2, parents) => {
8309
- if (!nodeStatusMap.value) return;
8310
- const visible = filterIsMatch(text, node2);
8311
- if (visible && parents.length) {
8312
- parents.forEach((parent) => {
8313
- updateStatus(nodeStatusMap.value, parent.id, {
8314
- visible,
8315
- expand: true
8316
- });
8317
- });
8318
- }
8319
- updateStatus(nodeStatusMap.value, node2.id, {
8320
- visible
8321
- });
8322
- });
8323
- });
8324
- };
8325
- return {
8326
- filterText: ref(""),
8327
- filterTextChangeHandler(text) {
8328
- filter(text);
8329
- }
8330
- };
8331
- };
8332
-
8333
- const createPageNodeStatus$1 = (nodeData, initialLayerNodeStatus) => {
8334
- const map = /* @__PURE__ */ new Map();
8335
- nodeData.forEach(
8336
- (node) => traverseNode(node, (node2) => {
8337
- map.set(
8338
- node2.id,
8339
- initialLayerNodeStatus?.get(node2.id) || {
8340
- visible: true,
8341
- expand: false,
8342
- selected: false,
8343
- draggable: false
8344
- }
8345
- );
8346
- })
8347
- );
8348
- return map;
8349
- };
8350
- const useNodeStatus$1 = (nodeData) => {
8351
- const nodeStatusMap = ref(/* @__PURE__ */ new Map());
8352
- watch(
8353
- nodeData,
8354
- (nodeData2) => {
8355
- nodeStatusMap.value = createPageNodeStatus$1(nodeData2, nodeStatusMap.value);
8356
- },
8357
- {
8358
- immediate: true,
8359
- deep: true
8360
- }
8361
- );
8362
- return {
8363
- nodeStatusMap
8364
- };
8365
- };
8366
-
8367
8368
  const _sfc_main$l = /* @__PURE__ */ defineComponent({
8368
8369
  ...{
8369
8370
  name: "MEditorCodeBlockList"
8370
8371
  },
8371
8372
  __name: "CodeBlockList",
8372
8373
  props: {
8374
+ indent: {},
8375
+ nextLevelIndentIncrement: {},
8373
8376
  customError: { type: Function }
8374
8377
  },
8375
8378
  emits: ["edit", "remove"],
@@ -8463,6 +8466,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8463
8466
  return openBlock(), createBlock(_sfc_main$m, {
8464
8467
  data: codeList.value,
8465
8468
  "node-status-map": unref(nodeStatusMap),
8469
+ indent: _ctx.indent,
8470
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8466
8471
  onNodeClick: clickHandler
8467
8472
  }, {
8468
8473
  "tree-node-label": withCtx(({ data }) => [
@@ -8511,7 +8516,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8511
8516
  })
8512
8517
  ]),
8513
8518
  _: 3
8514
- }, 8, ["data", "node-status-map"]);
8519
+ }, 8, ["data", "node-status-map", "indent", "next-level-indent-increment"]);
8515
8520
  };
8516
8521
  }
8517
8522
  });
@@ -8523,6 +8528,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8523
8528
  },
8524
8529
  __name: "CodeBlockListPanel",
8525
8530
  props: {
8531
+ indent: {},
8532
+ nextLevelIndentIncrement: {},
8526
8533
  customError: { type: Function }
8527
8534
  },
8528
8535
  setup(__props) {
@@ -8551,9 +8558,9 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8551
8558
  size: "small",
8552
8559
  onClick: unref(createCodeBlock)
8553
8560
  }, {
8554
- default: withCtx(() => [
8561
+ default: withCtx(() => _cache[0] || (_cache[0] = [
8555
8562
  createTextVNode("新增")
8556
- ]),
8563
+ ])),
8557
8564
  _: 1
8558
8565
  }, 8, ["onClick"])) : createCommentVNode("", true),
8559
8566
  renderSlot(_ctx.$slots, "code-block-panel-search")
@@ -8563,6 +8570,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8563
8570
  ref_key: "codeBlockList",
8564
8571
  ref: codeBlockList,
8565
8572
  "custom-error": _ctx.customError,
8573
+ indent: _ctx.indent,
8574
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8566
8575
  onEdit: unref(editCode),
8567
8576
  onRemove: unref(deleteCode)
8568
8577
  }, {
@@ -8573,7 +8582,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8573
8582
  })
8574
8583
  ]),
8575
8584
  _: 3
8576
- }, 8, ["custom-error", "onEdit", "onRemove"])
8585
+ }, 8, ["custom-error", "indent", "next-level-indent-increment", "onEdit", "onRemove"])
8577
8586
  ]),
8578
8587
  _: 3
8579
8588
  }),
@@ -8701,6 +8710,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8701
8710
  name: "MEditorDataSourceList"
8702
8711
  },
8703
8712
  __name: "DataSourceList",
8713
+ props: {
8714
+ indent: {},
8715
+ nextLevelIndentIncrement: {}
8716
+ },
8704
8717
  emits: ["edit", "remove"],
8705
8718
  setup(__props, { expose: __expose, emit: __emit }) {
8706
8719
  const emit = __emit;
@@ -8796,6 +8809,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8796
8809
  return openBlock(), createBlock(_sfc_main$m, {
8797
8810
  data: list.value,
8798
8811
  "node-status-map": unref(nodeStatusMap),
8812
+ indent: _ctx.indent,
8813
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8799
8814
  onNodeClick: clickHandler
8800
8815
  }, {
8801
8816
  "tree-node-label": withCtx(({ data }) => [
@@ -8841,18 +8856,21 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8841
8856
  renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
8842
8857
  ]),
8843
8858
  _: 3
8844
- }, 8, ["data", "node-status-map"]);
8859
+ }, 8, ["data", "node-status-map", "indent", "next-level-indent-increment"]);
8845
8860
  };
8846
8861
  }
8847
8862
  });
8848
8863
 
8849
8864
  const _hoisted_1$6 = { class: "search-wrapper" };
8850
- const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
8851
8865
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
8852
8866
  ...{
8853
8867
  name: "MEditorDataSourceListPanel"
8854
8868
  },
8855
8869
  __name: "DataSourceListPanel",
8870
+ props: {
8871
+ indent: {},
8872
+ nextLevelIndentIncrement: {}
8873
+ },
8856
8874
  setup(__props) {
8857
8875
  const eventBus = inject("eventBus");
8858
8876
  const { dataSourceService } = inject("services") || {};
@@ -8896,34 +8914,35 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
8896
8914
  createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
8897
8915
  unref(editable) ? (openBlock(), createBlock(unref(TMagicPopover), {
8898
8916
  key: 0,
8899
- placement: "right"
8917
+ placement: "right",
8918
+ trigger: "hover",
8919
+ "popper-class": "data-source-list-panel-add-menu",
8920
+ "destroy-on-close": true
8900
8921
  }, {
8901
8922
  reference: withCtx(() => [
8902
8923
  createVNode(unref(TMagicButton), {
8903
8924
  type: "primary",
8904
8925
  size: "small"
8905
8926
  }, {
8906
- default: withCtx(() => [
8927
+ default: withCtx(() => _cache[0] || (_cache[0] = [
8907
8928
  createTextVNode("新增")
8908
- ]),
8929
+ ])),
8909
8930
  _: 1
8910
8931
  })
8911
8932
  ]),
8912
8933
  default: withCtx(() => [
8913
- createElementVNode("div", _hoisted_2$5, [
8914
- (openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
8915
- return openBlock(), createBlock(_sfc_main$y, {
8916
- data: {
8917
- type: "button",
8918
- text: item.text,
8919
- handler: () => {
8920
- addHandler(item.type);
8921
- }
8922
- },
8923
- key: index
8924
- }, null, 8, ["data"]);
8925
- }), 128))
8926
- ])
8934
+ (openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
8935
+ return openBlock(), createBlock(_sfc_main$y, {
8936
+ data: {
8937
+ type: "button",
8938
+ text: item.text,
8939
+ handler: () => {
8940
+ addHandler(item.type);
8941
+ }
8942
+ },
8943
+ key: index
8944
+ }, null, 8, ["data"]);
8945
+ }), 128))
8927
8946
  ]),
8928
8947
  _: 1
8929
8948
  })) : createCommentVNode("", true),
@@ -8932,9 +8951,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
8932
8951
  createVNode(_sfc_main$i, {
8933
8952
  ref_key: "dataSourceList",
8934
8953
  ref: dataSourceList,
8954
+ indent: _ctx.indent,
8955
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8935
8956
  onEdit: unref(editHandler),
8936
8957
  onRemove: removeHandler
8937
- }, null, 8, ["onEdit"])
8958
+ }, null, 8, ["indent", "next-level-indent-increment", "onEdit"])
8938
8959
  ]),
8939
8960
  _: 3
8940
8961
  }),
@@ -9124,18 +9145,6 @@ const _hoisted_1$5 = {
9124
9145
  fill: "currentColor",
9125
9146
  xmlns: "http://www.w3.org/2000/svg"
9126
9147
  };
9127
- const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("path", {
9128
- "fill-rule": "evenodd",
9129
- 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"
9130
- }, null, -1);
9131
- const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("path", {
9132
- "fill-rule": "evenodd",
9133
- 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"
9134
- }, null, -1);
9135
- const _hoisted_4$2 = [
9136
- _hoisted_2$4,
9137
- _hoisted_3$2
9138
- ];
9139
9148
  const _sfc_main$f = /* @__PURE__ */ defineComponent({
9140
9149
  ...{
9141
9150
  name: "MEditorFolderMinusIcon"
@@ -9143,7 +9152,16 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
9143
9152
  __name: "FolderMinusIcon",
9144
9153
  setup(__props) {
9145
9154
  return (_ctx, _cache) => {
9146
- return openBlock(), createElementBlock("svg", _hoisted_1$5, _hoisted_4$2);
9155
+ return openBlock(), createElementBlock("svg", _hoisted_1$5, _cache[0] || (_cache[0] = [
9156
+ createElementVNode("path", {
9157
+ "fill-rule": "evenodd",
9158
+ 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"
9159
+ }, null, -1),
9160
+ createElementVNode("path", {
9161
+ "fill-rule": "evenodd",
9162
+ 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"
9163
+ }, null, -1)
9164
+ ]));
9147
9165
  };
9148
9166
  }
9149
9167
  });
@@ -9182,8 +9200,8 @@ const usePasteMenu = (menu) => ({
9182
9200
  const stage = services?.editorService?.get("stage");
9183
9201
  const rect = menu.value.$el.getBoundingClientRect();
9184
9202
  const parentRect = stage?.container?.getBoundingClientRect();
9185
- const initialLeft = calcValueByFontsize(stage?.renderer.getDocument(), (rect.left || 0) - (parentRect?.left || 0)) / services.uiService.get("zoom");
9186
- const initialTop = calcValueByFontsize(stage?.renderer.getDocument(), (rect.top || 0) - (parentRect?.top || 0)) / services.uiService.get("zoom");
9203
+ const initialLeft = calcValueByFontsize(stage?.renderer?.getDocument(), (rect.left || 0) - (parentRect?.left || 0)) / services.uiService.get("zoom");
9204
+ const initialTop = calcValueByFontsize(stage?.renderer?.getDocument(), (rect.top || 0) - (parentRect?.top || 0)) / services.uiService.get("zoom");
9187
9205
  services?.editorService?.paste({ left: initialLeft, top: initialTop });
9188
9206
  } else {
9189
9207
  services?.editorService?.paste();
@@ -9828,6 +9846,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
9828
9846
  __name: "LayerPanel",
9829
9847
  props: {
9830
9848
  layerContentMenu: {},
9849
+ indent: {},
9850
+ nextLevelIndentIncrement: {},
9831
9851
  customContentMenu: { type: Function }
9832
9852
  },
9833
9853
  setup(__props) {
@@ -9877,6 +9897,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
9877
9897
  ref: tree,
9878
9898
  data: nodeData.value,
9879
9899
  "node-status-map": unref(nodeStatusMap),
9900
+ indent: _ctx.indent,
9901
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
9880
9902
  onNodeDragover: unref(handleDragOver),
9881
9903
  onNodeDragstart: unref(handleDragStart),
9882
9904
  onNodeDragleave: unref(handleDragLeave),
@@ -9897,7 +9919,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
9897
9919
  renderSlot(_ctx.$slots, "layer-node-label", { data: nodeData2 })
9898
9920
  ]),
9899
9921
  _: 3
9900
- }, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
9922
+ }, 8, ["data", "node-status-map", "indent", "next-level-indent-increment", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
9901
9923
  (openBlock(), createBlock(Teleport, { to: "body" }, [
9902
9924
  createVNode(_sfc_main$e, {
9903
9925
  ref_key: "menu",
@@ -9915,7 +9937,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
9915
9937
  });
9916
9938
 
9917
9939
  const _hoisted_1$4 = ["onClick", "onDragstart"];
9918
- const _hoisted_2$3 = ["title"];
9940
+ const _hoisted_2$2 = ["title"];
9919
9941
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
9920
9942
  ...{
9921
9943
  name: "MEditorComponentListPanel"
@@ -9966,7 +9988,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
9966
9988
  globalThis.clearTimeout(timeout);
9967
9989
  timeout = void 0;
9968
9990
  }
9969
- const doc = stage.value?.renderer.getDocument();
9991
+ const doc = stage.value?.renderer?.getDocument();
9970
9992
  if (doc && stageOptions?.containerHighlightClassName) {
9971
9993
  removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
9972
9994
  }
@@ -10033,7 +10055,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
10033
10055
  }, 1032, ["disabled", "content"]),
10034
10056
  createElementVNode("span", {
10035
10057
  title: item.text
10036
- }, toDisplayString(item.text), 9, _hoisted_2$3)
10058
+ }, toDisplayString(item.text), 9, _hoisted_2$2)
10037
10059
  ])
10038
10060
  ], 40, _hoisted_1$4);
10039
10061
  }), 128))
@@ -10057,13 +10079,13 @@ const _hoisted_1$3 = {
10057
10079
  key: 0,
10058
10080
  class: "m-editor-sidebar"
10059
10081
  };
10060
- const _hoisted_2$2 = { class: "m-editor-sidebar-header" };
10061
- const _hoisted_3$1 = ["draggable", "onClick", "onDragend"];
10062
- const _hoisted_4$1 = {
10082
+ const _hoisted_2$1 = { class: "m-editor-sidebar-header" };
10083
+ const _hoisted_3 = ["draggable", "onClick", "onDragend"];
10084
+ const _hoisted_4 = {
10063
10085
  key: 1,
10064
10086
  class: "magic-editor-tab-panel-title"
10065
10087
  };
10066
- const _hoisted_5$1 = { class: "m-editor-slide-list-box" };
10088
+ const _hoisted_5 = { class: "m-editor-slide-list-box" };
10067
10089
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
10068
10090
  ...{
10069
10091
  name: "MEditorSidebar"
@@ -10076,13 +10098,30 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10076
10098
  items: [SideItemKey.COMPONENT_LIST, SideItemKey.LAYER, SideItemKey.CODE_BLOCK, SideItemKey.DATA_SOURCE]
10077
10099
  }) },
10078
10100
  layerContentMenu: {},
10101
+ indent: {},
10102
+ nextLevelIndentIncrement: {},
10079
10103
  customContentMenu: {}
10080
10104
  },
10081
10105
  setup(__props, { expose: __expose }) {
10082
10106
  const props = __props;
10083
10107
  const services = inject("services");
10084
10108
  const columnLeftWidth = computed(() => services?.uiService.get("columnWidth")[ColumnLayout.LEFT] || 0);
10085
- const { height: columnLeftHeight } = useEditorContentHeight();
10109
+ const { height: editorContentHeight } = useEditorContentHeight();
10110
+ const columnLeftHeight = ref(0);
10111
+ const unWatchEditorContentHeight = watch(
10112
+ editorContentHeight,
10113
+ (height) => {
10114
+ if (height) {
10115
+ columnLeftHeight.value = height * 0.5;
10116
+ nextTick().then(() => {
10117
+ unWatchEditorContentHeight();
10118
+ });
10119
+ }
10120
+ },
10121
+ {
10122
+ immediate: true
10123
+ }
10124
+ );
10086
10125
  const activeTabName = ref(props.data?.status);
10087
10126
  const getItemConfig = (data) => {
10088
10127
  const map = {
@@ -10101,7 +10140,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10101
10140
  text: "已选组件",
10102
10141
  props: {
10103
10142
  layerContentMenu: props.layerContentMenu,
10104
- customContentMenu: props.customContentMenu
10143
+ customContentMenu: props.customContentMenu,
10144
+ indent: props.indent,
10145
+ nextLevelIndentIncrement: props.nextLevelIndentIncrement
10105
10146
  },
10106
10147
  component: _sfc_main$c,
10107
10148
  slots: {}
@@ -10112,6 +10153,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10112
10153
  icon: EditPen,
10113
10154
  text: "代码编辑",
10114
10155
  component: _sfc_main$k,
10156
+ props: {
10157
+ indent: props.indent,
10158
+ nextLevelIndentIncrement: props.nextLevelIndentIncrement
10159
+ },
10115
10160
  slots: {}
10116
10161
  },
10117
10162
  [SideItemKey.DATA_SOURCE]: {
@@ -10120,6 +10165,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10120
10165
  icon: Coin,
10121
10166
  text: "数据源",
10122
10167
  component: _sfc_main$h,
10168
+ props: {
10169
+ indent: props.indent,
10170
+ nextLevelIndentIncrement: props.nextLevelIndentIncrement
10171
+ },
10123
10172
  slots: {}
10124
10173
  }
10125
10174
  };
@@ -10174,7 +10223,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10174
10223
  return (_ctx, _cache) => {
10175
10224
  return openBlock(), createElementBlock(Fragment, null, [
10176
10225
  _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
10177
- createElementVNode("div", _hoisted_2$2, [
10226
+ createElementVNode("div", _hoisted_2$1, [
10178
10227
  (openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
10179
10228
  return withDirectives((openBlock(), createElementBlock("div", {
10180
10229
  class: normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
@@ -10190,8 +10239,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10190
10239
  key: 0,
10191
10240
  icon: config.icon
10192
10241
  }, null, 8, ["icon"])) : createCommentVNode("", true),
10193
- config.text ? (openBlock(), createElementBlock("div", _hoisted_4$1, toDisplayString(config.text), 1)) : createCommentVNode("", true)
10194
- ], 46, _hoisted_3$1)), [
10242
+ config.text ? (openBlock(), createElementBlock("div", _hoisted_4, toDisplayString(config.text), 1)) : createCommentVNode("", true)
10243
+ ], 46, _hoisted_3)), [
10195
10244
  [vShow, !unref(floatBoxStates)[config.$key]?.status]
10196
10245
  ]);
10197
10246
  }), 128))
@@ -10336,8 +10385,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10336
10385
  key: config.$key ?? index,
10337
10386
  visible: unref(floatBoxStates)[config.$key].status,
10338
10387
  "onUpdate:visible": ($event) => unref(floatBoxStates)[config.$key].status = $event,
10339
- height: unref(columnLeftHeight),
10340
- "onUpdate:height": _cache[1] || (_cache[1] = ($event) => isRef(columnLeftHeight) ? columnLeftHeight.value = $event : null),
10388
+ height: columnLeftHeight.value,
10389
+ "onUpdate:height": _cache[1] || (_cache[1] = ($event) => columnLeftHeight.value = $event),
10341
10390
  width: columnLeftWidth.value,
10342
10391
  title: config.text,
10343
10392
  position: {
@@ -10346,7 +10395,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10346
10395
  }
10347
10396
  }, {
10348
10397
  body: withCtx(() => [
10349
- createElementVNode("div", _hoisted_5$1, [
10398
+ createElementVNode("div", _hoisted_5, [
10350
10399
  config && unref(floatBoxStates)[config.$key].status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({
10351
10400
  key: 0,
10352
10401
  ref_for: true
@@ -10577,7 +10626,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
10577
10626
  if (!stage2) return;
10578
10627
  nextTick(() => unWatch());
10579
10628
  stage2.on("select", (el, event) => {
10580
- const els = stage2.renderer.getElementsFromPoint(event) || [];
10629
+ const els = stage2.renderer?.getElementsFromPoint(event) || [];
10581
10630
  const ids = els.map((el2) => getIdFromEl()(el2)).filter((id) => Boolean(id));
10582
10631
  buttonVisible.value = ids.length > 3;
10583
10632
  filterTextChangeHandler(ids);
@@ -10676,7 +10725,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
10676
10725
  watch(stage, (stage2) => {
10677
10726
  if (stage2) {
10678
10727
  stage2.on("dblclick", async (event) => {
10679
- const el = await stage2.actionManager.getElementFromPoint(event);
10728
+ const el = await stage2.actionManager?.getElementFromPoint(event) || null;
10680
10729
  services?.stageOverlayService.openOverlay(el);
10681
10730
  });
10682
10731
  } else {
@@ -10691,11 +10740,15 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
10691
10740
  subStage.mount(stageOverlay2);
10692
10741
  const { mask, renderer } = subStage;
10693
10742
  const { contentWindow } = renderer;
10694
- mask.showRule(false);
10743
+ mask?.showRule(false);
10695
10744
  services?.stageOverlayService.updateOverlay();
10696
10745
  contentWindow?.magic.onRuntimeReady({});
10697
10746
  }
10698
10747
  });
10748
+ onBeforeUnmount(() => {
10749
+ services?.stageOverlayService.get("stage")?.destroy();
10750
+ services?.stageOverlayService.set("stage", null);
10751
+ });
10699
10752
  const closeOverlayHandler = () => {
10700
10753
  services?.stageOverlayService.closeOverlay();
10701
10754
  };
@@ -10733,32 +10786,6 @@ const _hoisted_1$2 = {
10733
10786
  fill: "none",
10734
10787
  xmlns: "http://www.w3.org/2000/svg"
10735
10788
  };
10736
- const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("path", {
10737
- "fill-rule": "evenodd",
10738
- "clip-rule": "evenodd",
10739
- d: "M2 4H21V6H2V4Z",
10740
- fill: "black",
10741
- "fill-opacity": "0.9"
10742
- }, null, -1);
10743
- const _hoisted_3 = /* @__PURE__ */ createElementVNode("path", {
10744
- "fill-rule": "evenodd",
10745
- "clip-rule": "evenodd",
10746
- d: "M5 11H18V13H5V11Z",
10747
- fill: "black",
10748
- "fill-opacity": "0.9"
10749
- }, null, -1);
10750
- const _hoisted_4 = /* @__PURE__ */ createElementVNode("path", {
10751
- "fill-rule": "evenodd",
10752
- "clip-rule": "evenodd",
10753
- d: "M2 18H21V20H2V18Z",
10754
- fill: "black",
10755
- "fill-opacity": "0.9"
10756
- }, null, -1);
10757
- const _hoisted_5 = [
10758
- _hoisted_2$1,
10759
- _hoisted_3,
10760
- _hoisted_4
10761
- ];
10762
10789
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
10763
10790
  ...{
10764
10791
  name: "MEditorCenterIcon"
@@ -10766,7 +10793,29 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
10766
10793
  __name: "CenterIcon",
10767
10794
  setup(__props) {
10768
10795
  return (_ctx, _cache) => {
10769
- return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_5);
10796
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [
10797
+ createElementVNode("path", {
10798
+ "fill-rule": "evenodd",
10799
+ "clip-rule": "evenodd",
10800
+ d: "M2 4H21V6H2V4Z",
10801
+ fill: "black",
10802
+ "fill-opacity": "0.9"
10803
+ }, null, -1),
10804
+ createElementVNode("path", {
10805
+ "fill-rule": "evenodd",
10806
+ "clip-rule": "evenodd",
10807
+ d: "M5 11H18V13H5V11Z",
10808
+ fill: "black",
10809
+ "fill-opacity": "0.9"
10810
+ }, null, -1),
10811
+ createElementVNode("path", {
10812
+ "fill-rule": "evenodd",
10813
+ "clip-rule": "evenodd",
10814
+ d: "M2 18H21V20H2V18Z",
10815
+ fill: "black",
10816
+ "fill-opacity": "0.9"
10817
+ }, null, -1)
10818
+ ]));
10770
10819
  };
10771
10820
  }
10772
10821
  });
@@ -10947,6 +10996,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
10947
10996
  });
10948
10997
  });
10949
10998
  });
10999
+ onBeforeUnmount(() => {
11000
+ stage?.destroy();
11001
+ });
10950
11002
  watch(zoom, (zoom2) => {
10951
11003
  if (!stage || !zoom2) return;
10952
11004
  stage.setZoom(zoom2);
@@ -10987,7 +11039,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
10987
11039
  services?.keybindingService.unregisterEl("stage");
10988
11040
  services?.editorService.off("root-change", rootChangeHandler);
10989
11041
  });
10990
- const parseDSL = getConfig("parseDSL");
11042
+ const parseDSL = getEditorConfig("parseDSL");
10991
11043
  const contextmenuHandler = (e) => {
10992
11044
  e.preventDefault();
10993
11045
  menu.value?.show(e);
@@ -11004,7 +11056,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
11004
11056
  const config = parseDSL(`(${data})`);
11005
11057
  if (!config || config.dragType !== DragType.COMPONENT_LIST) return;
11006
11058
  e.preventDefault();
11007
- const doc = stage?.renderer.contentWindow?.document;
11059
+ const doc = stage?.renderer?.contentWindow?.document;
11008
11060
  const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
11009
11061
  let parent = page.value;
11010
11062
  const parentId = getIdFromEl()(parentEl);
@@ -11238,7 +11290,7 @@ class CodeBlock extends BaseService {
11238
11290
  if (codeDsl[id] && !force) return;
11239
11291
  const codeConfigProcessed = cloneDeep(codeConfig);
11240
11292
  if (codeConfigProcessed.content) {
11241
- const parseDSL = getConfig("parseDSL");
11293
+ const parseDSL = getEditorConfig("parseDSL");
11242
11294
  if (typeof codeConfigProcessed.content === "string") {
11243
11295
  codeConfigProcessed.content = parseDSL(codeConfigProcessed.content);
11244
11296
  }
@@ -11947,6 +11999,10 @@ class StageOverlay extends BaseService {
11947
11999
  const subStage = this.get("stage");
11948
12000
  const wrapDiv = this.get("wrapDiv");
11949
12001
  subStage?.destroy();
12002
+ for (let i = 0, l = wrapDiv.children.length; i < l; i++) {
12003
+ const child = wrapDiv.children[i];
12004
+ child.remove();
12005
+ }
11950
12006
  wrapDiv.remove();
11951
12007
  this.set("stage", null);
11952
12008
  this.set("sourceEl", null);
@@ -11972,7 +12028,7 @@ class StageOverlay extends BaseService {
11972
12028
  autoScrollIntoView: false,
11973
12029
  render: async (stage) => {
11974
12030
  this.copyDocumentElement();
11975
- const rootEls = stage.renderer.getDocument()?.body.children;
12031
+ const rootEls = stage.renderer?.getDocument()?.body.children;
11976
12032
  if (rootEls) {
11977
12033
  Array.from(rootEls).forEach((element) => {
11978
12034
  if (["SCRIPT", "STYLE"].includes(element.tagName)) {
@@ -12001,8 +12057,8 @@ class StageOverlay extends BaseService {
12001
12057
  copyDocumentElement() {
12002
12058
  const subStage = this.get("stage");
12003
12059
  const stage = editorService.get("stage");
12004
- const doc = subStage?.renderer.getDocument();
12005
- const documentElement = stage?.renderer.getDocument()?.documentElement;
12060
+ const doc = subStage?.renderer?.getDocument();
12061
+ const documentElement = stage?.renderer?.getDocument()?.documentElement;
12006
12062
  if (doc && documentElement) {
12007
12063
  doc.replaceChild(documentElement.cloneNode(true), doc.documentElement);
12008
12064
  }
@@ -12020,12 +12076,13 @@ class StageOverlay extends BaseService {
12020
12076
  height: ${sourceEl?.scrollHeight}px;
12021
12077
  background-color: #fff;
12022
12078
  `;
12023
- Array.from(wrapDiv.children).forEach((element) => {
12024
- element.remove();
12025
- });
12079
+ for (let i = 0, l = wrapDiv.children.length; i < l; i++) {
12080
+ const child = wrapDiv.children[i];
12081
+ child.remove();
12082
+ }
12026
12083
  wrapDiv.appendChild(contentEl);
12027
12084
  setTimeout(() => {
12028
- subStage?.renderer.contentWindow?.magic.onPageElUpdate(wrapDiv);
12085
+ subStage?.renderer?.contentWindow?.magic.onPageElUpdate(wrapDiv);
12029
12086
  });
12030
12087
  if (await stageOptions?.canSelect?.(contentEl)) {
12031
12088
  const id = getIdFromEl()(contentEl);
@@ -12265,7 +12322,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
12265
12322
  };
12266
12323
  const getApp = () => {
12267
12324
  const stage = editorService.get("stage");
12268
- return stage?.renderer.runtime?.getApp?.();
12325
+ return stage?.renderer?.runtime?.getApp?.();
12269
12326
  };
12270
12327
  const updateDataSourceSchema = () => {
12271
12328
  const root = editorService.get("root");
@@ -12298,7 +12355,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
12298
12355
  delete root.dataSourceCondDeps[id];
12299
12356
  }
12300
12357
  };
12301
- const collectedHandler = (nodes, deep) => {
12358
+ const collectedHandler = debounce((nodes, deep) => {
12302
12359
  const root = editorService.get("root");
12303
12360
  const stage = editorService.get("stage");
12304
12361
  if (!root || !stage) return;
@@ -12333,7 +12390,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
12333
12390
  });
12334
12391
  });
12335
12392
  });
12336
- };
12393
+ }, 300);
12337
12394
  depService.on("add-target", targetAddHandler);
12338
12395
  depService.on("remove-target", targetRemoveHandler);
12339
12396
  depService.on("collected", collectedHandler);
@@ -12457,6 +12514,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12457
12514
  disabledPageFragment: { type: Boolean },
12458
12515
  disabledStageOverlay: { type: Boolean },
12459
12516
  disabledShowSrc: { type: Boolean },
12517
+ treeIndent: {},
12518
+ treeNextLevelIndentIncrement: {},
12460
12519
  render: { type: Function },
12461
12520
  updateDragEl: { type: Function },
12462
12521
  canSelect: { type: Function },
@@ -12533,7 +12592,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12533
12592
  createVNode(_sfc_main$a, {
12534
12593
  data: _ctx.sidebar,
12535
12594
  "layer-content-menu": _ctx.layerContentMenu,
12536
- "custom-content-menu": _ctx.customContentMenu
12595
+ "custom-content-menu": _ctx.customContentMenu,
12596
+ indent: _ctx.treeIndent,
12597
+ "next-level-indent-increment": _ctx.treeNextLevelIndentIncrement
12537
12598
  }, {
12538
12599
  "layer-panel-header": withCtx(() => [
12539
12600
  renderSlot(_ctx.$slots, "layer-panel-header")
@@ -12575,7 +12636,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12575
12636
  renderSlot(_ctx.$slots, "data-source-panel-search")
12576
12637
  ]),
12577
12638
  _: 3
12578
- }, 8, ["data", "layer-content-menu", "custom-content-menu"])
12639
+ }, 8, ["data", "layer-content-menu", "custom-content-menu", "indent", "next-level-indent-increment"])
12579
12640
  ])
12580
12641
  ]),
12581
12642
  workspace: withCtx(() => [
@@ -12645,8 +12706,11 @@ const defaultInstallOpt = {
12645
12706
  const index = {
12646
12707
  install: (app, opt) => {
12647
12708
  const option = Object.assign(defaultInstallOpt, opt || {});
12709
+ app.use(designPlugin__default, opt || {});
12710
+ app.use(formPlugin__default, opt || {});
12711
+ app.use(tablePlugin__default);
12648
12712
  app.config.globalProperties.$TMAGIC_EDITOR = option;
12649
- setConfig(option);
12713
+ setEditorConfig(option);
12650
12714
  app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
12651
12715
  app.component("magic-code-editor", _sfc_main$X);
12652
12716
  app.component("m-fields-ui-select", _sfc_main$B);
@@ -12669,4 +12733,4 @@ const index = {
12669
12733
  }
12670
12734
  };
12671
12735
 
12672
- export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$L as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$U as CodeSelect, _sfc_main$S as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$R as CondOpSelect, _sfc_main$g as ContentMenu, _sfc_main$j as DataSourceConfigPanel, _sfc_main$N as DataSourceFieldSelect, _sfc_main$P as DataSourceFields, _sfc_main$M as DataSourceInput, _sfc_main$J as DataSourceMethodSelect, _sfc_main$K as DataSourceMethods, _sfc_main$I as DataSourceMocks, _sfc_main$H as DataSourceSelect, _sfc_main$G as DisplayConds, DragType, _sfc_main$F as EventSelect, Fixed2Other, _sfc_main$Q as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$Y as Icon, IdleTask, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$p as PropsPanel, _sfc_main$A as Resizer, ScrollViewer, SideItemKey, _sfc_main$z as SplitView, _sfc_main$X as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, eqOptions, error, eventTabConfig, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, moveItemsInContainer, numberOptions, propsService, removeDataSourceFieldPrefix, serializeConfig, setChildrenLayout, setConfig, setLayout, stageOverlayService, storageService, styleTabConfig, traverseNode, uiService, updateStatus, useCodeBlockEdit, useDataSourceMethod, useEditorContentHeight, useFloatBox, useStage, useWindowRect, warn };
12736
+ export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$L as CodeBlockEditor, _sfc_main$l as CodeBlockList, _sfc_main$k as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$U as CodeSelect, _sfc_main$S as CodeSelectCol, ColumnLayout, _sfc_main$b as ComponentListPanel, _sfc_main$R as CondOpSelect, _sfc_main$g as ContentMenu, _sfc_main$j as DataSourceConfigPanel, _sfc_main$N as DataSourceFieldSelect, _sfc_main$P as DataSourceFields, _sfc_main$M as DataSourceInput, _sfc_main$J as DataSourceMethodSelect, _sfc_main$K as DataSourceMethods, _sfc_main$I as DataSourceMocks, _sfc_main$H as DataSourceSelect, _sfc_main$G as DisplayConds, DragType, _sfc_main$F as EventSelect, Fixed2Other, _sfc_main$Q as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$Y as Icon, IdleTask, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$c as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$C as PageFragmentSelect, _sfc_main$p as PropsPanel, _sfc_main$A as Resizer, ScrollViewer, SideItemKey, _sfc_main$z as SplitView, _sfc_main$X as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$y as ToolButton, _sfc_main$m as Tree, _sfc_main$n as TreeNode, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, eqOptions, error, eventTabConfig, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getDefaultConfig, getDisplayField, getEditorConfig, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, log, moveItemsInContainer, numberOptions, propsService, removeDataSourceFieldPrefix, serializeConfig, setChildrenLayout, setEditorConfig, setLayout, stageOverlayService, storageService, styleTabConfig, uiService, updateStatus, useCodeBlockEdit, useDataSourceMethod, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus$1 as useNodeStatus, useStage, useWindowRect, warn };