@tmagic/editor 1.1.1 → 1.1.2

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.
@@ -30,13 +30,6 @@
30
30
  const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
31
31
  const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
32
32
 
33
- if (typeof global === "undefined") {
34
- window.global = window;
35
- }
36
- if (typeof globalThis === "undefined") {
37
- window.globalThis = window;
38
- }
39
-
40
33
  const _sfc_main$o = vue.defineComponent({
41
34
  name: "m-fields-vs-code",
42
35
  props: ["model", "name", "config", "prop"],
@@ -63,7 +56,7 @@
63
56
  return target;
64
57
  };
65
58
 
66
- function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
59
+ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
67
60
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
68
61
  return vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
69
62
  style: vue.normalizeStyle(`height: ${_ctx.height}`),
@@ -72,7 +65,7 @@
72
65
  onSave: _ctx.save
73
66
  }, null, 8, ["style", "init-values", "language", "onSave"]);
74
67
  }
75
- const Code = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$b]]);
68
+ const Code = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$a]]);
76
69
 
77
70
  const _sfc_main$n = vue.defineComponent({
78
71
  name: "m-fields-code-link",
@@ -130,7 +123,7 @@
130
123
  }
131
124
  });
132
125
 
133
- function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
126
+ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
134
127
  const _component_m_fields_link = vue.resolveComponent("m-fields-link");
135
128
  return vue.openBlock(), vue.createBlock(_component_m_fields_link, {
136
129
  config: _ctx.formConfig,
@@ -139,9 +132,9 @@
139
132
  onChange: _ctx.changeHandler
140
133
  }, null, 8, ["config", "model", "onChange"]);
141
134
  }
142
- const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$a]]);
135
+ const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$9]]);
143
136
 
144
- const _hoisted_1$b = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
137
+ const _hoisted_1$c = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
145
138
  const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
146
139
  __name: "UISelect",
147
140
  props: {
@@ -207,7 +200,7 @@
207
200
  style: { "padding": "0" }
208
201
  }, {
209
202
  default: vue.withCtx(() => [
210
- _hoisted_1$b
203
+ _hoisted_1$c
211
204
  ]),
212
205
  _: 1
213
206
  }, 8, ["icon"])
@@ -378,14 +371,14 @@
378
371
  }
379
372
  });
380
373
 
381
- const _hoisted_1$a = {
374
+ const _hoisted_1$b = {
382
375
  ref: "codeEditor",
383
376
  class: "magic-code-editor"
384
377
  };
385
- function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
386
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, null, 512);
378
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
379
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, null, 512);
387
380
  }
388
- const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$9]]);
381
+ const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$8]]);
389
382
 
390
383
  let $TMAGIC_EDITOR = {};
391
384
  const setConfig = (option) => {
@@ -1901,7 +1894,8 @@
1901
1894
  columnWidth: defaultColumnWidth,
1902
1895
  showGuides: true,
1903
1896
  showRule: true,
1904
- propsPanelSize: "small"
1897
+ propsPanelSize: "small",
1898
+ showAddPageButton: true
1905
1899
  });
1906
1900
  class Ui extends BaseService {
1907
1901
  constructor() {
@@ -2081,13 +2075,13 @@
2081
2075
  }
2082
2076
  });
2083
2077
 
2084
- const _hoisted_1$9 = { class: "m-editor-empty-panel" };
2078
+ const _hoisted_1$a = { class: "m-editor-empty-panel" };
2085
2079
  const _hoisted_2$4 = { class: "m-editor-empty-content" };
2086
2080
  const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
2087
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2081
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2088
2082
  const _component_plus = vue.resolveComponent("plus");
2089
2083
  const _component_el_icon = vue.resolveComponent("el-icon");
2090
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
2084
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
2091
2085
  vue.createElementVNode("div", _hoisted_2$4, [
2092
2086
  vue.createElementVNode("div", {
2093
2087
  class: "m-editor-empty-button",
@@ -2106,7 +2100,7 @@
2106
2100
  ])
2107
2101
  ]);
