@tmagic/editor 1.2.0-beta.2 → 1.2.0-beta.21
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 +41 -28
- package/dist/{tmagic-editor.mjs → tmagic-editor.js} +1693 -1272
- package/dist/tmagic-editor.js.map +1 -0
- package/dist/{tmagic-editor.umd.js → tmagic-editor.umd.cjs} +1700 -1274
- package/dist/tmagic-editor.umd.cjs.map +1 -0
- package/package.json +16 -14
- package/src/Editor.vue +54 -37
- package/src/components/CodeDraftEditor.vue +145 -0
- package/src/components/ContentMenu.vue +4 -4
- package/src/components/FunctionEditor.vue +145 -0
- package/src/components/Icon.vue +7 -5
- package/src/components/Layout.vue +149 -0
- package/src/components/ScrollBar.vue +1 -1
- package/src/components/ScrollViewer.vue +10 -1
- package/src/components/ToolButton.vue +30 -15
- package/src/fields/Code.vue +1 -1
- package/src/fields/CodeLink.vue +1 -1
- package/src/fields/CodeSelect.vue +89 -110
- package/src/fields/UISelect.vue +9 -8
- package/src/index.ts +1 -0
- package/src/layouts/AddPageBox.vue +3 -2
- package/src/layouts/CodeEditor.vue +2 -3
- package/src/layouts/Framework.vue +62 -40
- package/src/layouts/NavMenu.vue +1 -1
- package/src/layouts/PropsPanel.vue +11 -13
- package/src/layouts/Resizer.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +15 -13
- package/src/layouts/sidebar/LayerMenu.vue +9 -7
- package/src/layouts/sidebar/LayerPanel.vue +277 -177
- package/src/layouts/sidebar/Sidebar.vue +113 -27
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +34 -85
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +55 -89
- package/src/layouts/workspace/Breadcrumb.vue +32 -0
- package/src/layouts/workspace/PageBar.vue +12 -11
- 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 +10 -3
- package/src/services/BaseService.ts +6 -1
- package/src/services/codeBlock.ts +124 -125
- package/src/services/componentList.ts +6 -1
- package/src/services/editor.ts +43 -19
- 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/breadcrumb.scss +6 -0
- package/src/theme/code-block.scss +30 -21
- package/src/theme/component-list-panel.scss +3 -7
- package/src/theme/layer-panel.scss +7 -2
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +76 -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 +9 -2
- package/types/Editor.vue.d.ts +42 -29
- package/types/components/CodeDraftEditor.vue.d.ts +148 -0
- package/types/components/ContentMenu.vue.d.ts +1 -3
- package/types/components/FunctionEditor.vue.d.ts +120 -0
- package/types/components/Icon.vue.d.ts +1 -3
- package/types/{layouts → components}/Layout.vue.d.ts +12 -1
- package/types/components/ScrollBar.vue.d.ts +1 -3
- package/types/components/ScrollViewer.vue.d.ts +45 -1
- package/types/components/ToolButton.vue.d.ts +1 -3
- package/types/fields/Code.vue.d.ts +1 -3
- package/types/fields/CodeLink.vue.d.ts +1 -3
- package/types/fields/CodeSelect.vue.d.ts +10 -12
- package/types/fields/UISelect.vue.d.ts +1 -3
- package/types/index.d.ts +1 -0
- package/types/layouts/AddPageBox.vue.d.ts +1 -3
- package/types/layouts/CodeEditor.vue.d.ts +6 -15
- package/types/layouts/NavMenu.vue.d.ts +1 -3
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +25 -9
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +38 -886
- 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/{sidebar/TabPane.vue.d.ts → workspace/Breadcrumb.vue.d.ts} +5 -43
- package/types/layouts/workspace/Stage.vue.d.ts +25 -8
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +6 -3
- 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 +64 -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/Layout.vue +0 -100
- package/src/layouts/sidebar/TabPane.vue +0 -116
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.
|
|
5
|
-
})(this, (function (exports, vue, serialize,
|
|
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$d = { 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$q = /* @__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,125 +153,107 @@
|
|
|
192
153
|
setup(__props, { emit }) {
|
|
193
154
|
const props = __props;
|
|
194
155
|
const services = vue.inject("services");
|
|
195
|
-
const
|
|
156
|
+
const mForm = vue.inject("mForm");
|
|
157
|
+
const codeDsl = vue.computed(() => services?.codeBlockService.getCodeDslSync());
|
|
158
|
+
const tableConfig = vue.computed(() => {
|
|
196
159
|
const defaultConfig = {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
160
|
+
dropSort: true,
|
|
161
|
+
enableFullscreen: false,
|
|
162
|
+
border: true,
|
|
163
|
+
items: [
|
|
164
|
+
{
|
|
165
|
+
type: "select",
|
|
166
|
+
label: "\u4EE3\u7801\u5757",
|
|
167
|
+
name: "codeId",
|
|
168
|
+
width: "200px",
|
|
169
|
+
options: () => {
|
|
170
|
+
if (codeDsl.value) {
|
|
171
|
+
return lodashEs.map(codeDsl.value, (value, key) => ({
|
|
172
|
+
text: `${value.name}\uFF08${key}\uFF09`,
|
|
173
|
+
label: `${value.name}\uFF08${key}\uFF09`,
|
|
174
|
+
value: key
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
return [];
|
|
178
|
+
},
|
|
179
|
+
onChange: (formState, codeId, { model }) => {
|
|
180
|
+
model.params = {};
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "params",
|
|
185
|
+
label: "\u53C2\u6570",
|
|
186
|
+
defaultValue: {},
|
|
187
|
+
itemsFunction: (row) => {
|
|
188
|
+
const paramsConfig = getParamsConfig(row.codeId);
|
|
189
|
+
if (!row.params)
|
|
190
|
+
row.params = {};
|
|
191
|
+
if (lodashEs.isEmpty(row.params)) {
|
|
192
|
+
form.createValues(mForm, paramsConfig, {}, row.params);
|
|
193
|
+
}
|
|
194
|
+
return paramsConfig;
|
|
195
|
+
}
|
|
206
196
|
}
|
|
207
|
-
|
|
208
|
-
}
|
|
197
|
+
]
|
|
209
198
|
};
|
|
210
199
|
return {
|
|
211
200
|
...defaultConfig,
|
|
212
|
-
...props.config.
|
|
201
|
+
...props.config.tableConfig
|
|
213
202
|
};
|
|
214
203
|
});
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
});
|
|
228
|
-
const changeHandler = async (value) => {
|
|
229
|
-
let codeIds = value;
|
|
230
|
-
if (typeof value === "string") {
|
|
231
|
-
multiple.value = false;
|
|
232
|
-
lastTagSnapshot = [lastTagSnapshot];
|
|
233
|
-
codeIds = value ? [value] : [];
|
|
234
|
-
}
|
|
235
|
-
await setCombineRelation(codeIds);
|
|
236
|
-
emit("change", value);
|
|
237
|
-
};
|
|
238
|
-
const setCombineRelation = async (codeIds) => {
|
|
239
|
-
const { id = "" } = services?.editorService.get("node") || {};
|
|
240
|
-
let opFlag = CodeSelectOp.CHANGE;
|
|
241
|
-
let diffValues = codeIds;
|
|
242
|
-
if (multiple.value) {
|
|
243
|
-
opFlag = codeIds.length < lastTagSnapshot.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
|
|
244
|
-
diffValues = lodashEs.xor(codeIds, lastTagSnapshot);
|
|
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
|
|
245
216
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
};
|
|
250
|
-
const setCombineIds = async (codeIds) => {
|
|
251
|
-
combineIds.value = codeIds;
|
|
252
|
-
await services?.codeBlockService.setCombineIds(codeIds);
|
|
217
|
+
);
|
|
218
|
+
const changeHandler = async () => {
|
|
219
|
+
emit("change", props.model[props.name]);
|
|
253
220
|
};
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
+
}));
|
|
262
233
|
};
|
|
263
234
|
return (_ctx, _cache) => {
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
model: __props.model,
|
|
276
|
-
prop: __props.prop,
|
|
277
|
-
name: __props.name,
|
|
278
|
-
size: __props.size,
|
|
279
|
-
onChange: changeHandler
|
|
280
|
-
}, null, 8, ["config", "model", "prop", "name", "size"])
|
|
281
|
-
]),
|
|
282
|
-
default: vue.withCtx(() => [
|
|
283
|
-
vue.createElementVNode("div", _hoisted_1$d, [
|
|
284
|
-
vue.createVNode(_component_el_tooltip, {
|
|
285
|
-
class: "tool-item",
|
|
286
|
-
effect: "dark",
|
|
287
|
-
content: "\u67E5\u770B\u4EE3\u7801\u5757",
|
|
288
|
-
placement: "top"
|
|
289
|
-
}, {
|
|
290
|
-
default: vue.withCtx(() => [
|
|
291
|
-
(vue.openBlock(), vue.createElementBlock("svg", {
|
|
292
|
-
onClick: viewHandler,
|
|
293
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
294
|
-
viewBox: "0 0 24 24",
|
|
295
|
-
width: "15px",
|
|
296
|
-
height: "15px",
|
|
297
|
-
"data-v-65a7fb6c": ""
|
|
298
|
-
}, _hoisted_3$3))
|
|
299
|
-
]),
|
|
300
|
-
_: 1
|
|
301
|
-
})
|
|
302
|
-
])
|
|
303
|
-
]),
|
|
304
|
-
_: 1
|
|
305
|
-
})
|
|
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"])
|
|
306
246
|
]);
|
|
307
247
|
};
|
|
308
248
|
}
|
|
309
249
|
});
|
|
310
250
|
|
|
311
|
-
const _hoisted_1$
|
|
312
|
-
const
|
|
313
|
-
|
|
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,
|
|
314
257
|
props: {
|
|
315
258
|
config: null,
|
|
316
259
|
model: null,
|
|
@@ -360,21 +303,19 @@
|
|
|
360
303
|
}
|
|
361
304
|
};
|
|
362
305
|
return (_ctx, _cache) => {
|
|
363
|
-
const _component_el_button = vue.resolveComponent("el-button");
|
|
364
|
-
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
365
306
|
return uiSelectMode.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
366
307
|
key: 0,
|
|
367
308
|
class: "m-fields-ui-select",
|
|
368
309
|
onClick: cancelHandler
|
|
369
310
|
}, [
|
|
370
|
-
vue.createVNode(
|
|
311
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
371
312
|
type: "danger",
|
|
372
313
|
icon: vue.unref(iconsVue.Delete),
|
|
373
314
|
text: "",
|
|
374
315
|
style: { "padding": "0" }
|
|
375
316
|
}, {
|
|
376
317
|
default: vue.withCtx(() => [
|
|
377
|
-
_hoisted_1$
|
|
318
|
+
_hoisted_1$f
|
|
378
319
|
]),
|
|
379
320
|
_: 1
|
|
380
321
|
}, 8, ["icon"])
|
|
@@ -384,12 +325,12 @@
|
|
|
384
325
|
onClick: startSelect,
|
|
385
326
|
style: { "display": "flex" }
|
|
386
327
|
}, [
|
|
387
|
-
vue.unref(val) ? (vue.openBlock(), vue.createBlock(
|
|
328
|
+
vue.unref(val) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
388
329
|
key: 0,
|
|
389
330
|
content: "\u6E05\u9664"
|
|
390
331
|
}, {
|
|
391
332
|
default: vue.withCtx(() => [
|
|
392
|
-
vue.createVNode(
|
|
333
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
393
334
|
style: { "padding": "0" },
|
|
394
335
|
type: "danger",
|
|
395
336
|
icon: vue.unref(iconsVue.Close),
|
|
@@ -399,11 +340,11 @@
|
|
|
399
340
|
]),
|
|
400
341
|
_: 1
|
|
401
342
|
})) : vue.createCommentVNode("", true),
|
|
402
|
-
vue.createVNode(
|
|
343
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
403
344
|
content: vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
|
|
404
345
|
}, {
|
|
405
346
|
default: vue.withCtx(() => [
|
|
406
|
-
vue.createVNode(
|
|
347
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
407
348
|
text: "",
|
|
408
349
|
style: { "padding": "0", "margin": "0" }
|
|
409
350
|
}, {
|
|
@@ -422,12 +363,15 @@
|
|
|
422
363
|
|
|
423
364
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
424
365
|
|
|
425
|
-
const
|
|
426
|
-
|
|
366
|
+
const __default__$p = vue.defineComponent({
|
|
367
|
+
name: "MEditorCodeEditor"
|
|
368
|
+
});
|
|
369
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
370
|
+
...__default__$p,
|
|
427
371
|
props: {
|
|
428
372
|
initValues: null,
|
|
429
373
|
modifiedValues: null,
|
|
430
|
-
type:
|
|
374
|
+
type: null,
|
|
431
375
|
language: { default: "javascript" },
|
|
432
376
|
options: { default: () => ({
|
|
433
377
|
tabSize: 2
|
|
@@ -552,6 +496,255 @@
|
|
|
552
496
|
};
|
|
553
497
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
554
498
|
|
|
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
|
+
});
|
|
538
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
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,
|
|
675
|
+
props: {
|
|
676
|
+
icon: null
|
|
677
|
+
},
|
|
678
|
+
setup(__props) {
|
|
679
|
+
return (_ctx, _cache) => {
|
|
680
|
+
return !__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
681
|
+
key: 0,
|
|
682
|
+
class: "magic-editor-icon"
|
|
683
|
+
}, {
|
|
684
|
+
default: vue.withCtx(() => [
|
|
685
|
+
vue.createVNode(vue.unref(iconsVue.Edit))
|
|
686
|
+
]),
|
|
687
|
+
_: 1
|
|
688
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
689
|
+
key: 1,
|
|
690
|
+
class: "magic-editor-icon"
|
|
691
|
+
}, {
|
|
692
|
+
default: vue.withCtx(() => [
|
|
693
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$e)
|
|
694
|
+
]),
|
|
695
|
+
_: 1
|
|
696
|
+
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
697
|
+
key: 2,
|
|
698
|
+
class: vue.normalizeClass(["magic-editor-icon", __props.icon])
|
|
699
|
+
}, null, 2)) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
700
|
+
key: 3,
|
|
701
|
+
class: "magic-editor-icon"
|
|
702
|
+
}, {
|
|
703
|
+
default: vue.withCtx(() => [
|
|
704
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
|
|
705
|
+
]),
|
|
706
|
+
_: 1
|
|
707
|
+
}));
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
});
|
|
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
|
+
|
|
555
748
|
const log = (...args) => {
|
|
556
749
|
if (process.env.NODE_ENV === "development") {
|
|
557
750
|
console.log("magic editor: ", ...args);
|
|
@@ -681,6 +874,10 @@
|
|
|
681
874
|
this.pluginOptionsList[methodName2].push(method);
|
|
682
875
|
});
|
|
683
876
|
}
|
|
877
|
+
removeAllPlugins() {
|
|
878
|
+
this.pluginOptionsList = {};
|
|
879
|
+
this.middleware = {};
|
|
880
|
+
}
|
|
684
881
|
async doTask() {
|
|
685
882
|
this.doingTask = true;
|
|
686
883
|
let task = this.taskList.shift();
|
|
@@ -700,7 +897,8 @@
|
|
|
700
897
|
editable: true,
|
|
701
898
|
mode: CodeEditorMode.EDITOR,
|
|
702
899
|
combineIds: [],
|
|
703
|
-
undeletableList: []
|
|
900
|
+
undeletableList: [],
|
|
901
|
+
relations: {}
|
|
704
902
|
});
|
|
705
903
|
constructor() {
|
|
706
904
|
super([
|
|
@@ -718,31 +916,40 @@
|
|
|
718
916
|
"deleteCodeDslByIds"
|
|
719
917
|
]);
|
|
720
918
|
}
|
|
721
|
-
async setCodeDsl(
|
|
722
|
-
this.state.codeDsl =
|
|
919
|
+
async setCodeDsl(codeDsl2) {
|
|
920
|
+
this.state.codeDsl = codeDsl2;
|
|
723
921
|
await editorService.setCodeDsl(this.state.codeDsl);
|
|
724
922
|
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
725
923
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
726
924
|
}
|
|
727
925
|
async getCodeDsl(forceRefresh = false) {
|
|
926
|
+
return this.getCodeDslSync(forceRefresh);
|
|
927
|
+
}
|
|
928
|
+
getCodeDslSync(forceRefresh = false) {
|
|
728
929
|
if (!this.state.codeDsl || forceRefresh) {
|
|
729
|
-
this.state.codeDsl =
|
|
930
|
+
this.state.codeDsl = editorService.getCodeDslSync();
|
|
730
931
|
}
|
|
731
932
|
return this.state.codeDsl;
|
|
732
933
|
}
|
|
733
|
-
async getCodeContentById(
|
|
734
|
-
if (!
|
|
934
|
+
async getCodeContentById(id2) {
|
|
935
|
+
if (!id2)
|
|
735
936
|
return null;
|
|
736
937
|
const totalCodeDsl = await this.getCodeDsl();
|
|
737
938
|
if (!totalCodeDsl)
|
|
738
939
|
return null;
|
|
739
|
-
return totalCodeDsl[
|
|
940
|
+
return totalCodeDsl[id2] ?? null;
|
|
740
941
|
}
|
|
741
942
|
async setCodeDslById(id, codeConfig) {
|
|
742
943
|
let codeDsl = await this.getCodeDsl();
|
|
944
|
+
const codeConfigProcessed = codeConfig;
|
|
945
|
+
if (codeConfig.content) {
|
|
946
|
+
codeConfigProcessed.content = eval(codeConfig.content);
|
|
947
|
+
}
|
|
743
948
|
if (!codeDsl) {
|
|
744
949
|
codeDsl = {
|
|
745
|
-
[id]:
|
|
950
|
+
[id]: {
|
|
951
|
+
...codeConfigProcessed
|
|
952
|
+
}
|
|
746
953
|
};
|
|
747
954
|
} else {
|
|
748
955
|
const existContent = codeDsl[id] || {};
|
|
@@ -750,15 +957,15 @@
|
|
|
750
957
|
...codeDsl,
|
|
751
958
|
[id]: {
|
|
752
959
|
...existContent,
|
|
753
|
-
...
|
|
960
|
+
...codeConfigProcessed
|
|
754
961
|
}
|
|
755
962
|
};
|
|
756
963
|
}
|
|
757
964
|
await this.setCodeDsl(codeDsl);
|
|
758
965
|
}
|
|
759
966
|
async getCodeDslByIds(ids) {
|
|
760
|
-
const
|
|
761
|
-
return lodashEs.pick(
|
|
967
|
+
const codeDsl2 = await this.getCodeDsl();
|
|
968
|
+
return lodashEs.pick(codeDsl2, ids);
|
|
762
969
|
}
|
|
763
970
|
async setCodeEditorShowStatus(status) {
|
|
764
971
|
this.state.isShowCodeEditor = status;
|
|
@@ -766,10 +973,10 @@
|
|
|
766
973
|
getCodeEditorShowStatus() {
|
|
767
974
|
return this.state.isShowCodeEditor;
|
|
768
975
|
}
|
|
769
|
-
setCodeEditorContent(status,
|
|
770
|
-
if (!
|
|
976
|
+
setCodeEditorContent(status, id2) {
|
|
977
|
+
if (!id2)
|
|
771
978
|
return;
|
|
772
|
-
this.setId(
|
|
979
|
+
this.setId(id2);
|
|
773
980
|
this.state.isShowCodeEditor = status;
|
|
774
981
|
}
|
|
775
982
|
async getCurrentDsl() {
|
|
@@ -781,10 +988,10 @@
|
|
|
781
988
|
async setEditStatus(status) {
|
|
782
989
|
this.state.editable = status;
|
|
783
990
|
}
|
|
784
|
-
setId(
|
|
785
|
-
if (!
|
|
991
|
+
setId(id2) {
|
|
992
|
+
if (!id2)
|
|
786
993
|
return;
|
|
787
|
-
this.state.id =
|
|
994
|
+
this.state.id = id2;
|
|
788
995
|
}
|
|
789
996
|
getId() {
|
|
790
997
|
return this.state.id;
|
|
@@ -801,61 +1008,17 @@
|
|
|
801
1008
|
getCombineIds() {
|
|
802
1009
|
return this.state.combineIds;
|
|
803
1010
|
}
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
if (!
|
|
807
|
-
return;
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}
|
|
816
|
-
});
|
|
817
|
-
} catch (e) {
|
|
818
|
-
error(e);
|
|
819
|
-
throw new Error("\u89E3\u7ED1\u4EE3\u7801\u5757\u5931\u8D25");
|
|
820
|
-
}
|
|
821
|
-
} else if (opFlag === CodeSelectOp.ADD) {
|
|
822
|
-
try {
|
|
823
|
-
diffCodeIds.forEach((codeId) => {
|
|
824
|
-
const compsContent = codeDsl[codeId].comps;
|
|
825
|
-
const existHooks = compsContent?.[compId];
|
|
826
|
-
if (lodashEs.isEmpty(existHooks)) {
|
|
827
|
-
codeDsl[codeId].comps = {
|
|
828
|
-
...codeDsl[codeId].comps || {},
|
|
829
|
-
[compId]: [hook]
|
|
830
|
-
};
|
|
831
|
-
} else {
|
|
832
|
-
existHooks?.push(hook);
|
|
833
|
-
}
|
|
834
|
-
});
|
|
835
|
-
} catch (e) {
|
|
836
|
-
error(e);
|
|
837
|
-
throw new Error("\u7ED1\u5B9A\u4EE3\u7801\u5757\u5931\u8D25");
|
|
838
|
-
}
|
|
839
|
-
} else if (opFlag === CodeSelectOp.CHANGE) {
|
|
840
|
-
lodashEs.forIn(codeDsl, (codeBlockContent, codeId) => {
|
|
841
|
-
if (codeId === diffCodeIds[0]) {
|
|
842
|
-
codeBlockContent.comps = {
|
|
843
|
-
...codeBlockContent?.comps || {},
|
|
844
|
-
[compId]: [hook]
|
|
845
|
-
};
|
|
846
|
-
} else if (lodashEs.isEmpty(diffCodeIds) || codeId !== diffCodeIds[0]) {
|
|
847
|
-
const compHooks = codeBlockContent?.comps?.[compId];
|
|
848
|
-
if (!compHooks)
|
|
849
|
-
return true;
|
|
850
|
-
const index = compHooks.findIndex((hookName) => hookName === hook);
|
|
851
|
-
if (index !== -1) {
|
|
852
|
-
compHooks.splice(index, 1);
|
|
853
|
-
return false;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
this.setCodeDsl(codeDsl);
|
|
1011
|
+
refreshCombineInfo() {
|
|
1012
|
+
const root = editorService.get("root");
|
|
1013
|
+
if (!root)
|
|
1014
|
+
return null;
|
|
1015
|
+
const relations = {};
|
|
1016
|
+
this.recurseMNode(root, relations);
|
|
1017
|
+
this.state.relations = relations;
|
|
1018
|
+
return this.state.relations;
|
|
1019
|
+
}
|
|
1020
|
+
getCombineInfo() {
|
|
1021
|
+
return this.state.relations;
|
|
859
1022
|
}
|
|
860
1023
|
getUndeletableList() {
|
|
861
1024
|
return this.state.undeletableList;
|
|
@@ -863,6 +1026,15 @@
|
|
|
863
1026
|
async setUndeleteableList(codeIds) {
|
|
864
1027
|
this.state.undeletableList = codeIds;
|
|
865
1028
|
}
|
|
1029
|
+
setCodeDraft(codeId, content) {
|
|
1030
|
+
globalThis.localStorage.setItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`, content);
|
|
1031
|
+
}
|
|
1032
|
+
getCodeDraft(codeId) {
|
|
1033
|
+
return globalThis.localStorage.getItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
1034
|
+
}
|
|
1035
|
+
removeCodeDraft(codeId) {
|
|
1036
|
+
globalThis.localStorage.removeItem(`${CODE_DRAFT_STORAGE_KEY}_${codeId}`);
|
|
1037
|
+
}
|
|
866
1038
|
async deleteCodeDslByIds(codeIds) {
|
|
867
1039
|
const currentDsl = await this.getCodeDsl();
|
|
868
1040
|
const newDsl = lodashEs.omit(currentDsl, codeIds);
|
|
@@ -878,13 +1050,13 @@
|
|
|
878
1050
|
return await this.getUniqueId();
|
|
879
1051
|
}
|
|
880
1052
|
async deleteCompsInRelation(node) {
|
|
881
|
-
const
|
|
882
|
-
if (!
|
|
1053
|
+
const codeDsl2 = lodashEs.cloneDeep(await this.getCodeDsl());
|
|
1054
|
+
if (!codeDsl2)
|
|
883
1055
|
return;
|
|
884
|
-
this.
|
|
885
|
-
this.setCodeDsl(
|
|
1056
|
+
this.refreshRelationDeep(node, codeDsl2);
|
|
1057
|
+
this.setCodeDsl(codeDsl2);
|
|
886
1058
|
}
|
|
887
|
-
|
|
1059
|
+
resetState() {
|
|
888
1060
|
this.state.isShowCodeEditor = false;
|
|
889
1061
|
this.state.codeDsl = null;
|
|
890
1062
|
this.state.id = "";
|
|
@@ -893,16 +1065,44 @@
|
|
|
893
1065
|
this.state.combineIds = [];
|
|
894
1066
|
this.state.undeletableList = [];
|
|
895
1067
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
1068
|
+
destroy() {
|
|
1069
|
+
this.resetState();
|
|
1070
|
+
this.removeAllListeners();
|
|
1071
|
+
this.removeAllPlugins();
|
|
1072
|
+
}
|
|
1073
|
+
refreshRelationDeep(node, codeDsl2) {
|
|
1074
|
+
if (!node.id)
|
|
1075
|
+
return;
|
|
1076
|
+
lodashEs.forIn(codeDsl2, (codeBlockContent) => {
|
|
1077
|
+
const compsContent = codeBlockContent.comps || {};
|
|
1078
|
+
codeBlockContent.comps = lodashEs.omit(compsContent, node.id);
|
|
1079
|
+
});
|
|
1080
|
+
if (!lodashEs.isEmpty(node.items)) {
|
|
1081
|
+
node.items.forEach((item) => {
|
|
1082
|
+
this.refreshRelationDeep(item, codeDsl2);
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
recurseMNode(node, relations) {
|
|
1087
|
+
lodashEs.forIn(node, (value, key) => {
|
|
1088
|
+
if (value?.hookType === schema.HookType.CODE && !lodashEs.isEmpty(value.hookData)) {
|
|
1089
|
+
value.hookData.forEach((relationItem) => {
|
|
1090
|
+
if (!relationItem.codeId)
|
|
1091
|
+
return;
|
|
1092
|
+
if (!relations[relationItem.codeId]) {
|
|
1093
|
+
relations[relationItem.codeId] = {};
|
|
1094
|
+
}
|
|
1095
|
+
const codeItem = relations[relationItem.codeId];
|
|
1096
|
+
if (lodashEs.isEmpty(codeItem[node.id])) {
|
|
1097
|
+
codeItem[node.id] = [];
|
|
1098
|
+
}
|
|
1099
|
+
codeItem[node.id].push(key);
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
902
1102
|
});
|
|
903
1103
|
if (!lodashEs.isEmpty(node.items)) {
|
|
904
1104
|
node.items.forEach((item) => {
|
|
905
|
-
this.
|
|
1105
|
+
this.recurseMNode(item, relations);
|
|
906
1106
|
});
|
|
907
1107
|
}
|
|
908
1108
|
}
|
|
@@ -986,8 +1186,9 @@
|
|
|
986
1186
|
this.state.pageSteps[this.state.pageId] = undoRedo;
|
|
987
1187
|
}
|
|
988
1188
|
this.setCanUndoRedo();
|
|
1189
|
+
this.emit("page-change", this.state.pageSteps[this.state.pageId]);
|
|
989
1190
|
}
|
|
990
|
-
|
|
1191
|
+
resetState() {
|
|
991
1192
|
this.state.pageId = void 0;
|
|
992
1193
|
this.state.pageSteps = {};
|
|
993
1194
|
this.state.canRedo = false;
|
|
@@ -1018,8 +1219,9 @@
|
|
|
1018
1219
|
return state;
|
|
1019
1220
|
}
|
|
1020
1221
|
destroy() {
|
|
1021
|
-
this.
|
|
1222
|
+
this.resetState();
|
|
1022
1223
|
this.removeAllListeners();
|
|
1224
|
+
this.removeAllPlugins();
|
|
1023
1225
|
}
|
|
1024
1226
|
getUndoRedo() {
|
|
1025
1227
|
if (!this.state.pageId)
|
|
@@ -1099,6 +1301,7 @@
|
|
|
1099
1301
|
}
|
|
1100
1302
|
destroy() {
|
|
1101
1303
|
this.removeAllListeners();
|
|
1304
|
+
this.removeAllPlugins();
|
|
1102
1305
|
}
|
|
1103
1306
|
getValueAndProtocol(value) {
|
|
1104
1307
|
let protocol2 = "";
|
|
@@ -1271,6 +1474,10 @@
|
|
|
1271
1474
|
left: fixNodeLeft(config, parent, stage?.renderer.contentWindow?.document)
|
|
1272
1475
|
};
|
|
1273
1476
|
};
|
|
1477
|
+
const serializeConfig = (config) => serialize__default.default(config, {
|
|
1478
|
+
space: 2,
|
|
1479
|
+
unsafe: true
|
|
1480
|
+
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1274
1481
|
|
|
1275
1482
|
class Props extends BaseService {
|
|
1276
1483
|
state = vue.reactive({
|
|
@@ -1312,7 +1519,7 @@
|
|
|
1312
1519
|
this.setPropsValue(utils.toLine(type), values[type]);
|
|
1313
1520
|
});
|
|
1314
1521
|
}
|
|
1315
|
-
setPropsValue(type, value) {
|
|
1522
|
+
async setPropsValue(type, value) {
|
|
1316
1523
|
this.state.propsValueMap[type] = value;
|
|
1317
1524
|
}
|
|
1318
1525
|
async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
|
|
@@ -1366,10 +1573,14 @@
|
|
|
1366
1573
|
name: type
|
|
1367
1574
|
};
|
|
1368
1575
|
}
|
|
1369
|
-
|
|
1576
|
+
resetState() {
|
|
1370
1577
|
this.state.propsConfigMap = {};
|
|
1371
1578
|
this.state.propsValueMap = {};
|
|
1579
|
+
}
|
|
1580
|
+
destroy() {
|
|
1581
|
+
this.resetState();
|
|
1372
1582
|
this.removeAllListeners();
|
|
1583
|
+
this.removeAllPlugins();
|
|
1373
1584
|
}
|
|
1374
1585
|
guid(digit = 8) {
|
|
1375
1586
|
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
@@ -1444,6 +1655,13 @@
|
|
|
1444
1655
|
}
|
|
1445
1656
|
return parentNode;
|
|
1446
1657
|
};
|
|
1658
|
+
const getDefaultConfig = async (addNode, parentNode) => {
|
|
1659
|
+
const { type, inputEvent, ...config } = addNode;
|
|
1660
|
+
const layout = await editorService.getLayout(vue.toRaw(parentNode), addNode);
|
|
1661
|
+
const newNode = { ...vue.toRaw(await propsService.getPropsValue(type, config)) };
|
|
1662
|
+
newNode.style = getInitPositionStyle(newNode.style, layout);
|
|
1663
|
+
return newNode;
|
|
1664
|
+
};
|
|
1447
1665
|
|
|
1448
1666
|
class Editor$1 extends BaseService {
|
|
1449
1667
|
state = vue.reactive({
|
|
@@ -1473,7 +1691,7 @@
|
|
|
1473
1691
|
"copy",
|
|
1474
1692
|
"paste",
|
|
1475
1693
|
"doPaste",
|
|
1476
|
-
"
|
|
1694
|
+
"doAlignCenter",
|
|
1477
1695
|
"alignCenter",
|
|
1478
1696
|
"moveLayer",
|
|
1479
1697
|
"moveToContainer",
|
|
@@ -1554,7 +1772,7 @@
|
|
|
1554
1772
|
if (page) {
|
|
1555
1773
|
historyService.changePage(vue.toRaw(page));
|
|
1556
1774
|
} else {
|
|
1557
|
-
historyService.
|
|
1775
|
+
historyService.resetState();
|
|
1558
1776
|
}
|
|
1559
1777
|
if (node?.id) {
|
|
1560
1778
|
this.get("stage")?.renderer.runtime?.getApp?.()?.emit(
|
|
@@ -1652,6 +1870,9 @@
|
|
|
1652
1870
|
}
|
|
1653
1871
|
const newNodes = await Promise.all(
|
|
1654
1872
|
addNodes.map((node) => {
|
|
1873
|
+
if (utils.isPage(node)) {
|
|
1874
|
+
return this.doAdd(node, this.get("root"));
|
|
1875
|
+
}
|
|
1655
1876
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
1656
1877
|
if (!parentNode)
|
|
1657
1878
|
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
@@ -1670,7 +1891,9 @@
|
|
|
1670
1891
|
stage?.select(newNodes[0].id);
|
|
1671
1892
|
}
|
|
1672
1893
|
}
|
|
1673
|
-
|
|
1894
|
+
if (!utils.isPage(newNodes[0])) {
|
|
1895
|
+
this.pushHistoryState();
|
|
1896
|
+
}
|
|
1674
1897
|
this.emit("add", newNodes);
|
|
1675
1898
|
return Array.isArray(addNode) ? newNodes : newNodes[0];
|
|
1676
1899
|
}
|
|
@@ -1712,7 +1935,9 @@
|
|
|
1712
1935
|
async remove(nodeOrNodeList) {
|
|
1713
1936
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
1714
1937
|
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
1715
|
-
|
|
1938
|
+
if (!utils.isPage(nodes[0])) {
|
|
1939
|
+
this.pushHistoryState();
|
|
1940
|
+
}
|
|
1716
1941
|
this.emit("remove", nodes);
|
|
1717
1942
|
}
|
|
1718
1943
|
async doUpdate(config) {
|
|
@@ -1724,6 +1949,9 @@
|
|
|
1724
1949
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
1725
1950
|
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, this.get("root"));
|
|
1726
1951
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1952
|
+
if (lodashEs.isObject(srcValue) && Array.isArray(objValue)) {
|
|
1953
|
+
return srcValue;
|
|
1954
|
+
}
|
|
1727
1955
|
if (Array.isArray(srcValue)) {
|
|
1728
1956
|
return srcValue;
|
|
1729
1957
|
}
|
|
@@ -1747,10 +1975,10 @@
|
|
|
1747
1975
|
newConfig = setLayout(newConfig, newLayout);
|
|
1748
1976
|
}
|
|
1749
1977
|
parentNodeItems[index] = newConfig;
|
|
1750
|
-
const nodes = this.get("nodes");
|
|
1978
|
+
const nodes = this.get("nodes") || [];
|
|
1751
1979
|
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
1752
1980
|
nodes.splice(targetIndex, 1, newConfig);
|
|
1753
|
-
this.set("nodes", nodes);
|
|
1981
|
+
this.set("nodes", [...nodes]);
|
|
1754
1982
|
this.get("stage")?.update({
|
|
1755
1983
|
config: lodashEs.cloneDeep(newConfig),
|
|
1756
1984
|
parentId: parent.id,
|
|
@@ -1767,6 +1995,7 @@
|
|
|
1767
1995
|
const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
|
|
1768
1996
|
this.pushHistoryState();
|
|
1769
1997
|
this.emit("update", newNodes);
|
|
1998
|
+
codeBlockService.refreshCombineInfo();
|
|
1770
1999
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
1771
2000
|
}
|
|
1772
2001
|
async sort(id1, id2) {
|
|
@@ -1797,7 +2026,7 @@
|
|
|
1797
2026
|
if (!Array.isArray(config))
|
|
1798
2027
|
return;
|
|
1799
2028
|
const pasteConfigs = await this.doPaste(config, position);
|
|
1800
|
-
return this.add(pasteConfigs);
|
|
2029
|
+
return this.add(pasteConfigs, this.get("parent"));
|
|
1801
2030
|
}
|
|
1802
2031
|
async doPaste(config, position = {}) {
|
|
1803
2032
|
const pasteConfigs = await beforePaste(position, lodashEs.cloneDeep(config));
|
|
@@ -1832,7 +2061,11 @@
|
|
|
1832
2061
|
const stage = this.get("stage");
|
|
1833
2062
|
const newNodes = await Promise.all(nodes.map((node) => this.doAlignCenter(node)));
|
|
1834
2063
|
const newNode = await this.update(newNodes);
|
|
1835
|
-
|
|
2064
|
+
if (newNodes.length > 1) {
|
|
2065
|
+
await stage?.multiSelect(newNodes.map((node) => node.id));
|
|
2066
|
+
} else {
|
|
2067
|
+
await stage?.select(newNodes[0].id);
|
|
2068
|
+
}
|
|
1836
2069
|
return newNode;
|
|
1837
2070
|
}
|
|
1838
2071
|
async moveLayer(offset) {
|
|
@@ -1918,8 +2151,7 @@
|
|
|
1918
2151
|
}
|
|
1919
2152
|
});
|
|
1920
2153
|
}
|
|
1921
|
-
|
|
1922
|
-
this.removeAllListeners();
|
|
2154
|
+
resetState() {
|
|
1923
2155
|
this.set("root", null);
|
|
1924
2156
|
this.set("node", null);
|
|
1925
2157
|
this.set("nodes", []);
|
|
@@ -1930,6 +2162,11 @@
|
|
|
1930
2162
|
this.set("modifiedNodeIds", /* @__PURE__ */ new Map());
|
|
1931
2163
|
this.set("pageLength", /* @__PURE__ */ new Map());
|
|
1932
2164
|
}
|
|
2165
|
+
destroy() {
|
|
2166
|
+
this.removeAllListeners();
|
|
2167
|
+
this.resetState();
|
|
2168
|
+
this.removeAllPlugins();
|
|
2169
|
+
}
|
|
1933
2170
|
resetModifiedNodeId() {
|
|
1934
2171
|
this.get("modifiedNodeIds").clear();
|
|
1935
2172
|
}
|
|
@@ -1939,6 +2176,12 @@
|
|
|
1939
2176
|
return null;
|
|
1940
2177
|
return root.codeBlocks || null;
|
|
1941
2178
|
}
|
|
2179
|
+
getCodeDslSync() {
|
|
2180
|
+
const root = this.get("root");
|
|
2181
|
+
if (!root)
|
|
2182
|
+
return null;
|
|
2183
|
+
return root.codeBlocks || null;
|
|
2184
|
+
}
|
|
1942
2185
|
async setCodeDsl(codeDsl) {
|
|
1943
2186
|
if (!this.state.root)
|
|
1944
2187
|
return;
|
|
@@ -2050,10 +2293,14 @@
|
|
|
2050
2293
|
getMethod(type) {
|
|
2051
2294
|
return lodashEs.cloneDeep(methodMap[type] || core.DEFAULT_METHODS);
|
|
2052
2295
|
}
|
|
2053
|
-
|
|
2296
|
+
resetState() {
|
|
2054
2297
|
eventMap = vue.reactive({});
|
|
2055
2298
|
methodMap = vue.reactive({});
|
|
2299
|
+
}
|
|
2300
|
+
destroy() {
|
|
2301
|
+
this.resetState();
|
|
2056
2302
|
this.removeAllListeners();
|
|
2303
|
+
this.removeAllPlugins();
|
|
2057
2304
|
}
|
|
2058
2305
|
}
|
|
2059
2306
|
const eventsService = new Events();
|
|
@@ -2253,14 +2500,14 @@
|
|
|
2253
2500
|
{
|
|
2254
2501
|
name: "created",
|
|
2255
2502
|
text: "created",
|
|
2256
|
-
|
|
2257
|
-
|
|
2503
|
+
labelWidth: "100px",
|
|
2504
|
+
type: "code-select"
|
|
2258
2505
|
},
|
|
2259
2506
|
{
|
|
2260
2507
|
name: "mounted",
|
|
2261
2508
|
text: "mounted",
|
|
2262
|
-
|
|
2263
|
-
|
|
2509
|
+
labelWidth: "100px",
|
|
2510
|
+
type: "code-select"
|
|
2264
2511
|
}
|
|
2265
2512
|
]
|
|
2266
2513
|
}
|
|
@@ -2328,8 +2575,19 @@
|
|
|
2328
2575
|
}
|
|
2329
2576
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
2330
2577
|
}
|
|
2578
|
+
resetState() {
|
|
2579
|
+
this.set("showSrc", false);
|
|
2580
|
+
this.set("uiSelectMode", false);
|
|
2581
|
+
this.set("zoom", 1);
|
|
2582
|
+
this.set("stageContainerRect", {
|
|
2583
|
+
width: 0,
|
|
2584
|
+
height: 0
|
|
2585
|
+
});
|
|
2586
|
+
}
|
|
2331
2587
|
destroy() {
|
|
2588
|
+
this.resetState();
|
|
2332
2589
|
this.removeAllListeners();
|
|
2590
|
+
this.removeAllPlugins();
|
|
2333
2591
|
}
|
|
2334
2592
|
async setStageRect(value) {
|
|
2335
2593
|
state.stageRect = {
|
|
@@ -2372,12 +2630,14 @@
|
|
|
2372
2630
|
getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
|
|
2373
2631
|
]);
|
|
2374
2632
|
stage.on("select", (el) => {
|
|
2633
|
+
if (`${editorService.get("node")?.id}` === el.id && editorService.get("nodes").length === 1)
|
|
2634
|
+
return;
|
|
2375
2635
|
editorService.select(el.id);
|
|
2376
2636
|
});
|
|
2377
2637
|
stage.on("highlight", (el) => {
|
|
2378
2638
|
editorService.highlight(el.id);
|
|
2379
2639
|
});
|
|
2380
|
-
stage.on("
|
|
2640
|
+
stage.on("multi-select", (els) => {
|
|
2381
2641
|
editorService.multiSelect(els.map((el) => el.id));
|
|
2382
2642
|
});
|
|
2383
2643
|
stage.on("update", (ev) => {
|
|
@@ -2392,7 +2652,12 @@
|
|
|
2392
2652
|
stage.on("sort", (ev) => {
|
|
2393
2653
|
editorService.sort(ev.src, ev.dist);
|
|
2394
2654
|
});
|
|
2395
|
-
stage.on("
|
|
2655
|
+
stage.on("select-parent", () => {
|
|
2656
|
+
const parent = editorService.get("parent");
|
|
2657
|
+
editorService.select(parent);
|
|
2658
|
+
editorService.get("stage").select(parent.id);
|
|
2659
|
+
});
|
|
2660
|
+
stage.on("change-guides", (e) => {
|
|
2396
2661
|
uiService.set("showGuides", true);
|
|
2397
2662
|
if (!root.value || !page.value)
|
|
2398
2663
|
return;
|
|
@@ -2408,11 +2673,14 @@
|
|
|
2408
2673
|
return stage;
|
|
2409
2674
|
};
|
|
2410
2675
|
|
|
2411
|
-
const _hoisted_1$
|
|
2412
|
-
const _hoisted_2$
|
|
2413
|
-
const _hoisted_3$
|
|
2414
|
-
const
|
|
2415
|
-
|
|
2676
|
+
const _hoisted_1$d = { class: "m-editor-empty-panel" };
|
|
2677
|
+
const _hoisted_2$7 = { class: "m-editor-empty-content" };
|
|
2678
|
+
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2679
|
+
const __default__$l = vue.defineComponent({
|
|
2680
|
+
name: "MEditorAddPageBox"
|
|
2681
|
+
});
|
|
2682
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
2683
|
+
...__default__$l,
|
|
2416
2684
|
setup(__props) {
|
|
2417
2685
|
const services = vue.inject("services");
|
|
2418
2686
|
const clickHandler = () => {
|
|
@@ -2425,22 +2693,16 @@
|
|
|
2425
2693
|
});
|
|
2426
2694
|
};
|
|
2427
2695
|
return (_ctx, _cache) => {
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
vue.createElementVNode("div", _hoisted_2$5, [
|
|
2696
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
|
|
2697
|
+
vue.createElementVNode("div", _hoisted_2$7, [
|
|
2431
2698
|
vue.createElementVNode("div", {
|
|
2432
2699
|
class: "m-editor-empty-button",
|
|
2433
2700
|
onClick: clickHandler
|
|
2434
2701
|
}, [
|
|
2435
2702
|
vue.createElementVNode("div", null, [
|
|
2436
|
-
vue.createVNode(
|
|
2437
|
-
default: vue.withCtx(() => [
|
|
2438
|
-
vue.createVNode(vue.unref(iconsVue.Plus))
|
|
2439
|
-
]),
|
|
2440
|
-
_: 1
|
|
2441
|
-
})
|
|
2703
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2442
2704
|
]),
|
|
2443
|
-
_hoisted_3$
|
|
2705
|
+
_hoisted_3$4
|
|
2444
2706
|
])
|
|
2445
2707
|
])
|
|
2446
2708
|
]);
|
|
@@ -2448,137 +2710,12 @@
|
|
|
2448
2710
|
}
|
|
2449
2711
|
});
|
|
2450
2712
|
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
setup(__props, { emit }) {
|
|
2455
|
-
const target = vue.ref();
|
|
2456
|
-
let getso;
|
|
2457
|
-
vue.onMounted(() => {
|
|
2458
|
-
if (!target.value)
|
|
2459
|
-
return;
|
|
2460
|
-
getso = new Gesto__default.default(target.value, {
|
|
2461
|
-
container: window,
|
|
2462
|
-
pinchOutside: true
|
|
2463
|
-
}).on("drag", (e) => {
|
|
2464
|
-
if (!target.value)
|
|
2465
|
-
return;
|
|
2466
|
-
emit("change", e.deltaX);
|
|
2467
|
-
});
|
|
2468
|
-
});
|
|
2469
|
-
vue.onUnmounted(() => {
|
|
2470
|
-
getso?.unset();
|
|
2471
|
-
});
|
|
2472
|
-
return (_ctx, _cache) => {
|
|
2473
|
-
return vue.openBlock(), vue.createElementBlock("span", {
|
|
2474
|
-
ref_key: "target",
|
|
2475
|
-
ref: target,
|
|
2476
|
-
class: "m-editor-resizer"
|
|
2477
|
-
}, [
|
|
2478
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
2479
|
-
], 512);
|
|
2480
|
-
};
|
|
2481
|
-
}
|
|
2713
|
+
const _hoisted_1$c = { class: "m-editor" };
|
|
2714
|
+
const __default__$k = vue.defineComponent({
|
|
2715
|
+
name: "MEditorFramework"
|
|
2482
2716
|
});
|
|
2483
|
-
|
|
2484
2717
|
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
2485
|
-
|
|
2486
|
-
props: {
|
|
2487
|
-
left: null,
|
|
2488
|
-
right: null,
|
|
2489
|
-
minLeft: { default: 1 },
|
|
2490
|
-
minRight: { default: 1 },
|
|
2491
|
-
leftClass: null,
|
|
2492
|
-
rightClass: null,
|
|
2493
|
-
centerClass: null
|
|
2494
|
-
},
|
|
2495
|
-
emits: ["update:left", "change", "update:right"],
|
|
2496
|
-
setup(__props, { emit }) {
|
|
2497
|
-
const props = __props;
|
|
2498
|
-
const el = vue.ref();
|
|
2499
|
-
let clientWidth = 0;
|
|
2500
|
-
const resizerObserver = new ResizeObserver((entries) => {
|
|
2501
|
-
for (const { contentRect } of entries) {
|
|
2502
|
-
clientWidth = contentRect.width;
|
|
2503
|
-
center.value = clientWidth - (props.left || 0) - (props.right || 0);
|
|
2504
|
-
emit("change", {
|
|
2505
|
-
left: props.left,
|
|
2506
|
-
center: center.value,
|
|
2507
|
-
right: props.right
|
|
2508
|
-
});
|
|
2509
|
-
}
|
|
2510
|
-
});
|
|
2511
|
-
vue.onMounted(() => {
|
|
2512
|
-
if (el.value) {
|
|
2513
|
-
resizerObserver.observe(el.value);
|
|
2514
|
-
}
|
|
2515
|
-
});
|
|
2516
|
-
vue.onUnmounted(() => {
|
|
2517
|
-
resizerObserver.disconnect();
|
|
2518
|
-
});
|
|
2519
|
-
const center = vue.ref(0);
|
|
2520
|
-
const changeLeft = (deltaX) => {
|
|
2521
|
-
if (typeof props.left === "undefined")
|
|
2522
|
-
return;
|
|
2523
|
-
const left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
2524
|
-
emit("update:left", left);
|
|
2525
|
-
center.value = clientWidth - left - (props.right || 0);
|
|
2526
|
-
emit("change", {
|
|
2527
|
-
left,
|
|
2528
|
-
center: center.value,
|
|
2529
|
-
right: props.right
|
|
2530
|
-
});
|
|
2531
|
-
};
|
|
2532
|
-
const changeRight = (deltaX) => {
|
|
2533
|
-
if (typeof props.right === "undefined")
|
|
2534
|
-
return;
|
|
2535
|
-
const right = Math.max(props.right - deltaX, props.minRight) || 0;
|
|
2536
|
-
emit("update:right", right);
|
|
2537
|
-
center.value = clientWidth - (props.left || 0) - right;
|
|
2538
|
-
emit("change", {
|
|
2539
|
-
left: props.left,
|
|
2540
|
-
center: center.value,
|
|
2541
|
-
right
|
|
2542
|
-
});
|
|
2543
|
-
};
|
|
2544
|
-
return (_ctx, _cache) => {
|
|
2545
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2546
|
-
ref_key: "el",
|
|
2547
|
-
ref: el,
|
|
2548
|
-
class: "m-editor-layout"
|
|
2549
|
-
}, [
|
|
2550
|
-
typeof props.left !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
2551
|
-
vue.createElementVNode("div", {
|
|
2552
|
-
class: vue.normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
2553
|
-
style: vue.normalizeStyle(`width: ${__props.left}px`)
|
|
2554
|
-
}, [
|
|
2555
|
-
vue.renderSlot(_ctx.$slots, "left")
|
|
2556
|
-
], 6),
|
|
2557
|
-
vue.createVNode(_sfc_main$m, { onChange: changeLeft })
|
|
2558
|
-
], 64)) : vue.createCommentVNode("", true),
|
|
2559
|
-
vue.createElementVNode("div", {
|
|
2560
|
-
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
2561
|
-
style: vue.normalizeStyle(`width: ${center.value}px`)
|
|
2562
|
-
}, [
|
|
2563
|
-
vue.renderSlot(_ctx.$slots, "center")
|
|
2564
|
-
], 6),
|
|
2565
|
-
typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
2566
|
-
vue.createVNode(_sfc_main$m, { onChange: changeRight }),
|
|
2567
|
-
vue.createElementVNode("div", {
|
|
2568
|
-
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
2569
|
-
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
2570
|
-
}, [
|
|
2571
|
-
vue.renderSlot(_ctx.$slots, "right")
|
|
2572
|
-
], 6)
|
|
2573
|
-
], 64)) : vue.createCommentVNode("", true)
|
|
2574
|
-
], 512);
|
|
2575
|
-
};
|
|
2576
|
-
}
|
|
2577
|
-
});
|
|
2578
|
-
|
|
2579
|
-
const _hoisted_1$a = { class: "m-editor" };
|
|
2580
|
-
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
2581
|
-
__name: "Framework",
|
|
2718
|
+
...__default__$k,
|
|
2582
2719
|
props: {
|
|
2583
2720
|
codeOptions: { default: () => ({}) }
|
|
2584
2721
|
},
|
|
@@ -2587,48 +2724,64 @@
|
|
|
2587
2724
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
2588
2725
|
const { editorService, uiService } = vue.inject("services") || {};
|
|
2589
2726
|
const root = vue.computed(() => editorService?.get("root"));
|
|
2727
|
+
const nodes = vue.computed(() => editorService?.get("nodes") || []);
|
|
2590
2728
|
const pageLength = vue.computed(() => editorService?.get("pageLength") || 0);
|
|
2591
2729
|
const showSrc = vue.computed(() => uiService?.get("showSrc"));
|
|
2730
|
+
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
2731
|
+
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
2732
|
+
const leftColumnWidthCacheData = Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY));
|
|
2733
|
+
const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY));
|
|
2592
2734
|
const columnWidth = vue.ref({
|
|
2593
|
-
left:
|
|
2735
|
+
left: leftColumnWidthCacheData,
|
|
2594
2736
|
center: 0,
|
|
2595
|
-
right:
|
|
2737
|
+
right: RightColumnWidthCacheData
|
|
2596
2738
|
});
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
columnWidth.value.
|
|
2601
|
-
columnWidth.value.
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2739
|
+
vue.watch(
|
|
2740
|
+
pageLength,
|
|
2741
|
+
(length) => {
|
|
2742
|
+
const left = columnWidth.value.left || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
2743
|
+
columnWidth.value.left = left;
|
|
2744
|
+
if (length <= 0) {
|
|
2745
|
+
columnWidth.value.right = void 0;
|
|
2746
|
+
columnWidth.value.center = globalThis.document.body.clientWidth - left;
|
|
2747
|
+
} else {
|
|
2748
|
+
const right = columnWidth.value.right || RightColumnWidthCacheData || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
2749
|
+
columnWidth.value.right = right;
|
|
2750
|
+
columnWidth.value.center = globalThis.document.body.clientWidth - left - right;
|
|
2751
|
+
}
|
|
2752
|
+
uiService?.set("columnWidth", columnWidth);
|
|
2753
|
+
},
|
|
2754
|
+
{
|
|
2755
|
+
immediate: true
|
|
2605
2756
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2757
|
+
);
|
|
2758
|
+
vue.watch(
|
|
2759
|
+
() => columnWidth.value.right,
|
|
2760
|
+
(right) => {
|
|
2761
|
+
if (typeof right === "undefined")
|
|
2762
|
+
return;
|
|
2763
|
+
globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${right}`);
|
|
2612
2764
|
}
|
|
2765
|
+
);
|
|
2766
|
+
vue.watch(
|
|
2767
|
+
() => columnWidth.value.left,
|
|
2768
|
+
(left) => {
|
|
2769
|
+
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
2770
|
+
}
|
|
2771
|
+
);
|
|
2772
|
+
const columnWidthChange = (columnWidth2) => {
|
|
2773
|
+
uiService?.set("columnWidth", columnWidth2);
|
|
2613
2774
|
};
|
|
2614
|
-
const
|
|
2615
|
-
const columnWidthCacheData = globalThis.localStorage.getItem(COLUMN_WIDTH_STORAGE_KEY);
|
|
2616
|
-
if (columnWidthCacheData) {
|
|
2775
|
+
const saveCode = (value) => {
|
|
2617
2776
|
try {
|
|
2618
|
-
|
|
2619
|
-
columnWidth.value = columnWidthCache;
|
|
2777
|
+
editorService?.set("root", eval(value));
|
|
2620
2778
|
} catch (e) {
|
|
2621
2779
|
console.error(e);
|
|
2622
2780
|
}
|
|
2623
|
-
}
|
|
2624
|
-
const columnWidthChange = (columnWidth2) => {
|
|
2625
|
-
uiService?.set("columnWidth", columnWidth2);
|
|
2626
|
-
globalThis.localStorage.setItem(COLUMN_WIDTH_STORAGE_KEY, JSON.stringify(columnWidth2));
|
|
2627
2781
|
};
|
|
2628
2782
|
return (_ctx, _cache) => {
|
|
2629
2783
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2630
|
-
|
|
2631
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
2784
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
2632
2785
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2633
2786
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2634
2787
|
key: 0,
|
|
@@ -2636,95 +2789,57 @@
|
|
|
2636
2789
|
"init-values": vue.unref(root),
|
|
2637
2790
|
options: __props.codeOptions,
|
|
2638
2791
|
onSave: saveCode
|
|
2639
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2792
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
2640
2793
|
key: 1,
|
|
2641
2794
|
class: "m-editor-content",
|
|
2642
2795
|
"left-class": "m-editor-framework-left",
|
|
2643
|
-
"center-class": "m-editor-framework-center",
|
|
2644
|
-
"right-class": "m-editor-framework-right",
|
|
2645
|
-
left: columnWidth.value.left,
|
|
2646
|
-
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
|
|
2647
|
-
right: columnWidth.value.right,
|
|
2648
|
-
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
2649
|
-
"min-left": 45,
|
|
2650
|
-
"min-right": 1,
|
|
2651
|
-
onChange: columnWidthChange
|
|
2652
|
-
}, vue.createSlots({
|
|
2653
|
-
left: vue.withCtx(() => [
|
|
2654
|
-
vue.renderSlot(_ctx.$slots, "sidebar")
|
|
2655
|
-
]),
|
|
2656
|
-
center: vue.withCtx(() => [
|
|
2657
|
-
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2658
|
-
vue.createVNode(_sfc_main$
|
|
2659
|
-
])
|
|
2660
|
-
]),
|
|
2661
|
-
_: 2
|
|
2662
|
-
}, [
|
|
2663
|
-
vue.unref(pageLength) > 0 ? {
|
|
2664
|
-
name: "right",
|
|
2665
|
-
fn: vue.withCtx(() => [
|
|
2666
|
-
vue.createVNode(
|
|
2667
|
-
default: vue.withCtx(() => [
|
|
2668
|
-
vue.renderSlot(_ctx.$slots, "props-panel")
|
|
2669
|
-
]),
|
|
2670
|
-
_: 3
|
|
2671
|
-
})
|
|
2672
|
-
])
|
|
2673
|
-
} : void 0
|
|
2674
|
-
]), 1032, ["left", "right"]))
|
|
2675
|
-
]);
|
|
2676
|
-
};
|
|
2677
|
-
}
|
|
2678
|
-
});
|
|
2679
|
-
|
|
2680
|
-
const _hoisted_1$9 = ["src"];
|
|
2681
|
-
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
2682
|
-
__name: "Icon",
|
|
2683
|
-
props: {
|
|
2684
|
-
icon: null
|
|
2685
|
-
},
|
|
2686
|
-
setup(__props) {
|
|
2687
|
-
return (_ctx, _cache) => {
|
|
2688
|
-
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
2689
|
-
return !__props.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2690
|
-
key: 0,
|
|
2691
|
-
class: "magic-editor-icon"
|
|
2692
|
-
}, {
|
|
2693
|
-
default: vue.withCtx(() => [
|
|
2694
|
-
vue.createVNode(vue.unref(iconsVue.Edit))
|
|
2695
|
-
]),
|
|
2696
|
-
_: 1
|
|
2697
|
-
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2698
|
-
key: 1,
|
|
2699
|
-
class: "magic-editor-icon"
|
|
2700
|
-
}, {
|
|
2701
|
-
default: vue.withCtx(() => [
|
|
2702
|
-
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$9)
|
|
2703
|
-
]),
|
|
2704
|
-
_: 1
|
|
2705
|
-
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
2706
|
-
key: 2,
|
|
2707
|
-
class: vue.normalizeClass(["magic-editor-icon", __props.icon])
|
|
2708
|
-
}, null, 2)) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
2709
|
-
key: 3,
|
|
2710
|
-
class: "magic-editor-icon"
|
|
2711
|
-
}, {
|
|
2712
|
-
default: vue.withCtx(() => [
|
|
2713
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
|
|
2714
|
-
]),
|
|
2715
|
-
_: 1
|
|
2716
|
-
}));
|
|
2796
|
+
"center-class": "m-editor-framework-center",
|
|
2797
|
+
"right-class": "m-editor-framework-right",
|
|
2798
|
+
left: columnWidth.value.left,
|
|
2799
|
+
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => columnWidth.value.left = $event),
|
|
2800
|
+
right: columnWidth.value.right,
|
|
2801
|
+
"onUpdate:right": _cache[1] || (_cache[1] = ($event) => columnWidth.value.right = $event),
|
|
2802
|
+
"min-left": 45,
|
|
2803
|
+
"min-right": 1,
|
|
2804
|
+
onChange: columnWidthChange
|
|
2805
|
+
}, vue.createSlots({
|
|
2806
|
+
left: vue.withCtx(() => [
|
|
2807
|
+
vue.renderSlot(_ctx.$slots, "sidebar")
|
|
2808
|
+
]),
|
|
2809
|
+
center: vue.withCtx(() => [
|
|
2810
|
+
vue.unref(pageLength) > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2811
|
+
vue.createVNode(_sfc_main$m)
|
|
2812
|
+
])
|
|
2813
|
+
]),
|
|
2814
|
+
_: 2
|
|
2815
|
+
}, [
|
|
2816
|
+
vue.unref(pageLength) > 0 && vue.unref(nodes).length === 1 ? {
|
|
2817
|
+
name: "right",
|
|
2818
|
+
fn: vue.withCtx(() => [
|
|
2819
|
+
vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
|
|
2820
|
+
default: vue.withCtx(() => [
|
|
2821
|
+
vue.renderSlot(_ctx.$slots, "props-panel")
|
|
2822
|
+
]),
|
|
2823
|
+
_: 3
|
|
2824
|
+
})
|
|
2825
|
+
])
|
|
2826
|
+
} : void 0
|
|
2827
|
+
]), 1032, ["left", "right"]))
|
|
2828
|
+
]);
|
|
2717
2829
|
};
|
|
2718
2830
|
}
|
|
2719
2831
|
});
|
|
2720
2832
|
|
|
2721
|
-
const _hoisted_1$
|
|
2833
|
+
const _hoisted_1$b = {
|
|
2722
2834
|
key: 1,
|
|
2723
2835
|
class: "menu-item-text"
|
|
2724
2836
|
};
|
|
2725
|
-
const _hoisted_2$
|
|
2726
|
-
const
|
|
2727
|
-
|
|
2837
|
+
const _hoisted_2$6 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2838
|
+
const __default__$j = vue.defineComponent({
|
|
2839
|
+
name: "MEditorToolButton"
|
|
2840
|
+
});
|
|
2841
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
2842
|
+
...__default__$j,
|
|
2728
2843
|
props: {
|
|
2729
2844
|
data: { default: () => ({
|
|
2730
2845
|
type: "text",
|
|
@@ -2789,13 +2904,6 @@
|
|
|
2789
2904
|
}
|
|
2790
2905
|
};
|
|
2791
2906
|
return (_ctx, _cache) => {
|
|
2792
|
-
const _component_el_divider = vue.resolveComponent("el-divider");
|
|
2793
|
-
const _component_el_button = vue.resolveComponent("el-button");
|
|
2794
|
-
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
2795
|
-
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
2796
|
-
const _component_el_dropdown_item = vue.resolveComponent("el-dropdown-item");
|
|
2797
|
-
const _component_el_dropdown_menu = vue.resolveComponent("el-dropdown-menu");
|
|
2798
|
-
const _component_el_dropdown = vue.resolveComponent("el-dropdown");
|
|
2799
2907
|
return vue.unref(display) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
2800
2908
|
key: 0,
|
|
2801
2909
|
class: vue.normalizeClass(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
|
|
@@ -2803,24 +2911,24 @@
|
|
|
2803
2911
|
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
|
|
2804
2912
|
onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(__props.data, $event))
|
|
2805
2913
|
}, [
|
|
2806
|
-
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(
|
|
2914
|
+
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
2807
2915
|
key: 0,
|
|
2808
2916
|
direction: __props.data.direction || "vertical"
|
|
2809
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2810
|
-
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(
|
|
2917
|
+
}, 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 }, [
|
|
2918
|
+
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
2811
2919
|
key: 0,
|
|
2812
2920
|
effect: "dark",
|
|
2813
2921
|
placement: "bottom-start",
|
|
2814
2922
|
content: __props.data.tooltip
|
|
2815
2923
|
}, {
|
|
2816
2924
|
default: vue.withCtx(() => [
|
|
2817
|
-
vue.createVNode(
|
|
2925
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
2818
2926
|
size: "small",
|
|
2819
2927
|
text: "",
|
|
2820
2928
|
disabled: vue.unref(disabled)
|
|
2821
2929
|
}, {
|
|
2822
2930
|
default: vue.withCtx(() => [
|
|
2823
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2931
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2824
2932
|
key: 0,
|
|
2825
2933
|
icon: __props.data.icon
|
|
2826
2934
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2830,14 +2938,14 @@
|
|
|
2830
2938
|
}, 8, ["disabled"])
|
|
2831
2939
|
]),
|
|
2832
2940
|
_: 1
|
|
2833
|
-
}, 8, ["content"])) : (vue.openBlock(), vue.createBlock(
|
|
2941
|
+
}, 8, ["content"])) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
2834
2942
|
key: 1,
|
|
2835
2943
|
size: "small",
|
|
2836
2944
|
text: "",
|
|
2837
2945
|
disabled: vue.unref(disabled)
|
|
2838
2946
|
}, {
|
|
2839
2947
|
default: vue.withCtx(() => [
|
|
2840
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2948
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2841
2949
|
key: 0,
|
|
2842
2950
|
icon: __props.data.icon
|
|
2843
2951
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2845,17 +2953,17 @@
|
|
|
2845
2953
|
]),
|
|
2846
2954
|
_: 1
|
|
2847
2955
|
}, 8, ["disabled"]))
|
|
2848
|
-
], 64)) : __props.data.type === "dropdown" ? (vue.openBlock(), vue.createBlock(
|
|
2956
|
+
], 64)) : __props.data.type === "dropdown" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdown), {
|
|
2849
2957
|
key: 3,
|
|
2850
2958
|
trigger: "click",
|
|
2851
2959
|
disabled: vue.unref(disabled),
|
|
2852
2960
|
onCommand: dropdownHandler
|
|
2853
2961
|
}, {
|
|
2854
2962
|
dropdown: vue.withCtx(() => [
|
|
2855
|
-
__props.data.items && __props.data.items.length ? (vue.openBlock(), vue.createBlock(
|
|
2963
|
+
__props.data.items && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownMenu), { key: 0 }, {
|
|
2856
2964
|
default: vue.withCtx(() => [
|
|
2857
2965
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.data.items, (subItem, index) => {
|
|
2858
|
-
return vue.openBlock(), vue.createBlock(
|
|
2966
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDropdownItem), {
|
|
2859
2967
|
key: index,
|
|
2860
2968
|
command: { data: __props.data, subItem }
|
|
2861
2969
|
}, {
|
|
@@ -2870,9 +2978,9 @@
|
|
|
2870
2978
|
})) : vue.createCommentVNode("", true)
|
|
2871
2979
|
]),
|
|
2872
2980
|
default: vue.withCtx(() => [
|
|
2873
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
2981
|
+
vue.createElementVNode("span", _hoisted_2$6, [
|
|
2874
2982
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
2875
|
-
vue.createVNode(
|
|
2983
|
+
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
2876
2984
|
default: vue.withCtx(() => [
|
|
2877
2985
|
vue.createVNode(vue.unref(iconsVue.ArrowDown))
|
|
2878
2986
|
]),
|
|
@@ -2887,8 +2995,11 @@
|
|
|
2887
2995
|
}
|
|
2888
2996
|
});
|
|
2889
2997
|
|
|
2890
|
-
const
|
|
2891
|
-
|
|
2998
|
+
const __default__$i = vue.defineComponent({
|
|
2999
|
+
name: "MEditorNavMenu"
|
|
3000
|
+
});
|
|
3001
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
3002
|
+
...__default__$i,
|
|
2892
3003
|
props: {
|
|
2893
3004
|
data: { default: () => ({}) },
|
|
2894
3005
|
height: { default: 35 }
|
|
@@ -3043,7 +3154,7 @@
|
|
|
3043
3154
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
3044
3155
|
}, [
|
|
3045
3156
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
3046
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3157
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3047
3158
|
data: item,
|
|
3048
3159
|
key: index
|
|
3049
3160
|
}, null, 8, ["data"]);
|
|
@@ -3055,9 +3166,12 @@
|
|
|
3055
3166
|
}
|
|
3056
3167
|
});
|
|
3057
3168
|
|
|
3058
|
-
const _hoisted_1$
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3169
|
+
const _hoisted_1$a = { class: "m-editor-props-panel" };
|
|
3170
|
+
const __default__$h = vue.defineComponent({
|
|
3171
|
+
name: "MEditorPropsPanel"
|
|
3172
|
+
});
|
|
3173
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
3174
|
+
...__default__$h,
|
|
3061
3175
|
emits: ["mounted"],
|
|
3062
3176
|
setup(__props, { expose, emit }) {
|
|
3063
3177
|
const internalInstance = vue.getCurrentInstance();
|
|
@@ -3066,7 +3180,9 @@
|
|
|
3066
3180
|
const curFormConfig = vue.ref([]);
|
|
3067
3181
|
const services = vue.inject("services");
|
|
3068
3182
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3069
|
-
const propsPanelSize = vue.computed(
|
|
3183
|
+
const propsPanelSize = vue.computed(
|
|
3184
|
+
() => services?.uiService.get("propsPanelSize") || "small"
|
|
3185
|
+
);
|
|
3070
3186
|
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
3071
3187
|
const init = async () => {
|
|
3072
3188
|
if (!node.value) {
|
|
@@ -3093,21 +3209,15 @@
|
|
|
3093
3209
|
services?.editorService.update(values2);
|
|
3094
3210
|
} catch (e) {
|
|
3095
3211
|
console.error(e);
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
duration: 1e4,
|
|
3099
|
-
showClose: true,
|
|
3100
|
-
message: e.message,
|
|
3101
|
-
dangerouslyUseHTMLString: true
|
|
3102
|
-
});
|
|
3212
|
+
design.tMagicMessage.closeAll();
|
|
3213
|
+
design.tMagicMessage.error(e.message);
|
|
3103
3214
|
}
|
|
3104
3215
|
};
|
|
3105
3216
|
expose({ submit });
|
|
3106
3217
|
return (_ctx, _cache) => {
|
|
3107
|
-
|
|
3108
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
|
|
3218
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
3109
3219
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3110
|
-
vue.createVNode(
|
|
3220
|
+
vue.createVNode(vue.unref(form.MForm), {
|
|
3111
3221
|
ref_key: "configForm",
|
|
3112
3222
|
ref: configForm,
|
|
3113
3223
|
class: vue.normalizeClass(`m-editor-props-panel ${vue.unref(propsPanelSize)}`),
|
|
@@ -3122,43 +3232,328 @@
|
|
|
3122
3232
|
}
|
|
3123
3233
|
});
|
|
3124
3234
|
|
|
3125
|
-
const _hoisted_1$
|
|
3126
|
-
|
|
3127
|
-
const _hoisted_3$1 = { class: "code-name" };
|
|
3128
|
-
const _hoisted_4$1 = { class: "code-name-wrapper" };
|
|
3129
|
-
const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3130
|
-
const _hoisted_6$1 = { class: "m-editor-wrapper" };
|
|
3131
|
-
const _hoisted_7$1 = {
|
|
3132
|
-
key: 1,
|
|
3235
|
+
const _hoisted_1$9 = {
|
|
3236
|
+
key: 0,
|
|
3133
3237
|
class: "m-editor-content-bottom"
|
|
3134
3238
|
};
|
|
3135
|
-
const
|
|
3136
|
-
const
|
|
3137
|
-
const
|
|
3138
|
-
key:
|
|
3239
|
+
const _hoisted_2$5 = /* @__PURE__ */ vue.createTextVNode("\u4FDD\u5B58");
|
|
3240
|
+
const _hoisted_3$3 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3241
|
+
const _hoisted_4$2 = {
|
|
3242
|
+
key: 1,
|
|
3139
3243
|
class: "m-editor-content-bottom"
|
|
3140
3244
|
};
|
|
3141
|
-
const
|
|
3245
|
+
const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3246
|
+
const __default__$g = vue.defineComponent({
|
|
3247
|
+
name: "MEditorCodeDraftEditor"
|
|
3248
|
+
});
|
|
3249
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
3250
|
+
...__default__$g,
|
|
3251
|
+
props: {
|
|
3252
|
+
id: null,
|
|
3253
|
+
content: null,
|
|
3254
|
+
editable: { type: Boolean, default: true },
|
|
3255
|
+
autoSaveDraft: { type: Boolean, default: true },
|
|
3256
|
+
codeOptions: null,
|
|
3257
|
+
language: null
|
|
3258
|
+
},
|
|
3259
|
+
emits: ["save", "close", "saveAndClose"],
|
|
3260
|
+
setup(__props, { emit }) {
|
|
3261
|
+
const props = __props;
|
|
3262
|
+
const services = vue.inject("services");
|
|
3263
|
+
const codeContent = vue.ref("");
|
|
3264
|
+
const editorContent = vue.ref("");
|
|
3265
|
+
const codeEditor = vue.ref();
|
|
3266
|
+
const originCodeContent = vue.ref("");
|
|
3267
|
+
const isFullScreen = vue.ref(false);
|
|
3268
|
+
const codeOptions = vue.computed(() => ({
|
|
3269
|
+
...props.codeOptions,
|
|
3270
|
+
readOnly: !props.editable
|
|
3271
|
+
}));
|
|
3272
|
+
vue.watchEffect(() => {
|
|
3273
|
+
codeContent.value = props.content;
|
|
3274
|
+
if (!originCodeContent.value) {
|
|
3275
|
+
originCodeContent.value = codeContent.value;
|
|
3276
|
+
}
|
|
3277
|
+
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3278
|
+
if (codeDraft) {
|
|
3279
|
+
codeContent.value = codeDraft;
|
|
3280
|
+
}
|
|
3281
|
+
});
|
|
3282
|
+
const saveCodeDraft = async (codeValue) => {
|
|
3283
|
+
if (!props.autoSaveDraft)
|
|
3284
|
+
return;
|
|
3285
|
+
if (originCodeContent.value === codeValue) {
|
|
3286
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3287
|
+
return;
|
|
3288
|
+
}
|
|
3289
|
+
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3290
|
+
design.tMagicMessage.success(`\u4EE3\u7801\u8349\u7A3F\u4FDD\u5B58\u6210\u529F ${utils.datetimeFormatter(new Date())}`);
|
|
3291
|
+
};
|
|
3292
|
+
const saveCode = () => {
|
|
3293
|
+
if (!codeEditor.value || !props.editable)
|
|
3294
|
+
return;
|
|
3295
|
+
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3296
|
+
emit("save", editorContent.value);
|
|
3297
|
+
};
|
|
3298
|
+
const saveAndClose = () => {
|
|
3299
|
+
if (!codeEditor.value || !props.editable)
|
|
3300
|
+
return;
|
|
3301
|
+
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3302
|
+
emit("saveAndClose", editorContent.value);
|
|
3303
|
+
};
|
|
3304
|
+
const close = async () => {
|
|
3305
|
+
const codeDraft = services?.codeBlockService.getCodeDraft(props.id);
|
|
3306
|
+
if (codeDraft) {
|
|
3307
|
+
design.tMagicMessageBox.confirm("\u60A8\u6709\u4EE3\u7801\u4FEE\u6539\u672A\u4FDD\u5B58\uFF0C\u662F\u5426\u4FDD\u5B58\u540E\u518D\u5173\u95ED\uFF1F", "\u63D0\u793A", {
|
|
3308
|
+
confirmButtonText: "\u786E\u8BA4",
|
|
3309
|
+
cancelButtonText: "\u53D6\u6D88",
|
|
3310
|
+
type: "warning"
|
|
3311
|
+
}).then(async () => {
|
|
3312
|
+
saveAndClose();
|
|
3313
|
+
}).catch(() => {
|
|
3314
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3315
|
+
emit("close");
|
|
3316
|
+
});
|
|
3317
|
+
} else {
|
|
3318
|
+
emit("close");
|
|
3319
|
+
}
|
|
3320
|
+
};
|
|
3321
|
+
const toggleFullScreen = () => {
|
|
3322
|
+
isFullScreen.value = !isFullScreen.value;
|
|
3323
|
+
if (codeEditor.value) {
|
|
3324
|
+
codeEditor.value.focus();
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
return (_ctx, _cache) => {
|
|
3328
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3329
|
+
class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3330
|
+
}, [
|
|
3331
|
+
vue.createVNode(_sfc_main$q, {
|
|
3332
|
+
ref_key: "codeEditor",
|
|
3333
|
+
ref: codeEditor,
|
|
3334
|
+
class: "m-editor-container",
|
|
3335
|
+
"init-values": `${codeContent.value}`,
|
|
3336
|
+
onSave: saveCodeDraft,
|
|
3337
|
+
language: __props.language,
|
|
3338
|
+
options: vue.unref(codeOptions)
|
|
3339
|
+
}, null, 8, ["init-values", "language", "options"]),
|
|
3340
|
+
__props.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
|
|
3341
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3342
|
+
type: "primary",
|
|
3343
|
+
class: "button",
|
|
3344
|
+
onClick: toggleFullScreen
|
|
3345
|
+
}, {
|
|
3346
|
+
default: vue.withCtx(() => [
|
|
3347
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F"), 1)
|
|
3348
|
+
]),
|
|
3349
|
+
_: 1
|
|
3350
|
+
}),
|
|
3351
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3352
|
+
type: "primary",
|
|
3353
|
+
class: "button",
|
|
3354
|
+
onClick: saveCode
|
|
3355
|
+
}, {
|
|
3356
|
+
default: vue.withCtx(() => [
|
|
3357
|
+
_hoisted_2$5
|
|
3358
|
+
]),
|
|
3359
|
+
_: 1
|
|
3360
|
+
}),
|
|
3361
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3362
|
+
type: "primary",
|
|
3363
|
+
class: "button",
|
|
3364
|
+
onClick: close
|
|
3365
|
+
}, {
|
|
3366
|
+
default: vue.withCtx(() => [
|
|
3367
|
+
_hoisted_3$3
|
|
3368
|
+
]),
|
|
3369
|
+
_: 1
|
|
3370
|
+
})
|
|
3371
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, [
|
|
3372
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3373
|
+
type: "primary",
|
|
3374
|
+
class: "button",
|
|
3375
|
+
onClick: toggleFullScreen
|
|
3376
|
+
}, {
|
|
3377
|
+
default: vue.withCtx(() => [
|
|
3378
|
+
vue.createTextVNode(vue.toDisplayString(isFullScreen.value ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F"), 1)
|
|
3379
|
+
]),
|
|
3380
|
+
_: 1
|
|
3381
|
+
}),
|
|
3382
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3383
|
+
type: "primary",
|
|
3384
|
+
class: "button",
|
|
3385
|
+
onClick: close
|
|
3386
|
+
}, {
|
|
3387
|
+
default: vue.withCtx(() => [
|
|
3388
|
+
_hoisted_5$1
|
|
3389
|
+
]),
|
|
3390
|
+
_: 1
|
|
3391
|
+
})
|
|
3392
|
+
]))
|
|
3393
|
+
], 2);
|
|
3394
|
+
};
|
|
3395
|
+
}
|
|
3396
|
+
});
|
|
3397
|
+
|
|
3398
|
+
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3399
|
+
const _hoisted_2$4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3400
|
+
const _hoisted_3$2 = { class: "code-name-wrapper" };
|
|
3401
|
+
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u53C2\u6570\u5B9A\u4E49", -1);
|
|
3402
|
+
const __default__$f = vue.defineComponent({
|
|
3403
|
+
name: "MEditorFunctionEditor"
|
|
3404
|
+
});
|
|
3405
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
3406
|
+
...__default__$f,
|
|
3407
|
+
props: {
|
|
3408
|
+
id: null,
|
|
3409
|
+
name: null,
|
|
3410
|
+
content: null,
|
|
3411
|
+
editable: { type: Boolean, default: true },
|
|
3412
|
+
autoSaveDraft: { type: Boolean, default: true },
|
|
3413
|
+
codeOptions: null
|
|
3414
|
+
},
|
|
3415
|
+
emits: ["change", "field-input"],
|
|
3416
|
+
setup(__props, { emit }) {
|
|
3417
|
+
const props = __props;
|
|
3418
|
+
const tableConfig = {
|
|
3419
|
+
border: true,
|
|
3420
|
+
enableFullscreen: false,
|
|
3421
|
+
name: "params",
|
|
3422
|
+
maxHeight: "150px",
|
|
3423
|
+
items: [
|
|
3424
|
+
{
|
|
3425
|
+
type: "text",
|
|
3426
|
+
label: "\u53C2\u6570\u540D",
|
|
3427
|
+
name: "name"
|
|
3428
|
+
}
|
|
3429
|
+
]
|
|
3430
|
+
};
|
|
3431
|
+
const services = vue.inject("services");
|
|
3432
|
+
const codeName = vue.ref("");
|
|
3433
|
+
const codeContent = vue.ref("");
|
|
3434
|
+
const evalRes = vue.ref(true);
|
|
3435
|
+
vue.provide("mForm", {
|
|
3436
|
+
$emit: emit,
|
|
3437
|
+
setField: () => {
|
|
3438
|
+
}
|
|
3439
|
+
});
|
|
3440
|
+
const tableModel = vue.ref();
|
|
3441
|
+
vue.watchEffect(() => {
|
|
3442
|
+
codeName.value = props.name;
|
|
3443
|
+
codeContent.value = props.content;
|
|
3444
|
+
});
|
|
3445
|
+
const initTableModel = () => {
|
|
3446
|
+
const codeDsl = services?.codeBlockService.getCodeDslSync();
|
|
3447
|
+
if (!codeDsl)
|
|
3448
|
+
return;
|
|
3449
|
+
tableModel.value = {
|
|
3450
|
+
params: codeDsl[props.id]?.params || []
|
|
3451
|
+
};
|
|
3452
|
+
};
|
|
3453
|
+
initTableModel();
|
|
3454
|
+
const beforeSave = (codeValue) => {
|
|
3455
|
+
try {
|
|
3456
|
+
eval(codeValue);
|
|
3457
|
+
return true;
|
|
3458
|
+
} catch (e) {
|
|
3459
|
+
design.tMagicMessage.error(e.stack);
|
|
3460
|
+
return false;
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3463
|
+
const saveCode = async (codeValue2) => {
|
|
3464
|
+
if (!props.editable)
|
|
3465
|
+
return;
|
|
3466
|
+
evalRes.value = beforeSave(codeValue2);
|
|
3467
|
+
if (evalRes.value) {
|
|
3468
|
+
await services?.codeBlockService.setCodeDslById(props.id, {
|
|
3469
|
+
name: codeName.value,
|
|
3470
|
+
content: codeValue2,
|
|
3471
|
+
params: tableModel.value?.params || []
|
|
3472
|
+
});
|
|
3473
|
+
design.tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3474
|
+
services?.codeBlockService.removeCodeDraft(props.id);
|
|
3475
|
+
}
|
|
3476
|
+
};
|
|
3477
|
+
const saveAndClose = async (codeValue2) => {
|
|
3478
|
+
await saveCode(codeValue2);
|
|
3479
|
+
if (evalRes.value) {
|
|
3480
|
+
close();
|
|
3481
|
+
}
|
|
3482
|
+
};
|
|
3483
|
+
const close = () => {
|
|
3484
|
+
services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3485
|
+
};
|
|
3486
|
+
return (_ctx, _cache) => {
|
|
3487
|
+
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
3488
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
3489
|
+
header: vue.withCtx(() => [
|
|
3490
|
+
vue.createElementVNode("div", _hoisted_1$8, [
|
|
3491
|
+
_hoisted_2$4,
|
|
3492
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3493
|
+
class: "code-name-input",
|
|
3494
|
+
modelValue: codeName.value,
|
|
3495
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => codeName.value = $event),
|
|
3496
|
+
disabled: !__props.editable
|
|
3497
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
3498
|
+
]),
|
|
3499
|
+
vue.createElementVNode("div", _hoisted_3$2, [
|
|
3500
|
+
_hoisted_4$1,
|
|
3501
|
+
vue.createVNode(_component_m_form_table, {
|
|
3502
|
+
style: { "width": "320px" },
|
|
3503
|
+
config: tableConfig,
|
|
3504
|
+
model: tableModel.value,
|
|
3505
|
+
enableToggleMode: false,
|
|
3506
|
+
name: "params",
|
|
3507
|
+
prop: "params",
|
|
3508
|
+
size: "small"
|
|
3509
|
+
}, null, 8, ["model"])
|
|
3510
|
+
])
|
|
3511
|
+
]),
|
|
3512
|
+
default: vue.withCtx(() => [
|
|
3513
|
+
vue.createVNode(_sfc_main$h, {
|
|
3514
|
+
id: __props.id,
|
|
3515
|
+
content: codeContent.value,
|
|
3516
|
+
editable: __props.editable,
|
|
3517
|
+
autoSaveDraft: __props.autoSaveDraft,
|
|
3518
|
+
codeOptions: __props.codeOptions,
|
|
3519
|
+
language: "javascript",
|
|
3520
|
+
onSave: saveCode,
|
|
3521
|
+
onSaveAndClose: saveAndClose,
|
|
3522
|
+
onClose: close
|
|
3523
|
+
}, null, 8, ["id", "content", "editable", "autoSaveDraft", "codeOptions"])
|
|
3524
|
+
]),
|
|
3525
|
+
_: 1
|
|
3526
|
+
});
|
|
3527
|
+
};
|
|
3528
|
+
}
|
|
3529
|
+
});
|
|
3530
|
+
|
|
3531
|
+
const _hoisted_1$7 = ["id"];
|
|
3532
|
+
const _hoisted_2$3 = { class: "list-item" };
|
|
3533
|
+
const _hoisted_3$1 = { class: "code-name" };
|
|
3534
|
+
const __default__$e = vue.defineComponent({
|
|
3535
|
+
name: "MEditorCodeBlockEditor"
|
|
3536
|
+
});
|
|
3142
3537
|
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
3143
|
-
|
|
3538
|
+
...__default__$e,
|
|
3144
3539
|
setup(__props) {
|
|
3145
3540
|
const services = vue.inject("services");
|
|
3146
|
-
const
|
|
3541
|
+
const codeOptions = vue.inject("codeOptions", {});
|
|
3147
3542
|
const left = vue.ref(200);
|
|
3148
3543
|
const currentTitle = vue.ref("");
|
|
3149
3544
|
const codeConfig = vue.ref(null);
|
|
3150
3545
|
const state = vue.reactive({
|
|
3151
3546
|
codeList: []
|
|
3152
3547
|
});
|
|
3153
|
-
const isShowCodeBlockEditor = vue.computed(
|
|
3154
|
-
() => codeConfig.value && services?.codeBlockService.getCodeEditorShowStatus() || false
|
|
3155
|
-
);
|
|
3156
3548
|
const mode = vue.computed(() => services?.codeBlockService.getMode());
|
|
3157
3549
|
const id = vue.computed(() => services?.codeBlockService.getId() || "");
|
|
3158
3550
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3159
3551
|
const selectedIds = vue.computed(() => services?.codeBlockService.getCombineIds() || []);
|
|
3160
3552
|
vue.watchEffect(async () => {
|
|
3161
|
-
codeConfig.value = await services?.codeBlockService.getCodeContentById(id.value) || null;
|
|
3553
|
+
codeConfig.value = lodashEs.cloneDeep(await services?.codeBlockService.getCodeContentById(id.value)) || null;
|
|
3554
|
+
if (!codeConfig.value)
|
|
3555
|
+
return;
|
|
3556
|
+
codeConfig.value.content = serializeConfig(codeConfig.value.content);
|
|
3162
3557
|
});
|
|
3163
3558
|
vue.watchEffect(async () => {
|
|
3164
3559
|
const codeDsl = await services?.codeBlockService.getCodeDslByIds(selectedIds.value) || null;
|
|
@@ -3173,52 +3568,24 @@
|
|
|
3173
3568
|
});
|
|
3174
3569
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3175
3570
|
});
|
|
3176
|
-
const saveCode = async () => {
|
|
3177
|
-
if (!codeEditor.value || !codeConfig.value || !editable.value)
|
|
3178
|
-
return true;
|
|
3179
|
-
try {
|
|
3180
|
-
const codeContent = codeEditor.value.getEditor()?.getValue();
|
|
3181
|
-
codeConfig.value.content = eval(codeContent);
|
|
3182
|
-
} catch (e) {
|
|
3183
|
-
elementPlus.ElMessage.error(e.stack);
|
|
3184
|
-
return false;
|
|
3185
|
-
}
|
|
3186
|
-
await services?.codeBlockService.setCodeDslById(id.value, {
|
|
3187
|
-
name: codeConfig.value.name,
|
|
3188
|
-
content: codeConfig.value.content
|
|
3189
|
-
});
|
|
3190
|
-
elementPlus.ElMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3191
|
-
return true;
|
|
3192
|
-
};
|
|
3193
|
-
const saveAndClose = async () => {
|
|
3194
|
-
const saveRes = await saveCode();
|
|
3195
|
-
if (saveRes) {
|
|
3196
|
-
await services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3197
|
-
}
|
|
3198
|
-
};
|
|
3199
3571
|
const selectHandler = (data) => {
|
|
3200
3572
|
services?.codeBlockService.setId(data.id);
|
|
3201
3573
|
currentTitle.value = data.name;
|
|
3202
3574
|
};
|
|
3203
3575
|
return (_ctx, _cache) => {
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
const _component_el_button = vue.resolveComponent("el-button");
|
|
3207
|
-
const _component_el_card = vue.resolveComponent("el-card");
|
|
3208
|
-
const _component_el_dialog = vue.resolveComponent("el-dialog");
|
|
3209
|
-
return vue.openBlock(), vue.createBlock(_component_el_dialog, {
|
|
3210
|
-
modelValue: vue.unref(isShowCodeBlockEditor),
|
|
3211
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
|
|
3576
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDialog), {
|
|
3577
|
+
"model-value": true,
|
|
3212
3578
|
class: "code-editor-dialog",
|
|
3213
3579
|
title: currentTitle.value,
|
|
3214
3580
|
fullscreen: true,
|
|
3215
|
-
"
|
|
3216
|
-
"append-to-body": true
|
|
3581
|
+
"close-on-press-escape": false,
|
|
3582
|
+
"append-to-body": true,
|
|
3583
|
+
"show-close": false
|
|
3217
3584
|
}, {
|
|
3218
3585
|
default: vue.withCtx(() => [
|
|
3219
|
-
vue.createVNode(_sfc_main$
|
|
3586
|
+
vue.createVNode(_sfc_main$o, {
|
|
3220
3587
|
left: left.value,
|
|
3221
|
-
"onUpdate:left": _cache[
|
|
3588
|
+
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3222
3589
|
"min-left": 45,
|
|
3223
3590
|
class: "code-editor-layout"
|
|
3224
3591
|
}, vue.createSlots({
|
|
@@ -3230,72 +3597,15 @@
|
|
|
3230
3597
|
])
|
|
3231
3598
|
}, [
|
|
3232
3599
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3233
|
-
vue.
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
disabled: !vue.unref(editable)
|
|
3243
|
-
}, null, 8, ["modelValue", "disabled"])) : vue.createCommentVNode("", true)
|
|
3244
|
-
])
|
|
3245
|
-
]),
|
|
3246
|
-
default: vue.withCtx(() => [
|
|
3247
|
-
vue.createElementVNode("div", _hoisted_6$1, [
|
|
3248
|
-
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
3249
|
-
key: 0,
|
|
3250
|
-
ref_key: "codeEditor",
|
|
3251
|
-
ref: codeEditor,
|
|
3252
|
-
class: "m-editor-container",
|
|
3253
|
-
"init-values": `${codeConfig.value.content}`,
|
|
3254
|
-
onSave: saveCode,
|
|
3255
|
-
options: {
|
|
3256
|
-
tabSize: 2,
|
|
3257
|
-
fontSize: 16,
|
|
3258
|
-
formatOnPaste: true,
|
|
3259
|
-
readOnly: !vue.unref(editable)
|
|
3260
|
-
}
|
|
3261
|
-
}, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
|
|
3262
|
-
vue.unref(editable) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
|
|
3263
|
-
vue.createVNode(_component_el_button, {
|
|
3264
|
-
type: "primary",
|
|
3265
|
-
class: "button",
|
|
3266
|
-
onClick: saveCode
|
|
3267
|
-
}, {
|
|
3268
|
-
default: vue.withCtx(() => [
|
|
3269
|
-
_hoisted_8$1
|
|
3270
|
-
]),
|
|
3271
|
-
_: 1
|
|
3272
|
-
}),
|
|
3273
|
-
vue.createVNode(_component_el_button, {
|
|
3274
|
-
type: "primary",
|
|
3275
|
-
class: "button",
|
|
3276
|
-
onClick: saveAndClose
|
|
3277
|
-
}, {
|
|
3278
|
-
default: vue.withCtx(() => [
|
|
3279
|
-
_hoisted_9$1
|
|
3280
|
-
]),
|
|
3281
|
-
_: 1
|
|
3282
|
-
})
|
|
3283
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
|
|
3284
|
-
vue.createVNode(_component_el_button, {
|
|
3285
|
-
type: "primary",
|
|
3286
|
-
class: "button",
|
|
3287
|
-
onClick: saveAndClose
|
|
3288
|
-
}, {
|
|
3289
|
-
default: vue.withCtx(() => [
|
|
3290
|
-
_hoisted_11
|
|
3291
|
-
]),
|
|
3292
|
-
_: 1
|
|
3293
|
-
})
|
|
3294
|
-
]))
|
|
3295
|
-
])
|
|
3296
|
-
]),
|
|
3297
|
-
_: 1
|
|
3298
|
-
})
|
|
3600
|
+
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$g, {
|
|
3601
|
+
key: 0,
|
|
3602
|
+
id: vue.unref(id),
|
|
3603
|
+
name: codeConfig.value.name,
|
|
3604
|
+
content: codeConfig.value.content,
|
|
3605
|
+
editable: !!vue.unref(editable),
|
|
3606
|
+
autoSaveDraft: vue.unref(mode) === vue.unref(CodeEditorMode).EDITOR,
|
|
3607
|
+
codeOptions: vue.unref(codeOptions)
|
|
3608
|
+
}, null, 8, ["id", "name", "content", "editable", "autoSaveDraft", "codeOptions"])) : vue.createCommentVNode("", true)
|
|
3299
3609
|
], 2)) : vue.createCommentVNode("", true)
|
|
3300
3610
|
]),
|
|
3301
3611
|
_: 2
|
|
@@ -3303,16 +3613,15 @@
|
|
|
3303
3613
|
vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? {
|
|
3304
3614
|
name: "left",
|
|
3305
3615
|
fn: vue.withCtx(() => [
|
|
3306
|
-
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(
|
|
3616
|
+
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
3307
3617
|
key: 0,
|
|
3308
|
-
|
|
3618
|
+
class: "side-tree",
|
|
3309
3619
|
"node-key": "id",
|
|
3310
3620
|
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3311
3621
|
data: state.codeList,
|
|
3312
3622
|
"highlight-current": true,
|
|
3313
|
-
onNodeClick: selectHandler,
|
|
3314
3623
|
"current-node-key": state.codeList[0].id,
|
|
3315
|
-
|
|
3624
|
+
onNodeClick: selectHandler
|
|
3316
3625
|
}, {
|
|
3317
3626
|
default: vue.withCtx(({ data }) => [
|
|
3318
3627
|
vue.createElementVNode("div", {
|
|
@@ -3322,7 +3631,7 @@
|
|
|
3322
3631
|
vue.createElementVNode("div", _hoisted_2$3, [
|
|
3323
3632
|
vue.createElementVNode("div", _hoisted_3$1, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1)
|
|
3324
3633
|
])
|
|
3325
|
-
], 8, _hoisted_1$
|
|
3634
|
+
], 8, _hoisted_1$7)
|
|
3326
3635
|
]),
|
|
3327
3636
|
_: 1
|
|
3328
3637
|
}, 8, ["data", "current-node-key"])) : vue.createCommentVNode("", true)
|
|
@@ -3331,12 +3640,12 @@
|
|
|
3331
3640
|
]), 1032, ["left"])
|
|
3332
3641
|
]),
|
|
3333
3642
|
_: 3
|
|
3334
|
-
}, 8, ["
|
|
3643
|
+
}, 8, ["title"]);
|
|
3335
3644
|
};
|
|
3336
3645
|
}
|
|
3337
3646
|
});
|
|
3338
3647
|
|
|
3339
|
-
const _hoisted_1$
|
|
3648
|
+
const _hoisted_1$6 = { class: "m-editor-code-block-list" };
|
|
3340
3649
|
const _hoisted_2$2 = { class: "code-header-wrapper" };
|
|
3341
3650
|
const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("\u65B0\u589E");
|
|
3342
3651
|
const _hoisted_4 = ["id"];
|
|
@@ -3358,8 +3667,11 @@
|
|
|
3358
3667
|
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"
|
|
3359
3668
|
})
|
|
3360
3669
|
], -1);
|
|
3670
|
+
const __default__$d = vue.defineComponent({
|
|
3671
|
+
name: "MEditorCodeBlockList"
|
|
3672
|
+
});
|
|
3361
3673
|
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
3362
|
-
|
|
3674
|
+
...__default__$d,
|
|
3363
3675
|
props: {
|
|
3364
3676
|
customError: null
|
|
3365
3677
|
},
|
|
@@ -3367,41 +3679,38 @@
|
|
|
3367
3679
|
const props = __props;
|
|
3368
3680
|
const services = vue.inject("services");
|
|
3369
3681
|
const state = vue.reactive({
|
|
3370
|
-
codeList: []
|
|
3371
|
-
bindComps: {}
|
|
3682
|
+
codeList: []
|
|
3372
3683
|
});
|
|
3373
3684
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3374
|
-
const
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
const
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
id: compId,
|
|
3384
|
-
name: getCompName(compId)
|
|
3685
|
+
const isShowCodeBlockEditor = vue.computed(() => services?.codeBlockService.getCodeEditorShowStatus() || false);
|
|
3686
|
+
const codeCombineInfo = vue.ref(null);
|
|
3687
|
+
const getBindCompsByCodeId = (codeId) => {
|
|
3688
|
+
if (!codeCombineInfo.value || !codeCombineInfo.value[codeId])
|
|
3689
|
+
return [];
|
|
3690
|
+
const bindCompsId = Object.keys(codeCombineInfo.value[codeId]);
|
|
3691
|
+
return bindCompsId.map((compId) => ({
|
|
3692
|
+
compId,
|
|
3693
|
+
compName: getCompName(compId)
|
|
3385
3694
|
}));
|
|
3386
|
-
state.bindComps[codeId] = compsInfo;
|
|
3387
3695
|
};
|
|
3388
3696
|
const initList = async () => {
|
|
3389
|
-
const codeDsl = await services?.codeBlockService.getCodeDsl() || null;
|
|
3390
|
-
|
|
3697
|
+
const codeDsl = lodashEs.cloneDeep(await services?.codeBlockService.getCodeDsl()) || null;
|
|
3698
|
+
codeCombineInfo.value = lodashEs.cloneDeep(services?.codeBlockService.getCombineInfo()) || null;
|
|
3699
|
+
if (!codeDsl || !codeCombineInfo.value)
|
|
3391
3700
|
return;
|
|
3392
3701
|
state.codeList = [];
|
|
3393
3702
|
lodashEs.forIn(codeDsl, (value, codeId) => {
|
|
3394
|
-
getBindCompsByCodeId(codeId, value);
|
|
3395
3703
|
state.codeList.push({
|
|
3396
3704
|
id: codeId,
|
|
3397
3705
|
name: value.name,
|
|
3398
3706
|
codeBlockContent: value,
|
|
3399
|
-
showRelation: true
|
|
3707
|
+
showRelation: true,
|
|
3708
|
+
combineInfo: getBindCompsByCodeId(codeId)
|
|
3400
3709
|
});
|
|
3401
3710
|
});
|
|
3402
3711
|
};
|
|
3403
3712
|
vue.watch(
|
|
3404
|
-
() => services?.codeBlockService.
|
|
3713
|
+
[() => services?.codeBlockService.getCodeDslSync(), () => services?.codeBlockService.refreshCombineInfo()],
|
|
3405
3714
|
() => {
|
|
3406
3715
|
initList();
|
|
3407
3716
|
},
|
|
@@ -3410,31 +3719,18 @@
|
|
|
3410
3719
|
deep: true
|
|
3411
3720
|
}
|
|
3412
3721
|
);
|
|
3413
|
-
vue.watch(
|
|
3414
|
-
() => services?.editorService.get("node"),
|
|
3415
|
-
(curNode) => {
|
|
3416
|
-
if (!curNode?.id)
|
|
3417
|
-
return;
|
|
3418
|
-
lodashEs.forIn(state.bindComps, (bindCompInfo) => {
|
|
3419
|
-
bindCompInfo.forEach((comp) => {
|
|
3420
|
-
if (comp.id === curNode.id) {
|
|
3421
|
-
comp.name = curNode.name;
|
|
3422
|
-
}
|
|
3423
|
-
});
|
|
3424
|
-
});
|
|
3425
|
-
}
|
|
3426
|
-
);
|
|
3427
3722
|
const createCodeBlock = async () => {
|
|
3428
3723
|
const { codeBlockService } = services || {};
|
|
3429
3724
|
if (!codeBlockService) {
|
|
3430
|
-
|
|
3725
|
+
design.tMagicMessage.error("\u65B0\u589E\u4EE3\u7801\u5757\u5931\u8D25");
|
|
3431
3726
|
return;
|
|
3432
3727
|
}
|
|
3433
3728
|
const codeConfig = {
|
|
3434
3729
|
name: "\u4EE3\u7801\u5757",
|
|
3435
|
-
content: `() => {
|
|
3730
|
+
content: `({app, params}) => {
|
|
3436
3731
|
// place your code here
|
|
3437
|
-
}
|
|
3732
|
+
}`,
|
|
3733
|
+
params: []
|
|
3438
3734
|
};
|
|
3439
3735
|
await codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3440
3736
|
const id = await codeBlockService.getUniqueId();
|
|
@@ -3446,7 +3742,8 @@
|
|
|
3446
3742
|
services?.codeBlockService.setCodeEditorContent(true, key);
|
|
3447
3743
|
};
|
|
3448
3744
|
const deleteCode = (key) => {
|
|
3449
|
-
const
|
|
3745
|
+
const currentCode = state.codeList.find((codeItem) => codeItem.id === key);
|
|
3746
|
+
const existBinds = !lodashEs.isEmpty(currentCode?.combineInfo);
|
|
3450
3747
|
const undeleteableList = services?.codeBlockService.getUndeletableList() || [];
|
|
3451
3748
|
if (!existBinds && !undeleteableList.includes(key)) {
|
|
3452
3749
|
services?.codeBlockService.deleteCodeDslByIds([key]);
|
|
@@ -3454,7 +3751,7 @@
|
|
|
3454
3751
|
if (typeof props.customError === "function") {
|
|
3455
3752
|
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
3456
3753
|
} else {
|
|
3457
|
-
|
|
3754
|
+
design.tMagicMessage.error("\u4EE3\u7801\u5757\u5220\u9664\u5931\u8D25");
|
|
3458
3755
|
}
|
|
3459
3756
|
}
|
|
3460
3757
|
};
|
|
@@ -3486,14 +3783,10 @@
|
|
|
3486
3783
|
stage?.select(compId);
|
|
3487
3784
|
};
|
|
3488
3785
|
return (_ctx, _cache) => {
|
|
3489
|
-
|
|
3490
|
-
const _component_el_button = vue.resolveComponent("el-button");
|
|
3491
|
-
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
3492
|
-
const _component_el_tree = vue.resolveComponent("el-tree");
|
|
3493
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
|
|
3786
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
|
|
3494
3787
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
3495
3788
|
vue.createElementVNode("div", _hoisted_2$2, [
|
|
3496
|
-
vue.createVNode(
|
|
3789
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3497
3790
|
class: vue.normalizeClass([vue.unref(editable) ? "code-filter-input" : "code-filter-input-no-btn"]),
|
|
3498
3791
|
size: "small",
|
|
3499
3792
|
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
@@ -3502,7 +3795,7 @@
|
|
|
3502
3795
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
3503
3796
|
onInput: filterTextChangeHandler
|
|
3504
3797
|
}, null, 8, ["class", "modelValue"]),
|
|
3505
|
-
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(
|
|
3798
|
+
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3506
3799
|
key: 0,
|
|
3507
3800
|
class: "create-code-button",
|
|
3508
3801
|
type: "primary",
|
|
@@ -3516,7 +3809,7 @@
|
|
|
3516
3809
|
})) : vue.createCommentVNode("", true)
|
|
3517
3810
|
])
|
|
3518
3811
|
]),
|
|
3519
|
-
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(
|
|
3812
|
+
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
3520
3813
|
key: 0,
|
|
3521
3814
|
ref_key: "tree",
|
|
3522
3815
|
ref: tree,
|
|
@@ -3533,15 +3826,15 @@
|
|
|
3533
3826
|
class: "list-container"
|
|
3534
3827
|
}, [
|
|
3535
3828
|
vue.createElementVNode("div", _hoisted_5, [
|
|
3536
|
-
vue.createElementVNode("
|
|
3829
|
+
vue.createElementVNode("span", _hoisted_6, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1),
|
|
3537
3830
|
vue.createElementVNode("div", _hoisted_7, [
|
|
3538
|
-
vue.createVNode(
|
|
3831
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
3539
3832
|
effect: "dark",
|
|
3540
3833
|
content: vue.unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
|
|
3541
3834
|
placement: "bottom"
|
|
3542
3835
|
}, {
|
|
3543
3836
|
default: vue.withCtx(() => [
|
|
3544
|
-
vue.createVNode(_sfc_main$
|
|
3837
|
+
vue.createVNode(_sfc_main$n, {
|
|
3545
3838
|
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3546
3839
|
class: "edit-icon",
|
|
3547
3840
|
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3549,14 +3842,14 @@
|
|
|
3549
3842
|
]),
|
|
3550
3843
|
_: 2
|
|
3551
3844
|
}, 1032, ["content"]),
|
|
3552
|
-
|
|
3845
|
+
data.combineInfo && data.combineInfo.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3553
3846
|
key: 0,
|
|
3554
3847
|
effect: "dark",
|
|
3555
3848
|
content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
|
|
3556
3849
|
placement: "bottom"
|
|
3557
3850
|
}, {
|
|
3558
3851
|
default: vue.withCtx(() => [
|
|
3559
|
-
vue.createVNode(_sfc_main$
|
|
3852
|
+
vue.createVNode(_sfc_main$n, {
|
|
3560
3853
|
icon: vue.unref(iconsVue.Link),
|
|
3561
3854
|
class: "edit-icon",
|
|
3562
3855
|
onClick: vue.withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
@@ -3564,14 +3857,14 @@
|
|
|
3564
3857
|
]),
|
|
3565
3858
|
_: 2
|
|
3566
3859
|
}, 1024)) : vue.createCommentVNode("", true),
|
|
3567
|
-
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(
|
|
3860
|
+
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3568
3861
|
key: 1,
|
|
3569
3862
|
effect: "dark",
|
|
3570
3863
|
content: "\u5220\u9664",
|
|
3571
3864
|
placement: "bottom"
|
|
3572
3865
|
}, {
|
|
3573
3866
|
default: vue.withCtx(() => [
|
|
3574
|
-
vue.createVNode(_sfc_main$
|
|
3867
|
+
vue.createVNode(_sfc_main$n, {
|
|
3575
3868
|
icon: vue.unref(iconsVue.Close),
|
|
3576
3869
|
class: "edit-icon",
|
|
3577
3870
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3585,18 +3878,18 @@
|
|
|
3585
3878
|
})
|
|
3586
3879
|
])
|
|
3587
3880
|
]),
|
|
3588
|
-
data.showRelation &&
|
|
3881
|
+
data.showRelation && data.combineInfo && data.combineInfo.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
3589
3882
|
_hoisted_9,
|
|
3590
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
3591
|
-
return vue.openBlock(), vue.createBlock(
|
|
3883
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.combineInfo, (comp, index) => {
|
|
3884
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3592
3885
|
key: index,
|
|
3593
3886
|
class: "code-comp",
|
|
3594
3887
|
size: "small",
|
|
3595
3888
|
plain: true,
|
|
3596
|
-
onClick: vue.withModifiers(($event) => selectComp(comp.
|
|
3889
|
+
onClick: vue.withModifiers(($event) => selectComp(comp.compId), ["stop"])
|
|
3597
3890
|
}, {
|
|
3598
3891
|
default: vue.withCtx(() => [
|
|
3599
|
-
vue.createTextVNode(vue.toDisplayString(comp.
|
|
3892
|
+
vue.createTextVNode(vue.toDisplayString(comp.compName), 1)
|
|
3600
3893
|
]),
|
|
3601
3894
|
_: 2
|
|
3602
3895
|
}, 1032, ["onClick"]);
|
|
@@ -3606,21 +3899,23 @@
|
|
|
3606
3899
|
]),
|
|
3607
3900
|
_: 3
|
|
3608
3901
|
}, 8, ["data"])) : vue.createCommentVNode("", true),
|
|
3609
|
-
vue.
|
|
3902
|
+
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, { key: 1 }, {
|
|
3610
3903
|
"code-block-edit-panel-header": vue.withCtx(({ id }) => [
|
|
3611
3904
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
3612
3905
|
]),
|
|
3613
3906
|
_: 3
|
|
3614
|
-
})
|
|
3907
|
+
})) : vue.createCommentVNode("", true)
|
|
3615
3908
|
]);
|
|
3616
3909
|
};
|
|
3617
3910
|
}
|
|
3618
3911
|
});
|
|
3619
3912
|
|
|
3620
|
-
const _hoisted_1$
|
|
3621
|
-
const
|
|
3913
|
+
const _hoisted_1$5 = ["onClick", "onDragstart"];
|
|
3914
|
+
const __default__$c = vue.defineComponent({
|
|
3915
|
+
name: "MEditorComponentListPanel"
|
|
3916
|
+
});
|
|
3622
3917
|
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
3623
|
-
|
|
3918
|
+
...__default__$c,
|
|
3624
3919
|
setup(__props) {
|
|
3625
3920
|
const searchText = vue.ref("");
|
|
3626
3921
|
const services = vue.inject("services");
|
|
@@ -3633,7 +3928,7 @@
|
|
|
3633
3928
|
}))
|
|
3634
3929
|
);
|
|
3635
3930
|
const collapseValue = vue.computed(
|
|
3636
|
-
() => Array(list.value?.length).fill(1).map((x, i) => i)
|
|
3931
|
+
() => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
|
|
3637
3932
|
);
|
|
3638
3933
|
let timeout;
|
|
3639
3934
|
let clientX;
|
|
@@ -3685,36 +3980,31 @@
|
|
|
3685
3980
|
timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
|
|
3686
3981
|
};
|
|
3687
3982
|
return (_ctx, _cache) => {
|
|
3688
|
-
|
|
3689
|
-
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
3690
|
-
const _component_el_collapse_item = vue.resolveComponent("el-collapse-item");
|
|
3691
|
-
const _component_el_collapse = vue.resolveComponent("el-collapse");
|
|
3692
|
-
const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
|
|
3693
|
-
return vue.openBlock(), vue.createBlock(_component_el_scrollbar, null, {
|
|
3983
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), null, {
|
|
3694
3984
|
default: vue.withCtx(() => [
|
|
3695
3985
|
vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
3696
|
-
vue.createVNode(
|
|
3986
|
+
vue.createVNode(vue.unref(design.TMagicCollapse), {
|
|
3697
3987
|
class: "ui-component-panel",
|
|
3698
3988
|
"model-value": vue.unref(collapseValue)
|
|
3699
3989
|
}, {
|
|
3700
3990
|
default: vue.withCtx(() => [
|
|
3701
|
-
vue.createVNode(
|
|
3702
|
-
"prefix-icon": "el-icon-search",
|
|
3991
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3703
3992
|
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
3704
3993
|
class: "search-input",
|
|
3705
3994
|
size: "small",
|
|
3706
3995
|
clearable: "",
|
|
3996
|
+
"prefix-icon": vue.unref(iconsVue.Search),
|
|
3707
3997
|
modelValue: searchText.value,
|
|
3708
3998
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event)
|
|
3709
|
-
}, null, 8, ["modelValue"]),
|
|
3999
|
+
}, null, 8, ["prefix-icon", "modelValue"]),
|
|
3710
4000
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(list), (group, index) => {
|
|
3711
4001
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
3712
|
-
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(
|
|
4002
|
+
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
3713
4003
|
key: index,
|
|
3714
|
-
name: index
|
|
4004
|
+
name: `${index}`
|
|
3715
4005
|
}, {
|
|
3716
4006
|
title: vue.withCtx(() => [
|
|
3717
|
-
|
|
4007
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
3718
4008
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
3719
4009
|
]),
|
|
3720
4010
|
default: vue.withCtx(() => [
|
|
@@ -3729,10 +4019,10 @@
|
|
|
3729
4019
|
onDrag: dragHandler
|
|
3730
4020
|
}, [
|
|
3731
4021
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
3732
|
-
vue.createVNode(_sfc_main$
|
|
4022
|
+
vue.createVNode(_sfc_main$n, {
|
|
3733
4023
|
icon: item.icon
|
|
3734
4024
|
}, null, 8, ["icon"]),
|
|
3735
|
-
vue.createVNode(
|
|
4025
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
3736
4026
|
effect: "dark",
|
|
3737
4027
|
placement: "bottom",
|
|
3738
4028
|
content: item.text
|
|
@@ -3743,7 +4033,7 @@
|
|
|
3743
4033
|
_: 2
|
|
3744
4034
|
}, 1032, ["content"])
|
|
3745
4035
|
])
|
|
3746
|
-
], 40,
|
|
4036
|
+
], 40, _hoisted_1$5);
|
|
3747
4037
|
}), 128))
|
|
3748
4038
|
]),
|
|
3749
4039
|
_: 2
|
|
@@ -3760,8 +4050,11 @@
|
|
|
3760
4050
|
}
|
|
3761
4051
|
});
|
|
3762
4052
|
|
|
4053
|
+
const __default__$b = vue.defineComponent({
|
|
4054
|
+
name: "MEditorContentMenu"
|
|
4055
|
+
});
|
|
3763
4056
|
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
3764
|
-
|
|
4057
|
+
...__default__$b,
|
|
3765
4058
|
props: {
|
|
3766
4059
|
menuData: { default: () => [] },
|
|
3767
4060
|
isSubMenu: { type: Boolean, default: false }
|
|
@@ -3840,7 +4133,7 @@
|
|
|
3840
4133
|
});
|
|
3841
4134
|
return (_ctx, _cache) => {
|
|
3842
4135
|
const _component_content_menu = vue.resolveComponent("content-menu", true);
|
|
3843
|
-
return __props.menuData.length
|
|
4136
|
+
return __props.menuData.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
3844
4137
|
key: 0,
|
|
3845
4138
|
class: "magic-editor-content-menu",
|
|
3846
4139
|
ref_key: "menu",
|
|
@@ -3849,7 +4142,7 @@
|
|
|
3849
4142
|
}, [
|
|
3850
4143
|
vue.createElementVNode("div", null, [
|
|
3851
4144
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
3852
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4145
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$k, {
|
|
3853
4146
|
"event-type": "mouseup",
|
|
3854
4147
|
data: item,
|
|
3855
4148
|
key: index,
|
|
@@ -3868,21 +4161,29 @@
|
|
|
3868
4161
|
onHide: hide
|
|
3869
4162
|
}, null, 8, ["menu-data"])
|
|
3870
4163
|
]))
|
|
3871
|
-
], 4))
|
|
4164
|
+
], 4)), [
|
|
4165
|
+
[vue.vShow, visible.value]
|
|
4166
|
+
]) : vue.createCommentVNode("", true);
|
|
3872
4167
|
};
|
|
3873
4168
|
}
|
|
3874
4169
|
});
|
|
3875
4170
|
|
|
4171
|
+
const __default__$a = vue.defineComponent({
|
|
4172
|
+
name: "MEditorLayerMenu"
|
|
4173
|
+
});
|
|
3876
4174
|
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
3877
|
-
|
|
4175
|
+
...__default__$a,
|
|
4176
|
+
props: {
|
|
4177
|
+
layerContentMenu: null
|
|
4178
|
+
},
|
|
3878
4179
|
setup(__props, { expose }) {
|
|
4180
|
+
const props = __props;
|
|
3879
4181
|
const services = vue.inject("services");
|
|
3880
4182
|
const menu = vue.ref();
|
|
3881
4183
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3882
4184
|
const isRoot = vue.computed(() => node.value?.type === schema.NodeType.ROOT);
|
|
3883
4185
|
const isPage = vue.computed(() => node.value?.type === schema.NodeType.PAGE);
|
|
3884
4186
|
const componentList = vue.computed(() => services?.componentListService.getList() || []);
|
|
3885
|
-
const layerContentMenu = vue.inject("layerContentMenu", []);
|
|
3886
4187
|
const createMenuItems = (group) => group.items.map((component) => ({
|
|
3887
4188
|
text: component.text,
|
|
3888
4189
|
type: "button",
|
|
@@ -3937,7 +4238,7 @@
|
|
|
3937
4238
|
{
|
|
3938
4239
|
type: "button",
|
|
3939
4240
|
text: "\u590D\u5236",
|
|
3940
|
-
icon: vue.markRaw(iconsVue.
|
|
4241
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
3941
4242
|
display: () => !isRoot.value,
|
|
3942
4243
|
handler: () => {
|
|
3943
4244
|
node.value && services?.editorService.copy(node.value);
|
|
@@ -3952,7 +4253,7 @@
|
|
|
3952
4253
|
node.value && services?.editorService.remove(node.value);
|
|
3953
4254
|
}
|
|
3954
4255
|
},
|
|
3955
|
-
...layerContentMenu
|
|
4256
|
+
...props.layerContentMenu
|
|
3956
4257
|
]);
|
|
3957
4258
|
const show = (e) => {
|
|
3958
4259
|
menu.value?.show(e);
|
|
@@ -3971,398 +4272,365 @@
|
|
|
3971
4272
|
}
|
|
3972
4273
|
});
|
|
3973
4274
|
|
|
3974
|
-
const
|
|
3975
|
-
const
|
|
3976
|
-
|
|
3977
|
-
throw new Error("\u6CA1\u6709id");
|
|
3978
|
-
}
|
|
3979
|
-
await editorService?.select(data);
|
|
3980
|
-
editorService?.get("stage")?.select(data.id);
|
|
3981
|
-
};
|
|
3982
|
-
const highlight = (data, editorService) => {
|
|
3983
|
-
if (!data?.id) {
|
|
3984
|
-
throw new Error("\u6CA1\u6709id");
|
|
3985
|
-
}
|
|
3986
|
-
editorService?.highlight(data);
|
|
3987
|
-
editorService?.get("stage")?.highlight(data.id);
|
|
3988
|
-
};
|
|
3989
|
-
const useDrop = (tree, editorService) => ({
|
|
3990
|
-
allowDrop: (draggingNode, dropNode, type) => {
|
|
3991
|
-
const { data } = dropNode || {};
|
|
3992
|
-
const { data: ingData } = draggingNode;
|
|
3993
|
-
const { type: ingType } = ingData;
|
|
3994
|
-
if (ingType !== schema.NodeType.PAGE && data.type === schema.NodeType.PAGE)
|
|
3995
|
-
return false;
|
|
3996
|
-
if (ingType === schema.NodeType.PAGE && data.type !== schema.NodeType.PAGE)
|
|
3997
|
-
return false;
|
|
3998
|
-
if (!data || !data.type)
|
|
3999
|
-
return false;
|
|
4000
|
-
if (["prev", "next"].includes(type))
|
|
4001
|
-
return true;
|
|
4002
|
-
if (data.items || data.type === "container")
|
|
4003
|
-
return true;
|
|
4004
|
-
return false;
|
|
4005
|
-
},
|
|
4006
|
-
async handleDragEnd(e) {
|
|
4007
|
-
if (!tree.value)
|
|
4008
|
-
return;
|
|
4009
|
-
const { data: node } = e;
|
|
4010
|
-
const parent = editorService?.getParentById(node.id, false);
|
|
4011
|
-
const layout = await editorService?.getLayout(parent);
|
|
4012
|
-
node.style.position = layout;
|
|
4013
|
-
if (layout === Layout.RELATIVE) {
|
|
4014
|
-
node.style.top = 0;
|
|
4015
|
-
node.style.left = 0;
|
|
4016
|
-
}
|
|
4017
|
-
const { data } = tree.value;
|
|
4018
|
-
const [page] = data;
|
|
4019
|
-
editorService?.update(page);
|
|
4020
|
-
}
|
|
4275
|
+
const _hoisted_1$4 = ["id", "onMouseenter"];
|
|
4276
|
+
const __default__$9 = vue.defineComponent({
|
|
4277
|
+
name: "MEditorLayerPanel"
|
|
4021
4278
|
});
|
|
4022
|
-
const
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4279
|
+
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
4280
|
+
...__default__$9,
|
|
4281
|
+
props: {
|
|
4282
|
+
layerContentMenu: null
|
|
4283
|
+
},
|
|
4284
|
+
setup(__props) {
|
|
4285
|
+
const throttleTime = 150;
|
|
4286
|
+
const services = vue.inject("services");
|
|
4287
|
+
const tree = vue.ref();
|
|
4288
|
+
const menu = vue.ref();
|
|
4289
|
+
const editorService = services?.editorService;
|
|
4290
|
+
const page = vue.computed(() => editorService?.get("page"));
|
|
4291
|
+
const values = vue.computed(() => page.value ? [page.value] : []);
|
|
4292
|
+
const selectedNodes = vue.ref([]);
|
|
4293
|
+
const selectedIds = vue.computed(() => selectedNodes.value.map((node) => node.id));
|
|
4294
|
+
const isMultiSelectStatus = vue.ref(false);
|
|
4295
|
+
const spliceNodeKey = vue.ref();
|
|
4296
|
+
const filterText = vue.ref("");
|
|
4297
|
+
const defaultExpandedKeys = vue.computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
|
|
4298
|
+
editorService?.on("remove", () => {
|
|
4299
|
+
setTimeout(() => {
|
|
4300
|
+
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
4301
|
+
}, 0);
|
|
4302
|
+
});
|
|
4303
|
+
const select = async (data) => {
|
|
4304
|
+
if (!data.id) {
|
|
4305
|
+
throw new Error("\u6CA1\u6709id");
|
|
4306
|
+
}
|
|
4307
|
+
await editorService?.select(data);
|
|
4308
|
+
editorService?.get("stage")?.select(data.id);
|
|
4309
|
+
};
|
|
4310
|
+
const multiSelect = async (data) => {
|
|
4311
|
+
await editorService?.multiSelect(data);
|
|
4312
|
+
editorService?.get("stage")?.multiSelect(data);
|
|
4313
|
+
};
|
|
4314
|
+
const highlight = (data) => {
|
|
4315
|
+
if (!data?.id) {
|
|
4316
|
+
throw new Error("\u6CA1\u6709id");
|
|
4317
|
+
}
|
|
4318
|
+
editorService?.highlight(data);
|
|
4319
|
+
editorService?.get("stage")?.highlight(data.id);
|
|
4320
|
+
};
|
|
4321
|
+
const expandedKeys = /* @__PURE__ */ new Map();
|
|
4322
|
+
const allowDrop = (draggingNode, dropNode, type) => {
|
|
4323
|
+
const { data } = dropNode || {};
|
|
4324
|
+
const { data: ingData } = draggingNode;
|
|
4325
|
+
const { type: ingType } = ingData;
|
|
4326
|
+
if (ingType !== schema.NodeType.PAGE && data.type === schema.NodeType.PAGE)
|
|
4327
|
+
return false;
|
|
4328
|
+
if (ingType === schema.NodeType.PAGE && data.type !== schema.NodeType.PAGE)
|
|
4329
|
+
return false;
|
|
4330
|
+
if (!data || !data.type)
|
|
4331
|
+
return false;
|
|
4332
|
+
if (["prev", "next"].includes(type))
|
|
4333
|
+
return true;
|
|
4334
|
+
if (data.items || data.type === "container")
|
|
4335
|
+
return true;
|
|
4336
|
+
return false;
|
|
4337
|
+
};
|
|
4338
|
+
const handleDragEnd = async (e) => {
|
|
4028
4339
|
if (!tree.value)
|
|
4029
4340
|
return;
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
const
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4341
|
+
const { data: node } = e;
|
|
4342
|
+
const parent = editorService?.getParentById(node.id, false);
|
|
4343
|
+
const layout = await editorService?.getLayout(parent);
|
|
4344
|
+
node.style.position = layout;
|
|
4345
|
+
if (layout === Layout.RELATIVE) {
|
|
4346
|
+
node.style.top = 0;
|
|
4347
|
+
node.style.left = 0;
|
|
4348
|
+
}
|
|
4349
|
+
const data = tree.value.getData();
|
|
4350
|
+
const [page2] = data;
|
|
4351
|
+
editorService?.update(page2);
|
|
4352
|
+
};
|
|
4353
|
+
const loadItems = (node, resolve) => {
|
|
4354
|
+
if (Array.isArray(node.data)) {
|
|
4355
|
+
return resolve(node.data);
|
|
4356
|
+
}
|
|
4357
|
+
if (Array.isArray(node.data?.items)) {
|
|
4358
|
+
return resolve(node.data?.items);
|
|
4359
|
+
}
|
|
4360
|
+
resolve([]);
|
|
4361
|
+
};
|
|
4362
|
+
const handleCollapse = (data) => {
|
|
4363
|
+
expandedKeys.delete(data.id);
|
|
4364
|
+
};
|
|
4365
|
+
const handleExpand = (data) => {
|
|
4366
|
+
const parent = editorService?.getParentById(data.id);
|
|
4367
|
+
if (!parent?.id)
|
|
4368
|
+
return;
|
|
4369
|
+
expandedKeys.set(parent.id, parent.id);
|
|
4370
|
+
};
|
|
4371
|
+
const filterNode = (value, data) => {
|
|
4372
|
+
if (!value) {
|
|
4373
|
+
return true;
|
|
4374
|
+
}
|
|
4375
|
+
let name = "";
|
|
4376
|
+
if (data.name) {
|
|
4377
|
+
name = data.name;
|
|
4378
|
+
} else if (data.items) {
|
|
4379
|
+
name = "container";
|
|
4380
|
+
}
|
|
4381
|
+
return `${data.id}${name}${data.type}`.indexOf(value) !== -1;
|
|
4382
|
+
};
|
|
4383
|
+
const filterTextChangeHandler = (val) => {
|
|
4384
|
+
tree.value?.filter(val);
|
|
4385
|
+
};
|
|
4386
|
+
const expandNodes = async () => {
|
|
4387
|
+
if (!tree.value)
|
|
4388
|
+
return;
|
|
4389
|
+
await vue.nextTick();
|
|
4390
|
+
tree.value && Object.entries(tree.value.getStore().nodesMap).forEach(([id, node]) => {
|
|
4391
|
+
if (node.expanded && node.data.items) {
|
|
4050
4392
|
expandedKeys.set(id, id);
|
|
4051
4393
|
}
|
|
4052
4394
|
});
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4395
|
+
expandedKeys.forEach((key) => {
|
|
4396
|
+
if (!tree.value)
|
|
4397
|
+
return;
|
|
4398
|
+
tree.value.getNode(key)?.expand();
|
|
4399
|
+
});
|
|
4400
|
+
};
|
|
4401
|
+
vue.watch(
|
|
4402
|
+
() => editorService?.get("nodes"),
|
|
4403
|
+
(nodes) => {
|
|
4404
|
+
selectedNodes.value = nodes ?? [];
|
|
4061
4405
|
}
|
|
4062
|
-
|
|
4063
|
-
|
|
4406
|
+
);
|
|
4407
|
+
const setTreeKeyStatus = () => {
|
|
4408
|
+
if (!tree.value)
|
|
4409
|
+
return;
|
|
4410
|
+
if (selectedIds.value.length === 0) {
|
|
4411
|
+
tree.value.setCheckedKeys([]);
|
|
4412
|
+
tree.value.setCurrentKey();
|
|
4413
|
+
} else if (selectedIds.value.length === 1 && !isMultiSelectStatus.value) {
|
|
4414
|
+
tree.value.setCurrentKey(selectedIds.value[0], true);
|
|
4415
|
+
tree.value.setCheckedKeys([]);
|
|
4416
|
+
} else {
|
|
4417
|
+
tree.value.setCheckedKeys(selectedIds.value);
|
|
4418
|
+
tree.value.setCurrentKey();
|
|
4064
4419
|
}
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
handleCollapse: (data) => {
|
|
4071
|
-
expandedKeys.delete(data.id);
|
|
4072
|
-
},
|
|
4073
|
-
handleExpand: (data) => {
|
|
4074
|
-
const parent = editorService?.getParentById(data.id);
|
|
4420
|
+
};
|
|
4421
|
+
vue.watch([selectedIds, tree], async () => {
|
|
4422
|
+
if (!tree.value || !editorService)
|
|
4423
|
+
return;
|
|
4424
|
+
const parent = editorService.get("parent");
|
|
4075
4425
|
if (!parent?.id)
|
|
4076
4426
|
return;
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
const menu = vue.ref();
|
|
4427
|
+
const treeNode = tree.value.getNode(parent.id);
|
|
4428
|
+
treeNode?.updateChildren();
|
|
4429
|
+
await expandNodes();
|
|
4430
|
+
setTreeKeyStatus();
|
|
4431
|
+
});
|
|
4432
|
+
const mouseenterHandler = () => {
|
|
4433
|
+
tree.value?.$el.focus();
|
|
4434
|
+
};
|
|
4435
|
+
const mouseleaveHandler = () => {
|
|
4436
|
+
tree.value?.$el.blur();
|
|
4437
|
+
isMultiSelectStatus.value = false;
|
|
4438
|
+
};
|
|
4439
|
+
let keycon;
|
|
4440
|
+
vue.onMounted(() => {
|
|
4441
|
+
keycon = new KeyController__default.default(tree.value?.$el);
|
|
4442
|
+
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4443
|
+
const ctrl = isMac ? "meta" : "ctrl";
|
|
4444
|
+
keycon.keydown(ctrl, (e) => {
|
|
4445
|
+
e.inputEvent.preventDefault();
|
|
4446
|
+
isMultiSelectStatus.value = true;
|
|
4447
|
+
}).keyup(ctrl, (e) => {
|
|
4448
|
+
e.inputEvent.preventDefault();
|
|
4449
|
+
isMultiSelectStatus.value = false;
|
|
4450
|
+
});
|
|
4451
|
+
});
|
|
4452
|
+
vue.onUnmounted(() => {
|
|
4453
|
+
keycon.destroy();
|
|
4454
|
+
});
|
|
4106
4455
|
const clicked = vue.ref(false);
|
|
4107
|
-
const
|
|
4456
|
+
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
4108
4457
|
const highlightHandler = lodashEs.throttle((data) => {
|
|
4109
|
-
highlight(data
|
|
4458
|
+
highlight(data);
|
|
4110
4459
|
}, throttleTime);
|
|
4111
4460
|
const toggleClickFlag = () => {
|
|
4112
4461
|
clicked.value = !clicked.value;
|
|
4113
4462
|
};
|
|
4114
|
-
const
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4463
|
+
const canHighlight = (data) => {
|
|
4464
|
+
if (clicked.value)
|
|
4465
|
+
return false;
|
|
4466
|
+
return data.id === highlightNode?.value?.id && !selectedIds.value.includes(data.id) && spliceNodeKey.value !== data.id;
|
|
4467
|
+
};
|
|
4468
|
+
vue.watch(isMultiSelectStatus, () => {
|
|
4469
|
+
if (isMultiSelectStatus.value && selectedNodes.value.length === 1 && selectedNodes.value[0].type === schema.NodeType.PAGE) {
|
|
4470
|
+
selectedNodes.value = [];
|
|
4471
|
+
}
|
|
4122
4472
|
});
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4473
|
+
const multiClickHandler = (data) => {
|
|
4474
|
+
if (!data?.id) {
|
|
4475
|
+
throw new Error("\u6CA1\u6709id");
|
|
4476
|
+
}
|
|
4477
|
+
if (data.type === schema.NodeType.PAGE) {
|
|
4478
|
+
tree.value?.setCheckedKeys([]);
|
|
4479
|
+
return;
|
|
4480
|
+
}
|
|
4481
|
+
const index = selectedNodes.value.findIndex((node) => node.id === data.id);
|
|
4482
|
+
if (index !== -1) {
|
|
4483
|
+
selectedNodes.value.splice(index, 1);
|
|
4484
|
+
spliceNodeKey.value = data.id;
|
|
4485
|
+
} else {
|
|
4486
|
+
selectedNodes.value = [...selectedNodes.value, data];
|
|
4487
|
+
}
|
|
4488
|
+
tree.value?.setCheckedKeys(selectedIds.value);
|
|
4489
|
+
multiSelect(selectedIds.value);
|
|
4490
|
+
};
|
|
4491
|
+
const clickHandler = (data) => {
|
|
4492
|
+
if (!isMultiSelectStatus.value) {
|
|
4133
4493
|
if (services?.uiService.get("uiSelectMode")) {
|
|
4134
4494
|
document.dispatchEvent(new CustomEvent("ui-select", { detail: data }));
|
|
4135
4495
|
return;
|
|
4136
4496
|
}
|
|
4137
4497
|
tree.value?.setCurrentKey(data.id);
|
|
4138
|
-
select(data
|
|
4139
|
-
}
|
|
4140
|
-
|
|
4141
|
-
event.preventDefault();
|
|
4142
|
-
await select(data, editorService);
|
|
4143
|
-
menu.value?.show(event);
|
|
4498
|
+
select(data);
|
|
4499
|
+
} else {
|
|
4500
|
+
multiClickHandler(data);
|
|
4144
4501
|
}
|
|
4145
4502
|
};
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
for (const [key, val] of props) {
|
|
4152
|
-
target[key] = val;
|
|
4153
|
-
}
|
|
4154
|
-
return target;
|
|
4155
|
-
};
|
|
4156
|
-
|
|
4157
|
-
const _hoisted_1$3 = ["id", "onMouseenter"];
|
|
4158
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4159
|
-
const _component_el_input = vue.resolveComponent("el-input");
|
|
4160
|
-
const _component_el_tree = vue.resolveComponent("el-tree");
|
|
4161
|
-
const _component_layer_menu = vue.resolveComponent("layer-menu");
|
|
4162
|
-
const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
|
|
4163
|
-
return vue.openBlock(), vue.createBlock(_component_el_scrollbar, { class: "magic-editor-layer-panel" }, {
|
|
4164
|
-
default: vue.withCtx(() => [
|
|
4165
|
-
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4166
|
-
vue.createVNode(_component_el_input, {
|
|
4167
|
-
class: "filterInput",
|
|
4168
|
-
size: "small",
|
|
4169
|
-
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4170
|
-
clearable: "",
|
|
4171
|
-
modelValue: _ctx.filterText,
|
|
4172
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filterText = $event),
|
|
4173
|
-
onChange: _ctx.filterTextChangeHandler
|
|
4174
|
-
}, null, 8, ["modelValue", "onChange"]),
|
|
4175
|
-
_ctx.values.length ? (vue.openBlock(), vue.createBlock(_component_el_tree, {
|
|
4176
|
-
key: 0,
|
|
4177
|
-
ref: "tree",
|
|
4178
|
-
"node-key": "id",
|
|
4179
|
-
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4180
|
-
draggable: "",
|
|
4181
|
-
"default-expanded-keys": _ctx.expandedKeys,
|
|
4182
|
-
load: _ctx.loadItems,
|
|
4183
|
-
data: _ctx.values,
|
|
4184
|
-
"expand-on-click-node": false,
|
|
4185
|
-
"highlight-current": true,
|
|
4186
|
-
props: {
|
|
4187
|
-
children: "items"
|
|
4188
|
-
},
|
|
4189
|
-
"filter-node-method": _ctx.filterNode,
|
|
4190
|
-
"allow-drop": _ctx.allowDrop,
|
|
4191
|
-
onNodeClick: _ctx.clickHandler,
|
|
4192
|
-
onNodeContextmenu: _ctx.contextmenu,
|
|
4193
|
-
onNodeDragEnd: _ctx.handleDragEnd,
|
|
4194
|
-
onNodeCollapse: _ctx.handleCollapse,
|
|
4195
|
-
onNodeExpand: _ctx.handleExpand
|
|
4196
|
-
}, {
|
|
4197
|
-
default: vue.withCtx(({ node, data }) => [
|
|
4198
|
-
vue.createElementVNode("div", {
|
|
4199
|
-
id: data.id,
|
|
4200
|
-
class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": _ctx.canHighlight && data.id === _ctx.highlightNode?.id }]),
|
|
4201
|
-
onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.toggleClickFlag && _ctx.toggleClickFlag(...args)),
|
|
4202
|
-
onMouseup: _cache[2] || (_cache[2] = (...args) => _ctx.toggleClickFlag && _ctx.toggleClickFlag(...args)),
|
|
4203
|
-
onMouseenter: ($event) => _ctx.highlightHandler(data)
|
|
4204
|
-
}, [
|
|
4205
|
-
vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4206
|
-
node,
|
|
4207
|
-
data
|
|
4208
|
-
}, () => [
|
|
4209
|
-
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4210
|
-
])
|
|
4211
|
-
], 42, _hoisted_1$3)
|
|
4212
|
-
]),
|
|
4213
|
-
_: 3
|
|
4214
|
-
}, 8, ["default-expanded-keys", "load", "data", "filter-node-method", "allow-drop", "onNodeClick", "onNodeContextmenu", "onNodeDragEnd", "onNodeCollapse", "onNodeExpand"])) : vue.createCommentVNode("", true),
|
|
4215
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4216
|
-
vue.createVNode(_component_layer_menu, { ref: "menu" }, null, 512)
|
|
4217
|
-
]))
|
|
4218
|
-
]),
|
|
4219
|
-
_: 3
|
|
4220
|
-
});
|
|
4221
|
-
}
|
|
4222
|
-
const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$1]]);
|
|
4223
|
-
|
|
4224
|
-
const _hoisted_1$2 = {
|
|
4225
|
-
key: 1,
|
|
4226
|
-
class: "magic-editor-tab-panel-title"
|
|
4227
|
-
};
|
|
4228
|
-
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
4229
|
-
__name: "TabPane",
|
|
4230
|
-
props: {
|
|
4231
|
-
data: null
|
|
4232
|
-
},
|
|
4233
|
-
setup(__props) {
|
|
4234
|
-
const props = __props;
|
|
4235
|
-
const config = vue.computed(() => {
|
|
4236
|
-
if (typeof props.data !== "string") {
|
|
4237
|
-
return props.data;
|
|
4238
|
-
}
|
|
4239
|
-
switch (props.data) {
|
|
4240
|
-
case "component-list":
|
|
4241
|
-
return {
|
|
4242
|
-
type: "component",
|
|
4243
|
-
icon: iconsVue.Coin,
|
|
4244
|
-
text: "\u7EC4\u4EF6",
|
|
4245
|
-
component: _sfc_main$d,
|
|
4246
|
-
slots: {}
|
|
4247
|
-
};
|
|
4248
|
-
case "layer":
|
|
4249
|
-
return {
|
|
4250
|
-
type: "component",
|
|
4251
|
-
icon: iconsVue.Files,
|
|
4252
|
-
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4253
|
-
component: LayerPanel,
|
|
4254
|
-
slots: {}
|
|
4255
|
-
};
|
|
4256
|
-
case "code-block":
|
|
4257
|
-
return {
|
|
4258
|
-
type: "component",
|
|
4259
|
-
icon: iconsVue.EditPen,
|
|
4260
|
-
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4261
|
-
component: _sfc_main$e,
|
|
4262
|
-
slots: {}
|
|
4263
|
-
};
|
|
4264
|
-
default:
|
|
4265
|
-
return void 0;
|
|
4266
|
-
}
|
|
4267
|
-
});
|
|
4503
|
+
const contextmenu = async (event, data) => {
|
|
4504
|
+
event.preventDefault();
|
|
4505
|
+
await select(data);
|
|
4506
|
+
menu.value?.show(event);
|
|
4507
|
+
};
|
|
4268
4508
|
return (_ctx, _cache) => {
|
|
4269
|
-
|
|
4270
|
-
return vue.unref(config) ? (vue.openBlock(), vue.createBlock(_component_el_tab_pane, {
|
|
4271
|
-
key: 0,
|
|
4272
|
-
name: vue.unref(config).text
|
|
4273
|
-
}, {
|
|
4274
|
-
label: vue.withCtx(() => [
|
|
4275
|
-
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4276
|
-
key: vue.unref(config).text
|
|
4277
|
-
}, [
|
|
4278
|
-
vue.unref(config).icon ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
|
|
4279
|
-
key: 0,
|
|
4280
|
-
icon: vue.unref(config).icon
|
|
4281
|
-
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4282
|
-
vue.unref(config).text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, vue.toDisplayString(vue.unref(config).text), 1)) : vue.createCommentVNode("", true)
|
|
4283
|
-
]))
|
|
4284
|
-
]),
|
|
4509
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
4285
4510
|
default: vue.withCtx(() => [
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4511
|
+
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4512
|
+
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
4513
|
+
modelValue: filterText.value,
|
|
4514
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
4515
|
+
class: "search-input",
|
|
4516
|
+
size: "small",
|
|
4517
|
+
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4518
|
+
clearable: "",
|
|
4519
|
+
"prefix-icon": vue.unref(iconsVue.Search),
|
|
4520
|
+
onChange: filterTextChangeHandler
|
|
4521
|
+
}, null, 8, ["modelValue", "prefix-icon"]),
|
|
4522
|
+
vue.unref(values).length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
4523
|
+
key: 0,
|
|
4524
|
+
tabindex: "-1",
|
|
4525
|
+
class: "magic-editor-layer-tree",
|
|
4526
|
+
ref_key: "tree",
|
|
4527
|
+
ref: tree,
|
|
4528
|
+
"node-key": "id",
|
|
4529
|
+
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4530
|
+
draggable: "",
|
|
4531
|
+
"default-expanded-keys": vue.unref(defaultExpandedKeys),
|
|
4532
|
+
load: loadItems,
|
|
4533
|
+
data: vue.unref(values),
|
|
4534
|
+
"default-expand-all": true,
|
|
4535
|
+
"expand-on-click-node": false,
|
|
4536
|
+
"highlight-current": true,
|
|
4537
|
+
props: {
|
|
4538
|
+
children: "items"
|
|
4539
|
+
},
|
|
4540
|
+
"filter-node-method": filterNode,
|
|
4541
|
+
"allow-drop": allowDrop,
|
|
4542
|
+
"show-checkbox": isMultiSelectStatus.value || vue.unref(selectedIds).length > 1,
|
|
4543
|
+
onNodeClick: clickHandler,
|
|
4544
|
+
onNodeContextmenu: contextmenu,
|
|
4545
|
+
onNodeDragEnd: handleDragEnd,
|
|
4546
|
+
onNodeCollapse: handleCollapse,
|
|
4547
|
+
onNodeExpand: handleExpand,
|
|
4548
|
+
onCheck: multiClickHandler,
|
|
4549
|
+
onMousedown: toggleClickFlag,
|
|
4550
|
+
onMouseup: toggleClickFlag,
|
|
4551
|
+
onMouseenter: mouseenterHandler,
|
|
4552
|
+
onMouseleave: mouseleaveHandler
|
|
4553
|
+
}, {
|
|
4554
|
+
default: vue.withCtx(({ node, data }) => [
|
|
4555
|
+
vue.createElementVNode("div", {
|
|
4556
|
+
id: data.id,
|
|
4557
|
+
class: vue.normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4558
|
+
onMouseenter: ($event) => vue.unref(highlightHandler)(data)
|
|
4559
|
+
}, [
|
|
4560
|
+
vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4561
|
+
node,
|
|
4323
4562
|
data
|
|
4324
|
-
}
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
fn: vue.withCtx(({ data: nodeData, node }) => [
|
|
4339
|
-
__props.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4340
|
-
key: 0,
|
|
4341
|
-
data: nodeData,
|
|
4342
|
-
node
|
|
4343
|
-
}) : vue.unref(config).slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(config).slots.layerNodeContent), {
|
|
4344
|
-
key: 1,
|
|
4345
|
-
data: nodeData,
|
|
4346
|
-
node
|
|
4347
|
-
}, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
|
|
4348
|
-
])
|
|
4349
|
-
} : void 0
|
|
4350
|
-
]), 1040))
|
|
4563
|
+
}, () => [
|
|
4564
|
+
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4565
|
+
])
|
|
4566
|
+
], 42, _hoisted_1$4)
|
|
4567
|
+
]),
|
|
4568
|
+
_: 3
|
|
4569
|
+
}, 8, ["default-expanded-keys", "data", "show-checkbox"])) : vue.createCommentVNode("", true),
|
|
4570
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
4571
|
+
vue.createVNode(_sfc_main$b, {
|
|
4572
|
+
ref_key: "menu",
|
|
4573
|
+
ref: menu,
|
|
4574
|
+
"layer-content-menu": __props.layerContentMenu
|
|
4575
|
+
}, null, 8, ["layer-content-menu"])
|
|
4576
|
+
]))
|
|
4351
4577
|
]),
|
|
4352
4578
|
_: 3
|
|
4353
|
-
}
|
|
4579
|
+
});
|
|
4354
4580
|
};
|
|
4355
4581
|
}
|
|
4356
4582
|
});
|
|
4357
4583
|
|
|
4358
|
-
const
|
|
4359
|
-
|
|
4584
|
+
const _hoisted_1$3 = {
|
|
4585
|
+
key: 1,
|
|
4586
|
+
class: "magic-editor-tab-panel-title"
|
|
4587
|
+
};
|
|
4588
|
+
const __default__$8 = vue.defineComponent({
|
|
4589
|
+
name: "MEditorSidebar"
|
|
4590
|
+
});
|
|
4591
|
+
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
4592
|
+
...__default__$8,
|
|
4360
4593
|
props: {
|
|
4361
|
-
data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) }
|
|
4594
|
+
data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) },
|
|
4595
|
+
layerContentMenu: null
|
|
4362
4596
|
},
|
|
4363
4597
|
setup(__props, { expose }) {
|
|
4364
4598
|
const props = __props;
|
|
4599
|
+
const uiComponent = design.getConfig("components").tabPane;
|
|
4365
4600
|
const activeTabName = vue.ref(props.data?.status);
|
|
4601
|
+
const getItemConfig = (data) => {
|
|
4602
|
+
const map = {
|
|
4603
|
+
"component-list": {
|
|
4604
|
+
$key: "component-list",
|
|
4605
|
+
type: "component",
|
|
4606
|
+
icon: iconsVue.Coin,
|
|
4607
|
+
text: "\u7EC4\u4EF6",
|
|
4608
|
+
component: _sfc_main$d,
|
|
4609
|
+
slots: {}
|
|
4610
|
+
},
|
|
4611
|
+
layer: {
|
|
4612
|
+
$key: "layer",
|
|
4613
|
+
type: "component",
|
|
4614
|
+
icon: iconsVue.Files,
|
|
4615
|
+
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4616
|
+
props: {
|
|
4617
|
+
layerContentMenu: props.layerContentMenu
|
|
4618
|
+
},
|
|
4619
|
+
component: _sfc_main$a,
|
|
4620
|
+
slots: {}
|
|
4621
|
+
},
|
|
4622
|
+
"code-block": {
|
|
4623
|
+
$key: "code-block",
|
|
4624
|
+
type: "component",
|
|
4625
|
+
icon: iconsVue.EditPen,
|
|
4626
|
+
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4627
|
+
component: _sfc_main$e,
|
|
4628
|
+
slots: {}
|
|
4629
|
+
}
|
|
4630
|
+
};
|
|
4631
|
+
return typeof data === "string" ? map[data] : data;
|
|
4632
|
+
};
|
|
4633
|
+
const sideBarItems = vue.computed(() => props.data.items.map((item) => getItemConfig(item)));
|
|
4366
4634
|
vue.watch(
|
|
4367
4635
|
() => props.data.status,
|
|
4368
4636
|
(status) => {
|
|
@@ -4373,8 +4641,7 @@
|
|
|
4373
4641
|
activeTabName
|
|
4374
4642
|
});
|
|
4375
4643
|
return (_ctx, _cache) => {
|
|
4376
|
-
|
|
4377
|
-
return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(_component_el_tabs, {
|
|
4644
|
+
return __props.data.type === "tabs" && __props.data.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTabs), {
|
|
4378
4645
|
key: 0,
|
|
4379
4646
|
class: "m-editor-sidebar",
|
|
4380
4647
|
modelValue: activeTabName.value,
|
|
@@ -4383,60 +4650,91 @@
|
|
|
4383
4650
|
"tab-position": "left"
|
|
4384
4651
|
}, {
|
|
4385
4652
|
default: vue.withCtx(() => [
|
|
4386
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(
|
|
4387
|
-
return vue.openBlock(), vue.createBlock(
|
|
4653
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(sideBarItems), (config, index) => {
|
|
4654
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(uiComponent).component), {
|
|
4388
4655
|
key: index,
|
|
4389
|
-
|
|
4390
|
-
},
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4656
|
+
name: config.text
|
|
4657
|
+
}, {
|
|
4658
|
+
label: vue.withCtx(() => [
|
|
4659
|
+
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4660
|
+
key: config.text
|
|
4661
|
+
}, [
|
|
4662
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
4663
|
+
key: 0,
|
|
4664
|
+
icon: config.icon
|
|
4665
|
+
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
4666
|
+
config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
|
|
4667
|
+
]))
|
|
4668
|
+
]),
|
|
4669
|
+
default: vue.withCtx(() => [
|
|
4670
|
+
config ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({ key: 0 }, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
|
|
4671
|
+
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
4672
|
+
name: "component-list-panel-header",
|
|
4673
|
+
fn: vue.withCtx(() => [
|
|
4674
|
+
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)
|
|
4675
|
+
])
|
|
4676
|
+
} : void 0,
|
|
4677
|
+
config.$key === "component-list" || config.slots?.componentListItem ? {
|
|
4678
|
+
name: "component-list-item",
|
|
4679
|
+
fn: vue.withCtx(({ component }) => [
|
|
4680
|
+
config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
|
|
4681
|
+
key: 0,
|
|
4682
|
+
component
|
|
4683
|
+
}) : config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListItem), {
|
|
4684
|
+
key: 1,
|
|
4685
|
+
component
|
|
4686
|
+
}, null, 8, ["component"])) : vue.createCommentVNode("", true)
|
|
4687
|
+
])
|
|
4688
|
+
} : void 0,
|
|
4689
|
+
config.$key === "layer" || config.slots?.layerPanelHeader ? {
|
|
4690
|
+
name: "layer-panel-header",
|
|
4691
|
+
fn: vue.withCtx(() => [
|
|
4692
|
+
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)
|
|
4693
|
+
])
|
|
4694
|
+
} : void 0,
|
|
4695
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
|
|
4696
|
+
name: "code-block-panel-header",
|
|
4697
|
+
fn: vue.withCtx(() => [
|
|
4698
|
+
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)
|
|
4699
|
+
])
|
|
4700
|
+
} : void 0,
|
|
4701
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
4702
|
+
name: "code-block-panel-tool",
|
|
4703
|
+
fn: vue.withCtx(({ id, data }) => [
|
|
4704
|
+
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4705
|
+
key: 0,
|
|
4706
|
+
id,
|
|
4707
|
+
data
|
|
4708
|
+
}) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4709
|
+
])
|
|
4710
|
+
} : void 0,
|
|
4711
|
+
config.$key === "code-block" || config.slots?.codeBlockEditPanelHeader ? {
|
|
4712
|
+
name: "code-block-edit-panel-header",
|
|
4713
|
+
fn: vue.withCtx(({ id }) => [
|
|
4714
|
+
config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4715
|
+
key: 0,
|
|
4716
|
+
id
|
|
4717
|
+
}) : config.slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4718
|
+
])
|
|
4719
|
+
} : void 0,
|
|
4720
|
+
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
4721
|
+
name: "layer-node-content",
|
|
4722
|
+
fn: vue.withCtx(({ data: nodeData, node }) => [
|
|
4723
|
+
config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4724
|
+
key: 0,
|
|
4725
|
+
data: nodeData,
|
|
4726
|
+
node
|
|
4727
|
+
}) : config.slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
4728
|
+
key: 1,
|
|
4729
|
+
data: nodeData,
|
|
4730
|
+
node
|
|
4731
|
+
}, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
|
|
4732
|
+
])
|
|
4733
|
+
} : void 0
|
|
4734
|
+
]), 1040)) : vue.createCommentVNode("", true)
|
|
4735
|
+
]),
|
|
4736
|
+
_: 2
|
|
4737
|
+
}, 1032, ["name"]);
|
|
4440
4738
|
}), 128))
|
|
4441
4739
|
]),
|
|
4442
4740
|
_: 3
|
|
@@ -4445,12 +4743,60 @@
|
|
|
4445
4743
|
}
|
|
4446
4744
|
});
|
|
4447
4745
|
|
|
4746
|
+
const _hoisted_1$2 = {
|
|
4747
|
+
key: 0,
|
|
4748
|
+
class: "m-editor-breadcrumb"
|
|
4749
|
+
};
|
|
4750
|
+
const _hoisted_2$1 = { key: 0 };
|
|
4751
|
+
const __default__$7 = vue.defineComponent({
|
|
4752
|
+
name: "MEditorBreadcrumb"
|
|
4753
|
+
});
|
|
4754
|
+
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
4755
|
+
...__default__$7,
|
|
4756
|
+
setup(__props) {
|
|
4757
|
+
const services = vue.inject("services");
|
|
4758
|
+
const editorService = services?.editorService;
|
|
4759
|
+
const node = vue.computed(() => editorService?.get("node"));
|
|
4760
|
+
const nodes = vue.computed(() => editorService?.get("nodes") || []);
|
|
4761
|
+
const root = vue.computed(() => editorService?.get("root"));
|
|
4762
|
+
const path = vue.computed(() => utils.getNodePath(node.value?.id || "", root.value?.items || []));
|
|
4763
|
+
const select = async (node2) => {
|
|
4764
|
+
await editorService?.select(node2);
|
|
4765
|
+
editorService?.get("stage")?.select(node2.id);
|
|
4766
|
+
};
|
|
4767
|
+
return (_ctx, _cache) => {
|
|
4768
|
+
return vue.unref(nodes).length === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
4769
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(path), (item, index) => {
|
|
4770
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
4771
|
+
key: item.id
|
|
4772
|
+
}, [
|
|
4773
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4774
|
+
text: "",
|
|
4775
|
+
disabled: item.id === vue.unref(node)?.id,
|
|
4776
|
+
onClick: ($event) => select(item)
|
|
4777
|
+
}, {
|
|
4778
|
+
default: vue.withCtx(() => [
|
|
4779
|
+
vue.createTextVNode(vue.toDisplayString(item.name), 1)
|
|
4780
|
+
]),
|
|
4781
|
+
_: 2
|
|
4782
|
+
}, 1032, ["disabled", "onClick"]),
|
|
4783
|
+
index < vue.unref(path).length - 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$1, "/")) : vue.createCommentVNode("", true)
|
|
4784
|
+
], 64);
|
|
4785
|
+
}), 128))
|
|
4786
|
+
])) : vue.createCommentVNode("", true);
|
|
4787
|
+
};
|
|
4788
|
+
}
|
|
4789
|
+
});
|
|
4790
|
+
|
|
4448
4791
|
const _hoisted_1$1 = {
|
|
4449
4792
|
key: 1,
|
|
4450
4793
|
style: { "width": "21px" }
|
|
4451
4794
|
};
|
|
4795
|
+
const __default__$6 = vue.defineComponent({
|
|
4796
|
+
name: "MEditorPageBarScrollContainer"
|
|
4797
|
+
});
|
|
4452
4798
|
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
4453
|
-
|
|
4799
|
+
...__default__$6,
|
|
4454
4800
|
setup(__props) {
|
|
4455
4801
|
const services = vue.inject("services");
|
|
4456
4802
|
const editorService = services?.editorService;
|
|
@@ -4531,14 +4877,14 @@
|
|
|
4531
4877
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4532
4878
|
onClick: addPage
|
|
4533
4879
|
}, [
|
|
4534
|
-
vue.createVNode(_sfc_main$
|
|
4880
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4535
4881
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
4536
4882
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4537
4883
|
key: 2,
|
|
4538
4884
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4539
4885
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4540
4886
|
}, [
|
|
4541
|
-
vue.createVNode(_sfc_main$
|
|
4887
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
4542
4888
|
])) : vue.createCommentVNode("", true),
|
|
4543
4889
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4544
4890
|
key: 3,
|
|
@@ -4554,7 +4900,7 @@
|
|
|
4554
4900
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4555
4901
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4556
4902
|
}, [
|
|
4557
|
-
vue.createVNode(_sfc_main$
|
|
4903
|
+
vue.createVNode(_sfc_main$n, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
4558
4904
|
])) : vue.createCommentVNode("", true)
|
|
4559
4905
|
], 512);
|
|
4560
4906
|
};
|
|
@@ -4563,8 +4909,11 @@
|
|
|
4563
4909
|
|
|
4564
4910
|
const _hoisted_1 = ["onClick"];
|
|
4565
4911
|
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
4912
|
+
const __default__$5 = vue.defineComponent({
|
|
4913
|
+
name: "MEditorPageBar"
|
|
4914
|
+
});
|
|
4566
4915
|
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
4567
|
-
|
|
4916
|
+
...__default__$5,
|
|
4568
4917
|
setup(__props) {
|
|
4569
4918
|
const services = vue.inject("services");
|
|
4570
4919
|
const editorService = services?.editorService;
|
|
@@ -4584,9 +4933,6 @@
|
|
|
4584
4933
|
editorService?.remove(node);
|
|
4585
4934
|
};
|
|
4586
4935
|
return (_ctx, _cache) => {
|
|
4587
|
-
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
4588
|
-
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
4589
|
-
const _component_el_popover = vue.resolveComponent("el-popover");
|
|
4590
4936
|
return vue.openBlock(), vue.createBlock(_sfc_main$7, null, {
|
|
4591
4937
|
default: vue.withCtx(() => [
|
|
4592
4938
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(root) && vue.unref(root).items || [], (item) => {
|
|
@@ -4597,7 +4943,7 @@
|
|
|
4597
4943
|
}, [
|
|
4598
4944
|
vue.createElementVNode("div", _hoisted_2, [
|
|
4599
4945
|
vue.renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
|
|
4600
|
-
vue.createVNode(
|
|
4946
|
+
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
4601
4947
|
effect: "dark",
|
|
4602
4948
|
placement: "top-start",
|
|
4603
4949
|
content: item.name
|
|
@@ -4609,14 +4955,14 @@
|
|
|
4609
4955
|
}, 1032, ["content"])
|
|
4610
4956
|
])
|
|
4611
4957
|
]),
|
|
4612
|
-
vue.createVNode(
|
|
4958
|
+
vue.createVNode(vue.unref(design.TMagicPopover), {
|
|
4613
4959
|
"popper-class": "page-bar-popover",
|
|
4614
4960
|
placement: "top",
|
|
4615
4961
|
width: 160,
|
|
4616
4962
|
trigger: "hover"
|
|
4617
4963
|
}, {
|
|
4618
4964
|
reference: vue.withCtx(() => [
|
|
4619
|
-
vue.createVNode(
|
|
4965
|
+
vue.createVNode(vue.unref(design.TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
|
|
4620
4966
|
default: vue.withCtx(() => [
|
|
4621
4967
|
vue.createVNode(vue.unref(iconsVue.CaretBottom))
|
|
4622
4968
|
]),
|
|
@@ -4626,7 +4972,7 @@
|
|
|
4626
4972
|
default: vue.withCtx(() => [
|
|
4627
4973
|
vue.createElementVNode("div", null, [
|
|
4628
4974
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
4629
|
-
vue.createVNode(_sfc_main$
|
|
4975
|
+
vue.createVNode(_sfc_main$k, {
|
|
4630
4976
|
data: {
|
|
4631
4977
|
type: "button",
|
|
4632
4978
|
text: "\u590D\u5236",
|
|
@@ -4634,7 +4980,7 @@
|
|
|
4634
4980
|
handler: () => copy(item)
|
|
4635
4981
|
}
|
|
4636
4982
|
}, null, 8, ["data"]),
|
|
4637
|
-
vue.createVNode(_sfc_main$
|
|
4983
|
+
vue.createVNode(_sfc_main$k, {
|
|
4638
4984
|
data: {
|
|
4639
4985
|
type: "button",
|
|
4640
4986
|
text: "\u5220\u9664",
|
|
@@ -4668,6 +5014,10 @@
|
|
|
4668
5014
|
height = 0;
|
|
4669
5015
|
translateXCorrectionValue = 0;
|
|
4670
5016
|
translateYCorrectionValue = 0;
|
|
5017
|
+
correctionScrollSize = {
|
|
5018
|
+
width: 0,
|
|
5019
|
+
height: 0
|
|
5020
|
+
};
|
|
4671
5021
|
resizeObserver = new ResizeObserver(() => {
|
|
4672
5022
|
this.setSize();
|
|
4673
5023
|
this.setScrollSize();
|
|
@@ -4677,6 +5027,12 @@
|
|
|
4677
5027
|
this.container = options.container;
|
|
4678
5028
|
this.target = options.target;
|
|
4679
5029
|
this.zoom = options.zoom;
|
|
5030
|
+
if (this.correctionScrollSize) {
|
|
5031
|
+
this.correctionScrollSize = {
|
|
5032
|
+
...this.correctionScrollSize,
|
|
5033
|
+
...options.correctionScrollSize
|
|
5034
|
+
};
|
|
5035
|
+
}
|
|
4680
5036
|
this.container.addEventListener("wheel", this.wheelHandler, false);
|
|
4681
5037
|
this.setSize();
|
|
4682
5038
|
this.setScrollSize();
|
|
@@ -4739,9 +5095,9 @@
|
|
|
4739
5095
|
}
|
|
4740
5096
|
setScrollSize = () => {
|
|
4741
5097
|
const targetRect = this.target.getBoundingClientRect();
|
|
4742
|
-
this.scrollWidth = targetRect.width * this.zoom +
|
|
5098
|
+
this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
|
|
4743
5099
|
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
4744
|
-
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom +
|
|
5100
|
+
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
|
|
4745
5101
|
let left;
|
|
4746
5102
|
let top;
|
|
4747
5103
|
if (this.scrollWidth < this.width) {
|
|
@@ -4774,8 +5130,11 @@
|
|
|
4774
5130
|
};
|
|
4775
5131
|
}
|
|
4776
5132
|
|
|
5133
|
+
const __default__$4 = vue.defineComponent({
|
|
5134
|
+
name: "MEditorScrollBar"
|
|
5135
|
+
});
|
|
4777
5136
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
4778
|
-
|
|
5137
|
+
...__default__$4,
|
|
4779
5138
|
props: {
|
|
4780
5139
|
size: null,
|
|
4781
5140
|
scrollSize: null,
|
|
@@ -4860,14 +5219,21 @@
|
|
|
4860
5219
|
|
|
4861
5220
|
const ScrollBar_vue_vue_type_style_index_0_lang = '';
|
|
4862
5221
|
|
|
5222
|
+
const __default__$3 = vue.defineComponent({
|
|
5223
|
+
name: "MEditorScrollViewer"
|
|
5224
|
+
});
|
|
4863
5225
|
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
4864
|
-
|
|
5226
|
+
...__default__$3,
|
|
4865
5227
|
props: {
|
|
4866
5228
|
width: { default: 0 },
|
|
4867
5229
|
height: { default: 0 },
|
|
4868
5230
|
wrapWidth: { default: 0 },
|
|
4869
5231
|
wrapHeight: { default: 0 },
|
|
4870
|
-
zoom: { default: 1 }
|
|
5232
|
+
zoom: { default: 1 },
|
|
5233
|
+
correctionScrollSize: { default: () => ({
|
|
5234
|
+
width: 0,
|
|
5235
|
+
height: 0
|
|
5236
|
+
}) }
|
|
4871
5237
|
},
|
|
4872
5238
|
setup(__props, { expose }) {
|
|
4873
5239
|
const props = __props;
|
|
@@ -4890,7 +5256,8 @@
|
|
|
4890
5256
|
scrollViewer = new ScrollViewer({
|
|
4891
5257
|
container: container.value,
|
|
4892
5258
|
target: el.value,
|
|
4893
|
-
zoom: props.zoom
|
|
5259
|
+
zoom: props.zoom,
|
|
5260
|
+
correctionScrollSize: props.correctionScrollSize
|
|
4894
5261
|
});
|
|
4895
5262
|
scrollViewer.on("scroll", (data) => {
|
|
4896
5263
|
hOffset.value = data.scrollLeft;
|
|
@@ -4958,10 +5325,14 @@
|
|
|
4958
5325
|
}
|
|
4959
5326
|
});
|
|
4960
5327
|
|
|
5328
|
+
const __default__$2 = vue.defineComponent({
|
|
5329
|
+
name: "MEditorViewerMenu"
|
|
5330
|
+
});
|
|
4961
5331
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
4962
|
-
|
|
5332
|
+
...__default__$2,
|
|
4963
5333
|
props: {
|
|
4964
|
-
isMultiSelect: { type: Boolean, default: false }
|
|
5334
|
+
isMultiSelect: { type: Boolean, default: false },
|
|
5335
|
+
stageContentMenu: null
|
|
4965
5336
|
},
|
|
4966
5337
|
setup(__props, { expose }) {
|
|
4967
5338
|
const props = __props;
|
|
@@ -4974,8 +5345,7 @@
|
|
|
4974
5345
|
const nodes = vue.computed(() => editorService?.get("nodes"));
|
|
4975
5346
|
const parent = vue.computed(() => editorService?.get("parent"));
|
|
4976
5347
|
const stage = vue.computed(() => editorService?.get("stage"));
|
|
4977
|
-
const
|
|
4978
|
-
const menuData = vue.reactive([
|
|
5348
|
+
const menuData = vue.computed(() => [
|
|
4979
5349
|
{
|
|
4980
5350
|
type: "button",
|
|
4981
5351
|
text: "\u6C34\u5E73\u5C45\u4E2D",
|
|
@@ -4989,7 +5359,7 @@
|
|
|
4989
5359
|
{
|
|
4990
5360
|
type: "button",
|
|
4991
5361
|
text: "\u590D\u5236",
|
|
4992
|
-
icon: vue.markRaw(iconsVue.
|
|
5362
|
+
icon: vue.markRaw(iconsVue.CopyDocument),
|
|
4993
5363
|
handler: () => {
|
|
4994
5364
|
nodes.value && editorService?.copy(nodes.value);
|
|
4995
5365
|
canPaste.value = true;
|
|
@@ -4998,6 +5368,7 @@
|
|
|
4998
5368
|
{
|
|
4999
5369
|
type: "button",
|
|
5000
5370
|
text: "\u7C98\u8D34",
|
|
5371
|
+
icon: vue.markRaw(iconsVue.DocumentCopy),
|
|
5001
5372
|
display: () => canPaste.value,
|
|
5002
5373
|
handler: () => {
|
|
5003
5374
|
const rect = menu.value?.$el.getBoundingClientRect();
|
|
@@ -5077,7 +5448,7 @@
|
|
|
5077
5448
|
editorService?.get("stage").clearGuides();
|
|
5078
5449
|
}
|
|
5079
5450
|
},
|
|
5080
|
-
...stageContentMenu
|
|
5451
|
+
...props.stageContentMenu
|
|
5081
5452
|
]);
|
|
5082
5453
|
vue.watch(
|
|
5083
5454
|
parent,
|
|
@@ -5101,7 +5472,7 @@
|
|
|
5101
5472
|
expose({ show });
|
|
5102
5473
|
return (_ctx, _cache) => {
|
|
5103
5474
|
return vue.openBlock(), vue.createBlock(_sfc_main$c, {
|
|
5104
|
-
"menu-data": menuData,
|
|
5475
|
+
"menu-data": vue.unref(menuData),
|
|
5105
5476
|
ref_key: "menu",
|
|
5106
5477
|
ref: menu
|
|
5107
5478
|
}, null, 8, ["menu-data"]);
|
|
@@ -5109,8 +5480,14 @@
|
|
|
5109
5480
|
}
|
|
5110
5481
|
});
|
|
5111
5482
|
|
|
5483
|
+
const __default__$1 = vue.defineComponent({
|
|
5484
|
+
name: "MEditorStage"
|
|
5485
|
+
});
|
|
5112
5486
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
5113
|
-
|
|
5487
|
+
...__default__$1,
|
|
5488
|
+
props: {
|
|
5489
|
+
stageContentMenu: null
|
|
5490
|
+
},
|
|
5114
5491
|
setup(__props) {
|
|
5115
5492
|
let stage = null;
|
|
5116
5493
|
let runtime = null;
|
|
@@ -5127,7 +5504,7 @@
|
|
|
5127
5504
|
const zoom = vue.computed(() => services?.uiService.get("zoom") || 1);
|
|
5128
5505
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
5129
5506
|
vue.watchEffect(() => {
|
|
5130
|
-
if (stage)
|
|
5507
|
+
if (stage || !page.value)
|
|
5131
5508
|
return;
|
|
5132
5509
|
if (!stageContainer.value)
|
|
5133
5510
|
return;
|
|
@@ -5157,6 +5534,14 @@
|
|
|
5157
5534
|
runtime.updateRootConfig?.(lodashEs.cloneDeep(vue.toRaw(root2)));
|
|
5158
5535
|
}
|
|
5159
5536
|
});
|
|
5537
|
+
vue.watch(page, (page2) => {
|
|
5538
|
+
if (runtime && page2) {
|
|
5539
|
+
runtime.updatePageId?.(page2.id);
|
|
5540
|
+
vue.nextTick(() => {
|
|
5541
|
+
stage?.select(page2.id);
|
|
5542
|
+
});
|
|
5543
|
+
}
|
|
5544
|
+
});
|
|
5160
5545
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
5161
5546
|
for (const { contentRect } of entries) {
|
|
5162
5547
|
services?.uiService.set("stageContainerRect", {
|
|
@@ -5229,7 +5614,11 @@
|
|
|
5229
5614
|
height: vue.unref(stageRect)?.height,
|
|
5230
5615
|
"wrap-width": vue.unref(stageContainerRect)?.width,
|
|
5231
5616
|
"wrap-height": vue.unref(stageContainerRect)?.height,
|
|
5232
|
-
zoom: vue.unref(zoom)
|
|
5617
|
+
zoom: vue.unref(zoom),
|
|
5618
|
+
"correction-scroll-size": {
|
|
5619
|
+
width: 60,
|
|
5620
|
+
height: 50
|
|
5621
|
+
}
|
|
5233
5622
|
}, {
|
|
5234
5623
|
default: vue.withCtx(() => [
|
|
5235
5624
|
vue.createElementVNode("div", {
|
|
@@ -5245,8 +5634,9 @@
|
|
|
5245
5634
|
vue.createVNode(_sfc_main$3, {
|
|
5246
5635
|
ref_key: "menu",
|
|
5247
5636
|
ref: menu,
|
|
5248
|
-
"is-multi-select": vue.unref(isMultiSelect)
|
|
5249
|
-
|
|
5637
|
+
"is-multi-select": vue.unref(isMultiSelect),
|
|
5638
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5639
|
+
}, null, 8, ["is-multi-select", "stage-content-menu"])
|
|
5250
5640
|
]))
|
|
5251
5641
|
]),
|
|
5252
5642
|
_: 1
|
|
@@ -5255,8 +5645,14 @@
|
|
|
5255
5645
|
}
|
|
5256
5646
|
});
|
|
5257
5647
|
|
|
5648
|
+
const __default__ = vue.defineComponent({
|
|
5649
|
+
name: "MEditorWorkspace"
|
|
5650
|
+
});
|
|
5258
5651
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
5259
|
-
|
|
5652
|
+
...__default__,
|
|
5653
|
+
props: {
|
|
5654
|
+
stageContentMenu: null
|
|
5655
|
+
},
|
|
5260
5656
|
setup(__props) {
|
|
5261
5657
|
const services = vue.inject("services");
|
|
5262
5658
|
const workspace = vue.ref();
|
|
@@ -5365,10 +5761,12 @@
|
|
|
5365
5761
|
ref_key: "workspace",
|
|
5366
5762
|
ref: workspace
|
|
5367
5763
|
}, [
|
|
5764
|
+
vue.createVNode(_sfc_main$8),
|
|
5368
5765
|
vue.renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
5369
|
-
(vue.openBlock(), vue.createBlock(_sfc_main$2, {
|
|
5370
|
-
key:
|
|
5371
|
-
|
|
5766
|
+
vue.unref(page) ? (vue.openBlock(), vue.createBlock(_sfc_main$2, {
|
|
5767
|
+
key: 0,
|
|
5768
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5769
|
+
}, null, 8, ["stage-content-menu"])) : vue.createCommentVNode("", true)
|
|
5372
5770
|
]),
|
|
5373
5771
|
vue.renderSlot(_ctx.$slots, "workspace-content"),
|
|
5374
5772
|
vue.createVNode(_sfc_main$6, null, {
|
|
@@ -5398,9 +5796,13 @@
|
|
|
5398
5796
|
getList() {
|
|
5399
5797
|
return this.state.list;
|
|
5400
5798
|
}
|
|
5401
|
-
|
|
5799
|
+
resetState() {
|
|
5402
5800
|
this.state.list = [];
|
|
5801
|
+
}
|
|
5802
|
+
destroy() {
|
|
5803
|
+
this.resetState();
|
|
5403
5804
|
this.removeAllListeners();
|
|
5805
|
+
this.removeAllPlugins();
|
|
5404
5806
|
}
|
|
5405
5807
|
}
|
|
5406
5808
|
const componentListService = new ComponentList();
|
|
@@ -5408,11 +5810,11 @@
|
|
|
5408
5810
|
const _sfc_main = vue.defineComponent({
|
|
5409
5811
|
name: "m-editor",
|
|
5410
5812
|
components: {
|
|
5411
|
-
NavMenu: _sfc_main$
|
|
5412
|
-
Sidebar: _sfc_main$
|
|
5813
|
+
NavMenu: _sfc_main$j,
|
|
5814
|
+
Sidebar: _sfc_main$9,
|
|
5413
5815
|
Workspace: _sfc_main$1,
|
|
5414
|
-
PropsPanel: _sfc_main$
|
|
5415
|
-
Framework: _sfc_main$
|
|
5816
|
+
PropsPanel: _sfc_main$i,
|
|
5817
|
+
Framework: _sfc_main$l
|
|
5416
5818
|
},
|
|
5417
5819
|
props: {
|
|
5418
5820
|
modelValue: {
|
|
@@ -5427,6 +5829,10 @@
|
|
|
5427
5829
|
sidebar: {
|
|
5428
5830
|
type: Object
|
|
5429
5831
|
},
|
|
5832
|
+
menu: {
|
|
5833
|
+
type: Object,
|
|
5834
|
+
default: () => ({ left: [], right: [] })
|
|
5835
|
+
},
|
|
5430
5836
|
layerContentMenu: {
|
|
5431
5837
|
type: Array,
|
|
5432
5838
|
default: () => []
|
|
@@ -5435,10 +5841,6 @@
|
|
|
5435
5841
|
type: Array,
|
|
5436
5842
|
default: () => []
|
|
5437
5843
|
},
|
|
5438
|
-
menu: {
|
|
5439
|
-
type: Object,
|
|
5440
|
-
default: () => ({ left: [], right: [] })
|
|
5441
|
-
},
|
|
5442
5844
|
render: {
|
|
5443
5845
|
type: Function
|
|
5444
5846
|
},
|
|
@@ -5472,7 +5874,7 @@
|
|
|
5472
5874
|
},
|
|
5473
5875
|
containerHighlightClassName: {
|
|
5474
5876
|
type: String,
|
|
5475
|
-
default: StageCore.
|
|
5877
|
+
default: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME
|
|
5476
5878
|
},
|
|
5477
5879
|
containerHighlightDuration: {
|
|
5478
5880
|
type: Number,
|
|
@@ -5496,14 +5898,23 @@
|
|
|
5496
5898
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
5497
5899
|
setup(props, { emit }) {
|
|
5498
5900
|
editorService.on("root-change", (value) => {
|
|
5499
|
-
const
|
|
5500
|
-
|
|
5501
|
-
if (nodeId
|
|
5502
|
-
editorService.
|
|
5503
|
-
}
|
|
5901
|
+
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
5902
|
+
let node;
|
|
5903
|
+
if (nodeId) {
|
|
5904
|
+
node = editorService.getNodeById(nodeId);
|
|
5905
|
+
}
|
|
5906
|
+
if (node && node !== value) {
|
|
5907
|
+
editorService.select(node.id);
|
|
5908
|
+
} else if (value?.items?.length) {
|
|
5909
|
+
editorService.select(value.items[0]);
|
|
5910
|
+
} else if (value?.id) {
|
|
5504
5911
|
editorService.set("nodes", [value]);
|
|
5912
|
+
editorService.set("parent", null);
|
|
5913
|
+
editorService.set("page", null);
|
|
5914
|
+
}
|
|
5915
|
+
if (vue.toRaw(value) !== vue.toRaw(editorService.get("root"))) {
|
|
5916
|
+
emit("update:modelValue", value);
|
|
5505
5917
|
}
|
|
5506
|
-
emit("update:modelValue", vue.toRaw(editorService.get("root")));
|
|
5507
5918
|
});
|
|
5508
5919
|
vue.watch(
|
|
5509
5920
|
() => props.modelValue,
|
|
@@ -5566,13 +5977,12 @@
|
|
|
5566
5977
|
}
|
|
5567
5978
|
);
|
|
5568
5979
|
vue.onUnmounted(() => {
|
|
5569
|
-
editorService.
|
|
5570
|
-
historyService.
|
|
5571
|
-
propsService.
|
|
5572
|
-
uiService.
|
|
5573
|
-
componentListService.
|
|
5574
|
-
|
|
5575
|
-
codeBlockService.destroy();
|
|
5980
|
+
editorService.resetState();
|
|
5981
|
+
historyService.resetState();
|
|
5982
|
+
propsService.resetState();
|
|
5983
|
+
uiService.resetState();
|
|
5984
|
+
componentListService.resetState();
|
|
5985
|
+
codeBlockService.resetState();
|
|
5576
5986
|
});
|
|
5577
5987
|
const services = {
|
|
5578
5988
|
componentListService,
|
|
@@ -5585,8 +5995,7 @@
|
|
|
5585
5995
|
codeBlockService
|
|
5586
5996
|
};
|
|
5587
5997
|
vue.provide("services", services);
|
|
5588
|
-
vue.provide("
|
|
5589
|
-
vue.provide("stageContentMenu", props.stageContentMenu);
|
|
5998
|
+
vue.provide("codeOptions", props.codeOptions);
|
|
5590
5999
|
vue.provide(
|
|
5591
6000
|
"stageOptions",
|
|
5592
6001
|
vue.reactive({
|
|
@@ -5606,21 +6015,32 @@
|
|
|
5606
6015
|
}
|
|
5607
6016
|
});
|
|
5608
6017
|
|
|
6018
|
+
const _export_sfc = (sfc, props) => {
|
|
6019
|
+
const target = sfc.__vccOpts || sfc;
|
|
6020
|
+
for (const [key, val] of props) {
|
|
6021
|
+
target[key] = val;
|
|
6022
|
+
}
|
|
6023
|
+
return target;
|
|
6024
|
+
};
|
|
6025
|
+
|
|
5609
6026
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5610
|
-
const
|
|
5611
|
-
const
|
|
5612
|
-
const
|
|
5613
|
-
const
|
|
5614
|
-
const
|
|
5615
|
-
return vue.openBlock(), vue.createBlock(
|
|
6027
|
+
const _component_NavMenu = vue.resolveComponent("NavMenu");
|
|
6028
|
+
const _component_Sidebar = vue.resolveComponent("Sidebar");
|
|
6029
|
+
const _component_Workspace = vue.resolveComponent("Workspace");
|
|
6030
|
+
const _component_PropsPanel = vue.resolveComponent("PropsPanel");
|
|
6031
|
+
const _component_Framework = vue.resolveComponent("Framework");
|
|
6032
|
+
return vue.openBlock(), vue.createBlock(_component_Framework, { "code-options": _ctx.codeOptions }, {
|
|
5616
6033
|
nav: vue.withCtx(() => [
|
|
5617
6034
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
5618
|
-
vue.createVNode(
|
|
6035
|
+
vue.createVNode(_component_NavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
5619
6036
|
])
|
|
5620
6037
|
]),
|
|
5621
6038
|
sidebar: vue.withCtx(() => [
|
|
5622
6039
|
vue.renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
5623
|
-
vue.createVNode(
|
|
6040
|
+
vue.createVNode(_component_Sidebar, {
|
|
6041
|
+
data: _ctx.sidebar,
|
|
6042
|
+
"layer-content-menu": _ctx.layerContentMenu
|
|
6043
|
+
}, {
|
|
5624
6044
|
"layer-panel-header": vue.withCtx(() => [
|
|
5625
6045
|
vue.renderSlot(_ctx.$slots, "layer-panel-header")
|
|
5626
6046
|
]),
|
|
@@ -5649,12 +6069,12 @@
|
|
|
5649
6069
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
5650
6070
|
]),
|
|
5651
6071
|
_: 3
|
|
5652
|
-
}, 8, ["data"])
|
|
6072
|
+
}, 8, ["data", "layer-content-menu"])
|
|
5653
6073
|
])
|
|
5654
6074
|
]),
|
|
5655
6075
|
workspace: vue.withCtx(() => [
|
|
5656
6076
|
vue.renderSlot(_ctx.$slots, "workspace", { editorService: _ctx.editorService }, () => [
|
|
5657
|
-
vue.createVNode(
|
|
6077
|
+
vue.createVNode(_component_Workspace, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
5658
6078
|
stage: vue.withCtx(() => [
|
|
5659
6079
|
vue.renderSlot(_ctx.$slots, "stage")
|
|
5660
6080
|
]),
|
|
@@ -5668,12 +6088,12 @@
|
|
|
5668
6088
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
5669
6089
|
]),
|
|
5670
6090
|
_: 3
|
|
5671
|
-
})
|
|
6091
|
+
}, 8, ["stage-content-menu"])
|
|
5672
6092
|
])
|
|
5673
6093
|
]),
|
|
5674
6094
|
"props-panel": vue.withCtx(() => [
|
|
5675
6095
|
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
5676
|
-
vue.createVNode(
|
|
6096
|
+
vue.createVNode(_component_PropsPanel, {
|
|
5677
6097
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
5678
6098
|
}, {
|
|
5679
6099
|
"props-panel-header": vue.withCtx(() => [
|
|
@@ -5700,35 +6120,37 @@
|
|
|
5700
6120
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
5701
6121
|
setConfig(option);
|
|
5702
6122
|
app.component(Editor.name, Editor);
|
|
5703
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
5704
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
5705
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
5706
|
-
app.component("magic-code-editor", _sfc_main$
|
|
5707
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
6123
|
+
app.component("m-fields-ui-select", _sfc_main$r);
|
|
6124
|
+
app.component("m-fields-code-link", _sfc_main$t);
|
|
6125
|
+
app.component("m-fields-vs-code", _sfc_main$u);
|
|
6126
|
+
app.component("magic-code-editor", _sfc_main$q);
|
|
6127
|
+
app.component("m-fields-code-select", _sfc_main$s);
|
|
5708
6128
|
}
|
|
5709
6129
|
};
|
|
5710
6130
|
|
|
6131
|
+
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
5711
6132
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
5712
6133
|
exports.CodeBlockList = _sfc_main$e;
|
|
5713
6134
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
5714
6135
|
exports.CodeEditorMode = CodeEditorMode;
|
|
5715
|
-
exports.CodeSelect = _sfc_main$
|
|
5716
|
-
exports.CodeSelectOp = CodeSelectOp;
|
|
6136
|
+
exports.CodeSelect = _sfc_main$s;
|
|
5717
6137
|
exports.ColumnLayout = ColumnLayout;
|
|
5718
6138
|
exports.ComponentListPanel = _sfc_main$d;
|
|
5719
6139
|
exports.ContentMenu = _sfc_main$c;
|
|
5720
6140
|
exports.Fixed2Other = Fixed2Other;
|
|
5721
6141
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
5722
|
-
exports.Icon = _sfc_main$
|
|
6142
|
+
exports.Icon = _sfc_main$n;
|
|
5723
6143
|
exports.Keys = Keys;
|
|
5724
6144
|
exports.LayerOffset = LayerOffset;
|
|
5725
|
-
exports.LayerPanel =
|
|
6145
|
+
exports.LayerPanel = _sfc_main$a;
|
|
5726
6146
|
exports.Layout = Layout;
|
|
5727
|
-
exports.
|
|
5728
|
-
exports.
|
|
6147
|
+
exports.LayoutContainer = _sfc_main$o;
|
|
6148
|
+
exports.PropsPanel = _sfc_main$i;
|
|
6149
|
+
exports.TMagicCodeEditor = _sfc_main$q;
|
|
5729
6150
|
exports.TMagicEditor = Editor;
|
|
5730
|
-
exports.ToolButton = _sfc_main$
|
|
6151
|
+
exports.ToolButton = _sfc_main$k;
|
|
5731
6152
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
6153
|
+
exports.beforePaste = beforePaste;
|
|
5732
6154
|
exports.change2Fixed = change2Fixed;
|
|
5733
6155
|
exports.codeBlockService = codeBlockService;
|
|
5734
6156
|
exports.debug = debug;
|
|
@@ -5741,18 +6163,22 @@
|
|
|
5741
6163
|
exports.fixNodePosition = fixNodePosition;
|
|
5742
6164
|
exports.generatePageName = generatePageName;
|
|
5743
6165
|
exports.generatePageNameByApp = generatePageNameByApp;
|
|
6166
|
+
exports.getAddParent = getAddParent;
|
|
5744
6167
|
exports.getConfig = getConfig;
|
|
6168
|
+
exports.getDefaultConfig = getDefaultConfig;
|
|
5745
6169
|
exports.getGuideLineFromCache = getGuideLineFromCache;
|
|
5746
6170
|
exports.getInitPositionStyle = getInitPositionStyle;
|
|
5747
6171
|
exports.getNodeIndex = getNodeIndex;
|
|
5748
6172
|
exports.getPageList = getPageList;
|
|
5749
6173
|
exports.getPageNameList = getPageNameList;
|
|
6174
|
+
exports.getPositionInContainer = getPositionInContainer;
|
|
5750
6175
|
exports.getRelativeStyle = getRelativeStyle;
|
|
5751
6176
|
exports.historyService = historyService;
|
|
5752
6177
|
exports.info = info;
|
|
5753
6178
|
exports.isFixed = isFixed;
|
|
5754
6179
|
exports.log = log;
|
|
5755
6180
|
exports.propsService = propsService;
|
|
6181
|
+
exports.serializeConfig = serializeConfig;
|
|
5756
6182
|
exports.setConfig = setConfig;
|
|
5757
6183
|
exports.setLayout = setLayout;
|
|
5758
6184
|
exports.storageService = storageService;
|
|
@@ -5763,4 +6189,4 @@
|
|
|
5763
6189
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
5764
6190
|
|
|
5765
6191
|
}));
|
|
5766
|
-
//# sourceMappingURL=tmagic-editor.umd.
|
|
6192
|
+
//# sourceMappingURL=tmagic-editor.umd.cjs.map
|