@tmagic/editor 1.5.0-beta.4 → 1.5.0-beta.5

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 (76) hide show
  1. package/dist/style.css +274 -2
  2. package/dist/tmagic-editor.js +103 -46
  3. package/dist/tmagic-editor.umd.cjs +325 -242
  4. package/package.json +7 -9
  5. package/src/Editor.vue +8 -2
  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 +5 -2
  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 +1 -1
  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 +2 -2
  24. package/src/fields/PageFragmentSelect.vue +1 -1
  25. package/src/fields/UISelect.vue +1 -1
  26. package/src/hooks/use-code-block-edit.ts +1 -1
  27. package/src/hooks/use-data-source-edit.ts +1 -1
  28. package/src/hooks/use-data-source-method.ts +3 -3
  29. package/src/hooks/use-filter.ts +1 -1
  30. package/src/hooks/use-node-status.ts +1 -1
  31. package/src/hooks/use-stage.ts +2 -6
  32. package/src/index.ts +27 -7
  33. package/src/initService.ts +11 -3
  34. package/src/layouts/AddPageBox.vue +1 -1
  35. package/src/layouts/CodeEditor.vue +5 -5
  36. package/src/layouts/Framework.vue +2 -2
  37. package/src/layouts/NavMenu.vue +1 -1
  38. package/src/layouts/PropsPanel.vue +1 -1
  39. package/src/layouts/page-bar/AddButton.vue +1 -1
  40. package/src/layouts/page-bar/PageBar.vue +1 -1
  41. package/src/layouts/page-bar/PageBarScrollContainer.vue +1 -1
  42. package/src/layouts/page-bar/PageList.vue +1 -1
  43. package/src/layouts/page-bar/SwitchTypeButton.vue +1 -1
  44. package/src/layouts/sidebar/Sidebar.vue +12 -0
  45. package/src/layouts/sidebar/code-block/CodeBlockList.vue +11 -3
  46. package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +11 -2
  47. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +1 -1
  48. package/src/layouts/sidebar/data-source/DataSourceList.vue +13 -3
  49. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +12 -1
  50. package/src/layouts/sidebar/layer/LayerNodeTool.vue +1 -1
  51. package/src/layouts/sidebar/layer/LayerPanel.vue +5 -1
  52. package/src/layouts/sidebar/layer/use-click.ts +1 -1
  53. package/src/layouts/sidebar/layer/use-drag.ts +1 -1
  54. package/src/layouts/sidebar/layer/use-node-status.ts +1 -1
  55. package/src/layouts/workspace/Breadcrumb.vue +1 -1
  56. package/src/layouts/workspace/viewer/NodeListMenu.vue +1 -1
  57. package/src/layouts/workspace/viewer/Stage.vue +7 -3
  58. package/src/layouts/workspace/viewer/StageOverlay.vue +6 -1
  59. package/src/layouts/workspace/viewer/ViewerMenu.vue +1 -1
  60. package/src/services/codeBlock.ts +7 -7
  61. package/src/services/dataSource.ts +3 -4
  62. package/src/services/dep.ts +2 -2
  63. package/src/services/editor.ts +7 -8
  64. package/src/services/history.ts +1 -1
  65. package/src/services/props.ts +3 -3
  66. package/src/services/storage.ts +2 -2
  67. package/src/theme/index.scss +3 -0
  68. package/src/type.ts +13 -10
  69. package/src/utils/config.ts +5 -5
  70. package/src/utils/content-menu.ts +1 -1
  71. package/src/utils/data-source/index.ts +1 -1
  72. package/src/utils/editor.ts +2 -8
  73. package/src/utils/operator.ts +2 -1
  74. package/src/utils/props.ts +1 -1
  75. package/src/utils/tree.ts +1 -1
  76. package/types/index.d.ts +53 -29