2108
2102
  }
2109
- const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$8]]);
2103
+ const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$7]]);
2110
2104
 
2111
2105
  const _sfc_main$j = vue.defineComponent({
2112
2106
  name: "m-editor-resize",
@@ -2151,16 +2145,16 @@
2151
2145
  }
2152
2146
  });
2153
2147
 
2154
- const _hoisted_1$8 = {
2148
+ const _hoisted_1$9 = {
2155
2149
  ref: "target",
2156
2150
  class: "m-editor-resizer"
2157
2151
  };
2158
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2159
- return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$8, [
2152
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2153
+ return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$9, [
2160
2154
  vue.renderSlot(_ctx.$slots, "default")
2161
2155
  ], 512);
2162
2156
  }
2163
- const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$7]]);
2157
+ const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$6]]);
2164
2158
 
2165
2159
  const _sfc_main$i = vue.defineComponent({
2166
2160
  components: {
@@ -2192,17 +2186,17 @@
2192
2186
  }
2193
2187
  });
2194
2188
 
2195
- const _hoisted_1$7 = { class: "m-editor" };
2189
+ const _hoisted_1$8 = { class: "m-editor" };
2196
2190
  const _hoisted_2$3 = {
2197
2191
  key: 1,
2198
2192
  class: "m-editor-content"
2199
2193
  };
2200
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2194
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2201
2195
  const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
2202
2196
  const _component_resizer = vue.resolveComponent("resizer");
2203
2197
  const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
2204
2198
  const _component_add_page_box = vue.resolveComponent("add-page-box");
2205
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
2199
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
2206
2200
  vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
2207
2201
  _ctx.showSrc ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
2208
2202
  key: 0,
@@ -2243,9 +2237,9 @@
2243
2237
  ]))
2244
2238
  ]);
2245
2239
  }
2246
- const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$6]]);
2240
+ const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$5]]);
2247
2241
 
2248
- const _hoisted_1$6 = ["src"];
2242
+ const _hoisted_1$7 = ["src"];
2249
2243
  const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
2250
2244
  __name: "Icon",
2251
2245
  props: {
@@ -2254,20 +2248,29 @@
2254
2248
  setup(__props) {
2255
2249
  return (_ctx, _cache) => {
2256
2250
  const _component_el_icon = vue.resolveComponent("el-icon");
2257
- return !__props.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
2251
+ return !__props.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
2252
+ key: 0,
2253
+ class: "magic-editor-icon"
2254
+ }, {
2258
2255
  default: vue.withCtx(() => [
2259
2256
  vue.createVNode(vue.unref(iconsVue.Edit))
2260
2257
  ]),
2261
2258
  _: 1
2262
- })) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 1 }, {
2259
+ })) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
2260
+ key: 1,
2261
+ class: "magic-editor-icon"
2262
+ }, {
2263
2263
  default: vue.withCtx(() => [
2264
- vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$6)
2264
+ vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$7)
2265
2265
  ]),
2266
2266
  _: 1
2267
2267
  })) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
2268
2268
  key: 2,
2269
- class: vue.normalizeClass(__props.icon)
2270
- }, null, 2)) : (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 3 }, {
2269
+ class: vue.normalizeClass(["magic-editor-icon", __props.icon])
2270
+ }, null, 2)) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
2271
+ key: 3,
2272
+ class: "magic-editor-icon"
2273
+ }, {
2271
2274
  default: vue.withCtx(() => [
2272
2275
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
2273
2276
  ]),
@@ -2277,7 +2280,7 @@
2277
2280
  }
2278
2281
  });
2279
2282
 
