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

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 (45) hide show
  1. package/dist/tmagic-editor.mjs +769 -768
  2. package/dist/tmagic-editor.mjs.map +1 -1
  3. package/dist/tmagic-editor.umd.js +773 -771
  4. package/dist/tmagic-editor.umd.js.map +1 -1
  5. package/package.json +9 -9
  6. package/src/Editor.vue +2 -2
  7. package/src/components/ContentMenu.vue +2 -2
  8. package/src/components/Icon.vue +6 -4
  9. package/src/components/ToolButton.vue +29 -14
  10. package/src/fields/Code.vue +4 -1
  11. package/src/fields/CodeLink.vue +19 -11
  12. package/src/fields/CodeSelect.vue +6 -6
  13. package/src/fields/UISelect.vue +8 -7
  14. package/src/index.ts +2 -1
  15. package/src/layouts/AddPageBox.vue +13 -20
  16. package/src/layouts/CodeEditor.vue +106 -120
  17. package/src/layouts/Framework.vue +3 -2
  18. package/src/layouts/PropsPanel.vue +3 -8
  19. package/src/layouts/sidebar/ComponentListPanel.vue +13 -11
  20. package/src/layouts/sidebar/LayerMenu.vue +86 -91
  21. package/src/layouts/sidebar/LayerPanel.vue +252 -162
  22. package/src/layouts/sidebar/Sidebar.vue +24 -28
  23. package/src/layouts/sidebar/TabPane.vue +43 -51
  24. package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +22 -18
  25. package/src/layouts/sidebar/code-block/CodeBlockList.vue +21 -21
  26. package/src/layouts/workspace/PageBar.vue +11 -10
  27. package/src/services/codeBlock.ts +16 -10
  28. package/src/services/editor.ts +4 -4
  29. package/src/theme/index.scss +1 -15
  30. package/src/theme/theme.scss +15 -0
  31. package/src/type.ts +1 -1
  32. package/types/Editor.vue.d.ts +2 -2
  33. package/types/fields/Code.vue.d.ts +8 -0
  34. package/types/fields/CodeLink.vue.d.ts +4 -0
  35. package/types/index.d.ts +1 -0
  36. package/types/layouts/AddPageBox.vue.d.ts +45 -3
  37. package/types/layouts/CodeEditor.vue.d.ts +160 -45
  38. package/types/layouts/sidebar/LayerMenu.vue.d.ts +16 -64
  39. package/types/layouts/sidebar/LayerPanel.vue.d.ts +16 -1071
  40. package/types/layouts/sidebar/Sidebar.vue.d.ts +114 -17
  41. package/types/layouts/sidebar/TabPane.vue.d.ts +80 -12
  42. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +1 -0
  43. package/types/services/codeBlock.d.ts +1 -1
  44. package/types/services/editor.d.ts +2 -2
  45. package/types/type.d.ts +1 -1
@@ -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('@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', 'lodash-es', '@tmagic/design', '@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.lodashEs, global.design, global.iconsVue, global.monaco, global.StageCore, global.schema, global.utils, global.events, global.core, global.Gesto, global.KeyController));
5
+ })(this, (function (exports, vue, serialize, lodashEs, design, iconsVue, monaco, StageCore, schema, utils, events, core, Gesto, KeyController) { 'use strict';
6
6
 
7
7
  const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
8
8
 
@@ -42,7 +42,7 @@
42
42
  setup(__props, { emit }) {
43
43
  const props = __props;
44
44
  const language = vue.computed(() => props.config.language || "javascript");
45
- const height = vue.computed(() => `${document.body.clientHeight - 168}px`);
45
+ const height = vue.computed(() => props.config.height || `${document.body.clientHeight - 168}px`);
46
46
  const save = (v) => {
47
47
  props.model[props.name] = v;
48
48
  emit("change", v);
@@ -53,8 +53,9 @@
53
53
  style: vue.normalizeStyle(`height: ${vue.unref(height)}`),
54
54
  "init-values": __props.model[__props.name],
55
55
  language: vue.unref(language),
56
+ options: __props.config.options,
56
57
  onSave: save
57
- }, null, 8, ["style", "init-values", "language"]);
58
+ }, null, 8, ["style", "init-values", "language", "options"]);
58
59
  };
59
60
  }
60
61
  });
@@ -70,17 +71,24 @@
70
71
  emits: ["change"],
