@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.
@@ -12,13 +12,6 @@ import Gesto from 'gesto';
12
12
  import { ElMessage } from 'element-plus';
13
13
  import KeyController from 'keycon';
14
14
 
15
- if (typeof global === "undefined") {
16
- window.global = window;
17
- }
18
- if (typeof globalThis === "undefined") {
19
- window.globalThis = window;
20
- }
21
-
22
15
  const _sfc_main$o = defineComponent({
23
16
  name: "m-fields-vs-code",
24
17
  props: ["model", "name", "config", "prop"],
@@ -45,7 +38,7 @@ const _export_sfc = (sfc, props) => {
45
38
  return target;
46
39
  };
47
40
 
48
- function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
41
+ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
49
42
  const _component_magic_code_editor = resolveComponent("magic-code-editor");
50
43
  return openBlock(), createBlock(_component_magic_code_editor, {
51
44
  style: normalizeStyle(`height: ${_ctx.height}`),
@@ -54,7 +47,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
54
47
  onSave: _ctx.save
55
48
  }, null, 8, ["style", "init-values", "language", "onSave"]);
56
49
  }
57
- const Code = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$b]]);
50
+ const Code = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$a]]);
58
51
 
59
52
  const _sfc_main$n = defineComponent({
60
53
  name: "m-fields-code-link",
@@ -112,7 +105,7 @@ const _sfc_main$n = defineComponent({
112
105
  }
113
106
  });
114
107
 
115
- function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
108
+ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
116
109
  const _component_m_fields_link = resolveComponent("m-fields-link");
117
110
  return openBlock(), createBlock(_component_m_fields_link, {
118
111
  config: _ctx.formConfig,
@@ -121,9 +114,9 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
121
114
  onChange: _ctx.changeHandler
122
115
  }, null, 8, ["config", "model", "onChange"]);
123
116
  }
124
- const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$a]]);
117
+ const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$9]]);
125
118
 
126
- const _hoisted_1$b = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
119
+ const _hoisted_1$c = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
127
120
  const _sfc_main$m = /* @__PURE__ */ defineComponent({
128
121
  __name: "UISelect",
129
122
  props: {
@@ -189,7 +182,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
189
182
  style: { "padding": "0" }
190
183
  }, {
191
184
  default: withCtx(() => [
192
- _hoisted_1$b
185
+ _hoisted_1$c
193
186
  ]),
194
187
  _: 1
195
188
  }, 8, ["icon"])
@@ -360,14 +353,14 @@ const _sfc_main$l = defineComponent({
360
353
  }
361
354
  });
362
355
 
363
- const _hoisted_1$a = {
356
+ const _hoisted_1$b = {
364
357
  ref: "codeEditor",
365
358
  class: "magic-code-editor"
366
359
  };
367
- function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
368
- return openBlock(), createElementBlock("div", _hoisted_1$a, null, 512);
360
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
361
+ return openBlock(), createElementBlock("div", _hoisted_1$b, null, 512);
369
362
  }
370
- const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$9]]);
363
+ const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$8]]);
371
364
 
372
365
  let $TMAGIC_EDITOR = {};
373
366
  const setConfig = (option) => {
@@ -1883,7 +1876,8 @@ const state = reactive({
1883
1876
  columnWidth: defaultColumnWidth,
1884
1877
  showGuides: true,
1885
1878
  showRule: true,
1886
- propsPanelSize: "small"
1879
+ propsPanelSize: "small",
1880
+ showAddPageButton: true
1887
1881
  });
1888
1882
  class Ui extends BaseService {
1889
1883
  constructor() {
@@ -2063,13 +2057,13 @@ const _sfc_main$k = defineComponent({
2063
2057
  }
2064
2058
  });
2065
2059
 
2066
- const _hoisted_1$9 = { class: "m-editor-empty-panel" };
2060
+ const _hoisted_1$a = { class: "m-editor-empty-panel" };
2067
2061
  const _hoisted_2$4 = { class: "m-editor-empty-content" };
2068
2062
  const _hoisted_3 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
2069
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2063
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2070
2064
  const _component_plus = resolveComponent("plus");
2071
2065
  const _component_el_icon = resolveComponent("el-icon");
2072
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
2066
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
2073
2067
  createElementVNode("div", _hoisted_2$4, [
2074
2068
  createElementVNode("div", {
2075
2069
  class: "m-editor-empty-button",
@@ -2088,7 +2082,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2088
2082
  ])
2089
2083
  ]);
2090
2084
  }
2091
- const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$8]]);
2085
+ const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$7]]);
2092
2086
 