2280
- const _hoisted_1$5 = {
2283
+ const _hoisted_1$6 = {
2281
2284
  key: 1,
2282
2285
  class: "menu-item-text"
2283
2286
  };
@@ -2365,7 +2368,7 @@
2365
2368
  __props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(_component_el_divider, {
2366
2369
  key: 0,
2367
2370
  direction: __props.data.direction || "vertical"
2368
- }, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
2371
+ }, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
2369
2372
  __props.data.tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
2370
2373
  key: 0,
2371
2374
  effect: "dark",
@@ -2608,7 +2611,7 @@
2608
2611
  }
2609
2612
  });
2610
2613
 
2611
- const _hoisted_1$4 = { class: "`m-editor-props-panel" };
2614
+ const _hoisted_1$5 = { class: "`m-editor-props-panel" };
2612
2615
  const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
2613
2616
  __name: "PropsPanel",
2614
2617
  emits: ["mounted"],
@@ -2658,7 +2661,7 @@
2658
2661
  expose({ submit });
2659
2662
  return (_ctx, _cache) => {
2660
2663
  const _component_m_form = vue.resolveComponent("m-form");
2661
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
2664
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
2662
2665
  vue.renderSlot(_ctx.$slots, "props-panel-header"),
2663
2666
  vue.createVNode(_component_m_form, {
2664
2667
  ref_key: "configForm",
@@ -2675,10 +2678,11 @@
2675
2678
  }
2676
2679
  });
2677
2680
 
