@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
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch,
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, withCtx, createVNode, createElementVNode, createElementBlock, normalizeClass, resolveDynamicComponent, toRaw, inject, createCommentVNode, ref, withModifiers, createTextVNode, toDisplayString, onMounted, onUnmounted, renderSlot, Fragment, createSlots, renderList, normalizeProps, mergeProps, markRaw, getCurrentInstance, watchEffect, provide, withDirectives, Teleport, vShow, nextTick, toHandlers } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
|
-
import {
|
|
3
|
+
import { Edit, View, Delete, Close, Plus, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Link, Search, Files, CopyDocument, Coin, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Top, Bottom } from '@element-plus/icons-vue';
|
|
4
|
+
import { isEmpty, map, throttle, pick, omit, keys, cloneDeep, forIn, mergeWith, isObject, uniq, difference, union } from 'lodash-es';
|
|
4
5
|
import { createValues, MForm } from '@tmagic/form';
|
|
5
6
|
import { HookType, NodeType } from '@tmagic/schema';
|
|
6
|
-
import {
|
|
7
|
-
import { TMagicButton, TMagicTooltip, TMagicIcon, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, tMagicMessageBox, TMagicCard, TMagicInput, TMagicDialog, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicTabs, TMagicPopover } from '@tmagic/design';
|
|
7
|
+
import { TMagicIcon, TMagicButton, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, tMagicMessageBox, TMagicCard, TMagicInput, TMagicDialog, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicTabs, TMagicPopover } from '@tmagic/design';
|
|
8
8
|
import * as monaco from 'monaco-editor';
|
|
9
9
|
import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
10
10
|
import Gesto from 'gesto';
|
|
@@ -119,12 +119,55 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
const _hoisted_1$g =
|
|
122
|
+
const _hoisted_1$g = ["src"];
|
|
123
123
|
const __default__$r = defineComponent({
|
|
124
|
-
name: "
|
|
124
|
+
name: "MEditorIcon"
|
|
125
125
|
});
|
|
126
126
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
127
127
|
...__default__$r,
|
|
128
|
+
props: {
|
|
129
|
+
icon: null
|
|
130
|
+
},
|
|
131
|
+
setup(__props) {
|
|
132
|
+
return (_ctx, _cache) => {
|
|
133
|
+
return !__props.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
134
|
+
key: 0,
|
|
135
|
+
class: "magic-editor-icon"
|
|
136
|
+
}, {
|
|
137
|
+
default: withCtx(() => [
|
|
138
|
+
createVNode(unref(Edit))
|
|
139
|
+
]),
|
|
140
|
+
_: 1
|
|
141
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
142
|
+
key: 1,
|
|
143
|
+
class: "magic-editor-icon"
|
|
144
|
+
}, {
|
|
145
|
+
default: withCtx(() => [
|
|
146
|
+
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$g)
|
|
147
|
+
]),
|
|
148
|
+
_: 1
|
|
149
|
+
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
150
|
+
key: 2,
|
|
151
|
+
class: normalizeClass(["magic-editor-icon", __props.icon])
|
|
152
|
+
}, null, 2)) : (openBlock(), createBlock(unref(TMagicIcon), {
|
|
153
|
+
key: 3,
|
|
154
|
+
class: "magic-editor-icon"
|
|
155
|
+
}, {
|
|
156
|
+
default: withCtx(() => [
|
|
157
|
+
(openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
|
|
158
|
+
]),
|
|
159
|
+
_: 1
|
|
160
|
+
}));
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const _hoisted_1$f = { class: "m-fields-code-select" };
|
|
166
|
+
const __default__$q = defineComponent({
|
|
167
|
+
name: "MEditorCodeSelect"
|
|
168
|
+
});
|
|
169
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
170
|
+
...__default__$q,
|
|
128
171
|
props: {
|
|
129
172
|
config: null,
|
|
130
173
|
model: null,
|
|
@@ -140,9 +183,10 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
140
183
|
const codeDsl = computed(() => services?.codeBlockService.getCodeDslSync());
|
|
141
184
|
const tableConfig = computed(() => {
|
|
142
185
|
const defaultConfig = {
|
|
143
|
-
dropSort:
|
|
186
|
+
dropSort: false,
|
|
144
187
|
enableFullscreen: false,
|
|
145
188
|
border: true,
|
|
189
|
+
operateColWidth: 60,
|
|
146
190
|
items: [
|
|
147
191
|
{
|
|
148
192
|
type: "select",
|
|
@@ -169,9 +213,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
169
213
|
defaultValue: {},
|
|
170
214
|
itemsFunction: (row) => {
|
|
171
215
|
const paramsConfig = getParamsConfig(row.codeId);
|
|
172
|
-
if (!row.params)
|
|
173
|
-
row.params = {};
|
|
174
|
-
if (isEmpty(row.params)) {
|
|
216
|
+
if (isEmpty(row.params) || !row.params) {
|
|
175
217
|
createValues(mForm, paramsConfig, {}, row.params);
|
|
176
218
|
}
|
|
177
219
|
return paramsConfig;
|
|
@@ -184,6 +226,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
184
226
|
...props.config.tableConfig
|
|
185
227
|
};
|
|
186
228
|
});
|
|
229
|
+
const editable = computed(() => services?.codeBlockService.getEditStatus());
|
|
187
230
|
watch(
|
|
188
231
|
() => props.model[props.name],
|
|
189
232
|
(value) => {
|
|
@@ -208,15 +251,17 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
208
251
|
if (isEmpty(paramStatements))
|
|
209
252
|
return [];
|
|
210
253
|
return paramStatements.map((paramState) => ({
|
|
211
|
-
name: paramState.name,
|
|
212
|
-
text: paramState.name,
|
|
213
254
|
labelWidth: "100px",
|
|
214
|
-
|
|
255
|
+
text: paramState.name,
|
|
256
|
+
...paramState
|
|
215
257
|
}));
|
|
216
258
|
};
|
|
259
|
+
const editCode = (codeId) => {
|
|
260
|
+
services?.codeBlockService.setCodeEditorContent(true, codeId);
|
|
261
|
+
};
|
|
217
262
|
return (_ctx, _cache) => {
|
|
218
263
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
219
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
264
|
+
return openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
220
265
|
createVNode(_component_m_form_table, {
|
|
221
266
|
config: unref(tableConfig),
|
|
222
267
|
model: __props.model[__props.name],
|
|
@@ -225,18 +270,28 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
225
270
|
prop: __props.prop,
|
|
226
271
|
size: __props.size,
|
|
227
272
|
onChange: changeHandler
|
|
228
|
-
},
|
|
273
|
+
}, {
|
|
274
|
+
operateCol: withCtx(({ scope }) => [
|
|
275
|
+
scope.row.codeId ? (openBlock(), createBlock(_sfc_main$s, {
|
|
276
|
+
key: 0,
|
|
277
|
+
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
278
|
+
class: "edit-icon",
|
|
279
|
+
onClick: ($event) => editCode(scope.row.codeId)
|
|
280
|
+
}, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
281
|
+
]),
|
|
282
|
+
_: 1
|
|
283
|
+
}, 8, ["config", "model", "prop", "size"])
|
|
229
284
|
]);
|
|
230
285
|
};
|
|
231
286
|
}
|
|
232
287
|
});
|
|
233
288
|
|
|
234
|
-
const _hoisted_1$
|
|
235
|
-
const __default__$
|
|
289
|
+
const _hoisted_1$e = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
|
|
290
|
+
const __default__$p = defineComponent({
|
|
236
291
|
name: "MEditorUISelect"
|
|
237
292
|
});
|
|
238
|
-
const _sfc_main$
|
|
239
|
-
...__default__$
|
|
293
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
294
|
+
...__default__$p,
|
|
240
295
|
props: {
|
|
241
296
|
config: null,
|
|
242
297
|
model: null,
|
|
@@ -298,7 +353,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
298
353
|
style: { "padding": "0" }
|
|
299
354
|
}, {
|
|
300
355
|
default: withCtx(() => [
|
|
301
|
-
_hoisted_1$
|
|
356
|
+
_hoisted_1$e
|
|
302
357
|
]),
|
|
303
358
|
_: 1
|
|
304
359
|
}, 8, ["icon"])
|
|
@@ -346,11 +401,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
346
401
|
|
|
347
402
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
348
403
|
|
|
349
|
-
const __default__$
|
|
404
|
+
const __default__$o = defineComponent({
|
|
350
405
|
name: "MEditorCodeEditor"
|
|
351
406
|
});
|
|
352
|
-
const _sfc_main$
|
|
353
|
-
...__default__$
|
|
407
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
408
|
+
...__default__$o,
|
|
354
409
|
props: {
|
|
355
410
|
initValues: null,
|
|
356
411
|
modifiedValues: null,
|
|
@@ -479,11 +534,11 @@ const setConfig = (option) => {
|
|
|
479
534
|
};
|
|
480
535
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
481
536
|
|
|
482
|
-
const __default__$
|
|
537
|
+
const __default__$n = defineComponent({
|
|
483
538
|
name: "MEditorResizer"
|
|
484
539
|
});
|
|
485
|
-
const _sfc_main$
|
|
486
|
-
...__default__$
|
|
540
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
541
|
+
...__default__$n,
|
|
487
542
|
emits: ["change"],
|
|
488
543
|
setup(__props, { emit }) {
|
|
489
544
|
const target = ref();
|
|
@@ -515,17 +570,17 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
515
570
|
}
|
|
516
571
|
});
|
|
517
572
|
|
|
518
|
-
const __default__$
|
|
573
|
+
const __default__$m = defineComponent({
|
|
519
574
|
name: "MEditorLayout"
|
|
520
575
|
});
|
|
521
|
-
const _sfc_main$
|
|
522
|
-
...__default__$
|
|
576
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
577
|
+
...__default__$m,
|
|
523
578
|
props: {
|
|
524
579
|
left: null,
|
|
525
580
|
right: null,
|
|
526
581
|
minLeft: { default: 46 },
|
|
527
582
|
minRight: { default: 1 },
|
|
528
|
-
minCenter: { default:
|
|
583
|
+
minCenter: { default: 5 },
|
|
529
584
|
leftClass: null,
|
|
530
585
|
rightClass: null,
|
|
531
586
|
centerClass: null
|
|
@@ -627,7 +682,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
627
682
|
}, [
|
|
628
683
|
renderSlot(_ctx.$slots, "left")
|
|
629
684
|
], 6),
|
|
630
|
-
createVNode(_sfc_main$
|
|
685
|
+
createVNode(_sfc_main$o, { onChange: changeLeft })
|
|
631
686
|
], 64)) : createCommentVNode("", true),
|
|
632
687
|
createElementVNode("div", {
|
|
633
688
|
class: normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -636,7 +691,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
636
691
|
renderSlot(_ctx.$slots, "center")
|
|
637
692
|
], 6),
|
|
638
693
|
unref(hasRight) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
639
|
-
createVNode(_sfc_main$
|
|
694
|
+
createVNode(_sfc_main$o, { onChange: changeRight }),
|
|
640
695
|
createElementVNode("div", {
|
|
641
696
|
class: normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
642
697
|
style: normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -649,49 +704,6 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
649
704
|
}
|
|
650
705
|
});
|
|
651
706
|
|
|
652
|
-
const _hoisted_1$e = ["src"];
|
|
653
|
-
const __default__$m = defineComponent({
|
|
654
|
-
name: "MEditorIcon"
|
|
655
|
-
});
|
|
656
|
-
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
657
|
-
...__default__$m,
|
|
658
|
-
props: {
|
|
659
|
-
icon: null
|
|
660
|
-
},
|
|
661
|
-
setup(__props) {
|
|
662
|
-
return (_ctx, _cache) => {
|
|
663
|
-
return !__props.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
664
|
-
key: 0,
|
|
665
|
-
class: "magic-editor-icon"
|
|
666
|
-
}, {
|
|
667
|
-
default: withCtx(() => [
|
|
668
|
-
createVNode(unref(Edit))
|
|
669
|
-
]),
|
|
670
|
-
_: 1
|
|
671
|
-
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
672
|
-
key: 1,
|
|
673
|
-
class: "magic-editor-icon"
|
|
674
|
-
}, {
|
|
675
|
-
default: withCtx(() => [
|
|
676
|
-
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$e)
|
|
677
|
-
]),
|
|
678
|
-
_: 1
|
|
679
|
-
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
680
|
-
key: 2,
|
|
681
|
-
class: normalizeClass(["magic-editor-icon", __props.icon])
|
|
682
|
-
}, null, 2)) : (openBlock(), createBlock(unref(TMagicIcon), {
|
|
683
|
-
key: 3,
|
|
684
|
-
class: "magic-editor-icon"
|
|
685
|
-
}, {
|
|
686
|
-
default: withCtx(() => [
|
|
687
|
-
(openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
|
|
688
|
-
]),
|
|
689
|
-
_: 1
|
|
690
|
-
}));
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
|
-
});
|
|
694
|
-
|
|
695
707
|
var ColumnLayout = /* @__PURE__ */ ((ColumnLayout2) => {
|
|
696
708
|
ColumnLayout2["LEFT"] = "left";
|
|
697
709
|
ColumnLayout2["CENTER"] = "center";
|
|
@@ -716,11 +728,6 @@ var Keys = /* @__PURE__ */ ((Keys2) => {
|
|
|
716
728
|
})(Keys || {});
|
|
717
729
|
const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
718
730
|
const V_GUIDE_LINE_STORAGE_KEY = "$MagicStageVerticalGuidelinesData";
|
|
719
|
-
var CodeEditorMode = /* @__PURE__ */ ((CodeEditorMode2) => {
|
|
720
|
-
CodeEditorMode2["LIST"] = "list";
|
|
721
|
-
CodeEditorMode2["EDITOR"] = "editor";
|
|
722
|
-
return CodeEditorMode2;
|
|
723
|
-
})(CodeEditorMode || {});
|
|
724
731
|
var CodeDeleteErrorType = /* @__PURE__ */ ((CodeDeleteErrorType2) => {
|
|
725
732
|
CodeDeleteErrorType2["UNDELETEABLE"] = "undeleteable";
|
|
726
733
|
CodeDeleteErrorType2["BIND"] = "bind";
|
|
@@ -882,7 +889,6 @@ class CodeBlock extends BaseService {
|
|
|
882
889
|
codeDsl: null,
|
|
883
890
|
id: "",
|
|
884
891
|
editable: true,
|
|
885
|
-
mode: CodeEditorMode.EDITOR,
|
|
886
892
|
combineIds: [],
|
|
887
893
|
undeletableList: [],
|
|
888
894
|
relations: {}
|
|
@@ -897,7 +903,6 @@ class CodeBlock extends BaseService {
|
|
|
897
903
|
"setCodeDslById",
|
|
898
904
|
"setCodeEditorShowStatus",
|
|
899
905
|
"setEditStatus",
|
|
900
|
-
"setMode",
|
|
901
906
|
"setCombineIds",
|
|
902
907
|
"setUndeleteableList",
|
|
903
908
|
"deleteCodeDslByIds"
|
|
@@ -983,12 +988,6 @@ class CodeBlock extends BaseService {
|
|
|
983
988
|
getId() {
|
|
984
989
|
return this.state.id;
|
|
985
990
|
}
|
|
986
|
-
getMode() {
|
|
987
|
-
return this.state.mode;
|
|
988
|
-
}
|
|
989
|
-
async setMode(mode) {
|
|
990
|
-
this.state.mode = mode;
|
|
991
|
-
}
|
|
992
991
|
async setCombineIds(ids) {
|
|
993
992
|
this.state.combineIds = ids;
|
|
994
993
|
}
|
|
@@ -1048,7 +1047,6 @@ class CodeBlock extends BaseService {
|
|
|
1048
1047
|
this.state.codeDsl = null;
|
|
1049
1048
|
this.state.id = "";
|
|
1050
1049
|
this.state.editable = true;
|
|
1051
|
-
this.state.mode = CodeEditorMode.EDITOR;
|
|
1052
1050
|
this.state.combineIds = [];
|
|
1053
1051
|
this.state.undeletableList = [];
|
|
1054
1052
|
}
|
|
@@ -1072,6 +1070,7 @@ class CodeBlock extends BaseService {
|
|
|
1072
1070
|
}
|
|
1073
1071
|
recurseMNode(node, relations) {
|
|
1074
1072
|
forIn(node, (value, key) => {
|
|
1073
|
+
let unConfirmedValue = { id: node.id };
|
|
1075
1074
|
if (value?.hookType === HookType.CODE && !isEmpty(value.hookData)) {
|
|
1076
1075
|
value.hookData.forEach((relationItem) => {
|
|
1077
1076
|
if (!relationItem.codeId)
|
|
@@ -1085,6 +1084,14 @@ class CodeBlock extends BaseService {
|
|
|
1085
1084
|
}
|
|
1086
1085
|
codeItem[node.id].push(key);
|
|
1087
1086
|
});
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
if (typeof value === "object") {
|
|
1090
|
+
unConfirmedValue = {
|
|
1091
|
+
...unConfirmedValue,
|
|
1092
|
+
...value
|
|
1093
|
+
};
|
|
1094
|
+
this.recurseMNode(unConfirmedValue, relations);
|
|
1088
1095
|
}
|
|
1089
1096
|
});
|
|
1090
1097
|
if (!isEmpty(node.items)) {
|
|
@@ -1357,10 +1364,14 @@ const getMiddleTop = (node, parentNode, stage) => {
|
|
|
1357
1364
|
};
|
|
1358
1365
|
const getInitPositionStyle = (style = {}, layout) => {
|
|
1359
1366
|
if (layout === Layout.ABSOLUTE) {
|
|
1360
|
-
|
|
1367
|
+
const newStyle = {
|
|
1361
1368
|
...style,
|
|
1362
1369
|
position: "absolute"
|
|
1363
1370
|
};
|
|
1371
|
+
if (typeof newStyle.left === "undefined" && typeof newStyle.right === "undefined") {
|
|
1372
|
+
newStyle.left = 0;
|
|
1373
|
+
}
|
|
1374
|
+
return newStyle;
|
|
1364
1375
|
}
|
|
1365
1376
|
if (layout === Layout.RELATIVE) {
|
|
1366
1377
|
return getRelativeStyle(style);
|
|
@@ -1588,7 +1599,7 @@ const beforePaste = async (position, config) => {
|
|
|
1588
1599
|
config.map(async (configItem) => {
|
|
1589
1600
|
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
1590
1601
|
let pastePosition = positionClone;
|
|
1591
|
-
if (!isEmpty(pastePosition) && curNode
|
|
1602
|
+
if (!isEmpty(pastePosition) && curNode?.items) {
|
|
1592
1603
|
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
1593
1604
|
}
|
|
1594
1605
|
if (pastePosition.left && configItem.style?.left) {
|
|
@@ -1611,8 +1622,9 @@ const beforePaste = async (position, config) => {
|
|
|
1611
1622
|
...pastePosition
|
|
1612
1623
|
};
|
|
1613
1624
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1625
|
+
const root = editorService.get("root");
|
|
1626
|
+
if (isPage(pasteConfig) && root) {
|
|
1627
|
+
pasteConfig.name = generatePageNameByApp(root);
|
|
1616
1628
|
}
|
|
1617
1629
|
return pasteConfig;
|
|
1618
1630
|
})
|
|
@@ -1635,9 +1647,9 @@ const getAddParent = (node) => {
|
|
|
1635
1647
|
let parentNode;
|
|
1636
1648
|
if (isPage(node)) {
|
|
1637
1649
|
parentNode = editorService.get("root");
|
|
1638
|
-
} else if (curNode
|
|
1650
|
+
} else if (curNode?.items) {
|
|
1639
1651
|
parentNode = curNode;
|
|
1640
|
-
} else {
|
|
1652
|
+
} else if (curNode?.id) {
|
|
1641
1653
|
parentNode = editorService.getParentById(curNode.id, false);
|
|
1642
1654
|
}
|
|
1643
1655
|
return parentNode;
|
|
@@ -1695,11 +1707,18 @@ class Editor$1 extends BaseService {
|
|
|
1695
1707
|
set(name, value) {
|
|
1696
1708
|
const preValue = this.state[name];
|
|
1697
1709
|
this.state[name] = value;
|
|
1698
|
-
if (name === "nodes") {
|
|
1710
|
+
if (name === "nodes" && Array.isArray(value)) {
|
|
1699
1711
|
this.set("node", value[0]);
|
|
1700
1712
|
}
|
|
1701
1713
|
if (name === "root") {
|
|
1702
|
-
|
|
1714
|
+
if (Array.isArray(value)) {
|
|
1715
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u6570\u7EC4");
|
|
1716
|
+
}
|
|
1717
|
+
if (value && isObject(value) && !(value instanceof StageCore) && !(value instanceof Map)) {
|
|
1718
|
+
this.state.pageLength = value.items?.length || 0;
|
|
1719
|
+
} else {
|
|
1720
|
+
this.state.pageLength = 0;
|
|
1721
|
+
}
|
|
1703
1722
|
this.emit("root-change", value, preValue);
|
|
1704
1723
|
}
|
|
1705
1724
|
}
|
|
@@ -1711,16 +1730,21 @@ class Editor$1 extends BaseService {
|
|
|
1711
1730
|
if (raw) {
|
|
1712
1731
|
root = toRaw(root);
|
|
1713
1732
|
}
|
|
1733
|
+
const info = {
|
|
1734
|
+
node: null,
|
|
1735
|
+
parent: null,
|
|
1736
|
+
page: null
|
|
1737
|
+
};
|
|
1714
1738
|
if (!root)
|
|
1715
|
-
return
|
|
1739
|
+
return info;
|
|
1716
1740
|
if (id === root.id) {
|
|
1717
|
-
|
|
1741
|
+
info.node = root;
|
|
1742
|
+
return info;
|
|
1718
1743
|
}
|
|
1719
1744
|
const path = getNodePath(id, root.items);
|
|
1720
1745
|
if (!path.length)
|
|
1721
|
-
return
|
|
1746
|
+
return info;
|
|
1722
1747
|
path.unshift(root);
|
|
1723
|
-
const info = {};
|
|
1724
1748
|
info.node = path[path.length - 1];
|
|
1725
1749
|
info.parent = path[path.length - 2];
|
|
1726
1750
|
path.forEach((item) => {
|
|
@@ -1736,8 +1760,6 @@ class Editor$1 extends BaseService {
|
|
|
1736
1760
|
return node;
|
|
1737
1761
|
}
|
|
1738
1762
|
getParentById(id, raw = true) {
|
|
1739
|
-
if (!this.get("root"))
|
|
1740
|
-
return;
|
|
1741
1763
|
const { parent } = this.getNodeInfo(id, raw);
|
|
1742
1764
|
return parent;
|
|
1743
1765
|
}
|
|
@@ -1754,9 +1776,9 @@ class Editor$1 extends BaseService {
|
|
|
1754
1776
|
}
|
|
1755
1777
|
async select(config) {
|
|
1756
1778
|
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
1757
|
-
this.set("nodes", [node]);
|
|
1758
|
-
this.set("page", page
|
|
1759
|
-
this.set("parent", parent
|
|
1779
|
+
this.set("nodes", node ? [node] : []);
|
|
1780
|
+
this.set("page", page);
|
|
1781
|
+
this.set("parent", parent);
|
|
1760
1782
|
if (page) {
|
|
1761
1783
|
historyService.changePage(toRaw(page));
|
|
1762
1784
|
} else {
|
|
@@ -1770,7 +1792,7 @@ class Editor$1 extends BaseService {
|
|
|
1770
1792
|
page,
|
|
1771
1793
|
parent
|
|
1772
1794
|
},
|
|
1773
|
-
getNodePath(node.id, this.get("root")
|
|
1795
|
+
getNodePath(node.id, this.get("root")?.items)
|
|
1774
1796
|
);
|
|
1775
1797
|
}
|
|
1776
1798
|
this.emit("select", node);
|
|
@@ -1792,6 +1814,10 @@ class Editor$1 extends BaseService {
|
|
|
1792
1814
|
async selectNextPage() {
|
|
1793
1815
|
const root = toRaw(this.get("root"));
|
|
1794
1816
|
const page = toRaw(this.get("page"));
|
|
1817
|
+
if (!page)
|
|
1818
|
+
throw new Error("page\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1819
|
+
if (!root)
|
|
1820
|
+
throw new Error("root\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1795
1821
|
const index = getNodeIndex(page, root);
|
|
1796
1822
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
1797
1823
|
await this.select(nextPage);
|
|
@@ -1818,16 +1844,20 @@ class Editor$1 extends BaseService {
|
|
|
1818
1844
|
}
|
|
1819
1845
|
async doAdd(node, parent) {
|
|
1820
1846
|
const root = this.get("root");
|
|
1847
|
+
if (!root)
|
|
1848
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1821
1849
|
const curNode = this.get("node");
|
|
1822
1850
|
const stage = this.get("stage");
|
|
1823
|
-
if (
|
|
1851
|
+
if (!curNode)
|
|
1852
|
+
throw new Error("\u5F53\u524D\u9009\u4E2D\u8282\u70B9\u4E3A\u7A7A");
|
|
1853
|
+
if ((parent.type === NodeType.ROOT || curNode?.type === NodeType.ROOT) && node.type !== NodeType.PAGE) {
|
|
1824
1854
|
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
1825
1855
|
}
|
|
1826
1856
|
if (parent.id !== curNode.id && node.type !== NodeType.PAGE) {
|
|
1827
1857
|
const index = parent.items.indexOf(curNode);
|
|
1828
|
-
parent
|
|
1858
|
+
parent.items?.splice(index + 1, 0, node);
|
|
1829
1859
|
} else {
|
|
1830
|
-
parent
|
|
1860
|
+
parent.items?.push(node);
|
|
1831
1861
|
}
|
|
1832
1862
|
const layout = await this.getLayout(toRaw(parent), node);
|
|
1833
1863
|
node.style = getInitPositionStyle(node.style, layout);
|
|
@@ -1858,8 +1888,9 @@ class Editor$1 extends BaseService {
|
|
|
1858
1888
|
}
|
|
1859
1889
|
const newNodes = await Promise.all(
|
|
1860
1890
|
addNodes.map((node) => {
|
|
1861
|
-
|
|
1862
|
-
|
|
1891
|
+
const root = this.get("root");
|
|
1892
|
+
if (isPage(node) && root) {
|
|
1893
|
+
return this.doAdd(node, root);
|
|
1863
1894
|
}
|
|
1864
1895
|
const parentNode = parent && typeof parent !== "function" ? parent : getAddParent(node);
|
|
1865
1896
|
if (!parentNode)
|
|
@@ -1888,7 +1919,7 @@ class Editor$1 extends BaseService {
|
|
|
1888
1919
|
async doRemove(node) {
|
|
1889
1920
|
const root = this.get("root");
|
|
1890
1921
|
if (!root)
|
|
1891
|
-
throw new Error("\
|
|
1922
|
+
throw new Error("root\u4E0D\u80FD\u4E3A\u7A7A");
|
|
1892
1923
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
1893
1924
|
if (!parent || !curNode)
|
|
1894
1925
|
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
@@ -1929,13 +1960,16 @@ class Editor$1 extends BaseService {
|
|
|
1929
1960
|
this.emit("remove", nodes);
|
|
1930
1961
|
}
|
|
1931
1962
|
async doUpdate(config) {
|
|
1963
|
+
const root = this.get("root");
|
|
1964
|
+
if (!root)
|
|
1965
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1932
1966
|
if (!config?.id)
|
|
1933
1967
|
throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
|
|
1934
1968
|
const info = this.getNodeInfo(config.id, false);
|
|
1935
1969
|
if (!info.node)
|
|
1936
1970
|
throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config.id}\u7684\u8282\u70B9`);
|
|
1937
1971
|
const node = cloneDeep(toRaw(info.node));
|
|
1938
|
-
let newConfig = await this.toggleFixedPosition(toRaw(config), node,
|
|
1972
|
+
let newConfig = await this.toggleFixedPosition(toRaw(config), node, root);
|
|
1939
1973
|
newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1940
1974
|
if (isObject(srcValue) && Array.isArray(objValue)) {
|
|
1941
1975
|
return srcValue;
|
|
@@ -1963,14 +1997,14 @@ class Editor$1 extends BaseService {
|
|
|
1963
1997
|
newConfig = setLayout(newConfig, newLayout);
|
|
1964
1998
|
}
|
|
1965
1999
|
parentNodeItems[index] = newConfig;
|
|
1966
|
-
const nodes = this.get("nodes")
|
|
2000
|
+
const nodes = this.get("nodes");
|
|
1967
2001
|
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
1968
2002
|
nodes.splice(targetIndex, 1, newConfig);
|
|
1969
2003
|
this.set("nodes", [...nodes]);
|
|
1970
2004
|
this.get("stage")?.update({
|
|
1971
2005
|
config: cloneDeep(newConfig),
|
|
1972
2006
|
parentId: parent.id,
|
|
1973
|
-
root: cloneDeep(
|
|
2007
|
+
root: cloneDeep(root)
|
|
1974
2008
|
});
|
|
1975
2009
|
if (newConfig.type === NodeType.PAGE) {
|
|
1976
2010
|
this.set("page", newConfig);
|
|
@@ -1987,8 +2021,15 @@ class Editor$1 extends BaseService {
|
|
|
1987
2021
|
return Array.isArray(config) ? newNodes : newNodes[0];
|
|
1988
2022
|
}
|
|
1989
2023
|
async sort(id1, id2) {
|
|
2024
|
+
const root = this.get("root");
|
|
2025
|
+
if (!root)
|
|
2026
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
1990
2027
|
const node = this.get("node");
|
|
2028
|
+
if (!node)
|
|
2029
|
+
throw new Error("\u5F53\u524D\u8282\u70B9\u4E3A\u7A7A");
|
|
1991
2030
|
const parent = cloneDeep(toRaw(this.get("parent")));
|
|
2031
|
+
if (!parent)
|
|
2032
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
1992
2033
|
const index2 = parent.items.findIndex((node2) => `${node2.id}` === `${id2}`);
|
|
1993
2034
|
if (index2 < 0)
|
|
1994
2035
|
return;
|
|
@@ -1999,7 +2040,7 @@ class Editor$1 extends BaseService {
|
|
|
1999
2040
|
this.get("stage")?.update({
|
|
2000
2041
|
config: cloneDeep(node),
|
|
2001
2042
|
parentId: parent.id,
|
|
2002
|
-
root: cloneDeep(
|
|
2043
|
+
root: cloneDeep(root)
|
|
2003
2044
|
});
|
|
2004
2045
|
this.addModifiedNodeId(parent.id);
|
|
2005
2046
|
this.pushHistoryState();
|
|
@@ -2014,10 +2055,10 @@ class Editor$1 extends BaseService {
|
|
|
2014
2055
|
if (!Array.isArray(config))
|
|
2015
2056
|
return;
|
|
2016
2057
|
const node = this.get("node");
|
|
2017
|
-
let parent =
|
|
2018
|
-
if (config.length === 1 && config[0].id === node
|
|
2058
|
+
let parent = null;
|
|
2059
|
+
if (config.length === 1 && config[0].id === node?.id) {
|
|
2019
2060
|
parent = this.get("parent");
|
|
2020
|
-
if (parent
|
|
2061
|
+
if (parent?.type === NodeType.ROOT) {
|
|
2021
2062
|
parent = this.get("page");
|
|
2022
2063
|
}
|
|
2023
2064
|
}
|
|
@@ -2065,9 +2106,16 @@ class Editor$1 extends BaseService {
|
|
|
2065
2106
|
return newNode;
|
|
2066
2107
|
}
|
|
2067
2108
|
async moveLayer(offset) {
|
|
2109
|
+
const root = this.get("root");
|
|
2110
|
+
if (!root)
|
|
2111
|
+
throw new Error("root\u4E3A\u7A7A");
|
|
2068
2112
|
const parent = this.get("parent");
|
|
2113
|
+
if (!parent)
|
|
2114
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
2069
2115
|
const node = this.get("node");
|
|
2070
|
-
|
|
2116
|
+
if (!node)
|
|
2117
|
+
throw new Error("\u5F53\u524D\u8282\u70B9\u4E3A\u7A7A");
|
|
2118
|
+
const brothers = parent.items || [];
|
|
2071
2119
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
2072
2120
|
const layout = await this.getLayout(parent, node);
|
|
2073
2121
|
const isRelative = layout === Layout.RELATIVE;
|
|
@@ -2083,17 +2131,17 @@ class Editor$1 extends BaseService {
|
|
|
2083
2131
|
this.get("stage")?.update({
|
|
2084
2132
|
config: cloneDeep(toRaw(parent)),
|
|
2085
2133
|
parentId: grandparent?.id,
|
|
2086
|
-
root: cloneDeep(
|
|
2134
|
+
root: cloneDeep(root)
|
|
2087
2135
|
});
|
|
2088
2136
|
this.addModifiedNodeId(parent.id);
|
|
2089
2137
|
this.pushHistoryState();
|
|
2090
2138
|
}
|
|
2091
2139
|
async moveToContainer(config, targetId) {
|
|
2140
|
+
const root = cloneDeep(this.get("root"));
|
|
2092
2141
|
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
2093
2142
|
const target = this.getNodeById(targetId, false);
|
|
2094
2143
|
const stage = this.get("stage");
|
|
2095
|
-
if (node && parent && stage) {
|
|
2096
|
-
const root = cloneDeep(this.get("root"));
|
|
2144
|
+
if (root && node && parent && stage) {
|
|
2097
2145
|
const index = getNodeIndex(node, parent);
|
|
2098
2146
|
parent.items?.splice(index, 1);
|
|
2099
2147
|
await stage.remove({ id: node.id, parentId: parent.id, root });
|
|
@@ -2156,7 +2204,7 @@ class Editor$1 extends BaseService {
|
|
|
2156
2204
|
this.set("stage", null);
|
|
2157
2205
|
this.set("highlightNode", null);
|
|
2158
2206
|
this.set("modifiedNodeIds", /* @__PURE__ */ new Map());
|
|
2159
|
-
this.set("pageLength",
|
|
2207
|
+
this.set("pageLength", 0);
|
|
2160
2208
|
}
|
|
2161
2209
|
destroy() {
|
|
2162
2210
|
this.removeAllListeners();
|
|
@@ -2168,15 +2216,11 @@ class Editor$1 extends BaseService {
|
|
|
2168
2216
|
}
|
|
2169
2217
|
async getCodeDsl() {
|
|
2170
2218
|
const root = this.get("root");
|
|
2171
|
-
|
|
2172
|
-
return null;
|
|
2173
|
-
return root.codeBlocks || null;
|
|
2219
|
+
return root?.codeBlocks || null;
|
|
2174
2220
|
}
|
|
2175
2221
|
getCodeDslSync() {
|
|
2176
2222
|
const root = this.get("root");
|
|
2177
|
-
|
|
2178
|
-
return null;
|
|
2179
|
-
return root.codeBlocks || null;
|
|
2223
|
+
return root?.codeBlocks || null;
|
|
2180
2224
|
}
|
|
2181
2225
|
async setCodeDsl(codeDsl) {
|
|
2182
2226
|
if (!this.state.root)
|
|
@@ -2190,9 +2234,10 @@ class Editor$1 extends BaseService {
|
|
|
2190
2234
|
}
|
|
2191
2235
|
pushHistoryState() {
|
|
2192
2236
|
const curNode = cloneDeep(toRaw(this.get("node")));
|
|
2193
|
-
|
|
2237
|
+
const page = this.get("page");
|
|
2238
|
+
if (!this.isHistoryStateChange && curNode && page) {
|
|
2194
2239
|
historyService.push({
|
|
2195
|
-
data: cloneDeep(toRaw(
|
|
2240
|
+
data: cloneDeep(toRaw(page)),
|
|
2196
2241
|
modifiedNodeIds: this.get("modifiedNodeIds"),
|
|
2197
2242
|
nodeId: curNode.id
|
|
2198
2243
|
});
|
|
@@ -2651,8 +2696,10 @@ const useStage = (stageOptions) => {
|
|
|
2651
2696
|
});
|
|
2652
2697
|
stage.on("select-parent", () => {
|
|
2653
2698
|
const parent = editorService.get("parent");
|
|
2699
|
+
if (!parent)
|
|
2700
|
+
throw new Error("\u7236\u8282\u70B9\u4E3A\u7A7A");
|
|
2654
2701
|
editorService.select(parent);
|
|
2655
|
-
editorService.get("stage")
|
|
2702
|
+
editorService.get("stage")?.select(parent.id);
|
|
2656
2703
|
});
|
|
2657
2704
|
stage.on("change-guides", (e) => {
|
|
2658
2705
|
uiService.set("showGuides", true);
|
|
@@ -2671,8 +2718,8 @@ const useStage = (stageOptions) => {
|
|
|
2671
2718
|
};
|
|
2672
2719
|
|
|
2673
2720
|
const _hoisted_1$d = { class: "m-editor-empty-panel" };
|
|
2674
|
-
const _hoisted_2$
|
|
2675
|
-
const _hoisted_3$
|
|
2721
|
+
const _hoisted_2$6 = { class: "m-editor-empty-content" };
|
|
2722
|
+
const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2676
2723
|
const __default__$l = defineComponent({
|
|
2677
2724
|
name: "MEditorAddPageBox"
|
|
2678
2725
|
});
|
|
@@ -2684,22 +2731,25 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2684
2731
|
const { editorService } = services || {};
|
|
2685
2732
|
if (!editorService)
|
|
2686
2733
|
return;
|
|
2734
|
+
const root = toRaw(editorService.get("root"));
|
|
2735
|
+
if (!root)
|
|
2736
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u7A7A");
|
|
2687
2737
|
editorService.add({
|
|
2688
2738
|
type: NodeType.PAGE,
|
|
2689
|
-
name: generatePageNameByApp(
|
|
2739
|
+
name: generatePageNameByApp(root)
|
|
2690
2740
|
});
|
|
2691
2741
|
};
|
|
2692
2742
|
return (_ctx, _cache) => {
|
|
2693
2743
|
return openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
2694
|
-
createElementVNode("div", _hoisted_2$
|
|
2744
|
+
createElementVNode("div", _hoisted_2$6, [
|
|
2695
2745
|
createElementVNode("div", {
|
|
2696
2746
|
class: "m-editor-empty-button",
|
|
2697
2747
|
onClick: clickHandler
|
|
2698
2748
|
}, [
|
|
2699
2749
|
createElementVNode("div", null, [
|
|
2700
|
-
createVNode(_sfc_main$
|
|
2750
|
+
createVNode(_sfc_main$s, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
2701
2751
|
]),
|
|
2702
|
-
_hoisted_3$
|
|
2752
|
+
_hoisted_3$3
|
|
2703
2753
|
])
|
|
2704
2754
|
])
|
|
2705
2755
|
]);
|
|
@@ -2746,7 +2796,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2746
2796
|
columnWidth.value.right = right;
|
|
2747
2797
|
columnWidth.value.center = globalThis.document.body.clientWidth - left - right;
|
|
2748
2798
|
}
|
|
2749
|
-
uiService?.set("columnWidth", columnWidth);
|
|
2799
|
+
uiService?.set("columnWidth", columnWidth.value);
|
|
2750
2800
|
},
|
|
2751
2801
|
{
|
|
2752
2802
|
immediate: true
|
|
@@ -2766,8 +2816,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2766
2816
|
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
2767
2817
|
}
|
|
2768
2818
|
);
|
|
2769
|
-
const columnWidthChange = (
|
|
2770
|
-
|
|
2819
|
+
const columnWidthChange = (columnW) => {
|
|
2820
|
+
columnWidth.value.left = columnW.left;
|
|
2821
|
+
columnWidth.value.center = columnW.center;
|
|
2822
|
+
columnWidth.value.right = columnW.right;
|
|
2823
|
+
uiService?.set("columnWidth", columnW);
|
|
2771
2824
|
};
|
|
2772
2825
|
const saveCode = (value) => {
|
|
2773
2826
|
try {
|
|
@@ -2786,7 +2839,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2786
2839
|
"init-values": unref(root),
|
|
2787
2840
|
options: __props.codeOptions,
|
|
2788
2841
|
onSave: saveCode
|
|
2789
|
-
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$
|
|
2842
|
+
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$n, {
|
|
2790
2843
|
key: 1,
|
|
2791
2844
|
class: "m-editor-content",
|
|
2792
2845
|
"left-class": "m-editor-framework-left",
|
|
@@ -2831,7 +2884,7 @@ const _hoisted_1$b = {
|
|
|
2831
2884
|
key: 1,
|
|
2832
2885
|
class: "menu-item-text"
|
|
2833
2886
|
};
|
|
2834
|
-
const _hoisted_2$
|
|
2887
|
+
const _hoisted_2$5 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2835
2888
|
const __default__$j = defineComponent({
|
|
2836
2889
|
name: "MEditorToolButton"
|
|
2837
2890
|
});
|
|
@@ -2925,7 +2978,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2925
2978
|
disabled: unref(disabled)
|
|
2926
2979
|
}, {
|
|
2927
2980
|
default: withCtx(() => [
|
|
2928
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
2981
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$s, {
|
|
2929
2982
|
key: 0,
|
|
2930
2983
|
icon: __props.data.icon
|
|
2931
2984
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -2942,7 +2995,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2942
2995
|
disabled: unref(disabled)
|
|
2943
2996
|
}, {
|
|
2944
2997
|
default: withCtx(() => [
|
|
2945
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
2998
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$s, {
|
|
2946
2999
|
key: 0,
|
|
2947
3000
|
icon: __props.data.icon
|
|
2948
3001
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -2975,7 +3028,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2975
3028
|
})) : createCommentVNode("", true)
|
|
2976
3029
|
]),
|
|
2977
3030
|
default: withCtx(() => [
|
|
2978
|
-
createElementVNode("span", _hoisted_2$
|
|
3031
|
+
createElementVNode("span", _hoisted_2$5, [
|
|
2979
3032
|
createTextVNode(toDisplayString(__props.data.text), 1),
|
|
2980
3033
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
2981
3034
|
default: withCtx(() => [
|
|
@@ -3040,7 +3093,10 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3040
3093
|
icon: markRaw(Delete),
|
|
3041
3094
|
tooltip: `\u522A\u9664(Delete)`,
|
|
3042
3095
|
disabled: () => services?.editorService.get("node")?.type === NodeType.PAGE,
|
|
3043
|
-
handler: () =>
|
|
3096
|
+
handler: () => {
|
|
3097
|
+
const node = services?.editorService.get("node");
|
|
3098
|
+
node && services?.editorService.remove(node);
|
|
3099
|
+
}
|
|
3044
3100
|
});
|
|
3045
3101
|
break;
|
|
3046
3102
|
case "undo":
|
|
@@ -3177,9 +3233,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
3177
3233
|
const curFormConfig = ref([]);
|
|
3178
3234
|
const services = inject("services");
|
|
3179
3235
|
const node = computed(() => services?.editorService.get("node"));
|
|
3180
|
-
const propsPanelSize = computed(
|
|
3181
|
-
() => services?.uiService.get("propsPanelSize") || "small"
|
|
3182
|
-
);
|
|
3236
|
+
const propsPanelSize = computed(() => services?.uiService.get("propsPanelSize") || "small");
|
|
3183
3237
|
const stage = computed(() => services?.editorService.get("stage"));
|
|
3184
3238
|
const init = async () => {
|
|
3185
3239
|
if (!node.value) {
|
|
@@ -3236,8 +3290,8 @@ const _hoisted_1$9 = {
|
|
|
3236
3290
|
key: 0,
|
|
3237
3291
|
class: "m-editor-content-bottom"
|
|
3238
3292
|
};
|
|
3239
|
-
const _hoisted_2$
|
|
3240
|
-
const _hoisted_3$
|
|
3293
|
+
const _hoisted_2$4 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4");
|
|
3294
|
+
const _hoisted_3$2 = /* @__PURE__ */ createTextVNode("\u5173\u95ED");
|
|
3241
3295
|
const _hoisted_4$2 = {
|
|
3242
3296
|
key: 1,
|
|
3243
3297
|
class: "m-editor-content-bottom"
|
|
@@ -3256,7 +3310,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3256
3310
|
codeOptions: null,
|
|
3257
3311
|
language: null
|
|
3258
3312
|
},
|
|
3259
|
-
emits: ["
|
|
3313
|
+
emits: ["close", "saveAndClose"],
|
|
3260
3314
|
setup(__props, { emit }) {
|
|
3261
3315
|
const props = __props;
|
|
3262
3316
|
const services = inject("services");
|
|
@@ -3289,12 +3343,6 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3289
3343
|
services?.codeBlockService.setCodeDraft(props.id, codeValue);
|
|
3290
3344
|
tMagicMessage.success(`\u4EE3\u7801\u8349\u7A3F\u4FDD\u5B58\u6210\u529F ${datetimeFormatter(new Date())}`);
|
|
3291
3345
|
};
|
|
3292
|
-
const saveCode = () => {
|
|
3293
|
-
if (!codeEditor.value || !props.editable)
|
|
3294
|
-
return;
|
|
3295
|
-
editorContent.value = codeEditor.value.getEditor()?.getValue();
|
|
3296
|
-
emit("save", editorContent.value);
|
|
3297
|
-
};
|
|
3298
3346
|
const saveAndClose = () => {
|
|
3299
3347
|
if (!codeEditor.value || !props.editable)
|
|
3300
3348
|
return;
|
|
@@ -3328,7 +3376,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3328
3376
|
return openBlock(), createElementBlock("div", {
|
|
3329
3377
|
class: normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
|
|
3330
3378
|
}, [
|
|
3331
|
-
createVNode(_sfc_main$
|
|
3379
|
+
createVNode(_sfc_main$p, {
|
|
3332
3380
|
ref_key: "codeEditor",
|
|
3333
3381
|
ref: codeEditor,
|
|
3334
3382
|
class: "m-editor-container",
|
|
@@ -3351,10 +3399,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3351
3399
|
createVNode(unref(TMagicButton), {
|
|
3352
3400
|
type: "primary",
|
|
3353
3401
|
class: "button",
|
|
3354
|
-
onClick:
|
|
3402
|
+
onClick: saveAndClose
|
|
3355
3403
|
}, {
|
|
3356
3404
|
default: withCtx(() => [
|
|
3357
|
-
_hoisted_2$
|
|
3405
|
+
_hoisted_2$4
|
|
3358
3406
|
]),
|
|
3359
3407
|
_: 1
|
|
3360
3408
|
}),
|
|
@@ -3364,7 +3412,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3364
3412
|
onClick: close
|
|
3365
3413
|
}, {
|
|
3366
3414
|
default: withCtx(() => [
|
|
3367
|
-
_hoisted_3$
|
|
3415
|
+
_hoisted_3$2
|
|
3368
3416
|
]),
|
|
3369
3417
|
_: 1
|
|
3370
3418
|
})
|
|
@@ -3396,9 +3444,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3396
3444
|
});
|
|
3397
3445
|
|
|
3398
3446
|
const _hoisted_1$8 = { class: "code-name-wrapper" };
|
|
3399
|
-
const _hoisted_2$
|
|
3400
|
-
const _hoisted_3$
|
|
3401
|
-
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "\u53C2\u6570
|
|
3447
|
+
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
3448
|
+
const _hoisted_3$1 = { class: "code-name-wrapper" };
|
|
3449
|
+
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "\u53C2\u6570", -1);
|
|
3402
3450
|
const __default__$f = defineComponent({
|
|
3403
3451
|
name: "MEditorFunctionEditor"
|
|
3404
3452
|
});
|
|
@@ -3410,22 +3458,58 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3410
3458
|
content: null,
|
|
3411
3459
|
editable: { type: Boolean, default: true },
|
|
3412
3460
|
autoSaveDraft: { type: Boolean, default: true },
|
|
3413
|
-
codeOptions: null
|
|
3461
|
+
codeOptions: null,
|
|
3462
|
+
paramsColConfig: null
|
|
3414
3463
|
},
|
|
3415
3464
|
emits: ["change", "field-input"],
|
|
3416
3465
|
setup(__props, { emit }) {
|
|
3417
3466
|
const props = __props;
|
|
3467
|
+
const defaultParamColConfig = {
|
|
3468
|
+
type: "row",
|
|
3469
|
+
label: "\u53C2\u6570\u7C7B\u578B",
|
|
3470
|
+
items: [
|
|
3471
|
+
{
|
|
3472
|
+
text: "\u53C2\u6570\u7C7B\u578B",
|
|
3473
|
+
labelWidth: "70px",
|
|
3474
|
+
type: "select",
|
|
3475
|
+
name: "type",
|
|
3476
|
+
options: [
|
|
3477
|
+
{
|
|
3478
|
+
text: "\u6570\u5B57",
|
|
3479
|
+
label: "\u6570\u5B57",
|
|
3480
|
+
value: "number"
|
|
3481
|
+
},
|
|
3482
|
+
{
|
|
3483
|
+
text: "\u5B57\u7B26\u4E32",
|
|
3484
|
+
label: "\u5B57\u7B26\u4E32",
|
|
3485
|
+
value: "text"
|
|
3486
|
+
}
|
|
3487
|
+
]
|
|
3488
|
+
}
|
|
3489
|
+
]
|
|
3490
|
+
};
|
|
3491
|
+
const paramsColConfig = props.paramsColConfig || defaultParamColConfig;
|
|
3418
3492
|
const tableConfig = {
|
|
3493
|
+
type: "table",
|
|
3419
3494
|
border: true,
|
|
3420
3495
|
enableFullscreen: false,
|
|
3421
3496
|
name: "params",
|
|
3422
|
-
maxHeight: "
|
|
3497
|
+
maxHeight: "300px",
|
|
3498
|
+
dropSort: false,
|
|
3423
3499
|
items: [
|
|
3424
3500
|
{
|
|
3425
3501
|
type: "text",
|
|
3426
3502
|
label: "\u53C2\u6570\u540D",
|
|
3427
|
-
name: "name"
|
|
3428
|
-
|
|
3503
|
+
name: "name",
|
|
3504
|
+
width: 200
|
|
3505
|
+
},
|
|
3506
|
+
{
|
|
3507
|
+
type: "text",
|
|
3508
|
+
label: "\u53C2\u6570\u6CE8\u91CA",
|
|
3509
|
+
name: "tip",
|
|
3510
|
+
width: 200
|
|
3511
|
+
},
|
|
3512
|
+
paramsColConfig
|
|
3429
3513
|
]
|
|
3430
3514
|
};
|
|
3431
3515
|
const services = inject("services");
|
|
@@ -3443,7 +3527,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3443
3527
|
codeContent.value = props.content;
|
|
3444
3528
|
});
|
|
3445
3529
|
const initTableModel = () => {
|
|
3446
|
-
const codeDsl = services?.codeBlockService.getCodeDslSync();
|
|
3530
|
+
const codeDsl = cloneDeep(services?.codeBlockService.getCodeDslSync());
|
|
3447
3531
|
if (!codeDsl)
|
|
3448
3532
|
return;
|
|
3449
3533
|
tableModel.value = {
|
|
@@ -3488,7 +3572,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3488
3572
|
return openBlock(), createBlock(unref(TMagicCard), { shadow: "never" }, {
|
|
3489
3573
|
header: withCtx(() => [
|
|
3490
3574
|
createElementVNode("div", _hoisted_1$8, [
|
|
3491
|
-
_hoisted_2$
|
|
3575
|
+
_hoisted_2$3,
|
|
3492
3576
|
createVNode(unref(TMagicInput), {
|
|
3493
3577
|
class: "code-name-input",
|
|
3494
3578
|
modelValue: codeName.value,
|
|
@@ -3496,10 +3580,10 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3496
3580
|
disabled: !__props.editable
|
|
3497
3581
|
}, null, 8, ["modelValue", "disabled"])
|
|
3498
3582
|
]),
|
|
3499
|
-
createElementVNode("div", _hoisted_3$
|
|
3583
|
+
createElementVNode("div", _hoisted_3$1, [
|
|
3500
3584
|
_hoisted_4$1,
|
|
3501
3585
|
createVNode(_component_m_form_table, {
|
|
3502
|
-
style: { "width": "
|
|
3586
|
+
style: { "width": "800px" },
|
|
3503
3587
|
config: tableConfig,
|
|
3504
3588
|
model: tableModel.value,
|
|
3505
3589
|
enableToggleMode: false,
|
|
@@ -3517,7 +3601,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3517
3601
|
autoSaveDraft: __props.autoSaveDraft,
|
|
3518
3602
|
codeOptions: __props.codeOptions,
|
|
3519
3603
|
language: "javascript",
|
|
3520
|
-
onSave: saveCode,
|
|
3521
3604
|
onSaveAndClose: saveAndClose,
|
|
3522
3605
|
onClose: close
|
|
3523
3606
|
}, null, 8, ["id", "content", "editable", "autoSaveDraft", "codeOptions"])
|
|
@@ -3528,14 +3611,18 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3528
3611
|
}
|
|
3529
3612
|
});
|
|
3530
3613
|
|
|
3531
|
-
const _hoisted_1$7 =
|
|
3532
|
-
|
|
3533
|
-
|
|
3614
|
+
const _hoisted_1$7 = {
|
|
3615
|
+
key: 0,
|
|
3616
|
+
class: "m-editor-code-block-editor-panel"
|
|
3617
|
+
};
|
|
3534
3618
|
const __default__$e = defineComponent({
|
|
3535
3619
|
name: "MEditorCodeBlockEditor"
|
|
3536
3620
|
});
|
|
3537
3621
|
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
3538
3622
|
...__default__$e,
|
|
3623
|
+
props: {
|
|
3624
|
+
paramsColConfig: null
|
|
3625
|
+
},
|
|
3539
3626
|
setup(__props) {
|
|
3540
3627
|
const services = inject("services");
|
|
3541
3628
|
const codeOptions = inject("codeOptions", {});
|
|
@@ -3545,7 +3632,6 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3545
3632
|
const state = reactive({
|
|
3546
3633
|
codeList: []
|
|
3547
3634
|
});
|
|
3548
|
-
const mode = computed(() => services?.codeBlockService.getMode());
|
|
3549
3635
|
const id = computed(() => services?.codeBlockService.getId() || "");
|
|
3550
3636
|
const editable = computed(() => services?.codeBlockService.getEditStatus());
|
|
3551
3637
|
const selectedIds = computed(() => services?.codeBlockService.getCombineIds() || []);
|
|
@@ -3568,10 +3654,6 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3568
3654
|
});
|
|
3569
3655
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
3570
3656
|
});
|
|
3571
|
-
const selectHandler = (data) => {
|
|
3572
|
-
services?.codeBlockService.setId(data.id);
|
|
3573
|
-
currentTitle.value = data.name;
|
|
3574
|
-
};
|
|
3575
3657
|
return (_ctx, _cache) => {
|
|
3576
3658
|
return openBlock(), createBlock(unref(TMagicDialog), {
|
|
3577
3659
|
"model-value": true,
|
|
@@ -3583,61 +3665,29 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3583
3665
|
"show-close": false
|
|
3584
3666
|
}, {
|
|
3585
3667
|
default: withCtx(() => [
|
|
3586
|
-
createVNode(_sfc_main$
|
|
3668
|
+
createVNode(_sfc_main$n, {
|
|
3587
3669
|
left: left.value,
|
|
3588
3670
|
"onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
|
|
3589
3671
|
"min-left": 45,
|
|
3590
3672
|
class: "code-editor-layout"
|
|
3591
|
-
},
|
|
3673
|
+
}, {
|
|
3592
3674
|
center: withCtx(() => [
|
|
3593
|
-
!unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div",
|
|
3594
|
-
key: 0,
|
|
3595
|
-
class: normalizeClass([
|
|
3596
|
-
unref(mode) === unref(CodeEditorMode).LIST ? "m-editor-code-block-editor-panel-list-mode" : "m-editor-code-block-editor-panel"
|
|
3597
|
-
])
|
|
3598
|
-
}, [
|
|
3675
|
+
!unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
3599
3676
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: unref(id) }),
|
|
3600
3677
|
codeConfig.value ? (openBlock(), createBlock(_sfc_main$g, {
|
|
3601
3678
|
key: 0,
|
|
3602
3679
|
id: unref(id),
|
|
3603
3680
|
name: codeConfig.value.name,
|
|
3604
3681
|
content: codeConfig.value.content,
|
|
3682
|
+
paramsColConfig: __props.paramsColConfig,
|
|
3605
3683
|
editable: !!unref(editable),
|
|
3606
|
-
autoSaveDraft:
|
|
3684
|
+
autoSaveDraft: true,
|
|
3607
3685
|
codeOptions: unref(codeOptions)
|
|
3608
|
-
}, null, 8, ["id", "name", "content", "
|
|
3609
|
-
]
|
|
3686
|
+
}, null, 8, ["id", "name", "content", "paramsColConfig", "editable", "codeOptions"])) : createCommentVNode("", true)
|
|
3687
|
+
])) : createCommentVNode("", true)
|
|
3610
3688
|
]),
|
|
3611
|
-
_:
|
|
3612
|
-
}, [
|
|
3613
|
-
unref(mode) === unref(CodeEditorMode).LIST ? {
|
|
3614
|
-
name: "left",
|
|
3615
|
-
fn: withCtx(() => [
|
|
3616
|
-
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
3617
|
-
key: 0,
|
|
3618
|
-
class: "side-tree",
|
|
3619
|
-
"node-key": "id",
|
|
3620
|
-
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3621
|
-
data: state.codeList,
|
|
3622
|
-
"highlight-current": true,
|
|
3623
|
-
"current-node-key": state.codeList[0].id,
|
|
3624
|
-
onNodeClick: selectHandler
|
|
3625
|
-
}, {
|
|
3626
|
-
default: withCtx(({ data }) => [
|
|
3627
|
-
createElementVNode("div", {
|
|
3628
|
-
id: data.id,
|
|
3629
|
-
class: "list-container"
|
|
3630
|
-
}, [
|
|
3631
|
-
createElementVNode("div", _hoisted_2$3, [
|
|
3632
|
-
createElementVNode("div", _hoisted_3$1, toDisplayString(data.name) + "\uFF08" + toDisplayString(data.id) + "\uFF09", 1)
|
|
3633
|
-
])
|
|
3634
|
-
], 8, _hoisted_1$7)
|
|
3635
|
-
]),
|
|
3636
|
-
_: 1
|
|
3637
|
-
}, 8, ["data", "current-node-key"])) : createCommentVNode("", true)
|
|
3638
|
-
])
|
|
3639
|
-
} : void 0
|
|
3640
|
-
]), 1032, ["left"])
|
|
3689
|
+
_: 3
|
|
3690
|
+
}, 8, ["left"])
|
|
3641
3691
|
]),
|
|
3642
3692
|
_: 3
|
|
3643
3693
|
}, 8, ["title"]);
|
|
@@ -3673,7 +3723,8 @@ const __default__$d = defineComponent({
|
|
|
3673
3723
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
3674
3724
|
...__default__$d,
|
|
3675
3725
|
props: {
|
|
3676
|
-
customError: null
|
|
3726
|
+
customError: null,
|
|
3727
|
+
paramsColConfig: null
|
|
3677
3728
|
},
|
|
3678
3729
|
setup(__props) {
|
|
3679
3730
|
const props = __props;
|
|
@@ -3732,13 +3783,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3732
3783
|
}`,
|
|
3733
3784
|
params: []
|
|
3734
3785
|
};
|
|
3735
|
-
await codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3736
3786
|
const id = await codeBlockService.getUniqueId();
|
|
3737
3787
|
await codeBlockService.setCodeDslById(id, codeConfig);
|
|
3738
3788
|
codeBlockService.setCodeEditorContent(true, id);
|
|
3739
3789
|
};
|
|
3740
3790
|
const editCode = async (key) => {
|
|
3741
|
-
await services?.codeBlockService.setMode(CodeEditorMode.EDITOR);
|
|
3742
3791
|
services?.codeBlockService.setCodeEditorContent(true, key);
|
|
3743
3792
|
};
|
|
3744
3793
|
const deleteCode = (key) => {
|
|
@@ -3836,7 +3885,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3836
3885
|
placement: "bottom"
|
|
3837
3886
|
}, {
|
|
3838
3887
|
default: withCtx(() => [
|
|
3839
|
-
createVNode(_sfc_main$
|
|
3888
|
+
createVNode(_sfc_main$s, {
|
|
3840
3889
|
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
3841
3890
|
class: "edit-icon",
|
|
3842
3891
|
onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3851,7 +3900,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3851
3900
|
placement: "bottom"
|
|
3852
3901
|
}, {
|
|
3853
3902
|
default: withCtx(() => [
|
|
3854
|
-
createVNode(_sfc_main$
|
|
3903
|
+
createVNode(_sfc_main$s, {
|
|
3855
3904
|
icon: unref(Link),
|
|
3856
3905
|
class: "edit-icon",
|
|
3857
3906
|
onClick: withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
@@ -3866,7 +3915,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3866
3915
|
placement: "bottom"
|
|
3867
3916
|
}, {
|
|
3868
3917
|
default: withCtx(() => [
|
|
3869
|
-
createVNode(_sfc_main$
|
|
3918
|
+
createVNode(_sfc_main$s, {
|
|
3870
3919
|
icon: unref(Close),
|
|
3871
3920
|
class: "edit-icon",
|
|
3872
3921
|
onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3904,12 +3953,15 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3904
3953
|
]),
|
|
3905
3954
|
_: 3
|
|
3906
3955
|
}),
|
|
3907
|
-
unref(isShowCodeBlockEditor) ? (openBlock(), createBlock(_sfc_main$f, {
|
|
3956
|
+
unref(isShowCodeBlockEditor) ? (openBlock(), createBlock(_sfc_main$f, {
|
|
3957
|
+
key: 0,
|
|
3958
|
+
paramsColConfig: __props.paramsColConfig
|
|
3959
|
+
}, {
|
|
3908
3960
|
"code-block-edit-panel-header": withCtx(({ id }) => [
|
|
3909
3961
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
3910
3962
|
]),
|
|
3911
3963
|
_: 3
|
|
3912
|
-
})) : createCommentVNode("", true)
|
|
3964
|
+
}, 8, ["paramsColConfig"])) : createCommentVNode("", true)
|
|
3913
3965
|
]);
|
|
3914
3966
|
};
|
|
3915
3967
|
}
|
|
@@ -4009,7 +4061,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4009
4061
|
name: `${index}`
|
|
4010
4062
|
}, {
|
|
4011
4063
|
title: withCtx(() => [
|
|
4012
|
-
createVNode(_sfc_main$
|
|
4064
|
+
createVNode(_sfc_main$s, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
4013
4065
|
createTextVNode(toDisplayString(group.title), 1)
|
|
4014
4066
|
]),
|
|
4015
4067
|
default: withCtx(() => [
|
|
@@ -4024,7 +4076,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4024
4076
|
onDrag: dragHandler
|
|
4025
4077
|
}, [
|
|
4026
4078
|
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
4027
|
-
createVNode(_sfc_main$
|
|
4079
|
+
createVNode(_sfc_main$s, {
|
|
4028
4080
|
icon: item.icon
|
|
4029
4081
|
}, null, 8, ["icon"]),
|
|
4030
4082
|
createVNode(unref(TMagicTooltip), {
|
|
@@ -4407,13 +4459,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
4407
4459
|
});
|
|
4408
4460
|
watch(isMultiSelect, (isMultiSelect2) => {
|
|
4409
4461
|
if (!isMultiSelect2) {
|
|
4410
|
-
currentNodeKey.value = editorService?.get("node")
|
|
4462
|
+
currentNodeKey.value = editorService?.get("node")?.id;
|
|
4411
4463
|
tree.value?.setCurrentKey(currentNodeKey.value);
|
|
4412
4464
|
}
|
|
4413
4465
|
});
|
|
4414
4466
|
const editorServiceRemoveHandler = () => {
|
|
4415
4467
|
setTimeout(() => {
|
|
4416
|
-
tree.value?.getNode(editorService?.get("node")
|
|
4468
|
+
tree.value?.getNode(editorService?.get("node")?.id)?.updateChildren();
|
|
4417
4469
|
}, 0);
|
|
4418
4470
|
};
|
|
4419
4471
|
const windowBlurHandler = () => {
|
|
@@ -4619,7 +4671,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4619
4671
|
(openBlock(), createElementBlock("div", {
|
|
4620
4672
|
key: config.text
|
|
4621
4673
|
}, [
|
|
4622
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
4674
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$s, {
|
|
4623
4675
|
key: 0,
|
|
4624
4676
|
icon: config.icon
|
|
4625
4677
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -4819,9 +4871,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4819
4871
|
const addPage = () => {
|
|
4820
4872
|
if (!editorService)
|
|
4821
4873
|
return;
|
|
4874
|
+
const root = toRaw(editorService.get("root"));
|
|
4875
|
+
if (!root)
|
|
4876
|
+
throw new Error("root \u4E0D\u80FD\u4E3A\u7A7A");
|
|
4822
4877
|
const pageConfig = {
|
|
4823
4878
|
type: NodeType.PAGE,
|
|
4824
|
-
name: generatePageNameByApp(
|
|
4879
|
+
name: generatePageNameByApp(root)
|
|
4825
4880
|
};
|
|
4826
4881
|
editorService.add(pageConfig);
|
|
4827
4882
|
};
|
|
@@ -4837,14 +4892,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4837
4892
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4838
4893
|
onClick: addPage
|
|
4839
4894
|
}, [
|
|
4840
|
-
createVNode(_sfc_main$
|
|
4895
|
+
createVNode(_sfc_main$s, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
4841
4896
|
])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
|
|
4842
4897
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
4843
4898
|
key: 2,
|
|
4844
4899
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4845
4900
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4846
4901
|
}, [
|
|
4847
|
-
createVNode(_sfc_main$
|
|
4902
|
+
createVNode(_sfc_main$s, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
4848
4903
|
])) : createCommentVNode("", true),
|
|
4849
4904
|
unref(pageLength) ? (openBlock(), createElementBlock("div", {
|
|
4850
4905
|
key: 3,
|
|
@@ -4860,7 +4915,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4860
4915
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4861
4916
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4862
4917
|
}, [
|
|
4863
|
-
createVNode(_sfc_main$
|
|
4918
|
+
createVNode(_sfc_main$s, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
4864
4919
|
])) : createCommentVNode("", true)
|
|
4865
4920
|
], 512);
|
|
4866
4921
|
};
|
|
@@ -5405,7 +5460,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5405
5460
|
type: "button",
|
|
5406
5461
|
text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
|
|
5407
5462
|
handler: () => {
|
|
5408
|
-
editorService?.get("stage")
|
|
5463
|
+
editorService?.get("stage")?.clearGuides();
|
|
5409
5464
|
}
|
|
5410
5465
|
},
|
|
5411
5466
|
...props.stageContentMenu
|
|
@@ -5456,7 +5511,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
5456
5511
|
const stageWrap = ref();
|
|
5457
5512
|
const stageContainer = ref();
|
|
5458
5513
|
const menu = ref();
|
|
5459
|
-
const
|
|
5514
|
+
const nodes = computed(() => services?.editorService.get("nodes") || []);
|
|
5515
|
+
const isMultiSelect = computed(() => nodes.value.length > 1);
|
|
5460
5516
|
const stageRect = computed(() => services?.uiService.get("stageRect"));
|
|
5461
5517
|
const stageContainerRect = computed(() => services?.uiService.get("stageContainerRect"));
|
|
5462
5518
|
const root = computed(() => services?.editorService.get("root"));
|
|
@@ -6086,13 +6142,13 @@ const index = {
|
|
|
6086
6142
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
6087
6143
|
setConfig(option);
|
|
6088
6144
|
app.component(Editor.name, Editor);
|
|
6089
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
6145
|
+
app.component("m-fields-ui-select", _sfc_main$q);
|
|
6090
6146
|
app.component("m-fields-code-link", _sfc_main$t);
|
|
6091
6147
|
app.component("m-fields-vs-code", _sfc_main$u);
|
|
6092
|
-
app.component("magic-code-editor", _sfc_main$
|
|
6093
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
6148
|
+
app.component("magic-code-editor", _sfc_main$p);
|
|
6149
|
+
app.component("m-fields-code-select", _sfc_main$r);
|
|
6094
6150
|
}
|
|
6095
6151
|
};
|
|
6096
6152
|
|
|
6097
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType,
|
|
6153
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, _sfc_main$r as CodeSelect, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$s as Icon, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$n as LayoutContainer, _sfc_main$i as PropsPanel, _sfc_main$p as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$k as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
|
|
6098
6154
|
//# sourceMappingURL=tmagic-editor.js.map
|