@tmagic/editor 1.2.0-beta.1 → 1.2.0-beta.11

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 +14 -8
  2. package/dist/tmagic-editor.mjs +1112 -981
  3. package/dist/tmagic-editor.mjs.map +1 -1
  4. package/dist/tmagic-editor.umd.js +1124 -991
  5. package/dist/tmagic-editor.umd.js.map +1 -1
  6. package/package.json +11 -10
  7. package/src/Editor.vue +11 -13
  8. package/src/components/ContentMenu.vue +4 -4
  9. package/src/components/Icon.vue +7 -5
  10. package/src/{layouts → components}/Layout.vue +14 -4
  11. package/src/components/ScrollBar.vue +1 -1
  12. package/src/components/ScrollViewer.vue +10 -1
  13. package/src/components/ToolButton.vue +30 -15
  14. package/src/fields/Code.vue +5 -2
  15. package/src/fields/CodeLink.vue +20 -12
  16. package/src/fields/CodeSelect.vue +19 -27
  17. package/src/fields/UISelect.vue +9 -8
  18. package/src/index.ts +3 -1
  19. package/src/layouts/AddPageBox.vue +13 -20
  20. package/src/layouts/CodeEditor.vue +106 -120
  21. package/src/layouts/Framework.vue +62 -40
  22. package/src/layouts/NavMenu.vue +1 -1
  23. package/src/layouts/PropsPanel.vue +4 -9
  24. package/src/layouts/Resizer.vue +1 -1
  25. package/src/layouts/sidebar/ComponentListPanel.vue +15 -13
  26. package/src/layouts/sidebar/LayerMenu.vue +89 -92
  27. package/src/layouts/sidebar/LayerPanel.vue +273 -178
  28. package/src/layouts/sidebar/Sidebar.vue +126 -46
  29. package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +28 -24
  30. package/src/layouts/sidebar/code-block/CodeBlockList.vue +22 -22
  31. package/src/layouts/workspace/Breadcrumb.vue +32 -0
  32. package/src/layouts/workspace/PageBar.vue +12 -11
  33. package/src/layouts/workspace/PageBarScrollContainer.vue +1 -1
  34. package/src/layouts/workspace/Stage.vue +15 -7
  35. package/src/layouts/workspace/ViewerMenu.vue +8 -7
  36. package/src/layouts/workspace/Workspace.vue +10 -3
  37. package/src/services/codeBlock.ts +16 -10
  38. package/src/services/editor.ts +12 -8
  39. package/src/theme/breadcrumb.scss +6 -0
  40. package/src/theme/component-list-panel.scss +3 -7
  41. package/src/theme/index.scss +1 -15
  42. package/src/theme/layer-panel.scss +7 -2
  43. package/src/theme/theme.scss +16 -0
  44. package/src/type.ts +2 -1
  45. package/src/utils/scroll-viewer.ts +18 -2
  46. package/src/utils/stage.ts +7 -0
  47. package/types/Editor.vue.d.ts +2 -2
  48. package/types/components/ContentMenu.vue.d.ts +1 -3
  49. package/types/components/Icon.vue.d.ts +1 -3
  50. package/types/{layouts → components}/Layout.vue.d.ts +0 -0
  51. package/types/components/ScrollBar.vue.d.ts +1 -3
  52. package/types/components/ScrollViewer.vue.d.ts +45 -1
  53. package/types/components/ToolButton.vue.d.ts +1 -3
  54. package/types/fields/Code.vue.d.ts +9 -3
  55. package/types/fields/CodeLink.vue.d.ts +5 -3
  56. package/types/fields/CodeSelect.vue.d.ts +1 -3
  57. package/types/fields/UISelect.vue.d.ts +1 -3
  58. package/types/index.d.ts +2 -0
  59. package/types/layouts/AddPageBox.vue.d.ts +43 -3
  60. package/types/layouts/CodeEditor.vue.d.ts +158 -45
  61. package/types/layouts/NavMenu.vue.d.ts +1 -3
  62. package/types/layouts/sidebar/LayerMenu.vue.d.ts +31 -63
  63. package/types/layouts/sidebar/LayerPanel.vue.d.ts +38 -1074
  64. package/types/layouts/sidebar/Sidebar.vue.d.ts +119 -17
  65. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +1 -0
  66. package/types/layouts/workspace/Breadcrumb.vue.d.ts +44 -0
  67. package/types/layouts/workspace/Stage.vue.d.ts +23 -7
  68. package/types/layouts/workspace/ViewerMenu.vue.d.ts +6 -3
  69. package/types/layouts/workspace/Workspace.vue.d.ts +23 -5
  70. package/types/services/codeBlock.d.ts +1 -1
  71. package/types/services/editor.d.ts +2 -2
  72. package/types/services/ui.d.ts +1 -1
  73. package/types/type.d.ts +2 -1
  74. package/types/utils/scroll-viewer.d.ts +5 -0
  75. package/src/layouts/sidebar/TabPane.vue +0 -126
  76. package/types/layouts/sidebar/TabPane.vue.d.ts +0 -14
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('element-plus'), require('lodash-es'), require('@element-plus/icons-vue'), require('monaco-editor'), require('@tmagic/stage'), require('@tmagic/schema'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('gesto'), require('keycon')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'element-plus', 'lodash-es', '@element-plus/icons-vue', 'monaco-editor', '@tmagic/stage', '@tmagic/schema', '@tmagic/utils', 'events', '@tmagic/core', 'gesto', 'keycon'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.ElementPlus, global.lodashEs, global.iconsVue, global.monaco, global.StageCore, global.schema, global.utils, global.events, global.core, global.Gesto, global.KeyController));
5
- })(this, (function (exports, vue, serialize, elementPlus, lodashEs, iconsVue, monaco, StageCore, schema, utils, events, core, Gesto, KeyController) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/design'), require('@element-plus/icons-vue'), require('monaco-editor'), require('@tmagic/stage'), require('gesto'), require('@tmagic/schema'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('keycon')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/design', '@element-plus/icons-vue', 'monaco-editor', '@tmagic/stage', 'gesto', '@tmagic/schema', '@tmagic/utils', 'events', '@tmagic/core', 'keycon'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.design, global.iconsVue, global.monaco, global.StageCore, global.Gesto, global.schema, global.utils, global.events, global.core, global.KeyController));
5
+ })(this, (function (exports, vue, serialize, lodashEs, design, iconsVue, monaco, StageCore, Gesto, schema, utils, events, core, KeyController) { 'use strict';
6
6
 
7
7
  const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
8
8
 
@@ -30,8 +30,11 @@
30
30
  const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
31
31
  const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
32
32
 
33
+ const __default__$r = vue.defineComponent({
34
+ name: "MEditorCode"
35
+ });
33
36
  const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
34
- __name: "Code",
37
+ ...__default__$r,
35
38
  props: {
36
39
  model: null,
37
40
  name: null,
@@ -42,7 +45,7 @@
42
45
  setup(__props, { emit }) {
43
46
  const props = __props;
44
47
  const language = vue.computed(() => props.config.language || "javascript");
45
- const height = vue.computed(() => `${document.body.clientHeight - 168}px`);
48
+ const height = vue.computed(() => props.config.height || `${document.body.clientHeight - 168}px`);
46
49
  const save = (v) => {
47
50
  props.model[props.name] = v;
48
51
  emit("change", v);
@@ -53,14 +56,18 @@
53
56
  style: vue.normalizeStyle(`height: ${vue.unref(height)}`),
54
57
  "init-values": __props.model[__props.name],
55
58
  language: vue.unref(language),
59
+ options: __props.config.options,
56
60
  onSave: save
57
- }, null, 8, ["style", "init-values", "language"]);
61
+ }, null, 8, ["style", "init-values", "language", "options"]);
58
62
  };
59
63
  }
60
64
  });
61
65
 
66
+ const __default__$q = vue.defineComponent({
67
+ name: "MEditorCodeLink"
68
+ });
62
69
  const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