2678
- const _sfc_main$d = vue.defineComponent({
2679
- name: "ui-component-panel",
2680
- components: { MIcon: _sfc_main$h },
2681
- setup() {
2681
+ const _hoisted_1$4 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
2682
+ const _hoisted_2$1 = ["onClick", "onDragstart"];
2683
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
2684
+ __name: "ComponentListPanel",
2685
+ setup(__props) {
2682
2686
  const searchText = vue.ref("");
2683
2687
  const services = vue.inject("services");
2684
2688
  const stageOptions = vue.inject("stageOptions");
@@ -2691,132 +2695,124 @@
2691
2695
  let timeout;
2692
2696
  let clientX;
2693
2697
  let clientY;
2694
- return {
2695
- searchText,
2696
- collapseValue,
2697
- list,
2698
- appendComponent({ text, type, data = {} }) {
2699
- services?.editorService.add({
2698
+ const appendComponent = ({ text, type, data = {} }) => {
2699
+ services?.editorService.add({
2700
+ name: text,
2701
+ type,
2702
+ ...data
2703
+ });
2704
+ };
2705
+ const dragstartHandler = ({ text, type, data = {} }, e) => {
2706
+ if (e.dataTransfer) {
2707
+ e.dataTransfer.effectAllowed = "move";
2708
+ e.dataTransfer.setData("data", serialize__default.default({
2700
2709
  name: text,
2701
2710
  type,
2702
2711
  ...data
2703
- });
2704
- },
2705
- dragstartHandler({ text, type, data = {} }, e) {
2706
- if (e.dataTransfer) {
2707
- e.dataTransfer.effectAllowed = "move";
2708
- e.dataTransfer.setData("data", serialize__default.default({
2709
- name: text,
2710
- type,
2711
- ...data
2712
- }).replace(/"(\w+)":\s/g, "$1: "));
2713
- }
2714
- },
2715
- dragendHandler() {
2712
+ }).replace(/"(\w+)":\s/g, "$1: "));
2713
+ }
2714
+ };
2715
+ const dragendHandler = () => {
2716
+ if (timeout) {
2717
+ globalThis.clearTimeout(timeout);
2718
+ timeout = void 0;
2719
+ }
2720
+ const doc = stage.value?.renderer.contentWindow?.document;
2721
+ if (doc && stageOptions) {
2722
+ utils.removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
2723
+ }
2724
+ clientX = 0;
2725
+ clientY = 0;
2726
+ };
2727
+ const dragHandler = (e) => {
2728
+ if (e.clientX !== clientX || e.clientY !== clientY) {
2729
+ clientX = e.clientX;
2730
+ clientY = e.clientY;
2716
2731
  if (timeout) {
2717
2732
  globalThis.clearTimeout(timeout);
2718
2733
  timeout = void 0;
2719
2734
  }
2720
- const doc = stage.value?.renderer.contentWindow?.document;
2721
- if (doc && stageOptions) {
2722
- utils.removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
2723
- }
2724
- clientX = 0;
2725
- clientY = 0;
2726
- },
2727
- dragHandler(e) {
2728
- if (e.clientX !== clientX || e.clientY !== clientY) {
2729
- clientX = e.clientX;
2730
- clientY = e.clientY;
2731
- if (timeout) {
2732
- globalThis.clearTimeout(timeout);
2733
- timeout = void 0;
2734
- }
2735
- return;
2736
- }
2737
- if (timeout || !stage.value)
2738
- return;
2739
- timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
2735
+ return;
2740
2736
  }
2737
+ if (timeout || !stage.value)
2738
+ return;
2739
+ timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
2741
2740
  };
2742
- }
2743
- });
2744
-
2745
- const _hoisted_1$3 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
2746
- const _hoisted_2$1 = ["onClick", "onDragstart"];
2747
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2748
- const _component_el_input = vue.resolveComponent("el-input");
2749
- const _component_m_icon = vue.resolveComponent("m-icon");
2750
- const _component_el_tooltip = vue.resolveComponent("el-tooltip");
2751
- const _component_el_collapse_item = vue.resolveComponent("el-collapse-item");
2752
- const _component_el_collapse = vue.resolveComponent("el-collapse");
2753
- const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
2754
- return vue.openBlock(), vue.createBlock(_component_el_scrollbar, null, {
2755
- default: vue.withCtx(() => [
2756
- vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
2757
- vue.createVNode(_component_el_collapse, {
2758
- class: "ui-component-panel",
2759
- "model-value": _ctx.collapseValue
2760
- }, {
2741
+ return (_ctx, _cache) => {
2742
+ const _component_el_input = vue.resolveComponent("el-input");
2743
+ const _component_el_tooltip = vue.resolveComponent("el-tooltip");
2744
+ const _component_el_collapse_item = vue.resolveComponent("el-collapse-item");
2745
+ const _component_el_collapse = vue.resolveComponent("el-collapse");
2746
+ const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
2747
+ return vue.openBlock(), vue.createBlock(_component_el_scrollbar, null, {
2761
2748
  default: vue.withCtx(() => [
2762
- vue.createVNode(_component_el_input, {
2763
- "prefix-icon": "el-icon-search",
2764
- placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
2765
- class: "search-input",
2766
- size: "small",
2767
- clearable: "",
2768
- modelValue: _ctx.searchText,
2769
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.searchText = $event)
2770
- }, null, 8, ["modelValue"]),
2771
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.list, (group, index) => {
2772
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
2773
- group.items && group.items.length ? (vue.openBlock(), vue.createBlock(_component_el_collapse_item, {
2774
- key: index,
2775
- name: index
2776
- }, {
2777
- title: vue.withCtx(() => [
2778
- _hoisted_1$3,
2779
- vue.createTextVNode(vue.toDisplayString(group.title), 1)
2780
- ]),
2781
- default: vue.withCtx(() => [
2782
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.items, (item) => {
2783
- return vue.openBlock(), vue.createElementBlock("div", {
2784
- class: "component-item",
2785
- draggable: "true",
2786
- key: item.type,
2787
- onClick: ($event) => _ctx.appendComponent(item),
2788
- onDragstart: ($event) => _ctx.dragstartHandler(item, $event),
2789
- onDragend: _cache[1] || (_cache[1] = (...args) => _ctx.dragendHandler && _ctx.dragendHandler(...args)),
2790
- onDrag: _cache[2] || (_cache[2] = (...args) => _ctx.dragHandler && _ctx.dragHandler(...args))
2791
- }, [
2792
- vue.createVNode(_component_m_icon, {
2793
- icon: item.icon
2794
- }, null, 8, ["icon"]),
2795
- vue.createVNode(_component_el_tooltip, {
2796
- effect: "dark",
2797
- placement: "bottom",
2798
- content: item.text
2799
- }, {
2800
- default: vue.withCtx(() => [
2801
- vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1)
2802
- ]),
2803
- _: 2
2804
- }, 1032, ["content"])
2805
- ], 40, _hoisted_2$1);
2806
- }), 128))
2807
- ]),
2808
- _: 2
2809
- }, 1032, ["name"])) : vue.createCommentVNode("", true)
2810
- ], 64);
2811
- }), 256))
2749
+ vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
2750
+ vue.createVNode(_component_el_collapse, {
2751
+ class: "ui-component-panel",
2752
+ "model-value": vue.unref(collapseValue)
2753
+ }, {
2754
+ default: vue.withCtx(() => [
2755
+ vue.createVNode(_component_el_input, {
2756
+ "prefix-icon": "el-icon-search",
2757
+ placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
2758
+ class: "search-input",
2759
+ size: "small",
2760
+ clearable: "",
2761
+ modelValue: searchText.value,
2762
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event)
2763
+ }, null, 8, ["modelValue"]),
2764
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
2765
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
2766
+ group.items && group.items.length ? (vue.openBlock(), vue.createBlock(_component_el_collapse_item, {
2767
+ key: index,
2768
+ name: index
2769
+ }, {
2770
+ title: vue.withCtx(() => [
2771
+ _hoisted_1$4,
2772
+ vue.createTextVNode(vue.toDisplayString(group.title), 1)
2773
+ ]),
2774
+ default: vue.withCtx(() => [
2775
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.items, (item) => {
2776
+ return vue.openBlock(), vue.createElementBlock("div", {
2777
+ class: "component-item",
2778
+ draggable: "true",
2779
+ key: item.type,
2780
+ onClick: ($event) => appendComponent(item),
2781
+ onDragstart: ($event) => dragstartHandler(item, $event),
2782
+ onDragend: dragendHandler,
2783
+ onDrag: dragHandler
2784
+ }, [
2785
+ vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
2786
+ vue.createVNode(_sfc_main$h, {
2787
+ icon: item.icon
2788
+ }, null, 8, ["icon"]),
2789
+ vue.createVNode(_component_el_tooltip, {
2790
+ effect: "dark",
2791
+ placement: "bottom",
2792
+ content: item.text
2793
+ }, {
2794
+ default: vue.withCtx(() => [
2795
+ vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1)
2796
+ ]),
2797
+ _: 2
2798
+ }, 1032, ["content"])
2799
+ ])
2800
+ ], 40, _hoisted_2$1);
2801
+ }), 128))
2802
+ ]),
2803
+ _: 2
2804
+ }, 1032, ["name"])) : vue.createCommentVNode("", true)
2805
+ ], 64);
2806
+ }), 256))
2807
+ ]),
2808
+ _: 3
2809
+ }, 8, ["model-value"])
2812
2810
  ]),