2093
2087
  const _sfc_main$j = defineComponent({
2094
2088
  name: "m-editor-resize",
@@ -2133,16 +2127,16 @@ const _sfc_main$j = defineComponent({
2133
2127
  }
2134
2128
  });
2135
2129
 
2136
- const _hoisted_1$8 = {
2130
+ const _hoisted_1$9 = {
2137
2131
  ref: "target",
2138
2132
  class: "m-editor-resizer"
2139
2133
  };
2140
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2141
- return openBlock(), createElementBlock("span", _hoisted_1$8, [
2134
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2135
+ return openBlock(), createElementBlock("span", _hoisted_1$9, [
2142
2136
  renderSlot(_ctx.$slots, "default")
2143
2137
  ], 512);
2144
2138
  }
2145
- const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$7]]);
2139
+ const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$6]]);
2146
2140
 
2147
2141
  const _sfc_main$i = defineComponent({
2148
2142
  components: {
@@ -2174,17 +2168,17 @@ const _sfc_main$i = defineComponent({
2174
2168
  }
2175
2169
  });
2176
2170
 
2177
- const _hoisted_1$7 = { class: "m-editor" };
2171
+ const _hoisted_1$8 = { class: "m-editor" };
2178
2172
  const _hoisted_2$3 = {
2179
2173
  key: 1,
2180
2174
  class: "m-editor-content"
2181
2175
  };
2182
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2176
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2183
2177
  const _component_magic_code_editor = resolveComponent("magic-code-editor");
2184
2178
  const _component_resizer = resolveComponent("resizer");
2185
2179
  const _component_el_scrollbar = resolveComponent("el-scrollbar");
2186
2180
  const _component_add_page_box = resolveComponent("add-page-box");
2187
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
2181
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
2188
2182
  renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
2189
2183
  _ctx.showSrc ? (openBlock(), createBlock(_component_magic_code_editor, {
2190
2184
  key: 0,
@@ -2225,9 +2219,9 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
2225
2219
  ]))
2226
2220
  ]);
2227
2221
  }
2228
- const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$6]]);
2222
+ const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$5]]);
2229
2223
 
2230
- const _hoisted_1$6 = ["src"];
2224
+ const _hoisted_1$7 = ["src"];
2231
2225
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
2232
2226
  __name: "Icon",
2233
2227
  props: {
@@ -2236,20 +2230,29 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2236
2230
  setup(__props) {
2237
2231
  return (_ctx, _cache) => {
2238
2232
  const _component_el_icon = resolveComponent("el-icon");
2239
- return !__props.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
2233
+ return !__props.icon ? (openBlock(), createBlock(_component_el_icon, {
2234
+ key: 0,
2235
+ class: "magic-editor-icon"
2236
+ }, {
2240
2237
  default: withCtx(() => [
2241
2238
  createVNode(unref(Edit))
2242
2239
  ]),
2243
2240
  _: 1
2244
- })) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
2241
+ })) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(_component_el_icon, {
2242
+ key: 1,
2243
+ class: "magic-editor-icon"
2244
+ }, {
2245
2245
  default: withCtx(() => [
2246
- createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$6)
2246
+ createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$7)
2247
2247
  ]),
2248
2248
  _: 1
2249
2249
  })) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
2250
2250
  key: 2,