63
- __name: "CodeLink",
70
+ ...__default__$q,
64
71
  props: {
65
72
  config: null,
66
73
  model: null,
@@ -70,17 +77,24 @@
70
77
  emits: ["change"],
71
78
  setup(__props, { emit }) {
72
79
  const props = __props;
73
- const formConfig = vue.computed(() => ({
74
- ...props.config,
75
- text: "",
76
- type: "link",
77
- form: [
78
- {
79
- name: props.name,
80
- type: "vs-code"
81
- }
82
- ]
83
- }));
80
+ const formConfig = vue.computed(() => {
81
+ const { codeOptions, ...config } = props.config;
82
+ return {
83
+ ...config,
84
+ text: "",
85
+ type: "link",
86
+ form: [
87
+ {
88
+ name: props.name,
89
+ type: "vs-code",
90
+ options: {
91
+ tabSize: 2,
92
+ ...codeOptions || {}
93
+ }
94
+ }
95
+ ]
96
+ };
97
+ });
84
98
  const modelValue = vue.reactive({
85
99
  form: {
86
100
  [props.name]: ""
@@ -171,8 +185,11 @@
171
185
  const _hoisted_3$3 = [
172
186
  _hoisted_2$6
173
187
  ];
188
+ const __default__$p = vue.defineComponent({
189
+ name: "MEditorCodeSelect"
190
+ });
174
191
  const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
175
- __name: "CodeSelect",
192
+ ...__default__$p,
176
193
  props: {
177
194
  config: null,
178
195
  model: null,
@@ -184,6 +201,7 @@
184
201
  setup(__props, { emit }) {
185
202
  const props = __props;
186
203
  const services = vue.inject("services");
204
+ const form = vue.inject("mForm");
187
205
  const selectConfig = vue.computed(() => {
188
206
  const defaultConfig = {
189
207
  multiple: true,
@@ -206,11 +224,12 @@
206
224
  });
207
225
  const fieldKey = vue.ref("");
208
226
  const multiple = vue.ref(true);
209
- const combineIds = vue.ref([]);
210
- let lastTagSnapshot = lodashEs.cloneDeep(props.model[props.name]) || [];
227
+ const lastTagSnapshot = vue.ref([]);
211
228
  vue.watchEffect(async () => {
229
+ if (!props.model[props.name])
230
+ return;
212
231
  const combineNames = await Promise.all(
213
- combineIds.value.map(async (id) => {
232
+ props.model[props.name].map(async (id) => {
214
233
  const { name = "" } = await services?.codeBlockService.getCodeContentById(id) || {};
215
234
  return name;
216
235
  })
@@ -221,7 +240,6 @@
221
240
  let codeIds = value;
222
241
  if (typeof value === "string") {
223
242
  multiple.value = false;
224
- lastTagSnapshot = [lastTagSnapshot];
225
243
  codeIds = value ? [value] : [];
226
244
  }
227
245
  await setCombineRelation(codeIds);
@@ -232,35 +250,28 @@
232
250
  let opFlag = CodeSelectOp.CHANGE;
233
251
  let diffValues = codeIds;
234
252
  if (multiple.value) {
235
- opFlag = codeIds.length < lastTagSnapshot.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
236
- diffValues = lodashEs.xor(codeIds, lastTagSnapshot);
253
+ lastTagSnapshot.value = form?.initValues[props.name] || [];
254
+ opFlag = codeIds.length < lastTagSnapshot.value.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
255
+ diffValues = lodashEs.xor(codeIds, lastTagSnapshot.value);
237
256
  }
238
257
  await services?.codeBlockService.setCombineRelation(id, diffValues, opFlag, props.prop);
239
- lastTagSnapshot = codeIds;
240
- await setCombineIds(codeIds);
241
- };
242
- const setCombineIds = async (codeIds) => {
243
- combineIds.value = codeIds;
244
- await services?.codeBlockService.setCombineIds(codeIds);
245
258
  };
246
259
  const viewHandler = async () => {
247
260
  if (props.model[props.name].length === 0) {
248
- elementPlus.ElMessage.error("\u8BF7\u5148\u7ED1\u5B9A\u4EE3\u7801\u5757");
261
+ design.tMagicMessage.error("\u8BF7\u5148\u7ED1\u5B9A\u4EE3\u7801\u5757");
249
262
  return;
250
263
  }
251
- await setCombineIds(props.model[props.name]);
264
+ await services?.codeBlockService.setCombineIds(props.model[props.name]);
252
265
  await services?.codeBlockService.setMode(CodeEditorMode.LIST);
253
- services?.codeBlockService.setCodeEditorContent(true, combineIds.value[0]);
266
+ services?.codeBlockService.setCodeEditorContent(true, props.model[props.name][0]);
254
267
  };
255
268
  return (_ctx, _cache) => {
256
269
  const _component_m_fields_select = vue.resolveComponent("m-fields-select");
257
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
258
- const _component_el_card = vue.resolveComponent("el-card");
259
270
  return vue.openBlock(), vue.createElementBlock("div", {
260
271
  class: "m-fields-code-select",
261
272
  key: fieldKey.value
262
273
  }, [
263
- vue.createVNode(_component_el_card, { shadow: "never" }, {
274
+ vue.createVNode(vue.unref(design.TMagicCard), { shadow: "never" }, {
264
275
  header: vue.withCtx(() => [
265
276
  vue.createVNode(_component_m_fields_select, {
266
277
  config: vue.unref(selectConfig),
@@ -273,7 +284,7 @@
273
284
  ]),
274
285
  default: vue.withCtx(() => [
275
286
  vue.createElementVNode("div", _hoisted_1$e, [
276
- vue.createVNode(_component_el_tooltip, {
287
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
277
288
  class: "tool-item",
278
289
  effect: "dark",
279
290
  content: "\u67E5\u770B\u4EE3\u7801\u5757",
@@ -301,8 +312,11 @@
301
312
  });
302
313
 
303
314
  const _hoisted_1$d = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
315
+ const __default__$o = vue.defineComponent({
316
+ name: "MEditorUISelect"
317
+ });
304
318
  const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
305
- __name: "UISelect",
319
+ ...__default__$o,
306
320
  props: {
307
321
  config: null,
308
322
  model: null,
@@ -352,14 +366,12 @@
352
366
  }
353
367
  };
354
368
  return (_ctx, _cache) => {
355
- const _component_el_button = vue.resolveComponent("el-button");
356
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
357
369
  return uiSelectMode.value ? (vue.openBlock(), vue.createElementBlock("div", {
358
370
  key: 0,
359
371
  class: "m-fields-ui-select",
360
372
  onClick: cancelHandler
361
373
  }, [
362
- vue.createVNode(_component_el_button, {
374
+ vue.createVNode(vue.unref(design.TMagicButton), {
363
375
  type: "danger",
364
376
  icon: vue.unref(iconsVue.Delete),
365
377
  text: "",
@@ -376,12 +388,12 @@
376
388
  onClick: startSelect,
377
389
  style: { "display": "flex" }
378
390
  }, [
379
- vue.unref(val) ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
391
+ vue.unref(val) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
380
392
  key: 0,
381
393
  content: "\u6E05\u9664"
382
394
  }, {
383
395
  default: vue.withCtx(() => [
384
- vue.createVNode(_component_el_button, {
396
+ vue.createVNode(vue.unref(design.TMagicButton), {
385
397
  style: { "padding": "0" },
386
398
  type: "danger",
387
399
  icon: vue.unref(iconsVue.Close),
@@ -391,11 +403,11 @@
391
403
  ]),
392
404
  _: 1
393
405
  })) : vue.createCommentVNode("", true),
394
- vue.createVNode(_component_el_tooltip, {
406
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
395
407
  content: vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
396
408
  }, {
397
409
  default: vue.withCtx(() => [
398
- vue.createVNode(_component_el_button, {
410
+ vue.createVNode(vue.unref(design.TMagicButton), {
399
411
  text: "",
400
412
  style: { "padding": "0", "margin": "0" }
401
413
  }, {
@@ -414,45 +426,39 @@
414
426
 
415
427
  const UISelect_vue_vue_type_style_index_0_lang = '';
416
428
 
417
- const toString = (v, language) => {
418
- let value = "";
419
- if (typeof v !== "string") {
420
- value = serialize__default.default(v, {
421
- space: 2,
422
- unsafe: true
423
- }).replace(/"(\w+)":\s/g, "$1: ");
424
- } else {
425
- value = v;
426
- }
427
- if (language === "javascript" && value.startsWith("{") && value.endsWith("}")) {
428
- value = `(${value})`;
429
- }
430
- return value;
431
- };
432
- const _sfc_main$o = vue.defineComponent({
433
- name: "magic-code-editor",
429
+ const __default__$n = vue.defineComponent({
430
+ name: "MEditorCodeEditor"
431
+ });
432
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
433
+ ...__default__$n,
434
434
  props: {
435
- initValues: {
436
- type: [String, Object]
437
- },
438
- modifiedValues: {
439
- type: [String, Object]
440
- },
441
- type: {
442
- type: String,
443
- default: () => ""
444
- },
445
- language: {
446
- type: String,
447
- default: () => "javascript"
448
- },
449
- options: {
450
- type: Object,
451
- default: () => ({})
452
- }
435
+ initValues: null,
436
+ modifiedValues: null,
437
+ type: { default: "" },
438
+ language: { default: "javascript" },
439
+ options: { default: () => ({
440
+ tabSize: 2
441
+ }) },
442
+ autoSave: { type: Boolean, default: true }
453
443
  },
454
444
  emits: ["initd", "save"],
455
- setup(props, { emit }) {
445
+ setup(__props, { expose, emit }) {
446
+ const props = __props;
447
+ const toString = (v, language) => {
448
+ let value = "";
449
+ if (typeof v !== "string") {
450
+ value = serialize__default.default(v, {
451
+ space: 2,
452
+ unsafe: true
453
+ }).replace(/"(\w+)":\s/g, "$1: ");
454
+ } else {
455
+ value = v;
456
+ }
457
+ if (language === "javascript" && value.startsWith("{") && value.endsWith("}")) {
458
+ value = `(${value})`;
459
+ }
460
+ return value;
461
+ };
456
462
  let vsEditor = null;
457
463
  let vsDiffEditor = null;
458
464
  const values = vue.ref("");
@@ -501,7 +507,7 @@
501
507
  emit("save", getEditorValue());
502
508
  }
503
509
  });
504
- if (props.type !== "diff") {
510
+ if (props.type !== "diff" && props.autoSave) {
505
511
  vsEditor?.onDidBlurEditorWidget(() => {
506
512
  emit("save", getEditorValue());
507
513
  });
@@ -527,10 +533,7 @@
527
533
  vue.onUnmounted(() => {
528
534
  resizeObserver.disconnect();
529
535
  });
530
- return {
531
- values,
532
- loading,
533
- codeEditor,
536
+ expose({
534
537
  getEditor() {
535
538
  return vsEditor || vsDiffEditor;
536
539
  },
@@ -539,33 +542,206 @@
539
542
  vsEditor?.focus();
540
543
  vsDiffEditor?.focus();
541
544
  }
545
+ });
546
+ return (_ctx, _cache) => {
547
+ return vue.openBlock(), vue.createElementBlock("div", {
548
+ ref_key: "codeEditor",
549
+ ref: codeEditor,
550
+ class: "magic-code-editor"
551
+ }, null, 512);
542
552
  };
543
553
  }
544
554
  });
545
555
 
546
- const _export_sfc = (sfc, props) => {
547
- const target = sfc.__vccOpts || sfc;
548
- for (const [key, val] of props) {
549
- target[key] = val;
550
- }
551
- return target;
552
- };
553
-
554
- const _hoisted_1$c = {
555
- ref: "codeEditor",
556
- class: "magic-code-editor"
557
- };
558
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
559
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, null, 512);
560
- }
561
- const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$6]]);
562
-
563
556
  let $TMAGIC_EDITOR = {};
564
557
  const setConfig = (option) => {
565
558
  $TMAGIC_EDITOR = option;
566
559
  };
567
560
  const getConfig = (key) => $TMAGIC_EDITOR[key];
568
561
 
562
+ const __default__$m = vue.defineComponent({
563
+ name: "MEditorResizer"
564
+ });
565
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
566
+ ...__default__$m,
567
+ emits: ["change"],
568
+ setup(__props, { emit }) {
569
+ const target = vue.ref();
570
+ let getso;
571
+ vue.onMounted(() => {
572
+ if (!target.value)
573
+ return;
574
+ getso = new Gesto__default.default(target.value, {
575
+ container: window,
576
+ pinchOutside: true
577
+ }).on("drag", (e) => {
578
+ if (!target.value)
579
+ return;
580
+ emit("change", e.deltaX);
581
+ });
582
+ });
583
+ vue.onUnmounted(() => {
584
+ getso?.unset();
585
+ });
586
+ return (_ctx, _cache) => {
587
+ return vue.openBlock(), vue.createElementBlock("span", {
588
+ ref_key: "target",
589
+ ref: target,
590
+ class: "m-editor-resizer"
591
+ }, [
592
+ vue.renderSlot(_ctx.$slots, "default")
593
+ ], 512);
594
+ };
595
+ }
596
+ });
597
+
598
+ const __default__$l = vue.defineComponent({
599
+ name: "MEditorLayout"
600
+ });
601
+ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
602
+ ...__default__$l,
603
+ props: {
604
+ left: null,
605
+ right: null,
606
+ minLeft: { default: 1 },
607
+ minRight: { default: 1 },
608
+ leftClass: null,
609
+ rightClass: null,
610
+ centerClass: null
611
+ },
612
+ emits: ["update:left", "change", "update:right"],
613
+ setup(__props, { emit }) {
614
+ const props = __props;
615
+ const el = vue.ref();
616
+ let clientWidth = 0;
617
+ const resizerObserver = new ResizeObserver((entries) => {
618
+ for (const { contentRect } of entries) {
619
+ clientWidth = contentRect.width;
620
+ center.value = clientWidth - (props.left || 0) - (props.right || 0);
621
+ emit("change", {
622
+ left: props.left,
623
+ center: center.value,
624
+ right: props.right
625
+ });
626
+ }
627
+ });
628
+ vue.onMounted(() => {
629
+ if (el.value) {
630
+ resizerObserver.observe(el.value);
631
+ }
632
+ });
633
+ vue.onUnmounted(() => {
634
+ resizerObserver.disconnect();
635
+ });
636
+ const center = vue.ref(0);
637
+ const changeLeft = (deltaX) => {
638
+ if (typeof props.left === "undefined")
639
+ return;
640
+ let left = Math.max(props.left + deltaX, props.minLeft) || 0;
641
+ emit("update:left", left);
642
+ if (clientWidth - left - (props.right || 0) <= 0) {
643
+ left = props.left;
644
+ }
645
+ center.value = clientWidth - left - (props.right || 0);
646
+ emit("change", {
647
+ left,
648
+ center: center.value,
649
+ right: props.right
650
+ });
651
+ };
652
+ const changeRight = (deltaX) => {
653
+ if (typeof props.right === "undefined")
654
+ return;
655
+ let right = Math.max(props.right - deltaX, props.minRight) || 0;
656
+ emit("update:right", right);
657
+ if (clientWidth - (props.left || 0) - right <= 0) {
658
+ right = props.right;
659
+ }
660
+ center.value = clientWidth - (props.left || 0) - right;
661
+ emit("change", {
662
+ left: props.left,
663
+ center: center.value,
664
+ right
665
+ });
666
+ };
667
+ return (_ctx, _cache) => {
668
+ return vue.openBlock(), vue.createElementBlock("div", {
669
+ ref_key: "el",
670
+ ref: el,
671
+ class: "m-editor-layout"
672
+ }, [
673
+ typeof props.left !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
674
+ vue.createElementVNode("div", {
675
+ class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
676
+ style: vue.normalizeStyle(`width: ${__props.left}px`)
677
+ }, [
678
+ vue.renderSlot(_ctx.$slots, "left")
679
+ ], 6),
680
+ vue.createVNode(_sfc_main$n, { onChange: changeLeft })
681
+ ], 64)) : vue.createCommentVNode("", true),
682
+ vue.createElementVNode("div", {
683
+ class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
684
+ style: vue.normalizeStyle(`width: ${center.value}px`)
685
+ }, [
686
+ vue.renderSlot(_ctx.$slots, "center")
687
+ ], 6),
688
+ typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
689
+ vue.createVNode(_sfc_main$n, { onChange: changeRight }),
690
+ vue.createElementVNode("div", {
691
+ class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
692
+ style: vue.normalizeStyle(`width: ${__props.right}px`)
693
+ }, [
694
+ vue.renderSlot(_ctx.$slots, "right")
695
+ ], 6)
696
+ ], 64)) : vue.createCommentVNode("", true)
697
+ ], 512);
698
+ };
699
+ }
700
+ });
701
+
702
+ const _hoisted_1$c = ["src"];
703
+ const __default__$k = vue.defineComponent({
704
+ name: "MEditorIcon"
705
+ });
706
+ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
707
+ ...__default__$k,
708
+ props: {
709
+ icon: null
710
+ },
711
+ setup(__props) {
712
+ return (_ctx, _cache) => {
713
+ return !__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
714
+ key: 0,
715
+ class: "magic-editor-icon"
716
+ }, {
717
+ default: vue.withCtx(() => [
718
+ vue.createVNode(vue.unref(iconsVue.Edit))
719
+ ]),
720
+ _: 1
721
+ })) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
722
+ key: 1,
723
+ class: "magic-editor-icon"
724
+ }, {
725
+ default: vue.withCtx(() => [
726
+ vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$c)
727
+ ]),
728
+ _: 1
729
+ })) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
730
+ key: 2,
731
+ class: vue.normalizeClass(["magic-editor-icon", __props.icon])
732
+ }, null, 2)) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
733
+ key: 3,
734
+ class: "magic-editor-icon"
735
+ }, {
736
+ default: vue.withCtx(() => [
737
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
738
+ ]),
739
+ _: 1
740
+ }));
741
+ };
742
+ }
743
+ });
744
+
569
745
  const log = (...args) => {
570
746
  if (process.env.NODE_ENV === "development") {
571
747
  console.log("magic editor: ", ...args);
@@ -754,16 +930,20 @@
754
930
  }
755
931
  async setCodeDslById(id, codeConfig) {
756
932
  let codeDsl = await this.getCodeDsl();
757
- if (!codeDsl)
758
- return;
759
- const existContent = codeDsl[id] || {};
760
- codeDsl = {
761
- ...codeDsl,
762
- [id]: {
763
- ...existContent,
764
- ...codeConfig
765
- }
766
- };
933
+ if (!codeDsl) {
934
+ codeDsl = {
935
+ [id]: codeConfig
936
+ };
937
+ } else {
938
+ const existContent = codeDsl[id] || {};
939
+ codeDsl = {
940
+ ...codeDsl,
941
+ [id]: {
942
+ ...existContent,
943
+ ...codeConfig
944
+ }
945
+ };
946
+ }
767
947
  await this.setCodeDsl(codeDsl);
768
948
  }
769
949
  async getCodeDslByIds(ids) {
@@ -1483,7 +1663,7 @@
1483
1663
  "copy",
1484
1664
  "paste",
1485
1665
  "doPaste",
1486
- "duAlignCenter",
1666
+ "doAlignCenter",
1487
1667
  "alignCenter",
1488
1668
  "moveLayer",
1489
1669
  "moveToContainer",
@@ -1757,10 +1937,10 @@
1757
1937
  newConfig = setLayout(newConfig, newLayout);
1758
1938
  }
1759
1939
  parentNodeItems[index] = newConfig;
1760
- const nodes = this.get("nodes");
1940
+ const nodes = this.get("nodes") || [];
1761
1941
  const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
1762
1942
  nodes.splice(targetIndex, 1, newConfig);
1763
- this.set("nodes", nodes);
1943
+ this.set("nodes", [...nodes]);
1764
1944
  this.get("stage")?.update({
1765
1945
  config: lodashEs.cloneDeep(newConfig),
1766
1946
  parentId: parent.id,
@@ -1842,7 +2022,11 @@
1842
2022
  const stage = this.get("stage");
1843
2023
  const newNodes = await Promise.all(nodes.map((node) => this.doAlignCenter(node)));
1844
2024
  const newNode = await this.update(newNodes);
1845
- await stage?.multiSelect(newNodes.map((node) => node.id));
2025
+ if (newNodes.length > 1) {
2026
+ await stage?.multiSelect(newNodes.map((node) => node.id));
2027
+ } else {
2028
+ await stage?.select(newNodes[0].id);
2029
+ }
1846
2030
  return newNode;
1847
2031
  }
1848
2032
  async moveLayer(offset) {
@@ -1947,12 +2131,12 @@
1947
2131
  const root = this.get("root");
1948
2132
  if (!root)
1949
2133
  return null;
1950
- return root.codeBlock || null;
2134
+ return root.codeBlocks || null;
1951
2135
  }
1952
2136
  async setCodeDsl(codeDsl) {
1953
2137
  if (!this.state.root)
1954
2138
  return;
1955
- this.state.root.codeBlock = codeDsl;
2139
+ this.state.root.codeBlocks = codeDsl;
1956
2140
  }
1957
2141
  addModifiedNodeId(id) {
1958
2142
  if (!this.isHistoryStateChange) {
@@ -2382,6 +2566,8 @@
2382
2566
  getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
2383
2567
  ]);
2384
2568
  stage.on("select", (el) => {
2569
+ if (`${editorService.get("node")?.id}` === el.id && editorService.get("nodes").length === 1)
2570
+ return;
2385
2571
  editorService.select(el.id);
2386
2572
  });
2387
2573
  stage.on("highlight", (el) => {
@@ -2402,6 +2588,11 @@
2402
2588
  stage.on("sort", (ev) => {
2403
2589
  editorService.sort(ev.src, ev.dist);
2404
2590
  });
2591
+ stage.on("select-parent", () => {
2592
+ const parent = editorService.get("parent");
2593
+ editorService.select(parent);
2594
+ editorService.get("stage").select(parent.id);
2595
+ });
2405
2596
  stage.on("changeGuides", (e) => {
2406
2597
  uiService.set("showGuides", true);
2407
2598
  if (!root.value || !page.value)
@@ -2418,182 +2609,49 @@
2418
2609
  return stage;
2419
2610
  };
2420
2611
 
2421
- const _sfc_main$n = vue.defineComponent({
2422
- components: { Plus: iconsVue.Plus },
2423
- setup() {
2612
+ const _hoisted_1$b = { class: "m-editor-empty-panel" };
2613
+ const _hoisted_2$5 = { class: "m-editor-empty-content" };
2614
+ const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
2615
+ const __default__$j = vue.defineComponent({
2616
+ name: "MEditorAddPageBox"
2617
+ });
2618
+ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
2619
+ ...__default__$j,
2620
+ setup(__props) {
2424
2621
  const services = vue.inject("services");
2425
- return {
2426
- clickHandler() {
2427
- const { editorService } = services || {};
2428
- if (!editorService)
2429
- return;
2430
- editorService.add({
2431
- type: schema.NodeType.PAGE,
2432
- name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
2433
- });
2434
- }
2435
- };
2436
- }
2437
- });
2438
-
2439
- const _hoisted_1$b = { class: "m-editor-empty-panel" };
2440
- const _hoisted_2$5 = { class: "m-editor-empty-content" };
2441
- const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
2442
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2443
- const _component_plus = vue.resolveComponent("plus");
2444
- const _component_el_icon = vue.resolveComponent("el-icon");
2445
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
2446
- vue.createElementVNode("div", _hoisted_2$5, [
2447
- vue.createElementVNode("div", {
2448
- class: "m-editor-empty-button",
2449
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
2450
- }, [
2451
- vue.createElementVNode("div", null, [
2452
- vue.createVNode(_component_el_icon, null, {
2453
- default: vue.withCtx(() => [
2454
- vue.createVNode(_component_plus)
2455
- ]),
2456
- _: 1
2457
- })
2458
- ]),
2459
- _hoisted_3$2
2460
- ])
2461
- ])
2462
- ]);
2463
- }
2464
- const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$5]]);
2465
-
2466
- const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
2467
- __name: "Resizer",
2468
- emits: ["change"],
2469
- setup(__props, { emit }) {
2470
- const target = vue.ref();
2471
- let getso;
2472
- vue.onMounted(() => {
2473
- if (!target.value)
2474
- return;
2475
- getso = new Gesto__default.default(target.value, {
2476
- container: window,
2477
- pinchOutside: true
2478
- }).on("drag", (e) => {
2479
- if (!target.value)
2480
- return;
2481
- emit("change", e.deltaX);
2482
- });
2483
- });
2484
- vue.onUnmounted(() => {
2485
- getso?.unset();
2486
- });
2487
- return (_ctx, _cache) => {
2488
- return vue.openBlock(), vue.createElementBlock("span", {
2489
- ref_key: "target",
2490
- ref: target,
2491
- class: "m-editor-resizer"
2492
- }, [
2493
- vue.renderSlot(_ctx.$slots, "default")
2494
- ], 512);
2495
- };
2496
- }
2497
- });
2498
-
2499
- const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
2500
- __name: "Layout",
2501
- props: {
2502
- left: null,
2503
- right: null,
2504
- minLeft: { default: 1 },
2505
- minRight: { default: 1 },
2506
- leftClass: null,
2507
- rightClass: null,
2508
- centerClass: null
2509
- },
2510
- emits: ["update:left", "change", "update:right"],
2511
- setup(__props, { emit }) {
2512
- const props = __props;
2513
- const el = vue.ref();
2514
- let clientWidth = 0;
2515
- const resizerObserver = new ResizeObserver((entries) => {
2516
- for (const { contentRect } of entries) {
2517
- clientWidth = contentRect.width;
2518
- center.value = clientWidth - (props.left || 0) - (props.right || 0);
2519
- emit("change", {
2520
- left: props.left,
2521
- center: center.value,
2522
- right: props.right
2523
- });
2524
- }
2525
- });
2526
- vue.onMounted(() => {
2527
- if (el.value) {
2528
- resizerObserver.observe(el.value);
2529
- }
2530
- });
2531
- vue.onUnmounted(() => {
2532
- resizerObserver.disconnect();
2533
- });
2534
- const center = vue.ref(0);
2535
- const changeLeft = (deltaX) => {
2536
- if (typeof props.left === "undefined")
2537
- return;
2538
- const left = Math.max(props.left + deltaX, props.minLeft) || 0;
2539
- emit("update:left", left);
2540
- center.value = clientWidth - left - (props.right || 0);
2541
- emit("change", {
2542
- left,
2543
- center: center.value,
2544
- right: props.right
2545
- });
2546
- };
2547
- const changeRight = (deltaX) => {
2548
- if (typeof props.right === "undefined")
2549
- return;
2550
- const right = Math.max(props.right - deltaX, props.minRight) || 0;
2551
- emit("update:right", right);
2552
- center.value = clientWidth - (props.left || 0) - right;
2553
- emit("change", {
2554
- left: props.left,
2555
- center: center.value,
2556
- right
2557
- });
2558
- };
2559
- return (_ctx, _cache) => {
2560
- return vue.openBlock(), vue.createElementBlock("div", {
2561
- ref_key: "el",
2562
- ref: el,
2563
- class: "m-editor-layout"
2564
- }, [
2565
- typeof props.left !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
2566
- vue.createElementVNode("div", {
2567
- class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
2568
- style: vue.normalizeStyle(`width: ${__props.left}px`)
2569
- }, [
2570
- vue.renderSlot(_ctx.$slots, "left")
2571
- ], 6),
2572
- vue.createVNode(_sfc_main$m, { onChange: changeLeft })
2573
- ], 64)) : vue.createCommentVNode("", true),
2574
- vue.createElementVNode("div", {
2575
- class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
2576
- style: vue.normalizeStyle(`width: ${center.value}px`)
2577
- }, [
2578
- vue.renderSlot(_ctx.$slots, "center")
2579
- ], 6),
2580
- typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
2581
- vue.createVNode(_sfc_main$m, { onChange: changeRight }),
2582
- vue.createElementVNode("div", {
2583
- class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
2584
- style: vue.normalizeStyle(`width: ${__props.right}px`)
2585
- }, [
2586
- vue.renderSlot(_ctx.$slots, "right")
2587
- ], 6)
2588
- ], 64)) : vue.createCommentVNode("", true)
2589
- ], 512);
2622
+ const clickHandler = () => {
2623
+ const { editorService } = services || {};
2624
+ if (!editorService)
2625
+ return;
2626
+ editorService.add({
2627
+ type: schema.NodeType.PAGE,
2628
+ name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
2629
+ });
2630
+ };
2631
+ return (_ctx, _cache) => {
2632
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
2633
+ vue.createElementVNode("div", _hoisted_2$5, [
2634
+ vue.createElementVNode("div", {
2635
+ class: "m-editor-empty-button",
2636
+ onClick: clickHandler
2637
+ }, [
2638
+ vue.createElementVNode("div", null, [
2639
+ vue.createVNode(_sfc_main$l, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
2640
+ ]),
2641
+ _hoisted_3$2
2642
+ ])
2643
+ ])
2644
+ ]);
2590
2645
  };
2591
2646
  }
2592
2647
  });
2593
2648
 
2594
2649
  const _hoisted_1$a = { class: "m-editor" };
2595
- const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
2596
- __name: "Framework",
2650
+ const __default__$i = vue.defineComponent({
2651
+ name: "MEditorFramework"
2652
+ });
2653
+ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
2654
+ ...__default__$i,
2597
2655
  props: {
2598
2656
  codeOptions: { default: () => ({}) }
2599
2657
  },
@@ -2602,47 +2660,63 @@
2602
2660
  const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
2603
2661
  const { editorService, uiService } = vue.inject("services") || {};
2604
2662
  const root = vue.computed(() => editorService?.get("root"));
2663
+ const nodes = vue.computed(() => editorService?.get("nodes") || []);
2605
2664
  const pageLength = vue.computed(() => editorService?.get("pageLength") || 0);
2606
2665
  const showSrc = vue.computed(() => uiService?.get("showSrc"));
2666
+ const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
2667
+ const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
2668
+ const leftColumnWidthCacheData = Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY));
2669
+ const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY));
2607
2670
  const columnWidth = vue.ref({
2608
- left: DEFAULT_LEFT_COLUMN_WIDTH,
2671
+ left: leftColumnWidthCacheData,
2609
2672
  center: 0,
2610
- right: 0
2673
+ right: RightColumnWidthCacheData
2611
2674
  });