71
72
  setup(__props, { emit }) {
72
73
  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
- }));
74
+ const formConfig = vue.computed(() => {
75
+ const { codeOptions, ...config } = props.config;
76
+ return {
77
+ ...config,
78
+ text: "",
79
+ type: "link",
80
+ form: [
81
+ {
82
+ name: props.name,
83
+ type: "vs-code",
84
+ options: {
85
+ tabSize: 2,
86
+ ...codeOptions || {}
87
+ }
88
+ }
89
+ ]
90
+ };
91
+ });
84
92
  const modelValue = vue.reactive({
85
93
  form: {
86
94
  [props.name]: ""
@@ -163,13 +171,13 @@
163
171
  return CodeSelectOp2;
164
172
  })(CodeSelectOp || {});
165
173
 
166
- const _hoisted_1$e = { class: "tool-bar" };
167
- const _hoisted_2$6 = /* @__PURE__ */ vue.createElementVNode("path", {
174
+ const _hoisted_1$d = { class: "tool-bar" };
175
+ const _hoisted_2$5 = /* @__PURE__ */ vue.createElementVNode("path", {
168
176
  fill: "currentColor",
169
177
  d: "m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414L23 12zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414L3.828 12z"
170
178
  }, null, -1);
171
179
  const _hoisted_3$3 = [
172
- _hoisted_2$6
180
+ _hoisted_2$5
173
181
  ];
174
182
  const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
175
183
  __name: "CodeSelect",
@@ -245,7 +253,7 @@
245
253
  };
246
254
  const viewHandler = async () => {
247
255
  if (props.model[props.name].length === 0) {
248
- elementPlus.ElMessage.error("\u8BF7\u5148\u7ED1\u5B9A\u4EE3\u7801\u5757");
256
+ design.tMagicMessage.error("\u8BF7\u5148\u7ED1\u5B9A\u4EE3\u7801\u5757");
249
257
  return;
250
258
  }
251
259
  await setCombineIds(props.model[props.name]);
@@ -254,13 +262,11 @@
254
262
  };
255
263
  return (_ctx, _cache) => {
256
264
  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
265
  return vue.openBlock(), vue.createElementBlock("div", {
260
266
  class: "m-fields-code-select",
261
267
  key: fieldKey.value
262
268
  }, [
263
- vue.createVNode(_component_el_card, { shadow: "never" }, {
269
+ vue.createVNode(vue.unref(design.TMagicCard), { shadow: "never" }, {
264
270
  header: vue.withCtx(() => [
265
271
  vue.createVNode(_component_m_fields_select, {
266
272
  config: vue.unref(selectConfig),
@@ -272,8 +278,8 @@
272
278
  }, null, 8, ["config", "model", "prop", "name", "size"])
273
279
  ]),
274
280
  default: vue.withCtx(() => [
275
- vue.createElementVNode("div", _hoisted_1$e, [
276
- vue.createVNode(_component_el_tooltip, {
281
+ vue.createElementVNode("div", _hoisted_1$d, [
282
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
277
283
  class: "tool-item",
278
284
  effect: "dark",
279
285
  content: "\u67E5\u770B\u4EE3\u7801\u5757",
@@ -300,7 +306,7 @@
300
306
  }
301
307
  });
302
308
 
303
- const _hoisted_1$d = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
309
+ const _hoisted_1$c = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
304
310
  const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
305
311
  __name: "UISelect",
306
312
  props: {
@@ -352,21 +358,19 @@
352
358
  }
353
359
  };
354
360
  return (_ctx, _cache) => {
355
- const _component_el_button = vue.resolveComponent("el-button");
356
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
357
361
  return uiSelectMode.value ? (vue.openBlock(), vue.createElementBlock("div", {
358
362
  key: 0,
359
363
  class: "m-fields-ui-select",
360
364
  onClick: cancelHandler
361
365
  }, [
362
- vue.createVNode(_component_el_button, {
366
+ vue.createVNode(vue.unref(design.TMagicButton), {
363
367
  type: "danger",
364
368
  icon: vue.unref(iconsVue.Delete),
365
369
  text: "",
366
370
  style: { "padding": "0" }
367
371
  }, {
368
372
  default: vue.withCtx(() => [
369
- _hoisted_1$d
373
+ _hoisted_1$c
370
374
  ]),
371
375
  _: 1
372
376
  }, 8, ["icon"])
@@ -376,12 +380,12 @@
376
380
  onClick: startSelect,
377
381
  style: { "display": "flex" }
378
382
  }, [
379
- vue.unref(val) ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
383
+ vue.unref(val) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
380
384
  key: 0,
381
385
  content: "\u6E05\u9664"
382
386
  }, {
383
387
  default: vue.withCtx(() => [
384
- vue.createVNode(_component_el_button, {
388
+ vue.createVNode(vue.unref(design.TMagicButton), {
385
389
  style: { "padding": "0" },
386
390
  type: "danger",
387
391
  icon: vue.unref(iconsVue.Close),
@@ -391,11 +395,11 @@
391
395
  ]),
392
396
  _: 1
393
397
  })) : vue.createCommentVNode("", true),
394
- vue.createVNode(_component_el_tooltip, {
398
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
395
399
  content: vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
396
400
  }, {
397
401
  default: vue.withCtx(() => [
398
- vue.createVNode(_component_el_button, {
402
+ vue.createVNode(vue.unref(design.TMagicButton), {
399
403
  text: "",
400
404
  style: { "padding": "0", "margin": "0" }
401
405
  }, {
@@ -414,45 +418,36 @@
414
418
 
415
419
  const UISelect_vue_vue_type_style_index_0_lang = '';
416
420
 
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",
421
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
422
+ __name: "CodeEditor",
434
423
  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
- }
424
+ initValues: null,
425
+ modifiedValues: null,
426
+ type: { default: "" },
427
+ language: { default: "javascript" },
428
+ options: { default: () => ({
429
+ tabSize: 2
430
+ }) },
431
+ autoSave: { type: Boolean, default: true }
453
432
  },
454
433
  emits: ["initd", "save"],
455
- setup(props, { emit }) {
434
+ setup(__props, { expose, emit }) {
435
+ const props = __props;
436
+ const toString = (v, language) => {
437
+ let value = "";
438
+ if (typeof v !== "string") {
439
+ value = serialize__default.default(v, {
440
+ space: 2,
441
+ unsafe: true
442
+ }).replace(/"(\w+)":\s/g, "$1: ");
443
+ } else {
444
+ value = v;
445
+ }
446
+ if (language === "javascript" && value.startsWith("{") && value.endsWith("}")) {
447
+ value = `(${value})`;
448
+ }
449
+ return value;
450
+ };
456
451
  let vsEditor = null;
457
452
  let vsDiffEditor = null;
458
453
  const values = vue.ref("");
@@ -501,7 +496,7 @@
501
496
  emit("save", getEditorValue());
502
497
  }
503
498
  });
504
- if (props.type !== "diff") {
499
+ if (props.type !== "diff" && props.autoSave) {
505
500
  vsEditor?.onDidBlurEditorWidget(() => {
506
501
  emit("save", getEditorValue());
507
502
  });
@@ -527,10 +522,7 @@
527
522
  vue.onUnmounted(() => {
528
523
  resizeObserver.disconnect();
529
524
  });
530
- return {
531
- values,
532
- loading,
533
- codeEditor,
525
+ expose({
534
526
  getEditor() {
535
527
  return vsEditor || vsDiffEditor;
536
528
  },
@@ -539,33 +531,63 @@
539
531
  vsEditor?.focus();
540
532
  vsDiffEditor?.focus();
541
533
  }
534
+ });
535
+ return (_ctx, _cache) => {
536
+ return vue.openBlock(), vue.createElementBlock("div", {
537
+ ref_key: "codeEditor",
538
+ ref: codeEditor,
539
+ class: "magic-code-editor"
540
+ }, null, 512);
542
541
  };
543
542
  }
544
543
  });
545
544
 
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
545
  let $TMAGIC_EDITOR = {};
564
546
  const setConfig = (option) => {
565
547
  $TMAGIC_EDITOR = option;
566
548
  };
567
549
  const getConfig = (key) => $TMAGIC_EDITOR[key];
568
550
 
551
+ const _hoisted_1$b = ["src"];
552
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
553
+ __name: "Icon",
554
+ props: {
555
+ icon: null
556
+ },
557
+ setup(__props) {
558
+ return (_ctx, _cache) => {
559
+ return !__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
560
+ key: 0,
561
+ class: "magic-editor-icon"
562
+ }, {
563
+ default: vue.withCtx(() => [
564
+ vue.createVNode(vue.unref(iconsVue.Edit))
565
+ ]),
566
+ _: 1
567
+ })) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
568
+ key: 1,
569
+ class: "magic-editor-icon"
570
+ }, {
571
+ default: vue.withCtx(() => [
572
+ vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$b)
573
+ ]),
574
+ _: 1
575
+ })) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
576
+ key: 2,
577
+ class: vue.normalizeClass(["magic-editor-icon", __props.icon])
578
+ }, null, 2)) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
579
+ key: 3,
580
+ class: "magic-editor-icon"
581
+ }, {
582
+ default: vue.withCtx(() => [
583
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
584
+ ]),
585
+ _: 1
586
+ }));
587
+ };
588
+ }
589
+ });
590
+
569
591
  const log = (...args) => {
570
592
  if (process.env.NODE_ENV === "development") {
571
593
  console.log("magic editor: ", ...args);
@@ -754,16 +776,20 @@
754
776
  }
755
777
  async setCodeDslById(id, codeConfig) {
756
778
  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
- };
779
+ if (!codeDsl) {
780
+ codeDsl = {
781
+ [id]: codeConfig
782
+ };
783
+ } else {
784
+ const existContent = codeDsl[id] || {};
785
+ codeDsl = {
786
+ ...codeDsl,
787
+ [id]: {
788
+ ...existContent,
789
+ ...codeConfig
790
+ }
791
+ };
792
+ }
767
793
  await this.setCodeDsl(codeDsl);
768
794
  }
769
795
  async getCodeDslByIds(ids) {
@@ -1947,12 +1973,12 @@
1947
1973
  const root = this.get("root");
1948
1974
  if (!root)
1949
1975
  return null;
1950
- return root.codeBlock || null;
1976
+ return root.codeBlocks || null;
1951
1977
  }
1952
1978
  async setCodeDsl(codeDsl) {
1953
1979
  if (!this.state.root)
1954
1980
  return;
1955
- this.state.root.codeBlock = codeDsl;
1981
+ this.state.root.codeBlocks = codeDsl;
1956
1982
  }
1957
1983
  addModifiedNodeId(id) {
1958
1984
  if (!this.isHistoryStateChange) {
@@ -2418,52 +2444,41 @@
2418
2444
  return stage;
2419
2445
  };
2420
2446
 
2421
- const _sfc_main$n = vue.defineComponent({
2422
- components: { Plus: iconsVue.Plus },
2423
- setup() {
2447
+ const _hoisted_1$a = { class: "m-editor-empty-panel" };
2448
+ const _hoisted_2$4 = { class: "m-editor-empty-content" };
2449
+ const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
2450
+ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
2451
+ __name: "AddPageBox",
2452
+ setup(__props) {
2424
2453
  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
- }
2454
+ const clickHandler = () => {
2455
+ const { editorService } = services || {};
2456
+ if (!editorService)
2457
+ return;
2458
+ editorService.add({
2459
+ type: schema.NodeType.PAGE,
2460
+ name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
2461
+ });
2462
+ };
2463
+ return (_ctx, _cache) => {
2464
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
2465
+ vue.createElementVNode("div", _hoisted_2$4, [
2466
+ vue.createElementVNode("div", {
2467
+ class: "m-editor-empty-button",
2468
+ onClick: clickHandler
2469
+ }, [
2470
+ vue.createElementVNode("div", null, [
2471
+ vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
2472
+ ]),
2473
+ _hoisted_3$2
2474
+ ])
2475
+ ])
2476
+ ]);
2435
2477
  };
2436
2478
  }
2437
2479
  });
2438
2480
 
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({
2481
+ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
2467
2482
  __name: "Resizer",
2468
2483
  emits: ["change"],
2469
2484
  setup(__props, { emit }) {
@@ -2496,7 +2511,7 @@
2496
2511
  }
2497
2512
  });
2498
2513
 
2499
- const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
2514
+ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
2500
2515
  __name: "Layout",
2501
2516
  props: {
2502
2517
  left: null,
@@ -2569,7 +2584,7 @@
2569
2584
  }, [
2570
2585
  vue.renderSlot(_ctx.$slots, "left")
2571
2586
  ], 6),
2572
- vue.createVNode(_sfc_main$m, { onChange: changeLeft })
2587
+ vue.createVNode(_sfc_main$l, { onChange: changeLeft })
2573
2588
  ], 64)) : vue.createCommentVNode("", true),
2574
2589
  vue.createElementVNode("div", {
2575
2590
  class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
@@ -2578,7 +2593,7 @@
2578
2593
  vue.renderSlot(_ctx.$slots, "center")
2579
2594
  ], 6),
2580
2595
  typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
2581
- vue.createVNode(_sfc_main$m, { onChange: changeRight }),
2596
+ vue.createVNode(_sfc_main$l, { onChange: changeRight }),
2582
2597
  vue.createElementVNode("div", {
2583
2598
  class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
2584
2599
  style: vue.normalizeStyle(`width: ${__props.right}px`)
@@ -2591,8 +2606,8 @@
2591
2606
  }
2592
2607
  });
2593
2608
 
2594
- const _hoisted_1$a = { class: "m-editor" };
2595
- const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
2609
+ const _hoisted_1$9 = { class: "m-editor" };
2610
+ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
2596
2611
  __name: "Framework",
2597
2612
  props: {
2598
2613
  codeOptions: { default: () => ({}) }
@@ -2642,8 +2657,7 @@
2642
2657
  };
2643
2658
  return (_ctx, _cache) => {
2644
2659
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
2645
- const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
2646
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
2660
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
2647
2661
  vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
2648
2662
  vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
2649
2663
  key: 0,
@@ -2651,7 +2665,7 @@
2651
2665
  "init-values": vue.unref(root),
2652
2666
  options: __props.codeOptions,
2653
2667
  onSave: saveCode
2654
- }, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$l, {
2668
+ }, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$k, {
2655
2669
  key: 1,
2656
2670
  class: "m-editor-content",
2657
2671
  "left-class": "m-editor-framework-left",
@@ -2670,7 +2684,7 @@
2670
2684
  ]),
2671
2685
  center: vue.withCtx(() => [
2672
2686
  vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
2673
- vue.createVNode(AddPageBox)
2687
+ vue.createVNode(_sfc_main$m)
2674
2688
  ])
2675
2689
  ]),