2251
- class: normalizeClass(__props.icon)
2252
- }, null, 2)) : (openBlock(), createBlock(_component_el_icon, { key: 3 }, {
2251
+ class: normalizeClass(["magic-editor-icon", __props.icon])
2252
+ }, null, 2)) : (openBlock(), createBlock(_component_el_icon, {
2253
+ key: 3,
2254
+ class: "magic-editor-icon"
2255
+ }, {
2253
2256
  default: withCtx(() => [
2254
2257
  (openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
2255
2258
  ]),
@@ -2259,7 +2262,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2259
2262
  }
2260
2263
  });
2261
2264
 
2262
- const _hoisted_1$5 = {
2265
+ const _hoisted_1$6 = {
2263
2266
  key: 1,
2264
2267
  class: "menu-item-text"
2265
2268
  };
@@ -2347,7 +2350,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2347
2350
  __props.data.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
2348
2351
  key: 0,
2349
2352
  direction: __props.data.direction || "vertical"
2350
- }, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$5, toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2353
+ }, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$6, toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2351
2354
  __props.data.tooltip ? (openBlock(), createBlock(_component_el_tooltip, {
2352
2355
  key: 0,
2353
2356
  effect: "dark",
@@ -2590,7 +2593,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2590
2593
  }
2591
2594
  });
2592
2595
 
2593
- const _hoisted_1$4 = { class: "`m-editor-props-panel" };
2596
+ const _hoisted_1$5 = { class: "`m-editor-props-panel" };
2594
2597
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
2595
2598
  __name: "PropsPanel",
2596
2599
  emits: ["mounted"],
@@ -2640,7 +2643,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2640
2643
  expose({ submit });
2641
2644
  return (_ctx, _cache) => {
2642
2645
  const _component_m_form = resolveComponent("m-form");
2643
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
2646
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
2644
2647
  renderSlot(_ctx.$slots, "props-panel-header"),
2645
2648
  createVNode(_component_m_form, {
2646
2649
  ref_key: "configForm",
@@ -2657,10 +2660,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2657
2660
  }
2658
2661
  });
2659
2662
 