2813
- _: 1
2814
- }, 8, ["model-value"])
2815
- ]),
2816
- _: 3
2817
- });
2818
- }
2819
- const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$5]]);
2811
+ _: 3
2812
+ });
2813
+ };
2814
+ }
2815
+ });
2820
2816
 
2821
2817
  const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
2822
2818
  __name: "ContentMenu",
@@ -3198,7 +3194,7 @@
3198
3194
  }
3199
3195
  });
3200
3196
 
3201
- const _hoisted_1$2 = ["id", "onMouseenter"];
3197
+ const _hoisted_1$3 = ["id", "onMouseenter"];
3202
3198
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
3203
3199
  const _component_el_input = vue.resolveComponent("el-input");
3204
3200
  const _component_el_tree = vue.resolveComponent("el-tree");
@@ -3252,7 +3248,7 @@
3252
3248
  }, () => [
3253
3249
  vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
3254
3250
  ])
3255
- ], 42, _hoisted_1$2)
3251
+ ], 42, _hoisted_1$3)
3256
3252
  ]),
3257
3253
  _: 3
3258
3254
  }, 8, ["default-expanded-keys", "load", "data", "filter-node-method", "allow-drop", "onNodeClick", "onNodeContextmenu", "onNodeDragEnd", "onNodeCollapse", "onNodeExpand"])) : vue.createCommentVNode("", true),
