@tmagic/editor 1.2.0-beta.9 → 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 -1154
- package/dist/tmagic-editor.js.map +1 -0
- package/dist/{tmagic-editor.umd.js → tmagic-editor.umd.cjs} +1483 -1159
- 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 +1 -1
- 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 +89 -102
- 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,119 +153,107 @@
|
|
|
192
153
|
setup(__props, { emit }) {
|
|
193
154
|
const props = __props;
|
|
194
155
|
const services = vue.inject("services");
|
|
195
|
-
const
|
|
196
|
-
const
|
|
156
|
+
const mForm = vue.inject("mForm");
|
|
157
|
+
const codeDsl = vue.computed(() => services?.codeBlockService.getCodeDslSync());
|
|
158
|
+
const tableConfig = vue.computed(() => {
|
|
197
159
|
const defaultConfig = {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
+
}
|
|
207
196
|
}
|
|
208
|
-
|
|
209
|
-
}
|
|
197
|
+
]
|
|
210
198
|
};
|
|
211
199
|
return {
|
|
212
200
|
...defaultConfig,
|
|
213
|
-
...props.config.
|
|
201
|
+
...props.config.tableConfig
|
|
214
202
|
};
|
|
215
203
|
});
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
fieldKey.value = combineNames.join("-");
|
|
229
|
-
});
|
|
230
|
-
const changeHandler = async (value) => {
|
|
231
|
-
let codeIds = value;
|
|
232
|
-
if (typeof value === "string") {
|
|
233
|
-
multiple.value = false;
|
|
234
|
-
codeIds = value ? [value] : [];
|
|
235
|
-
}
|
|
236
|
-
await setCombineRelation(codeIds);
|
|
237
|
-
emit("change", value);
|
|
238
|
-
};
|
|
239
|
-
const setCombineRelation = async (codeIds) => {
|
|
240
|
-
const { id = "" } = services?.editorService.get("node") || {};
|
|
241
|
-
let opFlag = CodeSelectOp.CHANGE;
|
|
242
|
-
let diffValues = codeIds;
|
|
243
|
-
if (multiple.value) {
|
|
244
|
-
lastTagSnapshot.value = form?.initValues[props.name] || [];
|
|
245
|
-
opFlag = codeIds.length < lastTagSnapshot.value.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
|
|
246
|
-
diffValues = lodashEs.xor(codeIds, lastTagSnapshot.value);
|
|
204
|
+
vue.watch(
|
|
205
|
+
() => props.model[props.name],
|
|
206
|
+
(value) => {
|
|
207
|
+
if (lodashEs.isEmpty(value)) {
|
|
208
|
+
props.model[props.name] = {
|
|
209
|
+
hookType: schema.HookType.CODE,
|
|
210
|
+
hookData: []
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
immediate: true
|
|
247
216
|
}
|
|
248
|
-
|
|
217
|
+
);
|
|
218
|
+
const changeHandler = async () => {
|
|
219
|
+
emit("change", props.model[props.name]);
|
|
249
220
|
};
|
|
250
|
-
const
|
|
251
|
-
if (
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
+
}));
|
|
258
233
|
};
|
|
259
234
|
return (_ctx, _cache) => {
|
|
260
|
-
const
|
|
261
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
name: __props.name,
|
|
272
|
-
size: __props.size,
|
|
273
|
-
onChange: changeHandler
|
|
274
|
-
}, null, 8, ["config", "model", "prop", "name", "size"])
|
|
275
|
-
]),
|
|
276
|
-
default: vue.withCtx(() => [
|
|
277
|
-
vue.createElementVNode("div", _hoisted_1$e, [
|
|
278
|
-
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
279
|
-
class: "tool-item",
|
|
280
|
-
effect: "dark",
|
|
281
|
-
content: "\u67E5\u770B\u4EE3\u7801\u5757",
|
|
282
|
-
placement: "top"
|
|
283
|
-
}, {
|
|
284
|
-
default: vue.withCtx(() => [
|
|
285
|
-
(vue.openBlock(), vue.createElementBlock("svg", {
|
|
286
|
-
onClick: viewHandler,
|
|
287
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
288
|
-
viewBox: "0 0 24 24",
|
|
289
|
-
width: "15px",
|
|
290
|
-
height: "15px",
|
|
291
|
-
"data-v-65a7fb6c": ""
|
|
292
|
-
}, _hoisted_3$3))
|
|
293
|
-
]),
|
|
294
|
-
_: 1
|
|
295
|
-
})
|
|
296
|
-
])
|
|
297
|
-
]),
|
|
298
|
-
_: 1
|
|
299
|
-
})
|
|
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"])
|
|
300
246
|
]);
|
|
301
247
|
};
|
|
302
248
|
}
|
|
303
249
|
});
|
|
304
250
|
|
|
305
|
-
const _hoisted_1$
|
|
306
|
-
const
|
|
307
|
-
|
|
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,
|
|
308
257
|
props: {
|
|
309
258
|
config: null,
|
|
310
259
|
model: null,
|
|
@@ -366,7 +315,7 @@
|
|
|
366
315
|
style: { "padding": "0" }
|
|
367
316
|
}, {
|
|
368
317
|
default: vue.withCtx(() => [
|
|
369
|
-
_hoisted_1$
|
|
318
|
+
_hoisted_1$f
|
|
370
319
|
]),
|
|
371
320
|
_: 1
|
|
372
321
|
}, 8, ["icon"])
|
|
@@ -414,12 +363,15 @@
|
|
|
414
363
|
|
|
415
364
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
416
365
|
|
|
417
|
-
const
|
|
418
|
-
|
|
366
|
+
const __default__$p = vue.defineComponent({
|
|
367
|
+
name: "MEditorCodeEditor"
|
|
368
|
+
});
|
|
369
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
370
|
+
...__default__$p,
|
|
419
371
|
props: {
|
|
420
372
|
initValues: null,
|
|
421
373
|
modifiedValues: null,
|
|
422
|
-
type:
|
|
374
|
+
type: null,
|
|
423
375
|
language: { default: "javascript" },
|
|
424
376
|
options: { default: () => ({
|
|
425
377
|
tabSize: 2
|
|
@@ -544,9 +496,182 @@
|
|
|
544
496
|
};
|
|
545
497
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
546
498
|
|
|
547
|
-
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
|
+
});
|
|
548
538
|
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
549
|
-
|
|
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,
|
|
550
675
|
props: {
|
|
551
676
|
icon: null
|
|
552
677
|
},
|
|
@@ -565,7 +690,7 @@
|
|
|
565
690
|
class: "magic-editor-icon"
|
|
566
691
|
}, {
|
|
567
692
|
default: vue.withCtx(() => [
|
|
568
|
-
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$
|
|
693
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$e)
|
|
569
694
|
]),
|
|
570
695
|
_: 1
|
|
571
696
|
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
@@ -584,6 +709,42 @@
|
|
|
584
709
|
}
|
|
585
710
|
});
|
|
586
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
|
+
|
|
587
748
|
const log = (...args) => {
|
|
588
749
|
if (process.env.NODE_ENV === "development") {
|
|
589
750
|
console.log("magic editor: ", ...args);
|
|
@@ -713,6 +874,14 @@
|
|
|
713
874
|
this.pluginOptionsList[methodName2].push(method);
|
|
714
875
|
});
|
|
715
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
|
+
}
|
|
716
885
|
async doTask() {
|
|
717
886
|
this.doingTask = true;
|
|
718
887
|
let task = this.taskList.shift();
|
|
@@ -732,7 +901,8 @@
|
|
|
732
901
|
editable: true,
|
|
733
902
|
mode: CodeEditorMode.EDITOR,
|
|
734
903
|
combineIds: [],
|
|
735
|
-
undeletableList: []
|
|
904
|
+
undeletableList: [],
|
|
905
|
+
relations: {}
|
|
736
906
|
});
|
|
737
907
|
constructor() {
|
|
738
908
|
super([
|
|
@@ -750,31 +920,40 @@
|
|
|
750
920
|
"deleteCodeDslByIds"
|
|
751
921
|
]);
|
|
752
922
|
}
|
|
753
|
-
async setCodeDsl(
|
|
754
|
-
this.state.codeDsl =
|
|
923
|
+
async setCodeDsl(codeDsl2) {
|
|
924
|
+
this.state.codeDsl = codeDsl2;
|
|
755
925
|
await editorService.setCodeDsl(this.state.codeDsl);
|
|
756
926
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
757
927
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
758
928
|
}
|
|
759
929
|
async getCodeDsl(forceRefresh = false) {
|
|
930
|
+
return this.getCodeDslSync(forceRefresh);
|
|
931
|
+
}
|
|
932
|
+
getCodeDslSync(forceRefresh = false) {
|
|
760
933
|
if (!this.state.codeDsl || forceRefresh) {
|
|
761
|
-
this.state.codeDsl =
|
|
934
|
+
this.state.codeDsl = editorService.getCodeDslSync();
|
|
762
935
|
}
|
|
763
936
|
return this.state.codeDsl;
|
|
764
937
|
}
|
|
765
|
-
async getCodeContentById(
|
|
766
|
-
if (!
|
|
938
|
+
async getCodeContentById(id2) {
|
|
939
|
+
if (!id2)
|
|
767
940
|
return null;
|
|
768
941
|
const totalCodeDsl = await this.getCodeDsl();
|
|
769
942
|
if (!totalCodeDsl)
|
|
770
943
|
return null;
|
|
771
|
-
return totalCodeDsl[
|
|
944
|
+
return totalCodeDsl[id2] ?? null;
|
|
772
945
|
}
|
|
773
946
|
async setCodeDslById(id, codeConfig) {
|
|
774
947
|
let codeDsl = await this.getCodeDsl();
|
|
948
|
+
const codeConfigProcessed = codeConfig;
|
|
949
|
+
if (codeConfig.content) {
|
|
950
|
+
codeConfigProcessed.content = eval(codeConfig.content);
|
|
951
|
+
}
|
|
775
952
|
if (!codeDsl) {
|
|
776
953
|
codeDsl = {
|
|
777
|
-
[id]:
|
|
954
|
+
[id]: {
|
|
955
|
+
...codeConfigProcessed
|
|
956
|
+
}
|
|
778
957
|
};
|
|
779
958
|
} else {
|
|
780
959
|
const existContent = codeDsl[id] || {};
|
|
@@ -782,15 +961,15 @@
|
|
|
782
961
|
...codeDsl,
|
|
783
962
|
[id]: {
|
|
784
963
|
...existContent,
|
|
785
|
-
...
|
|
964
|
+
...codeConfigProcessed
|
|
786
965
|
}
|
|
787
966
|
};
|
|
788
967
|
}
|
|
789
968
|
await this.setCodeDsl(codeDsl);
|
|
790
969
|
}
|
|
791
970
|
async getCodeDslByIds(ids) {
|
|
792
|
-
const
|
|
793
|
-
return lodashEs.pick(
|
|
971
|
+
const codeDsl2 = await this.getCodeDsl();
|
|
972
|
+
return lodashEs.pick(codeDsl2, ids);
|
|
794
973
|
}
|
|
795
974
|
async setCodeEditorShowStatus(status) {
|
|
796
975
|
this.state.isShowCodeEditor = status;
|
|
@@ -798,10 +977,10 @@
|
|
|
798
977
|
getCodeEditorShowStatus() {
|
|
799
978
|
return this.state.isShowCodeEditor;
|
|
800
979
|
}
|
|
801
|
-
setCodeEditorContent(status,
|
|
802
|
-
if (!
|
|
980
|
+
setCodeEditorContent(status, id2) {
|
|
981
|
+
if (!id2)
|
|
803
982
|
return;
|
|
804
|
-
this.setId(
|
|
983
|
+
this.setId(id2);
|
|
805
984
|
this.state.isShowCodeEditor = status;
|
|
806
985
|
}
|
|
807
986
|
async getCurrentDsl() {
|
|
@@ -813,10 +992,10 @@
|
|
|
813
992
|
async setEditStatus(status) {
|
|
814
993
|
this.state.editable = status;
|
|
815
994
|
}
|
|
816
|
-
setId(
|
|
817
|
-
if (!
|
|
995
|
+
setId(id2) {
|
|
996
|
+
if (!id2)
|
|
818
997
|
return;
|
|
819
|
-
this.state.id =
|
|
998
|
+
this.state.id = id2;
|
|
820
999
|
}
|
|
821
1000
|
getId() {
|
|
822
1001
|
return this.state.id;
|
|
@@ -833,61 +1012,17 @@
|
|
|
833
1012
|
getCombineIds() {
|
|
834
1013
|
return this.state.combineIds;
|
|
835
1014
|
}
|
|
836
|
-
|
|
837
|
-
const
|
|
838
|
-
if (!
|
|
839
|
-
return;
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}
|
|
848
|
-
});
|
|
849
|
-
} catch (e) {
|
|
850
|
-
error(e);
|
|
851
|
-
throw new Error("\u89E3\u7ED1\u4EE3\u7801\u5757\u5931\u8D25");
|
|
852
|
-
}
|
|
853
|
-
} else if (opFlag === CodeSelectOp.ADD) {
|
|
854
|
-
try {
|
|
855
|
-
diffCodeIds.forEach((codeId) => {
|
|
856
|
-
const compsContent = codeDsl[codeId].comps;
|
|
857
|
-
const existHooks = compsContent?.[compId];
|
|
858
|
-
if (lodashEs.isEmpty(existHooks)) {
|
|
859
|
-
codeDsl[codeId].comps = {
|
|
860
|
-
...codeDsl[codeId].comps || {},
|
|
861
|
-
[compId]: [hook]
|
|
862
|
-
};
|
|
863
|
-
} else {
|
|
864
|
-
existHooks?.push(hook);
|
|
865
|
-
}
|
|
866
|
-
});
|
|
867
|
-
} catch (e) {
|
|
868
|
-
error(e);
|
|
869
|
-
throw new Error("\u7ED1\u5B9A\u4EE3\u7801\u5757\u5931\u8D25");
|
|
870
|
-
}
|
|
871
|
-
} else if (opFlag === CodeSelectOp.CHANGE) {
|
|
872
|
-
lodashEs.forIn(codeDsl, (codeBlockContent, codeId) => {
|
|
873
|
-
if (codeId === diffCodeIds[0]) {
|
|
874
|
-
codeBlockContent.comps = {
|
|
875
|
-
...codeBlockContent?.comps || {},
|
|
876
|
-
[compId]: [hook]
|
|
877
|
-
};
|
|
878
|
-
} else if (lodashEs.isEmpty(diffCodeIds) || codeId !== diffCodeIds[0]) {
|
|
879
|
-
const compHooks = codeBlockContent?.comps?.[compId];
|
|
880
|
-
if (!compHooks)
|
|
881
|
-
return true;
|
|
882
|
-
const index = compHooks.findIndex((hookName) => hookName === hook);
|
|
883
|
-
if (index !== -1) {
|
|
884
|
-
compHooks.splice(index, 1);
|
|
885
|
-
return false;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
this.setCodeDsl(codeDsl);
|
|
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;
|
|
891
1026
|
}
|
|
892
1027
|
getUndeletableList() {
|
|
893
1028
|
return this.state.undeletableList;
|
|
@@ -895,6 +1030,15 @@
|
|
|
895
1030
|
async setUndeleteableList(codeIds) {
|
|
896
1031
|
this.state.undeletableList = codeIds;
|
|
897
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
|
+
}
|
|
898
1042
|
async deleteCodeDslByIds(codeIds) {
|
|
899
1043
|
const currentDsl = await this.getCodeDsl();
|
|
900
1044
|
const newDsl = lodashEs.omit(currentDsl, codeIds);
|
|
@@ -910,13 +1054,13 @@
|
|
|
910
1054
|
return await this.getUniqueId();
|
|
911
1055
|
}
|
|
912
1056
|
async deleteCompsInRelation(node) {
|
|
913
|
-
const
|
|
914
|
-
if (!
|
|
1057
|
+
const codeDsl2 = lodashEs.cloneDeep(await this.getCodeDsl());
|
|
1058
|
+
if (!codeDsl2)
|
|
915
1059
|
return;
|
|
916
|
-
this.
|
|
917
|
-
this.setCodeDsl(
|
|
1060
|
+
this.refreshRelationDeep(node, codeDsl2);
|
|
1061
|
+
this.setCodeDsl(codeDsl2);
|
|
918
1062
|
}
|
|
919
|
-
|
|
1063
|
+
resetState() {
|
|
920
1064
|
this.state.isShowCodeEditor = false;
|
|
921
1065
|
this.state.codeDsl = null;
|
|
922
1066
|
this.state.id = "";
|
|
@@ -925,16 +1069,44 @@
|
|
|
925
1069
|
this.state.combineIds = [];
|
|
926
1070
|
this.state.undeletableList = [];
|
|
927
1071
|
}
|
|
928
|
-
|
|
1072
|
+
destroy() {
|
|
1073
|
+
this.resetState();
|
|
1074
|
+
this.removeAllListeners();
|
|
1075
|
+
this.removeAllPlugins();
|
|
1076
|
+
}
|
|
1077
|
+
refreshRelationDeep(node, codeDsl2) {
|
|
929
1078
|
if (!node.id)
|
|
930
1079
|
return;
|
|
931
|
-
lodashEs.forIn(
|
|
1080
|
+
lodashEs.forIn(codeDsl2, (codeBlockContent) => {
|
|
932
1081
|
const compsContent = codeBlockContent.comps || {};
|
|
933
1082
|
codeBlockContent.comps = lodashEs.omit(compsContent, node.id);
|
|
934
1083
|
});
|
|
935
1084
|
if (!lodashEs.isEmpty(node.items)) {
|
|
936
1085
|
node.items.forEach((item) => {
|
|
937
|
-
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);
|
|
938
1110
|
});
|
|
939
1111
|
}
|
|
940
1112
|
}
|
|
@@ -1018,8 +1190,9 @@
|
|
|
1018
1190
|
this.state.pageSteps[this.state.pageId] = undoRedo;
|
|
1019
1191
|
}
|
|
1020
1192
|
this.setCanUndoRedo();
|
|
1193
|
+
this.emit("page-change", this.state.pageSteps[this.state.pageId]);
|
|
1021
1194
|
}
|
|
1022
|
-
|
|
1195
|
+
resetState() {
|
|
1023
1196
|
this.state.pageId = void 0;
|
|
1024
1197
|
this.state.pageSteps = {};
|
|
1025
1198
|
this.state.canRedo = false;
|
|
@@ -1050,8 +1223,9 @@
|
|
|
1050
1223
|
return state;
|
|
1051
1224
|
}
|
|
1052
1225
|
destroy() {
|
|
1053
|
-
this.
|
|
1226
|
+
this.resetState();
|
|
1054
1227
|
this.removeAllListeners();
|
|
1228
|
+
this.removeAllPlugins();
|
|
1055
1229
|
}
|
|
1056
1230
|
getUndoRedo() {
|
|
1057
1231
|
if (!this.state.pageId)
|
|
@@ -1131,6 +1305,7 @@
|
|
|
1131
1305
|
}
|
|
1132
1306
|
destroy() {
|
|
1133
1307
|
this.removeAllListeners();
|
|
1308
|
+
this.removeAllPlugins();
|
|
1134
1309
|
}
|
|
1135
1310
|
getValueAndProtocol(value) {
|
|
1136
1311
|
let protocol2 = "";
|
|
@@ -1303,6 +1478,10 @@
|
|
|
1303
1478
|
left: fixNodeLeft(config, parent, stage?.renderer.contentWindow?.document)
|
|
1304
1479
|
};
|
|
1305
1480
|
};
|
|
1481
|
+
const serializeConfig = (config) => serialize__default.default(config, {
|
|
1482
|
+
space: 2,
|
|
1483
|
+
unsafe: true
|
|
1484
|
+
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1306
1485
|
|
|
1307
1486
|
class Props extends BaseService {
|
|
1308
1487
|
state = vue.reactive({
|
|
@@ -1344,7 +1523,7 @@
|
|
|
1344
1523
|
this.setPropsValue(utils.toLine(type), values[type]);
|
|
1345
1524
|
});
|
|
1346
1525
|
}
|
|
1347
|
-
setPropsValue(type, value) {
|
|
1526
|
+
async setPropsValue(type, value) {
|
|
1348
1527
|
this.state.propsValueMap[type] = value;
|
|
1349
1528
|
}
|
|
1350
1529
|
async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
|
|
@@ -1398,10 +1577,14 @@
|
|
|
1398
1577
|
name: type
|
|
1399
1578
|
};
|
|
1400
1579
|
}
|
|
1401
|
-
|
|
1580
|
+
resetState() {
|
|
1402
1581
|
this.state.propsConfigMap = {};
|
|
1403
1582
|
this.state.propsValueMap = {};
|
|
1583
|
+
}
|
|
1584
|
+
destroy() {
|
|
1585
|
+
this.resetState();
|
|
1404
1586
|
this.removeAllListeners();
|
|
1587
|
+
this.removeAllPlugins();
|
|
1405
1588
|
}
|
|
1406
1589
|
guid(digit = 8) {
|
|
1407
1590
|
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
@@ -1476,6 +1659,13 @@
|
|
|
1476
1659
|
}
|
|
1477
1660
|
return parentNode;
|
|
1478
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
|
+
};
|
|
1479
1669
|
|
|
1480
1670
|
class Editor$1 extends BaseService {
|
|
1481
1671
|
state = vue.reactive({
|
|
@@ -1505,7 +1695,7 @@
|
|
|
1505
1695
|
"copy",
|
|
1506
1696
|
"paste",
|
|
1507
1697
|
"doPaste",
|
|
1508
|
-
"
|
|
1698
|
+
"doAlignCenter",
|
|
1509
1699
|
"alignCenter",
|
|
1510
1700
|
"moveLayer",
|
|
1511
1701
|
"moveToContainer",
|
|
@@ -1520,13 +1710,14 @@
|
|
|
1520
1710
|
);
|
|
1521
1711
|
}
|
|
1522
1712
|
set(name, value) {
|
|
1713
|
+
const preValue = this.state[name];
|
|
1523
1714
|
this.state[name] = value;
|
|
1524
1715
|
if (name === "nodes") {
|
|
1525
1716
|
this.set("node", value[0]);
|
|
1526
1717
|
}
|
|
1527
1718
|
if (name === "root") {
|
|
1528
1719
|
this.state.pageLength = value?.items?.length || 0;
|
|
1529
|
-
this.emit("root-change", value);
|
|
1720
|
+
this.emit("root-change", value, preValue);
|
|
1530
1721
|
}
|
|
1531
1722
|
}
|
|
1532
1723
|
get(name) {
|
|
@@ -1586,7 +1777,7 @@
|
|
|
1586
1777
|
if (page) {
|
|
1587
1778
|
historyService.changePage(vue.toRaw(page));
|
|
1588
1779
|
} else {
|
|
1589
|
-
historyService.
|
|
1780
|
+
historyService.resetState();
|
|
1590
1781
|
}
|
|
1591
1782
|
if (node?.id) {
|
|
1592
1783
|
this.get("stage")?.renderer.runtime?.getApp?.()?.emit(
|
|
@@ -1684,6 +1875,9 @@
|
|
|
1684
1875
|
}
|
|
1685
1876
|
const newNodes = await Promise.all(
|
|
1686
1877
|
addNodes.map((node) => {
|
|
1878
|
+
if (utils.isPage(node)) {
|
|
1879
|
+
return this.doAdd(node, this.get("root"));
|
|
1880
|
+
}
|
|
1687
1881
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
1688
1882
|
if (!parentNode)
|
|
1689
1883
|
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
@@ -1702,7 +1896,9 @@
|
|
|
1702
1896
|
stage?.select(newNodes[0].id);
|
|
1703
1897
|
}
|
|
1704
1898
|
}
|
|
1705
|
-
|
|
1899
|
+
if (!utils.isPage(newNodes[0])) {
|
|
1900
|
+
this.pushHistoryState();
|
|
1901
|
+
}
|
|
1706
1902
|
this.emit("add", newNodes);
|
|
1707
1903
|
return Array.isArray(addNode) ? newNodes : newNodes[0];
|
|
1708
1904
|
}
|
|
@@ -1744,7 +1940,9 @@
|
|
|
1744
1940
|
async remove(nodeOrNodeList) {
|
|
1745
1941
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
1746
1942
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
1747
|
-
|
|
1943
|
+
if (!utils.isPage(nodes[0])) {
|
|
1944
|
+
this.pushHistoryState();
|
|
1945
|
+
}
|
|
1748
1946
|
this.emit("remove", nodes);
|
|
1749
1947
|
}
|
|
1750
1948
|
async doUpdate(config) {
|
|
@@ -1756,6 +1954,9 @@
|
|
|
1756
1954
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
1757
1955
|
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, this.get("root"));
|
|
1758
1956
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1957
|
+
if (lodashEs.isObject(srcValue) && Array.isArray(objValue)) {
|
|
1958
|
+
return srcValue;
|
|
1959
|
+
}
|
|
1759
1960
|
if (Array.isArray(srcValue)) {
|
|
1760
1961
|
return srcValue;
|
|
1761
1962
|
}
|
|
@@ -1799,6 +2000,7 @@
|
|
|
1799
2000
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
1800
2001
|
this.pushHistoryState();
|
|
1801
2002
|
this.emit("update", newNodes);
|
|
2003
|
+
codeBlockService.refreshCombineInfo();
|
|
1802
2004
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
1803
2005
|
}
|
|
1804
2006
|
async sort(id1, id2) {
|
|
@@ -1828,8 +2030,16 @@
|
|
|
1828
2030
|
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
1829
2031
|
if (!Array.isArray(config))
|
|
1830
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
|
+
}
|
|
1831
2041
|
const pasteConfigs = await this.doPaste(config, position);
|
|
1832
|
-
return this.add(pasteConfigs);
|
|
2042
|
+
return this.add(pasteConfigs, parent);
|
|
1833
2043
|
}
|
|
1834
2044
|
async doPaste(config, position = {}) {
|
|
1835
2045
|
const pasteConfigs = await beforePaste(position, lodashEs.cloneDeep(config));
|
|
@@ -1864,7 +2074,11 @@
|
|
|
1864
2074
|
const stage = this.get("stage");
|
|
1865
2075
|
const newNodes = await Promise.all(nodes.map((node) => this.doAlignCenter(node)));
|
|
1866
2076
|
const newNode = await this.update(newNodes);
|
|
1867
|
-
|
|
2077
|
+
if (newNodes.length > 1) {
|
|
2078
|
+
await stage?.multiSelect(newNodes.map((node) => node.id));
|
|
2079
|
+
} else {
|
|
2080
|
+
await stage?.select(newNodes[0].id);
|
|
2081
|
+
}
|
|
1868
2082
|
return newNode;
|
|
1869
2083
|
}
|
|
1870
2084
|
async moveLayer(offset) {
|
|
@@ -1950,8 +2164,7 @@
|
|
|
1950
2164
|
}
|
|
1951
2165
|
});
|
|
1952
2166
|
}
|
|
1953
|
-
|
|
1954
|
-
this.removeAllListeners();
|
|
2167
|
+
resetState() {
|
|
1955
2168
|
this.set("root", null);
|
|
1956
2169
|
this.set("node", null);
|
|
1957
2170
|
this.set("nodes", []);
|
|
@@ -1962,6 +2175,11 @@
|
|
|
1962
2175
|
this.set("modifiedNodeIds", /* @__PURE__ */ new Map());
|
|
1963
2176
|
this.set("pageLength", /* @__PURE__ */ new Map());
|
|
1964
2177
|
}
|
|
2178
|
+
destroy() {
|
|
2179
|
+
this.removeAllListeners();
|
|
2180
|
+
this.resetState();
|
|
2181
|
+
this.removeAllPlugins();
|
|
2182
|
+
}
|
|
1965
2183
|
resetModifiedNodeId() {
|
|
1966
2184
|
this.get("modifiedNodeIds").clear();
|
|
1967
2185
|
}
|
|
@@ -1971,6 +2189,12 @@
|
|
|
1971
2189
|
return null;
|
|
1972
2190
|
return root.codeBlocks || null;
|
|
1973
2191
|
}
|
|
2192
|
+
getCodeDslSync() {
|
|
2193
|
+
const root = this.get("root");
|
|
2194
|
+
if (!root)
|
|
2195
|
+
return null;
|
|
2196
|
+
return root.codeBlocks || null;
|
|
2197
|
+
}
|
|
1974
2198
|
async setCodeDsl(codeDsl) {
|
|
1975
2199
|
if (!this.state.root)
|
|
1976
2200
|
return;
|
|
@@ -2082,10 +2306,14 @@
|
|
|
2082
2306
|
getMethod(type) {
|
|
2083
2307
|
return lodashEs.cloneDeep(methodMap[type] || core.DEFAULT_METHODS);
|
|
2084
2308
|
}
|
|
2085
|
-
|
|
2309
|
+
resetState() {
|
|
2086
2310
|
eventMap = vue.reactive({});
|
|
2087
2311
|
methodMap = vue.reactive({});
|
|
2312
|
+
}
|
|
2313
|
+
destroy() {
|
|
2314
|
+
this.resetState();
|
|
2088
2315
|
this.removeAllListeners();
|
|
2316
|
+
this.removeAllPlugins();
|
|
2089
2317
|
}
|
|
2090
2318
|
}
|
|
2091
2319
|
const eventsService = new Events();
|
|
@@ -2285,14 +2513,14 @@
|
|
|
2285
2513
|
{
|
|
2286
2514
|
name: "created",
|
|
2287
2515
|
text: "created",
|
|
2288
|
-
|
|
2289
|
-
|
|
2516
|
+
labelWidth: "100px",
|
|
2517
|
+
type: "code-select"
|
|
2290
2518
|
},
|
|
2291
2519
|
{
|
|
2292
2520
|
name: "mounted",
|
|
2293
2521
|
text: "mounted",
|
|
2294
|
-
|
|
2295
|
-
|
|
2522
|
+
labelWidth: "100px",
|
|
2523
|
+
type: "code-select"
|
|
2296
2524
|
}
|
|
2297
2525
|
]
|
|
2298
2526
|
}
|
|
@@ -2360,8 +2588,19 @@
|
|
|
2360
2588
|
}
|
|
2361
2589
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
2362
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
|
+
}
|
|
2363
2600
|
destroy() {
|
|
2601
|
+
this.resetState();
|
|
2364
2602
|
this.removeAllListeners();
|
|
2603
|
+
this.removeAllPlugins();
|
|
2365
2604
|
}
|
|
2366
2605
|
async setStageRect(value) {
|
|
2367
2606
|
state.stageRect = {
|
|
@@ -2388,6 +2627,7 @@
|
|
|
2388
2627
|
containerHighlightClassName: stageOptions.containerHighlightClassName,
|
|
2389
2628
|
containerHighlightDuration: stageOptions.containerHighlightDuration,
|
|
2390
2629
|
containerHighlightType: stageOptions.containerHighlightType,
|
|
2630
|
+
disabledDragStart: stageOptions.disabledDragStart,
|
|
2391
2631
|
canSelect: (el, event, stop) => {
|
|
2392
2632
|
const elCanSelect = stageOptions.canSelect(el);
|
|
2393
2633
|
if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
|
|
@@ -2399,225 +2639,97 @@
|
|
|
2399
2639
|
moveableOptions: stageOptions.moveableOptions,
|
|
2400
2640
|
updateDragEl: stageOptions.updateDragEl
|
|
2401
2641
|
});
|
|
2402
|
-
stage.mask.setGuides([
|
|
2403
|
-
getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)),
|
|
2404
|
-
getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
|
|
2405
|
-
]);
|
|
2406
|
-
stage.on("select", (el) => {
|
|
2407
|
-
if (`${editorService.get("node")?.id}` === el.id)
|
|
2408
|
-
return;
|
|
2409
|
-
editorService.select(el.id);
|
|
2410
|
-
});
|
|
2411
|
-
stage.on("highlight", (el) => {
|
|
2412
|
-
editorService.highlight(el.id);
|
|
2413
|
-
});
|
|
2414
|
-
stage.on("
|
|
2415
|
-
editorService.multiSelect(els.map((el) => el.id));
|
|
2416
|
-
});
|
|
2417
|
-
stage.on("update", (ev) => {
|
|
2418
|
-
if (ev.parentEl) {
|
|
2419
|
-
for (const data of ev.data) {
|
|
2420
|
-
editorService.moveToContainer({ id: data.el.id, style: data.style }, ev.parentEl.id);
|
|
2421
|
-
}
|
|
2422
|
-
return;
|
|
2423
|
-
}
|
|
2424
|
-
editorService.update(ev.data.map((data) => ({ id: data.el.id, style: data.style })));
|
|
2425
|
-
});
|
|
2426
|
-
stage.on("sort", (ev) => {
|
|
2427
|
-
editorService.sort(ev.src, ev.dist);
|
|
2428
|
-
});
|
|
2429
|
-
stage.on("select-parent", () => {
|
|
2430
|
-
const parent = editorService.get("parent");
|
|
2431
|
-
editorService.select(parent);
|
|
2432
|
-
editorService.get("stage").select(parent.id);
|
|
2433
|
-
});
|
|
2434
|
-
stage.on("changeGuides", (e) => {
|
|
2435
|
-
uiService.set("showGuides", true);
|
|
2436
|
-
if (!root.value || !page.value)
|
|
2437
|
-
return;
|
|
2438
|
-
const storageKey = getGuideLineKey(
|
|
2439
|
-
e.type === StageCore.GuidesType.HORIZONTAL ? H_GUIDE_LINE_STORAGE_KEY : V_GUIDE_LINE_STORAGE_KEY
|
|
2440
|
-
);
|
|
2441
|
-
if (e.guides.length) {
|
|
2442
|
-
globalThis.localStorage.setItem(storageKey, JSON.stringify(e.guides));
|
|
2443
|
-
} else {
|
|
2444
|
-
globalThis.localStorage.removeItem(storageKey);
|
|
2445
|
-
}
|
|
2446
|
-
});
|
|
2447
|
-
return stage;
|
|
2448
|
-
};
|
|
2449
|
-
|
|
2450
|
-
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
2451
|
-
const _hoisted_2$5 = { class: "m-editor-empty-content" };
|
|
2452
|
-
const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2453
|
-
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
2454
|
-
__name: "AddPageBox",
|
|
2455
|
-
setup(__props) {
|
|
2456
|
-
const services = vue.inject("services");
|
|
2457
|
-
const clickHandler = () => {
|
|
2458
|
-
const { editorService } = services || {};
|
|
2459
|
-
if (!editorService)
|
|
2460
|
-
return;
|
|
2461
|
-
editorService.add({
|
|
2462
|
-
type: schema.NodeType.PAGE,
|
|
2463
|
-
name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
|
|
2464
|
-
});
|
|
2465
|
-
};
|
|
2466
|
-
return (_ctx, _cache) => {
|
|
2467
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
2468
|
-
vue.createElementVNode("div", _hoisted_2$5, [
|
|
2469
|
-
vue.createElementVNode("div", {
|
|
2470
|
-
class: "m-editor-empty-button",
|
|
2471
|
-
onClick: clickHandler
|
|
2472
|
-
}, [
|
|
2473
|
-
vue.createElementVNode("div", null, [
|
|
2474
|
-
vue.createVNode(_sfc_main$o, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2475
|
-
]),
|
|
2476
|
-
_hoisted_3$2
|
|
2477
|
-
])
|
|
2478
|
-
])
|
|
2479
|
-
]);
|
|
2480
|
-
};
|
|
2481
|
-
}
|
|
2482
|
-
});
|
|
2483
|
-
|
|
2484
|
-
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
2485
|
-
__name: "Resizer",
|
|
2486
|
-
emits: ["change"],
|
|
2487
|
-
setup(__props, { emit }) {
|
|
2488
|
-
const target = vue.ref();
|
|
2489
|
-
let getso;
|
|
2490
|
-
vue.onMounted(() => {
|
|
2491
|
-
if (!target.value)
|
|
2492
|
-
return;
|
|
2493
|
-
getso = new Gesto__default.default(target.value, {
|
|
2494
|
-
container: window,
|
|
2495
|
-
pinchOutside: true
|
|
2496
|
-
}).on("drag", (e) => {
|
|
2497
|
-
if (!target.value)
|
|
2498
|
-
return;
|
|
2499
|
-
emit("change", e.deltaX);
|
|
2500
|
-
});
|
|
2501
|
-
});
|
|
2502
|
-
vue.onUnmounted(() => {
|
|
2503
|
-
getso?.unset();
|
|
2504
|
-
});
|
|
2505
|
-
return (_ctx, _cache) => {
|
|
2506
|
-
return vue.openBlock(), vue.createElementBlock("span", {
|
|
2507
|
-
ref_key: "target",
|
|
2508
|
-
ref: target,
|
|
2509
|
-
class: "m-editor-resizer"
|
|
2510
|
-
}, [
|
|
2511
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
2512
|
-
], 512);
|
|
2513
|
-
};
|
|
2514
|
-
}
|
|
2515
|
-
});
|
|
2516
|
-
|
|
2517
|
-
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
2518
|
-
__name: "Layout",
|
|
2519
|
-
props: {
|
|
2520
|
-
left: null,
|
|
2521
|
-
right: null,
|
|
2522
|
-
minLeft: { default: 1 },
|
|
2523
|
-
minRight: { default: 1 },
|
|
2524
|
-
leftClass: null,
|
|
2525
|
-
rightClass: null,
|
|
2526
|
-
centerClass: null
|
|
2527
|
-
},
|
|
2528
|
-
emits: ["update:left", "change", "update:right"],
|
|
2529
|
-
setup(__props, { emit }) {
|
|
2530
|
-
const props = __props;
|
|
2531
|
-
const el = vue.ref();
|
|
2532
|
-
let clientWidth = 0;
|
|
2533
|
-
const resizerObserver = new ResizeObserver((entries) => {
|
|
2534
|
-
for (const { contentRect } of entries) {
|
|
2535
|
-
clientWidth = contentRect.width;
|
|
2536
|
-
center.value = clientWidth - (props.left || 0) - (props.right || 0);
|
|
2537
|
-
emit("change", {
|
|
2538
|
-
left: props.left,
|
|
2539
|
-
center: center.value,
|
|
2540
|
-
right: props.right
|
|
2541
|
-
});
|
|
2542
|
-
}
|
|
2543
|
-
});
|
|
2544
|
-
vue.onMounted(() => {
|
|
2545
|
-
if (el.value) {
|
|
2546
|
-
resizerObserver.observe(el.value);
|
|
2547
|
-
}
|
|
2548
|
-
});
|
|
2549
|
-
vue.onUnmounted(() => {
|
|
2550
|
-
resizerObserver.disconnect();
|
|
2551
|
-
});
|
|
2552
|
-
const center = vue.ref(0);
|
|
2553
|
-
const changeLeft = (deltaX) => {
|
|
2554
|
-
if (typeof props.left === "undefined")
|
|
2555
|
-
return;
|
|
2556
|
-
let left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
2557
|
-
emit("update:left", left);
|
|
2558
|
-
if (clientWidth - left - (props.right || 0) <= 0) {
|
|
2559
|
-
left = props.left;
|
|
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);
|
|
2560
2661
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
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)
|
|
2570
2703
|
return;
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
right = props.right;
|
|
2575
|
-
}
|
|
2576
|
-
center.value = clientWidth - (props.left || 0) - right;
|
|
2577
|
-
emit("change", {
|
|
2578
|
-
left: props.left,
|
|
2579
|
-
center: center.value,
|
|
2580
|
-
right
|
|
2704
|
+
editorService.add({
|
|
2705
|
+
type: schema.NodeType.PAGE,
|
|
2706
|
+
name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
|
|
2581
2707
|
});
|
|
2582
2708
|
};
|
|
2583
2709
|
return (_ctx, _cache) => {
|
|
2584
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
2585
|
-
|
|
2586
|
-
ref: el,
|
|
2587
|
-
class: "m-editor-layout"
|
|
2588
|
-
}, [
|
|
2589
|
-
typeof props.left !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
2590
|
-
vue.createElementVNode("div", {
|
|
2591
|
-
class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
2592
|
-
style: vue.normalizeStyle(`width: ${__props.left}px`)
|
|
2593
|
-
}, [
|
|
2594
|
-
vue.renderSlot(_ctx.$slots, "left")
|
|
2595
|
-
], 6),
|
|
2596
|
-
vue.createVNode(_sfc_main$m, { onChange: changeLeft })
|
|
2597
|
-
], 64)) : vue.createCommentVNode("", true),
|
|
2598
|
-
vue.createElementVNode("div", {
|
|
2599
|
-
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
2600
|
-
style: vue.normalizeStyle(`width: ${center.value}px`)
|
|
2601
|
-
}, [
|
|
2602
|
-
vue.renderSlot(_ctx.$slots, "center")
|
|
2603
|
-
], 6),
|
|
2604
|
-
typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
2605
|
-
vue.createVNode(_sfc_main$m, { onChange: changeRight }),
|
|
2710
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
|
|
2711
|
+
vue.createElementVNode("div", _hoisted_2$7, [
|
|
2606
2712
|
vue.createElementVNode("div", {
|
|
2607
|
-
class:
|
|
2608
|
-
|
|
2713
|
+
class: "m-editor-empty-button",
|
|
2714
|
+
onClick: clickHandler
|
|
2609
2715
|
}, [
|
|
2610
|
-
vue.
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
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
|
+
]);
|
|
2614
2723
|
};
|
|
2615
2724
|
}
|
|
2616
2725
|
});
|
|
2617
2726
|
|
|
2618
|
-
const _hoisted_1$
|
|
2619
|
-
const
|
|
2620
|
-
|
|
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,
|
|
2621
2733
|
props: {
|
|
2622
2734
|
codeOptions: { default: () => ({}) }
|
|
2623
2735
|
},
|
|
@@ -2683,7 +2795,7 @@
|
|
|
2683
2795
|
};
|
|
2684
2796
|
return (_ctx, _cache) => {
|
|
2685
2797
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2686
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2798
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
2687
2799
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2688
2800
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2689
2801
|
key: 0,
|
|
@@ -2691,7 +2803,7 @@
|
|
|
2691
2803
|
"init-values": vue.unref(root),
|
|
2692
2804
|
options: __props.codeOptions,
|
|
2693
2805
|
onSave: saveCode
|
|
2694
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2806
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
2695
2807
|
key: 1,
|
|
2696
2808
|
class: "m-editor-content",
|
|
2697
2809
|
"left-class": "m-editor-framework-left",
|
|
@@ -2710,7 +2822,7 @@
|
|
|
2710
2822
|
]),
|
|
2711
2823
|
center: vue.withCtx(() => [
|
|
2712
2824
|
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2713
|
-
vue.createVNode(_sfc_main$
|
|
2825
|
+
vue.createVNode(_sfc_main$m)
|
|
2714
2826
|
])
|
|
2715
2827
|
]),
|
|
2716
2828
|
_: 2
|
|
@@ -2732,13 +2844,16 @@
|
|
|
2732
2844
|
}
|
|
2733
2845
|
});
|
|
2734
2846
|
|
|
2735
|
-
const _hoisted_1$
|
|
2847
|
+
const _hoisted_1$b = {
|
|
2736
2848
|
key: 1,
|
|
2737
2849
|
class: "menu-item-text"
|
|
2738
2850
|
};
|
|
2739
|
-
const _hoisted_2$
|
|
2740
|
-
const
|
|
2741
|
-
|
|
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,
|
|
2742
2857
|
props: {
|
|
2743
2858
|
data: { default: () => ({
|
|
2744
2859
|
type: "text",
|
|
@@ -2813,7 +2928,7 @@
|
|
|
2813
2928
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
2814
2929
|
key: 0,
|
|
2815
2930
|
direction: __props.data.direction || "vertical"
|
|
2816
|
-
}, 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 }, [
|
|
2817
2932
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
2818
2933
|
key: 0,
|
|
2819
2934
|
effect: "dark",
|
|
@@ -2827,7 +2942,7 @@
|
|
|
2827
2942
|
disabled: vue.unref(disabled)
|
|
2828
2943
|
}, {
|
|
2829
2944
|
default: vue.withCtx(() => [
|
|
2830
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2945
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2831
2946
|
key: 0,
|
|
2832
2947
|
icon: __props.data.icon
|
|
2833
2948
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2844,7 +2959,7 @@
|
|
|
2844
2959
|
disabled: vue.unref(disabled)
|
|
2845
2960
|
}, {
|
|
2846
2961
|
default: vue.withCtx(() => [
|
|
2847
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2962
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2848
2963
|
key: 0,
|
|
2849
2964
|
icon: __props.data.icon
|
|
2850
2965
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2877,7 +2992,7 @@
|
|
|
2877
2992
|
})) : vue.createCommentVNode("", true)
|
|
2878
2993
|
]),
|
|
2879
2994
|
default: vue.withCtx(() => [
|
|
2880
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
2995
|
+
vue.createElementVNode("span", _hoisted_2$6, [
|
|
2881
2996
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
2882
2997
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
2883
2998
|
default: vue.withCtx(() => [
|
|
@@ -2894,8 +3009,11 @@
|
|
|
2894
3009
|
}
|
|
2895
3010
|
});
|
|
2896
3011
|
|
|
2897
|
-
const
|
|
2898
|
-
|
|
3012
|
+
const __default__$i = vue.defineComponent({
|
|
3013
|
+
name: "MEditorNavMenu"
|
|
3014
|
+
});
|
|
3015
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
3016
|
+
...__default__$i,
|
|
2899
3017
|
props: {
|
|
2900
3018
|
data: { default: () => ({}) },
|
|
2901
3019
|
height: { default: 35 }
|
|
@@ -3050,7 +3168,7 @@
|
|
|
3050
3168
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
3051
3169
|
}, [
|
|
3052
3170
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
3053
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3171
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3054
3172
|
data: item,
|
|
3055
3173
|
key: index
|
|
3056
3174
|
}, null, 8, ["data"]);
|
|
@@ -3062,9 +3180,12 @@
|
|
|
3062
3180
|
}
|
|
3063
3181
|
});
|
|
3064
3182
|
|
|
3065
|
-
const _hoisted_1$
|
|
3066
|
-
const
|
|
3067
|
-
|
|
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,
|
|
3068
3189
|
emits: ["mounted"],
|
|
3069
3190
|
setup(__props, { expose, emit }) {
|
|
3070
3191
|
const internalInstance = vue.getCurrentInstance();
|
|
@@ -3073,7 +3194,9 @@
|
|
|
3073
3194
|
const curFormConfig = vue.ref([]);
|
|
3074
3195
|
const services = vue.inject("services");
|
|
3075
3196
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3076
|
-
const propsPanelSize = vue.computed(
|
|
3197
|
+
const propsPanelSize = vue.computed(
|
|
3198
|
+
() => services?.uiService.get("propsPanelSize") || "small"
|
|
3199
|
+
);
|
|
3077
3200
|
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
3078
3201
|
const init = async () => {
|
|
3079
3202
|
if (!node.value) {
|
|
@@ -3089,6 +3212,9 @@
|
|
|
3089
3212
|
vue.onMounted(() => {
|
|
3090
3213
|
emit("mounted", internalInstance);
|
|
3091
3214
|
});
|
|
3215
|
+
vue.onUnmounted(() => {
|
|
3216
|
+
services?.propsService.off("props-configs-change", init);
|
|
3217
|
+
});
|
|
3092
3218
|
vue.watchEffect(() => {
|
|
3093
3219
|
if (configForm.value && stage.value) {
|
|
3094
3220
|
configForm.value.formState.stage = stage.value;
|
|
@@ -3106,10 +3232,9 @@
|
|
|
3106
3232
|
};
|
|
3107
3233
|
expose({ submit });
|
|
3108
3234
|
return (_ctx, _cache) => {
|
|
3109
|
-
|
|
3110
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
|
|
3235
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
3111
3236
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3112
|
-
vue.createVNode(
|
|
3237
|
+
vue.createVNode(vue.unref(form.MForm), {
|
|
3113
3238
|
ref_key: "configForm",
|
|
3114
3239
|
ref: configForm,
|
|
3115
3240
|
class: vue.normalizeClass(`m-editor-props-panel ${vue.unref(propsPanelSize)}`),
|
|
@@ -3124,43 +3249,328 @@
|
|
|
3124
3249
|
}
|
|
3125
3250
|
});
|
|
3126
3251
|
|
|
3127
|
-
const _hoisted_1$
|
|
3128
|
-
|
|
3129
|
-
const _hoisted_3$1 = { class: "code-name" };
|
|
3130
|
-
const _hoisted_4$1 = { class: "code-name-wrapper" };
|
|
3131
|
-
const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3132
|
-
const _hoisted_6$1 = { class: "m-editor-wrapper" };
|
|
3133
|
-
const _hoisted_7$1 = {
|
|
3134
|
-
key: 1,
|
|
3252
|
+
const _hoisted_1$9 = {
|
|
3253
|
+
key: 0,
|
|
3135
3254
|
class: "m-editor-content-bottom"
|
|
3136
3255
|
};
|
|
3137
|
-
const
|
|
3138
|
-
const
|
|
3139
|
-
const
|
|
3140
|
-
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,
|
|
3141
3260
|
class: "m-editor-content-bottom"
|
|
3142
3261
|
};
|
|
3143
|
-
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
|
+
});
|
|
3144
3422
|
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
3145
|
-
|
|
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,
|
|
3146
3556
|
setup(__props) {
|
|
3147
3557
|
const services = vue.inject("services");
|
|
3148
|
-
const
|
|
3558
|
+
const codeOptions = vue.inject("codeOptions", {});
|
|
3149
3559
|
const left = vue.ref(200);
|
|
3150
3560
|
const currentTitle = vue.ref("");
|
|
3151
3561
|
const codeConfig = vue.ref(null);
|
|
3152
3562
|
const state = vue.reactive({
|
|
3153
3563
|
codeList: []
|
|
3154
3564
|
});
|
|
3155
|
-
const isShowCodeBlockEditor = vue.computed(
|
|
3156
|
-
() => codeConfig.value && services?.codeBlockService.getCodeEditorShowStatus() || false
|
|
3157
|
-
);
|
|
3158
3565
|
const mode = vue.computed(() => services?.codeBlockService.getMode());
|
|
3159
3566
|
const id = vue.computed(() => services?.codeBlockService.getId() || "");
|
|
3160
3567
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3161
3568
|
const selectedIds = vue.computed(() => services?.codeBlockService.getCombineIds() || []);
|
|
3162
3569
|
vue.watchEffect(async () => {
|
|
3163
|
-
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);
|
|
3164
3574
|
});
|
|
3165
3575
|
vue.watchEffect(async () => {
|
|
3166
3576
|
const codeDsl = await services?.codeBlockService.getCodeDslByIds(selectedIds.value) || null;
|
|
@@ -3175,47 +3585,24 @@
|
|
|
3175
3585
|
});
|
|
3176
3586
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3177
3587
|
});
|
|
3178
|
-
const saveCode = async () => {
|
|
3179
|
-
if (!codeEditor.value || !codeConfig.value || !editable.value)
|
|
3180
|
-
return true;
|
|
3181
|
-
try {
|
|
3182
|
-
const codeContent = codeEditor.value.getEditor()?.getValue();
|
|
3183
|
-
codeConfig.value.content = eval(codeContent);
|
|
3184
|
-
} catch (e) {
|
|
3185
|
-
design.tMagicMessage.error(e.stack);
|
|
3186
|
-
return false;
|
|
3187
|
-
}
|
|
3188
|
-
await services?.codeBlockService.setCodeDslById(id.value, {
|
|
3189
|
-
name: codeConfig.value.name,
|
|
3190
|
-
content: codeConfig.value.content
|
|
3191
|
-
});
|
|
3192
|
-
design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3193
|
-
return true;
|
|
3194
|
-
};
|
|
3195
|
-
const saveAndClose = async () => {
|
|
3196
|
-
const saveRes = await saveCode();
|
|
3197
|
-
if (saveRes) {
|
|
3198
|
-
await services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3199
|
-
}
|
|
3200
|
-
};
|
|
3201
3588
|
const selectHandler = (data) => {
|
|
3202
3589
|
services?.codeBlockService.setId(data.id);
|
|
3203
3590
|
currentTitle.value = data.name;
|
|
3204
3591
|
};
|
|
3205
3592
|
return (_ctx, _cache) => {
|
|
3206
3593
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDialog), {
|
|
3207
|
-
|
|
3208
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
|
|
3594
|
+
"model-value": true,
|
|
3209
3595
|
class: "code-editor-dialog",
|
|
3210
3596
|
title: currentTitle.value,
|
|
3211
3597
|
fullscreen: true,
|
|
3212
|
-
"
|
|
3213
|
-
"append-to-body": true
|
|
3598
|
+
"close-on-press-escape": false,
|
|
3599
|
+
"append-to-body": true,
|
|
3600
|
+
"show-close": false
|
|
3214
3601
|
}, {
|
|
3215
3602
|
default: vue.withCtx(() => [
|
|
3216
|
-
vue.createVNode(_sfc_main$
|
|
3603
|
+
vue.createVNode(_sfc_main$o, {
|
|
3217
3604
|
left: left.value,
|
|
3218
|
-
"onUpdate:left": _cache[
|
|
3605
|
+
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3219
3606
|
"min-left": 45,
|
|
3220
3607
|
class: "code-editor-layout"
|
|
3221
3608
|
}, vue.createSlots({
|
|
@@ -3227,72 +3614,15 @@
|
|
|
3227
3614
|
])
|
|
3228
3615
|
}, [
|
|
3229
3616
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
disabled: !vue.unref(editable)
|
|
3240
|
-
}, null, 8, ["modelValue", "disabled"])) : vue.createCommentVNode("", true)
|
|
3241
|
-
])
|
|
3242
|
-
]),
|
|
3243
|
-
default: vue.withCtx(() => [
|
|
3244
|
-
vue.createElementVNode("div", _hoisted_6$1, [
|
|
3245
|
-
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$p, {
|
|
3246
|
-
key: 0,
|
|
3247
|
-
ref_key: "codeEditor",
|
|
3248
|
-
ref: codeEditor,
|
|
3249
|
-
class: "m-editor-container",
|
|
3250
|
-
"init-values": `${codeConfig.value.content}`,
|
|
3251
|
-
onSave: saveCode,
|
|
3252
|
-
options: {
|
|
3253
|
-
tabSize: 2,
|
|
3254
|
-
fontSize: 16,
|
|
3255
|
-
formatOnPaste: true,
|
|
3256
|
-
readOnly: !vue.unref(editable)
|
|
3257
|
-
}
|
|
3258
|
-
}, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
|
|
3259
|
-
vue.unref(editable) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
|
|
3260
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3261
|
-
type: "primary",
|
|
3262
|
-
class: "button",
|
|
3263
|
-
onClick: saveCode
|
|
3264
|
-
}, {
|
|
3265
|
-
default: vue.withCtx(() => [
|
|
3266
|
-
_hoisted_8$1
|
|
3267
|
-
]),
|
|
3268
|
-
_: 1
|
|
3269
|
-
}),
|
|
3270
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3271
|
-
type: "primary",
|
|
3272
|
-
class: "button",
|
|
3273
|
-
onClick: saveAndClose
|
|
3274
|
-
}, {
|
|
3275
|
-
default: vue.withCtx(() => [
|
|
3276
|
-
_hoisted_9$1
|
|
3277
|
-
]),
|
|
3278
|
-
_: 1
|
|
3279
|
-
})
|
|
3280
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
|
|
3281
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3282
|
-
type: "primary",
|
|
3283
|
-
class: "button",
|
|
3284
|
-
onClick: saveAndClose
|
|
3285
|
-
}, {
|
|
3286
|
-
default: vue.withCtx(() => [
|
|
3287
|
-
_hoisted_11
|
|
3288
|
-
]),
|
|
3289
|
-
_: 1
|
|
3290
|
-
})
|
|
3291
|
-
]))
|
|
3292
|
-
])
|
|
3293
|
-
]),
|
|
3294
|
-
_: 1
|
|
3295
|
-
})
|
|
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)
|
|
3296
3626
|
], 2)) : vue.createCommentVNode("", true)
|
|
3297
3627
|
]),
|
|
3298
3628
|
_: 2
|
|
@@ -3327,7 +3657,7 @@
|
|
|
3327
3657
|
]), 1032, ["left"])
|
|
3328
3658
|
]),
|
|
3329
3659
|
_: 3
|
|
3330
|
-
}, 8, ["
|
|
3660
|
+
}, 8, ["title"]);
|
|
3331
3661
|
};
|
|
3332
3662
|
}
|
|
3333
3663
|
});
|
|
@@ -3354,8 +3684,11 @@
|
|
|
3354
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"
|
|
3355
3685
|
})
|
|
3356
3686
|
], -1);
|
|
3357
|
-
const
|
|
3358
|
-
|
|
3687
|
+
const __default__$d = vue.defineComponent({
|
|
3688
|
+
name: "MEditorCodeBlockList"
|
|
3689
|
+
});
|
|
3690
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
3691
|
+
...__default__$d,
|
|
3359
3692
|
props: {
|
|
3360
3693
|
customError: null
|
|
3361
3694
|
},
|
|
@@ -3363,41 +3696,38 @@
|
|
|
3363
3696
|
const props = __props;
|
|
3364
3697
|
const services = vue.inject("services");
|
|
3365
3698
|
const state = vue.reactive({
|
|
3366
|
-
codeList: []
|
|
3367
|
-
bindComps: {}
|
|
3699
|
+
codeList: []
|
|
3368
3700
|
});
|
|
3369
3701
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
const
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
id: compId,
|
|
3380
|
-
name: getCompName(compId)
|
|
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)
|
|
3381
3711
|
}));
|
|
3382
|
-
state.bindComps[codeId] = compsInfo;
|
|
3383
3712
|
};
|
|
3384
3713
|
const initList = async () => {
|
|
3385
|
-
const codeDsl = await services?.codeBlockService.getCodeDsl() || null;
|
|
3386
|
-
|
|
3714
|
+
const codeDsl = lodashEs.cloneDeep(await services?.codeBlockService.getCodeDsl()) || null;
|
|
3715
|
+
codeCombineInfo.value = lodashEs.cloneDeep(services?.codeBlockService.getCombineInfo()) || null;
|
|
3716
|
+
if (!codeDsl || !codeCombineInfo.value)
|
|
3387
3717
|
return;
|
|
3388
3718
|
state.codeList = [];
|
|
3389
3719
|
lodashEs.forIn(codeDsl, (value, codeId) => {
|
|
3390
|
-
getBindCompsByCodeId(codeId, value);
|
|
3391
3720
|
state.codeList.push({
|
|
3392
3721
|
id: codeId,
|
|
3393
3722
|
name: value.name,
|
|
3394
3723
|
codeBlockContent: value,
|
|
3395
|
-
showRelation: true
|
|
3724
|
+
showRelation: true,
|
|
3725
|
+
combineInfo: getBindCompsByCodeId(codeId)
|
|
3396
3726
|
});
|
|
3397
3727
|
});
|
|
3398
3728
|
};
|
|
3399
3729
|
vue.watch(
|
|
3400
|
-
() => services?.codeBlockService.
|
|
3730
|
+
[() => services?.codeBlockService.getCodeDslSync(), () => services?.codeBlockService.refreshCombineInfo()],
|
|
3401
3731
|
() => {
|
|
3402
3732
|
initList();
|
|
3403
3733
|
},
|
|
@@ -3406,20 +3736,6 @@
|
|
|
3406
3736
|
deep: true
|
|
3407
3737
|
}
|
|
3408
3738
|
);
|
|
3409
|
-
vue.watch(
|
|
3410
|
-
() => services?.editorService.get("node"),
|
|
3411
|
-
(curNode) => {
|
|
3412
|
-
if (!curNode?.id)
|
|
3413
|
-
return;
|
|
3414
|
-
lodashEs.forIn(state.bindComps, (bindCompInfo) => {
|
|
3415
|
-
bindCompInfo.forEach((comp) => {
|
|
3416
|
-
if (comp.id === curNode.id) {
|
|
3417
|
-
comp.name = curNode.name;
|
|
3418
|
-
}
|
|
3419
|
-
});
|
|
3420
|
-
});
|
|
3421
|
-
}
|
|
3422
|
-
);
|
|
3423
3739
|
const createCodeBlock = async () => {
|
|
3424
3740
|
const { codeBlockService } = services || {};
|
|
3425
3741
|
if (!codeBlockService) {
|
|
@@ -3428,9 +3744,10 @@
|
|
|
3428
3744
|
}
|
|
3429
3745
|
const codeConfig = {
|
|
3430
3746
|
name: "\u4EE3\u7801\u5757",
|
|
3431
|
-
content: `() => {
|
|
3747
|
+
content: `({app, params}) => {
|
|
3432
3748
|
// place your code here
|
|
3433
|
-
}
|
|
3749
|
+
}`,
|
|
3750
|
+
params: []
|
|
3434
3751
|
};
|
|
3435
3752
|
await codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3436
3753
|
const id = await codeBlockService.getUniqueId();
|
|
@@ -3442,7 +3759,8 @@
|
|
|
3442
3759
|
services?.codeBlockService.setCodeEditorContent(true, key);
|
|
3443
3760
|
};
|
|
3444
3761
|
const deleteCode = (key) => {
|
|
3445
|
-
const
|
|
3762
|
+
const currentCode = state.codeList.find((codeItem) => codeItem.id === key);
|
|
3763
|
+
const existBinds = !lodashEs.isEmpty(currentCode?.combineInfo);
|
|
3446
3764
|
const undeleteableList = services?.codeBlockService.getUndeletableList() || [];
|
|
3447
3765
|
if (!existBinds && !undeleteableList.includes(key)) {
|
|
3448
3766
|
services?.codeBlockService.deleteCodeDslByIds([key]);
|
|
@@ -3508,110 +3826,118 @@
|
|
|
3508
3826
|
})) : vue.createCommentVNode("", true)
|
|
3509
3827
|
])
|
|
3510
3828
|
]),
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
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)
|
|
3579
3918
|
]),
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(state.bindComps[data.id], (comp, index) => {
|
|
3583
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3584
|
-
key: index,
|
|
3585
|
-
class: "code-comp",
|
|
3586
|
-
size: "small",
|
|
3587
|
-
plain: true,
|
|
3588
|
-
onClick: vue.withModifiers(($event) => selectComp(comp.id), ["stop"])
|
|
3589
|
-
}, {
|
|
3590
|
-
default: vue.withCtx(() => [
|
|
3591
|
-
vue.createTextVNode(vue.toDisplayString(comp.name), 1)
|
|
3592
|
-
]),
|
|
3593
|
-
_: 2
|
|
3594
|
-
}, 1032, ["onClick"]);
|
|
3595
|
-
}), 128))
|
|
3596
|
-
])) : vue.createCommentVNode("", true)
|
|
3597
|
-
], 8, _hoisted_4)
|
|
3919
|
+
_: 3
|
|
3920
|
+
}, 8, ["data"])) : vue.createCommentVNode("", true)
|
|
3598
3921
|
]),
|
|
3599
3922
|
_: 3
|
|
3600
|
-
}
|
|
3601
|
-
vue.
|
|
3923
|
+
}),
|
|
3924
|
+
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, { key: 0 }, {
|
|
3602
3925
|
"code-block-edit-panel-header": vue.withCtx(({ id }) => [
|
|
3603
3926
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
3604
3927
|
]),
|
|
3605
3928
|
_: 3
|
|
3606
|
-
})
|
|
3929
|
+
})) : vue.createCommentVNode("", true)
|
|
3607
3930
|
]);
|
|
3608
3931
|
};
|
|
3609
3932
|
}
|
|
3610
3933
|
});
|
|
3611
3934
|
|
|
3612
3935
|
const _hoisted_1$5 = ["onClick", "onDragstart"];
|
|
3613
|
-
const
|
|
3614
|
-
|
|
3936
|
+
const __default__$c = vue.defineComponent({
|
|
3937
|
+
name: "MEditorComponentListPanel"
|
|
3938
|
+
});
|
|
3939
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
3940
|
+
...__default__$c,
|
|
3615
3941
|
setup(__props) {
|
|
3616
3942
|
const searchText = vue.ref("");
|
|
3617
3943
|
const services = vue.inject("services");
|
|
@@ -3700,7 +4026,7 @@
|
|
|
3700
4026
|
name: `${index}`
|
|
3701
4027
|
}, {
|
|
3702
4028
|
title: vue.withCtx(() => [
|
|
3703
|
-
vue.createVNode(_sfc_main$
|
|
4029
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
3704
4030
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
3705
4031
|
]),
|
|
3706
4032
|
default: vue.withCtx(() => [
|
|
@@ -3715,7 +4041,7 @@
|
|
|
3715
4041
|
onDrag: dragHandler
|
|
3716
4042
|
}, [
|
|
3717
4043
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
3718
|
-
vue.createVNode(_sfc_main$
|
|
4044
|
+
vue.createVNode(_sfc_main$n, {
|
|
3719
4045
|
icon: item.icon
|
|
3720
4046
|
}, null, 8, ["icon"]),
|
|
3721
4047
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
@@ -3746,8 +4072,11 @@
|
|
|
3746
4072
|
}
|
|
3747
4073
|
});
|
|
3748
4074
|
|
|
3749
|
-
const
|
|
3750
|
-
|
|
4075
|
+
const __default__$b = vue.defineComponent({
|
|
4076
|
+
name: "MEditorContentMenu"
|
|
4077
|
+
});
|
|
4078
|
+
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
4079
|
+
...__default__$b,
|
|
3751
4080
|
props: {
|
|
3752
4081
|
menuData: { default: () => [] },
|
|
3753
4082
|
isSubMenu: { type: Boolean, default: false }
|
|
@@ -3835,7 +4164,7 @@
|
|
|
3835
4164
|
}, [
|
|
3836
4165
|
vue.createElementVNode("div", null, [
|
|
3837
4166
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
3838
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4167
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3839
4168
|
"event-type": "mouseup",
|
|
3840
4169
|
data: item,
|
|
3841
4170
|
key: index,
|
|
@@ -3861,16 +4190,22 @@
|
|
|
3861
4190
|
}
|
|
3862
4191
|
});
|
|
3863
4192
|
|
|
3864
|
-
const
|
|
3865
|
-
|
|
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
|
+
},
|
|
3866
4201
|
setup(__props, { expose }) {
|
|
4202
|
+
const props = __props;
|
|
3867
4203
|
const services = vue.inject("services");
|
|
3868
4204
|
const menu = vue.ref();
|
|
3869
4205
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3870
4206
|
const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
|
|
3871
4207
|
const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
|
|
3872
4208
|
const componentList = vue.computed(() => services?.componentListService.getList() || []);
|
|
3873
|
-
const layerContentMenu = vue.inject("layerContentMenu", []);
|
|
3874
4209
|
const createMenuItems = (group) => group.items.map((component) => ({
|
|
3875
4210
|
text: component.text,
|
|
3876
4211
|
type: "button",
|
|
@@ -3925,7 +4260,7 @@
|
|
|
3925
4260
|
{
|
|
3926
4261
|
type: "button",
|
|
3927
4262
|
text: "\u590D\u5236",
|
|
3928
|
-
icon: vue.markRaw(iconsVue.
|
|
4263
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
3929
4264
|
display: () => !isRoot.value,
|
|
3930
4265
|
handler: () => {
|
|
3931
4266
|
node.value && services?.editorService.copy(node.value);
|
|
@@ -3940,7 +4275,7 @@
|
|
|
3940
4275
|
node.value && services?.editorService.remove(node.value);
|
|
3941
4276
|
}
|
|
3942
4277
|
},
|
|
3943
|
-
...layerContentMenu
|
|
4278
|
+
...props.layerContentMenu
|
|
3944
4279
|
]);
|
|
3945
4280
|
const show = (e) => {
|
|
3946
4281
|
menu.value?.show(e);
|
|
@@ -3949,7 +4284,7 @@
|
|
|
3949
4284
|
show
|
|
3950
4285
|
});
|
|
3951
4286
|
return (_ctx, _cache) => {
|
|
3952
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4287
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$c, {
|
|
3953
4288
|
"menu-data": vue.unref(menuData),
|
|
3954
4289
|
ref_key: "menu",
|
|
3955
4290
|
ref: menu,
|
|
@@ -3960,27 +4295,42 @@
|
|
|
3960
4295
|
});
|
|
3961
4296
|
|
|
3962
4297
|
const _hoisted_1$4 = ["id", "onMouseenter"];
|
|
3963
|
-
const
|
|
3964
|
-
|
|
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
|
+
},
|
|
3965
4306
|
setup(__props) {
|
|
3966
4307
|
const throttleTime = 150;
|
|
3967
4308
|
const services = vue.inject("services");
|
|
4309
|
+
const editorService = services?.editorService;
|
|
3968
4310
|
const tree = vue.ref();
|
|
3969
4311
|
const menu = vue.ref();
|
|
3970
|
-
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") || []);
|
|
3971
4331
|
const page = vue.computed(() => editorService?.get("page"));
|
|
3972
4332
|
const values = vue.computed(() => page.value ? [page.value] : []);
|
|
3973
|
-
const
|
|
3974
|
-
const selectedIds = vue.computed(() => selectedNodes.value.map((node) => node.id));
|
|
3975
|
-
const isMultiSelectStatus = vue.ref(false);
|
|
3976
|
-
const spliceNodeKey = vue.ref();
|
|
3977
|
-
const filterText = vue.ref("");
|
|
3978
|
-
const defaultExpandedKeys = vue.computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
|
|
3979
|
-
editorService?.on("remove", () => {
|
|
3980
|
-
setTimeout(() => {
|
|
3981
|
-
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
3982
|
-
}, 0);
|
|
3983
|
-
});
|
|
4333
|
+
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
3984
4334
|
const select = async (data) => {
|
|
3985
4335
|
if (!data.id) {
|
|
3986
4336
|
throw new Error("\u6CA1\u6709id");
|
|
@@ -3999,7 +4349,6 @@
|
|
|
3999
4349
|
editorService?.highlight(data);
|
|
4000
4350
|
editorService?.get("stage")?.highlight(data.id);
|
|
4001
4351
|
};
|
|
4002
|
-
const expandedKeys = /* @__PURE__ */ new Map();
|
|
4003
4352
|
const allowDrop = (draggingNode, dropNode, type) => {
|
|
4004
4353
|
const { data } = dropNode || {};
|
|
4005
4354
|
const { data: ingData } = draggingNode;
|
|
@@ -4031,23 +4380,18 @@
|
|
|
4031
4380
|
const [page2] = data;
|
|
4032
4381
|
editorService?.update(page2);
|
|
4033
4382
|
};
|
|
4034
|
-
const loadItems = (node, resolve) => {
|
|
4035
|
-
if (Array.isArray(node.data)) {
|
|
4036
|
-
return resolve(node.data);
|
|
4037
|
-
}
|
|
4038
|
-
if (Array.isArray(node.data?.items)) {
|
|
4039
|
-
return resolve(node.data?.items);
|
|
4040
|
-
}
|
|
4041
|
-
resolve([]);
|
|
4042
|
-
};
|
|
4043
4383
|
const handleCollapse = (data) => {
|
|
4044
|
-
expandedKeys.
|
|
4384
|
+
expandedKeys.value = expandedKeys.value.filter((id) => id !== data.id);
|
|
4045
4385
|
};
|
|
4046
4386
|
const handleExpand = (data) => {
|
|
4047
|
-
|
|
4048
|
-
|
|
4387
|
+
if (!page.value) {
|
|
4388
|
+
expandedKeys.value = [];
|
|
4049
4389
|
return;
|
|
4050
|
-
|
|
4390
|
+
}
|
|
4391
|
+
expandedKeys.value = lodashEs.union(
|
|
4392
|
+
expandedKeys.value,
|
|
4393
|
+
utils.getNodePath(data.id, [page.value]).map((node) => node.id)
|
|
4394
|
+
);
|
|
4051
4395
|
};
|
|
4052
4396
|
const filterNode = (value, data) => {
|
|
4053
4397
|
if (!value) {
|
|
@@ -4064,121 +4408,78 @@
|
|
|
4064
4408
|
const filterTextChangeHandler = (val) => {
|
|
4065
4409
|
tree.value?.filter(val);
|
|
4066
4410
|
};
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
tree.value.getNode(key)?.expand();
|
|
4080
|
-
});
|
|
4081
|
-
};
|
|
4082
|
-
vue.watch(
|
|
4083
|
-
() => editorService?.get("nodes"),
|
|
4084
|
-
(nodes) => {
|
|
4085
|
-
selectedNodes.value = nodes ?? [];
|
|
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);
|
|
4086
4423
|
}
|
|
4087
|
-
);
|
|
4088
|
-
|
|
4089
|
-
if (!
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
tree.value.setCheckedKeys([]);
|
|
4093
|
-
tree.value.setCurrentKey();
|
|
4094
|
-
} else if (selectedIds.value.length === 1 && !isMultiSelectStatus.value) {
|
|
4095
|
-
tree.value.setCurrentKey(selectedIds.value[0], true);
|
|
4096
|
-
tree.value.setCheckedKeys([]);
|
|
4097
|
-
} else {
|
|
4098
|
-
tree.value.setCheckedKeys(selectedIds.value);
|
|
4099
|
-
tree.value.setCurrentKey();
|
|
4424
|
+
});
|
|
4425
|
+
vue.watch(isMultiSelect, (isMultiSelect2) => {
|
|
4426
|
+
if (!isMultiSelect2) {
|
|
4427
|
+
currentNodeKey.value = editorService?.get("node").id;
|
|
4428
|
+
tree.value?.setCurrentKey(currentNodeKey.value);
|
|
4100
4429
|
}
|
|
4101
|
-
};
|
|
4102
|
-
vue.watch([selectedIds, tree], async () => {
|
|
4103
|
-
if (!tree.value || !editorService)
|
|
4104
|
-
return;
|
|
4105
|
-
const parent = editorService.get("parent");
|
|
4106
|
-
if (!parent?.id)
|
|
4107
|
-
return;
|
|
4108
|
-
const treeNode = tree.value.getNode(parent.id);
|
|
4109
|
-
treeNode?.updateChildren();
|
|
4110
|
-
await expandNodes();
|
|
4111
|
-
setTreeKeyStatus();
|
|
4112
4430
|
});
|
|
4113
|
-
const
|
|
4114
|
-
|
|
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();
|
|
4115
4443
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4116
4444
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
4117
|
-
keycon.
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
})
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
keycon.value.keyup(ctrl, (e) => {
|
|
4126
|
-
e.inputEvent.preventDefault();
|
|
4127
|
-
isMultiSelectStatus.value = false;
|
|
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;
|
|
4128
4453
|
});
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
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
|
+
});
|
|
4137
4461
|
const highlightHandler = lodashEs.throttle((data) => {
|
|
4138
4462
|
highlight(data);
|
|
4139
4463
|
}, throttleTime);
|
|
4140
4464
|
const toggleClickFlag = () => {
|
|
4141
4465
|
clicked.value = !clicked.value;
|
|
4142
4466
|
};
|
|
4143
|
-
const
|
|
4144
|
-
if (
|
|
4145
|
-
|
|
4146
|
-
return data.id === highlightNode?.value?.id && !selectedIds.value.includes(data.id) && spliceNodeKey.value !== data.id;
|
|
4147
|
-
};
|
|
4148
|
-
vue.watch(isMultiSelectStatus, () => {
|
|
4149
|
-
if (isMultiSelectStatus.value && selectedNodes.value.length === 1 && selectedNodes.value[0].type === schema.NodeType.PAGE) {
|
|
4150
|
-
selectedNodes.value = [];
|
|
4151
|
-
}
|
|
4152
|
-
});
|
|
4153
|
-
const multiClickHandler = (data) => {
|
|
4154
|
-
if (!data?.id) {
|
|
4155
|
-
throw new Error("\u6CA1\u6709id");
|
|
4156
|
-
}
|
|
4157
|
-
if (data.type === schema.NodeType.PAGE) {
|
|
4158
|
-
tree.value?.setCheckedKeys([]);
|
|
4159
|
-
return;
|
|
4160
|
-
}
|
|
4161
|
-
const index = selectedNodes.value.findIndex((node) => node.id === data.id);
|
|
4162
|
-
if (index !== -1) {
|
|
4163
|
-
selectedNodes.value.splice(index, 1);
|
|
4164
|
-
spliceNodeKey.value = data.id;
|
|
4467
|
+
const checkHandler = (data, { checkedNodes }) => {
|
|
4468
|
+
if (checkedNodes.length > 0) {
|
|
4469
|
+
multiSelect(checkedNodes.map((node) => node.id));
|
|
4165
4470
|
} else {
|
|
4166
|
-
|
|
4471
|
+
multiSelect(nodes.value.map((node) => node.id));
|
|
4167
4472
|
}
|
|
4168
|
-
tree.value?.setCheckedKeys(selectedIds.value);
|
|
4169
|
-
multiSelect(selectedIds.value);
|
|
4170
4473
|
};
|
|
4171
4474
|
const clickHandler = (data) => {
|
|
4172
|
-
if (
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
}
|
|
4177
|
-
|
|
4178
|
-
select(data);
|
|
4179
|
-
} else {
|
|
4180
|
-
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;
|
|
4181
4481
|
}
|
|
4482
|
+
select(data);
|
|
4182
4483
|
};
|
|
4183
4484
|
const contextmenu = async (event, data) => {
|
|
4184
4485
|
event.preventDefault();
|
|
@@ -4186,11 +4487,7 @@
|
|
|
4186
4487
|
menu.value?.show(event);
|
|
4187
4488
|
};
|
|
4188
4489
|
return (_ctx, _cache) => {
|
|
4189
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), {
|
|
4190
|
-
class: "magic-editor-layer-panel",
|
|
4191
|
-
onMouseenter: addSelectModeListener,
|
|
4192
|
-
onMouseleave: removeSelectModeListener
|
|
4193
|
-
}, {
|
|
4490
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4194
4491
|
default: vue.withCtx(() => [
|
|
4195
4492
|
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4196
4493
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
@@ -4211,30 +4508,30 @@
|
|
|
4211
4508
|
"node-key": "id",
|
|
4212
4509
|
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4213
4510
|
draggable: "",
|
|
4214
|
-
"default-expanded-keys":
|
|
4215
|
-
|
|
4511
|
+
"default-expanded-keys": expandedKeys.value,
|
|
4512
|
+
"default-checked-keys": checkedKeys.value,
|
|
4513
|
+
"current-node-key": currentNodeKey.value,
|
|
4216
4514
|
data: vue.unref(values),
|
|
4217
4515
|
"expand-on-click-node": false,
|
|
4218
|
-
"highlight-current":
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
},
|
|
4516
|
+
"highlight-current": !vue.unref(isMultiSelect),
|
|
4517
|
+
"check-on-click-node": true,
|
|
4518
|
+
props: treeProps,
|
|
4222
4519
|
"filter-node-method": filterNode,
|
|
4223
4520
|
"allow-drop": allowDrop,
|
|
4224
|
-
"show-checkbox":
|
|
4521
|
+
"show-checkbox": vue.unref(isMultiSelect),
|
|
4225
4522
|
onNodeClick: clickHandler,
|
|
4226
4523
|
onNodeContextmenu: contextmenu,
|
|
4227
4524
|
onNodeDragEnd: handleDragEnd,
|
|
4228
4525
|
onNodeCollapse: handleCollapse,
|
|
4229
4526
|
onNodeExpand: handleExpand,
|
|
4230
|
-
onCheck:
|
|
4527
|
+
onCheck: checkHandler,
|
|
4231
4528
|
onMousedown: toggleClickFlag,
|
|
4232
4529
|
onMouseup: toggleClickFlag
|
|
4233
4530
|
}, {
|
|
4234
4531
|
default: vue.withCtx(({ node, data }) => [
|
|
4235
4532
|
vue.createElementVNode("div", {
|
|
4533
|
+
class: "cus-tree-node",
|
|
4236
4534
|
id: data.id,
|
|
4237
|
-
class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4238
4535
|
onMouseenter: ($event) => vue.unref(highlightHandler)(data)
|
|
4239
4536
|
}, [
|
|
4240
4537
|
vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
@@ -4243,15 +4540,16 @@
|
|
|
4243
4540
|
}, () => [
|
|
4244
4541
|
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4245
4542
|
])
|
|
4246
|
-
],
|
|
4543
|
+
], 40, _hoisted_1$4)
|
|
4247
4544
|
]),
|
|
4248
4545
|
_: 3
|
|
4249
|
-
}, 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),
|
|
4250
4547
|
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4251
|
-
vue.createVNode(_sfc_main$
|
|
4548
|
+
vue.createVNode(_sfc_main$b, {
|
|
4252
4549
|
ref_key: "menu",
|
|
4253
|
-
ref: menu
|
|
4254
|
-
|
|
4550
|
+
ref: menu,
|
|
4551
|
+
"layer-content-menu": __props.layerContentMenu
|
|
4552
|
+
}, null, 8, ["layer-content-menu"])
|
|
4255
4553
|
]))
|
|
4256
4554
|
]),
|
|
4257
4555
|
_: 3
|
|
@@ -4264,143 +4562,52 @@
|
|
|
4264
4562
|
key: 1,
|
|
4265
4563
|
class: "magic-editor-tab-panel-title"
|
|
4266
4564
|
};
|
|
4267
|
-
const
|
|
4268
|
-
|
|
4269
|
-
props: {
|
|
4270
|
-
data: null
|
|
4271
|
-
},
|
|
4272
|
-
setup(__props) {
|
|
4273
|
-
const props = __props;
|
|
4274
|
-
const config = vue.computed(() => {
|
|
4275
|
-
if (typeof props.data !== "string") {
|
|
4276
|
-
return props.data;
|
|
4277
|
-
}
|
|
4278
|
-
switch (props.data) {
|
|
4279
|
-
case "component-list":
|
|
4280
|
-
return {
|
|
4281
|
-
type: "component",
|
|
4282
|
-
icon: iconsVue.Coin,
|
|
4283
|
-
text: "\u7EC4\u4EF6",
|
|
4284
|
-
component: _sfc_main$e,
|
|
4285
|
-
slots: {}
|
|
4286
|
-
};
|
|
4287
|
-
case "layer":
|
|
4288
|
-
return {
|
|
4289
|
-
type: "component",
|
|
4290
|
-
icon: iconsVue.Files,
|
|
4291
|
-
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4292
|
-
component: _sfc_main$b,
|
|
4293
|
-
slots: {}
|
|
4294
|
-
};
|
|
4295
|
-
case "code-block":
|
|
4296
|
-
return {
|
|
4297
|
-
type: "component",
|
|
4298
|
-
icon: iconsVue.EditPen,
|
|
4299
|
-
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4300
|
-
component: _sfc_main$f,
|
|
4301
|
-
slots: {}
|
|
4302
|
-
};
|
|
4303
|
-
default:
|
|
4304
|
-
return void 0;
|
|
4305
|
-
}
|
|
4306
|
-
});
|
|
4307
|
-
return (_ctx, _cache) => {
|
|
4308
|
-
return vue.unref(config) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabPane), {
|
|
4309
|
-
key: 0,
|
|
4310
|
-
name: vue.unref(config).text
|
|
4311
|
-
}, {
|
|
4312
|
-
label: vue.withCtx(() => [
|
|
4313
|
-
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4314
|
-
key: vue.unref(config).text
|
|
4315
|
-
}, [
|
|
4316
|
-
vue.unref(config).icon ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
4317
|
-
key: 0,
|
|
4318
|
-
icon: vue.unref(config).icon
|
|
4319
|
-
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4320
|
-
vue.unref(config).text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(vue.unref(config).text), 1)) : vue.createCommentVNode("", true)
|
|
4321
|
-
]))
|
|
4322
|
-
]),
|
|
4323
|
-
default: vue.withCtx(() => [
|
|
4324
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).component), vue.mergeProps(vue.unref(config).props || {}, vue.toHandlers(vue.unref(config)?.listeners || {})), vue.createSlots({ _: 2 }, [
|
|
4325
|
-
__props.data === "component-list" || vue.unref(config).slots?.componentListPanelHeader ? {
|
|
4326
|
-
name: "component-list-panel-header",
|
|
4327
|
-
fn: vue.withCtx(() => [
|
|
4328
|
-
__props.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : vue.unref(config).slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4329
|
-
])
|
|
4330
|
-
} : void 0,
|
|
4331
|
-
__props.data === "component-list" || vue.unref(config).slots?.componentListItem ? {
|
|
4332
|
-
name: "component-list-item",
|
|
4333
|
-
fn: vue.withCtx(({ component }) => [
|
|
4334
|
-
__props.data === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
|
|
4335
|
-
key: 0,
|
|
4336
|
-
component
|
|
4337
|
-
}) : vue.unref(config).slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.componentListItem), {
|
|
4338
|
-
key: 1,
|
|
4339
|
-
component
|
|
4340
|
-
}, null, 8, ["component"])) : vue.createCommentVNode("", true)
|
|
4341
|
-
])
|
|
4342
|
-
} : void 0,
|
|
4343
|
-
__props.data === "layer" || vue.unref(config).slots?.layerPanelHeader ? {
|
|
4344
|
-
name: "layer-panel-header",
|
|
4345
|
-
fn: vue.withCtx(() => [
|
|
4346
|
-
__props.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : vue.unref(config).slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4347
|
-
])
|
|
4348
|
-
} : void 0,
|
|
4349
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockPanelHeader ? {
|
|
4350
|
-
name: "code-block-panel-header",
|
|
4351
|
-
fn: vue.withCtx(() => [
|
|
4352
|
-
__props.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : vue.unref(config).slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4353
|
-
])
|
|
4354
|
-
} : void 0,
|
|
4355
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockPanelTool ? {
|
|
4356
|
-
name: "code-block-panel-tool",
|
|
4357
|
-
fn: vue.withCtx(({ id, data }) => [
|
|
4358
|
-
data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4359
|
-
key: 0,
|
|
4360
|
-
id,
|
|
4361
|
-
data
|
|
4362
|
-
}) : vue.unref(config).slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4363
|
-
])
|
|
4364
|
-
} : void 0,
|
|
4365
|
-
__props.data === "code-block" || vue.unref(config).slots?.codeBlockEditPanelHeader ? {
|
|
4366
|
-
name: "code-block-edit-panel-header",
|
|
4367
|
-
fn: vue.withCtx(({ id }) => [
|
|
4368
|
-
__props.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4369
|
-
key: 0,
|
|
4370
|
-
id
|
|
4371
|
-
}) : vue.unref(config).slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4372
|
-
])
|
|
4373
|
-
} : void 0,
|
|
4374
|
-
__props.data === "layer" || vue.unref(config).slots?.layerNodeContent ? {
|
|
4375
|
-
name: "layer-node-content",
|
|
4376
|
-
fn: vue.withCtx(({ data: nodeData, node }) => [
|
|
4377
|
-
__props.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4378
|
-
key: 0,
|
|
4379
|
-
data: nodeData,
|
|
4380
|
-
node
|
|
4381
|
-
}) : vue.unref(config).slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.layerNodeContent), {
|
|
4382
|
-
key: 1,
|
|
4383
|
-
data: nodeData,
|
|
4384
|
-
node
|
|
4385
|
-
}, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
|
|
4386
|
-
])
|
|
4387
|
-
} : void 0
|
|
4388
|
-
]), 1040))
|
|
4389
|
-
]),
|
|
4390
|
-
_: 3
|
|
4391
|
-
}, 8, ["name"])) : vue.createCommentVNode("", true);
|
|
4392
|
-
};
|
|
4393
|
-
}
|
|
4565
|
+
const __default__$8 = vue.defineComponent({
|
|
4566
|
+
name: "MEditorSidebar"
|
|
4394
4567
|
});
|
|
4395
|
-
|
|
4396
4568
|
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
4397
|
-
|
|
4569
|
+
...__default__$8,
|
|
4398
4570
|
props: {
|
|
4399
|
-
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
|
|
4400
4573
|
},
|
|
4401
4574
|
setup(__props, { expose }) {
|
|
4402
4575
|
const props = __props;
|
|
4576
|
+
const uiComponent = design.getConfig("components").tabPane;
|
|
4403
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)));
|
|
4404
4611
|
vue.watch(
|
|
4405
4612
|
() => props.data.status,
|
|
4406
4613
|
(status) => {
|
|
@@ -4420,60 +4627,91 @@
|
|
|
4420
4627
|
"tab-position": "left"
|
|
4421
4628
|
}, {
|
|
4422
4629
|
default: vue.withCtx(() => [
|
|
4423
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
4424
|
-
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), {
|
|
4425
4632
|
key: index,
|
|
4426
|
-
|
|
4427
|
-
},
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
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"]);
|
|
4477
4715
|
}), 128))
|
|
4478
4716
|
]),
|
|
4479
4717
|
_: 3
|
|
@@ -4487,8 +4725,11 @@
|
|
|
4487
4725
|
class: "m-editor-breadcrumb"
|
|
4488
4726
|
};
|
|
4489
4727
|
const _hoisted_2$1 = { key: 0 };
|
|
4728
|
+
const __default__$7 = vue.defineComponent({
|
|
4729
|
+
name: "MEditorBreadcrumb"
|
|
4730
|
+
});
|
|
4490
4731
|
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
4491
|
-
|
|
4732
|
+
...__default__$7,
|
|
4492
4733
|
setup(__props) {
|
|
4493
4734
|
const services = vue.inject("services");
|
|
4494
4735
|
const editorService = services?.editorService;
|
|
@@ -4528,8 +4769,11 @@
|
|
|
4528
4769
|
key: 1,
|
|
4529
4770
|
style: { "width": "21px" }
|
|
4530
4771
|
};
|
|
4772
|
+
const __default__$6 = vue.defineComponent({
|
|
4773
|
+
name: "MEditorPageBarScrollContainer"
|
|
4774
|
+
});
|
|
4531
4775
|
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
4532
|
-
|
|
4776
|
+
...__default__$6,
|
|
4533
4777
|
setup(__props) {
|
|
4534
4778
|
const services = vue.inject("services");
|
|
4535
4779
|
const editorService = services?.editorService;
|
|
@@ -4610,14 +4854,14 @@
|
|
|
4610
4854
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4611
4855
|
onClick: addPage
|
|
4612
4856
|
}, [
|
|
4613
|
-
vue.createVNode(_sfc_main$
|
|
4857
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4614
4858
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
4615
4859
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4616
4860
|
key: 2,
|
|
4617
4861
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4618
4862
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4619
4863
|
}, [
|
|
4620
|
-
vue.createVNode(_sfc_main$
|
|
4864
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
4621
4865
|
])) : vue.createCommentVNode("", true),
|
|
4622
4866
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4623
4867
|
key: 3,
|
|
@@ -4633,7 +4877,7 @@
|
|
|
4633
4877
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4634
4878
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4635
4879
|
}, [
|
|
4636
|
-
vue.createVNode(_sfc_main$
|
|
4880
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
4637
4881
|
])) : vue.createCommentVNode("", true)
|
|
4638
4882
|
], 512);
|
|
4639
4883
|
};
|
|
@@ -4642,8 +4886,11 @@
|
|
|
4642
4886
|
|
|
4643
4887
|
const _hoisted_1 = ["onClick"];
|
|
4644
4888
|
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
4889
|
+
const __default__$5 = vue.defineComponent({
|
|
4890
|
+
name: "MEditorPageBar"
|
|
4891
|
+
});
|
|
4645
4892
|
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
4646
|
-
|
|
4893
|
+
...__default__$5,
|
|
4647
4894
|
setup(__props) {
|
|
4648
4895
|
const services = vue.inject("services");
|
|
4649
4896
|
const editorService = services?.editorService;
|
|
@@ -4702,7 +4949,7 @@
|
|
|
4702
4949
|
default: vue.withCtx(() => [
|
|
4703
4950
|
vue.createElementVNode("div", null, [
|
|
4704
4951
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4705
|
-
vue.createVNode(_sfc_main$
|
|
4952
|
+
vue.createVNode(_sfc_main$k, {
|
|
4706
4953
|
data: {
|
|
4707
4954
|
type: "button",
|
|
4708
4955
|
text: "\u590D\u5236",
|
|
@@ -4710,7 +4957,7 @@
|
|
|
4710
4957
|
handler: () => copy(item)
|
|
4711
4958
|
}
|
|
4712
4959
|
}, null, 8, ["data"]),
|
|
4713
|
-
vue.createVNode(_sfc_main$
|
|
4960
|
+
vue.createVNode(_sfc_main$k, {
|
|
4714
4961
|
data: {
|
|
4715
4962
|
type: "button",
|
|
4716
4963
|
text: "\u5220\u9664",
|
|
@@ -4744,6 +4991,10 @@
|
|
|
4744
4991
|
height = 0;
|
|
4745
4992
|
translateXCorrectionValue = 0;
|
|
4746
4993
|
translateYCorrectionValue = 0;
|
|
4994
|
+
correctionScrollSize = {
|
|
4995
|
+
width: 0,
|
|
4996
|
+
height: 0
|
|
4997
|
+
};
|
|
4747
4998
|
resizeObserver = new ResizeObserver(() => {
|
|
4748
4999
|
this.setSize();
|
|
4749
5000
|
this.setScrollSize();
|
|
@@ -4753,6 +5004,12 @@
|
|
|
4753
5004
|
this.container = options.container;
|
|
4754
5005
|
this.target = options.target;
|
|
4755
5006
|
this.zoom = options.zoom;
|
|
5007
|
+
if (this.correctionScrollSize) {
|
|
5008
|
+
this.correctionScrollSize = {
|
|
5009
|
+
...this.correctionScrollSize,
|
|
5010
|
+
...options.correctionScrollSize
|
|
5011
|
+
};
|
|
5012
|
+
}
|
|
4756
5013
|
this.container.addEventListener("wheel", this.wheelHandler, false);
|
|
4757
5014
|
this.setSize();
|
|
4758
5015
|
this.setScrollSize();
|
|
@@ -4815,9 +5072,9 @@
|
|
|
4815
5072
|
}
|
|
4816
5073
|
setScrollSize = () => {
|
|
4817
5074
|
const targetRect = this.target.getBoundingClientRect();
|
|
4818
|
-
this.scrollWidth = targetRect.width * this.zoom +
|
|
5075
|
+
this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
|
|
4819
5076
|
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
4820
|
-
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom +
|
|
5077
|
+
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
|
|
4821
5078
|
let left;
|
|
4822
5079
|
let top;
|
|
4823
5080
|
if (this.scrollWidth < this.width) {
|
|
@@ -4850,8 +5107,11 @@
|
|
|
4850
5107
|
};
|
|
4851
5108
|
}
|
|
4852
5109
|
|
|
5110
|
+
const __default__$4 = vue.defineComponent({
|
|
5111
|
+
name: "MEditorScrollBar"
|
|
5112
|
+
});
|
|
4853
5113
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
4854
|
-
|
|
5114
|
+
...__default__$4,
|
|
4855
5115
|
props: {
|
|
4856
5116
|
size: null,
|
|
4857
5117
|
scrollSize: null,
|
|
@@ -4936,14 +5196,21 @@
|
|
|
4936
5196
|
|
|
4937
5197
|
const ScrollBar_vue_vue_type_style_index_0_lang = '';
|
|
4938
5198
|
|
|
5199
|
+
const __default__$3 = vue.defineComponent({
|
|
5200
|
+
name: "MEditorScrollViewer"
|
|
5201
|
+
});
|
|
4939
5202
|
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
4940
|
-
|
|
5203
|
+
...__default__$3,
|
|
4941
5204
|
props: {
|
|
4942
5205
|
width: { default: 0 },
|
|
4943
5206
|
height: { default: 0 },
|
|
4944
5207
|
wrapWidth: { default: 0 },
|
|
4945
5208
|
wrapHeight: { default: 0 },
|
|
4946
|
-
zoom: { default: 1 }
|
|
5209
|
+
zoom: { default: 1 },
|
|
5210
|
+
correctionScrollSize: { default: () => ({
|
|
5211
|
+
width: 0,
|
|
5212
|
+
height: 0
|
|
5213
|
+
}) }
|
|
4947
5214
|
},
|
|
4948
5215
|
setup(__props, { expose }) {
|
|
4949
5216
|
const props = __props;
|
|
@@ -4966,7 +5233,8 @@
|
|
|
4966
5233
|
scrollViewer = new ScrollViewer({
|
|
4967
5234
|
container: container.value,
|
|
4968
5235
|
target: el.value,
|
|
4969
|
-
zoom: props.zoom
|
|
5236
|
+
zoom: props.zoom,
|
|
5237
|
+
correctionScrollSize: props.correctionScrollSize
|
|
4970
5238
|
});
|
|
4971
5239
|
scrollViewer.on("scroll", (data) => {
|
|
4972
5240
|
hOffset.value = data.scrollLeft;
|
|
@@ -5034,10 +5302,14 @@
|
|
|
5034
5302
|
}
|
|
5035
5303
|
});
|
|
5036
5304
|
|
|
5305
|
+
const __default__$2 = vue.defineComponent({
|
|
5306
|
+
name: "MEditorViewerMenu"
|
|
5307
|
+
});
|
|
5037
5308
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
5038
|
-
|
|
5309
|
+
...__default__$2,
|
|
5039
5310
|
props: {
|
|
5040
|
-
isMultiSelect: { type: Boolean, default: false }
|
|
5311
|
+
isMultiSelect: { type: Boolean, default: false },
|
|
5312
|
+
stageContentMenu: null
|
|
5041
5313
|
},
|
|
5042
5314
|
setup(__props, { expose }) {
|
|
5043
5315
|
const props = __props;
|
|
@@ -5050,8 +5322,7 @@
|
|
|
5050
5322
|
const nodes = vue.computed(() => editorService?.get("nodes"));
|
|
5051
5323
|
const parent = vue.computed(() => editorService?.get("parent"));
|
|
5052
5324
|
const stage = vue.computed(() => editorService?.get("stage"));
|
|
5053
|
-
const
|
|
5054
|
-
const menuData = vue.reactive([
|
|
5325
|
+
const menuData = vue.computed(() => [
|
|
5055
5326
|
{
|
|
5056
5327
|
type: "button",
|
|
5057
5328
|
text: "\u6C34\u5E73\u5C45\u4E2D",
|
|
@@ -5065,7 +5336,7 @@
|
|
|
5065
5336
|
{
|
|
5066
5337
|
type: "button",
|
|
5067
5338
|
text: "\u590D\u5236",
|
|
5068
|
-
icon: vue.markRaw(iconsVue.
|
|
5339
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
5069
5340
|
handler: () => {
|
|
5070
5341
|
nodes.value && editorService?.copy(nodes.value);
|
|
5071
5342
|
canPaste.value = true;
|
|
@@ -5074,6 +5345,7 @@
|
|
|
5074
5345
|
{
|
|
5075
5346
|
type: "button",
|
|
5076
5347
|
text: "\u7C98\u8D34",
|
|
5348
|
+
icon: vue.markRaw(iconsVue.DocumentCopy),
|
|
5077
5349
|
display: () => canPaste.value,
|
|
5078
5350
|
handler: () => {
|
|
5079
5351
|
const rect = menu.value?.$el.getBoundingClientRect();
|
|
@@ -5153,7 +5425,7 @@
|
|
|
5153
5425
|
editorService?.get("stage").clearGuides();
|
|
5154
5426
|
}
|
|
5155
5427
|
},
|
|
5156
|
-
...stageContentMenu
|
|
5428
|
+
...props.stageContentMenu
|
|
5157
5429
|
]);
|
|
5158
5430
|
vue.watch(
|
|
5159
5431
|
parent,
|
|
@@ -5176,8 +5448,8 @@
|
|
|
5176
5448
|
};
|
|
5177
5449
|
expose({ show });
|
|
5178
5450
|
return (_ctx, _cache) => {
|
|
5179
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5180
|
-
"menu-data": menuData,
|
|
5451
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$c, {
|
|
5452
|
+
"menu-data": vue.unref(menuData),
|
|
5181
5453
|
ref_key: "menu",
|
|
5182
5454
|
ref: menu
|
|
5183
5455
|
}, null, 8, ["menu-data"]);
|
|
@@ -5185,8 +5457,14 @@
|
|
|
5185
5457
|
}
|
|
5186
5458
|
});
|
|
5187
5459
|
|
|
5460
|
+
const __default__$1 = vue.defineComponent({
|
|
5461
|
+
name: "MEditorStage"
|
|
5462
|
+
});
|
|
5188
5463
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
5189
|
-
|
|
5464
|
+
...__default__$1,
|
|
5465
|
+
props: {
|
|
5466
|
+
stageContentMenu: null
|
|
5467
|
+
},
|
|
5190
5468
|
setup(__props) {
|
|
5191
5469
|
let stage = null;
|
|
5192
5470
|
let runtime = null;
|
|
@@ -5203,7 +5481,7 @@
|
|
|
5203
5481
|
const zoom = vue.computed(() => services?.uiService.get("zoom") || 1);
|
|
5204
5482
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
5205
5483
|
vue.watchEffect(() => {
|
|
5206
|
-
if (stage)
|
|
5484
|
+
if (stage || !page.value)
|
|
5207
5485
|
return;
|
|
5208
5486
|
if (!stageContainer.value)
|
|
5209
5487
|
return;
|
|
@@ -5233,6 +5511,14 @@
|
|
|
5233
5511
|
runtime.updateRootConfig?.(lodashEs.cloneDeep(vue.toRaw(root2)));
|
|
5234
5512
|
}
|
|
5235
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
|
+
});
|
|
5236
5522
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
5237
5523
|
for (const { contentRect } of entries) {
|
|
5238
5524
|
services?.uiService.set("stageContainerRect", {
|
|
@@ -5305,7 +5591,11 @@
|
|
|
5305
5591
|
height: vue.unref(stageRect)?.height,
|
|
5306
5592
|
"wrap-width": vue.unref(stageContainerRect)?.width,
|
|
5307
5593
|
"wrap-height": vue.unref(stageContainerRect)?.height,
|
|
5308
|
-
zoom: vue.unref(zoom)
|
|
5594
|
+
zoom: vue.unref(zoom),
|
|
5595
|
+
"correction-scroll-size": {
|
|
5596
|
+
width: 60,
|
|
5597
|
+
height: 50
|
|
5598
|
+
}
|
|
5309
5599
|
}, {
|
|
5310
5600
|
default: vue.withCtx(() => [
|
|
5311
5601
|
vue.createElementVNode("div", {
|
|
@@ -5321,8 +5611,9 @@
|
|
|
5321
5611
|
vue.createVNode(_sfc_main$3, {
|
|
5322
5612
|
ref_key: "menu",
|
|
5323
5613
|
ref: menu,
|
|
5324
|
-
"is-multi-select": vue.unref(isMultiSelect)
|
|
5325
|
-
|
|
5614
|
+
"is-multi-select": vue.unref(isMultiSelect),
|
|
5615
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5616
|
+
}, null, 8, ["is-multi-select", "stage-content-menu"])
|
|
5326
5617
|
]))
|
|
5327
5618
|
]),
|
|
5328
5619
|
_: 1
|
|
@@ -5331,8 +5622,14 @@
|
|
|
5331
5622
|
}
|
|
5332
5623
|
});
|
|
5333
5624
|
|
|
5625
|
+
const __default__ = vue.defineComponent({
|
|
5626
|
+
name: "MEditorWorkspace"
|
|
5627
|
+
});
|
|
5334
5628
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
5335
|
-
|
|
5629
|
+
...__default__,
|
|
5630
|
+
props: {
|
|
5631
|
+
stageContentMenu: null
|
|
5632
|
+
},
|
|
5336
5633
|
setup(__props) {
|
|
5337
5634
|
const services = vue.inject("services");
|
|
5338
5635
|
const workspace = vue.ref();
|
|
@@ -5443,9 +5740,10 @@
|
|
|
5443
5740
|
}, [
|
|
5444
5741
|
vue.createVNode(_sfc_main$8),
|
|
5445
5742
|
vue.renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
5446
|
-
(vue.openBlock(), vue.createBlock(_sfc_main$2, {
|
|
5447
|
-
key:
|
|
5448
|
-
|
|
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)
|
|
5449
5747
|
]),
|
|
5450
5748
|
vue.renderSlot(_ctx.$slots, "workspace-content"),
|
|
5451
5749
|
vue.createVNode(_sfc_main$6, null, {
|
|
@@ -5475,9 +5773,13 @@
|
|
|
5475
5773
|
getList() {
|
|
5476
5774
|
return this.state.list;
|
|
5477
5775
|
}
|
|
5478
|
-
|
|
5776
|
+
resetState() {
|
|
5479
5777
|
this.state.list = [];
|
|
5778
|
+
}
|
|
5779
|
+
destroy() {
|
|
5780
|
+
this.resetState();
|
|
5480
5781
|
this.removeAllListeners();
|
|
5782
|
+
this.removeAllPlugins();
|
|
5481
5783
|
}
|
|
5482
5784
|
}
|
|
5483
5785
|
const componentListService = new ComponentList();
|
|
@@ -5485,11 +5787,11 @@
|
|
|
5485
5787
|
const _sfc_main = vue.defineComponent({
|
|
5486
5788
|
name: "m-editor",
|
|
5487
5789
|
components: {
|
|
5488
|
-
|
|
5790
|
+
TMagicNavMenu: _sfc_main$j,
|
|
5489
5791
|
Sidebar: _sfc_main$9,
|
|
5490
5792
|
Workspace: _sfc_main$1,
|
|
5491
|
-
PropsPanel: _sfc_main$
|
|
5492
|
-
Framework: _sfc_main$
|
|
5793
|
+
PropsPanel: _sfc_main$i,
|
|
5794
|
+
Framework: _sfc_main$l
|
|
5493
5795
|
},
|
|
5494
5796
|
props: {
|
|
5495
5797
|
modelValue: {
|
|
@@ -5504,6 +5806,10 @@
|
|
|
5504
5806
|
sidebar: {
|
|
5505
5807
|
type: Object
|
|
5506
5808
|
},
|
|
5809
|
+
menu: {
|
|
5810
|
+
type: Object,
|
|
5811
|
+
default: () => ({ left: [], right: [] })
|
|
5812
|
+
},
|
|
5507
5813
|
layerContentMenu: {
|
|
5508
5814
|
type: Array,
|
|
5509
5815
|
default: () => []
|
|
@@ -5512,10 +5818,6 @@
|
|
|
5512
5818
|
type: Array,
|
|
5513
5819
|
default: () => []
|
|
5514
5820
|
},
|
|
5515
|
-
menu: {
|
|
5516
|
-
type: Object,
|
|
5517
|
-
default: () => ({ left: [], right: [] })
|
|
5518
|
-
},
|
|
5519
5821
|
render: {
|
|
5520
5822
|
type: Function
|
|
5521
5823
|
},
|
|
@@ -5549,7 +5851,7 @@
|
|
|
5549
5851
|
},
|
|
5550
5852
|
containerHighlightClassName: {
|
|
5551
5853
|
type: String,
|
|
5552
|
-
default: StageCore.
|
|
5854
|
+
default: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME
|
|
5553
5855
|
},
|
|
5554
5856
|
containerHighlightDuration: {
|
|
5555
5857
|
type: Number,
|
|
@@ -5568,20 +5870,33 @@
|
|
|
5568
5870
|
},
|
|
5569
5871
|
updateDragEl: {
|
|
5570
5872
|
type: Function
|
|
5873
|
+
},
|
|
5874
|
+
disabledDragStart: {
|
|
5875
|
+
type: Boolean
|
|
5571
5876
|
}
|
|
5572
5877
|
},
|
|
5573
5878
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
5574
5879
|
setup(props, { emit }) {
|
|
5575
|
-
|
|
5576
|
-
const
|
|
5577
|
-
|
|
5578
|
-
if (nodeId
|
|
5579
|
-
editorService.
|
|
5580
|
-
}
|
|
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) {
|
|
5581
5891
|
editorService.set("nodes", [value]);
|
|
5892
|
+
editorService.set("parent", null);
|
|
5893
|
+
editorService.set("page", null);
|
|
5582
5894
|
}
|
|
5583
|
-
|
|
5584
|
-
|
|
5895
|
+
if (vue.toRaw(value) !== vue.toRaw(preValue)) {
|
|
5896
|
+
emit("update:modelValue", value);
|
|
5897
|
+
}
|
|
5898
|
+
};
|
|
5899
|
+
editorService.on("root-change", rootChangeHandler);
|
|
5585
5900
|
vue.watch(
|
|
5586
5901
|
() => props.modelValue,
|
|
5587
5902
|
(modelValue) => {
|
|
@@ -5643,13 +5958,13 @@
|
|
|
5643
5958
|
}
|
|
5644
5959
|
);
|
|
5645
5960
|
vue.onUnmounted(() => {
|
|
5646
|
-
editorService.
|
|
5647
|
-
historyService.
|
|
5648
|
-
propsService.
|
|
5649
|
-
uiService.
|
|
5650
|
-
componentListService.
|
|
5651
|
-
|
|
5652
|
-
|
|
5961
|
+
editorService.resetState();
|
|
5962
|
+
historyService.resetState();
|
|
5963
|
+
propsService.resetState();
|
|
5964
|
+
uiService.resetState();
|
|
5965
|
+
componentListService.resetState();
|
|
5966
|
+
codeBlockService.resetState();
|
|
5967
|
+
editorService.off("root-change", rootChangeHandler);
|
|
5653
5968
|
});
|
|
5654
5969
|
const services = {
|
|
5655
5970
|
componentListService,
|
|
@@ -5662,8 +5977,7 @@
|
|
|
5662
5977
|
codeBlockService
|
|
5663
5978
|
};
|
|
5664
5979
|
vue.provide("services", services);
|
|
5665
|
-
vue.provide("
|
|
5666
|
-
vue.provide("stageContentMenu", props.stageContentMenu);
|
|
5980
|
+
vue.provide("codeOptions", props.codeOptions);
|
|
5667
5981
|
vue.provide(
|
|
5668
5982
|
"stageOptions",
|
|
5669
5983
|
vue.reactive({
|
|
@@ -5676,7 +5990,8 @@
|
|
|
5676
5990
|
isContainer: props.isContainer,
|
|
5677
5991
|
containerHighlightClassName: props.containerHighlightClassName,
|
|
5678
5992
|
containerHighlightDuration: props.containerHighlightDuration,
|
|
5679
|
-
containerHighlightType: props.containerHighlightType
|
|
5993
|
+
containerHighlightType: props.containerHighlightType,
|
|
5994
|
+
disabledDragStart: props.disabledDragStart
|
|
5680
5995
|
})
|
|
5681
5996
|
);
|
|
5682
5997
|
return services;
|
|
@@ -5692,20 +6007,23 @@
|
|
|
5692
6007
|
};
|
|
5693
6008
|
|
|
5694
6009
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5695
|
-
const
|
|
5696
|
-
const
|
|
5697
|
-
const
|
|
5698
|
-
const
|
|
5699
|
-
const
|
|
5700
|
-
return vue.openBlock(), vue.createBlock(
|
|
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 }, {
|
|
5701
6016
|
nav: vue.withCtx(() => [
|
|
5702
6017
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
5703
|
-
vue.createVNode(
|
|
6018
|
+
vue.createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
5704
6019
|
])
|
|
5705
6020
|
]),
|
|
5706
6021
|
sidebar: vue.withCtx(() => [
|
|
5707
6022
|
vue.renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
5708
|
-
vue.createVNode(
|
|
6023
|
+
vue.createVNode(_component_Sidebar, {
|
|
6024
|
+
data: _ctx.sidebar,
|
|
6025
|
+
"layer-content-menu": _ctx.layerContentMenu
|
|
6026
|
+
}, {
|
|
5709
6027
|
"layer-panel-header": vue.withCtx(() => [
|
|
5710
6028
|
vue.renderSlot(_ctx.$slots, "layer-panel-header")
|
|
5711
6029
|
]),
|
|
@@ -5734,12 +6052,12 @@
|
|
|
5734
6052
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
5735
6053
|
]),
|
|
5736
6054
|
_: 3
|
|
5737
|
-
}, 8, ["data"])
|
|
6055
|
+
}, 8, ["data", "layer-content-menu"])
|
|
5738
6056
|
])
|
|
5739
6057
|
]),
|
|
5740
6058
|
workspace: vue.withCtx(() => [
|
|
5741
6059
|
vue.renderSlot(_ctx.$slots, "workspace", { editorService: _ctx.editorService }, () => [
|
|
5742
|
-
vue.createVNode(
|
|
6060
|
+
vue.createVNode(_component_Workspace, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
5743
6061
|
stage: vue.withCtx(() => [
|
|
5744
6062
|
vue.renderSlot(_ctx.$slots, "stage")
|
|
5745
6063
|
]),
|
|
@@ -5753,12 +6071,12 @@
|
|
|
5753
6071
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
5754
6072
|
]),
|
|
5755
6073
|
_: 3
|
|
5756
|
-
})
|
|
6074
|
+
}, 8, ["stage-content-menu"])
|
|
5757
6075
|
])
|
|
5758
6076
|
]),
|
|
5759
6077
|
"props-panel": vue.withCtx(() => [
|
|
5760
6078
|
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
5761
|
-
vue.createVNode(
|
|
6079
|
+
vue.createVNode(_component_PropsPanel, {
|
|
5762
6080
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
5763
6081
|
}, {
|
|
5764
6082
|
"props-panel-header": vue.withCtx(() => [
|
|
@@ -5785,35 +6103,37 @@
|
|
|
5785
6103
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
5786
6104
|
setConfig(option);
|
|
5787
6105
|
app.component(Editor.name, Editor);
|
|
5788
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
5789
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
5790
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
5791
|
-
app.component("magic-code-editor", _sfc_main$
|
|
5792
|
-
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);
|
|
5793
6111
|
}
|
|
5794
6112
|
};
|
|
5795
6113
|
|
|
6114
|
+
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
5796
6115
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
5797
|
-
exports.CodeBlockList = _sfc_main$
|
|
6116
|
+
exports.CodeBlockList = _sfc_main$e;
|
|
5798
6117
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
5799
6118
|
exports.CodeEditorMode = CodeEditorMode;
|
|
5800
|
-
exports.CodeSelect = _sfc_main$
|
|
5801
|
-
exports.CodeSelectOp = CodeSelectOp;
|
|
6119
|
+
exports.CodeSelect = _sfc_main$s;
|
|
5802
6120
|
exports.ColumnLayout = ColumnLayout;
|
|
5803
|
-
exports.ComponentListPanel = _sfc_main$
|
|
5804
|
-
exports.ContentMenu = _sfc_main$
|
|
6121
|
+
exports.ComponentListPanel = _sfc_main$d;
|
|
6122
|
+
exports.ContentMenu = _sfc_main$c;
|
|
5805
6123
|
exports.Fixed2Other = Fixed2Other;
|
|
5806
6124
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
5807
|
-
exports.Icon = _sfc_main$
|
|
6125
|
+
exports.Icon = _sfc_main$n;
|
|
5808
6126
|
exports.Keys = Keys;
|
|
5809
6127
|
exports.LayerOffset = LayerOffset;
|
|
5810
|
-
exports.LayerPanel = _sfc_main$
|
|
6128
|
+
exports.LayerPanel = _sfc_main$a;
|
|
5811
6129
|
exports.Layout = Layout;
|
|
5812
|
-
exports.
|
|
5813
|
-
exports.
|
|
6130
|
+
exports.LayoutContainer = _sfc_main$o;
|
|
6131
|
+
exports.PropsPanel = _sfc_main$i;
|
|
6132
|
+
exports.TMagicCodeEditor = _sfc_main$q;
|
|
5814
6133
|
exports.TMagicEditor = Editor;
|
|
5815
|
-
exports.ToolButton = _sfc_main$
|
|
6134
|
+
exports.ToolButton = _sfc_main$k;
|
|
5816
6135
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
6136
|
+
exports.beforePaste = beforePaste;
|
|
5817
6137
|
exports.change2Fixed = change2Fixed;
|
|
5818
6138
|
exports.codeBlockService = codeBlockService;
|
|
5819
6139
|
exports.debug = debug;
|
|
@@ -5826,18 +6146,22 @@
|
|
|
5826
6146
|
exports.fixNodePosition = fixNodePosition;
|
|
5827
6147
|
exports.generatePageName = generatePageName;
|
|
5828
6148
|
exports.generatePageNameByApp = generatePageNameByApp;
|
|
6149
|
+
exports.getAddParent = getAddParent;
|
|
5829
6150
|
exports.getConfig = getConfig;
|
|
6151
|
+
exports.getDefaultConfig = getDefaultConfig;
|
|
5830
6152
|
exports.getGuideLineFromCache = getGuideLineFromCache;
|
|
5831
6153
|
exports.getInitPositionStyle = getInitPositionStyle;
|
|
5832
6154
|
exports.getNodeIndex = getNodeIndex;
|
|
5833
6155
|
exports.getPageList = getPageList;
|
|
5834
6156
|
exports.getPageNameList = getPageNameList;
|
|
6157
|
+
exports.getPositionInContainer = getPositionInContainer;
|
|
5835
6158
|
exports.getRelativeStyle = getRelativeStyle;
|
|
5836
6159
|
exports.historyService = historyService;
|
|
5837
6160
|
exports.info = info;
|
|
5838
6161
|
exports.isFixed = isFixed;
|
|
5839
6162
|
exports.log = log;
|
|
5840
6163
|
exports.propsService = propsService;
|
|
6164
|
+
exports.serializeConfig = serializeConfig;
|
|
5841
6165
|
exports.setConfig = setConfig;
|
|
5842
6166
|
exports.setLayout = setLayout;
|
|
5843
6167
|
exports.storageService = storageService;
|
|
@@ -5848,4 +6172,4 @@
|
|
|
5848
6172
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
5849
6173
|
|
|
5850
6174
|
}));
|
|
5851
|
-
//# sourceMappingURL=tmagic-editor.umd.
|
|
6175
|
+
//# sourceMappingURL=tmagic-editor.umd.cjs.map
|