2660
- const _sfc_main$d = defineComponent({
2661
- name: "ui-component-panel",
2662
- components: { MIcon: _sfc_main$h },
2663
- setup() {
2663
+ const _hoisted_1$4 = /* @__PURE__ */ createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
2664
+ const _hoisted_2$1 = ["onClick", "onDragstart"];
2665
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2666
+ __name: "ComponentListPanel",
2667
+ setup(__props) {
2664
2668
  const searchText = ref("");
2665
2669
  const services = inject("services");
2666
2670
  const stageOptions = inject("stageOptions");
@@ -2673,132 +2677,124 @@ const _sfc_main$d = defineComponent({
2673
2677
  let timeout;
2674
2678
  let clientX;
2675
2679
  let clientY;
2676
- return {
2677
- searchText,
2678
- collapseValue,
2679
- list,
2680
- appendComponent({ text, type, data = {} }) {
2681
- services?.editorService.add({
2680
+ const appendComponent = ({ text, type, data = {} }) => {
2681
+ services?.editorService.add({
2682
+ name: text,
2683
+ type,
2684
+ ...data
2685
+ });
2686
+ };
2687
+ const dragstartHandler = ({ text, type, data = {} }, e) => {
2688
+ if (e.dataTransfer) {
2689
+ e.dataTransfer.effectAllowed = "move";
2690
+ e.dataTransfer.setData("data", serialize({
2682
2691
  name: text,
2683
2692
  type,
2684
2693
  ...data
2685
- });
2686
- },
2687
- dragstartHandler({ text, type, data = {} }, e) {
2688
- if (e.dataTransfer) {
2689
- e.dataTransfer.effectAllowed = "move";
2690
- e.dataTransfer.setData("data", serialize({
2691
- name: text,
2692
- type,
2693
- ...data
2694
- }).replace(/"(\w+)":\s/g, "$1: "));
2695
- }
2696
- },
2697
- dragendHandler() {
2694
+ }).replace(/"(\w+)":\s/g, "$1: "));
2695
+ }
2696
+ };
2697
+ const dragendHandler = () => {
2698
+ if (timeout) {
2699
+ globalThis.clearTimeout(timeout);
2700
+ timeout = void 0;
2701
+ }
2702
+ const doc = stage.value?.renderer.contentWindow?.document;
2703
+ if (doc && stageOptions) {
2704
+ removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
2705
+ }
2706
+ clientX = 0;
2707
+ clientY = 0;
2708
+ };
2709
+ const dragHandler = (e) => {
2710
+ if (e.clientX !== clientX || e.clientY !== clientY) {
2711
+ clientX = e.clientX;
2712
+ clientY = e.clientY;
2698
2713
  if (timeout) {
2699
2714
  globalThis.clearTimeout(timeout);
2700
2715
  timeout = void 0;
2701
2716
  }
2702
- const doc = stage.value?.renderer.contentWindow?.document;
2703
- if (doc && stageOptions) {
2704
- removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
2705
- }
2706
- clientX = 0;
2707
- clientY = 0;
2708
- },
2709
- dragHandler(e) {
2710
- if (e.clientX !== clientX || e.clientY !== clientY) {
2711
- clientX = e.clientX;
2712
- clientY = e.clientY;
2713
- if (timeout) {
2714
- globalThis.clearTimeout(timeout);
2715
- timeout = void 0;
2716
- }
2717
- return;
2718
- }
2719
- if (timeout || !stage.value)
2720
- return;
2721
- timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
2717
+ return;
2722
2718
  }
2719
+ if (timeout || !stage.value)
2720
+ return;
2721
+ timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
2723
2722
  };
2724
- }
2725
- });
2726
-
2727
- const _hoisted_1$3 = /* @__PURE__ */ createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
2728
- const _hoisted_2$1 = ["onClick", "onDragstart"];
2729
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
2730
- const _component_el_input = resolveComponent("el-input");
2731
- const _component_m_icon = resolveComponent("m-icon");
2732
- const _component_el_tooltip = resolveComponent("el-tooltip");
2733
- const _component_el_collapse_item = resolveComponent("el-collapse-item");
2734
- const _component_el_collapse = resolveComponent("el-collapse");
2735
- const _component_el_scrollbar = resolveComponent("el-scrollbar");
2736
- return openBlock(), createBlock(_component_el_scrollbar, null, {
2737
- default: withCtx(() => [
2738
- renderSlot(_ctx.$slots, "component-list-panel-header"),
2739
- createVNode(_component_el_collapse, {
2740
- class: "ui-component-panel",
2741
- "model-value": _ctx.collapseValue
2742
- }, {
2723
+ return (_ctx, _cache) => {
2724
+ const _component_el_input = resolveComponent("el-input");
2725
+ const _component_el_tooltip = resolveComponent("el-tooltip");
2726
+ const _component_el_collapse_item = resolveComponent("el-collapse-item");
2727
+ const _component_el_collapse = resolveComponent("el-collapse");
2728
+ const _component_el_scrollbar = resolveComponent("el-scrollbar");
2729
+ return openBlock(), createBlock(_component_el_scrollbar, null, {
2743
2730
  default: withCtx(() => [
2744
- createVNode(_component_el_input, {
2745
- "prefix-icon": "el-icon-search",
2746
- placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
2747
- class: "search-input",
2748
- size: "small",
2749
- clearable: "",
2750
- modelValue: _ctx.searchText,
2751
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.searchText = $event)
2752
- }, null, 8, ["modelValue"]),
2753
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (group, index) => {
2754
- return openBlock(), createElementBlock(Fragment, null, [
2755
- group.items && group.items.length ? (openBlock(), createBlock(_component_el_collapse_item, {
2756
- key: index,
2757
- name: index
2758
- }, {
2759
- title: withCtx(() => [
2760
- _hoisted_1$3,
2761
- createTextVNode(toDisplayString(group.title), 1)
2762
- ]),
2763
- default: withCtx(() => [
2764
- (openBlock(true), createElementBlock(Fragment, null, renderList(group.items, (item) => {
2765
- return openBlock(), createElementBlock("div", {
2766
- class: "component-item",
2767
- draggable: "true",
2768
- key: item.type,
2769
- onClick: ($event) => _ctx.appendComponent(item),
2770
- onDragstart: ($event) => _ctx.dragstartHandler(item, $event),
2771
- onDragend: _cache[1] || (_cache[1] = (...args) => _ctx.dragendHandler && _ctx.dragendHandler(...args)),
2772
- onDrag: _cache[2] || (_cache[2] = (...args) => _ctx.dragHandler && _ctx.dragHandler(...args))
2773
- }, [
2774
- createVNode(_component_m_icon, {
2775
- icon: item.icon
2776
- }, null, 8, ["icon"]),
2777
- createVNode(_component_el_tooltip, {
2778
- effect: "dark",
2779
- placement: "bottom",
2780
- content: item.text
2781
- }, {
2782
- default: withCtx(() => [
2783
- createElementVNode("span", null, toDisplayString(item.text), 1)
2784
- ]),
2785
- _: 2
2786
- }, 1032, ["content"])
2787
- ], 40, _hoisted_2$1);
2788
- }), 128))
2789
- ]),
2790
- _: 2
2791
- }, 1032, ["name"])) : createCommentVNode("", true)
2792
- ], 64);
2793
- }), 256))
2731
+ renderSlot(_ctx.$slots, "component-list-panel-header"),
2732
+ createVNode(_component_el_collapse, {
2733
+ class: "ui-component-panel",
2734
+ "model-value": unref(collapseValue)
2735
+ }, {
2736
+ default: withCtx(() => [
2737
+ createVNode(_component_el_input, {
2738
+ "prefix-icon": "el-icon-search",
2739
+ placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
2740
+ class: "search-input",
2741
+ size: "small",
2742
+ clearable: "",
2743
+ modelValue: searchText.value,
2744
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event)
2745
+ }, null, 8, ["modelValue"]),
2746
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (group, index) => {
2747
+ return openBlock(), createElementBlock(Fragment, null, [
2748
+ group.items && group.items.length ? (openBlock(), createBlock(_component_el_collapse_item, {
2749
+ key: index,
2750
+ name: index
2751
+ }, {
2752
+ title: withCtx(() => [
2753
+ _hoisted_1$4,
2754
+ createTextVNode(toDisplayString(group.title), 1)
2755
+ ]),
2756
+ default: withCtx(() => [
2757
+ (openBlock(true), createElementBlock(Fragment, null, renderList(group.items, (item) => {
2758
+ return openBlock(), createElementBlock("div", {
2759
+ class: "component-item",
2760
+ draggable: "true",
2761
+ key: item.type,
2762
+ onClick: ($event) => appendComponent(item),
2763
+ onDragstart: ($event) => dragstartHandler(item, $event),
2764
+ onDragend: dragendHandler,
2765
+ onDrag: dragHandler
2766
+ }, [
2767
+ renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
2768
+ createVNode(_sfc_main$h, {
2769
+ icon: item.icon
2770
+ }, null, 8, ["icon"]),
2771
+ createVNode(_component_el_tooltip, {
2772
+ effect: "dark",
2773
+ placement: "bottom",
2774
+ content: item.text
2775
+ }, {
2776
+ default: withCtx(() => [
2777
+ createElementVNode("span", null, toDisplayString(item.text), 1)
2778
+ ]),
2779
+ _: 2
2780
+ }, 1032, ["content"])
2781
+ ])
2782
+ ], 40, _hoisted_2$1);
2783
+ }), 128))
2784
+ ]),
2785
+ _: 2
2786
+ }, 1032, ["name"])) : createCommentVNode("", true)
2787
+ ], 64);
2788
+ }), 256))
2789
+ ]),
2790
+ _: 3
2791
+ }, 8, ["model-value"])
2794
2792
  ]),
2795
- _: 1
2796
- }, 8, ["model-value"])
2797
- ]),
2798
- _: 3
2799
- });
2800
- }
2801
- const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$5]]);
2793
+ _: 3
2794
+ });
2795
+ };
2796
+ }
2797
+ });
2802
2798
 
