@tmagic/editor 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tmagic-editor.mjs +592 -481
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +591 -480
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/Editor.vue +0 -2
- package/src/fields/Code.vue +17 -21
- package/src/fields/CodeLink.vue +49 -63
- package/src/index.ts +2 -2
- package/src/layouts/Framework.vue +85 -55
- package/src/layouts/Layout.vue +100 -0
- package/src/layouts/NavMenu.vue +1 -1
- package/src/layouts/Resizer.vue +17 -46
- package/src/layouts/sidebar/ComponentListPanel.vue +1 -1
- package/src/layouts/workspace/PageBarScrollContainer.vue +46 -43
- package/src/layouts/workspace/Workspace.vue +3 -3
- package/src/services/editor.ts +6 -3
- package/src/services/ui.ts +12 -73
- package/src/utils/scroll-viewer.ts +1 -0
- package/types/components/ToolButton.vue.d.ts +4 -4
- package/types/fields/Code.vue.d.ts +88 -20
- package/types/fields/CodeLink.vue.d.ts +99 -48
- package/types/layouts/Framework.vue.d.ts +88 -20
- package/types/layouts/Layout.vue.d.ts +133 -0
- package/types/layouts/Resizer.vue.d.ts +54 -10
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +2 -1
- package/types/services/ui.d.ts +2 -4
|
@@ -30,112 +30,100 @@
|
|
|
30
30
|
const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
|
|
31
31
|
const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
|
|
32
32
|
|
|
33
|
-
const _sfc_main$
|
|
34
|
-
|
|
35
|
-
props:
|
|
33
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
34
|
+
__name: "Code",
|
|
35
|
+
props: {
|
|
36
|
+
model: null,
|
|
37
|
+
name: null,
|
|
38
|
+
config: null,
|
|
39
|
+
prop: null
|
|
40
|
+
},
|
|
36
41
|
emits: ["change"],
|
|
37
|
-
setup(
|
|
42
|
+
setup(__props, { emit }) {
|
|
43
|
+
const props = __props;
|
|
38
44
|
const language = vue.computed(() => props.config.language || "javascript");
|
|
39
45
|
const height = vue.computed(() => `${document.body.clientHeight - 168}px`);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
const save = (v) => {
|
|
47
|
+
props.model[props.name] = v;
|
|
48
|
+
emit("change", v);
|
|
49
|
+
};
|
|
50
|
+
return (_ctx, _cache) => {
|
|
51
|
+
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
52
|
+
return vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
53
|
+
style: vue.normalizeStyle(`height: ${vue.unref(height)}`),
|
|
54
|
+
"init-values": __props.model[__props.name],
|
|
55
|
+
language: vue.unref(language),
|
|
56
|
+
onSave: save
|
|
57
|
+
}, null, 8, ["style", "init-values", "language"]);
|
|
47
58
|
};
|
|
48
59
|
}
|
|
49
60
|
});
|
|
50
61
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
for (const [key, val] of props) {
|
|
54
|
-
target[key] = val;
|
|
55
|
-
}
|
|
56
|
-
return target;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
60
|
-
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
61
|
-
return vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
62
|
-
style: vue.normalizeStyle(`height: ${_ctx.height}`),
|
|
63
|
-
"init-values": _ctx.model[_ctx.name],
|
|
64
|
-
language: _ctx.language,
|
|
65
|
-
onSave: _ctx.save
|
|
66
|
-
}, null, 8, ["style", "init-values", "language", "onSave"]);
|
|
67
|
-
}
|
|
68
|
-
const Code = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$a]]);
|
|
69
|
-
|
|
70
|
-
const _sfc_main$n = vue.defineComponent({
|
|
71
|
-
name: "m-fields-code-link",
|
|
62
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
63
|
+
__name: "CodeLink",
|
|
72
64
|
props: {
|
|
73
|
-
config:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
type: Object
|
|
78
|
-
},
|
|
79
|
-
name: {
|
|
80
|
-
type: String
|
|
81
|
-
},
|
|
82
|
-
prop: {
|
|
83
|
-
type: String
|
|
84
|
-
}
|
|
65
|
+
config: null,
|
|
66
|
+
model: null,
|
|
67
|
+
name: null,
|
|
68
|
+
prop: null
|
|
85
69
|
},
|
|
86
70
|
emits: ["change"],
|
|
87
|
-
setup(
|
|
88
|
-
const
|
|
89
|
-
|
|
71
|
+
setup(__props, { emit }) {
|
|
72
|
+
const props = __props;
|
|
73
|
+
const formConfig = vue.computed(() => ({
|
|
74
|
+
...props.config,
|
|
75
|
+
text: "",
|
|
76
|
+
type: "link",
|
|
77
|
+
form: [
|
|
78
|
+
{
|
|
79
|
+
name: props.name,
|
|
80
|
+
type: "vs-code"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}));
|
|
84
|
+
const modelValue = vue.reactive({
|
|
85
|
+
form: {
|
|
86
|
+
[props.name]: ""
|
|
87
|
+
}
|
|
90
88
|
});
|
|
91
|
-
vue.
|
|
92
|
-
|
|
89
|
+
vue.watch(
|
|
90
|
+
() => props.model[props.name],
|
|
91
|
+
(value) => {
|
|
92
|
+
modelValue.form = {
|
|
93
|
+
[props.name]: serialize__default.default(value, {
|
|
94
|
+
space: 2,
|
|
95
|
+
unsafe: true
|
|
96
|
+
}).replace(/"(\w+)":\s/g, "$1: ")
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
immediate: true
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
const changeHandler = (v) => {
|
|
104
|
+
if (!props.name || !props.model)
|
|
93
105
|
return;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
modelValue,
|
|
101
|
-
formConfig: vue.computed(() => ({
|
|
102
|
-
...props.config,
|
|
103
|
-
text: "",
|
|
104
|
-
type: "link",
|
|
105
|
-
form: [
|
|
106
|
-
{
|
|
107
|
-
name: props.name,
|
|
108
|
-
type: "vs-code"
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
})),
|
|
112
|
-
changeHandler(v) {
|
|
113
|
-
if (!props.name || !props.model)
|
|
114
|
-
return;
|
|
115
|
-
try {
|
|
116
|
-
props.model[props.name] = eval(`${v[props.name]}`);
|
|
117
|
-
emit("change", props.model[props.name]);
|
|
118
|
-
} catch (e) {
|
|
119
|
-
console.error(e);
|
|
120
|
-
}
|
|
106
|
+
try {
|
|
107
|
+
props.model[props.name] = eval(`(${v[props.name]})`);
|
|
108
|
+
emit("change", props.model[props.name]);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
console.error(e);
|
|
121
111
|
}
|
|
122
112
|
};
|
|
113
|
+
return (_ctx, _cache) => {
|
|
114
|
+
const _component_m_fields_link = vue.resolveComponent("m-fields-link");
|
|
115
|
+
return vue.openBlock(), vue.createBlock(_component_m_fields_link, {
|
|
116
|
+
config: vue.unref(formConfig),
|
|
117
|
+
model: modelValue,
|
|
118
|
+
name: "form",
|
|
119
|
+
onChange: changeHandler
|
|
120
|
+
}, null, 8, ["config", "model"]);
|
|
121
|
+
};
|
|
123
122
|
}
|
|
124
123
|
});
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return vue.openBlock(), vue.createBlock(_component_m_fields_link, {
|
|
129
|
-
config: _ctx.formConfig,
|
|
130
|
-
model: _ctx.modelValue,
|
|
131
|
-
name: "form",
|
|
132
|
-
onChange: _ctx.changeHandler
|
|
133
|
-
}, null, 8, ["config", "model", "onChange"]);
|
|
134
|
-
}
|
|
135
|
-
const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$9]]);
|
|
136
|
-
|
|
137
|
-
const _hoisted_1$c = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
|
|
138
|
-
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
125
|
+
const _hoisted_1$b = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
|
|
126
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
139
127
|
__name: "UISelect",
|
|
140
128
|
props: {
|
|
141
129
|
config: null,
|
|
@@ -200,7 +188,7 @@
|
|
|
200
188
|
style: { "padding": "0" }
|
|
201
189
|
}, {
|
|
202
190
|
default: vue.withCtx(() => [
|
|
203
|
-
_hoisted_1$
|
|
191
|
+
_hoisted_1$b
|
|
204
192
|
]),
|
|
205
193
|
_: 1
|
|
206
194
|
}, 8, ["icon"])
|
|
@@ -263,7 +251,7 @@
|
|
|
263
251
|
}
|
|
264
252
|
return value;
|
|
265
253
|
};
|
|
266
|
-
const _sfc_main$
|
|
254
|
+
const _sfc_main$m = vue.defineComponent({
|
|
267
255
|
name: "magic-code-editor",
|
|
268
256
|
props: {
|
|
269
257
|
initValues: {
|
|
@@ -292,10 +280,12 @@
|
|
|
292
280
|
const values = vue.ref("");
|
|
293
281
|
const loading = vue.ref(false);
|
|
294
282
|
const codeEditor = vue.ref();
|
|
295
|
-
const resizeObserver = new globalThis.ResizeObserver(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
283
|
+
const resizeObserver = new globalThis.ResizeObserver(
|
|
284
|
+
lodashEs.throttle(() => {
|
|
285
|
+
vsEditor?.layout();
|
|
286
|
+
vsDiffEditor?.layout();
|
|
287
|
+
}, 300)
|
|
288
|
+
);
|
|
299
289
|
const setEditorValue = (v, m) => {
|
|
300
290
|
values.value = toString(v, props.language);
|
|
301
291
|
if (props.type === "diff") {
|
|
@@ -340,14 +330,18 @@
|
|
|
340
330
|
}
|
|
341
331
|
resizeObserver.observe(codeEditor.value);
|
|
342
332
|
};
|
|
343
|
-
vue.watch(
|
|
344
|
-
|
|
345
|
-
|
|
333
|
+
vue.watch(
|
|
334
|
+
() => props.initValues,
|
|
335
|
+
(v, preV) => {
|
|
336
|
+
if (v !== preV) {
|
|
337
|
+
setEditorValue(props.initValues, props.modifiedValues);
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
deep: true,
|
|
342
|
+
immediate: true
|
|
346
343
|
}
|
|
347
|
-
|
|
348
|
-
deep: true,
|
|
349
|
-
immediate: true
|
|
350
|
-
});
|
|
344
|
+
);
|
|
351
345
|
vue.onMounted(async () => {
|
|
352
346
|
loading.value = true;
|
|
353
347
|
init();
|
|
@@ -371,14 +365,22 @@
|
|
|
371
365
|
}
|
|
372
366
|
});
|
|
373
367
|
|
|
374
|
-
const
|
|
368
|
+
const _export_sfc = (sfc, props) => {
|
|
369
|
+
const target = sfc.__vccOpts || sfc;
|
|
370
|
+
for (const [key, val] of props) {
|
|
371
|
+
target[key] = val;
|
|
372
|
+
}
|
|
373
|
+
return target;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
const _hoisted_1$a = {
|
|
375
377
|
ref: "codeEditor",
|
|
376
378
|
class: "magic-code-editor"
|
|
377
379
|
};
|
|
378
|
-
function _sfc_render$
|
|
379
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
380
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
381
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, null, 512);
|
|
380
382
|
}
|
|
381
|
-
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
383
|
+
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$6]]);
|
|
382
384
|
|
|
383
385
|
let $TMAGIC_EDITOR = {};
|
|
384
386
|
const setConfig = (option) => {
|
|
@@ -651,7 +653,9 @@
|
|
|
651
653
|
}
|
|
652
654
|
async getItem(key, options = {}) {
|
|
653
655
|
const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
654
|
-
const { protocol = options.protocol, item } = this.getValueAndProtocol(
|
|
656
|
+
const { protocol = options.protocol, item } = this.getValueAndProtocol(
|
|
657
|
+
storage.getItem(`${options.namespace || namespace}:${key}`)
|
|
658
|
+
);
|
|
655
659
|
if (item === null)
|
|
656
660
|
return null;
|
|
657
661
|
switch (protocol) {
|
|
@@ -942,10 +946,12 @@
|
|
|
942
946
|
const [id, defaultPropsValue, data] = await Promise.all([
|
|
943
947
|
this.createId(type),
|
|
944
948
|
this.getDefaultPropsValue(type),
|
|
945
|
-
this.setNewItemId(
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
+
this.setNewItemId(
|
|
950
|
+
lodashEs.cloneDeep({
|
|
951
|
+
type,
|
|
952
|
+
...defaultValue
|
|
953
|
+
})
|
|
954
|
+
)
|
|
949
955
|
]);
|
|
950
956
|
return {
|
|
951
957
|
id,
|
|
@@ -998,37 +1004,39 @@
|
|
|
998
1004
|
return config;
|
|
999
1005
|
const curNode = editorService.get("node");
|
|
1000
1006
|
const { left: referenceLeft, top: referenceTop } = config[0].style;
|
|
1001
|
-
const pasteConfigs = await Promise.all(
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
if (pastePosition.left && configItem.style?.left) {
|
|
1008
|
-
pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
|
|
1009
|
-
}
|
|
1010
|
-
if (pastePosition.top && configItem.style?.top) {
|
|
1011
|
-
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
1012
|
-
}
|
|
1013
|
-
const pasteConfig = await propsService.setNewItemId(configItem);
|
|
1014
|
-
if (pasteConfig.style) {
|
|
1015
|
-
const { left, top } = pasteConfig.style;
|
|
1016
|
-
if (typeof left === "number" || !!left && !isNaN(Number(left))) {
|
|
1017
|
-
pasteConfig.style.left = Number(left) + offsetX;
|
|
1007
|
+
const pasteConfigs = await Promise.all(
|
|
1008
|
+
config.map(async (configItem) => {
|
|
1009
|
+
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
1010
|
+
let pastePosition = positionClone;
|
|
1011
|
+
if (!lodashEs.isEmpty(pastePosition) && curNode.items) {
|
|
1012
|
+
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
1018
1013
|
}
|
|
1019
|
-
if (
|
|
1020
|
-
|
|
1014
|
+
if (pastePosition.left && configItem.style?.left) {
|
|
1015
|
+
pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
|
|
1021
1016
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1017
|
+
if (pastePosition.top && configItem.style?.top) {
|
|
1018
|
+
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
1019
|
+
}
|
|
1020
|
+
const pasteConfig = await propsService.setNewItemId(configItem);
|
|
1021
|
+
if (pasteConfig.style) {
|
|
1022
|
+
const { left, top } = pasteConfig.style;
|
|
1023
|
+
if (typeof left === "number" || !!left && !isNaN(Number(left))) {
|
|
1024
|
+
pasteConfig.style.left = Number(left) + offsetX;
|
|
1025
|
+
}
|
|
1026
|
+
if (typeof top === "number" || !!top && !isNaN(Number(top))) {
|
|
1027
|
+
pasteConfig.style.top = Number(top) + offsetY;
|
|
1028
|
+
}
|
|
1029
|
+
pasteConfig.style = {
|
|
1030
|
+
...pasteConfig.style,
|
|
1031
|
+
...pastePosition
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
if (utils.isPage(pasteConfig)) {
|
|
1035
|
+
pasteConfig.name = generatePageNameByApp(editorService.get("root"));
|
|
1036
|
+
}
|
|
1037
|
+
return pasteConfig;
|
|
1038
|
+
})
|
|
1039
|
+
);
|
|
1032
1040
|
return pasteConfigs;
|
|
1033
1041
|
};
|
|
1034
1042
|
const getPositionInContainer = (position = {}, id) => {
|
|
@@ -1069,28 +1077,31 @@
|
|
|
1069
1077
|
});
|
|
1070
1078
|
isHistoryStateChange = false;
|
|
1071
1079
|
constructor() {
|
|
1072
|
-
super(
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1080
|
+
super(
|
|
1081
|
+
[
|
|
1082
|
+
"getLayout",
|
|
1083
|
+
"select",
|
|
1084
|
+
"doAdd",
|
|
1085
|
+
"add",
|
|
1086
|
+
"doRemove",
|
|
1087
|
+
"remove",
|
|
1088
|
+
"doUpdate",
|
|
1089
|
+
"update",
|
|
1090
|
+
"sort",
|
|
1091
|
+
"copy",
|
|
1092
|
+
"paste",
|
|
1093
|
+
"doPaste",
|
|
1094
|
+
"duAlignCenter",
|
|
1095
|
+
"alignCenter",
|
|
1096
|
+
"moveLayer",
|
|
1097
|
+
"moveToContainer",
|
|
1098
|
+
"move",
|
|
1099
|
+
"undo",
|
|
1100
|
+
"redo",
|
|
1101
|
+
"highlight"
|
|
1102
|
+
],
|
|
1103
|
+
["select", "update", "moveLayer"]
|
|
1104
|
+
);
|
|
1094
1105
|
}
|
|
1095
1106
|
set(name, value) {
|
|
1096
1107
|
this.state[name] = value;
|
|
@@ -1162,11 +1173,15 @@
|
|
|
1162
1173
|
historyService.empty();
|
|
1163
1174
|
}
|
|
1164
1175
|
if (node?.id) {
|
|
1165
|
-
this.get("stage")?.renderer.runtime?.getApp?.()?.emit(
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1176
|
+
this.get("stage")?.renderer.runtime?.getApp?.()?.emit(
|
|
1177
|
+
"editor:select",
|
|
1178
|
+
{
|
|
1179
|
+
node,
|
|
1180
|
+
page,
|
|
1181
|
+
parent
|
|
1182
|
+
},
|
|
1183
|
+
utils.getNodePath(node.id, this.get("root").items)
|
|
1184
|
+
);
|
|
1170
1185
|
}
|
|
1171
1186
|
this.emit("select", node);
|
|
1172
1187
|
return node;
|
|
@@ -1218,7 +1233,7 @@
|
|
|
1218
1233
|
if ((parent?.type === schema.NodeType.ROOT || curNode.type === schema.NodeType.ROOT) && node.type !== schema.NodeType.PAGE) {
|
|
1219
1234
|
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
1220
1235
|
}
|
|
1221
|
-
if (parent.id !== curNode.id) {
|
|
1236
|
+
if (parent.id !== curNode.id && node.type !== schema.NodeType.PAGE) {
|
|
1222
1237
|
const index = parent.items.indexOf(curNode);
|
|
1223
1238
|
parent?.items?.splice(index + 1, 0, node);
|
|
1224
1239
|
} else {
|
|
@@ -1232,8 +1247,11 @@
|
|
|
1232
1247
|
parentId: parent.id,
|
|
1233
1248
|
root: lodashEs.cloneDeep(root)
|
|
1234
1249
|
});
|
|
1235
|
-
|
|
1236
|
-
|
|
1250
|
+
const newStyle = fixNodePosition(node, parent, stage);
|
|
1251
|
+
if (newStyle && (newStyle.top !== node.style.top || newStyle.left !== node.style.left)) {
|
|
1252
|
+
node.style = newStyle;
|
|
1253
|
+
await stage?.update({ config: lodashEs.cloneDeep(node), parentId: parent.id, root: lodashEs.cloneDeep(root) });
|
|
1254
|
+
}
|
|
1237
1255
|
this.addModifiedNodeId(node.id);
|
|
1238
1256
|
return node;
|
|
1239
1257
|
}
|
|
@@ -1248,12 +1266,14 @@
|
|
|
1248
1266
|
} else {
|
|
1249
1267
|
addNodes.push(...addNode);
|
|
1250
1268
|
}
|
|
1251
|
-
const newNodes = await Promise.all(
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1269
|
+
const newNodes = await Promise.all(
|
|
1270
|
+
addNodes.map((node) => {
|
|
1271
|
+
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
1272
|
+
if (!parentNode)
|
|
1273
|
+
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
1274
|
+
return this.doAdd(node, parentNode);
|
|
1275
|
+
})
|
|
1276
|
+
);
|
|
1257
1277
|
if (newNodes.length > 1) {
|
|
1258
1278
|
const newNodeIds = newNodes.map((node) => node.id);
|
|
1259
1279
|
stage?.multiSelect(newNodeIds);
|
|
@@ -1872,16 +1892,6 @@
|
|
|
1872
1892
|
}
|
|
1873
1893
|
};
|
|
1874
1894
|
|
|
1875
|
-
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
1876
|
-
const MIN_LEFT_COLUMN_WIDTH = 45;
|
|
1877
|
-
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
1878
|
-
const MIN_RIGHT_COLUMN_WIDTH = 1;
|
|
1879
|
-
const COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorColumnWidthData";
|
|
1880
|
-
const defaultColumnWidth = {
|
|
1881
|
-
left: DEFAULT_LEFT_COLUMN_WIDTH,
|
|
1882
|
-
center: globalThis.document.body.clientWidth - DEFAULT_LEFT_COLUMN_WIDTH - DEFAULT_RIGHT_COLUMN_WIDTH,
|
|
1883
|
-
right: DEFAULT_RIGHT_COLUMN_WIDTH
|
|
1884
|
-
};
|
|
1885
1895
|
const state = vue.reactive({
|
|
1886
1896
|
uiSelectMode: false,
|
|
1887
1897
|
showSrc: false,
|
|
@@ -1894,7 +1904,11 @@
|
|
|
1894
1904
|
width: 375,
|
|
1895
1905
|
height: 817
|
|
1896
1906
|
},
|
|
1897
|
-
columnWidth:
|
|
1907
|
+
columnWidth: {
|
|
1908
|
+
left: 0,
|
|
1909
|
+
right: 0,
|
|
1910
|
+
center: 0
|
|
1911
|
+
},
|
|
1898
1912
|
showGuides: true,
|
|
1899
1913
|
showRule: true,
|
|
1900
1914
|
propsPanelSize: "small",
|
|
@@ -1902,19 +1916,10 @@
|
|
|
1902
1916
|
});
|
|
1903
1917
|
class Ui extends BaseService {
|
|
1904
1918
|
constructor() {
|
|
1905
|
-
super([]);
|
|
1906
|
-
globalThis.addEventListener("resize", () => {
|
|
1907
|
-
this.setColumnWidth({
|
|
1908
|
-
center: "auto"
|
|
1909
|
-
});
|
|
1910
|
-
});
|
|
1919
|
+
super(["zoom", "calcZoom"]);
|
|
1911
1920
|
}
|
|
1912
1921
|
set(name, value) {
|
|
1913
1922
|
const mask = editorService.get("stage")?.mask;
|
|
1914
|
-
if (name === "columnWidth") {
|
|
1915
|
-
this.setColumnWidth(value);
|
|
1916
|
-
return;
|
|
1917
|
-
}
|
|
1918
1923
|
if (name === "stageRect") {
|
|
1919
1924
|
this.setStageRect(value);
|
|
1920
1925
|
return;
|
|
@@ -1930,23 +1935,12 @@
|
|
|
1930
1935
|
get(name) {
|
|
1931
1936
|
return state[name];
|
|
1932
1937
|
}
|
|
1933
|
-
|
|
1934
|
-
const columnWidthCacheData = globalThis.localStorage.getItem(COLUMN_WIDTH_STORAGE_KEY);
|
|
1935
|
-
if (columnWidthCacheData) {
|
|
1936
|
-
try {
|
|
1937
|
-
const columnWidthCache = JSON.parse(columnWidthCacheData);
|
|
1938
|
-
this.setColumnWidth(columnWidthCache);
|
|
1939
|
-
} catch (e) {
|
|
1940
|
-
console.error(e);
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
zoom(zoom) {
|
|
1938
|
+
async zoom(zoom) {
|
|
1945
1939
|
this.set("zoom", (this.get("zoom") * 100 + zoom * 100) / 100);
|
|
1946
1940
|
if (this.get("zoom") < 0.1)
|
|
1947
1941
|
this.set("zoom", 0.1);
|
|
1948
1942
|
}
|
|
1949
|
-
calcZoom() {
|
|
1943
|
+
async calcZoom() {
|
|
1950
1944
|
const { stageRect, stageContainerRect } = state;
|
|
1951
1945
|
const { height, width } = stageContainerRect;
|
|
1952
1946
|
if (!width || !height)
|
|
@@ -1961,36 +1955,12 @@
|
|
|
1961
1955
|
destroy() {
|
|
1962
1956
|
this.removeAllListeners();
|
|
1963
1957
|
}
|
|
1964
|
-
|
|
1965
|
-
const columnWidth = {
|
|
1966
|
-
...vue.toRaw(this.get("columnWidth"))
|
|
1967
|
-
};
|
|
1968
|
-
if (left) {
|
|
1969
|
-
columnWidth.left = Math.max(left, MIN_LEFT_COLUMN_WIDTH);
|
|
1970
|
-
}
|
|
1971
|
-
if (right) {
|
|
1972
|
-
columnWidth.right = Math.max(right, MIN_RIGHT_COLUMN_WIDTH);
|
|
1973
|
-
}
|
|
1974
|
-
if (!center || center === "auto") {
|
|
1975
|
-
const bodyWidth = globalThis.document.body.clientWidth;
|
|
1976
|
-
columnWidth.center = bodyWidth - (columnWidth?.left || 0) - (columnWidth?.right || 0);
|
|
1977
|
-
if (columnWidth.center <= 0) {
|
|
1978
|
-
columnWidth.left = defaultColumnWidth.left;
|
|
1979
|
-
columnWidth.center = defaultColumnWidth.center;
|
|
1980
|
-
columnWidth.right = defaultColumnWidth.right;
|
|
1981
|
-
}
|
|
1982
|
-
} else {
|
|
1983
|
-
columnWidth.center = center;
|
|
1984
|
-
}
|
|
1985
|
-
globalThis.localStorage.setItem(COLUMN_WIDTH_STORAGE_KEY, JSON.stringify(columnWidth));
|
|
1986
|
-
state.columnWidth = columnWidth;
|
|
1987
|
-
}
|
|
1988
|
-
setStageRect(value) {
|
|
1958
|
+
async setStageRect(value) {
|
|
1989
1959
|
state.stageRect = {
|
|
1990
1960
|
...state.stageRect,
|
|
1991
1961
|
...value
|
|
1992
1962
|
};
|
|
1993
|
-
state.zoom = this.calcZoom();
|
|
1963
|
+
state.zoom = await this.calcZoom();
|
|
1994
1964
|
}
|
|
1995
1965
|
}
|
|
1996
1966
|
const uiService = new Ui();
|
|
@@ -2050,7 +2020,9 @@
|
|
|
2050
2020
|
uiService.set("showGuides", true);
|
|
2051
2021
|
if (!root.value || !page.value)
|
|
2052
2022
|
return;
|
|
2053
|
-
const storageKey = getGuideLineKey(
|
|
2023
|
+
const storageKey = getGuideLineKey(
|
|
2024
|
+
e.type === StageCore.GuidesType.HORIZONTAL ? H_GUIDE_LINE_STORAGE_KEY : V_GUIDE_LINE_STORAGE_KEY
|
|
2025
|
+
);
|
|
2054
2026
|
if (e.guides.length) {
|
|
2055
2027
|
globalThis.localStorage.setItem(storageKey, JSON.stringify(e.guides));
|
|
2056
2028
|
} else {
|
|
@@ -2060,7 +2032,7 @@
|
|
|
2060
2032
|
return stage;
|
|
2061
2033
|
};
|
|
2062
2034
|
|
|
2063
|
-
const _sfc_main$
|
|
2035
|
+
const _sfc_main$l = vue.defineComponent({
|
|
2064
2036
|
components: { Plus: iconsVue.Plus },
|
|
2065
2037
|
setup() {
|
|
2066
2038
|
const services = vue.inject("services");
|
|
@@ -2078,14 +2050,14 @@
|
|
|
2078
2050
|
}
|
|
2079
2051
|
});
|
|
2080
2052
|
|
|
2081
|
-
const _hoisted_1$
|
|
2082
|
-
const _hoisted_2$
|
|
2053
|
+
const _hoisted_1$9 = { class: "m-editor-empty-panel" };
|
|
2054
|
+
const _hoisted_2$3 = { class: "m-editor-empty-content" };
|
|
2083
2055
|
const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2084
|
-
function _sfc_render$
|
|
2056
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2085
2057
|
const _component_plus = vue.resolveComponent("plus");
|
|
2086
2058
|
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
2087
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2088
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
2059
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
|
|
2060
|
+
vue.createElementVNode("div", _hoisted_2$3, [
|
|
2089
2061
|
vue.createElementVNode("div", {
|
|
2090
2062
|
class: "m-editor-empty-button",
|
|
2091
2063
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
|
|
@@ -2103,17 +2075,12 @@
|
|
|
2103
2075
|
])
|
|
2104
2076
|
]);
|
|
2105
2077
|
}
|
|
2106
|
-
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2078
|
+
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$5]]);
|
|
2107
2079
|
|
|
2108
|
-
const _sfc_main$
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
type: String
|
|
2113
|
-
}
|
|
2114
|
-
},
|
|
2115
|
-
setup(props) {
|
|
2116
|
-
const services = vue.inject("services");
|
|
2080
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
2081
|
+
__name: "Resizer",
|
|
2082
|
+
emits: ["change"],
|
|
2083
|
+
setup(__props, { emit }) {
|
|
2117
2084
|
const target = vue.ref();
|
|
2118
2085
|
let getso;
|
|
2119
2086
|
vue.onMounted(() => {
|
|
@@ -2123,124 +2090,220 @@
|
|
|
2123
2090
|
container: window,
|
|
2124
2091
|
pinchOutside: true
|
|
2125
2092
|
}).on("drag", (e) => {
|
|
2126
|
-
if (!target.value
|
|
2093
|
+
if (!target.value)
|
|
2127
2094
|
return;
|
|
2128
|
-
|
|
2129
|
-
...vue.toRaw(services.uiService.get("columnWidth"))
|
|
2130
|
-
};
|
|
2131
|
-
if (props.type === "left") {
|
|
2132
|
-
left += e.deltaX;
|
|
2133
|
-
} else if (props.type === "right") {
|
|
2134
|
-
right -= e.deltaX;
|
|
2135
|
-
}
|
|
2136
|
-
services.uiService.set("columnWidth", {
|
|
2137
|
-
left,
|
|
2138
|
-
right
|
|
2139
|
-
});
|
|
2095
|
+
emit("change", e.deltaX);
|
|
2140
2096
|
});
|
|
2141
2097
|
});
|
|
2142
2098
|
vue.onUnmounted(() => {
|
|
2143
2099
|
getso?.unset();
|
|
2144
2100
|
});
|
|
2145
|
-
return {
|
|
2146
|
-
|
|
2101
|
+
return (_ctx, _cache) => {
|
|
2102
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
2103
|
+
ref_key: "target",
|
|
2104
|
+
ref: target,
|
|
2105
|
+
class: "m-editor-resizer"
|
|
2106
|
+
}, [
|
|
2107
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
2108
|
+
], 512);
|
|
2147
2109
|
};
|
|
2148
2110
|
}
|
|
2149
2111
|
});
|
|
2150
2112
|
|
|
2151
|
-
const
|
|
2152
|
-
|
|
2153
|
-
class: "m-editor-resizer"
|
|
2154
|
-
};
|
|
2155
|
-
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2156
|
-
return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$9, [
|
|
2157
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
2158
|
-
], 512);
|
|
2159
|
-
}
|
|
2160
|
-
const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$6]]);
|
|
2161
|
-
|
|
2162
|
-
const _sfc_main$i = vue.defineComponent({
|
|
2163
|
-
components: {
|
|
2164
|
-
AddPageBox,
|
|
2165
|
-
Resizer
|
|
2166
|
-
},
|
|
2113
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
2114
|
+
__name: "Layout",
|
|
2167
2115
|
props: {
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
}
|
|
2116
|
+
left: null,
|
|
2117
|
+
right: null,
|
|
2118
|
+
minLeft: { default: 1 },
|
|
2119
|
+
minRight: { default: 1 },
|
|
2120
|
+
leftClass: null,
|
|
2121
|
+
rightClass: null,
|
|
2122
|
+
centerClass: null
|
|
2172
2123
|
},
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
const
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
}
|
|
2124
|
+
emits: ["update:left", "change", "update:right"],
|
|
2125
|
+
setup(__props, { emit }) {
|
|
2126
|
+
const props = __props;
|
|
2127
|
+
const el = vue.ref();
|
|
2128
|
+
let clientWidth = 0;
|
|
2129
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
2130
|
+
for (const { contentRect } of entries) {
|
|
2131
|
+
clientWidth = contentRect.width;
|
|
2132
|
+
center.value = clientWidth - (props.left || 0) - (props.right || 0);
|
|
2133
|
+
emit("change", {
|
|
2134
|
+
left: props.left,
|
|
2135
|
+
center: center.value,
|
|
2136
|
+
right: props.right
|
|
2137
|
+
});
|
|
2187
2138
|
}
|
|
2139
|
+
});
|
|
2140
|
+
vue.onMounted(() => {
|
|
2141
|
+
if (el.value) {
|
|
2142
|
+
resizerObserver.observe(el.value);
|
|
2143
|
+
}
|
|
2144
|
+
});
|
|
2145
|
+
vue.onUnmounted(() => {
|
|
2146
|
+
resizerObserver.disconnect();
|
|
2147
|
+
});
|
|
2148
|
+
const center = vue.ref(0);
|
|
2149
|
+
const changeLeft = (deltaX) => {
|
|
2150
|
+
if (typeof props.left === "undefined")
|
|
2151
|
+
return;
|
|
2152
|
+
const left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
2153
|
+
emit("update:left", left);
|
|
2154
|
+
center.value = clientWidth - left - (props.right || 0);
|
|
2155
|
+
emit("change", {
|
|
2156
|
+
left,
|
|
2157
|
+
center: center.value,
|
|
2158
|
+
right: props.right
|
|
2159
|
+
});
|
|
2160
|
+
};
|
|
2161
|
+
const changeRight = (deltaX) => {
|
|
2162
|
+
if (typeof props.right === "undefined")
|
|
2163
|
+
return;
|
|
2164
|
+
const right = Math.max(props.right - deltaX, props.minRight) || 0;
|
|
2165
|
+
emit("update:right", right);
|
|
2166
|
+
center.value = clientWidth - (props.left || 0) - right;
|
|
2167
|
+
emit("change", {
|
|
2168
|
+
left: props.left,
|
|
2169
|
+
center: center.value,
|
|
2170
|
+
right
|
|
2171
|
+
});
|
|
2172
|
+
};
|
|
2173
|
+
return (_ctx, _cache) => {
|
|
2174
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2175
|
+
ref_key: "el",
|
|
2176
|
+
ref: el
|
|
2177
|
+
}, [
|
|
2178
|
+
typeof props.left !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
2179
|
+
vue.createElementVNode("div", {
|
|
2180
|
+
class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
2181
|
+
style: vue.normalizeStyle(`width: ${__props.left}px`)
|
|
2182
|
+
}, [
|
|
2183
|
+
vue.renderSlot(_ctx.$slots, "left")
|
|
2184
|
+
], 6),
|
|
2185
|
+
vue.createVNode(_sfc_main$k, { onChange: changeLeft })
|
|
2186
|
+
], 64)) : vue.createCommentVNode("", true),
|
|
2187
|
+
vue.createElementVNode("div", {
|
|
2188
|
+
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
2189
|
+
style: vue.normalizeStyle(`width: ${center.value}px`)
|
|
2190
|
+
}, [
|
|
2191
|
+
vue.renderSlot(_ctx.$slots, "center")
|
|
2192
|
+
], 6),
|
|
2193
|
+
typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
2194
|
+
vue.createVNode(_sfc_main$k, { onChange: changeRight }),
|
|
2195
|
+
vue.createElementVNode("div", {
|
|
2196
|
+
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
2197
|
+
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
2198
|
+
}, [
|
|
2199
|
+
vue.renderSlot(_ctx.$slots, "right")
|
|
2200
|
+
], 6)
|
|
2201
|
+
], 64)) : vue.createCommentVNode("", true)
|
|
2202
|
+
], 512);
|
|
2188
2203
|
};
|
|
2189
2204
|
}
|
|
2190
2205
|
});
|
|
2191
2206
|
|
|
2192
2207
|
const _hoisted_1$8 = { class: "m-editor" };
|
|
2193
|
-
const
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
vue.
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2208
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
2209
|
+
__name: "Framework",
|
|
2210
|
+
props: {
|
|
2211
|
+
codeOptions: { default: () => ({}) }
|
|
2212
|
+
},
|
|
2213
|
+
setup(__props) {
|
|
2214
|
+
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
2215
|
+
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
2216
|
+
const { editorService, uiService } = vue.inject("services") || {};
|
|
2217
|
+
const root = vue.computed(() => editorService?.get("root"));
|
|
2218
|
+
const pageLength = vue.computed(() => editorService?.get("pageLength") || 0);
|
|
2219
|
+
const showSrc = vue.computed(() => uiService?.get("showSrc"));
|
|
2220
|
+
const columnWidth = vue.ref({
|
|
2221
|
+
left: DEFAULT_LEFT_COLUMN_WIDTH,
|
|
2222
|
+
center: 0,
|
|
2223
|
+
right: 0
|
|
2224
|
+
});
|
|
2225
|
+
uiService?.set("columnWidth", columnWidth.value);
|
|
2226
|
+
vue.watchEffect(() => {
|
|
2227
|
+
if (pageLength.value <= 0) {
|
|
2228
|
+
columnWidth.value.right = void 0;
|
|
2229
|
+
columnWidth.value.center = globalThis.document.body.clientWidth - DEFAULT_LEFT_COLUMN_WIDTH;
|
|
2230
|
+
} else {
|
|
2231
|
+
columnWidth.value.right = columnWidth.value.right || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
2232
|
+
columnWidth.value.center = globalThis.document.body.clientWidth - DEFAULT_LEFT_COLUMN_WIDTH - DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
2233
|
+
}
|
|
2234
|
+
});
|
|
2235
|
+
const saveCode = (value) => {
|
|
2236
|
+
try {
|
|
2237
|
+
editorService?.set("root", eval(value));
|
|
2238
|
+
} catch (e) {
|
|
2239
|
+
console.error(e);
|
|
2240
|
+
}
|
|
2241
|
+
};
|
|
2242
|
+
const COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorColumnWidthData";
|
|
2243
|
+
const columnWidthCacheData = globalThis.localStorage.getItem(COLUMN_WIDTH_STORAGE_KEY);
|
|
2244
|
+
if (columnWidthCacheData) {
|
|
2245
|
+
try {
|
|
2246
|
+
const columnWidthCache = JSON.parse(columnWidthCacheData);
|
|
2247
|
+
columnWidth.value = columnWidthCache;
|
|
2248
|
+
} catch (e) {
|
|
2249
|
+
console.error(e);
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
const columnWidthChange = (columnWidth2) => {
|
|
2253
|
+
uiService?.set("columnWidth", columnWidth2);
|
|
2254
|
+
globalThis.localStorage.setItem(COLUMN_WIDTH_STORAGE_KEY, JSON.stringify(columnWidth2));
|
|
2255
|
+
};
|
|
2256
|
+
return (_ctx, _cache) => {
|
|
2257
|
+
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2258
|
+
const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
|
|
2259
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
|
|
2260
|
+
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2261
|
+
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2262
|
+
key: 0,
|
|
2263
|
+
class: "m-editor-content",
|
|
2264
|
+
"init-values": vue.unref(root),
|
|
2265
|
+
options: __props.codeOptions,
|
|
2266
|
+
onSave: saveCode
|
|
2267
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$j, {
|
|
2268
|
+
key: 1,
|
|
2269
|
+
class: "m-editor-content",
|
|
2270
|
+
"left-class": "m-editor-framework-left",
|
|
2271
|
+
"center-class": "m-editor-framework-center",
|
|
2272
|
+
"right-class": "m-editor-framework-right",
|
|
2273
|
+
left: columnWidth.value.left,
|
|
2274
|
+
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
|
|
2275
|
+
right: columnWidth.value.right,
|
|
2276
|
+
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
2277
|
+
"min-left": 45,
|
|
2278
|
+
"min-right": 1,
|
|
2279
|
+
onChange: columnWidthChange
|
|
2280
|
+
}, vue.createSlots({
|
|
2281
|
+
left: vue.withCtx(() => [
|
|
2282
|
+
vue.renderSlot(_ctx.$slots, "sidebar")
|
|
2283
|
+
]),
|
|
2284
|
+
center: vue.withCtx(() => [
|
|
2285
|
+
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2286
|
+
vue.createVNode(AddPageBox)
|
|
2287
|
+
])
|
|
2288
|
+
]),
|
|
2289
|
+
_: 2
|
|
2229
2290
|
}, [
|
|
2230
|
-
vue.
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2291
|
+
vue.unref(pageLength) > 0 ? {
|
|
2292
|
+
name: "right",
|
|
2293
|
+
fn: vue.withCtx(() => [
|
|
2294
|
+
vue.createVNode(_component_el_scrollbar, null, {
|
|
2295
|
+
default: vue.withCtx(() => [
|
|
2296
|
+
vue.renderSlot(_ctx.$slots, "props-panel")
|
|
2297
|
+
]),
|
|
2298
|
+
_: 3
|
|
2299
|
+
})
|
|
2300
|
+
])
|
|
2301
|
+
} : void 0
|
|
2302
|
+
]), 1032, ["left", "right"]))
|
|
2303
|
+
]);
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2244
2307
|
|
|
2245
2308
|
const _hoisted_1$7 = ["src"];
|
|
2246
2309
|
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -2482,7 +2545,13 @@
|
|
|
2482
2545
|
});
|
|
2483
2546
|
break;
|
|
2484
2547
|
case "zoom":
|
|
2485
|
-
config.push(
|
|
2548
|
+
config.push(
|
|
2549
|
+
...getConfig("zoom-out"),
|
|
2550
|
+
...getConfig(`${parseInt(`${zoom.value * 100}`, 10)}%`),
|
|
2551
|
+
...getConfig("zoom-in"),
|
|
2552
|
+
...getConfig("scale-to-original"),
|
|
2553
|
+
...getConfig("scale-to-fit")
|
|
2554
|
+
);
|
|
2486
2555
|
break;
|
|
2487
2556
|
case "delete":
|
|
2488
2557
|
config.push({
|
|
@@ -2547,7 +2616,7 @@
|
|
|
2547
2616
|
className: "scale-to-fit",
|
|
2548
2617
|
icon: vue.markRaw(iconsVue.FullScreen),
|
|
2549
2618
|
tooltip: `\u7F29\u653E\u4EE5\u9002\u5E94(${ctrl}+0)`,
|
|
2550
|
-
handler: () => uiService?.set("zoom", uiService.calcZoom())
|
|
2619
|
+
handler: async () => uiService?.set("zoom", await uiService.calcZoom())
|
|
2551
2620
|
});
|
|
2552
2621
|
break;
|
|
2553
2622
|
case "rule":
|
|
@@ -2690,11 +2759,15 @@
|
|
|
2690
2759
|
const services = vue.inject("services");
|
|
2691
2760
|
const stageOptions = vue.inject("stageOptions");
|
|
2692
2761
|
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
2693
|
-
const list = vue.computed(
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2762
|
+
const list = vue.computed(
|
|
2763
|
+
() => services?.componentListService.getList().map((group) => ({
|
|
2764
|
+
...group,
|
|
2765
|
+
items: group.items.filter((item) => item.text.includes(searchText.value))
|
|
2766
|
+
}))
|
|
2767
|
+
);
|
|
2768
|
+
const collapseValue = vue.computed(
|
|
2769
|
+
() => Array(list.value?.length).fill(1).map((x, i) => i)
|
|
2770
|
+
);
|
|
2698
2771
|
let timeout;
|
|
2699
2772
|
let clientX;
|
|
2700
2773
|
let clientY;
|
|
@@ -2708,11 +2781,14 @@
|
|
|
2708
2781
|
const dragstartHandler = ({ text, type, data = {} }, e) => {
|
|
2709
2782
|
if (e.dataTransfer) {
|
|
2710
2783
|
e.dataTransfer.effectAllowed = "move";
|
|
2711
|
-
e.dataTransfer.setData(
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2784
|
+
e.dataTransfer.setData(
|
|
2785
|
+
"data",
|
|
2786
|
+
serialize__default.default({
|
|
2787
|
+
name: text,
|
|
2788
|
+
type,
|
|
2789
|
+
...data
|
|
2790
|
+
}).replace(/"(\w+)":\s/g, "$1: ")
|
|
2791
|
+
);
|
|
2716
2792
|
}
|
|
2717
2793
|
};
|
|
2718
2794
|
const dragendHandler = () => {
|
|
@@ -2968,12 +3044,18 @@
|
|
|
2968
3044
|
];
|
|
2969
3045
|
}
|
|
2970
3046
|
if (node.value?.items) {
|
|
2971
|
-
return componentList.value.reduce(
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
3047
|
+
return componentList.value.reduce(
|
|
3048
|
+
(subMenuData, group, index) => subMenuData.concat(
|
|
3049
|
+
createMenuItems(group),
|
|
3050
|
+
index < componentList.value.length - 1 ? [
|
|
3051
|
+
{
|
|
3052
|
+
type: "divider",
|
|
3053
|
+
direction: "horizontal"
|
|
3054
|
+
}
|
|
3055
|
+
] : []
|
|
3056
|
+
),
|
|
3057
|
+
[]
|
|
3058
|
+
) || [];
|
|
2977
3059
|
}
|
|
2978
3060
|
return [];
|
|
2979
3061
|
});
|
|
@@ -3165,7 +3247,9 @@
|
|
|
3165
3247
|
clicked.value = !clicked.value;
|
|
3166
3248
|
};
|
|
3167
3249
|
const statusData = useStatus(tree, editorService);
|
|
3168
|
-
const canHighlight = vue.computed(
|
|
3250
|
+
const canHighlight = vue.computed(
|
|
3251
|
+
() => statusData.highlightNode.value?.id !== statusData.clickNode.value?.id && !clicked.value
|
|
3252
|
+
);
|
|
3169
3253
|
editorService?.on("remove", () => {
|
|
3170
3254
|
setTimeout(() => {
|
|
3171
3255
|
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
@@ -3377,9 +3461,12 @@
|
|
|
3377
3461
|
},
|
|
3378
3462
|
setup(props) {
|
|
3379
3463
|
const activeTabName = vue.ref(props.data?.status);
|
|
3380
|
-
vue.watch(
|
|
3381
|
-
|
|
3382
|
-
|
|
3464
|
+
vue.watch(
|
|
3465
|
+
() => props.data?.status,
|
|
3466
|
+
(status) => {
|
|
3467
|
+
activeTabName.value = status || "0";
|
|
3468
|
+
}
|
|
3469
|
+
);
|
|
3383
3470
|
return {
|
|
3384
3471
|
activeTabName
|
|
3385
3472
|
};
|
|
@@ -3439,25 +3526,29 @@
|
|
|
3439
3526
|
const services = vue.inject("services");
|
|
3440
3527
|
const editorService = services?.editorService;
|
|
3441
3528
|
const uiService = services?.uiService;
|
|
3442
|
-
const pageBar = vue.ref();
|
|
3443
3529
|
const itemsContainer = vue.ref();
|
|
3444
|
-
const pageBarWidth = vue.ref(0);
|
|
3445
3530
|
const canScroll = vue.ref(false);
|
|
3446
3531
|
const showAddPageButton = vue.computed(() => uiService?.get("showAddPageButton"));
|
|
3447
|
-
const itemsContainerWidth = vue.
|
|
3448
|
-
let translateLeft = 0;
|
|
3449
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
3450
|
-
for (const { contentRect } of entries) {
|
|
3451
|
-
const { width } = contentRect;
|
|
3452
|
-
pageBarWidth.value = width || 0;
|
|
3453
|
-
setCanScroll();
|
|
3454
|
-
}
|
|
3455
|
-
});
|
|
3532
|
+
const itemsContainerWidth = vue.ref(0);
|
|
3456
3533
|
const setCanScroll = () => {
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3534
|
+
itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - (showAddPageButton.value ? 37 : 21);
|
|
3535
|
+
vue.nextTick(() => {
|
|
3536
|
+
if (itemsContainer.value) {
|
|
3537
|
+
canScroll.value = itemsContainer.value.scrollWidth - itemsContainerWidth.value > 1;
|
|
3538
|
+
}
|
|
3539
|
+
});
|
|
3460
3540
|
};
|
|
3541
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
3542
|
+
setCanScroll();
|
|
3543
|
+
});
|
|
3544
|
+
const pageBar = vue.ref();
|
|
3545
|
+
vue.onMounted(() => {
|
|
3546
|
+
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
3547
|
+
});
|
|
3548
|
+
vue.onUnmounted(() => {
|
|
3549
|
+
resizeObserver.disconnect();
|
|
3550
|
+
});
|
|
3551
|
+
let translateLeft = 0;
|
|
3461
3552
|
const scroll = (type) => {
|
|
3462
3553
|
if (!itemsContainer.value)
|
|
3463
3554
|
return;
|
|
@@ -3479,14 +3570,8 @@
|
|
|
3479
3570
|
}
|
|
3480
3571
|
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
3481
3572
|
};
|
|
3482
|
-
vue.
|
|
3483
|
-
|
|
3484
|
-
});
|
|
3485
|
-
vue.onUnmounted(() => {
|
|
3486
|
-
resizeObserver.disconnect();
|
|
3487
|
-
});
|
|
3488
|
-
const root = vue.computed(() => editorService?.get("root"));
|
|
3489
|
-
vue.watch(() => root.value?.items.length, (length = 0, preLength = 0) => {
|
|
3573
|
+
const pageLength = vue.computed(() => editorService?.get("pageLength"));
|
|
3574
|
+
vue.watch(pageLength, (length = 0, preLength = 0) => {
|
|
3490
3575
|
setTimeout(() => {
|
|
3491
3576
|
setCanScroll();
|
|
3492
3577
|
if (length < preLength) {
|
|
@@ -3506,7 +3591,6 @@
|
|
|
3506
3591
|
editorService.add(pageConfig);
|
|
3507
3592
|
};
|
|
3508
3593
|
return (_ctx, _cache) => {
|
|
3509
|
-
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
3510
3594
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3511
3595
|
class: "m-editor-page-bar",
|
|
3512
3596
|
ref_key: "pageBar",
|
|
@@ -3518,31 +3602,21 @@
|
|
|
3518
3602
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3519
3603
|
onClick: addPage
|
|
3520
3604
|
}, [
|
|
3521
|
-
vue.createVNode(
|
|
3522
|
-
default: vue.withCtx(() => [
|
|
3523
|
-
vue.createVNode(vue.unref(iconsVue.Plus))
|
|
3524
|
-
]),
|
|
3525
|
-
_: 1
|
|
3526
|
-
})
|
|
3605
|
+
vue.createVNode(_sfc_main$h, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
3527
3606
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
3528
3607
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3529
3608
|
key: 2,
|
|
3530
3609
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3531
3610
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
3532
3611
|
}, [
|
|
3533
|
-
vue.createVNode(
|
|
3534
|
-
default: vue.withCtx(() => [
|
|
3535
|
-
vue.createVNode(vue.unref(iconsVue.ArrowLeftBold))
|
|
3536
|
-
]),
|
|
3537
|
-
_: 1
|
|
3538
|
-
})
|
|
3612
|
+
vue.createVNode(_sfc_main$h, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
3539
3613
|
])) : vue.createCommentVNode("", true),
|
|
3540
|
-
vue.unref(
|
|
3614
|
+
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3541
3615
|
key: 3,
|
|
3542
3616
|
class: "m-editor-page-bar-items",
|
|
3543
3617
|
ref_key: "itemsContainer",
|
|
3544
3618
|
ref: itemsContainer,
|
|
3545
|
-
style: vue.normalizeStyle(`width: ${
|
|
3619
|
+
style: vue.normalizeStyle(`width: ${itemsContainerWidth.value}px`)
|
|
3546
3620
|
}, [
|
|
3547
3621
|
vue.renderSlot(_ctx.$slots, "default")
|
|
3548
3622
|
], 4)) : vue.createCommentVNode("", true),
|
|
@@ -3551,12 +3625,7 @@
|
|
|
3551
3625
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3552
3626
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
3553
3627
|
}, [
|
|
3554
|
-
vue.createVNode(
|
|
3555
|
-
default: vue.withCtx(() => [
|
|
3556
|
-
vue.createVNode(vue.unref(iconsVue.ArrowRightBold))
|
|
3557
|
-
]),
|
|
3558
|
-
_: 1
|
|
3559
|
-
})
|
|
3628
|
+
vue.createVNode(_sfc_main$h, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
3560
3629
|
])) : vue.createCommentVNode("", true)
|
|
3561
3630
|
], 512);
|
|
3562
3631
|
};
|
|
@@ -3683,6 +3752,7 @@
|
|
|
3683
3752
|
this.setSize();
|
|
3684
3753
|
this.setScrollSize();
|
|
3685
3754
|
this.resizeObserver.observe(this.container);
|
|
3755
|
+
this.resizeObserver.observe(this.target);
|
|
3686
3756
|
}
|
|
3687
3757
|
destroy() {
|
|
3688
3758
|
this.resizeObserver.disconnect();
|
|
@@ -3874,12 +3944,14 @@
|
|
|
3874
3944
|
const props = __props;
|
|
3875
3945
|
const container = vue.ref();
|
|
3876
3946
|
const el = vue.ref();
|
|
3877
|
-
const style = vue.computed(
|
|
3947
|
+
const style = vue.computed(
|
|
3948
|
+
() => `
|
|
3878
3949
|
width: ${props.width}px;
|
|
3879
3950
|
height: ${props.height}px;
|
|
3880
3951
|
position: absolute;
|
|
3881
3952
|
margin-top: 30px;
|
|
3882
|
-
`
|
|
3953
|
+
`
|
|
3954
|
+
);
|
|
3883
3955
|
const scrollWidth = vue.ref(0);
|
|
3884
3956
|
const scrollHeight = vue.ref(0);
|
|
3885
3957
|
let scrollViewer;
|
|
@@ -3901,9 +3973,12 @@
|
|
|
3901
3973
|
vue.onUnmounted(() => {
|
|
3902
3974
|
scrollViewer.destroy();
|
|
3903
3975
|
});
|
|
3904
|
-
vue.watch(
|
|
3905
|
-
|
|
3906
|
-
|
|
3976
|
+
vue.watch(
|
|
3977
|
+
() => props.zoom,
|
|
3978
|
+
() => {
|
|
3979
|
+
scrollViewer.setZoom(props.zoom);
|
|
3980
|
+
}
|
|
3981
|
+
);
|
|
3907
3982
|
const vOffset = vue.ref(0);
|
|
3908
3983
|
const vScrollHandler = (delta) => {
|
|
3909
3984
|
vOffset.value += delta;
|
|
@@ -4075,14 +4150,20 @@
|
|
|
4075
4150
|
},
|
|
4076
4151
|
...stageContentMenu
|
|
4077
4152
|
]);
|
|
4078
|
-
vue.watch(
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4153
|
+
vue.watch(
|
|
4154
|
+
parent,
|
|
4155
|
+
async () => {
|
|
4156
|
+
if (!parent.value || !editorService)
|
|
4157
|
+
return canCenter.value = false;
|
|
4158
|
+
const layout = await editorService.getLayout(parent.value);
|
|
4159
|
+
const isLayoutConform = [Layout.ABSOLUTE, Layout.FIXED].includes(layout);
|
|
4160
|
+
const isTypeConform = nodes.value?.every(
|
|
4161
|
+
(selectedNode) => ![schema.NodeType.ROOT, schema.NodeType.PAGE, "pop"].includes(`${selectedNode?.type}`)
|
|
4162
|
+
);
|
|
4163
|
+
canCenter.value = isLayoutConform && !!isTypeConform;
|
|
4164
|
+
},
|
|
4165
|
+
{ immediate: true }
|
|
4166
|
+
);
|
|
4086
4167
|
const show = async (e) => {
|
|
4087
4168
|
menu.value?.show(e);
|
|
4088
4169
|
const data = await storageService.getItem(COPY_STORAGE_KEY);
|
|
@@ -4335,9 +4416,9 @@
|
|
|
4335
4416
|
}).keydown([ctrl, "numpad-"], (e) => {
|
|
4336
4417
|
e.inputEvent.preventDefault();
|
|
4337
4418
|
services?.uiService.zoom(-0.1);
|
|
4338
|
-
}).keydown([ctrl, "0"], (e) => {
|
|
4419
|
+
}).keydown([ctrl, "0"], async (e) => {
|
|
4339
4420
|
e.inputEvent.preventDefault();
|
|
4340
|
-
services?.uiService.set("zoom", services.uiService.calcZoom());
|
|
4421
|
+
services?.uiService.set("zoom", await services.uiService.calcZoom());
|
|
4341
4422
|
}).keydown([ctrl, "1"], (e) => {
|
|
4342
4423
|
e.inputEvent.preventDefault();
|
|
4343
4424
|
services?.uiService.set("zoom", 1);
|
|
@@ -4351,7 +4432,7 @@
|
|
|
4351
4432
|
return (_ctx, _cache) => {
|
|
4352
4433
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4353
4434
|
class: "m-editor-workspace",
|
|
4354
|
-
tabindex: "1",
|
|
4435
|
+
tabindex: "-1",
|
|
4355
4436
|
ref_key: "workspace",
|
|
4356
4437
|
ref: workspace
|
|
4357
4438
|
}, [
|
|
@@ -4402,7 +4483,7 @@
|
|
|
4402
4483
|
Sidebar,
|
|
4403
4484
|
Workspace: _sfc_main$1,
|
|
4404
4485
|
PropsPanel: _sfc_main$e,
|
|
4405
|
-
Framework
|
|
4486
|
+
Framework: _sfc_main$i
|
|
4406
4487
|
},
|
|
4407
4488
|
props: {
|
|
4408
4489
|
modelValue: {
|
|
@@ -4495,37 +4576,64 @@
|
|
|
4495
4576
|
}
|
|
4496
4577
|
emit("update:modelValue", vue.toRaw(editorService.get("root")));
|
|
4497
4578
|
});
|
|
4498
|
-
vue.watch(
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4579
|
+
vue.watch(
|
|
4580
|
+
() => props.modelValue,
|
|
4581
|
+
(modelValue) => editorService.set("root", modelValue),
|
|
4582
|
+
{
|
|
4583
|
+
immediate: true
|
|
4584
|
+
}
|
|
4585
|
+
);
|
|
4586
|
+
vue.watch(
|
|
4587
|
+
() => props.componentGroupList,
|
|
4588
|
+
(componentGroupList) => componentListService.setList(componentGroupList),
|
|
4589
|
+
{
|
|
4590
|
+
immediate: true
|
|
4591
|
+
}
|
|
4592
|
+
);
|
|
4593
|
+
vue.watch(
|
|
4594
|
+
() => props.propsConfigs,
|
|
4595
|
+
(configs) => propsService.setPropsConfigs(configs),
|
|
4596
|
+
{
|
|
4597
|
+
immediate: true
|
|
4598
|
+
}
|
|
4599
|
+
);
|
|
4600
|
+
vue.watch(
|
|
4601
|
+
() => props.propsValues,
|
|
4602
|
+
(values) => propsService.setPropsValues(values),
|
|
4603
|
+
{
|
|
4604
|
+
immediate: true
|
|
4605
|
+
}
|
|
4606
|
+
);
|
|
4607
|
+
vue.watch(
|
|
4608
|
+
() => props.eventMethodList,
|
|
4609
|
+
(eventMethodList) => {
|
|
4610
|
+
const eventsList = {};
|
|
4611
|
+
const methodsList = {};
|
|
4612
|
+
Object.keys(eventMethodList).forEach((type) => {
|
|
4613
|
+
eventsList[type] = eventMethodList[type].events;
|
|
4614
|
+
methodsList[type] = eventMethodList[type].methods;
|
|
4615
|
+
});
|
|
4616
|
+
eventsService.setEvents(eventsList);
|
|
4617
|
+
eventsService.setMethods(methodsList);
|
|
4618
|
+
},
|
|
4619
|
+
{
|
|
4620
|
+
immediate: true
|
|
4621
|
+
}
|
|
4622
|
+
);
|
|
4623
|
+
vue.watch(
|
|
4624
|
+
() => props.defaultSelected,
|
|
4625
|
+
(defaultSelected) => defaultSelected && editorService.select(defaultSelected),
|
|
4626
|
+
{
|
|
4627
|
+
immediate: true
|
|
4628
|
+
}
|
|
4629
|
+
);
|
|
4630
|
+
vue.watch(
|
|
4631
|
+
() => props.stageRect,
|
|
4632
|
+
(stageRect) => stageRect && uiService.set("stageRect", stageRect),
|
|
4633
|
+
{
|
|
4634
|
+
immediate: true
|
|
4635
|
+
}
|
|
4636
|
+
);
|
|
4529
4637
|
vue.onUnmounted(() => {
|
|
4530
4638
|
editorService.destroy();
|
|
4531
4639
|
historyService.destroy();
|
|
@@ -4546,18 +4654,21 @@
|
|
|
4546
4654
|
vue.provide("services", services);
|
|
4547
4655
|
vue.provide("layerContentMenu", props.layerContentMenu);
|
|
4548
4656
|
vue.provide("stageContentMenu", props.stageContentMenu);
|
|
4549
|
-
vue.provide(
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4657
|
+
vue.provide(
|
|
4658
|
+
"stageOptions",
|
|
4659
|
+
vue.reactive({
|
|
4660
|
+
runtimeUrl: props.runtimeUrl,
|
|
4661
|
+
autoScrollIntoView: props.autoScrollIntoView,
|
|
4662
|
+
render: props.render,
|
|
4663
|
+
moveableOptions: props.moveableOptions,
|
|
4664
|
+
canSelect: props.canSelect,
|
|
4665
|
+
updateDragEl: props.updateDragEl,
|
|
4666
|
+
isContainer: props.isContainer,
|
|
4667
|
+
containerHighlightClassName: props.containerHighlightClassName,
|
|
4668
|
+
containerHighlightDuration: props.containerHighlightDuration,
|
|
4669
|
+
containerHighlightType: props.containerHighlightType
|
|
4670
|
+
})
|
|
4671
|
+
);
|
|
4561
4672
|
return services;
|
|
4562
4673
|
}
|
|
4563
4674
|
});
|
|
@@ -4638,9 +4749,9 @@
|
|
|
4638
4749
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
4639
4750
|
setConfig(option);
|
|
4640
4751
|
app.component(Editor.name, Editor);
|
|
4641
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
4642
|
-
app.component(
|
|
4643
|
-
app.component(
|
|
4752
|
+
app.component("m-fields-ui-select", _sfc_main$n);
|
|
4753
|
+
app.component("m-fields-code-link", _sfc_main$o);
|
|
4754
|
+
app.component("m-fields-vs-code", _sfc_main$p);
|
|
4644
4755
|
app.component(CodeEditor.name, CodeEditor);
|
|
4645
4756
|
}
|
|
4646
4757
|
};
|