2676
2690
  _: 2
@@ -2678,7 +2692,7 @@
2678
2692
  vue.unref(pageLength) > 0 ? {
2679
2693
  name: "right",
2680
2694
  fn: vue.withCtx(() => [
2681
- vue.createVNode(_component_el_scrollbar, null, {
2695
+ vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
2682
2696
  default: vue.withCtx(() => [
2683
2697
  vue.renderSlot(_ctx.$slots, "props-panel")
2684
2698
  ]),
@@ -2692,52 +2706,11 @@
2692
2706
  }
2693
2707
  });
2694
2708
 
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
2709
  const _hoisted_1$8 = {
2737
2710
  key: 1,
2738
2711
  class: "menu-item-text"
2739
2712
  };
2740
- const _hoisted_2$4 = { class: "el-dropdown-link menubar-menu-button" };
2713
+ const _hoisted_2$3 = { class: "el-dropdown-link menubar-menu-button" };
2741
2714
  const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
2742
2715
  __name: "ToolButton",
2743
2716
  props: {
@@ -2804,13 +2777,6 @@
2804
2777
  }
2805
2778
  };
2806
2779
  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
2780
  return vue.unref(display) ? (vue.openBlock(), vue.createElementBlock("div", {
2815
2781
  key: 0,
2816
2782
  class: vue.normalizeClass(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
@@ -2818,24 +2784,24 @@
2818
2784
  onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
2819
2785
  onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(__props.data, $event))
2820
2786
  }, [
2821
- __props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(_component_el_divider, {
2787
+ __props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
2822
2788
  key: 0,
2823
2789
  direction: __props.data.direction || "vertical"
2824
2790
  }, 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, {
2791
+ __props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
2826
2792
  key: 0,
2827
2793
  effect: "dark",
2828
2794
  placement: "bottom-start",
2829
2795
  content: __props.data.tooltip
2830
2796
  }, {
2831
2797
  default: vue.withCtx(() => [
2832
- vue.createVNode(_component_el_button, {
2798
+ vue.createVNode(vue.unref(design.TMagicButton), {
2833
2799
  size: "small",
2834
2800
  text: "",
2835
2801
  disabled: vue.unref(disabled)
2836
2802
  }, {
2837
2803
  default: vue.withCtx(() => [
2838
- __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
2804
+ __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
2839
2805
  key: 0,
2840
2806
  icon: __props.data.icon
2841
2807
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -2845,14 +2811,14 @@
2845
2811
  }, 8, ["disabled"])
2846
2812
  ]),
2847
2813
  _: 1
2848
- }, 8, ["content"])) : (vue.openBlock(), vue.createBlock(_component_el_button, {
2814
+ }, 8, ["content"])) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
2849
2815
  key: 1,
2850
2816
  size: "small",
2851
2817
  text: "",
2852
2818
  disabled: vue.unref(disabled)
2853
2819
  }, {
2854
2820
  default: vue.withCtx(() => [
2855
- __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
2821
+ __props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
2856
2822
  key: 0,
2857
2823
  icon: __props.data.icon
2858
2824
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -2860,17 +2826,17 @@
2860
2826
  ]),
2861
2827
  _: 1
2862
2828
  }, 8, ["disabled"]))
2863
- ], 64)) : __props.data.type === "dropdown" ? (vue.openBlock(), vue.createBlock(_component_el_dropdown, {
2829
+ ], 64)) : __props.data.type === "dropdown" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdown), {
2864
2830
  key: 3,
2865
2831
  trigger: "click",
2866
2832
  disabled: vue.unref(disabled),
2867
2833
  onCommand: dropdownHandler
2868
2834
  }, {
2869
2835
  dropdown: vue.withCtx(() => [
2870
- __props.data.items && __props.data.items.length ? (vue.openBlock(), vue.createBlock(_component_el_dropdown_menu, { key: 0 }, {
2836
+ __props.data.items && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownMenu), { key: 0 }, {
2871
2837
  default: vue.withCtx(() => [
2872
2838
  (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, {
2839
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownItem), {
2874
2840
  key: index,
2875
2841
  command: { data: __props.data, subItem }
2876
2842
  }, {
@@ -2885,9 +2851,9 @@
2885
2851
  })) : vue.createCommentVNode("", true)
2886
2852
  ]),
2887
2853
  default: vue.withCtx(() => [
2888
- vue.createElementVNode("span", _hoisted_2$4, [
2854
+ vue.createElementVNode("span", _hoisted_2$3, [
2889
2855
  vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
2890
- vue.createVNode(_component_el_icon, { class: "el-icon--right" }, {
2856
+ vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
2891
2857
  default: vue.withCtx(() => [
2892
2858
  vue.createVNode(vue.unref(iconsVue.ArrowDown))
2893
2859
  ]),
@@ -3108,13 +3074,8 @@
3108
3074
  services?.editorService.update(values2);
3109
3075
  } catch (e) {
3110
3076
  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
- });
3077
+ design.tMagicMessage.closeAll();
3078
+ design.tMagicMessage.error(e.message);
3118
3079
  }
3119
3080
  };
3120
3081
  expose({ submit });
@@ -3138,7 +3099,7 @@
3138
3099
  });
3139
3100
 
3140
3101
  const _hoisted_1$6 = ["id"];
3141
- const _hoisted_2$3 = { class: "list-item" };
3102
+ const _hoisted_2$2 = { class: "list-item" };
3142
3103
  const _hoisted_3$1 = { class: "code-name" };
3143
3104
  const _hoisted_4$1 = { class: "code-name-wrapper" };
3144
3105
  const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
@@ -3183,8 +3144,7 @@
3183
3144
  lodashEs.forIn(codeDsl, (value, key) => {
3184
3145
  state.codeList.push({
3185
3146
  id: key,
3186
- name: value.name,
3187
- content: value.content
3147
+ name: value.name
3188
3148
  });
3189
3149
  });
3190
3150
  currentTitle.value = state.codeList[0]?.name || "";
@@ -3196,14 +3156,14 @@
3196
3156
  const codeContent = codeEditor.value.getEditor()?.getValue();
3197
3157
  codeConfig.value.content = eval(codeContent);
3198
3158
  } catch (e) {
3199
- elementPlus.ElMessage.error(e.stack);
3159
+ design.tMagicMessage.error(e.stack);
3200
3160
  return false;
3201
3161
  }
3202
3162
  await services?.codeBlockService.setCodeDslById(id.value, {
3203
3163
  name: codeConfig.value.name,
3204
3164
  content: codeConfig.value.content
3205
3165
  });
3206
- elementPlus.ElMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
3166
+ design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
3207
3167
  return true;
3208
3168
  };
3209
3169
  const saveAndClose = async () => {
@@ -3217,22 +3177,17 @@
3217
3177
  currentTitle.value = data.name;
3218
3178
  };
3219
3179
  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, {
3180
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDialog), {
3226
3181
  modelValue: vue.unref(isShowCodeBlockEditor),
3227
3182
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
3183
+ class: "code-editor-dialog",
3228
3184
  title: currentTitle.value,
3229
3185
  fullscreen: true,
3230
3186
  "before-close": saveAndClose,
3231
- "append-to-body": true,
3232
- "custom-class": "code-editor-dialog"
3187
+ "append-to-body": true
3233
3188
  }, {
3234
3189
  default: vue.withCtx(() => [
3235
- vue.createVNode(_sfc_main$l, {
3190
+ vue.createVNode(_sfc_main$k, {
3236
3191
  left: left.value,
3237
3192
  "onUpdate:left": _cache[1] || (_cache[1] = ($event) => left.value = $event),
3238
3193
  "min-left": 45,
@@ -3246,11 +3201,11 @@
3246
3201
  ])
3247
3202
  }, [
3248
3203
  vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
3249
- vue.createVNode(_component_el_card, { shadow: "never" }, {
3204
+ vue.createVNode(vue.unref(design.TMagicCard), { shadow: "never" }, {
3250
3205
  header: vue.withCtx(() => [
3251
3206
  vue.createElementVNode("div", _hoisted_4$1, [
3252
3207
  _hoisted_5$1,
3253
- codeConfig.value ? (vue.openBlock(), vue.createBlock(_component_el_input, {
3208
+ codeConfig.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInput), {
3254
3209
  key: 0,
3255
3210
  class: "code-name-input",
3256
3211
  modelValue: codeConfig.value.name,
@@ -3261,7 +3216,7 @@
3261
3216
  ]),
3262
3217
  default: vue.withCtx(() => [
3263
3218
  vue.createElementVNode("div", _hoisted_6$1, [
3264
- codeConfig.value ? (vue.openBlock(), vue.createBlock(CodeEditor, {
3219
+ codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
3265
3220
  key: 0,
3266
3221
  ref_key: "codeEditor",
3267
3222
  ref: codeEditor,
@@ -3276,7 +3231,7 @@
3276
3231
  }
3277
3232
  }, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
3278
3233
  vue.unref(editable) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
3279
- vue.createVNode(_component_el_button, {
3234
+ vue.createVNode(vue.unref(design.TMagicButton), {
3280
3235
  type: "primary",
3281
3236
  class: "button",
3282
3237
  onClick: saveCode
@@ -3286,7 +3241,7 @@
3286
3241
  ]),
3287
3242
  _: 1
3288
3243
  }),
3289
- vue.createVNode(_component_el_button, {
3244
+ vue.createVNode(vue.unref(design.TMagicButton), {
3290
3245
  type: "primary",
3291
3246
  class: "button",
3292
3247
  onClick: saveAndClose
@@ -3297,7 +3252,7 @@
3297
3252
  _: 1
3298
3253
  })
3299
3254
  ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
3300
- vue.createVNode(_component_el_button, {
3255
+ vue.createVNode(vue.unref(design.TMagicButton), {
3301
3256
  type: "primary",
3302
3257
  class: "button",
3303
3258
  onClick: saveAndClose
@@ -3319,23 +3274,22 @@
3319
3274
  vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? {
3320
3275
  name: "left",
3321
3276
  fn: vue.withCtx(() => [
3322
- !vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(_component_el_tree, {
3277
+ !vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
3323
3278
  key: 0,
3324
- ref: "tree",
3279
+ class: "side-tree",
3325
3280
  "node-key": "id",
3326
3281
  "empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
3327
3282
  data: state.codeList,
3328
3283
  "highlight-current": true,
3329
- onNodeClick: selectHandler,
3330
3284
  "current-node-key": state.codeList[0].id,
3331
- class: "side-tree"
3285
+ onNodeClick: selectHandler
3332
3286
  }, {
3333
3287
  default: vue.withCtx(({ data }) => [
3334
3288
  vue.createElementVNode("div", {
3335
3289
  id: data.id,
3336
3290
  class: "list-container"
3337
3291
  }, [
3338
- vue.createElementVNode("div", _hoisted_2$3, [
3292
+ vue.createElementVNode("div", _hoisted_2$2, [
3339
3293
  vue.createElementVNode("div", _hoisted_3$1, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1)
3340
3294
  ])
3341
3295
  ], 8, _hoisted_1$6)
@@ -3353,7 +3307,7 @@
3353
3307
  });
3354
3308
 
3355
3309
  const _hoisted_1$5 = { class: "m-editor-code-block-list" };
3356
- const _hoisted_2$2 = { class: "code-header-wrapper" };
3310
+ const _hoisted_2$1 = { class: "code-header-wrapper" };
3357
3311
  const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("\u65B0\u589E");
3358
3312
  const _hoisted_4 = ["id"];
3359
3313
  const _hoisted_5 = { class: "list-item" };
@@ -3411,7 +3365,7 @@
3411
3365
  state.codeList.push({
3412
3366
  id: codeId,
3413
3367
  name: value.name,
3414
- content: value.content,
3368
+ codeBlockContent: value,
3415
3369
  showRelation: true
3416
3370
  });
3417
3371
  });
@@ -3443,7 +3397,7 @@
3443
3397
  const createCodeBlock = async () => {
3444
3398
  const { codeBlockService } = services || {};
3445
3399
  if (!codeBlockService) {
3446
- elementPlus.ElMessage.error("\u65B0\u589E\u4EE3\u7801\u5757\u5931\u8D25");
3400
+ design.tMagicMessage.error("\u65B0\u589E\u4EE3\u7801\u5757\u5931\u8D25");
3447
3401
  return;
3448
3402
  }
3449
3403
  const codeConfig = {
@@ -3470,7 +3424,7 @@
3470
3424
  if (typeof props.customError === "function") {
3471
3425
  props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
3472
3426
  } else {
3473
- elementPlus.ElMessage.error("\u4EE3\u7801\u5757\u5220\u9664\u5931\u8D25");
3427
+ design.tMagicMessage.error("\u4EE3\u7801\u5757\u5220\u9664\u5931\u8D25");
3474
3428
  }
3475
3429
  }
3476
3430
  };
@@ -3502,14 +3456,10 @@
3502
3456
  stage?.select(compId);
3503
3457
  };
3504
3458
  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
3459
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
3510
3460
  vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
3511
- vue.createElementVNode("div", _hoisted_2$2, [
3512
- vue.createVNode(_component_el_input, {
3461
+ vue.createElementVNode("div", _hoisted_2$1, [
3462
+ vue.createVNode(vue.unref(design.TMagicInput), {
3513
3463
  class: vue.normalizeClass([vue.unref(editable) ? "code-filter-input" : "code-filter-input-no-btn"]),
3514
3464
  size: "small",
3515
3465
  placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
@@ -3518,7 +3468,7 @@
3518
3468
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
3519
3469
  onInput: filterTextChangeHandler
3520
3470
  }, null, 8, ["class", "modelValue"]),
3521
- vue.unref(editable) ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3471
+ vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
3522
3472
  key: 0,
3523
3473
  class: "create-code-button",
3524
3474
  type: "primary",
@@ -3532,7 +3482,7 @@
3532
3482
  })) : vue.createCommentVNode("", true)
3533
3483
  ])
3534
3484
  ]),
3535
- !vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(_component_el_tree, {
3485
+ !vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
3536
3486
  key: 0,
3537
3487
  ref_key: "tree",
3538
3488
  ref: tree,
@@ -3551,13 +3501,13 @@
3551
3501
  vue.createElementVNode("div", _hoisted_5, [
3552
3502
  vue.createElementVNode("div", _hoisted_6, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1),
3553
3503
  vue.createElementVNode("div", _hoisted_7, [
3554
- vue.createVNode(_component_el_tooltip, {
3504
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
3555
3505
  effect: "dark",
3556
3506
  content: vue.unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
3557
3507
  placement: "bottom"
3558
3508
  }, {
3559
3509
  default: vue.withCtx(() => [
3560
- vue.createVNode(_sfc_main$j, {
3510
+ vue.createVNode(_sfc_main$n, {
3561
3511
  icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
3562
3512
  class: "edit-icon",
3563
3513
  onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
@@ -3565,14 +3515,14 @@
3565
3515
  ]),
3566
3516
  _: 2
3567
3517
  }, 1032, ["content"]),
3568
- state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
3518
+ state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3569
3519
  key: 0,
3570
3520
  effect: "dark",
3571
3521
  content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
3572
3522
  placement: "bottom"
3573
3523
  }, {
3574
3524
  default: vue.withCtx(() => [
3575
- vue.createVNode(_sfc_main$j, {
3525
+ vue.createVNode(_sfc_main$n, {
3576
3526
  icon: vue.unref(iconsVue.Link),
3577
3527
  class: "edit-icon",
3578
3528
  onClick: vue.withModifiers(($event) => toggleCombineRelation(data), ["stop"])
@@ -3580,14 +3530,14 @@
3580
3530
  ]),
3581
3531
  _: 2
3582
3532
  }, 1024)) : vue.createCommentVNode("", true),
3583
- vue.unref(editable) ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
3533
+ vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3584
3534
  key: 1,
3585
3535
  effect: "dark",
3586
3536
  content: "\u5220\u9664",
3587
3537
  placement: "bottom"
3588
3538
  }, {
3589
3539
  default: vue.withCtx(() => [
3590
- vue.createVNode(_sfc_main$j, {
3540
+ vue.createVNode(_sfc_main$n, {
3591
3541
  icon: vue.unref(iconsVue.Close),
3592
3542
  class: "edit-icon",
3593
3543
  onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -3596,14 +3546,15 @@
3596
3546
  _: 2
3597
3547
  }, 1024)) : vue.createCommentVNode("", true),
3598
3548
  vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
3599
- id: data.id
3549
+ id: data.id,
3550
+ data: data.codeBlockContent
3600
3551
  })
3601
3552
  ])
3602
3553
  ]),
3603
3554
  data.showRelation && state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
3604
3555
  _hoisted_9,
3605
3556
  (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, {
3557
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
3607
3558
  key: index,
3608
3559
  class: "code-comp",
3609
3560
  size: "small",
@@ -3632,8 +3583,7 @@
3632
3583
  }
3633
3584
  });
3634
3585
 
3635
- const _hoisted_1$4 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
3636
- const _hoisted_2$1 = ["onClick", "onDragstart"];
3586
+ const _hoisted_1$4 = ["onClick", "onDragstart"];
3637
3587
  const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
3638
3588
  __name: "ComponentListPanel",
3639
3589
  setup(__props) {
@@ -3648,7 +3598,7 @@
3648
3598
  }))
3649
3599
  );
3650
3600
  const collapseValue = vue.computed(
3651
- () => Array(list.value?.length).fill(1).map((x, i) => i)
3601
+ () => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
3652
3602
  );
3653
3603
  let timeout;
3654
3604
  let clientX;
@@ -3700,20 +3650,15 @@
3700
3650
  timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
3701
3651
  };
3702
3652
  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, {
3653
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), null, {
3709
3654
  default: vue.withCtx(() => [
3710
3655
  vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
3711
- vue.createVNode(_component_el_collapse, {
3656
+ vue.createVNode(vue.unref(design.TMagicCollapse), {
3712
3657
  class: "ui-component-panel",
3713
3658
  "model-value": vue.unref(collapseValue)
3714
3659
  }, {
3715
3660
  default: vue.withCtx(() => [
3716
- vue.createVNode(_component_el_input, {
3661
+ vue.createVNode(vue.unref(design.TMagicInput), {
3717
3662
  "prefix-icon": "el-icon-search",
3718
3663
  placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
3719
3664
  class: "search-input",
@@ -3724,12 +3669,12 @@
3724
3669
  }, null, 8, ["modelValue"]),
3725
3670
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
3726
3671
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3727
- group.items && group.items.length ? (vue.openBlock(), vue.createBlock(_component_el_collapse_item, {
3672
+ group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
3728
3673
  key: index,
3729
- name: index
3674
+ name: `${index}`
3730
3675
  }, {
3731
3676
  title: vue.withCtx(() => [
3732
- _hoisted_1$4,
3677
+ vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
3733
3678
  vue.createTextVNode(vue.toDisplayString(group.title), 1)
3734
3679
  ]),
3735
3680
  default: vue.withCtx(() => [
@@ -3744,10 +3689,10 @@
3744
3689
  onDrag: dragHandler
3745
3690
  }, [
3746
3691
  vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
3747
- vue.createVNode(_sfc_main$j, {
3692
+ vue.createVNode(_sfc_main$n, {
3748
3693
  icon: item.icon
3749
3694
  }, null, 8, ["icon"]),
3750
- vue.createVNode(_component_el_tooltip, {
3695
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
3751
3696
  effect: "dark",
3752
3697
  placement: "bottom",
3753
3698
  content: item.text
@@ -3758,7 +3703,7 @@
3758
3703
  _: 2
3759
3704
  }, 1032, ["content"])
3760
3705
  ])
3761
- ], 40, _hoisted_2$1);
3706
+ ], 40, _hoisted_1$4);
3762
3707
  }), 128))
3763
3708
  ]),
3764
3709
  _: 2
@@ -3888,9 +3833,9 @@
3888
3833
  }
3889
3834
  });
3890
3835
 
3891
- const _sfc_main$b = vue.defineComponent({
3892
- components: { ContentMenu: _sfc_main$c },
3893
- setup() {
3836
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
3837
+ __name: "LayerMenu",
3838
+ setup(__props, { expose }) {
3894
3839
  const services = vue.inject("services");
3895
3840
  const menu = vue.ref();
3896
3841
  const node = vue.computed(() => services?.editorService.get("node"));
@@ -3941,337 +3886,349 @@
3941
3886
  }
3942
3887
  return [];
3943
3888
  });
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);
3976
- }
3889
+ const menuData = vue.computed(() => [
3890
+ {
3891
+ type: "button",
3892
+ text: "\u65B0\u589E",
3893
+ icon: vue.markRaw(iconsVue.Plus),
3894
+ display: () => node.value?.items,
3895
+ items: getSubMenuData.value
3896
+ },
3897
+ {
3898
+ type: "button",
3899
+ text: "\u590D\u5236",
3900
+ icon: vue.markRaw(iconsVue.DocumentCopy),
3901
+ display: () => !isRoot.value,
3902
+ handler: () => {
3903
+ node.value && services?.editorService.copy(node.value);
3904
+ }
3905
+ },
3906
+ {
3907
+ type: "button",
3908
+ text: "\u5220\u9664",
3909
+ icon: vue.markRaw(iconsVue.Delete),
3910
+ display: () => !isRoot.value && !isPage.value,
3911
+ handler: () => {
3912
+ node.value && services?.editorService.remove(node.value);
3913
+ }
3914
+ },
3915
+ ...layerContentMenu
3916
+ ]);
3917
+ const show = (e) => {
3918
+ menu.value?.show(e);
3919
+ };
3920
+ expose({
3921
+ show
3922
+ });
3923
+ return (_ctx, _cache) => {
3924
+ return vue.openBlock(), vue.createBlock(_sfc_main$c, {
3925
+ "menu-data": vue.unref(menuData),
3926
+ ref_key: "menu",
3927
+ ref: menu,
3928
+ style: { "overflow": "initial" }
3929
+ }, null, 8, ["menu-data"]);
3977
3930
  };
3978
3931
  }
3979
3932
  });
3980
3933
 
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)
3934
+ const _hoisted_1$3 = ["id", "onMouseenter"];
3935
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
3936
+ __name: "LayerPanel",
3937
+ setup(__props) {
3938
+ const throttleTime = 150;
3939
+ const services = vue.inject("services");
3940
+ const tree = vue.ref();
3941
+ const menu = vue.ref();
3942
+ const editorService = services?.editorService;
3943
+ const page = vue.computed(() => editorService?.get("page"));
3944
+ const values = vue.computed(() => page.value ? [page.value] : []);
3945
+ const selectedNodes = vue.ref([]);
3946
+ const selectedIds = vue.computed(() => selectedNodes.value.map((node) => node.id));
3947
+ const isMultiSelectStatus = vue.ref(false);
3948
+ const spliceNodeKey = vue.ref();
3949
+ const filterText = vue.ref("");
3950
+ const defaultExpandedKeys = vue.computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
3951
+ editorService?.on("remove", () => {
3952
+ setTimeout(() => {
3953
+ tree.value?.getNode(editorService.get("node").id)?.updateChildren();
3954
+ }, 0);
3955
+ });
3956
+ const select = async (data) => {
3957
+ if (!data.id) {
3958
+ throw new Error("\u6CA1\u6709id");
3959
+ }
3960
+ await editorService?.select(data);
3961
+ editorService?.get("stage")?.select(data.id);
3962
+ };
3963
+ const multiSelect = async (data) => {
3964
+ await editorService?.multiSelect(data);
3965
+ editorService?.get("stage")?.multiSelect(data);
3966
+ };
3967
+ const highlight = (data) => {
3968
+ if (!data?.id) {
3969
+ throw new Error("\u6CA1\u6709id");
3970
+ }
3971
+ editorService?.highlight(data);
3972
+ editorService?.get("stage")?.highlight(data.id);
3973
+ };
3974
+ const expandedKeys = /* @__PURE__ */ new Map();
3975
+ const allowDrop = (draggingNode, dropNode, type) => {
3976
+ const { data } = dropNode || {};
3977
+ const { data: ingData } = draggingNode;
3978
+ const { type: ingType } = ingData;
3979
+ if (ingType !== schema.NodeType.PAGE && data.type === schema.NodeType.PAGE)
3980
+ return false;
3981
+ if (ingType === schema.NodeType.PAGE && data.type !== schema.NodeType.PAGE)
3982
+ return false;
3983
+ if (!data || !data.type)
3984
+ return false;
3985
+ if (["prev", "next"].includes(type))
3986
+ return true;
3987
+ if (data.items || data.type === "container")
3988
+ return true;
4016
3989
  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) => {
3990
+ };
3991
+ const handleDragEnd = async (e) => {
4045
3992
  if (!tree.value)
4046
3993
  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) {
4067
- expandedKeys.set(id, id);
4068
- }
4069
- });
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);
3994
+ const { data: node } = e;
3995
+ const parent = editorService?.getParentById(node.id, false);
3996
+ const layout = await editorService?.getLayout(parent);
3997
+ node.style.position = layout;
3998
+ if (layout === Layout.RELATIVE) {
3999
+ node.style.top = 0;
4000
+ node.style.left = 0;
4001
+ }
4002
+ const data = tree.value.getData();
4003
+ const [page2] = data;
4004
+ editorService?.update(page2);
4005
+ };
4006
+ const loadItems = (node, resolve) => {
4007
+ if (Array.isArray(node.data)) {
4008
+ return resolve(node.data);
4078
4009
  }
4079
- if (Array.isArray(node2.data?.items)) {
4080
- return resolve(node2.data?.items);
4010
+ if (Array.isArray(node.data?.items)) {
4011
+ return resolve(node.data?.items);
4081
4012
  }
4082
4013
  resolve([]);
4083
- },
4084
- highlightNode: vue.computed(() => editorService?.get("highlightNode")),
4085
- clickNode: node,
4086
- expandedKeys: vue.computed(() => node.value ? [node.value.id] : []),
4087
- handleCollapse: (data) => {
4014
+ };
4015
+ const handleCollapse = (data) => {
4088
4016
  expandedKeys.delete(data.id);
4089
- },
4090
- handleExpand: (data) => {
4017
+ };
4018
+ const handleExpand = (data) => {
4091
4019
  const parent = editorService?.getParentById(data.id);
4092
4020
  if (!parent?.id)
4093
4021
  return;
4094
4022
  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();
4023
+ };
4024
+ const filterNode = (value, data) => {
4025
+ if (!value) {
4026
+ return true;
4027
+ }
4028
+ let name = "";
4029
+ if (data.name) {
4030
+ name = data.name;
4031
+ } else if (data.items) {
4032
+ name = "container";
4033
+ }
4034
+ return `${data.id}${name}${data.type}`.indexOf(value) !== -1;
4035
+ };
4036
+ const filterTextChangeHandler = (val) => {
4037
+ tree.value?.filter(val);
4038
+ };
4039
+ const expandNodes = () => {
4040
+ expandedKeys.forEach((key) => {
4041
+ if (!tree.value)
4042
+ return;
4043
+ tree.value.getNode(key)?.expand();
4044
+ });
4045
+ };
4046
+ vue.watch(
4047
+ () => editorService?.get("nodes"),
4048
+ (nodes) => {
4049
+ if (!tree.value)
4050
+ return;
4051
+ if (!editorService)
4052
+ return;
4053
+ if (!nodes)
4054
+ return;
4055
+ selectedNodes.value = nodes;
4056
+ const parent = editorService.get("parent");
4057
+ if (!parent?.id)
4058
+ return;
4059
+ const treeNode = tree.value.getNode(parent.id);
4060
+ treeNode?.updateChildren();
4061
+ setTimeout(() => {
4062
+ tree.value && Object.entries(tree.value.getStore().nodesMap).forEach(([id, node]) => {
4063
+ if (node.expanded && node.data.items) {
4064
+ expandedKeys.set(id, id);
4065
+ }
4066
+ });
4067
+ expandNodes();
4068
+ });
4069
+ }
4070
+ );
4071
+ const setTreeKeyStatus = () => {
4072
+ if (!tree.value)
4073
+ return;
4074
+ if (selectedIds.value.length === 0) {
4075
+ tree.value.setCheckedKeys([]);
4076
+ tree.value.setCurrentKey();
4077
+ } else if (selectedIds.value.length === 1 && !isMultiSelectStatus.value) {
4078
+ tree.value.setCurrentKey(selectedIds.value[0], true);
4079
+ tree.value.setCheckedKeys([]);
4080
+ } else {
4081
+ tree.value.setCheckedKeys(selectedIds.value);
4082
+ tree.value.setCurrentKey();
4083
+ }
4084
+ };
4085
+ vue.watch(selectedIds, () => {
4086
+ setTreeKeyStatus();
4087
+ });
4088
+ const keycon = vue.ref();
4089
+ const addSelectModeListener = () => {
4090
+ const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
4091
+ const ctrl = isMac ? "meta" : "ctrl";
4092
+ keycon.value = new KeyController__default.default();
4093
+ keycon.value.keydown(ctrl, (e) => {
4094
+ e.inputEvent.preventDefault();
4095
+ isMultiSelectStatus.value = true;
4096
+ });
4097
+ keycon.value.on("blur", () => {
4098
+ isMultiSelectStatus.value = false;
4099
+ });
4100
+ keycon.value.keyup(ctrl, (e) => {
4101
+ e.inputEvent.preventDefault();
4102
+ isMultiSelectStatus.value = false;
4103
+ });
4104
+ };
4105
+ const removeSelectModeListener = () => {
4106
+ keycon.value?.destroy();
4107
+ if (selectedIds.value.length === 1)
4108
+ isMultiSelectStatus.value = false;
4109
+ };
4123
4110
  const clicked = vue.ref(false);
4124
- const editorService = services?.editorService;
4111
+ const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
4125
4112
  const highlightHandler = lodashEs.throttle((data) => {
4126
- highlight(data, editorService);
4113
+ highlight(data);
4127
4114
  }, throttleTime);
4128
4115
  const toggleClickFlag = () => {
4129
4116
  clicked.value = !clicked.value;
4130
4117
  };
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);
4118
+ const canHighlight = (data) => {
4119
+ if (clicked.value)
4120
+ return false;
4121
+ return data.id === highlightNode?.value?.id && !selectedIds.value.includes(data.id) && spliceNodeKey.value !== data.id;
4122
+ };
4123
+ vue.watch(isMultiSelectStatus, () => {
4124
+ if (isMultiSelectStatus.value && selectedNodes.value.length === 1 && selectedNodes.value[0].type === schema.NodeType.PAGE) {
4125
+ selectedNodes.value = [];
4126
+ }
4139
4127
  });
4140
- return {
4141
- tree,
4142
- menu,
4143
- ...statusData,
4144
- ...useDrop(tree, editorService),
4145
- ...useFilter(tree),
4146
- highlightHandler,
4147
- toggleClickFlag,
4148
- canHighlight,
4149
- clickHandler(data) {
4128
+ const multiClickHandler = (data) => {
4129
+ if (!data?.id) {
4130
+ throw new Error("\u6CA1\u6709id");
4131
+ }
4132
+ if (data.type === schema.NodeType.PAGE) {
4133
+ tree.value?.setCheckedKeys([]);
4134
+ return;
4135
+ }
4136
+ const index = selectedNodes.value.findIndex((node) => node.id === data.id);
4137
+ if (index !== -1) {
4138
+ selectedNodes.value.splice(index, 1);
4139
+ spliceNodeKey.value = data.id;
4140
+ } else {
4141
+ selectedNodes.value = [...selectedNodes.value, data];
4142
+ }
4143
+ tree.value?.setCheckedKeys(selectedIds.value);
4144
+ multiSelect(selectedIds.value);
4145
+ };
4146
+ const clickHandler = (data) => {
4147
+ if (!isMultiSelectStatus.value) {
4150
4148
  if (services?.uiService.get("uiSelectMode")) {
4151
4149
  document.dispatchEvent(new CustomEvent("ui-select", { detail: data }));
4152
4150
  return;
4153
4151
  }
4154
4152
  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);
4153
+ select(data);
4154
+ } else {
4155
+ multiClickHandler(data);
4161
4156
  }
4162
4157
  };
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
4158
+ const contextmenu = async (event, data) => {
4159
+ event.preventDefault();
4160
+ await select(data);
4161
+ menu.value?.show(event);
4162
+ };
4163
+ return (_ctx, _cache) => {
4164
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), {
4165
+ class: "magic-editor-layer-panel",
4166
+ onMouseenter: addSelectModeListener,
4167
+ onMouseleave: removeSelectModeListener
4205
4168
  }, {
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)
4169
+ default: vue.withCtx(() => [
4170
+ vue.renderSlot(_ctx.$slots, "layer-panel-header"),
4171
+ vue.createVNode(vue.unref(design.TMagicInput), {
4172
+ class: "filterInput",
4173
+ size: "small",
4174
+ placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
4175
+ clearable: "",
4176
+ modelValue: filterText.value,
4177
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
4178
+ onChange: filterTextChangeHandler
4179
+ }, null, 8, ["modelValue"]),
4180
+ vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
4181
+ key: 0,
4182
+ ref_key: "tree",
4183
+ ref: tree,
4184
+ "node-key": "id",
4185
+ "empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
4186
+ draggable: "",
4187
+ "default-expanded-keys": vue.unref(defaultExpandedKeys),
4188
+ load: loadItems,
4189
+ data: vue.unref(values),
4190
+ "expand-on-click-node": false,
4191
+ "highlight-current": true,
4192
+ props: {
4193
+ children: "items"
4194
+ },
4195
+ "filter-node-method": filterNode,
4196
+ "allow-drop": allowDrop,
4197
+ "show-checkbox": isMultiSelectStatus.value || vue.unref(selectedIds).length > 1,
4198
+ onNodeClick: clickHandler,
4199
+ onNodeContextmenu: contextmenu,
4200
+ onNodeDragEnd: handleDragEnd,
4201
+ onNodeCollapse: handleCollapse,
4202
+ onNodeExpand: handleExpand,
4203
+ onCheck: multiClickHandler,
4204
+ onMousedown: toggleClickFlag,
4205
+ onMouseup: toggleClickFlag
4206
+ }, {
4207
+ default: vue.withCtx(({ node, data }) => [
4208
+ vue.createElementVNode("div", {
4209
+ id: data.id,
4210
+ class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
4211
+ onMouseenter: ($event) => vue.unref(highlightHandler)(data)
4212
+ }, [
4213
+ vue.renderSlot(_ctx.$slots, "layer-node-content", {
4214
+ node,
4215
+ data
4216
+ }, () => [
4217
+ vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
4218
+ ])
4219
+ ], 42, _hoisted_1$3)
4220
+ ]),
4221
+ _: 3
4222
+ }, 8, ["default-expanded-keys", "data", "show-checkbox"])) : vue.createCommentVNode("", true),
4223
+ (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
4224
+ vue.createVNode(_sfc_main$b, {
4225
+ ref_key: "menu",
4226
+ ref: menu
4227
+ }, null, 512)
4228
+ ]))
4221
4229
  ]),
4222
4230
  _: 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
- })
4231
+ });
4275
4232
  };
4276
4233
  }
4277
4234
  });
@@ -4280,188 +4237,224 @@
4280
4237
  key: 1,
4281
4238
  class: "magic-editor-tab-panel-title"
4282
4239
  };
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", {
4240
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
4241
+ __name: "TabPane",
4242
+ props: {
4243
+ data: null
4244
+ },
4245
+ setup(__props) {
4246
+ const props = __props;
4247
+ const config = vue.computed(() => {
4248
+ if (typeof props.data !== "string") {
4249
+ return props.data;
4250
+ }
4251
+ switch (props.data) {
4252
+ case "component-list":
4253
+ return {
4254
+ type: "component",
4255
+ icon: iconsVue.Coin,
4256
+ text: "\u7EC4\u4EF6",
4257
+ component: _sfc_main$d,
4258
+ slots: {}
4259
+ };
4260
+ case "layer":
4261
+ return {
4262
+ type: "component",
4263
+ icon: iconsVue.Files,
4264
+ text: "\u5DF2\u9009\u7EC4\u4EF6",
4265
+ component: _sfc_main$a,
4266
+ slots: {}
4267
+ };
4268
+ case "code-block":
4269
+ return {
4270
+ type: "component",
4271
+ icon: iconsVue.EditPen,
4272
+ text: "\u4EE3\u7801\u7F16\u8F91",
4273
+ component: _sfc_main$e,
4274
+ slots: {}
4275
+ };
4276
+ default:
4277
+ return void 0;
4278
+ }
4279
+ });
4280
+ return (_ctx, _cache) => {
4281
+ return vue.unref(config) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabPane), {
4282
+ key: 0,
4283
+ name: vue.unref(config).text
4284
+ }, {
4285
+ label: vue.withCtx(() => [
4286
+ (vue.openBlock(), vue.createElementBlock("div", {
4287
+ key: vue.unref(config).text
4288
+ }, [
4289
+ vue.unref(config).icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
4355
4290
  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]]);
4291
+ icon: vue.unref(config).icon
4292
+ }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
4293
+ vue.unref(config).text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, vue.toDisplayString(vue.unref(config).text), 1)) : vue.createCommentVNode("", true)
4294
+ ]))
4295
+ ]),
4296
+ default: vue.withCtx(() => [
4297
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).component), vue.mergeProps(vue.unref(config).props || {}, vue.toHandlers(vue.unref(config)?.listeners || {})), vue.createSlots({ _: 2 }, [
4298
+ __props.data === "component-list" || vue.unref(config).slots?.componentListPanelHeader ? {
4299
+ name: "component-list-panel-header",
4300
+ fn: vue.withCtx(() => [
4301
+ __props.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : vue.unref(config).slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4302
+ ])
4303
+ } : void 0,
4304
+ __props.data === "component-list" || vue.unref(config).slots?.componentListItem ? {
4305
+ name: "component-list-item",
4306
+ fn: vue.withCtx(({ component }) => [
4307
+ __props.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
4308
+ key: 0,
4309
+ component
4310
+ }) : vue.unref(config).slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.componentListItem), {
4311
+ key: 1,
4312
+ component
4313
+ }, null, 8, ["component"])) : vue.createCommentVNode("", true)
4314
+ ])
4315
+ } : void 0,
4316
+ __props.data === "layer" || vue.unref(config).slots?.layerPanelHeader ? {
4317
+ name: "layer-panel-header",
4318
+ fn: vue.withCtx(() => [
4319
+ __props.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : vue.unref(config).slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4320
+ ])
4321
+ } : void 0,
4322
+ __props.data === "code-block" || vue.unref(config).slots?.codeBlockPanelHeader ? {
4323
+ name: "code-block-panel-header",
4324
+ fn: vue.withCtx(() => [
4325
+ __props.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : vue.unref(config).slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4326
+ ])
4327
+ } : void 0,
4328
+ __props.data === "code-block" || vue.unref(config).slots?.codeBlockPanelTool ? {
4329
+ name: "code-block-panel-tool",
4330
+ fn: vue.withCtx(({ id, data }) => [
4331
+ data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
4332
+ key: 0,
4333
+ id,
4334
+ data
4335
+ }) : vue.unref(config).slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
4336
+ ])
4337
+ } : void 0,
4338
+ __props.data === "code-block" || vue.unref(config).slots?.codeBlockEditPanelHeader ? {
4339
+ name: "code-block-edit-panel-header",
4340
+ fn: vue.withCtx(({ id }) => [
4341
+ __props.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
4342
+ key: 0,
4343
+ id
4344
+ }) : vue.unref(config).slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
4345
+ ])
4346
+ } : void 0,
4347
+ __props.data === "layer" || vue.unref(config).slots?.layerNodeContent ? {
4348
+ name: "layer-node-content",
4349
+ fn: vue.withCtx(({ data: nodeData, node }) => [
4350
+ __props.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
4351
+ key: 0,
4352
+ data: nodeData,
4353
+ node
4354
+ }) : vue.unref(config).slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.layerNodeContent), {
4355
+ key: 1,
4356
+ data: nodeData,
4357
+ node
4358
+ }, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
4359
+ ])
4360
+ } : void 0
4361
+ ]), 1040))
4362
+ ]),
4363
+ _: 3
4364
+ }, 8, ["name"])) : vue.createCommentVNode("", true);
4365
+ };
4366
+ }
4367
+ });
4371
4368
 