2803
2799
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
2804
2800
  __name: "ContentMenu",
@@ -3180,7 +3176,7 @@ const _sfc_main$a = defineComponent({
3180
3176
  }
3181
3177
  });
3182
3178
 
3183
- const _hoisted_1$2 = ["id", "onMouseenter"];
3179
+ const _hoisted_1$3 = ["id", "onMouseenter"];
3184
3180
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
3185
3181
  const _component_el_input = resolveComponent("el-input");
3186
3182
  const _component_el_tree = resolveComponent("el-tree");
@@ -3234,7 +3230,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
3234
3230
  }, () => [
3235
3231
  createElementVNode("span", null, toDisplayString(`${data.name} (${data.id})`), 1)
3236
3232
  ])
3237
- ], 42, _hoisted_1$2)
3233
+ ], 42, _hoisted_1$3)
3238
3234
  ]),
3239
3235
  _: 3
3240
3236
  }, 8, ["default-expanded-keys", "load", "data", "filter-node-method", "allow-drop", "onNodeClick", "onNodeContextmenu", "onNodeDragEnd", "onNodeCollapse", "onNodeExpand"])) : createCommentVNode("", true),
@@ -3266,7 +3262,7 @@ const _sfc_main$9 = defineComponent({
3266
3262
  type: "component",
3267
3263
  icon: Coin,
3268
3264
  text: "\u7EC4\u4EF6",
3269
- component: ComponentListPanel,
3265
+ component: _sfc_main$d,
3270
3266
  slots: {}
3271
3267
  };
3272
3268
  case "layer":
@@ -3285,7 +3281,7 @@ const _sfc_main$9 = defineComponent({
3285
3281
  }
3286
3282
  });
