@tmagic/editor 1.2.0-beta.8 → 1.2.0
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 +59 -35
- package/dist/{tmagic-editor.mjs → tmagic-editor.js} +1473 -1161
- package/dist/tmagic-editor.js.map +1 -0
- package/dist/{tmagic-editor.umd.js → tmagic-editor.umd.cjs} +1483 -1166
- 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 +145 -0
- package/src/components/ContentMenu.vue +2 -2
- package/src/components/FunctionEditor.vue +145 -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 +84 -110
- package/src/fields/UISelect.vue +1 -1
- package/src/index.ts +1 -0
- package/src/layouts/AddPageBox.vue +1 -1
- package/src/layouts/CodeEditor.vue +2 -3
- package/src/layouts/Framework.vue +2 -2
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/PropsPanel.vue +13 -6
- package/src/layouts/Resizer.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +1 -1
- package/src/layouts/sidebar/LayerMenu.vue +9 -7
- package/src/layouts/sidebar/LayerPanel.vue +127 -174
- package/src/layouts/sidebar/Sidebar.vue +110 -26
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +27 -83
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +90 -122
- package/src/layouts/workspace/Breadcrumb.vue +1 -1
- package/src/layouts/workspace/PageBar.vue +1 -1
- package/src/layouts/workspace/PageBarScrollContainer.vue +1 -1
- package/src/layouts/workspace/Stage.vue +26 -9
- package/src/layouts/workspace/ViewerMenu.vue +11 -9
- package/src/layouts/workspace/Workspace.vue +7 -3
- package/src/services/BaseService.ts +10 -1
- package/src/services/codeBlock.ts +124 -125
- package/src/services/componentList.ts +6 -1
- package/src/services/editor.ts +54 -18
- package/src/services/events.ts +6 -1
- package/src/services/history.ts +7 -16
- package/src/services/props.ts +7 -2
- package/src/services/storage.ts +1 -0
- package/src/services/ui.ts +12 -0
- package/src/theme/code-block.scss +43 -24
- package/src/theme/component-list-panel.scss +8 -5
- package/src/type.ts +77 -50
- package/src/utils/editor.ts +9 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/props.ts +2 -2
- package/src/utils/scroll-viewer.ts +18 -2
- package/src/utils/stage.ts +4 -3
- package/types/Editor.vue.d.ts +47 -27
- package/types/components/CodeDraftEditor.vue.d.ts +56 -0
- package/types/components/ContentMenu.vue.d.ts +11 -87
- package/types/components/FunctionEditor.vue.d.ts +43 -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 +1 -1
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +6 -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 +23 -5
- package/types/services/BaseService.d.ts +2 -1
- package/types/services/codeBlock.d.ts +57 -36
- package/types/services/componentList.d.ts +1 -0
- package/types/services/editor.d.ts +5 -6
- 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 +2 -1
- package/types/type.d.ts +65 -48
- package/types/utils/editor.d.ts +1 -0
- package/types/utils/index.d.ts +1 -0
- 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('lodash-es'), require('@tmagic/form'), require('@tmagic/schema'), require('@element-plus/icons-vue'), 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', 'lodash-es', '@tmagic/form', '@tmagic/schema', '@element-plus/icons-vue', '@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.lodashEs, global.form, global.schema, global.iconsVue, global.design, global.monaco, global.StageCore, global.Gesto, global.utils, global.events, global.core, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, serialize, lodashEs, form, schema, iconsVue, 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,12 @@
|
|
|
130
136
|
}
|
|
131
137
|
});
|
|
132
138
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
140
|
-
LayerOffset2["TOP"] = "top";
|
|
141
|
-
LayerOffset2["BOTTOM"] = "bottom";
|
|
142
|
-
return LayerOffset2;
|
|
143
|
-
})(LayerOffset || {});
|
|
144
|
-
var Layout = /* @__PURE__ */ ((Layout2) => {
|
|
145
|
-
Layout2["FLEX"] = "flex";
|
|
146
|
-
Layout2["FIXED"] = "fixed";
|
|
147
|
-
Layout2["RELATIVE"] = "relative";
|
|
148
|
-
Layout2["ABSOLUTE"] = "absolute";
|
|
149
|
-
return Layout2;
|
|
150
|
-
})(Layout || {});
|
|
151
|
-
var Keys = /* @__PURE__ */ ((Keys2) => {
|
|
152
|
-
Keys2["ESCAPE"] = "Space";
|
|
153
|
-
return Keys2;
|
|
154
|
-
})(Keys || {});
|
|
155
|
-
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
156
|
-
const V_GUIDE_LINE_STORAGE_KEY = "$MagicStageVerticalGuidelinesData";
|
|
157
|
-
var CodeEditorMode = /* @__PURE__ */ ((CodeEditorMode2) => {
|
|
158
|
-
CodeEditorMode2["LIST"] = "list";
|
|
159
|
-
CodeEditorMode2["EDITOR"] = "editor";
|
|
160
|
-
return CodeEditorMode2;
|
|
161
|
-
})(CodeEditorMode || {});
|
|
162
|
-
var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
163
|
-
CodeDeleteErrorType2["UNDELETEABLE"] = "undeleteable";
|
|
164
|
-
CodeDeleteErrorType2["BIND"] = "bind";
|
|
165
|
-
return CodeDeleteErrorType2;
|
|
166
|
-
})(CodeDeleteErrorType || {});
|
|
167
|
-
var CodeSelectOp = /* @__PURE__ */ ((CodeSelectOp2) => {
|
|
168
|
-
CodeSelectOp2["ADD"] = "add";
|
|
169
|
-
CodeSelectOp2["DELETE"] = "delete";
|
|
170
|
-
CodeSelectOp2["CHANGE"] = "change";
|
|
171
|
-
return CodeSelectOp2;
|
|
172
|
-
})(CodeSelectOp || {});
|
|
173
|
-
|
|
174
|
-
const _hoisted_1$e = { class: "tool-bar" };
|
|
175
|
-
const _hoisted_2$6 = /* @__PURE__ */ vue.createElementVNode("path", {
|
|
176
|
-
fill: "currentColor",
|
|
177
|
-
d: "m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414L23 12zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414L3.828 12z"
|
|
178
|
-
}, null, -1);
|
|
179
|
-
const _hoisted_3$3 = [
|
|
180
|
-
_hoisted_2$6
|
|
181
|
-
];
|
|
182
|
-
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
183
|
-
__name: "CodeSelect",
|
|
139
|
+
const _hoisted_1$g = { class: "m-fields-code-select" };
|
|
140
|
+
const __default__$r = vue.defineComponent({
|
|
141
|
+
name: "MEditorCodeSelect"
|
|
142
|
+
});
|
|
143
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
144
|
+
...__default__$r,
|
|
184
145
|
props: {
|
|
185
146
|
config: null,
|
|
186
147
|
model: null,
|
|
@@ -192,128 +153,107 @@
|
|
|
192
153
|
setup(__props, { emit }) {
|
|
193
154
|
const props = __props;
|
|
194
155
|
const services = vue.inject("services");
|
|
195
|
-
const
|
|
156
|
+
const mForm = vue.inject("mForm");
|
|
157
|
+
const codeDsl = vue.computed(() => services?.codeBlockService.getCodeDslSync());
|
|
158
|
+
const tableConfig = vue.computed(() => {
|
|
196
159
|
const defaultConfig = {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
160
|
+
dropSort: true,
|
|
161
|
+
enableFullscreen: false,
|
|
162
|
+
border: true,
|
|
163
|
+
items: [
|
|
164
|
+
{
|
|
165
|
+
type: "select",
|
|
166
|
+
label: "\u4EE3\u7801\u5757",
|
|
167
|
+
name: "codeId",
|
|
168
|
+
width: "200px",
|
|
169
|
+
options: () => {
|
|
170
|
+
if (codeDsl.value) {
|
|
171
|
+
return lodashEs.map(codeDsl.value, (value, key) => ({
|
|
172
|
+
text: `${value.name}\uFF08${key}\uFF09`,
|
|
173
|
+
label: `${value.name}\uFF08${key}\uFF09`,
|
|
174
|
+
value: key
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
return [];
|
|
178
|
+
},
|
|
179
|
+
onChange: (formState, codeId, { model }) => {
|
|
180
|
+
model.params = {};
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "params",
|
|
185
|
+
label: "\u53C2\u6570",
|
|
186
|
+
defaultValue: {},
|
|
187
|
+
itemsFunction: (row) => {
|
|
188
|
+
const paramsConfig = getParamsConfig(row.codeId);
|
|
189
|
+
if (!row.params)
|
|
190
|
+
row.params = {};
|
|
191
|
+
if (lodashEs.isEmpty(row.params)) {
|
|
192
|
+
form.createValues(mForm, paramsConfig, {}, row.params);
|
|
193
|
+
}
|
|
194
|
+
return paramsConfig;
|
|
195
|
+
}
|
|
206
196
|
}
|
|
207
|
-
|
|
208
|
-
}
|
|
197
|
+
]
|
|
209
198
|
};
|
|
210
199
|
return {
|
|
211
200
|
...defaultConfig,
|
|
212
|
-
...props.config.
|
|
201
|
+
...props.config.tableConfig
|
|
213
202
|
};
|
|
214
203
|
});
|
|
215
|
-
const fieldKey = vue.ref("");
|
|
216
|
-
const multiple = vue.ref(true);
|
|
217
|
-
let lastTagSnapshot = lodashEs.cloneDeep(props.model[props.name]) || [];
|
|
218
|
-
let shouldWatch = true;
|
|
219
204
|
vue.watch(
|
|
220
205
|
() => props.model[props.name],
|
|
221
|
-
(
|
|
222
|
-
if (
|
|
223
|
-
|
|
206
|
+
(value) => {
|
|
207
|
+
if (lodashEs.isEmpty(value)) {
|
|
208
|
+
props.model[props.name] = {
|
|
209
|
+
hookType: schema.HookType.CODE,
|
|
210
|
+
hookData: []
|
|
211
|
+
};
|
|
224
212
|
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
immediate: true
|
|
225
216
|
}
|
|
226
217
|
);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
props.model[props.name].map(async (id) => {
|
|
230
|
-
const { name = "" } = await services?.codeBlockService.getCodeContentById(id) || {};
|
|
231
|
-
return name;
|
|
232
|
-
})
|
|
233
|
-
);
|
|
234
|
-
fieldKey.value = combineNames.join("-");
|
|
235
|
-
});
|
|
236
|
-
const changeHandler = async (value) => {
|
|
237
|
-
shouldWatch = false;
|
|
238
|
-
let codeIds = value;
|
|
239
|
-
if (typeof value === "string") {
|
|
240
|
-
multiple.value = false;
|
|
241
|
-
lastTagSnapshot = [lastTagSnapshot];
|
|
242
|
-
codeIds = value ? [value] : [];
|
|
243
|
-
}
|
|
244
|
-
await setCombineRelation(codeIds);
|
|
245
|
-
emit("change", value);
|
|
246
|
-
};
|
|
247
|
-
const setCombineRelation = async (codeIds) => {
|
|
248
|
-
const { id = "" } = services?.editorService.get("node") || {};
|
|
249
|
-
let opFlag = CodeSelectOp.CHANGE;
|
|
250
|
-
let diffValues = codeIds;
|
|
251
|
-
if (multiple.value) {
|
|
252
|
-
opFlag = codeIds.length < lastTagSnapshot.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
|
|
253
|
-
diffValues = lodashEs.xor(codeIds, lastTagSnapshot);
|
|
254
|
-
}
|
|
255
|
-
await services?.codeBlockService.setCombineRelation(id, diffValues, opFlag, props.prop);
|
|
256
|
-
lastTagSnapshot = codeIds;
|
|
257
|
-
shouldWatch = true;
|
|
218
|
+
const changeHandler = async () => {
|
|
219
|
+
emit("change", props.model[props.name]);
|
|
258
220
|
};
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
221
|
+
const getParamsConfig = (codeId) => {
|
|
222
|
+
if (!codeDsl.value)
|
|
223
|
+
return [];
|
|
224
|
+
const paramStatements = codeDsl.value[codeId]?.params;
|
|
225
|
+
if (lodashEs.isEmpty(paramStatements))
|
|
226
|
+
return [];
|
|
227
|
+
return paramStatements.map((paramState) => ({
|
|
228
|
+
name: paramState.name,
|
|
229
|
+
text: paramState.name,
|
|
230
|
+
labelWidth: "100px",
|
|
231
|
+
type: "text"
|
|
232
|
+
}));
|
|
267
233
|
};
|
|
268
234
|
return (_ctx, _cache) => {
|
|
269
|
-
const
|
|
270
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
name: __props.name,
|
|
281
|
-
size: __props.size,
|
|
282
|
-
onChange: changeHandler
|
|
283
|
-
}, null, 8, ["config", "model", "prop", "name", "size"])
|
|
284
|
-
]),
|
|
285
|
-
default: vue.withCtx(() => [
|
|
286
|
-
vue.createElementVNode("div", _hoisted_1$e, [
|
|
287
|
-
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
288
|
-
class: "tool-item",
|
|
289
|
-
effect: "dark",
|
|
290
|
-
content: "\u67E5\u770B\u4EE3\u7801\u5757",
|
|
291
|
-
placement: "top"
|
|
292
|
-
}, {
|
|
293
|
-
default: vue.withCtx(() => [
|
|
294
|
-
(vue.openBlock(), vue.createElementBlock("svg", {
|
|
295
|
-
onClick: viewHandler,
|
|
296
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
297
|
-
viewBox: "0 0 24 24",
|
|
298
|
-
width: "15px",
|
|
299
|
-
height: "15px",
|
|
300
|
-
"data-v-65a7fb6c": ""
|
|
301
|
-
}, _hoisted_3$3))
|
|
302
|
-
]),
|
|
303
|
-
_: 1
|
|
304
|
-
})
|
|
305
|
-
])
|
|
306
|
-
]),
|
|
307
|
-
_: 1
|
|
308
|
-
})
|
|
235
|
+
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
236
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
|
|
237
|
+
vue.createVNode(_component_m_form_table, {
|
|
238
|
+
config: vue.unref(tableConfig),
|
|
239
|
+
model: __props.model[__props.name],
|
|
240
|
+
name: "hookData",
|
|
241
|
+
enableToggleMode: false,
|
|
242
|
+
prop: __props.prop,
|
|
243
|
+
size: __props.size,
|
|
244
|
+
onChange: changeHandler
|
|
245
|
+
}, null, 8, ["config", "model", "prop", "size"])
|
|
309
246
|
]);
|
|
310
247
|
};
|
|
311
248
|
}
|
|
312
249
|
});
|
|
313
250
|
|
|
314
|
-
const _hoisted_1$
|
|
315
|
-
const
|
|
316
|
-
|
|
251
|
+
const _hoisted_1$f = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
|
|
252
|
+
const __default__$q = vue.defineComponent({
|
|
253
|
+
name: "MEditorUISelect"
|
|
254
|
+
});
|
|
255
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
256
|
+
...__default__$q,
|
|
317
257
|
props: {
|
|
318
258
|
config: null,
|
|
319
259
|
model: null,
|
|
@@ -375,7 +315,7 @@
|
|
|
375
315
|
style: { "padding": "0" }
|
|
376
316
|
}, {
|
|
377
317
|
default: vue.withCtx(() => [
|
|
378
|
-
_hoisted_1$
|
|
318
|
+
_hoisted_1$f
|
|
379
319
|
]),
|
|
380
320
|
_: 1
|
|
381
321
|
}, 8, ["icon"])
|
|
@@ -423,12 +363,15 @@
|
|
|
423
363
|
|
|
424
364
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
425
365
|
|
|
426
|
-
const
|
|
427
|
-
|
|
366
|
+
const __default__$p = vue.defineComponent({
|
|
367
|
+
name: "MEditorCodeEditor"
|
|
368
|
+
});
|
|
369
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
370
|
+
...__default__$p,
|
|
428
371
|
props: {
|
|
429
372
|
initValues: null,
|
|
430
373
|
modifiedValues: null,
|
|
431
|
-
type:
|
|
374
|
+
type: null,
|
|
432
375
|
language: { default: "javascript" },
|
|
433
376
|
options: { default: () => ({
|
|
434
377
|
tabSize: 2
|
|
@@ -553,9 +496,182 @@
|
|
|
553
496
|
};
|
|
554
497
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
555
498
|
|
|
556
|
-
const
|
|
499
|
+
const __default__$o = vue.defineComponent({
|
|
500
|
+
name: "MEditorResizer"
|
|
501
|
+
});
|
|
502
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
503
|
+
...__default__$o,
|
|
504
|
+
emits: ["change"],
|
|
505
|
+
setup(__props, { emit }) {
|
|
506
|
+
const target = vue.ref();
|
|
507
|
+
let getso;
|
|
508
|
+
vue.onMounted(() => {
|
|
509
|
+
if (!target.value)
|
|
510
|
+
return;
|
|
511
|
+
getso = new Gesto__default.default(target.value, {
|
|
512
|
+
container: window,
|
|
513
|
+
pinchOutside: true
|
|
514
|
+
}).on("drag", (e) => {
|
|
515
|
+
if (!target.value)
|
|
516
|
+
return;
|
|
517
|
+
emit("change", e.deltaX);
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
vue.onUnmounted(() => {
|
|
521
|
+
getso?.unset();
|
|
522
|
+
});
|
|
523
|
+
return (_ctx, _cache) => {
|
|
524
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
525
|
+
ref_key: "target",
|
|
526
|
+
ref: target,
|
|
527
|
+
class: "m-editor-resizer"
|
|
528
|
+
}, [
|
|
529
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
530
|
+
], 512);
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
const __default__$n = vue.defineComponent({
|
|
536
|
+
name: "MEditorLayout"
|
|
537
|
+
});
|
|
557
538
|
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
558
|
-
|
|
539
|
+
...__default__$n,
|
|
540
|
+
props: {
|
|
541
|
+
left: null,
|
|
542
|
+
right: null,
|
|
543
|
+
minLeft: { default: 46 },
|
|
544
|
+
minRight: { default: 1 },
|
|
545
|
+
minCenter: { default: 1 },
|
|
546
|
+
leftClass: null,
|
|
547
|
+
rightClass: null,
|
|
548
|
+
centerClass: null
|
|
549
|
+
},
|
|
550
|
+
emits: ["update:left", "change", "update:right"],
|
|
551
|
+
setup(__props, { emit }) {
|
|
552
|
+
const props = __props;
|
|
553
|
+
const el = vue.ref();
|
|
554
|
+
const hasLeft = vue.computed(() => typeof props.left !== "undefined");
|
|
555
|
+
const hasRight = vue.computed(() => typeof props.right !== "undefined");
|
|
556
|
+
const getCenterWidth = (clientWidth2, left, right) => {
|
|
557
|
+
let center2 = clientWidth2 - left - right;
|
|
558
|
+
if (center2 < props.minCenter) {
|
|
559
|
+
center2 = props.minCenter;
|
|
560
|
+
if (left < right) {
|
|
561
|
+
right = clientWidth2 - left - props.minCenter;
|
|
562
|
+
} else {
|
|
563
|
+
left = clientWidth2 - right - props.minCenter;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return {
|
|
567
|
+
center: center2,
|
|
568
|
+
left,
|
|
569
|
+
right
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
let clientWidth = 0;
|
|
573
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
574
|
+
for (const { contentRect } of entries) {
|
|
575
|
+
clientWidth = contentRect.width;
|
|
576
|
+
let left = props.left || 0;
|
|
577
|
+
let right = props.right || 0;
|
|
578
|
+
if (left > clientWidth) {
|
|
579
|
+
left = clientWidth / 3;
|
|
580
|
+
}
|
|
581
|
+
if (right > clientWidth) {
|
|
582
|
+
right = clientWidth / 3;
|
|
583
|
+
}
|
|
584
|
+
const columnWidth = getCenterWidth(clientWidth, left, right);
|
|
585
|
+
center.value = columnWidth.center;
|
|
586
|
+
emit("change", {
|
|
587
|
+
left: columnWidth.left,
|
|
588
|
+
center: center.value,
|
|
589
|
+
right: columnWidth.right
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
vue.onMounted(() => {
|
|
594
|
+
if (el.value) {
|
|
595
|
+
resizerObserver.observe(el.value);
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
vue.onUnmounted(() => {
|
|
599
|
+
resizerObserver.disconnect();
|
|
600
|
+
});
|
|
601
|
+
const center = vue.ref(0);
|
|
602
|
+
const changeLeft = (deltaX) => {
|
|
603
|
+
if (typeof props.left === "undefined")
|
|
604
|
+
return;
|
|
605
|
+
let left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
606
|
+
emit("update:left", left);
|
|
607
|
+
if (clientWidth - left - (props.right || 0) <= 0) {
|
|
608
|
+
left = props.left;
|
|
609
|
+
}
|
|
610
|
+
const columnWidth = getCenterWidth(clientWidth, left, props.right || 0);
|
|
611
|
+
center.value = columnWidth.center;
|
|
612
|
+
emit("change", {
|
|
613
|
+
left: columnWidth.left,
|
|
614
|
+
center: center.value,
|
|
615
|
+
right: columnWidth.right
|
|
616
|
+
});
|
|
617
|
+
};
|
|
618
|
+
const changeRight = (deltaX) => {
|
|
619
|
+
if (typeof props.right === "undefined")
|
|
620
|
+
return;
|
|
621
|
+
let right = Math.max(props.right - deltaX, props.minRight) || 0;
|
|
622
|
+
emit("update:right", right);
|
|
623
|
+
if (clientWidth - (props.left || 0) - right <= 0) {
|
|
624
|
+
right = props.right;
|
|
625
|
+
}
|
|
626
|
+
const columnWidth = getCenterWidth(clientWidth, props.left || 0, right);
|
|
627
|
+
center.value = columnWidth.center;
|
|
628
|
+
emit("change", {
|
|
629
|
+
left: columnWidth.left,
|
|
630
|
+
center: center.value,
|
|
631
|
+
right: columnWidth.right
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
return (_ctx, _cache) => {
|
|
635
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
636
|
+
ref_key: "el",
|
|
637
|
+
ref: el,
|
|
638
|
+
class: "m-editor-layout"
|
|
639
|
+
}, [
|
|
640
|
+
vue.unref(hasLeft) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
641
|
+
vue.createElementVNode("div", {
|
|
642
|
+
class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
643
|
+
style: vue.normalizeStyle(`width: ${__props.left}px`)
|
|
644
|
+
}, [
|
|
645
|
+
vue.renderSlot(_ctx.$slots, "left")
|
|
646
|
+
], 6),
|
|
647
|
+
vue.createVNode(_sfc_main$p, { onChange: changeLeft })
|
|
648
|
+
], 64)) : vue.createCommentVNode("", true),
|
|
649
|
+
vue.createElementVNode("div", {
|
|
650
|
+
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
651
|
+
style: vue.normalizeStyle(`width: ${center.value}px`)
|
|
652
|
+
}, [
|
|
653
|
+
vue.renderSlot(_ctx.$slots, "center")
|
|
654
|
+
], 6),
|
|
655
|
+
vue.unref(hasRight) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
656
|
+
vue.createVNode(_sfc_main$p, { onChange: changeRight }),
|
|
657
|
+
vue.createElementVNode("div", {
|
|
658
|
+
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
659
|
+
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
660
|
+
}, [
|
|
661
|
+
vue.renderSlot(_ctx.$slots, "right")
|
|
662
|
+
], 6)
|
|
663
|
+
], 64)) : vue.createCommentVNode("", true)
|
|
664
|
+
], 512);
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
const _hoisted_1$e = ["src"];
|
|
670
|
+
const __default__$m = vue.defineComponent({
|
|
671
|
+
name: "MEditorIcon"
|
|
672
|
+
});
|
|
673
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
674
|
+
...__default__$m,
|
|
559
675
|
props: {
|
|
560
676
|
icon: null
|
|
561
677
|
},
|
|
@@ -574,7 +690,7 @@
|
|
|
574
690
|
class: "magic-editor-icon"
|
|
575
691
|
}, {
|
|
576
692
|
default: vue.withCtx(() => [
|
|
577
|
-
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$
|
|
693
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$e)
|
|
578
694
|
]),
|
|
579
695
|
_: 1
|
|
580
696
|
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
@@ -593,6 +709,42 @@
|
|
|
593
709
|
}
|
|
594
710
|
});
|
|
595
711
|
|
|
712
|
+
var ColumnLayout = /* @__PURE__ */ ((ColumnLayout2) => {
|
|
713
|
+
ColumnLayout2["LEFT"] = "left";
|
|
714
|
+
ColumnLayout2["CENTER"] = "center";
|
|
715
|
+
ColumnLayout2["RIGHT"] = "right";
|
|
716
|
+
return ColumnLayout2;
|
|
717
|
+
})(ColumnLayout || {});
|
|
718
|
+
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
719
|
+
LayerOffset2["TOP"] = "top";
|
|
720
|
+
LayerOffset2["BOTTOM"] = "bottom";
|
|
721
|
+
return LayerOffset2;
|
|
722
|
+
})(LayerOffset || {});
|
|
723
|
+
var Layout = /* @__PURE__ */ ((Layout2) => {
|
|
724
|
+
Layout2["FLEX"] = "flex";
|
|
725
|
+
Layout2["FIXED"] = "fixed";
|
|
726
|
+
Layout2["RELATIVE"] = "relative";
|
|
727
|
+
Layout2["ABSOLUTE"] = "absolute";
|
|
728
|
+
return Layout2;
|
|
729
|
+
})(Layout || {});
|
|
730
|
+
var Keys = /* @__PURE__ */ ((Keys2) => {
|
|
731
|
+
Keys2["ESCAPE"] = "Space";
|
|
732
|
+
return Keys2;
|
|
733
|
+
})(Keys || {});
|
|
734
|
+
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
735
|
+
const V_GUIDE_LINE_STORAGE_KEY = "$MagicStageVerticalGuidelinesData";
|
|
736
|
+
var CodeEditorMode = /* @__PURE__ */ ((CodeEditorMode2) => {
|
|
737
|
+
CodeEditorMode2["LIST"] = "list";
|
|
738
|
+
CodeEditorMode2["EDITOR"] = "editor";
|
|
739
|
+
return CodeEditorMode2;
|
|
740
|
+
})(CodeEditorMode || {});
|
|
741
|
+
var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
742
|
+
CodeDeleteErrorType2["UNDELETEABLE"] = "undeleteable";
|
|
743
|
+
CodeDeleteErrorType2["BIND"] = "bind";
|
|
744
|
+
return CodeDeleteErrorType2;
|
|
745
|
+
})(CodeDeleteErrorType || {});
|
|
746
|
+
const CODE_DRAFT_STORAGE_KEY = "magicCodeDraft";
|
|
747
|
+
|
|
596
748
|
const log = (...args) => {
|
|
597
749
|
if (process.env.NODE_ENV === "development") {
|
|
598
750
|
console.log("magic editor: ", ...args);
|
|
@@ -722,6 +874,14 @@
|
|
|
722
874
|
this.pluginOptionsList[methodName2].push(method);
|
|
723
875
|
});
|
|
724
876
|
}
|
|
877
|
+
removeAllPlugins() {
|
|
878
|
+
Object.keys(this.pluginOptionsList).forEach((key) => {
|
|
879
|
+
this.pluginOptionsList[key] = [];
|
|
880
|
+
});
|
|
881
|
+
Object.keys(this.middleware).forEach((key) => {
|
|
882
|
+
this.middleware[key] = [];
|
|
883
|
+
});
|
|
884
|
+
}
|
|
725
885
|
async doTask() {
|
|
726
886
|
this.doingTask = true;
|
|
727
887
|
let task = this.taskList.shift();
|
|
@@ -741,7 +901,8 @@
|
|
|
741
901
|
editable: true,
|
|
742
902
|
mode: CodeEditorMode.EDITOR,
|
|
743
903
|
combineIds: [],
|
|
744
|
-
undeletableList: []
|
|
904
|
+
undeletableList: [],
|
|
905
|
+
relations: {}
|
|
745
906
|
});
|
|
746
907
|
constructor() {
|
|
747
908
|
super([
|
|
@@ -759,31 +920,40 @@
|
|
|
759
920
|
"deleteCodeDslByIds"
|
|
760
921
|
]);
|
|
761
922
|
}
|
|
762
|
-
async setCodeDsl(
|
|
763
|
-
this.state.codeDsl =
|
|
923
|
+
async setCodeDsl(codeDsl2) {
|
|
924
|
+
this.state.codeDsl = codeDsl2;
|
|
764
925
|
await editorService.setCodeDsl(this.state.codeDsl);
|
|
765
926
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
766
927
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
767
928
|
}
|
|
768
929
|
async getCodeDsl(forceRefresh = false) {
|
|
930
|
+
return this.getCodeDslSync(forceRefresh);
|
|
931
|
+
}
|
|
932
|
+
getCodeDslSync(forceRefresh = false) {
|
|
769
933
|
if (!this.state.codeDsl || forceRefresh) {
|
|
770
|
-
this.state.codeDsl =
|
|
934
|
+
this.state.codeDsl = editorService.getCodeDslSync();
|
|
771
935
|
}
|
|
772
936
|
return this.state.codeDsl;
|
|
773
937
|
}
|
|
774
|
-
async getCodeContentById(
|
|
775
|
-
if (!
|
|
938
|
+
async getCodeContentById(id2) {
|
|
939
|
+
if (!id2)
|
|
776
940
|
return null;
|
|
777
941
|
const totalCodeDsl = await this.getCodeDsl();
|
|
778
942
|
if (!totalCodeDsl)
|
|
779
943
|
return null;
|
|
780
|
-
return totalCodeDsl[
|
|
944
|
+
return totalCodeDsl[id2] ?? null;
|
|
781
945
|
}
|
|
782
946
|
async setCodeDslById(id, codeConfig) {
|
|
783
947
|
let codeDsl = await this.getCodeDsl();
|
|
948
|
+
const codeConfigProcessed = codeConfig;
|
|
949
|
+
if (codeConfig.content) {
|
|
950
|
+
codeConfigProcessed.content = eval(codeConfig.content);
|
|
951
|
+
}
|
|
784
952
|
if (!codeDsl) {
|
|
785
953
|
codeDsl = {
|
|
786
|
-
[id]:
|
|
954
|
+
[id]: {
|
|
955
|
+
...codeConfigProcessed
|
|
956
|
+
}
|
|
787
957
|
};
|
|
788
958
|
} else {
|
|
789
959
|
const existContent = codeDsl[id] || {};
|
|
@@ -791,15 +961,15 @@
|
|
|
791
961
|
...codeDsl,
|
|
792
962
|
[id]: {
|
|
793
963
|
...existContent,
|
|
794
|
-
...
|
|
964
|
+
...codeConfigProcessed
|
|
795
965
|
}
|
|
796
966
|
};
|
|
797
967
|
}
|
|
798
968
|
await this.setCodeDsl(codeDsl);
|
|
799
969
|
}
|
|
800
970
|
async getCodeDslByIds(ids) {
|
|
801
|
-
const
|
|
802
|
-
return lodashEs.pick(
|
|
971
|
+
const codeDsl2 = await this.getCodeDsl();
|
|
972
|
+
return lodashEs.pick(codeDsl2, ids);
|
|
803
973
|
}
|
|
804
974
|
async setCodeEditorShowStatus(status) {
|
|
805
975
|
this.state.isShowCodeEditor = status;
|
|
@@ -807,10 +977,10 @@
|
|
|
807
977
|
getCodeEditorShowStatus() {
|
|
808
978
|
return this.state.isShowCodeEditor;
|
|
809
979
|
}
|
|
810
|
-
setCodeEditorContent(status,
|
|
811
|
-
if (!
|
|
980
|
+
setCodeEditorContent(status, id2) {
|
|
981
|
+
if (!id2)
|
|
812
982
|
return;
|
|
813
|
-
this.setId(
|
|
983
|
+
this.setId(id2);
|
|
814
984
|
this.state.isShowCodeEditor = status;
|
|
815
985
|
}
|
|
816
986
|
async getCurrentDsl() {
|
|
@@ -822,10 +992,10 @@
|
|
|
822
992
|
async setEditStatus(status) {
|
|
823
993
|
this.state.editable = status;
|
|
824
994
|
}
|
|
825
|
-
setId(
|
|
826
|
-
if (!
|
|
995
|
+
setId(id2) {
|
|
996
|
+
if (!id2)
|
|
827
997
|
return;
|
|
828
|
-
this.state.id =
|
|
998
|
+
this.state.id = id2;
|
|
829
999
|
}
|
|
830
1000
|
getId() {
|
|
831
1001
|
return this.state.id;
|
|
@@ -842,61 +1012,17 @@
|
|
|
842
1012
|
getCombineIds() {
|
|
843
1013
|
return this.state.combineIds;
|
|
844
1014
|
}
|
|
845
|
-
|
|
846
|
-
const
|
|
847
|
-
if (!
|
|
848
|
-
return;
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
}
|
|
857
|
-
});
|
|
858
|
-
} catch (e) {
|
|
859
|
-
error(e);
|
|
860
|
-
throw new Error("\u89E3\u7ED1\u4EE3\u7801\u5757\u5931\u8D25");
|
|
861
|
-
}
|
|
862
|
-
} else if (opFlag === CodeSelectOp.ADD) {
|
|
863
|
-
try {
|
|
864
|
-
diffCodeIds.forEach((codeId) => {
|
|
865
|
-
const compsContent = codeDsl[codeId].comps;
|
|
866
|
-
const existHooks = compsContent?.[compId];
|
|
867
|
-
if (lodashEs.isEmpty(existHooks)) {
|
|
868
|
-
codeDsl[codeId].comps = {
|
|
869
|
-
...codeDsl[codeId].comps || {},
|
|
870
|
-
[compId]: [hook]
|
|
871
|
-
};
|
|
872
|
-
} else {
|
|
873
|
-
existHooks?.push(hook);
|
|
874
|
-
}
|
|
875
|
-
});
|
|
876
|
-
} catch (e) {
|
|
877
|
-
error(e);
|
|
878
|
-
throw new Error("\u7ED1\u5B9A\u4EE3\u7801\u5757\u5931\u8D25");
|
|
879
|
-
}
|
|
880
|
-
} else if (opFlag === CodeSelectOp.CHANGE) {
|
|
881
|
-
lodashEs.forIn(codeDsl, (codeBlockContent, codeId) => {
|
|
882
|
-
if (codeId === diffCodeIds[0]) {
|
|
883
|
-
codeBlockContent.comps = {
|
|
884
|
-
...codeBlockContent?.comps || {},
|
|
885
|
-
[compId]: [hook]
|
|
886
|
-
};
|
|
887
|
-
} else if (lodashEs.isEmpty(diffCodeIds) || codeId !== diffCodeIds[0]) {
|
|
888
|
-
const compHooks = codeBlockContent?.comps?.[compId];
|
|
889
|
-
if (!compHooks)
|
|
890
|
-
return true;
|
|
891
|
-
const index = compHooks.findIndex((hookName) => hookName === hook);
|
|
892
|
-
if (index !== -1) {
|
|
893
|
-
compHooks.splice(index, 1);
|
|
894
|
-
return false;
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
this.setCodeDsl(codeDsl);
|
|
1015
|
+
refreshCombineInfo() {
|
|
1016
|
+
const root = editorService.get("root");
|
|
1017
|
+
if (!root)
|
|
1018
|
+
return null;
|
|
1019
|
+
const relations = {};
|
|
1020
|
+
this.recurseMNode(root, relations);
|
|
1021
|
+
this.state.relations = relations;
|
|
1022
|
+
return this.state.relations;
|
|
1023
|
+
}
|
|
1024
|
+
getCombineInfo() {
|
|
1025
|
+
return this.state.relations;
|
|
900
1026
|
}
|
|
901
1027
|
getUndeletableList() {
|
|
902
1028
|
return this.state.undeletableList;
|
|
@@ -904,6 +1030,15 @@
|
|
|
904
1030
|
async setUndeleteableList(codeIds) {
|
|
905
1031
|
this.state.undeletableList = codeIds;
|
|
906
1032
|
}
|
|
1033
|
+
setCodeDraft(codeId, content) {
|
|
1034
|
+
globalThis.localStorage.setItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`, content);
|
|
1035
|
+
}
|
|
1036
|
+
getCodeDraft(codeId) {
|
|
1037
|
+
return globalThis.localStorage.getItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
1038
|
+
}
|
|
1039
|
+
removeCodeDraft(codeId) {
|
|
1040
|
+
globalThis.localStorage.removeItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
1041
|
+
}
|
|
907
1042
|
async deleteCodeDslByIds(codeIds) {
|
|
908
1043
|
const currentDsl = await this.getCodeDsl();
|
|
909
1044
|
const newDsl = lodashEs.omit(currentDsl, codeIds);
|
|
@@ -919,13 +1054,13 @@
|
|
|
919
1054
|
return await this.getUniqueId();
|
|
920
1055
|
}
|
|
921
1056
|
async deleteCompsInRelation(node) {
|
|
922
|
-
const
|
|
923
|
-
if (!
|
|
1057
|
+
const codeDsl2 = lodashEs.cloneDeep(await this.getCodeDsl());
|
|
1058
|
+
if (!codeDsl2)
|
|
924
1059
|
return;
|
|
925
|
-
this.
|
|
926
|
-
this.setCodeDsl(
|
|
1060
|
+
this.refreshRelationDeep(node, codeDsl2);
|
|
1061
|
+
this.setCodeDsl(codeDsl2);
|
|
927
1062
|
}
|
|
928
|
-
|
|
1063
|
+
resetState() {
|
|
929
1064
|
this.state.isShowCodeEditor = false;
|
|
930
1065
|
this.state.codeDsl = null;
|
|
931
1066
|
this.state.id = "";
|
|
@@ -934,16 +1069,44 @@
|
|
|
934
1069
|
this.state.combineIds = [];
|
|
935
1070
|
this.state.undeletableList = [];
|
|
936
1071
|
}
|
|
937
|
-
|
|
1072
|
+
destroy() {
|
|
1073
|
+
this.resetState();
|
|
1074
|
+
this.removeAllListeners();
|
|
1075
|
+
this.removeAllPlugins();
|
|
1076
|
+
}
|
|
1077
|
+
refreshRelationDeep(node, codeDsl2) {
|
|
938
1078
|
if (!node.id)
|
|
939
1079
|
return;
|
|
940
|
-
lodashEs.forIn(
|
|
1080
|
+
lodashEs.forIn(codeDsl2, (codeBlockContent) => {
|
|
941
1081
|
const compsContent = codeBlockContent.comps || {};
|
|
942
1082
|
codeBlockContent.comps = lodashEs.omit(compsContent, node.id);
|
|
943
1083
|
});
|
|
944
1084
|
if (!lodashEs.isEmpty(node.items)) {
|
|
945
1085
|
node.items.forEach((item) => {
|
|
946
|
-
this.
|
|
1086
|
+
this.refreshRelationDeep(item, codeDsl2);
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
recurseMNode(node, relations) {
|
|
1091
|
+
lodashEs.forIn(node, (value, key) => {
|
|
1092
|
+
if (value?.hookType === schema.HookType.CODE && !lodashEs.isEmpty(value.hookData)) {
|
|
1093
|
+
value.hookData.forEach((relationItem) => {
|
|
1094
|
+
if (!relationItem.codeId)
|
|
1095
|
+
return;
|
|
1096
|
+
if (!relations[relationItem.codeId]) {
|
|
1097
|
+
relations[relationItem.codeId] = {};
|
|
1098
|
+
}
|
|
1099
|
+
const codeItem = relations[relationItem.codeId];
|
|
1100
|
+
if (lodashEs.isEmpty(codeItem[node.id])) {
|
|
1101
|
+
codeItem[node.id] = [];
|
|
1102
|
+
}
|
|
1103
|
+
codeItem[node.id].push(key);
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
});
|
|
1107
|
+
if (!lodashEs.isEmpty(node.items)) {
|
|
1108
|
+
node.items.forEach((item) => {
|
|
1109
|
+
this.recurseMNode(item, relations);
|
|
947
1110
|
});
|
|
948
1111
|
}
|
|
949
1112
|
}
|
|
@@ -1027,8 +1190,9 @@
|
|
|
1027
1190
|
this.state.pageSteps[this.state.pageId] = undoRedo;
|
|
1028
1191
|
}
|
|
1029
1192
|
this.setCanUndoRedo();
|
|
1193
|
+
this.emit("page-change", this.state.pageSteps[this.state.pageId]);
|
|
1030
1194
|
}
|
|
1031
|
-
|
|
1195
|
+
resetState() {
|
|
1032
1196
|
this.state.pageId = void 0;
|
|
1033
1197
|
this.state.pageSteps = {};
|
|
1034
1198
|
this.state.canRedo = false;
|
|
@@ -1059,8 +1223,9 @@
|
|
|
1059
1223
|
return state;
|
|
1060
1224
|
}
|
|
1061
1225
|
destroy() {
|
|
1062
|
-
this.
|
|
1226
|
+
this.resetState();
|
|
1063
1227
|
this.removeAllListeners();
|
|
1228
|
+
this.removeAllPlugins();
|
|
1064
1229
|
}
|
|
1065
1230
|
getUndoRedo() {
|
|
1066
1231
|
if (!this.state.pageId)
|
|
@@ -1140,6 +1305,7 @@
|
|
|
1140
1305
|
}
|
|
1141
1306
|
destroy() {
|
|
1142
1307
|
this.removeAllListeners();
|
|
1308
|
+
this.removeAllPlugins();
|
|
1143
1309
|
}
|
|
1144
1310
|
getValueAndProtocol(value) {
|
|
1145
1311
|
let protocol2 = "";
|
|
@@ -1312,6 +1478,10 @@
|
|
|
1312
1478
|
left: fixNodeLeft(config, parent, stage?.renderer.contentWindow?.document)
|
|
1313
1479
|
};
|
|
1314
1480
|
};
|
|
1481
|
+
const serializeConfig = (config) => serialize__default.default(config, {
|
|
1482
|
+
space: 2,
|
|
1483
|
+
unsafe: true
|
|
1484
|
+
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1315
1485
|
|
|
1316
1486
|
class Props extends BaseService {
|
|
1317
1487
|
state = vue.reactive({
|
|
@@ -1353,7 +1523,7 @@
|
|
|
1353
1523
|
this.setPropsValue(utils.toLine(type), values[type]);
|
|
1354
1524
|
});
|
|
1355
1525
|
}
|
|
1356
|
-
setPropsValue(type, value) {
|
|
1526
|
+
async setPropsValue(type, value) {
|
|
1357
1527
|
this.state.propsValueMap[type] = value;
|
|
1358
1528
|
}
|
|
1359
1529
|
async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
|
|
@@ -1407,10 +1577,14 @@
|
|
|
1407
1577
|
name: type
|
|
1408
1578
|
};
|
|
1409
1579
|
}
|
|
1410
|
-
|
|
1580
|
+
resetState() {
|
|
1411
1581
|
this.state.propsConfigMap = {};
|
|
1412
1582
|
this.state.propsValueMap = {};
|
|
1583
|
+
}
|
|
1584
|
+
destroy() {
|
|
1585
|
+
this.resetState();
|
|
1413
1586
|
this.removeAllListeners();
|
|
1587
|
+
this.removeAllPlugins();
|
|
1414
1588
|
}
|
|
1415
1589
|
guid(digit = 8) {
|
|
1416
1590
|
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
@@ -1485,6 +1659,13 @@
|
|
|
1485
1659
|
}
|
|
1486
1660
|
return parentNode;
|
|
1487
1661
|
};
|
|
1662
|
+
const getDefaultConfig = async (addNode, parentNode) => {
|
|
1663
|
+
const { type, inputEvent, ...config } = addNode;
|
|
1664
|
+
const layout = await editorService.getLayout(vue.toRaw(parentNode), addNode);
|
|
1665
|
+
const newNode = { ...vue.toRaw(await propsService.getPropsValue(type, config)) };
|
|
1666
|
+
newNode.style = getInitPositionStyle(newNode.style, layout);
|
|
1667
|
+
return newNode;
|
|
1668
|
+
};
|
|
1488
1669
|
|
|
1489
1670
|
class Editor$1 extends BaseService {
|
|
1490
1671
|
state = vue.reactive({
|
|
@@ -1514,7 +1695,7 @@
|
|
|
1514
1695
|
"copy",
|
|
1515
1696
|
"paste",
|
|
1516
1697
|
"doPaste",
|
|
1517
|
-
"
|
|
1698
|
+
"doAlignCenter",
|
|
1518
1699
|
"alignCenter",
|
|
1519
1700
|
"moveLayer",
|
|
1520
1701
|
"moveToContainer",
|
|
@@ -1529,13 +1710,14 @@
|
|
|
1529
1710
|
);
|
|
1530
1711
|
}
|
|
1531
1712
|
set(name, value) {
|
|
1713
|
+
const preValue = this.state[name];
|
|
1532
1714
|
this.state[name] = value;
|
|
1533
1715
|
if (name === "nodes") {
|
|
1534
1716
|
this.set("node", value[0]);
|
|
1535
1717
|
}
|
|
1536
1718
|
if (name === "root") {
|
|
1537
1719
|
this.state.pageLength = value?.items?.length || 0;
|
|
1538
|
-
this.emit("root-change", value);
|
|
1720
|
+
this.emit("root-change", value, preValue);
|
|
1539
1721
|
}
|
|
1540
1722
|
}
|
|
1541
1723
|
get(name) {
|
|
@@ -1595,7 +1777,7 @@
|
|
|
1595
1777
|
if (page) {
|
|
1596
1778
|
historyService.changePage(vue.toRaw(page));
|
|
1597
1779
|
} else {
|
|
1598
|
-
historyService.
|
|
1780
|
+
historyService.resetState();
|
|
1599
1781
|
}
|
|
1600
1782
|
if (node?.id) {
|
|
1601
1783
|
this.get("stage")?.renderer.runtime?.getApp?.()?.emit(
|
|
@@ -1693,6 +1875,9 @@
|
|
|
1693
1875
|
}
|
|
1694
1876
|
const newNodes = await Promise.all(
|
|
1695
1877
|
addNodes.map((node) => {
|
|
1878
|
+
if (utils.isPage(node)) {
|
|
1879
|
+
return this.doAdd(node, this.get("root"));
|
|
1880
|
+
}
|
|
1696
1881
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
1697
1882
|
if (!parentNode)
|
|
1698
1883
|
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
@@ -1711,7 +1896,9 @@
|
|
|
1711
1896
|
stage?.select(newNodes[0].id);
|
|
1712
1897
|
}
|
|
1713
1898
|
}
|
|
1714
|
-
|
|
1899
|
+
if (!utils.isPage(newNodes[0])) {
|
|
1900
|
+
this.pushHistoryState();
|
|
1901
|
+
}
|
|
1715
1902
|
this.emit("add", newNodes);
|
|
1716
1903
|
return Array.isArray(addNode) ? newNodes : newNodes[0];
|
|
1717
1904
|
}
|
|
@@ -1753,7 +1940,9 @@
|
|
|
1753
1940
|
async remove(nodeOrNodeList) {
|
|
1754
1941
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
1755
1942
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
1756
|
-
|
|
1943
|
+
if (!utils.isPage(nodes[0])) {
|
|
1944
|
+
this.pushHistoryState();
|
|
1945
|
+
}
|
|
1757
1946
|
this.emit("remove", nodes);
|
|
1758
1947
|
}
|
|
1759
1948
|
async doUpdate(config) {
|
|
@@ -1765,6 +1954,9 @@
|
|
|
1765
1954
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
1766
1955
|
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, this.get("root"));
|
|
1767
1956
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1957
|
+
if (lodashEs.isObject(srcValue) && Array.isArray(objValue)) {
|
|
1958
|
+
return srcValue;
|
|
1959
|
+
}
|
|
1768
1960
|
if (Array.isArray(srcValue)) {
|
|
1769
1961
|
return srcValue;
|
|
1770
1962
|
}
|
|
@@ -1808,6 +2000,7 @@
|
|
|
1808
2000
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
1809
2001
|
this.pushHistoryState();
|
|
1810
2002
|
this.emit("update", newNodes);
|
|
2003
|
+
codeBlockService.refreshCombineInfo();
|
|
1811
2004
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
1812
2005
|
}
|
|
1813
2006
|
async sort(id1, id2) {
|
|
@@ -1837,8 +2030,16 @@
|
|
|
1837
2030
|
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
1838
2031
|
if (!Array.isArray(config))
|
|
1839
2032
|
return;
|
|
2033
|
+
const node = this.get("node");
|
|
2034
|
+
let parent = void 0;
|
|
2035
|
+
if (config.length === 1 && config[0].id === node.id) {
|
|
2036
|
+
parent = this.get("parent");
|
|
2037
|
+
if (parent.type === schema.NodeType.ROOT) {
|
|
2038
|
+
parent = this.get("page");
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
1840
2041
|
const pasteConfigs = await this.doPaste(config, position);
|
|
1841
|
-
return this.add(pasteConfigs);
|
|
2042
|
+
return this.add(pasteConfigs, parent);
|
|
1842
2043
|
}
|
|
1843
2044
|
async doPaste(config, position = {}) {
|
|
1844
2045
|
const pasteConfigs = await beforePaste(position, lodashEs.cloneDeep(config));
|
|
@@ -1873,7 +2074,11 @@
|
|
|
1873
2074
|
const stage = this.get("stage");
|
|
1874
2075
|
const newNodes = await Promise.all(nodes.map((node) => this.doAlignCenter(node)));
|
|
1875
2076
|
const newNode = await this.update(newNodes);
|
|
1876
|
-
|
|
2077
|
+
if (newNodes.length > 1) {
|
|
2078
|
+
await stage?.multiSelect(newNodes.map((node) => node.id));
|
|
2079
|
+
} else {
|
|
2080
|
+
await stage?.select(newNodes[0].id);
|
|
2081
|
+
}
|
|
1877
2082
|
return newNode;
|
|
1878
2083
|
}
|
|
1879
2084
|
async moveLayer(offset) {
|
|
@@ -1959,8 +2164,7 @@
|
|
|
1959
2164
|
}
|
|
1960
2165
|
});
|
|
1961
2166
|
}
|
|
1962
|
-
|
|
1963
|
-
this.removeAllListeners();
|
|
2167
|
+
resetState() {
|
|
1964
2168
|
this.set("root", null);
|
|
1965
2169
|
this.set("node", null);
|
|
1966
2170
|
this.set("nodes", []);
|
|
@@ -1971,6 +2175,11 @@
|
|
|
1971
2175
|
this.set("modifiedNodeIds", /* @__PURE__ */ new Map());
|
|
1972
2176
|
this.set("pageLength", /* @__PURE__ */ new Map());
|
|
1973
2177
|
}
|
|
2178
|
+
destroy() {
|
|
2179
|
+
this.removeAllListeners();
|
|
2180
|
+
this.resetState();
|
|
2181
|
+
this.removeAllPlugins();
|
|
2182
|
+
}
|
|
1974
2183
|
resetModifiedNodeId() {
|
|
1975
2184
|
this.get("modifiedNodeIds").clear();
|
|
1976
2185
|
}
|
|
@@ -1980,6 +2189,12 @@
|
|
|
1980
2189
|
return null;
|
|
1981
2190
|
return root.codeBlocks || null;
|
|
1982
2191
|
}
|
|
2192
|
+
getCodeDslSync() {
|
|
2193
|
+
const root = this.get("root");
|
|
2194
|
+
if (!root)
|
|
2195
|
+
return null;
|
|
2196
|
+
return root.codeBlocks || null;
|
|
2197
|
+
}
|
|
1983
2198
|
async setCodeDsl(codeDsl) {
|
|
1984
2199
|
if (!this.state.root)
|
|
1985
2200
|
return;
|
|
@@ -2091,10 +2306,14 @@
|
|
|
2091
2306
|
getMethod(type) {
|
|
2092
2307
|
return lodashEs.cloneDeep(methodMap[type] || core.DEFAULT_METHODS);
|
|
2093
2308
|
}
|
|
2094
|
-
|
|
2309
|
+
resetState() {
|
|
2095
2310
|
eventMap = vue.reactive({});
|
|
2096
2311
|
methodMap = vue.reactive({});
|
|
2312
|
+
}
|
|
2313
|
+
destroy() {
|
|
2314
|
+
this.resetState();
|
|
2097
2315
|
this.removeAllListeners();
|
|
2316
|
+
this.removeAllPlugins();
|
|
2098
2317
|
}
|
|
2099
2318
|
}
|
|
2100
2319
|
const eventsService = new Events();
|
|
@@ -2294,14 +2513,14 @@
|
|
|
2294
2513
|
{
|
|
2295
2514
|
name: "created",
|
|
2296
2515
|
text: "created",
|
|
2297
|
-
|
|
2298
|
-
|
|
2516
|
+
labelWidth: "100px",
|
|
2517
|
+
type: "code-select"
|
|
2299
2518
|
},
|
|
2300
2519
|
{
|
|
2301
2520
|
name: "mounted",
|
|
2302
2521
|
text: "mounted",
|
|
2303
|
-
|
|
2304
|
-
|
|
2522
|
+
labelWidth: "100px",
|
|
2523
|
+
type: "code-select"
|
|
2305
2524
|
}
|
|
2306
2525
|
]
|
|
2307
2526
|
}
|
|
@@ -2369,8 +2588,19 @@
|
|
|
2369
2588
|
}
|
|
2370
2589
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
2371
2590
|
}
|
|
2591
|
+
resetState() {
|
|
2592
|
+
this.set("showSrc", false);
|
|
2593
|
+
this.set("uiSelectMode", false);
|
|
2594
|
+
this.set("zoom", 1);
|
|
2595
|
+
this.set("stageContainerRect", {
|
|
2596
|
+
width: 0,
|
|
2597
|
+
height: 0
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2372
2600
|
destroy() {
|
|
2601
|
+
this.resetState();
|
|
2373
2602
|
this.removeAllListeners();
|
|
2603
|
+
this.removeAllPlugins();
|
|
2374
2604
|
}
|
|
2375
2605
|
async setStageRect(value) {
|
|
2376
2606
|
state.stageRect = {
|
|
@@ -2397,6 +2627,7 @@
|
|
|
2397
2627
|
containerHighlightClassName: stageOptions.containerHighlightClassName,
|
|
2398
2628
|
containerHighlightDuration: stageOptions.containerHighlightDuration,
|
|
2399
2629
|
containerHighlightType: stageOptions.containerHighlightType,
|
|
2630
|
+
disabledDragStart: stageOptions.disabledDragStart,
|
|
2400
2631
|
canSelect: (el, event, stop) => {
|
|
2401
2632
|
const elCanSelect = stageOptions.canSelect(el);
|
|
2402
2633
|
if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
|
|
@@ -2408,225 +2639,97 @@
|
|
|
2408
2639
|
moveableOptions: stageOptions.moveableOptions,
|
|
2409
2640
|
updateDragEl: stageOptions.updateDragEl
|
|
2410
2641
|
});
|
|
2411
|
-
stage.mask.setGuides([
|
|
2412
|
-
getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)),
|
|
2413
|
-
getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
|
|
2414
|
-
]);
|
|
2415
|
-
stage.on("select", (el) => {
|
|
2416
|
-
if (`${editorService.get("node")?.id}` === el.id)
|
|
2417
|
-
return;
|
|
2418
|
-
editorService.select(el.id);
|
|
2419
|
-
});
|
|
2420
|
-
stage.on("highlight", (el) => {
|
|
2421
|
-
editorService.highlight(el.id);
|
|
2422
|
-
});
|
|
2423
|
-
stage.on("
|
|
2424
|
-
editorService.multiSelect(els.map((el) => el.id));
|
|
2425
|
-
});
|
|
2426
|
-
stage.on("update", (ev) => {
|
|
2427
|
-
if (ev.parentEl) {
|
|
2428
|
-
for (const data of ev.data) {
|
|
2429
|
-
editorService.moveToContainer({ id: data.el.id, style: data.style }, ev.parentEl.id);
|
|
2430
|
-
}
|
|
2431
|
-
return;
|
|
2432
|
-
}
|
|
2433
|
-
editorService.update(ev.data.map((data) => ({ id: data.el.id, style: data.style })));
|
|
2434
|
-
});
|
|
2435
|
-
stage.on("sort", (ev) => {
|
|
2436
|
-
editorService.sort(ev.src, ev.dist);
|
|
2437
|
-
});
|
|
2438
|
-
stage.on("select-parent", () => {
|
|
2439
|
-
const parent = editorService.get("parent");
|
|
2440
|
-
editorService.select(parent);
|
|
2441
|
-
editorService.get("stage").select(parent.id);
|
|
2442
|
-
});
|
|
2443
|
-
stage.on("changeGuides", (e) => {
|
|
2444
|
-
uiService.set("showGuides", true);
|
|
2445
|
-
if (!root.value || !page.value)
|
|
2446
|
-
return;
|
|
2447
|
-
const storageKey = getGuideLineKey(
|
|
2448
|
-
e.type === StageCore.GuidesType.HORIZONTAL ? H_GUIDE_LINE_STORAGE_KEY : V_GUIDE_LINE_STORAGE_KEY
|
|
2449
|
-
);
|
|
2450
|
-
if (e.guides.length) {
|
|
2451
|
-
globalThis.localStorage.setItem(storageKey, JSON.stringify(e.guides));
|
|
2452
|
-
} else {
|
|
2453
|
-
globalThis.localStorage.removeItem(storageKey);
|
|
2454
|
-
}
|
|
2455
|
-
});
|
|
2456
|
-
return stage;
|
|
2457
|
-
};
|
|
2458
|
-
|
|
2459
|
-
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
2460
|
-
const _hoisted_2$5 = { class: "m-editor-empty-content" };
|
|
2461
|
-
const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2462
|
-
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
2463
|
-
__name: "AddPageBox",
|
|
2464
|
-
setup(__props) {
|
|
2465
|
-
const services = vue.inject("services");
|
|
2466
|
-
const clickHandler = () => {
|
|
2467
|
-
const { editorService } = services || {};
|
|
2468
|
-
if (!editorService)
|
|
2469
|
-
return;
|
|
2470
|
-
editorService.add({
|
|
2471
|
-
type: schema.NodeType.PAGE,
|
|
2472
|
-
name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
|
|
2473
|
-
});
|
|
2474
|
-
};
|
|
2475
|
-
return (_ctx, _cache) => {
|
|
2476
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
2477
|
-
vue.createElementVNode("div", _hoisted_2$5, [
|
|
2478
|
-
vue.createElementVNode("div", {
|
|
2479
|
-
class: "m-editor-empty-button",
|
|
2480
|
-
onClick: clickHandler
|
|
2481
|
-
}, [
|
|
2482
|
-
vue.createElementVNode("div", null, [
|
|
2483
|
-
vue.createVNode(_sfc_main$o, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2484
|
-
]),
|
|
2485
|
-
_hoisted_3$2
|
|
2486
|
-
])
|
|
2487
|
-
])
|
|
2488
|
-
]);
|
|
2489
|
-
};
|
|
2490
|
-
}
|
|
2491
|
-
});
|
|
2492
|
-
|
|
2493
|
-
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
2494
|
-
__name: "Resizer",
|
|
2495
|
-
emits: ["change"],
|
|
2496
|
-
setup(__props, { emit }) {
|
|
2497
|
-
const target = vue.ref();
|
|
2498
|
-
let getso;
|
|
2499
|
-
vue.onMounted(() => {
|
|
2500
|
-
if (!target.value)
|
|
2501
|
-
return;
|
|
2502
|
-
getso = new Gesto__default.default(target.value, {
|
|
2503
|
-
container: window,
|
|
2504
|
-
pinchOutside: true
|
|
2505
|
-
}).on("drag", (e) => {
|
|
2506
|
-
if (!target.value)
|
|
2507
|
-
return;
|
|
2508
|
-
emit("change", e.deltaX);
|
|
2509
|
-
});
|
|
2510
|
-
});
|
|
2511
|
-
vue.onUnmounted(() => {
|
|
2512
|
-
getso?.unset();
|
|
2513
|
-
});
|
|
2514
|
-
return (_ctx, _cache) => {
|
|
2515
|
-
return vue.openBlock(), vue.createElementBlock("span", {
|
|
2516
|
-
ref_key: "target",
|
|
2517
|
-
ref: target,
|
|
2518
|
-
class: "m-editor-resizer"
|
|
2519
|
-
}, [
|
|
2520
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
2521
|
-
], 512);
|
|
2522
|
-
};
|
|
2523
|
-
}
|
|
2524
|
-
});
|
|
2525
|
-
|
|
2526
|
-
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
2527
|
-
__name: "Layout",
|
|
2528
|
-
props: {
|
|
2529
|
-
left: null,
|
|
2530
|
-
right: null,
|
|
2531
|
-
minLeft: { default: 1 },
|
|
2532
|
-
minRight: { default: 1 },
|
|
2533
|
-
leftClass: null,
|
|
2534
|
-
rightClass: null,
|
|
2535
|
-
centerClass: null
|
|
2536
|
-
},
|
|
2537
|
-
emits: ["update:left", "change", "update:right"],
|
|
2538
|
-
setup(__props, { emit }) {
|
|
2539
|
-
const props = __props;
|
|
2540
|
-
const el = vue.ref();
|
|
2541
|
-
let clientWidth = 0;
|
|
2542
|
-
const resizerObserver = new ResizeObserver((entries) => {
|
|
2543
|
-
for (const { contentRect } of entries) {
|
|
2544
|
-
clientWidth = contentRect.width;
|
|
2545
|
-
center.value = clientWidth - (props.left || 0) - (props.right || 0);
|
|
2546
|
-
emit("change", {
|
|
2547
|
-
left: props.left,
|
|
2548
|
-
center: center.value,
|
|
2549
|
-
right: props.right
|
|
2550
|
-
});
|
|
2551
|
-
}
|
|
2552
|
-
});
|
|
2553
|
-
vue.onMounted(() => {
|
|
2554
|
-
if (el.value) {
|
|
2555
|
-
resizerObserver.observe(el.value);
|
|
2556
|
-
}
|
|
2557
|
-
});
|
|
2558
|
-
vue.onUnmounted(() => {
|
|
2559
|
-
resizerObserver.disconnect();
|
|
2560
|
-
});
|
|
2561
|
-
const center = vue.ref(0);
|
|
2562
|
-
const changeLeft = (deltaX) => {
|
|
2563
|
-
if (typeof props.left === "undefined")
|
|
2564
|
-
return;
|
|
2565
|
-
let left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
2566
|
-
emit("update:left", left);
|
|
2567
|
-
if (clientWidth - left - (props.right || 0) <= 0) {
|
|
2568
|
-
left = props.left;
|
|
2642
|
+
stage.mask.setGuides([
|
|
2643
|
+
getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)),
|
|
2644
|
+
getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
|
|
2645
|
+
]);
|
|
2646
|
+
stage.on("select", (el) => {
|
|
2647
|
+
if (`${editorService.get("node")?.id}` === el.id && editorService.get("nodes").length === 1)
|
|
2648
|
+
return;
|
|
2649
|
+
editorService.select(el.id);
|
|
2650
|
+
});
|
|
2651
|
+
stage.on("highlight", (el) => {
|
|
2652
|
+
editorService.highlight(el.id);
|
|
2653
|
+
});
|
|
2654
|
+
stage.on("multi-select", (els) => {
|
|
2655
|
+
editorService.multiSelect(els.map((el) => el.id));
|
|
2656
|
+
});
|
|
2657
|
+
stage.on("update", (ev) => {
|
|
2658
|
+
if (ev.parentEl) {
|
|
2659
|
+
for (const data of ev.data) {
|
|
2660
|
+
editorService.moveToContainer({ id: data.el.id, style: data.style }, ev.parentEl.id);
|
|
2569
2661
|
}
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
editorService.update(ev.data.map((data) => ({ id: data.el.id, style: data.style })));
|
|
2665
|
+
});
|
|
2666
|
+
stage.on("sort", (ev) => {
|
|
2667
|
+
editorService.sort(ev.src, ev.dist);
|
|
2668
|
+
});
|
|
2669
|
+
stage.on("select-parent", () => {
|
|
2670
|
+
const parent = editorService.get("parent");
|
|
2671
|
+
editorService.select(parent);
|
|
2672
|
+
editorService.get("stage").select(parent.id);
|
|
2673
|
+
});
|
|
2674
|
+
stage.on("change-guides", (e) => {
|
|
2675
|
+
uiService.set("showGuides", true);
|
|
2676
|
+
if (!root.value || !page.value)
|
|
2677
|
+
return;
|
|
2678
|
+
const storageKey = getGuideLineKey(
|
|
2679
|
+
e.type === StageCore.GuidesType.HORIZONTAL ? H_GUIDE_LINE_STORAGE_KEY : V_GUIDE_LINE_STORAGE_KEY
|
|
2680
|
+
);
|
|
2681
|
+
if (e.guides.length) {
|
|
2682
|
+
globalThis.localStorage.setItem(storageKey, JSON.stringify(e.guides));
|
|
2683
|
+
} else {
|
|
2684
|
+
globalThis.localStorage.removeItem(storageKey);
|
|
2685
|
+
}
|
|
2686
|
+
});
|
|
2687
|
+
return stage;
|
|
2688
|
+
};
|
|
2689
|
+
|
|
2690
|
+
const _hoisted_1$d = { class: "m-editor-empty-panel" };
|
|
2691
|
+
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
2692
|
+
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2693
|
+
const __default__$l = vue.defineComponent({
|
|
2694
|
+
name: "MEditorAddPageBox"
|
|
2695
|
+
});
|
|
2696
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
2697
|
+
...__default__$l,
|
|
2698
|
+
setup(__props) {
|
|
2699
|
+
const services = vue.inject("services");
|
|
2700
|
+
const clickHandler = () => {
|
|
2701
|
+
const { editorService } = services || {};
|
|
2702
|
+
if (!editorService)
|
|
2579
2703
|
return;
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
right = props.right;
|
|
2584
|
-
}
|
|
2585
|
-
center.value = clientWidth - (props.left || 0) - right;
|
|
2586
|
-
emit("change", {
|
|
2587
|
-
left: props.left,
|
|
2588
|
-
center: center.value,
|
|
2589
|
-
right
|
|
2704
|
+
editorService.add({
|
|
2705
|
+
type: schema.NodeType.PAGE,
|
|
2706
|
+
name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
|
|
2590
2707
|
});
|
|
2591
2708
|
};
|
|
2592
2709
|
return (_ctx, _cache) => {
|
|
2593
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
2594
|
-
|
|
2595
|
-
ref: el,
|
|
2596
|
-
class: "m-editor-layout"
|
|
2597
|
-
}, [
|
|
2598
|
-
typeof props.left !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
2599
|
-
vue.createElementVNode("div", {
|
|
2600
|
-
class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
2601
|
-
style: vue.normalizeStyle(`width: ${__props.left}px`)
|
|
2602
|
-
}, [
|
|
2603
|
-
vue.renderSlot(_ctx.$slots, "left")
|
|
2604
|
-
], 6),
|
|
2605
|
-
vue.createVNode(_sfc_main$m, { onChange: changeLeft })
|
|
2606
|
-
], 64)) : vue.createCommentVNode("", true),
|
|
2607
|
-
vue.createElementVNode("div", {
|
|
2608
|
-
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
2609
|
-
style: vue.normalizeStyle(`width: ${center.value}px`)
|
|
2610
|
-
}, [
|
|
2611
|
-
vue.renderSlot(_ctx.$slots, "center")
|
|
2612
|
-
], 6),
|
|
2613
|
-
typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
2614
|
-
vue.createVNode(_sfc_main$m, { onChange: changeRight }),
|
|
2710
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
|
|
2711
|
+
vue.createElementVNode("div", _hoisted_2$7, [
|
|
2615
2712
|
vue.createElementVNode("div", {
|
|
2616
|
-
class:
|
|
2617
|
-
|
|
2713
|
+
class: "m-editor-empty-button",
|
|
2714
|
+
onClick: clickHandler
|
|
2618
2715
|
}, [
|
|
2619
|
-
vue.
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2716
|
+
vue.createElementVNode("div", null, [
|
|
2717
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2718
|
+
]),
|
|
2719
|
+
_hoisted_3$4
|
|
2720
|
+
])
|
|
2721
|
+
])
|
|
2722
|
+
]);
|
|
2623
2723
|
};
|
|
2624
2724
|
}
|
|
2625
2725
|
});
|
|
2626
2726
|
|
|
2627
|
-
const _hoisted_1$
|
|
2628
|
-
const
|
|
2629
|
-
|
|
2727
|
+
const _hoisted_1$c = { class: "m-editor" };
|
|
2728
|
+
const __default__$k = vue.defineComponent({
|
|
2729
|
+
name: "MEditorFramework"
|
|
2730
|
+
});
|
|
2731
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
2732
|
+
...__default__$k,
|
|
2630
2733
|
props: {
|
|
2631
2734
|
codeOptions: { default: () => ({}) }
|
|
2632
2735
|
},
|
|
@@ -2692,7 +2795,7 @@
|
|
|
2692
2795
|
};
|
|
2693
2796
|
return (_ctx, _cache) => {
|
|
2694
2797
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2695
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2798
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
2696
2799
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2697
2800
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2698
2801
|
key: 0,
|
|
@@ -2700,7 +2803,7 @@
|
|
|
2700
2803
|
"init-values": vue.unref(root),
|
|
2701
2804
|
options: __props.codeOptions,
|
|
2702
2805
|
onSave: saveCode
|
|
2703
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2806
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
2704
2807
|
key: 1,
|
|
2705
2808
|
class: "m-editor-content",
|
|
2706
2809
|
"left-class": "m-editor-framework-left",
|
|
@@ -2719,7 +2822,7 @@
|
|
|
2719
2822
|
]),
|
|
2720
2823
|
center: vue.withCtx(() => [
|
|
2721
2824
|
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2722
|
-
vue.createVNode(_sfc_main$
|
|
2825
|
+
vue.createVNode(_sfc_main$m)
|
|
2723
2826
|
])
|
|
2724
2827
|
]),
|
|
2725
2828
|
_: 2
|
|
@@ -2741,13 +2844,16 @@
|
|
|
2741
2844
|
}
|
|
2742
2845
|
});
|
|
2743
2846
|
|
|
2744
|
-
const _hoisted_1$
|
|
2847
|
+
const _hoisted_1$b = {
|
|
2745
2848
|
key: 1,
|
|
2746
2849
|
class: "menu-item-text"
|
|
2747
2850
|
};
|
|
2748
|
-
const _hoisted_2$
|
|
2749
|
-
const
|
|
2750
|
-
|
|
2851
|
+
const _hoisted_2$6 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2852
|
+
const __default__$j = vue.defineComponent({
|
|
2853
|
+
name: "MEditorToolButton"
|
|
2854
|
+
});
|
|
2855
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
2856
|
+
...__default__$j,
|
|
2751
2857
|
props: {
|
|
2752
2858
|
data: { default: () => ({
|
|
2753
2859
|
type: "text",
|
|
@@ -2822,7 +2928,7 @@
|
|
|
2822
2928
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
2823
2929
|
key: 0,
|
|
2824
2930
|
direction: __props.data.direction || "vertical"
|
|
2825
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2931
|
+
}, 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 }, [
|
|
2826
2932
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
2827
2933
|
key: 0,
|
|
2828
2934
|
effect: "dark",
|
|
@@ -2836,7 +2942,7 @@
|
|
|
2836
2942
|
disabled: vue.unref(disabled)
|
|
2837
2943
|
}, {
|
|
2838
2944
|
default: vue.withCtx(() => [
|
|
2839
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2945
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2840
2946
|
key: 0,
|
|
2841
2947
|
icon: __props.data.icon
|
|
2842
2948
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2853,7 +2959,7 @@
|
|
|
2853
2959
|
disabled: vue.unref(disabled)
|
|
2854
2960
|
}, {
|
|
2855
2961
|
default: vue.withCtx(() => [
|
|
2856
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2962
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2857
2963
|
key: 0,
|
|
2858
2964
|
icon: __props.data.icon
|
|
2859
2965
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2886,7 +2992,7 @@
|
|
|
2886
2992
|
})) : vue.createCommentVNode("", true)
|
|
2887
2993
|
]),
|
|
2888
2994
|
default: vue.withCtx(() => [
|
|
2889
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
2995
|
+
vue.createElementVNode("span", _hoisted_2$6, [
|
|
2890
2996
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
2891
2997
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
2892
2998
|
default: vue.withCtx(() => [
|
|
@@ -2903,8 +3009,11 @@
|
|
|
2903
3009
|
}
|
|
2904
3010
|
});
|
|
2905
3011
|
|
|
2906
|
-
const
|
|
2907
|
-
|
|
3012
|
+
const __default__$i = vue.defineComponent({
|
|
3013
|
+
name: "MEditorNavMenu"
|
|
3014
|
+
});
|
|
3015
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
3016
|
+
...__default__$i,
|
|
2908
3017
|
props: {
|
|
2909
3018
|
data: { default: () => ({}) },
|
|
2910
3019
|
height: { default: 35 }
|
|
@@ -3059,7 +3168,7 @@
|
|
|
3059
3168
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
3060
3169
|
}, [
|
|
3061
3170
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
3062
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3171
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3063
3172
|
data: item,
|
|
3064
3173
|
key: index
|
|
3065
3174
|
}, null, 8, ["data"]);
|
|
@@ -3071,9 +3180,12 @@
|
|
|
3071
3180
|
}
|
|
3072
3181
|
});
|
|
3073
3182
|
|
|
3074
|
-
const _hoisted_1$
|
|
3075
|
-
const
|
|
3076
|
-
|
|
3183
|
+
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
3184
|
+
const __default__$h = vue.defineComponent({
|
|
3185
|
+
name: "MEditorPropsPanel"
|
|
3186
|
+
});
|
|
3187
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
3188
|
+
...__default__$h,
|
|
3077
3189
|
emits: ["mounted"],
|
|
3078
3190
|
setup(__props, { expose, emit }) {
|
|
3079
3191
|
const internalInstance = vue.getCurrentInstance();
|
|
@@ -3082,7 +3194,9 @@
|
|
|
3082
3194
|
const curFormConfig = vue.ref([]);
|
|
3083
3195
|
const services = vue.inject("services");
|
|
3084
3196
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3085
|
-
const propsPanelSize = vue.computed(
|
|
3197
|
+
const propsPanelSize = vue.computed(
|
|
3198
|
+
() => services?.uiService.get("propsPanelSize") || "small"
|
|
3199
|
+
);
|
|
3086
3200
|
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
3087
3201
|
const init = async () => {
|
|
3088
3202
|
if (!node.value) {
|
|
@@ -3098,6 +3212,9 @@
|
|
|
3098
3212
|
vue.onMounted(() => {
|
|
3099
3213
|
emit("mounted", internalInstance);
|
|
3100
3214
|
});
|
|
3215
|
+
vue.onUnmounted(() => {
|
|
3216
|
+
services?.propsService.off("props-configs-change", init);
|
|
3217
|
+
});
|
|
3101
3218
|
vue.watchEffect(() => {
|
|
3102
3219
|
if (configForm.value && stage.value) {
|
|
3103
3220
|
configForm.value.formState.stage = stage.value;
|
|
@@ -3115,10 +3232,9 @@
|
|
|
3115
3232
|
};
|
|
3116
3233
|
expose({ submit });
|
|
3117
3234
|
return (_ctx, _cache) => {
|
|
3118
|
-
|
|
3119
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
|
|
3235
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
3120
3236
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3121
|
-
vue.createVNode(
|
|
3237
|
+
vue.createVNode(vue.unref(form.MForm), {
|
|
3122
3238
|
ref_key: "configForm",
|
|
3123
3239
|
ref: configForm,
|
|
3124
3240
|
class: vue.normalizeClass(`m-editor-props-panel ${vue.unref(propsPanelSize)}`),
|
|
@@ -3133,43 +3249,328 @@
|
|
|
3133
3249
|
}
|
|
3134
3250
|
});
|
|
3135
3251
|
|
|
3136
|
-
const _hoisted_1$
|
|
3137
|
-
|
|
3138
|
-
const _hoisted_3$1 = { class: "code-name" };
|
|
3139
|
-
const _hoisted_4$1 = { class: "code-name-wrapper" };
|
|
3140
|
-
const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3141
|
-
const _hoisted_6$1 = { class: "m-editor-wrapper" };
|
|
3142
|
-
const _hoisted_7$1 = {
|
|
3143
|
-
key: 1,
|
|
3252
|
+
const _hoisted_1$9 = {
|
|
3253
|
+
key: 0,
|
|
3144
3254
|
class: "m-editor-content-bottom"
|
|
3145
3255
|
};
|
|
3146
|
-
const
|
|
3147
|
-
const
|
|
3148
|
-
const
|
|
3149
|
-
key:
|
|
3256
|
+
const _hoisted_2$5 = /* @__PURE__ */ vue.createTextVNode("\u4FDD\u5B58");
|
|
3257
|
+
const _hoisted_3$3 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3258
|
+
const _hoisted_4$2 = {
|
|
3259
|
+
key: 1,
|
|
3150
3260
|
class: "m-editor-content-bottom"
|
|
3151
3261
|
};
|
|
3152
|
-
const
|
|
3262
|
+
const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3263
|
+
const __default__$g = vue.defineComponent({
|
|
3264
|
+
name: "MEditorCodeDraftEditor"
|
|
3265
|
+
});
|
|
3266
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
3267
|
+
...__default__$g,
|
|
3268
|
+
props: {
|
|
3269
|
+
id: null,
|
|
3270
|
+
content: null,
|
|
3271
|
+
editable: { type: Boolean, default: true },
|
|
3272
|
+
autoSaveDraft: { type: Boolean, default: true },
|
|
3273
|
+
codeOptions: null,
|
|
3274
|
+
language: null
|
|
3275
|
+
},
|
|
3276
|
+
emits: ["save", "close", "saveAndClose"],
|
|
3277
|
+
setup(__props, { emit }) {
|
|
3278
|
+
const props = __props;
|
|
3279
|
+
const services = vue.inject("services");
|
|
3280
|
+
const codeContent = vue.ref("");
|
|
3281
|
+
const editorContent = vue.ref("");
|
|
3282
|
+
const codeEditor = vue.ref();
|
|
3283
|
+
const originCodeContent = vue.ref("");
|
|
3284
|
+
const isFullScreen = vue.ref(false);
|
|
3285
|
+
const codeOptions = vue.computed(() => ({
|
|
3286
|
+
...props.codeOptions,
|
|
3287
|
+
readOnly: !props.editable
|
|
3288
|
+
}));
|
|
3289
|
+
vue.watchEffect(() => {
|
|
3290
|
+
codeContent.value = props.content;
|
|
3291
|
+
if (!originCodeContent.value) {
|
|
3292
|
+
originCodeContent.value = codeContent.value;
|
|
3293
|
+
}
|
|
3294
|
+
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3295
|
+
if (codeDraft) {
|
|
3296
|
+
codeContent.value = codeDraft;
|
|
3297
|
+
}
|
|
3298
|
+
});
|
|
3299
|
+
const saveCodeDraft = async (codeValue) => {
|
|
3300
|
+
if (!props.autoSaveDraft)
|
|
3301
|
+
return;
|
|
3302
|
+
if (originCodeContent.value === codeValue) {
|
|
3303
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3304
|
+
return;
|
|
3305
|
+
}
|
|
3306
|
+
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3307
|
+
design.tMagicMessage.success(`\u4EE3\u7801\u8349\u7A3F\u4FDD\u5B58\u6210\u529F ${utils.datetimeFormatter(new Date())}`);
|
|
3308
|
+
};
|
|
3309
|
+
const saveCode = () => {
|
|
3310
|
+
if (!codeEditor.value || !props.editable)
|
|
3311
|
+
return;
|
|
3312
|
+
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3313
|
+
emit("save", editorContent.value);
|
|
3314
|
+
};
|
|
3315
|
+
const saveAndClose = () => {
|
|
3316
|
+
if (!codeEditor.value || !props.editable)
|
|
3317
|
+
return;
|
|
3318
|
+
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3319
|
+
emit("saveAndClose", editorContent.value);
|
|
3320
|
+
};
|
|
3321
|
+
const close = async () => {
|
|
3322
|
+
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3323
|
+
if (codeDraft) {
|
|
3324
|
+
design.tMagicMessageBox.confirm("\u60A8\u6709\u4EE3\u7801\u4FEE\u6539\u672A\u4FDD\u5B58\uFF0C\u662F\u5426\u4FDD\u5B58\u540E\u518D\u5173\u95ED\uFF1F", "\u63D0\u793A", {
|
|
3325
|
+
confirmButtonText: "\u786E\u8BA4",
|
|
3326
|
+
cancelButtonText: "\u53D6\u6D88",
|
|
3327
|
+
type: "warning"
|
|
3328
|
+
}).then(async () => {
|
|
3329
|
+
saveAndClose();
|
|
3330
|
+
}).catch(() => {
|
|
3331
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3332
|
+
emit("close");
|
|
3333
|
+
});
|
|
3334
|
+
} else {
|
|
3335
|
+
emit("close");
|
|
3336
|
+
}
|
|
3337
|
+
};
|
|
3338
|
+
const toggleFullScreen = () => {
|
|
3339
|
+
isFullScreen.value = !isFullScreen.value;
|
|
3340
|
+
if (codeEditor.value) {
|
|
3341
|
+
codeEditor.value.focus();
|
|
3342
|
+
}
|
|
3343
|
+
};
|
|
3344
|
+
return (_ctx, _cache) => {
|
|
3345
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3346
|
+
class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3347
|
+
}, [
|
|
3348
|
+
vue.createVNode(_sfc_main$q, {
|
|
3349
|
+
ref_key: "codeEditor",
|
|
3350
|
+
ref: codeEditor,
|
|
3351
|
+
class: "m-editor-container",
|
|
3352
|
+
"init-values": `${codeContent.value}`,
|
|
3353
|
+
onSave: saveCodeDraft,
|
|
3354
|
+
language: __props.language,
|
|
3355
|
+
options: vue.unref(codeOptions)
|
|
3356
|
+
}, null, 8, ["init-values", "language", "options"]),
|
|
3357
|
+
__props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
|
|
3358
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3359
|
+
type: "primary",
|
|
3360
|
+
class: "button",
|
|
3361
|
+
onClick: toggleFullScreen
|
|
3362
|
+
}, {
|
|
3363
|
+
default: vue.withCtx(() => [
|
|
3364
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F"), 1)
|
|
3365
|
+
]),
|
|
3366
|
+
_: 1
|
|
3367
|
+
}),
|
|
3368
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3369
|
+
type: "primary",
|
|
3370
|
+
class: "button",
|
|
3371
|
+
onClick: saveCode
|
|
3372
|
+
}, {
|
|
3373
|
+
default: vue.withCtx(() => [
|
|
3374
|
+
_hoisted_2$5
|
|
3375
|
+
]),
|
|
3376
|
+
_: 1
|
|
3377
|
+
}),
|
|
3378
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3379
|
+
type: "primary",
|
|
3380
|
+
class: "button",
|
|
3381
|
+
onClick: close
|
|
3382
|
+
}, {
|
|
3383
|
+
default: vue.withCtx(() => [
|
|
3384
|
+
_hoisted_3$3
|
|
3385
|
+
]),
|
|
3386
|
+
_: 1
|
|
3387
|
+
})
|
|
3388
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, [
|
|
3389
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3390
|
+
type: "primary",
|
|
3391
|
+
class: "button",
|
|
3392
|
+
onClick: toggleFullScreen
|
|
3393
|
+
}, {
|
|
3394
|
+
default: vue.withCtx(() => [
|
|
3395
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F"), 1)
|
|
3396
|
+
]),
|
|
3397
|
+
_: 1
|
|
3398
|
+
}),
|
|
3399
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3400
|
+
type: "primary",
|
|
3401
|
+
class: "button",
|
|
3402
|
+
onClick: close
|
|
3403
|
+
}, {
|
|
3404
|
+
default: vue.withCtx(() => [
|
|
3405
|
+
_hoisted_5$1
|
|
3406
|
+
]),
|
|
3407
|
+
_: 1
|
|
3408
|
+
})
|
|
3409
|
+
]))
|
|
3410
|
+
], 2);
|
|
3411
|
+
};
|
|
3412
|
+
}
|
|
3413
|
+
});
|
|
3414
|
+
|
|
3415
|
+
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3416
|
+
const _hoisted_2$4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3417
|
+
const _hoisted_3$2 = { class: "code-name-wrapper" };
|
|
3418
|
+
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u53C2\u6570\u5B9A\u4E49", -1);
|
|
3419
|
+
const __default__$f = vue.defineComponent({
|
|
3420
|
+
name: "MEditorFunctionEditor"
|
|
3421
|
+
});
|
|
3153
3422
|
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
3154
|
-
|
|
3423
|
+
...__default__$f,
|
|
3424
|
+
props: {
|
|
3425
|
+
id: null,
|
|
3426
|
+
name: null,
|
|
3427
|
+
content: null,
|
|
3428
|
+
editable: { type: Boolean, default: true },
|
|
3429
|
+
autoSaveDraft: { type: Boolean, default: true },
|
|
3430
|
+
codeOptions: null
|
|
3431
|
+
},
|
|
3432
|
+
emits: ["change", "field-input"],
|
|
3433
|
+
setup(__props, { emit }) {
|
|
3434
|
+
const props = __props;
|
|
3435
|
+
const tableConfig = {
|
|
3436
|
+
border: true,
|
|
3437
|
+
enableFullscreen: false,
|
|
3438
|
+
name: "params",
|
|
3439
|
+
maxHeight: "150px",
|
|
3440
|
+
items: [
|
|
3441
|
+
{
|
|
3442
|
+
type: "text",
|
|
3443
|
+
label: "\u53C2\u6570\u540D",
|
|
3444
|
+
name: "name"
|
|
3445
|
+
}
|
|
3446
|
+
]
|
|
3447
|
+
};
|
|
3448
|
+
const services = vue.inject("services");
|
|
3449
|
+
const codeName = vue.ref("");
|
|
3450
|
+
const codeContent = vue.ref("");
|
|
3451
|
+
const evalRes = vue.ref(true);
|
|
3452
|
+
vue.provide("mForm", {
|
|
3453
|
+
$emit: emit,
|
|
3454
|
+
setField: () => {
|
|
3455
|
+
}
|
|
3456
|
+
});
|
|
3457
|
+
const tableModel = vue.ref();
|
|
3458
|
+
vue.watchEffect(() => {
|
|
3459
|
+
codeName.value = props.name;
|
|
3460
|
+
codeContent.value = props.content;
|
|
3461
|
+
});
|
|
3462
|
+
const initTableModel = () => {
|
|
3463
|
+
const codeDsl = services?.codeBlockService.getCodeDslSync();
|
|
3464
|
+
if (!codeDsl)
|
|
3465
|
+
return;
|
|
3466
|
+
tableModel.value = {
|
|
3467
|
+
params: codeDsl[props.id]?.params || []
|
|
3468
|
+
};
|
|
3469
|
+
};
|
|
3470
|
+
initTableModel();
|
|
3471
|
+
const beforeSave = (codeValue) => {
|
|
3472
|
+
try {
|
|
3473
|
+
eval(codeValue);
|
|
3474
|
+
return true;
|
|
3475
|
+
} catch (e) {
|
|
3476
|
+
design.tMagicMessage.error(e.stack);
|
|
3477
|
+
return false;
|
|
3478
|
+
}
|
|
3479
|
+
};
|
|
3480
|
+
const saveCode = async (codeValue2) => {
|
|
3481
|
+
if (!props.editable)
|
|
3482
|
+
return;
|
|
3483
|
+
evalRes.value = beforeSave(codeValue2);
|
|
3484
|
+
if (evalRes.value) {
|
|
3485
|
+
await services?.codeBlockService.setCodeDslById(props.id, {
|
|
3486
|
+
name: codeName.value,
|
|
3487
|
+
content: codeValue2,
|
|
3488
|
+
params: tableModel.value?.params || []
|
|
3489
|
+
});
|
|
3490
|
+
design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3491
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3492
|
+
}
|
|
3493
|
+
};
|
|
3494
|
+
const saveAndClose = async (codeValue2) => {
|
|
3495
|
+
await saveCode(codeValue2);
|
|
3496
|
+
if (evalRes.value) {
|
|
3497
|
+
close();
|
|
3498
|
+
}
|
|
3499
|
+
};
|
|
3500
|
+
const close = () => {
|
|
3501
|
+
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3502
|
+
};
|
|
3503
|
+
return (_ctx, _cache) => {
|
|
3504
|
+
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
3505
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
3506
|
+
header: vue.withCtx(() => [
|
|
3507
|
+
vue.createElementVNode("div", _hoisted_1$8, [
|
|
3508
|
+
_hoisted_2$4,
|
|
3509
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3510
|
+
class: "code-name-input",
|
|
3511
|
+
modelValue: codeName.value,
|
|
3512
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => codeName.value = $event),
|
|
3513
|
+
disabled: !__props.editable
|
|
3514
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
3515
|
+
]),
|
|
3516
|
+
vue.createElementVNode("div", _hoisted_3$2, [
|
|
3517
|
+
_hoisted_4$1,
|
|
3518
|
+
vue.createVNode(_component_m_form_table, {
|
|
3519
|
+
style: { "width": "320px" },
|
|
3520
|
+
config: tableConfig,
|
|
3521
|
+
model: tableModel.value,
|
|
3522
|
+
enableToggleMode: false,
|
|
3523
|
+
name: "params",
|
|
3524
|
+
prop: "params",
|
|
3525
|
+
size: "small"
|
|
3526
|
+
}, null, 8, ["model"])
|
|
3527
|
+
])
|
|
3528
|
+
]),
|
|
3529
|
+
default: vue.withCtx(() => [
|
|
3530
|
+
vue.createVNode(_sfc_main$h, {
|
|
3531
|
+
id: __props.id,
|
|
3532
|
+
content: codeContent.value,
|
|
3533
|
+
editable: __props.editable,
|
|
3534
|
+
autoSaveDraft: __props.autoSaveDraft,
|
|
3535
|
+
codeOptions: __props.codeOptions,
|
|
3536
|
+
language: "javascript",
|
|
3537
|
+
onSave: saveCode,
|
|
3538
|
+
onSaveAndClose: saveAndClose,
|
|
3539
|
+
onClose: close
|
|
3540
|
+
}, null, 8, ["id", "content", "editable", "autoSaveDraft", "codeOptions"])
|
|
3541
|
+
]),
|
|
3542
|
+
_: 1
|
|
3543
|
+
});
|
|
3544
|
+
};
|
|
3545
|
+
}
|
|
3546
|
+
});
|
|
3547
|
+
|
|
3548
|
+
const _hoisted_1$7 = ["id"];
|
|
3549
|
+
const _hoisted_2$3 = { class: "list-item" };
|
|
3550
|
+
const _hoisted_3$1 = { class: "code-name" };
|
|
3551
|
+
const __default__$e = vue.defineComponent({
|
|
3552
|
+
name: "MEditorCodeBlockEditor"
|
|
3553
|
+
});
|
|
3554
|
+
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
3555
|
+
...__default__$e,
|
|
3155
3556
|
setup(__props) {
|
|
3156
3557
|
const services = vue.inject("services");
|
|
3157
|
-
const
|
|
3558
|
+
const codeOptions = vue.inject("codeOptions", {});
|
|
3158
3559
|
const left = vue.ref(200);
|
|
3159
3560
|
const currentTitle = vue.ref("");
|
|
3160
3561
|
const codeConfig = vue.ref(null);
|
|
3161
3562
|
const state = vue.reactive({
|
|
3162
3563
|
codeList: []
|
|
3163
3564
|
});
|
|
3164
|
-
const isShowCodeBlockEditor = vue.computed(
|
|
3165
|
-
() => codeConfig.value && services?.codeBlockService.getCodeEditorShowStatus() || false
|
|
3166
|
-
);
|
|
3167
3565
|
const mode = vue.computed(() => services?.codeBlockService.getMode());
|
|
3168
3566
|
const id = vue.computed(() => services?.codeBlockService.getId() || "");
|
|
3169
3567
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3170
3568
|
const selectedIds = vue.computed(() => services?.codeBlockService.getCombineIds() || []);
|
|
3171
3569
|
vue.watchEffect(async () => {
|
|
3172
|
-
codeConfig.value = await services?.codeBlockService.getCodeContentById(id.value) || null;
|
|
3570
|
+
codeConfig.value = lodashEs.cloneDeep(await services?.codeBlockService.getCodeContentById(id.value)) || null;
|
|
3571
|
+
if (!codeConfig.value)
|
|
3572
|
+
return;
|
|
3573
|
+
codeConfig.value.content = serializeConfig(codeConfig.value.content);
|
|
3173
3574
|
});
|
|
3174
3575
|
vue.watchEffect(async () => {
|
|
3175
3576
|
const codeDsl = await services?.codeBlockService.getCodeDslByIds(selectedIds.value) || null;
|
|
@@ -3184,47 +3585,24 @@
|
|
|
3184
3585
|
});
|
|
3185
3586
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3186
3587
|
});
|
|
3187
|
-
const saveCode = async () => {
|
|
3188
|
-
if (!codeEditor.value || !codeConfig.value || !editable.value)
|
|
3189
|
-
return true;
|
|
3190
|
-
try {
|
|
3191
|
-
const codeContent = codeEditor.value.getEditor()?.getValue();
|
|
3192
|
-
codeConfig.value.content = eval(codeContent);
|
|
3193
|
-
} catch (e) {
|
|
3194
|
-
design.tMagicMessage.error(e.stack);
|
|
3195
|
-
return false;
|
|
3196
|
-
}
|
|
3197
|
-
await services?.codeBlockService.setCodeDslById(id.value, {
|
|
3198
|
-
name: codeConfig.value.name,
|
|
3199
|
-
content: codeConfig.value.content
|
|
3200
|
-
});
|
|
3201
|
-
design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3202
|
-
return true;
|
|
3203
|
-
};
|
|
3204
|
-
const saveAndClose = async () => {
|
|
3205
|
-
const saveRes = await saveCode();
|
|
3206
|
-
if (saveRes) {
|
|
3207
|
-
await services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3208
|
-
}
|
|
3209
|
-
};
|
|
3210
3588
|
const selectHandler = (data) => {
|
|
3211
3589
|
services?.codeBlockService.setId(data.id);
|
|
3212
3590
|
currentTitle.value = data.name;
|
|
3213
3591
|
};
|
|
3214
3592
|
return (_ctx, _cache) => {
|
|
3215
3593
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDialog), {
|
|
3216
|
-
|
|
3217
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
|
|
3594
|
+
"model-value": true,
|
|
3218
3595
|
class: "code-editor-dialog",
|
|
3219
3596
|
title: currentTitle.value,
|
|
3220
3597
|
fullscreen: true,
|
|
3221
|
-
"
|
|
3222
|
-
"append-to-body": true
|
|
3598
|
+
"close-on-press-escape": false,
|
|
3599
|
+
"append-to-body": true,
|
|
3600
|
+
"show-close": false
|
|
3223
3601
|
}, {
|
|
3224
3602
|
default: vue.withCtx(() => [
|
|
3225
|
-
vue.createVNode(_sfc_main$
|
|
3603
|
+
vue.createVNode(_sfc_main$o, {
|
|
3226
3604
|
left: left.value,
|
|
3227
|
-
"onUpdate:left": _cache[
|
|
3605
|
+
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3228
3606
|
"min-left": 45,
|
|
3229
3607
|
class: "code-editor-layout"
|
|
3230
3608
|
}, vue.createSlots({
|
|
@@ -3236,72 +3614,15 @@
|
|
|
3236
3614
|
])
|
|
3237
3615
|
}, [
|
|
3238
3616
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
disabled: !vue.unref(editable)
|
|
3249
|
-
}, null, 8, ["modelValue", "disabled"])) : vue.createCommentVNode("", true)
|
|
3250
|
-
])
|
|
3251
|
-
]),
|
|
3252
|
-
default: vue.withCtx(() => [
|
|
3253
|
-
vue.createElementVNode("div", _hoisted_6$1, [
|
|
3254
|
-
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
3255
|
-
key: 0,
|
|
3256
|
-
ref_key: "codeEditor",
|
|
3257
|
-
ref: codeEditor,
|
|
3258
|
-
class: "m-editor-container",
|
|
3259
|
-
"init-values": `${codeConfig.value.content}`,
|
|
3260
|
-
onSave: saveCode,
|
|
3261
|
-
options: {
|
|
3262
|
-
tabSize: 2,
|
|
3263
|
-
fontSize: 16,
|
|
3264
|
-
formatOnPaste: true,
|
|
3265
|
-
readOnly: !vue.unref(editable)
|
|
3266
|
-
}
|
|
3267
|
-
}, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
|
|
3268
|
-
vue.unref(editable) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
|
|
3269
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3270
|
-
type: "primary",
|
|
3271
|
-
class: "button",
|
|
3272
|
-
onClick: saveCode
|
|
3273
|
-
}, {
|
|
3274
|
-
default: vue.withCtx(() => [
|
|
3275
|
-
_hoisted_8$1
|
|
3276
|
-
]),
|
|
3277
|
-
_: 1
|
|
3278
|
-
}),
|
|
3279
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3280
|
-
type: "primary",
|
|
3281
|
-
class: "button",
|
|
3282
|
-
onClick: saveAndClose
|
|
3283
|
-
}, {
|
|
3284
|
-
default: vue.withCtx(() => [
|
|
3285
|
-
_hoisted_9$1
|
|
3286
|
-
]),
|
|
3287
|
-
_: 1
|
|
3288
|
-
})
|
|
3289
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
|
|
3290
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3291
|
-
type: "primary",
|
|
3292
|
-
class: "button",
|
|
3293
|
-
onClick: saveAndClose
|
|
3294
|
-
}, {
|
|
3295
|
-
default: vue.withCtx(() => [
|
|
3296
|
-
_hoisted_11
|
|
3297
|
-
]),
|
|
3298
|
-
_: 1
|
|
3299
|
-
})
|
|
3300
|
-
]))
|
|
3301
|
-
])
|
|
3302
|
-
]),
|
|
3303
|
-
_: 1
|
|
3304
|
-
})
|
|
3617
|
+
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$g, {
|
|
3618
|
+
key: 0,
|
|
3619
|
+
id: vue.unref(id),
|
|
3620
|
+
name: codeConfig.value.name,
|
|
3621
|
+
content: codeConfig.value.content,
|
|
3622
|
+
editable: !!vue.unref(editable),
|
|
3623
|
+
autoSaveDraft: vue.unref(mode) === vue.unref(CodeEditorMode).EDITOR,
|
|
3624
|
+
codeOptions: vue.unref(codeOptions)
|
|
3625
|
+
}, null, 8, ["id", "name", "content", "editable", "autoSaveDraft", "codeOptions"])) : vue.createCommentVNode("", true)
|
|
3305
3626
|
], 2)) : vue.createCommentVNode("", true)
|
|
3306
3627
|
]),
|
|
3307
3628
|
_: 2
|
|
@@ -3336,7 +3657,7 @@
|
|
|
3336
3657
|
]), 1032, ["left"])
|
|
3337
3658
|
]),
|
|
3338
3659
|
_: 3
|
|
3339
|
-
}, 8, ["
|
|
3660
|
+
}, 8, ["title"]);
|
|
3340
3661
|
};
|
|
3341
3662
|
}
|
|
3342
3663
|
});
|
|
@@ -3363,8 +3684,11 @@
|
|
|
3363
3684
|
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"
|
|
3364
3685
|
})
|
|
3365
3686
|
], -1);
|
|
3366
|
-
const
|
|
3367
|
-
|
|
3687
|
+
const __default__$d = vue.defineComponent({
|
|
3688
|
+
name: "MEditorCodeBlockList"
|
|
3689
|
+
});
|
|
3690
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
3691
|
+
...__default__$d,
|
|
3368
3692
|
props: {
|
|
3369
3693
|
customError: null
|
|
3370
3694
|
},
|
|
@@ -3372,41 +3696,38 @@
|
|
|
3372
3696
|
const props = __props;
|
|
3373
3697
|
const services = vue.inject("services");
|
|
3374
3698
|
const state = vue.reactive({
|
|
3375
|
-
codeList: []
|
|
3376
|
-
bindComps: {}
|
|
3699
|
+
codeList: []
|
|
3377
3700
|
});
|
|
3378
3701
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3379
|
-
const
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
const
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
id: compId,
|
|
3389
|
-
name: getCompName(compId)
|
|
3702
|
+
const isShowCodeBlockEditor = vue.computed(() => services?.codeBlockService.getCodeEditorShowStatus() || false);
|
|
3703
|
+
const codeCombineInfo = vue.ref(null);
|
|
3704
|
+
const getBindCompsByCodeId = (codeId) => {
|
|
3705
|
+
if (!codeCombineInfo.value || !codeCombineInfo.value[codeId])
|
|
3706
|
+
return [];
|
|
3707
|
+
const bindCompsId = Object.keys(codeCombineInfo.value[codeId]);
|
|
3708
|
+
return bindCompsId.map((compId) => ({
|
|
3709
|
+
compId,
|
|
3710
|
+
compName: getCompName(compId)
|
|
3390
3711
|
}));
|
|
3391
|
-
state.bindComps[codeId] = compsInfo;
|
|
3392
3712
|
};
|
|
3393
3713
|
const initList = async () => {
|
|
3394
|
-
const codeDsl = await services?.codeBlockService.getCodeDsl() || null;
|
|
3395
|
-
|
|
3714
|
+
const codeDsl = lodashEs.cloneDeep(await services?.codeBlockService.getCodeDsl()) || null;
|
|
3715
|
+
codeCombineInfo.value = lodashEs.cloneDeep(services?.codeBlockService.getCombineInfo()) || null;
|
|
3716
|
+
if (!codeDsl || !codeCombineInfo.value)
|
|
3396
3717
|
return;
|
|
3397
3718
|
state.codeList = [];
|
|
3398
3719
|
lodashEs.forIn(codeDsl, (value, codeId) => {
|
|
3399
|
-
getBindCompsByCodeId(codeId, value);
|
|
3400
3720
|
state.codeList.push({
|
|
3401
3721
|
id: codeId,
|
|
3402
3722
|
name: value.name,
|
|
3403
3723
|
codeBlockContent: value,
|
|
3404
|
-
showRelation: true
|
|
3724
|
+
showRelation: true,
|
|
3725
|
+
combineInfo: getBindCompsByCodeId(codeId)
|
|
3405
3726
|
});
|
|
3406
3727
|
});
|
|
3407
3728
|
};
|
|
3408
3729
|
vue.watch(
|
|
3409
|
-
() => services?.codeBlockService.
|
|
3730
|
+
[() => services?.codeBlockService.getCodeDslSync(), () => services?.codeBlockService.refreshCombineInfo()],
|
|
3410
3731
|
() => {
|
|
3411
3732
|
initList();
|
|
3412
3733
|
},
|
|
@@ -3415,20 +3736,6 @@
|
|
|
3415
3736
|
deep: true
|
|
3416
3737
|
}
|
|
3417
3738
|
);
|
|
3418
|
-
vue.watch(
|
|
3419
|
-
() => services?.editorService.get("node"),
|
|
3420
|
-
(curNode) => {
|
|
3421
|
-
if (!curNode?.id)
|
|
3422
|
-
return;
|
|
3423
|
-
lodashEs.forIn(state.bindComps, (bindCompInfo) => {
|
|
3424
|
-
bindCompInfo.forEach((comp) => {
|
|
3425
|
-
if (comp.id === curNode.id) {
|
|
3426
|
-
comp.name = curNode.name;
|
|
3427
|
-
}
|
|
3428
|
-
});
|
|
3429
|
-
});
|
|
3430
|
-
}
|
|
3431
|
-
);
|
|
3432
3739
|
const createCodeBlock = async () => {
|
|
3433
3740
|
const { codeBlockService } = services || {};
|
|
3434
3741
|
if (!codeBlockService) {
|
|
@@ -3437,9 +3744,10 @@
|
|
|
3437
3744
|
}
|
|
3438
3745
|
const codeConfig = {
|
|
3439
3746
|
name: "\u4EE3\u7801\u5757",
|
|
3440
|
-
content: `() => {
|
|
3747
|
+
content: `({app, params}) => {
|
|
3441
3748
|
// place your code here
|
|
3442
|
-
}
|
|
3749
|
+
}`,
|
|
3750
|
+
params: []
|
|
3443
3751
|
};
|
|
3444
3752
|
await codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3445
3753
|
const id = await codeBlockService.getUniqueId();
|
|
@@ -3451,7 +3759,8 @@
|
|
|
3451
3759
|
services?.codeBlockService.setCodeEditorContent(true, key);
|
|
3452
3760
|
};
|
|
3453
3761
|
const deleteCode = (key) => {
|
|
3454
|
-
const
|
|
3762
|
+
const currentCode = state.codeList.find((codeItem) => codeItem.id === key);
|
|
3763
|
+
const existBinds = !lodashEs.isEmpty(currentCode?.combineInfo);
|
|
3455
3764
|
const undeleteableList = services?.codeBlockService.getUndeletableList() || [];
|
|
3456
3765
|
if (!existBinds && !undeleteableList.includes(key)) {
|
|
3457
3766
|
services?.codeBlockService.deleteCodeDslByIds([key]);
|
|
@@ -3517,110 +3826,118 @@
|
|
|
3517
3826
|
})) : vue.createCommentVNode("", true)
|
|
3518
3827
|
])
|
|
3519
3828
|
]),
|
|
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
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3829
|
+
vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
|
|
3830
|
+
default: vue.withCtx(() => [
|
|
3831
|
+
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
3832
|
+
key: 0,
|
|
3833
|
+
ref_key: "tree",
|
|
3834
|
+
ref: tree,
|
|
3835
|
+
"node-key": "id",
|
|
3836
|
+
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3837
|
+
data: state.codeList,
|
|
3838
|
+
"highlight-current": true,
|
|
3839
|
+
"filter-node-method": filterNode,
|
|
3840
|
+
onNodeClick: toggleCombineRelation
|
|
3841
|
+
}, {
|
|
3842
|
+
default: vue.withCtx(({ data }) => [
|
|
3843
|
+
vue.createElementVNode("div", {
|
|
3844
|
+
id: data.id,
|
|
3845
|
+
class: "list-container"
|
|
3846
|
+
}, [
|
|
3847
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
3848
|
+
vue.createElementVNode("span", _hoisted_6, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1),
|
|
3849
|
+
vue.createElementVNode("div", _hoisted_7, [
|
|
3850
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
3851
|
+
effect: "dark",
|
|
3852
|
+
content: vue.unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
|
|
3853
|
+
placement: "bottom"
|
|
3854
|
+
}, {
|
|
3855
|
+
default: vue.withCtx(() => [
|
|
3856
|
+
vue.createVNode(_sfc_main$n, {
|
|
3857
|
+
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3858
|
+
class: "edit-icon",
|
|
3859
|
+
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
3860
|
+
}, null, 8, ["icon", "onClick"])
|
|
3861
|
+
]),
|
|
3862
|
+
_: 2
|
|
3863
|
+
}, 1032, ["content"]),
|
|
3864
|
+
data.combineInfo && data.combineInfo.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3865
|
+
key: 0,
|
|
3866
|
+
effect: "dark",
|
|
3867
|
+
content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
|
|
3868
|
+
placement: "bottom"
|
|
3869
|
+
}, {
|
|
3870
|
+
default: vue.withCtx(() => [
|
|
3871
|
+
vue.createVNode(_sfc_main$n, {
|
|
3872
|
+
icon: vue.unref(iconsVue.Link),
|
|
3873
|
+
class: "edit-icon",
|
|
3874
|
+
onClick: vue.withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
3875
|
+
}, null, 8, ["icon", "onClick"])
|
|
3876
|
+
]),
|
|
3877
|
+
_: 2
|
|
3878
|
+
}, 1024)) : vue.createCommentVNode("", true),
|
|
3879
|
+
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3880
|
+
key: 1,
|
|
3881
|
+
effect: "dark",
|
|
3882
|
+
content: "\u5220\u9664",
|
|
3883
|
+
placement: "bottom"
|
|
3884
|
+
}, {
|
|
3885
|
+
default: vue.withCtx(() => [
|
|
3886
|
+
vue.createVNode(_sfc_main$n, {
|
|
3887
|
+
icon: vue.unref(iconsVue.Close),
|
|
3888
|
+
class: "edit-icon",
|
|
3889
|
+
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
3890
|
+
}, null, 8, ["icon", "onClick"])
|
|
3891
|
+
]),
|
|
3892
|
+
_: 2
|
|
3893
|
+
}, 1024)) : vue.createCommentVNode("", true),
|
|
3894
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
3895
|
+
id: data.id,
|
|
3896
|
+
data: data.codeBlockContent
|
|
3897
|
+
})
|
|
3898
|
+
])
|
|
3899
|
+
]),
|
|
3900
|
+
data.showRelation && data.combineInfo && data.combineInfo.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
3901
|
+
_hoisted_9,
|
|
3902
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.combineInfo, (comp, index) => {
|
|
3903
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3904
|
+
key: index,
|
|
3905
|
+
class: "code-comp",
|
|
3906
|
+
size: "small",
|
|
3907
|
+
plain: true,
|
|
3908
|
+
onClick: vue.withModifiers(($event) => selectComp(comp.compId), ["stop"])
|
|
3909
|
+
}, {
|
|
3910
|
+
default: vue.withCtx(() => [
|
|
3911
|
+
vue.createTextVNode(vue.toDisplayString(comp.compName), 1)
|
|
3912
|
+
]),
|
|
3913
|
+
_: 2
|
|
3914
|
+
}, 1032, ["onClick"]);
|
|
3915
|
+
}), 128))
|
|
3916
|
+
])) : vue.createCommentVNode("", true)
|
|
3917
|
+
], 8, _hoisted_4)
|
|
3588
3918
|
]),
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(state.bindComps[data.id], (comp, index) => {
|
|
3592
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3593
|
-
key: index,
|
|
3594
|
-
class: "code-comp",
|
|
3595
|
-
size: "small",
|
|
3596
|
-
plain: true,
|
|
3597
|
-
onClick: vue.withModifiers(($event) => selectComp(comp.id), ["stop"])
|
|
3598
|
-
}, {
|
|
3599
|
-
default: vue.withCtx(() => [
|
|
3600
|
-
vue.createTextVNode(vue.toDisplayString(comp.name), 1)
|
|
3601
|
-
]),
|
|
3602
|
-
_: 2
|
|
3603
|
-
}, 1032, ["onClick"]);
|
|
3604
|
-
}), 128))
|
|
3605
|
-
])) : vue.createCommentVNode("", true)
|
|
3606
|
-
], 8, _hoisted_4)
|
|
3919
|
+
_: 3
|
|
3920
|
+
}, 8, ["data"])) : vue.createCommentVNode("", true)
|
|
3607
3921
|
]),
|
|
3608
3922
|
_: 3
|
|
3609
|
-
}
|
|
3610
|
-
vue.
|
|
3923
|
+
}),
|
|
3924
|
+
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, { key: 0 }, {
|
|
3611
3925
|
"code-block-edit-panel-header": vue.withCtx(({ id }) => [
|
|
3612
3926
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
3613
3927
|
]),
|
|
3614
3928
|
_: 3
|
|
3615
|
-
})
|
|
3929
|
+
})) : vue.createCommentVNode("", true)
|
|
3616
3930
|
]);
|
|
3617
3931
|
};
|
|
3618
3932
|
}
|
|
3619
3933
|
});
|
|
3620
3934
|
|
|
3621
3935
|
const _hoisted_1$5 = ["onClick", "onDragstart"];
|
|
3622
|
-
const
|
|
3623
|
-
|
|
3936
|
+
const __default__$c = vue.defineComponent({
|
|
3937
|
+
name: "MEditorComponentListPanel"
|
|
3938
|
+
});
|
|
3939
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
3940
|
+
...__default__$c,
|
|
3624
3941
|
setup(__props) {
|
|
3625
3942
|
const searchText = vue.ref("");
|
|
3626
3943
|
const services = vue.inject("services");
|
|
@@ -3709,7 +4026,7 @@
|
|
|
3709
4026
|
name: `${index}`
|
|
3710
4027
|
}, {
|
|
3711
4028
|
title: vue.withCtx(() => [
|
|
3712
|
-
vue.createVNode(_sfc_main$
|
|
4029
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
3713
4030
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
3714
4031
|
]),
|
|
3715
4032
|
default: vue.withCtx(() => [
|
|
@@ -3724,7 +4041,7 @@
|
|
|
3724
4041
|
onDrag: dragHandler
|
|
3725
4042
|
}, [
|
|
3726
4043
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
3727
|
-
vue.createVNode(_sfc_main$
|
|
4044
|
+
vue.createVNode(_sfc_main$n, {
|
|
3728
4045
|
icon: item.icon
|
|
3729
4046
|
}, null, 8, ["icon"]),
|
|
3730
4047
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
@@ -3755,8 +4072,11 @@
|
|
|
3755
4072
|
}
|
|
3756
4073
|
});
|
|
3757
4074
|
|
|
3758
|
-
const
|
|
3759
|
-
|
|
4075
|
+
const __default__$b = vue.defineComponent({
|
|
4076
|
+
name: "MEditorContentMenu"
|
|
4077
|
+
});
|
|
4078
|
+
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
4079
|
+
...__default__$b,
|
|
3760
4080
|
props: {
|
|
3761
4081
|
menuData: { default: () => [] },
|
|
3762
4082
|
isSubMenu: { type: Boolean, default: false }
|
|
@@ -3835,7 +4155,7 @@
|
|
|
3835
4155
|
});
|
|
3836
4156
|
return (_ctx, _cache) => {
|
|
3837
4157
|
const _component_content_menu = vue.resolveComponent("content-menu", true);
|
|
3838
|
-
return __props.menuData.length
|
|
4158
|
+
return __props.menuData.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
3839
4159
|
key: 0,
|
|
3840
4160
|
class: "magic-editor-content-menu",
|
|
3841
4161
|
ref_key: "menu",
|
|
@@ -3844,7 +4164,7 @@
|
|
|
3844
4164
|
}, [
|
|
3845
4165
|
vue.createElementVNode("div", null, [
|
|
3846
4166
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
3847
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4167
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3848
4168
|
"event-type": "mouseup",
|
|
3849
4169
|
data: item,
|
|
3850
4170
|
key: index,
|
|
@@ -3863,21 +4183,29 @@
|
|
|
3863
4183
|
onHide: hide
|
|
3864
4184
|
}, null, 8, ["menu-data"])
|
|
3865
4185
|
]))
|
|
3866
|
-
], 4))
|
|
4186
|
+
], 4)), [
|
|
4187
|
+
[vue.vShow, visible.value]
|
|
4188
|
+
]) : vue.createCommentVNode("", true);
|
|
3867
4189
|
};
|
|
3868
4190
|
}
|
|
3869
4191
|
});
|
|
3870
4192
|
|
|
3871
|
-
const
|
|
3872
|
-
|
|
4193
|
+
const __default__$a = vue.defineComponent({
|
|
4194
|
+
name: "MEditorLayerMenu"
|
|
4195
|
+
});
|
|
4196
|
+
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
4197
|
+
...__default__$a,
|
|
4198
|
+
props: {
|
|
4199
|
+
layerContentMenu: null
|
|
4200
|
+
},
|
|
3873
4201
|
setup(__props, { expose }) {
|
|
4202
|
+
const props = __props;
|
|
3874
4203
|
const services = vue.inject("services");
|
|
3875
4204
|
const menu = vue.ref();
|
|
3876
4205
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3877
4206
|
const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
|
|
3878
4207
|
const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
|
|
3879
4208
|
const componentList = vue.computed(() => services?.componentListService.getList() || []);
|
|
3880
|
-
const layerContentMenu = vue.inject("layerContentMenu", []);
|
|
3881
4209
|
const createMenuItems = (group) => group.items.map((component) => ({
|
|
3882
4210
|
text: component.text,
|
|
3883
4211
|
type: "button",
|
|
@@ -3932,7 +4260,7 @@
|
|
|
3932
4260
|
{
|
|
3933
4261
|
type: "button",
|
|
3934
4262
|
text: "\u590D\u5236",
|
|
3935
|
-
icon: vue.markRaw(iconsVue.
|
|
4263
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
3936
4264
|
display: () => !isRoot.value,
|
|
3937
4265
|
handler: () => {
|
|
3938
4266
|
node.value && services?.editorService.copy(node.value);
|
|
@@ -3947,7 +4275,7 @@
|
|
|
3947
4275
|
node.value && services?.editorService.remove(node.value);
|
|
3948
4276
|
}
|
|
3949
4277
|
},
|
|
3950
|
-
...layerContentMenu
|
|
4278
|
+
...props.layerContentMenu
|
|
3951
4279
|
]);
|
|
3952
4280
|
const show = (e) => {
|
|
3953
4281
|
menu.value?.show(e);
|
|
@@ -3956,7 +4284,7 @@
|
|
|
3956
4284
|
show
|
|
3957
4285
|
});
|
|
3958
4286
|
return (_ctx, _cache) => {
|
|
3959
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4287
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$c, {
|
|
3960
4288
|
"menu-data": vue.unref(menuData),
|
|
3961
4289
|
ref_key: "menu",
|
|
3962
4290
|
ref: menu,
|
|
@@ -3967,27 +4295,42 @@
|
|
|
3967
4295
|
});
|
|
3968
4296
|
|
|
3969
4297
|
const _hoisted_1$4 = ["id", "onMouseenter"];
|
|
3970
|
-
const
|
|
3971
|
-
|
|
4298
|
+
const __default__$9 = vue.defineComponent({
|
|
4299
|
+
name: "MEditorLayerPanel"
|
|
4300
|
+
});
|
|
4301
|
+
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
4302
|
+
...__default__$9,
|
|
4303
|
+
props: {
|
|
4304
|
+
layerContentMenu: null
|
|
4305
|
+
},
|
|
3972
4306
|
setup(__props) {
|
|
3973
4307
|
const throttleTime = 150;
|
|
3974
4308
|
const services = vue.inject("services");
|
|
4309
|
+
const editorService = services?.editorService;
|
|
3975
4310
|
const tree = vue.ref();
|
|
3976
4311
|
const menu = vue.ref();
|
|
3977
|
-
const
|
|
4312
|
+
const checkedKeys = vue.ref([]);
|
|
4313
|
+
const isCtrlKeyDown = vue.ref(false);
|
|
4314
|
+
const filterText = vue.ref("");
|
|
4315
|
+
const expandedKeys = vue.ref([]);
|
|
4316
|
+
const currentNodeKey = vue.ref();
|
|
4317
|
+
const clicked = vue.ref(false);
|
|
4318
|
+
const treeProps = {
|
|
4319
|
+
children: "items",
|
|
4320
|
+
disabled: (data) => Boolean(data.items?.length),
|
|
4321
|
+
class: (data) => {
|
|
4322
|
+
if (clicked.value || utils.isPage(data))
|
|
4323
|
+
return "";
|
|
4324
|
+
if (data.id === highlightNode?.value?.id && !checkedKeys.value.includes(data.id)) {
|
|
4325
|
+
return "cus-tree-node-hover";
|
|
4326
|
+
}
|
|
4327
|
+
}
|
|
4328
|
+
};
|
|
4329
|
+
const isMultiSelect = vue.computed(() => isCtrlKeyDown.value || checkedKeys.value.length > 1);
|
|
4330
|
+
const nodes = vue.computed(() => editorService?.get("nodes") || []);
|
|
3978
4331
|
const page = vue.computed(() => editorService?.get("page"));
|
|
3979
4332
|
const values = vue.computed(() => page.value ? [page.value] : []);
|
|
3980
|
-
const
|
|
3981
|
-
const selectedIds = vue.computed(() => selectedNodes.value.map((node) => node.id));
|
|
3982
|
-
const isMultiSelectStatus = vue.ref(false);
|
|
3983
|
-
const spliceNodeKey = vue.ref();
|
|
3984
|
-
const filterText = vue.ref("");
|
|
3985
|
-
const defaultExpandedKeys = vue.computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
|
|
3986
|
-
editorService?.on("remove", () => {
|
|
3987
|
-
setTimeout(() => {
|
|
3988
|
-
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
3989
|
-
}, 0);
|
|
3990
|
-
});
|
|
4333
|
+
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
3991
4334
|
const select = async (data) => {
|
|
3992
4335
|
if (!data.id) {
|
|
3993
4336
|
throw new Error("\u6CA1\u6709id");
|
|
@@ -4006,7 +4349,6 @@
|
|
|
4006
4349
|
editorService?.highlight(data);
|
|
4007
4350
|
editorService?.get("stage")?.highlight(data.id);
|
|
4008
4351
|
};
|
|
4009
|
-
const expandedKeys = /* @__PURE__ */ new Map();
|
|
4010
4352
|
const allowDrop = (draggingNode, dropNode, type) => {
|
|
4011
4353
|
const { data } = dropNode || {};
|
|
4012
4354
|
const { data: ingData } = draggingNode;
|
|
@@ -4038,23 +4380,18 @@
|
|
|
4038
4380
|
const [page2] = data;
|
|
4039
4381
|
editorService?.update(page2);
|
|
4040
4382
|
};
|
|
4041
|
-
const loadItems = (node, resolve) => {
|
|
4042
|
-
if (Array.isArray(node.data)) {
|
|
4043
|
-
return resolve(node.data);
|
|
4044
|
-
}
|
|
4045
|
-
if (Array.isArray(node.data?.items)) {
|
|
4046
|
-
return resolve(node.data?.items);
|
|
4047
|
-
}
|
|
4048
|
-
resolve([]);
|
|
4049
|
-
};
|
|
4050
4383
|
const handleCollapse = (data) => {
|
|
4051
|
-
expandedKeys.
|
|
4384
|
+
expandedKeys.value = expandedKeys.value.filter((id) => id !== data.id);
|
|
4052
4385
|
};
|
|
4053
4386
|
const handleExpand = (data) => {
|
|
4054
|
-
|
|
4055
|
-
|
|
4387
|
+
if (!page.value) {
|
|
4388
|
+
expandedKeys.value = [];
|
|
4056
4389
|
return;
|
|
4057
|
-
|
|
4390
|
+
}
|
|
4391
|
+
expandedKeys.value = lodashEs.union(
|
|
4392
|
+
expandedKeys.value,
|
|
4393
|
+
utils.getNodePath(data.id, [page.value]).map((node) => node.id)
|
|
4394
|
+
);
|
|
4058
4395
|
};
|
|
4059
4396
|
const filterNode = (value, data) => {
|
|
4060
4397
|
if (!value) {
|
|
@@ -4071,121 +4408,78 @@
|
|
|
4071
4408
|
const filterTextChangeHandler = (val) => {
|
|
4072
4409
|
tree.value?.filter(val);
|
|
4073
4410
|
};
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
tree.value.getNode(key)?.expand();
|
|
4087
|
-
});
|
|
4088
|
-
};
|
|
4089
|
-
vue.watch(
|
|
4090
|
-
() => editorService?.get("nodes"),
|
|
4091
|
-
(nodes) => {
|
|
4092
|
-
selectedNodes.value = nodes ?? [];
|
|
4411
|
+
vue.watch(nodes, (nodes2) => {
|
|
4412
|
+
const ids = nodes2?.map((node) => node.id) || [];
|
|
4413
|
+
const idsLength = ids.length;
|
|
4414
|
+
const checkedKeysLength = checkedKeys.value.length;
|
|
4415
|
+
if (lodashEs.difference(
|
|
4416
|
+
idsLength > checkedKeysLength ? ids : checkedKeys.value,
|
|
4417
|
+
idsLength > checkedKeysLength ? checkedKeys.value : ids
|
|
4418
|
+
).length) {
|
|
4419
|
+
tree.value?.setCheckedKeys([], false);
|
|
4420
|
+
[currentNodeKey.value] = ids;
|
|
4421
|
+
checkedKeys.value = ids.filter((id) => id !== page.value?.id);
|
|
4422
|
+
expandedKeys.value = lodashEs.union(expandedKeys.value, ids);
|
|
4093
4423
|
}
|
|
4094
|
-
);
|
|
4095
|
-
|
|
4096
|
-
if (!
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
tree.value.setCheckedKeys([]);
|
|
4100
|
-
tree.value.setCurrentKey();
|
|
4101
|
-
} else if (selectedIds.value.length === 1 && !isMultiSelectStatus.value) {
|
|
4102
|
-
tree.value.setCurrentKey(selectedIds.value[0], true);
|
|
4103
|
-
tree.value.setCheckedKeys([]);
|
|
4104
|
-
} else {
|
|
4105
|
-
tree.value.setCheckedKeys(selectedIds.value);
|
|
4106
|
-
tree.value.setCurrentKey();
|
|
4424
|
+
});
|
|
4425
|
+
vue.watch(isMultiSelect, (isMultiSelect2) => {
|
|
4426
|
+
if (!isMultiSelect2) {
|
|
4427
|
+
currentNodeKey.value = editorService?.get("node").id;
|
|
4428
|
+
tree.value?.setCurrentKey(currentNodeKey.value);
|
|
4107
4429
|
}
|
|
4108
|
-
};
|
|
4109
|
-
vue.watch([selectedIds, tree], async () => {
|
|
4110
|
-
if (!tree.value || !editorService)
|
|
4111
|
-
return;
|
|
4112
|
-
const parent = editorService.get("parent");
|
|
4113
|
-
if (!parent?.id)
|
|
4114
|
-
return;
|
|
4115
|
-
const treeNode = tree.value.getNode(parent.id);
|
|
4116
|
-
treeNode?.updateChildren();
|
|
4117
|
-
await expandNodes();
|
|
4118
|
-
setTreeKeyStatus();
|
|
4119
4430
|
});
|
|
4120
|
-
const
|
|
4121
|
-
|
|
4431
|
+
const editorServiceRemoveHandler = () => {
|
|
4432
|
+
setTimeout(() => {
|
|
4433
|
+
tree.value?.getNode(editorService?.get("node").id)?.updateChildren();
|
|
4434
|
+
}, 0);
|
|
4435
|
+
};
|
|
4436
|
+
const windowBlurHandler = () => {
|
|
4437
|
+
isCtrlKeyDown.value = false;
|
|
4438
|
+
};
|
|
4439
|
+
let keycon;
|
|
4440
|
+
vue.onMounted(() => {
|
|
4441
|
+
editorService?.on("remove", editorServiceRemoveHandler);
|
|
4442
|
+
keycon = new KeyController__default.default();
|
|
4122
4443
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4123
4444
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4124
|
-
keycon.
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
})
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
keycon.value.keyup(ctrl, (e) => {
|
|
4133
|
-
e.inputEvent.preventDefault();
|
|
4134
|
-
isMultiSelectStatus.value = false;
|
|
4445
|
+
keycon.keydown((e) => {
|
|
4446
|
+
if (e.key !== ctrl) {
|
|
4447
|
+
isCtrlKeyDown.value = false;
|
|
4448
|
+
}
|
|
4449
|
+
}).keydown(ctrl, () => {
|
|
4450
|
+
isCtrlKeyDown.value = true;
|
|
4451
|
+
}).keyup(ctrl, () => {
|
|
4452
|
+
isCtrlKeyDown.value = false;
|
|
4135
4453
|
});
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
4454
|
+
globalThis.addEventListener("blur", windowBlurHandler);
|
|
4455
|
+
});
|
|
4456
|
+
vue.onUnmounted(() => {
|
|
4457
|
+
keycon.destroy();
|
|
4458
|
+
editorService?.off("remove", editorServiceRemoveHandler);
|
|
4459
|
+
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
4460
|
+
});
|
|
4144
4461
|
const highlightHandler = lodashEs.throttle((data) => {
|
|
4145
4462
|
highlight(data);
|
|
4146
4463
|
}, throttleTime);
|
|
4147
4464
|
const toggleClickFlag = () => {
|
|
4148
4465
|
clicked.value = !clicked.value;
|
|
4149
4466
|
};
|
|
4150
|
-
const
|
|
4151
|
-
if (
|
|
4152
|
-
|
|
4153
|
-
return data.id === highlightNode?.value?.id && !selectedIds.value.includes(data.id) && spliceNodeKey.value !== data.id;
|
|
4154
|
-
};
|
|
4155
|
-
vue.watch(isMultiSelectStatus, () => {
|
|
4156
|
-
if (isMultiSelectStatus.value && selectedNodes.value.length === 1 && selectedNodes.value[0].type === schema.NodeType.PAGE) {
|
|
4157
|
-
selectedNodes.value = [];
|
|
4158
|
-
}
|
|
4159
|
-
});
|
|
4160
|
-
const multiClickHandler = (data) => {
|
|
4161
|
-
if (!data?.id) {
|
|
4162
|
-
throw new Error("\u6CA1\u6709id");
|
|
4163
|
-
}
|
|
4164
|
-
if (data.type === schema.NodeType.PAGE) {
|
|
4165
|
-
tree.value?.setCheckedKeys([]);
|
|
4166
|
-
return;
|
|
4167
|
-
}
|
|
4168
|
-
const index = selectedNodes.value.findIndex((node) => node.id === data.id);
|
|
4169
|
-
if (index !== -1) {
|
|
4170
|
-
selectedNodes.value.splice(index, 1);
|
|
4171
|
-
spliceNodeKey.value = data.id;
|
|
4467
|
+
const checkHandler = (data, { checkedNodes }) => {
|
|
4468
|
+
if (checkedNodes.length > 0) {
|
|
4469
|
+
multiSelect(checkedNodes.map((node) => node.id));
|
|
4172
4470
|
} else {
|
|
4173
|
-
|
|
4471
|
+
multiSelect(nodes.value.map((node) => node.id));
|
|
4174
4472
|
}
|
|
4175
|
-
tree.value?.setCheckedKeys(selectedIds.value);
|
|
4176
|
-
multiSelect(selectedIds.value);
|
|
4177
4473
|
};
|
|
4178
4474
|
const clickHandler = (data) => {
|
|
4179
|
-
if (
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
}
|
|
4184
|
-
|
|
4185
|
-
select(data);
|
|
4186
|
-
} else {
|
|
4187
|
-
multiClickHandler(data);
|
|
4475
|
+
if (isCtrlKeyDown.value) {
|
|
4476
|
+
return;
|
|
4477
|
+
}
|
|
4478
|
+
if (services?.uiService.get("uiSelectMode")) {
|
|
4479
|
+
document.dispatchEvent(new CustomEvent("ui-select", { detail: data }));
|
|
4480
|
+
return;
|
|
4188
4481
|
}
|
|
4482
|
+
select(data);
|
|
4189
4483
|
};
|
|
4190
4484
|
const contextmenu = async (event, data) => {
|
|
4191
4485
|
event.preventDefault();
|
|
@@ -4193,11 +4487,7 @@
|
|
|
4193
4487
|
menu.value?.show(event);
|
|
4194
4488
|
};
|
|
4195
4489
|
return (_ctx, _cache) => {
|
|
4196
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), {
|
|
4197
|
-
class: "magic-editor-layer-panel",
|
|
4198
|
-
onMouseenter: addSelectModeListener,
|
|
4199
|
-
onMouseleave: removeSelectModeListener
|
|
4200
|
-
}, {
|
|
4490
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4201
4491
|
default: vue.withCtx(() => [
|
|
4202
4492
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4203
4493
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
@@ -4218,30 +4508,30 @@
|
|
|
4218
4508
|
"node-key": "id",
|
|
4219
4509
|
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4220
4510
|
draggable: "",
|
|
4221
|
-
"default-expanded-keys":
|
|
4222
|
-
|
|
4511
|
+
"default-expanded-keys": expandedKeys.value,
|
|
4512
|
+
"default-checked-keys": checkedKeys.value,
|
|
4513
|
+
"current-node-key": currentNodeKey.value,
|
|
4223
4514
|
data: vue.unref(values),
|
|
4224
4515
|
"expand-on-click-node": false,
|
|
4225
|
-
"highlight-current":
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
},
|
|
4516
|
+
"highlight-current": !vue.unref(isMultiSelect),
|
|
4517
|
+
"check-on-click-node": true,
|
|
4518
|
+
props: treeProps,
|
|
4229
4519
|
"filter-node-method": filterNode,
|
|
4230
4520
|
"allow-drop": allowDrop,
|
|
4231
|
-
"show-checkbox":
|
|
4521
|
+
"show-checkbox": vue.unref(isMultiSelect),
|
|
4232
4522
|
onNodeClick: clickHandler,
|
|
4233
4523
|
onNodeContextmenu: contextmenu,
|
|
4234
4524
|
onNodeDragEnd: handleDragEnd,
|
|
4235
4525
|
onNodeCollapse: handleCollapse,
|
|
4236
4526
|
onNodeExpand: handleExpand,
|
|
4237
|
-
onCheck:
|
|
4527
|
+
onCheck: checkHandler,
|
|
4238
4528
|
onMousedown: toggleClickFlag,
|
|
4239
4529
|
onMouseup: toggleClickFlag
|
|
4240
4530
|
}, {
|
|
4241
4531
|
default: vue.withCtx(({ node, data }) => [
|
|
4242
4532
|
vue.createElementVNode("div", {
|
|
4533
|
+
class: "cus-tree-node",
|
|
4243
4534
|
id: data.id,
|
|
4244
|
-
class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4245
4535
|
onMouseenter: ($event) => vue.unref(highlightHandler)(data)
|
|
4246
4536
|
}, [
|
|
4247
4537
|
vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
@@ -4250,15 +4540,16 @@
|
|
|
4250
4540
|
}, () => [
|
|
4251
4541
|
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4252
4542
|
])
|
|
4253
|
-
],
|
|
4543
|
+
], 40, _hoisted_1$4)
|
|
4254
4544
|
]),
|
|
4255
4545
|
_: 3
|
|
4256
|
-
}, 8, ["default-expanded-keys", "data", "show-checkbox"])) : vue.createCommentVNode("", true),
|
|
4546
|
+
}, 8, ["default-expanded-keys", "default-checked-keys", "current-node-key", "data", "highlight-current", "show-checkbox"])) : vue.createCommentVNode("", true),
|
|
4257
4547
|
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4258
|
-
vue.createVNode(_sfc_main$
|
|
4548
|
+
vue.createVNode(_sfc_main$b, {
|
|
4259
4549
|
ref_key: "menu",
|
|
4260
|
-
ref: menu
|
|
4261
|
-
|
|
4550
|
+
ref: menu,
|
|
4551
|
+
"layer-content-menu": __props.layerContentMenu
|
|
4552
|
+
}, null, 8, ["layer-content-menu"])
|
|
4262
4553
|
]))
|
|
4263
4554
|
]),
|
|
4264
4555
|
_: 3
|
|
@@ -4271,143 +4562,52 @@
|
|
|
4271
4562
|
key: 1,
|
|
4272
4563
|
class: "magic-editor-tab-panel-title"
|
|
4273
4564
|
};
|
|
4274
|
-
const
|
|
4275
|
-
|
|
4276
|
-
props: {
|
|
4277
|
-
data: null
|
|
4278
|
-
},
|
|
4279
|
-
setup(__props) {
|
|
4280
|
-
const props = __props;
|
|
4281
|
-
const config = vue.computed(() => {
|
|
4282
|
-
if (typeof props.data !== "string") {
|
|
4283
|
-
return props.data;
|
|
4284
|
-
}
|
|
4285
|
-
switch (props.data) {
|
|
4286
|
-
case "component-list":
|
|
4287
|
-
return {
|
|
4288
|
-
type: "component",
|
|
4289
|
-
icon: iconsVue.Coin,
|
|
4290
|
-
text: "\u7EC4\u4EF6",
|
|
4291
|
-
component: _sfc_main$e,
|
|
4292
|
-
slots: {}
|
|
4293
|
-
};
|
|
4294
|
-
case "layer":
|
|
4295
|
-
return {
|
|
4296
|
-
type: "component",
|
|
4297
|
-
icon: iconsVue.Files,
|
|
4298
|
-
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4299
|
-
component: _sfc_main$b,
|
|
4300
|
-
slots: {}
|
|
4301
|
-
};
|
|
4302
|
-
case "code-block":
|
|
4303
|
-
return {
|
|
4304
|
-
type: "component",
|
|
4305
|
-
icon: iconsVue.EditPen,
|
|
4306
|
-
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4307
|
-
component: _sfc_main$f,
|
|
4308
|
-
slots: {}
|
|
4309
|
-
};
|
|
4310
|
-
default:
|
|
4311
|
-
return void 0;
|
|
4312
|
-
}
|
|
4313
|
-
});
|
|
4314
|
-
return (_ctx, _cache) => {
|
|
4315
|
-
return vue.unref(config) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabPane), {
|
|
4316
|
-
key: 0,
|
|
4317
|
-
name: vue.unref(config).text
|
|
4318
|
-
}, {
|
|
4319
|
-
label: vue.withCtx(() => [
|
|
4320
|
-
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4321
|
-
key: vue.unref(config).text
|
|
4322
|
-
}, [
|
|
4323
|
-
vue.unref(config).icon ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
4324
|
-
key: 0,
|
|
4325
|
-
icon: vue.unref(config).icon
|
|
4326
|
-
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4327
|
-
vue.unref(config).text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(vue.unref(config).text), 1)) : vue.createCommentVNode("", true)
|
|
4328
|
-
]))
|
|
4329
|
-
]),
|
|
4330
|
-
default: vue.withCtx(() => [
|
|
4331
|
-
(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 }, [
|
|
4332
|
-
__props.data === "component-list" || vue.unref(config).slots?.componentListPanelHeader ? {
|
|
4333
|
-
name: "component-list-panel-header",
|
|
4334
|
-
fn: vue.withCtx(() => [
|
|
4335
|
-
__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)
|
|
4336
|
-
])
|
|
4337
|
-
} : void 0,
|
|
4338
|
-
__props.data === "component-list" || vue.unref(config).slots?.componentListItem ? {
|
|
4339
|
-
name: "component-list-item",
|
|
4340
|
-
fn: vue.withCtx(({ component }) => [
|
|
4341
|
-
__props.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
|
|
4342
|
-
key: 0,
|
|
4343
|
-
component
|
|
4344
|
-
}) : vue.unref(config).slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.componentListItem), {
|
|
4345
|
-
key: 1,
|
|
4346
|
-
component
|
|
4347
|
-
}, null, 8, ["component"])) : vue.createCommentVNode("", true)
|
|
4348
|
-
])
|
|
4349
|
-
} : void 0,
|
|
4350
|
-
__props.data === "layer" || vue.unref(config).slots?.layerPanelHeader ? {
|
|
4351
|
-
name: "layer-panel-header",
|
|
4352
|
-
fn: vue.withCtx(() => [
|
|
4353
|
-
__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)
|
|
4354
|
-
])
|
|
4355
|
-
} : void 0,
|
|
4356
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockPanelHeader ? {
|
|
4357
|
-
name: "code-block-panel-header",
|
|
4358
|
-
fn: vue.withCtx(() => [
|
|
4359
|
-
__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)
|
|
4360
|
-
])
|
|
4361
|
-
} : void 0,
|
|
4362
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockPanelTool ? {
|
|
4363
|
-
name: "code-block-panel-tool",
|
|
4364
|
-
fn: vue.withCtx(({ id, data }) => [
|
|
4365
|
-
data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4366
|
-
key: 0,
|
|
4367
|
-
id,
|
|
4368
|
-
data
|
|
4369
|
-
}) : vue.unref(config).slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4370
|
-
])
|
|
4371
|
-
} : void 0,
|
|
4372
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockEditPanelHeader ? {
|
|
4373
|
-
name: "code-block-edit-panel-header",
|
|
4374
|
-
fn: vue.withCtx(({ id }) => [
|
|
4375
|
-
__props.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4376
|
-
key: 0,
|
|
4377
|
-
id
|
|
4378
|
-
}) : vue.unref(config).slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4379
|
-
])
|
|
4380
|
-
} : void 0,
|
|
4381
|
-
__props.data === "layer" || vue.unref(config).slots?.layerNodeContent ? {
|
|
4382
|
-
name: "layer-node-content",
|
|
4383
|
-
fn: vue.withCtx(({ data: nodeData, node }) => [
|
|
4384
|
-
__props.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4385
|
-
key: 0,
|
|
4386
|
-
data: nodeData,
|
|
4387
|
-
node
|
|
4388
|
-
}) : vue.unref(config).slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.layerNodeContent), {
|
|
4389
|
-
key: 1,
|
|
4390
|
-
data: nodeData,
|
|
4391
|
-
node
|
|
4392
|
-
}, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
|
|
4393
|
-
])
|
|
4394
|
-
} : void 0
|
|
4395
|
-
]), 1040))
|
|
4396
|
-
]),
|
|
4397
|
-
_: 3
|
|
4398
|
-
}, 8, ["name"])) : vue.createCommentVNode("", true);
|
|
4399
|
-
};
|
|
4400
|
-
}
|
|
4565
|
+
const __default__$8 = vue.defineComponent({
|
|
4566
|
+
name: "MEditorSidebar"
|
|
4401
4567
|
});
|
|
4402
|
-
|
|
4403
4568
|
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
4404
|
-
|
|
4569
|
+
...__default__$8,
|
|
4405
4570
|
props: {
|
|
4406
|
-
data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) }
|
|
4571
|
+
data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) },
|
|
4572
|
+
layerContentMenu: null
|
|
4407
4573
|
},
|
|
4408
4574
|
setup(__props, { expose }) {
|
|
4409
4575
|
const props = __props;
|
|
4576
|
+
const uiComponent = design.getConfig("components").tabPane;
|
|
4410
4577
|
const activeTabName = vue.ref(props.data?.status);
|
|
4578
|
+
const getItemConfig = (data) => {
|
|
4579
|
+
const map = {
|
|
4580
|
+
"component-list": {
|
|
4581
|
+
$key: "component-list",
|
|
4582
|
+
type: "component",
|
|
4583
|
+
icon: iconsVue.Coin,
|
|
4584
|
+
text: "\u7EC4\u4EF6",
|
|
4585
|
+
component: _sfc_main$d,
|
|
4586
|
+
slots: {}
|
|
4587
|
+
},
|
|
4588
|
+
layer: {
|
|
4589
|
+
$key: "layer",
|
|
4590
|
+
type: "component",
|
|
4591
|
+
icon: iconsVue.Files,
|
|
4592
|
+
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4593
|
+
props: {
|
|
4594
|
+
layerContentMenu: props.layerContentMenu
|
|
4595
|
+
},
|
|
4596
|
+
component: _sfc_main$a,
|
|
4597
|
+
slots: {}
|
|
4598
|
+
},
|
|
4599
|
+
"code-block": {
|
|
4600
|
+
$key: "code-block",
|
|
4601
|
+
type: "component",
|
|
4602
|
+
icon: iconsVue.EditPen,
|
|
4603
|
+
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4604
|
+
component: _sfc_main$e,
|
|
4605
|
+
slots: {}
|
|
4606
|
+
}
|
|
4607
|
+
};
|
|
4608
|
+
return typeof data === "string" ? map[data] : data;
|
|
4609
|
+
};
|
|
4610
|
+
const sideBarItems = vue.computed(() => props.data.items.map((item) => getItemConfig(item)));
|
|
4411
4611
|
vue.watch(
|
|
4412
4612
|
() => props.data.status,
|
|
4413
4613
|
(status) => {
|
|
@@ -4427,60 +4627,91 @@
|
|
|
4427
4627
|
"tab-position": "left"
|
|
4428
4628
|
}, {
|
|
4429
4629
|
default: vue.withCtx(() => [
|
|
4430
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
4431
|
-
return vue.openBlock(), vue.createBlock(
|
|
4630
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(sideBarItems), (config, index) => {
|
|
4631
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(uiComponent).component), {
|
|
4432
4632
|
key: index,
|
|
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
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4633
|
+
name: config.text
|
|
4634
|
+
}, {
|
|
4635
|
+
label: vue.withCtx(() => [
|
|
4636
|
+
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4637
|
+
key: config.text
|
|
4638
|
+
}, [
|
|
4639
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
4640
|
+
key: 0,
|
|
4641
|
+
icon: config.icon
|
|
4642
|
+
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4643
|
+
config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
|
|
4644
|
+
]))
|
|
4645
|
+
]),
|
|
4646
|
+
default: vue.withCtx(() => [
|
|
4647
|
+
config ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({ key: 0 }, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
|
|
4648
|
+
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
4649
|
+
name: "component-list-panel-header",
|
|
4650
|
+
fn: vue.withCtx(() => [
|
|
4651
|
+
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)
|
|
4652
|
+
])
|
|
4653
|
+
} : void 0,
|
|
4654
|
+
config.$key === "component-list" || config.slots?.componentListItem ? {
|
|
4655
|
+
name: "component-list-item",
|
|
4656
|
+
fn: vue.withCtx(({ component }) => [
|
|
4657
|
+
config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
|
|
4658
|
+
key: 0,
|
|
4659
|
+
component
|
|
4660
|
+
}) : config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListItem), {
|
|
4661
|
+
key: 1,
|
|
4662
|
+
component
|
|
4663
|
+
}, null, 8, ["component"])) : vue.createCommentVNode("", true)
|
|
4664
|
+
])
|
|
4665
|
+
} : void 0,
|
|
4666
|
+
config.$key === "layer" || config.slots?.layerPanelHeader ? {
|
|
4667
|
+
name: "layer-panel-header",
|
|
4668
|
+
fn: vue.withCtx(() => [
|
|
4669
|
+
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)
|
|
4670
|
+
])
|
|
4671
|
+
} : void 0,
|
|
4672
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
|
|
4673
|
+
name: "code-block-panel-header",
|
|
4674
|
+
fn: vue.withCtx(() => [
|
|
4675
|
+
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)
|
|
4676
|
+
])
|
|
4677
|
+
} : void 0,
|
|
4678
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
4679
|
+
name: "code-block-panel-tool",
|
|
4680
|
+
fn: vue.withCtx(({ id, data }) => [
|
|
4681
|
+
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4682
|
+
key: 0,
|
|
4683
|
+
id,
|
|
4684
|
+
data
|
|
4685
|
+
}) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4686
|
+
])
|
|
4687
|
+
} : void 0,
|
|
4688
|
+
config.$key === "code-block" || config.slots?.codeBlockEditPanelHeader ? {
|
|
4689
|
+
name: "code-block-edit-panel-header",
|
|
4690
|
+
fn: vue.withCtx(({ id }) => [
|
|
4691
|
+
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4692
|
+
key: 0,
|
|
4693
|
+
id
|
|
4694
|
+
}) : config.slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4695
|
+
])
|
|
4696
|
+
} : void 0,
|
|
4697
|
+
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
4698
|
+
name: "layer-node-content",
|
|
4699
|
+
fn: vue.withCtx(({ data: nodeData, node }) => [
|
|
4700
|
+
config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4701
|
+
key: 0,
|
|
4702
|
+
data: nodeData,
|
|
4703
|
+
node
|
|
4704
|
+
}) : config.slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
4705
|
+
key: 1,
|
|
4706
|
+
data: nodeData,
|
|
4707
|
+
node
|
|
4708
|
+
}, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
|
|
4709
|
+
])
|
|
4710
|
+
} : void 0
|
|
4711
|
+
]), 1040)) : vue.createCommentVNode("", true)
|
|
4712
|
+
]),
|
|
4713
|
+
_: 2
|
|
4714
|
+
}, 1032, ["name"]);
|
|
4484
4715
|
}), 128))
|
|
4485
4716
|
]),
|
|
4486
4717
|
_: 3
|
|
@@ -4494,8 +4725,11 @@
|
|
|
4494
4725
|
class: "m-editor-breadcrumb"
|
|
4495
4726
|
};
|
|
4496
4727
|
const _hoisted_2$1 = { key: 0 };
|
|
4728
|
+
const __default__$7 = vue.defineComponent({
|
|
4729
|
+
name: "MEditorBreadcrumb"
|
|
4730
|
+
});
|
|
4497
4731
|
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
4498
|
-
|
|
4732
|
+
...__default__$7,
|
|
4499
4733
|
setup(__props) {
|
|
4500
4734
|
const services = vue.inject("services");
|
|
4501
4735
|
const editorService = services?.editorService;
|
|
@@ -4535,8 +4769,11 @@
|
|
|
4535
4769
|
key: 1,
|
|
4536
4770
|
style: { "width": "21px" }
|
|
4537
4771
|
};
|
|
4772
|
+
const __default__$6 = vue.defineComponent({
|
|
4773
|
+
name: "MEditorPageBarScrollContainer"
|
|
4774
|
+
});
|
|
4538
4775
|
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
4539
|
-
|
|
4776
|
+
...__default__$6,
|
|
4540
4777
|
setup(__props) {
|
|
4541
4778
|
const services = vue.inject("services");
|
|
4542
4779
|
const editorService = services?.editorService;
|
|
@@ -4617,14 +4854,14 @@
|
|
|
4617
4854
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4618
4855
|
onClick: addPage
|
|
4619
4856
|
}, [
|
|
4620
|
-
vue.createVNode(_sfc_main$
|
|
4857
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4621
4858
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
4622
4859
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4623
4860
|
key: 2,
|
|
4624
4861
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4625
4862
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4626
4863
|
}, [
|
|
4627
|
-
vue.createVNode(_sfc_main$
|
|
4864
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
4628
4865
|
])) : vue.createCommentVNode("", true),
|
|
4629
4866
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4630
4867
|
key: 3,
|
|
@@ -4640,7 +4877,7 @@
|
|
|
4640
4877
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4641
4878
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4642
4879
|
}, [
|
|
4643
|
-
vue.createVNode(_sfc_main$
|
|
4880
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
4644
4881
|
])) : vue.createCommentVNode("", true)
|
|
4645
4882
|
], 512);
|
|
4646
4883
|
};
|
|
@@ -4649,8 +4886,11 @@
|
|
|
4649
4886
|
|
|
4650
4887
|
const _hoisted_1 = ["onClick"];
|
|
4651
4888
|
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
4889
|
+
const __default__$5 = vue.defineComponent({
|
|
4890
|
+
name: "MEditorPageBar"
|
|
4891
|
+
});
|
|
4652
4892
|
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
4653
|
-
|
|
4893
|
+
...__default__$5,
|
|
4654
4894
|
setup(__props) {
|
|
4655
4895
|
const services = vue.inject("services");
|
|
4656
4896
|
const editorService = services?.editorService;
|
|
@@ -4709,7 +4949,7 @@
|
|
|
4709
4949
|
default: vue.withCtx(() => [
|
|
4710
4950
|
vue.createElementVNode("div", null, [
|
|
4711
4951
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4712
|
-
vue.createVNode(_sfc_main$
|
|
4952
|
+
vue.createVNode(_sfc_main$k, {
|
|
4713
4953
|
data: {
|
|
4714
4954
|
type: "button",
|
|
4715
4955
|
text: "\u590D\u5236",
|
|
@@ -4717,7 +4957,7 @@
|
|
|
4717
4957
|
handler: () => copy(item)
|
|
4718
4958
|
}
|
|
4719
4959
|
}, null, 8, ["data"]),
|
|
4720
|
-
vue.createVNode(_sfc_main$
|
|
4960
|
+
vue.createVNode(_sfc_main$k, {
|
|
4721
4961
|
data: {
|
|
4722
4962
|
type: "button",
|
|
4723
4963
|
text: "\u5220\u9664",
|
|
@@ -4751,6 +4991,10 @@
|
|
|
4751
4991
|
height = 0;
|
|
4752
4992
|
translateXCorrectionValue = 0;
|
|
4753
4993
|
translateYCorrectionValue = 0;
|
|
4994
|
+
correctionScrollSize = {
|
|
4995
|
+
width: 0,
|
|
4996
|
+
height: 0
|
|
4997
|
+
};
|
|
4754
4998
|
resizeObserver = new ResizeObserver(() => {
|
|
4755
4999
|
this.setSize();
|
|
4756
5000
|
this.setScrollSize();
|
|
@@ -4760,6 +5004,12 @@
|
|
|
4760
5004
|
this.container = options.container;
|
|
4761
5005
|
this.target = options.target;
|
|
4762
5006
|
this.zoom = options.zoom;
|
|
5007
|
+
if (this.correctionScrollSize) {
|
|
5008
|
+
this.correctionScrollSize = {
|
|
5009
|
+
...this.correctionScrollSize,
|
|
5010
|
+
...options.correctionScrollSize
|
|
5011
|
+
};
|
|
5012
|
+
}
|
|
4763
5013
|
this.container.addEventListener("wheel", this.wheelHandler, false);
|
|
4764
5014
|
this.setSize();
|
|
4765
5015
|
this.setScrollSize();
|
|
@@ -4822,9 +5072,9 @@
|
|
|
4822
5072
|
}
|
|
4823
5073
|
setScrollSize = () => {
|
|
4824
5074
|
const targetRect = this.target.getBoundingClientRect();
|
|
4825
|
-
this.scrollWidth = targetRect.width * this.zoom +
|
|
5075
|
+
this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
|
|
4826
5076
|
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
4827
|
-
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom +
|
|
5077
|
+
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
|
|
4828
5078
|
let left;
|
|
4829
5079
|
let top;
|
|
4830
5080
|
if (this.scrollWidth < this.width) {
|
|
@@ -4857,8 +5107,11 @@
|
|
|
4857
5107
|
};
|
|
4858
5108
|
}
|
|
4859
5109
|
|
|
5110
|
+
const __default__$4 = vue.defineComponent({
|
|
5111
|
+
name: "MEditorScrollBar"
|
|
5112
|
+
});
|
|
4860
5113
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
4861
|
-
|
|
5114
|
+
...__default__$4,
|
|
4862
5115
|
props: {
|
|
4863
5116
|
size: null,
|
|
4864
5117
|
scrollSize: null,
|
|
@@ -4943,14 +5196,21 @@
|
|
|
4943
5196
|
|
|
4944
5197
|
const ScrollBar_vue_vue_type_style_index_0_lang = '';
|
|
4945
5198
|
|
|
5199
|
+
const __default__$3 = vue.defineComponent({
|
|
5200
|
+
name: "MEditorScrollViewer"
|
|
5201
|
+
});
|
|
4946
5202
|
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
4947
|
-
|
|
5203
|
+
...__default__$3,
|
|
4948
5204
|
props: {
|
|
4949
5205
|
width: { default: 0 },
|
|
4950
5206
|
height: { default: 0 },
|
|
4951
5207
|
wrapWidth: { default: 0 },
|
|
4952
5208
|
wrapHeight: { default: 0 },
|
|
4953
|
-
zoom: { default: 1 }
|
|
5209
|
+
zoom: { default: 1 },
|
|
5210
|
+
correctionScrollSize: { default: () => ({
|
|
5211
|
+
width: 0,
|
|
5212
|
+
height: 0
|
|
5213
|
+
}) }
|
|
4954
5214
|
},
|
|
4955
5215
|
setup(__props, { expose }) {
|
|
4956
5216
|
const props = __props;
|
|
@@ -4973,7 +5233,8 @@
|
|
|
4973
5233
|
scrollViewer = new ScrollViewer({
|
|
4974
5234
|
container: container.value,
|
|
4975
5235
|
target: el.value,
|
|
4976
|
-
zoom: props.zoom
|
|
5236
|
+
zoom: props.zoom,
|
|
5237
|
+
correctionScrollSize: props.correctionScrollSize
|
|
4977
5238
|
});
|
|
4978
5239
|
scrollViewer.on("scroll", (data) => {
|
|
4979
5240
|
hOffset.value = data.scrollLeft;
|
|
@@ -5041,10 +5302,14 @@
|
|
|
5041
5302
|
}
|
|
5042
5303
|
});
|
|
5043
5304
|
|
|
5305
|
+
const __default__$2 = vue.defineComponent({
|
|
5306
|
+
name: "MEditorViewerMenu"
|
|
5307
|
+
});
|
|
5044
5308
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
5045
|
-
|
|
5309
|
+
...__default__$2,
|
|
5046
5310
|
props: {
|
|
5047
|
-
isMultiSelect: { type: Boolean, default: false }
|
|
5311
|
+
isMultiSelect: { type: Boolean, default: false },
|
|
5312
|
+
stageContentMenu: null
|
|
5048
5313
|
},
|
|
5049
5314
|
setup(__props, { expose }) {
|
|
5050
5315
|
const props = __props;
|
|
@@ -5057,8 +5322,7 @@
|
|
|
5057
5322
|
const nodes = vue.computed(() => editorService?.get("nodes"));
|
|
5058
5323
|
const parent = vue.computed(() => editorService?.get("parent"));
|
|
5059
5324
|
const stage = vue.computed(() => editorService?.get("stage"));
|
|
5060
|
-
const
|
|
5061
|
-
const menuData = vue.reactive([
|
|
5325
|
+
const menuData = vue.computed(() => [
|
|
5062
5326
|
{
|
|
5063
5327
|
type: "button",
|
|
5064
5328
|
text: "\u6C34\u5E73\u5C45\u4E2D",
|
|
@@ -5072,7 +5336,7 @@
|
|
|
5072
5336
|
{
|
|
5073
5337
|
type: "button",
|
|
5074
5338
|
text: "\u590D\u5236",
|
|
5075
|
-
icon: vue.markRaw(iconsVue.
|
|
5339
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
5076
5340
|
handler: () => {
|
|
5077
5341
|
nodes.value && editorService?.copy(nodes.value);
|
|
5078
5342
|
canPaste.value = true;
|
|
@@ -5081,6 +5345,7 @@
|
|
|
5081
5345
|
{
|
|
5082
5346
|
type: "button",
|
|
5083
5347
|
text: "\u7C98\u8D34",
|
|
5348
|
+
icon: vue.markRaw(iconsVue.DocumentCopy),
|
|
5084
5349
|
display: () => canPaste.value,
|
|
5085
5350
|
handler: () => {
|
|
5086
5351
|
const rect = menu.value?.$el.getBoundingClientRect();
|
|
@@ -5160,7 +5425,7 @@
|
|
|
5160
5425
|
editorService?.get("stage").clearGuides();
|
|
5161
5426
|
}
|
|
5162
5427
|
},
|
|
5163
|
-
...stageContentMenu
|
|
5428
|
+
...props.stageContentMenu
|
|
5164
5429
|
]);
|
|
5165
5430
|
vue.watch(
|
|
5166
5431
|
parent,
|
|
@@ -5183,8 +5448,8 @@
|
|
|
5183
5448
|
};
|
|
5184
5449
|
expose({ show });
|
|
5185
5450
|
return (_ctx, _cache) => {
|
|
5186
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5187
|
-
"menu-data": menuData,
|
|
5451
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$c, {
|
|
5452
|
+
"menu-data": vue.unref(menuData),
|
|
5188
5453
|
ref_key: "menu",
|
|
5189
5454
|
ref: menu
|
|
5190
5455
|
}, null, 8, ["menu-data"]);
|
|
@@ -5192,8 +5457,14 @@
|
|
|
5192
5457
|
}
|
|
5193
5458
|
});
|
|
5194
5459
|
|
|
5460
|
+
const __default__$1 = vue.defineComponent({
|
|
5461
|
+
name: "MEditorStage"
|
|
5462
|
+
});
|
|
5195
5463
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
5196
|
-
|
|
5464
|
+
...__default__$1,
|
|
5465
|
+
props: {
|
|
5466
|
+
stageContentMenu: null
|
|
5467
|
+
},
|
|
5197
5468
|
setup(__props) {
|
|
5198
5469
|
let stage = null;
|
|
5199
5470
|
let runtime = null;
|
|
@@ -5210,7 +5481,7 @@
|
|
|
5210
5481
|
const zoom = vue.computed(() => services?.uiService.get("zoom") || 1);
|
|
5211
5482
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
5212
5483
|
vue.watchEffect(() => {
|
|
5213
|
-
if (stage)
|
|
5484
|
+
if (stage || !page.value)
|
|
5214
5485
|
return;
|
|
5215
5486
|
if (!stageContainer.value)
|
|
5216
5487
|
return;
|
|
@@ -5240,6 +5511,14 @@
|
|
|
5240
5511
|
runtime.updateRootConfig?.(lodashEs.cloneDeep(vue.toRaw(root2)));
|
|
5241
5512
|
}
|
|
5242
5513
|
});
|
|
5514
|
+
vue.watch(page, (page2) => {
|
|
5515
|
+
if (runtime && page2) {
|
|
5516
|
+
runtime.updatePageId?.(page2.id);
|
|
5517
|
+
vue.nextTick(() => {
|
|
5518
|
+
stage?.select(page2.id);
|
|
5519
|
+
});
|
|
5520
|
+
}
|
|
5521
|
+
});
|
|
5243
5522
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
5244
5523
|
for (const { contentRect } of entries) {
|
|
5245
5524
|
services?.uiService.set("stageContainerRect", {
|
|
@@ -5312,7 +5591,11 @@
|
|
|
5312
5591
|
height: vue.unref(stageRect)?.height,
|
|
5313
5592
|
"wrap-width": vue.unref(stageContainerRect)?.width,
|
|
5314
5593
|
"wrap-height": vue.unref(stageContainerRect)?.height,
|
|
5315
|
-
zoom: vue.unref(zoom)
|
|
5594
|
+
zoom: vue.unref(zoom),
|
|
5595
|
+
"correction-scroll-size": {
|
|
5596
|
+
width: 60,
|
|
5597
|
+
height: 50
|
|
5598
|
+
}
|
|
5316
5599
|
}, {
|
|
5317
5600
|
default: vue.withCtx(() => [
|
|
5318
5601
|
vue.createElementVNode("div", {
|
|
@@ -5328,8 +5611,9 @@
|
|
|
5328
5611
|
vue.createVNode(_sfc_main$3, {
|
|
5329
5612
|
ref_key: "menu",
|
|
5330
5613
|
ref: menu,
|
|
5331
|
-
"is-multi-select": vue.unref(isMultiSelect)
|
|
5332
|
-
|
|
5614
|
+
"is-multi-select": vue.unref(isMultiSelect),
|
|
5615
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5616
|
+
}, null, 8, ["is-multi-select", "stage-content-menu"])
|
|
5333
5617
|
]))
|
|
5334
5618
|
]),
|
|
5335
5619
|
_: 1
|
|
@@ -5338,8 +5622,14 @@
|
|
|
5338
5622
|
}
|
|
5339
5623
|
});
|
|
5340
5624
|
|
|
5625
|
+
const __default__ = vue.defineComponent({
|
|
5626
|
+
name: "MEditorWorkspace"
|
|
5627
|
+
});
|
|
5341
5628
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
5342
|
-
|
|
5629
|
+
...__default__,
|
|
5630
|
+
props: {
|
|
5631
|
+
stageContentMenu: null
|
|
5632
|
+
},
|
|
5343
5633
|
setup(__props) {
|
|
5344
5634
|
const services = vue.inject("services");
|
|
5345
5635
|
const workspace = vue.ref();
|
|
@@ -5450,9 +5740,10 @@
|
|
|
5450
5740
|
}, [
|
|
5451
5741
|
vue.createVNode(_sfc_main$8),
|
|
5452
5742
|
vue.renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
5453
|
-
(vue.openBlock(), vue.createBlock(_sfc_main$2, {
|
|
5454
|
-
key:
|
|
5455
|
-
|
|
5743
|
+
vue.unref(page) ? (vue.openBlock(), vue.createBlock(_sfc_main$2, {
|
|
5744
|
+
key: 0,
|
|
5745
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5746
|
+
}, null, 8, ["stage-content-menu"])) : vue.createCommentVNode("", true)
|
|
5456
5747
|
]),
|
|
5457
5748
|
vue.renderSlot(_ctx.$slots, "workspace-content"),
|
|
5458
5749
|
vue.createVNode(_sfc_main$6, null, {
|
|
@@ -5482,9 +5773,13 @@
|
|
|
5482
5773
|
getList() {
|
|
5483
5774
|
return this.state.list;
|
|
5484
5775
|
}
|
|
5485
|
-
|
|
5776
|
+
resetState() {
|
|
5486
5777
|
this.state.list = [];
|
|
5778
|
+
}
|
|
5779
|
+
destroy() {
|
|
5780
|
+
this.resetState();
|
|
5487
5781
|
this.removeAllListeners();
|
|
5782
|
+
this.removeAllPlugins();
|
|
5488
5783
|
}
|
|
5489
5784
|
}
|
|
5490
5785
|
const componentListService = new ComponentList();
|
|
@@ -5492,11 +5787,11 @@
|
|
|
5492
5787
|
const _sfc_main = vue.defineComponent({
|
|
5493
5788
|
name: "m-editor",
|
|
5494
5789
|
components: {
|
|
5495
|
-
|
|
5790
|
+
TMagicNavMenu: _sfc_main$j,
|
|
5496
5791
|
Sidebar: _sfc_main$9,
|
|
5497
5792
|
Workspace: _sfc_main$1,
|
|
5498
|
-
PropsPanel: _sfc_main$
|
|
5499
|
-
Framework: _sfc_main$
|
|
5793
|
+
PropsPanel: _sfc_main$i,
|
|
5794
|
+
Framework: _sfc_main$l
|
|
5500
5795
|
},
|
|
5501
5796
|
props: {
|
|
5502
5797
|
modelValue: {
|
|
@@ -5511,6 +5806,10 @@
|
|
|
5511
5806
|
sidebar: {
|
|
5512
5807
|
type: Object
|
|
5513
5808
|
},
|
|
5809
|
+
menu: {
|
|
5810
|
+
type: Object,
|
|
5811
|
+
default: () => ({ left: [], right: [] })
|
|
5812
|
+
},
|
|
5514
5813
|
layerContentMenu: {
|
|
5515
5814
|
type: Array,
|
|
5516
5815
|
default: () => []
|
|
@@ -5519,10 +5818,6 @@
|
|
|
5519
5818
|
type: Array,
|
|
5520
5819
|
default: () => []
|
|
5521
5820
|
},
|
|
5522
|
-
menu: {
|
|
5523
|
-
type: Object,
|
|
5524
|
-
default: () => ({ left: [], right: [] })
|
|
5525
|
-
},
|
|
5526
5821
|
render: {
|
|
5527
5822
|
type: Function
|
|
5528
5823
|
},
|
|
@@ -5556,7 +5851,7 @@
|
|
|
5556
5851
|
},
|
|
5557
5852
|
containerHighlightClassName: {
|
|
5558
5853
|
type: String,
|
|
5559
|
-
default: StageCore.
|
|
5854
|
+
default: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME
|
|
5560
5855
|
},
|
|
5561
5856
|
containerHighlightDuration: {
|
|
5562
5857
|
type: Number,
|
|
@@ -5575,20 +5870,33 @@
|
|
|
5575
5870
|
},
|
|
5576
5871
|
updateDragEl: {
|
|
5577
5872
|
type: Function
|
|
5873
|
+
},
|
|
5874
|
+
disabledDragStart: {
|
|
5875
|
+
type: Boolean
|
|
5578
5876
|
}
|
|
5579
5877
|
},
|
|
5580
5878
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
5581
5879
|
setup(props, { emit }) {
|
|
5582
|
-
|
|
5583
|
-
const
|
|
5584
|
-
|
|
5585
|
-
if (nodeId
|
|
5586
|
-
editorService.
|
|
5587
|
-
}
|
|
5880
|
+
const rootChangeHandler = (value, preValue) => {
|
|
5881
|
+
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
5882
|
+
let node;
|
|
5883
|
+
if (nodeId) {
|
|
5884
|
+
node = editorService.getNodeById(nodeId);
|
|
5885
|
+
}
|
|
5886
|
+
if (node && node !== value) {
|
|
5887
|
+
editorService.select(node.id);
|
|
5888
|
+
} else if (value?.items?.length) {
|
|
5889
|
+
editorService.select(value.items[0]);
|
|
5890
|
+
} else if (value?.id) {
|
|
5588
5891
|
editorService.set("nodes", [value]);
|
|
5892
|
+
editorService.set("parent", null);
|
|
5893
|
+
editorService.set("page", null);
|
|
5589
5894
|
}
|
|
5590
|
-
|
|
5591
|
-
|
|
5895
|
+
if (vue.toRaw(value) !== vue.toRaw(preValue)) {
|
|
5896
|
+
emit("update:modelValue", value);
|
|
5897
|
+
}
|
|
5898
|
+
};
|
|
5899
|
+
editorService.on("root-change", rootChangeHandler);
|
|
5592
5900
|
vue.watch(
|
|
5593
5901
|
() => props.modelValue,
|
|
5594
5902
|
(modelValue) => {
|
|
@@ -5650,13 +5958,13 @@
|
|
|
5650
5958
|
}
|
|
5651
5959
|
);
|
|
5652
5960
|
vue.onUnmounted(() => {
|
|
5653
|
-
editorService.
|
|
5654
|
-
historyService.
|
|
5655
|
-
propsService.
|
|
5656
|
-
uiService.
|
|
5657
|
-
componentListService.
|
|
5658
|
-
|
|
5659
|
-
|
|
5961
|
+
editorService.resetState();
|
|
5962
|
+
historyService.resetState();
|
|
5963
|
+
propsService.resetState();
|
|
5964
|
+
uiService.resetState();
|
|
5965
|
+
componentListService.resetState();
|
|
5966
|
+
codeBlockService.resetState();
|
|
5967
|
+
editorService.off("root-change", rootChangeHandler);
|
|
5660
5968
|
});
|
|
5661
5969
|
const services = {
|
|
5662
5970
|
componentListService,
|
|
@@ -5669,8 +5977,7 @@
|
|
|
5669
5977
|
codeBlockService
|
|
5670
5978
|
};
|
|
5671
5979
|
vue.provide("services", services);
|
|
5672
|
-
vue.provide("
|
|
5673
|
-
vue.provide("stageContentMenu", props.stageContentMenu);
|
|
5980
|
+
vue.provide("codeOptions", props.codeOptions);
|
|
5674
5981
|
vue.provide(
|
|
5675
5982
|
"stageOptions",
|
|
5676
5983
|
vue.reactive({
|
|
@@ -5683,7 +5990,8 @@
|
|
|
5683
5990
|
isContainer: props.isContainer,
|
|
5684
5991
|
containerHighlightClassName: props.containerHighlightClassName,
|
|
5685
5992
|
containerHighlightDuration: props.containerHighlightDuration,
|
|
5686
|
-
containerHighlightType: props.containerHighlightType
|
|
5993
|
+
containerHighlightType: props.containerHighlightType,
|
|
5994
|
+
disabledDragStart: props.disabledDragStart
|
|
5687
5995
|
})
|
|
5688
5996
|
);
|
|
5689
5997
|
return services;
|
|
@@ -5699,20 +6007,23 @@
|
|
|
5699
6007
|
};
|
|
5700
6008
|
|
|
5701
6009
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5702
|
-
const
|
|
5703
|
-
const
|
|
5704
|
-
const
|
|
5705
|
-
const
|
|
5706
|
-
const
|
|
5707
|
-
return vue.openBlock(), vue.createBlock(
|
|
6010
|
+
const _component_TMagicNavMenu = vue.resolveComponent("TMagicNavMenu");
|
|
6011
|
+
const _component_Sidebar = vue.resolveComponent("Sidebar");
|
|
6012
|
+
const _component_Workspace = vue.resolveComponent("Workspace");
|
|
6013
|
+
const _component_PropsPanel = vue.resolveComponent("PropsPanel");
|
|
6014
|
+
const _component_Framework = vue.resolveComponent("Framework");
|
|
6015
|
+
return vue.openBlock(), vue.createBlock(_component_Framework, { "code-options": _ctx.codeOptions }, {
|
|
5708
6016
|
nav: vue.withCtx(() => [
|
|
5709
6017
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
5710
|
-
vue.createVNode(
|
|
6018
|
+
vue.createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
5711
6019
|
])
|
|
5712
6020
|
]),
|
|
5713
6021
|
sidebar: vue.withCtx(() => [
|
|
5714
6022
|
vue.renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
5715
|
-
vue.createVNode(
|
|
6023
|
+
vue.createVNode(_component_Sidebar, {
|
|
6024
|
+
data: _ctx.sidebar,
|
|
6025
|
+
"layer-content-menu": _ctx.layerContentMenu
|
|
6026
|
+
}, {
|
|
5716
6027
|
"layer-panel-header": vue.withCtx(() => [
|
|
5717
6028
|
vue.renderSlot(_ctx.$slots, "layer-panel-header")
|
|
5718
6029
|
]),
|
|
@@ -5741,12 +6052,12 @@
|
|
|
5741
6052
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
5742
6053
|
]),
|
|
5743
6054
|
_: 3
|
|
5744
|
-
}, 8, ["data"])
|
|
6055
|
+
}, 8, ["data", "layer-content-menu"])
|
|
5745
6056
|
])
|
|
5746
6057
|
]),
|
|
5747
6058
|
workspace: vue.withCtx(() => [
|
|
5748
6059
|
vue.renderSlot(_ctx.$slots, "workspace", { editorService: _ctx.editorService }, () => [
|
|
5749
|
-
vue.createVNode(
|
|
6060
|
+
vue.createVNode(_component_Workspace, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
5750
6061
|
stage: vue.withCtx(() => [
|
|
5751
6062
|
vue.renderSlot(_ctx.$slots, "stage")
|
|
5752
6063
|
]),
|
|
@@ -5760,12 +6071,12 @@
|
|
|
5760
6071
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
5761
6072
|
]),
|
|
5762
6073
|
_: 3
|
|
5763
|
-
})
|
|
6074
|
+
}, 8, ["stage-content-menu"])
|
|
5764
6075
|
])
|
|
5765
6076
|
]),
|
|
5766
6077
|
"props-panel": vue.withCtx(() => [
|
|
5767
6078
|
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
5768
|
-
vue.createVNode(
|
|
6079
|
+
vue.createVNode(_component_PropsPanel, {
|
|
5769
6080
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
5770
6081
|
}, {
|
|
5771
6082
|
"props-panel-header": vue.withCtx(() => [
|
|
@@ -5792,35 +6103,37 @@
|
|
|
5792
6103
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
5793
6104
|
setConfig(option);
|
|
5794
6105
|
app.component(Editor.name, Editor);
|
|
5795
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
5796
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
5797
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
5798
|
-
app.component("magic-code-editor", _sfc_main$
|
|
5799
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
6106
|
+
app.component("m-fields-ui-select", _sfc_main$r);
|
|
6107
|
+
app.component("m-fields-code-link", _sfc_main$t);
|
|
6108
|
+
app.component("m-fields-vs-code", _sfc_main$u);
|
|
6109
|
+
app.component("magic-code-editor", _sfc_main$q);
|
|
6110
|
+
app.component("m-fields-code-select", _sfc_main$s);
|
|
5800
6111
|
}
|
|
5801
6112
|
};
|
|
5802
6113
|
|
|
6114
|
+
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
5803
6115
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
5804
|
-
exports.CodeBlockList = _sfc_main$
|
|
6116
|
+
exports.CodeBlockList = _sfc_main$e;
|
|
5805
6117
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
5806
6118
|
exports.CodeEditorMode = CodeEditorMode;
|
|
5807
|
-
exports.CodeSelect = _sfc_main$
|
|
5808
|
-
exports.CodeSelectOp = CodeSelectOp;
|
|
6119
|
+
exports.CodeSelect = _sfc_main$s;
|
|
5809
6120
|
exports.ColumnLayout = ColumnLayout;
|
|
5810
|
-
exports.ComponentListPanel = _sfc_main$
|
|
5811
|
-
exports.ContentMenu = _sfc_main$
|
|
6121
|
+
exports.ComponentListPanel = _sfc_main$d;
|
|
6122
|
+
exports.ContentMenu = _sfc_main$c;
|
|
5812
6123
|
exports.Fixed2Other = Fixed2Other;
|
|
5813
6124
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
5814
|
-
exports.Icon = _sfc_main$
|
|
6125
|
+
exports.Icon = _sfc_main$n;
|
|
5815
6126
|
exports.Keys = Keys;
|
|
5816
6127
|
exports.LayerOffset = LayerOffset;
|
|
5817
|
-
exports.LayerPanel = _sfc_main$
|
|
6128
|
+
exports.LayerPanel = _sfc_main$a;
|
|
5818
6129
|
exports.Layout = Layout;
|
|
5819
|
-
exports.
|
|
5820
|
-
exports.
|
|
6130
|
+
exports.LayoutContainer = _sfc_main$o;
|
|
6131
|
+
exports.PropsPanel = _sfc_main$i;
|
|
6132
|
+
exports.TMagicCodeEditor = _sfc_main$q;
|
|
5821
6133
|
exports.TMagicEditor = Editor;
|
|
5822
|
-
exports.ToolButton = _sfc_main$
|
|
6134
|
+
exports.ToolButton = _sfc_main$k;
|
|
5823
6135
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
6136
|
+
exports.beforePaste = beforePaste;
|
|
5824
6137
|
exports.change2Fixed = change2Fixed;
|
|
5825
6138
|
exports.codeBlockService = codeBlockService;
|
|
5826
6139
|
exports.debug = debug;
|
|
@@ -5833,18 +6146,22 @@
|
|
|
5833
6146
|
exports.fixNodePosition = fixNodePosition;
|
|
5834
6147
|
exports.generatePageName = generatePageName;
|
|
5835
6148
|
exports.generatePageNameByApp = generatePageNameByApp;
|
|
6149
|
+
exports.getAddParent = getAddParent;
|
|
5836
6150
|
exports.getConfig = getConfig;
|
|
6151
|
+
exports.getDefaultConfig = getDefaultConfig;
|
|
5837
6152
|
exports.getGuideLineFromCache = getGuideLineFromCache;
|
|
5838
6153
|
exports.getInitPositionStyle = getInitPositionStyle;
|
|
5839
6154
|
exports.getNodeIndex = getNodeIndex;
|
|
5840
6155
|
exports.getPageList = getPageList;
|
|
5841
6156
|
exports.getPageNameList = getPageNameList;
|
|
6157
|
+
exports.getPositionInContainer = getPositionInContainer;
|
|
5842
6158
|
exports.getRelativeStyle = getRelativeStyle;
|
|
5843
6159
|
exports.historyService = historyService;
|
|
5844
6160
|
exports.info = info;
|
|
5845
6161
|
exports.isFixed = isFixed;
|
|
5846
6162
|
exports.log = log;
|
|
5847
6163
|
exports.propsService = propsService;
|
|
6164
|
+
exports.serializeConfig = serializeConfig;
|
|
5848
6165
|
exports.setConfig = setConfig;
|
|
5849
6166
|
exports.setLayout = setLayout;
|
|
5850
6167
|
exports.storageService = storageService;
|
|
@@ -5855,4 +6172,4 @@
|
|
|
5855
6172
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
5856
6173
|
|
|
5857
6174
|
}));
|
|
5858
|
-
//# sourceMappingURL=tmagic-editor.umd.
|
|
6175
|
+
//# sourceMappingURL=tmagic-editor.umd.cjs.map
|