4372
- const _sfc_main$8 = vue.defineComponent({
4373
- components: { TabPane },
4374
- name: "m-sidebar",
4369
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
4370
+ __name: "Sidebar",
4375
4371
  props: {
4376
- data: {
4377
- type: Object,
4378
- default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] })
4379
- }
4372
+ data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) }
4380
4373
  },
4381
- setup(props) {
4374
+ setup(__props, { expose }) {
4375
+ const props = __props;
4382
4376
  const activeTabName = vue.ref(props.data?.status);
4383
4377
  vue.watch(
4384
- () => props.data?.status,
4378
+ () => props.data.status,
4385
4379
  (status) => {
4386
4380
  activeTabName.value = status || "0";
4387
4381
  }
4388
4382
  );
4389
- return {
4383
+ expose({
4390
4384
  activeTabName
4385
+ });
4386
+ return (_ctx, _cache) => {
4387
+ return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabs), {
4388
+ key: 0,
4389
+ class: "m-editor-sidebar",
4390
+ modelValue: activeTabName.value,
4391
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
4392
+ type: "card",
4393
+ "tab-position": "left"
4394
+ }, {
4395
+ default: vue.withCtx(() => [
4396
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.data.items, (item, index) => {
4397
+ return vue.openBlock(), vue.createBlock(_sfc_main$9, {
4398
+ key: index,
4399
+ data: item
4400
+ }, vue.createSlots({ _: 2 }, [
4401
+ item === "layer" ? {
4402
+ name: "layer-panel-header",
4403
+ fn: vue.withCtx(() => [
4404
+ vue.renderSlot(_ctx.$slots, "layer-panel-header")
4405
+ ])
4406
+ } : void 0,
4407
+ item === "layer" ? {
4408
+ name: "layer-node-content",
4409
+ fn: vue.withCtx(({ node, data }) => [
4410
+ vue.renderSlot(_ctx.$slots, "layer-node-content", {
4411
+ data,
4412
+ node
4413
+ })
4414
+ ])
4415
+ } : void 0,
4416
+ item === "component-list" ? {
4417
+ name: "component-list-panel-header",
4418
+ fn: vue.withCtx(() => [
4419
+ vue.renderSlot(_ctx.$slots, "component-list-panel-header")
4420
+ ])
4421
+ } : void 0,
4422
+ item === "component-list" ? {
4423
+ name: "component-list-item",
4424
+ fn: vue.withCtx(({ component }) => [
4425
+ vue.renderSlot(_ctx.$slots, "component-list-item", { component })
4426
+ ])
4427
+ } : void 0,
4428
+ item === "code-block" ? {
4429
+ name: "code-block-panel-header",
4430
+ fn: vue.withCtx(() => [
4431
+ vue.renderSlot(_ctx.$slots, "code-block-panel-header")
4432
+ ])
4433
+ } : void 0,
4434
+ item === "code-block" ? {
4435
+ name: "code-block-panel-tool",
4436
+ fn: vue.withCtx(({ id, data }) => [
4437
+ vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
4438
+ id,
4439
+ data
4440
+ })
4441
+ ])
4442
+ } : void 0,
4443
+ item === "code-block" ? {
4444
+ name: "code-block-edit-panel-header",
4445
+ fn: vue.withCtx(({ id }) => [
4446
+ vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
4447
+ ])
4448
+ } : void 0
4449
+ ]), 1032, ["data"]);
4450
+ }), 128))
4451
+ ]),
4452
+ _: 3
4453
+ }, 8, ["modelValue"])) : vue.createCommentVNode("", true);
4391
4454
  };
