@tmagic/editor 1.1.0-beta.6 → 1.1.0-beta.7
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/tmagic-editor.mjs +163 -155
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +162 -154
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +7 -7
- package/src/fields/UISelect.vue +0 -1
- package/src/index.ts +1 -1
- package/src/layouts/workspace/PageBar.vue +43 -161
- package/src/layouts/workspace/PageBarScrollContainer.vue +111 -0
- package/types/fields/UISelect.vue.d.ts +0 -4
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +48 -0
package/dist/tmagic-editor.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, createElementBlock, createVNode, unref, withCtx, withModifiers, createCommentVNode, createTextVNode, toDisplayString, watch, onMounted, onUnmounted, reactive, toRaw, createElementVNode, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, markRaw, renderList, normalizeProps, mergeProps, getCurrentInstance, Teleport, nextTick, toHandlers, createSlots, provide } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
|
-
import { Delete, Close, Plus, Edit, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, ArrowDown, Files, DocumentCopy, Coin, ArrowLeftBold,
|
|
3
|
+
import { Delete, Close, Plus, Edit, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, ArrowDown, Files, DocumentCopy, Coin, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons-vue';
|
|
4
4
|
import { throttle, cloneDeep, mergeWith, isEmpty, uniq } from 'lodash-es';
|
|
5
5
|
import * as monaco from 'monaco-editor';
|
|
6
6
|
import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS } from '@tmagic/stage';
|
|
@@ -19,7 +19,7 @@ if (typeof globalThis === "undefined") {
|
|
|
19
19
|
window.globalThis = window;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const _sfc_main$
|
|
22
|
+
const _sfc_main$n = defineComponent({
|
|
23
23
|
name: "m-fields-vs-code",
|
|
24
24
|
props: ["model", "name", "config", "prop"],
|
|
25
25
|
emits: ["change"],
|
|
@@ -54,9 +54,9 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
54
54
|
onSave: _ctx.save
|
|
55
55
|
}, null, 8, ["style", "init-values", "language", "onSave"]);
|
|
56
56
|
}
|
|
57
|
-
const Code = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
57
|
+
const Code = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$g]]);
|
|
58
58
|
|
|
59
|
-
const _sfc_main$
|
|
59
|
+
const _sfc_main$m = defineComponent({
|
|
60
60
|
name: "m-fields-code-link",
|
|
61
61
|
props: {
|
|
62
62
|
config: {
|
|
@@ -121,13 +121,12 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
121
121
|
onChange: _ctx.changeHandler
|
|
122
122
|
}, null, 8, ["config", "model", "onChange"]);
|
|
123
123
|
}
|
|
124
|
-
const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
124
|
+
const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$f]]);
|
|
125
125
|
|
|
126
126
|
const _hoisted_1$d = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
|
|
127
|
-
const _sfc_main$
|
|
127
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
128
128
|
__name: "UISelect",
|
|
129
129
|
props: {
|
|
130
|
-
labelWidth: null,
|
|
131
130
|
config: null,
|
|
132
131
|
model: null,
|
|
133
132
|
prop: null,
|
|
@@ -251,7 +250,7 @@ const toString = (v, language) => {
|
|
|
251
250
|
}
|
|
252
251
|
return value;
|
|
253
252
|
};
|
|
254
|
-
const _sfc_main$
|
|
253
|
+
const _sfc_main$k = defineComponent({
|
|
255
254
|
name: "magic-code-editor",
|
|
256
255
|
props: {
|
|
257
256
|
initValues: {
|
|
@@ -366,7 +365,7 @@ const _hoisted_1$c = {
|
|
|
366
365
|
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
367
366
|
return openBlock(), createElementBlock("div", _hoisted_1$c, null, 512);
|
|
368
367
|
}
|
|
369
|
-
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
368
|
+
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$e]]);
|
|
370
369
|
|
|
371
370
|
let $TMAGIC_EDITOR = {};
|
|
372
371
|
const setConfig = (option) => {
|
|
@@ -1834,7 +1833,7 @@ const error = (...args) => {
|
|
|
1834
1833
|
}
|
|
1835
1834
|
};
|
|
1836
1835
|
|
|
1837
|
-
const _sfc_main$
|
|
1836
|
+
const _sfc_main$j = defineComponent({
|
|
1838
1837
|
components: { Plus },
|
|
1839
1838
|
setup() {
|
|
1840
1839
|
const services = inject("services");
|
|
@@ -1854,7 +1853,7 @@ const _sfc_main$i = defineComponent({
|
|
|
1854
1853
|
|
|
1855
1854
|
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
1856
1855
|
const _hoisted_2$4 = { class: "m-editor-empty-content" };
|
|
1857
|
-
const _hoisted_3$
|
|
1856
|
+
const _hoisted_3$1 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
1858
1857
|
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1859
1858
|
const _component_plus = resolveComponent("plus");
|
|
1860
1859
|
const _component_el_icon = resolveComponent("el-icon");
|
|
@@ -1872,14 +1871,14 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1872
1871
|
_: 1
|
|
1873
1872
|
})
|
|
1874
1873
|
]),
|
|
1875
|
-
_hoisted_3$
|
|
1874
|
+
_hoisted_3$1
|
|
1876
1875
|
])
|
|
1877
1876
|
])
|
|
1878
1877
|
]);
|
|
1879
1878
|
}
|
|
1880
|
-
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1879
|
+
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$d]]);
|
|
1881
1880
|
|
|
1882
|
-
const _sfc_main$
|
|
1881
|
+
const _sfc_main$i = defineComponent({
|
|
1883
1882
|
name: "m-editor-resize",
|
|
1884
1883
|
props: {
|
|
1885
1884
|
type: {
|
|
@@ -1931,9 +1930,9 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1931
1930
|
renderSlot(_ctx.$slots, "default")
|
|
1932
1931
|
], 512);
|
|
1933
1932
|
}
|
|
1934
|
-
const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1933
|
+
const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$c]]);
|
|
1935
1934
|
|
|
1936
|
-
const _sfc_main$
|
|
1935
|
+
const _sfc_main$h = defineComponent({
|
|
1937
1936
|
components: {
|
|
1938
1937
|
AddPageBox,
|
|
1939
1938
|
Resizer
|
|
@@ -2014,9 +2013,9 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2014
2013
|
]))
|
|
2015
2014
|
]);
|
|
2016
2015
|
}
|
|
2017
|
-
const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2016
|
+
const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$b]]);
|
|
2018
2017
|
|
|
2019
|
-
const _sfc_main$
|
|
2018
|
+
const _sfc_main$g = defineComponent({
|
|
2020
2019
|
name: "m-icon",
|
|
2021
2020
|
components: { Edit },
|
|
2022
2021
|
props: {
|
|
@@ -2053,7 +2052,7 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2053
2052
|
_: 1
|
|
2054
2053
|
}));
|
|
2055
2054
|
}
|
|
2056
|
-
const MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2055
|
+
const MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$a]]);
|
|
2057
2056
|
|
|
2058
2057
|
const _hoisted_1$7 = {
|
|
2059
2058
|
key: 1,
|
|
@@ -2063,8 +2062,8 @@ const _hoisted_2$2 = {
|
|
|
2063
2062
|
class: "menu-item-text",
|
|
2064
2063
|
style: { "margin": "0 5px" }
|
|
2065
2064
|
};
|
|
2066
|
-
const _hoisted_3
|
|
2067
|
-
const _sfc_main$
|
|
2065
|
+
const _hoisted_3 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2066
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
2068
2067
|
__name: "ToolButton",
|
|
2069
2068
|
props: {
|
|
2070
2069
|
data: {
|
|
@@ -2307,7 +2306,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2307
2306
|
})) : createCommentVNode("", true)
|
|
2308
2307
|
]),
|
|
2309
2308
|
default: withCtx(() => [
|
|
2310
|
-
createElementVNode("span", _hoisted_3
|
|
2309
|
+
createElementVNode("span", _hoisted_3, [
|
|
2311
2310
|
createTextVNode(toDisplayString(unref(item).text), 1),
|
|
2312
2311
|
createVNode(_component_el_icon, { class: "el-icon--right" }, {
|
|
2313
2312
|
default: withCtx(() => [
|
|
@@ -2324,9 +2323,9 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2324
2323
|
}
|
|
2325
2324
|
});
|
|
2326
2325
|
|
|
2327
|
-
const _sfc_main$
|
|
2326
|
+
const _sfc_main$e = defineComponent({
|
|
2328
2327
|
name: "nav-menu",
|
|
2329
|
-
components: { ToolButton: _sfc_main$
|
|
2328
|
+
components: { ToolButton: _sfc_main$f },
|
|
2330
2329
|
props: {
|
|
2331
2330
|
data: {
|
|
2332
2331
|
type: Object,
|
|
@@ -2367,9 +2366,9 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2367
2366
|
}), 128))
|
|
2368
2367
|
], 4);
|
|
2369
2368
|
}
|
|
2370
|
-
const NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2369
|
+
const NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$9]]);
|
|
2371
2370
|
|
|
2372
|
-
const _sfc_main$
|
|
2371
|
+
const _sfc_main$d = defineComponent({
|
|
2373
2372
|
name: "m-editor-props-panel",
|
|
2374
2373
|
emits: ["mounted"],
|
|
2375
2374
|
setup(props, { emit }) {
|
|
@@ -2433,9 +2432,9 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2433
2432
|
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"])
|
|
2434
2433
|
]);
|
|
2435
2434
|
}
|
|
2436
|
-
const PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2435
|
+
const PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$8]]);
|
|
2437
2436
|
|
|
2438
|
-
const _sfc_main$
|
|
2437
|
+
const _sfc_main$c = defineComponent({
|
|
2439
2438
|
name: "ui-component-panel",
|
|
2440
2439
|
components: { MIcon },
|
|
2441
2440
|
setup() {
|
|
@@ -2576,9 +2575,9 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2576
2575
|
_: 3
|
|
2577
2576
|
});
|
|
2578
2577
|
}
|
|
2579
|
-
const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2578
|
+
const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$7]]);
|
|
2580
2579
|
|
|
2581
|
-
const _sfc_main$
|
|
2580
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
2582
2581
|
__name: "ContentMenu",
|
|
2583
2582
|
props: {
|
|
2584
2583
|
menuData: { default: () => [] },
|
|
@@ -2667,7 +2666,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2667
2666
|
}, [
|
|
2668
2667
|
createElementVNode("div", null, [
|
|
2669
2668
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuData, (item, index) => {
|
|
2670
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2669
|
+
return openBlock(), createBlock(_sfc_main$f, {
|
|
2671
2670
|
"event-type": "mouseup",
|
|
2672
2671
|
data: item,
|
|
2673
2672
|
key: index,
|
|
@@ -2691,8 +2690,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2691
2690
|
}
|
|
2692
2691
|
});
|
|
2693
2692
|
|
|
2694
|
-
const _sfc_main$
|
|
2695
|
-
components: { ContentMenu: _sfc_main$
|
|
2693
|
+
const _sfc_main$a = defineComponent({
|
|
2694
|
+
components: { ContentMenu: _sfc_main$b },
|
|
2696
2695
|
setup() {
|
|
2697
2696
|
const services = inject("services");
|
|
2698
2697
|
const menu = ref();
|
|
@@ -2783,7 +2782,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2783
2782
|
style: { "overflow": "initial" }
|
|
2784
2783
|
}, null, 8, ["menu-data"]);
|
|
2785
2784
|
}
|
|
2786
|
-
const LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2785
|
+
const LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$6]]);
|
|
2787
2786
|
|
|
2788
2787
|
const throttleTime = 150;
|
|
2789
2788
|
const select = async (data, editorService) => {
|
|
@@ -2883,7 +2882,7 @@ const useFilter = (tree) => ({
|
|
|
2883
2882
|
tree.value?.filter(val);
|
|
2884
2883
|
}
|
|
2885
2884
|
});
|
|
2886
|
-
const _sfc_main$
|
|
2885
|
+
const _sfc_main$9 = defineComponent({
|
|
2887
2886
|
name: "magic-editor-layer-panel",
|
|
2888
2887
|
components: { LayerMenu },
|
|
2889
2888
|
setup() {
|
|
@@ -2994,9 +2993,9 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2994
2993
|
_: 3
|
|
2995
2994
|
});
|
|
2996
2995
|
}
|
|
2997
|
-
const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2996
|
+
const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$5]]);
|
|
2998
2997
|
|
|
2999
|
-
const _sfc_main$
|
|
2998
|
+
const _sfc_main$8 = defineComponent({
|
|
3000
2999
|
components: { MIcon },
|
|
3001
3000
|
props: {
|
|
3002
3001
|
data: {
|
|
@@ -3084,9 +3083,9 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3084
3083
|
_: 3
|
|
3085
3084
|
}, 8, ["name"])) : createCommentVNode("", true);
|
|
3086
3085
|
}
|
|
3087
|
-
const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3086
|
+
const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$4]]);
|
|
3088
3087
|
|
|
3089
|
-
const _sfc_main$
|
|
3088
|
+
const _sfc_main$7 = defineComponent({
|
|
3090
3089
|
components: { TabPane },
|
|
3091
3090
|
name: "m-sidebar",
|
|
3092
3091
|
props: {
|
|
@@ -3141,89 +3140,69 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3141
3140
|
_: 3
|
|
3142
3141
|
}, 8, ["modelValue"])) : createCommentVNode("", true);
|
|
3143
3142
|
}
|
|
3144
|
-
const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3143
|
+
const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3]]);
|
|
3145
3144
|
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3148
|
-
ref: "pageBar"
|
|
3149
|
-
};
|
|
3150
|
-
const _hoisted_2 = ["onClick"];
|
|
3151
|
-
const _hoisted_3 = { class: "m-editor-page-bar-title" };
|
|
3152
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3153
|
-
__name: "PageBar",
|
|
3145
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
3146
|
+
__name: "PageBarScrollContainer",
|
|
3154
3147
|
setup(__props) {
|
|
3155
|
-
const
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
}
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
}
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
}
|
|
3183
|
-
} else if (type === "right") {
|
|
3184
|
-
translateLeft -= 100;
|
|
3185
|
-
if (-translateLeft > maxScrollLeft) {
|
|
3186
|
-
translateLeft = -maxScrollLeft;
|
|
3187
|
-
}
|
|
3188
|
-
} else if (type === "start") {
|
|
3148
|
+
const services = inject("services");
|
|
3149
|
+
const editorService = services?.editorService;
|
|
3150
|
+
const pageBar = ref();
|
|
3151
|
+
const itemsContainer = ref();
|
|
3152
|
+
const pageBarWidth = ref(0);
|
|
3153
|
+
const canScroll = ref(false);
|
|
3154
|
+
const itemsContainerWidth = computed(() => pageBarWidth.value - 105);
|
|
3155
|
+
let translateLeft = 0;
|
|
3156
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
3157
|
+
for (const { contentRect } of entries) {
|
|
3158
|
+
const { width } = contentRect;
|
|
3159
|
+
pageBarWidth.value = width || 0;
|
|
3160
|
+
setCanScroll();
|
|
3161
|
+
}
|
|
3162
|
+
});
|
|
3163
|
+
const setCanScroll = () => {
|
|
3164
|
+
if (itemsContainer.value) {
|
|
3165
|
+
canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3168
|
+
const scroll = (type) => {
|
|
3169
|
+
if (!itemsContainer.value)
|
|
3170
|
+
return;
|
|
3171
|
+
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
3172
|
+
if (type === "left") {
|
|
3173
|
+
translateLeft += 100;
|
|
3174
|
+
if (translateLeft > 0) {
|
|
3189
3175
|
translateLeft = 0;
|
|
3190
|
-
}
|
|
3176
|
+
}
|
|
3177
|
+
} else if (type === "right") {
|
|
3178
|
+
translateLeft -= 100;
|
|
3179
|
+
if (-translateLeft > maxScrollLeft) {
|
|
3191
3180
|
translateLeft = -maxScrollLeft;
|
|
3192
3181
|
}
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
}
|
|
3198
|
-
|
|
3199
|
-
resizeObserver.disconnect();
|
|
3200
|
-
});
|
|
3201
|
-
watch(() => root2.value?.items.length, (length = 0, preLength = 0) => {
|
|
3202
|
-
setTimeout(() => {
|
|
3203
|
-
setCanScroll();
|
|
3204
|
-
if (length < preLength) {
|
|
3205
|
-
scroll("start");
|
|
3206
|
-
} else {
|
|
3207
|
-
scroll("end");
|
|
3208
|
-
}
|
|
3209
|
-
});
|
|
3210
|
-
});
|
|
3211
|
-
return {
|
|
3212
|
-
pageBar,
|
|
3213
|
-
itemsContainer,
|
|
3214
|
-
canScroll,
|
|
3215
|
-
itemsContainerWidth,
|
|
3216
|
-
scroll
|
|
3217
|
-
};
|
|
3182
|
+
} else if (type === "start") {
|
|
3183
|
+
translateLeft = 0;
|
|
3184
|
+
} else if (type === "end") {
|
|
3185
|
+
translateLeft = -maxScrollLeft;
|
|
3186
|
+
}
|
|
3187
|
+
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
3218
3188
|
};
|
|
3219
|
-
|
|
3220
|
-
|
|
3189
|
+
onMounted(() => {
|
|
3190
|
+
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
3191
|
+
});
|
|
3192
|
+
onUnmounted(() => {
|
|
3193
|
+
resizeObserver.disconnect();
|
|
3194
|
+
});
|
|
3221
3195
|
const root = computed(() => editorService?.get("root"));
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3196
|
+
watch(() => root.value?.items.length, (length = 0, preLength = 0) => {
|
|
3197
|
+
setTimeout(() => {
|
|
3198
|
+
setCanScroll();
|
|
3199
|
+
if (length < preLength) {
|
|
3200
|
+
scroll("start");
|
|
3201
|
+
} else {
|
|
3202
|
+
scroll("end");
|
|
3203
|
+
}
|
|
3204
|
+
});
|
|
3205
|
+
});
|
|
3227
3206
|
const addPage = () => {
|
|
3228
3207
|
if (!editorService)
|
|
3229
3208
|
return;
|
|
@@ -3233,21 +3212,13 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3233
3212
|
};
|
|
3234
3213
|
editorService.add(pageConfig);
|
|
3235
3214
|
};
|
|
3236
|
-
const copy = (node) => {
|
|
3237
|
-
node && editorService?.copy(node);
|
|
3238
|
-
editorService?.paste({
|
|
3239
|
-
left: 0,
|
|
3240
|
-
top: 0
|
|
3241
|
-
});
|
|
3242
|
-
};
|
|
3243
|
-
const remove = (node) => {
|
|
3244
|
-
editorService?.remove(node);
|
|
3245
|
-
};
|
|
3246
3215
|
return (_ctx, _cache) => {
|
|
3247
3216
|
const _component_el_icon = resolveComponent("el-icon");
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3217
|
+
return openBlock(), createElementBlock("div", {
|
|
3218
|
+
class: "m-editor-page-bar",
|
|
3219
|
+
ref_key: "pageBar",
|
|
3220
|
+
ref: pageBar
|
|
3221
|
+
}, [
|
|
3251
3222
|
createElementVNode("div", {
|
|
3252
3223
|
id: "m-editor-page-bar-add-icon",
|
|
3253
3224
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
@@ -3260,10 +3231,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3260
3231
|
_: 1
|
|
3261
3232
|
})
|
|
3262
3233
|
]),
|
|
3263
|
-
|
|
3234
|
+
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
3264
3235
|
key: 0,
|
|
3265
3236
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3266
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
3237
|
+
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
3267
3238
|
}, [
|
|
3268
3239
|
createVNode(_component_el_icon, null, {
|
|
3269
3240
|
default: withCtx(() => [
|
|
@@ -3275,16 +3246,64 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3275
3246
|
unref(root) ? (openBlock(), createElementBlock("div", {
|
|
3276
3247
|
key: 1,
|
|
3277
3248
|
class: "m-editor-page-bar-items",
|
|
3278
|
-
|
|
3279
|
-
|
|
3249
|
+
ref_key: "itemsContainer",
|
|
3250
|
+
ref: itemsContainer,
|
|
3251
|
+
style: normalizeStyle(`width: ${unref(itemsContainerWidth)}px`)
|
|
3280
3252
|
}, [
|
|
3281
|
-
(
|
|
3253
|
+
renderSlot(_ctx.$slots, "default")
|
|
3254
|
+
], 4)) : createCommentVNode("", true),
|
|
3255
|
+
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
3256
|
+
key: 2,
|
|
3257
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3258
|
+
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
3259
|
+
}, [
|
|
3260
|
+
createVNode(_component_el_icon, null, {
|
|
3261
|
+
default: withCtx(() => [
|
|
3262
|
+
createVNode(unref(ArrowRightBold))
|
|
3263
|
+
]),
|
|
3264
|
+
_: 1
|
|
3265
|
+
})
|
|
3266
|
+
])) : createCommentVNode("", true)
|
|
3267
|
+
], 512);
|
|
3268
|
+
};
|
|
3269
|
+
}
|
|
3270
|
+
});
|
|
3271
|
+
|
|
3272
|
+
const _hoisted_1$2 = ["onClick"];
|
|
3273
|
+
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
3274
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3275
|
+
__name: "PageBar",
|
|
3276
|
+
setup(__props) {
|
|
3277
|
+
const services = inject("services");
|
|
3278
|
+
const editorService = services?.editorService;
|
|
3279
|
+
const root = computed(() => editorService?.get("root"));
|
|
3280
|
+
const page = computed(() => editorService?.get("page"));
|
|
3281
|
+
const switchPage = (page2) => {
|
|
3282
|
+
editorService?.select(page2);
|
|
3283
|
+
};
|
|
3284
|
+
const copy = (node) => {
|
|
3285
|
+
node && editorService?.copy(node);
|
|
3286
|
+
editorService?.paste({
|
|
3287
|
+
left: 0,
|
|
3288
|
+
top: 0
|
|
3289
|
+
});
|
|
3290
|
+
};
|
|
3291
|
+
const remove = (node) => {
|
|
3292
|
+
editorService?.remove(node);
|
|
3293
|
+
};
|
|
3294
|
+
return (_ctx, _cache) => {
|
|
3295
|
+
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
3296
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
3297
|
+
const _component_el_popover = resolveComponent("el-popover");
|
|
3298
|
+
return openBlock(), createBlock(_sfc_main$6, null, {
|
|
3299
|
+
default: withCtx(() => [
|
|
3300
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(root) && unref(root).items || [], (item) => {
|
|
3282
3301
|
return openBlock(), createElementBlock("div", {
|
|
3283
|
-
key: item.key,
|
|
3284
3302
|
class: normalizeClass(["m-editor-page-bar-item", { active: unref(page)?.id === item.id }]),
|
|
3303
|
+
key: item.key,
|
|
3285
3304
|
onClick: ($event) => switchPage(item)
|
|
3286
3305
|
}, [
|
|
3287
|
-
createElementVNode("div",
|
|
3306
|
+
createElementVNode("div", _hoisted_2, [
|
|
3288
3307
|
renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
|
|
3289
3308
|
createVNode(_component_el_tooltip, {
|
|
3290
3309
|
effect: "dark",
|
|
@@ -3315,7 +3334,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3315
3334
|
default: withCtx(() => [
|
|
3316
3335
|
createElementVNode("div", null, [
|
|
3317
3336
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
3318
|
-
createVNode(_sfc_main$
|
|
3337
|
+
createVNode(_sfc_main$f, {
|
|
3319
3338
|
data: {
|
|
3320
3339
|
type: "button",
|
|
3321
3340
|
text: "\u590D\u5236",
|
|
@@ -3323,7 +3342,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3323
3342
|
handler: () => copy(item)
|
|
3324
3343
|
}
|
|
3325
3344
|
}, null, 8, ["data"]),
|
|
3326
|
-
createVNode(_sfc_main$
|
|
3345
|
+
createVNode(_sfc_main$f, {
|
|
3327
3346
|
data: {
|
|
3328
3347
|
type: "button",
|
|
3329
3348
|
text: "\u5220\u9664",
|
|
@@ -3336,22 +3355,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3336
3355
|
]),
|
|
3337
3356
|
_: 2
|
|
3338
3357
|
}, 1024)
|
|
3339
|
-
], 10,
|
|
3358
|
+
], 10, _hoisted_1$2);
|
|
3340
3359
|
}), 128))
|
|
3341
|
-
]
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3345
|
-
onClick: _cache[1] || (_cache[1] = ($event) => unref(scrollState).scroll("right"))
|
|
3346
|
-
}, [
|
|
3347
|
-
createVNode(_component_el_icon, null, {
|
|
3348
|
-
default: withCtx(() => [
|
|
3349
|
-
createVNode(unref(ArrowRightBold))
|
|
3350
|
-
]),
|
|
3351
|
-
_: 1
|
|
3352
|
-
})
|
|
3353
|
-
])) : createCommentVNode("", true)
|
|
3354
|
-
], 512);
|
|
3360
|
+
]),
|
|
3361
|
+
_: 3
|
|
3362
|
+
});
|
|
3355
3363
|
};
|
|
3356
3364
|
}
|
|
3357
3365
|
});
|
|
@@ -3714,7 +3722,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3714
3722
|
};
|
|
3715
3723
|
expose({ show });
|
|
3716
3724
|
return (_ctx, _cache) => {
|
|
3717
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3725
|
+
return openBlock(), createBlock(_sfc_main$b, {
|
|
3718
3726
|
"menu-data": menuData,
|
|
3719
3727
|
ref_key: "menu",
|
|
3720
3728
|
ref: menu
|
|
@@ -4409,12 +4417,12 @@ const index = {
|
|
|
4409
4417
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
4410
4418
|
setConfig(option);
|
|
4411
4419
|
app.component(Editor.name, Editor);
|
|
4412
|
-
app.component(
|
|
4420
|
+
app.component("m-fields-ui-select", _sfc_main$l);
|
|
4413
4421
|
app.component(CodeLink.name, CodeLink);
|
|
4414
4422
|
app.component(Code.name, Code);
|
|
4415
4423
|
app.component(CodeEditor.name, CodeEditor);
|
|
4416
4424
|
}
|
|
4417
4425
|
};
|
|
4418
4426
|
|
|
4419
|
-
export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$
|
|
4427
|
+
export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$f as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, warn };
|
|
4420
4428
|
//# sourceMappingURL=tmagic-editor.mjs.map
|