@@ -3284,7 +3280,7 @@
3284
3280
  type: "component",
3285
3281
  icon: iconsVue.Coin,
3286
3282
  text: "\u7EC4\u4EF6",
3287
- component: ComponentListPanel,
3283
+ component: _sfc_main$d,
3288
3284
  slots: {}
3289
3285
  };
3290
3286
  case "layer":
@@ -3303,7 +3299,7 @@
3303
3299
  }
3304
3300
  });
3305
3301
 
3306
- const _hoisted_1$1 = {
3302
+ const _hoisted_1$2 = {
3307
3303
  key: 1,
3308
3304
  class: "magic-editor-tab-panel-title"
3309
3305
  };
@@ -3322,7 +3318,7 @@
3322
3318
  key: 0,
3323
3319
  icon: _ctx.config.icon
3324
3320
  }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
3325
- _ctx.config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, vue.toDisplayString(_ctx.config.text), 1)) : vue.createCommentVNode("", true)
3321
+ _ctx.config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, vue.toDisplayString(_ctx.config.text), 1)) : vue.createCommentVNode("", true)
3326
3322
  ]))
3327
3323
  ]),
3328
3324
  default: vue.withCtx(() => [
@@ -3333,6 +3329,18 @@
3333
3329
  _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)
3334
3330
  ])
3335
3331
  } : void 0,
3332
+ _ctx.data === "component-list" || _ctx.config.slots?.componentListItem ? {
3333
+ name: "component-list-item",
3334
+ fn: vue.withCtx(({ component }) => [
3335
+ _ctx.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
3336
+ key: 0,
3337
+ component
3338
+ }) : _ctx.config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.componentListItem), {
3339
+ key: 1,
3340
+ component
3341
+ }, null, 8, ["component"])) : vue.createCommentVNode("", true)
3342
+ ])
3343
+ } : void 0,
3336
3344
  _ctx.data === "layer" || _ctx.config.slots?.layerPanelHeader ? {
3337
3345
  name: "layer-panel-header",
3338
3346
  fn: vue.withCtx(() => [
@@ -3403,6 +3411,12 @@
3403
3411
  fn: vue.withCtx(() => [
3404
3412
  vue.renderSlot(_ctx.$slots, "component-list-panel-header")
3405
3413
  ])
3414
+ } : void 0,
3415
+ item === "component-list" ? {
3416
+ name: "component-list-item",
3417
+ fn: vue.withCtx(({ component }) => [
3418
+ vue.renderSlot(_ctx.$slots, "component-list-item", { component })
3419
+ ])
3406
3420
  } : void 0
3407
3421
  ]), 1032, ["data"]);
3408
3422
  }), 128))
@@ -3412,16 +3426,22 @@
3412
3426
  }
3413
3427
  const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$1]]);
3414
3428
 
3429
+ const _hoisted_1$1 = {
3430
+ key: 1,
3431
+ style: { "width": "21px" }
3432
+ };
3415
3433
  const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
3416
3434
  __name: "PageBarScrollContainer",
