@tmagic/editor 1.1.6 → 1.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +177 -0
- package/dist/tmagic-editor.mjs +1104 -158
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +1111 -160
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +7 -7
- package/src/Editor.vue +18 -1
- package/src/fields/CodeSelect.vue +139 -0
- package/src/index.ts +4 -1
- package/src/layouts/Layout.vue +1 -1
- package/src/layouts/PropsPanel.vue +1 -1
- package/src/layouts/sidebar/Sidebar.vue +13 -1
- package/src/layouts/sidebar/TabPane.vue +28 -1
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +165 -0
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +267 -0
- package/src/services/codeBlock.ts +409 -0
- package/src/services/editor.ts +27 -1
- package/src/theme/code-block.scss +184 -0
- package/src/theme/index.scss +2 -0
- package/src/theme/layout.scss +5 -0
- package/src/type.ts +87 -1
- package/src/utils/props.ts +9 -3
- package/types/fields/CodeSelect.vue.d.ts +96 -0
- package/types/index.d.ts +2 -0
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +3 -3
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +50 -0
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +72 -0
- package/types/services/codeBlock.d.ts +155 -0
- package/types/services/editor.d.ts +12 -1
- package/types/services/props.d.ts +12 -0
- package/types/type.d.ts +77 -1
- package/types/utils/props.d.ts +12 -0
|
@@ -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('element-plus'), require('lodash-es'), require('@element-plus/icons-vue'), require('monaco-editor'), require('@tmagic/stage'), require('@tmagic/schema'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('gesto'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'element-plus', 'lodash-es', '@element-plus/icons-vue', 'monaco-editor', '@tmagic/stage', '@tmagic/schema', '@tmagic/utils', 'events', '@tmagic/core', 'gesto', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.ElementPlus, global.lodashEs, global.iconsVue, global.monaco, global.StageCore, global.schema, global.utils, global.events, global.core, global.Gesto, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, serialize, elementPlus, lodashEs, iconsVue, monaco, StageCore, schema, utils, events, core, Gesto, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
|
8
8
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
|
|
31
31
|
const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
|
|
32
32
|
|
|
33
|
-
const _sfc_main$
|
|
33
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
34
34
|
__name: "Code",
|
|
35
35
|
props: {
|
|
36
36
|
model: null,
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
const _sfc_main$
|
|
62
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
63
63
|
__name: "CodeLink",
|
|
64
64
|
props: {
|
|
65
65
|
config: null,
|
|
@@ -122,8 +122,186 @@
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
var ColumnLayout = /* @__PURE__ */ ((ColumnLayout2) => {
|
|
126
|
+
ColumnLayout2["LEFT"] = "left";
|
|
127
|
+
ColumnLayout2["CENTER"] = "center";
|
|
128
|
+
ColumnLayout2["RIGHT"] = "right";
|
|
129
|
+
return ColumnLayout2;
|
|
130
|
+
})(ColumnLayout || {});
|
|
131
|
+
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
132
|
+
LayerOffset2["TOP"] = "top";
|
|
133
|
+
LayerOffset2["BOTTOM"] = "bottom";
|
|
134
|
+
return LayerOffset2;
|
|
135
|
+
})(LayerOffset || {});
|
|
136
|
+
var Layout = /* @__PURE__ */ ((Layout2) => {
|
|
137
|
+
Layout2["FLEX"] = "flex";
|
|
138
|
+
Layout2["FIXED"] = "fixed";
|
|
139
|
+
Layout2["RELATIVE"] = "relative";
|
|
140
|
+
Layout2["ABSOLUTE"] = "absolute";
|
|
141
|
+
return Layout2;
|
|
142
|
+
})(Layout || {});
|
|
143
|
+
var Keys = /* @__PURE__ */ ((Keys2) => {
|
|
144
|
+
Keys2["ESCAPE"] = "Space";
|
|
145
|
+
return Keys2;
|
|
146
|
+
})(Keys || {});
|
|
147
|
+
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
148
|
+
const V_GUIDE_LINE_STORAGE_KEY = "$MagicStageVerticalGuidelinesData";
|
|
149
|
+
var CodeEditorMode = /* @__PURE__ */ ((CodeEditorMode2) => {
|
|
150
|
+
CodeEditorMode2["LIST"] = "list";
|
|
151
|
+
CodeEditorMode2["EDITOR"] = "editor";
|
|
152
|
+
return CodeEditorMode2;
|
|
153
|
+
})(CodeEditorMode || {});
|
|
154
|
+
var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
155
|
+
CodeDeleteErrorType2["UNDELETEABLE"] = "undeleteable";
|
|
156
|
+
CodeDeleteErrorType2["BIND"] = "bind";
|
|
157
|
+
return CodeDeleteErrorType2;
|
|
158
|
+
})(CodeDeleteErrorType || {});
|
|
159
|
+
var CodeSelectOp = /* @__PURE__ */ ((CodeSelectOp2) => {
|
|
160
|
+
CodeSelectOp2["ADD"] = "add";
|
|
161
|
+
CodeSelectOp2["DELETE"] = "delete";
|
|
162
|
+
CodeSelectOp2["CHANGE"] = "change";
|
|
163
|
+
return CodeSelectOp2;
|
|
164
|
+
})(CodeSelectOp || {});
|
|
165
|
+
|
|
166
|
+
const _hoisted_1$e = { class: "tool-bar" };
|
|
167
|
+
const _hoisted_2$6 = /* @__PURE__ */ vue.createElementVNode("path", {
|
|
168
|
+
fill: "currentColor",
|
|
169
|
+
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"
|
|
170
|
+
}, null, -1);
|
|
171
|
+
const _hoisted_3$3 = [
|
|
172
|
+
_hoisted_2$6
|
|
173
|
+
];
|
|
174
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
175
|
+
__name: "CodeSelect",
|
|
176
|
+
props: {
|
|
177
|
+
config: null,
|
|
178
|
+
model: null,
|
|
179
|
+
prop: null,
|
|
180
|
+
name: null,
|
|
181
|
+
size: null
|
|
182
|
+
},
|
|
183
|
+
emits: ["change"],
|
|
184
|
+
setup(__props, { emit }) {
|
|
185
|
+
const props = __props;
|
|
186
|
+
const services = vue.inject("services");
|
|
187
|
+
const selectConfig = vue.computed(() => {
|
|
188
|
+
const defaultConfig = {
|
|
189
|
+
multiple: true,
|
|
190
|
+
options: async () => {
|
|
191
|
+
const codeDsl = await services?.codeBlockService.getCodeDsl();
|
|
192
|
+
if (codeDsl) {
|
|
193
|
+
return lodashEs.map(codeDsl, (value, key) => ({
|
|
194
|
+
text: `${value.name}\uFF08${key}\uFF09`,
|
|
195
|
+
label: `${value.name}\uFF08${key}\uFF09`,
|
|
196
|
+
value: key
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
return {
|
|
203
|
+
...defaultConfig,
|
|
204
|
+
...props.config.selectConfig
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
const fieldKey = vue.ref("");
|
|
208
|
+
const multiple = vue.ref(true);
|
|
209
|
+
const combineIds = vue.ref([]);
|
|
210
|
+
let lastTagSnapshot = lodashEs.cloneDeep(props.model[props.name]) || [];
|
|
211
|
+
vue.watchEffect(async () => {
|
|
212
|
+
const combineNames = await Promise.all(
|
|
213
|
+
combineIds.value.map(async (id) => {
|
|
214
|
+
const { name = "" } = await services?.codeBlockService.getCodeContentById(id) || {};
|
|
215
|
+
return name;
|
|
216
|
+
})
|
|
217
|
+
);
|
|
218
|
+
fieldKey.value = combineNames.join("-");
|
|
219
|
+
});
|
|
220
|
+
const changeHandler = async (value) => {
|
|
221
|
+
let codeIds = value;
|
|
222
|
+
if (typeof value === "string") {
|
|
223
|
+
multiple.value = false;
|
|
224
|
+
lastTagSnapshot = [lastTagSnapshot];
|
|
225
|
+
codeIds = value ? [value] : [];
|
|
226
|
+
}
|
|
227
|
+
await setCombineRelation(codeIds);
|
|
228
|
+
emit("change", value);
|
|
229
|
+
};
|
|
230
|
+
const setCombineRelation = async (codeIds) => {
|
|
231
|
+
const { id = "" } = services?.editorService.get("node") || {};
|
|
232
|
+
let opFlag = CodeSelectOp.CHANGE;
|
|
233
|
+
let diffValues = codeIds;
|
|
234
|
+
if (multiple.value) {
|
|
235
|
+
opFlag = codeIds.length < lastTagSnapshot.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
|
|
236
|
+
diffValues = lodashEs.xor(codeIds, lastTagSnapshot);
|
|
237
|
+
}
|
|
238
|
+
await services?.codeBlockService.setCombineRelation(id, diffValues, opFlag, props.prop);
|
|
239
|
+
lastTagSnapshot = codeIds;
|
|
240
|
+
await setCombineIds(codeIds);
|
|
241
|
+
};
|
|
242
|
+
const setCombineIds = async (codeIds) => {
|
|
243
|
+
combineIds.value = codeIds;
|
|
244
|
+
await services?.codeBlockService.setCombineIds(codeIds);
|
|
245
|
+
};
|
|
246
|
+
const viewHandler = async () => {
|
|
247
|
+
if (props.model[props.name].length === 0) {
|
|
248
|
+
elementPlus.ElMessage.error("\u8BF7\u5148\u7ED1\u5B9A\u4EE3\u7801\u5757");
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
await setCombineIds(props.model[props.name]);
|
|
252
|
+
await services?.codeBlockService.setMode(CodeEditorMode.LIST);
|
|
253
|
+
services?.codeBlockService.setCodeEditorContent(true, combineIds.value[0]);
|
|
254
|
+
};
|
|
255
|
+
return (_ctx, _cache) => {
|
|
256
|
+
const _component_m_fields_select = vue.resolveComponent("m-fields-select");
|
|
257
|
+
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
258
|
+
const _component_el_card = vue.resolveComponent("el-card");
|
|
259
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
260
|
+
class: "m-fields-code-select",
|
|
261
|
+
key: fieldKey.value
|
|
262
|
+
}, [
|
|
263
|
+
vue.createVNode(_component_el_card, { shadow: "never" }, {
|
|
264
|
+
header: vue.withCtx(() => [
|
|
265
|
+
vue.createVNode(_component_m_fields_select, {
|
|
266
|
+
config: vue.unref(selectConfig),
|
|
267
|
+
model: __props.model,
|
|
268
|
+
prop: __props.prop,
|
|
269
|
+
name: __props.name,
|
|
270
|
+
size: __props.size,
|
|
271
|
+
onChange: changeHandler
|
|
272
|
+
}, null, 8, ["config", "model", "prop", "name", "size"])
|
|
273
|
+
]),
|
|
274
|
+
default: vue.withCtx(() => [
|
|
275
|
+
vue.createElementVNode("div", _hoisted_1$e, [
|
|
276
|
+
vue.createVNode(_component_el_tooltip, {
|
|
277
|
+
class: "tool-item",
|
|
278
|
+
effect: "dark",
|
|
279
|
+
content: "\u67E5\u770B\u4EE3\u7801\u5757",
|
|
280
|
+
placement: "top"
|
|
281
|
+
}, {
|
|
282
|
+
default: vue.withCtx(() => [
|
|
283
|
+
(vue.openBlock(), vue.createElementBlock("svg", {
|
|
284
|
+
onClick: viewHandler,
|
|
285
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
286
|
+
viewBox: "0 0 24 24",
|
|
287
|
+
width: "15px",
|
|
288
|
+
height: "15px",
|
|
289
|
+
"data-v-65a7fb6c": ""
|
|
290
|
+
}, _hoisted_3$3))
|
|
291
|
+
]),
|
|
292
|
+
_: 1
|
|
293
|
+
})
|
|
294
|
+
])
|
|
295
|
+
]),
|
|
296
|
+
_: 1
|
|
297
|
+
})
|
|
298
|
+
]);
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
const _hoisted_1$d = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
|
|
304
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
127
305
|
__name: "UISelect",
|
|
128
306
|
props: {
|
|
129
307
|
config: null,
|
|
@@ -188,7 +366,7 @@
|
|
|
188
366
|
style: { "padding": "0" }
|
|
189
367
|
}, {
|
|
190
368
|
default: vue.withCtx(() => [
|
|
191
|
-
_hoisted_1$
|
|
369
|
+
_hoisted_1$d
|
|
192
370
|
]),
|
|
193
371
|
_: 1
|
|
194
372
|
}, 8, ["icon"])
|
|
@@ -251,7 +429,7 @@
|
|
|
251
429
|
}
|
|
252
430
|
return value;
|
|
253
431
|
};
|
|
254
|
-
const _sfc_main$
|
|
432
|
+
const _sfc_main$o = vue.defineComponent({
|
|
255
433
|
name: "magic-code-editor",
|
|
256
434
|
props: {
|
|
257
435
|
initValues: {
|
|
@@ -373,14 +551,14 @@
|
|
|
373
551
|
return target;
|
|
374
552
|
};
|
|
375
553
|
|
|
376
|
-
const _hoisted_1$
|
|
554
|
+
const _hoisted_1$c = {
|
|
377
555
|
ref: "codeEditor",
|
|
378
556
|
class: "magic-code-editor"
|
|
379
557
|
};
|
|
380
558
|
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
381
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
559
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, null, 512);
|
|
382
560
|
}
|
|
383
|
-
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
561
|
+
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$6]]);
|
|
384
562
|
|
|
385
563
|
let $TMAGIC_EDITOR = {};
|
|
386
564
|
const setConfig = (option) => {
|
|
@@ -388,51 +566,31 @@
|
|
|
388
566
|
};
|
|
389
567
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
390
568
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
listMaxSize;
|
|
395
|
-
constructor(listMaxSize = 200) {
|
|
396
|
-
const minListMaxSize = 2;
|
|
397
|
-
this.elementList = [];
|
|
398
|
-
this.listCursor = 0;
|
|
399
|
-
this.listMaxSize = listMaxSize > minListMaxSize ? listMaxSize : minListMaxSize;
|
|
400
|
-
}
|
|
401
|
-
pushElement(element) {
|
|
402
|
-
this.elementList.splice(this.listCursor, this.elementList.length - this.listCursor, lodashEs.cloneDeep(element));
|
|
403
|
-
this.listCursor += 1;
|
|
404
|
-
if (this.elementList.length > this.listMaxSize) {
|
|
405
|
-
this.elementList.shift();
|
|
406
|
-
this.listCursor -= 1;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
canUndo() {
|
|
410
|
-
return this.listCursor > 1;
|
|
569
|
+
const log = (...args) => {
|
|
570
|
+
if (process.env.NODE_ENV === "development") {
|
|
571
|
+
console.log("magic editor: ", ...args);
|
|
411
572
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
this.listCursor -= 1;
|
|
417
|
-
return this.getCurrentElement();
|
|
573
|
+
};
|
|
574
|
+
const info = (...args) => {
|
|
575
|
+
if (process.env.NODE_ENV === "development") {
|
|
576
|
+
console.info("magic editor: ", ...args);
|
|
418
577
|
}
|
|
419
|
-
|
|
420
|
-
|
|
578
|
+
};
|
|
579
|
+
const warn = (...args) => {
|
|
580
|
+
if (process.env.NODE_ENV === "development") {
|
|
581
|
+
console.warn("magic editor: ", ...args);
|
|
421
582
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
this.listCursor += 1;
|
|
427
|
-
return this.getCurrentElement();
|
|
583
|
+
};
|
|
584
|
+
const debug = (...args) => {
|
|
585
|
+
if (process.env.NODE_ENV === "development") {
|
|
586
|
+
console.debug("magic editor: ", ...args);
|
|
428
587
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return lodashEs.cloneDeep(this.elementList[this.listCursor - 1]);
|
|
588
|
+
};
|
|
589
|
+
const error = (...args) => {
|
|
590
|
+
if (process.env.NODE_ENV === "development") {
|
|
591
|
+
console.error("magic editor: ", ...args);
|
|
434
592
|
}
|
|
435
|
-
}
|
|
593
|
+
};
|
|
436
594
|
|
|
437
595
|
const compose = (middleware) => {
|
|
438
596
|
if (!Array.isArray(middleware))
|
|
@@ -548,6 +706,265 @@
|
|
|
548
706
|
}
|
|
549
707
|
}
|
|
550
708
|
|
|
709
|
+
class CodeBlock extends BaseService {
|
|
710
|
+
state = vue.reactive({
|
|
711
|
+
isShowCodeEditor: false,
|
|
712
|
+
codeDsl: null,
|
|
713
|
+
id: "",
|
|
714
|
+
editable: true,
|
|
715
|
+
mode: CodeEditorMode.EDITOR,
|
|
716
|
+
combineIds: [],
|
|
717
|
+
undeletableList: []
|
|
718
|
+
});
|
|
719
|
+
constructor() {
|
|
720
|
+
super([
|
|
721
|
+
"setCodeDsl",
|
|
722
|
+
"getCodeDsl",
|
|
723
|
+
"getCodeContentById",
|
|
724
|
+
"getCodeDslByIds",
|
|
725
|
+
"getCurrentDsl",
|
|
726
|
+
"setCodeDslById",
|
|
727
|
+
"setCodeEditorShowStatus",
|
|
728
|
+
"setEditStatus",
|
|
729
|
+
"setMode",
|
|
730
|
+
"setCombineIds",
|
|
731
|
+
"setUndeleteableList",
|
|
732
|
+
"deleteCodeDslByIds"
|
|
733
|
+
]);
|
|
734
|
+
}
|
|
735
|
+
async setCodeDsl(codeDsl) {
|
|
736
|
+
this.state.codeDsl = codeDsl;
|
|
737
|
+
await editorService.setCodeDsl(this.state.codeDsl);
|
|
738
|
+
info("[code-block]:code-dsl-change", this.state.codeDsl);
|
|
739
|
+
this.emit("code-dsl-change", this.state.codeDsl);
|
|
740
|
+
}
|
|
741
|
+
async getCodeDsl(forceRefresh = false) {
|
|
742
|
+
if (!this.state.codeDsl || forceRefresh) {
|
|
743
|
+
this.state.codeDsl = await editorService.getCodeDsl();
|
|
744
|
+
}
|
|
745
|
+
return this.state.codeDsl;
|
|
746
|
+
}
|
|
747
|
+
async getCodeContentById(id) {
|
|
748
|
+
if (!id)
|
|
749
|
+
return null;
|
|
750
|
+
const totalCodeDsl = await this.getCodeDsl();
|
|
751
|
+
if (!totalCodeDsl)
|
|
752
|
+
return null;
|
|
753
|
+
return totalCodeDsl[id] ?? null;
|
|
754
|
+
}
|
|
755
|
+
async setCodeDslById(id, codeConfig) {
|
|
756
|
+
let codeDsl = await this.getCodeDsl();
|
|
757
|
+
if (!codeDsl)
|
|
758
|
+
return;
|
|
759
|
+
const existContent = codeDsl[id] || {};
|
|
760
|
+
codeDsl = {
|
|
761
|
+
...codeDsl,
|
|
762
|
+
[id]: {
|
|
763
|
+
...existContent,
|
|
764
|
+
...codeConfig
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
await this.setCodeDsl(codeDsl);
|
|
768
|
+
}
|
|
769
|
+
async getCodeDslByIds(ids) {
|
|
770
|
+
const codeDsl = await this.getCodeDsl();
|
|
771
|
+
return lodashEs.pick(codeDsl, ids);
|
|
772
|
+
}
|
|
773
|
+
async setCodeEditorShowStatus(status) {
|
|
774
|
+
this.state.isShowCodeEditor = status;
|
|
775
|
+
}
|
|
776
|
+
getCodeEditorShowStatus() {
|
|
777
|
+
return this.state.isShowCodeEditor;
|
|
778
|
+
}
|
|
779
|
+
setCodeEditorContent(status, id) {
|
|
780
|
+
if (!id)
|
|
781
|
+
return;
|
|
782
|
+
this.setId(id);
|
|
783
|
+
this.state.isShowCodeEditor = status;
|
|
784
|
+
}
|
|
785
|
+
async getCurrentDsl() {
|
|
786
|
+
return await this.getCodeContentById(this.state.id);
|
|
787
|
+
}
|
|
788
|
+
getEditStatus() {
|
|
789
|
+
return this.state.editable;
|
|
790
|
+
}
|
|
791
|
+
async setEditStatus(status) {
|
|
792
|
+
this.state.editable = status;
|
|
793
|
+
}
|
|
794
|
+
setId(id) {
|
|
795
|
+
if (!id)
|
|
796
|
+
return;
|
|
797
|
+
this.state.id = id;
|
|
798
|
+
}
|
|
799
|
+
getId() {
|
|
800
|
+
return this.state.id;
|
|
801
|
+
}
|
|
802
|
+
getMode() {
|
|
803
|
+
return this.state.mode;
|
|
804
|
+
}
|
|
805
|
+
async setMode(mode) {
|
|
806
|
+
this.state.mode = mode;
|
|
807
|
+
}
|
|
808
|
+
async setCombineIds(ids) {
|
|
809
|
+
this.state.combineIds = ids;
|
|
810
|
+
}
|
|
811
|
+
getCombineIds() {
|
|
812
|
+
return this.state.combineIds;
|
|
813
|
+
}
|
|
814
|
+
async setCombineRelation(compId, diffCodeIds, opFlag, hook) {
|
|
815
|
+
const codeDsl = lodashEs.cloneDeep(await this.getCodeDsl());
|
|
816
|
+
if (!codeDsl)
|
|
817
|
+
return;
|
|
818
|
+
if (opFlag === CodeSelectOp.DELETE) {
|
|
819
|
+
try {
|
|
820
|
+
diffCodeIds.forEach((codeId) => {
|
|
821
|
+
const compsContent = codeDsl[codeId].comps;
|
|
822
|
+
const index = compsContent?.[compId].findIndex((item) => item === hook);
|
|
823
|
+
if (typeof index !== "undefined" && index !== -1) {
|
|
824
|
+
compsContent?.[compId].splice(index, 1);
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
} catch (e) {
|
|
828
|
+
error(e);
|
|
829
|
+
throw new Error("\u89E3\u7ED1\u4EE3\u7801\u5757\u5931\u8D25");
|
|
830
|
+
}
|
|
831
|
+
} else if (opFlag === CodeSelectOp.ADD) {
|
|
832
|
+
try {
|
|
833
|
+
diffCodeIds.forEach((codeId) => {
|
|
834
|
+
const compsContent = codeDsl[codeId].comps;
|
|
835
|
+
const existHooks = compsContent?.[compId];
|
|
836
|
+
if (lodashEs.isEmpty(existHooks)) {
|
|
837
|
+
codeDsl[codeId].comps = {
|
|
838
|
+
...codeDsl[codeId].comps || {},
|
|
839
|
+
[compId]: [hook]
|
|
840
|
+
};
|
|
841
|
+
} else {
|
|
842
|
+
existHooks?.push(hook);
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
} catch (e) {
|
|
846
|
+
error(e);
|
|
847
|
+
throw new Error("\u7ED1\u5B9A\u4EE3\u7801\u5757\u5931\u8D25");
|
|
848
|
+
}
|
|
849
|
+
} else if (opFlag === CodeSelectOp.CHANGE) {
|
|
850
|
+
lodashEs.forIn(codeDsl, (codeBlockContent, codeId) => {
|
|
851
|
+
if (codeId === diffCodeIds[0]) {
|
|
852
|
+
codeBlockContent.comps = {
|
|
853
|
+
...codeBlockContent?.comps || {},
|
|
854
|
+
[compId]: [hook]
|
|
855
|
+
};
|
|
856
|
+
} else if (lodashEs.isEmpty(diffCodeIds) || codeId !== diffCodeIds[0]) {
|
|
857
|
+
const compHooks = codeBlockContent?.comps?.[compId];
|
|
858
|
+
if (!compHooks)
|
|
859
|
+
return true;
|
|
860
|
+
const index = compHooks.findIndex((hookName) => hookName === hook);
|
|
861
|
+
if (index !== -1) {
|
|
862
|
+
compHooks.splice(index, 1);
|
|
863
|
+
return false;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
this.setCodeDsl(codeDsl);
|
|
869
|
+
}
|
|
870
|
+
getUndeletableList() {
|
|
871
|
+
return this.state.undeletableList;
|
|
872
|
+
}
|
|
873
|
+
async setUndeleteableList(codeIds) {
|
|
874
|
+
this.state.undeletableList = codeIds;
|
|
875
|
+
}
|
|
876
|
+
async deleteCodeDslByIds(codeIds) {
|
|
877
|
+
const currentDsl = await this.getCodeDsl();
|
|
878
|
+
const newDsl = lodashEs.omit(currentDsl, codeIds);
|
|
879
|
+
await this.setCodeDsl(newDsl);
|
|
880
|
+
return newDsl;
|
|
881
|
+
}
|
|
882
|
+
async getUniqueId() {
|
|
883
|
+
const newId = `code_${Math.random().toString(10).substring(2).substring(0, 4)}`;
|
|
884
|
+
const dsl = await this.getCodeDsl();
|
|
885
|
+
const existedIds = lodashEs.keys(dsl);
|
|
886
|
+
if (!existedIds.includes(newId))
|
|
887
|
+
return newId;
|
|
888
|
+
return await this.getUniqueId();
|
|
889
|
+
}
|
|
890
|
+
async deleteCompsInRelation(node) {
|
|
891
|
+
const codeDsl = lodashEs.cloneDeep(await this.getCodeDsl());
|
|
892
|
+
if (!codeDsl)
|
|
893
|
+
return;
|
|
894
|
+
this.recurseNodes(node, codeDsl);
|
|
895
|
+
this.setCodeDsl(codeDsl);
|
|
896
|
+
}
|
|
897
|
+
destroy() {
|
|
898
|
+
this.state.isShowCodeEditor = false;
|
|
899
|
+
this.state.codeDsl = null;
|
|
900
|
+
this.state.id = "";
|
|
901
|
+
this.state.editable = true;
|
|
902
|
+
this.state.mode = CodeEditorMode.EDITOR;
|
|
903
|
+
this.state.combineIds = [];
|
|
904
|
+
this.state.undeletableList = [];
|
|
905
|
+
}
|
|
906
|
+
recurseNodes(node, codeDsl) {
|
|
907
|
+
if (!node.id)
|
|
908
|
+
return;
|
|
909
|
+
lodashEs.forIn(codeDsl, (codeBlockContent) => {
|
|
910
|
+
const compsContent = codeBlockContent.comps || {};
|
|
911
|
+
codeBlockContent.comps = lodashEs.omit(compsContent, node.id);
|
|
912
|
+
});
|
|
913
|
+
if (!lodashEs.isEmpty(node.items)) {
|
|
914
|
+
node.items.forEach((item) => {
|
|
915
|
+
this.recurseNodes(item, codeDsl);
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
const codeBlockService = new CodeBlock();
|
|
921
|
+
|
|
922
|
+
class UndoRedo {
|
|
923
|
+
elementList;
|
|
924
|
+
listCursor;
|
|
925
|
+
listMaxSize;
|
|
926
|
+
constructor(listMaxSize = 200) {
|
|
927
|
+
const minListMaxSize = 2;
|
|
928
|
+
this.elementList = [];
|
|
929
|
+
this.listCursor = 0;
|
|
930
|
+
this.listMaxSize = listMaxSize > minListMaxSize ? listMaxSize : minListMaxSize;
|
|
931
|
+
}
|
|
932
|
+
pushElement(element) {
|
|
933
|
+
this.elementList.splice(this.listCursor, this.elementList.length - this.listCursor, lodashEs.cloneDeep(element));
|
|
934
|
+
this.listCursor += 1;
|
|
935
|
+
if (this.elementList.length > this.listMaxSize) {
|
|
936
|
+
this.elementList.shift();
|
|
937
|
+
this.listCursor -= 1;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
canUndo() {
|
|
941
|
+
return this.listCursor > 1;
|
|
942
|
+
}
|
|
943
|
+
undo() {
|
|
944
|
+
if (!this.canUndo()) {
|
|
945
|
+
return null;
|
|
946
|
+
}
|
|
947
|
+
this.listCursor -= 1;
|
|
948
|
+
return this.getCurrentElement();
|
|
949
|
+
}
|
|
950
|
+
canRedo() {
|
|
951
|
+
return this.elementList.length > this.listCursor;
|
|
952
|
+
}
|
|
953
|
+
redo() {
|
|
954
|
+
if (!this.canRedo()) {
|
|
955
|
+
return null;
|
|
956
|
+
}
|
|
957
|
+
this.listCursor += 1;
|
|
958
|
+
return this.getCurrentElement();
|
|
959
|
+
}
|
|
960
|
+
getCurrentElement() {
|
|
961
|
+
if (this.listCursor < 1) {
|
|
962
|
+
return null;
|
|
963
|
+
}
|
|
964
|
+
return lodashEs.cloneDeep(this.elementList[this.listCursor - 1]);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
551
968
|
class History extends BaseService {
|
|
552
969
|
state = vue.reactive({
|
|
553
970
|
pageSteps: {},
|
|
@@ -713,31 +1130,6 @@
|
|
|
713
1130
|
}
|
|
714
1131
|
const storageService = new WebStorage();
|
|
715
1132
|
|
|
716
|
-
var ColumnLayout = /* @__PURE__ */ ((ColumnLayout2) => {
|
|
717
|
-
ColumnLayout2["LEFT"] = "left";
|
|
718
|
-
ColumnLayout2["CENTER"] = "center";
|
|
719
|
-
ColumnLayout2["RIGHT"] = "right";
|
|
720
|
-
return ColumnLayout2;
|
|
721
|
-
})(ColumnLayout || {});
|
|
722
|
-
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
723
|
-
LayerOffset2["TOP"] = "top";
|
|
724
|
-
LayerOffset2["BOTTOM"] = "bottom";
|
|
725
|
-
return LayerOffset2;
|
|
726
|
-
})(LayerOffset || {});
|
|
727
|
-
var Layout = /* @__PURE__ */ ((Layout2) => {
|
|
728
|
-
Layout2["FLEX"] = "flex";
|
|
729
|
-
Layout2["FIXED"] = "fixed";
|
|
730
|
-
Layout2["RELATIVE"] = "relative";
|
|
731
|
-
Layout2["ABSOLUTE"] = "absolute";
|
|
732
|
-
return Layout2;
|
|
733
|
-
})(Layout || {});
|
|
734
|
-
var Keys = /* @__PURE__ */ ((Keys2) => {
|
|
735
|
-
Keys2["ESCAPE"] = "Space";
|
|
736
|
-
return Keys2;
|
|
737
|
-
})(Keys || {});
|
|
738
|
-
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
739
|
-
const V_GUIDE_LINE_STORAGE_KEY = "$MagicStageVerticalGuidelinesData";
|
|
740
|
-
|
|
741
1133
|
const COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
742
1134
|
const getPageList = (app) => {
|
|
743
1135
|
if (app.items && Array.isArray(app.items)) {
|
|
@@ -1098,7 +1490,9 @@
|
|
|
1098
1490
|
"move",
|
|
1099
1491
|
"undo",
|
|
1100
1492
|
"redo",
|
|
1101
|
-
"highlight"
|
|
1493
|
+
"highlight",
|
|
1494
|
+
"getCodeDsl",
|
|
1495
|
+
"setCodeDsl"
|
|
1102
1496
|
],
|
|
1103
1497
|
["select", "update", "moveLayer"]
|
|
1104
1498
|
);
|
|
@@ -1323,6 +1717,7 @@
|
|
|
1323
1717
|
stage?.select(parent.id);
|
|
1324
1718
|
}
|
|
1325
1719
|
this.addModifiedNodeId(parent.id);
|
|
1720
|
+
codeBlockService.deleteCompsInRelation(node);
|
|
1326
1721
|
}
|
|
1327
1722
|
async remove(nodeOrNodeList) {
|
|
1328
1723
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
@@ -1548,6 +1943,17 @@
|
|
|
1548
1943
|
resetModifiedNodeId() {
|
|
1549
1944
|
this.get("modifiedNodeIds").clear();
|
|
1550
1945
|
}
|
|
1946
|
+
async getCodeDsl() {
|
|
1947
|
+
const root = this.get("root");
|
|
1948
|
+
if (!root)
|
|
1949
|
+
return null;
|
|
1950
|
+
return root.codeBlock || null;
|
|
1951
|
+
}
|
|
1952
|
+
async setCodeDsl(codeDsl) {
|
|
1953
|
+
if (!this.state.root)
|
|
1954
|
+
return;
|
|
1955
|
+
this.state.root.codeBlock = codeDsl;
|
|
1956
|
+
}
|
|
1551
1957
|
addModifiedNodeId(id) {
|
|
1552
1958
|
if (!this.isHistoryStateChange) {
|
|
1553
1959
|
this.get("modifiedNodeIds").set(id, id);
|
|
@@ -1852,13 +2258,19 @@
|
|
|
1852
2258
|
},
|
|
1853
2259
|
{
|
|
1854
2260
|
title: "\u9AD8\u7EA7",
|
|
1855
|
-
|
|
2261
|
+
lazy: true,
|
|
1856
2262
|
items: [
|
|
1857
2263
|
{
|
|
1858
|
-
type: "code-link",
|
|
1859
2264
|
name: "created",
|
|
1860
2265
|
text: "created",
|
|
1861
|
-
|
|
2266
|
+
type: "code-select",
|
|
2267
|
+
labelWidth: "100px"
|
|
2268
|
+
},
|
|
2269
|
+
{
|
|
2270
|
+
name: "mounted",
|
|
2271
|
+
text: "mounted",
|
|
2272
|
+
type: "code-select",
|
|
2273
|
+
labelWidth: "100px"
|
|
1862
2274
|
}
|
|
1863
2275
|
]
|
|
1864
2276
|
}
|
|
@@ -1866,32 +2278,6 @@
|
|
|
1866
2278
|
}
|
|
1867
2279
|
];
|
|
1868
2280
|
|
|
1869
|
-
const log = (...args) => {
|
|
1870
|
-
if (process.env.NODE_ENV === "development") {
|
|
1871
|
-
console.log("magic editor: ", ...args);
|
|
1872
|
-
}
|
|
1873
|
-
};
|
|
1874
|
-
const info = (...args) => {
|
|
1875
|
-
if (process.env.NODE_ENV === "development") {
|
|
1876
|
-
console.info("magic editor: ", ...args);
|
|
1877
|
-
}
|
|
1878
|
-
};
|
|
1879
|
-
const warn = (...args) => {
|
|
1880
|
-
if (process.env.NODE_ENV === "development") {
|
|
1881
|
-
console.warn("magic editor: ", ...args);
|
|
1882
|
-
}
|
|
1883
|
-
};
|
|
1884
|
-
const debug = (...args) => {
|
|
1885
|
-
if (process.env.NODE_ENV === "development") {
|
|
1886
|
-
console.debug("magic editor: ", ...args);
|
|
1887
|
-
}
|
|
1888
|
-
};
|
|
1889
|
-
const error = (...args) => {
|
|
1890
|
-
if (process.env.NODE_ENV === "development") {
|
|
1891
|
-
console.error("magic editor: ", ...args);
|
|
1892
|
-
}
|
|
1893
|
-
};
|
|
1894
|
-
|
|
1895
2281
|
const state = vue.reactive({
|
|
1896
2282
|
uiSelectMode: false,
|
|
1897
2283
|
showSrc: false,
|
|
@@ -2032,7 +2418,7 @@
|
|
|
2032
2418
|
return stage;
|
|
2033
2419
|
};
|
|
2034
2420
|
|
|
2035
|
-
const _sfc_main$
|
|
2421
|
+
const _sfc_main$n = vue.defineComponent({
|
|
2036
2422
|
components: { Plus: iconsVue.Plus },
|
|
2037
2423
|
setup() {
|
|
2038
2424
|
const services = vue.inject("services");
|
|
@@ -2050,14 +2436,14 @@
|
|
|
2050
2436
|
}
|
|
2051
2437
|
});
|
|
2052
2438
|
|
|
2053
|
-
const _hoisted_1$
|
|
2054
|
-
const _hoisted_2$
|
|
2055
|
-
const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2439
|
+
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
2440
|
+
const _hoisted_2$5 = { class: "m-editor-empty-content" };
|
|
2441
|
+
const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2056
2442
|
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2057
2443
|
const _component_plus = vue.resolveComponent("plus");
|
|
2058
2444
|
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
2059
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2060
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
2445
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
2446
|
+
vue.createElementVNode("div", _hoisted_2$5, [
|
|
2061
2447
|
vue.createElementVNode("div", {
|
|
2062
2448
|
class: "m-editor-empty-button",
|
|
2063
2449
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
|
|
@@ -2070,14 +2456,14 @@
|
|
|
2070
2456
|
_: 1
|
|
2071
2457
|
})
|
|
2072
2458
|
]),
|
|
2073
|
-
_hoisted_3
|
|
2459
|
+
_hoisted_3$2
|
|
2074
2460
|
])
|
|
2075
2461
|
])
|
|
2076
2462
|
]);
|
|
2077
2463
|
}
|
|
2078
|
-
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2464
|
+
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$5]]);
|
|
2079
2465
|
|
|
2080
|
-
const _sfc_main$
|
|
2466
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
2081
2467
|
__name: "Resizer",
|
|
2082
2468
|
emits: ["change"],
|
|
2083
2469
|
setup(__props, { emit }) {
|
|
@@ -2110,7 +2496,7 @@
|
|
|
2110
2496
|
}
|
|
2111
2497
|
});
|
|
2112
2498
|
|
|
2113
|
-
const _sfc_main$
|
|
2499
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
2114
2500
|
__name: "Layout",
|
|
2115
2501
|
props: {
|
|
2116
2502
|
left: null,
|
|
@@ -2173,7 +2559,8 @@
|
|
|
2173
2559
|
return (_ctx, _cache) => {
|
|
2174
2560
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2175
2561
|
ref_key: "el",
|
|
2176
|
-
ref: el
|
|
2562
|
+
ref: el,
|
|
2563
|
+
class: "m-editor-layout"
|
|
2177
2564
|
}, [
|
|
2178
2565
|
typeof props.left !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
2179
2566
|
vue.createElementVNode("div", {
|
|
@@ -2182,7 +2569,7 @@
|
|
|
2182
2569
|
}, [
|
|
2183
2570
|
vue.renderSlot(_ctx.$slots, "left")
|
|
2184
2571
|
], 6),
|
|
2185
|
-
vue.createVNode(_sfc_main$
|
|
2572
|
+
vue.createVNode(_sfc_main$m, { onChange: changeLeft })
|
|
2186
2573
|
], 64)) : vue.createCommentVNode("", true),
|
|
2187
2574
|
vue.createElementVNode("div", {
|
|
2188
2575
|
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -2191,7 +2578,7 @@
|
|
|
2191
2578
|
vue.renderSlot(_ctx.$slots, "center")
|
|
2192
2579
|
], 6),
|
|
2193
2580
|
typeof props.right !== "undefined" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
2194
|
-
vue.createVNode(_sfc_main$
|
|
2581
|
+
vue.createVNode(_sfc_main$m, { onChange: changeRight }),
|
|
2195
2582
|
vue.createElementVNode("div", {
|
|
2196
2583
|
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
2197
2584
|
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -2204,8 +2591,8 @@
|
|
|
2204
2591
|
}
|
|
2205
2592
|
});
|
|
2206
2593
|
|
|
2207
|
-
const _hoisted_1$
|
|
2208
|
-
const _sfc_main$
|
|
2594
|
+
const _hoisted_1$a = { class: "m-editor" };
|
|
2595
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
2209
2596
|
__name: "Framework",
|
|
2210
2597
|
props: {
|
|
2211
2598
|
codeOptions: { default: () => ({}) }
|
|
@@ -2256,7 +2643,7 @@
|
|
|
2256
2643
|
return (_ctx, _cache) => {
|
|
2257
2644
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
2258
2645
|
const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
|
|
2259
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2646
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
2260
2647
|
vue.renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2261
2648
|
vue.unref(showSrc) ? (vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
2262
2649
|
key: 0,
|
|
@@ -2264,7 +2651,7 @@
|
|
|
2264
2651
|
"init-values": vue.unref(root),
|
|
2265
2652
|
options: __props.codeOptions,
|
|
2266
2653
|
onSave: saveCode
|
|
2267
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2654
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
2268
2655
|
key: 1,
|
|
2269
2656
|
class: "m-editor-content",
|
|
2270
2657
|
"left-class": "m-editor-framework-left",
|
|
@@ -2305,8 +2692,8 @@
|
|
|
2305
2692
|
}
|
|
2306
2693
|
});
|
|
2307
2694
|
|
|
2308
|
-
const _hoisted_1$
|
|
2309
|
-
const _sfc_main$
|
|
2695
|
+
const _hoisted_1$9 = ["src"];
|
|
2696
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
2310
2697
|
__name: "Icon",
|
|
2311
2698
|
props: {
|
|
2312
2699
|
icon: null
|
|
@@ -2327,7 +2714,7 @@
|
|
|
2327
2714
|
class: "magic-editor-icon"
|
|
2328
2715
|
}, {
|
|
2329
2716
|
default: vue.withCtx(() => [
|
|
2330
|
-
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$
|
|
2717
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$9)
|
|
2331
2718
|
]),
|
|
2332
2719
|
_: 1
|
|
2333
2720
|
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
@@ -2346,12 +2733,12 @@
|
|
|
2346
2733
|
}
|
|
2347
2734
|
});
|
|
2348
2735
|
|
|
2349
|
-
const _hoisted_1$
|
|
2736
|
+
const _hoisted_1$8 = {
|
|
2350
2737
|
key: 1,
|
|
2351
2738
|
class: "menu-item-text"
|
|
2352
2739
|
};
|
|
2353
|
-
const _hoisted_2$
|
|
2354
|
-
const _sfc_main$
|
|
2740
|
+
const _hoisted_2$4 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2741
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
2355
2742
|
__name: "ToolButton",
|
|
2356
2743
|
props: {
|
|
2357
2744
|
data: { default: () => ({
|
|
@@ -2434,7 +2821,7 @@
|
|
|
2434
2821
|
__props.data.type === "divider" ? (vue.openBlock(), vue.createBlock(_component_el_divider, {
|
|
2435
2822
|
key: 0,
|
|
2436
2823
|
direction: __props.data.direction || "vertical"
|
|
2437
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2824
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, vue.toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
2438
2825
|
__props.data.tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
|
|
2439
2826
|
key: 0,
|
|
2440
2827
|
effect: "dark",
|
|
@@ -2448,7 +2835,7 @@
|
|
|
2448
2835
|
disabled: vue.unref(disabled)
|
|
2449
2836
|
}, {
|
|
2450
2837
|
default: vue.withCtx(() => [
|
|
2451
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2838
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
|
|
2452
2839
|
key: 0,
|
|
2453
2840
|
icon: __props.data.icon
|
|
2454
2841
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2465,7 +2852,7 @@
|
|
|
2465
2852
|
disabled: vue.unref(disabled)
|
|
2466
2853
|
}, {
|
|
2467
2854
|
default: vue.withCtx(() => [
|
|
2468
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2855
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
|
|
2469
2856
|
key: 0,
|
|
2470
2857
|
icon: __props.data.icon
|
|
2471
2858
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2498,7 +2885,7 @@
|
|
|
2498
2885
|
})) : vue.createCommentVNode("", true)
|
|
2499
2886
|
]),
|
|
2500
2887
|
default: vue.withCtx(() => [
|
|
2501
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
2888
|
+
vue.createElementVNode("span", _hoisted_2$4, [
|
|
2502
2889
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
2503
2890
|
vue.createVNode(_component_el_icon, { class: "el-icon--right" }, {
|
|
2504
2891
|
default: vue.withCtx(() => [
|
|
@@ -2515,7 +2902,7 @@
|
|
|
2515
2902
|
}
|
|
2516
2903
|
});
|
|
2517
2904
|
|
|
2518
|
-
const _sfc_main$
|
|
2905
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
2519
2906
|
__name: "NavMenu",
|
|
2520
2907
|
props: {
|
|
2521
2908
|
data: { default: () => ({}) },
|
|
@@ -2671,7 +3058,7 @@
|
|
|
2671
3058
|
style: vue.normalizeStyle(`width: ${vue.unref(columnWidth)?.[key]}px`)
|
|
2672
3059
|
}, [
|
|
2673
3060
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttons)[key], (item, index) => {
|
|
2674
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3061
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$i, {
|
|
2675
3062
|
data: item,
|
|
2676
3063
|
key: index
|
|
2677
3064
|
}, null, 8, ["data"]);
|
|
@@ -2683,8 +3070,8 @@
|
|
|
2683
3070
|
}
|
|
2684
3071
|
});
|
|
2685
3072
|
|
|
2686
|
-
const _hoisted_1$
|
|
2687
|
-
const _sfc_main$
|
|
3073
|
+
const _hoisted_1$7 = { class: "m-editor-props-panel" };
|
|
3074
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
2688
3075
|
__name: "PropsPanel",
|
|
2689
3076
|
emits: ["mounted"],
|
|
2690
3077
|
setup(__props, { expose, emit }) {
|
|
@@ -2733,7 +3120,7 @@
|
|
|
2733
3120
|
expose({ submit });
|
|
2734
3121
|
return (_ctx, _cache) => {
|
|
2735
3122
|
const _component_m_form = vue.resolveComponent("m-form");
|
|
2736
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3123
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
|
|
2737
3124
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
2738
3125
|
vue.createVNode(_component_m_form, {
|
|
2739
3126
|
ref_key: "configForm",
|
|
@@ -2750,6 +3137,501 @@
|
|
|
2750
3137
|
}
|
|
2751
3138
|
});
|
|
2752
3139
|
|
|
3140
|
+
const _hoisted_1$6 = ["id"];
|
|
3141
|
+
const _hoisted_2$3 = { class: "list-item" };
|
|
3142
|
+
const _hoisted_3$1 = { class: "code-name" };
|
|
3143
|
+
const _hoisted_4$1 = { class: "code-name-wrapper" };
|
|
3144
|
+
const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3145
|
+
const _hoisted_6$1 = { class: "m-editor-wrapper" };
|
|
3146
|
+
const _hoisted_7$1 = {
|
|
3147
|
+
key: 1,
|
|
3148
|
+
class: "m-editor-content-bottom"
|
|
3149
|
+
};
|
|
3150
|
+
const _hoisted_8$1 = /* @__PURE__ */ vue.createTextVNode("\u4FDD\u5B58");
|
|
3151
|
+
const _hoisted_9$1 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3152
|
+
const _hoisted_10 = {
|
|
3153
|
+
key: 2,
|
|
3154
|
+
class: "m-editor-content-bottom"
|
|
3155
|
+
};
|
|
3156
|
+
const _hoisted_11 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3157
|
+
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
3158
|
+
__name: "CodeBlockEditor",
|
|
3159
|
+
setup(__props) {
|
|
3160
|
+
const services = vue.inject("services");
|
|
3161
|
+
const codeEditor = vue.ref();
|
|
3162
|
+
const left = vue.ref(200);
|
|
3163
|
+
const currentTitle = vue.ref("");
|
|
3164
|
+
const codeConfig = vue.ref(null);
|
|
3165
|
+
const state = vue.reactive({
|
|
3166
|
+
codeList: []
|
|
3167
|
+
});
|
|
3168
|
+
const isShowCodeBlockEditor = vue.computed(
|
|
3169
|
+
() => codeConfig.value && services?.codeBlockService.getCodeEditorShowStatus() || false
|
|
3170
|
+
);
|
|
3171
|
+
const mode = vue.computed(() => services?.codeBlockService.getMode());
|
|
3172
|
+
const id = vue.computed(() => services?.codeBlockService.getId() || "");
|
|
3173
|
+
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3174
|
+
const selectedIds = vue.computed(() => services?.codeBlockService.getCombineIds() || []);
|
|
3175
|
+
vue.watchEffect(async () => {
|
|
3176
|
+
codeConfig.value = await services?.codeBlockService.getCodeContentById(id.value) || null;
|
|
3177
|
+
});
|
|
3178
|
+
vue.watchEffect(async () => {
|
|
3179
|
+
const codeDsl = await services?.codeBlockService.getCodeDslByIds(selectedIds.value) || null;
|
|
3180
|
+
if (!codeDsl)
|
|
3181
|
+
return;
|
|
3182
|
+
state.codeList = [];
|
|
3183
|
+
lodashEs.forIn(codeDsl, (value, key) => {
|
|
3184
|
+
state.codeList.push({
|
|
3185
|
+
id: key,
|
|
3186
|
+
name: value.name,
|
|
3187
|
+
content: value.content
|
|
3188
|
+
});
|
|
3189
|
+
});
|
|
3190
|
+
currentTitle.value = state.codeList[0]?.name || "";
|
|
3191
|
+
});
|
|
3192
|
+
const saveCode = async () => {
|
|
3193
|
+
if (!codeEditor.value || !codeConfig.value || !editable.value)
|
|
3194
|
+
return true;
|
|
3195
|
+
try {
|
|
3196
|
+
const codeContent = codeEditor.value.getEditor()?.getValue();
|
|
3197
|
+
codeConfig.value.content = eval(codeContent);
|
|
3198
|
+
} catch (e) {
|
|
3199
|
+
elementPlus.ElMessage.error(e.stack);
|
|
3200
|
+
return false;
|
|
3201
|
+
}
|
|
3202
|
+
await services?.codeBlockService.setCodeDslById(id.value, {
|
|
3203
|
+
name: codeConfig.value.name,
|
|
3204
|
+
content: codeConfig.value.content
|
|
3205
|
+
});
|
|
3206
|
+
elementPlus.ElMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3207
|
+
return true;
|
|
3208
|
+
};
|
|
3209
|
+
const saveAndClose = async () => {
|
|
3210
|
+
const saveRes = await saveCode();
|
|
3211
|
+
if (saveRes) {
|
|
3212
|
+
await services?.codeBlockService.setCodeEditorShowStatus(false);
|
|
3213
|
+
}
|
|
3214
|
+
};
|
|
3215
|
+
const selectHandler = (data) => {
|
|
3216
|
+
services?.codeBlockService.setId(data.id);
|
|
3217
|
+
currentTitle.value = data.name;
|
|
3218
|
+
};
|
|
3219
|
+
return (_ctx, _cache) => {
|
|
3220
|
+
const _component_el_tree = vue.resolveComponent("el-tree");
|
|
3221
|
+
const _component_el_input = vue.resolveComponent("el-input");
|
|
3222
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
3223
|
+
const _component_el_card = vue.resolveComponent("el-card");
|
|
3224
|
+
const _component_el_dialog = vue.resolveComponent("el-dialog");
|
|
3225
|
+
return vue.openBlock(), vue.createBlock(_component_el_dialog, {
|
|
3226
|
+
modelValue: vue.unref(isShowCodeBlockEditor),
|
|
3227
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
|
|
3228
|
+
title: currentTitle.value,
|
|
3229
|
+
fullscreen: true,
|
|
3230
|
+
"before-close": saveAndClose,
|
|
3231
|
+
"append-to-body": true,
|
|
3232
|
+
"custom-class": "code-editor-dialog"
|
|
3233
|
+
}, {
|
|
3234
|
+
default: vue.withCtx(() => [
|
|
3235
|
+
vue.createVNode(_sfc_main$l, {
|
|
3236
|
+
left: left.value,
|
|
3237
|
+
"onUpdate:left": _cache[1] || (_cache[1] = ($event) => left.value = $event),
|
|
3238
|
+
"min-left": 45,
|
|
3239
|
+
class: "code-editor-layout"
|
|
3240
|
+
}, vue.createSlots({
|
|
3241
|
+
center: vue.withCtx(() => [
|
|
3242
|
+
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3243
|
+
key: 0,
|
|
3244
|
+
class: vue.normalizeClass([
|
|
3245
|
+
vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? "m-editor-code-block-editor-panel-list-mode" : "m-editor-code-block-editor-panel"
|
|
3246
|
+
])
|
|
3247
|
+
}, [
|
|
3248
|
+
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3249
|
+
vue.createVNode(_component_el_card, { shadow: "never" }, {
|
|
3250
|
+
header: vue.withCtx(() => [
|
|
3251
|
+
vue.createElementVNode("div", _hoisted_4$1, [
|
|
3252
|
+
_hoisted_5$1,
|
|
3253
|
+
codeConfig.value ? (vue.openBlock(), vue.createBlock(_component_el_input, {
|
|
3254
|
+
key: 0,
|
|
3255
|
+
class: "code-name-input",
|
|
3256
|
+
modelValue: codeConfig.value.name,
|
|
3257
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => codeConfig.value.name = $event),
|
|
3258
|
+
disabled: !vue.unref(editable)
|
|
3259
|
+
}, null, 8, ["modelValue", "disabled"])) : vue.createCommentVNode("", true)
|
|
3260
|
+
])
|
|
3261
|
+
]),
|
|
3262
|
+
default: vue.withCtx(() => [
|
|
3263
|
+
vue.createElementVNode("div", _hoisted_6$1, [
|
|
3264
|
+
codeConfig.value ? (vue.openBlock(), vue.createBlock(CodeEditor, {
|
|
3265
|
+
key: 0,
|
|
3266
|
+
ref_key: "codeEditor",
|
|
3267
|
+
ref: codeEditor,
|
|
3268
|
+
class: "m-editor-container",
|
|
3269
|
+
"init-values": `${codeConfig.value.content}`,
|
|
3270
|
+
onSave: saveCode,
|
|
3271
|
+
options: {
|
|
3272
|
+
tabSize: 2,
|
|
3273
|
+
fontSize: 16,
|
|
3274
|
+
formatOnPaste: true,
|
|
3275
|
+
readOnly: !vue.unref(editable)
|
|
3276
|
+
}
|
|
3277
|
+
}, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
|
|
3278
|
+
vue.unref(editable) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$1, [
|
|
3279
|
+
vue.createVNode(_component_el_button, {
|
|
3280
|
+
type: "primary",
|
|
3281
|
+
class: "button",
|
|
3282
|
+
onClick: saveCode
|
|
3283
|
+
}, {
|
|
3284
|
+
default: vue.withCtx(() => [
|
|
3285
|
+
_hoisted_8$1
|
|
3286
|
+
]),
|
|
3287
|
+
_: 1
|
|
3288
|
+
}),
|
|
3289
|
+
vue.createVNode(_component_el_button, {
|
|
3290
|
+
type: "primary",
|
|
3291
|
+
class: "button",
|
|
3292
|
+
onClick: saveAndClose
|
|
3293
|
+
}, {
|
|
3294
|
+
default: vue.withCtx(() => [
|
|
3295
|
+
_hoisted_9$1
|
|
3296
|
+
]),
|
|
3297
|
+
_: 1
|
|
3298
|
+
})
|
|
3299
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
|
|
3300
|
+
vue.createVNode(_component_el_button, {
|
|
3301
|
+
type: "primary",
|
|
3302
|
+
class: "button",
|
|
3303
|
+
onClick: saveAndClose
|
|
3304
|
+
}, {
|
|
3305
|
+
default: vue.withCtx(() => [
|
|
3306
|
+
_hoisted_11
|
|
3307
|
+
]),
|
|
3308
|
+
_: 1
|
|
3309
|
+
})
|
|
3310
|
+
]))
|
|
3311
|
+
])
|
|
3312
|
+
]),
|
|
3313
|
+
_: 1
|
|
3314
|
+
})
|
|
3315
|
+
], 2)) : vue.createCommentVNode("", true)
|
|
3316
|
+
]),
|
|
3317
|
+
_: 2
|
|
3318
|
+
}, [
|
|
3319
|
+
vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? {
|
|
3320
|
+
name: "left",
|
|
3321
|
+
fn: vue.withCtx(() => [
|
|
3322
|
+
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(_component_el_tree, {
|
|
3323
|
+
key: 0,
|
|
3324
|
+
ref: "tree",
|
|
3325
|
+
"node-key": "id",
|
|
3326
|
+
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3327
|
+
data: state.codeList,
|
|
3328
|
+
"highlight-current": true,
|
|
3329
|
+
onNodeClick: selectHandler,
|
|
3330
|
+
"current-node-key": state.codeList[0].id,
|
|
3331
|
+
class: "side-tree"
|
|
3332
|
+
}, {
|
|
3333
|
+
default: vue.withCtx(({ data }) => [
|
|
3334
|
+
vue.createElementVNode("div", {
|
|
3335
|
+
id: data.id,
|
|
3336
|
+
class: "list-container"
|
|
3337
|
+
}, [
|
|
3338
|
+
vue.createElementVNode("div", _hoisted_2$3, [
|
|
3339
|
+
vue.createElementVNode("div", _hoisted_3$1, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1)
|
|
3340
|
+
])
|
|
3341
|
+
], 8, _hoisted_1$6)
|
|
3342
|
+
]),
|
|
3343
|
+
_: 1
|
|
3344
|
+
}, 8, ["data", "current-node-key"])) : vue.createCommentVNode("", true)
|
|
3345
|
+
])
|
|
3346
|
+
} : void 0
|
|
3347
|
+
]), 1032, ["left"])
|
|
3348
|
+
]),
|
|
3349
|
+
_: 3
|
|
3350
|
+
}, 8, ["modelValue", "title"]);
|
|
3351
|
+
};
|
|
3352
|
+
}
|
|
3353
|
+
});
|
|
3354
|
+
|
|
3355
|
+
const _hoisted_1$5 = { class: "m-editor-code-block-list" };
|
|
3356
|
+
const _hoisted_2$2 = { class: "code-header-wrapper" };
|
|
3357
|
+
const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("\u65B0\u589E");
|
|
3358
|
+
const _hoisted_4 = ["id"];
|
|
3359
|
+
const _hoisted_5 = { class: "list-item" };
|
|
3360
|
+
const _hoisted_6 = { class: "code-name" };
|
|
3361
|
+
const _hoisted_7 = { class: "right-tool" };
|
|
3362
|
+
const _hoisted_8 = {
|
|
3363
|
+
key: 0,
|
|
3364
|
+
class: "code-comp-map-wrapper"
|
|
3365
|
+
};
|
|
3366
|
+
const _hoisted_9 = /* @__PURE__ */ vue.createElementVNode("svg", {
|
|
3367
|
+
class: "arrow-left",
|
|
3368
|
+
viewBox: "0 0 1024 1024",
|
|
3369
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3370
|
+
"data-v-029747aa": ""
|
|
3371
|
+
}, [
|
|
3372
|
+
/* @__PURE__ */ vue.createElementVNode("path", {
|
|
3373
|
+
fill: "currentColor",
|
|
3374
|
+
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"
|
|
3375
|
+
})
|
|
3376
|
+
], -1);
|
|
3377
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
3378
|
+
__name: "CodeBlockList",
|
|
3379
|
+
props: {
|
|
3380
|
+
customError: null
|
|
3381
|
+
},
|
|
3382
|
+
setup(__props) {
|
|
3383
|
+
const props = __props;
|
|
3384
|
+
const services = vue.inject("services");
|
|
3385
|
+
const state = vue.reactive({
|
|
3386
|
+
codeList: [],
|
|
3387
|
+
bindComps: {}
|
|
3388
|
+
});
|
|
3389
|
+
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3390
|
+
const getBindCompsByCodeId = (codeId, codeBlockContent) => {
|
|
3391
|
+
if (lodashEs.isEmpty(codeBlockContent) || lodashEs.isEmpty(codeBlockContent.comps)) {
|
|
3392
|
+
state.bindComps[codeId] = [];
|
|
3393
|
+
return;
|
|
3394
|
+
}
|
|
3395
|
+
const compsField = codeBlockContent.comps;
|
|
3396
|
+
const bindCompIds = Object.keys(compsField);
|
|
3397
|
+
const bindCompsFiltered = bindCompIds.filter((compId) => !lodashEs.isEmpty(compsField[compId]));
|
|
3398
|
+
const compsInfo = bindCompsFiltered.map((compId) => ({
|
|
3399
|
+
id: compId,
|
|
3400
|
+
name: getCompName(compId)
|
|
3401
|
+
}));
|
|
3402
|
+
state.bindComps[codeId] = compsInfo;
|
|
3403
|
+
};
|
|
3404
|
+
const initList = async () => {
|
|
3405
|
+
const codeDsl = await services?.codeBlockService.getCodeDsl() || null;
|
|
3406
|
+
if (!codeDsl)
|
|
3407
|
+
return;
|
|
3408
|
+
state.codeList = [];
|
|
3409
|
+
lodashEs.forIn(codeDsl, (value, codeId) => {
|
|
3410
|
+
getBindCompsByCodeId(codeId, value);
|
|
3411
|
+
state.codeList.push({
|
|
3412
|
+
id: codeId,
|
|
3413
|
+
name: value.name,
|
|
3414
|
+
content: value.content,
|
|
3415
|
+
showRelation: true
|
|
3416
|
+
});
|
|
3417
|
+
});
|
|
3418
|
+
};
|
|
3419
|
+
vue.watch(
|
|
3420
|
+
() => services?.codeBlockService.getCodeDsl(),
|
|
3421
|
+
() => {
|
|
3422
|
+
initList();
|
|
3423
|
+
},
|
|
3424
|
+
{
|
|
3425
|
+
immediate: true,
|
|
3426
|
+
deep: true
|
|
3427
|
+
}
|
|
3428
|
+
);
|
|
3429
|
+
vue.watch(
|
|
3430
|
+
() => services?.editorService.get("node"),
|
|
3431
|
+
(curNode) => {
|
|
3432
|
+
if (!curNode?.id)
|
|
3433
|
+
return;
|
|
3434
|
+
lodashEs.forIn(state.bindComps, (bindCompInfo) => {
|
|
3435
|
+
bindCompInfo.forEach((comp) => {
|
|
3436
|
+
if (comp.id === curNode.id) {
|
|
3437
|
+
comp.name = curNode.name;
|
|
3438
|
+
}
|
|
3439
|
+
});
|
|
3440
|
+
});
|
|
3441
|
+
}
|
|
3442
|
+
);
|
|
3443
|
+
const createCodeBlock = async () => {
|
|
3444
|
+
const { codeBlockService } = services || {};
|
|
3445
|
+
if (!codeBlockService) {
|
|
3446
|
+
elementPlus.ElMessage.error("\u65B0\u589E\u4EE3\u7801\u5757\u5931\u8D25");
|
|
3447
|
+
return;
|
|
3448
|
+
}
|
|
3449
|
+
const codeConfig = {
|
|
3450
|
+
name: "\u4EE3\u7801\u5757",
|
|
3451
|
+
content: `() => {
|
|
3452
|
+
// place your code here
|
|
3453
|
+
}`
|
|
3454
|
+
};
|
|
3455
|
+
await codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3456
|
+
const id = await codeBlockService.getUniqueId();
|
|
3457
|
+
await codeBlockService.setCodeDslById(id, codeConfig);
|
|
3458
|
+
codeBlockService.setCodeEditorContent(true, id);
|
|
3459
|
+
};
|
|
3460
|
+
const editCode = async (key) => {
|
|
3461
|
+
await services?.codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3462
|
+
services?.codeBlockService.setCodeEditorContent(true, key);
|
|
3463
|
+
};
|
|
3464
|
+
const deleteCode = (key) => {
|
|
3465
|
+
const existBinds = !!(state.bindComps[key]?.length > 0);
|
|
3466
|
+
const undeleteableList = services?.codeBlockService.getUndeletableList() || [];
|
|
3467
|
+
if (!existBinds && !undeleteableList.includes(key)) {
|
|
3468
|
+
services?.codeBlockService.deleteCodeDslByIds([key]);
|
|
3469
|
+
} else {
|
|
3470
|
+
if (typeof props.customError === "function") {
|
|
3471
|
+
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
3472
|
+
} else {
|
|
3473
|
+
elementPlus.ElMessage.error("\u4EE3\u7801\u5757\u5220\u9664\u5931\u8D25");
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
};
|
|
3477
|
+
const filterText = vue.ref("");
|
|
3478
|
+
const tree = vue.ref();
|
|
3479
|
+
const filterNode = (value, data) => {
|
|
3480
|
+
if (!value) {
|
|
3481
|
+
return true;
|
|
3482
|
+
}
|
|
3483
|
+
return `${data.name}${data.id}`.indexOf(value) !== -1;
|
|
3484
|
+
};
|
|
3485
|
+
const filterTextChangeHandler = (val) => {
|
|
3486
|
+
tree.value?.filter(val);
|
|
3487
|
+
};
|
|
3488
|
+
const toggleCombineRelation = (data) => {
|
|
3489
|
+
const { id } = data;
|
|
3490
|
+
const currentCode = state.codeList.find((item) => item.id === id);
|
|
3491
|
+
if (!currentCode)
|
|
3492
|
+
return;
|
|
3493
|
+
currentCode.showRelation = !currentCode?.showRelation;
|
|
3494
|
+
};
|
|
3495
|
+
const getCompName = (compId) => {
|
|
3496
|
+
const node = services?.editorService.getNodeById(compId);
|
|
3497
|
+
return node?.name || String(compId);
|
|
3498
|
+
};
|
|
3499
|
+
const selectComp = (compId) => {
|
|
3500
|
+
const stage = services?.editorService.get("stage");
|
|
3501
|
+
services?.editorService.select(compId);
|
|
3502
|
+
stage?.select(compId);
|
|
3503
|
+
};
|
|
3504
|
+
return (_ctx, _cache) => {
|
|
3505
|
+
const _component_el_input = vue.resolveComponent("el-input");
|
|
3506
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
3507
|
+
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
3508
|
+
const _component_el_tree = vue.resolveComponent("el-tree");
|
|
3509
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
|
|
3510
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
3511
|
+
vue.createElementVNode("div", _hoisted_2$2, [
|
|
3512
|
+
vue.createVNode(_component_el_input, {
|
|
3513
|
+
class: vue.normalizeClass([vue.unref(editable) ? "code-filter-input" : "code-filter-input-no-btn"]),
|
|
3514
|
+
size: "small",
|
|
3515
|
+
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
3516
|
+
clearable: "",
|
|
3517
|
+
modelValue: filterText.value,
|
|
3518
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
3519
|
+
onInput: filterTextChangeHandler
|
|
3520
|
+
}, null, 8, ["class", "modelValue"]),
|
|
3521
|
+
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
3522
|
+
key: 0,
|
|
3523
|
+
class: "create-code-button",
|
|
3524
|
+
type: "primary",
|
|
3525
|
+
size: "small",
|
|
3526
|
+
onClick: createCodeBlock
|
|
3527
|
+
}, {
|
|
3528
|
+
default: vue.withCtx(() => [
|
|
3529
|
+
_hoisted_3
|
|
3530
|
+
]),
|
|
3531
|
+
_: 1
|
|
3532
|
+
})) : vue.createCommentVNode("", true)
|
|
3533
|
+
])
|
|
3534
|
+
]),
|
|
3535
|
+
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(_component_el_tree, {
|
|
3536
|
+
key: 0,
|
|
3537
|
+
ref_key: "tree",
|
|
3538
|
+
ref: tree,
|
|
3539
|
+
"node-key": "id",
|
|
3540
|
+
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3541
|
+
data: state.codeList,
|
|
3542
|
+
"highlight-current": true,
|
|
3543
|
+
"filter-node-method": filterNode,
|
|
3544
|
+
onNodeClick: toggleCombineRelation
|
|
3545
|
+
}, {
|
|
3546
|
+
default: vue.withCtx(({ data }) => [
|
|
3547
|
+
vue.createElementVNode("div", {
|
|
3548
|
+
id: data.id,
|
|
3549
|
+
class: "list-container"
|
|
3550
|
+
}, [
|
|
3551
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
3552
|
+
vue.createElementVNode("div", _hoisted_6, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1),
|
|
3553
|
+
vue.createElementVNode("div", _hoisted_7, [
|
|
3554
|
+
vue.createVNode(_component_el_tooltip, {
|
|
3555
|
+
effect: "dark",
|
|
3556
|
+
content: vue.unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
|
|
3557
|
+
placement: "bottom"
|
|
3558
|
+
}, {
|
|
3559
|
+
default: vue.withCtx(() => [
|
|
3560
|
+
vue.createVNode(_sfc_main$j, {
|
|
3561
|
+
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3562
|
+
class: "edit-icon",
|
|
3563
|
+
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
3564
|
+
}, null, 8, ["icon", "onClick"])
|
|
3565
|
+
]),
|
|
3566
|
+
_: 2
|
|
3567
|
+
}, 1032, ["content"]),
|
|
3568
|
+
state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
|
|
3569
|
+
key: 0,
|
|
3570
|
+
effect: "dark",
|
|
3571
|
+
content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
|
|
3572
|
+
placement: "bottom"
|
|
3573
|
+
}, {
|
|
3574
|
+
default: vue.withCtx(() => [
|
|
3575
|
+
vue.createVNode(_sfc_main$j, {
|
|
3576
|
+
icon: vue.unref(iconsVue.Link),
|
|
3577
|
+
class: "edit-icon",
|
|
3578
|
+
onClick: vue.withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
3579
|
+
}, null, 8, ["icon", "onClick"])
|
|
3580
|
+
]),
|
|
3581
|
+
_: 2
|
|
3582
|
+
}, 1024)) : vue.createCommentVNode("", true),
|
|
3583
|
+
vue.unref(editable) ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
|
|
3584
|
+
key: 1,
|
|
3585
|
+
effect: "dark",
|
|
3586
|
+
content: "\u5220\u9664",
|
|
3587
|
+
placement: "bottom"
|
|
3588
|
+
}, {
|
|
3589
|
+
default: vue.withCtx(() => [
|
|
3590
|
+
vue.createVNode(_sfc_main$j, {
|
|
3591
|
+
icon: vue.unref(iconsVue.Close),
|
|
3592
|
+
class: "edit-icon",
|
|
3593
|
+
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
3594
|
+
}, null, 8, ["icon", "onClick"])
|
|
3595
|
+
]),
|
|
3596
|
+
_: 2
|
|
3597
|
+
}, 1024)) : vue.createCommentVNode("", true),
|
|
3598
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
3599
|
+
id: data.id
|
|
3600
|
+
})
|
|
3601
|
+
])
|
|
3602
|
+
]),
|
|
3603
|
+
data.showRelation && state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
3604
|
+
_hoisted_9,
|
|
3605
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(state.bindComps[data.id], (comp, index) => {
|
|
3606
|
+
return vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
3607
|
+
key: index,
|
|
3608
|
+
class: "code-comp",
|
|
3609
|
+
size: "small",
|
|
3610
|
+
plain: true,
|
|
3611
|
+
onClick: vue.withModifiers(($event) => selectComp(comp.id), ["stop"])
|
|
3612
|
+
}, {
|
|
3613
|
+
default: vue.withCtx(() => [
|
|
3614
|
+
vue.createTextVNode(vue.toDisplayString(comp.name), 1)
|
|
3615
|
+
]),
|
|
3616
|
+
_: 2
|
|
3617
|
+
}, 1032, ["onClick"]);
|
|
3618
|
+
}), 128))
|
|
3619
|
+
])) : vue.createCommentVNode("", true)
|
|
3620
|
+
], 8, _hoisted_4)
|
|
3621
|
+
]),
|
|
3622
|
+
_: 3
|
|
3623
|
+
}, 8, ["data"])) : vue.createCommentVNode("", true),
|
|
3624
|
+
vue.createVNode(_sfc_main$f, null, {
|
|
3625
|
+
"code-block-edit-panel-header": vue.withCtx(({ id }) => [
|
|
3626
|
+
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
3627
|
+
]),
|
|
3628
|
+
_: 3
|
|
3629
|
+
})
|
|
3630
|
+
]);
|
|
3631
|
+
};
|
|
3632
|
+
}
|
|
3633
|
+
});
|
|
3634
|
+
|
|
2753
3635
|
const _hoisted_1$4 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
|
|
2754
3636
|
const _hoisted_2$1 = ["onClick", "onDragstart"];
|
|
2755
3637
|
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -2862,7 +3744,7 @@
|
|
|
2862
3744
|
onDrag: dragHandler
|
|
2863
3745
|
}, [
|
|
2864
3746
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
2865
|
-
vue.createVNode(_sfc_main$
|
|
3747
|
+
vue.createVNode(_sfc_main$j, {
|
|
2866
3748
|
icon: item.icon
|
|
2867
3749
|
}, null, 8, ["icon"]),
|
|
2868
3750
|
vue.createVNode(_component_el_tooltip, {
|
|
@@ -2982,7 +3864,7 @@
|
|
|
2982
3864
|
}, [
|
|
2983
3865
|
vue.createElementVNode("div", null, [
|
|
2984
3866
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
2985
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3867
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$i, {
|
|
2986
3868
|
"event-type": "mouseup",
|
|
2987
3869
|
data: item,
|
|
2988
3870
|
key: index,
|
|
@@ -3349,7 +4231,7 @@
|
|
|
3349
4231
|
const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$3]]);
|
|
3350
4232
|
|
|
3351
4233
|
const _sfc_main$9 = vue.defineComponent({
|
|
3352
|
-
components: { MIcon: _sfc_main$
|
|
4234
|
+
components: { MIcon: _sfc_main$j },
|
|
3353
4235
|
props: {
|
|
3354
4236
|
data: {
|
|
3355
4237
|
type: [Object, String]
|
|
@@ -3378,6 +4260,14 @@
|
|
|
3378
4260
|
component: LayerPanel,
|
|
3379
4261
|
slots: {}
|
|
3380
4262
|
};
|
|
4263
|
+
case "code-block":
|
|
4264
|
+
return {
|
|
4265
|
+
type: "component",
|
|
4266
|
+
icon: iconsVue.EditPen,
|
|
4267
|
+
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4268
|
+
component: _sfc_main$e,
|
|
4269
|
+
slots: {}
|
|
4270
|
+
};
|
|
3381
4271
|
default:
|
|
3382
4272
|
return void 0;
|
|
3383
4273
|
}
|
|
@@ -3434,6 +4324,30 @@
|
|
|
3434
4324
|
_ctx.data === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : _ctx.config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
3435
4325
|
])
|
|
3436
4326
|
} : void 0,
|
|
4327
|
+
_ctx.data === "code-block" || _ctx.config.slots?.codeBlockPanelHeader ? {
|
|
4328
|
+
name: "code-block-panel-header",
|
|
4329
|
+
fn: vue.withCtx(() => [
|
|
4330
|
+
_ctx.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : _ctx.config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4331
|
+
])
|
|
4332
|
+
} : void 0,
|
|
4333
|
+
_ctx.data === "code-block" || _ctx.config.slots?.codeBlockPanelTool ? {
|
|
4334
|
+
name: "code-block-panel-tool",
|
|
4335
|
+
fn: vue.withCtx(({ id }) => [
|
|
4336
|
+
_ctx.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4337
|
+
key: 0,
|
|
4338
|
+
id
|
|
4339
|
+
}) : _ctx.config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4340
|
+
])
|
|
4341
|
+
} : void 0,
|
|
4342
|
+
_ctx.data === "code-block" || _ctx.config.slots?.codeBlockEditPanelHeader ? {
|
|
4343
|
+
name: "code-block-edit-panel-header",
|
|
4344
|
+
fn: vue.withCtx(({ id }) => [
|
|
4345
|
+
_ctx.data === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4346
|
+
key: 0,
|
|
4347
|
+
id
|
|
4348
|
+
}) : _ctx.config.slots?.codeBlockEditPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.config.slots.codeBlockEditPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
|
|
4349
|
+
])
|
|
4350
|
+
} : void 0,
|
|
3437
4351
|
_ctx.data === "layer" || _ctx.config.slots?.layerNodeContent ? {
|
|
3438
4352
|
name: "layer-node-content",
|
|
3439
4353
|
fn: vue.withCtx(({ data: nodeData, node }) => [
|
|
@@ -3461,7 +4375,7 @@
|
|
|
3461
4375
|
props: {
|
|
3462
4376
|
data: {
|
|
3463
4377
|
type: Object,
|
|
3464
|
-
default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer"] })
|
|
4378
|
+
default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] })
|
|
3465
4379
|
}
|
|
3466
4380
|
},
|
|
3467
4381
|
setup(props) {
|
|
@@ -3521,6 +4435,24 @@
|
|
|
3521
4435
|
fn: vue.withCtx(({ component }) => [
|
|
3522
4436
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component })
|
|
3523
4437
|
])
|
|
4438
|
+
} : void 0,
|
|
4439
|
+
item === "code-block" ? {
|
|
4440
|
+
name: "code-block-panel-header",
|
|
4441
|
+
fn: vue.withCtx(() => [
|
|
4442
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-header")
|
|
4443
|
+
])
|
|
4444
|
+
} : void 0,
|
|
4445
|
+
item === "code-block" ? {
|
|
4446
|
+
name: "code-block-panel-tool",
|
|
4447
|
+
fn: vue.withCtx(({ id }) => [
|
|
4448
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-tool", { id })
|
|
4449
|
+
])
|
|
4450
|
+
} : void 0,
|
|
4451
|
+
item === "code-block" ? {
|
|
4452
|
+
name: "code-block-edit-panel-header",
|
|
4453
|
+
fn: vue.withCtx(({ id }) => [
|
|
4454
|
+
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
4455
|
+
])
|
|
3524
4456
|
} : void 0
|
|
3525
4457
|
]), 1032, ["data"]);
|
|
3526
4458
|
}), 128))
|
|
@@ -3616,14 +4548,14 @@
|
|
|
3616
4548
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3617
4549
|
onClick: addPage
|
|
3618
4550
|
}, [
|
|
3619
|
-
vue.createVNode(_sfc_main$
|
|
4551
|
+
vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
3620
4552
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
3621
4553
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3622
4554
|
key: 2,
|
|
3623
4555
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3624
4556
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
3625
4557
|
}, [
|
|
3626
|
-
vue.createVNode(_sfc_main$
|
|
4558
|
+
vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
3627
4559
|
])) : vue.createCommentVNode("", true),
|
|
3628
4560
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3629
4561
|
key: 3,
|
|
@@ -3639,7 +4571,7 @@
|
|
|
3639
4571
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3640
4572
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
3641
4573
|
}, [
|
|
3642
|
-
vue.createVNode(_sfc_main$
|
|
4574
|
+
vue.createVNode(_sfc_main$j, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
3643
4575
|
])) : vue.createCommentVNode("", true)
|
|
3644
4576
|
], 512);
|
|
3645
4577
|
};
|
|
@@ -3711,7 +4643,7 @@
|
|
|
3711
4643
|
default: vue.withCtx(() => [
|
|
3712
4644
|
vue.createElementVNode("div", null, [
|
|
3713
4645
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
3714
|
-
vue.createVNode(_sfc_main$
|
|
4646
|
+
vue.createVNode(_sfc_main$i, {
|
|
3715
4647
|
data: {
|
|
3716
4648
|
type: "button",
|
|
3717
4649
|
text: "\u590D\u5236",
|
|
@@ -3719,7 +4651,7 @@
|
|
|
3719
4651
|
handler: () => copy(item)
|
|
3720
4652
|
}
|
|
3721
4653
|
}, null, 8, ["data"]),
|
|
3722
|
-
vue.createVNode(_sfc_main$
|
|
4654
|
+
vue.createVNode(_sfc_main$i, {
|
|
3723
4655
|
data: {
|
|
3724
4656
|
type: "button",
|
|
3725
4657
|
text: "\u5220\u9664",
|
|
@@ -4493,11 +5425,11 @@
|
|
|
4493
5425
|
const _sfc_main = vue.defineComponent({
|
|
4494
5426
|
name: "m-editor",
|
|
4495
5427
|
components: {
|
|
4496
|
-
NavMenu: _sfc_main$
|
|
5428
|
+
NavMenu: _sfc_main$h,
|
|
4497
5429
|
Sidebar,
|
|
4498
5430
|
Workspace: _sfc_main$1,
|
|
4499
|
-
PropsPanel: _sfc_main$
|
|
4500
|
-
Framework: _sfc_main$
|
|
5431
|
+
PropsPanel: _sfc_main$g,
|
|
5432
|
+
Framework: _sfc_main$k
|
|
4501
5433
|
},
|
|
4502
5434
|
props: {
|
|
4503
5435
|
modelValue: {
|
|
@@ -4592,7 +5524,9 @@
|
|
|
4592
5524
|
});
|
|
4593
5525
|
vue.watch(
|
|
4594
5526
|
() => props.modelValue,
|
|
4595
|
-
(modelValue) =>
|
|
5527
|
+
(modelValue) => {
|
|
5528
|
+
editorService.set("root", modelValue);
|
|
5529
|
+
},
|
|
4596
5530
|
{
|
|
4597
5531
|
immediate: true
|
|
4598
5532
|
}
|
|
@@ -4655,6 +5589,7 @@
|
|
|
4655
5589
|
uiService.destroy();
|
|
4656
5590
|
componentListService.destroy();
|
|
4657
5591
|
storageService.destroy();
|
|
5592
|
+
codeBlockService.destroy();
|
|
4658
5593
|
});
|
|
4659
5594
|
const services = {
|
|
4660
5595
|
componentListService,
|
|
@@ -4663,7 +5598,8 @@
|
|
|
4663
5598
|
propsService,
|
|
4664
5599
|
editorService,
|
|
4665
5600
|
uiService,
|
|
4666
|
-
storageService
|
|
5601
|
+
storageService,
|
|
5602
|
+
codeBlockService
|
|
4667
5603
|
};
|
|
4668
5604
|
vue.provide("services", services);
|
|
4669
5605
|
vue.provide("layerContentMenu", props.layerContentMenu);
|
|
@@ -4717,6 +5653,15 @@
|
|
|
4717
5653
|
"component-list-item": vue.withCtx(({ component }) => [
|
|
4718
5654
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component })
|
|
4719
5655
|
]),
|
|
5656
|
+
"code-block-panel-header": vue.withCtx(() => [
|
|
5657
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-header")
|
|
5658
|
+
]),
|
|
5659
|
+
"code-block-panel-tool": vue.withCtx(({ id }) => [
|
|
5660
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-tool", { id })
|
|
5661
|
+
]),
|
|
5662
|
+
"code-block-edit-panel-header": vue.withCtx(({ id }) => [
|
|
5663
|
+
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
5664
|
+
]),
|
|
4720
5665
|
_: 3
|
|
4721
5666
|
}, 8, ["data"])
|
|
4722
5667
|
])
|
|
@@ -4769,30 +5714,36 @@
|
|
|
4769
5714
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
4770
5715
|
setConfig(option);
|
|
4771
5716
|
app.component(Editor.name, Editor);
|
|
4772
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
4773
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
4774
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
5717
|
+
app.component("m-fields-ui-select", _sfc_main$p);
|
|
5718
|
+
app.component("m-fields-code-link", _sfc_main$r);
|
|
5719
|
+
app.component("m-fields-vs-code", _sfc_main$s);
|
|
4775
5720
|
app.component(CodeEditor.name, CodeEditor);
|
|
5721
|
+
app.component("m-fields-code-select", _sfc_main$q);
|
|
4776
5722
|
}
|
|
4777
5723
|
};
|
|
4778
5724
|
|
|
4779
5725
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
5726
|
+
exports.CodeBlockList = _sfc_main$e;
|
|
5727
|
+
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
5728
|
+
exports.CodeEditorMode = CodeEditorMode;
|
|
5729
|
+
exports.CodeSelectOp = CodeSelectOp;
|
|
4780
5730
|
exports.ColumnLayout = ColumnLayout;
|
|
4781
5731
|
exports.ComponentListPanel = _sfc_main$d;
|
|
4782
5732
|
exports.ContentMenu = _sfc_main$c;
|
|
4783
5733
|
exports.Fixed2Other = Fixed2Other;
|
|
4784
5734
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
4785
|
-
exports.Icon = _sfc_main$
|
|
5735
|
+
exports.Icon = _sfc_main$j;
|
|
4786
5736
|
exports.Keys = Keys;
|
|
4787
5737
|
exports.LayerOffset = LayerOffset;
|
|
4788
5738
|
exports.LayerPanel = LayerPanel;
|
|
4789
5739
|
exports.Layout = Layout;
|
|
4790
|
-
exports.PropsPanel = _sfc_main$
|
|
5740
|
+
exports.PropsPanel = _sfc_main$g;
|
|
4791
5741
|
exports.TMagicCodeEditor = CodeEditor;
|
|
4792
5742
|
exports.TMagicEditor = Editor;
|
|
4793
|
-
exports.ToolButton = _sfc_main$
|
|
5743
|
+
exports.ToolButton = _sfc_main$i;
|
|
4794
5744
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
4795
5745
|
exports.change2Fixed = change2Fixed;
|
|
5746
|
+
exports.codeBlockService = codeBlockService;
|
|
4796
5747
|
exports.debug = debug;
|
|
4797
5748
|
exports.default = index;
|
|
4798
5749
|
exports.editorService = editorService;
|