3287
3283
 
3288
- const _hoisted_1$1 = {
3284
+ const _hoisted_1$2 = {
3289
3285
  key: 1,
3290
3286
  class: "magic-editor-tab-panel-title"
3291
3287
  };
@@ -3304,7 +3300,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
3304
3300
  key: 0,
3305
3301
  icon: _ctx.config.icon
3306
3302
  }, null, 8, ["icon"])) : createCommentVNode("", true),
3307
- _ctx.config.text ? (openBlock(), createElementBlock("div", _hoisted_1$1, toDisplayString(_ctx.config.text), 1)) : createCommentVNode("", true)
3303
+ _ctx.config.text ? (openBlock(), createElementBlock("div", _hoisted_1$2, toDisplayString(_ctx.config.text), 1)) : createCommentVNode("", true)
3308
3304
  ]))
3309
3305
  ]),
3310
3306
  default: withCtx(() => [
@@ -3315,6 +3311,18 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
3315
3311
  _ctx.data === "component-list" ? renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : _ctx.config.slots?.componentListPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.componentListPanelHeader), { key: 1 })) : createCommentVNode("", true)
3316
3312
  ])
3317
3313
  } : void 0,
3314
+ _ctx.data === "component-list" || _ctx.config.slots?.componentListItem ? {
3315
+ name: "component-list-item",
3316
+ fn: withCtx(({ component }) => [
3317
+ _ctx.data === "component-list" ? renderSlot(_ctx.$slots, "component-list-item", {
3318
+ key: 0,
3319
+ component
3320
+ }) : _ctx.config.slots?.componentListItem ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.componentListItem), {
3321
+ key: 1,
3322
+ component
3323
+ }, null, 8, ["component"])) : createCommentVNode("", true)
3324
+ ])
3325
+ } : void 0,
3318
3326
  _ctx.data === "layer" || _ctx.config.slots?.layerPanelHeader ? {
3319
3327
  name: "layer-panel-header",
3320
3328
  fn: withCtx(() => [
@@ -3385,6 +3393,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
3385
3393
  fn: withCtx(() => [
3386
3394
  renderSlot(_ctx.$slots, "component-list-panel-header")
3387
3395
  ])
3396
+ } : void 0,
3397
+ item === "component-list" ? {
3398
+ name: "component-list-item",
3399
+ fn: withCtx(({ component }) => [
3400
+ renderSlot(_ctx.$slots, "component-list-item", { component })
3401
+ ])
3388
3402
  } : void 0
3389
3403
  ]), 1032, ["data"]);
3390
3404
  }), 128))
@@ -3394,16 +3408,22 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
3394
3408
  }
3395
3409
  const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$1]]);
3396
3410
 
3411
+ const _hoisted_1$1 = {
3412
+ key: 1,
3413
+ style: { "width": "21px" }
3414
+ };
3397
3415
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3398
3416
  __name: "PageBarScrollContainer",