@@ -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
12
  import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys } 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';
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';
11
18
  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';
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}`);
@@ -1706,7 +1712,7 @@ class WebStorage extends BaseService {
1706
1712
  if (item === null) return null;
1707
1713
  switch (protocol) {
1708
1714
  case "object" /* OBJECT */:
1709
- return getConfig("parseDSL")(`(${item})`);
1715
+ return getEditorConfig("parseDSL")(`(${item})`);
1710
1716
  case "json" /* JSON */:
1711
1717
  return JSON.parse(item);
1712
1718
  case "number" /* NUMBER */:
@@ -1918,7 +1924,7 @@ class Editor extends BaseService {
1918
1924
  * 只有容器拥有布局
1919
1925
  */
1920
1926
  async getLayout(parent, node) {
1921
- if (node && typeof node !== "function" && isFixed(node)) return Layout.FIXED;
1927
+ if (node && typeof node !== "function" && isFixed(node.style || {})) return Layout.FIXED;
1922
1928
  if (parent.layout) {
1923
1929
  return parent.layout;
1924
1930
  }
@@ -2586,9 +2592,9 @@ class Editor extends BaseService {
2586
2592
  async toggleFixedPosition(dist, src, root) {
2587
2593
  const newConfig = cloneDeep(dist);
2588
2594
  if (!isPop(src) && newConfig.style?.position) {
2589
- if (isFixed(newConfig) && !isFixed(src)) {
2595
+ if (isFixed(newConfig.style) && !isFixed(src.style || {})) {
2590
2596
  newConfig.style = change2Fixed(newConfig, root);
2591
- } else if (!isFixed(newConfig) && isFixed(src)) {
2597
+ } else if (!isFixed(newConfig.style) && isFixed(src.style || {})) {
2592
2598
  newConfig.style = await Fixed2Other(newConfig, root, this.getLayout);
2593
2599
  }
2594
2600
  }
@@ -3370,7 +3376,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
3370
3376
  const emit = __emit;
3371
3377
  const { dataSourceService } = inject("services") || {};
3372
3378
  const props = __props;
3373
- const optionComponent = getConfig$1("components")?.option;
3379
+ const optionComponent = getDesignConfig("components")?.option;
3374
3380
  const options = computed(() => {
3375
3381
  const [id, ...fieldNames] = [...props.config.parentFields || [], ...props.model.field];
3376
3382
  const ds = dataSourceService?.getDataSourceById(id);
@@ -3721,7 +3727,7 @@ const useDataSourceMethod = () => {
3721
3727
  dataSource.value.methods = [];
3722
3728
  }
3723
3729
  if (values.content) {
3724
- const parseDSL = getConfig("parseDSL");
3730
+ const parseDSL = getEditorConfig("parseDSL");
3725
3731
  if (typeof values.content === "string") {
3726
3732
  values.content = parseDSL(values.content);
3727
3733
  }
@@ -3849,7 +3855,7 @@ const zoom = computed(() => uiService.get("zoom") || 1);
3849
3855
  const uiSelectMode = computed(() => uiService.get("uiSelectMode"));
3850
3856
  const getGuideLineKey = (key) => `${key}_${root.value?.id}_${page.value?.id}`;
3851
3857
  const useStage = (stageOptions) => {
3852
- const stage = new StageCore({
3858
+ const stage = new StageCore__default({
3853
3859
  render: stageOptions.render,
3854
3860
  runtimeUrl: stageOptions.runtimeUrl,
3855
3861
  zoom: stageOptions.zoom ?? zoom.value,
@@ -3940,9 +3946,6 @@ const useStage = (stageOptions) => {
3940
3946
  globalThis.localStorage.removeItem(storageKey);
3941
3947
  }
3942
3948
  });
3943
- onBeforeUnmount(() => {
3944
- stage.destroy();
3945
- });
3946
3949
  return stage;
3947
3950
  };
3948
3951
 
@@ -4537,7 +4540,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
4537
4540
  const props = __props;
4538
4541
  const emit = __emit;
4539
4542
  const modelValue = useModel(__props, "modelValue");
4540
- const optionComponent = getConfig$1("components")?.option;
4543
+ const optionComponent = getDesignConfig("components")?.option;
4541
4544
  const services = inject("services");
4542
4545
  const mForm = inject("mForm");
4543
4546
  const eventBus = inject("eventBus");
@@ -5011,7 +5014,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
5011
5014
  changeHandler(state.value);
5012
5015
  };
5013
5016
  return (_ctx, _cache) => {
5014
- return _ctx.disabled || isFocused.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(getConfig$1)("components")?.autocomplete.component || "el-autocomplete"), mergeProps(
5017
+ return _ctx.disabled || isFocused.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(getDesignConfig)("components")?.autocomplete.component || "el-autocomplete"), mergeProps(
5015
5018
  {
5016
5019
  key: 0,
5017
5020
  class: "tmagic-design-auto-complete",
@@ -5020,7 +5023,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
5020
5023
  modelValue: state.value,
5021
5024
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.value = $event)
5022
5025
  },
5023
- unref(getConfig$1)("components")?.autocomplete.props({
5026
+ unref(getDesignConfig)("components")?.autocomplete.props({
5024
5027
  disabled: _ctx.disabled,
5025
5028
  size: _ctx.size,
5026
5029
  fetchSuggestions: querySearch,
@@ -5204,7 +5207,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
5204
5207
  height: "500px",
5205
5208
  onChange: (formState, code) => {
5206
5209
  try {
5207
- getConfig("parseDSL")(code);
5210
+ getEditorConfig("parseDSL")(code);
5208
5211
  return code;
5209
5212
  } catch (error) {
5210
5213
  tMagicMessage.error(error.message);
@@ -7754,7 +7757,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
7754
7757
  });
7755
7758
  const saveCode = (value) => {
7756
7759
  try {
7757
- const parseDSL = getConfig("parseDSL");
7760
+ const parseDSL = getEditorConfig("parseDSL");
7758
7761
  editorService?.set("root", parseDSL(value));
7759
7762
  } catch (e) {
7760
7763
  console.error(e);
@@ -8161,6 +8164,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
8161
8164
  timer && clearTimeout(timer);
8162
8165
  timer = setTimeout(() => {
8163
8166
  emit("search", filterText.value);
8167
+ timer = null;
8164
8168
  }, 300);
8165
8169
  };
8166
8170
  return (_ctx, _cache) => {
@@ -8204,7 +8208,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8204
8208
  parent: {},
8205
8209
  parentsId: { default: () => [] },
8206
8210
  nodeStatusMap: {},
8207
- indent: { default: 0 }
8211
+ indent: { default: 0 },
8212
+ nextLevelIndentIncrement: { default: 11 }
8208
8213
  },
8209
8214
  emits: ["node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
8210
8215
  setup(__props, { emit: __emit }) {
@@ -8297,7 +8302,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8297
8302
  parent: _ctx.data,
8298
8303
  parentsId: [..._ctx.parentsId, _ctx.data.id],
8299
8304
  "node-status-map": _ctx.nodeStatusMap,
8300
- indent: _ctx.indent + 11
8305
+ indent: _ctx.indent + _ctx.nextLevelIndentIncrement
8301
8306
  }, {
8302
8307
  "tree-node-content": withCtx(({ data: nodeData }) => [
8303
8308
  renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })
@@ -8332,6 +8337,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8332
8337
  data: {},
8333
8338
  nodeStatusMap: {},
8334
8339
  indent: { default: 0 },
8340
+ nextLevelIndentIncrement: {},
8335
8341
  emptyText: { default: "暂无数据" }
8336
8342
  },
8337
8343
  emits: ["node-dragover", "node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
@@ -8351,6 +8357,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8351
8357
  key: item.id,
8352
8358
  data: item,
8353
8359
  indent: _ctx.indent,
8360
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8354
8361
  "node-status-map": _ctx.nodeStatusMap
8355
8362
  }, {
8356
8363
  "tree-node-content": withCtx(({ data: nodeData }) => [
@@ -8363,7 +8370,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8363
8370
  renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
8364
8371
  ]),
8365
8372
  _: 2
8366
- }, 1032, ["data", "indent", "node-status-map"]);
8373
+ }, 1032, ["data", "indent", "next-level-indent-increment", "node-status-map"]);
8367
8374
  }), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$8, [
8368
8375
  createElementVNode("p", null, toDisplayString(_ctx.emptyText), 1)
8369
8376
  ]))
@@ -8378,6 +8385,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8378
8385
  },
8379
8386
  __name: "CodeBlockList",
8380
8387
  props: {
8388
+ indent: {},
8389
+ nextLevelIndentIncrement: {},
8381
8390
  customError: { type: Function }
8382
8391
  },
8383
8392
  emits: ["edit", "remove"],
@@ -8471,6 +8480,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8471
8480
  return openBlock(), createBlock(_sfc_main$m, {
8472
8481
  data: codeList.value,
8473
8482
  "node-status-map": unref(nodeStatusMap),
8483
+ indent: _ctx.indent,
8484
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8474
8485
  onNodeClick: clickHandler
8475
8486
  }, {
8476
8487
  "tree-node-label": withCtx(({ data }) => [
@@ -8519,7 +8530,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8519
8530
  })
8520
8531
  ]),
8521
8532
  _: 3
8522
- }, 8, ["data", "node-status-map"]);
8533
+ }, 8, ["data", "node-status-map", "indent", "next-level-indent-increment"]);
8523
8534
  };
8524
8535
  }
8525
8536
  });
@@ -8531,6 +8542,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8531
8542
  },
8532
8543
  __name: "CodeBlockListPanel",
8533
8544
  props: {
8545
+ indent: {},
8546
+ nextLevelIndentIncrement: {},
8534
8547
  customError: { type: Function }
8535
8548
  },
8536
8549
  setup(__props) {
@@ -8571,6 +8584,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8571
8584
  ref_key: "codeBlockList",
8572
8585
  ref: codeBlockList,
8573
8586
  "custom-error": _ctx.customError,
8587
+ indent: _ctx.indent,
8588
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8574
8589
  onEdit: unref(editCode),
8575
8590
  onRemove: unref(deleteCode)
8576
8591
  }, {
@@ -8581,7 +8596,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8581
8596
  })
8582
8597
  ]),
8583
8598
  _: 3
8584
- }, 8, ["custom-error", "onEdit", "onRemove"])
8599
+ }, 8, ["custom-error", "indent", "next-level-indent-increment", "onEdit", "onRemove"])
8585
8600
  ]),
8586
8601
  _: 3
8587
8602
  }),
@@ -8709,6 +8724,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8709
8724
  name: "MEditorDataSourceList"
8710
8725
  },
8711
8726
  __name: "DataSourceList",
8727
+ props: {
8728
+ indent: {},
8729
+ nextLevelIndentIncrement: {}
8730
+ },
8712
8731
  emits: ["edit", "remove"],
8713
8732
  setup(__props, { expose: __expose, emit: __emit }) {
8714
8733
  const emit = __emit;
@@ -8804,6 +8823,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8804
8823
  return openBlock(), createBlock(_sfc_main$m, {
8805
8824
  data: list.value,
8806
8825
  "node-status-map": unref(nodeStatusMap),
8826
+ indent: _ctx.indent,
8827
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8807
8828
  onNodeClick: clickHandler
8808
8829
  }, {
8809
8830
  "tree-node-label": withCtx(({ data }) => [
@@ -8849,7 +8870,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
8849
8870
  renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
8850
8871
  ]),
8851
8872
  _: 3
8852
- }, 8, ["data", "node-status-map"]);
8873
+ }, 8, ["data", "node-status-map", "indent", "next-level-indent-increment"]);
8853
8874
  };
8854
8875
  }
8855
8876
  });
@@ -8860,6 +8881,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
8860
8881
  name: "MEditorDataSourceListPanel"
8861
8882
  },
8862
8883
  __name: "DataSourceListPanel",
8884
+ props: {
8885
+ indent: {},
8886
+ nextLevelIndentIncrement: {}
8887
+ },
8863
8888
  setup(__props) {
8864
8889
  const eventBus = inject("eventBus");
8865
8890
  const { dataSourceService } = inject("services") || {};
@@ -8940,9 +8965,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
8940
8965
  createVNode(_sfc_main$i, {
8941
8966
  ref_key: "dataSourceList",
8942
8967
  ref: dataSourceList,
8968
+ indent: _ctx.indent,
8969
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
8943
8970
  onEdit: unref(editHandler),
8944
8971
  onRemove: removeHandler
8945
- }, null, 8, ["onEdit"])
8972
+ }, null, 8, ["indent", "next-level-indent-increment", "onEdit"])
8946
8973
  ]),
8947
8974
  _: 3
8948
8975
  }),
@@ -9836,6 +9863,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
9836
9863
  __name: "LayerPanel",
9837
9864
  props: {
9838
9865
  layerContentMenu: {},
9866
+ indent: {},
9867
+ nextLevelIndentIncrement: {},
9839
9868
  customContentMenu: { type: Function }
9840
9869
  },
9841
9870
  setup(__props) {
@@ -9885,6 +9914,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
9885
9914
  ref: tree,
9886
9915
  data: nodeData.value,
9887
9916
  "node-status-map": unref(nodeStatusMap),
9917
+ indent: _ctx.indent,
9918
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
9888
9919
  onNodeDragover: unref(handleDragOver),
9889
9920
  onNodeDragstart: unref(handleDragStart),
9890
9921
  onNodeDragleave: unref(handleDragLeave),
@@ -9905,7 +9936,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
9905
9936
  renderSlot(_ctx.$slots, "layer-node-label", { data: nodeData2 })
9906
9937
  ]),
9907
9938
  _: 3
9908
- }, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
9939
+ }, 8, ["data", "node-status-map", "indent", "next-level-indent-increment", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
9909
9940
  (openBlock(), createBlock(Teleport, { to: "body" }, [
9910
9941
  createVNode(_sfc_main$e, {
9911
9942
  ref_key: "menu",
@@ -10084,6 +10115,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10084
10115
  items: [SideItemKey.COMPONENT_LIST, SideItemKey.LAYER, SideItemKey.CODE_BLOCK, SideItemKey.DATA_SOURCE]
10085
10116
  }) },
10086
10117
  layerContentMenu: {},
10118
+ indent: {},
10119
+ nextLevelIndentIncrement: {},
10087
10120
  customContentMenu: {}
10088
10121
  },
10089
10122
  setup(__props, { expose: __expose }) {
@@ -10124,7 +10157,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10124
10157
  text: "已选组件",
10125
10158
  props: {
10126
10159
  layerContentMenu: props.layerContentMenu,
10127
- customContentMenu: props.customContentMenu
10160
+ customContentMenu: props.customContentMenu,
10161
+ indent: props.indent,
10162
+ nextLevelIndentIncrement: props.nextLevelIndentIncrement
10128
10163
  },
10129
10164
  component: _sfc_main$c,
10130
10165
  slots: {}
@@ -10135,6 +10170,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10135
10170
  icon: EditPen,
10136
10171
  text: "代码编辑",
10137
10172
  component: _sfc_main$k,
10173
+ props: {
10174
+ indent: props.indent,
10175
+ nextLevelIndentIncrement: props.nextLevelIndentIncrement
10176
+ },
10138
10177
  slots: {}
10139
10178
  },
10140
10179
  [SideItemKey.DATA_SOURCE]: {
@@ -10143,6 +10182,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10143
10182
  icon: Coin,
10144
10183
  text: "数据源",
10145
10184
  component: _sfc_main$h,
10185
+ props: {
10186
+ indent: props.indent,
10187
+ nextLevelIndentIncrement: props.nextLevelIndentIncrement
10188
+ },
10146
10189
  slots: {}
10147
10190
  }
10148
10191
  };
@@ -10719,6 +10762,10 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
10719
10762
  contentWindow?.magic.onRuntimeReady({});
10720
10763
  }
10721
10764
  });
10765
+ onBeforeUnmount(() => {
10766
+ services?.stageOverlayService.get("stage")?.destroy();
10767
+ services?.stageOverlayService.set("stage", null);
10768
+ });
10722
10769
  const closeOverlayHandler = () => {
10723
10770
  services?.stageOverlayService.closeOverlay();
10724
10771
  };
@@ -10970,6 +11017,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
10970
11017
  });
10971
11018
  });
10972
11019
  });
11020
+ onBeforeUnmount(() => {
11021
+ stage?.destroy();
11022
+ });
10973
11023
  watch(zoom, (zoom2) => {
10974
11024
  if (!stage || !zoom2) return;
10975
11025
  stage.setZoom(zoom2);
@@ -11010,7 +11060,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
11010
11060
  services?.keybindingService.unregisterEl("stage");
11011
11061
  services?.editorService.off("root-change", rootChangeHandler);
11012
11062
  });
11013
- const parseDSL = getConfig("parseDSL");
11063
+ const parseDSL = getEditorConfig("parseDSL");
11014
11064
  const contextmenuHandler = (e) => {
11015
11065
  e.preventDefault();
11016
11066
  menu.value?.show(e);
@@ -11261,7 +11311,7 @@ class CodeBlock extends BaseService {
11261
11311
  if (codeDsl[id] && !force) return;
11262
11312
  const codeConfigProcessed = cloneDeep(codeConfig);
11263
11313
  if (codeConfigProcessed.content) {
11264
- const parseDSL = getConfig("parseDSL");
11314
+ const parseDSL = getEditorConfig("parseDSL");
11265
11315
  if (typeof codeConfigProcessed.content === "string") {
11266
11316
  codeConfigProcessed.content = parseDSL(codeConfigProcessed.content);
11267
11317
  }
@@ -12485,6 +12535,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12485
12535
  disabledPageFragment: { type: Boolean },
12486
12536
  disabledStageOverlay: { type: Boolean },
12487
12537
  disabledShowSrc: { type: Boolean },
12538
+ indent: {},
12539
+ nextLevelIndentIncrement: {},
12488
12540
  render: { type: Function },
12489
12541
  updateDragEl: { type: Function },
12490
12542
  canSelect: { type: Function },
@@ -12561,7 +12613,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12561
12613
  createVNode(_sfc_main$a, {
12562
12614
  data: _ctx.sidebar,
12563
12615
  "layer-content-menu": _ctx.layerContentMenu,
12564
- "custom-content-menu": _ctx.customContentMenu
12616
+ "custom-content-menu": _ctx.customContentMenu,
12617
+ indent: _ctx.indent,
12618
+ "next-level-indent-increment": _ctx.nextLevelIndentIncrement
12565
12619
  }, {
12566
12620
  "layer-panel-header": withCtx(() => [
12567
12621
  renderSlot(_ctx.$slots, "layer-panel-header")
@@ -12603,7 +12657,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12603
12657
  renderSlot(_ctx.$slots, "data-source-panel-search")
12604
12658
  ]),
12605
12659
  _: 3
12606
- }, 8, ["data", "layer-content-menu", "custom-content-menu"])
12660
+ }, 8, ["data", "layer-content-menu", "custom-content-menu", "indent", "next-level-indent-increment"])
12607
12661
  ])
12608
12662
  ]),
12609
12663
  workspace: withCtx(() => [
@@ -12673,8 +12727,11 @@ const defaultInstallOpt = {
12673
12727
  const index = {
12674
12728
  install: (app, opt) => {
12675
12729
  const option = Object.assign(defaultInstallOpt, opt || {});
12730
+ app.use(designPlugin__default, opt || {});
12731
+ app.use(formPlugin__default, opt || {});
12732
+ app.use(tablePlugin__default);
12676
12733
  app.config.globalProperties.$TMAGIC_EDITOR = option;
12677
- setConfig(option);
12734
+ setEditorConfig(option);
12678
12735
  app.component(`${_sfc_main.name || "MEditor"}`, _sfc_main);
12679
12736
  app.component("magic-code-editor", _sfc_main$X);
12680
12737
  app.component("m-fields-ui-select", _sfc_main$B);
@@ -12697,4 +12754,4 @@ const index = {
12697
12754
  }
12698
12755
  };
12699
12756
 
12700
- 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, 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, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus$1 as useNodeStatus, useStage, useWindowRect, warn };
12757
+ 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, traverseNode, uiService, updateStatus, useCodeBlockEdit, useDataSourceMethod, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus$1 as useNodeStatus, useStage, useWindowRect, warn };