2612
- uiService?.set("columnWidth", columnWidth.value);
2613
- vue.watchEffect(() => {
2614
- if (pageLength.value <= 0) {
2615
- columnWidth.value.right = void 0;
2616
- columnWidth.value.center = globalThis.document.body.clientWidth - DEFAULT_LEFT_COLUMN_WIDTH;
2617
- } else {
2618
- columnWidth.value.right = columnWidth.value.right || DEFAULT_RIGHT_COLUMN_WIDTH;
2619
- columnWidth.value.center = globalThis.document.body.clientWidth - DEFAULT_LEFT_COLUMN_WIDTH - DEFAULT_RIGHT_COLUMN_WIDTH;
2675
+ vue.watch(
2676
+ pageLength,
2677
+ (length) => {
2678
+ const left = columnWidth.value.left || DEFAULT_LEFT_COLUMN_WIDTH;
2679
+ columnWidth.value.left = left;
2680
+ if (length <= 0) {
2681
+ columnWidth.value.right = void 0;
2682
+ columnWidth.value.center = globalThis.document.body.clientWidth - left;
2683
+ } else {
2684
+ const right = columnWidth.value.right || RightColumnWidthCacheData || DEFAULT_RIGHT_COLUMN_WIDTH;
2685
+ columnWidth.value.right = right;
2686
+ columnWidth.value.center = globalThis.document.body.clientWidth - left - right;
2687
+ }
2688
+ uiService?.set("columnWidth", columnWidth);
2689
+ },
2690
+ {
2691
+ immediate: true
2620
2692
  }
2621
- });
2622
- const saveCode = (value) => {
2623
- try {
2624
- editorService?.set("root", eval(value));
2625
- } catch (e) {
2626
- console.error(e);
2693
+ );
2694
+ vue.watch(
2695
+ () => columnWidth.value.right,
2696
+ (right) => {
2697
+ if (typeof right === "undefined")
2698
+ return;
2699
+ globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${right}`);
2627
2700
  }
2701
+ );
2702
+ vue.watch(
2703
+ () => columnWidth.value.left,
2704
+ (left) => {
2705
+ globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
2706
+ }
2707
+ );
2708
+ const columnWidthChange = (columnWidth2) => {
2709
+ uiService?.set("columnWidth", columnWidth2);
2628
2710
  };
2629
- const COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorColumnWidthData";
2630
- const columnWidthCacheData = globalThis.localStorage.getItem(COLUMN_WIDTH_STORAGE_KEY);
2631
- if (columnWidthCacheData) {
2711
+ const saveCode = (value) => {
2632
2712
  try {
2633
- const columnWidthCache = JSON.parse(columnWidthCacheData);
2634
- columnWidth.value = columnWidthCache;
2713
+ editorService?.set("root", eval(value));
2635
2714
  } catch (e) {
2636
2715
  console.error(e);
2637
2716
  }
2638
- }
2639
- const columnWidthChange = (columnWidth2) => {
2640
- uiService?.set("columnWidth", columnWidth2);
2641
- globalThis.localStorage.setItem(COLUMN_WIDTH_STORAGE_KEY, JSON.stringify(columnWidth2));
2642
2717
  };
2643
2718
  return (_ctx, _cache) => {
2644
2719
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
2645
- const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
2646
2720
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
2647
2721
  vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
2648
2722
  vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
@@ -2651,7 +2725,7 @@
2651
2725
  "init-values": vue.unref(root),
2652
2726
  options: __props.codeOptions,
2653
2727
  onSave: saveCode
2654
- }, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$l, {
2728
+ }, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$m, {
2655
2729
  key: 1,
2656
2730
  class: "m-editor-content",
2657
2731
  "left-class": "m-editor-framework-left",
@@ -2670,15 +2744,15 @@
2670
2744
  ]),
2671
2745
  center: vue.withCtx(() => [
2672
2746
  vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
2673
- vue.createVNode(AddPageBox)
2747
+ vue.createVNode(_sfc_main$k)
2674
2748
  ])
2675
2749
  ]),
2676
2750
  _: 2
2677
2751
  }, [
2678
- vue.unref(pageLength) > 0 ? {
2752
+ vue.unref(pageLength) > 0 && vue.unref(nodes).length === 1 ? {
2679
2753
  name: "right",
2680
2754
  fn: vue.withCtx(() => [
2681
- vue.createVNode(_component_el_scrollbar, null, {
2755
+ vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
2682
2756
  default: vue.withCtx(() => [
2683
2757
  vue.renderSlot(_ctx.$slots, "props-panel")
2684
2758
  ]),
@@ -2692,54 +2766,16 @@
2692
2766
  }
2693
2767
  });
2694
2768
 
2695
- const _hoisted_1$9 = ["src"];
2696
- const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
2697
- __name: "Icon",
2698
- props: {
2699
- icon: null
2700
- },
2701
- setup(__props) {
2702
- return (_ctx, _cache) => {
2703
- const _component_el_icon = vue.resolveComponent("el-icon");
2704
- return !__props.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
2705
- key: 0,
2706
- class: "magic-editor-icon"
2707
- }, {
2708
- default: vue.withCtx(() => [
2709
- vue.createVNode(vue.unref(iconsVue.Edit))
2710
- ]),
2711
- _: 1
2712
- })) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
2713
- key: 1,
2714
- class: "magic-editor-icon"
2715
- }, {
2716
- default: vue.withCtx(() => [
2717
- vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$9)
2718
- ]),
2719
- _: 1
2720
- })) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
2721
- key: 2,
2722
- class: vue.normalizeClass(["magic-editor-icon", __props.icon])
2723
- }, null, 2)) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
2724
- key: 3,
2725
- class: "magic-editor-icon"
2726
- }, {
2727
- default: vue.withCtx(() => [
2728
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
2729
- ]),
2730
- _: 1
2731
- }));
2732
- };
2733
- }
2734
- });
2735
-
2736
- const _hoisted_1$8 = {
2769
+ const _hoisted_1$9 = {
2737
2770
  key: 1,
2738
2771
  class: "menu-item-text"
2739
2772
  };
2740
2773
  const _hoisted_2$4 = { class: "el-dropdown-link menubar-menu-button" };
2774
+ const __default__$h = vue.defineComponent({
2775
+ name: "MEditorToolButton"
2776
+ });
2741
2777
  const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
2742
- __name: "ToolButton",
2778
+ ...__default__$h,
2743
2779
  props: {
2744
2780
  data: { default: () => ({
2745
2781
  type: "text",
@@ -2804,13 +2840,6 @@
2804
2840
  }
2805
2841
  };
2806
2842
  return (_ctx, _cache) => {
2807
- const _component_el_divider = vue.resolveComponent("el-divider");
2808
- const _component_el_button = vue.resolveComponent("el-button");
2809
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
2810
- const _component_el_icon = vue.resolveComponent("el-icon");
2811
- const _component_el_dropdown_item = vue.resolveComponent("el-dropdown-item");
2812
- const _component_el_dropdown_menu = vue.resolveComponent("el-dropdown-menu");
2813
- const _component_el_dropdown = vue.resolveComponent("el-dropdown");
2814
2843
  return vue.unref(display) ? (vue.openBlock(), vue.createElementBlock("div", {
2815
2844
  key: 0,
2816
2845
  class: vue.normalizeClass(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
@@ -2818,24 +2847,24 @@
2818
2847
  onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
2819
2848
  onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(__props.data, $event))
2820
2849
  }, [
2821
- __props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(_component_el_divider, {
2850
+ __props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
2822
2851
  key: 0,
2823
2852
  direction: __props.data.direction || "vertical"
2824
- }, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
2825
- __props.data.tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
2853
+ }, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
2854
+ __props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
2826
2855
  key: 0,
2827
2856
  effect: "dark",
2828
2857
  placement: "bottom-start",
2829
2858
  content: __props.data.tooltip
2830
2859
  }, {
2831
2860
  default: vue.withCtx(() => [
2832
- vue.createVNode(_component_el_button, {
2861
+ vue.createVNode(vue.unref(design.TMagicButton), {
2833
2862
  size: "small",
2834
2863
  text: "",
2835
2864
  disabled: vue.unref(disabled)
2836
2865
  }, {
2837
2866
  default: vue.withCtx(() => [
2838
- __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
2867
+ __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
2839
2868
  key: 0,
2840
2869
  icon: __props.data.icon
2841
2870
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -2845,14 +2874,14 @@
2845
2874
  }, 8, ["disabled"])
2846
2875
  ]),
2847
2876
  _: 1
2848
- }, 8, ["content"])) : (vue.openBlock(), vue.createBlock(_component_el_button, {
2877
+ }, 8, ["content"])) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
2849
2878
  key: 1,
2850
2879
  size: "small",
2851
2880
  text: "",
2852
2881
  disabled: vue.unref(disabled)
2853
2882
  }, {
2854
2883
  default: vue.withCtx(() => [
2855
- __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
2884
+ __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
2856
2885
  key: 0,
2857
2886
  icon: __props.data.icon
2858
2887
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -2860,17 +2889,17 @@
2860
2889
  ]),
2861
2890
  _: 1
2862
2891
  }, 8, ["disabled"]))
2863
- ], 64)) : __props.data.type === "dropdown" ? (vue.openBlock(), vue.createBlock(_component_el_dropdown, {
2892
+ ], 64)) : __props.data.type === "dropdown" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdown), {
2864
2893
  key: 3,
2865
2894
  trigger: "click",
2866
2895
  disabled: vue.unref(disabled),
2867
2896
  onCommand: dropdownHandler
2868
2897
  }, {
2869
2898
  dropdown: vue.withCtx(() => [
2870
- __props.data.items && __props.data.items.length ? (vue.openBlock(), vue.createBlock(_component_el_dropdown_menu, { key: 0 }, {
2899
+ __props.data.items && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownMenu), { key: 0 }, {
2871
2900
  default: vue.withCtx(() => [
2872
2901
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.data.items, (subItem, index) => {
2873
- return vue.openBlock(), vue.createBlock(_component_el_dropdown_item, {
2902
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownItem), {
2874
2903
  key: index,
2875
2904
  command: { data: __props.data, subItem }
2876
2905
  }, {
@@ -2887,7 +2916,7 @@
2887
2916
  default: vue.withCtx(() => [
2888
2917
  vue.createElementVNode("span", _hoisted_2$4, [
2889
2918
  vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
2890
- vue.createVNode(_component_el_icon, { class: "el-icon--right" }, {
2919
+ vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
2891
2920
  default: vue.withCtx(() => [
2892
2921
  vue.createVNode(vue.unref(iconsVue.ArrowDown))
2893
2922
  ]),
@@ -2902,8 +2931,11 @@
2902
2931
  }
2903
2932
  });
2904
2933
 
2934
+ const __default__$g = vue.defineComponent({
2935
+ name: "MEditorNavMenu"
2936
+ });
2905
2937
  const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
2906
- __name: "NavMenu",
2938
+ ...__default__$g,
2907
2939
  props: {
2908
2940
  data: { default: () => ({}) },
2909
2941
  height: { default: 35 }
@@ -3070,9 +3102,12 @@
3070
3102
  }
3071
3103
  });
3072
3104
 
3073
- const _hoisted_1$7 = { class: "m-editor-props-panel" };
3105
+ const _hoisted_1$8 = { class: "m-editor-props-panel" };
3106
+ const __default__$f = vue.defineComponent({
3107
+ name: "MEditorPropsPanel"
3108
+ });
3074
3109
  const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
3075
- __name: "PropsPanel",
3110
+ ...__default__$f,
3076
3111
  emits: ["mounted"],
3077
3112
  setup(__props, { expose, emit }) {
3078
3113
  const internalInstance = vue.getCurrentInstance();
@@ -3108,19 +3143,14 @@
3108
3143
  services?.editorService.update(values2);
3109
3144
  } catch (e) {
3110
3145
  console.error(e);
3111
- elementPlus.ElMessage.closeAll();
3112
- elementPlus.ElMessage.error({
3113
- duration: 1e4,
3114
- showClose: true,
3115
- message: e.message,
3116
- dangerouslyUseHTMLString: true
3117
- });
3146
+ design.tMagicMessage.closeAll();
3147
+ design.tMagicMessage.error(e.message);
3118
3148
  }
3119
3149
  };
3120
3150
  expose({ submit });
3121
3151
  return (_ctx, _cache) => {
3122
3152
  const _component_m_form = vue.resolveComponent("m-form");
3123
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
3153
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
3124
3154
  vue.renderSlot(_ctx.$slots, "props-panel-header"),
3125
3155
  vue.createVNode(_component_m_form, {
3126
3156
  ref_key: "configForm",
@@ -3137,7 +3167,7 @@
3137
3167
  }
3138
3168
  });
3139
3169
 
3140
- const _hoisted_1$6 = ["id"];
3170
+ const _hoisted_1$7 = ["id"];
3141
3171
  const _hoisted_2$3 = { class: "list-item" };
3142
3172
  const _hoisted_3$1 = { class: "code-name" };
3143
3173
  const _hoisted_4$1 = { class: "code-name-wrapper" };
@@ -3154,8 +3184,11 @@
3154
3184
  class: "m-editor-content-bottom"
3155
3185
  };
3156
3186
  const _hoisted_11 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
3187
+ const __default__$e = vue.defineComponent({
3188
+ name: "MEditorCodeBlockEditor"
3189
+ });
3157
3190
  const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
3158
- __name: "CodeBlockEditor",
3191
+ ...__default__$e,
3159
3192
  setup(__props) {
3160
3193
  const services = vue.inject("services");
3161
3194
  const codeEditor = vue.ref();
@@ -3183,8 +3216,7 @@
3183
3216
  lodashEs.forIn(codeDsl, (value, key) => {
3184
3217
  state.codeList.push({
3185
3218
  id: key,
3186
- name: value.name,
3187
- content: value.content
3219
+ name: value.name
3188
3220
  });
3189
3221
  });
3190
3222
  currentTitle.value = state.codeList[0]?.name || "";
@@ -3196,14 +3228,14 @@
3196
3228
  const codeContent = codeEditor.value.getEditor()?.getValue();
3197
3229
  codeConfig.value.content = eval(codeContent);
3198
3230
  } catch (e) {
3199
- elementPlus.ElMessage.error(e.stack);
3231
+ design.tMagicMessage.error(e.stack);
3200
3232
  return false;
3201
3233
  }
3202
3234
  await services?.codeBlockService.setCodeDslById(id.value, {
3203
3235
  name: codeConfig.value.name,
3204
3236
  content: codeConfig.value.content
3205
3237
  });
3206
- elementPlus.ElMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
3238
+ design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
3207
3239
  return true;
3208
3240
  };
3209
3241
  const saveAndClose = async () => {
@@ -3217,22 +3249,17 @@
3217
3249
  currentTitle.value = data.name;
3218
3250
  };
3219
3251
  return (_ctx, _cache) => {
3220
- const _component_el_tree = vue.resolveComponent("el-tree");
3221
- const _component_el_input = vue.resolveComponent("el-input");
3222
- const _component_el_button = vue.resolveComponent("el-button");
3223
- const _component_el_card = vue.resolveComponent("el-card");
3224
- const _component_el_dialog = vue.resolveComponent("el-dialog");
3225
- return vue.openBlock(), vue.createBlock(_component_el_dialog, {
3252
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDialog), {
3226
3253
  modelValue: vue.unref(isShowCodeBlockEditor),
3227
3254
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
3255
+ class: "code-editor-dialog",
3228
3256
  title: currentTitle.value,
3229
3257
  fullscreen: true,
3230
3258
  "before-close": saveAndClose,
3231
- "append-to-body": true,
3232
- "custom-class": "code-editor-dialog"
3259
+ "append-to-body": true
3233
3260
  }, {
3234
3261
  default: vue.withCtx(() => [
3235
- vue.createVNode(_sfc_main$l, {
3262
+ vue.createVNode(_sfc_main$m, {
3236
3263
  left: left.value,
3237
3264
  "onUpdate:left": _cache[1] || (_cache[1] = ($event) => left.value = $event),
3238
3265
  "min-left": 45,
@@ -3246,11 +3273,11 @@
3246
3273
  ])
3247
3274
  }, [
3248
3275
  vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
3249
- vue.createVNode(_component_el_card, { shadow: "never" }, {
3276
+ vue.createVNode(vue.unref(design.TMagicCard), { shadow: "never" }, {
3250
3277
  header: vue.withCtx(() => [
3251
3278
  vue.createElementVNode("div", _hoisted_4$1, [
3252
3279
  _hoisted_5$1,
3253
- codeConfig.value ? (vue.openBlock(), vue.createBlock(_component_el_input, {
3280
+ codeConfig.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInput), {
3254
3281
  key: 0,
3255
3282
  class: "code-name-input",
3256
3283
  modelValue: codeConfig.value.name,
@@ -3261,7 +3288,7 @@
3261
3288
  ]),
3262
3289
  default: vue.withCtx(() => [
3263
3290
  vue.createElementVNode("div", _hoisted_6$1, [
3264
- codeConfig.value ? (vue.openBlock(), vue.createBlock(CodeEditor, {
3291
+ codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
3265
3292
  key: 0,
3266
3293
  ref_key: "codeEditor",
3267
3294
  ref: codeEditor,
@@ -3276,7 +3303,7 @@
3276
3303
  }
3277
3304
  }, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
3278
3305
  vue.unref(editable) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
3279
- vue.createVNode(_component_el_button, {
3306
+ vue.createVNode(vue.unref(design.TMagicButton), {
3280
3307
  type: "primary",
3281
3308
  class: "button",
3282
3309
  onClick: saveCode
@@ -3286,7 +3313,7 @@
3286
3313
  ]),
3287
3314
  _: 1
3288
3315
  }),
3289
- vue.createVNode(_component_el_button, {
3316
+ vue.createVNode(vue.unref(design.TMagicButton), {
3290
3317
  type: "primary",
3291
3318
  class: "button",
3292
3319
  onClick: saveAndClose
@@ -3297,7 +3324,7 @@
3297
3324
  _: 1
3298
3325
  })
3299
3326
  ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
3300
- vue.createVNode(_component_el_button, {
3327
+ vue.createVNode(vue.unref(design.TMagicButton), {
3301
3328
  type: "primary",
3302
3329
  class: "button",
3303
3330
  onClick: saveAndClose
@@ -3319,16 +3346,15 @@
3319
3346
  vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? {
3320
3347
  name: "left",
3321
3348
  fn: vue.withCtx(() => [
3322
- !vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(_component_el_tree, {
3349
+ !vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
3323
3350
  key: 0,
3324
- ref: "tree",
3351
+ class: "side-tree",
3325
3352
  "node-key": "id",
3326
3353
  "empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
3327
3354
  data: state.codeList,
3328
3355
  "highlight-current": true,
3329
- onNodeClick: selectHandler,
3330
3356
  "current-node-key": state.codeList[0].id,
3331
- class: "side-tree"
3357
+ onNodeClick: selectHandler
3332
3358
  }, {
3333
3359
  default: vue.withCtx(({ data }) => [
3334
3360
  vue.createElementVNode("div", {
@@ -3338,7 +3364,7 @@
3338
3364
  vue.createElementVNode("div", _hoisted_2$3, [
3339
3365
  vue.createElementVNode("div", _hoisted_3$1, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1)
3340
3366
  ])
3341
- ], 8, _hoisted_1$6)
3367
+ ], 8, _hoisted_1$7)
3342
3368
  ]),
3343
3369
  _: 1
3344
3370
  }, 8, ["data", "current-node-key"])) : vue.createCommentVNode("", true)
@@ -3352,7 +3378,7 @@
3352
3378
  }
3353
3379
  });
3354
3380
 
3355
- const _hoisted_1$5 = { class: "m-editor-code-block-list" };
3381
+ const _hoisted_1$6 = { class: "m-editor-code-block-list" };
3356
3382
  const _hoisted_2$2 = { class: "code-header-wrapper" };
3357
3383
  const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("\u65B0\u589E");
3358
3384
  const _hoisted_4 = ["id"];
@@ -3374,8 +3400,11 @@
3374
3400
  d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
3375
3401
  })
3376
3402
  ], -1);
3403
+ const __default__$d = vue.defineComponent({
3404
+ name: "MEditorCodeBlockList"
3405
+ });
3377
3406
  const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
3378
- __name: "CodeBlockList",
3407
+ ...__default__$d,
3379
3408
  props: {
3380
3409
  customError: null
3381
3410
  },
@@ -3411,7 +3440,7 @@
3411
3440
  state.codeList.push({
3412
3441
  id: codeId,
3413
3442
  name: value.name,
3414
- content: value.content,
3443
+ codeBlockContent: value,
3415
3444
  showRelation: true
3416
3445
  });
3417
3446
  });
@@ -3443,7 +3472,7 @@
3443
3472
  const createCodeBlock = async () => {
3444
3473
  const { codeBlockService } = services || {};
3445
3474
  if (!codeBlockService) {
3446
- elementPlus.ElMessage.error("\u65B0\u589E\u4EE3\u7801\u5757\u5931\u8D25");
3475
+ design.tMagicMessage.error("\u65B0\u589E\u4EE3\u7801\u5757\u5931\u8D25");
3447
3476
  return;
3448
3477
  }
3449
3478
  const codeConfig = {
@@ -3470,7 +3499,7 @@
3470
3499
  if (typeof props.customError === "function") {
3471
3500
  props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
3472
3501
  } else {
3473
- elementPlus.ElMessage.error("\u4EE3\u7801\u5757\u5220\u9664\u5931\u8D25");
3502
+ design.tMagicMessage.error("\u4EE3\u7801\u5757\u5220\u9664\u5931\u8D25");
3474
3503
  }
3475
3504
  }
3476
3505
  };
@@ -3502,14 +3531,10 @@
3502
3531
  stage?.select(compId);
3503
3532
  };
3504
3533
  return (_ctx, _cache) => {
3505
- const _component_el_input = vue.resolveComponent("el-input");
3506
- const _component_el_button = vue.resolveComponent("el-button");
3507
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
3508
- const _component_el_tree = vue.resolveComponent("el-tree");
3509
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
3534
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
3510
3535
  vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
3511
3536
  vue.createElementVNode("div", _hoisted_2$2, [
3512
- vue.createVNode(_component_el_input, {
3537
+ vue.createVNode(vue.unref(design.TMagicInput), {
3513
3538
  class: vue.normalizeClass([vue.unref(editable) ? "code-filter-input" : "code-filter-input-no-btn"]),
3514
3539
  size: "small",
3515
3540
  placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
@@ -3518,7 +3543,7 @@
3518
3543
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
3519
3544
  onInput: filterTextChangeHandler
3520
3545
  }, null, 8, ["class", "modelValue"]),
3521
- vue.unref(editable) ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3546
+ vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
3522
3547
  key: 0,
3523
3548
  class: "create-code-button",
3524
3549
  type: "primary",
@@ -3532,7 +3557,7 @@
3532
3557
  })) : vue.createCommentVNode("", true)
3533
3558
  ])
3534
3559
  ]),
3535
- !vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(_component_el_tree, {
3560
+ !vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
3536
3561
  key: 0,
3537
3562
  ref_key: "tree",
3538
3563
  ref: tree,
@@ -3551,13 +3576,13 @@
3551
3576
  vue.createElementVNode("div", _hoisted_5, [
3552
3577
  vue.createElementVNode("div", _hoisted_6, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1),
3553
3578
  vue.createElementVNode("div", _hoisted_7, [
3554
- vue.createVNode(_component_el_tooltip, {
3579
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
3555
3580
  effect: "dark",
3556
3581
  content: vue.unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
3557
3582
  placement: "bottom"
3558
3583
  }, {
3559
3584
  default: vue.withCtx(() => [
3560
- vue.createVNode(_sfc_main$j, {
3585
+ vue.createVNode(_sfc_main$l, {
3561
3586
  icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
3562
3587
  class: "edit-icon",
3563
3588
  onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
@@ -3565,14 +3590,14 @@
3565
3590
  ]),
3566
3591
  _: 2
3567
3592
  }, 1032, ["content"]),
3568
- state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
3593
+ state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3569
3594
  key: 0,
3570
3595
  effect: "dark",
3571
3596
  content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
3572
3597
  placement: "bottom"
3573
3598
  }, {
3574
3599
  default: vue.withCtx(() => [
3575
- vue.createVNode(_sfc_main$j, {
3600
+ vue.createVNode(_sfc_main$l, {
3576
3601
  icon: vue.unref(iconsVue.Link),
3577
3602
  class: "edit-icon",
3578
3603
  onClick: vue.withModifiers(($event) => toggleCombineRelation(data), ["stop"])
@@ -3580,14 +3605,14 @@
3580
3605
  ]),
3581
3606
  _: 2
3582
3607
  }, 1024)) : vue.createCommentVNode("", true),
3583
- vue.unref(editable) ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
3608
+ vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3584
3609
  key: 1,
3585
3610
  effect: "dark",
3586
3611
  content: "\u5220\u9664",
3587
3612
  placement: "bottom"
3588
3613
  }, {
3589
3614
  default: vue.withCtx(() => [
3590
- vue.createVNode(_sfc_main$j, {
3615
+ vue.createVNode(_sfc_main$l, {
3591
3616
  icon: vue.unref(iconsVue.Close),
3592
3617
  class: "edit-icon",
3593
3618
  onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -3596,14 +3621,15 @@
3596
3621
  _: 2
3597
3622
  }, 1024)) : vue.createCommentVNode("", true),
3598
3623
  vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
3599
- id: data.id
3624
+ id: data.id,
3625
+ data: data.codeBlockContent
3600
3626
  })
3601
3627
  ])
3602
3628
  ]),
3603
3629
  data.showRelation && state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
3604
3630
  _hoisted_9,
3605
3631
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(state.bindComps[data.id], (comp, index) => {
3606
- return vue.openBlock(), vue.createBlock(_component_el_button, {
3632
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
3607
3633
  key: index,
3608
3634
  class: "code-comp",
3609
3635
  size: "small",
@@ -3632,10 +3658,12 @@
3632
3658
  }
3633
3659
  });
3634
3660
 
3635
- const _hoisted_1$4 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
3636
- const _hoisted_2$1 = ["onClick", "onDragstart"];
3661
+ const _hoisted_1$5 = ["onClick", "onDragstart"];
3662
+ const __default__$c = vue.defineComponent({
3663
+ name: "MEditorComponentListPanel"
3664
+ });
3637
3665
  const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
3638
- __name: "ComponentListPanel",
3666
+ ...__default__$c,
3639
3667
  setup(__props) {
3640
3668
  const searchText = vue.ref("");
3641
3669
  const services = vue.inject("services");
@@ -3648,7 +3676,7 @@
3648
3676
  }))
3649
3677
  );
3650
3678
  const collapseValue = vue.computed(
3651
- () => Array(list.value?.length).fill(1).map((x, i) => i)
3679
+ () => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
3652
3680
  );
3653
3681
  let timeout;
3654
3682
  let clientX;
@@ -3700,36 +3728,31 @@
3700
3728
  timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
3701
3729
  };
3702
3730
  return (_ctx, _cache) => {
3703
- const _component_el_input = vue.resolveComponent("el-input");
3704
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
3705
- const _component_el_collapse_item = vue.resolveComponent("el-collapse-item");
3706
- const _component_el_collapse = vue.resolveComponent("el-collapse");
3707
- const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
3708
- return vue.openBlock(), vue.createBlock(_component_el_scrollbar, null, {
3731
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), null, {
3709
3732
  default: vue.withCtx(() => [
3710
3733
  vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
3711
- vue.createVNode(_component_el_collapse, {
3734
+ vue.createVNode(vue.unref(design.TMagicCollapse), {
3712
3735
  class: "ui-component-panel",
3713
3736
  "model-value": vue.unref(collapseValue)
3714
3737
  }, {
3715
3738
  default: vue.withCtx(() => [
3716
- vue.createVNode(_component_el_input, {
3717
- "prefix-icon": "el-icon-search",
3739
+ vue.createVNode(vue.unref(design.TMagicInput), {
3718
3740
  placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
3719
3741
  class: "search-input",
3720
3742
  size: "small",
3721
3743
  clearable: "",
3744
+ "prefix-icon": vue.unref(iconsVue.Search),
3722
3745
  modelValue: searchText.value,
3723
3746
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event)
3724
- }, null, 8, ["modelValue"]),
3747
+ }, null, 8, ["prefix-icon", "modelValue"]),
3725
3748
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
3726
3749
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3727
- group.items && group.items.length ? (vue.openBlock(), vue.createBlock(_component_el_collapse_item, {
3750
+ group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
3728
3751
  key: index,
3729
- name: index
3752
+ name: `${index}`
3730
3753
  }, {
3731
3754
  title: vue.withCtx(() => [
3732
- _hoisted_1$4,
3755
+ vue.createVNode(_sfc_main$l, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
3733
3756
  vue.createTextVNode(vue.toDisplayString(group.title), 1)
3734
3757
  ]),
3735
3758
  default: vue.withCtx(() => [
@@ -3744,10 +3767,10 @@
3744
3767
  onDrag: dragHandler
3745
3768
  }, [
3746
3769
  vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
3747
- vue.createVNode(_sfc_main$j, {
3770
+ vue.createVNode(_sfc_main$l, {
3748
3771
  icon: item.icon
3749
3772
  }, null, 8, ["icon"]),
3750
- vue.createVNode(_component_el_tooltip, {
3773
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
3751
3774
  effect: "dark",
3752
3775
  placement: "bottom",
3753
3776
  content: item.text
@@ -3758,7 +3781,7 @@
3758
3781
  _: 2
3759
3782
  }, 1032, ["content"])
3760
3783
  ])
3761
- ], 40, _hoisted_2$1);
3784
+ ], 40, _hoisted_1$5);
3762
3785
  }), 128))
3763
3786
  ]),
3764
3787
  _: 2
@@ -3775,8 +3798,11 @@
3775
3798
  }
3776
3799
  });
3777
3800
 
3801
+ const __default__$b = vue.defineComponent({
3802
+ name: "MEditorContentMenu"
3803
+ });
3778
3804
  const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
3779
- __name: "ContentMenu",
3805
+ ...__default__$b,
3780
3806
  props: {
3781
3807
  menuData: { default: () => [] },
3782
3808
  isSubMenu: { type: Boolean, default: false }
@@ -3855,7 +3881,7 @@
3855
3881
  });
3856
3882
  return (_ctx, _cache) => {
3857
3883
  const _component_content_menu = vue.resolveComponent("content-menu", true);
3858
- return __props.menuData.length && visible.value ? (vue.openBlock(), vue.createElementBlock("div", {
3884
+ return __props.menuData.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
3859
3885
  key: 0,
3860
3886
  class: "magic-editor-content-menu",
3861
3887
  ref_key: "menu",
@@ -3883,21 +3909,29 @@
3883
3909
  onHide: hide
3884
3910
  }, null, 8, ["menu-data"])
3885
3911
  ]))
3886
- ], 4)) : vue.createCommentVNode("", true);
3912
+ ], 4)), [
3913
+ [vue.vShow, visible.value]
3914
+ ]) : vue.createCommentVNode("", true);
3887
3915
  };
3888
3916
  }
3889
3917
  });
3890
3918
 
3891
- const _sfc_main$b = vue.defineComponent({
3892
- components: { ContentMenu: _sfc_main$c },
3893
- setup() {
3919
+ const __default__$a = vue.defineComponent({
3920
+ name: "MEditorLayerMenu"
3921
+ });
3922
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
3923
+ ...__default__$a,
3924
+ props: {
3925
+ layerContentMenu: null
3926
+ },
3927
+ setup(__props, { expose }) {
3928
+ const props = __props;
3894
3929
  const services = vue.inject("services");
3895
3930
  const menu = vue.ref();
3896
3931
  const node = vue.computed(() => services?.editorService.get("node"));
3897
3932
  const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
3898
3933
  const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
3899
3934
  const componentList = vue.computed(() => services?.componentListService.getList() || []);
3900
- const layerContentMenu = vue.inject("layerContentMenu", []);
3901
3935
  const createMenuItems = (group) => group.items.map((component) => ({
3902
3936
  text: component.text,
3903
3937
  type: "button",
@@ -3941,533 +3975,575 @@
3941
3975
  }
3942
3976
  return [];
3943
3977
  });
3944
- return {
3945
- menu,
3946
- menuData: vue.computed(() => [
3947
- {
3948
- type: "button",
3949
- text: "\u65B0\u589E",
3950
- icon: vue.markRaw(iconsVue.Plus),
3951
- display: () => node.value?.items,
3952
- items: getSubMenuData.value
3953
- },
3954
- {
3955
- type: "button",
3956
- text: "\u590D\u5236",
3957
- icon: vue.markRaw(iconsVue.DocumentCopy),
3958
- display: () => !isRoot.value,
3959
- handler: () => {
3960
- node.value && services?.editorService.copy(node.value);
3961
- }
3962
- },
3963
- {
3964
- type: "button",
3965
- text: "\u5220\u9664",
3966
- icon: vue.markRaw(iconsVue.Delete),
3967
- display: () => !isRoot.value && !isPage.value,
3968
- handler: () => {
3969
- node.value && services?.editorService.remove(node.value);
3970
- }
3971
- },
3972
- ...layerContentMenu
3973
- ]),
3974
- show(e) {
3975
- menu.value?.show(e);
3978
+ const menuData = vue.computed(() => [
3979
+ {
3980
+ type: "button",
3981
+ text: "\u65B0\u589E",
3982
+ icon: vue.markRaw(iconsVue.Plus),
3983
+ display: () => node.value?.items,
3984
+ items: getSubMenuData.value
3985
+ },
3986
+ {
3987
+ type: "button",
3988
+ text: "\u590D\u5236",
3989
+ icon: vue.markRaw(iconsVue.DocumentCopy),
3990
+ display: () => !isRoot.value,
3991
+ handler: () => {
3992
+ node.value && services?.editorService.copy(node.value);
3993
+ }
3994
+ },
3995
+ {
3996
+ type: "button",
3997
+ text: "\u5220\u9664",
3998
+ icon: vue.markRaw(iconsVue.Delete),
3999
+ display: () => !isRoot.value && !isPage.value,
4000
+ handler: () => {
4001
+ node.value && services?.editorService.remove(node.value);
4002
+ }
4003
+ },
4004
+ ...props.layerContentMenu
4005
+ ]);
4006
+ const show = (e) => {
4007
+ menu.value?.show(e);
4008
+ };
4009
+ expose({
4010
+ show
4011
+ });
4012
+ return (_ctx, _cache) => {
4013
+ return vue.openBlock(), vue.createBlock(_sfc_main$c, {
4014
+ "menu-data": vue.unref(menuData),
4015
+ ref_key: "menu",
4016
+ ref: menu,
4017
+ style: { "overflow": "initial" }
4018
+ }, null, 8, ["menu-data"]);
4019
+ };
4020
+ }
4021
+ });
4022
+
4023
+ const _hoisted_1$4 = ["id", "onMouseenter"];
4024
+ const __default__$9 = vue.defineComponent({
4025
+ name: "MEditorLayerPanel"
4026
+ });
4027
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
4028
+ ...__default__$9,
4029
+ props: {
4030
+ layerContentMenu: null
4031
+ },
4032
+ setup(__props) {
4033
+ const throttleTime = 150;
4034
+ const services = vue.inject("services");
4035
+ const tree = vue.ref();
4036
+ const menu = vue.ref();
4037
+ const editorService = services?.editorService;
4038
+ const page = vue.computed(() => editorService?.get("page"));
4039
+ const values = vue.computed(() => page.value ? [page.value] : []);
4040
+ const selectedNodes = vue.ref([]);
4041
+ const selectedIds = vue.computed(() => selectedNodes.value.map((node) => node.id));
4042
+ const isMultiSelectStatus = vue.ref(false);
4043
+ const spliceNodeKey = vue.ref();
4044
+ const filterText = vue.ref("");
4045
+ const defaultExpandedKeys = vue.computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
4046
+ editorService?.on("remove", () => {
4047
+ setTimeout(() => {
4048
+ tree.value?.getNode(editorService.get("node").id)?.updateChildren();
4049
+ }, 0);
4050
+ });
4051
+ const select = async (data) => {
4052
+ if (!data.id) {
4053
+ throw new Error("\u6CA1\u6709id");
4054
+ }
4055
+ await editorService?.select(data);
4056
+ editorService?.get("stage")?.select(data.id);
4057
+ };
4058
+ const multiSelect = async (data) => {
4059
+ await editorService?.multiSelect(data);
4060
+ editorService?.get("stage")?.multiSelect(data);
4061
+ };
4062
+ const highlight = (data) => {
4063
+ if (!data?.id) {
4064
+ throw new Error("\u6CA1\u6709id");
4065
+ }
4066
+ editorService?.highlight(data);
4067
+ editorService?.get("stage")?.highlight(data.id);
4068
+ };
4069
+ const expandedKeys = /* @__PURE__ */ new Map();
4070
+ const allowDrop = (draggingNode, dropNode, type) => {
4071
+ const { data } = dropNode || {};
4072
+ const { data: ingData } = draggingNode;
4073
+ const { type: ingType } = ingData;
4074
+ if (ingType !== schema.NodeType.PAGE && data.type === schema.NodeType.PAGE)
4075
+ return false;
4076
+ if (ingType === schema.NodeType.PAGE && data.type !== schema.NodeType.PAGE)
4077
+ return false;
4078
+ if (!data || !data.type)
4079
+ return false;
4080
+ if (["prev", "next"].includes(type))
4081
+ return true;
4082
+ if (data.items || data.type === "container")
4083
+ return true;
4084
+ return false;
4085
+ };
4086
+ const handleDragEnd = async (e) => {
4087
+ if (!tree.value)
4088
+ return;
4089
+ const { data: node } = e;
4090
+ const parent = editorService?.getParentById(node.id, false);
4091
+ const layout = await editorService?.getLayout(parent);
4092
+ node.style.position = layout;
4093
+ if (layout === Layout.RELATIVE) {
4094
+ node.style.top = 0;
4095
+ node.style.left = 0;
4096
+ }
4097
+ const data = tree.value.getData();
4098
+ const [page2] = data;
4099
+ editorService?.update(page2);
4100
+ };
4101
+ const loadItems = (node, resolve) => {
4102
+ if (Array.isArray(node.data)) {
4103
+ return resolve(node.data);
4104
+ }
4105
+ if (Array.isArray(node.data?.items)) {
4106
+ return resolve(node.data?.items);
4107
+ }
4108
+ resolve([]);
4109
+ };
4110
+ const handleCollapse = (data) => {
4111
+ expandedKeys.delete(data.id);
4112
+ };
4113
+ const handleExpand = (data) => {
4114
+ const parent = editorService?.getParentById(data.id);
4115
+ if (!parent?.id)
4116
+ return;
4117
+ expandedKeys.set(parent.id, parent.id);
4118
+ };
4119
+ const filterNode = (value, data) => {
4120
+ if (!value) {
4121
+ return true;
3976
4122
  }
4123
+ let name = "";
4124
+ if (data.name) {
4125
+ name = data.name;
4126
+ } else if (data.items) {
4127
+ name = "container";
4128
+ }
4129
+ return `${data.id}${name}${data.type}`.indexOf(value) !== -1;
3977
4130
  };
3978
- }
3979
- });
3980
-
3981
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3982
- const _component_content_menu = vue.resolveComponent("content-menu");
3983
- return vue.openBlock(), vue.createBlock(_component_content_menu, {
3984
- "menu-data": _ctx.menuData,
3985
- ref: "menu",
3986
- style: { "overflow": "initial" }
3987
- }, null, 8, ["menu-data"]);
3988
- }
3989
- const LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$4]]);
3990
-
3991
- const throttleTime = 150;
3992
- const select = async (data, editorService) => {
3993
- if (!data.id) {
3994
- throw new Error("\u6CA1\u6709id");
3995
- }
3996
- await editorService?.select(data);
3997
- editorService?.get("stage")?.select(data.id);
3998
- };
3999
- const highlight = (data, editorService) => {
4000
- if (!data?.id) {
4001
- throw new Error("\u6CA1\u6709id");
4002
- }
4003
- editorService?.highlight(data);
4004
- editorService?.get("stage")?.highlight(data.id);
4005
- };
4006
- const useDrop = (tree, editorService) => ({
4007
- allowDrop: (draggingNode, dropNode, type) => {
4008
- const { data } = dropNode || {};
4009
- const { data: ingData } = draggingNode;
4010
- const { type: ingType } = ingData;
4011
- if (ingType !== schema.NodeType.PAGE && data.type === schema.NodeType.PAGE)
4012
- return false;
4013
- if (ingType === schema.NodeType.PAGE && data.type !== schema.NodeType.PAGE)
4014
- return false;
4015
- if (!data || !data.type)
4016
- return false;
4017
- if (["prev", "next"].includes(type))
4018
- return true;
4019
- if (data.items || data.type === "container")
4020
- return true;
4021
- return false;
4022
- },
4023
- async handleDragEnd(e) {
4024
- if (!tree.value)
4025
- return;
4026
- const { data: node } = e;
4027
- const parent = editorService?.getParentById(node.id, false);
4028
- const layout = await editorService?.getLayout(parent);
4029
- node.style.position = layout;
4030
- if (layout === Layout.RELATIVE) {
4031
- node.style.top = 0;
4032
- node.style.left = 0;
4033
- }
4034
- const { data } = tree.value;
4035
- const [page] = data;
4036
- editorService?.update(page);
4037
- }
4038
- });
4039
- const useStatus = (tree, editorService) => {
4040
- const node = vue.ref();
4041
- const page = vue.computed(() => editorService?.get("page"));
4042
- const expandedKeys = /* @__PURE__ */ new Map();
4043
- const expandNodes = () => {
4044
- expandedKeys.forEach((key) => {
4131
+ const filterTextChangeHandler = (val) => {
4132
+ tree.value?.filter(val);
4133
+ };
4134
+ const expandNodes = async () => {
4045
4135
  if (!tree.value)
4046
4136
  return;
4047
- tree.value.getNode(key)?.expand();
4048
- });
4049
- };
4050
- vue.watchEffect(() => {
4051
- if (!tree.value)
4052
- return;
4053
- if (!editorService)
4054
- return;
4055
- node.value = editorService.get("node");
4056
- if (!node.value)
4057
- return;
4058
- tree.value.setCurrentKey(node.value.id, true);
4059
- const parent = editorService.get("parent");
4060
- if (!parent?.id)
4061
- return;
4062
- const treeNode = tree.value.getNode(parent.id);
4063
- treeNode?.updateChildren();
4064
- setTimeout(() => {
4065
- tree.value && Object.entries(tree.value.store.nodesMap).forEach(([id, node2]) => {
4066
- if (node2.expanded && node2.data.items) {
4137
+ await vue.nextTick();
4138
+ tree.value && Object.entries(tree.value.getStore().nodesMap).forEach(([id, node]) => {
4139
+ if (node.expanded && node.data.items) {
4067
4140
  expandedKeys.set(id, id);
4068
4141
  }
4069
4142
  });
4070
- expandNodes();
4071
- });
4072
- });
4073
- return {
4074
- values: vue.computed(() => page.value ? [page.value] : []),
4075
- loadItems: (node2, resolve) => {
4076
- if (Array.isArray(node2.data)) {
4077
- return resolve(node2.data);
4143
+ expandedKeys.forEach((key) => {
4144
+ if (!tree.value)
4145
+ return;
4146
+ tree.value.getNode(key)?.expand();
4147
+ });
4148
+ };
4149
+ vue.watch(
4150
+ () => editorService?.get("nodes"),
4151
+ (nodes) => {
4152
+ selectedNodes.value = nodes ?? [];
4078
4153
  }
4079
- if (Array.isArray(node2.data?.items)) {
4080
- return resolve(node2.data?.items);
4154
+ );
4155
+ const setTreeKeyStatus = () => {
4156
+ if (!tree.value)
4157
+ return;
4158
+ if (selectedIds.value.length === 0) {
4159
+ tree.value.setCheckedKeys([]);
4160
+ tree.value.setCurrentKey();
4161
+ } else if (selectedIds.value.length === 1 && !isMultiSelectStatus.value) {
4162
+ tree.value.setCurrentKey(selectedIds.value[0], true);
4163
+ tree.value.setCheckedKeys([]);
4164
+ } else {
4165
+ tree.value.setCheckedKeys(selectedIds.value);
4166
+ tree.value.setCurrentKey();
4081
4167
  }
4082
- resolve([]);
4083
- },
4084
- highlightNode: vue.computed(() => editorService?.get("highlightNode")),
4085
- clickNode: node,
4086
- expandedKeys: vue.computed(() => node.value ? [node.value.id] : []),
4087
- handleCollapse: (data) => {
4088
- expandedKeys.delete(data.id);
4089
- },
4090
- handleExpand: (data) => {
4091
- const parent = editorService?.getParentById(data.id);
4168
+ };
4169
+ vue.watch([selectedIds, tree], async () => {
4170
+ if (!tree.value || !editorService)
4171
+ return;
4172
+ const parent = editorService.get("parent");
4092
4173
  if (!parent?.id)
4093
4174
  return;
4094
- expandedKeys.set(parent.id, parent.id);
4095
- }
4096
- };
4097
- };
4098
- const useFilter = (tree) => ({
4099
- filterText: vue.ref(""),
4100
- filterNode: (value, data) => {
4101
- if (!value) {
4102
- return true;
4103
- }
4104
- let name = "";
4105
- if (data.name) {
4106
- name = data.name;
4107
- } else if (data.items) {
4108
- name = "container";
4109
- }
4110
- return `${data.id}${name}${data.type}`.indexOf(value) !== -1;
4111
- },
4112
- filterTextChangeHandler(val) {
4113
- tree.value?.filter(val);
4114
- }
4115
- });
4116
- const _sfc_main$a = vue.defineComponent({
4117
- name: "magic-editor-layer-panel",
4118
- components: { LayerMenu },
4119
- setup() {
4120
- const services = vue.inject("services");
4121
- const tree = vue.ref();
4122
- const menu = vue.ref();
4175
+ const treeNode = tree.value.getNode(parent.id);
4176
+ treeNode?.updateChildren();
4177
+ await expandNodes();
4178
+ setTreeKeyStatus();
4179
+ });
4180
+ const keycon = vue.ref();
4181
+ const addSelectModeListener = () => {
4182
+ const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
4183
+ const ctrl = isMac ? "meta" : "ctrl";
4184
+ keycon.value = new KeyController__default.default();
4185
+ keycon.value.keydown(ctrl, (e) => {
4186
+ e.inputEvent.preventDefault();
4187
+ isMultiSelectStatus.value = true;
4188
+ });
4189
+ keycon.value.on("blur", () => {
4190
+ isMultiSelectStatus.value = false;
4191
+ });
4192
+ keycon.value.keyup(ctrl, (e) => {
4193
+ e.inputEvent.preventDefault();
4194
+ isMultiSelectStatus.value = false;
4195
+ });
4196
+ };
4197
+ const removeSelectModeListener = () => {
4198
+ keycon.value?.destroy();
4199
+ if (selectedIds.value.length === 1)
4200
+ isMultiSelectStatus.value = false;
4201
+ };
4123
4202
  const clicked = vue.ref(false);
4124
- const editorService = services?.editorService;
4203
+ const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
4125
4204
  const highlightHandler = lodashEs.throttle((data) => {
4126
- highlight(data, editorService);
4205
+ highlight(data);
4127
4206
  }, throttleTime);
4128
4207
  const toggleClickFlag = () => {
4129
4208
  clicked.value = !clicked.value;
4130
4209
  };
4131
- const statusData = useStatus(tree, editorService);
4132
- const canHighlight = vue.computed(
4133
- () => statusData.highlightNode.value?.id !== statusData.clickNode.value?.id && !clicked.value
4134
- );
4135
- editorService?.on("remove", () => {
4136
- setTimeout(() => {
4137
- tree.value?.getNode(editorService.get("node").id)?.updateChildren();
4138
- }, 0);
4210
+ const canHighlight = (data) => {
4211
+ if (clicked.value)
4212
+ return false;
4213
+ return data.id === highlightNode?.value?.id && !selectedIds.value.includes(data.id) && spliceNodeKey.value !== data.id;
4214
+ };
4215
+ vue.watch(isMultiSelectStatus, () => {
4216
+ if (isMultiSelectStatus.value && selectedNodes.value.length === 1 && selectedNodes.value[0].type === schema.NodeType.PAGE) {
4217
+ selectedNodes.value = [];
4218
+ }
4139
4219
  });
4140
- return {
4141
- tree,
4142
- menu,
4143
- ...statusData,
4144
- ...useDrop(tree, editorService),
4145
- ...useFilter(tree),
4146
- highlightHandler,
4147
- toggleClickFlag,
4148
- canHighlight,
4149
- clickHandler(data) {
4220
+ const multiClickHandler = (data) => {
4221
+ if (!data?.id) {
4222
+ throw new Error("\u6CA1\u6709id");
4223
+ }
4224
+ if (data.type === schema.NodeType.PAGE) {
4225
+ tree.value?.setCheckedKeys([]);
4226
+ return;
4227
+ }
4228
+ const index = selectedNodes.value.findIndex((node) => node.id === data.id);
4229
+ if (index !== -1) {
4230
+ selectedNodes.value.splice(index, 1);
4231
+ spliceNodeKey.value = data.id;
4232
+ } else {
4233
+ selectedNodes.value = [...selectedNodes.value, data];
4234
+ }
4235
+ tree.value?.setCheckedKeys(selectedIds.value);
4236
+ multiSelect(selectedIds.value);
4237
+ };
4238
+ const clickHandler = (data) => {
4239
+ if (!isMultiSelectStatus.value) {
4150
4240
  if (services?.uiService.get("uiSelectMode")) {
4151
4241
  document.dispatchEvent(new CustomEvent("ui-select", { detail: data }));
4152
4242
  return;
4153
4243
  }
4154
4244
  tree.value?.setCurrentKey(data.id);
4155
- select(data, editorService);
4156
- },
4157
- async contextmenu(event, data) {
4158
- event.preventDefault();
4159
- await select(data, editorService);
4160
- menu.value?.show(event);
4245
+ select(data);
4246
+ } else {
4247
+ multiClickHandler(data);
4161
4248
  }
4162
4249
  };
4163
- }
4164
- });
4165
-
4166
- const _hoisted_1$3 = ["id", "onMouseenter"];
4167
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
4168
- const _component_el_input = vue.resolveComponent("el-input");
4169
- const _component_el_tree = vue.resolveComponent("el-tree");
4170
- const _component_layer_menu = vue.resolveComponent("layer-menu");
4171
- const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
4172
- return vue.openBlock(), vue.createBlock(_component_el_scrollbar, { class: "magic-editor-layer-panel" }, {
4173
- default: vue.withCtx(() => [
4174
- vue.renderSlot(_ctx.$slots, "layer-panel-header"),
4175
- vue.createVNode(_component_el_input, {
4176
- class: "filterInput",
4177
- size: "small",
4178
- placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
4179
- clearable: "",
4180
- modelValue: _ctx.filterText,
4181
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filterText = $event),
4182
- onChange: _ctx.filterTextChangeHandler
4183
- }, null, 8, ["modelValue", "onChange"]),
4184
- _ctx.values.length ? (vue.openBlock(), vue.createBlock(_component_el_tree, {
4185
- key: 0,
4186
- ref: "tree",
4187
- "node-key": "id",
4188
- "empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
4189
- draggable: "",
4190
- "default-expanded-keys": _ctx.expandedKeys,
4191
- load: _ctx.loadItems,
4192
- data: _ctx.values,
4193
- "expand-on-click-node": false,
4194
- "highlight-current": true,
4195
- props: {
4196
- children: "items"
4197
- },
4198
- "filter-node-method": _ctx.filterNode,
4199
- "allow-drop": _ctx.allowDrop,
4200
- onNodeClick: _ctx.clickHandler,
4201
- onNodeContextmenu: _ctx.contextmenu,
4202
- onNodeDragEnd: _ctx.handleDragEnd,
4203
- onNodeCollapse: _ctx.handleCollapse,
4204
- onNodeExpand: _ctx.handleExpand
4250
+ const contextmenu = async (event, data) => {
4251
+ event.preventDefault();
4252
+ await select(data);
4253
+ menu.value?.show(event);
4254
+ };
4255
+ return (_ctx, _cache) => {
4256
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), {
4257
+ class: "magic-editor-layer-panel",
4258
+ onMouseenter: addSelectModeListener,
4259
+ onMouseleave: removeSelectModeListener
4205
4260
  }, {
4206
- default: vue.withCtx(({ node, data }) => [
4207
- vue.createElementVNode("div", {
4208
- id: data.id,
4209
- class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": _ctx.canHighlight && data.id === _ctx.highlightNode?.id }]),
4210
- onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.toggleClickFlag && _ctx.toggleClickFlag(...args)),
4211
- onMouseup: _cache[2] || (_cache[2] = (...args) => _ctx.toggleClickFlag && _ctx.toggleClickFlag(...args)),
4212
- onMouseenter: ($event) => _ctx.highlightHandler(data)
4213
- }, [
4214
- vue.renderSlot(_ctx.$slots, "layer-node-content", {
4215
- node,
4216
- data
4217
- }, () => [
4218
- vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
4219
- ])
4220
- ], 42, _hoisted_1$3)
4261
+ default: vue.withCtx(() => [
4262
+ vue.renderSlot(_ctx.$slots, "layer-panel-header"),
4263
+ vue.createVNode(vue.unref(design.TMagicInput), {
4264
+ modelValue: filterText.value,
4265
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
4266
+ class: "search-input",
4267
+ size: "small",
4268
+ placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
4269
+ clearable: "",
4270
+ "prefix-icon": vue.unref(iconsVue.Search),
4271
+ onChange: filterTextChangeHandler
4272
+ }, null, 8, ["modelValue", "prefix-icon"]),
4273
+ vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
4274
+ key: 0,
4275
+ class: "magic-editor-layer-tree",
4276
+ ref_key: "tree",
4277
+ ref: tree,
4278
+ "node-key": "id",
4279
+ "empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
4280
+ draggable: "",
4281
+ "default-expanded-keys": vue.unref(defaultExpandedKeys),
4282
+ load: loadItems,
4283
+ data: vue.unref(values),
4284
+ "expand-on-click-node": false,
4285
+ "highlight-current": true,
4286
+ props: {
4287
+ children: "items"
4288
+ },
4289
+ "filter-node-method": filterNode,
4290
+ "allow-drop": allowDrop,
4291
+ "show-checkbox": isMultiSelectStatus.value || vue.unref(selectedIds).length > 1,
4292
+ onNodeClick: clickHandler,
4293
+ onNodeContextmenu: contextmenu,
4294
+ onNodeDragEnd: handleDragEnd,
4295
+ onNodeCollapse: handleCollapse,
4296
+ onNodeExpand: handleExpand,
4297
+ onCheck: multiClickHandler,
4298
+ onMousedown: toggleClickFlag,
4299
+ onMouseup: toggleClickFlag
4300
+ }, {
4301
+ default: vue.withCtx(({ node, data }) => [
4302
+ vue.createElementVNode("div", {
4303
+ id: data.id,
4304
+ class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
4305
+ onMouseenter: ($event) => vue.unref(highlightHandler)(data)
4306
+ }, [
4307
+ vue.renderSlot(_ctx.$slots, "layer-node-content", {
4308
+ node,
4309
+ data
4310
+ }, () => [
4311
+ vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
4312
+ ])
4313
+ ], 42, _hoisted_1$4)
4314
+ ]),
4315
+ _: 3
4316
+ }, 8, ["default-expanded-keys", "data", "show-checkbox"])) : vue.createCommentVNode("", true),
4317
+ (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
4318
+ vue.createVNode(_sfc_main$b, {
4319
+ ref_key: "menu",
4320
+ ref: menu,
4321
+ "layer-content-menu": __props.layerContentMenu
4322
+ }, null, 8, ["layer-content-menu"])
4323
+ ]))
4221
4324
  ]),
4222
4325
  _: 3
4223
- }, 8, ["default-expanded-keys", "load", "data", "filter-node-method", "allow-drop", "onNodeClick", "onNodeContextmenu", "onNodeDragEnd", "onNodeCollapse", "onNodeExpand"])) : vue.createCommentVNode("", true),
4224
- (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
4225
- vue.createVNode(_component_layer_menu, { ref: "menu" }, null, 512)
4226
- ]))
4227
- ]),
4228
- _: 3
4229
- });
4230
- }
4231
- const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$3]]);
4232
-
4233
- const _sfc_main$9 = vue.defineComponent({
4234
- components: { MIcon: _sfc_main$j },
4235
- props: {
4236
- data: {
4237
- type: [Object, String]
4238
- }
4239
- },
4240
- setup(props) {
4241
- return {
4242
- config: vue.computed(() => {
4243
- if (typeof props.data !== "string") {
4244
- return props.data;
4245
- }
4246
- switch (props.data) {
4247
- case "component-list":
4248
- return {
4249
- type: "component",
4250
- icon: iconsVue.Coin,
4251
- text: "\u7EC4\u4EF6",
4252
- component: _sfc_main$d,
4253
- slots: {}
4254
- };
4255
- case "layer":
4256
- return {
4257
- type: "component",
4258
- icon: iconsVue.Files,
4259
- text: "\u5DF2\u9009\u7EC4\u4EF6",
4260
- component: LayerPanel,
4261
- slots: {}
4262
- };
4263
- case "code-block":
4264
- return {
4265
- type: "component",
4266
- icon: iconsVue.EditPen,
4267
- text: "\u4EE3\u7801\u7F16\u8F91",
4268
- component: _sfc_main$e,
4269
- slots: {}
4270
- };
4271
- default:
4272
- return void 0;
4273
- }
4274
- })
4326
+ });
4275
4327
  };
4276
4328
  }
4277
4329
  });
4278
4330
 
4279
- const _hoisted_1$2 = {
4331
+ const _hoisted_1$3 = {
4280
4332
  key: 1,
4281
4333
  class: "magic-editor-tab-panel-title"
4282
4334
  };
4283
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
4284
- const _component_m_icon = vue.resolveComponent("m-icon");
4285
- const _component_el_tab_pane = vue.resolveComponent("el-tab-pane");
4286
- return _ctx.config ? (vue.openBlock(), vue.createBlock(_component_el_tab_pane, {
4287
- key: 0,
4288
- name: _ctx.config.text
4289
- }, {
4290
- label: vue.withCtx(() => [
4291
- (vue.openBlock(), vue.createElementBlock("div", {
4292
- key: _ctx.config.text
4293
- }, [
4294
- _ctx.config.icon ? (vue.openBlock(), vue.createBlock(_component_m_icon, {
4295
- key: 0,
4296
- icon: _ctx.config.icon
4297
- }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
4298
- _ctx.config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, vue.toDisplayString(_ctx.config.text), 1)) : vue.createCommentVNode("", true)
4299
- ]))
4300
- ]),
4301
- default: vue.withCtx(() => [
4302
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.component), vue.mergeProps(_ctx.config.props || {}, vue.toHandlers(_ctx.config?.listeners || {})), vue.createSlots({ _: 2 }, [
4303
- _ctx.data === "component-list" || _ctx.config.slots?.componentListPanelHeader ? {
4304
- name: "component-list-panel-header",
4305
- fn: vue.withCtx(() => [
4306
- _ctx.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : _ctx.config.slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4307
- ])
4308
- } : void 0,
4309
- _ctx.data === "component-list" || _ctx.config.slots?.componentListItem ? {
4310
- name: "component-list-item",
4311
- fn: vue.withCtx(({ component }) => [
4312
- _ctx.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
4313
- key: 0,
4314
- component
4315
- }) : _ctx.config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.componentListItem), {
4316
- key: 1,
4317
- component
4318
- }, null, 8, ["component"])) : vue.createCommentVNode("", true)
4319
- ])
4320
- } : void 0,
4321
- _ctx.data === "layer" || _ctx.config.slots?.layerPanelHeader ? {
4322
- name: "layer-panel-header",
4323
- fn: vue.withCtx(() => [
4324
- _ctx.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : _ctx.config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4325
- ])
4326
- } : void 0,
4327
- _ctx.data === "code-block" || _ctx.config.slots?.codeBlockPanelHeader ? {
4328
- name: "code-block-panel-header",
4329
- fn: vue.withCtx(() => [
4330
- _ctx.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : _ctx.config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4331
- ])
4332
- } : void 0,
4333
- _ctx.data === "code-block" || _ctx.config.slots?.codeBlockPanelTool ? {
4334
- name: "code-block-panel-tool",
4335
- fn: vue.withCtx(({ id }) => [
4336
- _ctx.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
4337
- key: 0,
4338
- id
4339
- }) : _ctx.config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
4340
- ])
4341
- } : void 0,
4342
- _ctx.data === "code-block" || _ctx.config.slots?.codeBlockEditPanelHeader ? {
4343
- name: "code-block-edit-panel-header",
4344
- fn: vue.withCtx(({ id }) => [
4345
- _ctx.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
4346
- key: 0,
4347
- id
4348
- }) : _ctx.config.slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4349
- ])
4350
- } : void 0,
4351
- _ctx.data === "layer" || _ctx.config.slots?.layerNodeContent ? {
4352
- name: "layer-node-content",
4353
- fn: vue.withCtx(({ data: nodeData, node }) => [
4354
- _ctx.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
4355
- key: 0,
4356
- data: nodeData,
4357
- node
4358
- }) : _ctx.config.slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.layerNodeContent), {
4359
- key: 1,
4360
- data: nodeData,
4361
- node
4362
- }, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
4363
- ])
4364
- } : void 0
4365
- ]), 1040))
4366
- ]),
4367
- _: 3
4368
- }, 8, ["name"])) : vue.createCommentVNode("", true);
4369
- }
4370
- const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$2]]);
4371
-
4372
- const _sfc_main$8 = vue.defineComponent({
4373
- components: { TabPane },
4374
- name: "m-sidebar",
4335
+ const __default__$8 = vue.defineComponent({
4336
+ name: "MEditorSidebar"
4337
+ });
4338
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
4339
+ ...__default__$8,
4375
4340
  props: {
4376
- data: {
4377
- type: Object,
4378
- default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] })
4379
- }
4341
+ data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) },
4342
+ layerContentMenu: null
4380
4343
  },
4381
- setup(props) {
4344
+ setup(__props, { expose }) {
4345
+ const props = __props;
4346
+ const uiComponent = design.getConfig("components").tabPane;
4382
4347
  const activeTabName = vue.ref(props.data?.status);
4348
+ const getItemConfig = (data) => {
4349
+ const map = {
4350
+ "component-list": {
4351
+ $key: "component-list",
4352
+ type: "component",
4353
+ icon: iconsVue.Coin,
4354
+ text: "\u7EC4\u4EF6",
4355
+ component: _sfc_main$d,
4356
+ slots: {}
4357
+ },
4358
+ layer: {
4359
+ $key: "layer",
4360
+ type: "component",
4361
+ icon: iconsVue.Files,
4362
+ text: "\u5DF2\u9009\u7EC4\u4EF6",
4363
+ props: {
4364
+ layerContentMenu: props.layerContentMenu
4365
+ },
4366
+ component: _sfc_main$a,
4367
+ slots: {}
4368
+ },
4369
+ "code-block": {
4370
+ $key: "code-block",
4371
+ type: "component",
4372
+ icon: iconsVue.EditPen,
4373
+ text: "\u4EE3\u7801\u7F16\u8F91",
4374
+ component: _sfc_main$e,
4375
+ slots: {}
4376
+ }
4377
+ };
4378
+ return typeof data === "string" ? map[data] : data;
4379
+ };
4380
+ const sideBarItems = vue.computed(() => props.data.items.map((item) => getItemConfig(item)));
4383
4381
  vue.watch(
4384
- () => props.data?.status,
4382
+ () => props.data.status,
4385
4383
  (status) => {
4386
4384
  activeTabName.value = status || "0";
4387
4385
  }
4388
4386
  );
4389
- return {
4387
+ expose({
4390
4388
  activeTabName
4389
+ });
4390
+ return (_ctx, _cache) => {
4391
+ return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabs), {
4392
+ key: 0,
4393
+ class: "m-editor-sidebar",
4394
+ modelValue: activeTabName.value,
4395
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
4396
+ type: "card",
4397
+ "tab-position": "left"
4398
+ }, {
4399
+ default: vue.withCtx(() => [
4400
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(sideBarItems), (config, index) => {
4401
+ return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(uiComponent).component), {
4402
+ key: index,
4403
+ name: config.text
4404
+ }, {
4405
+ label: vue.withCtx(() => [
4406
+ (vue.openBlock(), vue.createElementBlock("div", {
4407
+ key: config.text
4408
+ }, [
4409
+ config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
4410
+ key: 0,
4411
+ icon: config.icon
4412
+ }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
4413
+ config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
4414
+ ]))
4415
+ ]),
4416
+ default: vue.withCtx(() => [
4417
+ config ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({ key: 0 }, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
4418
+ config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
4419
+ name: "component-list-panel-header",
4420
+ fn: vue.withCtx(() => [
4421
+ config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4422
+ ])
4423
+ } : void 0,
4424
+ config.$key === "component-list" || config.slots?.componentListItem ? {
4425
+ name: "component-list-item",
4426
+ fn: vue.withCtx(({ component }) => [
4427
+ config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
4428
+ key: 0,
4429
+ component
4430
+ }) : config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListItem), {
4431
+ key: 1,
4432
+ component
4433
+ }, null, 8, ["component"])) : vue.createCommentVNode("", true)
4434
+ ])
4435
+ } : void 0,
4436
+ config.$key === "layer" || config.slots?.layerPanelHeader ? {
4437
+ name: "layer-panel-header",
4438
+ fn: vue.withCtx(() => [
4439
+ config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4440
+ ])
4441
+ } : void 0,
4442
+ config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
4443
+ name: "code-block-panel-header",
4444
+ fn: vue.withCtx(() => [
4445
+ config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4446
+ ])
4447
+ } : void 0,
4448
+ config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
4449
+ name: "code-block-panel-tool",
4450
+ fn: vue.withCtx(({ id, data }) => [
4451
+ config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
4452
+ key: 0,
4453
+ id,
4454
+ data
4455
+ }) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
4456
+ ])
4457
+ } : void 0,
4458
+ config.$key === "code-block" || config.slots?.codeBlockEditPanelHeader ? {
4459
+ name: "code-block-edit-panel-header",
4460
+ fn: vue.withCtx(({ id }) => [
4461
+ config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
4462
+ key: 0,
4463
+ id
4464
+ }) : config.slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4465
+ ])
4466
+ } : void 0,
4467
+ config.$key === "layer" || config.slots?.layerNodeContent ? {
4468
+ name: "layer-node-content",
4469
+ fn: vue.withCtx(({ data: nodeData, node }) => [
4470
+ config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
4471
+ key: 0,
4472
+ data: nodeData,
4473
+ node
4474
+ }) : config.slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerNodeContent), {
4475
+ key: 1,
4476
+ data: nodeData,
4477
+ node
4478
+ }, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
4479
+ ])
4480
+ } : void 0
4481
+ ]), 1040)) : vue.createCommentVNode("", true)
4482
+ ]),
4483
+ _: 2
4484
+ }, 1032, ["name"]);
4485
+ }), 128))
4486
+ ]),
4487
+ _: 3
4488
+ }, 8, ["modelValue"])) : vue.createCommentVNode("", true);
4391
4489
  };
4392
4490
  }
4393
4491
  });
4394
4492
 
4395
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
4396
- const _component_tab_pane = vue.resolveComponent("tab-pane");
4397
- const _component_el_tabs = vue.resolveComponent("el-tabs");
4398
- return _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createBlock(_component_el_tabs, {
4399
- key: 0,
4400
- class: "m-editor-sidebar",
4401
- modelValue: _ctx.activeTabName,
4402
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.activeTabName = $event),
4403
- type: "card",
4404
- "tab-position": "left"
4405
- }, {
4406
- default: vue.withCtx(() => [
4407
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.data.items, (item, index) => {
4408
- return vue.openBlock(), vue.createBlock(_component_tab_pane, {
4409
- key: index,
4410
- data: item
4411
- }, vue.createSlots({ _: 2 }, [
4412
- item === "layer" ? {
4413
- name: "layer-panel-header",
4414
- fn: vue.withCtx(() => [
4415
- vue.renderSlot(_ctx.$slots, "layer-panel-header")
4416
- ])
4417
- } : void 0,
4418
- item === "layer" ? {
4419
- name: "layer-node-content",
4420
- fn: vue.withCtx(({ node, data }) => [
4421
- vue.renderSlot(_ctx.$slots, "layer-node-content", {
4422
- data,
4423
- node
4424
- })
4425
- ])
4426
- } : void 0,
4427
- item === "component-list" ? {
4428
- name: "component-list-panel-header",
4429
- fn: vue.withCtx(() => [
4430
- vue.renderSlot(_ctx.$slots, "component-list-panel-header")
4431
- ])
4432
- } : void 0,
4433
- item === "component-list" ? {
4434
- name: "component-list-item",
4435
- fn: vue.withCtx(({ component }) => [
4436
- vue.renderSlot(_ctx.$slots, "component-list-item", { component })
4437
- ])
4438
- } : void 0,
4439
- item === "code-block" ? {
4440
- name: "code-block-panel-header",
4441
- fn: vue.withCtx(() => [
4442
- vue.renderSlot(_ctx.$slots, "code-block-panel-header")
4443
- ])
4444
- } : void 0,
4445
- item === "code-block" ? {
4446
- name: "code-block-panel-tool",
4447
- fn: vue.withCtx(({ id }) => [
4448
- vue.renderSlot(_ctx.$slots, "code-block-panel-tool", { id })
4449
- ])
4450
- } : void 0,
4451
- item === "code-block" ? {
4452
- name: "code-block-edit-panel-header",
4453
- fn: vue.withCtx(({ id }) => [
4454
- vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
4455
- ])
4456
- } : void 0
4457
- ]), 1032, ["data"]);
4458
- }), 128))
4459
- ]),
4460
- _: 3
4461
- }, 8, ["modelValue"])) : vue.createCommentVNode("", true);
4462
- }
4463
- const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$1]]);
4493
+ const _hoisted_1$2 = {
4494
+ key: 0,
4495
+ class: "m-editor-breadcrumb"
4496
+ };
4497
+ const _hoisted_2$1 = { key: 0 };
4498
+ const __default__$7 = vue.defineComponent({
4499
+ name: "MEditorBreadcrumb"
4500
+ });
4501
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
4502
+ ...__default__$7,
4503
+ setup(__props) {
4504
+ const services = vue.inject("services");
4505
+ const editorService = services?.editorService;
4506
+ const node = vue.computed(() => editorService?.get("node"));
4507
+ const nodes = vue.computed(() => editorService?.get("nodes") || []);
4508
+ const root = vue.computed(() => editorService?.get("root"));
4509
+ const path = vue.computed(() => utils.getNodePath(node.value?.id || "", root.value?.items || []));
4510
+ const select = async (node2) => {
4511
+ await editorService?.select(node2);
4512
+ editorService?.get("stage")?.select(node2.id);
4513
+ };
4514
+ return (_ctx, _cache) => {
4515
+ return vue.unref(nodes).length === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
4516
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(path), (item, index) => {
4517
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
4518
+ key: item.id
4519
+ }, [
4520
+ vue.createVNode(vue.unref(design.TMagicButton), {
4521
+ text: "",
4522
+ disabled: item.id === vue.unref(node)?.id,
4523
+ onClick: ($event) => select(item)
4524
+ }, {
4525
+ default: vue.withCtx(() => [
4526
+ vue.createTextVNode(vue.toDisplayString(item.name), 1)
4527
+ ]),
4528
+ _: 2
4529
+ }, 1032, ["disabled", "onClick"]),
4530
+ index < vue.unref(path).length - 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$1, "/")) : vue.createCommentVNode("", true)
4531
+ ], 64);
4532
+ }), 128))
4533
+ ])) : vue.createCommentVNode("", true);
4534
+ };
4535
+ }
4536
+ });
4464
4537
 
4465
4538
  const _hoisted_1$1 = {
4466
4539
  key: 1,
4467
4540
  style: { "width": "21px" }
4468
4541
  };
4542
+ const __default__$6 = vue.defineComponent({
4543
+ name: "MEditorPageBarScrollContainer"
4544
+ });
4469
4545
  const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
4470
- __name: "PageBarScrollContainer",
4546
+ ...__default__$6,
4471
4547
  setup(__props) {
4472
4548
  const services = vue.inject("services");
4473
4549
  const editorService = services?.editorService;
@@ -4548,14 +4624,14 @@
4548
4624
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4549
4625
  onClick: addPage
4550
4626
  }, [
4551
- vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
4627
+ vue.createVNode(_sfc_main$l, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
4552
4628
  ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
4553
4629
  canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
4554
4630
  key: 2,
4555
4631
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4556
4632
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
4557
4633
  }, [
4558
- vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
4634
+ vue.createVNode(_sfc_main$l, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
4559
4635
  ])) : vue.createCommentVNode("", true),
4560
4636
  vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
4561
4637
  key: 3,
@@ -4571,7 +4647,7 @@
4571
4647
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4572
4648
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
4573
4649
  }, [
4574
- vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
4650
+ vue.createVNode(_sfc_main$l, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
4575
4651
  ])) : vue.createCommentVNode("", true)
4576
4652
  ], 512);
4577
4653
  };
@@ -4580,8 +4656,11 @@
4580
4656
 
4581
4657
  const _hoisted_1 = ["onClick"];
4582
4658
  const _hoisted_2 = { class: "m-editor-page-bar-title" };
4659
+ const __default__$5 = vue.defineComponent({
4660
+ name: "MEditorPageBar"
4661
+ });
4583
4662
  const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
4584
- __name: "PageBar",
4663
+ ...__default__$5,
4585
4664
  setup(__props) {
4586
4665
  const services = vue.inject("services");
4587
4666
  const editorService = services?.editorService;
@@ -4601,9 +4680,6 @@
4601
4680
  editorService?.remove(node);
4602
4681
  };
4603
4682
  return (_ctx, _cache) => {
4604
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
4605
- const _component_el_icon = vue.resolveComponent("el-icon");
4606
- const _component_el_popover = vue.resolveComponent("el-popover");
4607
4683
  return vue.openBlock(), vue.createBlock(_sfc_main$7, null, {
4608
4684
  default: vue.withCtx(() => [
4609
4685
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(root) && vue.unref(root).items || [], (item) => {
@@ -4614,7 +4690,7 @@
4614
4690
  }, [
4615
4691
  vue.createElementVNode("div", _hoisted_2, [
4616
4692
  vue.renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
4617
- vue.createVNode(_component_el_tooltip, {
4693
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
4618
4694
  effect: "dark",
4619
4695
  placement: "top-start",
4620
4696
  content: item.name
@@ -4626,14 +4702,14 @@
4626
4702
  }, 1032, ["content"])
4627
4703
  ])
4628
4704
  ]),
4629
- vue.createVNode(_component_el_popover, {
4705
+ vue.createVNode(vue.unref(design.TMagicPopover), {
4630
4706
  "popper-class": "page-bar-popover",
4631
4707
  placement: "top",
4632
4708
  width: 160,
4633
4709
  trigger: "hover"
4634
4710
  }, {
4635
4711
  reference: vue.withCtx(() => [
4636
- vue.createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
4712
+ vue.createVNode(vue.unref(design.TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
4637
4713
  default: vue.withCtx(() => [
4638
4714
  vue.createVNode(vue.unref(iconsVue.CaretBottom))
4639
4715
  ]),
@@ -4685,6 +4761,10 @@
4685
4761
  height = 0;
4686
4762
  translateXCorrectionValue = 0;
4687
4763
  translateYCorrectionValue = 0;
4764
+ correctionScrollSize = {
4765
+ width: 0,
4766
+ height: 0
4767
+ };
4688
4768
  resizeObserver = new ResizeObserver(() => {
4689
4769
  this.setSize();
4690
4770
  this.setScrollSize();
@@ -4694,6 +4774,12 @@
4694
4774
  this.container = options.container;
4695
4775
  this.target = options.target;
4696
4776
  this.zoom = options.zoom;
4777
+ if (this.correctionScrollSize) {
4778
+ this.correctionScrollSize = {
4779
+ ...this.correctionScrollSize,
4780
+ ...options.correctionScrollSize
4781
+ };
4782
+ }
4697
4783
  this.container.addEventListener("wheel", this.wheelHandler, false);
4698
4784
  this.setSize();
4699
4785
  this.setScrollSize();
@@ -4756,9 +4842,9 @@
4756
4842
  }
4757
4843
  setScrollSize = () => {
4758
4844
  const targetRect = this.target.getBoundingClientRect();
4759
- this.scrollWidth = targetRect.width * this.zoom + 100;
4845
+ this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
4760
4846
  const targetMarginTop = Number(this.target.style.marginTop) || 0;
4761
- this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + 100;
4847
+ this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
4762
4848
  let left;
4763
4849
  let top;
4764
4850
  if (this.scrollWidth < this.width) {
@@ -4791,8 +4877,11 @@
4791
4877
  };
4792
4878
  }
4793
4879
 
4880
+ const __default__$4 = vue.defineComponent({
4881
+ name: "MEditorScrollBar"
4882
+ });
4794
4883
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
4795
- __name: "ScrollBar",
4884
+ ...__default__$4,
4796
4885
  props: {
4797
4886
  size: null,
4798
4887
  scrollSize: null,
@@ -4877,14 +4966,21 @@
4877
4966
 
4878
4967
  const ScrollBar_vue_vue_type_style_index_0_lang = '';
4879
4968
 
4969
+ const __default__$3 = vue.defineComponent({
4970
+ name: "MEditorScrollViewer"
4971
+ });
4880
4972
  const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
4881
- __name: "ScrollViewer",
4973
+ ...__default__$3,
4882
4974
  props: {
4883
4975
  width: { default: 0 },
4884
4976
  height: { default: 0 },
4885
4977
  wrapWidth: { default: 0 },
4886
4978
  wrapHeight: { default: 0 },
4887
- zoom: { default: 1 }
4979
+ zoom: { default: 1 },
4980
+ correctionScrollSize: { default: () => ({
4981
+ width: 0,
4982
+ height: 0
4983
+ }) }
4888
4984
  },
4889
4985
  setup(__props, { expose }) {
4890
4986
  const props = __props;
@@ -4907,7 +5003,8 @@
4907
5003
  scrollViewer = new ScrollViewer({
4908
5004
  container: container.value,
4909
5005
  target: el.value,
4910
- zoom: props.zoom
5006
+ zoom: props.zoom,
5007
+ correctionScrollSize: props.correctionScrollSize
4911
5008
  });
4912
5009
  scrollViewer.on("scroll", (data) => {
4913
5010
  hOffset.value = data.scrollLeft;
@@ -4975,10 +5072,14 @@
4975
5072
  }
4976
5073
  });
4977
5074
 
5075
+ const __default__$2 = vue.defineComponent({
5076
+ name: "MEditorViewerMenu"
5077
+ });
4978
5078
  const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
4979
- __name: "ViewerMenu",
5079
+ ...__default__$2,
4980
5080
  props: {
4981
- isMultiSelect: { type: Boolean, default: false }
5081
+ isMultiSelect: { type: Boolean, default: false },
5082
+ stageContentMenu: null
4982
5083
  },
4983
5084
  setup(__props, { expose }) {
4984
5085
  const props = __props;
@@ -4991,8 +5092,7 @@
4991
5092
  const nodes = vue.computed(() => editorService?.get("nodes"));
4992
5093
  const parent = vue.computed(() => editorService?.get("parent"));
4993
5094
  const stage = vue.computed(() => editorService?.get("stage"));
4994
- const stageContentMenu = vue.inject("stageContentMenu", []);
4995
- const menuData = vue.reactive([
5095
+ const menuData = vue.computed(() => [
4996
5096
  {
4997
5097
  type: "button",
4998
5098
  text: "\u6C34\u5E73\u5C45\u4E2D",
@@ -5094,7 +5194,7 @@
5094
5194
  editorService?.get("stage").clearGuides();
5095
5195
  }
5096
5196
  },
5097
- ...stageContentMenu
5197
+ ...props.stageContentMenu
5098
5198
  ]);
5099
5199
  vue.watch(
5100
5200
  parent,
@@ -5118,7 +5218,7 @@
5118
5218
  expose({ show });
5119
5219
  return (_ctx, _cache) => {
5120
5220
  return vue.openBlock(), vue.createBlock(_sfc_main$c, {
5121
- "menu-data": menuData,
5221
+ "menu-data": vue.unref(menuData),
5122
5222
  ref_key: "menu",
5123
5223
  ref: menu
5124
5224
  }, null, 8, ["menu-data"]);
@@ -5126,8 +5226,14 @@
5126
5226
  }
5127
5227
  });
5128
5228
 
5229
+ const __default__$1 = vue.defineComponent({
5230
+ name: "MEditorStage"
5231
+ });
5129
5232
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
5130
- __name: "Stage",
5233
+ ...__default__$1,
5234
+ props: {
5235
+ stageContentMenu: null
5236
+ },
5131
5237
  setup(__props) {
5132
5238
  let stage = null;
5133
5239
  let runtime = null;
@@ -5246,7 +5352,11 @@
5246
5352
  height: vue.unref(stageRect)?.height,
5247
5353
  "wrap-width": vue.unref(stageContainerRect)?.width,
5248
5354
  "wrap-height": vue.unref(stageContainerRect)?.height,
5249
- zoom: vue.unref(zoom)
5355
+ zoom: vue.unref(zoom),
5356
+ "correction-scroll-size": {
5357
+ width: 60,
5358
+ height: 50
5359
+ }
5250
5360
  }, {
5251
5361
  default: vue.withCtx(() => [
5252
5362
  vue.createElementVNode("div", {
@@ -5262,8 +5372,9 @@
5262
5372
  vue.createVNode(_sfc_main$3, {
5263
5373
  ref_key: "menu",
5264
5374
  ref: menu,
5265
- "is-multi-select": vue.unref(isMultiSelect)
5266
- }, null, 8, ["is-multi-select"])
5375
+ "is-multi-select": vue.unref(isMultiSelect),
5376
+ "stage-content-menu": __props.stageContentMenu
5377
+ }, null, 8, ["is-multi-select", "stage-content-menu"])
5267
5378
  ]))
5268
5379
  ]),
5269
5380
  _: 1
@@ -5272,8 +5383,14 @@
5272
5383
  }
5273
5384
  });
5274
5385
 
5386
+ const __default__ = vue.defineComponent({
5387
+ name: "MEditorWorkspace"
5388
+ });
5275
5389
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
5276
- __name: "Workspace",
5390
+ ...__default__,
5391
+ props: {
5392
+ stageContentMenu: null
5393
+ },
5277
5394
  setup(__props) {
5278
5395
  const services = vue.inject("services");
5279
5396
  const workspace = vue.ref();
@@ -5382,10 +5499,12 @@
5382
5499
  ref_key: "workspace",
5383
5500
  ref: workspace
5384
5501
  }, [
5502
+ vue.createVNode(_sfc_main$8),
5385
5503
  vue.renderSlot(_ctx.$slots, "stage", {}, () => [
5386
5504
  (vue.openBlock(), vue.createBlock(_sfc_main$2, {
5387
- key: vue.unref(page)?.id
5388
- }))
5505
+ key: vue.unref(page)?.id,
5506
+ "stage-content-menu": __props.stageContentMenu
5507
+ }, null, 8, ["stage-content-menu"]))
5389
5508
  ]),
5390
5509
  vue.renderSlot(_ctx.$slots, "workspace-content"),
5391
5510
  vue.createVNode(_sfc_main$6, null, {
@@ -5426,10 +5545,10 @@
5426
5545
  name: "m-editor",
5427
5546
  components: {
5428
5547
  NavMenu: _sfc_main$h,
5429
- Sidebar,
5548
+ Sidebar: _sfc_main$9,
5430
5549
  Workspace: _sfc_main$1,
5431
5550
  PropsPanel: _sfc_main$g,
5432
- Framework: _sfc_main$k
5551
+ Framework: _sfc_main$j
5433
5552
  },
5434
5553
  props: {
5435
5554
  modelValue: {
@@ -5602,8 +5721,6 @@
5602
5721
  codeBlockService
5603
5722
  };
5604
5723
  vue.provide("services", services);
5605
- vue.provide("layerContentMenu", props.layerContentMenu);
5606
- vue.provide("stageContentMenu", props.stageContentMenu);
5607
5724
  vue.provide(
5608
5725
  "stageOptions",
5609
5726
  vue.reactive({
@@ -5623,21 +5740,32 @@
5623
5740
  }
5624
5741
  });
5625
5742
 
5743
+ const _export_sfc = (sfc, props) => {
5744
+ const target = sfc.__vccOpts || sfc;
5745
+ for (const [key, val] of props) {
5746
+ target[key] = val;
5747
+ }
5748
+ return target;
5749
+ };
5750
+
5626
5751
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
5627
- const _component_nav_menu = vue.resolveComponent("nav-menu");
5628
- const _component_sidebar = vue.resolveComponent("sidebar");
5629
- const _component_workspace = vue.resolveComponent("workspace");
5630
- const _component_props_panel = vue.resolveComponent("props-panel");
5631
- const _component_framework = vue.resolveComponent("framework");
5632
- return vue.openBlock(), vue.createBlock(_component_framework, { "code-options": _ctx.codeOptions }, {
5752
+ const _component_NavMenu = vue.resolveComponent("NavMenu");
5753
+ const _component_Sidebar = vue.resolveComponent("Sidebar");
5754
+ const _component_Workspace = vue.resolveComponent("Workspace");
5755
+ const _component_PropsPanel = vue.resolveComponent("PropsPanel");
5756
+ const _component_Framework = vue.resolveComponent("Framework");
5757
+ return vue.openBlock(), vue.createBlock(_component_Framework, { "code-options": _ctx.codeOptions }, {
5633
5758
  nav: vue.withCtx(() => [
5634
5759
  vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
5635
- vue.createVNode(_component_nav_menu, { data: _ctx.menu }, null, 8, ["data"])
5760
+ vue.createVNode(_component_NavMenu, { data: _ctx.menu }, null, 8, ["data"])
5636
5761
  ])
5637
5762
  ]),
5638
5763
  sidebar: vue.withCtx(() => [
5639
5764
  vue.renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
5640
- vue.createVNode(_component_sidebar, { data: _ctx.sidebar }, {
5765
+ vue.createVNode(_component_Sidebar, {
5766
+ data: _ctx.sidebar,
5767
+ "layer-content-menu": _ctx.layerContentMenu
5768
+ }, {
5641
5769
  "layer-panel-header": vue.withCtx(() => [
5642
5770
  vue.renderSlot(_ctx.$slots, "layer-panel-header")
5643
5771
  ]),
@@ -5656,19 +5784,22 @@
5656
5784
  "code-block-panel-header": vue.withCtx(() => [
5657
5785
  vue.renderSlot(_ctx.$slots, "code-block-panel-header")
5658
5786
  ]),
5659
- "code-block-panel-tool": vue.withCtx(({ id }) => [
5660
- vue.renderSlot(_ctx.$slots, "code-block-panel-tool", { id })
5787
+ "code-block-panel-tool": vue.withCtx(({ id, data }) => [
5788
+ vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
5789
+ id,
5790
+ data
5791
+ })
5661
5792
  ]),
5662
5793
  "code-block-edit-panel-header": vue.withCtx(({ id }) => [
5663
5794
  vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
5664
5795
  ]),
5665
5796
  _: 3
5666
- }, 8, ["data"])
5797
+ }, 8, ["data", "layer-content-menu"])
5667
5798
  ])
5668
5799
  ]),
5669
5800
  workspace: vue.withCtx(() => [
5670
5801
  vue.renderSlot(_ctx.$slots, "workspace", { editorService: _ctx.editorService }, () => [
5671
- vue.createVNode(_component_workspace, null, {
5802
+ vue.createVNode(_component_Workspace, { "stage-content-menu": _ctx.stageContentMenu }, {
5672
5803
  stage: vue.withCtx(() => [
5673
5804
  vue.renderSlot(_ctx.$slots, "stage")
5674
5805
  ]),
@@ -5682,12 +5813,12 @@
5682
5813
  vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
5683
5814
  ]),
5684
5815
  _: 3
5685
- })
5816
+ }, 8, ["stage-content-menu"])
5686
5817
  ])
5687
5818
  ]),
5688
5819
  "props-panel": vue.withCtx(() => [
5689
5820
  vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
5690
- vue.createVNode(_component_props_panel, {
5821
+ vue.createVNode(_component_PropsPanel, {
5691
5822
  onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
5692
5823
  }, {
5693
5824
  "props-panel-header": vue.withCtx(() => [
@@ -5717,7 +5848,7 @@
5717
5848
  app.component("m-fields-ui-select", _sfc_main$p);
5718
5849
  app.component("m-fields-code-link", _sfc_main$r);
5719
5850
  app.component("m-fields-vs-code", _sfc_main$s);
5720
- app.component(CodeEditor.name, CodeEditor);
5851
+ app.component("magic-code-editor", _sfc_main$o);
5721
5852
  app.component("m-fields-code-select", _sfc_main$q);
5722
5853
  }
5723
5854
  };
@@ -5726,19 +5857,21 @@
5726
5857
  exports.CodeBlockList = _sfc_main$e;
5727
5858
  exports.CodeDeleteErrorType = CodeDeleteErrorType;
5728
5859
  exports.CodeEditorMode = CodeEditorMode;
5860
+ exports.CodeSelect = _sfc_main$q;
5729
5861
  exports.CodeSelectOp = CodeSelectOp;
5730
5862
  exports.ColumnLayout = ColumnLayout;
5731
5863
  exports.ComponentListPanel = _sfc_main$d;
5732
5864
  exports.ContentMenu = _sfc_main$c;
5733
5865
  exports.Fixed2Other = Fixed2Other;
5734
5866
  exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
5735
- exports.Icon = _sfc_main$j;
5867
+ exports.Icon = _sfc_main$l;
5736
5868
  exports.Keys = Keys;
5737
5869
  exports.LayerOffset = LayerOffset;
5738
- exports.LayerPanel = LayerPanel;
5870
+ exports.LayerPanel = _sfc_main$a;
5739
5871
  exports.Layout = Layout;
5872
+ exports.LayoutContainer = _sfc_main$m;
5740
5873
  exports.PropsPanel = _sfc_main$g;
5741
- exports.TMagicCodeEditor = CodeEditor;
5874
+ exports.TMagicCodeEditor = _sfc_main$o;
5742
5875
  exports.TMagicEditor = Editor;
5743
5876
  exports.ToolButton = _sfc_main$i;
5744
5877
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;