@tmagic/editor 1.0.0-beta.12 → 1.0.0-beta.15
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/coverage/clover.xml +1540 -0
- package/coverage/coverage-final.json +35 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +206 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/Editor.vue.html +787 -0
- package/coverage/lcov-report/src/components/ContentMenu.vue.html +406 -0
- package/coverage/lcov-report/src/components/Icon.vue.html +172 -0
- package/coverage/lcov-report/src/components/ScrollViewer.vue.html +283 -0
- package/coverage/lcov-report/src/components/ToolButton.vue.html +772 -0
- package/coverage/lcov-report/src/components/index.html +161 -0
- package/coverage/lcov-report/src/index.html +131 -0
- package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +214 -0
- package/coverage/lcov-report/src/layouts/Framework.vue.html +304 -0
- package/coverage/lcov-report/src/layouts/NavMenu.vue.html +208 -0
- package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +316 -0
- package/coverage/lcov-report/src/layouts/Resizer.vue.html +268 -0
- package/coverage/lcov-report/src/layouts/index.html +176 -0
- package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +358 -0
- package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +421 -0
- package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +775 -0
- package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +343 -0
- package/coverage/lcov-report/src/layouts/sidebar/index.html +161 -0
- package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +718 -0
- package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +757 -0
- package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +532 -0
- package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +586 -0
- package/coverage/lcov-report/src/layouts/workspace/index.html +161 -0
- package/coverage/lcov-report/src/services/BaseService.ts.html +643 -0
- package/coverage/lcov-report/src/services/componentList.ts.html +229 -0
- package/coverage/lcov-report/src/services/editor.ts.html +2077 -0
- package/coverage/lcov-report/src/services/events.ts.html +331 -0
- package/coverage/lcov-report/src/services/history.ts.html +478 -0
- package/coverage/lcov-report/src/services/index.html +206 -0
- package/coverage/lcov-report/src/services/props.ts.html +415 -0
- package/coverage/lcov-report/src/services/ui.ts.html +514 -0
- package/coverage/lcov-report/src/type.ts.html +844 -0
- package/coverage/lcov-report/src/utils/compose.ts.html +184 -0
- package/coverage/lcov-report/src/utils/config.ts.html +172 -0
- package/coverage/lcov-report/src/utils/editor.ts.html +838 -0
- package/coverage/lcov-report/src/utils/index.html +221 -0
- package/coverage/lcov-report/src/utils/index.ts.html +151 -0
- package/coverage/lcov-report/src/utils/logger.ts.html +226 -0
- package/coverage/lcov-report/src/utils/props.ts.html +796 -0
- package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +733 -0
- package/coverage/lcov-report/src/utils/undo-redo.ts.html +313 -0
- package/coverage/lcov-report/undo-redo.ts.html +313 -0
- package/coverage/lcov.info +3676 -0
- package/dist/style.css +47 -22
- package/dist/tmagic-editor.es.js +921 -603
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +920 -602
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/dist/types/src/Editor.vue.d.ts +1 -1
- package/dist/types/src/components/ToolButton.vue.d.ts +12 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -0
- package/dist/types/src/layouts/workspace/PageBar.vue.d.ts +2 -0
- package/dist/types/src/services/editor.d.ts +5 -2
- package/dist/types/src/services/history.d.ts +1 -0
- package/dist/types/src/services/props.d.ts +2 -2
- package/dist/types/src/services/ui.d.ts +1 -0
- package/dist/types/src/type.d.ts +6 -8
- package/dist/types/src/utils/editor.d.ts +2 -2
- package/dist/types/src/utils/polyfills.d.ts +0 -0
- package/package.json +26 -12
- package/src/components/ContentMenu.vue +107 -0
- package/src/components/ScrollViewer.vue +1 -1
- package/src/components/ToolButton.vue +69 -30
- package/src/index.ts +2 -0
- package/src/layouts/Framework.vue +6 -6
- package/src/layouts/sidebar/ComponentListPanel.vue +23 -1
- package/src/layouts/sidebar/LayerMenu.vue +91 -72
- package/src/layouts/sidebar/LayerPanel.vue +23 -49
- package/src/layouts/workspace/PageBar.vue +35 -6
- package/src/layouts/workspace/Stage.vue +41 -44
- package/src/layouts/workspace/ViewerMenu.vue +104 -67
- package/src/layouts/workspace/Workspace.vue +74 -16
- package/src/services/BaseService.ts +1 -1
- package/src/services/editor.ts +97 -10
- package/src/services/history.ts +7 -0
- package/src/services/props.ts +2 -3
- package/src/services/ui.ts +5 -0
- package/src/theme/common/var.scss +1 -0
- package/src/theme/component-list-panel.scss +2 -0
- package/src/theme/content-menu.scss +33 -26
- package/src/theme/layer-panel.scss +2 -1
- package/src/theme/nav-menu.scss +6 -2
- package/src/theme/page-bar.scss +22 -1
- package/src/type.ts +6 -8
- package/src/utils/editor.ts +7 -3
- package/{vite.config.ts → src/utils/polyfills.ts} +4 -12
- package/src/utils/props.ts +19 -0
- package/dist/types/src/layouts/sidebar/LayerPanel.vue.d.ts +0 -980
- package/dist/types/src/layouts/workspace/Stage.vue.d.ts +0 -188
- package/dist/types/src/layouts/workspace/ViewerMenu.vue.d.ts +0 -18
- package/tsconfig.json +0 -9
package/dist/tmagic-editor.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, createElementBlock, createElementVNode, toDisplayString, withModifiers, createCommentVNode, watch, onMounted, onUnmounted, reactive, toRaw, createVNode, withCtx, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, renderList, createTextVNode, normalizeProps, mergeProps, getCurrentInstance,
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, createElementBlock, createElementVNode, toDisplayString, withModifiers, createCommentVNode, watch, onMounted, onUnmounted, reactive, toRaw, createVNode, withCtx, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, markRaw, renderList, createTextVNode, normalizeProps, mergeProps, getCurrentInstance, nextTick, withDirectives, Teleport, vShow, toHandlers, createSlots, provide } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
3
|
import * as monaco from 'monaco-editor';
|
|
4
|
-
import { Plus, Edit, ArrowDown, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Delete, Files, Coin, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons';
|
|
4
|
+
import { Plus, Edit, ArrowDown, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Delete, Files, DocumentCopy, Coin, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons';
|
|
5
5
|
import { NodeType } from '@tmagic/schema';
|
|
6
|
-
import { cloneDeep,
|
|
6
|
+
import { cloneDeep, mergeWith, random, throttle } from 'lodash-es';
|
|
7
7
|
import { toLine, isPop, getNodePath, isNumber, isPage } from '@tmagic/utils';
|
|
8
8
|
import { EventEmitter as EventEmitter$2 } from 'events';
|
|
9
9
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
@@ -11,6 +11,10 @@ import { ElMessage } from 'element-plus';
|
|
|
11
11
|
import KeyController from 'keycon';
|
|
12
12
|
import StageCore from '@tmagic/stage';
|
|
13
13
|
|
|
14
|
+
if (typeof window.global === "undefined") {
|
|
15
|
+
window.global = window;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
var _export_sfc = (sfc, props) => {
|
|
15
19
|
const target = sfc.__vccOpts || sfc;
|
|
16
20
|
for (const [key, val] of props) {
|
|
@@ -19,7 +23,7 @@ var _export_sfc = (sfc, props) => {
|
|
|
19
23
|
return target;
|
|
20
24
|
};
|
|
21
25
|
|
|
22
|
-
const _sfc_main$
|
|
26
|
+
const _sfc_main$l = defineComponent({
|
|
23
27
|
name: "m-fields-vs-code",
|
|
24
28
|
props: ["model", "name", "config", "prop"],
|
|
25
29
|
emits: ["change"],
|
|
@@ -36,7 +40,7 @@ const _sfc_main$k = defineComponent({
|
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
42
|
});
|
|
39
|
-
function _sfc_render$
|
|
43
|
+
function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
|
|
40
44
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
41
45
|
return openBlock(), createBlock(_component_magic_code_editor, {
|
|
42
46
|
style: normalizeStyle(`height: ${_ctx.height}`),
|
|
@@ -45,9 +49,9 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
45
49
|
onSave: _ctx.save
|
|
46
50
|
}, null, 8, ["style", "init-values", "language", "onSave"]);
|
|
47
51
|
}
|
|
48
|
-
var Code = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
52
|
+
var Code = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$l]]);
|
|
49
53
|
|
|
50
|
-
const _sfc_main$
|
|
54
|
+
const _sfc_main$k = defineComponent({
|
|
51
55
|
name: "m-fields-code-link",
|
|
52
56
|
props: {
|
|
53
57
|
config: {
|
|
@@ -102,7 +106,7 @@ const _sfc_main$j = defineComponent({
|
|
|
102
106
|
};
|
|
103
107
|
}
|
|
104
108
|
});
|
|
105
|
-
function _sfc_render$
|
|
109
|
+
function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
|
|
106
110
|
const _component_m_fields_link = resolveComponent("m-fields-link");
|
|
107
111
|
return openBlock(), createBlock(_component_m_fields_link, {
|
|
108
112
|
config: _ctx.formConfig,
|
|
@@ -111,11 +115,11 @@ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
111
115
|
onChange: _ctx.changeHandler
|
|
112
116
|
}, null, 8, ["config", "model", "onChange"]);
|
|
113
117
|
}
|
|
114
|
-
var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
118
|
+
var CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$k]]);
|
|
115
119
|
|
|
116
120
|
var UISelect_vue_vue_type_style_index_0_lang = '';
|
|
117
121
|
|
|
118
|
-
const _sfc_main$
|
|
122
|
+
const _sfc_main$j = defineComponent({
|
|
119
123
|
name: "m-fields-ui-select",
|
|
120
124
|
props: {
|
|
121
125
|
labelWidth: String,
|
|
@@ -177,25 +181,25 @@ const _sfc_main$i = defineComponent({
|
|
|
177
181
|
};
|
|
178
182
|
}
|
|
179
183
|
});
|
|
180
|
-
const _hoisted_1$
|
|
184
|
+
const _hoisted_1$c = /* @__PURE__ */ createElementVNode("i", {
|
|
181
185
|
class: "el-icon-delete",
|
|
182
186
|
style: { "color": "rgb(221, 75, 57)" }
|
|
183
187
|
}, "\u53D6\u6D88", -1);
|
|
184
|
-
const _hoisted_2$
|
|
185
|
-
_hoisted_1$
|
|
188
|
+
const _hoisted_2$5 = [
|
|
189
|
+
_hoisted_1$c
|
|
186
190
|
];
|
|
187
|
-
const _hoisted_3$
|
|
188
|
-
function _sfc_render$
|
|
191
|
+
const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", { class: "el-icon-thumb" }, null, -1);
|
|
192
|
+
function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
189
193
|
return _ctx.uiSelectMode ? (openBlock(), createElementBlock("div", {
|
|
190
194
|
key: 0,
|
|
191
195
|
class: "m-fields-ui-select",
|
|
192
196
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancelHandler && _ctx.cancelHandler(...args))
|
|
193
|
-
}, _hoisted_2$
|
|
197
|
+
}, _hoisted_2$5)) : (openBlock(), createElementBlock("div", {
|
|
194
198
|
key: 1,
|
|
195
199
|
class: "m-fields-ui-select",
|
|
196
200
|
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.startSelect && _ctx.startSelect(...args))
|
|
197
201
|
}, [
|
|
198
|
-
_hoisted_3$
|
|
202
|
+
_hoisted_3$3,
|
|
199
203
|
createElementVNode("span", null, toDisplayString(_ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1),
|
|
200
204
|
_ctx.val ? (openBlock(), createElementBlock("i", {
|
|
201
205
|
key: 0,
|
|
@@ -204,7 +208,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
204
208
|
})) : createCommentVNode("", true)
|
|
205
209
|
]));
|
|
206
210
|
}
|
|
207
|
-
var uiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
211
|
+
var uiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$j]]);
|
|
208
212
|
|
|
209
213
|
const toString = (v, language) => {
|
|
210
214
|
let value = "";
|
|
@@ -221,7 +225,7 @@ const toString = (v, language) => {
|
|
|
221
225
|
}
|
|
222
226
|
return value;
|
|
223
227
|
};
|
|
224
|
-
const _sfc_main$
|
|
228
|
+
const _sfc_main$i = defineComponent({
|
|
225
229
|
name: "magic-code-editor",
|
|
226
230
|
props: {
|
|
227
231
|
initValues: {
|
|
@@ -326,14 +330,14 @@ const _sfc_main$h = defineComponent({
|
|
|
326
330
|
};
|
|
327
331
|
}
|
|
328
332
|
});
|
|
329
|
-
const _hoisted_1$
|
|
333
|
+
const _hoisted_1$b = {
|
|
330
334
|
ref: "codeEditor",
|
|
331
335
|
class: "magic-code-editor"
|
|
332
336
|
};
|
|
333
|
-
function _sfc_render$
|
|
334
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
337
|
+
function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
338
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, null, 512);
|
|
335
339
|
}
|
|
336
|
-
var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
340
|
+
var CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$i]]);
|
|
337
341
|
|
|
338
342
|
let $TMAGIC_EDITOR = {};
|
|
339
343
|
const setConfig = (option) => {
|
|
@@ -342,9 +346,6 @@ const setConfig = (option) => {
|
|
|
342
346
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
343
347
|
|
|
344
348
|
class UndoRedo {
|
|
345
|
-
elementList;
|
|
346
|
-
listCursor;
|
|
347
|
-
listMaxSize;
|
|
348
349
|
constructor(listMaxSize = 200) {
|
|
349
350
|
const minListMaxSize = 2;
|
|
350
351
|
this.elementList = [];
|
|
@@ -435,7 +436,7 @@ const doAction = async (args, scope, sourceMethod, beforeMethodName, afterMethod
|
|
|
435
436
|
}
|
|
436
437
|
let returnValue = await fn(beforeArgs, sourceMethod.bind(scope));
|
|
437
438
|
for (const afterMethod of scope.pluginOptionsList[afterMethodName]) {
|
|
438
|
-
returnValue = await afterMethod(...beforeArgs
|
|
439
|
+
returnValue = await afterMethod(returnValue, ...beforeArgs);
|
|
439
440
|
if (isError(returnValue))
|
|
440
441
|
throw returnValue;
|
|
441
442
|
}
|
|
@@ -445,12 +446,12 @@ const doAction = async (args, scope, sourceMethod, beforeMethodName, afterMethod
|
|
|
445
446
|
}
|
|
446
447
|
};
|
|
447
448
|
class BaseService extends EventEmitter$2 {
|
|
448
|
-
pluginOptionsList = {};
|
|
449
|
-
middleware = {};
|
|
450
|
-
taskList = [];
|
|
451
|
-
doingTask = false;
|
|
452
449
|
constructor(methods = [], serialMethods = []) {
|
|
453
450
|
super();
|
|
451
|
+
this.pluginOptionsList = {};
|
|
452
|
+
this.middleware = {};
|
|
453
|
+
this.taskList = [];
|
|
454
|
+
this.doingTask = false;
|
|
454
455
|
methods.forEach((propertyName) => {
|
|
455
456
|
const scope = this;
|
|
456
457
|
const sourceMethod = scope[propertyName];
|
|
@@ -507,16 +508,22 @@ class BaseService extends EventEmitter$2 {
|
|
|
507
508
|
}
|
|
508
509
|
|
|
509
510
|
class History extends BaseService {
|
|
510
|
-
state = reactive({
|
|
511
|
-
pageSteps: {},
|
|
512
|
-
pageId: void 0,
|
|
513
|
-
canRedo: false,
|
|
514
|
-
canUndo: false
|
|
515
|
-
});
|
|
516
511
|
constructor() {
|
|
517
512
|
super([]);
|
|
513
|
+
this.state = reactive({
|
|
514
|
+
pageSteps: {},
|
|
515
|
+
pageId: void 0,
|
|
516
|
+
canRedo: false,
|
|
517
|
+
canUndo: false
|
|
518
|
+
});
|
|
518
519
|
this.on("change", this.setCanUndoRedo);
|
|
519
520
|
}
|
|
521
|
+
reset() {
|
|
522
|
+
this.state.pageSteps = {};
|
|
523
|
+
this.state.pageId = void 0;
|
|
524
|
+
this.state.canRedo = false;
|
|
525
|
+
this.state.canUndo = false;
|
|
526
|
+
}
|
|
520
527
|
changePage(page) {
|
|
521
528
|
if (!page)
|
|
522
529
|
return;
|
|
@@ -580,12 +587,12 @@ class History extends BaseService {
|
|
|
580
587
|
var historyService = new History();
|
|
581
588
|
|
|
582
589
|
class Props extends BaseService {
|
|
583
|
-
state = reactive({
|
|
584
|
-
propsConfigMap: {},
|
|
585
|
-
propsValueMap: {}
|
|
586
|
-
});
|
|
587
590
|
constructor() {
|
|
588
591
|
super(["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue"]);
|
|
592
|
+
this.state = reactive({
|
|
593
|
+
propsConfigMap: {},
|
|
594
|
+
propsValueMap: {}
|
|
595
|
+
});
|
|
589
596
|
}
|
|
590
597
|
setPropsConfigs(configs) {
|
|
591
598
|
Object.keys(configs).forEach((type) => {
|
|
@@ -622,8 +629,7 @@ class Props extends BaseService {
|
|
|
622
629
|
}
|
|
623
630
|
return cloneDeep({
|
|
624
631
|
...getDefaultPropsValue(type),
|
|
625
|
-
...defaultValue
|
|
626
|
-
...this.state.propsValueMap[type] || {}
|
|
632
|
+
...mergeWith(this.state.propsValueMap[type] || {}, defaultValue)
|
|
627
633
|
});
|
|
628
634
|
}
|
|
629
635
|
}
|
|
@@ -710,7 +716,7 @@ const toRelative = (node) => {
|
|
|
710
716
|
const setTop2Middle = (node, parentNode, stage) => {
|
|
711
717
|
const style = node.style || {};
|
|
712
718
|
const height = style.height || 0;
|
|
713
|
-
if (!stage || style.top || !parentNode.style || !isNumber(height))
|
|
719
|
+
if (!stage || typeof style.top !== "undefined" || !parentNode.style || !isNumber(height))
|
|
714
720
|
return style;
|
|
715
721
|
const { height: parentHeight } = parentNode.style;
|
|
716
722
|
if (isPage(parentNode)) {
|
|
@@ -808,16 +814,6 @@ const error = (...args) => {
|
|
|
808
814
|
};
|
|
809
815
|
|
|
810
816
|
class Editor$1 extends BaseService {
|
|
811
|
-
isHistoryStateChange = false;
|
|
812
|
-
state = reactive({
|
|
813
|
-
root: null,
|
|
814
|
-
page: null,
|
|
815
|
-
parent: null,
|
|
816
|
-
node: null,
|
|
817
|
-
stage: null,
|
|
818
|
-
highlightNode: null,
|
|
819
|
-
modifiedNodeIds: /* @__PURE__ */ new Map()
|
|
820
|
-
});
|
|
821
817
|
constructor() {
|
|
822
818
|
super([
|
|
823
819
|
"getLayout",
|
|
@@ -830,14 +826,27 @@ class Editor$1 extends BaseService {
|
|
|
830
826
|
"paste",
|
|
831
827
|
"alignCenter",
|
|
832
828
|
"moveLayer",
|
|
829
|
+
"move",
|
|
833
830
|
"undo",
|
|
834
831
|
"redo",
|
|
835
832
|
"highlight"
|
|
836
833
|
], ["select", "update", "moveLayer"]);
|
|
834
|
+
this.isHistoryStateChange = false;
|
|
835
|
+
this.state = reactive({
|
|
836
|
+
root: null,
|
|
837
|
+
page: null,
|
|
838
|
+
parent: null,
|
|
839
|
+
node: null,
|
|
840
|
+
stage: null,
|
|
841
|
+
highlightNode: null,
|
|
842
|
+
modifiedNodeIds: /* @__PURE__ */ new Map(),
|
|
843
|
+
pageLength: 0
|
|
844
|
+
});
|
|
837
845
|
}
|
|
838
846
|
set(name, value) {
|
|
839
847
|
this.state[name] = value;
|
|
840
848
|
if (name === "root") {
|
|
849
|
+
this.state.pageLength = value?.items?.length || 0;
|
|
841
850
|
this.emit("root-change", value);
|
|
842
851
|
}
|
|
843
852
|
}
|
|
@@ -845,7 +854,7 @@ class Editor$1 extends BaseService {
|
|
|
845
854
|
return this.state[name];
|
|
846
855
|
}
|
|
847
856
|
getNodeInfo(id) {
|
|
848
|
-
const root = this.get("root");
|
|
857
|
+
const root = toRaw(this.get("root"));
|
|
849
858
|
if (!root)
|
|
850
859
|
return {};
|
|
851
860
|
if (id === root.id) {
|
|
@@ -876,11 +885,13 @@ class Editor$1 extends BaseService {
|
|
|
876
885
|
const { parent } = this.getNodeInfo(id);
|
|
877
886
|
return parent;
|
|
878
887
|
}
|
|
879
|
-
async getLayout(node) {
|
|
880
|
-
if (node
|
|
881
|
-
return
|
|
888
|
+
async getLayout(parent, node) {
|
|
889
|
+
if (node && typeof node !== "function" && isFixed(node))
|
|
890
|
+
return Layout.FIXED;
|
|
891
|
+
if (parent.layout) {
|
|
892
|
+
return parent.layout;
|
|
882
893
|
}
|
|
883
|
-
if (!
|
|
894
|
+
if (!parent.style?.position) {
|
|
884
895
|
return Layout.RELATIVE;
|
|
885
896
|
}
|
|
886
897
|
return Layout.ABSOLUTE;
|
|
@@ -895,8 +906,31 @@ class Editor$1 extends BaseService {
|
|
|
895
906
|
} else {
|
|
896
907
|
historyService.empty();
|
|
897
908
|
}
|
|
909
|
+
this.emit("select", node);
|
|
898
910
|
return node;
|
|
899
911
|
}
|
|
912
|
+
async selectNextNode() {
|
|
913
|
+
const node = toRaw(this.get("node"));
|
|
914
|
+
if (!node || isPage(node) || node.type === NodeType.ROOT)
|
|
915
|
+
return node;
|
|
916
|
+
const parent = toRaw(this.getParentById(node.id));
|
|
917
|
+
if (!parent)
|
|
918
|
+
return node;
|
|
919
|
+
const index = getNodeIndex(node, parent);
|
|
920
|
+
const nextNode = parent.items[index + 1] || parent.items[0];
|
|
921
|
+
await this.select(nextNode);
|
|
922
|
+
this.get("stage")?.select(nextNode.id);
|
|
923
|
+
return nextNode;
|
|
924
|
+
}
|
|
925
|
+
async selectNextPage() {
|
|
926
|
+
const root = toRaw(this.get("root"));
|
|
927
|
+
const page = toRaw(this.get("page"));
|
|
928
|
+
const index = getNodeIndex(page, root);
|
|
929
|
+
const nextPage = root.items[index + 1] || root.items[0];
|
|
930
|
+
await this.select(nextPage);
|
|
931
|
+
this.get("stage")?.select(nextPage.id);
|
|
932
|
+
return nextPage;
|
|
933
|
+
}
|
|
900
934
|
highlight(config2) {
|
|
901
935
|
const { node } = this.selectedConfigExceptionHandler(config2);
|
|
902
936
|
const currentHighlightNode = this.get("highlightNode");
|
|
@@ -904,10 +938,12 @@ class Editor$1 extends BaseService {
|
|
|
904
938
|
return;
|
|
905
939
|
this.set("highlightNode", node);
|
|
906
940
|
}
|
|
907
|
-
async add(
|
|
941
|
+
async add(addNode, parent) {
|
|
942
|
+
const { type, ...config2 } = addNode;
|
|
908
943
|
const curNode = this.get("node");
|
|
909
944
|
let parentNode;
|
|
910
|
-
|
|
945
|
+
const isPage2 = type === NodeType.PAGE;
|
|
946
|
+
if (isPage2) {
|
|
911
947
|
parentNode = this.get("root");
|
|
912
948
|
} else if (parent && typeof parent !== "function") {
|
|
913
949
|
parentNode = parent;
|
|
@@ -918,7 +954,7 @@ class Editor$1 extends BaseService {
|
|
|
918
954
|
}
|
|
919
955
|
if (!parentNode)
|
|
920
956
|
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
921
|
-
const layout = await this.getLayout(parentNode);
|
|
957
|
+
const layout = await this.getLayout(toRaw(parentNode), addNode);
|
|
922
958
|
const newNode = initPosition({ ...toRaw(await propsService.getPropsValue(type, config2)) }, layout, parentNode, this.get("stage"));
|
|
923
959
|
if ((parentNode?.type === NodeType.ROOT || curNode.type === NodeType.ROOT) && newNode.type !== NodeType.PAGE) {
|
|
924
960
|
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
@@ -932,6 +968,10 @@ class Editor$1 extends BaseService {
|
|
|
932
968
|
this.pushHistoryState();
|
|
933
969
|
}
|
|
934
970
|
stage?.select(newNode.id);
|
|
971
|
+
if (isPage2) {
|
|
972
|
+
this.state.pageLength += 1;
|
|
973
|
+
}
|
|
974
|
+
this.emit("add", newNode);
|
|
935
975
|
return newNode;
|
|
936
976
|
}
|
|
937
977
|
async remove(node) {
|
|
@@ -950,9 +990,20 @@ class Editor$1 extends BaseService {
|
|
|
950
990
|
const stage = this.get("stage");
|
|
951
991
|
stage?.remove({ id: node.id, root: this.get("root") });
|
|
952
992
|
if (node.type === NodeType.PAGE) {
|
|
993
|
+
this.state.pageLength -= 1;
|
|
953
994
|
if (root.items[0]) {
|
|
954
995
|
await this.select(root.items[0]);
|
|
955
996
|
stage?.select(root.items[0].id);
|
|
997
|
+
} else {
|
|
998
|
+
this.set("node", null);
|
|
999
|
+
this.set("parent", null);
|
|
1000
|
+
this.set("page", null);
|
|
1001
|
+
this.set("stage", null);
|
|
1002
|
+
this.set("highlightNode", null);
|
|
1003
|
+
this.resetModifiedNodeId();
|
|
1004
|
+
historyService.reset();
|
|
1005
|
+
this.emit("remove", node);
|
|
1006
|
+
return node;
|
|
956
1007
|
}
|
|
957
1008
|
} else {
|
|
958
1009
|
await this.select(parent);
|
|
@@ -960,6 +1011,7 @@ class Editor$1 extends BaseService {
|
|
|
960
1011
|
}
|
|
961
1012
|
this.addModifiedNodeId(parent.id);
|
|
962
1013
|
this.pushHistoryState();
|
|
1014
|
+
this.emit("remove", node);
|
|
963
1015
|
return node;
|
|
964
1016
|
}
|
|
965
1017
|
async update(config2) {
|
|
@@ -1003,6 +1055,7 @@ class Editor$1 extends BaseService {
|
|
|
1003
1055
|
}
|
|
1004
1056
|
this.addModifiedNodeId(newConfig.id);
|
|
1005
1057
|
this.pushHistoryState();
|
|
1058
|
+
this.emit("update", newConfig);
|
|
1006
1059
|
return newConfig;
|
|
1007
1060
|
}
|
|
1008
1061
|
async sort(id1, id2) {
|
|
@@ -1046,7 +1099,7 @@ class Editor$1 extends BaseService {
|
|
|
1046
1099
|
async alignCenter(config2) {
|
|
1047
1100
|
const parent = this.get("parent");
|
|
1048
1101
|
const node = this.get("node");
|
|
1049
|
-
const layout = await this.getLayout(parent);
|
|
1102
|
+
const layout = await this.getLayout(toRaw(parent), toRaw(node));
|
|
1050
1103
|
if (layout === Layout.RELATIVE) {
|
|
1051
1104
|
return;
|
|
1052
1105
|
}
|
|
@@ -1083,6 +1136,26 @@ class Editor$1 extends BaseService {
|
|
|
1083
1136
|
await this.changeHistoryState(value);
|
|
1084
1137
|
return value;
|
|
1085
1138
|
}
|
|
1139
|
+
async move(left, top) {
|
|
1140
|
+
const node = toRaw(this.get("node"));
|
|
1141
|
+
if (!node || isPage(node))
|
|
1142
|
+
return;
|
|
1143
|
+
const { style, id } = node;
|
|
1144
|
+
if (!style || style.position !== "absolute")
|
|
1145
|
+
return;
|
|
1146
|
+
if (top && !isNumber(style.top))
|
|
1147
|
+
return;
|
|
1148
|
+
if (left && !isNumber(style.left))
|
|
1149
|
+
return;
|
|
1150
|
+
this.update({
|
|
1151
|
+
id,
|
|
1152
|
+
style: {
|
|
1153
|
+
...style,
|
|
1154
|
+
left: Number(style.left) + left,
|
|
1155
|
+
top: Number(style.top) + top
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1086
1159
|
destroy() {
|
|
1087
1160
|
this.removeAllListeners();
|
|
1088
1161
|
this.set("root", null);
|
|
@@ -1312,6 +1385,25 @@ const fillConfig = (config = []) => [
|
|
|
1312
1385
|
defaultValue: "100% 100%"
|
|
1313
1386
|
}
|
|
1314
1387
|
]
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
type: "fieldset",
|
|
1391
|
+
legend: "\u5B57\u4F53",
|
|
1392
|
+
items: [
|
|
1393
|
+
{
|
|
1394
|
+
name: "color",
|
|
1395
|
+
text: "\u989C\u8272",
|
|
1396
|
+
type: "colorPicker"
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
name: "fontSize",
|
|
1400
|
+
text: "\u5927\u5C0F"
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
name: "fontWeight",
|
|
1404
|
+
text: "\u7C97\u7EC6"
|
|
1405
|
+
}
|
|
1406
|
+
]
|
|
1315
1407
|
}
|
|
1316
1408
|
]
|
|
1317
1409
|
}
|
|
@@ -1379,7 +1471,7 @@ const getDefaultPropsValue = (type) => ({
|
|
|
1379
1471
|
name: type
|
|
1380
1472
|
});
|
|
1381
1473
|
|
|
1382
|
-
const _sfc_main$
|
|
1474
|
+
const _sfc_main$h = defineComponent({
|
|
1383
1475
|
components: { Plus },
|
|
1384
1476
|
setup() {
|
|
1385
1477
|
const services = inject("services");
|
|
@@ -1396,14 +1488,14 @@ const _sfc_main$g = defineComponent({
|
|
|
1396
1488
|
};
|
|
1397
1489
|
}
|
|
1398
1490
|
});
|
|
1399
|
-
const _hoisted_1$
|
|
1400
|
-
const _hoisted_2$
|
|
1401
|
-
const _hoisted_3$
|
|
1402
|
-
function _sfc_render$
|
|
1491
|
+
const _hoisted_1$a = { class: "m-editor-empty-panel" };
|
|
1492
|
+
const _hoisted_2$4 = { class: "m-editor-empty-content" };
|
|
1493
|
+
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
1494
|
+
function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1403
1495
|
const _component_plus = resolveComponent("plus");
|
|
1404
1496
|
const _component_el_icon = resolveComponent("el-icon");
|
|
1405
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1406
|
-
createElementVNode("div", _hoisted_2$
|
|
1497
|
+
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
1498
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
1407
1499
|
createElementVNode("div", {
|
|
1408
1500
|
class: "m-editor-empty-button",
|
|
1409
1501
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
|
|
@@ -1416,12 +1508,12 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1416
1508
|
_: 1
|
|
1417
1509
|
})
|
|
1418
1510
|
]),
|
|
1419
|
-
_hoisted_3$
|
|
1511
|
+
_hoisted_3$2
|
|
1420
1512
|
])
|
|
1421
1513
|
])
|
|
1422
1514
|
]);
|
|
1423
1515
|
}
|
|
1424
|
-
var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1516
|
+
var AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h]]);
|
|
1425
1517
|
|
|
1426
1518
|
/*
|
|
1427
1519
|
Copyright (c) 2018 Daybrush
|
|
@@ -1825,8 +1917,8 @@ Copyright (c) 2019 Daybrush
|
|
|
1825
1917
|
name: gesto
|
|
1826
1918
|
license: MIT
|
|
1827
1919
|
author: Daybrush
|
|
1828
|
-
repository: git+https://github.com/daybrush/
|
|
1829
|
-
version: 1.
|
|
1920
|
+
repository: git+https://github.com/daybrush/gesto.git
|
|
1921
|
+
version: 1.7.0
|
|
1830
1922
|
*/
|
|
1831
1923
|
|
|
1832
1924
|
/*! *****************************************************************************
|
|
@@ -1995,19 +2087,6 @@ function () {
|
|
|
1995
2087
|
|
|
1996
2088
|
var __proto = ClientStore.prototype;
|
|
1997
2089
|
|
|
1998
|
-
__proto.addClients = function (clients) {
|
|
1999
|
-
if (clients === void 0) {
|
|
2000
|
-
clients = this.prevClients;
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
var position = this.getPosition(clients);
|
|
2004
|
-
var deltaX = position.deltaX,
|
|
2005
|
-
deltaY = position.deltaY;
|
|
2006
|
-
this.movement += Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
2007
|
-
this.prevClients = clients;
|
|
2008
|
-
return position;
|
|
2009
|
-
};
|
|
2010
|
-
|
|
2011
2090
|
__proto.getAngle = function (clients) {
|
|
2012
2091
|
if (clients === void 0) {
|
|
2013
2092
|
clients = this.prevClients;
|
|
@@ -2024,8 +2103,17 @@ function () {
|
|
|
2024
2103
|
return getRotatiion(clients) - getRotatiion(this.startClients);
|
|
2025
2104
|
};
|
|
2026
2105
|
|
|
2027
|
-
__proto.getPosition = function (clients) {
|
|
2028
|
-
|
|
2106
|
+
__proto.getPosition = function (clients, isAdd) {
|
|
2107
|
+
if (clients === void 0) {
|
|
2108
|
+
clients = this.prevClients;
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
var position = getPosition(clients || this.prevClients, this.prevClients, this.startClients);
|
|
2112
|
+
var deltaX = position.deltaX,
|
|
2113
|
+
deltaY = position.deltaY;
|
|
2114
|
+
this.movement += Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
2115
|
+
this.prevClients = clients;
|
|
2116
|
+
return position;
|
|
2029
2117
|
};
|
|
2030
2118
|
|
|
2031
2119
|
__proto.getPositions = function (clients) {
|
|
@@ -2074,10 +2162,6 @@ function () {
|
|
|
2074
2162
|
client.clientX -= deltaX;
|
|
2075
2163
|
client.clientY -= deltaY;
|
|
2076
2164
|
});
|
|
2077
|
-
this.prevClients.forEach(function (client) {
|
|
2078
|
-
client.clientX -= deltaX;
|
|
2079
|
-
client.clientY -= deltaY;
|
|
2080
|
-
});
|
|
2081
2165
|
};
|
|
2082
2166
|
|
|
2083
2167
|
return ClientStore;
|
|
@@ -2116,6 +2200,7 @@ function (_super) {
|
|
|
2116
2200
|
_this.targets = [];
|
|
2117
2201
|
_this.prevTime = 0;
|
|
2118
2202
|
_this.doubleFlag = false;
|
|
2203
|
+
_this._dragFlag = false;
|
|
2119
2204
|
|
|
2120
2205
|
_this.onDragStart = function (e, isTrusted) {
|
|
2121
2206
|
if (isTrusted === void 0) {
|
|
@@ -2146,7 +2231,8 @@ function (_super) {
|
|
|
2146
2231
|
if (checkInput || activeElement === target) {
|
|
2147
2232
|
// force false or already focused.
|
|
2148
2233
|
return false;
|
|
2149
|
-
}
|
|
2234
|
+
} // no focus
|
|
2235
|
+
|
|
2150
2236
|
|
|
2151
2237
|
if (activeElement && hasContentEditable && activeElement.isContentEditable && activeElement.contains(target)) {
|
|
2152
2238
|
return false;
|
|
@@ -2162,6 +2248,7 @@ function (_super) {
|
|
|
2162
2248
|
_this.clientStores = [new ClientStore(getEventClients(e))];
|
|
2163
2249
|
_this.flag = true;
|
|
2164
2250
|
_this.isDrag = false;
|
|
2251
|
+
_this._dragFlag = true;
|
|
2165
2252
|
_this.datas = {};
|
|
2166
2253
|
|
|
2167
2254
|
if (preventRightClick && (e.which === 3 || e.button === 2)) {
|
|
@@ -2177,7 +2264,14 @@ function (_super) {
|
|
|
2177
2264
|
inputEvent: e,
|
|
2178
2265
|
isTrusted: isTrusted,
|
|
2179
2266
|
isDouble: _this.doubleFlag
|
|
2180
|
-
}, _this.getCurrentStore().getPosition()
|
|
2267
|
+
}, _this.getCurrentStore().getPosition(), {
|
|
2268
|
+
preventDefault: function () {
|
|
2269
|
+
e.preventDefault();
|
|
2270
|
+
},
|
|
2271
|
+
preventDrag: function () {
|
|
2272
|
+
_this._dragFlag = false;
|
|
2273
|
+
}
|
|
2274
|
+
}));
|
|
2181
2275
|
|
|
2182
2276
|
if (result === false) {
|
|
2183
2277
|
_this.initDrag();
|
|
@@ -2226,24 +2320,26 @@ function (_super) {
|
|
|
2226
2320
|
|
|
2227
2321
|
var result = _this.moveClients(clients, e, false);
|
|
2228
2322
|
|
|
2229
|
-
if (_this.
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2323
|
+
if (_this._dragFlag) {
|
|
2324
|
+
if (_this.pinchFlag || result.deltaX || result.deltaY) {
|
|
2325
|
+
var dragResult = _this.emit("drag", __assign({}, result, {
|
|
2326
|
+
isScroll: !!isScroll,
|
|
2327
|
+
inputEvent: e
|
|
2328
|
+
}));
|
|
2234
2329
|
|
|
2235
|
-
|
|
2236
|
-
|
|
2330
|
+
if (dragResult === false) {
|
|
2331
|
+
_this.stop();
|
|
2237
2332
|
|
|
2238
|
-
|
|
2333
|
+
return;
|
|
2334
|
+
}
|
|
2239
2335
|
}
|
|
2240
|
-
}
|
|
2241
2336
|
|
|
2242
|
-
|
|
2243
|
-
|
|
2337
|
+
if (_this.pinchFlag) {
|
|
2338
|
+
_this.onPinch(e, clients);
|
|
2339
|
+
}
|
|
2244
2340
|
}
|
|
2245
2341
|
|
|
2246
|
-
_this.getCurrentStore().
|
|
2342
|
+
_this.getCurrentStore().getPosition(clients, true);
|
|
2247
2343
|
};
|
|
2248
2344
|
|
|
2249
2345
|
_this.onDragEnd = function (e) {
|
|
@@ -2261,7 +2357,7 @@ function (_super) {
|
|
|
2261
2357
|
|
|
2262
2358
|
_this.flag = false;
|
|
2263
2359
|
|
|
2264
|
-
var position = _this.
|
|
2360
|
+
var position = _this._getPosition();
|
|
2265
2361
|
|
|
2266
2362
|
var currentTime = now();
|
|
2267
2363
|
var isDouble = !_this.isDrag && _this.doubleFlag;
|
|
@@ -2455,7 +2551,23 @@ function (_super) {
|
|
|
2455
2551
|
return this;
|
|
2456
2552
|
};
|
|
2457
2553
|
/**
|
|
2458
|
-
*
|
|
2554
|
+
* Get the current event state while dragging.
|
|
2555
|
+
*/
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
__proto.getCurrentEvent = function (inputEvent) {
|
|
2559
|
+
return __assign({
|
|
2560
|
+
datas: this.datas
|
|
2561
|
+
}, this._getPosition(), {
|
|
2562
|
+
movement: this.getMovement(),
|
|
2563
|
+
isDrag: this.isDrag,
|
|
2564
|
+
isPinch: this.isPinch,
|
|
2565
|
+
isScroll: false,
|
|
2566
|
+
inputEvent: inputEvent
|
|
2567
|
+
});
|
|
2568
|
+
};
|
|
2569
|
+
/**
|
|
2570
|
+
* Get & Set the event data while dragging.
|
|
2459
2571
|
*/
|
|
2460
2572
|
|
|
2461
2573
|
|
|
@@ -2571,9 +2683,12 @@ function (_super) {
|
|
|
2571
2683
|
};
|
|
2572
2684
|
|
|
2573
2685
|
__proto.moveClients = function (clients, inputEvent, isAdd) {
|
|
2574
|
-
var
|
|
2575
|
-
|
|
2576
|
-
|
|
2686
|
+
var position = this._getPosition(clients, isAdd);
|
|
2687
|
+
|
|
2688
|
+
if (position.deltaX || position.deltaY) {
|
|
2689
|
+
this.isDrag = true;
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2577
2692
|
return __assign({
|
|
2578
2693
|
datas: this.datas
|
|
2579
2694
|
}, position, {
|
|
@@ -2585,12 +2700,31 @@ function (_super) {
|
|
|
2585
2700
|
});
|
|
2586
2701
|
};
|
|
2587
2702
|
|
|
2703
|
+
__proto._getPosition = function (clients, isAdd) {
|
|
2704
|
+
var store = this.getCurrentStore();
|
|
2705
|
+
var position = store.getPosition(clients, isAdd);
|
|
2706
|
+
|
|
2707
|
+
var _a = this.clientStores.slice(1).reduce(function (prev, cur) {
|
|
2708
|
+
var storePosition = cur.getPosition();
|
|
2709
|
+
prev.distX += storePosition.distX;
|
|
2710
|
+
prev.distY += storePosition.distY;
|
|
2711
|
+
return prev;
|
|
2712
|
+
}, position),
|
|
2713
|
+
distX = _a.distX,
|
|
2714
|
+
distY = _a.distY;
|
|
2715
|
+
|
|
2716
|
+
return __assign({}, position, {
|
|
2717
|
+
distX: distX,
|
|
2718
|
+
distY: distY
|
|
2719
|
+
});
|
|
2720
|
+
};
|
|
2721
|
+
|
|
2588
2722
|
return Gesto;
|
|
2589
2723
|
}(EventEmitter$1);
|
|
2590
2724
|
|
|
2591
2725
|
var Gesto$1 = Gesto;
|
|
2592
2726
|
|
|
2593
|
-
const _sfc_main$
|
|
2727
|
+
const _sfc_main$g = defineComponent({
|
|
2594
2728
|
name: "m-editor-resize",
|
|
2595
2729
|
props: {
|
|
2596
2730
|
type: {
|
|
@@ -2632,33 +2766,33 @@ const _sfc_main$f = defineComponent({
|
|
|
2632
2766
|
};
|
|
2633
2767
|
}
|
|
2634
2768
|
});
|
|
2635
|
-
const _hoisted_1$
|
|
2769
|
+
const _hoisted_1$9 = {
|
|
2636
2770
|
ref: "target",
|
|
2637
2771
|
class: "m-editor-resizer"
|
|
2638
2772
|
};
|
|
2639
|
-
function _sfc_render$
|
|
2640
|
-
return openBlock(), createElementBlock("span", _hoisted_1$
|
|
2773
|
+
function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2774
|
+
return openBlock(), createElementBlock("span", _hoisted_1$9, [
|
|
2641
2775
|
renderSlot(_ctx.$slots, "default")
|
|
2642
2776
|
], 512);
|
|
2643
2777
|
}
|
|
2644
|
-
var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2778
|
+
var Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g]]);
|
|
2645
2779
|
|
|
2646
|
-
const _sfc_main$
|
|
2780
|
+
const _sfc_main$f = defineComponent({
|
|
2647
2781
|
components: {
|
|
2648
2782
|
AddPageBox,
|
|
2649
2783
|
Resizer
|
|
2650
2784
|
},
|
|
2651
2785
|
setup() {
|
|
2652
|
-
const
|
|
2653
|
-
const root = computed(() =>
|
|
2786
|
+
const { editorService, uiService } = inject("services") || {};
|
|
2787
|
+
const root = computed(() => editorService?.get("root"));
|
|
2654
2788
|
return {
|
|
2655
2789
|
root,
|
|
2656
|
-
pageLength: computed(() =>
|
|
2657
|
-
showSrc: computed(() =>
|
|
2658
|
-
columnWidth: computed(() =>
|
|
2790
|
+
pageLength: computed(() => editorService?.get("pageLength") || 0),
|
|
2791
|
+
showSrc: computed(() => uiService?.get("showSrc")),
|
|
2792
|
+
columnWidth: computed(() => uiService?.get("columnWidth")),
|
|
2659
2793
|
saveCode(value) {
|
|
2660
2794
|
try {
|
|
2661
|
-
|
|
2795
|
+
editorService?.set("root", eval(value));
|
|
2662
2796
|
} catch (e) {
|
|
2663
2797
|
console.error(e);
|
|
2664
2798
|
}
|
|
@@ -2666,24 +2800,24 @@ const _sfc_main$e = defineComponent({
|
|
|
2666
2800
|
};
|
|
2667
2801
|
}
|
|
2668
2802
|
});
|
|
2669
|
-
const _hoisted_1$
|
|
2670
|
-
const _hoisted_2$
|
|
2803
|
+
const _hoisted_1$8 = { class: "m-editor" };
|
|
2804
|
+
const _hoisted_2$3 = {
|
|
2671
2805
|
key: 1,
|
|
2672
2806
|
class: "m-editor-content"
|
|
2673
2807
|
};
|
|
2674
|
-
function _sfc_render$
|
|
2808
|
+
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2675
2809
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
2676
2810
|
const _component_resizer = resolveComponent("resizer");
|
|
2677
2811
|
const _component_el_scrollbar = resolveComponent("el-scrollbar");
|
|
2678
2812
|
const _component_add_page_box = resolveComponent("add-page-box");
|
|
2679
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2813
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
2680
2814
|
renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2681
2815
|
_ctx.showSrc ? (openBlock(), createBlock(_component_magic_code_editor, {
|
|
2682
2816
|
key: 0,
|
|
2683
2817
|
class: "m-editor-content",
|
|
2684
2818
|
"init-values": _ctx.root,
|
|
2685
2819
|
onSave: _ctx.saveCode
|
|
2686
|
-
}, null, 8, ["init-values", "onSave"])) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
2820
|
+
}, null, 8, ["init-values", "onSave"])) : (openBlock(), createElementBlock("div", _hoisted_2$3, [
|
|
2687
2821
|
createElementVNode("div", {
|
|
2688
2822
|
class: "m-editor-framework-left",
|
|
2689
2823
|
style: normalizeStyle(`width: ${_ctx.columnWidth?.left}px`)
|
|
@@ -2716,9 +2850,9 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2716
2850
|
]))
|
|
2717
2851
|
]);
|
|
2718
2852
|
}
|
|
2719
|
-
var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2853
|
+
var Framework = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$f]]);
|
|
2720
2854
|
|
|
2721
|
-
const _sfc_main$
|
|
2855
|
+
const _sfc_main$e = defineComponent({
|
|
2722
2856
|
name: "m-icon",
|
|
2723
2857
|
components: { Edit },
|
|
2724
2858
|
props: {
|
|
@@ -2732,8 +2866,8 @@ const _sfc_main$d = defineComponent({
|
|
|
2732
2866
|
};
|
|
2733
2867
|
}
|
|
2734
2868
|
});
|
|
2735
|
-
const _hoisted_1$
|
|
2736
|
-
function _sfc_render$
|
|
2869
|
+
const _hoisted_1$7 = ["src"];
|
|
2870
|
+
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2737
2871
|
const _component_edit = resolveComponent("edit");
|
|
2738
2872
|
const _component_el_icon = resolveComponent("el-icon");
|
|
2739
2873
|
return !_ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
|
|
@@ -2744,7 +2878,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2744
2878
|
})) : typeof _ctx.icon === "string" && _ctx.icon.startsWith("http") ? (openBlock(), createElementBlock("img", {
|
|
2745
2879
|
key: 1,
|
|
2746
2880
|
src: _ctx.icon
|
|
2747
|
-
}, null, 8, _hoisted_1$
|
|
2881
|
+
}, null, 8, _hoisted_1$7)) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
2748
2882
|
key: 2,
|
|
2749
2883
|
class: normalizeClass(_ctx.icon)
|
|
2750
2884
|
}, null, 2)) : (openBlock(), createBlock(_component_el_icon, { key: 3 }, {
|
|
@@ -2754,9 +2888,9 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2754
2888
|
_: 1
|
|
2755
2889
|
}));
|
|
2756
2890
|
}
|
|
2757
|
-
var MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2891
|
+
var MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
|
|
2758
2892
|
|
|
2759
|
-
const _sfc_main$
|
|
2893
|
+
const _sfc_main$d = defineComponent({
|
|
2760
2894
|
components: { MIcon, ArrowDown },
|
|
2761
2895
|
props: {
|
|
2762
2896
|
data: {
|
|
@@ -2766,16 +2900,20 @@ const _sfc_main$c = defineComponent({
|
|
|
2766
2900
|
type: "text",
|
|
2767
2901
|
display: false
|
|
2768
2902
|
})
|
|
2903
|
+
},
|
|
2904
|
+
eventType: {
|
|
2905
|
+
type: String,
|
|
2906
|
+
default: "click"
|
|
2769
2907
|
}
|
|
2770
2908
|
},
|
|
2771
2909
|
setup(props) {
|
|
2772
2910
|
const services = inject("services");
|
|
2773
2911
|
const uiService = services?.uiService;
|
|
2774
|
-
const zoomInHandler = () => uiService?.set("zoom", zoom.value + 0.1);
|
|
2775
|
-
const zoomOutHandler = () => uiService?.set("zoom", zoom.value - 0.1);
|
|
2776
2912
|
const zoom = computed(() => uiService?.get("zoom") ?? 1);
|
|
2777
2913
|
const showGuides = computed(() => uiService?.get("showGuides") ?? true);
|
|
2778
2914
|
const showRule = computed(() => uiService?.get("showRule") ?? true);
|
|
2915
|
+
const zoomInHandler = () => uiService?.zoom(0.1);
|
|
2916
|
+
const zoomOutHandler = () => uiService?.zoom(-0.1);
|
|
2779
2917
|
const item = computed(() => {
|
|
2780
2918
|
if (typeof props.data !== "string") {
|
|
2781
2919
|
return props.data;
|
|
@@ -2792,7 +2930,7 @@ const _sfc_main$c = defineComponent({
|
|
|
2792
2930
|
case "delete":
|
|
2793
2931
|
return {
|
|
2794
2932
|
type: "button",
|
|
2795
|
-
icon: Delete,
|
|
2933
|
+
icon: markRaw(Delete),
|
|
2796
2934
|
tooltip: "\u522A\u9664",
|
|
2797
2935
|
disabled: () => services?.editorService.get("node")?.type === NodeType.PAGE,
|
|
2798
2936
|
handler: () => services?.editorService.remove(services?.editorService.get("node"))
|
|
@@ -2800,7 +2938,7 @@ const _sfc_main$c = defineComponent({
|
|
|
2800
2938
|
case "undo":
|
|
2801
2939
|
return {
|
|
2802
2940
|
type: "button",
|
|
2803
|
-
icon: Back,
|
|
2941
|
+
icon: markRaw(Back),
|
|
2804
2942
|
tooltip: "\u540E\u9000",
|
|
2805
2943
|
disabled: () => !services?.historyService.state.canUndo,
|
|
2806
2944
|
handler: () => services?.editorService.undo()
|
|
@@ -2808,7 +2946,7 @@ const _sfc_main$c = defineComponent({
|
|
|
2808
2946
|
case "redo":
|
|
2809
2947
|
return {
|
|
2810
2948
|
type: "button",
|
|
2811
|
-
icon: Right,
|
|
2949
|
+
icon: markRaw(Right),
|
|
2812
2950
|
tooltip: "\u524D\u8FDB",
|
|
2813
2951
|
disabled: () => !services?.historyService.state.canRedo,
|
|
2814
2952
|
handler: () => services?.editorService.redo()
|
|
@@ -2816,28 +2954,28 @@ const _sfc_main$c = defineComponent({
|
|
|
2816
2954
|
case "zoom-in":
|
|
2817
2955
|
return {
|
|
2818
2956
|
type: "button",
|
|
2819
|
-
icon: ZoomIn,
|
|
2957
|
+
icon: markRaw(ZoomIn),
|
|
2820
2958
|
tooltip: "\u653E\u5927",
|
|
2821
2959
|
handler: zoomInHandler
|
|
2822
2960
|
};
|
|
2823
2961
|
case "zoom-out":
|
|
2824
2962
|
return {
|
|
2825
2963
|
type: "button",
|
|
2826
|
-
icon: ZoomOut,
|
|
2964
|
+
icon: markRaw(ZoomOut),
|
|
2827
2965
|
tooltip: "\u7E2E\u5C0F",
|
|
2828
2966
|
handler: zoomOutHandler
|
|
2829
2967
|
};
|
|
2830
2968
|
case "rule":
|
|
2831
2969
|
return {
|
|
2832
2970
|
type: "button",
|
|
2833
|
-
icon: ScaleToOriginal,
|
|
2971
|
+
icon: markRaw(ScaleToOriginal),
|
|
2834
2972
|
tooltip: showRule.value ? "\u9690\u85CF\u6807\u5C3A" : "\u663E\u793A\u6807\u5C3A",
|
|
2835
2973
|
handler: () => uiService?.set("showRule", !showRule.value)
|
|
2836
2974
|
};
|
|
2837
2975
|
case "guides":
|
|
2838
2976
|
return {
|
|
2839
2977
|
type: "button",
|
|
2840
|
-
icon: Grid,
|
|
2978
|
+
icon: markRaw(Grid),
|
|
2841
2979
|
tooltip: showGuides.value ? "\u9690\u85CF\u53C2\u8003\u7EBF" : "\u663E\u793A\u53C2\u8003\u7EBF",
|
|
2842
2980
|
handler: () => uiService?.set("showGuides", !showGuides.value)
|
|
2843
2981
|
};
|
|
@@ -2858,9 +2996,16 @@ const _sfc_main$c = defineComponent({
|
|
|
2858
2996
|
}
|
|
2859
2997
|
return item.value.disabled;
|
|
2860
2998
|
});
|
|
2999
|
+
const buttonHandler = (item2, event) => {
|
|
3000
|
+
if (disabled.value)
|
|
3001
|
+
return;
|
|
3002
|
+
if (typeof item2.handler === "function" && services) {
|
|
3003
|
+
item2.handler?.(services, event);
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
2861
3006
|
return {
|
|
2862
|
-
ZoomIn,
|
|
2863
|
-
ZoomOut,
|
|
3007
|
+
ZoomIn: markRaw(ZoomIn),
|
|
3008
|
+
ZoomOut: markRaw(ZoomOut),
|
|
2864
3009
|
item,
|
|
2865
3010
|
zoom,
|
|
2866
3011
|
disabled,
|
|
@@ -2881,31 +3026,42 @@ const _sfc_main$c = defineComponent({
|
|
|
2881
3026
|
command.item.handler(services);
|
|
2882
3027
|
}
|
|
2883
3028
|
},
|
|
2884
|
-
|
|
2885
|
-
if (
|
|
3029
|
+
clickHandler(item2, event) {
|
|
3030
|
+
if (props.eventType !== "click")
|
|
2886
3031
|
return;
|
|
2887
|
-
if (
|
|
2888
|
-
item2
|
|
3032
|
+
if (item2.type === "button") {
|
|
3033
|
+
buttonHandler(item2, event);
|
|
3034
|
+
}
|
|
3035
|
+
},
|
|
3036
|
+
mousedownHandler(item2, event) {
|
|
3037
|
+
if (props.eventType !== "mousedown")
|
|
3038
|
+
return;
|
|
3039
|
+
if (item2.type === "button") {
|
|
3040
|
+
buttonHandler(item2, event);
|
|
3041
|
+
}
|
|
3042
|
+
},
|
|
3043
|
+
mouseupHandler(item2, event) {
|
|
3044
|
+
if (props.eventType !== "mouseup")
|
|
3045
|
+
return;
|
|
3046
|
+
if (item2.type === "button") {
|
|
3047
|
+
buttonHandler(item2, event);
|
|
2889
3048
|
}
|
|
2890
3049
|
}
|
|
2891
3050
|
};
|
|
2892
3051
|
}
|
|
2893
3052
|
});
|
|
2894
|
-
const _hoisted_1$
|
|
2895
|
-
key: 0,
|
|
2896
|
-
class: "menu-item"
|
|
2897
|
-
};
|
|
2898
|
-
const _hoisted_2$4 = {
|
|
3053
|
+
const _hoisted_1$6 = {
|
|
2899
3054
|
key: 1,
|
|
2900
3055
|
class: "menu-item-text"
|
|
2901
3056
|
};
|
|
2902
|
-
const
|
|
3057
|
+
const _hoisted_2$2 = {
|
|
2903
3058
|
class: "menu-item-text",
|
|
2904
3059
|
style: { "margin": "0 5px" }
|
|
2905
3060
|
};
|
|
2906
|
-
const
|
|
2907
|
-
function _sfc_render$
|
|
3061
|
+
const _hoisted_3$1 = { class: "el-dropdown-link menubar-menu-button" };
|
|
3062
|
+
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2908
3063
|
const _component_el_divider = resolveComponent("el-divider");
|
|
3064
|
+
const _component_tool_button = resolveComponent("tool-button", true);
|
|
2909
3065
|
const _component_m_icon = resolveComponent("m-icon");
|
|
2910
3066
|
const _component_el_button = resolveComponent("el-button");
|
|
2911
3067
|
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
@@ -2914,60 +3070,66 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2914
3070
|
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
2915
3071
|
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
2916
3072
|
const _component_el_dropdown = resolveComponent("el-dropdown");
|
|
2917
|
-
return _ctx.display ? (openBlock(), createElementBlock("div",
|
|
3073
|
+
return _ctx.display ? (openBlock(), createElementBlock("div", {
|
|
3074
|
+
key: 0,
|
|
3075
|
+
class: normalizeClass(["menu-item", _ctx.item.type]),
|
|
3076
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.clickHandler(_ctx.item, $event)),
|
|
3077
|
+
onMousedown: _cache[1] || (_cache[1] = ($event) => _ctx.mousedownHandler(_ctx.item, $event)),
|
|
3078
|
+
onMouseup: _cache[2] || (_cache[2] = ($event) => _ctx.mouseupHandler(_ctx.item, $event))
|
|
3079
|
+
}, [
|
|
2918
3080
|
_ctx.item.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
|
|
2919
3081
|
key: 0,
|
|
2920
|
-
direction: "vertical"
|
|
2921
|
-
})) : _ctx.item.type === "text" ? (openBlock(), createElementBlock("div",
|
|
2922
|
-
createVNode(
|
|
2923
|
-
|
|
2924
|
-
type:
|
|
3082
|
+
direction: _ctx.item.direction || "vertical"
|
|
3083
|
+
}, null, 8, ["direction"])) : _ctx.item.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$6, toDisplayString(_ctx.item.text), 1)) : _ctx.item.type === "zoom" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
3084
|
+
createVNode(_component_tool_button, {
|
|
3085
|
+
data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
|
|
3086
|
+
"event-type": _ctx.eventType
|
|
3087
|
+
}, null, 8, ["data", "event-type"]),
|
|
3088
|
+
createElementVNode("span", _hoisted_2$2, toDisplayString(parseInt(`${_ctx.zoom * 100}`, 10)) + "%", 1),
|
|
3089
|
+
createVNode(_component_tool_button, {
|
|
3090
|
+
data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
|
|
3091
|
+
"event-type": _ctx.eventType
|
|
3092
|
+
}, null, 8, ["data", "event-type"])
|
|
3093
|
+
], 64)) : _ctx.item.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
3094
|
+
_ctx.item.tooltip ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
3095
|
+
key: 0,
|
|
3096
|
+
effect: "dark",
|
|
3097
|
+
placement: "bottom-start",
|
|
3098
|
+
content: _ctx.item.tooltip
|
|
2925
3099
|
}, {
|
|
2926
3100
|
default: withCtx(() => [
|
|
2927
|
-
createVNode(
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
3101
|
+
createVNode(_component_el_button, {
|
|
3102
|
+
size: "small",
|
|
3103
|
+
text: "",
|
|
3104
|
+
disabled: _ctx.disabled
|
|
3105
|
+
}, {
|
|
3106
|
+
default: withCtx(() => [
|
|
3107
|
+
_ctx.item.icon ? (openBlock(), createBlock(_component_m_icon, {
|
|
3108
|
+
key: 0,
|
|
3109
|
+
icon: _ctx.item.icon
|
|
3110
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
3111
|
+
createElementVNode("span", null, toDisplayString(_ctx.item.text), 1)
|
|
3112
|
+
]),
|
|
3113
|
+
_: 1
|
|
3114
|
+
}, 8, ["disabled"])
|
|
2931
3115
|
]),
|
|
2932
3116
|
_: 1
|
|
2933
|
-
}),
|
|
2934
|
-
|
|
2935
|
-
createVNode(_component_el_button, {
|
|
3117
|
+
}, 8, ["content"])) : (openBlock(), createBlock(_component_el_button, {
|
|
3118
|
+
key: 1,
|
|
2936
3119
|
size: "small",
|
|
2937
|
-
|
|
3120
|
+
text: "",
|
|
3121
|
+
disabled: _ctx.disabled
|
|
2938
3122
|
}, {
|
|
2939
3123
|
default: withCtx(() => [
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
}, null, 8, ["icon"
|
|
3124
|
+
_ctx.item.icon ? (openBlock(), createBlock(_component_m_icon, {
|
|
3125
|
+
key: 0,
|
|
3126
|
+
icon: _ctx.item.icon
|
|
3127
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
3128
|
+
createElementVNode("span", null, toDisplayString(_ctx.item.text), 1)
|
|
2944
3129
|
]),
|
|
2945
3130
|
_: 1
|
|
2946
|
-
})
|
|
2947
|
-
], 64)) : _ctx.item.type === "
|
|
2948
|
-
key: 3,
|
|
2949
|
-
effect: "dark",
|
|
2950
|
-
placement: "bottom-start",
|
|
2951
|
-
content: _ctx.item.tooltip || _ctx.item.text
|
|
2952
|
-
}, {
|
|
2953
|
-
default: withCtx(() => [
|
|
2954
|
-
createVNode(_component_el_button, {
|
|
2955
|
-
size: "small",
|
|
2956
|
-
type: "text",
|
|
2957
|
-
disabled: _ctx.disabled,
|
|
2958
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.buttonHandler(_ctx.item))
|
|
2959
|
-
}, {
|
|
2960
|
-
default: withCtx(() => [
|
|
2961
|
-
createVNode(_component_m_icon, {
|
|
2962
|
-
icon: _ctx.item.icon
|
|
2963
|
-
}, null, 8, ["icon"]),
|
|
2964
|
-
createElementVNode("span", null, toDisplayString(_ctx.item.text), 1)
|
|
2965
|
-
]),
|
|
2966
|
-
_: 1
|
|
2967
|
-
}, 8, ["disabled"])
|
|
2968
|
-
]),
|
|
2969
|
-
_: 1
|
|
2970
|
-
}, 8, ["content"])) : _ctx.item.type === "dropdown" ? (openBlock(), createBlock(_component_el_dropdown, {
|
|
3131
|
+
}, 8, ["disabled"]))
|
|
3132
|
+
], 64)) : _ctx.item.type === "dropdown" ? (openBlock(), createBlock(_component_el_dropdown, {
|
|
2971
3133
|
key: 4,
|
|
2972
3134
|
trigger: "click",
|
|
2973
3135
|
disabled: _ctx.disabled,
|
|
@@ -2992,7 +3154,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2992
3154
|
})) : createCommentVNode("", true)
|
|
2993
3155
|
]),
|
|
2994
3156
|
default: withCtx(() => [
|
|
2995
|
-
createElementVNode("span",
|
|
3157
|
+
createElementVNode("span", _hoisted_3$1, [
|
|
2996
3158
|
createTextVNode(toDisplayString(_ctx.item.text), 1),
|
|
2997
3159
|
createVNode(_component_el_icon, { class: "el-icon--right" }, {
|
|
2998
3160
|
default: withCtx(() => [
|
|
@@ -3004,11 +3166,11 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3004
3166
|
]),
|
|
3005
3167
|
_: 1
|
|
3006
3168
|
}, 8, ["disabled", "onCommand"])) : _ctx.item.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.item.component), normalizeProps(mergeProps({ key: 5 }, _ctx.item.props || {})), null, 16)) : createCommentVNode("", true)
|
|
3007
|
-
])) : createCommentVNode("", true);
|
|
3169
|
+
], 34)) : createCommentVNode("", true);
|
|
3008
3170
|
}
|
|
3009
|
-
var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3171
|
+
var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d]]);
|
|
3010
3172
|
|
|
3011
|
-
const _sfc_main$
|
|
3173
|
+
const _sfc_main$c = defineComponent({
|
|
3012
3174
|
name: "nav-menu",
|
|
3013
3175
|
components: { ToolButton },
|
|
3014
3176
|
props: {
|
|
@@ -3028,7 +3190,7 @@ const _sfc_main$b = defineComponent({
|
|
|
3028
3190
|
};
|
|
3029
3191
|
}
|
|
3030
3192
|
});
|
|
3031
|
-
function _sfc_render$
|
|
3193
|
+
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3032
3194
|
const _component_tool_button = resolveComponent("tool-button");
|
|
3033
3195
|
return openBlock(), createElementBlock("div", {
|
|
3034
3196
|
class: "m-editor-nav-menu",
|
|
@@ -3050,9 +3212,9 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3050
3212
|
}), 128))
|
|
3051
3213
|
], 4);
|
|
3052
3214
|
}
|
|
3053
|
-
var NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3215
|
+
var NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
|
|
3054
3216
|
|
|
3055
|
-
const _sfc_main$
|
|
3217
|
+
const _sfc_main$b = defineComponent({
|
|
3056
3218
|
name: "m-editor-props-panel",
|
|
3057
3219
|
emits: ["mounted"],
|
|
3058
3220
|
setup(props, { emit }) {
|
|
@@ -3098,7 +3260,7 @@ const _sfc_main$a = defineComponent({
|
|
|
3098
3260
|
};
|
|
3099
3261
|
}
|
|
3100
3262
|
});
|
|
3101
|
-
function _sfc_render$
|
|
3263
|
+
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3102
3264
|
const _component_m_form = resolveComponent("m-form");
|
|
3103
3265
|
return openBlock(), createBlock(_component_m_form, {
|
|
3104
3266
|
class: "m-editor-props-panel",
|
|
@@ -3110,9 +3272,9 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3110
3272
|
onChange: _ctx.submit
|
|
3111
3273
|
}, null, 8, ["init-values", "config", "onChange"]);
|
|
3112
3274
|
}
|
|
3113
|
-
var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3275
|
+
var PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
|
|
3114
3276
|
|
|
3115
|
-
const _sfc_main$
|
|
3277
|
+
const _sfc_main$a = defineComponent({
|
|
3116
3278
|
name: "ui-component-panel",
|
|
3117
3279
|
components: { MIcon },
|
|
3118
3280
|
setup() {
|
|
@@ -3133,13 +3295,23 @@ const _sfc_main$9 = defineComponent({
|
|
|
3133
3295
|
type,
|
|
3134
3296
|
...data
|
|
3135
3297
|
});
|
|
3298
|
+
},
|
|
3299
|
+
dragstartHandler({ text, type, data = {} }, e) {
|
|
3300
|
+
if (e.dataTransfer) {
|
|
3301
|
+
e.dataTransfer.effectAllowed = "move";
|
|
3302
|
+
e.dataTransfer.setData("data", serialize({
|
|
3303
|
+
name: text,
|
|
3304
|
+
type,
|
|
3305
|
+
...data
|
|
3306
|
+
}).replace(/"(\w+)":\s/g, "$1: "));
|
|
3307
|
+
}
|
|
3136
3308
|
}
|
|
3137
3309
|
};
|
|
3138
3310
|
}
|
|
3139
3311
|
});
|
|
3140
|
-
const _hoisted_1$
|
|
3141
|
-
const _hoisted_2$
|
|
3142
|
-
function _sfc_render$
|
|
3312
|
+
const _hoisted_1$5 = /* @__PURE__ */ createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
|
|
3313
|
+
const _hoisted_2$1 = ["onClick", "onDragstart"];
|
|
3314
|
+
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3143
3315
|
const _component_el_input = resolveComponent("el-input");
|
|
3144
3316
|
const _component_m_icon = resolveComponent("m-icon");
|
|
3145
3317
|
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
@@ -3169,15 +3341,17 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3169
3341
|
name: index
|
|
3170
3342
|
}, {
|
|
3171
3343
|
title: withCtx(() => [
|
|
3172
|
-
_hoisted_1$
|
|
3344
|
+
_hoisted_1$5,
|
|
3173
3345
|
createTextVNode(toDisplayString(group.title), 1)
|
|
3174
3346
|
]),
|
|
3175
3347
|
default: withCtx(() => [
|
|
3176
3348
|
(openBlock(true), createElementBlock(Fragment, null, renderList(group.items, (item) => {
|
|
3177
3349
|
return openBlock(), createElementBlock("div", {
|
|
3178
3350
|
class: "component-item",
|
|
3351
|
+
draggable: "true",
|
|
3179
3352
|
key: item.type,
|
|
3180
|
-
onClick: ($event) => _ctx.appendComponent(item)
|
|
3353
|
+
onClick: ($event) => _ctx.appendComponent(item),
|
|
3354
|
+
onDragstart: ($event) => _ctx.dragstartHandler(item, $event)
|
|
3181
3355
|
}, [
|
|
3182
3356
|
createVNode(_component_m_icon, {
|
|
3183
3357
|
icon: item.icon
|
|
@@ -3192,7 +3366,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3192
3366
|
]),
|
|
3193
3367
|
_: 2
|
|
3194
3368
|
}, 1032, ["content"])
|
|
3195
|
-
],
|
|
3369
|
+
], 40, _hoisted_2$1);
|
|
3196
3370
|
}), 128))
|
|
3197
3371
|
]),
|
|
3198
3372
|
_: 2
|
|
@@ -3206,98 +3380,194 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3206
3380
|
_: 1
|
|
3207
3381
|
});
|
|
3208
3382
|
}
|
|
3209
|
-
var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
3383
|
+
var ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
|
|
3384
|
+
|
|
3385
|
+
const _sfc_main$9 = defineComponent({
|
|
3386
|
+
components: { ToolButton },
|
|
3387
|
+
props: {
|
|
3388
|
+
menuData: {
|
|
3389
|
+
type: Array,
|
|
3390
|
+
default: () => []
|
|
3391
|
+
}
|
|
3392
|
+
},
|
|
3393
|
+
setup() {
|
|
3394
|
+
const menu = ref();
|
|
3395
|
+
const subMenu = ref();
|
|
3396
|
+
const visible = ref(false);
|
|
3397
|
+
const subMenuData = ref([]);
|
|
3398
|
+
const menuStyle = ref({
|
|
3399
|
+
left: "0",
|
|
3400
|
+
top: "0"
|
|
3401
|
+
});
|
|
3402
|
+
const hide = () => {
|
|
3403
|
+
visible.value = false;
|
|
3404
|
+
};
|
|
3405
|
+
onMounted(() => {
|
|
3406
|
+
globalThis.addEventListener("mousedown", (e) => {
|
|
3407
|
+
if (!visible.value || e.target && menu.value?.contains(e.target)) {
|
|
3408
|
+
return;
|
|
3409
|
+
}
|
|
3410
|
+
hide();
|
|
3411
|
+
}, true);
|
|
3412
|
+
});
|
|
3413
|
+
return {
|
|
3414
|
+
menu,
|
|
3415
|
+
subMenu,
|
|
3416
|
+
visible,
|
|
3417
|
+
menuStyle,
|
|
3418
|
+
subMenuData,
|
|
3419
|
+
hide,
|
|
3420
|
+
show(e) {
|
|
3421
|
+
visible.value = true;
|
|
3422
|
+
nextTick(() => {
|
|
3423
|
+
const menuHeight = menu.value?.clientHeight || 0;
|
|
3424
|
+
let top = e.clientY;
|
|
3425
|
+
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
3426
|
+
top = document.body.clientHeight - menuHeight;
|
|
3427
|
+
}
|
|
3428
|
+
menuStyle.value = {
|
|
3429
|
+
top: `${top}px`,
|
|
3430
|
+
left: `${e.clientX}px`
|
|
3431
|
+
};
|
|
3432
|
+
});
|
|
3433
|
+
},
|
|
3434
|
+
showSubMenu(item) {
|
|
3435
|
+
const menuItem = item;
|
|
3436
|
+
if (typeof item !== "object" || !menuItem.items?.length) {
|
|
3437
|
+
return;
|
|
3438
|
+
}
|
|
3439
|
+
subMenuData.value = menuItem.items;
|
|
3440
|
+
if (menu.value) {
|
|
3441
|
+
subMenu.value.show({
|
|
3442
|
+
clientX: menu.value.offsetLeft + menu.value.clientWidth,
|
|
3443
|
+
clientY: menu.value.offsetTop
|
|
3444
|
+
});
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
};
|
|
3448
|
+
}
|
|
3449
|
+
});
|
|
3450
|
+
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3451
|
+
const _component_tool_button = resolveComponent("tool-button");
|
|
3452
|
+
const _component_content_menu = resolveComponent("content-menu", true);
|
|
3453
|
+
return _ctx.menuData.length ? withDirectives((openBlock(), createElementBlock("div", {
|
|
3454
|
+
key: 0,
|
|
3455
|
+
class: "magic-editor-content-menu",
|
|
3456
|
+
ref: "menu",
|
|
3457
|
+
style: normalizeStyle(_ctx.menuStyle)
|
|
3458
|
+
}, [
|
|
3459
|
+
createElementVNode("div", null, [
|
|
3460
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
3461
|
+
return openBlock(), createBlock(_component_tool_button, {
|
|
3462
|
+
"event-type": "mouseup",
|
|
3463
|
+
data: item,
|
|
3464
|
+
key: index,
|
|
3465
|
+
onMouseup: _ctx.hide,
|
|
3466
|
+
onMouseenter: ($event) => _ctx.showSubMenu(item)
|
|
3467
|
+
}, null, 8, ["data", "onMouseup", "onMouseenter"]);
|
|
3468
|
+
}), 128))
|
|
3469
|
+
]),
|
|
3470
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
3471
|
+
createVNode(_component_content_menu, {
|
|
3472
|
+
class: "sub-menu",
|
|
3473
|
+
ref: "subMenu",
|
|
3474
|
+
"menu-data": _ctx.subMenuData
|
|
3475
|
+
}, null, 8, ["menu-data"])
|
|
3476
|
+
]))
|
|
3477
|
+
], 4)), [
|
|
3478
|
+
[vShow, _ctx.visible]
|
|
3479
|
+
]) : createCommentVNode("", true);
|
|
3480
|
+
}
|
|
3481
|
+
var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
|
|
3210
3482
|
|
|
3211
3483
|
const _sfc_main$8 = defineComponent({
|
|
3212
|
-
|
|
3484
|
+
components: { ContentMenu },
|
|
3213
3485
|
setup() {
|
|
3214
3486
|
const services = inject("services");
|
|
3215
|
-
const
|
|
3487
|
+
const menu = ref();
|
|
3216
3488
|
const node = computed(() => services?.editorService.get("node"));
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3489
|
+
const isRoot = computed(() => node.value?.type === NodeType.ROOT);
|
|
3490
|
+
const isPage = computed(() => node.value?.type === NodeType.PAGE);
|
|
3491
|
+
const componentList = computed(() => services?.componentListService.getList() || []);
|
|
3492
|
+
const createMenuItems = (group) => group.items.map((component) => ({
|
|
3493
|
+
text: component.text,
|
|
3494
|
+
type: "button",
|
|
3495
|
+
icon: component.icon,
|
|
3496
|
+
handler: () => {
|
|
3222
3497
|
services?.editorService.add({
|
|
3223
|
-
name:
|
|
3224
|
-
type:
|
|
3225
|
-
...
|
|
3498
|
+
name: component.text,
|
|
3499
|
+
type: component.type,
|
|
3500
|
+
...component.data || {}
|
|
3226
3501
|
});
|
|
3227
|
-
}
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3502
|
+
}
|
|
3503
|
+
}));
|
|
3504
|
+
const getSubMenuData = computed(() => {
|
|
3505
|
+
if (node.value?.type === "tabs") {
|
|
3506
|
+
return [
|
|
3507
|
+
{
|
|
3508
|
+
text: "\u6807\u7B7E\u9875",
|
|
3509
|
+
type: "button",
|
|
3510
|
+
icon: Files,
|
|
3511
|
+
handler: () => {
|
|
3512
|
+
services?.editorService.add({
|
|
3513
|
+
type: "tab-pane"
|
|
3514
|
+
});
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
];
|
|
3518
|
+
}
|
|
3519
|
+
if (node.value?.items) {
|
|
3520
|
+
return componentList.value.reduce((subMenuData, group, index) => subMenuData.concat(createMenuItems(group), index < componentList.value.length - 1 ? [
|
|
3521
|
+
{
|
|
3522
|
+
type: "divider",
|
|
3523
|
+
direction: "horizontal"
|
|
3524
|
+
}
|
|
3525
|
+
] : []), []) || [];
|
|
3526
|
+
}
|
|
3527
|
+
return [];
|
|
3528
|
+
});
|
|
3529
|
+
return {
|
|
3530
|
+
menu,
|
|
3531
|
+
menuData: computed(() => [
|
|
3532
|
+
{
|
|
3533
|
+
type: "button",
|
|
3534
|
+
text: "\u65B0\u589E",
|
|
3535
|
+
icon: markRaw(Plus),
|
|
3536
|
+
display: () => node.value?.items,
|
|
3537
|
+
items: getSubMenuData.value
|
|
3538
|
+
},
|
|
3539
|
+
{
|
|
3540
|
+
type: "button",
|
|
3541
|
+
text: "\u590D\u5236",
|
|
3542
|
+
icon: markRaw(DocumentCopy),
|
|
3543
|
+
display: () => !isRoot.value,
|
|
3544
|
+
handler: () => {
|
|
3545
|
+
node.value && services?.editorService.copy(node.value);
|
|
3546
|
+
}
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
type: "button",
|
|
3550
|
+
text: "\u5220\u9664",
|
|
3551
|
+
icon: markRaw(Delete),
|
|
3552
|
+
display: () => !isRoot.value && !isPage.value,
|
|
3553
|
+
handler: () => {
|
|
3554
|
+
node.value && services?.editorService.remove(node.value);
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
]),
|
|
3558
|
+
show(e) {
|
|
3559
|
+
menu.value?.show(e);
|
|
3236
3560
|
}
|
|
3237
3561
|
};
|
|
3238
3562
|
}
|
|
3239
3563
|
});
|
|
3240
|
-
const _hoisted_1$6 = {
|
|
3241
|
-
key: 0,
|
|
3242
|
-
class: "magic-editor-content-menu"
|
|
3243
|
-
};
|
|
3244
|
-
const _hoisted_2$2 = ["onClick"];
|
|
3245
|
-
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("div", { class: "separation" }, null, -1);
|
|
3246
3564
|
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3247
|
-
const
|
|
3248
|
-
return
|
|
3249
|
-
_ctx.
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
onMouseleave: _cache[1] || (_cache[1] = ($event) => _ctx.setSubVisitable(false))
|
|
3254
|
-
}, " \u65B0\u589E ", 32)) : createCommentVNode("", true),
|
|
3255
|
-
_ctx.node.type !== "app" ? (openBlock(), createElementBlock("div", {
|
|
3256
|
-
key: 1,
|
|
3257
|
-
class: "magic-editor-content-menu-item",
|
|
3258
|
-
onClick: _cache[2] || (_cache[2] = () => _ctx.copy(_ctx.node))
|
|
3259
|
-
}, "\u590D\u5236")) : createCommentVNode("", true),
|
|
3260
|
-
_ctx.node.type !== "app" && _ctx.node.type !== "page" ? (openBlock(), createElementBlock("div", {
|
|
3261
|
-
key: 2,
|
|
3262
|
-
class: "magic-editor-content-menu-item",
|
|
3263
|
-
onClick: _cache[3] || (_cache[3] = () => _ctx.remove())
|
|
3264
|
-
}, " \u5220\u9664 ")) : createCommentVNode("", true),
|
|
3265
|
-
withDirectives(createElementVNode("div", {
|
|
3266
|
-
class: "subMenu",
|
|
3267
|
-
onMouseenter: _cache[5] || (_cache[5] = ($event) => _ctx.setSubVisitable(true)),
|
|
3268
|
-
onMouseleave: _cache[6] || (_cache[6] = ($event) => _ctx.setSubVisitable(false))
|
|
3269
|
-
}, [
|
|
3270
|
-
createVNode(_component_el_scrollbar, null, {
|
|
3271
|
-
default: withCtx(() => [
|
|
3272
|
-
_ctx.node.type === "tabs" ? (openBlock(), createElementBlock("div", {
|
|
3273
|
-
key: 0,
|
|
3274
|
-
class: "magic-editor-content-menu-item",
|
|
3275
|
-
onClick: _cache[4] || (_cache[4] = () => _ctx.append({
|
|
3276
|
-
type: "tab-pane"
|
|
3277
|
-
}))
|
|
3278
|
-
}, " \u6807\u7B7E ")) : _ctx.node.items ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.componentGroupList, (list) => {
|
|
3279
|
-
return openBlock(), createElementBlock("div", {
|
|
3280
|
-
key: list.title
|
|
3281
|
-
}, [
|
|
3282
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(list.items, (item) => {
|
|
3283
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
3284
|
-
item ? (openBlock(), createElementBlock("div", {
|
|
3285
|
-
class: "magic-editor-content-menu-item",
|
|
3286
|
-
key: item.type,
|
|
3287
|
-
onClick: () => _ctx.append(item)
|
|
3288
|
-
}, toDisplayString(item.text), 9, _hoisted_2$2)) : createCommentVNode("", true)
|
|
3289
|
-
], 64);
|
|
3290
|
-
}), 256)),
|
|
3291
|
-
_hoisted_3$2
|
|
3292
|
-
]);
|
|
3293
|
-
}), 128)) : createCommentVNode("", true)
|
|
3294
|
-
]),
|
|
3295
|
-
_: 1
|
|
3296
|
-
})
|
|
3297
|
-
], 544), [
|
|
3298
|
-
[vShow, _ctx.subVisible]
|
|
3299
|
-
])
|
|
3300
|
-
])) : createCommentVNode("", true);
|
|
3565
|
+
const _component_content_menu = resolveComponent("content-menu");
|
|
3566
|
+
return openBlock(), createBlock(_component_content_menu, {
|
|
3567
|
+
"menu-data": _ctx.menuData,
|
|
3568
|
+
ref: "menu",
|
|
3569
|
+
style: { "overflow": "initial" }
|
|
3570
|
+
}, null, 8, ["menu-data"]);
|
|
3301
3571
|
}
|
|
3302
3572
|
var LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
|
|
3303
3573
|
|
|
@@ -3391,56 +3661,37 @@ const useFilter = (tree) => ({
|
|
|
3391
3661
|
tree.value?.filter(val);
|
|
3392
3662
|
}
|
|
3393
3663
|
});
|
|
3394
|
-
const useContentMenu = (editorService) => {
|
|
3395
|
-
const menuStyle = ref({
|
|
3396
|
-
position: "absolute",
|
|
3397
|
-
left: "0",
|
|
3398
|
-
top: "0",
|
|
3399
|
-
display: "none"
|
|
3400
|
-
});
|
|
3401
|
-
onMounted(() => {
|
|
3402
|
-
document.addEventListener("click", () => {
|
|
3403
|
-
menuStyle.value.display = "none";
|
|
3404
|
-
}, true);
|
|
3405
|
-
});
|
|
3406
|
-
return {
|
|
3407
|
-
menuStyle,
|
|
3408
|
-
contextmenu(event, data) {
|
|
3409
|
-
const bodyHeight = globalThis.document.body.clientHeight;
|
|
3410
|
-
const left = `${event.clientX + 20}px`;
|
|
3411
|
-
let top = `${event.clientY - 10}px`;
|
|
3412
|
-
if (event.clientY + 300 > bodyHeight) {
|
|
3413
|
-
top = `${bodyHeight - 300}px`;
|
|
3414
|
-
}
|
|
3415
|
-
menuStyle.value.left = left;
|
|
3416
|
-
menuStyle.value.top = top;
|
|
3417
|
-
menuStyle.value.display = "";
|
|
3418
|
-
select(data, editorService);
|
|
3419
|
-
}
|
|
3420
|
-
};
|
|
3421
|
-
};
|
|
3422
3664
|
const _sfc_main$7 = defineComponent({
|
|
3423
3665
|
name: "magic-editor-layer-panel",
|
|
3424
3666
|
components: { LayerMenu },
|
|
3425
3667
|
setup() {
|
|
3426
3668
|
const services = inject("services");
|
|
3427
3669
|
const tree = ref();
|
|
3670
|
+
const menu = ref();
|
|
3428
3671
|
const clicked = ref(false);
|
|
3429
3672
|
const editorService = services?.editorService;
|
|
3430
3673
|
const highlightHandler = throttle((data) => {
|
|
3431
3674
|
highlight(data, editorService);
|
|
3432
3675
|
}, throttleTime);
|
|
3433
|
-
const
|
|
3676
|
+
const toggleClickFlag = () => {
|
|
3434
3677
|
clicked.value = !clicked.value;
|
|
3435
3678
|
};
|
|
3436
3679
|
const statusData = useStatus(tree, editorService);
|
|
3437
3680
|
const canHighlight = computed(() => statusData.highlightNode.value?.id !== statusData.clickNode.value?.id && !clicked.value);
|
|
3681
|
+
editorService?.on("remove", () => {
|
|
3682
|
+
setTimeout(() => {
|
|
3683
|
+
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
3684
|
+
}, 0);
|
|
3685
|
+
});
|
|
3438
3686
|
return {
|
|
3439
3687
|
tree,
|
|
3688
|
+
menu,
|
|
3440
3689
|
...statusData,
|
|
3441
3690
|
...useDrop(tree, editorService),
|
|
3442
3691
|
...useFilter(tree),
|
|
3443
|
-
|
|
3692
|
+
highlightHandler,
|
|
3693
|
+
toggleClickFlag,
|
|
3694
|
+
canHighlight,
|
|
3444
3695
|
clickHandler(data) {
|
|
3445
3696
|
if (services?.uiService.get("uiSelectMode")) {
|
|
3446
3697
|
document.dispatchEvent(new CustomEvent("ui-select", { detail: data }));
|
|
@@ -3449,13 +3700,15 @@ const _sfc_main$7 = defineComponent({
|
|
|
3449
3700
|
tree.value?.setCurrentKey(data.id);
|
|
3450
3701
|
select(data, editorService);
|
|
3451
3702
|
},
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3703
|
+
async contextmenu(event, data) {
|
|
3704
|
+
event.preventDefault();
|
|
3705
|
+
await select(data, editorService);
|
|
3706
|
+
menu.value?.show(event);
|
|
3707
|
+
}
|
|
3455
3708
|
};
|
|
3456
3709
|
}
|
|
3457
3710
|
});
|
|
3458
|
-
const _hoisted_1$
|
|
3711
|
+
const _hoisted_1$4 = ["id", "onMouseenter"];
|
|
3459
3712
|
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3460
3713
|
const _component_el_input = resolveComponent("el-input");
|
|
3461
3714
|
const _component_el_tree = resolveComponent("el-tree");
|
|
@@ -3496,8 +3749,8 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3496
3749
|
createElementVNode("div", {
|
|
3497
3750
|
id: data.id,
|
|
3498
3751
|
class: normalizeClass(["cus-tree-node", { "cus-tree-node-hover": _ctx.canHighlight && data.id === _ctx.highlightNode?.id }]),
|
|
3499
|
-
onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.
|
|
3500
|
-
onMouseup: _cache[2] || (_cache[2] = (...args) => _ctx.
|
|
3752
|
+
onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.toggleClickFlag && _ctx.toggleClickFlag(...args)),
|
|
3753
|
+
onMouseup: _cache[2] || (_cache[2] = (...args) => _ctx.toggleClickFlag && _ctx.toggleClickFlag(...args)),
|
|
3501
3754
|
onMouseenter: ($event) => _ctx.highlightHandler(data)
|
|
3502
3755
|
}, [
|
|
3503
3756
|
renderSlot(_ctx.$slots, "layer-node-content", {
|
|
@@ -3506,14 +3759,12 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3506
3759
|
}, () => [
|
|
3507
3760
|
createElementVNode("span", null, toDisplayString(`${data.name} (${data.id})`), 1)
|
|
3508
3761
|
])
|
|
3509
|
-
], 42, _hoisted_1$
|
|
3762
|
+
], 42, _hoisted_1$4)
|
|
3510
3763
|
]),
|
|
3511
3764
|
_: 3
|
|
3512
3765
|
}, 8, ["default-expanded-keys", "load", "data", "filter-node-method", "allow-drop", "onNodeClick", "onNodeContextmenu", "onNodeDragEnd"])) : createCommentVNode("", true),
|
|
3513
3766
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
3514
|
-
createVNode(_component_layer_menu, {
|
|
3515
|
-
style: normalizeStyle(_ctx.menuStyle)
|
|
3516
|
-
}, null, 8, ["style"])
|
|
3767
|
+
createVNode(_component_layer_menu, { ref: "menu" }, null, 512)
|
|
3517
3768
|
]))
|
|
3518
3769
|
]),
|
|
3519
3770
|
_: 3
|
|
@@ -3565,7 +3816,7 @@ const _sfc_main$6 = defineComponent({
|
|
|
3565
3816
|
};
|
|
3566
3817
|
}
|
|
3567
3818
|
});
|
|
3568
|
-
const _hoisted_1$
|
|
3819
|
+
const _hoisted_1$3 = {
|
|
3569
3820
|
key: 1,
|
|
3570
3821
|
class: "magic-editor-tab-panel-title"
|
|
3571
3822
|
};
|
|
@@ -3593,7 +3844,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3593
3844
|
key: 0,
|
|
3594
3845
|
icon: item.icon
|
|
3595
3846
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
3596
|
-
item.text ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
3847
|
+
item.text ? (openBlock(), createElementBlock("div", _hoisted_1$3, toDisplayString(item.text), 1)) : createCommentVNode("", true)
|
|
3597
3848
|
])
|
|
3598
3849
|
]),
|
|
3599
3850
|
default: withCtx(() => [
|
|
@@ -3683,12 +3934,14 @@ const useScroll = (root) => {
|
|
|
3683
3934
|
};
|
|
3684
3935
|
};
|
|
3685
3936
|
const _sfc_main$5 = defineComponent({
|
|
3686
|
-
components: { ArrowLeftBold, ArrowRightBold, CaretBottom, Plus },
|
|
3937
|
+
components: { ArrowLeftBold, ArrowRightBold, CaretBottom, Plus, ToolButton },
|
|
3687
3938
|
setup() {
|
|
3688
3939
|
const services = inject("services");
|
|
3689
3940
|
const editorService = services?.editorService;
|
|
3690
3941
|
const root = computed(() => editorService?.get("root"));
|
|
3691
3942
|
return {
|
|
3943
|
+
Delete: markRaw(Delete),
|
|
3944
|
+
DocumentCopy: markRaw(DocumentCopy),
|
|
3692
3945
|
...useScroll(root),
|
|
3693
3946
|
root,
|
|
3694
3947
|
page: computed(() => editorService?.get("page")),
|
|
@@ -3717,23 +3970,22 @@ const _sfc_main$5 = defineComponent({
|
|
|
3717
3970
|
};
|
|
3718
3971
|
}
|
|
3719
3972
|
});
|
|
3720
|
-
const _hoisted_1$
|
|
3973
|
+
const _hoisted_1$2 = {
|
|
3721
3974
|
class: "m-editor-page-bar",
|
|
3722
3975
|
ref: "pageBar"
|
|
3723
3976
|
};
|
|
3724
|
-
const _hoisted_2
|
|
3725
|
-
const _hoisted_3
|
|
3726
|
-
const _hoisted_4$1 = ["onClick"];
|
|
3727
|
-
const _hoisted_5 = ["onClick"];
|
|
3977
|
+
const _hoisted_2 = ["onClick"];
|
|
3978
|
+
const _hoisted_3 = { class: "m-editor-page-bar-title" };
|
|
3728
3979
|
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3729
3980
|
const _component_plus = resolveComponent("plus");
|
|
3730
3981
|
const _component_el_icon = resolveComponent("el-icon");
|
|
3731
3982
|
const _component_arrow_left_bold = resolveComponent("arrow-left-bold");
|
|
3732
3983
|
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
3984
|
+
const _component_tool_button = resolveComponent("tool-button");
|
|
3733
3985
|
const _component_caret_bottom = resolveComponent("caret-bottom");
|
|
3734
3986
|
const _component_el_popover = resolveComponent("el-popover");
|
|
3735
3987
|
const _component_arrow_right_bold = resolveComponent("arrow-right-bold");
|
|
3736
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3988
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
3737
3989
|
createElementVNode("div", {
|
|
3738
3990
|
id: "m-editor-page-bar-add-icon",
|
|
3739
3991
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
@@ -3770,7 +4022,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3770
4022
|
class: normalizeClass(["m-editor-page-bar-item", { active: _ctx.page?.id === item.id }]),
|
|
3771
4023
|
onClick: ($event) => _ctx.switchPage(item)
|
|
3772
4024
|
}, [
|
|
3773
|
-
createElementVNode("div", _hoisted_3
|
|
4025
|
+
createElementVNode("div", _hoisted_3, [
|
|
3774
4026
|
renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
|
|
3775
4027
|
createVNode(_component_el_tooltip, {
|
|
3776
4028
|
effect: "dark",
|
|
@@ -3785,6 +4037,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3785
4037
|
])
|
|
3786
4038
|
]),
|
|
3787
4039
|
createVNode(_component_el_popover, {
|
|
4040
|
+
"popper-class": "page-bar-popover",
|
|
3788
4041
|
placement: "top",
|
|
3789
4042
|
width: 160,
|
|
3790
4043
|
trigger: "hover"
|
|
@@ -3800,20 +4053,28 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3800
4053
|
default: withCtx(() => [
|
|
3801
4054
|
createElementVNode("div", null, [
|
|
3802
4055
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
},
|
|
4056
|
+
createVNode(_component_tool_button, {
|
|
4057
|
+
data: {
|
|
4058
|
+
type: "button",
|
|
4059
|
+
text: "\u590D\u5236",
|
|
4060
|
+
icon: _ctx.DocumentCopy,
|
|
4061
|
+
handler: () => _ctx.copy(item)
|
|
4062
|
+
}
|
|
4063
|
+
}, null, 8, ["data"]),
|
|
4064
|
+
createVNode(_component_tool_button, {
|
|
4065
|
+
data: {
|
|
4066
|
+
type: "button",
|
|
4067
|
+
text: "\u5220\u9664",
|
|
4068
|
+
icon: _ctx.Delete,
|
|
4069
|
+
handler: () => _ctx.remove(item)
|
|
4070
|
+
}
|
|
4071
|
+
}, null, 8, ["data"])
|
|
3811
4072
|
])
|
|
3812
4073
|
])
|
|
3813
4074
|
]),
|
|
3814
4075
|
_: 2
|
|
3815
4076
|
}, 1024)
|
|
3816
|
-
], 10, _hoisted_2
|
|
4077
|
+
], 10, _hoisted_2);
|
|
3817
4078
|
}), 128))
|
|
3818
4079
|
], 4)) : createCommentVNode("", true),
|
|
3819
4080
|
_ctx.canScroll ? (openBlock(), createElementBlock("div", {
|
|
@@ -3833,33 +4094,104 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3833
4094
|
var PageBar = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
|
|
3834
4095
|
|
|
3835
4096
|
class ScrollViewer$1 {
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
4097
|
+
constructor(options) {
|
|
4098
|
+
this.enter = false;
|
|
4099
|
+
this.targetEnter = false;
|
|
4100
|
+
this.keydown = false;
|
|
4101
|
+
this.zoom = 1;
|
|
4102
|
+
this.scrollLeft = 0;
|
|
4103
|
+
this.scrollTop = 0;
|
|
4104
|
+
this.x = 0;
|
|
4105
|
+
this.y = 0;
|
|
4106
|
+
this.resizeObserver = new ResizeObserver((entries) => {
|
|
4107
|
+
for (const { contentRect } of entries) {
|
|
4108
|
+
const { width, height } = contentRect;
|
|
4109
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
4110
|
+
const targetWidth = targetRect.width * this.zoom;
|
|
4111
|
+
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
4112
|
+
const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
|
|
4113
|
+
if (targetWidth < width) {
|
|
4114
|
+
this.target._left = 0;
|
|
4115
|
+
}
|
|
4116
|
+
if (targetHeight < height) {
|
|
4117
|
+
this.target._top = 0;
|
|
4118
|
+
}
|
|
4119
|
+
this.scroll();
|
|
3858
4120
|
}
|
|
4121
|
+
});
|
|
4122
|
+
this.wheelHandler = (event) => {
|
|
4123
|
+
if (this.targetEnter)
|
|
4124
|
+
return;
|
|
4125
|
+
const { deltaX, deltaY, currentTarget } = event;
|
|
4126
|
+
if (currentTarget !== this.container)
|
|
4127
|
+
return;
|
|
4128
|
+
this.setScrollOffset(deltaX, deltaY);
|
|
3859
4129
|
this.scroll();
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
4130
|
+
this.scrollLeft = this.target._left;
|
|
4131
|
+
this.scrollTop = this.target._top;
|
|
4132
|
+
};
|
|
4133
|
+
this.mouseEnterHandler = () => {
|
|
4134
|
+
this.enter = true;
|
|
4135
|
+
};
|
|
4136
|
+
this.mouseLeaveHandler = () => {
|
|
4137
|
+
this.enter = false;
|
|
4138
|
+
};
|
|
4139
|
+
this.targetMouseEnterHandler = () => {
|
|
4140
|
+
this.targetEnter = true;
|
|
4141
|
+
};
|
|
4142
|
+
this.targetMouseLeaveHandler = () => {
|
|
4143
|
+
this.targetEnter = false;
|
|
4144
|
+
};
|
|
4145
|
+
this.mousedownHandler = (event) => {
|
|
4146
|
+
if (!this.keydown)
|
|
4147
|
+
return;
|
|
4148
|
+
event.stopImmediatePropagation();
|
|
4149
|
+
event.stopPropagation();
|
|
4150
|
+
this.target.style.cursor = "grabbing";
|
|
4151
|
+
this.x = event.clientX;
|
|
4152
|
+
this.y = event.clientY;
|
|
4153
|
+
document.addEventListener("mousemove", this.mousemoveHandler);
|
|
4154
|
+
document.addEventListener("mouseup", this.mouseupHandler);
|
|
4155
|
+
};
|
|
4156
|
+
this.mouseupHandler = () => {
|
|
4157
|
+
this.x = 0;
|
|
4158
|
+
this.y = 0;
|
|
4159
|
+
this.scrollLeft = this.target._left;
|
|
4160
|
+
this.scrollTop = this.target._top;
|
|
4161
|
+
this.removeHandler();
|
|
4162
|
+
};
|
|
4163
|
+
this.mousemoveHandler = (event) => {
|
|
4164
|
+
event.stopImmediatePropagation();
|
|
4165
|
+
event.stopPropagation();
|
|
4166
|
+
const deltaX = event.clientX - this.x;
|
|
4167
|
+
const deltaY = event.clientY - this.y;
|
|
4168
|
+
this.setScrollOffset(deltaX, deltaY);
|
|
4169
|
+
this.scroll();
|
|
4170
|
+
};
|
|
4171
|
+
this.keydownHandler = (event) => {
|
|
4172
|
+
if (event.code === Keys.ESCAPE && this.enter) {
|
|
4173
|
+
event.preventDefault();
|
|
4174
|
+
event.stopImmediatePropagation();
|
|
4175
|
+
event.stopPropagation();
|
|
4176
|
+
}
|
|
4177
|
+
if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
|
|
4178
|
+
return;
|
|
4179
|
+
}
|
|
4180
|
+
this.keydown = true;
|
|
4181
|
+
this.target.style.cursor = "grab";
|
|
4182
|
+
this.container.addEventListener("mousedown", this.mousedownHandler);
|
|
4183
|
+
};
|
|
4184
|
+
this.keyupHandler = (event) => {
|
|
4185
|
+
if (event.code !== Keys.ESCAPE || !this.keydown) {
|
|
4186
|
+
return;
|
|
4187
|
+
}
|
|
4188
|
+
event.preventDefault();
|
|
4189
|
+
event.stopImmediatePropagation();
|
|
4190
|
+
event.stopPropagation();
|
|
4191
|
+
this.keydown = false;
|
|
4192
|
+
event.preventDefault();
|
|
4193
|
+
this.removeHandler();
|
|
4194
|
+
};
|
|
3863
4195
|
this.container = options.container;
|
|
3864
4196
|
this.target = options.target;
|
|
3865
4197
|
this.zoom = options.zoom;
|
|
@@ -3895,79 +4227,6 @@ class ScrollViewer$1 {
|
|
|
3895
4227
|
document.removeEventListener("mousemove", this.mousemoveHandler);
|
|
3896
4228
|
document.removeEventListener("mouseup", this.mouseupHandler);
|
|
3897
4229
|
}
|
|
3898
|
-
wheelHandler = (event) => {
|
|
3899
|
-
if (this.targetEnter)
|
|
3900
|
-
return;
|
|
3901
|
-
const { deltaX, deltaY, currentTarget } = event;
|
|
3902
|
-
if (currentTarget !== this.container)
|
|
3903
|
-
return;
|
|
3904
|
-
this.setScrollOffset(deltaX, deltaY);
|
|
3905
|
-
this.scroll();
|
|
3906
|
-
this.scrollLeft = this.target._left;
|
|
3907
|
-
this.scrollTop = this.target._top;
|
|
3908
|
-
};
|
|
3909
|
-
mouseEnterHandler = () => {
|
|
3910
|
-
this.enter = true;
|
|
3911
|
-
};
|
|
3912
|
-
mouseLeaveHandler = () => {
|
|
3913
|
-
this.enter = false;
|
|
3914
|
-
};
|
|
3915
|
-
targetMouseEnterHandler = () => {
|
|
3916
|
-
this.targetEnter = true;
|
|
3917
|
-
};
|
|
3918
|
-
targetMouseLeaveHandler = () => {
|
|
3919
|
-
this.targetEnter = false;
|
|
3920
|
-
};
|
|
3921
|
-
mousedownHandler = (event) => {
|
|
3922
|
-
if (!this.keydown)
|
|
3923
|
-
return;
|
|
3924
|
-
event.stopImmediatePropagation();
|
|
3925
|
-
event.stopPropagation();
|
|
3926
|
-
this.target.style.cursor = "grabbing";
|
|
3927
|
-
this.x = event.clientX;
|
|
3928
|
-
this.y = event.clientY;
|
|
3929
|
-
document.addEventListener("mousemove", this.mousemoveHandler);
|
|
3930
|
-
document.addEventListener("mouseup", this.mouseupHandler);
|
|
3931
|
-
};
|
|
3932
|
-
mouseupHandler = () => {
|
|
3933
|
-
this.x = 0;
|
|
3934
|
-
this.y = 0;
|
|
3935
|
-
this.scrollLeft = this.target._left;
|
|
3936
|
-
this.scrollTop = this.target._top;
|
|
3937
|
-
this.removeHandler();
|
|
3938
|
-
};
|
|
3939
|
-
mousemoveHandler = (event) => {
|
|
3940
|
-
event.stopImmediatePropagation();
|
|
3941
|
-
event.stopPropagation();
|
|
3942
|
-
const deltaX = event.clientX - this.x;
|
|
3943
|
-
const deltaY = event.clientY - this.y;
|
|
3944
|
-
this.setScrollOffset(deltaX, deltaY);
|
|
3945
|
-
this.scroll();
|
|
3946
|
-
};
|
|
3947
|
-
keydownHandler = (event) => {
|
|
3948
|
-
if (event.code === Keys.ESCAPE && this.enter) {
|
|
3949
|
-
event.preventDefault();
|
|
3950
|
-
event.stopImmediatePropagation();
|
|
3951
|
-
event.stopPropagation();
|
|
3952
|
-
}
|
|
3953
|
-
if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
|
|
3954
|
-
return;
|
|
3955
|
-
}
|
|
3956
|
-
this.keydown = true;
|
|
3957
|
-
this.target.style.cursor = "grab";
|
|
3958
|
-
this.container.addEventListener("mousedown", this.mousedownHandler);
|
|
3959
|
-
};
|
|
3960
|
-
keyupHandler = (event) => {
|
|
3961
|
-
if (event.code !== Keys.ESCAPE || !this.keydown) {
|
|
3962
|
-
return;
|
|
3963
|
-
}
|
|
3964
|
-
event.preventDefault();
|
|
3965
|
-
event.stopImmediatePropagation();
|
|
3966
|
-
event.stopPropagation();
|
|
3967
|
-
this.keydown = false;
|
|
3968
|
-
event.preventDefault();
|
|
3969
|
-
this.removeHandler();
|
|
3970
|
-
};
|
|
3971
4230
|
setScrollOffset(deltaX, deltaY) {
|
|
3972
4231
|
const { width, height } = this.container.getBoundingClientRect();
|
|
3973
4232
|
const targetRect = this.target.getBoundingClientRect();
|
|
@@ -4028,19 +4287,19 @@ const _sfc_main$4 = defineComponent({
|
|
|
4028
4287
|
el,
|
|
4029
4288
|
style: computed(() => `
|
|
4030
4289
|
width: ${props.width}px;
|
|
4031
|
-
height: ${props.height}px;
|
|
4290
|
+
height: ${(props.height || 0) - 40}px;
|
|
4032
4291
|
position: absolute;
|
|
4033
4292
|
margin-top: 30px;
|
|
4034
4293
|
`)
|
|
4035
4294
|
};
|
|
4036
4295
|
}
|
|
4037
4296
|
});
|
|
4038
|
-
const _hoisted_1$
|
|
4297
|
+
const _hoisted_1$1 = {
|
|
4039
4298
|
class: "m-editor-scroll-viewer-container",
|
|
4040
4299
|
ref: "container"
|
|
4041
4300
|
};
|
|
4042
4301
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4043
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4302
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
4044
4303
|
createElementVNode("div", {
|
|
4045
4304
|
ref: "el",
|
|
4046
4305
|
style: normalizeStyle(_ctx.style)
|
|
@@ -4052,7 +4311,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4052
4311
|
var ScrollViewer = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
|
|
4053
4312
|
|
|
4054
4313
|
const _sfc_main$3 = defineComponent({
|
|
4055
|
-
|
|
4314
|
+
components: { ContentMenu },
|
|
4056
4315
|
setup() {
|
|
4057
4316
|
const services = inject("services");
|
|
4058
4317
|
const editorService = services?.editorService;
|
|
@@ -4061,6 +4320,7 @@ const _sfc_main$3 = defineComponent({
|
|
|
4061
4320
|
const canCenter = ref(false);
|
|
4062
4321
|
const node = computed(() => editorService?.get("node"));
|
|
4063
4322
|
const parent = computed(() => editorService?.get("parent"));
|
|
4323
|
+
const isPage = computed(() => node.value?.type === NodeType.PAGE);
|
|
4064
4324
|
onMounted(() => {
|
|
4065
4325
|
const data = globalThis.localStorage.getItem(COPY_STORAGE_KEY);
|
|
4066
4326
|
canPaste.value = data !== "undefined" && !!data;
|
|
@@ -4073,133 +4333,114 @@ const _sfc_main$3 = defineComponent({
|
|
|
4073
4333
|
}, { immediate: true });
|
|
4074
4334
|
return {
|
|
4075
4335
|
menu,
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4336
|
+
menuData: reactive([
|
|
4337
|
+
{
|
|
4338
|
+
type: "button",
|
|
4339
|
+
text: "\u6C34\u5E73\u5C45\u4E2D",
|
|
4340
|
+
display: () => canCenter.value,
|
|
4341
|
+
handler: () => {
|
|
4342
|
+
node.value && editorService?.alignCenter(node.value);
|
|
4343
|
+
}
|
|
4344
|
+
},
|
|
4345
|
+
{
|
|
4346
|
+
type: "button",
|
|
4347
|
+
text: "\u590D\u5236",
|
|
4348
|
+
icon: markRaw(DocumentCopy),
|
|
4349
|
+
handler: () => {
|
|
4350
|
+
node.value && editorService?.copy(node.value);
|
|
4351
|
+
canPaste.value = true;
|
|
4352
|
+
}
|
|
4353
|
+
},
|
|
4354
|
+
{
|
|
4355
|
+
type: "button",
|
|
4356
|
+
text: "\u7C98\u8D34",
|
|
4357
|
+
display: () => canPaste.value,
|
|
4358
|
+
handler: () => {
|
|
4359
|
+
const top = menu.value?.$el.offsetTop || 0;
|
|
4360
|
+
const left = menu.value?.$el.offsetLeft || 0;
|
|
4361
|
+
editorService?.paste({ left, top });
|
|
4362
|
+
}
|
|
4363
|
+
},
|
|
4364
|
+
{
|
|
4365
|
+
type: "divider",
|
|
4366
|
+
direction: "horizontal",
|
|
4367
|
+
display: () => !isPage.value
|
|
4368
|
+
},
|
|
4369
|
+
{
|
|
4370
|
+
type: "button",
|
|
4371
|
+
text: "\u4E0A\u79FB\u4E00\u5C42",
|
|
4372
|
+
icon: markRaw(Top),
|
|
4373
|
+
display: () => !isPage.value,
|
|
4374
|
+
handler: () => {
|
|
4375
|
+
editorService?.moveLayer(1);
|
|
4376
|
+
}
|
|
4377
|
+
},
|
|
4378
|
+
{
|
|
4379
|
+
type: "button",
|
|
4380
|
+
text: "\u4E0B\u79FB\u4E00\u5C42",
|
|
4381
|
+
icon: markRaw(Bottom),
|
|
4382
|
+
display: () => !isPage.value,
|
|
4383
|
+
handler: () => {
|
|
4384
|
+
editorService?.moveLayer(-1);
|
|
4385
|
+
}
|
|
4386
|
+
},
|
|
4387
|
+
{
|
|
4388
|
+
type: "button",
|
|
4389
|
+
text: "\u7F6E\u9876",
|
|
4390
|
+
display: () => !isPage.value,
|
|
4391
|
+
handler: () => {
|
|
4392
|
+
editorService?.moveLayer(LayerOffset.TOP);
|
|
4393
|
+
}
|
|
4394
|
+
},
|
|
4395
|
+
{
|
|
4396
|
+
type: "button",
|
|
4397
|
+
text: "\u7F6E\u5E95",
|
|
4398
|
+
display: () => !isPage.value,
|
|
4399
|
+
handler: () => {
|
|
4400
|
+
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
4401
|
+
}
|
|
4402
|
+
},
|
|
4403
|
+
{
|
|
4404
|
+
type: "divider",
|
|
4405
|
+
direction: "horizontal",
|
|
4406
|
+
display: () => !isPage.value
|
|
4407
|
+
},
|
|
4408
|
+
{
|
|
4409
|
+
type: "button",
|
|
4410
|
+
text: "\u5220\u9664",
|
|
4411
|
+
icon: Delete,
|
|
4412
|
+
display: () => !isPage.value,
|
|
4413
|
+
handler: () => {
|
|
4414
|
+
node.value && editorService?.remove(node.value);
|
|
4415
|
+
}
|
|
4416
|
+
},
|
|
4417
|
+
{
|
|
4418
|
+
type: "divider",
|
|
4419
|
+
direction: "horizontal"
|
|
4420
|
+
},
|
|
4421
|
+
{
|
|
4422
|
+
type: "button",
|
|
4423
|
+
text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
|
|
4424
|
+
handler: () => {
|
|
4425
|
+
editorService?.get("stage").clearGuides();
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
]),
|
|
4429
|
+
show(e) {
|
|
4430
|
+
menu.value?.show(e);
|
|
4109
4431
|
}
|
|
4110
4432
|
};
|
|
4111
4433
|
}
|
|
4112
4434
|
});
|
|
4113
|
-
const _hoisted_1$1 = {
|
|
4114
|
-
class: "magic-editor-content-menu",
|
|
4115
|
-
ref: "menu"
|
|
4116
|
-
};
|
|
4117
|
-
const _hoisted_2 = /* @__PURE__ */ createElementVNode("div", { class: "separation" }, null, -1);
|
|
4118
|
-
const _hoisted_3 = /* @__PURE__ */ createElementVNode("div", { class: "separation" }, null, -1);
|
|
4119
|
-
const _hoisted_4 = /* @__PURE__ */ createElementVNode("div", { class: "separation" }, null, -1);
|
|
4120
4435
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
onClick: _cache[0] || (_cache[0] = () => _ctx.center())
|
|
4127
|
-
}, "\u6C34\u5E73\u5C45\u4E2D")) : createCommentVNode("", true),
|
|
4128
|
-
createElementVNode("div", {
|
|
4129
|
-
class: "magic-editor-content-menu-item",
|
|
4130
|
-
onClick: _cache[1] || (_cache[1] = () => _ctx.copy())
|
|
4131
|
-
}, "\u590D\u5236"),
|
|
4132
|
-
_ctx.canPaste ? (openBlock(), createElementBlock("div", {
|
|
4133
|
-
key: 1,
|
|
4134
|
-
class: "magic-editor-content-menu-item",
|
|
4135
|
-
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.paste && _ctx.paste(...args))
|
|
4136
|
-
}, "\u7C98\u8D34")) : createCommentVNode("", true),
|
|
4137
|
-
_ctx.canMoveZPos ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
4138
|
-
_hoisted_2,
|
|
4139
|
-
createElementVNode("div", {
|
|
4140
|
-
class: "magic-editor-content-menu-item",
|
|
4141
|
-
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.topItem && _ctx.topItem(...args))
|
|
4142
|
-
}, "\u4E0A\u79FB\u4E00\u5C42"),
|
|
4143
|
-
createElementVNode("div", {
|
|
4144
|
-
class: "magic-editor-content-menu-item",
|
|
4145
|
-
onClick: _cache[4] || (_cache[4] = (...args) => _ctx.bottomItem && _ctx.bottomItem(...args))
|
|
4146
|
-
}, "\u4E0B\u79FB\u4E00\u5C42"),
|
|
4147
|
-
createElementVNode("div", {
|
|
4148
|
-
class: "magic-editor-content-menu-item",
|
|
4149
|
-
onClick: _cache[5] || (_cache[5] = (...args) => _ctx.top && _ctx.top(...args))
|
|
4150
|
-
}, "\u7F6E\u9876"),
|
|
4151
|
-
createElementVNode("div", {
|
|
4152
|
-
class: "magic-editor-content-menu-item",
|
|
4153
|
-
onClick: _cache[6] || (_cache[6] = (...args) => _ctx.bottom && _ctx.bottom(...args))
|
|
4154
|
-
}, "\u7F6E\u5E95")
|
|
4155
|
-
], 64)) : createCommentVNode("", true),
|
|
4156
|
-
_ctx.canDelete ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
4157
|
-
_hoisted_3,
|
|
4158
|
-
createElementVNode("div", {
|
|
4159
|
-
class: "magic-editor-content-menu-item",
|
|
4160
|
-
onClick: _cache[7] || (_cache[7] = () => _ctx.remove())
|
|
4161
|
-
}, "\u5220\u9664")
|
|
4162
|
-
], 64)) : createCommentVNode("", true),
|
|
4163
|
-
_hoisted_4,
|
|
4164
|
-
createElementVNode("div", {
|
|
4165
|
-
class: "magic-editor-content-menu-item",
|
|
4166
|
-
onClick: _cache[8] || (_cache[8] = (...args) => _ctx.clearGuides && _ctx.clearGuides(...args))
|
|
4167
|
-
}, "\u6E05\u7A7A\u53C2\u8003\u7EBF")
|
|
4168
|
-
])
|
|
4169
|
-
], 512);
|
|
4436
|
+
const _component_content_menu = resolveComponent("content-menu");
|
|
4437
|
+
return openBlock(), createBlock(_component_content_menu, {
|
|
4438
|
+
"menu-data": _ctx.menuData,
|
|
4439
|
+
ref: "menu"
|
|
4440
|
+
}, null, 8, ["menu-data"]);
|
|
4170
4441
|
}
|
|
4171
4442
|
var ViewerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
4172
4443
|
|
|
4173
|
-
const useMenu = () => {
|
|
4174
|
-
const menu = ref();
|
|
4175
|
-
const menuStyle = ref({
|
|
4176
|
-
display: "none",
|
|
4177
|
-
left: "0",
|
|
4178
|
-
top: "0"
|
|
4179
|
-
});
|
|
4180
|
-
onMounted(() => {
|
|
4181
|
-
document.addEventListener("click", () => {
|
|
4182
|
-
menuStyle.value.display = "none";
|
|
4183
|
-
}, true);
|
|
4184
|
-
});
|
|
4185
|
-
return {
|
|
4186
|
-
menu,
|
|
4187
|
-
menuStyle,
|
|
4188
|
-
contextmenuHandler(e) {
|
|
4189
|
-
e.preventDefault();
|
|
4190
|
-
const menuHeight = menu.value?.$el.clientHeight;
|
|
4191
|
-
let top = e.clientY;
|
|
4192
|
-
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
4193
|
-
top = document.body.clientHeight - menuHeight;
|
|
4194
|
-
}
|
|
4195
|
-
menuStyle.value = {
|
|
4196
|
-
display: "block",
|
|
4197
|
-
top: `${top}px`,
|
|
4198
|
-
left: `${e.clientX}px`
|
|
4199
|
-
};
|
|
4200
|
-
}
|
|
4201
|
-
};
|
|
4202
|
-
};
|
|
4203
4444
|
const _sfc_main$2 = defineComponent({
|
|
4204
4445
|
name: "magic-stage",
|
|
4205
4446
|
components: {
|
|
@@ -4226,11 +4467,12 @@ const _sfc_main$2 = defineComponent({
|
|
|
4226
4467
|
const services = inject("services");
|
|
4227
4468
|
const stageWrap = ref();
|
|
4228
4469
|
const stageContainer = ref();
|
|
4470
|
+
const menu = ref();
|
|
4229
4471
|
const stageRect = computed(() => services?.uiService.get("stageRect"));
|
|
4230
4472
|
const uiSelectMode = computed(() => services?.uiService.get("uiSelectMode"));
|
|
4231
4473
|
const root = computed(() => services?.editorService.get("root"));
|
|
4232
4474
|
const page = computed(() => services?.editorService.get("page"));
|
|
4233
|
-
const zoom = computed(() => services?.uiService.get("zoom"));
|
|
4475
|
+
const zoom = computed(() => services?.uiService.get("zoom") || 1);
|
|
4234
4476
|
const node = computed(() => services?.editorService.get("node"));
|
|
4235
4477
|
let stage = null;
|
|
4236
4478
|
let runtime = null;
|
|
@@ -4312,9 +4554,36 @@ const _sfc_main$2 = defineComponent({
|
|
|
4312
4554
|
return {
|
|
4313
4555
|
stageWrap,
|
|
4314
4556
|
stageContainer,
|
|
4557
|
+
menu,
|
|
4315
4558
|
stageRect,
|
|
4316
4559
|
zoom,
|
|
4317
|
-
|
|
4560
|
+
contextmenuHandler(e2) {
|
|
4561
|
+
e2.preventDefault();
|
|
4562
|
+
menu.value?.show(e2);
|
|
4563
|
+
},
|
|
4564
|
+
dragoverHandler(e2) {
|
|
4565
|
+
e2.preventDefault();
|
|
4566
|
+
if (e2.dataTransfer) {
|
|
4567
|
+
e2.dataTransfer.dropEffect = "move";
|
|
4568
|
+
}
|
|
4569
|
+
},
|
|
4570
|
+
async dropHandler(e) {
|
|
4571
|
+
e.preventDefault();
|
|
4572
|
+
if (e.dataTransfer && page.value && stageContainer.value && stage) {
|
|
4573
|
+
const config = eval(`(${e.dataTransfer.getData("data")})`);
|
|
4574
|
+
const layout = await services?.editorService.getLayout(page.value);
|
|
4575
|
+
const containerRect = stageContainer.value.getBoundingClientRect();
|
|
4576
|
+
const { scrollTop, scrollLeft } = stage.mask;
|
|
4577
|
+
if (layout === Layout.ABSOLUTE) {
|
|
4578
|
+
config.style = {
|
|
4579
|
+
position: "absolute",
|
|
4580
|
+
top: e.clientY - containerRect.top + scrollTop,
|
|
4581
|
+
left: e.clientX - containerRect.left + scrollLeft
|
|
4582
|
+
};
|
|
4583
|
+
}
|
|
4584
|
+
services?.editorService.add(config, page.value);
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4318
4587
|
};
|
|
4319
4588
|
}
|
|
4320
4589
|
});
|
|
@@ -4332,14 +4601,13 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4332
4601
|
createElementVNode("div", {
|
|
4333
4602
|
class: "m-editor-stage-container",
|
|
4334
4603
|
ref: "stageContainer",
|
|
4604
|
+
style: normalizeStyle(`transform: scale(${_ctx.zoom})`),
|
|
4335
4605
|
onContextmenu: _cache[0] || (_cache[0] = (...args) => _ctx.contextmenuHandler && _ctx.contextmenuHandler(...args)),
|
|
4336
|
-
|
|
4606
|
+
onDrop: _cache[1] || (_cache[1] = (...args) => _ctx.dropHandler && _ctx.dropHandler(...args)),
|
|
4607
|
+
onDragover: _cache[2] || (_cache[2] = (...args) => _ctx.dragoverHandler && _ctx.dragoverHandler(...args))
|
|
4337
4608
|
}, null, 36),
|
|
4338
4609
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4339
|
-
createVNode(_component_viewer_menu, {
|
|
4340
|
-
ref: "menu",
|
|
4341
|
-
style: normalizeStyle(_ctx.menuStyle)
|
|
4342
|
-
}, null, 8, ["style"])
|
|
4610
|
+
createVNode(_component_viewer_menu, { ref: "menu" }, null, 512)
|
|
4343
4611
|
]))
|
|
4344
4612
|
]),
|
|
4345
4613
|
_: 1
|
|
@@ -4373,29 +4641,74 @@ const _sfc_main$1 = defineComponent({
|
|
|
4373
4641
|
const mouseenterHandler = () => {
|
|
4374
4642
|
workspace.value?.focus();
|
|
4375
4643
|
};
|
|
4376
|
-
const mouseleaveHandler = () => {
|
|
4377
|
-
workspace.value?.blur();
|
|
4378
|
-
};
|
|
4379
4644
|
onMounted(() => {
|
|
4380
4645
|
workspace.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
4381
|
-
workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
4382
4646
|
keycon = new KeyController(workspace.value);
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4647
|
+
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4648
|
+
const ctrl = isMac ? "meta" : "ctrl";
|
|
4649
|
+
keycon.keyup("delete", (e) => {
|
|
4650
|
+
e.inputEvent.preventDefault();
|
|
4651
|
+
if (!node.value || isPage(node.value))
|
|
4652
|
+
return;
|
|
4653
|
+
services?.editorService.remove(node.value);
|
|
4654
|
+
}).keydown([ctrl, "c"], (e) => {
|
|
4655
|
+
e.inputEvent.preventDefault();
|
|
4386
4656
|
node.value && services?.editorService.copy(node.value);
|
|
4387
|
-
}).
|
|
4657
|
+
}).keydown([ctrl, "v"], (e) => {
|
|
4658
|
+
e.inputEvent.preventDefault();
|
|
4388
4659
|
node.value && services?.editorService.paste();
|
|
4389
|
-
}).
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4660
|
+
}).keydown([ctrl, "x"], (e) => {
|
|
4661
|
+
e.inputEvent.preventDefault();
|
|
4662
|
+
if (!node.value || isPage(node.value))
|
|
4663
|
+
return;
|
|
4664
|
+
services?.editorService.copy(node.value);
|
|
4665
|
+
services?.editorService.remove(node.value);
|
|
4666
|
+
}).keydown([ctrl, "z"], (e) => {
|
|
4667
|
+
e.inputEvent.preventDefault();
|
|
4668
|
+
services?.editorService.undo();
|
|
4669
|
+
}).keydown([ctrl, "shift", "z"], (e) => {
|
|
4670
|
+
e.inputEvent.preventDefault();
|
|
4671
|
+
services?.editorService.redo();
|
|
4672
|
+
}).keydown("up", (e) => {
|
|
4673
|
+
e.inputEvent.preventDefault();
|
|
4674
|
+
services?.editorService.move(0, -1);
|
|
4675
|
+
}).keydown("down", (e) => {
|
|
4676
|
+
e.inputEvent.preventDefault();
|
|
4677
|
+
services?.editorService.move(0, 1);
|
|
4678
|
+
}).keydown("left", (e) => {
|
|
4679
|
+
e.inputEvent.preventDefault();
|
|
4680
|
+
services?.editorService.move(-1, 0);
|
|
4681
|
+
}).keydown("right", (e) => {
|
|
4682
|
+
e.inputEvent.preventDefault();
|
|
4683
|
+
services?.editorService.move(1, 0);
|
|
4684
|
+
}).keydown([ctrl, "up"], (e) => {
|
|
4685
|
+
e.inputEvent.preventDefault();
|
|
4686
|
+
services?.editorService.move(0, -10);
|
|
4687
|
+
}).keydown([ctrl, "down"], (e) => {
|
|
4688
|
+
e.inputEvent.preventDefault();
|
|
4689
|
+
services?.editorService.move(0, 10);
|
|
4690
|
+
}).keydown([ctrl, "left"], (e) => {
|
|
4691
|
+
e.inputEvent.preventDefault();
|
|
4692
|
+
services?.editorService.move(-10, 0);
|
|
4693
|
+
}).keydown([ctrl, "right"], (e) => {
|
|
4694
|
+
e.inputEvent.preventDefault();
|
|
4695
|
+
services?.editorService.move(10, 0);
|
|
4696
|
+
}).keydown("tab", (e) => {
|
|
4697
|
+
e.inputEvent.preventDefault();
|
|
4698
|
+
services?.editorService.selectNextNode();
|
|
4699
|
+
}).keydown([ctrl, "tab"], (e) => {
|
|
4700
|
+
e.inputEvent.preventDefault();
|
|
4701
|
+
services?.editorService.selectNextPage();
|
|
4702
|
+
}).keydown([ctrl, "="], (e) => {
|
|
4703
|
+
e.inputEvent.preventDefault();
|
|
4704
|
+
services?.uiService.zoom(0.1);
|
|
4705
|
+
}).keydown([ctrl, "-"], (e) => {
|
|
4706
|
+
e.inputEvent.preventDefault();
|
|
4707
|
+
services?.uiService.zoom(-0.1);
|
|
4394
4708
|
});
|
|
4395
4709
|
});
|
|
4396
4710
|
onUnmounted(() => {
|
|
4397
4711
|
workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
|
|
4398
|
-
workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
|
|
4399
4712
|
keycon.destroy();
|
|
4400
4713
|
});
|
|
4401
4714
|
return {
|
|
@@ -4435,11 +4748,11 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4435
4748
|
var Workspace = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
4436
4749
|
|
|
4437
4750
|
class ComponentList extends BaseService {
|
|
4438
|
-
state = reactive({
|
|
4439
|
-
list: []
|
|
4440
|
-
});
|
|
4441
4751
|
constructor() {
|
|
4442
4752
|
super([]);
|
|
4753
|
+
this.state = reactive({
|
|
4754
|
+
list: []
|
|
4755
|
+
});
|
|
4443
4756
|
}
|
|
4444
4757
|
setList(componentGroupList) {
|
|
4445
4758
|
this.state.list = componentGroupList;
|
|
@@ -4505,6 +4818,11 @@ class Ui extends BaseService {
|
|
|
4505
4818
|
get(name) {
|
|
4506
4819
|
return state[name];
|
|
4507
4820
|
}
|
|
4821
|
+
zoom(zoom) {
|
|
4822
|
+
this.set("zoom", (this.get("zoom") * 100 + zoom * 100) / 100);
|
|
4823
|
+
if (this.get("zoom") < 0.1)
|
|
4824
|
+
this.set("zoom", 0.1);
|
|
4825
|
+
}
|
|
4508
4826
|
setColumnWidth({ left, center, right }) {
|
|
4509
4827
|
const columnWidth = {
|
|
4510
4828
|
...toRaw(this.get("columnWidth"))
|
|
@@ -4718,5 +5036,5 @@ var index = {
|
|
|
4718
5036
|
}
|
|
4719
5037
|
};
|
|
4720
5038
|
|
|
4721
|
-
export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, generateId, generatePageName, generatePageNameByApp, getConfig, getDefaultPropsValue, getNodeIndex, getPageList, getPageNameList, historyService, info, initPosition, isFixed, log, propsService, setConfig, setLayout, setNewItemId, toRelative, uiService, warn };
|
|
5039
|
+
export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, ToolButton, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, generateId, generatePageName, generatePageNameByApp, getConfig, getDefaultPropsValue, getNodeIndex, getPageList, getPageNameList, historyService, info, initPosition, isFixed, log, propsService, setConfig, setLayout, setNewItemId, toRelative, uiService, warn };
|
|
4722
5040
|
//# sourceMappingURL=tmagic-editor.es.js.map
|