3399
3417
  setup(__props) {
3400
3418
  const services = inject("services");
3401
3419
  const editorService = services?.editorService;
3420
+ const uiService = services?.uiService;
3402
3421
  const pageBar = ref();
3403
3422
  const itemsContainer = ref();
3404
3423
  const pageBarWidth = ref(0);
3405
3424
  const canScroll = ref(false);
3406
- const itemsContainerWidth = computed(() => pageBarWidth.value - 105);
3425
+ const showAddPageButton = computed(() => uiService?.get("showAddPageButton"));
3426
+ const itemsContainerWidth = computed(() => pageBarWidth.value - 35 * 2 - (showAddPageButton.value ? 35 : 21));
3407
3427
  let translateLeft = 0;
3408
3428
  const resizeObserver = new ResizeObserver((entries) => {
3409
3429
  for (const { contentRect } of entries) {
@@ -3414,7 +3434,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3414
3434
  });
3415
3435
  const setCanScroll = () => {
3416
3436
  if (itemsContainer.value) {
3417
- canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
3437
+ canScroll.value = itemsContainer.value.scrollWidth > itemsContainerWidth.value;
3418
3438
  }
3419
3439
  };
3420
3440
  const scroll = (type) => {
@@ -3471,7 +3491,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3471
3491
  ref_key: "pageBar",
3472
3492
  ref: pageBar
3473
3493
  }, [
3474
- createElementVNode("div", {
3494
+ unref(showAddPageButton) ? (openBlock(), createElementBlock("div", {
3495
+ key: 0,
3475
3496
  id: "m-editor-page-bar-add-icon",
3476
3497
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3477
3498
  onClick: addPage
@@ -3482,9 +3503,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3482
3503
  ]),
3483
3504
  _: 1
3484
3505
  })
3485
- ]),
3506
+ ])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
3486
3507
  canScroll.value ? (openBlock(), createElementBlock("div", {
3487
- key: 0,
3508
+ key: 2,
3488
3509
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3489
3510
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
3490
3511
  }, [
@@ -3496,7 +3517,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3496
3517
  })
3497
3518
  ])) : createCommentVNode("", true),
3498
3519
  unref(root) ? (openBlock(), createElementBlock("div", {
3499
- key: 1,
3520
+ key: 3,
3500
3521
  class: "m-editor-page-bar-items",
3501
3522
  ref_key: "itemsContainer",
3502
3523
  ref: itemsContainer,
@@ -3505,7 +3526,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3505
3526
  renderSlot(_ctx.$slots, "default")
3506
3527
  ], 4)) : createCommentVNode("", true),
3507
3528
  canScroll.value ? (openBlock(), createElementBlock("div", {
3508
- key: 2,
3529
+ key: 4,
3509
3530
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
3510
3531
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
3511
3532
  }, [
@@ -4161,8 +4182,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4161
4182
  config.style = {
4162
4183
  ...style,
4163
4184
  position,
4164
- top,
4165
- left
4185
+ top: top / zoom.value,
4186
+ left: left / zoom.value
4166
4187
  };
4167
4188
  config.inputEvent = e;
4168
4189
  services?.editorService.add(config, parent);
@@ -4541,6 +4562,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4541
4562
  "component-list-panel-header": withCtx(() => [
4542
4563
  renderSlot(_ctx.$slots, "component-list-panel-header")
4543
4564
  ]),
4565
+ "component-list-item": withCtx(({ component }) => [
4566
+ renderSlot(_ctx.$slots, "component-list-item", { component })
4567
+ ]),
4544
4568
  _: 3
4545
4569
  }, 8, ["data"])
4546
4570
  ])
@@ -4600,5 +4624,5 @@ const index = {
4600
4624
  }
4601
4625
  };
4602
4626
 
4603
- export { COPY_STORAGE_KEY, ColumnLayout, ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$h as Icon, Keys, LayerOffset, LayerPanel, Layout, _sfc_main$e as PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$g as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, useStage, warn };
4627
+ export { COPY_STORAGE_KEY, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$h as Icon, Keys, LayerOffset, LayerPanel, Layout, _sfc_main$e as PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$g as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, useStage, warn };
4604
4628
  //# sourceMappingURL=tmagic-editor.mjs.map