4392
4455
  }
4393
4456
  });
4394
4457
 
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]]);
4464
-
4465
4458
  const _hoisted_1$1 = {
4466
4459
  key: 1,
4467
4460
  style: { "width": "21px" }
@@ -4548,14 +4541,14 @@
4548
4541
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4549
4542
  onClick: addPage
4550
4543
  }, [
4551
- vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
4544
+ vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
4552
4545
  ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
4553
4546
  canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
4554
4547
  key: 2,
4555
4548
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4556
4549
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
4557
4550
  }, [
4558
- vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
4551
+ vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
4559
4552
  ])) : vue.createCommentVNode("", true),
4560
4553
  vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
4561
4554
  key: 3,
@@ -4571,7 +4564,7 @@
4571
4564
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4572
4565
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
4573
4566
  }, [
4574
- vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
4567
+ vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
4575
4568
  ])) : vue.createCommentVNode("", true)
4576
4569
  ], 512);
4577
4570
  };
@@ -4601,9 +4594,6 @@
4601
4594
  editorService?.remove(node);
4602
4595
  };
4603
4596
  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
4597
  return vue.openBlock(), vue.createBlock(_sfc_main$7, null, {
4608
4598
  default: vue.withCtx(() => [
4609
4599
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(root) && vue.unref(root).items || [], (item) => {
@@ -4614,7 +4604,7 @@
4614
4604
  }, [
4615
4605
  vue.createElementVNode("div", _hoisted_2, [
4616
4606
  vue.renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
4617
- vue.createVNode(_component_el_tooltip, {
4607
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
4618
4608
  effect: "dark",
4619
4609
  placement: "top-start",
4620
4610
  content: item.name
@@ -4626,14 +4616,14 @@
4626
4616
  }, 1032, ["content"])
4627
4617
  ])
4628
4618
  ]),
4629
- vue.createVNode(_component_el_popover, {
4619
+ vue.createVNode(vue.unref(design.TMagicPopover), {
4630
4620
  "popper-class": "page-bar-popover",
4631
4621
  placement: "top",
4632
4622
  width: 160,
4633
4623
  trigger: "hover"
4634
4624
  }, {
4635
4625
  reference: vue.withCtx(() => [
4636
- vue.createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
4626
+ vue.createVNode(vue.unref(design.TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
4637
4627
  default: vue.withCtx(() => [
4638
4628
  vue.createVNode(vue.unref(iconsVue.CaretBottom))
4639
4629
  ]),
@@ -5426,10 +5416,10 @@
5426
5416
  name: "m-editor",
5427
5417
  components: {
5428
5418
  NavMenu: _sfc_main$h,
5429
- Sidebar,
5419
+ Sidebar: _sfc_main$8,
5430
5420
  Workspace: _sfc_main$1,
5431
5421
  PropsPanel: _sfc_main$g,
5432
- Framework: _sfc_main$k
5422
+ Framework: _sfc_main$j
5433
5423
  },
5434
5424
  props: {
5435
5425
  modelValue: {
@@ -5623,6 +5613,14 @@
5623
5613
  }
5624
5614
  });
5625
5615
 
5616
+ const _export_sfc = (sfc, props) => {
5617
+ const target = sfc.__vccOpts || sfc;
5618
+ for (const [key, val] of props) {
5619
+ target[key] = val;
5620
+ }
5621
+ return target;
5622
+ };
5623
+
5626
5624
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
5627
5625
  const _component_nav_menu = vue.resolveComponent("nav-menu");
5628
5626
  const _component_sidebar = vue.resolveComponent("sidebar");
@@ -5656,8 +5654,11 @@
5656
5654
  "code-block-panel-header": vue.withCtx(() => [
5657
5655
  vue.renderSlot(_ctx.$slots, "code-block-panel-header")
5658
5656
  ]),
5659
- "code-block-panel-tool": vue.withCtx(({ id }) => [
5660
- vue.renderSlot(_ctx.$slots, "code-block-panel-tool", { id })
5657
+ "code-block-panel-tool": vue.withCtx(({ id, data }) => [
5658
+ vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
5659
+ id,
5660
+ data
5661
+ })
5661
5662
  ]),
5662
5663
  "code-block-edit-panel-header": vue.withCtx(({ id }) => [
5663
5664
  vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
@@ -5717,7 +5718,7 @@
5717
5718
  app.component("m-fields-ui-select", _sfc_main$p);
5718
5719
  app.component("m-fields-code-link", _sfc_main$r);
5719
5720
  app.component("m-fields-vs-code", _sfc_main$s);
5720
- app.component(CodeEditor.name, CodeEditor);
5721
+ app.component("magic-code-editor", _sfc_main$o);
5721
5722
  app.component("m-fields-code-select", _sfc_main$q);
5722
5723
  }
5723
5724
  };
@@ -5726,19 +5727,20 @@
5726
5727
  exports.CodeBlockList = _sfc_main$e;
5727
5728
  exports.CodeDeleteErrorType = CodeDeleteErrorType;
5728
5729
  exports.CodeEditorMode = CodeEditorMode;
5730
+ exports.CodeSelect = _sfc_main$q;
5729
5731
  exports.CodeSelectOp = CodeSelectOp;
5730
5732
  exports.ColumnLayout = ColumnLayout;
5731
5733
  exports.ComponentListPanel = _sfc_main$d;
5732
5734
  exports.ContentMenu = _sfc_main$c;
5733
5735
  exports.Fixed2Other = Fixed2Other;
5734
5736
  exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
5735
- exports.Icon = _sfc_main$j;
5737
+ exports.Icon = _sfc_main$n;
5736
5738
  exports.Keys = Keys;
5737
5739
  exports.LayerOffset = LayerOffset;
5738
- exports.LayerPanel = LayerPanel;
5740
+ exports.LayerPanel = _sfc_main$a;
5739
5741
  exports.Layout = Layout;
5740
5742
  exports.PropsPanel = _sfc_main$g;
5741
- exports.TMagicCodeEditor = CodeEditor;
5743
+ exports.TMagicCodeEditor = _sfc_main$o;
5742
5744
  exports.TMagicEditor = Editor;
5743
5745
  exports.ToolButton = _sfc_main$i;
5744
5746
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;