3417
3435
  setup(__props) {
3418
3436
  const services = vue.inject("services");
3419
3437
  const editorService = services?.editorService;
3438
+ const uiService = services?.uiService;
3420
3439
  const pageBar = vue.ref();
3421
3440
  const itemsContainer = vue.ref();
3422
3441
  const pageBarWidth = vue.ref(0);
3423
3442
  const canScroll = vue.ref(false);
3424
- const itemsContainerWidth = vue.computed(() => pageBarWidth.value - 105);
3443
+ const showAddPageButton = vue.computed(() => uiService?.get("showAddPageButton"));
3444
+ const itemsContainerWidth = vue.computed(() => pageBarWidth.value - 35 * 2 - (showAddPageButton.value ? 35 : 21));
3425
3445
  let translateLeft = 0;
3426
3446
  const resizeObserver = new ResizeObserver((entries) => {
3427
3447
  for (const { contentRect } of entries) {
@@ -3432,7 +3452,7 @@
3432
3452
  });
3433
3453
  const setCanScroll = () => {
3434
3454
  if (itemsContainer.value) {
3435
- canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
3455
+ canScroll.value = itemsContainer.value.scrollWidth > itemsContainerWidth.value;
3436
3456
  }
3437
3457
  };
3438
3458
  const scroll = (type) => {
@@ -3489,7 +3509,8 @@
3489
3509
  ref_key: "pageBar",
3490
3510
  ref: pageBar
3491
3511
  }, [
3492
- vue.createElementVNode("div", {
3512
+ vue.unref(showAddPageButton) ? (vue.openBlock(), vue.createElementBlock("div", {
3513
+ key: 0,
3493
3514
  id: "m-editor-page-bar-add-icon",
3494
3515
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3495
3516
  onClick: addPage
@@ -3500,9 +3521,9 @@
3500
3521
  ]),
3501
3522
  _: 1
3502
3523
  })
3503
- ]),
3524
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
3504
3525
  canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
3505
- key: 0,
3526
+ key: 2,
3506
3527
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3507
3528
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
3508
3529
  }, [
@@ -3514,7 +3535,7 @@
3514
3535
  })
3515
3536
  ])) : vue.createCommentVNode("", true),
3516
3537
  vue.unref(root) ? (vue.openBlock(), vue.createElementBlock("div", {
3517
- key: 1,
3538
+ key: 3,
3518
3539
  class: "m-editor-page-bar-items",
3519
3540
  ref_key: "itemsContainer",
3520
3541
  ref: itemsContainer,
@@ -3523,7 +3544,7 @@
3523
3544
  vue.renderSlot(_ctx.$slots, "default")
3524
3545
  ], 4)) : vue.createCommentVNode("", true),
3525
3546
  canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
3526
- key: 2,
3547
+ key: 4,
3527
3548
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3528
3549
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
3529
3550
  }, [
@@ -4179,8 +4200,8 @@
4179
4200
  config.style = {
4180
4201
  ...style,
4181
4202
  position,
4182
- top,
4183
- left
4203
+ top: top / zoom.value,
4204
+ left: left / zoom.value
4184
4205
  };
4185
4206
  config.inputEvent = e;
4186
4207
  services?.editorService.add(config, parent);
@@ -4559,6 +4580,9 @@
4559
4580
  "component-list-panel-header": vue.withCtx(() => [
4560
4581
  vue.renderSlot(_ctx.$slots, "component-list-panel-header")
4561
4582
  ]),
4583
+ "component-list-item": vue.withCtx(({ component }) => [
4584
+ vue.renderSlot(_ctx.$slots, "component-list-item", { component })
4585
+ ]),
4562
4586
  _: 3
4563
4587
  }, 8, ["data"])
4564
4588
  ])
@@ -4620,7 +4644,7 @@
4620
4644
 
4621
4645
  exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
4622
4646
  exports.ColumnLayout = ColumnLayout;
4623
- exports.ComponentListPanel = ComponentListPanel;
4647
+ exports.ComponentListPanel = _sfc_main$d;
4624
4648
  exports.ContentMenu = _sfc_main$c;
4625
4649
  exports.Fixed2Other = Fixed2Other;
4626
4650
  exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;