@tmagic/editor 1.2.0-beta.9 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +62 -34
- package/dist/{tmagic-editor.mjs → tmagic-editor.js} +1641 -1266
- package/dist/tmagic-editor.js.map +1 -0
- package/dist/{tmagic-editor.umd.js → tmagic-editor.umd.cjs} +1649 -1270
- package/dist/tmagic-editor.umd.cjs.map +1 -0
- package/package.json +16 -14
- package/src/Editor.vue +66 -40
- package/src/components/CodeDraftEditor.vue +137 -0
- package/src/components/ContentMenu.vue +1 -1
- package/src/components/FunctionEditor.vue +190 -0
- package/src/components/Icon.vue +1 -1
- package/src/{layouts → components}/Layout.vue +54 -15
- package/src/components/ScrollBar.vue +1 -1
- package/src/components/ScrollViewer.vue +10 -1
- package/src/components/ToolButton.vue +1 -1
- package/src/fields/Code.vue +1 -1
- package/src/fields/CodeLink.vue +1 -1
- package/src/fields/CodeSelect.vue +102 -99
- package/src/fields/UISelect.vue +3 -3
- package/src/index.ts +2 -1
- package/src/layouts/AddPageBox.vue +5 -2
- package/src/layouts/CodeEditor.vue +2 -3
- package/src/layouts/Framework.vue +12 -10
- package/src/layouts/NavMenu.vue +11 -8
- package/src/layouts/PropsPanel.vue +12 -9
- package/src/layouts/Resizer.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +2 -3
- package/src/layouts/sidebar/LayerMenu.vue +9 -7
- package/src/layouts/sidebar/LayerPanel.vue +130 -178
- package/src/layouts/sidebar/Sidebar.vue +110 -26
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +33 -118
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +93 -126
- package/src/layouts/workspace/Breadcrumb.vue +6 -7
- package/src/layouts/workspace/PageBar.vue +3 -3
- package/src/layouts/workspace/PageBarScrollContainer.vue +5 -3
- package/src/layouts/workspace/Stage.vue +36 -18
- package/src/layouts/workspace/ViewerMenu.vue +16 -15
- package/src/layouts/workspace/Workspace.vue +9 -6
- package/src/services/BaseService.ts +11 -2
- package/src/services/codeBlock.ts +136 -146
- package/src/services/componentList.ts +7 -2
- package/src/services/editor.ts +161 -85
- package/src/services/events.ts +7 -2
- package/src/services/history.ts +8 -17
- package/src/services/props.ts +8 -3
- package/src/services/storage.ts +1 -0
- package/src/services/ui.ts +20 -10
- package/src/theme/code-block.scss +46 -23
- package/src/theme/component-list-panel.scss +8 -5
- package/src/type.ts +84 -63
- package/src/utils/config.ts +1 -1
- package/src/utils/editor.ts +17 -3
- package/src/utils/index.ts +2 -1
- package/src/utils/logger.ts +1 -1
- package/src/utils/operator.ts +12 -12
- package/src/utils/props.ts +3 -3
- package/src/utils/scroll-viewer.ts +18 -2
- package/src/utils/stage.ts +10 -9
- package/src/utils/undo-redo.ts +1 -1
- package/types/Editor.vue.d.ts +48 -28
- package/types/components/CodeDraftEditor.vue.d.ts +55 -0
- package/types/components/ContentMenu.vue.d.ts +11 -87
- package/types/components/FunctionEditor.vue.d.ts +60 -0
- package/types/components/Icon.vue.d.ts +4 -50
- package/types/{layouts → components}/Layout.vue.d.ts +12 -1
- package/types/components/ScrollBar.vue.d.ts +7 -65
- package/types/components/ScrollViewer.vue.d.ts +45 -1
- package/types/components/ToolButton.vue.d.ts +12 -78
- package/types/fields/Code.vue.d.ts +11 -77
- package/types/fields/CodeLink.vue.d.ts +12 -82
- package/types/fields/CodeSelect.vue.d.ts +13 -77
- package/types/fields/UISelect.vue.d.ts +7 -65
- package/types/index.d.ts +1 -0
- package/types/layouts/AddPageBox.vue.d.ts +1 -43
- package/types/layouts/CodeEditor.vue.d.ts +22 -130
- package/types/layouts/NavMenu.vue.d.ts +9 -69
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +16 -48
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +24 -7
- package/types/layouts/sidebar/Sidebar.vue.d.ts +10 -5
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +24 -6
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +11 -5
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -43
- package/types/layouts/workspace/Stage.vue.d.ts +15 -43
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +11 -66
- package/types/layouts/workspace/Workspace.vue.d.ts +25 -8
- package/types/services/BaseService.d.ts +2 -1
- package/types/services/codeBlock.d.ts +56 -47
- package/types/services/componentList.d.ts +1 -0
- package/types/services/editor.d.ts +10 -11
- package/types/services/events.d.ts +1 -0
- package/types/services/history.d.ts +5 -15
- package/types/services/props.d.ts +3 -2
- package/types/services/ui.d.ts +24 -24
- package/types/type.d.ts +70 -59
- package/types/utils/editor.d.ts +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +1 -1
- package/types/utils/scroll-viewer.d.ts +5 -0
- package/dist/tmagic-editor.mjs.map +0 -1
- package/dist/tmagic-editor.umd.js.map +0 -1
- package/src/layouts/sidebar/TabPane.vue +0 -118
- package/types/layouts/sidebar/TabPane.vue.d.ts +0 -82
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.
|
|
5
|
-
})(this, (function (exports, vue, serialize, lodashEs,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('@element-plus/icons-vue'), require('lodash-es'), require('@tmagic/form'), require('@tmagic/schema'), require('@tmagic/design'), require('monaco-editor'), require('@tmagic/stage'), require('gesto'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', '@element-plus/icons-vue', 'lodash-es', '@tmagic/form', '@tmagic/schema', '@tmagic/design', 'monaco-editor', '@tmagic/stage', 'gesto', '@tmagic/utils', 'events', '@tmagic/core', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.iconsVue, global.lodashEs, global.form, global.schema, global.design, global.monaco, global.StageCore, global.Gesto, global.utils, global.events, global.core, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, serialize, iconsVue, lodashEs, form, schema, design, monaco, StageCore, Gesto, utils, events, core, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
|
8
8
|
|
|
@@ -30,8 +30,11 @@
|
|
|
30
30
|
const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
|
|
31
31
|
const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const __default__$t = vue.defineComponent({
|
|
34
|
+
name: "MEditorCode"
|
|
35
|
+
});
|
|
36
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
37
|
+
...__default__$t,
|
|
35
38
|
props: {
|
|
36
39
|
model: null,
|
|
37
40
|
name: null,
|
|
@@ -60,8 +63,11 @@
|
|
|
60
63
|
}
|
|
61
64
|
});
|
|
62
65
|
|
|
63
|
-
const
|
|
64
|
-
|
|
66
|
+
const __default__$s = vue.defineComponent({
|
|
67
|
+
name: "MEditorCodeLink"
|
|
68
|
+
});
|
|
69
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
70
|
+
...__default__$s,
|
|
65
71
|
props: {
|
|
66
72
|
config: null,
|
|
67
73
|
model: null,
|
|
@@ -130,57 +136,55 @@
|
|
|
130
136
|
}
|
|
131
137
|
});
|
|
132
138
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
139
|
+
const _hoisted_1$g = ["src"];
|
|
140
|
+
const __default__$r = vue.defineComponent({
|
|
141
|
+
name: "MEditorIcon"
|
|
142
|
+
});
|
|
143
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
144
|
+
...__default__$r,
|
|
145
|
+
props: {
|
|
146
|
+
icon: null
|
|
147
|
+
},
|
|
148
|
+
setup(__props) {
|
|
149
|
+
return (_ctx, _cache) => {
|
|
150
|
+
return !__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
151
|
+
key: 0,
|
|
152
|
+
class: "magic-editor-icon"
|
|
153
|
+
}, {
|
|
154
|
+
default: vue.withCtx(() => [
|
|
155
|
+
vue.createVNode(vue.unref(iconsVue.Edit))
|
|
156
|
+
]),
|
|
157
|
+
_: 1
|
|
158
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
159
|
+
key: 1,
|
|
160
|
+
class: "magic-editor-icon"
|
|
161
|
+
}, {
|
|
162
|
+
default: vue.withCtx(() => [
|
|
163
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$g)
|
|
164
|
+
]),
|
|
165
|
+
_: 1
|
|
166
|
+
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
167
|
+
key: 2,
|
|
168
|
+
class: vue.normalizeClass(["magic-editor-icon", __props.icon])
|
|
169
|
+
}, null, 2)) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
170
|
+
key: 3,
|
|
171
|
+
class: "magic-editor-icon"
|
|
172
|
+
}, {
|
|
173
|
+
default: vue.withCtx(() => [
|
|
174
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
|
|
175
|
+
]),
|
|
176
|
+
_: 1
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
173
181
|
|
|
174
|
-
const _hoisted_1$
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}, null, -1);
|
|
179
|
-
const _hoisted_3$3 = [
|
|
180
|
-
_hoisted_2$6
|
|
181
|
-
];
|
|
182
|
+
const _hoisted_1$f = { class: "m-fields-code-select" };
|
|
183
|
+
const __default__$q = vue.defineComponent({
|
|
184
|
+
name: "MEditorCodeSelect"
|
|
185
|
+
});
|
|
182
186
|
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
183
|
-
|
|
187
|
+
...__default__$q,
|
|
184
188
|
props: {
|
|
185
189
|
config: null,
|
|
186
190
|
model: null,
|
|
@@ -192,119 +196,119 @@
|
|
|
192
196
|
setup(__props, { emit }) {
|
|
193
197
|
const props = __props;
|
|
194
198
|
const services = vue.inject("services");
|
|
195
|
-
const
|
|
196
|
-
const
|
|
199
|
+
const mForm = vue.inject("mForm");
|
|
200
|
+
const codeDsl = vue.computed(() => services?.codeBlockService.getCodeDslSync());
|
|
201
|
+
const tableConfig = vue.computed(() => {
|
|
197
202
|
const defaultConfig = {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
dropSort: false,
|
|
204
|
+
enableFullscreen: false,
|
|
205
|
+
border: true,
|
|
206
|
+
operateColWidth: 60,
|
|
207
|
+
items: [
|
|
208
|
+
{
|
|
209
|
+
type: "select",
|
|
210
|
+
label: "\u4EE3\u7801\u5757",
|
|
211
|
+
name: "codeId",
|
|
212
|
+
width: "200px",
|
|
213
|
+
options: () => {
|
|
214
|
+
if (codeDsl.value) {
|
|
215
|
+
return lodashEs.map(codeDsl.value, (value, key) => ({
|
|
216
|
+
text: `${value.name}\uFF08${key}\uFF09`,
|
|
217
|
+
label: `${value.name}\uFF08${key}\uFF09`,
|
|
218
|
+
value: key
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
return [];
|
|
222
|
+
},
|
|
223
|
+
onChange: (formState, codeId, { model }) => {
|
|
224
|
+
model.params = {};
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: "params",
|
|
229
|
+
label: "\u53C2\u6570",
|
|
230
|
+
defaultValue: {},
|
|
231
|
+
itemsFunction: (row) => {
|
|
232
|
+
const paramsConfig = getParamsConfig(row.codeId);
|
|
233
|
+
if (lodashEs.isEmpty(row.params) || !row.params) {
|
|
234
|
+
form.createValues(mForm, paramsConfig, {}, row.params);
|
|
235
|
+
}
|
|
236
|
+
return paramsConfig;
|
|
237
|
+
}
|
|
207
238
|
}
|
|
208
|
-
|
|
209
|
-
}
|
|
239
|
+
]
|
|
210
240
|
};
|
|
211
241
|
return {
|
|
212
242
|
...defaultConfig,
|
|
213
|
-
...props.config.
|
|
243
|
+
...props.config.tableConfig
|
|
214
244
|
};
|
|
215
245
|
});
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
});
|
|
230
|
-
const changeHandler = async (value) => {
|
|
231
|
-
let codeIds = value;
|
|
232
|
-
if (typeof value === "string") {
|
|
233
|
-
multiple.value = false;
|
|
234
|
-
codeIds = value ? [value] : [];
|
|
235
|
-
}
|
|
236
|
-
await setCombineRelation(codeIds);
|
|
237
|
-
emit("change", value);
|
|
238
|
-
};
|
|
239
|
-
const setCombineRelation = async (codeIds) => {
|
|
240
|
-
const { id = "" } = services?.editorService.get("node") || {};
|
|
241
|
-
let opFlag = CodeSelectOp.CHANGE;
|
|
242
|
-
let diffValues = codeIds;
|
|
243
|
-
if (multiple.value) {
|
|
244
|
-
lastTagSnapshot.value = form?.initValues[props.name] || [];
|
|
245
|
-
opFlag = codeIds.length < lastTagSnapshot.value.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
|
|
246
|
-
diffValues = lodashEs.xor(codeIds, lastTagSnapshot.value);
|
|
246
|
+
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
247
|
+
vue.watch(
|
|
248
|
+
() => props.model[props.name],
|
|
249
|
+
(value) => {
|
|
250
|
+
if (lodashEs.isEmpty(value)) {
|
|
251
|
+
props.model[props.name] = {
|
|
252
|
+
hookType: schema.HookType.CODE,
|
|
253
|
+
hookData: []
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
immediate: true
|
|
247
259
|
}
|
|
248
|
-
|
|
260
|
+
);
|
|
261
|
+
const changeHandler = async () => {
|
|
262
|
+
emit("change", props.model[props.name]);
|
|
249
263
|
};
|
|
250
|
-
const
|
|
251
|
-
if (
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
264
|
+
const getParamsConfig = (codeId) => {
|
|
265
|
+
if (!codeDsl.value)
|
|
266
|
+
return [];
|
|
267
|
+
const paramStatements = codeDsl.value[codeId]?.params;
|
|
268
|
+
if (lodashEs.isEmpty(paramStatements))
|
|
269
|
+
return [];
|
|
270
|
+
return paramStatements.map((paramState) => ({
|
|
271
|
+
labelWidth: "100px",
|
|
272
|
+
text: paramState.name,
|
|
273
|
+
...paramState
|
|
274
|
+
}));
|
|
275
|
+
};
|
|
276
|
+
const editCode = (codeId) => {
|
|
277
|
+
services?.codeBlockService.setCodeEditorContent(true, codeId);
|
|
258
278
|
};
|
|
259
279
|
return (_ctx, _cache) => {
|
|
260
|
-
const
|
|
261
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
vue.
|
|
278
|
-
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
279
|
-
class: "tool-item",
|
|
280
|
-
effect: "dark",
|
|
281
|
-
content: "\u67E5\u770B\u4EE3\u7801\u5757",
|
|
282
|
-
placement: "top"
|
|
283
|
-
}, {
|
|
284
|
-
default: vue.withCtx(() => [
|
|
285
|
-
(vue.openBlock(), vue.createElementBlock("svg", {
|
|
286
|
-
onClick: viewHandler,
|
|
287
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
288
|
-
viewBox: "0 0 24 24",
|
|
289
|
-
width: "15px",
|
|
290
|
-
height: "15px",
|
|
291
|
-
"data-v-65a7fb6c": ""
|
|
292
|
-
}, _hoisted_3$3))
|
|
293
|
-
]),
|
|
294
|
-
_: 1
|
|
295
|
-
})
|
|
296
|
-
])
|
|
280
|
+
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
281
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
282
|
+
vue.createVNode(_component_m_form_table, {
|
|
283
|
+
config: vue.unref(tableConfig),
|
|
284
|
+
model: __props.model[__props.name],
|
|
285
|
+
name: "hookData",
|
|
286
|
+
enableToggleMode: false,
|
|
287
|
+
prop: __props.prop,
|
|
288
|
+
size: __props.size,
|
|
289
|
+
onChange: changeHandler
|
|
290
|
+
}, {
|
|
291
|
+
operateCol: vue.withCtx(({ scope }) => [
|
|
292
|
+
scope.row.codeId ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
293
|
+
key: 0,
|
|
294
|
+
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
295
|
+
class: "edit-icon",
|
|
296
|
+
onClick: ($event) => editCode(scope.row.codeId)
|
|
297
|
+
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
297
298
|
]),
|
|
298
299
|
_: 1
|
|
299
|
-
})
|
|
300
|
+
}, 8, ["config", "model", "prop", "size"])
|
|
300
301
|
]);
|
|
301
302
|
};
|
|
302
303
|
}
|
|
303
304
|
});
|
|
304
305
|
|
|
305
|
-
const _hoisted_1$
|
|
306
|
+
const _hoisted_1$e = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
|
|
307
|
+
const __default__$p = vue.defineComponent({
|
|
308
|
+
name: "MEditorUISelect"
|
|
309
|
+
});
|
|
306
310
|
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
307
|
-
|
|
311
|
+
...__default__$p,
|
|
308
312
|
props: {
|
|
309
313
|
config: null,
|
|
310
314
|
model: null,
|
|
@@ -366,7 +370,7 @@
|
|
|
366
370
|
style: { "padding": "0" }
|
|
367
371
|
}, {
|
|
368
372
|
default: vue.withCtx(() => [
|
|
369
|
-
_hoisted_1$
|
|
373
|
+
_hoisted_1$e
|
|
370
374
|
]),
|
|
371
375
|
_: 1
|
|
372
376
|
}, 8, ["icon"])
|
|
@@ -414,12 +418,15 @@
|
|
|
414
418
|
|
|
415
419
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
416
420
|
|
|
421
|
+
const __default__$o = vue.defineComponent({
|
|
422
|
+
name: "MEditorCodeEditor"
|
|
423
|
+
});
|
|
417
424
|
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
418
|
-
|
|
425
|
+
...__default__$o,
|
|
419
426
|
props: {
|
|
420
427
|
initValues: null,
|
|
421
428
|
modifiedValues: null,
|
|
422
|
-
type:
|
|
429
|
+
type: null,
|
|
423
430
|
language: { default: "javascript" },
|
|
424
431
|
options: { default: () => ({
|
|
425
432
|
tabSize: 2
|
|
@@ -544,46 +551,207 @@
|
|
|
544
551
|
};
|
|
545
552
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
546
553
|
|
|
547
|
-
const
|
|
554
|
+
const __default__$n = vue.defineComponent({
|
|
555
|
+
name: "MEditorResizer"
|
|
556
|
+
});
|
|
548
557
|
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
549
|
-
|
|
558
|
+
...__default__$n,
|
|
559
|
+
emits: ["change"],
|
|
560
|
+
setup(__props, { emit }) {
|
|
561
|
+
const target = vue.ref();
|
|
562
|
+
let getso;
|
|
563
|
+
vue.onMounted(() => {
|
|
564
|
+
if (!target.value)
|
|
565
|
+
return;
|
|
566
|
+
getso = new Gesto__default.default(target.value, {
|
|
567
|
+
container: window,
|
|
568
|
+
pinchOutside: true
|
|
569
|
+
}).on("drag", (e) => {
|
|
570
|
+
if (!target.value)
|
|
571
|
+
return;
|
|
572
|
+
emit("change", e.deltaX);
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
vue.onUnmounted(() => {
|
|
576
|
+
getso?.unset();
|
|
577
|
+
});
|
|
578
|
+
return (_ctx, _cache) => {
|
|
579
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
580
|
+
ref_key: "target",
|
|
581
|
+
ref: target,
|
|
582
|
+
class: "m-editor-resizer"
|
|
583
|
+
}, [
|
|
584
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
585
|
+
], 512);
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
const __default__$m = vue.defineComponent({
|
|
591
|
+
name: "MEditorLayout"
|
|
592
|
+
});
|
|
593
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
594
|
+
...__default__$m,
|
|
550
595
|
props: {
|
|
551
|
-
|
|
596
|
+
left: null,
|
|
597
|
+
right: null,
|
|
598
|
+
minLeft: { default: 46 },
|
|
599
|
+
minRight: { default: 1 },
|
|
600
|
+
minCenter: { default: 5 },
|
|
601
|
+
leftClass: null,
|
|
602
|
+
rightClass: null,
|
|
603
|
+
centerClass: null
|
|
552
604
|
},
|
|
553
|
-
|
|
605
|
+
emits: ["update:left", "change", "update:right"],
|
|
606
|
+
setup(__props, { emit }) {
|
|
607
|
+
const props = __props;
|
|
608
|
+
const el = vue.ref();
|
|
609
|
+
const hasLeft = vue.computed(() => typeof props.left !== "undefined");
|
|
610
|
+
const hasRight = vue.computed(() => typeof props.right !== "undefined");
|
|
611
|
+
const getCenterWidth = (clientWidth2, left, right) => {
|
|
612
|
+
let center2 = clientWidth2 - left - right;
|
|
613
|
+
if (center2 < props.minCenter) {
|
|
614
|
+
center2 = props.minCenter;
|
|
615
|
+
if (left < right) {
|
|
616
|
+
right = clientWidth2 - left - props.minCenter;
|
|
617
|
+
} else {
|
|
618
|
+
left = clientWidth2 - right - props.minCenter;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return {
|
|
622
|
+
center: center2,
|
|
623
|
+
left,
|
|
624
|
+
right
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
let clientWidth = 0;
|
|
628
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
629
|
+
for (const { contentRect } of entries) {
|
|
630
|
+
clientWidth = contentRect.width;
|
|
631
|
+
let left = props.left || 0;
|
|
632
|
+
let right = props.right || 0;
|
|
633
|
+
if (left > clientWidth) {
|
|
634
|
+
left = clientWidth / 3;
|
|
635
|
+
}
|
|
636
|
+
if (right > clientWidth) {
|
|
637
|
+
right = clientWidth / 3;
|
|
638
|
+
}
|
|
639
|
+
const columnWidth = getCenterWidth(clientWidth, left, right);
|
|
640
|
+
center.value = columnWidth.center;
|
|
641
|
+
emit("change", {
|
|
642
|
+
left: columnWidth.left,
|
|
643
|
+
center: center.value,
|
|
644
|
+
right: columnWidth.right
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
vue.onMounted(() => {
|
|
649
|
+
if (el.value) {
|
|
650
|
+
resizerObserver.observe(el.value);
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
vue.onUnmounted(() => {
|
|
654
|
+
resizerObserver.disconnect();
|
|
655
|
+
});
|
|
656
|
+
const center = vue.ref(0);
|
|
657
|
+
const changeLeft = (deltaX) => {
|
|
658
|
+
if (typeof props.left === "undefined")
|
|
659
|
+
return;
|
|
660
|
+
let left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
661
|
+
emit("update:left", left);
|
|
662
|
+
if (clientWidth - left - (props.right || 0) <= 0) {
|
|
663
|
+
left = props.left;
|
|
664
|
+
}
|
|
665
|
+
const columnWidth = getCenterWidth(clientWidth, left, props.right || 0);
|
|
666
|
+
center.value = columnWidth.center;
|
|
667
|
+
emit("change", {
|
|
668
|
+
left: columnWidth.left,
|
|
669
|
+
center: center.value,
|
|
670
|
+
right: columnWidth.right
|
|
671
|
+
});
|
|
672
|
+
};
|
|
673
|
+
const changeRight = (deltaX) => {
|
|
674
|
+
if (typeof props.right === "undefined")
|
|
675
|
+
return;
|
|
676
|
+
let right = Math.max(props.right - deltaX, props.minRight) || 0;
|
|
677
|
+
emit("update:right", right);
|
|
678
|
+
if (clientWidth - (props.left || 0) - right <= 0) {
|
|
679
|
+
right = props.right;
|
|
680
|
+
}
|
|
681
|
+
const columnWidth = getCenterWidth(clientWidth, props.left || 0, right);
|
|
682
|
+
center.value = columnWidth.center;
|
|
683
|
+
emit("change", {
|
|
684
|
+
left: columnWidth.left,
|
|
685
|
+
center: center.value,
|
|
686
|
+
right: columnWidth.right
|
|
687
|
+
});
|
|
688
|
+
};
|
|
554
689
|
return (_ctx, _cache) => {
|
|
555
|
-
return
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
key:
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
690
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
691
|
+
ref_key: "el",
|
|
692
|
+
ref: el,
|
|
693
|
+
class: "m-editor-layout"
|
|
694
|
+
}, [
|
|
695
|
+
vue.unref(hasLeft) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
696
|
+
vue.createElementVNode("div", {
|
|
697
|
+
class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
698
|
+
style: vue.normalizeStyle(`width: ${__props.left}px`)
|
|
699
|
+
}, [
|
|
700
|
+
vue.renderSlot(_ctx.$slots, "left")
|
|
701
|
+
], 6),
|
|
702
|
+
vue.createVNode(_sfc_main$o, { onChange: changeLeft })
|
|
703
|
+
], 64)) : vue.createCommentVNode("", true),
|
|
704
|
+
vue.createElementVNode("div", {
|
|
705
|
+
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
706
|
+
style: vue.normalizeStyle(`width: ${center.value}px`)
|
|
707
|
+
}, [
|
|
708
|
+
vue.renderSlot(_ctx.$slots, "center")
|
|
709
|
+
], 6),
|
|
710
|
+
vue.unref(hasRight) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
711
|
+
vue.createVNode(_sfc_main$o, { onChange: changeRight }),
|
|
712
|
+
vue.createElementVNode("div", {
|
|
713
|
+
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
714
|
+
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
715
|
+
}, [
|
|
716
|
+
vue.renderSlot(_ctx.$slots, "right")
|
|
717
|
+
], 6)
|
|
718
|
+
], 64)) : vue.createCommentVNode("", true)
|
|
719
|
+
], 512);
|
|
583
720
|
};
|
|
584
721
|
}
|
|
585
722
|
});
|
|
586
723
|
|
|
724
|
+
var ColumnLayout = /* @__PURE__ */ ((ColumnLayout2) => {
|
|
725
|
+
ColumnLayout2["LEFT"] = "left";
|
|
726
|
+
ColumnLayout2["CENTER"] = "center";
|
|
727
|
+
ColumnLayout2["RIGHT"] = "right";
|
|
728
|
+
return ColumnLayout2;
|
|
729
|
+
})(ColumnLayout || {});
|
|
730
|
+
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
731
|
+
LayerOffset2["TOP"] = "top";
|
|
732
|
+
LayerOffset2["BOTTOM"] = "bottom";
|
|
733
|
+
return LayerOffset2;
|
|
734
|
+
})(LayerOffset || {});
|
|
735
|
+
var Layout = /* @__PURE__ */ ((Layout2) => {
|
|
736
|
+
Layout2["FLEX"] = "flex";
|
|
737
|
+
Layout2["FIXED"] = "fixed";
|
|
738
|
+
Layout2["RELATIVE"] = "relative";
|
|
739
|
+
Layout2["ABSOLUTE"] = "absolute";
|
|
740
|
+
return Layout2;
|
|
741
|
+
})(Layout || {});
|
|
742
|
+
var Keys = /* @__PURE__ */ ((Keys2) => {
|
|
743
|
+
Keys2["ESCAPE"] = "Space";
|
|
744
|
+
return Keys2;
|
|
745
|
+
})(Keys || {});
|
|
746
|
+
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
747
|
+
const V_GUIDE_LINE_STORAGE_KEY = "$MagicStageVerticalGuidelinesData";
|
|
748
|
+
var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
749
|
+
CodeDeleteErrorType2["UNDELETEABLE"] = "undeleteable";
|
|
750
|
+
CodeDeleteErrorType2["BIND"] = "bind";
|
|
751
|
+
return CodeDeleteErrorType2;
|
|
752
|
+
})(CodeDeleteErrorType || {});
|
|
753
|
+
const CODE_DRAFT_STORAGE_KEY = "magicCodeDraft";
|
|
754
|
+
|
|
587
755
|
const log = (...args) => {
|
|
588
756
|
if (process.env.NODE_ENV === "development") {
|
|
589
757
|
console.log("magic editor: ", ...args);
|
|
@@ -713,6 +881,14 @@
|
|
|
713
881
|
this.pluginOptionsList[methodName2].push(method);
|
|
714
882
|
});
|
|
715
883
|
}
|
|
884
|
+
removeAllPlugins() {
|
|
885
|
+
Object.keys(this.pluginOptionsList).forEach((key) => {
|
|
886
|
+
this.pluginOptionsList[key] = [];
|
|
887
|
+
});
|
|
888
|
+
Object.keys(this.middleware).forEach((key) => {
|
|
889
|
+
this.middleware[key] = [];
|
|
890
|
+
});
|
|
891
|
+
}
|
|
716
892
|
async doTask() {
|
|
717
893
|
this.doingTask = true;
|
|
718
894
|
let task = this.taskList.shift();
|
|
@@ -730,9 +906,9 @@
|
|
|
730
906
|
codeDsl: null,
|
|
731
907
|
id: "",
|
|
732
908
|
editable: true,
|
|
733
|
-
mode: CodeEditorMode.EDITOR,
|
|
734
909
|
combineIds: [],
|
|
735
|
-
undeletableList: []
|
|
910
|
+
undeletableList: [],
|
|
911
|
+
relations: {}
|
|
736
912
|
});
|
|
737
913
|
constructor() {
|
|
738
914
|
super([
|
|
@@ -744,37 +920,45 @@
|
|
|
744
920
|
"setCodeDslById",
|
|
745
921
|
"setCodeEditorShowStatus",
|
|
746
922
|
"setEditStatus",
|
|
747
|
-
"setMode",
|
|
748
923
|
"setCombineIds",
|
|
749
924
|
"setUndeleteableList",
|
|
750
925
|
"deleteCodeDslByIds"
|
|
751
926
|
]);
|
|
752
927
|
}
|
|
753
|
-
async setCodeDsl(
|
|
754
|
-
this.state.codeDsl =
|
|
928
|
+
async setCodeDsl(codeDsl2) {
|
|
929
|
+
this.state.codeDsl = codeDsl2;
|
|
755
930
|
await editorService.setCodeDsl(this.state.codeDsl);
|
|
756
931
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
757
932
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
758
933
|
}
|
|
759
934
|
async getCodeDsl(forceRefresh = false) {
|
|
935
|
+
return this.getCodeDslSync(forceRefresh);
|
|
936
|
+
}
|
|
937
|
+
getCodeDslSync(forceRefresh = false) {
|
|
760
938
|
if (!this.state.codeDsl || forceRefresh) {
|
|
761
|
-
this.state.codeDsl =
|
|
939
|
+
this.state.codeDsl = editorService.getCodeDslSync();
|
|
762
940
|
}
|
|
763
941
|
return this.state.codeDsl;
|
|
764
942
|
}
|
|
765
|
-
async getCodeContentById(
|
|
766
|
-
if (!
|
|
943
|
+
async getCodeContentById(id2) {
|
|
944
|
+
if (!id2)
|
|
767
945
|
return null;
|
|
768
946
|
const totalCodeDsl = await this.getCodeDsl();
|
|
769
947
|
if (!totalCodeDsl)
|
|
770
948
|
return null;
|
|
771
|
-
return totalCodeDsl[
|
|
949
|
+
return totalCodeDsl[id2] ?? null;
|
|
772
950
|
}
|
|
773
951
|
async setCodeDslById(id, codeConfig) {
|
|
774
952
|
let codeDsl = await this.getCodeDsl();
|
|
953
|
+
const codeConfigProcessed = codeConfig;
|
|
954
|
+
if (codeConfig.content) {
|
|
955
|
+
codeConfigProcessed.content = eval(codeConfig.content);
|
|
956
|
+
}
|
|
775
957
|
if (!codeDsl) {
|
|
776
958
|
codeDsl = {
|
|
777
|
-
[id]:
|
|
959
|
+
[id]: {
|
|
960
|
+
...codeConfigProcessed
|
|
961
|
+
}
|
|
778
962
|
};
|
|
779
963
|
} else {
|
|
780
964
|
const existContent = codeDsl[id] || {};
|
|
@@ -782,15 +966,15 @@
|
|
|
782
966
|
...codeDsl,
|
|
783
967
|
[id]: {
|
|
784
968
|
...existContent,
|
|
785
|
-
...
|
|
969
|
+
...codeConfigProcessed
|
|
786
970
|
}
|
|
787
971
|
};
|
|
788
972
|
}
|
|
789
973
|
await this.setCodeDsl(codeDsl);
|
|
790
974
|
}
|
|
791
975
|
async getCodeDslByIds(ids) {
|
|
792
|
-
const
|
|
793
|
-
return lodashEs.pick(
|
|
976
|
+
const codeDsl2 = await this.getCodeDsl();
|
|
977
|
+
return lodashEs.pick(codeDsl2, ids);
|
|
794
978
|
}
|
|
795
979
|
async setCodeEditorShowStatus(status) {
|
|
796
980
|
this.state.isShowCodeEditor = status;
|
|
@@ -798,10 +982,10 @@
|
|
|
798
982
|
getCodeEditorShowStatus() {
|
|
799
983
|
return this.state.isShowCodeEditor;
|
|
800
984
|
}
|
|
801
|
-
setCodeEditorContent(status,
|
|
802
|
-
if (!
|
|
985
|
+
setCodeEditorContent(status, id2) {
|
|
986
|
+
if (!id2)
|
|
803
987
|
return;
|
|
804
|
-
this.setId(
|
|
988
|
+
this.setId(id2);
|
|
805
989
|
this.state.isShowCodeEditor = status;
|
|
806
990
|
}
|
|
807
991
|
async getCurrentDsl() {
|
|
@@ -813,81 +997,31 @@
|
|
|
813
997
|
async setEditStatus(status) {
|
|
814
998
|
this.state.editable = status;
|
|
815
999
|
}
|
|
816
|
-
setId(
|
|
817
|
-
if (!
|
|
1000
|
+
setId(id2) {
|
|
1001
|
+
if (!id2)
|
|
818
1002
|
return;
|
|
819
|
-
this.state.id =
|
|
1003
|
+
this.state.id = id2;
|
|
820
1004
|
}
|
|
821
1005
|
getId() {
|
|
822
1006
|
return this.state.id;
|
|
823
1007
|
}
|
|
824
|
-
getMode() {
|
|
825
|
-
return this.state.mode;
|
|
826
|
-
}
|
|
827
|
-
async setMode(mode) {
|
|
828
|
-
this.state.mode = mode;
|
|
829
|
-
}
|
|
830
1008
|
async setCombineIds(ids) {
|
|
831
1009
|
this.state.combineIds = ids;
|
|
832
1010
|
}
|
|
833
1011
|
getCombineIds() {
|
|
834
1012
|
return this.state.combineIds;
|
|
835
1013
|
}
|
|
836
|
-
|
|
837
|
-
const
|
|
838
|
-
if (!
|
|
839
|
-
return;
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}
|
|
848
|
-
});
|
|
849
|
-
} catch (e) {
|
|
850
|
-
error(e);
|
|
851
|
-
throw new Error("\u89E3\u7ED1\u4EE3\u7801\u5757\u5931\u8D25");
|
|
852
|
-
}
|
|
853
|
-
} else if (opFlag === CodeSelectOp.ADD) {
|
|
854
|
-
try {
|
|
855
|
-
diffCodeIds.forEach((codeId) => {
|
|
856
|
-
const compsContent = codeDsl[codeId].comps;
|
|
857
|
-
const existHooks = compsContent?.[compId];
|
|
858
|
-
if (lodashEs.isEmpty(existHooks)) {
|
|
859
|
-
codeDsl[codeId].comps = {
|
|
860
|
-
...codeDsl[codeId].comps || {},
|
|
861
|
-
[compId]: [hook]
|
|
862
|
-
};
|
|
863
|
-
} else {
|
|
864
|
-
existHooks?.push(hook);
|
|
865
|
-
}
|
|
866
|
-
});
|
|
867
|
-
} catch (e) {
|
|
868
|
-
error(e);
|
|
869
|
-
throw new Error("\u7ED1\u5B9A\u4EE3\u7801\u5757\u5931\u8D25");
|
|
870
|
-
}
|
|
871
|
-
} else if (opFlag === CodeSelectOp.CHANGE) {
|
|
872
|
-
lodashEs.forIn(codeDsl, (codeBlockContent, codeId) => {
|
|
873
|
-
if (codeId === diffCodeIds[0]) {
|
|
874
|
-
codeBlockContent.comps = {
|
|
875
|
-
...codeBlockContent?.comps || {},
|
|
876
|
-
[compId]: [hook]
|
|
877
|
-
};
|
|
878
|
-
} else if (lodashEs.isEmpty(diffCodeIds) || codeId !== diffCodeIds[0]) {
|
|
879
|
-
const compHooks = codeBlockContent?.comps?.[compId];
|
|
880
|
-
if (!compHooks)
|
|
881
|
-
return true;
|
|
882
|
-
const index = compHooks.findIndex((hookName) => hookName === hook);
|
|
883
|
-
if (index !== -1) {
|
|
884
|
-
compHooks.splice(index, 1);
|
|
885
|
-
return false;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
this.setCodeDsl(codeDsl);
|
|
1014
|
+
refreshCombineInfo() {
|
|
1015
|
+
const root = editorService.get("root");
|
|
1016
|
+
if (!root)
|
|
1017
|
+
return null;
|
|
1018
|
+
const relations = {};
|
|
1019
|
+
this.recurseMNode(root, relations);
|
|
1020
|
+
this.state.relations = relations;
|
|
1021
|
+
return this.state.relations;
|
|
1022
|
+
}
|
|
1023
|
+
getCombineInfo() {
|
|
1024
|
+
return this.state.relations;
|
|
891
1025
|
}
|
|
892
1026
|
getUndeletableList() {
|
|
893
1027
|
return this.state.undeletableList;
|
|
@@ -895,6 +1029,15 @@
|
|
|
895
1029
|
async setUndeleteableList(codeIds) {
|
|
896
1030
|
this.state.undeletableList = codeIds;
|
|
897
1031
|
}
|
|
1032
|
+
setCodeDraft(codeId, content) {
|
|
1033
|
+
globalThis.localStorage.setItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`, content);
|
|
1034
|
+
}
|
|
1035
|
+
getCodeDraft(codeId) {
|
|
1036
|
+
return globalThis.localStorage.getItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
1037
|
+
}
|
|
1038
|
+
removeCodeDraft(codeId) {
|
|
1039
|
+
globalThis.localStorage.removeItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
1040
|
+
}
|
|
898
1041
|
async deleteCodeDslByIds(codeIds) {
|
|
899
1042
|
const currentDsl = await this.getCodeDsl();
|
|
900
1043
|
const newDsl = lodashEs.omit(currentDsl, codeIds);
|
|
@@ -910,31 +1053,67 @@
|
|
|
910
1053
|
return await this.getUniqueId();
|
|
911
1054
|
}
|
|
912
1055
|
async deleteCompsInRelation(node) {
|
|
913
|
-
const
|
|
914
|
-
if (!
|
|
1056
|
+
const codeDsl2 = lodashEs.cloneDeep(await this.getCodeDsl());
|
|
1057
|
+
if (!codeDsl2)
|
|
915
1058
|
return;
|
|
916
|
-
this.
|
|
917
|
-
this.setCodeDsl(
|
|
1059
|
+
this.refreshRelationDeep(node, codeDsl2);
|
|
1060
|
+
this.setCodeDsl(codeDsl2);
|
|
918
1061
|
}
|
|
919
|
-
|
|
1062
|
+
resetState() {
|
|
920
1063
|
this.state.isShowCodeEditor = false;
|
|
921
1064
|
this.state.codeDsl = null;
|
|
922
1065
|
this.state.id = "";
|
|
923
1066
|
this.state.editable = true;
|
|
924
|
-
this.state.mode = CodeEditorMode.EDITOR;
|
|
925
1067
|
this.state.combineIds = [];
|
|
926
1068
|
this.state.undeletableList = [];
|
|
927
1069
|
}
|
|
928
|
-
|
|
1070
|
+
destroy() {
|
|
1071
|
+
this.resetState();
|
|
1072
|
+
this.removeAllListeners();
|
|
1073
|
+
this.removeAllPlugins();
|
|
1074
|
+
}
|
|
1075
|
+
refreshRelationDeep(node, codeDsl2) {
|
|
929
1076
|
if (!node.id)
|
|
930
1077
|
return;
|
|
931
|
-
lodashEs.forIn(
|
|
1078
|
+
lodashEs.forIn(codeDsl2, (codeBlockContent) => {
|
|
932
1079
|
const compsContent = codeBlockContent.comps || {};
|
|
933
1080
|
codeBlockContent.comps = lodashEs.omit(compsContent, node.id);
|
|
934
1081
|
});
|
|
935
1082
|
if (!lodashEs.isEmpty(node.items)) {
|
|
936
1083
|
node.items.forEach((item) => {
|
|
937
|
-
this.
|
|
1084
|
+
this.refreshRelationDeep(item, codeDsl2);
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
recurseMNode(node, relations) {
|
|
1089
|
+
lodashEs.forIn(node, (value, key) => {
|
|
1090
|
+
let unConfirmedValue = { id: node.id };
|
|
1091
|
+
if (value?.hookType === schema.HookType.CODE && !lodashEs.isEmpty(value.hookData)) {
|
|
1092
|
+
value.hookData.forEach((relationItem) => {
|
|
1093
|
+
if (!relationItem.codeId)
|
|
1094
|
+
return;
|
|
1095
|
+
if (!relations[relationItem.codeId]) {
|
|
1096
|
+
relations[relationItem.codeId] = {};
|
|
1097
|
+
}
|
|
1098
|
+
const codeItem = relations[relationItem.codeId];
|
|
1099
|
+
if (lodashEs.isEmpty(codeItem[node.id])) {
|
|
1100
|
+
codeItem[node.id] = [];
|
|
1101
|
+
}
|
|
1102
|
+
codeItem[node.id].push(key);
|
|
1103
|
+
});
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
if (typeof value === "object") {
|
|
1107
|
+
unConfirmedValue = {
|
|
1108
|
+
...unConfirmedValue,
|
|
1109
|
+
...value
|
|
1110
|
+
};
|
|
1111
|
+
this.recurseMNode(unConfirmedValue, relations);
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
if (!lodashEs.isEmpty(node.items)) {
|
|
1115
|
+
node.items.forEach((item) => {
|
|
1116
|
+
this.recurseMNode(item, relations);
|
|
938
1117
|
});
|
|
939
1118
|
}
|
|
940
1119
|
}
|
|
@@ -1018,8 +1197,9 @@
|
|
|
1018
1197
|
this.state.pageSteps[this.state.pageId] = undoRedo;
|
|
1019
1198
|
}
|
|
1020
1199
|
this.setCanUndoRedo();
|
|
1200
|
+
this.emit("page-change", this.state.pageSteps[this.state.pageId]);
|
|
1021
1201
|
}
|
|
1022
|
-
|
|
1202
|
+
resetState() {
|
|
1023
1203
|
this.state.pageId = void 0;
|
|
1024
1204
|
this.state.pageSteps = {};
|
|
1025
1205
|
this.state.canRedo = false;
|
|
@@ -1050,8 +1230,9 @@
|
|
|
1050
1230
|
return state;
|
|
1051
1231
|
}
|
|
1052
1232
|
destroy() {
|
|
1053
|
-
this.
|
|
1233
|
+
this.resetState();
|
|
1054
1234
|
this.removeAllListeners();
|
|
1235
|
+
this.removeAllPlugins();
|
|
1055
1236
|
}
|
|
1056
1237
|
getUndoRedo() {
|
|
1057
1238
|
if (!this.state.pageId)
|
|
@@ -1131,6 +1312,7 @@
|
|
|
1131
1312
|
}
|
|
1132
1313
|
destroy() {
|
|
1133
1314
|
this.removeAllListeners();
|
|
1315
|
+
this.removeAllPlugins();
|
|
1134
1316
|
}
|
|
1135
1317
|
getValueAndProtocol(value) {
|
|
1136
1318
|
let protocol2 = "";
|
|
@@ -1199,10 +1381,14 @@
|
|
|
1199
1381
|
};
|
|
1200
1382
|
const getInitPositionStyle = (style = {}, layout) => {
|
|
1201
1383
|
if (layout === Layout.ABSOLUTE) {
|
|
1202
|
-
|
|
1384
|
+
const newStyle = {
|
|
1203
1385
|
...style,
|
|
1204
1386
|
position: "absolute"
|
|
1205
1387
|
};
|
|
1388
|
+
if (typeof newStyle.left === "undefined" && typeof newStyle.right === "undefined") {
|
|
1389
|
+
newStyle.left = 0;
|
|
1390
|
+
}
|
|
1391
|
+
return newStyle;
|
|
1206
1392
|
}
|
|
1207
1393
|
if (layout === Layout.RELATIVE) {
|
|
1208
1394
|
return getRelativeStyle(style);
|
|
@@ -1303,6 +1489,10 @@
|
|
|
1303
1489
|
left: fixNodeLeft(config, parent, stage?.renderer.contentWindow?.document)
|
|
1304
1490
|
};
|
|
1305
1491
|
};
|
|
1492
|
+
const serializeConfig = (config) => serialize__default.default(config, {
|
|
1493
|
+
space: 2,
|
|
1494
|
+
unsafe: true
|
|
1495
|
+
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1306
1496
|
|
|
1307
1497
|
class Props extends BaseService {
|
|
1308
1498
|
state = vue.reactive({
|
|
@@ -1344,7 +1534,7 @@
|
|
|
1344
1534
|
this.setPropsValue(utils.toLine(type), values[type]);
|
|
1345
1535
|
});
|
|
1346
1536
|
}
|
|
1347
|
-
setPropsValue(type, value) {
|
|
1537
|
+
async setPropsValue(type, value) {
|
|
1348
1538
|
this.state.propsValueMap[type] = value;
|
|
1349
1539
|
}
|
|
1350
1540
|
async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
|
|
@@ -1398,10 +1588,14 @@
|
|
|
1398
1588
|
name: type
|
|
1399
1589
|
};
|
|
1400
1590
|
}
|
|
1401
|
-
|
|
1591
|
+
resetState() {
|
|
1402
1592
|
this.state.propsConfigMap = {};
|
|
1403
1593
|
this.state.propsValueMap = {};
|
|
1594
|
+
}
|
|
1595
|
+
destroy() {
|
|
1596
|
+
this.resetState();
|
|
1404
1597
|
this.removeAllListeners();
|
|
1598
|
+
this.removeAllPlugins();
|
|
1405
1599
|
}
|
|
1406
1600
|
guid(digit = 8) {
|
|
1407
1601
|
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
@@ -1422,7 +1616,7 @@
|
|
|
1422
1616
|
config.map(async (configItem) => {
|
|
1423
1617
|
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
1424
1618
|
let pastePosition = positionClone;
|
|
1425
|
-
if (!lodashEs.isEmpty(pastePosition) && curNode
|
|
1619
|
+
if (!lodashEs.isEmpty(pastePosition) && curNode?.items) {
|
|
1426
1620
|
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
1427
1621
|
}
|
|
1428
1622
|
if (pastePosition.left && configItem.style?.left) {
|
|
@@ -1445,8 +1639,9 @@
|
|
|
1445
1639
|
...pastePosition
|
|
1446
1640
|
};
|
|
1447
1641
|
}
|
|
1448
|
-
|
|
1449
|
-
|
|
1642
|
+
const root = editorService.get("root");
|
|
1643
|
+
if (utils.isPage(pasteConfig) && root) {
|
|
1644
|
+
pasteConfig.name = generatePageNameByApp(root);
|
|
1450
1645
|
}
|
|
1451
1646
|
return pasteConfig;
|
|
1452
1647
|
})
|
|
@@ -1469,13 +1664,20 @@
|
|
|
1469
1664
|
let parentNode;
|
|
1470
1665
|
if (utils.isPage(node)) {
|
|
1471
1666
|
parentNode = editorService.get("root");
|
|
1472
|
-
} else if (curNode
|
|
1667
|
+
} else if (curNode?.items) {
|
|
1473
1668
|
parentNode = curNode;
|
|
1474
|
-
} else {
|
|
1669
|
+
} else if (curNode?.id) {
|
|
1475
1670
|
parentNode = editorService.getParentById(curNode.id, false);
|
|
1476
1671
|
}
|
|
1477
1672
|
return parentNode;
|
|
1478
1673
|
};
|
|
1674
|
+
const getDefaultConfig = async (addNode, parentNode) => {
|
|
1675
|
+
const { type, inputEvent, ...config } = addNode;
|
|
1676
|
+
const layout = await editorService.getLayout(vue.toRaw(parentNode), addNode);
|
|
1677
|
+
const newNode = { ...vue.toRaw(await propsService.getPropsValue(type, config)) };
|
|
1678
|
+
newNode.style = getInitPositionStyle(newNode.style, layout);
|
|
1679
|
+
return newNode;
|
|
1680
|
+
};
|
|
1479
1681
|
|
|
1480
1682
|
class Editor$1 extends BaseService {
|
|
1481
1683
|
state = vue.reactive({
|
|
@@ -1505,7 +1707,7 @@
|
|
|
1505
1707
|
"copy",
|
|
1506
1708
|
"paste",
|
|
1507
1709
|
"doPaste",
|
|
1508
|
-
"
|
|
1710
|
+
"doAlignCenter",
|
|
1509
1711
|
"alignCenter",
|
|
1510
1712
|
"moveLayer",
|
|
1511
1713
|
"moveToContainer",
|
|
@@ -1520,13 +1722,21 @@
|
|
|
1520
1722
|
);
|
|
1521
1723
|
}
|
|
1522
1724
|
set(name, value) {
|
|
1725
|
+
const preValue = this.state[name];
|
|
1523
1726
|
this.state[name] = value;
|
|
1524
|
-
if (name === "nodes") {
|
|
1727
|
+
if (name === "nodes" && Array.isArray(value)) {
|
|
1525
1728
|
this.set("node", value[0]);
|
|
1526
1729
|
}
|
|
1527
1730
|
if (name === "root") {
|
|
1528
|
-
|
|
1529
|
-
|
|
1731
|
+
if (Array.isArray(value)) {
|
|
1732
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u6570\u7EC4");
|
|
1733
|
+
}
|
|
1734
|
+
if (lodashEs.isObject(value) && !(value instanceof StageCore__default.default) && !(value instanceof Map)) {
|
|
1735
|
+
this.state.pageLength = value.items.length;
|
|
1736
|
+
} else {
|
|
1737
|
+
this.state.pageLength = 0;
|
|
1738
|
+
}
|
|
1739
|
+
this.emit("root-change", value, preValue);
|
|
1530
1740
|
}
|
|
1531
1741
|
}
|
|
1532
1742
|
get(name) {
|
|
@@ -1537,16 +1747,21 @@
|
|
|
1537
1747
|
if (raw) {
|
|
1538
1748
|
root = vue.toRaw(root);
|
|
1539
1749
|
}
|
|
1750
|
+
const info = {
|
|
1751
|
+
node: null,
|
|
1752
|
+
parent: null,
|
|
1753
|
+
page: null
|
|
1754
|
+
};
|
|
1540
1755
|
if (!root)
|
|
1541
|
-
return
|
|
1756
|
+
return info;
|
|
1542
1757
|
if (id === root.id) {
|
|
1543
|
-
|
|
1758
|
+
info.node = root;
|
|
1759
|
+
return info;
|
|
1544
1760
|
}
|
|
1545
1761
|
const path = utils.getNodePath(id, root.items);
|
|
1546
1762
|
if (!path.length)
|
|
1547
|
-
return
|
|
1763
|
+
return info;
|
|
1548
1764
|
path.unshift(root);
|
|
1549
|
-
const info = {};
|
|
1550
1765
|
info.node = path[path.length - 1];
|
|
1551
1766
|
info.parent = path[path.length - 2];
|
|
1552
1767
|
path.forEach((item) => {
|
|
@@ -1562,8 +1777,6 @@
|
|
|
1562
1777
|
return node;
|
|
1563
1778
|
}
|
|
1564
1779
|
getParentById(id, raw = true) {
|
|
1565
|
-
if (!this.get("root"))
|
|
1566
|
-
return;
|
|
1567
1780
|
const { parent } = this.getNodeInfo(id, raw);
|
|
1568
1781
|
return parent;
|
|
1569
1782
|
}
|
|
@@ -1580,13 +1793,13 @@
|
|
|
1580
1793
|
}
|
|
1581
1794
|
async select(config) {
|
|
1582
1795
|
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
1583
|
-
this.set("nodes", [node]);
|
|
1584
|
-
this.set("page", page
|
|
1585
|
-
this.set("parent", parent
|
|
1796
|
+
this.set("nodes", node ? [node] : []);
|
|
1797
|
+
this.set("page", page);
|
|
1798
|
+
this.set("parent", parent);
|
|
1586
1799
|
if (page) {
|
|
1587
1800
|
historyService.changePage(vue.toRaw(page));
|
|
1588
1801
|
} else {
|
|
1589
|
-
historyService.
|
|
1802
|
+
historyService.resetState();
|
|
1590
1803
|
}
|
|
1591
1804
|
if (node?.id) {
|
|
1592
1805
|
this.get("stage")?.renderer.runtime?.getApp?.()?.emit(
|
|
@@ -1596,7 +1809,7 @@
|
|
|
1596
1809
|
page,
|
|
1597
1810
|
parent
|
|
1598
1811
|
},
|
|
1599
|
-
utils.getNodePath(node.id, this.get("root")
|
|
1812
|
+
utils.getNodePath(node.id, this.get("root")?.items)
|
|
1600
1813
|
);
|
|
1601
1814
|
}
|
|
1602
1815
|
this.emit("select", node);
|
|
@@ -1618,6 +1831,10 @@
|
|
|
1618
1831
|
async selectNextPage() {
|
|
1619
1832
|
const root = vue.toRaw(this.get("root"));
|
|
1620
1833
|
const page = vue.toRaw(this.get("page"));
|
|
1834
|
+
if (!page)
|
|
1835
|
+
throw new Error("page\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1836
|
+
if (!root)
|
|
1837
|
+
throw new Error("root\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1621
1838
|
const index = getNodeIndex(page, root);
|
|
1622
1839
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
1623
1840
|
await this.select(nextPage);
|
|
@@ -1644,16 +1861,20 @@
|
|
|
1644
1861
|
}
|
|
1645
1862
|
async doAdd(node, parent) {
|
|
1646
1863
|
const root = this.get("root");
|
|
1864
|
+
if (!root)
|
|
1865
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1647
1866
|
const curNode = this.get("node");
|
|
1648
1867
|
const stage = this.get("stage");
|
|
1649
|
-
if (
|
|
1868
|
+
if (!curNode)
|
|
1869
|
+
throw new Error("\u5F53\u524D\u9009\u4E2D\u8282\u70B9\u4E3A\u7A7A");
|
|
1870
|
+
if ((parent.type === schema.NodeType.ROOT || curNode?.type === schema.NodeType.ROOT) && node.type !== schema.NodeType.PAGE) {
|
|
1650
1871
|
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
1651
1872
|
}
|
|
1652
1873
|
if (parent.id !== curNode.id && node.type !== schema.NodeType.PAGE) {
|
|
1653
1874
|
const index = parent.items.indexOf(curNode);
|
|
1654
|
-
parent
|
|
1875
|
+
parent.items?.splice(index + 1, 0, node);
|
|
1655
1876
|
} else {
|
|
1656
|
-
parent
|
|
1877
|
+
parent.items?.push(node);
|
|
1657
1878
|
}
|
|
1658
1879
|
const layout = await this.getLayout(vue.toRaw(parent), node);
|
|
1659
1880
|
node.style = getInitPositionStyle(node.style, layout);
|
|
@@ -1684,6 +1905,10 @@
|
|
|
1684
1905
|
}
|
|
1685
1906
|
const newNodes = await Promise.all(
|
|
1686
1907
|
addNodes.map((node) => {
|
|
1908
|
+
const root = this.get("root");
|
|
1909
|
+
if (utils.isPage(node) && root) {
|
|
1910
|
+
return this.doAdd(node, root);
|
|
1911
|
+
}
|
|
1687
1912
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
1688
1913
|
if (!parentNode)
|
|
1689
1914
|
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
@@ -1702,14 +1927,16 @@
|
|
|
1702
1927
|
stage?.select(newNodes[0].id);
|
|
1703
1928
|
}
|
|
1704
1929
|
}
|
|
1705
|
-
|
|
1930
|
+
if (!utils.isPage(newNodes[0])) {
|
|
1931
|
+
this.pushHistoryState();
|
|
1932
|
+
}
|
|
1706
1933
|
this.emit("add", newNodes);
|
|
1707
1934
|
return Array.isArray(addNode) ? newNodes : newNodes[0];
|
|
1708
1935
|
}
|
|
1709
1936
|
async doRemove(node) {
|
|
1710
1937
|
const root = this.get("root");
|
|
1711
1938
|
if (!root)
|
|
1712
|
-
throw new Error("\
|
|
1939
|
+
throw new Error("root\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1713
1940
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
1714
1941
|
if (!parent || !curNode)
|
|
1715
1942
|
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
@@ -1744,18 +1971,26 @@
|
|
|
1744
1971
|
async remove(nodeOrNodeList) {
|
|
1745
1972
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
1746
1973
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
1747
|
-
|
|
1974
|
+
if (!utils.isPage(nodes[0])) {
|
|
1975
|
+
this.pushHistoryState();
|
|
1976
|
+
}
|
|
1748
1977
|
this.emit("remove", nodes);
|
|
1749
1978
|
}
|
|
1750
1979
|
async doUpdate(config) {
|
|
1980
|
+
const root = this.get("root");
|
|
1981
|
+
if (!root)
|
|
1982
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1751
1983
|
if (!config?.id)
|
|
1752
1984
|
throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
|
|
1753
1985
|
const info = this.getNodeInfo(config.id, false);
|
|
1754
1986
|
if (!info.node)
|
|
1755
1987
|
throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config.id}\u7684\u8282\u70B9`);
|
|
1756
1988
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
1757
|
-
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node,
|
|
1989
|
+
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, root);
|
|
1758
1990
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1991
|
+
if (lodashEs.isObject(srcValue) && Array.isArray(objValue)) {
|
|
1992
|
+
return srcValue;
|
|
1993
|
+
}
|
|
1759
1994
|
if (Array.isArray(srcValue)) {
|
|
1760
1995
|
return srcValue;
|
|
1761
1996
|
}
|
|
@@ -1779,14 +2014,14 @@
|
|
|
1779
2014
|
newConfig = setLayout(newConfig, newLayout);
|
|
1780
2015
|
}
|
|
1781
2016
|
parentNodeItems[index] = newConfig;
|
|
1782
|
-
const nodes = this.get("nodes")
|
|
2017
|
+
const nodes = this.get("nodes");
|
|
1783
2018
|
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
1784
2019
|
nodes.splice(targetIndex, 1, newConfig);
|
|
1785
2020
|
this.set("nodes", [...nodes]);
|
|
1786
2021
|
this.get("stage")?.update({
|
|
1787
2022
|
config: lodashEs.cloneDeep(newConfig),
|
|
1788
2023
|
parentId: parent.id,
|
|
1789
|
-
root: lodashEs.cloneDeep(
|
|
2024
|
+
root: lodashEs.cloneDeep(root)
|
|
1790
2025
|
});
|
|
1791
2026
|
if (newConfig.type === schema.NodeType.PAGE) {
|
|
1792
2027
|
this.set("page", newConfig);
|
|
@@ -1799,11 +2034,19 @@
|
|
|
1799
2034
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
1800
2035
|
this.pushHistoryState();
|
|
1801
2036
|
this.emit("update", newNodes);
|
|
2037
|
+
codeBlockService.refreshCombineInfo();
|
|
1802
2038
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
1803
2039
|
}
|
|
1804
2040
|
async sort(id1, id2) {
|
|
2041
|
+
const root = this.get("root");
|
|
2042
|
+
if (!root)
|
|
2043
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1805
2044
|
const node = this.get("node");
|
|
2045
|
+
if (!node)
|
|
2046
|
+
throw new Error("\u5F53\u524D\u8282\u70B9\u4E3A\u7A7A");
|
|
1806
2047
|
const parent = lodashEs.cloneDeep(vue.toRaw(this.get("parent")));
|
|
2048
|
+
if (!parent)
|
|
2049
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
1807
2050
|
const index2 = parent.items.findIndex((node2) => `${node2.id}` === `${id2}`);
|
|
1808
2051
|
if (index2 < 0)
|
|
1809
2052
|
return;
|
|
@@ -1814,7 +2057,7 @@
|
|
|
1814
2057
|
this.get("stage")?.update({
|
|
1815
2058
|
config: lodashEs.cloneDeep(node),
|
|
1816
2059
|
parentId: parent.id,
|
|
1817
|
-
root: lodashEs.cloneDeep(
|
|
2060
|
+
root: lodashEs.cloneDeep(root)
|
|
1818
2061
|
});
|
|
1819
2062
|
this.addModifiedNodeId(parent.id);
|
|
1820
2063
|
this.pushHistoryState();
|
|
@@ -1828,8 +2071,16 @@
|
|
|
1828
2071
|
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
1829
2072
|
if (!Array.isArray(config))
|
|
1830
2073
|
return;
|
|
2074
|
+
const node = this.get("node");
|
|
2075
|
+
let parent = null;
|
|
2076
|
+
if (config.length === 1 && config[0].id === node?.id) {
|
|
2077
|
+
parent = this.get("parent");
|
|
2078
|
+
if (parent?.type === schema.NodeType.ROOT) {
|
|
2079
|
+
parent = this.get("page");
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
1831
2082
|
const pasteConfigs = await this.doPaste(config, position);
|
|
1832
|
-
return this.add(pasteConfigs);
|
|
2083
|
+
return this.add(pasteConfigs, parent);
|
|
1833
2084
|
}
|
|
1834
2085
|
async doPaste(config, position = {}) {
|
|
1835
2086
|
const pasteConfigs = await beforePaste(position, lodashEs.cloneDeep(config));
|
|
@@ -1864,13 +2115,24 @@
|
|
|
1864
2115
|
const stage = this.get("stage");
|
|
1865
2116
|
const newNodes = await Promise.all(nodes.map((node) => this.doAlignCenter(node)));
|
|
1866
2117
|
const newNode = await this.update(newNodes);
|
|
1867
|
-
|
|
2118
|
+
if (newNodes.length > 1) {
|
|
2119
|
+
await stage?.multiSelect(newNodes.map((node) => node.id));
|
|
2120
|
+
} else {
|
|
2121
|
+
await stage?.select(newNodes[0].id);
|
|
2122
|
+
}
|
|
1868
2123
|
return newNode;
|
|
1869
2124
|
}
|
|
1870
2125
|
async moveLayer(offset) {
|
|
2126
|
+
const root = this.get("root");
|
|
2127
|
+
if (!root)
|
|
2128
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1871
2129
|
const parent = this.get("parent");
|
|
2130
|
+
if (!parent)
|
|
2131
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
1872
2132
|
const node = this.get("node");
|
|
1873
|
-
|
|
2133
|
+
if (!node)
|
|
2134
|
+
throw new Error("\u5F53\u524D\u8282\u70B9\u4E3A\u7A7A");
|
|
2135
|
+
const brothers = parent.items || [];
|
|
1874
2136
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
1875
2137
|
const layout = await this.getLayout(parent, node);
|
|
1876
2138
|
const isRelative = layout === Layout.RELATIVE;
|
|
@@ -1886,17 +2148,17 @@
|
|
|
1886
2148
|
this.get("stage")?.update({
|
|
1887
2149
|
config: lodashEs.cloneDeep(vue.toRaw(parent)),
|
|
1888
2150
|
parentId: grandparent?.id,
|
|
1889
|
-
root: lodashEs.cloneDeep(
|
|
2151
|
+
root: lodashEs.cloneDeep(root)
|
|
1890
2152
|
});
|
|
1891
2153
|
this.addModifiedNodeId(parent.id);
|
|
1892
2154
|
this.pushHistoryState();
|
|
1893
2155
|
}
|
|
1894
2156
|
async moveToContainer(config, targetId) {
|
|
2157
|
+
const root = lodashEs.cloneDeep(this.get("root"));
|
|
1895
2158
|
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
1896
2159
|
const target = this.getNodeById(targetId, false);
|
|
1897
2160
|
const stage = this.get("stage");
|
|
1898
|
-
if (node && parent && stage) {
|
|
1899
|
-
const root = lodashEs.cloneDeep(this.get("root"));
|
|
2161
|
+
if (root && node && parent && stage) {
|
|
1900
2162
|
const index = getNodeIndex(node, parent);
|
|
1901
2163
|
parent.items?.splice(index, 1);
|
|
1902
2164
|
await stage.remove({ id: node.id, parentId: parent.id, root });
|
|
@@ -1950,8 +2212,7 @@
|
|
|
1950
2212
|
}
|
|
1951
2213
|
});
|
|
1952
2214
|
}
|
|
1953
|
-
|
|
1954
|
-
this.removeAllListeners();
|
|
2215
|
+
resetState() {
|
|
1955
2216
|
this.set("root", null);
|
|
1956
2217
|
this.set("node", null);
|
|
1957
2218
|
this.set("nodes", []);
|
|
@@ -1960,16 +2221,23 @@
|
|
|
1960
2221
|
this.set("stage", null);
|
|
1961
2222
|
this.set("highlightNode", null);
|
|
1962
2223
|
this.set("modifiedNodeIds", /* @__PURE__ */ new Map());
|
|
1963
|
-
this.set("pageLength",
|
|
2224
|
+
this.set("pageLength", 0);
|
|
2225
|
+
}
|
|
2226
|
+
destroy() {
|
|
2227
|
+
this.removeAllListeners();
|
|
2228
|
+
this.resetState();
|
|
2229
|
+
this.removeAllPlugins();
|
|
1964
2230
|
}
|
|
1965
2231
|
resetModifiedNodeId() {
|
|
1966
2232
|
this.get("modifiedNodeIds").clear();
|
|
1967
2233
|
}
|
|
1968
2234
|
async getCodeDsl() {
|
|
1969
2235
|
const root = this.get("root");
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
2236
|
+
return root?.codeBlocks || null;
|
|
2237
|
+
}
|
|
2238
|
+
getCodeDslSync() {
|
|
2239
|
+
const root = this.get("root");
|
|
2240
|
+
return root?.codeBlocks || null;
|
|
1973
2241
|
}
|
|
1974
2242
|
async setCodeDsl(codeDsl) {
|
|
1975
2243
|
if (!this.state.root)
|
|
@@ -1983,9 +2251,10 @@
|
|
|
1983
2251
|
}
|
|
1984
2252
|
pushHistoryState() {
|
|
1985
2253
|
const curNode = lodashEs.cloneDeep(vue.toRaw(this.get("node")));
|
|
1986
|
-
|
|
2254
|
+
const page = this.get("page");
|
|
2255
|
+
if (!this.isHistoryStateChange && curNode && page) {
|
|
1987
2256
|
historyService.push({
|
|
1988
|
-
data: lodashEs.cloneDeep(vue.toRaw(
|
|
2257
|
+
data: lodashEs.cloneDeep(vue.toRaw(page)),
|
|
1989
2258
|
modifiedNodeIds: this.get("modifiedNodeIds"),
|
|
1990
2259
|
nodeId: curNode.id
|
|
1991
2260
|
});
|
|
@@ -2082,10 +2351,14 @@
|
|
|
2082
2351
|
getMethod(type) {
|
|
2083
2352
|
return lodashEs.cloneDeep(methodMap[type] || core.DEFAULT_METHODS);
|
|
2084
2353
|
}
|
|
2085
|
-
|
|
2354
|
+
resetState() {
|
|
2086
2355
|
eventMap = vue.reactive({});
|
|
2087
2356
|
methodMap = vue.reactive({});
|
|
2357
|
+
}
|
|
2358
|
+
destroy() {
|
|
2359
|
+
this.resetState();
|
|
2088
2360
|
this.removeAllListeners();
|
|
2361
|
+
this.removeAllPlugins();
|
|
2089
2362
|
}
|
|
2090
2363
|
}
|
|
2091
2364
|
const eventsService = new Events();
|
|
@@ -2285,14 +2558,14 @@
|
|
|
2285
2558
|
{
|
|
2286
2559
|
name: "created",
|
|
2287
2560
|
text: "created",
|
|
2288
|
-
|
|
2289
|
-
|
|
2561
|
+
labelWidth: "100px",
|
|
2562
|
+
type: "code-select"
|
|
2290
2563
|
},
|
|
2291
2564
|
{
|
|
2292
2565
|
name: "mounted",
|
|
2293
2566
|
text: "mounted",
|
|
2294
|
-
|
|
2295
|
-
|
|
2567
|
+
labelWidth: "100px",
|
|
2568
|
+
type: "code-select"
|
|
2296
2569
|
}
|
|
2297
2570
|
]
|
|
2298
2571
|
}
|
|
@@ -2360,8 +2633,19 @@
|
|
|
2360
2633
|
}
|
|
2361
2634
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
2362
2635
|
}
|
|
2636
|
+
resetState() {
|
|
2637
|
+
this.set("showSrc", false);
|
|
2638
|
+
this.set("uiSelectMode", false);
|
|
2639
|
+
this.set("zoom", 1);
|
|
2640
|
+
this.set("stageContainerRect", {
|
|
2641
|
+
width: 0,
|
|
2642
|
+
height: 0
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2363
2645
|
destroy() {
|
|
2646
|
+
this.resetState();
|
|
2364
2647
|
this.removeAllListeners();
|
|
2648
|
+
this.removeAllPlugins();
|
|
2365
2649
|
}
|
|
2366
2650
|
async setStageRect(value) {
|
|
2367
2651
|
state.stageRect = {
|
|
@@ -2388,6 +2672,7 @@
|
|
|
2388
2672
|
containerHighlightClassName: stageOptions.containerHighlightClassName,
|
|
2389
2673
|
containerHighlightDuration: stageOptions.containerHighlightDuration,
|
|
2390
2674
|
containerHighlightType: stageOptions.containerHighlightType,
|
|
2675
|
+
disabledDragStart: stageOptions.disabledDragStart,
|
|
2391
2676
|
canSelect: (el, event, stop) => {
|
|
2392
2677
|
const elCanSelect = stageOptions.canSelect(el);
|
|
2393
2678
|
if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
|
|
@@ -2404,220 +2689,97 @@
|
|
|
2404
2689
|
getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
|
|
2405
2690
|
]);
|
|
2406
2691
|
stage.on("select", (el) => {
|
|
2407
|
-
if (`${editorService.get("node")?.id}` === el.id)
|
|
2408
|
-
return;
|
|
2409
|
-
editorService.select(el.id);
|
|
2410
|
-
});
|
|
2411
|
-
stage.on("highlight", (el) => {
|
|
2412
|
-
editorService.highlight(el.id);
|
|
2413
|
-
});
|
|
2414
|
-
stage.on("multiSelect", (els) => {
|
|
2415
|
-
editorService.multiSelect(els.map((el) => el.id));
|
|
2416
|
-
});
|
|
2417
|
-
stage.on("update", (ev) => {
|
|
2418
|
-
if (ev.parentEl) {
|
|
2419
|
-
for (const data of ev.data) {
|
|
2420
|
-
editorService.moveToContainer({ id: data.el.id, style: data.style }, ev.parentEl.id);
|
|
2421
|
-
}
|
|
2422
|
-
return;
|
|
2423
|
-
}
|
|
2424
|
-
editorService.update(ev.data.map((data) => ({ id: data.el.id, style: data.style })));
|
|
2425
|
-
});
|
|
2426
|
-
stage.on("sort", (ev) => {
|
|
2427
|
-
editorService.sort(ev.src, ev.dist);
|
|
2428
|
-
});
|
|
2429
|
-
stage.on("select-parent", () => {
|
|
2430
|
-
const parent = editorService.get("parent");
|
|
2431
|
-
editorService.select(parent);
|
|
2432
|
-
editorService.get("stage").select(parent.id);
|
|
2433
|
-
});
|
|
2434
|
-
stage.on("changeGuides", (e) => {
|
|
2435
|
-
uiService.set("showGuides", true);
|
|
2436
|
-
if (!root.value || !page.value)
|
|
2692
|
+
if (`${editorService.get("node")?.id}` === el.id && editorService.get("nodes").length === 1)
|
|
2437
2693
|
return;
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
2451
|
-
const _hoisted_2$5 = { class: "m-editor-empty-content" };
|
|
2452
|
-
const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2453
|
-
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
2454
|
-
__name: "AddPageBox",
|
|
2455
|
-
setup(__props) {
|
|
2456
|
-
const services = vue.inject("services");
|
|
2457
|
-
const clickHandler = () => {
|
|
2458
|
-
const { editorService } = services || {};
|
|
2459
|
-
if (!editorService)
|
|
2460
|
-
return;
|
|
2461
|
-
editorService.add({
|
|
2462
|
-
type: schema.NodeType.PAGE,
|
|
2463
|
-
name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
|
|
2464
|
-
});
|
|
2465
|
-
};
|
|
2466
|
-
return (_ctx, _cache) => {
|
|
2467
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
2468
|
-
vue.createElementVNode("div", _hoisted_2$5, [
|
|
2469
|
-
vue.createElementVNode("div", {
|
|
2470
|
-
class: "m-editor-empty-button",
|
|
2471
|
-
onClick: clickHandler
|
|
2472
|
-
}, [
|
|
2473
|
-
vue.createElementVNode("div", null, [
|
|
2474
|
-
vue.createVNode(_sfc_main$o, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2475
|
-
]),
|
|
2476
|
-
_hoisted_3$2
|
|
2477
|
-
])
|
|
2478
|
-
])
|
|
2479
|
-
]);
|
|
2480
|
-
};
|
|
2481
|
-
}
|
|
2482
|
-
});
|
|
2483
|
-
|
|
2484
|
-
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
2485
|
-
__name: "Resizer",
|
|
2486
|
-
emits: ["change"],
|
|
2487
|
-
setup(__props, { emit }) {
|
|
2488
|
-
const target = vue.ref();
|
|
2489
|
-
let getso;
|
|
2490
|
-
vue.onMounted(() => {
|
|
2491
|
-
if (!target.value)
|
|
2492
|
-
return;
|
|
2493
|
-
getso = new Gesto__default.default(target.value, {
|
|
2494
|
-
container: window,
|
|
2495
|
-
pinchOutside: true
|
|
2496
|
-
}).on("drag", (e) => {
|
|
2497
|
-
if (!target.value)
|
|
2498
|
-
return;
|
|
2499
|
-
emit("change", e.deltaX);
|
|
2500
|
-
});
|
|
2501
|
-
});
|
|
2502
|
-
vue.onUnmounted(() => {
|
|
2503
|
-
getso?.unset();
|
|
2504
|
-
});
|
|
2505
|
-
return (_ctx, _cache) => {
|
|
2506
|
-
return vue.openBlock(), vue.createElementBlock("span", {
|
|
2507
|
-
ref_key: "target",
|
|
2508
|
-
ref: target,
|
|
2509
|
-
class: "m-editor-resizer"
|
|
2510
|
-
}, [
|
|
2511
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
2512
|
-
], 512);
|
|
2513
|
-
};
|
|
2514
|
-
}
|
|
2515
|
-
});
|
|
2516
|
-
|
|
2517
|
-
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
2518
|
-
__name: "Layout",
|
|
2519
|
-
props: {
|
|
2520
|
-
left: null,
|
|
2521
|
-
right: null,
|
|
2522
|
-
minLeft: { default: 1 },
|
|
2523
|
-
minRight: { default: 1 },
|
|
2524
|
-
leftClass: null,
|
|
2525
|
-
rightClass: null,
|
|
2526
|
-
centerClass: null
|
|
2527
|
-
},
|
|
2528
|
-
emits: ["update:left", "change", "update:right"],
|
|
2529
|
-
setup(__props, { emit }) {
|
|
2530
|
-
const props = __props;
|
|
2531
|
-
const el = vue.ref();
|
|
2532
|
-
let clientWidth = 0;
|
|
2533
|
-
const resizerObserver = new ResizeObserver((entries) => {
|
|
2534
|
-
for (const { contentRect } of entries) {
|
|
2535
|
-
clientWidth = contentRect.width;
|
|
2536
|
-
center.value = clientWidth - (props.left || 0) - (props.right || 0);
|
|
2537
|
-
emit("change", {
|
|
2538
|
-
left: props.left,
|
|
2539
|
-
center: center.value,
|
|
2540
|
-
right: props.right
|
|
2541
|
-
});
|
|
2542
|
-
}
|
|
2543
|
-
});
|
|
2544
|
-
vue.onMounted(() => {
|
|
2545
|
-
if (el.value) {
|
|
2546
|
-
resizerObserver.observe(el.value);
|
|
2547
|
-
}
|
|
2548
|
-
});
|
|
2549
|
-
vue.onUnmounted(() => {
|
|
2550
|
-
resizerObserver.disconnect();
|
|
2551
|
-
});
|
|
2552
|
-
const center = vue.ref(0);
|
|
2553
|
-
const changeLeft = (deltaX) => {
|
|
2554
|
-
if (typeof props.left === "undefined")
|
|
2555
|
-
return;
|
|
2556
|
-
let left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
2557
|
-
emit("update:left", left);
|
|
2558
|
-
if (clientWidth - left - (props.right || 0) <= 0) {
|
|
2559
|
-
left = props.left;
|
|
2694
|
+
editorService.select(el.id);
|
|
2695
|
+
});
|
|
2696
|
+
stage.on("highlight", (el) => {
|
|
2697
|
+
editorService.highlight(el.id);
|
|
2698
|
+
});
|
|
2699
|
+
stage.on("multi-select", (els) => {
|
|
2700
|
+
editorService.multiSelect(els.map((el) => el.id));
|
|
2701
|
+
});
|
|
2702
|
+
stage.on("update", (ev) => {
|
|
2703
|
+
if (ev.parentEl) {
|
|
2704
|
+
for (const data of ev.data) {
|
|
2705
|
+
editorService.moveToContainer({ id: data.el.id, style: data.style }, ev.parentEl.id);
|
|
2560
2706
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
editorService.update(ev.data.map((data) => ({ id: data.el.id, style: data.style })));
|
|
2710
|
+
});
|
|
2711
|
+
stage.on("sort", (ev) => {
|
|
2712
|
+
editorService.sort(ev.src, ev.dist);
|
|
2713
|
+
});
|
|
2714
|
+
stage.on("select-parent", () => {
|
|
2715
|
+
const parent = editorService.get("parent");
|
|
2716
|
+
if (!parent)
|
|
2717
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
2718
|
+
editorService.select(parent);
|
|
2719
|
+
editorService.get("stage")?.select(parent.id);
|
|
2720
|
+
});
|
|
2721
|
+
stage.on("change-guides", (e) => {
|
|
2722
|
+
uiService.set("showGuides", true);
|
|
2723
|
+
if (!root.value || !page.value)
|
|
2724
|
+
return;
|
|
2725
|
+
const storageKey = getGuideLineKey(
|
|
2726
|
+
e.type === StageCore.GuidesType.HORIZONTAL ? H_GUIDE_LINE_STORAGE_KEY : V_GUIDE_LINE_STORAGE_KEY
|
|
2727
|
+
);
|
|
2728
|
+
if (e.guides.length) {
|
|
2729
|
+
globalThis.localStorage.setItem(storageKey, JSON.stringify(e.guides));
|
|
2730
|
+
} else {
|
|
2731
|
+
globalThis.localStorage.removeItem(storageKey);
|
|
2732
|
+
}
|
|
2733
|
+
});
|
|
2734
|
+
return stage;
|
|
2735
|
+
};
|
|
2736
|
+
|
|
2737
|
+
const _hoisted_1$d = { class: "m-editor-empty-panel" };
|
|
2738
|
+
const _hoisted_2$6 = { class: "m-editor-empty-content" };
|
|
2739
|
+
const _hoisted_3$3 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2740
|
+
const __default__$l = vue.defineComponent({
|
|
2741
|
+
name: "MEditorAddPageBox"
|
|
2742
|
+
});
|
|
2743
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
2744
|
+
...__default__$l,
|
|
2745
|
+
setup(__props) {
|
|
2746
|
+
const services = vue.inject("services");
|
|
2747
|
+
const clickHandler = () => {
|
|
2748
|
+
const { editorService } = services || {};
|
|
2749
|
+
if (!editorService)
|
|
2570
2750
|
return;
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
emit("change", {
|
|
2578
|
-
left: props.left,
|
|
2579
|
-
center: center.value,
|
|
2580
|
-
right
|
|
2751
|
+
const root = vue.toRaw(editorService.get("root"));
|
|
2752
|
+
if (!root)
|
|
2753
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u7A7A");
|
|
2754
|
+
editorService.add({
|
|
2755
|
+
type: schema.NodeType.PAGE,
|
|
2756
|
+
name: generatePageNameByApp(root)
|
|
2581
2757
|
});
|
|
2582
2758
|
};
|
|
2583
2759
|
return (_ctx, _cache) => {
|
|
2584
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
2585
|
-
|
|
2586
|
-
ref: el,
|
|
2587
|
-
class: "m-editor-layout"
|
|
2588
|
-
}, [
|
|
2589
|
-
typeof props.left !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
2590
|
-
vue.createElementVNode("div", {
|
|
2591
|
-
class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
2592
|
-
style: vue.normalizeStyle(`width: ${__props.left}px`)
|
|
2593
|
-
}, [
|
|
2594
|
-
vue.renderSlot(_ctx.$slots, "left")
|
|
2595
|
-
], 6),
|
|
2596
|
-
vue.createVNode(_sfc_main$m, { onChange: changeLeft })
|
|
2597
|
-
], 64)) : vue.createCommentVNode("", true),
|
|
2598
|
-
vue.createElementVNode("div", {
|
|
2599
|
-
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
2600
|
-
style: vue.normalizeStyle(`width: ${center.value}px`)
|
|
2601
|
-
}, [
|
|
2602
|
-
vue.renderSlot(_ctx.$slots, "center")
|
|
2603
|
-
], 6),
|
|
2604
|
-
typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
2605
|
-
vue.createVNode(_sfc_main$m, { onChange: changeRight }),
|
|
2760
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
|
|
2761
|
+
vue.createElementVNode("div", _hoisted_2$6, [
|
|
2606
2762
|
vue.createElementVNode("div", {
|
|
2607
|
-
class:
|
|
2608
|
-
|
|
2763
|
+
class: "m-editor-empty-button",
|
|
2764
|
+
onClick: clickHandler
|
|
2609
2765
|
}, [
|
|
2610
|
-
vue.
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2766
|
+
vue.createElementVNode("div", null, [
|
|
2767
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2768
|
+
]),
|
|
2769
|
+
_hoisted_3$3
|
|
2770
|
+
])
|
|
2771
|
+
])
|
|
2772
|
+
]);
|
|
2614
2773
|
};
|
|
2615
2774
|
}
|
|
2616
2775
|
});
|
|
2617
2776
|
|
|
2618
|
-
const _hoisted_1$
|
|
2619
|
-
const
|
|
2620
|
-
|
|
2777
|
+
const _hoisted_1$c = { class: "m-editor" };
|
|
2778
|
+
const __default__$k = vue.defineComponent({
|
|
2779
|
+
name: "MEditorFramework"
|
|
2780
|
+
});
|
|
2781
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
2782
|
+
...__default__$k,
|
|
2621
2783
|
props: {
|
|
2622
2784
|
codeOptions: { default: () => ({}) }
|
|
2623
2785
|
},
|
|
@@ -2651,7 +2813,7 @@
|
|
|
2651
2813
|
columnWidth.value.right = right;
|
|
2652
2814
|
columnWidth.value.center = globalThis.document.body.clientWidth - left - right;
|
|
2653
2815
|
}
|
|
2654
|
-
uiService?.set("columnWidth", columnWidth);
|
|
2816
|
+
uiService?.set("columnWidth", columnWidth.value);
|
|
2655
2817
|
},
|
|
2656
2818
|
{
|
|
2657
2819
|
immediate: true
|
|
@@ -2671,8 +2833,11 @@
|
|
|
2671
2833
|
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
2672
2834
|
}
|
|
2673
2835
|
);
|
|
2674
|
-
const columnWidthChange = (
|
|
2675
|
-
|
|
2836
|
+
const columnWidthChange = (columnW) => {
|
|
2837
|
+
columnWidth.value.left = columnW.left;
|
|
2838
|
+
columnWidth.value.center = columnW.center;
|
|
2839
|
+
columnWidth.value.right = columnW.right;
|
|
2840
|
+
uiService?.set("columnWidth", columnW);
|
|
2676
2841
|
};
|
|
2677
2842
|
const saveCode = (value) => {
|
|
2678
2843
|
try {
|
|
@@ -2683,7 +2848,7 @@
|
|
|
2683
2848
|
};
|
|
2684
2849
|
return (_ctx, _cache) => {
|
|
2685
2850
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2686
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2851
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
2687
2852
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2688
2853
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2689
2854
|
key: 0,
|
|
@@ -2691,7 +2856,7 @@
|
|
|
2691
2856
|
"init-values": vue.unref(root),
|
|
2692
2857
|
options: __props.codeOptions,
|
|
2693
2858
|
onSave: saveCode
|
|
2694
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2859
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2695
2860
|
key: 1,
|
|
2696
2861
|
class: "m-editor-content",
|
|
2697
2862
|
"left-class": "m-editor-framework-left",
|
|
@@ -2710,7 +2875,7 @@
|
|
|
2710
2875
|
]),
|
|
2711
2876
|
center: vue.withCtx(() => [
|
|
2712
2877
|
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2713
|
-
vue.createVNode(_sfc_main$
|
|
2878
|
+
vue.createVNode(_sfc_main$m)
|
|
2714
2879
|
])
|
|
2715
2880
|
]),
|
|
2716
2881
|
_: 2
|
|
@@ -2732,13 +2897,16 @@
|
|
|
2732
2897
|
}
|
|
2733
2898
|
});
|
|
2734
2899
|
|
|
2735
|
-
const _hoisted_1$
|
|
2900
|
+
const _hoisted_1$b = {
|
|
2736
2901
|
key: 1,
|
|
2737
2902
|
class: "menu-item-text"
|
|
2738
2903
|
};
|
|
2739
|
-
const _hoisted_2$
|
|
2740
|
-
const
|
|
2741
|
-
|
|
2904
|
+
const _hoisted_2$5 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2905
|
+
const __default__$j = vue.defineComponent({
|
|
2906
|
+
name: "MEditorToolButton"
|
|
2907
|
+
});
|
|
2908
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
2909
|
+
...__default__$j,
|
|
2742
2910
|
props: {
|
|
2743
2911
|
data: { default: () => ({
|
|
2744
2912
|
type: "text",
|
|
@@ -2813,7 +2981,7 @@
|
|
|
2813
2981
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
2814
2982
|
key: 0,
|
|
2815
2983
|
direction: __props.data.direction || "vertical"
|
|
2816
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2984
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
2817
2985
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
2818
2986
|
key: 0,
|
|
2819
2987
|
effect: "dark",
|
|
@@ -2827,7 +2995,7 @@
|
|
|
2827
2995
|
disabled: vue.unref(disabled)
|
|
2828
2996
|
}, {
|
|
2829
2997
|
default: vue.withCtx(() => [
|
|
2830
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2998
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
2831
2999
|
key: 0,
|
|
2832
3000
|
icon: __props.data.icon
|
|
2833
3001
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2844,7 +3012,7 @@
|
|
|
2844
3012
|
disabled: vue.unref(disabled)
|
|
2845
3013
|
}, {
|
|
2846
3014
|
default: vue.withCtx(() => [
|
|
2847
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3015
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
2848
3016
|
key: 0,
|
|
2849
3017
|
icon: __props.data.icon
|
|
2850
3018
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2877,7 +3045,7 @@
|
|
|
2877
3045
|
})) : vue.createCommentVNode("", true)
|
|
2878
3046
|
]),
|
|
2879
3047
|
default: vue.withCtx(() => [
|
|
2880
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
3048
|
+
vue.createElementVNode("span", _hoisted_2$5, [
|
|
2881
3049
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
2882
3050
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
2883
3051
|
default: vue.withCtx(() => [
|
|
@@ -2894,8 +3062,11 @@
|
|
|
2894
3062
|
}
|
|
2895
3063
|
});
|
|
2896
3064
|
|
|
2897
|
-
const
|
|
2898
|
-
|
|
3065
|
+
const __default__$i = vue.defineComponent({
|
|
3066
|
+
name: "MEditorNavMenu"
|
|
3067
|
+
});
|
|
3068
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
3069
|
+
...__default__$i,
|
|
2899
3070
|
props: {
|
|
2900
3071
|
data: { default: () => ({}) },
|
|
2901
3072
|
height: { default: 35 }
|
|
@@ -2939,7 +3110,10 @@
|
|
|
2939
3110
|
icon: vue.markRaw(iconsVue.Delete),
|
|
2940
3111
|
tooltip: `\u522A\u9664(Delete)`,
|
|
2941
3112
|
disabled: () => services?.editorService.get("node")?.type === schema.NodeType.PAGE,
|
|
2942
|
-
handler: () =>
|
|
3113
|
+
handler: () => {
|
|
3114
|
+
const node = services?.editorService.get("node");
|
|
3115
|
+
node && services?.editorService.remove(node);
|
|
3116
|
+
}
|
|
2943
3117
|
});
|
|
2944
3118
|
break;
|
|
2945
3119
|
case "undo":
|
|
@@ -3050,7 +3224,7 @@
|
|
|
3050
3224
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
3051
3225
|
}, [
|
|
3052
3226
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
3053
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3227
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3054
3228
|
data: item,
|
|
3055
3229
|
key: index
|
|
3056
3230
|
}, null, 8, ["data"]);
|
|
@@ -3062,9 +3236,12 @@
|
|
|
3062
3236
|
}
|
|
3063
3237
|
});
|
|
3064
3238
|
|
|
3065
|
-
const _hoisted_1$
|
|
3066
|
-
const
|
|
3067
|
-
|
|
3239
|
+
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
3240
|
+
const __default__$h = vue.defineComponent({
|
|
3241
|
+
name: "MEditorPropsPanel"
|
|
3242
|
+
});
|
|
3243
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
3244
|
+
...__default__$h,
|
|
3068
3245
|
emits: ["mounted"],
|
|
3069
3246
|
setup(__props, { expose, emit }) {
|
|
3070
3247
|
const internalInstance = vue.getCurrentInstance();
|
|
@@ -3089,6 +3266,9 @@
|
|
|
3089
3266
|
vue.onMounted(() => {
|
|
3090
3267
|
emit("mounted", internalInstance);
|
|
3091
3268
|
});
|
|
3269
|
+
vue.onUnmounted(() => {
|
|
3270
|
+
services?.propsService.off("props-configs-change", init);
|
|
3271
|
+
});
|
|
3092
3272
|
vue.watchEffect(() => {
|
|
3093
3273
|
if (configForm.value && stage.value) {
|
|
3094
3274
|
configForm.value.formState.stage = stage.value;
|
|
@@ -3106,10 +3286,9 @@
|
|
|
3106
3286
|
};
|
|
3107
3287
|
expose({ submit });
|
|
3108
3288
|
return (_ctx, _cache) => {
|
|
3109
|
-
|
|
3110
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
|
|
3289
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
3111
3290
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3112
|
-
vue.createVNode(
|
|
3291
|
+
vue.createVNode(vue.unref(form.MForm), {
|
|
3113
3292
|
ref_key: "configForm",
|
|
3114
3293
|
ref: configForm,
|
|
3115
3294
|
class: vue.normalizeClass(`m-editor-props-panel ${vue.unref(propsPanelSize)}`),
|
|
@@ -3124,43 +3303,360 @@
|
|
|
3124
3303
|
}
|
|
3125
3304
|
});
|
|
3126
3305
|
|
|
3127
|
-
const _hoisted_1$
|
|
3128
|
-
|
|
3129
|
-
const _hoisted_3$1 = { class: "code-name" };
|
|
3130
|
-
const _hoisted_4$1 = { class: "code-name-wrapper" };
|
|
3131
|
-
const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3132
|
-
const _hoisted_6$1 = { class: "m-editor-wrapper" };
|
|
3133
|
-
const _hoisted_7$1 = {
|
|
3134
|
-
key: 1,
|
|
3306
|
+
const _hoisted_1$9 = {
|
|
3307
|
+
key: 0,
|
|
3135
3308
|
class: "m-editor-content-bottom"
|
|
3136
3309
|
};
|
|
3137
|
-
const
|
|
3138
|
-
const
|
|
3139
|
-
const
|
|
3140
|
-
key:
|
|
3310
|
+
const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("\u786E\u8BA4");
|
|
3311
|
+
const _hoisted_3$2 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3312
|
+
const _hoisted_4$2 = {
|
|
3313
|
+
key: 1,
|
|
3141
3314
|
class: "m-editor-content-bottom"
|
|
3142
3315
|
};
|
|
3143
|
-
const
|
|
3316
|
+
const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3317
|
+
const __default__$g = vue.defineComponent({
|
|
3318
|
+
name: "MEditorCodeDraftEditor"
|
|
3319
|
+
});
|
|
3320
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
3321
|
+
...__default__$g,
|
|
3322
|
+
props: {
|
|
3323
|
+
id: null,
|
|
3324
|
+
content: null,
|
|
3325
|
+
editable: { type: Boolean, default: true },
|
|
3326
|
+
autoSaveDraft: { type: Boolean, default: true },
|
|
3327
|
+
codeOptions: null,
|
|
3328
|
+
language: null
|
|
3329
|
+
},
|
|
3330
|
+
emits: ["close", "saveAndClose"],
|
|
3331
|
+
setup(__props, { emit }) {
|
|
3332
|
+
const props = __props;
|
|
3333
|
+
const services = vue.inject("services");
|
|
3334
|
+
const codeContent = vue.ref("");
|
|
3335
|
+
const editorContent = vue.ref("");
|
|
3336
|
+
const codeEditor = vue.ref();
|
|
3337
|
+
const originCodeContent = vue.ref("");
|
|
3338
|
+
const isFullScreen = vue.ref(false);
|
|
3339
|
+
const codeOptions = vue.computed(() => ({
|
|
3340
|
+
...props.codeOptions,
|
|
3341
|
+
readOnly: !props.editable
|
|
3342
|
+
}));
|
|
3343
|
+
vue.watchEffect(() => {
|
|
3344
|
+
codeContent.value = props.content;
|
|
3345
|
+
if (!originCodeContent.value) {
|
|
3346
|
+
originCodeContent.value = codeContent.value;
|
|
3347
|
+
}
|
|
3348
|
+
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3349
|
+
if (codeDraft) {
|
|
3350
|
+
codeContent.value = codeDraft;
|
|
3351
|
+
}
|
|
3352
|
+
});
|
|
3353
|
+
const saveCodeDraft = async (codeValue) => {
|
|
3354
|
+
if (!props.autoSaveDraft)
|
|
3355
|
+
return;
|
|
3356
|
+
if (originCodeContent.value === codeValue) {
|
|
3357
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3358
|
+
return;
|
|
3359
|
+
}
|
|
3360
|
+
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3361
|
+
design.tMagicMessage.success(`\u4EE3\u7801\u8349\u7A3F\u4FDD\u5B58\u6210\u529F ${utils.datetimeFormatter(new Date())}`);
|
|
3362
|
+
};
|
|
3363
|
+
const saveAndClose = () => {
|
|
3364
|
+
if (!codeEditor.value || !props.editable)
|
|
3365
|
+
return;
|
|
3366
|
+
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3367
|
+
emit("saveAndClose", editorContent.value);
|
|
3368
|
+
};
|
|
3369
|
+
const close = async () => {
|
|
3370
|
+
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3371
|
+
if (codeDraft) {
|
|
3372
|
+
design.tMagicMessageBox.confirm("\u60A8\u6709\u4EE3\u7801\u4FEE\u6539\u672A\u4FDD\u5B58\uFF0C\u662F\u5426\u4FDD\u5B58\u540E\u518D\u5173\u95ED\uFF1F", "\u63D0\u793A", {
|
|
3373
|
+
confirmButtonText: "\u786E\u8BA4",
|
|
3374
|
+
cancelButtonText: "\u53D6\u6D88",
|
|
3375
|
+
type: "warning"
|
|
3376
|
+
}).then(async () => {
|
|
3377
|
+
saveAndClose();
|
|
3378
|
+
}).catch(() => {
|
|
3379
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3380
|
+
emit("close");
|
|
3381
|
+
});
|
|
3382
|
+
} else {
|
|
3383
|
+
emit("close");
|
|
3384
|
+
}
|
|
3385
|
+
};
|
|
3386
|
+
const toggleFullScreen = () => {
|
|
3387
|
+
isFullScreen.value = !isFullScreen.value;
|
|
3388
|
+
if (codeEditor.value) {
|
|
3389
|
+
codeEditor.value.focus();
|
|
3390
|
+
}
|
|
3391
|
+
};
|
|
3392
|
+
return (_ctx, _cache) => {
|
|
3393
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3394
|
+
class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3395
|
+
}, [
|
|
3396
|
+
vue.createVNode(_sfc_main$p, {
|
|
3397
|
+
ref_key: "codeEditor",
|
|
3398
|
+
ref: codeEditor,
|
|
3399
|
+
class: "m-editor-container",
|
|
3400
|
+
"init-values": `${codeContent.value}`,
|
|
3401
|
+
onSave: saveCodeDraft,
|
|
3402
|
+
language: __props.language,
|
|
3403
|
+
options: vue.unref(codeOptions)
|
|
3404
|
+
}, null, 8, ["init-values", "language", "options"]),
|
|
3405
|
+
__props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
|
|
3406
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3407
|
+
type: "primary",
|
|
3408
|
+
class: "button",
|
|
3409
|
+
onClick: toggleFullScreen
|
|
3410
|
+
}, {
|
|
3411
|
+
default: vue.withCtx(() => [
|
|
3412
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F"), 1)
|
|
3413
|
+
]),
|
|
3414
|
+
_: 1
|
|
3415
|
+
}),
|
|
3416
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3417
|
+
type: "primary",
|
|
3418
|
+
class: "button",
|
|
3419
|
+
onClick: saveAndClose
|
|
3420
|
+
}, {
|
|
3421
|
+
default: vue.withCtx(() => [
|
|
3422
|
+
_hoisted_2$4
|
|
3423
|
+
]),
|
|
3424
|
+
_: 1
|
|
3425
|
+
}),
|
|
3426
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3427
|
+
type: "primary",
|
|
3428
|
+
class: "button",
|
|
3429
|
+
onClick: close
|
|
3430
|
+
}, {
|
|
3431
|
+
default: vue.withCtx(() => [
|
|
3432
|
+
_hoisted_3$2
|
|
3433
|
+
]),
|
|
3434
|
+
_: 1
|
|
3435
|
+
})
|
|
3436
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, [
|
|
3437
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3438
|
+
type: "primary",
|
|
3439
|
+
class: "button",
|
|
3440
|
+
onClick: toggleFullScreen
|
|
3441
|
+
}, {
|
|
3442
|
+
default: vue.withCtx(() => [
|
|
3443
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F"), 1)
|
|
3444
|
+
]),
|
|
3445
|
+
_: 1
|
|
3446
|
+
}),
|
|
3447
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3448
|
+
type: "primary",
|
|
3449
|
+
class: "button",
|
|
3450
|
+
onClick: close
|
|
3451
|
+
}, {
|
|
3452
|
+
default: vue.withCtx(() => [
|
|
3453
|
+
_hoisted_5$1
|
|
3454
|
+
]),
|
|
3455
|
+
_: 1
|
|
3456
|
+
})
|
|
3457
|
+
]))
|
|
3458
|
+
], 2);
|
|
3459
|
+
};
|
|
3460
|
+
}
|
|
3461
|
+
});
|
|
3462
|
+
|
|
3463
|
+
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3464
|
+
const _hoisted_2$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3465
|
+
const _hoisted_3$1 = { class: "code-name-wrapper" };
|
|
3466
|
+
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u53C2\u6570", -1);
|
|
3467
|
+
const __default__$f = vue.defineComponent({
|
|
3468
|
+
name: "MEditorFunctionEditor"
|
|
3469
|
+
});
|
|
3144
3470
|
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
3145
|
-
|
|
3471
|
+
...__default__$f,
|
|
3472
|
+
props: {
|
|
3473
|
+
id: null,
|
|
3474
|
+
name: null,
|
|
3475
|
+
content: null,
|
|
3476
|
+
editable: { type: Boolean, default: true },
|
|
3477
|
+
autoSaveDraft: { type: Boolean, default: true },
|
|
3478
|
+
codeOptions: null,
|
|
3479
|
+
paramsColConfig: null
|
|
3480
|
+
},
|
|
3481
|
+
emits: ["change", "field-input"],
|
|
3482
|
+
setup(__props, { emit }) {
|
|
3483
|
+
const props = __props;
|
|
3484
|
+
const defaultParamColConfig = {
|
|
3485
|
+
type: "row",
|
|
3486
|
+
label: "\u53C2\u6570\u7C7B\u578B",
|
|
3487
|
+
items: [
|
|
3488
|
+
{
|
|
3489
|
+
text: "\u53C2\u6570\u7C7B\u578B",
|
|
3490
|
+
labelWidth: "70px",
|
|
3491
|
+
type: "select",
|
|
3492
|
+
name: "type",
|
|
3493
|
+
options: [
|
|
3494
|
+
{
|
|
3495
|
+
text: "\u6570\u5B57",
|
|
3496
|
+
label: "\u6570\u5B57",
|
|
3497
|
+
value: "number"
|
|
3498
|
+
},
|
|
3499
|
+
{
|
|
3500
|
+
text: "\u5B57\u7B26\u4E32",
|
|
3501
|
+
label: "\u5B57\u7B26\u4E32",
|
|
3502
|
+
value: "text"
|
|
3503
|
+
}
|
|
3504
|
+
]
|
|
3505
|
+
}
|
|
3506
|
+
]
|
|
3507
|
+
};
|
|
3508
|
+
const paramsColConfig = props.paramsColConfig || defaultParamColConfig;
|
|
3509
|
+
const tableConfig = {
|
|
3510
|
+
type: "table",
|
|
3511
|
+
border: true,
|
|
3512
|
+
enableFullscreen: false,
|
|
3513
|
+
name: "params",
|
|
3514
|
+
maxHeight: "300px",
|
|
3515
|
+
dropSort: false,
|
|
3516
|
+
items: [
|
|
3517
|
+
{
|
|
3518
|
+
type: "text",
|
|
3519
|
+
label: "\u53C2\u6570\u540D",
|
|
3520
|
+
name: "name",
|
|
3521
|
+
width: 200
|
|
3522
|
+
},
|
|
3523
|
+
{
|
|
3524
|
+
type: "text",
|
|
3525
|
+
label: "\u53C2\u6570\u6CE8\u91CA",
|
|
3526
|
+
name: "tip",
|
|
3527
|
+
width: 200
|
|
3528
|
+
},
|
|
3529
|
+
paramsColConfig
|
|
3530
|
+
]
|
|
3531
|
+
};
|
|
3532
|
+
const services = vue.inject("services");
|
|
3533
|
+
const codeName = vue.ref("");
|
|
3534
|
+
const codeContent = vue.ref("");
|
|
3535
|
+
const evalRes = vue.ref(true);
|
|
3536
|
+
vue.provide("mForm", {
|
|
3537
|
+
$emit: emit,
|
|
3538
|
+
setField: () => {
|
|
3539
|
+
}
|
|
3540
|
+
});
|
|
3541
|
+
const tableModel = vue.ref();
|
|
3542
|
+
vue.watchEffect(() => {
|
|
3543
|
+
codeName.value = props.name;
|
|
3544
|
+
codeContent.value = props.content;
|
|
3545
|
+
});
|
|
3546
|
+
const initTableModel = () => {
|
|
3547
|
+
const codeDsl = lodashEs.cloneDeep(services?.codeBlockService.getCodeDslSync());
|
|
3548
|
+
if (!codeDsl)
|
|
3549
|
+
return;
|
|
3550
|
+
tableModel.value = {
|
|
3551
|
+
params: codeDsl[props.id]?.params || []
|
|
3552
|
+
};
|
|
3553
|
+
};
|
|
3554
|
+
initTableModel();
|
|
3555
|
+
const beforeSave = (codeValue) => {
|
|
3556
|
+
try {
|
|
3557
|
+
eval(codeValue);
|
|
3558
|
+
return true;
|
|
3559
|
+
} catch (e) {
|
|
3560
|
+
design.tMagicMessage.error(e.stack);
|
|
3561
|
+
return false;
|
|
3562
|
+
}
|
|
3563
|
+
};
|
|
3564
|
+
const saveCode = async (codeValue2) => {
|
|
3565
|
+
if (!props.editable)
|
|
3566
|
+
return;
|
|
3567
|
+
evalRes.value = beforeSave(codeValue2);
|
|
3568
|
+
if (evalRes.value) {
|
|
3569
|
+
await services?.codeBlockService.setCodeDslById(props.id, {
|
|
3570
|
+
name: codeName.value,
|
|
3571
|
+
content: codeValue2,
|
|
3572
|
+
params: tableModel.value?.params || []
|
|
3573
|
+
});
|
|
3574
|
+
design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3575
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3576
|
+
}
|
|
3577
|
+
};
|
|
3578
|
+
const saveAndClose = async (codeValue2) => {
|
|
3579
|
+
await saveCode(codeValue2);
|
|
3580
|
+
if (evalRes.value) {
|
|
3581
|
+
close();
|
|
3582
|
+
}
|
|
3583
|
+
};
|
|
3584
|
+
const close = () => {
|
|
3585
|
+
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3586
|
+
};
|
|
3587
|
+
return (_ctx, _cache) => {
|
|
3588
|
+
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
3589
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
3590
|
+
header: vue.withCtx(() => [
|
|
3591
|
+
vue.createElementVNode("div", _hoisted_1$8, [
|
|
3592
|
+
_hoisted_2$3,
|
|
3593
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3594
|
+
class: "code-name-input",
|
|
3595
|
+
modelValue: codeName.value,
|
|
3596
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => codeName.value = $event),
|
|
3597
|
+
disabled: !__props.editable
|
|
3598
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
3599
|
+
]),
|
|
3600
|
+
vue.createElementVNode("div", _hoisted_3$1, [
|
|
3601
|
+
_hoisted_4$1,
|
|
3602
|
+
vue.createVNode(_component_m_form_table, {
|
|
3603
|
+
style: { "width": "800px" },
|
|
3604
|
+
config: tableConfig,
|
|
3605
|
+
model: tableModel.value,
|
|
3606
|
+
enableToggleMode: false,
|
|
3607
|
+
name: "params",
|
|
3608
|
+
prop: "params",
|
|
3609
|
+
size: "small"
|
|
3610
|
+
}, null, 8, ["model"])
|
|
3611
|
+
])
|
|
3612
|
+
]),
|
|
3613
|
+
default: vue.withCtx(() => [
|
|
3614
|
+
vue.createVNode(_sfc_main$h, {
|
|
3615
|
+
id: __props.id,
|
|
3616
|
+
content: codeContent.value,
|
|
3617
|
+
editable: __props.editable,
|
|
3618
|
+
autoSaveDraft: __props.autoSaveDraft,
|
|
3619
|
+
codeOptions: __props.codeOptions,
|
|
3620
|
+
language: "javascript",
|
|
3621
|
+
onSaveAndClose: saveAndClose,
|
|
3622
|
+
onClose: close
|
|
3623
|
+
}, null, 8, ["id", "content", "editable", "autoSaveDraft", "codeOptions"])
|
|
3624
|
+
]),
|
|
3625
|
+
_: 1
|
|
3626
|
+
});
|
|
3627
|
+
};
|
|
3628
|
+
}
|
|
3629
|
+
});
|
|
3630
|
+
|
|
3631
|
+
const _hoisted_1$7 = {
|
|
3632
|
+
key: 0,
|
|
3633
|
+
class: "m-editor-code-block-editor-panel"
|
|
3634
|
+
};
|
|
3635
|
+
const __default__$e = vue.defineComponent({
|
|
3636
|
+
name: "MEditorCodeBlockEditor"
|
|
3637
|
+
});
|
|
3638
|
+
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
3639
|
+
...__default__$e,
|
|
3640
|
+
props: {
|
|
3641
|
+
paramsColConfig: null
|
|
3642
|
+
},
|
|
3146
3643
|
setup(__props) {
|
|
3147
3644
|
const services = vue.inject("services");
|
|
3148
|
-
const
|
|
3645
|
+
const codeOptions = vue.inject("codeOptions", {});
|
|
3149
3646
|
const left = vue.ref(200);
|
|
3150
3647
|
const currentTitle = vue.ref("");
|
|
3151
3648
|
const codeConfig = vue.ref(null);
|
|
3152
3649
|
const state = vue.reactive({
|
|
3153
3650
|
codeList: []
|
|
3154
3651
|
});
|
|
3155
|
-
const isShowCodeBlockEditor = vue.computed(
|
|
3156
|
-
() => codeConfig.value && services?.codeBlockService.getCodeEditorShowStatus() || false
|
|
3157
|
-
);
|
|
3158
|
-
const mode = vue.computed(() => services?.codeBlockService.getMode());
|
|
3159
3652
|
const id = vue.computed(() => services?.codeBlockService.getId() || "");
|
|
3160
3653
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3161
3654
|
const selectedIds = vue.computed(() => services?.codeBlockService.getCombineIds() || []);
|
|
3162
3655
|
vue.watchEffect(async () => {
|
|
3163
|
-
codeConfig.value = await services?.codeBlockService.getCodeContentById(id.value) || null;
|
|
3656
|
+
codeConfig.value = lodashEs.cloneDeep(await services?.codeBlockService.getCodeContentById(id.value)) || null;
|
|
3657
|
+
if (!codeConfig.value)
|
|
3658
|
+
return;
|
|
3659
|
+
codeConfig.value.content = serializeConfig(codeConfig.value.content);
|
|
3164
3660
|
});
|
|
3165
3661
|
vue.watchEffect(async () => {
|
|
3166
3662
|
const codeDsl = await services?.codeBlockService.getCodeDslByIds(selectedIds.value) || null;
|
|
@@ -3175,159 +3671,43 @@
|
|
|
3175
3671
|
});
|
|
3176
3672
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3177
3673
|
});
|
|
3178
|
-
const saveCode = async () => {
|
|
3179
|
-
if (!codeEditor.value || !codeConfig.value || !editable.value)
|
|
3180
|
-
return true;
|
|
3181
|
-
try {
|
|
3182
|
-
const codeContent = codeEditor.value.getEditor()?.getValue();
|
|
3183
|
-
codeConfig.value.content = eval(codeContent);
|
|
3184
|
-
} catch (e) {
|
|
3185
|
-
design.tMagicMessage.error(e.stack);
|
|
3186
|
-
return false;
|
|
3187
|
-
}
|
|
3188
|
-
await services?.codeBlockService.setCodeDslById(id.value, {
|
|
3189
|
-
name: codeConfig.value.name,
|
|
3190
|
-
content: codeConfig.value.content
|
|
3191
|
-
});
|
|
3192
|
-
design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3193
|
-
return true;
|
|
3194
|
-
};
|
|
3195
|
-
const saveAndClose = async () => {
|
|
3196
|
-
const saveRes = await saveCode();
|
|
3197
|
-
if (saveRes) {
|
|
3198
|
-
await services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3199
|
-
}
|
|
3200
|
-
};
|
|
3201
|
-
const selectHandler = (data) => {
|
|
3202
|
-
services?.codeBlockService.setId(data.id);
|
|
3203
|
-
currentTitle.value = data.name;
|
|
3204
|
-
};
|
|
3205
3674
|
return (_ctx, _cache) => {
|
|
3206
3675
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDialog), {
|
|
3207
|
-
|
|
3208
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
|
|
3676
|
+
"model-value": true,
|
|
3209
3677
|
class: "code-editor-dialog",
|
|
3210
3678
|
title: currentTitle.value,
|
|
3211
3679
|
fullscreen: true,
|
|
3212
|
-
"
|
|
3213
|
-
"append-to-body": true
|
|
3680
|
+
"close-on-press-escape": false,
|
|
3681
|
+
"append-to-body": true,
|
|
3682
|
+
"show-close": false
|
|
3214
3683
|
}, {
|
|
3215
3684
|
default: vue.withCtx(() => [
|
|
3216
|
-
vue.createVNode(_sfc_main$
|
|
3685
|
+
vue.createVNode(_sfc_main$n, {
|
|
3217
3686
|
left: left.value,
|
|
3218
|
-
"onUpdate:left": _cache[
|
|
3687
|
+
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3219
3688
|
"min-left": 45,
|
|
3220
3689
|
class: "code-editor-layout"
|
|
3221
|
-
},
|
|
3690
|
+
}, {
|
|
3222
3691
|
center: vue.withCtx(() => [
|
|
3223
|
-
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div",
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? "m-editor-code-block-editor-panel-list-mode" : "m-editor-code-block-editor-panel"
|
|
3227
|
-
])
|
|
3228
|
-
}, [
|
|
3229
|
-
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3230
|
-
vue.createVNode(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
3231
|
-
header: vue.withCtx(() => [
|
|
3232
|
-
vue.createElementVNode("div", _hoisted_4$1, [
|
|
3233
|
-
_hoisted_5$1,
|
|
3234
|
-
codeConfig.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInput), {
|
|
3235
|
-
key: 0,
|
|
3236
|
-
class: "code-name-input",
|
|
3237
|
-
modelValue: codeConfig.value.name,
|
|
3238
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => codeConfig.value.name = $event),
|
|
3239
|
-
disabled: !vue.unref(editable)
|
|
3240
|
-
}, null, 8, ["modelValue", "disabled"])) : vue.createCommentVNode("", true)
|
|
3241
|
-
])
|
|
3242
|
-
]),
|
|
3243
|
-
default: vue.withCtx(() => [
|
|
3244
|
-
vue.createElementVNode("div", _hoisted_6$1, [
|
|
3245
|
-
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
3246
|
-
key: 0,
|
|
3247
|
-
ref_key: "codeEditor",
|
|
3248
|
-
ref: codeEditor,
|
|
3249
|
-
class: "m-editor-container",
|
|
3250
|
-
"init-values": `${codeConfig.value.content}`,
|
|
3251
|
-
onSave: saveCode,
|
|
3252
|
-
options: {
|
|
3253
|
-
tabSize: 2,
|
|
3254
|
-
fontSize: 16,
|
|
3255
|
-
formatOnPaste: true,
|
|
3256
|
-
readOnly: !vue.unref(editable)
|
|
3257
|
-
}
|
|
3258
|
-
}, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
|
|
3259
|
-
vue.unref(editable) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
|
|
3260
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3261
|
-
type: "primary",
|
|
3262
|
-
class: "button",
|
|
3263
|
-
onClick: saveCode
|
|
3264
|
-
}, {
|
|
3265
|
-
default: vue.withCtx(() => [
|
|
3266
|
-
_hoisted_8$1
|
|
3267
|
-
]),
|
|
3268
|
-
_: 1
|
|
3269
|
-
}),
|
|
3270
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3271
|
-
type: "primary",
|
|
3272
|
-
class: "button",
|
|
3273
|
-
onClick: saveAndClose
|
|
3274
|
-
}, {
|
|
3275
|
-
default: vue.withCtx(() => [
|
|
3276
|
-
_hoisted_9$1
|
|
3277
|
-
]),
|
|
3278
|
-
_: 1
|
|
3279
|
-
})
|
|
3280
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
|
|
3281
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3282
|
-
type: "primary",
|
|
3283
|
-
class: "button",
|
|
3284
|
-
onClick: saveAndClose
|
|
3285
|
-
}, {
|
|
3286
|
-
default: vue.withCtx(() => [
|
|
3287
|
-
_hoisted_11
|
|
3288
|
-
]),
|
|
3289
|
-
_: 1
|
|
3290
|
-
})
|
|
3291
|
-
]))
|
|
3292
|
-
])
|
|
3293
|
-
]),
|
|
3294
|
-
_: 1
|
|
3295
|
-
})
|
|
3296
|
-
], 2)) : vue.createCommentVNode("", true)
|
|
3297
|
-
]),
|
|
3298
|
-
_: 2
|
|
3299
|
-
}, [
|
|
3300
|
-
vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? {
|
|
3301
|
-
name: "left",
|
|
3302
|
-
fn: vue.withCtx(() => [
|
|
3303
|
-
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
3692
|
+
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
|
|
3693
|
+
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3694
|
+
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$g, {
|
|
3304
3695
|
key: 0,
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
},
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
}, [
|
|
3318
|
-
vue.createElementVNode("div", _hoisted_2$3, [
|
|
3319
|
-
vue.createElementVNode("div", _hoisted_3$1, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1)
|
|
3320
|
-
])
|
|
3321
|
-
], 8, _hoisted_1$7)
|
|
3322
|
-
]),
|
|
3323
|
-
_: 1
|
|
3324
|
-
}, 8, ["data", "current-node-key"])) : vue.createCommentVNode("", true)
|
|
3325
|
-
])
|
|
3326
|
-
} : void 0
|
|
3327
|
-
]), 1032, ["left"])
|
|
3696
|
+
id: vue.unref(id),
|
|
3697
|
+
name: codeConfig.value.name,
|
|
3698
|
+
content: codeConfig.value.content,
|
|
3699
|
+
paramsColConfig: __props.paramsColConfig,
|
|
3700
|
+
editable: !!vue.unref(editable),
|
|
3701
|
+
autoSaveDraft: true,
|
|
3702
|
+
codeOptions: vue.unref(codeOptions)
|
|
3703
|
+
}, null, 8, ["id", "name", "content", "paramsColConfig", "editable", "codeOptions"])) : vue.createCommentVNode("", true)
|
|
3704
|
+
])) : vue.createCommentVNode("", true)
|
|
3705
|
+
]),
|
|
3706
|
+
_: 3
|
|
3707
|
+
}, 8, ["left"])
|
|
3328
3708
|
]),
|
|
3329
3709
|
_: 3
|
|
3330
|
-
}, 8, ["
|
|
3710
|
+
}, 8, ["title"]);
|
|
3331
3711
|
};
|
|
3332
3712
|
}
|
|
3333
3713
|
});
|
|
@@ -3354,50 +3734,51 @@
|
|
|
3354
3734
|
d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
|
|
3355
3735
|
})
|
|
3356
3736
|
], -1);
|
|
3357
|
-
const
|
|
3358
|
-
|
|
3737
|
+
const __default__$d = vue.defineComponent({
|
|
3738
|
+
name: "MEditorCodeBlockList"
|
|
3739
|
+
});
|
|
3740
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
3741
|
+
...__default__$d,
|
|
3359
3742
|
props: {
|
|
3360
|
-
customError: null
|
|
3743
|
+
customError: null,
|
|
3744
|
+
paramsColConfig: null
|
|
3361
3745
|
},
|
|
3362
3746
|
setup(__props) {
|
|
3363
3747
|
const props = __props;
|
|
3364
3748
|
const services = vue.inject("services");
|
|
3365
3749
|
const state = vue.reactive({
|
|
3366
|
-
codeList: []
|
|
3367
|
-
bindComps: {}
|
|
3750
|
+
codeList: []
|
|
3368
3751
|
});
|
|
3369
3752
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
const
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
id: compId,
|
|
3380
|
-
name: getCompName(compId)
|
|
3753
|
+
const isShowCodeBlockEditor = vue.computed(() => services?.codeBlockService.getCodeEditorShowStatus() || false);
|
|
3754
|
+
const codeCombineInfo = vue.ref(null);
|
|
3755
|
+
const getBindCompsByCodeId = (codeId) => {
|
|
3756
|
+
if (!codeCombineInfo.value || !codeCombineInfo.value[codeId])
|
|
3757
|
+
return [];
|
|
3758
|
+
const bindCompsId = Object.keys(codeCombineInfo.value[codeId]);
|
|
3759
|
+
return bindCompsId.map((compId) => ({
|
|
3760
|
+
compId,
|
|
3761
|
+
compName: getCompName(compId)
|
|
3381
3762
|
}));
|
|
3382
|
-
state.bindComps[codeId] = compsInfo;
|
|
3383
3763
|
};
|
|
3384
3764
|
const initList = async () => {
|
|
3385
|
-
const codeDsl = await services?.codeBlockService.getCodeDsl() || null;
|
|
3386
|
-
|
|
3765
|
+
const codeDsl = lodashEs.cloneDeep(await services?.codeBlockService.getCodeDsl()) || null;
|
|
3766
|
+
codeCombineInfo.value = lodashEs.cloneDeep(services?.codeBlockService.getCombineInfo()) || null;
|
|
3767
|
+
if (!codeDsl || !codeCombineInfo.value)
|
|
3387
3768
|
return;
|
|
3388
3769
|
state.codeList = [];
|
|
3389
3770
|
lodashEs.forIn(codeDsl, (value, codeId) => {
|
|
3390
|
-
getBindCompsByCodeId(codeId, value);
|
|
3391
3771
|
state.codeList.push({
|
|
3392
3772
|
id: codeId,
|
|
3393
3773
|
name: value.name,
|
|
3394
3774
|
codeBlockContent: value,
|
|
3395
|
-
showRelation: true
|
|
3775
|
+
showRelation: true,
|
|
3776
|
+
combineInfo: getBindCompsByCodeId(codeId)
|
|
3396
3777
|
});
|
|
3397
3778
|
});
|
|
3398
3779
|
};
|
|
3399
3780
|
vue.watch(
|
|
3400
|
-
() => services?.codeBlockService.
|
|
3781
|
+
[() => services?.codeBlockService.getCodeDslSync(), () => services?.codeBlockService.refreshCombineInfo()],
|
|
3401
3782
|
() => {
|
|
3402
3783
|
initList();
|
|
3403
3784
|
},
|
|
@@ -3406,20 +3787,6 @@
|
|
|
3406
3787
|
deep: true
|
|
3407
3788
|
}
|
|
3408
3789
|
);
|
|
3409
|
-
vue.watch(
|
|
3410
|
-
() => services?.editorService.get("node"),
|
|
3411
|
-
(curNode) => {
|
|
3412
|
-
if (!curNode?.id)
|
|
3413
|
-
return;
|
|
3414
|
-
lodashEs.forIn(state.bindComps, (bindCompInfo) => {
|
|
3415
|
-
bindCompInfo.forEach((comp) => {
|
|
3416
|
-
if (comp.id === curNode.id) {
|
|
3417
|
-
comp.name = curNode.name;
|
|
3418
|
-
}
|
|
3419
|
-
});
|
|
3420
|
-
});
|
|
3421
|
-
}
|
|
3422
|
-
);
|
|
3423
3790
|
const createCodeBlock = async () => {
|
|
3424
3791
|
const { codeBlockService } = services || {};
|
|
3425
3792
|
if (!codeBlockService) {
|
|
@@ -3428,21 +3795,21 @@
|
|
|
3428
3795
|
}
|
|
3429
3796
|
const codeConfig = {
|
|
3430
3797
|
name: "\u4EE3\u7801\u5757",
|
|
3431
|
-
content: `() => {
|
|
3798
|
+
content: `({app, params}) => {
|
|
3432
3799
|
// place your code here
|
|
3433
|
-
}
|
|
3800
|
+
}`,
|
|
3801
|
+
params: []
|
|
3434
3802
|
};
|
|
3435
|
-
await codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3436
3803
|
const id = await codeBlockService.getUniqueId();
|
|
3437
3804
|
await codeBlockService.setCodeDslById(id, codeConfig);
|
|
3438
3805
|
codeBlockService.setCodeEditorContent(true, id);
|
|
3439
3806
|
};
|
|
3440
3807
|
const editCode = async (key) => {
|
|
3441
|
-
await services?.codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3442
3808
|
services?.codeBlockService.setCodeEditorContent(true, key);
|
|
3443
3809
|
};
|
|
3444
3810
|
const deleteCode = (key) => {
|
|
3445
|
-
const
|
|
3811
|
+
const currentCode = state.codeList.find((codeItem) => codeItem.id === key);
|
|
3812
|
+
const existBinds = !lodashEs.isEmpty(currentCode?.combineInfo);
|
|
3446
3813
|
const undeleteableList = services?.codeBlockService.getUndeletableList() || [];
|
|
3447
3814
|
if (!existBinds && !undeleteableList.includes(key)) {
|
|
3448
3815
|
services?.codeBlockService.deleteCodeDslByIds([key]);
|
|
@@ -3508,110 +3875,121 @@
|
|
|
3508
3875
|
})) : vue.createCommentVNode("", true)
|
|
3509
3876
|
])
|
|
3510
3877
|
]),
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3878
|
+
vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
|
|
3879
|
+
default: vue.withCtx(() => [
|
|
3880
|
+
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
3881
|
+
key: 0,
|
|
3882
|
+
ref_key: "tree",
|
|
3883
|
+
ref: tree,
|
|
3884
|
+
"node-key": "id",
|
|
3885
|
+
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3886
|
+
data: state.codeList,
|
|
3887
|
+
"highlight-current": true,
|
|
3888
|
+
"filter-node-method": filterNode,
|
|
3889
|
+
onNodeClick: toggleCombineRelation
|
|
3890
|
+
}, {
|
|
3891
|
+
default: vue.withCtx(({ data }) => [
|
|
3892
|
+
vue.createElementVNode("div", {
|
|
3893
|
+
id: data.id,
|
|
3894
|
+
class: "list-container"
|
|
3895
|
+
}, [
|
|
3896
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
3897
|
+
vue.createElementVNode("span", _hoisted_6, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1),
|
|
3898
|
+
vue.createElementVNode("div", _hoisted_7, [
|
|
3899
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
3900
|
+
effect: "dark",
|
|
3901
|
+
content: vue.unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
|
|
3902
|
+
placement: "bottom"
|
|
3903
|
+
}, {
|
|
3904
|
+
default: vue.withCtx(() => [
|
|
3905
|
+
vue.createVNode(_sfc_main$s, {
|
|
3906
|
+
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3907
|
+
class: "edit-icon",
|
|
3908
|
+
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
3909
|
+
}, null, 8, ["icon", "onClick"])
|
|
3910
|
+
]),
|
|
3911
|
+
_: 2
|
|
3912
|
+
}, 1032, ["content"]),
|
|
3913
|
+
data.combineInfo && data.combineInfo.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3914
|
+
key: 0,
|
|
3915
|
+
effect: "dark",
|
|
3916
|
+
content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
|
|
3917
|
+
placement: "bottom"
|
|
3918
|
+
}, {
|
|
3919
|
+
default: vue.withCtx(() => [
|
|
3920
|
+
vue.createVNode(_sfc_main$s, {
|
|
3921
|
+
icon: vue.unref(iconsVue.Link),
|
|
3922
|
+
class: "edit-icon",
|
|
3923
|
+
onClick: vue.withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
3924
|
+
}, null, 8, ["icon", "onClick"])
|
|
3925
|
+
]),
|
|
3926
|
+
_: 2
|
|
3927
|
+
}, 1024)) : vue.createCommentVNode("", true),
|
|
3928
|
+
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3929
|
+
key: 1,
|
|
3930
|
+
effect: "dark",
|
|
3931
|
+
content: "\u5220\u9664",
|
|
3932
|
+
placement: "bottom"
|
|
3933
|
+
}, {
|
|
3934
|
+
default: vue.withCtx(() => [
|
|
3935
|
+
vue.createVNode(_sfc_main$s, {
|
|
3936
|
+
icon: vue.unref(iconsVue.Close),
|
|
3937
|
+
class: "edit-icon",
|
|
3938
|
+
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
3939
|
+
}, null, 8, ["icon", "onClick"])
|
|
3940
|
+
]),
|
|
3941
|
+
_: 2
|
|
3942
|
+
}, 1024)) : vue.createCommentVNode("", true),
|
|
3943
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
3944
|
+
id: data.id,
|
|
3945
|
+
data: data.codeBlockContent
|
|
3946
|
+
})
|
|
3947
|
+
])
|
|
3948
|
+
]),
|
|
3949
|
+
data.showRelation && data.combineInfo && data.combineInfo.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
3950
|
+
_hoisted_9,
|
|
3951
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.combineInfo, (comp, index) => {
|
|
3952
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3953
|
+
key: index,
|
|
3954
|
+
class: "code-comp",
|
|
3955
|
+
size: "small",
|
|
3956
|
+
plain: true,
|
|
3957
|
+
onClick: vue.withModifiers(($event) => selectComp(comp.compId), ["stop"])
|
|
3958
|
+
}, {
|
|
3959
|
+
default: vue.withCtx(() => [
|
|
3960
|
+
vue.createTextVNode(vue.toDisplayString(comp.compName), 1)
|
|
3961
|
+
]),
|
|
3962
|
+
_: 2
|
|
3963
|
+
}, 1032, ["onClick"]);
|
|
3964
|
+
}), 128))
|
|
3965
|
+
])) : vue.createCommentVNode("", true)
|
|
3966
|
+
], 8, _hoisted_4)
|
|
3579
3967
|
]),
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(state.bindComps[data.id], (comp, index) => {
|
|
3583
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3584
|
-
key: index,
|
|
3585
|
-
class: "code-comp",
|
|
3586
|
-
size: "small",
|
|
3587
|
-
plain: true,
|
|
3588
|
-
onClick: vue.withModifiers(($event) => selectComp(comp.id), ["stop"])
|
|
3589
|
-
}, {
|
|
3590
|
-
default: vue.withCtx(() => [
|
|
3591
|
-
vue.createTextVNode(vue.toDisplayString(comp.name), 1)
|
|
3592
|
-
]),
|
|
3593
|
-
_: 2
|
|
3594
|
-
}, 1032, ["onClick"]);
|
|
3595
|
-
}), 128))
|
|
3596
|
-
])) : vue.createCommentVNode("", true)
|
|
3597
|
-
], 8, _hoisted_4)
|
|
3968
|
+
_: 3
|
|
3969
|
+
}, 8, ["data"])) : vue.createCommentVNode("", true)
|
|
3598
3970
|
]),
|
|
3599
3971
|
_: 3
|
|
3600
|
-
}
|
|
3601
|
-
vue.
|
|
3972
|
+
}),
|
|
3973
|
+
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, {
|
|
3974
|
+
key: 0,
|
|
3975
|
+
paramsColConfig: __props.paramsColConfig
|
|
3976
|
+
}, {
|
|
3602
3977
|
"code-block-edit-panel-header": vue.withCtx(({ id }) => [
|
|
3603
3978
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
3604
3979
|
]),
|
|
3605
3980
|
_: 3
|
|
3606
|
-
})
|
|
3981
|
+
}, 8, ["paramsColConfig"])) : vue.createCommentVNode("", true)
|
|
3607
3982
|
]);
|
|
3608
3983
|
};
|
|
3609
3984
|
}
|
|
3610
3985
|
});
|
|
3611
3986
|
|
|
3612
3987
|
const _hoisted_1$5 = ["onClick", "onDragstart"];
|
|
3613
|
-
const
|
|
3614
|
-
|
|
3988
|
+
const __default__$c = vue.defineComponent({
|
|
3989
|
+
name: "MEditorComponentListPanel"
|
|
3990
|
+
});
|
|
3991
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
3992
|
+
...__default__$c,
|
|
3615
3993
|
setup(__props) {
|
|
3616
3994
|
const searchText = vue.ref("");
|
|
3617
3995
|
const services = vue.inject("services");
|
|
@@ -3700,7 +4078,7 @@
|
|
|
3700
4078
|
name: `${index}`
|
|
3701
4079
|
}, {
|
|
3702
4080
|
title: vue.withCtx(() => [
|
|
3703
|
-
vue.createVNode(_sfc_main$
|
|
4081
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
3704
4082
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
3705
4083
|
]),
|
|
3706
4084
|
default: vue.withCtx(() => [
|
|
@@ -3715,7 +4093,7 @@
|
|
|
3715
4093
|
onDrag: dragHandler
|
|
3716
4094
|
}, [
|
|
3717
4095
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
3718
|
-
vue.createVNode(_sfc_main$
|
|
4096
|
+
vue.createVNode(_sfc_main$s, {
|
|
3719
4097
|
icon: item.icon
|
|
3720
4098
|
}, null, 8, ["icon"]),
|
|
3721
4099
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
@@ -3746,8 +4124,11 @@
|
|
|
3746
4124
|
}
|
|
3747
4125
|
});
|
|
3748
4126
|
|
|
3749
|
-
const
|
|
3750
|
-
|
|
4127
|
+
const __default__$b = vue.defineComponent({
|
|
4128
|
+
name: "MEditorContentMenu"
|
|
4129
|
+
});
|
|
4130
|
+
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
4131
|
+
...__default__$b,
|
|
3751
4132
|
props: {
|
|
3752
4133
|
menuData: { default: () => [] },
|
|
3753
4134
|
isSubMenu: { type: Boolean, default: false }
|
|
@@ -3835,7 +4216,7 @@
|
|
|
3835
4216
|
}, [
|
|
3836
4217
|
vue.createElementVNode("div", null, [
|
|
3837
4218
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
3838
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4219
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3839
4220
|
"event-type": "mouseup",
|
|
3840
4221
|
data: item,
|
|
3841
4222
|
key: index,
|
|
@@ -3861,16 +4242,22 @@
|
|
|
3861
4242
|
}
|
|
3862
4243
|
});
|
|
3863
4244
|
|
|
3864
|
-
const
|
|
3865
|
-
|
|
4245
|
+
const __default__$a = vue.defineComponent({
|
|
4246
|
+
name: "MEditorLayerMenu"
|
|
4247
|
+
});
|
|
4248
|
+
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
4249
|
+
...__default__$a,
|
|
4250
|
+
props: {
|
|
4251
|
+
layerContentMenu: null
|
|
4252
|
+
},
|
|
3866
4253
|
setup(__props, { expose }) {
|
|
4254
|
+
const props = __props;
|
|
3867
4255
|
const services = vue.inject("services");
|
|
3868
4256
|
const menu = vue.ref();
|
|
3869
4257
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3870
4258
|
const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
|
|
3871
4259
|
const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
|
|
3872
4260
|
const componentList = vue.computed(() => services?.componentListService.getList() || []);
|
|
3873
|
-
const layerContentMenu = vue.inject("layerContentMenu", []);
|
|
3874
4261
|
const createMenuItems = (group) => group.items.map((component) => ({
|
|
3875
4262
|
text: component.text,
|
|
3876
4263
|
type: "button",
|
|
@@ -3925,7 +4312,7 @@
|
|
|
3925
4312
|
{
|
|
3926
4313
|
type: "button",
|
|
3927
4314
|
text: "\u590D\u5236",
|
|
3928
|
-
icon: vue.markRaw(iconsVue.
|
|
4315
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
3929
4316
|
display: () => !isRoot.value,
|
|
3930
4317
|
handler: () => {
|
|
3931
4318
|
node.value && services?.editorService.copy(node.value);
|
|
@@ -3940,7 +4327,7 @@
|
|
|
3940
4327
|
node.value && services?.editorService.remove(node.value);
|
|
3941
4328
|
}
|
|
3942
4329
|
},
|
|
3943
|
-
...layerContentMenu
|
|
4330
|
+
...props.layerContentMenu
|
|
3944
4331
|
]);
|
|
3945
4332
|
const show = (e) => {
|
|
3946
4333
|
menu.value?.show(e);
|
|
@@ -3949,7 +4336,7 @@
|
|
|
3949
4336
|
show
|
|
3950
4337
|
});
|
|
3951
4338
|
return (_ctx, _cache) => {
|
|
3952
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4339
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$c, {
|
|
3953
4340
|
"menu-data": vue.unref(menuData),
|
|
3954
4341
|
ref_key: "menu",
|
|
3955
4342
|
ref: menu,
|
|
@@ -3960,27 +4347,42 @@
|
|
|
3960
4347
|
});
|
|
3961
4348
|
|
|
3962
4349
|
const _hoisted_1$4 = ["id", "onMouseenter"];
|
|
3963
|
-
const
|
|
3964
|
-
|
|
4350
|
+
const __default__$9 = vue.defineComponent({
|
|
4351
|
+
name: "MEditorLayerPanel"
|
|
4352
|
+
});
|
|
4353
|
+
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
4354
|
+
...__default__$9,
|
|
4355
|
+
props: {
|
|
4356
|
+
layerContentMenu: null
|
|
4357
|
+
},
|
|
3965
4358
|
setup(__props) {
|
|
3966
4359
|
const throttleTime = 150;
|
|
3967
4360
|
const services = vue.inject("services");
|
|
4361
|
+
const editorService = services?.editorService;
|
|
3968
4362
|
const tree = vue.ref();
|
|
3969
4363
|
const menu = vue.ref();
|
|
3970
|
-
const
|
|
4364
|
+
const checkedKeys = vue.ref([]);
|
|
4365
|
+
const isCtrlKeyDown = vue.ref(false);
|
|
4366
|
+
const filterText = vue.ref("");
|
|
4367
|
+
const expandedKeys = vue.ref([]);
|
|
4368
|
+
const currentNodeKey = vue.ref();
|
|
4369
|
+
const clicked = vue.ref(false);
|
|
4370
|
+
const treeProps = {
|
|
4371
|
+
children: "items",
|
|
4372
|
+
disabled: (data) => Boolean(data.items?.length),
|
|
4373
|
+
class: (data) => {
|
|
4374
|
+
if (clicked.value || utils.isPage(data))
|
|
4375
|
+
return "";
|
|
4376
|
+
if (data.id === highlightNode?.value?.id && !checkedKeys.value.includes(data.id)) {
|
|
4377
|
+
return "cus-tree-node-hover";
|
|
4378
|
+
}
|
|
4379
|
+
}
|
|
4380
|
+
};
|
|
4381
|
+
const isMultiSelect = vue.computed(() => isCtrlKeyDown.value || checkedKeys.value.length > 1);
|
|
4382
|
+
const nodes = vue.computed(() => editorService?.get("nodes") || []);
|
|
3971
4383
|
const page = vue.computed(() => editorService?.get("page"));
|
|
3972
4384
|
const values = vue.computed(() => page.value ? [page.value] : []);
|
|
3973
|
-
const
|
|
3974
|
-
const selectedIds = vue.computed(() => selectedNodes.value.map((node) => node.id));
|
|
3975
|
-
const isMultiSelectStatus = vue.ref(false);
|
|
3976
|
-
const spliceNodeKey = vue.ref();
|
|
3977
|
-
const filterText = vue.ref("");
|
|
3978
|
-
const defaultExpandedKeys = vue.computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
|
|
3979
|
-
editorService?.on("remove", () => {
|
|
3980
|
-
setTimeout(() => {
|
|
3981
|
-
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
3982
|
-
}, 0);
|
|
3983
|
-
});
|
|
4385
|
+
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
3984
4386
|
const select = async (data) => {
|
|
3985
4387
|
if (!data.id) {
|
|
3986
4388
|
throw new Error("\u6CA1\u6709id");
|
|
@@ -3999,7 +4401,6 @@
|
|
|
3999
4401
|
editorService?.highlight(data);
|
|
4000
4402
|
editorService?.get("stage")?.highlight(data.id);
|
|
4001
4403
|
};
|
|
4002
|
-
const expandedKeys = /* @__PURE__ */ new Map();
|
|
4003
4404
|
const allowDrop = (draggingNode, dropNode, type) => {
|
|
4004
4405
|
const { data } = dropNode || {};
|
|
4005
4406
|
const { data: ingData } = draggingNode;
|
|
@@ -4031,23 +4432,18 @@
|
|
|
4031
4432
|
const [page2] = data;
|
|
4032
4433
|
editorService?.update(page2);
|
|
4033
4434
|
};
|
|
4034
|
-
const loadItems = (node, resolve) => {
|
|
4035
|
-
if (Array.isArray(node.data)) {
|
|
4036
|
-
return resolve(node.data);
|
|
4037
|
-
}
|
|
4038
|
-
if (Array.isArray(node.data?.items)) {
|
|
4039
|
-
return resolve(node.data?.items);
|
|
4040
|
-
}
|
|
4041
|
-
resolve([]);
|
|
4042
|
-
};
|
|
4043
4435
|
const handleCollapse = (data) => {
|
|
4044
|
-
expandedKeys.
|
|
4436
|
+
expandedKeys.value = expandedKeys.value.filter((id) => id !== data.id);
|
|
4045
4437
|
};
|
|
4046
4438
|
const handleExpand = (data) => {
|
|
4047
|
-
|
|
4048
|
-
|
|
4439
|
+
if (!page.value) {
|
|
4440
|
+
expandedKeys.value = [];
|
|
4049
4441
|
return;
|
|
4050
|
-
|
|
4442
|
+
}
|
|
4443
|
+
expandedKeys.value = lodashEs.union(
|
|
4444
|
+
expandedKeys.value,
|
|
4445
|
+
utils.getNodePath(data.id, [page.value]).map((node) => node.id)
|
|
4446
|
+
);
|
|
4051
4447
|
};
|
|
4052
4448
|
const filterNode = (value, data) => {
|
|
4053
4449
|
if (!value) {
|
|
@@ -4064,121 +4460,78 @@
|
|
|
4064
4460
|
const filterTextChangeHandler = (val) => {
|
|
4065
4461
|
tree.value?.filter(val);
|
|
4066
4462
|
};
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
tree.value.getNode(key)?.expand();
|
|
4080
|
-
});
|
|
4081
|
-
};
|
|
4082
|
-
vue.watch(
|
|
4083
|
-
() => editorService?.get("nodes"),
|
|
4084
|
-
(nodes) => {
|
|
4085
|
-
selectedNodes.value = nodes ?? [];
|
|
4463
|
+
vue.watch(nodes, (nodes2) => {
|
|
4464
|
+
const ids = nodes2?.map((node) => node.id) || [];
|
|
4465
|
+
const idsLength = ids.length;
|
|
4466
|
+
const checkedKeysLength = checkedKeys.value.length;
|
|
4467
|
+
if (lodashEs.difference(
|
|
4468
|
+
idsLength > checkedKeysLength ? ids : checkedKeys.value,
|
|
4469
|
+
idsLength > checkedKeysLength ? checkedKeys.value : ids
|
|
4470
|
+
).length) {
|
|
4471
|
+
tree.value?.setCheckedKeys([], false);
|
|
4472
|
+
[currentNodeKey.value] = ids;
|
|
4473
|
+
checkedKeys.value = ids.filter((id) => id !== page.value?.id);
|
|
4474
|
+
expandedKeys.value = lodashEs.union(expandedKeys.value, ids);
|
|
4086
4475
|
}
|
|
4087
|
-
);
|
|
4088
|
-
|
|
4089
|
-
if (!
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
tree.value.setCheckedKeys([]);
|
|
4093
|
-
tree.value.setCurrentKey();
|
|
4094
|
-
} else if (selectedIds.value.length === 1 && !isMultiSelectStatus.value) {
|
|
4095
|
-
tree.value.setCurrentKey(selectedIds.value[0], true);
|
|
4096
|
-
tree.value.setCheckedKeys([]);
|
|
4097
|
-
} else {
|
|
4098
|
-
tree.value.setCheckedKeys(selectedIds.value);
|
|
4099
|
-
tree.value.setCurrentKey();
|
|
4476
|
+
});
|
|
4477
|
+
vue.watch(isMultiSelect, (isMultiSelect2) => {
|
|
4478
|
+
if (!isMultiSelect2) {
|
|
4479
|
+
currentNodeKey.value = editorService?.get("node")?.id;
|
|
4480
|
+
tree.value?.setCurrentKey(currentNodeKey.value);
|
|
4100
4481
|
}
|
|
4101
|
-
};
|
|
4102
|
-
vue.watch([selectedIds, tree], async () => {
|
|
4103
|
-
if (!tree.value || !editorService)
|
|
4104
|
-
return;
|
|
4105
|
-
const parent = editorService.get("parent");
|
|
4106
|
-
if (!parent?.id)
|
|
4107
|
-
return;
|
|
4108
|
-
const treeNode = tree.value.getNode(parent.id);
|
|
4109
|
-
treeNode?.updateChildren();
|
|
4110
|
-
await expandNodes();
|
|
4111
|
-
setTreeKeyStatus();
|
|
4112
4482
|
});
|
|
4113
|
-
const
|
|
4114
|
-
|
|
4483
|
+
const editorServiceRemoveHandler = () => {
|
|
4484
|
+
setTimeout(() => {
|
|
4485
|
+
tree.value?.getNode(editorService?.get("node")?.id)?.updateChildren();
|
|
4486
|
+
}, 0);
|
|
4487
|
+
};
|
|
4488
|
+
const windowBlurHandler = () => {
|
|
4489
|
+
isCtrlKeyDown.value = false;
|
|
4490
|
+
};
|
|
4491
|
+
let keycon;
|
|
4492
|
+
vue.onMounted(() => {
|
|
4493
|
+
editorService?.on("remove", editorServiceRemoveHandler);
|
|
4494
|
+
keycon = new KeyController__default.default();
|
|
4115
4495
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4116
4496
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4117
|
-
keycon.
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
})
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
keycon.value.keyup(ctrl, (e) => {
|
|
4126
|
-
e.inputEvent.preventDefault();
|
|
4127
|
-
isMultiSelectStatus.value = false;
|
|
4497
|
+
keycon.keydown((e) => {
|
|
4498
|
+
if (e.key !== ctrl) {
|
|
4499
|
+
isCtrlKeyDown.value = false;
|
|
4500
|
+
}
|
|
4501
|
+
}).keydown(ctrl, () => {
|
|
4502
|
+
isCtrlKeyDown.value = true;
|
|
4503
|
+
}).keyup(ctrl, () => {
|
|
4504
|
+
isCtrlKeyDown.value = false;
|
|
4128
4505
|
});
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
4506
|
+
globalThis.addEventListener("blur", windowBlurHandler);
|
|
4507
|
+
});
|
|
4508
|
+
vue.onUnmounted(() => {
|
|
4509
|
+
keycon.destroy();
|
|
4510
|
+
editorService?.off("remove", editorServiceRemoveHandler);
|
|
4511
|
+
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
4512
|
+
});
|
|
4137
4513
|
const highlightHandler = lodashEs.throttle((data) => {
|
|
4138
4514
|
highlight(data);
|
|
4139
4515
|
}, throttleTime);
|
|
4140
4516
|
const toggleClickFlag = () => {
|
|
4141
4517
|
clicked.value = !clicked.value;
|
|
4142
4518
|
};
|
|
4143
|
-
const
|
|
4144
|
-
if (
|
|
4145
|
-
|
|
4146
|
-
return data.id === highlightNode?.value?.id && !selectedIds.value.includes(data.id) && spliceNodeKey.value !== data.id;
|
|
4147
|
-
};
|
|
4148
|
-
vue.watch(isMultiSelectStatus, () => {
|
|
4149
|
-
if (isMultiSelectStatus.value && selectedNodes.value.length === 1 && selectedNodes.value[0].type === schema.NodeType.PAGE) {
|
|
4150
|
-
selectedNodes.value = [];
|
|
4151
|
-
}
|
|
4152
|
-
});
|
|
4153
|
-
const multiClickHandler = (data) => {
|
|
4154
|
-
if (!data?.id) {
|
|
4155
|
-
throw new Error("\u6CA1\u6709id");
|
|
4156
|
-
}
|
|
4157
|
-
if (data.type === schema.NodeType.PAGE) {
|
|
4158
|
-
tree.value?.setCheckedKeys([]);
|
|
4159
|
-
return;
|
|
4160
|
-
}
|
|
4161
|
-
const index = selectedNodes.value.findIndex((node) => node.id === data.id);
|
|
4162
|
-
if (index !== -1) {
|
|
4163
|
-
selectedNodes.value.splice(index, 1);
|
|
4164
|
-
spliceNodeKey.value = data.id;
|
|
4519
|
+
const checkHandler = (data, { checkedNodes }) => {
|
|
4520
|
+
if (checkedNodes.length > 0) {
|
|
4521
|
+
multiSelect(checkedNodes.map((node) => node.id));
|
|
4165
4522
|
} else {
|
|
4166
|
-
|
|
4523
|
+
multiSelect(nodes.value.map((node) => node.id));
|
|
4167
4524
|
}
|
|
4168
|
-
tree.value?.setCheckedKeys(selectedIds.value);
|
|
4169
|
-
multiSelect(selectedIds.value);
|
|
4170
4525
|
};
|
|
4171
4526
|
const clickHandler = (data) => {
|
|
4172
|
-
if (
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
}
|
|
4177
|
-
|
|
4178
|
-
select(data);
|
|
4179
|
-
} else {
|
|
4180
|
-
multiClickHandler(data);
|
|
4527
|
+
if (isCtrlKeyDown.value) {
|
|
4528
|
+
return;
|
|
4529
|
+
}
|
|
4530
|
+
if (services?.uiService.get("uiSelectMode")) {
|
|
4531
|
+
document.dispatchEvent(new CustomEvent("ui-select", { detail: data }));
|
|
4532
|
+
return;
|
|
4181
4533
|
}
|
|
4534
|
+
select(data);
|
|
4182
4535
|
};
|
|
4183
4536
|
const contextmenu = async (event, data) => {
|
|
4184
4537
|
event.preventDefault();
|
|
@@ -4186,11 +4539,7 @@
|
|
|
4186
4539
|
menu.value?.show(event);
|
|
4187
4540
|
};
|
|
4188
4541
|
return (_ctx, _cache) => {
|
|
4189
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), {
|
|
4190
|
-
class: "magic-editor-layer-panel",
|
|
4191
|
-
onMouseenter: addSelectModeListener,
|
|
4192
|
-
onMouseleave: removeSelectModeListener
|
|
4193
|
-
}, {
|
|
4542
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4194
4543
|
default: vue.withCtx(() => [
|
|
4195
4544
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4196
4545
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
@@ -4211,30 +4560,30 @@
|
|
|
4211
4560
|
"node-key": "id",
|
|
4212
4561
|
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4213
4562
|
draggable: "",
|
|
4214
|
-
"default-expanded-keys":
|
|
4215
|
-
|
|
4563
|
+
"default-expanded-keys": expandedKeys.value,
|
|
4564
|
+
"default-checked-keys": checkedKeys.value,
|
|
4565
|
+
"current-node-key": currentNodeKey.value,
|
|
4216
4566
|
data: vue.unref(values),
|
|
4217
4567
|
"expand-on-click-node": false,
|
|
4218
|
-
"highlight-current":
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
},
|
|
4568
|
+
"highlight-current": !vue.unref(isMultiSelect),
|
|
4569
|
+
"check-on-click-node": true,
|
|
4570
|
+
props: treeProps,
|
|
4222
4571
|
"filter-node-method": filterNode,
|
|
4223
4572
|
"allow-drop": allowDrop,
|
|
4224
|
-
"show-checkbox":
|
|
4573
|
+
"show-checkbox": vue.unref(isMultiSelect),
|
|
4225
4574
|
onNodeClick: clickHandler,
|
|
4226
4575
|
onNodeContextmenu: contextmenu,
|
|
4227
4576
|
onNodeDragEnd: handleDragEnd,
|
|
4228
4577
|
onNodeCollapse: handleCollapse,
|
|
4229
4578
|
onNodeExpand: handleExpand,
|
|
4230
|
-
onCheck:
|
|
4579
|
+
onCheck: checkHandler,
|
|
4231
4580
|
onMousedown: toggleClickFlag,
|
|
4232
4581
|
onMouseup: toggleClickFlag
|
|
4233
4582
|
}, {
|
|
4234
4583
|
default: vue.withCtx(({ node, data }) => [
|
|
4235
4584
|
vue.createElementVNode("div", {
|
|
4585
|
+
class: "cus-tree-node",
|
|
4236
4586
|
id: data.id,
|
|
4237
|
-
class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4238
4587
|
onMouseenter: ($event) => vue.unref(highlightHandler)(data)
|
|
4239
4588
|
}, [
|
|
4240
4589
|
vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
@@ -4243,15 +4592,16 @@
|
|
|
4243
4592
|
}, () => [
|
|
4244
4593
|
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4245
4594
|
])
|
|
4246
|
-
],
|
|
4595
|
+
], 40, _hoisted_1$4)
|
|
4247
4596
|
]),
|
|
4248
4597
|
_: 3
|
|
4249
|
-
}, 8, ["default-expanded-keys", "data", "show-checkbox"])) : vue.createCommentVNode("", true),
|
|
4598
|
+
}, 8, ["default-expanded-keys", "default-checked-keys", "current-node-key", "data", "highlight-current", "show-checkbox"])) : vue.createCommentVNode("", true),
|
|
4250
4599
|
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4251
|
-
vue.createVNode(_sfc_main$
|
|
4600
|
+
vue.createVNode(_sfc_main$b, {
|
|
4252
4601
|
ref_key: "menu",
|
|
4253
|
-
ref: menu
|
|
4254
|
-
|
|
4602
|
+
ref: menu,
|
|
4603
|
+
"layer-content-menu": __props.layerContentMenu
|
|
4604
|
+
}, null, 8, ["layer-content-menu"])
|
|
4255
4605
|
]))
|
|
4256
4606
|
]),
|
|
4257
4607
|
_: 3
|
|
@@ -4264,143 +4614,52 @@
|
|
|
4264
4614
|
key: 1,
|
|
4265
4615
|
class: "magic-editor-tab-panel-title"
|
|
4266
4616
|
};
|
|
4267
|
-
const
|
|
4268
|
-
|
|
4269
|
-
props: {
|
|
4270
|
-
data: null
|
|
4271
|
-
},
|
|
4272
|
-
setup(__props) {
|
|
4273
|
-
const props = __props;
|
|
4274
|
-
const config = vue.computed(() => {
|
|
4275
|
-
if (typeof props.data !== "string") {
|
|
4276
|
-
return props.data;
|
|
4277
|
-
}
|
|
4278
|
-
switch (props.data) {
|
|
4279
|
-
case "component-list":
|
|
4280
|
-
return {
|
|
4281
|
-
type: "component",
|
|
4282
|
-
icon: iconsVue.Coin,
|
|
4283
|
-
text: "\u7EC4\u4EF6",
|
|
4284
|
-
component: _sfc_main$e,
|
|
4285
|
-
slots: {}
|
|
4286
|
-
};
|
|
4287
|
-
case "layer":
|
|
4288
|
-
return {
|
|
4289
|
-
type: "component",
|
|
4290
|
-
icon: iconsVue.Files,
|
|
4291
|
-
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4292
|
-
component: _sfc_main$b,
|
|
4293
|
-
slots: {}
|
|
4294
|
-
};
|
|
4295
|
-
case "code-block":
|
|
4296
|
-
return {
|
|
4297
|
-
type: "component",
|
|
4298
|
-
icon: iconsVue.EditPen,
|
|
4299
|
-
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4300
|
-
component: _sfc_main$f,
|
|
4301
|
-
slots: {}
|
|
4302
|
-
};
|
|
4303
|
-
default:
|
|
4304
|
-
return void 0;
|
|
4305
|
-
}
|
|
4306
|
-
});
|
|
4307
|
-
return (_ctx, _cache) => {
|
|
4308
|
-
return vue.unref(config) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabPane), {
|
|
4309
|
-
key: 0,
|
|
4310
|
-
name: vue.unref(config).text
|
|
4311
|
-
}, {
|
|
4312
|
-
label: vue.withCtx(() => [
|
|
4313
|
-
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4314
|
-
key: vue.unref(config).text
|
|
4315
|
-
}, [
|
|
4316
|
-
vue.unref(config).icon ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
4317
|
-
key: 0,
|
|
4318
|
-
icon: vue.unref(config).icon
|
|
4319
|
-
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4320
|
-
vue.unref(config).text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(vue.unref(config).text), 1)) : vue.createCommentVNode("", true)
|
|
4321
|
-
]))
|
|
4322
|
-
]),
|
|
4323
|
-
default: vue.withCtx(() => [
|
|
4324
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).component), vue.mergeProps(vue.unref(config).props || {}, vue.toHandlers(vue.unref(config)?.listeners || {})), vue.createSlots({ _: 2 }, [
|
|
4325
|
-
__props.data === "component-list" || vue.unref(config).slots?.componentListPanelHeader ? {
|
|
4326
|
-
name: "component-list-panel-header",
|
|
4327
|
-
fn: vue.withCtx(() => [
|
|
4328
|
-
__props.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : vue.unref(config).slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4329
|
-
])
|
|
4330
|
-
} : void 0,
|
|
4331
|
-
__props.data === "component-list" || vue.unref(config).slots?.componentListItem ? {
|
|
4332
|
-
name: "component-list-item",
|
|
4333
|
-
fn: vue.withCtx(({ component }) => [
|
|
4334
|
-
__props.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
|
|
4335
|
-
key: 0,
|
|
4336
|
-
component
|
|
4337
|
-
}) : vue.unref(config).slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.componentListItem), {
|
|
4338
|
-
key: 1,
|
|
4339
|
-
component
|
|
4340
|
-
}, null, 8, ["component"])) : vue.createCommentVNode("", true)
|
|
4341
|
-
])
|
|
4342
|
-
} : void 0,
|
|
4343
|
-
__props.data === "layer" || vue.unref(config).slots?.layerPanelHeader ? {
|
|
4344
|
-
name: "layer-panel-header",
|
|
4345
|
-
fn: vue.withCtx(() => [
|
|
4346
|
-
__props.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : vue.unref(config).slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4347
|
-
])
|
|
4348
|
-
} : void 0,
|
|
4349
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockPanelHeader ? {
|
|
4350
|
-
name: "code-block-panel-header",
|
|
4351
|
-
fn: vue.withCtx(() => [
|
|
4352
|
-
__props.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : vue.unref(config).slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4353
|
-
])
|
|
4354
|
-
} : void 0,
|
|
4355
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockPanelTool ? {
|
|
4356
|
-
name: "code-block-panel-tool",
|
|
4357
|
-
fn: vue.withCtx(({ id, data }) => [
|
|
4358
|
-
data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4359
|
-
key: 0,
|
|
4360
|
-
id,
|
|
4361
|
-
data
|
|
4362
|
-
}) : vue.unref(config).slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4363
|
-
])
|
|
4364
|
-
} : void 0,
|
|
4365
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockEditPanelHeader ? {
|
|
4366
|
-
name: "code-block-edit-panel-header",
|
|
4367
|
-
fn: vue.withCtx(({ id }) => [
|
|
4368
|
-
__props.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4369
|
-
key: 0,
|
|
4370
|
-
id
|
|
4371
|
-
}) : vue.unref(config).slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4372
|
-
])
|
|
4373
|
-
} : void 0,
|
|
4374
|
-
__props.data === "layer" || vue.unref(config).slots?.layerNodeContent ? {
|
|
4375
|
-
name: "layer-node-content",
|
|
4376
|
-
fn: vue.withCtx(({ data: nodeData, node }) => [
|
|
4377
|
-
__props.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4378
|
-
key: 0,
|
|
4379
|
-
data: nodeData,
|
|
4380
|
-
node
|
|
4381
|
-
}) : vue.unref(config).slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.layerNodeContent), {
|
|
4382
|
-
key: 1,
|
|
4383
|
-
data: nodeData,
|
|
4384
|
-
node
|
|
4385
|
-
}, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
|
|
4386
|
-
])
|
|
4387
|
-
} : void 0
|
|
4388
|
-
]), 1040))
|
|
4389
|
-
]),
|
|
4390
|
-
_: 3
|
|
4391
|
-
}, 8, ["name"])) : vue.createCommentVNode("", true);
|
|
4392
|
-
};
|
|
4393
|
-
}
|
|
4617
|
+
const __default__$8 = vue.defineComponent({
|
|
4618
|
+
name: "MEditorSidebar"
|
|
4394
4619
|
});
|
|
4395
|
-
|
|
4396
4620
|
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
4397
|
-
|
|
4621
|
+
...__default__$8,
|
|
4398
4622
|
props: {
|
|
4399
|
-
data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) }
|
|
4623
|
+
data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) },
|
|
4624
|
+
layerContentMenu: null
|
|
4400
4625
|
},
|
|
4401
4626
|
setup(__props, { expose }) {
|
|
4402
4627
|
const props = __props;
|
|
4628
|
+
const uiComponent = design.getConfig("components").tabPane;
|
|
4403
4629
|
const activeTabName = vue.ref(props.data?.status);
|
|
4630
|
+
const getItemConfig = (data) => {
|
|
4631
|
+
const map = {
|
|
4632
|
+
"component-list": {
|
|
4633
|
+
$key: "component-list",
|
|
4634
|
+
type: "component",
|
|
4635
|
+
icon: iconsVue.Coin,
|
|
4636
|
+
text: "\u7EC4\u4EF6",
|
|
4637
|
+
component: _sfc_main$d,
|
|
4638
|
+
slots: {}
|
|
4639
|
+
},
|
|
4640
|
+
layer: {
|
|
4641
|
+
$key: "layer",
|
|
4642
|
+
type: "component",
|
|
4643
|
+
icon: iconsVue.Files,
|
|
4644
|
+
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4645
|
+
props: {
|
|
4646
|
+
layerContentMenu: props.layerContentMenu
|
|
4647
|
+
},
|
|
4648
|
+
component: _sfc_main$a,
|
|
4649
|
+
slots: {}
|
|
4650
|
+
},
|
|
4651
|
+
"code-block": {
|
|
4652
|
+
$key: "code-block",
|
|
4653
|
+
type: "component",
|
|
4654
|
+
icon: iconsVue.EditPen,
|
|
4655
|
+
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4656
|
+
component: _sfc_main$e,
|
|
4657
|
+
slots: {}
|
|
4658
|
+
}
|
|
4659
|
+
};
|
|
4660
|
+
return typeof data === "string" ? map[data] : data;
|
|
4661
|
+
};
|
|
4662
|
+
const sideBarItems = vue.computed(() => props.data.items.map((item) => getItemConfig(item)));
|
|
4404
4663
|
vue.watch(
|
|
4405
4664
|
() => props.data.status,
|
|
4406
4665
|
(status) => {
|
|
@@ -4420,60 +4679,91 @@
|
|
|
4420
4679
|
"tab-position": "left"
|
|
4421
4680
|
}, {
|
|
4422
4681
|
default: vue.withCtx(() => [
|
|
4423
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
4424
|
-
return vue.openBlock(), vue.createBlock(
|
|
4682
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(sideBarItems), (config, index) => {
|
|
4683
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(uiComponent).component), {
|
|
4425
4684
|
key: index,
|
|
4426
|
-
|
|
4427
|
-
},
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4685
|
+
name: config.text
|
|
4686
|
+
}, {
|
|
4687
|
+
label: vue.withCtx(() => [
|
|
4688
|
+
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4689
|
+
key: config.text
|
|
4690
|
+
}, [
|
|
4691
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
4692
|
+
key: 0,
|
|
4693
|
+
icon: config.icon
|
|
4694
|
+
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4695
|
+
config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
|
|
4696
|
+
]))
|
|
4697
|
+
]),
|
|
4698
|
+
default: vue.withCtx(() => [
|
|
4699
|
+
config ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({ key: 0 }, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
|
|
4700
|
+
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
4701
|
+
name: "component-list-panel-header",
|
|
4702
|
+
fn: vue.withCtx(() => [
|
|
4703
|
+
config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4704
|
+
])
|
|
4705
|
+
} : void 0,
|
|
4706
|
+
config.$key === "component-list" || config.slots?.componentListItem ? {
|
|
4707
|
+
name: "component-list-item",
|
|
4708
|
+
fn: vue.withCtx(({ component }) => [
|
|
4709
|
+
config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
|
|
4710
|
+
key: 0,
|
|
4711
|
+
component
|
|
4712
|
+
}) : config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListItem), {
|
|
4713
|
+
key: 1,
|
|
4714
|
+
component
|
|
4715
|
+
}, null, 8, ["component"])) : vue.createCommentVNode("", true)
|
|
4716
|
+
])
|
|
4717
|
+
} : void 0,
|
|
4718
|
+
config.$key === "layer" || config.slots?.layerPanelHeader ? {
|
|
4719
|
+
name: "layer-panel-header",
|
|
4720
|
+
fn: vue.withCtx(() => [
|
|
4721
|
+
config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4722
|
+
])
|
|
4723
|
+
} : void 0,
|
|
4724
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
|
|
4725
|
+
name: "code-block-panel-header",
|
|
4726
|
+
fn: vue.withCtx(() => [
|
|
4727
|
+
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4728
|
+
])
|
|
4729
|
+
} : void 0,
|
|
4730
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
4731
|
+
name: "code-block-panel-tool",
|
|
4732
|
+
fn: vue.withCtx(({ id, data }) => [
|
|
4733
|
+
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4734
|
+
key: 0,
|
|
4735
|
+
id,
|
|
4736
|
+
data
|
|
4737
|
+
}) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4738
|
+
])
|
|
4739
|
+
} : void 0,
|
|
4740
|
+
config.$key === "code-block" || config.slots?.codeBlockEditPanelHeader ? {
|
|
4741
|
+
name: "code-block-edit-panel-header",
|
|
4742
|
+
fn: vue.withCtx(({ id }) => [
|
|
4743
|
+
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4744
|
+
key: 0,
|
|
4745
|
+
id
|
|
4746
|
+
}) : config.slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4747
|
+
])
|
|
4748
|
+
} : void 0,
|
|
4749
|
+
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
4750
|
+
name: "layer-node-content",
|
|
4751
|
+
fn: vue.withCtx(({ data: nodeData, node }) => [
|
|
4752
|
+
config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4753
|
+
key: 0,
|
|
4754
|
+
data: nodeData,
|
|
4755
|
+
node
|
|
4756
|
+
}) : config.slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
4757
|
+
key: 1,
|
|
4758
|
+
data: nodeData,
|
|
4759
|
+
node
|
|
4760
|
+
}, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
|
|
4761
|
+
])
|
|
4762
|
+
} : void 0
|
|
4763
|
+
]), 1040)) : vue.createCommentVNode("", true)
|
|
4764
|
+
]),
|
|
4765
|
+
_: 2
|
|
4766
|
+
}, 1032, ["name"]);
|
|
4477
4767
|
}), 128))
|
|
4478
4768
|
]),
|
|
4479
4769
|
_: 3
|
|
@@ -4487,8 +4777,11 @@
|
|
|
4487
4777
|
class: "m-editor-breadcrumb"
|
|
4488
4778
|
};
|
|
4489
4779
|
const _hoisted_2$1 = { key: 0 };
|
|
4780
|
+
const __default__$7 = vue.defineComponent({
|
|
4781
|
+
name: "MEditorBreadcrumb"
|
|
4782
|
+
});
|
|
4490
4783
|
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
4491
|
-
|
|
4784
|
+
...__default__$7,
|
|
4492
4785
|
setup(__props) {
|
|
4493
4786
|
const services = vue.inject("services");
|
|
4494
4787
|
const editorService = services?.editorService;
|
|
@@ -4528,8 +4821,11 @@
|
|
|
4528
4821
|
key: 1,
|
|
4529
4822
|
style: { "width": "21px" }
|
|
4530
4823
|
};
|
|
4824
|
+
const __default__$6 = vue.defineComponent({
|
|
4825
|
+
name: "MEditorPageBarScrollContainer"
|
|
4826
|
+
});
|
|
4531
4827
|
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
4532
|
-
|
|
4828
|
+
...__default__$6,
|
|
4533
4829
|
setup(__props) {
|
|
4534
4830
|
const services = vue.inject("services");
|
|
4535
4831
|
const editorService = services?.editorService;
|
|
@@ -4592,9 +4888,12 @@
|
|
|
4592
4888
|
const addPage = () => {
|
|
4593
4889
|
if (!editorService)
|
|
4594
4890
|
return;
|
|
4891
|
+
const root = vue.toRaw(editorService.get("root"));
|
|
4892
|
+
if (!root)
|
|
4893
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u7A7A");
|
|
4595
4894
|
const pageConfig = {
|
|
4596
4895
|
type: schema.NodeType.PAGE,
|
|
4597
|
-
name: generatePageNameByApp(
|
|
4896
|
+
name: generatePageNameByApp(root)
|
|
4598
4897
|
};
|
|
4599
4898
|
editorService.add(pageConfig);
|
|
4600
4899
|
};
|
|
@@ -4610,14 +4909,14 @@
|
|
|
4610
4909
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4611
4910
|
onClick: addPage
|
|
4612
4911
|
}, [
|
|
4613
|
-
vue.createVNode(_sfc_main$
|
|
4912
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4614
4913
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
4615
4914
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4616
4915
|
key: 2,
|
|
4617
4916
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4618
4917
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4619
4918
|
}, [
|
|
4620
|
-
vue.createVNode(_sfc_main$
|
|
4919
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
4621
4920
|
])) : vue.createCommentVNode("", true),
|
|
4622
4921
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4623
4922
|
key: 3,
|
|
@@ -4633,7 +4932,7 @@
|
|
|
4633
4932
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4634
4933
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4635
4934
|
}, [
|
|
4636
|
-
vue.createVNode(_sfc_main$
|
|
4935
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
4637
4936
|
])) : vue.createCommentVNode("", true)
|
|
4638
4937
|
], 512);
|
|
4639
4938
|
};
|
|
@@ -4642,8 +4941,11 @@
|
|
|
4642
4941
|
|
|
4643
4942
|
const _hoisted_1 = ["onClick"];
|
|
4644
4943
|
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
4944
|
+
const __default__$5 = vue.defineComponent({
|
|
4945
|
+
name: "MEditorPageBar"
|
|
4946
|
+
});
|
|
4645
4947
|
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
4646
|
-
|
|
4948
|
+
...__default__$5,
|
|
4647
4949
|
setup(__props) {
|
|
4648
4950
|
const services = vue.inject("services");
|
|
4649
4951
|
const editorService = services?.editorService;
|
|
@@ -4702,7 +5004,7 @@
|
|
|
4702
5004
|
default: vue.withCtx(() => [
|
|
4703
5005
|
vue.createElementVNode("div", null, [
|
|
4704
5006
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4705
|
-
vue.createVNode(_sfc_main$
|
|
5007
|
+
vue.createVNode(_sfc_main$k, {
|
|
4706
5008
|
data: {
|
|
4707
5009
|
type: "button",
|
|
4708
5010
|
text: "\u590D\u5236",
|
|
@@ -4710,7 +5012,7 @@
|
|
|
4710
5012
|
handler: () => copy(item)
|
|
4711
5013
|
}
|
|
4712
5014
|
}, null, 8, ["data"]),
|
|
4713
|
-
vue.createVNode(_sfc_main$
|
|
5015
|
+
vue.createVNode(_sfc_main$k, {
|
|
4714
5016
|
data: {
|
|
4715
5017
|
type: "button",
|
|
4716
5018
|
text: "\u5220\u9664",
|
|
@@ -4744,6 +5046,10 @@
|
|
|
4744
5046
|
height = 0;
|
|
4745
5047
|
translateXCorrectionValue = 0;
|
|
4746
5048
|
translateYCorrectionValue = 0;
|
|
5049
|
+
correctionScrollSize = {
|
|
5050
|
+
width: 0,
|
|
5051
|
+
height: 0
|
|
5052
|
+
};
|
|
4747
5053
|
resizeObserver = new ResizeObserver(() => {
|
|
4748
5054
|
this.setSize();
|
|
4749
5055
|
this.setScrollSize();
|
|
@@ -4753,6 +5059,12 @@
|
|
|
4753
5059
|
this.container = options.container;
|
|
4754
5060
|
this.target = options.target;
|
|
4755
5061
|
this.zoom = options.zoom;
|
|
5062
|
+
if (this.correctionScrollSize) {
|
|
5063
|
+
this.correctionScrollSize = {
|
|
5064
|
+
...this.correctionScrollSize,
|
|
5065
|
+
...options.correctionScrollSize
|
|
5066
|
+
};
|
|
5067
|
+
}
|
|
4756
5068
|
this.container.addEventListener("wheel", this.wheelHandler, false);
|
|
4757
5069
|
this.setSize();
|
|
4758
5070
|
this.setScrollSize();
|
|
@@ -4815,9 +5127,9 @@
|
|
|
4815
5127
|
}
|
|
4816
5128
|
setScrollSize = () => {
|
|
4817
5129
|
const targetRect = this.target.getBoundingClientRect();
|
|
4818
|
-
this.scrollWidth = targetRect.width * this.zoom +
|
|
5130
|
+
this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
|
|
4819
5131
|
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
4820
|
-
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom +
|
|
5132
|
+
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
|
|
4821
5133
|
let left;
|
|
4822
5134
|
let top;
|
|
4823
5135
|
if (this.scrollWidth < this.width) {
|
|
@@ -4850,8 +5162,11 @@
|
|
|
4850
5162
|
};
|
|
4851
5163
|
}
|
|
4852
5164
|
|
|
5165
|
+
const __default__$4 = vue.defineComponent({
|
|
5166
|
+
name: "MEditorScrollBar"
|
|
5167
|
+
});
|
|
4853
5168
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
4854
|
-
|
|
5169
|
+
...__default__$4,
|
|
4855
5170
|
props: {
|
|
4856
5171
|
size: null,
|
|
4857
5172
|
scrollSize: null,
|
|
@@ -4936,14 +5251,21 @@
|
|
|
4936
5251
|
|
|
4937
5252
|
const ScrollBar_vue_vue_type_style_index_0_lang = '';
|
|
4938
5253
|
|
|
5254
|
+
const __default__$3 = vue.defineComponent({
|
|
5255
|
+
name: "MEditorScrollViewer"
|
|
5256
|
+
});
|
|
4939
5257
|
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
4940
|
-
|
|
5258
|
+
...__default__$3,
|
|
4941
5259
|
props: {
|
|
4942
5260
|
width: { default: 0 },
|
|
4943
5261
|
height: { default: 0 },
|
|
4944
5262
|
wrapWidth: { default: 0 },
|
|
4945
5263
|
wrapHeight: { default: 0 },
|
|
4946
|
-
zoom: { default: 1 }
|
|
5264
|
+
zoom: { default: 1 },
|
|
5265
|
+
correctionScrollSize: { default: () => ({
|
|
5266
|
+
width: 0,
|
|
5267
|
+
height: 0
|
|
5268
|
+
}) }
|
|
4947
5269
|
},
|
|
4948
5270
|
setup(__props, { expose }) {
|
|
4949
5271
|
const props = __props;
|
|
@@ -4966,7 +5288,8 @@
|
|
|
4966
5288
|
scrollViewer = new ScrollViewer({
|
|
4967
5289
|
container: container.value,
|
|
4968
5290
|
target: el.value,
|
|
4969
|
-
zoom: props.zoom
|
|
5291
|
+
zoom: props.zoom,
|
|
5292
|
+
correctionScrollSize: props.correctionScrollSize
|
|
4970
5293
|
});
|
|
4971
5294
|
scrollViewer.on("scroll", (data) => {
|
|
4972
5295
|
hOffset.value = data.scrollLeft;
|
|
@@ -5034,10 +5357,14 @@
|
|
|
5034
5357
|
}
|
|
5035
5358
|
});
|
|
5036
5359
|
|
|
5360
|
+
const __default__$2 = vue.defineComponent({
|
|
5361
|
+
name: "MEditorViewerMenu"
|
|
5362
|
+
});
|
|
5037
5363
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
5038
|
-
|
|
5364
|
+
...__default__$2,
|
|
5039
5365
|
props: {
|
|
5040
|
-
isMultiSelect: { type: Boolean, default: false }
|
|
5366
|
+
isMultiSelect: { type: Boolean, default: false },
|
|
5367
|
+
stageContentMenu: null
|
|
5041
5368
|
},
|
|
5042
5369
|
setup(__props, { expose }) {
|
|
5043
5370
|
const props = __props;
|
|
@@ -5050,8 +5377,7 @@
|
|
|
5050
5377
|
const nodes = vue.computed(() => editorService?.get("nodes"));
|
|
5051
5378
|
const parent = vue.computed(() => editorService?.get("parent"));
|
|
5052
5379
|
const stage = vue.computed(() => editorService?.get("stage"));
|
|
5053
|
-
const
|
|
5054
|
-
const menuData = vue.reactive([
|
|
5380
|
+
const menuData = vue.computed(() => [
|
|
5055
5381
|
{
|
|
5056
5382
|
type: "button",
|
|
5057
5383
|
text: "\u6C34\u5E73\u5C45\u4E2D",
|
|
@@ -5065,7 +5391,7 @@
|
|
|
5065
5391
|
{
|
|
5066
5392
|
type: "button",
|
|
5067
5393
|
text: "\u590D\u5236",
|
|
5068
|
-
icon: vue.markRaw(iconsVue.
|
|
5394
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
5069
5395
|
handler: () => {
|
|
5070
5396
|
nodes.value && editorService?.copy(nodes.value);
|
|
5071
5397
|
canPaste.value = true;
|
|
@@ -5074,6 +5400,7 @@
|
|
|
5074
5400
|
{
|
|
5075
5401
|
type: "button",
|
|
5076
5402
|
text: "\u7C98\u8D34",
|
|
5403
|
+
icon: vue.markRaw(iconsVue.DocumentCopy),
|
|
5077
5404
|
display: () => canPaste.value,
|
|
5078
5405
|
handler: () => {
|
|
5079
5406
|
const rect = menu.value?.$el.getBoundingClientRect();
|
|
@@ -5150,10 +5477,10 @@
|
|
|
5150
5477
|
type: "button",
|
|
5151
5478
|
text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
|
|
5152
5479
|
handler: () => {
|
|
5153
|
-
editorService?.get("stage")
|
|
5480
|
+
editorService?.get("stage")?.clearGuides();
|
|
5154
5481
|
}
|
|
5155
5482
|
},
|
|
5156
|
-
...stageContentMenu
|
|
5483
|
+
...props.stageContentMenu
|
|
5157
5484
|
]);
|
|
5158
5485
|
vue.watch(
|
|
5159
5486
|
parent,
|
|
@@ -5176,8 +5503,8 @@
|
|
|
5176
5503
|
};
|
|
5177
5504
|
expose({ show });
|
|
5178
5505
|
return (_ctx, _cache) => {
|
|
5179
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5180
|
-
"menu-data": menuData,
|
|
5506
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$c, {
|
|
5507
|
+
"menu-data": vue.unref(menuData),
|
|
5181
5508
|
ref_key: "menu",
|
|
5182
5509
|
ref: menu
|
|
5183
5510
|
}, null, 8, ["menu-data"]);
|
|
@@ -5185,8 +5512,14 @@
|
|
|
5185
5512
|
}
|
|
5186
5513
|
});
|
|
5187
5514
|
|
|
5515
|
+
const __default__$1 = vue.defineComponent({
|
|
5516
|
+
name: "MEditorStage"
|
|
5517
|
+
});
|
|
5188
5518
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
5189
|
-
|
|
5519
|
+
...__default__$1,
|
|
5520
|
+
props: {
|
|
5521
|
+
stageContentMenu: null
|
|
5522
|
+
},
|
|
5190
5523
|
setup(__props) {
|
|
5191
5524
|
let stage = null;
|
|
5192
5525
|
let runtime = null;
|
|
@@ -5195,7 +5528,8 @@
|
|
|
5195
5528
|
const stageWrap = vue.ref();
|
|
5196
5529
|
const stageContainer = vue.ref();
|
|
5197
5530
|
const menu = vue.ref();
|
|
5198
|
-
const
|
|
5531
|
+
const nodes = vue.computed(() => services?.editorService.get("nodes") || []);
|
|
5532
|
+
const isMultiSelect = vue.computed(() => nodes.value.length > 1);
|
|
5199
5533
|
const stageRect = vue.computed(() => services?.uiService.get("stageRect"));
|
|
5200
5534
|
const stageContainerRect = vue.computed(() => services?.uiService.get("stageContainerRect"));
|
|
5201
5535
|
const root = vue.computed(() => services?.editorService.get("root"));
|
|
@@ -5203,7 +5537,7 @@
|
|
|
5203
5537
|
const zoom = vue.computed(() => services?.uiService.get("zoom") || 1);
|
|
5204
5538
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
5205
5539
|
vue.watchEffect(() => {
|
|
5206
|
-
if (stage)
|
|
5540
|
+
if (stage || !page.value)
|
|
5207
5541
|
return;
|
|
5208
5542
|
if (!stageContainer.value)
|
|
5209
5543
|
return;
|
|
@@ -5233,6 +5567,14 @@
|
|
|
5233
5567
|
runtime.updateRootConfig?.(lodashEs.cloneDeep(vue.toRaw(root2)));
|
|
5234
5568
|
}
|
|
5235
5569
|
});
|
|
5570
|
+
vue.watch(page, (page2) => {
|
|
5571
|
+
if (runtime && page2) {
|
|
5572
|
+
runtime.updatePageId?.(page2.id);
|
|
5573
|
+
vue.nextTick(() => {
|
|
5574
|
+
stage?.select(page2.id);
|
|
5575
|
+
});
|
|
5576
|
+
}
|
|
5577
|
+
});
|
|
5236
5578
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
5237
5579
|
for (const { contentRect } of entries) {
|
|
5238
5580
|
services?.uiService.set("stageContainerRect", {
|
|
@@ -5305,7 +5647,11 @@
|
|
|
5305
5647
|
height: vue.unref(stageRect)?.height,
|
|
5306
5648
|
"wrap-width": vue.unref(stageContainerRect)?.width,
|
|
5307
5649
|
"wrap-height": vue.unref(stageContainerRect)?.height,
|
|
5308
|
-
zoom: vue.unref(zoom)
|
|
5650
|
+
zoom: vue.unref(zoom),
|
|
5651
|
+
"correction-scroll-size": {
|
|
5652
|
+
width: 60,
|
|
5653
|
+
height: 50
|
|
5654
|
+
}
|
|
5309
5655
|
}, {
|
|
5310
5656
|
default: vue.withCtx(() => [
|
|
5311
5657
|
vue.createElementVNode("div", {
|
|
@@ -5321,8 +5667,9 @@
|
|
|
5321
5667
|
vue.createVNode(_sfc_main$3, {
|
|
5322
5668
|
ref_key: "menu",
|
|
5323
5669
|
ref: menu,
|
|
5324
|
-
"is-multi-select": vue.unref(isMultiSelect)
|
|
5325
|
-
|
|
5670
|
+
"is-multi-select": vue.unref(isMultiSelect),
|
|
5671
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5672
|
+
}, null, 8, ["is-multi-select", "stage-content-menu"])
|
|
5326
5673
|
]))
|
|
5327
5674
|
]),
|
|
5328
5675
|
_: 1
|
|
@@ -5331,8 +5678,14 @@
|
|
|
5331
5678
|
}
|
|
5332
5679
|
});
|
|
5333
5680
|
|
|
5681
|
+
const __default__ = vue.defineComponent({
|
|
5682
|
+
name: "MEditorWorkspace"
|
|
5683
|
+
});
|
|
5334
5684
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
5335
|
-
|
|
5685
|
+
...__default__,
|
|
5686
|
+
props: {
|
|
5687
|
+
stageContentMenu: null
|
|
5688
|
+
},
|
|
5336
5689
|
setup(__props) {
|
|
5337
5690
|
const services = vue.inject("services");
|
|
5338
5691
|
const workspace = vue.ref();
|
|
@@ -5443,9 +5796,10 @@
|
|
|
5443
5796
|
}, [
|
|
5444
5797
|
vue.createVNode(_sfc_main$8),
|
|
5445
5798
|
vue.renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
5446
|
-
(vue.openBlock(), vue.createBlock(_sfc_main$2, {
|
|
5447
|
-
key:
|
|
5448
|
-
|
|
5799
|
+
vue.unref(page) ? (vue.openBlock(), vue.createBlock(_sfc_main$2, {
|
|
5800
|
+
key: 0,
|
|
5801
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5802
|
+
}, null, 8, ["stage-content-menu"])) : vue.createCommentVNode("", true)
|
|
5449
5803
|
]),
|
|
5450
5804
|
vue.renderSlot(_ctx.$slots, "workspace-content"),
|
|
5451
5805
|
vue.createVNode(_sfc_main$6, null, {
|
|
@@ -5475,9 +5829,13 @@
|
|
|
5475
5829
|
getList() {
|
|
5476
5830
|
return this.state.list;
|
|
5477
5831
|
}
|
|
5478
|
-
|
|
5832
|
+
resetState() {
|
|
5479
5833
|
this.state.list = [];
|
|
5834
|
+
}
|
|
5835
|
+
destroy() {
|
|
5836
|
+
this.resetState();
|
|
5480
5837
|
this.removeAllListeners();
|
|
5838
|
+
this.removeAllPlugins();
|
|
5481
5839
|
}
|
|
5482
5840
|
}
|
|
5483
5841
|
const componentListService = new ComponentList();
|
|
@@ -5485,11 +5843,11 @@
|
|
|
5485
5843
|
const _sfc_main = vue.defineComponent({
|
|
5486
5844
|
name: "m-editor",
|
|
5487
5845
|
components: {
|
|
5488
|
-
|
|
5846
|
+
TMagicNavMenu: _sfc_main$j,
|
|
5489
5847
|
Sidebar: _sfc_main$9,
|
|
5490
5848
|
Workspace: _sfc_main$1,
|
|
5491
|
-
PropsPanel: _sfc_main$
|
|
5492
|
-
Framework: _sfc_main$
|
|
5849
|
+
PropsPanel: _sfc_main$i,
|
|
5850
|
+
Framework: _sfc_main$l
|
|
5493
5851
|
},
|
|
5494
5852
|
props: {
|
|
5495
5853
|
modelValue: {
|
|
@@ -5504,6 +5862,10 @@
|
|
|
5504
5862
|
sidebar: {
|
|
5505
5863
|
type: Object
|
|
5506
5864
|
},
|
|
5865
|
+
menu: {
|
|
5866
|
+
type: Object,
|
|
5867
|
+
default: () => ({ left: [], right: [] })
|
|
5868
|
+
},
|
|
5507
5869
|
layerContentMenu: {
|
|
5508
5870
|
type: Array,
|
|
5509
5871
|
default: () => []
|
|
@@ -5512,10 +5874,6 @@
|
|
|
5512
5874
|
type: Array,
|
|
5513
5875
|
default: () => []
|
|
5514
5876
|
},
|
|
5515
|
-
menu: {
|
|
5516
|
-
type: Object,
|
|
5517
|
-
default: () => ({ left: [], right: [] })
|
|
5518
|
-
},
|
|
5519
5877
|
render: {
|
|
5520
5878
|
type: Function
|
|
5521
5879
|
},
|
|
@@ -5549,7 +5907,7 @@
|
|
|
5549
5907
|
},
|
|
5550
5908
|
containerHighlightClassName: {
|
|
5551
5909
|
type: String,
|
|
5552
|
-
default: StageCore.
|
|
5910
|
+
default: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME
|
|
5553
5911
|
},
|
|
5554
5912
|
containerHighlightDuration: {
|
|
5555
5913
|
type: Number,
|
|
@@ -5568,20 +5926,33 @@
|
|
|
5568
5926
|
},
|
|
5569
5927
|
updateDragEl: {
|
|
5570
5928
|
type: Function
|
|
5929
|
+
},
|
|
5930
|
+
disabledDragStart: {
|
|
5931
|
+
type: Boolean
|
|
5571
5932
|
}
|
|
5572
5933
|
},
|
|
5573
5934
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
5574
5935
|
setup(props, { emit }) {
|
|
5575
|
-
|
|
5576
|
-
const
|
|
5577
|
-
|
|
5578
|
-
if (nodeId
|
|
5579
|
-
editorService.
|
|
5580
|
-
}
|
|
5936
|
+
const rootChangeHandler = (value, preValue) => {
|
|
5937
|
+
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
5938
|
+
let node;
|
|
5939
|
+
if (nodeId) {
|
|
5940
|
+
node = editorService.getNodeById(nodeId);
|
|
5941
|
+
}
|
|
5942
|
+
if (node && node !== value) {
|
|
5943
|
+
editorService.select(node.id);
|
|
5944
|
+
} else if (value?.items?.length) {
|
|
5945
|
+
editorService.select(value.items[0]);
|
|
5946
|
+
} else if (value?.id) {
|
|
5581
5947
|
editorService.set("nodes", [value]);
|
|
5948
|
+
editorService.set("parent", null);
|
|
5949
|
+
editorService.set("page", null);
|
|
5582
5950
|
}
|
|
5583
|
-
|
|
5584
|
-
|
|
5951
|
+
if (vue.toRaw(value) !== vue.toRaw(preValue)) {
|
|
5952
|
+
emit("update:modelValue", value);
|
|
5953
|
+
}
|
|
5954
|
+
};
|
|
5955
|
+
editorService.on("root-change", rootChangeHandler);
|
|
5585
5956
|
vue.watch(
|
|
5586
5957
|
() => props.modelValue,
|
|
5587
5958
|
(modelValue) => {
|
|
@@ -5643,13 +6014,13 @@
|
|
|
5643
6014
|
}
|
|
5644
6015
|
);
|
|
5645
6016
|
vue.onUnmounted(() => {
|
|
5646
|
-
editorService.
|
|
5647
|
-
historyService.
|
|
5648
|
-
propsService.
|
|
5649
|
-
uiService.
|
|
5650
|
-
componentListService.
|
|
5651
|
-
|
|
5652
|
-
|
|
6017
|
+
editorService.resetState();
|
|
6018
|
+
historyService.resetState();
|
|
6019
|
+
propsService.resetState();
|
|
6020
|
+
uiService.resetState();
|
|
6021
|
+
componentListService.resetState();
|
|
6022
|
+
codeBlockService.resetState();
|
|
6023
|
+
editorService.off("root-change", rootChangeHandler);
|
|
5653
6024
|
});
|
|
5654
6025
|
const services = {
|
|
5655
6026
|
componentListService,
|
|
@@ -5662,8 +6033,7 @@
|
|
|
5662
6033
|
codeBlockService
|
|
5663
6034
|
};
|
|
5664
6035
|
vue.provide("services", services);
|
|
5665
|
-
vue.provide("
|
|
5666
|
-
vue.provide("stageContentMenu", props.stageContentMenu);
|
|
6036
|
+
vue.provide("codeOptions", props.codeOptions);
|
|
5667
6037
|
vue.provide(
|
|
5668
6038
|
"stageOptions",
|
|
5669
6039
|
vue.reactive({
|
|
@@ -5676,7 +6046,8 @@
|
|
|
5676
6046
|
isContainer: props.isContainer,
|
|
5677
6047
|
containerHighlightClassName: props.containerHighlightClassName,
|
|
5678
6048
|
containerHighlightDuration: props.containerHighlightDuration,
|
|
5679
|
-
containerHighlightType: props.containerHighlightType
|
|
6049
|
+
containerHighlightType: props.containerHighlightType,
|
|
6050
|
+
disabledDragStart: props.disabledDragStart
|
|
5680
6051
|
})
|
|
5681
6052
|
);
|
|
5682
6053
|
return services;
|
|
@@ -5692,20 +6063,23 @@
|
|
|
5692
6063
|
};
|
|
5693
6064
|
|
|
5694
6065
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5695
|
-
const
|
|
5696
|
-
const
|
|
5697
|
-
const
|
|
5698
|
-
const
|
|
5699
|
-
const
|
|
5700
|
-
return vue.openBlock(), vue.createBlock(
|
|
6066
|
+
const _component_TMagicNavMenu = vue.resolveComponent("TMagicNavMenu");
|
|
6067
|
+
const _component_Sidebar = vue.resolveComponent("Sidebar");
|
|
6068
|
+
const _component_Workspace = vue.resolveComponent("Workspace");
|
|
6069
|
+
const _component_PropsPanel = vue.resolveComponent("PropsPanel");
|
|
6070
|
+
const _component_Framework = vue.resolveComponent("Framework");
|
|
6071
|
+
return vue.openBlock(), vue.createBlock(_component_Framework, { "code-options": _ctx.codeOptions }, {
|
|
5701
6072
|
nav: vue.withCtx(() => [
|
|
5702
6073
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
5703
|
-
vue.createVNode(
|
|
6074
|
+
vue.createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
5704
6075
|
])
|
|
5705
6076
|
]),
|
|
5706
6077
|
sidebar: vue.withCtx(() => [
|
|
5707
6078
|
vue.renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
5708
|
-
vue.createVNode(
|
|
6079
|
+
vue.createVNode(_component_Sidebar, {
|
|
6080
|
+
data: _ctx.sidebar,
|
|
6081
|
+
"layer-content-menu": _ctx.layerContentMenu
|
|
6082
|
+
}, {
|
|
5709
6083
|
"layer-panel-header": vue.withCtx(() => [
|
|
5710
6084
|
vue.renderSlot(_ctx.$slots, "layer-panel-header")
|
|
5711
6085
|
]),
|
|
@@ -5734,12 +6108,12 @@
|
|
|
5734
6108
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
5735
6109
|
]),
|
|
5736
6110
|
_: 3
|
|
5737
|
-
}, 8, ["data"])
|
|
6111
|
+
}, 8, ["data", "layer-content-menu"])
|
|
5738
6112
|
])
|
|
5739
6113
|
]),
|
|
5740
6114
|
workspace: vue.withCtx(() => [
|
|
5741
6115
|
vue.renderSlot(_ctx.$slots, "workspace", { editorService: _ctx.editorService }, () => [
|
|
5742
|
-
vue.createVNode(
|
|
6116
|
+
vue.createVNode(_component_Workspace, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
5743
6117
|
stage: vue.withCtx(() => [
|
|
5744
6118
|
vue.renderSlot(_ctx.$slots, "stage")
|
|
5745
6119
|
]),
|
|
@@ -5753,12 +6127,12 @@
|
|
|
5753
6127
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
5754
6128
|
]),
|
|
5755
6129
|
_: 3
|
|
5756
|
-
})
|
|
6130
|
+
}, 8, ["stage-content-menu"])
|
|
5757
6131
|
])
|
|
5758
6132
|
]),
|
|
5759
6133
|
"props-panel": vue.withCtx(() => [
|
|
5760
6134
|
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
5761
|
-
vue.createVNode(
|
|
6135
|
+
vue.createVNode(_component_PropsPanel, {
|
|
5762
6136
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
5763
6137
|
}, {
|
|
5764
6138
|
"props-panel-header": vue.withCtx(() => [
|
|
@@ -5786,34 +6160,35 @@
|
|
|
5786
6160
|
setConfig(option);
|
|
5787
6161
|
app.component(Editor.name, Editor);
|
|
5788
6162
|
app.component("m-fields-ui-select", _sfc_main$q);
|
|
5789
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
5790
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
6163
|
+
app.component("m-fields-code-link", _sfc_main$t);
|
|
6164
|
+
app.component("m-fields-vs-code", _sfc_main$u);
|
|
5791
6165
|
app.component("magic-code-editor", _sfc_main$p);
|
|
5792
6166
|
app.component("m-fields-code-select", _sfc_main$r);
|
|
5793
6167
|
}
|
|
5794
6168
|
};
|
|
5795
6169
|
|
|
6170
|
+
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
5796
6171
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
5797
|
-
exports.CodeBlockList = _sfc_main$
|
|
6172
|
+
exports.CodeBlockList = _sfc_main$e;
|
|
5798
6173
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
5799
|
-
exports.CodeEditorMode = CodeEditorMode;
|
|
5800
6174
|
exports.CodeSelect = _sfc_main$r;
|
|
5801
|
-
exports.CodeSelectOp = CodeSelectOp;
|
|
5802
6175
|
exports.ColumnLayout = ColumnLayout;
|
|
5803
|
-
exports.ComponentListPanel = _sfc_main$
|
|
5804
|
-
exports.ContentMenu = _sfc_main$
|
|
6176
|
+
exports.ComponentListPanel = _sfc_main$d;
|
|
6177
|
+
exports.ContentMenu = _sfc_main$c;
|
|
5805
6178
|
exports.Fixed2Other = Fixed2Other;
|
|
5806
6179
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
5807
|
-
exports.Icon = _sfc_main$
|
|
6180
|
+
exports.Icon = _sfc_main$s;
|
|
5808
6181
|
exports.Keys = Keys;
|
|
5809
6182
|
exports.LayerOffset = LayerOffset;
|
|
5810
|
-
exports.LayerPanel = _sfc_main$
|
|
6183
|
+
exports.LayerPanel = _sfc_main$a;
|
|
5811
6184
|
exports.Layout = Layout;
|
|
5812
|
-
exports.
|
|
6185
|
+
exports.LayoutContainer = _sfc_main$n;
|
|
6186
|
+
exports.PropsPanel = _sfc_main$i;
|
|
5813
6187
|
exports.TMagicCodeEditor = _sfc_main$p;
|
|
5814
6188
|
exports.TMagicEditor = Editor;
|
|
5815
|
-
exports.ToolButton = _sfc_main$
|
|
6189
|
+
exports.ToolButton = _sfc_main$k;
|
|
5816
6190
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
6191
|
+
exports.beforePaste = beforePaste;
|
|
5817
6192
|
exports.change2Fixed = change2Fixed;
|
|
5818
6193
|
exports.codeBlockService = codeBlockService;
|
|
5819
6194
|
exports.debug = debug;
|
|
@@ -5826,18 +6201,22 @@
|
|
|
5826
6201
|
exports.fixNodePosition = fixNodePosition;
|
|
5827
6202
|
exports.generatePageName = generatePageName;
|
|
5828
6203
|
exports.generatePageNameByApp = generatePageNameByApp;
|
|
6204
|
+
exports.getAddParent = getAddParent;
|
|
5829
6205
|
exports.getConfig = getConfig;
|
|
6206
|
+
exports.getDefaultConfig = getDefaultConfig;
|
|
5830
6207
|
exports.getGuideLineFromCache = getGuideLineFromCache;
|
|
5831
6208
|
exports.getInitPositionStyle = getInitPositionStyle;
|
|
5832
6209
|
exports.getNodeIndex = getNodeIndex;
|
|
5833
6210
|
exports.getPageList = getPageList;
|
|
5834
6211
|
exports.getPageNameList = getPageNameList;
|
|
6212
|
+
exports.getPositionInContainer = getPositionInContainer;
|
|
5835
6213
|
exports.getRelativeStyle = getRelativeStyle;
|
|
5836
6214
|
exports.historyService = historyService;
|
|
5837
6215
|
exports.info = info;
|
|
5838
6216
|
exports.isFixed = isFixed;
|
|
5839
6217
|
exports.log = log;
|
|
5840
6218
|
exports.propsService = propsService;
|
|
6219
|
+
exports.serializeConfig = serializeConfig;
|
|
5841
6220
|
exports.setConfig = setConfig;
|
|
5842
6221
|
exports.setLayout = setLayout;
|
|
5843
6222
|
exports.storageService = storageService;
|
|
@@ -5848,4 +6227,4 @@
|
|
|
5848
6227
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
5849
6228
|
|
|
5850
6229
|
}));
|
|
5851
|
-
//# sourceMappingURL=tmagic-editor.umd.
|
|
6230
|
+
//# sourceMappingURL=tmagic-editor.umd.cjs.map
|