@tmagic/editor 1.1.0 → 1.1.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.
- package/dist/style.css +7 -4
- package/dist/tmagic-editor.mjs +213 -181
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +213 -181
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +7 -7
- package/src/Editor.vue +13 -3
- package/src/components/Icon.vue +6 -4
- package/src/index.ts +0 -2
- package/src/layouts/sidebar/ComponentListPanel.vue +78 -90
- package/src/layouts/sidebar/Sidebar.vue +4 -0
- package/src/layouts/sidebar/TabPane.vue +12 -0
- package/src/layouts/workspace/PageBar.vue +1 -1
- package/src/layouts/workspace/PageBarScrollContainer.vue +13 -3
- package/src/layouts/workspace/Stage.vue +2 -2
- package/src/services/editor.ts +10 -4
- package/src/services/ui.ts +1 -0
- package/src/theme/component-list-panel.scss +0 -5
- package/src/theme/content-menu.scss +4 -0
- package/src/theme/icon.scss +6 -0
- package/src/theme/index.scss +1 -0
- package/src/type.ts +2 -0
- package/types/Editor.vue.d.ts +1 -1
- package/types/index.d.ts +0 -1
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +50 -12
- package/types/services/ui.d.ts +1 -0
- package/types/type.d.ts +2 -0
- package/src/utils/polyfills.ts +0 -8
- package/types/utils/polyfills.d.ts +0 -0
|
@@ -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$
|
|
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$
|
|
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$
|
|
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$
|
|
135
|
+
const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$9]]);
|
|
143
136
|
|
|
144
|
-
const _hoisted_1$
|
|
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$
|
|
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$
|
|
374
|
+
const _hoisted_1$b = {
|
|
382
375
|
ref: "codeEditor",
|
|
383
376
|
class: "magic-code-editor"
|
|
384
377
|
};
|
|
385
|
-
function _sfc_render$
|
|
386
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
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$
|
|
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) => {
|
|
@@ -1296,7 +1289,7 @@
|
|
|
1296
1289
|
await this.select(root.items[0]);
|
|
1297
1290
|
stage?.select(root.items[0].id);
|
|
1298
1291
|
} else {
|
|
1299
|
-
this.set("
|
|
1292
|
+
this.set("nodes", [root]);
|
|
1300
1293
|
this.set("parent", null);
|
|
1301
1294
|
this.set("page", null);
|
|
1302
1295
|
this.set("stage", null);
|
|
@@ -1442,12 +1435,15 @@
|
|
|
1442
1435
|
const node = this.get("node");
|
|
1443
1436
|
const brothers = parent?.items || [];
|
|
1444
1437
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
1438
|
+
const layout = await this.getLayout(parent, node);
|
|
1439
|
+
const isRelative = layout === Layout.RELATIVE;
|
|
1440
|
+
brothers.splice(index, 1);
|
|
1445
1441
|
if (offset === LayerOffset.TOP) {
|
|
1446
|
-
brothers.splice(brothers.length - 1, 0,
|
|
1442
|
+
brothers.splice(isRelative ? 0 : brothers.length - 1, 0, node);
|
|
1447
1443
|
} else if (offset === LayerOffset.BOTTOM) {
|
|
1448
|
-
brothers.splice(
|
|
1444
|
+
brothers.splice(isRelative ? brothers.length - 1 : 0, 0, node);
|
|
1449
1445
|
} else {
|
|
1450
|
-
brothers.splice(index +
|
|
1446
|
+
brothers.splice(index + (isRelative ? -offset : offset), 0, node);
|
|
1451
1447
|
}
|
|
1452
1448
|
const grandparent = this.getParentById(parent.id);
|
|
1453
1449
|
this.get("stage")?.update({
|
|
@@ -1901,7 +1897,8 @@
|
|
|
1901
1897
|
columnWidth: defaultColumnWidth,
|
|
1902
1898
|
showGuides: true,
|
|
1903
1899
|
showRule: true,
|
|
1904
|
-
propsPanelSize: "small"
|
|
1900
|
+
propsPanelSize: "small",
|
|
1901
|
+
showAddPageButton: true
|
|
1905
1902
|
});
|
|
1906
1903
|
class Ui extends BaseService {
|
|
1907
1904
|
constructor() {
|
|
@@ -2081,13 +2078,13 @@
|
|
|
2081
2078
|
}
|
|
2082
2079
|
});
|
|
2083
2080
|
|
|
2084
|
-
const _hoisted_1$
|
|
2081
|
+
const _hoisted_1$a = { class: "m-editor-empty-panel" };
|
|
2085
2082
|
const _hoisted_2$4 = { class: "m-editor-empty-content" };
|
|
2086
2083
|
const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2087
|
-
function _sfc_render$
|
|
2084
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2088
2085
|
const _component_plus = vue.resolveComponent("plus");
|
|
2089
2086
|
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
2090
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2087
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
2091
2088
|
vue.createElementVNode("div", _hoisted_2$4, [
|
|
2092
2089
|
vue.createElementVNode("div", {
|
|
2093
2090
|
class: "m-editor-empty-button",
|
|
@@ -2106,7 +2103,7 @@
|
|
|
2106
2103
|
])
|
|
2107
2104
|
]);
|
|
2108
2105
|
}
|
|
2109
|
-
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$
|
|
2106
|
+
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$7]]);
|
|
2110
2107
|
|
|
2111
2108
|
const _sfc_main$j = vue.defineComponent({
|
|
2112
2109
|
name: "m-editor-resize",
|
|
@@ -2151,16 +2148,16 @@
|
|
|
2151
2148
|
}
|
|
2152
2149
|
});
|
|
2153
2150
|
|
|
2154
|
-
const _hoisted_1$
|
|
2151
|
+
const _hoisted_1$9 = {
|
|
2155
2152
|
ref: "target",
|
|
2156
2153
|
class: "m-editor-resizer"
|
|
2157
2154
|
};
|
|
2158
|
-
function _sfc_render$
|
|
2159
|
-
return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$
|
|
2155
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2156
|
+
return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$9, [
|
|
2160
2157
|
vue.renderSlot(_ctx.$slots, "default")
|
|
2161
2158
|
], 512);
|
|
2162
2159
|
}
|
|
2163
|
-
const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$
|
|
2160
|
+
const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$6]]);
|
|
2164
2161
|
|
|
2165
2162
|
const _sfc_main$i = vue.defineComponent({
|
|
2166
2163
|
components: {
|
|
@@ -2192,17 +2189,17 @@
|
|
|
2192
2189
|
}
|
|
2193
2190
|
});
|
|
2194
2191
|
|
|
2195
|
-
const _hoisted_1$
|
|
2192
|
+
const _hoisted_1$8 = { class: "m-editor" };
|
|
2196
2193
|
const _hoisted_2$3 = {
|
|
2197
2194
|
key: 1,
|
|
2198
2195
|
class: "m-editor-content"
|
|
2199
2196
|
};
|
|
2200
|
-
function _sfc_render$
|
|
2197
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2201
2198
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2202
2199
|
const _component_resizer = vue.resolveComponent("resizer");
|
|
2203
2200
|
const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
|
|
2204
2201
|
const _component_add_page_box = vue.resolveComponent("add-page-box");
|
|
2205
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2202
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
|
|
2206
2203
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2207
2204
|
_ctx.showSrc ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2208
2205
|
key: 0,
|
|
@@ -2243,9 +2240,9 @@
|
|
|
2243
2240
|
]))
|
|
2244
2241
|
]);
|
|
2245
2242
|
}
|
|
2246
|
-
const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$
|
|
2243
|
+
const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$5]]);
|
|
2247
2244
|
|
|
2248
|
-
const _hoisted_1$
|
|
2245
|
+
const _hoisted_1$7 = ["src"];
|
|
2249
2246
|
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
2250
2247
|
__name: "Icon",
|
|
2251
2248
|
props: {
|
|
@@ -2254,20 +2251,29 @@
|
|
|
2254
2251
|
setup(__props) {
|
|
2255
2252
|
return (_ctx, _cache) => {
|
|
2256
2253
|
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
2257
|
-
return !__props.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2254
|
+
return !__props.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2255
|
+
key: 0,
|
|
2256
|
+
class: "magic-editor-icon"
|
|
2257
|
+
}, {
|
|
2258
2258
|
default: vue.withCtx(() => [
|
|
2259
2259
|
vue.createVNode(vue.unref(iconsVue.Edit))
|
|
2260
2260
|
]),
|
|
2261
2261
|
_: 1
|
|
2262
|
-
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2262
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2263
|
+
key: 1,
|
|
2264
|
+
class: "magic-editor-icon"
|
|
2265
|
+
}, {
|
|
2263
2266
|
default: vue.withCtx(() => [
|
|
2264
|
-
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$
|
|
2267
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$7)
|
|
2265
2268
|
]),
|
|
2266
2269
|
_: 1
|
|
2267
2270
|
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
2268
2271
|
key: 2,
|
|
2269
|
-
class: vue.normalizeClass(__props.icon)
|
|
2270
|
-
}, null, 2)) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2272
|
+
class: vue.normalizeClass(["magic-editor-icon", __props.icon])
|
|
2273
|
+
}, null, 2)) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2274
|
+
key: 3,
|
|
2275
|
+
class: "magic-editor-icon"
|
|
2276
|
+
}, {
|
|
2271
2277
|
default: vue.withCtx(() => [
|
|
2272
2278
|
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
|
|
2273
2279
|
]),
|
|
@@ -2277,7 +2283,7 @@
|
|
|
2277
2283
|
}
|
|
2278
2284
|
});
|
|
2279
2285
|
|
|
2280
|
-
const _hoisted_1$
|
|
2286
|
+
const _hoisted_1$6 = {
|
|
2281
2287
|
key: 1,
|
|
2282
2288
|
class: "menu-item-text"
|
|
2283
2289
|
};
|
|
@@ -2365,7 +2371,7 @@
|
|
|
2365
2371
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(_component_el_divider, {
|
|
2366
2372
|
key: 0,
|
|
2367
2373
|
direction: __props.data.direction || "vertical"
|
|
2368
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2374
|
+
}, 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
2375
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
|
|
2370
2376
|
key: 0,
|
|
2371
2377
|
effect: "dark",
|
|
@@ -2608,7 +2614,7 @@
|
|
|
2608
2614
|
}
|
|
2609
2615
|
});
|
|
2610
2616
|
|
|
2611
|
-
const _hoisted_1$
|
|
2617
|
+
const _hoisted_1$5 = { class: "`m-editor-props-panel" };
|
|
2612
2618
|
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
2613
2619
|
__name: "PropsPanel",
|
|
2614
2620
|
emits: ["mounted"],
|
|
@@ -2658,7 +2664,7 @@
|
|
|
2658
2664
|
expose({ submit });
|
|
2659
2665
|
return (_ctx, _cache) => {
|
|
2660
2666
|
const _component_m_form = vue.resolveComponent("m-form");
|
|
2661
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2667
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
|
|
2662
2668
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
2663
2669
|
vue.createVNode(_component_m_form, {
|
|
2664
2670
|
ref_key: "configForm",
|
|
@@ -2675,10 +2681,11 @@
|
|
|
2675
2681
|
}
|
|
2676
2682
|
});
|
|
2677
2683
|
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2684
|
+
const _hoisted_1$4 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
|
|
2685
|
+
const _hoisted_2$1 = ["onClick", "onDragstart"];
|
|
2686
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
2687
|
+
__name: "ComponentListPanel",
|
|
2688
|
+
setup(__props) {
|
|
2682
2689
|
const searchText = vue.ref("");
|
|
2683
2690
|
const services = vue.inject("services");
|
|
2684
2691
|
const stageOptions = vue.inject("stageOptions");
|
|
@@ -2691,132 +2698,124 @@
|
|
|
2691
2698
|
let timeout;
|
|
2692
2699
|
let clientX;
|
|
2693
2700
|
let clientY;
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2701
|
+
const appendComponent = ({ text, type, data = {} }) => {
|
|
2702
|
+
services?.editorService.add({
|
|
2703
|
+
name: text,
|
|
2704
|
+
type,
|
|
2705
|
+
...data
|
|
2706
|
+
});
|
|
2707
|
+
};
|
|
2708
|
+
const dragstartHandler = ({ text, type, data = {} }, e) => {
|
|
2709
|
+
if (e.dataTransfer) {
|
|
2710
|
+
e.dataTransfer.effectAllowed = "move";
|
|
2711
|
+
e.dataTransfer.setData("data", serialize__default.default({
|
|
2700
2712
|
name: text,
|
|
2701
2713
|
type,
|
|
2702
2714
|
...data
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
}
|
|
2715
|
-
|
|
2715
|
+
}).replace(/"(\w+)":\s/g, "$1: "));
|
|
2716
|
+
}
|
|
2717
|
+
};
|
|
2718
|
+
const dragendHandler = () => {
|
|
2719
|
+
if (timeout) {
|
|
2720
|
+
globalThis.clearTimeout(timeout);
|
|
2721
|
+
timeout = void 0;
|
|
2722
|
+
}
|
|
2723
|
+
const doc = stage.value?.renderer.contentWindow?.document;
|
|
2724
|
+
if (doc && stageOptions) {
|
|
2725
|
+
utils.removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
|
|
2726
|
+
}
|
|
2727
|
+
clientX = 0;
|
|
2728
|
+
clientY = 0;
|
|
2729
|
+
};
|
|
2730
|
+
const dragHandler = (e) => {
|
|
2731
|
+
if (e.clientX !== clientX || e.clientY !== clientY) {
|
|
2732
|
+
clientX = e.clientX;
|
|
2733
|
+
clientY = e.clientY;
|
|
2716
2734
|
if (timeout) {
|
|
2717
2735
|
globalThis.clearTimeout(timeout);
|
|
2718
2736
|
timeout = void 0;
|
|
2719
2737
|
}
|
|
2720
|
-
|
|
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);
|
|
2738
|
+
return;
|
|
2740
2739
|
}
|
|
2740
|
+
if (timeout || !stage.value)
|
|
2741
|
+
return;
|
|
2742
|
+
timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
|
|
2741
2743
|
};
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
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
|
-
}, {
|
|
2744
|
+
return (_ctx, _cache) => {
|
|
2745
|
+
const _component_el_input = vue.resolveComponent("el-input");
|
|
2746
|
+
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
2747
|
+
const _component_el_collapse_item = vue.resolveComponent("el-collapse-item");
|
|
2748
|
+
const _component_el_collapse = vue.resolveComponent("el-collapse");
|
|
2749
|
+
const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
|
|
2750
|
+
return vue.openBlock(), vue.createBlock(_component_el_scrollbar, null, {
|
|
2761
2751
|
default: vue.withCtx(() => [
|
|
2762
|
-
vue.
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
},
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2752
|
+
vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
2753
|
+
vue.createVNode(_component_el_collapse, {
|
|
2754
|
+
class: "ui-component-panel",
|
|
2755
|
+
"model-value": vue.unref(collapseValue)
|
|
2756
|
+
}, {
|
|
2757
|
+
default: vue.withCtx(() => [
|
|
2758
|
+
vue.createVNode(_component_el_input, {
|
|
2759
|
+
"prefix-icon": "el-icon-search",
|
|
2760
|
+
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
2761
|
+
class: "search-input",
|
|
2762
|
+
size: "small",
|
|
2763
|
+
clearable: "",
|
|
2764
|
+
modelValue: searchText.value,
|
|
2765
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event)
|
|
2766
|
+
}, null, 8, ["modelValue"]),
|
|
2767
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
|
|
2768
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
2769
|
+
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(_component_el_collapse_item, {
|
|
2770
|
+
key: index,
|
|
2771
|
+
name: index
|
|
2772
|
+
}, {
|
|
2773
|
+
title: vue.withCtx(() => [
|
|
2774
|
+
_hoisted_1$4,
|
|
2775
|
+
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
2776
|
+
]),
|
|
2777
|
+
default: vue.withCtx(() => [
|
|
2778
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.items, (item) => {
|
|
2779
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2780
|
+
class: "component-item",
|
|
2781
|
+
draggable: "true",
|
|
2782
|
+
key: item.type,
|
|
2783
|
+
onClick: ($event) => appendComponent(item),
|
|
2784
|
+
onDragstart: ($event) => dragstartHandler(item, $event),
|
|
2785
|
+
onDragend: dragendHandler,
|
|
2786
|
+
onDrag: dragHandler
|
|
2787
|
+
}, [
|
|
2788
|
+
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
2789
|
+
vue.createVNode(_sfc_main$h, {
|
|
2790
|
+
icon: item.icon
|
|
2791
|
+
}, null, 8, ["icon"]),
|
|
2792
|
+
vue.createVNode(_component_el_tooltip, {
|
|
2793
|
+
effect: "dark",
|
|
2794
|
+
placement: "bottom",
|
|
2795
|
+
content: item.text
|
|
2796
|
+
}, {
|
|
2797
|
+
default: vue.withCtx(() => [
|
|
2798
|
+
vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1)
|
|
2799
|
+
]),
|
|
2800
|
+
_: 2
|
|
2801
|
+
}, 1032, ["content"])
|
|
2802
|
+
])
|
|
2803
|
+
], 40, _hoisted_2$1);
|
|
2804
|
+
}), 128))
|
|
2805
|
+
]),
|
|
2806
|
+
_: 2
|
|
2807
|
+
}, 1032, ["name"])) : vue.createCommentVNode("", true)
|
|
2808
|
+
], 64);
|
|
2809
|
+
}), 256))
|
|
2810
|
+
]),
|
|
2811
|
+
_: 3
|
|
2812
|
+
}, 8, ["model-value"])
|
|
2812
2813
|
]),
|
|
2813
|
-
_:
|
|
2814
|
-
}
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
}
|
|
2819
|
-
const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$5]]);
|
|
2814
|
+
_: 3
|
|
2815
|
+
});
|
|
2816
|
+
};
|
|
2817
|
+
}
|
|
2818
|
+
});
|
|
2820
2819
|
|
|
2821
2820
|
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
2822
2821
|
__name: "ContentMenu",
|
|
@@ -3198,7 +3197,7 @@
|
|
|
3198
3197
|
}
|
|
3199
3198
|
});
|
|
3200
3199
|
|
|
3201
|
-
const _hoisted_1$
|
|
3200
|
+
const _hoisted_1$3 = ["id", "onMouseenter"];
|
|
3202
3201
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3203
3202
|
const _component_el_input = vue.resolveComponent("el-input");
|
|
3204
3203
|
const _component_el_tree = vue.resolveComponent("el-tree");
|
|
@@ -3252,7 +3251,7 @@
|
|
|
3252
3251
|
}, () => [
|
|
3253
3252
|
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
3254
3253
|
])
|
|
3255
|
-
], 42, _hoisted_1$
|
|
3254
|
+
], 42, _hoisted_1$3)
|
|
3256
3255
|
]),
|
|
3257
3256
|
_: 3
|
|
3258
3257
|
}, 8, ["default-expanded-keys", "load", "data", "filter-node-method", "allow-drop", "onNodeClick", "onNodeContextmenu", "onNodeDragEnd", "onNodeCollapse", "onNodeExpand"])) : vue.createCommentVNode("", true),
|
|
@@ -3284,7 +3283,7 @@
|
|
|
3284
3283
|
type: "component",
|
|
3285
3284
|
icon: iconsVue.Coin,
|
|
3286
3285
|
text: "\u7EC4\u4EF6",
|
|
3287
|
-
component:
|
|
3286
|
+
component: _sfc_main$d,
|
|
3288
3287
|
slots: {}
|
|
3289
3288
|
};
|
|
3290
3289
|
case "layer":
|
|
@@ -3303,7 +3302,7 @@
|
|
|
3303
3302
|
}
|
|
3304
3303
|
});
|
|
3305
3304
|
|
|
3306
|
-
const _hoisted_1$
|
|
3305
|
+
const _hoisted_1$2 = {
|
|
3307
3306
|
key: 1,
|
|
3308
3307
|
class: "magic-editor-tab-panel-title"
|
|
3309
3308
|
};
|
|
@@ -3322,7 +3321,7 @@
|
|
|
3322
3321
|
key: 0,
|
|
3323
3322
|
icon: _ctx.config.icon
|
|
3324
3323
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
3325
|
-
_ctx.config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3324
|
+
_ctx.config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, vue.toDisplayString(_ctx.config.text), 1)) : vue.createCommentVNode("", true)
|
|
3326
3325
|
]))
|
|
3327
3326
|
]),
|
|
3328
3327
|
default: vue.withCtx(() => [
|
|
@@ -3333,6 +3332,18 @@
|
|
|
3333
3332
|
_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
3333
|
])
|
|
3335
3334
|
} : void 0,
|
|
3335
|
+
_ctx.data === "component-list" || _ctx.config.slots?.componentListItem ? {
|
|
3336
|
+
name: "component-list-item",
|
|
3337
|
+
fn: vue.withCtx(({ component }) => [
|
|
3338
|
+
_ctx.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
|
|
3339
|
+
key: 0,
|
|
3340
|
+
component
|
|
3341
|
+
}) : _ctx.config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.componentListItem), {
|
|
3342
|
+
key: 1,
|
|
3343
|
+
component
|
|
3344
|
+
}, null, 8, ["component"])) : vue.createCommentVNode("", true)
|
|
3345
|
+
])
|
|
3346
|
+
} : void 0,
|
|
3336
3347
|
_ctx.data === "layer" || _ctx.config.slots?.layerPanelHeader ? {
|
|
3337
3348
|
name: "layer-panel-header",
|
|
3338
3349
|
fn: vue.withCtx(() => [
|
|
@@ -3403,6 +3414,12 @@
|
|
|
3403
3414
|
fn: vue.withCtx(() => [
|
|
3404
3415
|
vue.renderSlot(_ctx.$slots, "component-list-panel-header")
|
|
3405
3416
|
])
|
|
3417
|
+
} : void 0,
|
|
3418
|
+
item === "component-list" ? {
|
|
3419
|
+
name: "component-list-item",
|
|
3420
|
+
fn: vue.withCtx(({ component }) => [
|
|
3421
|
+
vue.renderSlot(_ctx.$slots, "component-list-item", { component })
|
|
3422
|
+
])
|
|
3406
3423
|
} : void 0
|
|
3407
3424
|
]), 1032, ["data"]);
|
|
3408
3425
|
}), 128))
|
|
@@ -3412,16 +3429,22 @@
|
|
|
3412
3429
|
}
|
|
3413
3430
|
const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$1]]);
|
|
3414
3431
|
|
|
3432
|
+
const _hoisted_1$1 = {
|
|
3433
|
+
key: 1,
|
|
3434
|
+
style: { "width": "21px" }
|
|
3435
|
+
};
|
|
3415
3436
|
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
3416
3437
|
__name: "PageBarScrollContainer",
|
|
3417
3438
|
setup(__props) {
|
|
3418
3439
|
const services = vue.inject("services");
|
|
3419
3440
|
const editorService = services?.editorService;
|
|
3441
|
+
const uiService = services?.uiService;
|
|
3420
3442
|
const pageBar = vue.ref();
|
|
3421
3443
|
const itemsContainer = vue.ref();
|
|
3422
3444
|
const pageBarWidth = vue.ref(0);
|
|
3423
3445
|
const canScroll = vue.ref(false);
|
|
3424
|
-
const
|
|
3446
|
+
const showAddPageButton = vue.computed(() => uiService?.get("showAddPageButton"));
|
|
3447
|
+
const itemsContainerWidth = vue.computed(() => pageBarWidth.value - 35 * 2 - (showAddPageButton.value ? 35 : 21));
|
|
3425
3448
|
let translateLeft = 0;
|
|
3426
3449
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
3427
3450
|
for (const { contentRect } of entries) {
|
|
@@ -3432,7 +3455,7 @@
|
|
|
3432
3455
|
});
|
|
3433
3456
|
const setCanScroll = () => {
|
|
3434
3457
|
if (itemsContainer.value) {
|
|
3435
|
-
canScroll.value = itemsContainer.value.scrollWidth >
|
|
3458
|
+
canScroll.value = itemsContainer.value.scrollWidth > itemsContainerWidth.value;
|
|
3436
3459
|
}
|
|
3437
3460
|
};
|
|
3438
3461
|
const scroll = (type) => {
|
|
@@ -3489,7 +3512,8 @@
|
|
|
3489
3512
|
ref_key: "pageBar",
|
|
3490
3513
|
ref: pageBar
|
|
3491
3514
|
}, [
|
|
3492
|
-
vue.
|
|
3515
|
+
vue.unref(showAddPageButton) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3516
|
+
key: 0,
|
|
3493
3517
|
id: "m-editor-page-bar-add-icon",
|
|
3494
3518
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3495
3519
|
onClick: addPage
|
|
@@ -3500,9 +3524,9 @@
|
|
|
3500
3524
|
]),
|
|
3501
3525
|
_: 1
|
|
3502
3526
|
})
|
|
3503
|
-
]),
|
|
3527
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
3504
3528
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3505
|
-
key:
|
|
3529
|
+
key: 2,
|
|
3506
3530
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3507
3531
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
3508
3532
|
}, [
|
|
@@ -3514,7 +3538,7 @@
|
|
|
3514
3538
|
})
|
|
3515
3539
|
])) : vue.createCommentVNode("", true),
|
|
3516
3540
|
vue.unref(root) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3517
|
-
key:
|
|
3541
|
+
key: 3,
|
|
3518
3542
|
class: "m-editor-page-bar-items",
|
|
3519
3543
|
ref_key: "itemsContainer",
|
|
3520
3544
|
ref: itemsContainer,
|
|
@@ -3523,7 +3547,7 @@
|
|
|
3523
3547
|
vue.renderSlot(_ctx.$slots, "default")
|
|
3524
3548
|
], 4)) : vue.createCommentVNode("", true),
|
|
3525
3549
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3526
|
-
key:
|
|
3550
|
+
key: 4,
|
|
3527
3551
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3528
3552
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
3529
3553
|
}, [
|
|
@@ -4179,8 +4203,8 @@
|
|
|
4179
4203
|
config.style = {
|
|
4180
4204
|
...style,
|
|
4181
4205
|
position,
|
|
4182
|
-
top,
|
|
4183
|
-
left
|
|
4206
|
+
top: top / zoom.value,
|
|
4207
|
+
left: left / zoom.value
|
|
4184
4208
|
};
|
|
4185
4209
|
config.inputEvent = e;
|
|
4186
4210
|
services?.editorService.add(config, parent);
|
|
@@ -4461,9 +4485,14 @@
|
|
|
4461
4485
|
},
|
|
4462
4486
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
4463
4487
|
setup(props, { emit }) {
|
|
4464
|
-
editorService.on("root-change", () => {
|
|
4465
|
-
const node = editorService.get("node")
|
|
4466
|
-
node
|
|
4488
|
+
editorService.on("root-change", (value) => {
|
|
4489
|
+
const node = editorService.get("node");
|
|
4490
|
+
const nodeId = node?.id || props.defaultSelected;
|
|
4491
|
+
if (nodeId && node !== value) {
|
|
4492
|
+
editorService.select(nodeId);
|
|
4493
|
+
} else {
|
|
4494
|
+
editorService.set("nodes", [value]);
|
|
4495
|
+
}
|
|
4467
4496
|
emit("update:modelValue", vue.toRaw(editorService.get("root")));
|
|
4468
4497
|
});
|
|
4469
4498
|
vue.watch(() => props.modelValue, (modelValue) => editorService.set("root", modelValue), {
|
|
@@ -4554,6 +4583,9 @@
|
|
|
4554
4583
|
"component-list-panel-header": vue.withCtx(() => [
|
|
4555
4584
|
vue.renderSlot(_ctx.$slots, "component-list-panel-header")
|
|
4556
4585
|
]),
|
|
4586
|
+
"component-list-item": vue.withCtx(({ component }) => [
|
|
4587
|
+
vue.renderSlot(_ctx.$slots, "component-list-item", { component })
|
|
4588
|
+
]),
|
|
4557
4589
|
_: 3
|
|
4558
4590
|
}, 8, ["data"])
|
|
4559
4591
|
])
|
|
@@ -4615,7 +4647,7 @@
|
|
|
4615
4647
|
|
|
4616
4648
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
4617
4649
|
exports.ColumnLayout = ColumnLayout;
|
|
4618
|
-
exports.ComponentListPanel =
|
|
4650
|
+
exports.ComponentListPanel = _sfc_main$d;
|
|
4619
4651
|
exports.ContentMenu = _sfc_main$c;
|
|
4620
4652
|
exports.Fixed2Other = Fixed2Other;
|
|
4621
4653
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|