@tmagic/editor 1.2.0 → 1.2.2
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 +4 -0
- package/dist/tmagic-editor.js +305 -249
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +308 -253
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +9 -9
- package/src/Editor.vue +1 -1
- package/src/components/CodeDraftEditor.vue +2 -10
- package/src/components/FunctionEditor.vue +58 -13
- package/src/components/Layout.vue +1 -1
- package/src/fields/CodeSelect.vue +23 -7
- package/src/fields/UISelect.vue +2 -2
- package/src/index.ts +1 -1
- package/src/layouts/AddPageBox.vue +4 -1
- package/src/layouts/Framework.vue +10 -8
- package/src/layouts/NavMenu.vue +9 -6
- package/src/layouts/PropsPanel.vue +3 -7
- package/src/layouts/sidebar/ComponentListPanel.vue +1 -2
- package/src/layouts/sidebar/LayerPanel.vue +8 -9
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +10 -39
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +5 -6
- package/src/layouts/workspace/Breadcrumb.vue +5 -6
- package/src/layouts/workspace/PageBar.vue +2 -2
- package/src/layouts/workspace/PageBarScrollContainer.vue +4 -2
- package/src/layouts/workspace/Stage.vue +11 -10
- package/src/layouts/workspace/ViewerMenu.vue +5 -6
- package/src/layouts/workspace/Workspace.vue +2 -3
- package/src/services/BaseService.ts +1 -1
- package/src/services/codeBlock.ts +15 -24
- package/src/services/componentList.ts +1 -1
- package/src/services/editor.ts +119 -79
- package/src/services/events.ts +1 -1
- package/src/services/history.ts +1 -1
- package/src/services/props.ts +1 -1
- package/src/services/ui.ts +8 -10
- package/src/theme/code-block.scss +4 -0
- package/src/type.ts +7 -13
- package/src/utils/config.ts +1 -1
- package/src/utils/editor.ts +8 -2
- package/src/utils/index.ts +1 -1
- package/src/utils/logger.ts +1 -1
- package/src/utils/operator.ts +12 -12
- package/src/utils/props.ts +1 -1
- package/src/utils/stage.ts +6 -6
- package/src/utils/undo-redo.ts +1 -1
- package/types/Editor.vue.d.ts +1 -1
- package/types/components/CodeDraftEditor.vue.d.ts +1 -2
- package/types/components/FunctionEditor.vue.d.ts +17 -0
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +23 -5
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +5 -0
- package/types/layouts/workspace/Workspace.vue.d.ts +2 -3
- package/types/services/codeBlock.d.ts +0 -12
- package/types/services/editor.d.ts +6 -6
- package/types/services/ui.d.ts +23 -24
- package/types/type.d.ts +5 -11
- package/types/utils/operator.d.ts +1 -1
|
@@ -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', 'lodash-es', '@tmagic/form', '@tmagic/schema', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.
|
|
5
|
-
})(this, (function (exports, vue, serialize, lodashEs, form, schema,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('@element-plus/icons-vue'), require('lodash-es'), require('@tmagic/form'), require('@tmagic/schema'), require('@tmagic/design'), require('monaco-editor'), require('@tmagic/stage'), require('gesto'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', '@element-plus/icons-vue', 'lodash-es', '@tmagic/form', '@tmagic/schema', '@tmagic/design', 'monaco-editor', '@tmagic/stage', 'gesto', '@tmagic/utils', 'events', '@tmagic/core', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.iconsVue, global.lodashEs, global.form, global.schema, global.design, global.monaco, global.StageCore, global.Gesto, global.utils, global.events, global.core, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, serialize, iconsVue, lodashEs, form, schema, design, monaco, StageCore, Gesto, utils, events, core, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
|
8
8
|
|
|
@@ -136,12 +136,55 @@
|
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
const _hoisted_1$g =
|
|
139
|
+
const _hoisted_1$g = ["src"];
|
|
140
140
|
const __default__$r = vue.defineComponent({
|
|
141
|
-
name: "
|
|
141
|
+
name: "MEditorIcon"
|
|
142
142
|
});
|
|
143
143
|
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
144
144
|
...__default__$r,
|
|
145
|
+
props: {
|
|
146
|
+
icon: null
|
|
147
|
+
},
|
|
148
|
+
setup(__props) {
|
|
149
|
+
return (_ctx, _cache) => {
|
|
150
|
+
return !__props.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
151
|
+
key: 0,
|
|
152
|
+
class: "magic-editor-icon"
|
|
153
|
+
}, {
|
|
154
|
+
default: vue.withCtx(() => [
|
|
155
|
+
vue.createVNode(vue.unref(iconsVue.Edit))
|
|
156
|
+
]),
|
|
157
|
+
_: 1
|
|
158
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
159
|
+
key: 1,
|
|
160
|
+
class: "magic-editor-icon"
|
|
161
|
+
}, {
|
|
162
|
+
default: vue.withCtx(() => [
|
|
163
|
+
vue.createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$g)
|
|
164
|
+
]),
|
|
165
|
+
_: 1
|
|
166
|
+
})) : typeof __props.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
167
|
+
key: 2,
|
|
168
|
+
class: vue.normalizeClass(["magic-editor-icon", __props.icon])
|
|
169
|
+
}, null, 2)) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
|
|
170
|
+
key: 3,
|
|
171
|
+
class: "magic-editor-icon"
|
|
172
|
+
}, {
|
|
173
|
+
default: vue.withCtx(() => [
|
|
174
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.toRaw(__props.icon))))
|
|
175
|
+
]),
|
|
176
|
+
_: 1
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const _hoisted_1$f = { class: "m-fields-code-select" };
|
|
183
|
+
const __default__$q = vue.defineComponent({
|
|
184
|
+
name: "MEditorCodeSelect"
|
|
185
|
+
});
|
|
186
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
187
|
+
...__default__$q,
|
|
145
188
|
props: {
|
|
146
189
|
config: null,
|
|
147
190
|
model: null,
|
|
@@ -157,9 +200,10 @@
|
|
|
157
200
|
const codeDsl = vue.computed(() => services?.codeBlockService.getCodeDslSync());
|
|
158
201
|
const tableConfig = vue.computed(() => {
|
|
159
202
|
const defaultConfig = {
|
|
160
|
-
dropSort:
|
|
203
|
+
dropSort: false,
|
|
161
204
|
enableFullscreen: false,
|
|
162
205
|
border: true,
|
|
206
|
+
operateColWidth: 60,
|
|
163
207
|
items: [
|
|
164
208
|
{
|
|
165
209
|
type: "select",
|
|
@@ -186,9 +230,7 @@
|
|
|
186
230
|
defaultValue: {},
|
|
187
231
|
itemsFunction: (row) => {
|
|
188
232
|
const paramsConfig = getParamsConfig(row.codeId);
|
|
189
|
-
if (!row.params)
|
|
190
|
-
row.params = {};
|
|
191
|
-
if (lodashEs.isEmpty(row.params)) {
|
|
233
|
+
if (lodashEs.isEmpty(row.params) || !row.params) {
|
|
192
234
|
form.createValues(mForm, paramsConfig, {}, row.params);
|
|
193
235
|
}
|
|
194
236
|
return paramsConfig;
|
|
@@ -201,6 +243,7 @@
|
|
|
201
243
|
...props.config.tableConfig
|
|
202
244
|
};
|
|
203
245
|
});
|
|
246
|
+
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
204
247
|
vue.watch(
|
|
205
248
|
() => props.model[props.name],
|
|
206
249
|
(value) => {
|
|
@@ -225,15 +268,17 @@
|
|
|
225
268
|
if (lodashEs.isEmpty(paramStatements))
|
|
226
269
|
return [];
|
|
227
270
|
return paramStatements.map((paramState) => ({
|
|
228
|
-
name: paramState.name,
|
|
229
|
-
text: paramState.name,
|
|
230
271
|
labelWidth: "100px",
|
|
231
|
-
|
|
272
|
+
text: paramState.name,
|
|
273
|
+
...paramState
|
|
232
274
|
}));
|
|
233
275
|
};
|
|
276
|
+
const editCode = (codeId) => {
|
|
277
|
+
services?.codeBlockService.setCodeEditorContent(true, codeId);
|
|
278
|
+
};
|
|
234
279
|
return (_ctx, _cache) => {
|
|
235
280
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
236
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
281
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
237
282
|
vue.createVNode(_component_m_form_table, {
|
|
238
283
|
config: vue.unref(tableConfig),
|
|
239
284
|
model: __props.model[__props.name],
|
|
@@ -242,18 +287,28 @@
|
|
|
242
287
|
prop: __props.prop,
|
|
243
288
|
size: __props.size,
|
|
244
289
|
onChange: changeHandler
|
|
245
|
-
},
|
|
290
|
+
}, {
|
|
291
|
+
operateCol: vue.withCtx(({ scope }) => [
|
|
292
|
+
scope.row.codeId ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
293
|
+
key: 0,
|
|
294
|
+
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
295
|
+
class: "edit-icon",
|
|
296
|
+
onClick: ($event) => editCode(scope.row.codeId)
|
|
297
|
+
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
298
|
+
]),
|
|
299
|
+
_: 1
|
|
300
|
+
}, 8, ["config", "model", "prop", "size"])
|
|
246
301
|
]);
|
|
247
302
|
};
|
|
248
303
|
}
|
|
249
304
|
});
|
|
250
305
|
|
|
251
|
-
const _hoisted_1$
|
|
252
|
-
const __default__$
|
|
306
|
+
const _hoisted_1$e = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
|
|
307
|
+
const __default__$p = vue.defineComponent({
|
|
253
308
|
name: "MEditorUISelect"
|
|
254
309
|
});
|
|
255
|
-
const _sfc_main$
|
|
256
|
-
...__default__$
|
|
310
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
311
|
+
...__default__$p,
|
|
257
312
|
props: {
|
|
258
313
|
config: null,
|
|
259
314
|
model: null,
|
|
@@ -315,7 +370,7 @@
|
|
|
315
370
|
style: { "padding": "0" }
|
|
316
371
|
}, {
|
|
317
372
|
default: vue.withCtx(() => [
|
|
318
|
-
_hoisted_1$
|
|
373
|
+
_hoisted_1$e
|
|
319
374
|
]),
|
|
320
375
|
_: 1
|
|
321
376
|
}, 8, ["icon"])
|
|
@@ -363,11 +418,11 @@
|
|
|
363
418
|
|
|
364
419
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
365
420
|
|
|
366
|
-
const __default__$
|
|
421
|
+
const __default__$o = vue.defineComponent({
|
|
367
422
|
name: "MEditorCodeEditor"
|
|
368
423
|
});
|
|
369
|
-
const _sfc_main$
|
|
370
|
-
...__default__$
|
|
424
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
425
|
+
...__default__$o,
|
|
371
426
|
props: {
|
|
372
427
|
initValues: null,
|
|
373
428
|
modifiedValues: null,
|
|
@@ -496,11 +551,11 @@
|
|
|
496
551
|
};
|
|
497
552
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
498
553
|
|
|
499
|
-
const __default__$
|
|
554
|
+
const __default__$n = vue.defineComponent({
|
|
500
555
|
name: "MEditorResizer"
|
|
501
556
|
});
|
|
502
|
-
const _sfc_main$
|
|
503
|
-
...__default__$
|
|
557
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
558
|
+
...__default__$n,
|
|
504
559
|
emits: ["change"],
|
|
505
560
|
setup(__props, { emit }) {
|
|
506
561
|
const target = vue.ref();
|
|
@@ -532,17 +587,17 @@
|
|
|
532
587
|
}
|
|
533
588
|
});
|
|
534
589
|
|
|
535
|
-
const __default__$
|
|
590
|
+
const __default__$m = vue.defineComponent({
|
|
536
591
|
name: "MEditorLayout"
|
|
537
592
|
});
|
|
538
|
-
const _sfc_main$
|
|
539
|
-
...__default__$
|
|
593
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
594
|
+
...__default__$m,
|
|
540
595
|
props: {
|
|
541
596
|
left: null,
|
|
542
597
|
right: null,
|
|
543
598
|
minLeft: { default: 46 },
|
|
544
599
|
minRight: { default: 1 },
|
|
545
|
-
minCenter: { default:
|
|
600
|
+
minCenter: { default: 5 },
|
|
546
601
|
leftClass: null,
|
|
547
602
|
rightClass: null,
|
|
548
603
|
centerClass: null
|
|
@@ -644,7 +699,7 @@
|
|
|
644
699
|
}, [
|
|
645
700
|
vue.renderSlot(_ctx.$slots, "left")
|
|
646
701
|
], 6),
|
|
647
|
-
vue.createVNode(_sfc_main$
|
|
702
|
+
vue.createVNode(_sfc_main$o, { onChange: changeLeft })
|
|
648
703
|
], 64)) : vue.createCommentVNode("", true),
|
|
649
704
|
vue.createElementVNode("div", {
|
|
650
705
|
class: vue.normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -653,7 +708,7 @@
|
|
|
653
708
|
vue.renderSlot(_ctx.$slots, "center")
|
|
654
709
|
], 6),
|
|
655
710
|
vue.unref(hasRight) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
656
|
-
vue.createVNode(_sfc_main$
|
|
711
|
+
vue.createVNode(_sfc_main$o, { onChange: changeRight }),
|
|
657
712
|
vue.createElementVNode("div", {
|
|
658
713
|
class: vue.normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
659
714
|
style: vue.normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -666,49 +721,6 @@
|
|
|
666
721
|
}
|
|
667
722
|
});
|
|
668
723
|
|
|
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
724
|
var ColumnLayout = /* @__PURE__ */ ((ColumnLayout2) => {
|
|
713
725
|
ColumnLayout2["LEFT"] = "left";
|
|
714
726
|
ColumnLayout2["CENTER"] = "center";
|
|
@@ -733,11 +745,6 @@
|
|
|
733
745
|
})(Keys || {});
|
|
734
746
|
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
735
747
|
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
748
|
var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
742
749
|
CodeDeleteErrorType2["UNDELETEABLE"] = "undeleteable";
|
|
743
750
|
CodeDeleteErrorType2["BIND"] = "bind";
|
|
@@ -899,7 +906,6 @@
|
|
|
899
906
|
codeDsl: null,
|
|
900
907
|
id: "",
|
|
901
908
|
editable: true,
|
|
902
|
-
mode: CodeEditorMode.EDITOR,
|
|
903
909
|
combineIds: [],
|
|
904
910
|
undeletableList: [],
|
|
905
911
|
relations: {}
|
|
@@ -914,7 +920,6 @@
|
|
|
914
920
|
"setCodeDslById",
|
|
915
921
|
"setCodeEditorShowStatus",
|
|
916
922
|
"setEditStatus",
|
|
917
|
-
"setMode",
|
|
918
923
|
"setCombineIds",
|
|
919
924
|
"setUndeleteableList",
|
|
920
925
|
"deleteCodeDslByIds"
|
|
@@ -1000,12 +1005,6 @@
|
|
|
1000
1005
|
getId() {
|
|
1001
1006
|
return this.state.id;
|
|
1002
1007
|
}
|
|
1003
|
-
getMode() {
|
|
1004
|
-
return this.state.mode;
|
|
1005
|
-
}
|
|
1006
|
-
async setMode(mode) {
|
|
1007
|
-
this.state.mode = mode;
|
|
1008
|
-
}
|
|
1009
1008
|
async setCombineIds(ids) {
|
|
1010
1009
|
this.state.combineIds = ids;
|
|
1011
1010
|
}
|
|
@@ -1065,7 +1064,6 @@
|
|
|
1065
1064
|
this.state.codeDsl = null;
|
|
1066
1065
|
this.state.id = "";
|
|
1067
1066
|
this.state.editable = true;
|
|
1068
|
-
this.state.mode = CodeEditorMode.EDITOR;
|
|
1069
1067
|
this.state.combineIds = [];
|
|
1070
1068
|
this.state.undeletableList = [];
|
|
1071
1069
|
}
|
|
@@ -1089,6 +1087,7 @@
|
|
|
1089
1087
|
}
|
|
1090
1088
|
recurseMNode(node, relations) {
|
|
1091
1089
|
lodashEs.forIn(node, (value, key) => {
|
|
1090
|
+
let unConfirmedValue = { id: node.id };
|
|
1092
1091
|
if (value?.hookType === schema.HookType.CODE && !lodashEs.isEmpty(value.hookData)) {
|
|
1093
1092
|
value.hookData.forEach((relationItem) => {
|
|
1094
1093
|
if (!relationItem.codeId)
|
|
@@ -1102,6 +1101,14 @@
|
|
|
1102
1101
|
}
|
|
1103
1102
|
codeItem[node.id].push(key);
|
|
1104
1103
|
});
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
if (typeof value === "object") {
|
|
1107
|
+
unConfirmedValue = {
|
|
1108
|
+
...unConfirmedValue,
|
|
1109
|
+
...value
|
|
1110
|
+
};
|
|
1111
|
+
this.recurseMNode(unConfirmedValue, relations);
|
|
1105
1112
|
}
|
|
1106
1113
|
});
|
|
1107
1114
|
if (!lodashEs.isEmpty(node.items)) {
|
|
@@ -1374,10 +1381,14 @@
|
|
|
1374
1381
|
};
|
|
1375
1382
|
const getInitPositionStyle = (style = {}, layout) => {
|
|
1376
1383
|
if (layout === Layout.ABSOLUTE) {
|
|
1377
|
-
|
|
1384
|
+
const newStyle = {
|
|
1378
1385
|
...style,
|
|
1379
1386
|
position: "absolute"
|
|
1380
1387
|
};
|
|
1388
|
+
if (typeof newStyle.left === "undefined" && typeof newStyle.right === "undefined") {
|
|
1389
|
+
newStyle.left = 0;
|
|
1390
|
+
}
|
|
1391
|
+
return newStyle;
|
|
1381
1392
|
}
|
|
1382
1393
|
if (layout === Layout.RELATIVE) {
|
|
1383
1394
|
return getRelativeStyle(style);
|
|
@@ -1605,7 +1616,7 @@
|
|
|
1605
1616
|
config.map(async (configItem) => {
|
|
1606
1617
|
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
1607
1618
|
let pastePosition = positionClone;
|
|
1608
|
-
if (!lodashEs.isEmpty(pastePosition) && curNode
|
|
1619
|
+
if (!lodashEs.isEmpty(pastePosition) && curNode?.items) {
|
|
1609
1620
|
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
1610
1621
|
}
|
|
1611
1622
|
if (pastePosition.left && configItem.style?.left) {
|
|
@@ -1628,8 +1639,9 @@
|
|
|
1628
1639
|
...pastePosition
|
|
1629
1640
|
};
|
|
1630
1641
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1642
|
+
const root = editorService.get("root");
|
|
1643
|
+
if (utils.isPage(pasteConfig) && root) {
|
|
1644
|
+
pasteConfig.name = generatePageNameByApp(root);
|
|
1633
1645
|
}
|
|
1634
1646
|
return pasteConfig;
|
|
1635
1647
|
})
|
|
@@ -1652,9 +1664,9 @@
|
|
|
1652
1664
|
let parentNode;
|
|
1653
1665
|
if (utils.isPage(node)) {
|
|
1654
1666
|
parentNode = editorService.get("root");
|
|
1655
|
-
} else if (curNode
|
|
1667
|
+
} else if (curNode?.items) {
|
|
1656
1668
|
parentNode = curNode;
|
|
1657
|
-
} else {
|
|
1669
|
+
} else if (curNode?.id) {
|
|
1658
1670
|
parentNode = editorService.getParentById(curNode.id, false);
|
|
1659
1671
|
}
|
|
1660
1672
|
return parentNode;
|
|
@@ -1712,11 +1724,18 @@
|
|
|
1712
1724
|
set(name, value) {
|
|
1713
1725
|
const preValue = this.state[name];
|
|
1714
1726
|
this.state[name] = value;
|
|
1715
|
-
if (name === "nodes") {
|
|
1727
|
+
if (name === "nodes" && Array.isArray(value)) {
|
|
1716
1728
|
this.set("node", value[0]);
|
|
1717
1729
|
}
|
|
1718
1730
|
if (name === "root") {
|
|
1719
|
-
|
|
1731
|
+
if (Array.isArray(value)) {
|
|
1732
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u6570\u7EC4");
|
|
1733
|
+
}
|
|
1734
|
+
if (value && lodashEs.isObject(value) && !(value instanceof StageCore__default.default) && !(value instanceof Map)) {
|
|
1735
|
+
this.state.pageLength = value.items?.length || 0;
|
|
1736
|
+
} else {
|
|
1737
|
+
this.state.pageLength = 0;
|
|
1738
|
+
}
|
|
1720
1739
|
this.emit("root-change", value, preValue);
|
|
1721
1740
|
}
|
|
1722
1741
|
}
|
|
@@ -1728,16 +1747,21 @@
|
|
|
1728
1747
|
if (raw) {
|
|
1729
1748
|
root = vue.toRaw(root);
|
|
1730
1749
|
}
|
|
1750
|
+
const info = {
|
|
1751
|
+
node: null,
|
|
1752
|
+
parent: null,
|
|
1753
|
+
page: null
|
|
1754
|
+
};
|
|
1731
1755
|
if (!root)
|
|
1732
|
-
return
|
|
1756
|
+
return info;
|
|
1733
1757
|
if (id === root.id) {
|
|
1734
|
-
|
|
1758
|
+
info.node = root;
|
|
1759
|
+
return info;
|
|
1735
1760
|
}
|
|
1736
1761
|
const path = utils.getNodePath(id, root.items);
|
|
1737
1762
|
if (!path.length)
|
|
1738
|
-
return
|
|
1763
|
+
return info;
|
|
1739
1764
|
path.unshift(root);
|
|
1740
|
-
const info = {};
|
|
1741
1765
|
info.node = path[path.length - 1];
|
|
1742
1766
|
info.parent = path[path.length - 2];
|
|
1743
1767
|
path.forEach((item) => {
|
|
@@ -1753,8 +1777,6 @@
|
|
|
1753
1777
|
return node;
|
|
1754
1778
|
}
|
|
1755
1779
|
getParentById(id, raw = true) {
|
|
1756
|
-
if (!this.get("root"))
|
|
1757
|
-
return;
|
|
1758
1780
|
const { parent } = this.getNodeInfo(id, raw);
|
|
1759
1781
|
return parent;
|
|
1760
1782
|
}
|
|
@@ -1771,9 +1793,9 @@
|
|
|
1771
1793
|
}
|
|
1772
1794
|
async select(config) {
|
|
1773
1795
|
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
1774
|
-
this.set("nodes", [node]);
|
|
1775
|
-
this.set("page", page
|
|
1776
|
-
this.set("parent", parent
|
|
1796
|
+
this.set("nodes", node ? [node] : []);
|
|
1797
|
+
this.set("page", page);
|
|
1798
|
+
this.set("parent", parent);
|
|
1777
1799
|
if (page) {
|
|
1778
1800
|
historyService.changePage(vue.toRaw(page));
|
|
1779
1801
|
} else {
|
|
@@ -1787,7 +1809,7 @@
|
|
|
1787
1809
|
page,
|
|
1788
1810
|
parent
|
|
1789
1811
|
},
|
|
1790
|
-
utils.getNodePath(node.id, this.get("root")
|
|
1812
|
+
utils.getNodePath(node.id, this.get("root")?.items)
|
|
1791
1813
|
);
|
|
1792
1814
|
}
|
|
1793
1815
|
this.emit("select", node);
|
|
@@ -1809,6 +1831,10 @@
|
|
|
1809
1831
|
async selectNextPage() {
|
|
1810
1832
|
const root = vue.toRaw(this.get("root"));
|
|
1811
1833
|
const page = vue.toRaw(this.get("page"));
|
|
1834
|
+
if (!page)
|
|
1835
|
+
throw new Error("page\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1836
|
+
if (!root)
|
|
1837
|
+
throw new Error("root\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1812
1838
|
const index = getNodeIndex(page, root);
|
|
1813
1839
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
1814
1840
|
await this.select(nextPage);
|
|
@@ -1835,16 +1861,20 @@
|
|
|
1835
1861
|
}
|
|
1836
1862
|
async doAdd(node, parent) {
|
|
1837
1863
|
const root = this.get("root");
|
|
1864
|
+
if (!root)
|
|
1865
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1838
1866
|
const curNode = this.get("node");
|
|
1839
1867
|
const stage = this.get("stage");
|
|
1840
|
-
if (
|
|
1868
|
+
if (!curNode)
|
|
1869
|
+
throw new Error("\u5F53\u524D\u9009\u4E2D\u8282\u70B9\u4E3A\u7A7A");
|
|
1870
|
+
if ((parent.type === schema.NodeType.ROOT || curNode?.type === schema.NodeType.ROOT) && node.type !== schema.NodeType.PAGE) {
|
|
1841
1871
|
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
1842
1872
|
}
|
|
1843
1873
|
if (parent.id !== curNode.id && node.type !== schema.NodeType.PAGE) {
|
|
1844
1874
|
const index = parent.items.indexOf(curNode);
|
|
1845
|
-
parent
|
|
1875
|
+
parent.items?.splice(index + 1, 0, node);
|
|
1846
1876
|
} else {
|
|
1847
|
-
parent
|
|
1877
|
+
parent.items?.push(node);
|
|
1848
1878
|
}
|
|
1849
1879
|
const layout = await this.getLayout(vue.toRaw(parent), node);
|
|
1850
1880
|
node.style = getInitPositionStyle(node.style, layout);
|
|
@@ -1875,8 +1905,9 @@
|
|
|
1875
1905
|
}
|
|
1876
1906
|
const newNodes = await Promise.all(
|
|
1877
1907
|
addNodes.map((node) => {
|
|
1878
|
-
|
|
1879
|
-
|
|
1908
|
+
const root = this.get("root");
|
|
1909
|
+
if (utils.isPage(node) && root) {
|
|
1910
|
+
return this.doAdd(node, root);
|
|
1880
1911
|
}
|
|
1881
1912
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
1882
1913
|
if (!parentNode)
|
|
@@ -1905,7 +1936,7 @@
|
|
|
1905
1936
|
async doRemove(node) {
|
|
1906
1937
|
const root = this.get("root");
|
|
1907
1938
|
if (!root)
|
|
1908
|
-
throw new Error("\
|
|
1939
|
+
throw new Error("root\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1909
1940
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
1910
1941
|
if (!parent || !curNode)
|
|
1911
1942
|
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
@@ -1946,13 +1977,16 @@
|
|
|
1946
1977
|
this.emit("remove", nodes);
|
|
1947
1978
|
}
|
|
1948
1979
|
async doUpdate(config) {
|
|
1980
|
+
const root = this.get("root");
|
|
1981
|
+
if (!root)
|
|
1982
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1949
1983
|
if (!config?.id)
|
|
1950
1984
|
throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
|
|
1951
1985
|
const info = this.getNodeInfo(config.id, false);
|
|
1952
1986
|
if (!info.node)
|
|
1953
1987
|
throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config.id}\u7684\u8282\u70B9`);
|
|
1954
1988
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
1955
|
-
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node,
|
|
1989
|
+
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, root);
|
|
1956
1990
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1957
1991
|
if (lodashEs.isObject(srcValue) && Array.isArray(objValue)) {
|
|
1958
1992
|
return srcValue;
|
|
@@ -1980,14 +2014,14 @@
|
|
|
1980
2014
|
newConfig = setLayout(newConfig, newLayout);
|
|
1981
2015
|
}
|
|
1982
2016
|
parentNodeItems[index] = newConfig;
|
|
1983
|
-
const nodes = this.get("nodes")
|
|
2017
|
+
const nodes = this.get("nodes");
|
|
1984
2018
|
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
1985
2019
|
nodes.splice(targetIndex, 1, newConfig);
|
|
1986
2020
|
this.set("nodes", [...nodes]);
|
|
1987
2021
|
this.get("stage")?.update({
|
|
1988
2022
|
config: lodashEs.cloneDeep(newConfig),
|
|
1989
2023
|
parentId: parent.id,
|
|
1990
|
-
root: lodashEs.cloneDeep(
|
|
2024
|
+
root: lodashEs.cloneDeep(root)
|
|
1991
2025
|
});
|
|
1992
2026
|
if (newConfig.type === schema.NodeType.PAGE) {
|
|
1993
2027
|
this.set("page", newConfig);
|
|
@@ -2004,8 +2038,15 @@
|
|
|
2004
2038
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
2005
2039
|
}
|
|
2006
2040
|
async sort(id1, id2) {
|
|
2041
|
+
const root = this.get("root");
|
|
2042
|
+
if (!root)
|
|
2043
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
2007
2044
|
const node = this.get("node");
|
|
2045
|
+
if (!node)
|
|
2046
|
+
throw new Error("\u5F53\u524D\u8282\u70B9\u4E3A\u7A7A");
|
|
2008
2047
|
const parent = lodashEs.cloneDeep(vue.toRaw(this.get("parent")));
|
|
2048
|
+
if (!parent)
|
|
2049
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
2009
2050
|
const index2 = parent.items.findIndex((node2) => `${node2.id}` === `${id2}`);
|
|
2010
2051
|
if (index2 < 0)
|
|
2011
2052
|
return;
|
|
@@ -2016,7 +2057,7 @@
|
|
|
2016
2057
|
this.get("stage")?.update({
|
|
2017
2058
|
config: lodashEs.cloneDeep(node),
|
|
2018
2059
|
parentId: parent.id,
|
|
2019
|
-
root: lodashEs.cloneDeep(
|
|
2060
|
+
root: lodashEs.cloneDeep(root)
|
|
2020
2061
|
});
|
|
2021
2062
|
this.addModifiedNodeId(parent.id);
|
|
2022
2063
|
this.pushHistoryState();
|
|
@@ -2031,10 +2072,10 @@
|
|
|
2031
2072
|
if (!Array.isArray(config))
|
|
2032
2073
|
return;
|
|
2033
2074
|
const node = this.get("node");
|
|
2034
|
-
let parent =
|
|
2035
|
-
if (config.length === 1 && config[0].id === node
|
|
2075
|
+
let parent = null;
|
|
2076
|
+
if (config.length === 1 && config[0].id === node?.id) {
|
|
2036
2077
|
parent = this.get("parent");
|
|
2037
|
-
if (parent
|
|
2078
|
+
if (parent?.type === schema.NodeType.ROOT) {
|
|
2038
2079
|
parent = this.get("page");
|
|
2039
2080
|
}
|
|
2040
2081
|
}
|
|
@@ -2082,9 +2123,16 @@
|
|
|
2082
2123
|
return newNode;
|
|
2083
2124
|
}
|
|
2084
2125
|
async moveLayer(offset) {
|
|
2126
|
+
const root = this.get("root");
|
|
2127
|
+
if (!root)
|
|
2128
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
2085
2129
|
const parent = this.get("parent");
|
|
2130
|
+
if (!parent)
|
|
2131
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
2086
2132
|
const node = this.get("node");
|
|
2087
|
-
|
|
2133
|
+
if (!node)
|
|
2134
|
+
throw new Error("\u5F53\u524D\u8282\u70B9\u4E3A\u7A7A");
|
|
2135
|
+
const brothers = parent.items || [];
|
|
2088
2136
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
2089
2137
|
const layout = await this.getLayout(parent, node);
|
|
2090
2138
|
const isRelative = layout === Layout.RELATIVE;
|
|
@@ -2100,17 +2148,17 @@
|
|
|
2100
2148
|
this.get("stage")?.update({
|
|
2101
2149
|
config: lodashEs.cloneDeep(vue.toRaw(parent)),
|
|
2102
2150
|
parentId: grandparent?.id,
|
|
2103
|
-
root: lodashEs.cloneDeep(
|
|
2151
|
+
root: lodashEs.cloneDeep(root)
|
|
2104
2152
|
});
|
|
2105
2153
|
this.addModifiedNodeId(parent.id);
|
|
2106
2154
|
this.pushHistoryState();
|
|
2107
2155
|
}
|
|
2108
2156
|
async moveToContainer(config, targetId) {
|
|
2157
|
+
const root = lodashEs.cloneDeep(this.get("root"));
|
|
2109
2158
|
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
2110
2159
|
const target = this.getNodeById(targetId, false);
|
|
2111
2160
|
const stage = this.get("stage");
|
|
2112
|
-
if (node && parent && stage) {
|
|
2113
|
-
const root = lodashEs.cloneDeep(this.get("root"));
|
|
2161
|
+
if (root && node && parent && stage) {
|
|
2114
2162
|
const index = getNodeIndex(node, parent);
|
|
2115
2163
|
parent.items?.splice(index, 1);
|
|
2116
2164
|
await stage.remove({ id: node.id, parentId: parent.id, root });
|
|
@@ -2173,7 +2221,7 @@
|
|
|
2173
2221
|
this.set("stage", null);
|
|
2174
2222
|
this.set("highlightNode", null);
|
|
2175
2223
|
this.set("modifiedNodeIds", /* @__PURE__ */ new Map());
|
|
2176
|
-
this.set("pageLength",
|
|
2224
|
+
this.set("pageLength", 0);
|
|
2177
2225
|
}
|
|
2178
2226
|
destroy() {
|
|
2179
2227
|
this.removeAllListeners();
|
|
@@ -2185,15 +2233,11 @@
|
|
|
2185
2233
|
}
|
|
2186
2234
|
async getCodeDsl() {
|
|
2187
2235
|
const root = this.get("root");
|
|
2188
|
-
|
|
2189
|
-
return null;
|
|
2190
|
-
return root.codeBlocks || null;
|
|
2236
|
+
return root?.codeBlocks || null;
|
|
2191
2237
|
}
|
|
2192
2238
|
getCodeDslSync() {
|
|
2193
2239
|
const root = this.get("root");
|
|
2194
|
-
|
|
2195
|
-
return null;
|
|
2196
|
-
return root.codeBlocks || null;
|
|
2240
|
+
return root?.codeBlocks || null;
|
|
2197
2241
|
}
|
|
2198
2242
|
async setCodeDsl(codeDsl) {
|
|
2199
2243
|
if (!this.state.root)
|
|
@@ -2207,9 +2251,10 @@
|
|
|
2207
2251
|
}
|
|
2208
2252
|
pushHistoryState() {
|
|
2209
2253
|
const curNode = lodashEs.cloneDeep(vue.toRaw(this.get("node")));
|
|
2210
|
-
|
|
2254
|
+
const page = this.get("page");
|
|
2255
|
+
if (!this.isHistoryStateChange && curNode && page) {
|
|
2211
2256
|
historyService.push({
|
|
2212
|
-
data: lodashEs.cloneDeep(vue.toRaw(
|
|
2257
|
+
data: lodashEs.cloneDeep(vue.toRaw(page)),
|
|
2213
2258
|
modifiedNodeIds: this.get("modifiedNodeIds"),
|
|
2214
2259
|
nodeId: curNode.id
|
|
2215
2260
|
});
|
|
@@ -2668,8 +2713,10 @@
|
|
|
2668
2713
|
});
|
|
2669
2714
|
stage.on("select-parent", () => {
|
|
2670
2715
|
const parent = editorService.get("parent");
|
|
2716
|
+
if (!parent)
|
|
2717
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
2671
2718
|
editorService.select(parent);
|
|
2672
|
-
editorService.get("stage")
|
|
2719
|
+
editorService.get("stage")?.select(parent.id);
|
|
2673
2720
|
});
|
|
2674
2721
|
stage.on("change-guides", (e) => {
|
|
2675
2722
|
uiService.set("showGuides", true);
|
|
@@ -2688,8 +2735,8 @@
|
|
|
2688
2735
|
};
|
|
2689
2736
|
|
|
2690
2737
|
const _hoisted_1$d = { class: "m-editor-empty-panel" };
|
|
2691
|
-
const _hoisted_2$
|
|
2692
|
-
const _hoisted_3$
|
|
2738
|
+
const _hoisted_2$6 = { class: "m-editor-empty-content" };
|
|
2739
|
+
const _hoisted_3$3 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2693
2740
|
const __default__$l = vue.defineComponent({
|
|
2694
2741
|
name: "MEditorAddPageBox"
|
|
2695
2742
|
});
|
|
@@ -2701,22 +2748,25 @@
|
|
|
2701
2748
|
const { editorService } = services || {};
|
|
2702
2749
|
if (!editorService)
|
|
2703
2750
|
return;
|
|
2751
|
+
const root = vue.toRaw(editorService.get("root"));
|
|
2752
|
+
if (!root)
|
|
2753
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u7A7A");
|
|
2704
2754
|
editorService.add({
|
|
2705
2755
|
type: schema.NodeType.PAGE,
|
|
2706
|
-
name: generatePageNameByApp(
|
|
2756
|
+
name: generatePageNameByApp(root)
|
|
2707
2757
|
});
|
|
2708
2758
|
};
|
|
2709
2759
|
return (_ctx, _cache) => {
|
|
2710
2760
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
|
|
2711
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
2761
|
+
vue.createElementVNode("div", _hoisted_2$6, [
|
|
2712
2762
|
vue.createElementVNode("div", {
|
|
2713
2763
|
class: "m-editor-empty-button",
|
|
2714
2764
|
onClick: clickHandler
|
|
2715
2765
|
}, [
|
|
2716
2766
|
vue.createElementVNode("div", null, [
|
|
2717
|
-
vue.createVNode(_sfc_main$
|
|
2767
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
2718
2768
|
]),
|
|
2719
|
-
_hoisted_3$
|
|
2769
|
+
_hoisted_3$3
|
|
2720
2770
|
])
|
|
2721
2771
|
])
|
|
2722
2772
|
]);
|
|
@@ -2763,7 +2813,7 @@
|
|
|
2763
2813
|
columnWidth.value.right = right;
|
|
2764
2814
|
columnWidth.value.center = globalThis.document.body.clientWidth - left - right;
|
|
2765
2815
|
}
|
|
2766
|
-
uiService?.set("columnWidth", columnWidth);
|
|
2816
|
+
uiService?.set("columnWidth", columnWidth.value);
|
|
2767
2817
|
},
|
|
2768
2818
|
{
|
|
2769
2819
|
immediate: true
|
|
@@ -2783,8 +2833,11 @@
|
|
|
2783
2833
|
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
2784
2834
|
}
|
|
2785
2835
|
);
|
|
2786
|
-
const columnWidthChange = (
|
|
2787
|
-
|
|
2836
|
+
const columnWidthChange = (columnW) => {
|
|
2837
|
+
columnWidth.value.left = columnW.left;
|
|
2838
|
+
columnWidth.value.center = columnW.center;
|
|
2839
|
+
columnWidth.value.right = columnW.right;
|
|
2840
|
+
uiService?.set("columnWidth", columnW);
|
|
2788
2841
|
};
|
|
2789
2842
|
const saveCode = (value) => {
|
|
2790
2843
|
try {
|
|
@@ -2803,7 +2856,7 @@
|
|
|
2803
2856
|
"init-values": vue.unref(root),
|
|
2804
2857
|
options: __props.codeOptions,
|
|
2805
2858
|
onSave: saveCode
|
|
2806
|
-
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2859
|
+
}, null, 8, ["init-values", "options"])) : (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
2807
2860
|
key: 1,
|
|
2808
2861
|
class: "m-editor-content",
|
|
2809
2862
|
"left-class": "m-editor-framework-left",
|
|
@@ -2848,7 +2901,7 @@
|
|
|
2848
2901
|
key: 1,
|
|
2849
2902
|
class: "menu-item-text"
|
|
2850
2903
|
};
|
|
2851
|
-
const _hoisted_2$
|
|
2904
|
+
const _hoisted_2$5 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2852
2905
|
const __default__$j = vue.defineComponent({
|
|
2853
2906
|
name: "MEditorToolButton"
|
|
2854
2907
|
});
|
|
@@ -2942,7 +2995,7 @@
|
|
|
2942
2995
|
disabled: vue.unref(disabled)
|
|
2943
2996
|
}, {
|
|
2944
2997
|
default: vue.withCtx(() => [
|
|
2945
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
2998
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
2946
2999
|
key: 0,
|
|
2947
3000
|
icon: __props.data.icon
|
|
2948
3001
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2959,7 +3012,7 @@
|
|
|
2959
3012
|
disabled: vue.unref(disabled)
|
|
2960
3013
|
}, {
|
|
2961
3014
|
default: vue.withCtx(() => [
|
|
2962
|
-
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3015
|
+
__props.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
2963
3016
|
key: 0,
|
|
2964
3017
|
icon: __props.data.icon
|
|
2965
3018
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -2992,7 +3045,7 @@
|
|
|
2992
3045
|
})) : vue.createCommentVNode("", true)
|
|
2993
3046
|
]),
|
|
2994
3047
|
default: vue.withCtx(() => [
|
|
2995
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
3048
|
+
vue.createElementVNode("span", _hoisted_2$5, [
|
|
2996
3049
|
vue.createTextVNode(vue.toDisplayString(__props.data.text), 1),
|
|
2997
3050
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
2998
3051
|
default: vue.withCtx(() => [
|
|
@@ -3057,7 +3110,10 @@
|
|
|
3057
3110
|
icon: vue.markRaw(iconsVue.Delete),
|
|
3058
3111
|
tooltip: `\u522A\u9664(Delete)`,
|
|
3059
3112
|
disabled: () => services?.editorService.get("node")?.type === schema.NodeType.PAGE,
|
|
3060
|
-
handler: () =>
|
|
3113
|
+
handler: () => {
|
|
3114
|
+
const node = services?.editorService.get("node");
|
|
3115
|
+
node && services?.editorService.remove(node);
|
|
3116
|
+
}
|
|
3061
3117
|
});
|
|
3062
3118
|
break;
|
|
3063
3119
|
case "undo":
|
|
@@ -3194,9 +3250,7 @@
|
|
|
3194
3250
|
const curFormConfig = vue.ref([]);
|
|
3195
3251
|
const services = vue.inject("services");
|
|
3196
3252
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3197
|
-
const propsPanelSize = vue.computed(
|
|
3198
|
-
() => services?.uiService.get("propsPanelSize") || "small"
|
|
3199
|
-
);
|
|
3253
|
+
const propsPanelSize = vue.computed(() => services?.uiService.get("propsPanelSize") || "small");
|
|
3200
3254
|
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
3201
3255
|
const init = async () => {
|
|
3202
3256
|
if (!node.value) {
|
|
@@ -3253,8 +3307,8 @@
|
|
|
3253
3307
|
key: 0,
|
|
3254
3308
|
class: "m-editor-content-bottom"
|
|
3255
3309
|
};
|
|
3256
|
-
const _hoisted_2$
|
|
3257
|
-
const _hoisted_3$
|
|
3310
|
+
const _hoisted_2$4 = /* @__PURE__ */ vue.createTextVNode("\u786E\u8BA4");
|
|
3311
|
+
const _hoisted_3$2 = /* @__PURE__ */ vue.createTextVNode("\u5173\u95ED");
|
|
3258
3312
|
const _hoisted_4$2 = {
|
|
3259
3313
|
key: 1,
|
|
3260
3314
|
class: "m-editor-content-bottom"
|
|
@@ -3273,7 +3327,7 @@
|
|
|
3273
3327
|
codeOptions: null,
|
|
3274
3328
|
language: null
|
|
3275
3329
|
},
|
|
3276
|
-
emits: ["
|
|
3330
|
+
emits: ["close", "saveAndClose"],
|
|
3277
3331
|
setup(__props, { emit }) {
|
|
3278
3332
|
const props = __props;
|
|
3279
3333
|
const services = vue.inject("services");
|
|
@@ -3306,12 +3360,6 @@
|
|
|
3306
3360
|
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3307
3361
|
design.tMagicMessage.success(`\u4EE3\u7801\u8349\u7A3F\u4FDD\u5B58\u6210\u529F ${utils.datetimeFormatter(new Date())}`);
|
|
3308
3362
|
};
|
|
3309
|
-
const saveCode = () => {
|
|
3310
|
-
if (!codeEditor.value || !props.editable)
|
|
3311
|
-
return;
|
|
3312
|
-
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3313
|
-
emit("save", editorContent.value);
|
|
3314
|
-
};
|
|
3315
3363
|
const saveAndClose = () => {
|
|
3316
3364
|
if (!codeEditor.value || !props.editable)
|
|
3317
3365
|
return;
|
|
@@ -3345,7 +3393,7 @@
|
|
|
3345
3393
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3346
3394
|
class: vue.normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3347
3395
|
}, [
|
|
3348
|
-
vue.createVNode(_sfc_main$
|
|
3396
|
+
vue.createVNode(_sfc_main$p, {
|
|
3349
3397
|
ref_key: "codeEditor",
|
|
3350
3398
|
ref: codeEditor,
|
|
3351
3399
|
class: "m-editor-container",
|
|
@@ -3368,10 +3416,10 @@
|
|
|
3368
3416
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3369
3417
|
type: "primary",
|
|
3370
3418
|
class: "button",
|
|
3371
|
-
onClick:
|
|
3419
|
+
onClick: saveAndClose
|
|
3372
3420
|
}, {
|
|
3373
3421
|
default: vue.withCtx(() => [
|
|
3374
|
-
_hoisted_2$
|
|
3422
|
+
_hoisted_2$4
|
|
3375
3423
|
]),
|
|
3376
3424
|
_: 1
|
|
3377
3425
|
}),
|
|
@@ -3381,7 +3429,7 @@
|
|
|
3381
3429
|
onClick: close
|
|
3382
3430
|
}, {
|
|
3383
3431
|
default: vue.withCtx(() => [
|
|
3384
|
-
_hoisted_3$
|
|
3432
|
+
_hoisted_3$2
|
|
3385
3433
|
]),
|
|
3386
3434
|
_: 1
|
|
3387
3435
|
})
|
|
@@ -3413,9 +3461,9 @@
|
|
|
3413
3461
|
});
|
|
3414
3462
|
|
|
3415
3463
|
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3416
|
-
const _hoisted_2$
|
|
3417
|
-
const _hoisted_3$
|
|
3418
|
-
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u53C2\u6570
|
|
3464
|
+
const _hoisted_2$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3465
|
+
const _hoisted_3$1 = { class: "code-name-wrapper" };
|
|
3466
|
+
const _hoisted_4$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "\u53C2\u6570", -1);
|
|
3419
3467
|
const __default__$f = vue.defineComponent({
|
|
3420
3468
|
name: "MEditorFunctionEditor"
|
|
3421
3469
|
});
|
|
@@ -3427,22 +3475,58 @@
|
|
|
3427
3475
|
content: null,
|
|
3428
3476
|
editable: { type: Boolean, default: true },
|
|
3429
3477
|
autoSaveDraft: { type: Boolean, default: true },
|
|
3430
|
-
codeOptions: null
|
|
3478
|
+
codeOptions: null,
|
|
3479
|
+
paramsColConfig: null
|
|
3431
3480
|
},
|
|
3432
3481
|
emits: ["change", "field-input"],
|
|
3433
3482
|
setup(__props, { emit }) {
|
|
3434
3483
|
const props = __props;
|
|
3484
|
+
const defaultParamColConfig = {
|
|
3485
|
+
type: "row",
|
|
3486
|
+
label: "\u53C2\u6570\u7C7B\u578B",
|
|
3487
|
+
items: [
|
|
3488
|
+
{
|
|
3489
|
+
text: "\u53C2\u6570\u7C7B\u578B",
|
|
3490
|
+
labelWidth: "70px",
|
|
3491
|
+
type: "select",
|
|
3492
|
+
name: "type",
|
|
3493
|
+
options: [
|
|
3494
|
+
{
|
|
3495
|
+
text: "\u6570\u5B57",
|
|
3496
|
+
label: "\u6570\u5B57",
|
|
3497
|
+
value: "number"
|
|
3498
|
+
},
|
|
3499
|
+
{
|
|
3500
|
+
text: "\u5B57\u7B26\u4E32",
|
|
3501
|
+
label: "\u5B57\u7B26\u4E32",
|
|
3502
|
+
value: "text"
|
|
3503
|
+
}
|
|
3504
|
+
]
|
|
3505
|
+
}
|
|
3506
|
+
]
|
|
3507
|
+
};
|
|
3508
|
+
const paramsColConfig = props.paramsColConfig || defaultParamColConfig;
|
|
3435
3509
|
const tableConfig = {
|
|
3510
|
+
type: "table",
|
|
3436
3511
|
border: true,
|
|
3437
3512
|
enableFullscreen: false,
|
|
3438
3513
|
name: "params",
|
|
3439
|
-
maxHeight: "
|
|
3514
|
+
maxHeight: "300px",
|
|
3515
|
+
dropSort: false,
|
|
3440
3516
|
items: [
|
|
3441
3517
|
{
|
|
3442
3518
|
type: "text",
|
|
3443
3519
|
label: "\u53C2\u6570\u540D",
|
|
3444
|
-
name: "name"
|
|
3445
|
-
|
|
3520
|
+
name: "name",
|
|
3521
|
+
width: 200
|
|
3522
|
+
},
|
|
3523
|
+
{
|
|
3524
|
+
type: "text",
|
|
3525
|
+
label: "\u53C2\u6570\u6CE8\u91CA",
|
|
3526
|
+
name: "tip",
|
|
3527
|
+
width: 200
|
|
3528
|
+
},
|
|
3529
|
+
paramsColConfig
|
|
3446
3530
|
]
|
|
3447
3531
|
};
|
|
3448
3532
|
const services = vue.inject("services");
|
|
@@ -3460,7 +3544,7 @@
|
|
|
3460
3544
|
codeContent.value = props.content;
|
|
3461
3545
|
});
|
|
3462
3546
|
const initTableModel = () => {
|
|
3463
|
-
const codeDsl = services?.codeBlockService.getCodeDslSync();
|
|
3547
|
+
const codeDsl = lodashEs.cloneDeep(services?.codeBlockService.getCodeDslSync());
|
|
3464
3548
|
if (!codeDsl)
|
|
3465
3549
|
return;
|
|
3466
3550
|
tableModel.value = {
|
|
@@ -3505,7 +3589,7 @@
|
|
|
3505
3589
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
3506
3590
|
header: vue.withCtx(() => [
|
|
3507
3591
|
vue.createElementVNode("div", _hoisted_1$8, [
|
|
3508
|
-
_hoisted_2$
|
|
3592
|
+
_hoisted_2$3,
|
|
3509
3593
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3510
3594
|
class: "code-name-input",
|
|
3511
3595
|
modelValue: codeName.value,
|
|
@@ -3513,10 +3597,10 @@
|
|
|
3513
3597
|
disabled: !__props.editable
|
|
3514
3598
|
}, null, 8, ["modelValue", "disabled"])
|
|
3515
3599
|
]),
|
|
3516
|
-
vue.createElementVNode("div", _hoisted_3$
|
|
3600
|
+
vue.createElementVNode("div", _hoisted_3$1, [
|
|
3517
3601
|
_hoisted_4$1,
|
|
3518
3602
|
vue.createVNode(_component_m_form_table, {
|
|
3519
|
-
style: { "width": "
|
|
3603
|
+
style: { "width": "800px" },
|
|
3520
3604
|
config: tableConfig,
|
|
3521
3605
|
model: tableModel.value,
|
|
3522
3606
|
enableToggleMode: false,
|
|
@@ -3534,7 +3618,6 @@
|
|
|
3534
3618
|
autoSaveDraft: __props.autoSaveDraft,
|
|
3535
3619
|
codeOptions: __props.codeOptions,
|
|
3536
3620
|
language: "javascript",
|
|
3537
|
-
onSave: saveCode,
|
|
3538
3621
|
onSaveAndClose: saveAndClose,
|
|
3539
3622
|
onClose: close
|
|
3540
3623
|
}, null, 8, ["id", "content", "editable", "autoSaveDraft", "codeOptions"])
|
|
@@ -3545,14 +3628,18 @@
|
|
|
3545
3628
|
}
|
|
3546
3629
|
});
|
|
3547
3630
|
|
|
3548
|
-
const _hoisted_1$7 =
|
|
3549
|
-
|
|
3550
|
-
|
|
3631
|
+
const _hoisted_1$7 = {
|
|
3632
|
+
key: 0,
|
|
3633
|
+
class: "m-editor-code-block-editor-panel"
|
|
3634
|
+
};
|
|
3551
3635
|
const __default__$e = vue.defineComponent({
|
|
3552
3636
|
name: "MEditorCodeBlockEditor"
|
|
3553
3637
|
});
|
|
3554
3638
|
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
3555
3639
|
...__default__$e,
|
|
3640
|
+
props: {
|
|
3641
|
+
paramsColConfig: null
|
|
3642
|
+
},
|
|
3556
3643
|
setup(__props) {
|
|
3557
3644
|
const services = vue.inject("services");
|
|
3558
3645
|
const codeOptions = vue.inject("codeOptions", {});
|
|
@@ -3562,7 +3649,6 @@
|
|
|
3562
3649
|
const state = vue.reactive({
|
|
3563
3650
|
codeList: []
|
|
3564
3651
|
});
|
|
3565
|
-
const mode = vue.computed(() => services?.codeBlockService.getMode());
|
|
3566
3652
|
const id = vue.computed(() => services?.codeBlockService.getId() || "");
|
|
3567
3653
|
const editable = vue.computed(() => services?.codeBlockService.getEditStatus());
|
|
3568
3654
|
const selectedIds = vue.computed(() => services?.codeBlockService.getCombineIds() || []);
|
|
@@ -3585,10 +3671,6 @@
|
|
|
3585
3671
|
});
|
|
3586
3672
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3587
3673
|
});
|
|
3588
|
-
const selectHandler = (data) => {
|
|
3589
|
-
services?.codeBlockService.setId(data.id);
|
|
3590
|
-
currentTitle.value = data.name;
|
|
3591
|
-
};
|
|
3592
3674
|
return (_ctx, _cache) => {
|
|
3593
3675
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDialog), {
|
|
3594
3676
|
"model-value": true,
|
|
@@ -3600,61 +3682,29 @@
|
|
|
3600
3682
|
"show-close": false
|
|
3601
3683
|
}, {
|
|
3602
3684
|
default: vue.withCtx(() => [
|
|
3603
|
-
vue.createVNode(_sfc_main$
|
|
3685
|
+
vue.createVNode(_sfc_main$n, {
|
|
3604
3686
|
left: left.value,
|
|
3605
3687
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3606
3688
|
"min-left": 45,
|
|
3607
3689
|
class: "code-editor-layout"
|
|
3608
|
-
},
|
|
3690
|
+
}, {
|
|
3609
3691
|
center: vue.withCtx(() => [
|
|
3610
|
-
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div",
|
|
3611
|
-
key: 0,
|
|
3612
|
-
class: vue.normalizeClass([
|
|
3613
|
-
vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? "m-editor-code-block-editor-panel-list-mode" : "m-editor-code-block-editor-panel"
|
|
3614
|
-
])
|
|
3615
|
-
}, [
|
|
3692
|
+
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
|
|
3616
3693
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: vue.unref(id) }),
|
|
3617
3694
|
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$g, {
|
|
3618
3695
|
key: 0,
|
|
3619
3696
|
id: vue.unref(id),
|
|
3620
3697
|
name: codeConfig.value.name,
|
|
3621
3698
|
content: codeConfig.value.content,
|
|
3699
|
+
paramsColConfig: __props.paramsColConfig,
|
|
3622
3700
|
editable: !!vue.unref(editable),
|
|
3623
|
-
autoSaveDraft:
|
|
3701
|
+
autoSaveDraft: true,
|
|
3624
3702
|
codeOptions: vue.unref(codeOptions)
|
|
3625
|
-
}, null, 8, ["id", "name", "content", "
|
|
3626
|
-
]
|
|
3703
|
+
}, null, 8, ["id", "name", "content", "paramsColConfig", "editable", "codeOptions"])) : vue.createCommentVNode("", true)
|
|
3704
|
+
])) : vue.createCommentVNode("", true)
|
|
3627
3705
|
]),
|
|
3628
|
-
_:
|
|
3629
|
-
}, [
|
|
3630
|
-
vue.unref(mode) === vue.unref(CodeEditorMode).LIST ? {
|
|
3631
|
-
name: "left",
|
|
3632
|
-
fn: vue.withCtx(() => [
|
|
3633
|
-
!vue.unref(lodashEs.isEmpty)(state.codeList) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTree), {
|
|
3634
|
-
key: 0,
|
|
3635
|
-
class: "side-tree",
|
|
3636
|
-
"node-key": "id",
|
|
3637
|
-
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3638
|
-
data: state.codeList,
|
|
3639
|
-
"highlight-current": true,
|
|
3640
|
-
"current-node-key": state.codeList[0].id,
|
|
3641
|
-
onNodeClick: selectHandler
|
|
3642
|
-
}, {
|
|
3643
|
-
default: vue.withCtx(({ data }) => [
|
|
3644
|
-
vue.createElementVNode("div", {
|
|
3645
|
-
id: data.id,
|
|
3646
|
-
class: "list-container"
|
|
3647
|
-
}, [
|
|
3648
|
-
vue.createElementVNode("div", _hoisted_2$3, [
|
|
3649
|
-
vue.createElementVNode("div", _hoisted_3$1, vue.toDisplayString(data.name) + "\uFF08" + vue.toDisplayString(data.id) + "\uFF09", 1)
|
|
3650
|
-
])
|
|
3651
|
-
], 8, _hoisted_1$7)
|
|
3652
|
-
]),
|
|
3653
|
-
_: 1
|
|
3654
|
-
}, 8, ["data", "current-node-key"])) : vue.createCommentVNode("", true)
|
|
3655
|
-
])
|
|
3656
|
-
} : void 0
|
|
3657
|
-
]), 1032, ["left"])
|
|
3706
|
+
_: 3
|
|
3707
|
+
}, 8, ["left"])
|
|
3658
3708
|
]),
|
|
3659
3709
|
_: 3
|
|
3660
3710
|
}, 8, ["title"]);
|
|
@@ -3690,7 +3740,8 @@
|
|
|
3690
3740
|
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
3691
3741
|
...__default__$d,
|
|
3692
3742
|
props: {
|
|
3693
|
-
customError: null
|
|
3743
|
+
customError: null,
|
|
3744
|
+
paramsColConfig: null
|
|
3694
3745
|
},
|
|
3695
3746
|
setup(__props) {
|
|
3696
3747
|
const props = __props;
|
|
@@ -3749,13 +3800,11 @@
|
|
|
3749
3800
|
}`,
|
|
3750
3801
|
params: []
|
|
3751
3802
|
};
|
|
3752
|
-
await codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3753
3803
|
const id = await codeBlockService.getUniqueId();
|
|
3754
3804
|
await codeBlockService.setCodeDslById(id, codeConfig);
|
|
3755
3805
|
codeBlockService.setCodeEditorContent(true, id);
|
|
3756
3806
|
};
|
|
3757
3807
|
const editCode = async (key) => {
|
|
3758
|
-
await services?.codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3759
3808
|
services?.codeBlockService.setCodeEditorContent(true, key);
|
|
3760
3809
|
};
|
|
3761
3810
|
const deleteCode = (key) => {
|
|
@@ -3853,7 +3902,7 @@
|
|
|
3853
3902
|
placement: "bottom"
|
|
3854
3903
|
}, {
|
|
3855
3904
|
default: vue.withCtx(() => [
|
|
3856
|
-
vue.createVNode(_sfc_main$
|
|
3905
|
+
vue.createVNode(_sfc_main$s, {
|
|
3857
3906
|
icon: vue.unref(editable) ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3858
3907
|
class: "edit-icon",
|
|
3859
3908
|
onClick: vue.withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3868,7 +3917,7 @@
|
|
|
3868
3917
|
placement: "bottom"
|
|
3869
3918
|
}, {
|
|
3870
3919
|
default: vue.withCtx(() => [
|
|
3871
|
-
vue.createVNode(_sfc_main$
|
|
3920
|
+
vue.createVNode(_sfc_main$s, {
|
|
3872
3921
|
icon: vue.unref(iconsVue.Link),
|
|
3873
3922
|
class: "edit-icon",
|
|
3874
3923
|
onClick: vue.withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
@@ -3883,7 +3932,7 @@
|
|
|
3883
3932
|
placement: "bottom"
|
|
3884
3933
|
}, {
|
|
3885
3934
|
default: vue.withCtx(() => [
|
|
3886
|
-
vue.createVNode(_sfc_main$
|
|
3935
|
+
vue.createVNode(_sfc_main$s, {
|
|
3887
3936
|
icon: vue.unref(iconsVue.Close),
|
|
3888
3937
|
class: "edit-icon",
|
|
3889
3938
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3921,12 +3970,15 @@
|
|
|
3921
3970
|
]),
|
|
3922
3971
|
_: 3
|
|
3923
3972
|
}),
|
|
3924
|
-
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, {
|
|
3973
|
+
vue.unref(isShowCodeBlockEditor) ? (vue.openBlock(), vue.createBlock(_sfc_main$f, {
|
|
3974
|
+
key: 0,
|
|
3975
|
+
paramsColConfig: __props.paramsColConfig
|
|
3976
|
+
}, {
|
|
3925
3977
|
"code-block-edit-panel-header": vue.withCtx(({ id }) => [
|
|
3926
3978
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
3927
3979
|
]),
|
|
3928
3980
|
_: 3
|
|
3929
|
-
})) : vue.createCommentVNode("", true)
|
|
3981
|
+
}, 8, ["paramsColConfig"])) : vue.createCommentVNode("", true)
|
|
3930
3982
|
]);
|
|
3931
3983
|
};
|
|
3932
3984
|
}
|
|
@@ -4026,7 +4078,7 @@
|
|
|
4026
4078
|
name: `${index}`
|
|
4027
4079
|
}, {
|
|
4028
4080
|
title: vue.withCtx(() => [
|
|
4029
|
-
vue.createVNode(_sfc_main$
|
|
4081
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
4030
4082
|
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
4031
4083
|
]),
|
|
4032
4084
|
default: vue.withCtx(() => [
|
|
@@ -4041,7 +4093,7 @@
|
|
|
4041
4093
|
onDrag: dragHandler
|
|
4042
4094
|
}, [
|
|
4043
4095
|
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4044
|
-
vue.createVNode(_sfc_main$
|
|
4096
|
+
vue.createVNode(_sfc_main$s, {
|
|
4045
4097
|
icon: item.icon
|
|
4046
4098
|
}, null, 8, ["icon"]),
|
|
4047
4099
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
@@ -4424,13 +4476,13 @@
|
|
|
4424
4476
|
});
|
|
4425
4477
|
vue.watch(isMultiSelect, (isMultiSelect2) => {
|
|
4426
4478
|
if (!isMultiSelect2) {
|
|
4427
|
-
currentNodeKey.value = editorService?.get("node")
|
|
4479
|
+
currentNodeKey.value = editorService?.get("node")?.id;
|
|
4428
4480
|
tree.value?.setCurrentKey(currentNodeKey.value);
|
|
4429
4481
|
}
|
|
4430
4482
|
});
|
|
4431
4483
|
const editorServiceRemoveHandler = () => {
|
|
4432
4484
|
setTimeout(() => {
|
|
4433
|
-
tree.value?.getNode(editorService?.get("node")
|
|
4485
|
+
tree.value?.getNode(editorService?.get("node")?.id)?.updateChildren();
|
|
4434
4486
|
}, 0);
|
|
4435
4487
|
};
|
|
4436
4488
|
const windowBlurHandler = () => {
|
|
@@ -4636,7 +4688,7 @@
|
|
|
4636
4688
|
(vue.openBlock(), vue.createElementBlock("div", {
|
|
4637
4689
|
key: config.text
|
|
4638
4690
|
}, [
|
|
4639
|
-
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4691
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
4640
4692
|
key: 0,
|
|
4641
4693
|
icon: config.icon
|
|
4642
4694
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -4836,9 +4888,12 @@
|
|
|
4836
4888
|
const addPage = () => {
|
|
4837
4889
|
if (!editorService)
|
|
4838
4890
|
return;
|
|
4891
|
+
const root = vue.toRaw(editorService.get("root"));
|
|
4892
|
+
if (!root)
|
|
4893
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u7A7A");
|
|
4839
4894
|
const pageConfig = {
|
|
4840
4895
|
type: schema.NodeType.PAGE,
|
|
4841
|
-
name: generatePageNameByApp(
|
|
4896
|
+
name: generatePageNameByApp(root)
|
|
4842
4897
|
};
|
|
4843
4898
|
editorService.add(pageConfig);
|
|
4844
4899
|
};
|
|
@@ -4854,14 +4909,14 @@
|
|
|
4854
4909
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4855
4910
|
onClick: addPage
|
|
4856
4911
|
}, [
|
|
4857
|
-
vue.createVNode(_sfc_main$
|
|
4912
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4858
4913
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1)),
|
|
4859
4914
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4860
4915
|
key: 2,
|
|
4861
4916
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4862
4917
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4863
4918
|
}, [
|
|
4864
|
-
vue.createVNode(_sfc_main$
|
|
4919
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
4865
4920
|
])) : vue.createCommentVNode("", true),
|
|
4866
4921
|
vue.unref(pageLength) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4867
4922
|
key: 3,
|
|
@@ -4877,7 +4932,7 @@
|
|
|
4877
4932
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4878
4933
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4879
4934
|
}, [
|
|
4880
|
-
vue.createVNode(_sfc_main$
|
|
4935
|
+
vue.createVNode(_sfc_main$s, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
4881
4936
|
])) : vue.createCommentVNode("", true)
|
|
4882
4937
|
], 512);
|
|
4883
4938
|
};
|
|
@@ -5422,7 +5477,7 @@
|
|
|
5422
5477
|
type: "button",
|
|
5423
5478
|
text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
|
|
5424
5479
|
handler: () => {
|
|
5425
|
-
editorService?.get("stage")
|
|
5480
|
+
editorService?.get("stage")?.clearGuides();
|
|
5426
5481
|
}
|
|
5427
5482
|
},
|
|
5428
5483
|
...props.stageContentMenu
|
|
@@ -5473,7 +5528,8 @@
|
|
|
5473
5528
|
const stageWrap = vue.ref();
|
|
5474
5529
|
const stageContainer = vue.ref();
|
|
5475
5530
|
const menu = vue.ref();
|
|
5476
|
-
const
|
|
5531
|
+
const nodes = vue.computed(() => services?.editorService.get("nodes") || []);
|
|
5532
|
+
const isMultiSelect = vue.computed(() => nodes.value.length > 1);
|
|
5477
5533
|
const stageRect = vue.computed(() => services?.uiService.get("stageRect"));
|
|
5478
5534
|
const stageContainerRect = vue.computed(() => services?.uiService.get("stageContainerRect"));
|
|
5479
5535
|
const root = vue.computed(() => services?.editorService.get("root"));
|
|
@@ -6103,11 +6159,11 @@
|
|
|
6103
6159
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
6104
6160
|
setConfig(option);
|
|
6105
6161
|
app.component(Editor.name, Editor);
|
|
6106
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
6162
|
+
app.component("m-fields-ui-select", _sfc_main$q);
|
|
6107
6163
|
app.component("m-fields-code-link", _sfc_main$t);
|
|
6108
6164
|
app.component("m-fields-vs-code", _sfc_main$u);
|
|
6109
|
-
app.component("magic-code-editor", _sfc_main$
|
|
6110
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
6165
|
+
app.component("magic-code-editor", _sfc_main$p);
|
|
6166
|
+
app.component("m-fields-code-select", _sfc_main$r);
|
|
6111
6167
|
}
|
|
6112
6168
|
};
|
|
6113
6169
|
|
|
@@ -6115,21 +6171,20 @@
|
|
|
6115
6171
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
6116
6172
|
exports.CodeBlockList = _sfc_main$e;
|
|
6117
6173
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
6118
|
-
exports.
|
|
6119
|
-
exports.CodeSelect = _sfc_main$s;
|
|
6174
|
+
exports.CodeSelect = _sfc_main$r;
|
|
6120
6175
|
exports.ColumnLayout = ColumnLayout;
|
|
6121
6176
|
exports.ComponentListPanel = _sfc_main$d;
|
|
6122
6177
|
exports.ContentMenu = _sfc_main$c;
|
|
6123
6178
|
exports.Fixed2Other = Fixed2Other;
|
|
6124
6179
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
6125
|
-
exports.Icon = _sfc_main$
|
|
6180
|
+
exports.Icon = _sfc_main$s;
|
|
6126
6181
|
exports.Keys = Keys;
|
|
6127
6182
|
exports.LayerOffset = LayerOffset;
|
|
6128
6183
|
exports.LayerPanel = _sfc_main$a;
|
|
6129
6184
|
exports.Layout = Layout;
|
|
6130
|
-
exports.LayoutContainer = _sfc_main$
|
|
6185
|
+
exports.LayoutContainer = _sfc_main$n;
|
|
6131
6186
|
exports.PropsPanel = _sfc_main$i;
|
|
6132
|
-
exports.TMagicCodeEditor = _sfc_main$
|
|
6187
|
+
exports.TMagicCodeEditor = _sfc_main$p;
|
|
6133
6188
|
exports.TMagicEditor = Editor;
|
|
6134
6189
|
exports.ToolButton = _sfc_main$k;
|
|
6135
6190
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|