@tmagic/editor 1.3.0-beta.1 → 1.3.0-beta.3
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 +67 -75
- package/dist/tmagic-editor.js +1667 -1062
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +1692 -1084
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/Editor.vue +70 -65
- package/src/components/ContentMenu.vue +5 -1
- package/src/components/SearchInput.vue +5 -1
- package/src/components/ToolButton.vue +1 -1
- package/src/editorProps.ts +51 -129
- package/src/fields/Code.vue +9 -3
- package/src/fields/DataSourceFieldSelect.vue +28 -16
- package/src/fields/DataSourceFields.vue +95 -7
- package/src/fields/DataSourceMethodSelect.vue +23 -14
- package/src/fields/DataSourceMocks.vue +237 -0
- package/src/fields/EventSelect.vue +30 -11
- package/src/index.ts +4 -1
- package/src/initService.ts +50 -20
- package/src/layouts/CodeEditor.vue +20 -4
- package/src/layouts/Framework.vue +3 -1
- package/src/layouts/PropsPanel.vue +3 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +18 -8
- package/src/layouts/sidebar/Sidebar.vue +7 -10
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +3 -1
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +3 -1
- package/src/layouts/sidebar/layer/LayerNode.vue +206 -0
- package/src/layouts/sidebar/layer/LayerNodeTool.vue +32 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +85 -0
- package/src/layouts/sidebar/layer/use-drag.ts +157 -0
- package/src/layouts/sidebar/layer/use-filter.ts +70 -0
- package/src/layouts/sidebar/layer/use-keybinding.ts +47 -0
- package/src/layouts/sidebar/layer/use-node-status.ts +103 -0
- package/src/layouts/workspace/Workspace.vue +3 -1
- package/src/layouts/workspace/viewer/NodeListMenu.vue +16 -9
- package/src/layouts/workspace/viewer/Stage.vue +19 -17
- package/src/layouts/workspace/viewer/ViewerMenu.vue +1 -1
- package/src/services/dataSource.ts +21 -0
- package/src/services/editor.ts +45 -5
- package/src/theme/common/var.scss +2 -2
- package/src/theme/content-menu.scss +22 -20
- package/src/theme/framework.scss +2 -0
- package/src/theme/layer-panel.scss +63 -63
- package/src/theme/props-panel.scss +8 -0
- package/src/theme/sidebar.scss +1 -5
- package/src/type.ts +61 -0
- package/src/utils/data-source/index.ts +23 -0
- package/src/utils/dep.ts +26 -11
- package/src/utils/editor.ts +14 -3
- package/src/utils/props.ts +4 -0
- package/types/editorProps.d.ts +61 -107
- package/types/fields/Code.vue.d.ts +10 -6
- package/types/fields/DataSourceMocks.vue.d.ts +32 -0
- package/types/index.d.ts +2 -1
- package/types/initService.d.ts +5 -4
- package/types/layouts/CodeEditor.vue.d.ts +5 -0
- package/types/layouts/Framework.vue.d.ts +2 -12
- package/types/layouts/PropsPanel.vue.d.ts +2 -3
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +2 -7
- package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -17
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +2 -7
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +2 -9
- package/types/layouts/sidebar/{LayerMenu.vue.d.ts → layer/LayerMenu.vue.d.ts} +1 -1
- package/types/layouts/sidebar/layer/LayerNode.vue.d.ts +50 -0
- package/types/layouts/sidebar/{LayerNode.vue.d.ts → layer/LayerNodeTool.vue.d.ts} +1 -1
- package/types/layouts/sidebar/{LayerPanel.vue.d.ts → layer/LayerPanel.vue.d.ts} +2 -8
- package/types/layouts/sidebar/layer/use-drag.d.ts +14 -0
- package/types/layouts/sidebar/layer/use-filter.d.ts +8 -0
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +4 -0
- package/types/layouts/sidebar/layer/use-node-status.d.ts +7 -0
- package/types/layouts/workspace/Workspace.vue.d.ts +2 -11
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +1 -1
- package/types/services/dataSource.d.ts +7 -0
- package/types/services/editor.d.ts +1 -0
- package/types/type.d.ts +61 -0
- package/types/utils/dep.d.ts +1 -1
- package/types/utils/editor.d.ts +3 -2
- package/src/layouts/sidebar/LayerNode.vue +0 -40
- package/src/layouts/sidebar/LayerPanel.vue +0 -369
- package/types/Editor.vue.d.ts +0 -233
- /package/src/layouts/sidebar/{LayerMenu.vue → layer/LayerMenu.vue} +0 -0
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, createTextVNode, createCommentVNode, toRaw, resolveDynamicComponent, nextTick, mergeProps, toDisplayString, renderList, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, createStaticVNode, Transition, onBeforeUnmount, toHandlers,
|
|
2
|
-
import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, CopyDocument, DocumentCopy, Files, Hide, Goods, List, EditPen, Top, Bottom, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons-vue';
|
|
3
|
-
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, map, has,
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, createTextVNode, createCommentVNode, toRaw, resolveDynamicComponent, nextTick, mergeProps, toDisplayString, renderList, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, createStaticVNode, Transition, onBeforeUnmount, provide, toHandlers, mergeDefaults } from 'vue';
|
|
2
|
+
import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, CopyDocument, DocumentCopy, Files, Hide, ArrowRight, Goods, List, EditPen, Top, Bottom, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons-vue';
|
|
3
|
+
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, map, has, pick, keys } from 'lodash-es';
|
|
4
4
|
import * as monaco from 'monaco-editor';
|
|
5
5
|
import serialize from 'serialize-javascript';
|
|
6
|
-
import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicTree, TMagicPopover, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
6
|
+
import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicTree, TMagicPopover, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
7
7
|
import { HookType, NodeType, ActionType } from '@tmagic/schema';
|
|
8
8
|
import { MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
|
|
9
9
|
import { MagicTable } from '@tmagic/table';
|
|
10
|
+
import { guid, isPop, getNodePath, isNumber, isPage, toLine, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getDefaultValueFromFields, addClassName, removeClassName, getKeys, removeClassNameByClassName, getNodes, isObject as isObject$1 } from '@tmagic/utils';
|
|
10
11
|
import Gesto from 'gesto';
|
|
11
|
-
import { guid, isPop, getNodePath, isNumber, isPage, toLine, removeClassNameByClassName, getNodes, isObject as isObject$1 } from '@tmagic/utils';
|
|
12
12
|
import StageCore, { GuidesType, StageDragStatus, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
13
13
|
import { EventEmitter } from 'events';
|
|
14
14
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
15
15
|
import KeyController from 'keycon';
|
|
16
16
|
|
|
17
|
+
let $TMAGIC_EDITOR = {};
|
|
18
|
+
const setConfig = (option) => {
|
|
19
|
+
$TMAGIC_EDITOR = option;
|
|
20
|
+
};
|
|
21
|
+
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
22
|
+
|
|
17
23
|
const _hoisted_1$w = {
|
|
18
24
|
class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
|
|
19
25
|
};
|
|
20
|
-
const _sfc_main$
|
|
26
|
+
const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
21
27
|
...{
|
|
22
28
|
name: "MEditorCodeEditor"
|
|
23
29
|
},
|
|
@@ -31,7 +37,8 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
31
37
|
tabSize: 2
|
|
32
38
|
}) },
|
|
33
39
|
height: {},
|
|
34
|
-
autoSave: { type: Boolean, default: true }
|
|
40
|
+
autoSave: { type: Boolean, default: true },
|
|
41
|
+
parse: { type: Boolean, default: false }
|
|
35
42
|
},
|
|
36
43
|
emits: ["initd", "save"],
|
|
37
44
|
setup(__props, { expose: __expose, emit }) {
|
|
@@ -39,7 +46,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
39
46
|
const toString = (v, language) => {
|
|
40
47
|
let value = "";
|
|
41
48
|
if (typeof v !== "string") {
|
|
42
|
-
if (
|
|
49
|
+
if (language === "json") {
|
|
43
50
|
value = JSON.stringify(v, null, 2);
|
|
44
51
|
} else {
|
|
45
52
|
value = serialize(v, {
|
|
@@ -55,6 +62,15 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
55
62
|
}
|
|
56
63
|
return value;
|
|
57
64
|
};
|
|
65
|
+
const parse = (v, language) => {
|
|
66
|
+
if (typeof v !== "string") {
|
|
67
|
+
return v;
|
|
68
|
+
}
|
|
69
|
+
if (language === "json") {
|
|
70
|
+
return JSON.parse(v);
|
|
71
|
+
}
|
|
72
|
+
return getConfig("parseDSL")(v);
|
|
73
|
+
};
|
|
58
74
|
let vsEditor = null;
|
|
59
75
|
let vsDiffEditor = null;
|
|
60
76
|
const values = ref("");
|
|
@@ -67,7 +83,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
67
83
|
}, 300)
|
|
68
84
|
);
|
|
69
85
|
const setEditorValue = (v, m) => {
|
|
70
|
-
values.value = toString(v, props.language);
|
|
86
|
+
values.value = toString(v, props.language.toLocaleLowerCase());
|
|
71
87
|
if (props.type === "diff") {
|
|
72
88
|
const originalModel = monaco.editor.createModel(values.value, "text/javascript");
|
|
73
89
|
const modifiedModel = monaco.editor.createModel(toString(m, props.language), "text/javascript");
|
|
@@ -102,7 +118,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
102
118
|
e.stopPropagation();
|
|
103
119
|
const newValue = getEditorValue();
|
|
104
120
|
values.value = newValue;
|
|
105
|
-
emit("save", newValue);
|
|
121
|
+
emit("save", props.parse ? parse(newValue, props.language) : newValue);
|
|
106
122
|
}
|
|
107
123
|
});
|
|
108
124
|
if (props.type !== "diff" && props.autoSave) {
|
|
@@ -110,7 +126,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
110
126
|
const newValue = getEditorValue();
|
|
111
127
|
if (values.value !== newValue) {
|
|
112
128
|
values.value = newValue;
|
|
113
|
-
emit("save", newValue);
|
|
129
|
+
emit("save", props.parse ? parse(newValue, props.language) : newValue);
|
|
114
130
|
}
|
|
115
131
|
});
|
|
116
132
|
}
|
|
@@ -192,7 +208,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
192
208
|
}
|
|
193
209
|
});
|
|
194
210
|
|
|
195
|
-
const _sfc_main$
|
|
211
|
+
const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
196
212
|
...{
|
|
197
213
|
name: "MEditorCode"
|
|
198
214
|
},
|
|
@@ -216,7 +232,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
216
232
|
emit("change", v);
|
|
217
233
|
};
|
|
218
234
|
return (_ctx, _cache) => {
|
|
219
|
-
return openBlock(), createBlock(_sfc_main$
|
|
235
|
+
return openBlock(), createBlock(_sfc_main$S, {
|
|
220
236
|
height: _ctx.config.height,
|
|
221
237
|
"init-values": _ctx.model[_ctx.name],
|
|
222
238
|
language: _ctx.config.language,
|
|
@@ -224,19 +240,14 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
224
240
|
..._ctx.config.options,
|
|
225
241
|
readOnly: _ctx.disabled
|
|
226
242
|
},
|
|
243
|
+
parse: _ctx.config.parse,
|
|
227
244
|
onSave: save
|
|
228
|
-
}, null, 8, ["height", "init-values", "language", "options"]);
|
|
245
|
+
}, null, 8, ["height", "init-values", "language", "options", "parse"]);
|
|
229
246
|
};
|
|
230
247
|
}
|
|
231
248
|
});
|
|
232
249
|
|
|
233
|
-
|
|
234
|
-
const setConfig = (option) => {
|
|
235
|
-
$TMAGIC_EDITOR = option;
|
|
236
|
-
};
|
|
237
|
-
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
238
|
-
|
|
239
|
-
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
250
|
+
const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
240
251
|
...{
|
|
241
252
|
name: "MEditorCodeLink"
|
|
242
253
|
},
|
|
@@ -315,7 +326,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
315
326
|
}
|
|
316
327
|
});
|
|
317
328
|
|
|
318
|
-
const _sfc_main$
|
|
329
|
+
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
319
330
|
...{
|
|
320
331
|
name: "MEditorCodeSelect"
|
|
321
332
|
},
|
|
@@ -388,10 +399,10 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
388
399
|
});
|
|
389
400
|
|
|
390
401
|
const _hoisted_1$v = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
391
|
-
const _hoisted_2$
|
|
392
|
-
const _hoisted_3$
|
|
393
|
-
const _hoisted_4$
|
|
394
|
-
const _sfc_main$
|
|
402
|
+
const _hoisted_2$p = { style: { "flex": "1" } };
|
|
403
|
+
const _hoisted_3$b = { style: { "flex": "1" } };
|
|
404
|
+
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
405
|
+
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
395
406
|
...{
|
|
396
407
|
name: "MEditorCodeBlockEditor"
|
|
397
408
|
},
|
|
@@ -610,7 +621,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
610
621
|
fullscreen: ""
|
|
611
622
|
}, {
|
|
612
623
|
footer: withCtx(() => [
|
|
613
|
-
createElementVNode("span", _hoisted_4$
|
|
624
|
+
createElementVNode("span", _hoisted_4$7, [
|
|
614
625
|
createVNode(unref(TMagicButton), {
|
|
615
626
|
size: "small",
|
|
616
627
|
onClick: _cache[1] || (_cache[1] = ($event) => difVisible.value = false)
|
|
@@ -634,7 +645,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
634
645
|
]),
|
|
635
646
|
default: withCtx(() => [
|
|
636
647
|
createElementVNode("div", _hoisted_1$v, [
|
|
637
|
-
createElementVNode("div", _hoisted_2$
|
|
648
|
+
createElementVNode("div", _hoisted_2$p, [
|
|
638
649
|
createVNode(unref(TMagicTag), {
|
|
639
650
|
size: "small",
|
|
640
651
|
type: "info"
|
|
@@ -645,7 +656,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
645
656
|
_: 1
|
|
646
657
|
})
|
|
647
658
|
]),
|
|
648
|
-
createElementVNode("div", _hoisted_3$
|
|
659
|
+
createElementVNode("div", _hoisted_3$b, [
|
|
649
660
|
createVNode(unref(TMagicTag), {
|
|
650
661
|
size: "small",
|
|
651
662
|
type: "success"
|
|
@@ -657,7 +668,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
657
668
|
})
|
|
658
669
|
])
|
|
659
670
|
]),
|
|
660
|
-
difVisible.value ? (openBlock(), createBlock(_sfc_main$
|
|
671
|
+
difVisible.value ? (openBlock(), createBlock(_sfc_main$S, {
|
|
661
672
|
key: 0,
|
|
662
673
|
ref_key: "magicVsEditor",
|
|
663
674
|
ref: magicVsEditor,
|
|
@@ -786,6 +797,29 @@ const fillConfig$1 = (config) => [
|
|
|
786
797
|
defaultValue: () => []
|
|
787
798
|
}
|
|
788
799
|
]
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
type: "panel",
|
|
803
|
+
title: "事件配置",
|
|
804
|
+
display: false,
|
|
805
|
+
items: [
|
|
806
|
+
{
|
|
807
|
+
name: "events",
|
|
808
|
+
src: "datasource",
|
|
809
|
+
type: "event-select"
|
|
810
|
+
}
|
|
811
|
+
]
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
type: "panel",
|
|
815
|
+
title: "mock数据",
|
|
816
|
+
items: [
|
|
817
|
+
{
|
|
818
|
+
name: "mocks",
|
|
819
|
+
type: "data-source-mocks",
|
|
820
|
+
defaultValue: () => []
|
|
821
|
+
}
|
|
822
|
+
]
|
|
789
823
|
}
|
|
790
824
|
];
|
|
791
825
|
const getFormConfig = (type, configs) => {
|
|
@@ -966,7 +1000,9 @@ class DataSource extends BaseService {
|
|
|
966
1000
|
dataSources: [],
|
|
967
1001
|
editable: true,
|
|
968
1002
|
configs: {},
|
|
969
|
-
values: {}
|
|
1003
|
+
values: {},
|
|
1004
|
+
events: {},
|
|
1005
|
+
methods: {}
|
|
970
1006
|
});
|
|
971
1007
|
set(name, value) {
|
|
972
1008
|
this.state[name] = value;
|
|
@@ -986,6 +1022,18 @@ class DataSource extends BaseService {
|
|
|
986
1022
|
setFormValue(type, value) {
|
|
987
1023
|
this.get("values")[type] = value;
|
|
988
1024
|
}
|
|
1025
|
+
getFormEvent(type = "base") {
|
|
1026
|
+
return this.get("events")[type] || [];
|
|
1027
|
+
}
|
|
1028
|
+
setFormEvent(type, value = []) {
|
|
1029
|
+
this.get("events")[type] = value;
|
|
1030
|
+
}
|
|
1031
|
+
getFormMethod(type = "base") {
|
|
1032
|
+
return this.get("methods")[type] || [];
|
|
1033
|
+
}
|
|
1034
|
+
setFormMethod(type, value = []) {
|
|
1035
|
+
this.get("methods")[type] = value;
|
|
1036
|
+
}
|
|
989
1037
|
add(config) {
|
|
990
1038
|
const newConfig = {
|
|
991
1039
|
...config,
|
|
@@ -1202,6 +1250,7 @@ const eventTabConfig = {
|
|
|
1202
1250
|
items: [
|
|
1203
1251
|
{
|
|
1204
1252
|
name: "events",
|
|
1253
|
+
src: "component",
|
|
1205
1254
|
type: "event-select"
|
|
1206
1255
|
}
|
|
1207
1256
|
]
|
|
@@ -1231,6 +1280,8 @@ const displayTabConfig = {
|
|
|
1231
1280
|
{
|
|
1232
1281
|
type: "groupList",
|
|
1233
1282
|
name: "displayConds",
|
|
1283
|
+
titlePrefix: "条件组",
|
|
1284
|
+
expandAll: true,
|
|
1234
1285
|
items: [
|
|
1235
1286
|
{
|
|
1236
1287
|
type: "table",
|
|
@@ -1239,6 +1290,7 @@ const displayTabConfig = {
|
|
|
1239
1290
|
{
|
|
1240
1291
|
type: "data-source-field-select",
|
|
1241
1292
|
name: "field",
|
|
1293
|
+
value: "key",
|
|
1242
1294
|
label: "字段"
|
|
1243
1295
|
},
|
|
1244
1296
|
{
|
|
@@ -1424,6 +1476,11 @@ var DepTargetType = /* @__PURE__ */ ((DepTargetType2) => {
|
|
|
1424
1476
|
DepTargetType2["DATA_SOURCE_COND"] = "data-source-cond";
|
|
1425
1477
|
return DepTargetType2;
|
|
1426
1478
|
})(DepTargetType || {});
|
|
1479
|
+
var DragType = /* @__PURE__ */ ((DragType2) => {
|
|
1480
|
+
DragType2["COMPONENT_LIST"] = "component-list";
|
|
1481
|
+
DragType2["LAYER_TREE"] = "layer-tree";
|
|
1482
|
+
return DragType2;
|
|
1483
|
+
})(DragType || {});
|
|
1427
1484
|
|
|
1428
1485
|
const COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
1429
1486
|
const getPageList = (app) => {
|
|
@@ -1446,9 +1503,9 @@ const generatePageName = (pageNameList) => {
|
|
|
1446
1503
|
};
|
|
1447
1504
|
const generatePageNameByApp = (app) => generatePageName(getPageNameList(getPageList(app)));
|
|
1448
1505
|
const isFixed = (node) => node.style?.position === "fixed";
|
|
1449
|
-
const getNodeIndex = (
|
|
1506
|
+
const getNodeIndex = (id, parent) => {
|
|
1450
1507
|
const items = parent?.items || [];
|
|
1451
|
-
return items.findIndex((item) => `${item.id}` === `${
|
|
1508
|
+
return items.findIndex((item) => `${item.id}` === `${id}`);
|
|
1452
1509
|
};
|
|
1453
1510
|
const getRelativeStyle = (style = {}) => ({
|
|
1454
1511
|
...style,
|
|
@@ -1584,6 +1641,15 @@ const serializeConfig = (config) => serialize(config, {
|
|
|
1584
1641
|
space: 2,
|
|
1585
1642
|
unsafe: true
|
|
1586
1643
|
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1644
|
+
const traverseNode = (node, cb, parents = []) => {
|
|
1645
|
+
cb(node, parents);
|
|
1646
|
+
if (node.items?.length) {
|
|
1647
|
+
parents.push(node);
|
|
1648
|
+
node.items.forEach((item) => {
|
|
1649
|
+
traverseNode(item, cb, parents);
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1587
1653
|
|
|
1588
1654
|
class UndoRedo {
|
|
1589
1655
|
elementList;
|
|
@@ -1962,7 +2028,7 @@ class Props extends BaseService {
|
|
|
1962
2028
|
}
|
|
1963
2029
|
const propsService = new Props();
|
|
1964
2030
|
|
|
1965
|
-
|
|
2031
|
+
class Editor extends BaseService {
|
|
1966
2032
|
state = reactive({
|
|
1967
2033
|
root: null,
|
|
1968
2034
|
page: null,
|
|
@@ -1997,7 +2063,8 @@ let Editor$1 = class Editor extends BaseService {
|
|
|
1997
2063
|
"move",
|
|
1998
2064
|
"undo",
|
|
1999
2065
|
"redo",
|
|
2000
|
-
"highlight"
|
|
2066
|
+
"highlight",
|
|
2067
|
+
"dragTo"
|
|
2001
2068
|
],
|
|
2002
2069
|
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
2003
2070
|
["select", "update", "moveLayer"]
|
|
@@ -2140,7 +2207,7 @@ let Editor$1 = class Editor extends BaseService {
|
|
|
2140
2207
|
const parent = toRaw(this.getParentById(node.id));
|
|
2141
2208
|
if (!parent)
|
|
2142
2209
|
return node;
|
|
2143
|
-
const index = getNodeIndex(node, parent);
|
|
2210
|
+
const index = getNodeIndex(node.id, parent);
|
|
2144
2211
|
const nextNode = parent.items[index + 1] || parent.items[0];
|
|
2145
2212
|
await this.select(nextNode);
|
|
2146
2213
|
this.get("stage")?.select(nextNode.id);
|
|
@@ -2153,7 +2220,7 @@ let Editor$1 = class Editor extends BaseService {
|
|
|
2153
2220
|
throw new Error("page不能为空");
|
|
2154
2221
|
if (!root)
|
|
2155
2222
|
throw new Error("root不能为空");
|
|
2156
|
-
const index = getNodeIndex(page, root);
|
|
2223
|
+
const index = getNodeIndex(page.id, root);
|
|
2157
2224
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
2158
2225
|
await this.select(nextPage);
|
|
2159
2226
|
this.get("stage")?.select(nextPage.id);
|
|
@@ -2274,7 +2341,7 @@ let Editor$1 = class Editor extends BaseService {
|
|
|
2274
2341
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
2275
2342
|
if (!parent || !curNode)
|
|
2276
2343
|
throw new Error("找不要删除的节点");
|
|
2277
|
-
const index = getNodeIndex(curNode, parent);
|
|
2344
|
+
const index = getNodeIndex(curNode.id, parent);
|
|
2278
2345
|
if (typeof index !== "number" || index === -1)
|
|
2279
2346
|
throw new Error("找不要删除的节点");
|
|
2280
2347
|
parent.items?.splice(index, 1);
|
|
@@ -2342,7 +2409,7 @@ let Editor$1 = class Editor extends BaseService {
|
|
|
2342
2409
|
if (!parent)
|
|
2343
2410
|
throw new Error("获取不到父级节点");
|
|
2344
2411
|
const parentNodeItems = parent.items;
|
|
2345
|
-
const index = getNodeIndex(newConfig, parent);
|
|
2412
|
+
const index = getNodeIndex(newConfig.id, parent);
|
|
2346
2413
|
if (!parentNodeItems || typeof index === "undefined" || index === -1)
|
|
2347
2414
|
throw new Error("更新的节点未找到");
|
|
2348
2415
|
const newLayout = await this.getLayout(newConfig);
|
|
@@ -2532,7 +2599,7 @@ let Editor$1 = class Editor extends BaseService {
|
|
|
2532
2599
|
const target = this.getNodeById(targetId, false);
|
|
2533
2600
|
const stage = this.get("stage");
|
|
2534
2601
|
if (root && node && parent && stage) {
|
|
2535
|
-
const index = getNodeIndex(node, parent);
|
|
2602
|
+
const index = getNodeIndex(node.id, parent);
|
|
2536
2603
|
parent.items?.splice(index, 1);
|
|
2537
2604
|
await stage.remove({ id: node.id, parentId: parent.id, root });
|
|
2538
2605
|
const layout = await this.getLayout(target);
|
|
@@ -2554,6 +2621,38 @@ let Editor$1 = class Editor extends BaseService {
|
|
|
2554
2621
|
return newConfig;
|
|
2555
2622
|
}
|
|
2556
2623
|
}
|
|
2624
|
+
async dragTo(config, targetParent, targetIndex) {
|
|
2625
|
+
if (!targetParent || !Array.isArray(targetParent.items))
|
|
2626
|
+
return;
|
|
2627
|
+
const { parent, node: curNode } = this.getNodeInfo(config.id, false);
|
|
2628
|
+
if (!parent || !curNode)
|
|
2629
|
+
throw new Error("找不要删除的节点");
|
|
2630
|
+
const index = getNodeIndex(curNode.id, parent);
|
|
2631
|
+
if (typeof index !== "number" || index === -1)
|
|
2632
|
+
throw new Error("找不要删除的节点");
|
|
2633
|
+
if (parent.id === targetParent.id) {
|
|
2634
|
+
if (index === targetIndex)
|
|
2635
|
+
return;
|
|
2636
|
+
if (index < targetIndex) {
|
|
2637
|
+
targetIndex -= 1;
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
parent.items?.splice(index, 1);
|
|
2641
|
+
targetParent.items?.splice(targetIndex, 0, config);
|
|
2642
|
+
const page = this.get("page");
|
|
2643
|
+
const root = this.get("root");
|
|
2644
|
+
const stage = this.get("stage");
|
|
2645
|
+
if (stage && page && root) {
|
|
2646
|
+
stage.update({
|
|
2647
|
+
config: cloneDeep(page),
|
|
2648
|
+
parentId: root.id,
|
|
2649
|
+
root: cloneDeep(root)
|
|
2650
|
+
});
|
|
2651
|
+
}
|
|
2652
|
+
this.addModifiedNodeId(config.id);
|
|
2653
|
+
this.addModifiedNodeId(parent.id);
|
|
2654
|
+
this.pushHistoryState();
|
|
2655
|
+
}
|
|
2557
2656
|
/**
|
|
2558
2657
|
* 撤销当前操作
|
|
2559
2658
|
* @returns 上一次数据
|
|
@@ -2698,8 +2797,8 @@ let Editor$1 = class Editor extends BaseService {
|
|
|
2698
2797
|
page
|
|
2699
2798
|
};
|
|
2700
2799
|
}
|
|
2701
|
-
}
|
|
2702
|
-
const editorService = new Editor
|
|
2800
|
+
}
|
|
2801
|
+
const editorService = new Editor();
|
|
2703
2802
|
|
|
2704
2803
|
const beforePaste = async (position, config) => {
|
|
2705
2804
|
if (!config[0]?.style)
|
|
@@ -2773,7 +2872,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
|
|
|
2773
2872
|
return newNode;
|
|
2774
2873
|
};
|
|
2775
2874
|
|
|
2776
|
-
const _sfc_main$
|
|
2875
|
+
const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
2777
2876
|
...{
|
|
2778
2877
|
name: "MEditorCodeParams"
|
|
2779
2878
|
},
|
|
@@ -2823,7 +2922,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
2823
2922
|
});
|
|
2824
2923
|
|
|
2825
2924
|
const _hoisted_1$u = ["src"];
|
|
2826
|
-
const _sfc_main$
|
|
2925
|
+
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
2827
2926
|
...{
|
|
2828
2927
|
name: "MEditorIcon"
|
|
2829
2928
|
},
|
|
@@ -2924,8 +3023,8 @@ const useCodeBlockEdit = (codeBlockService) => {
|
|
|
2924
3023
|
};
|
|
2925
3024
|
|
|
2926
3025
|
const _hoisted_1$t = { class: "m-fields-code-select-col" };
|
|
2927
|
-
const _hoisted_2$
|
|
2928
|
-
const _sfc_main$
|
|
3026
|
+
const _hoisted_2$o = { class: "code-select-container" };
|
|
3027
|
+
const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
2929
3028
|
...{
|
|
2930
3029
|
name: "MEditorCodeSelectCol"
|
|
2931
3030
|
},
|
|
@@ -3000,21 +3099,21 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
3000
3099
|
return (_ctx, _cache) => {
|
|
3001
3100
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
3002
3101
|
return openBlock(), createElementBlock("div", _hoisted_1$t, [
|
|
3003
|
-
createElementVNode("div", _hoisted_2$
|
|
3102
|
+
createElementVNode("div", _hoisted_2$o, [
|
|
3004
3103
|
createVNode(_component_m_form_container, {
|
|
3005
3104
|
class: "select",
|
|
3006
3105
|
config: selectConfig,
|
|
3007
3106
|
model: _ctx.model,
|
|
3008
3107
|
onChange: onParamsChangeHandler
|
|
3009
3108
|
}, null, 8, ["model"]),
|
|
3010
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
3109
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$M, {
|
|
3011
3110
|
key: 0,
|
|
3012
3111
|
class: "icon",
|
|
3013
3112
|
icon: !_ctx.disabled ? unref(Edit) : unref(View),
|
|
3014
3113
|
onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
|
|
3015
3114
|
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
3016
3115
|
]),
|
|
3017
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
3116
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$N, {
|
|
3018
3117
|
key: 0,
|
|
3019
3118
|
name: "params",
|
|
3020
3119
|
model: _ctx.model,
|
|
@@ -3022,7 +3121,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
3022
3121
|
"params-config": paramsConfig.value,
|
|
3023
3122
|
onChange: onParamsChangeHandler
|
|
3024
3123
|
}, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true),
|
|
3025
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
3124
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
|
|
3026
3125
|
key: 1,
|
|
3027
3126
|
ref_key: "codeBlockEditor",
|
|
3028
3127
|
ref: codeBlockEditor,
|
|
@@ -3036,8 +3135,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
3036
3135
|
});
|
|
3037
3136
|
|
|
3038
3137
|
const _hoisted_1$s = { class: "m-editor-data-source-fields" };
|
|
3039
|
-
const _hoisted_2$
|
|
3040
|
-
const _sfc_main$
|
|
3138
|
+
const _hoisted_2$n = { class: "m-editor-data-source-fields-footer" };
|
|
3139
|
+
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
3041
3140
|
...{
|
|
3042
3141
|
name: "MEditorDataSourceFields"
|
|
3043
3142
|
},
|
|
@@ -3059,11 +3158,11 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
3059
3158
|
const services = inject("services");
|
|
3060
3159
|
const addDialog = ref();
|
|
3061
3160
|
const fieldValues = ref({});
|
|
3062
|
-
const
|
|
3161
|
+
const fieldTitle = ref("");
|
|
3063
3162
|
const width = computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
|
|
3064
3163
|
const newHandler = () => {
|
|
3065
3164
|
fieldValues.value = {};
|
|
3066
|
-
|
|
3165
|
+
fieldTitle.value = "新增属性";
|
|
3067
3166
|
addDialog.value?.show();
|
|
3068
3167
|
};
|
|
3069
3168
|
const fieldChange = ({ index, ...value }) => {
|
|
@@ -3103,7 +3202,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
3103
3202
|
...row,
|
|
3104
3203
|
index
|
|
3105
3204
|
};
|
|
3106
|
-
|
|
3205
|
+
fieldTitle.value = `编辑${row.title}`;
|
|
3107
3206
|
addDialog.value?.show();
|
|
3108
3207
|
}
|
|
3109
3208
|
},
|
|
@@ -3173,12 +3272,16 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
3173
3272
|
{
|
|
3174
3273
|
name: "defaultValue",
|
|
3175
3274
|
text: "默认值",
|
|
3275
|
+
height: "200px",
|
|
3276
|
+
parse: true,
|
|
3176
3277
|
type: (mForm, { model }) => {
|
|
3177
3278
|
if (model.type === "number")
|
|
3178
3279
|
return "number";
|
|
3179
3280
|
if (model.type === "boolean")
|
|
3180
3281
|
return "select";
|
|
3181
|
-
|
|
3282
|
+
if (model.type === "string")
|
|
3283
|
+
return "text";
|
|
3284
|
+
return "vs-code";
|
|
3182
3285
|
},
|
|
3183
3286
|
options: [
|
|
3184
3287
|
{ text: "true", value: true },
|
|
@@ -3195,22 +3298,98 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
3195
3298
|
name: "fields",
|
|
3196
3299
|
type: "data-source-fields",
|
|
3197
3300
|
defaultValue: [],
|
|
3198
|
-
display: (formState, { model }) => model.type === "object"
|
|
3301
|
+
display: (formState, { model }) => model.type === "object" || model.type === "array"
|
|
3302
|
+
}
|
|
3303
|
+
];
|
|
3304
|
+
const addFromJsonDialog = ref();
|
|
3305
|
+
const jsonFromConfig = [
|
|
3306
|
+
{
|
|
3307
|
+
name: "data",
|
|
3308
|
+
type: "vs-code",
|
|
3309
|
+
labelWidth: "0",
|
|
3310
|
+
language: "json",
|
|
3311
|
+
height: "600px",
|
|
3312
|
+
options: inject("codeOptions", {})
|
|
3199
3313
|
}
|
|
3200
3314
|
];
|
|
3315
|
+
const jsonFromValues = ref({
|
|
3316
|
+
data: {}
|
|
3317
|
+
});
|
|
3318
|
+
const newFromJsonHandler = () => {
|
|
3319
|
+
addFromJsonDialog.value?.show();
|
|
3320
|
+
};
|
|
3321
|
+
const getValueType = (value) => {
|
|
3322
|
+
if (Array.isArray(value))
|
|
3323
|
+
return "array";
|
|
3324
|
+
if (value === null)
|
|
3325
|
+
return "null";
|
|
3326
|
+
if (typeof value === "object")
|
|
3327
|
+
return "object";
|
|
3328
|
+
if (typeof value === "number")
|
|
3329
|
+
return "number";
|
|
3330
|
+
if (typeof value === "boolean")
|
|
3331
|
+
return "boolean";
|
|
3332
|
+
if (typeof value === "string")
|
|
3333
|
+
return "string";
|
|
3334
|
+
return "any";
|
|
3335
|
+
};
|
|
3336
|
+
const getFieldsConfig = (value) => {
|
|
3337
|
+
if (!value || typeof value !== "object")
|
|
3338
|
+
throw new Error("数据格式错误");
|
|
3339
|
+
const fields = [];
|
|
3340
|
+
Object.entries(value).forEach(([key, value2]) => {
|
|
3341
|
+
const type = getValueType(value2);
|
|
3342
|
+
let childFields = [];
|
|
3343
|
+
if (Array.isArray(value2) && value2.length > 0) {
|
|
3344
|
+
childFields = getFieldsConfig(value2[0]);
|
|
3345
|
+
} else if (type === "object") {
|
|
3346
|
+
childFields = getFieldsConfig(value2);
|
|
3347
|
+
}
|
|
3348
|
+
fields.push({
|
|
3349
|
+
name: key,
|
|
3350
|
+
title: key,
|
|
3351
|
+
type,
|
|
3352
|
+
defaultValue: value2,
|
|
3353
|
+
fields: childFields
|
|
3354
|
+
});
|
|
3355
|
+
});
|
|
3356
|
+
return fields;
|
|
3357
|
+
};
|
|
3358
|
+
const addFromJsonFromChange = ({ data }) => {
|
|
3359
|
+
console.log(data);
|
|
3360
|
+
try {
|
|
3361
|
+
const value = JSON.parse(data);
|
|
3362
|
+
props.model[props.name] = getFieldsConfig(value);
|
|
3363
|
+
addFromJsonDialog.value?.hide();
|
|
3364
|
+
emit("change", props.model[props.name]);
|
|
3365
|
+
} catch (e) {
|
|
3366
|
+
tMagicMessage.error(e.message);
|
|
3367
|
+
}
|
|
3368
|
+
};
|
|
3201
3369
|
return (_ctx, _cache) => {
|
|
3202
3370
|
return openBlock(), createElementBlock("div", _hoisted_1$s, [
|
|
3203
3371
|
createVNode(unref(MagicTable), {
|
|
3204
3372
|
data: _ctx.model[_ctx.name],
|
|
3205
3373
|
columns: fieldColumns
|
|
3206
3374
|
}, null, 8, ["data"]),
|
|
3207
|
-
createElementVNode("div", _hoisted_2$
|
|
3375
|
+
createElementVNode("div", _hoisted_2$n, [
|
|
3376
|
+
createVNode(unref(TMagicButton), {
|
|
3377
|
+
size: "small",
|
|
3378
|
+
disabled: _ctx.disabled,
|
|
3379
|
+
plain: "",
|
|
3380
|
+
onClick: _cache[0] || (_cache[0] = ($event) => newFromJsonHandler())
|
|
3381
|
+
}, {
|
|
3382
|
+
default: withCtx(() => [
|
|
3383
|
+
createTextVNode("快速添加")
|
|
3384
|
+
]),
|
|
3385
|
+
_: 1
|
|
3386
|
+
}, 8, ["disabled"]),
|
|
3208
3387
|
createVNode(unref(TMagicButton), {
|
|
3209
3388
|
size: "small",
|
|
3210
3389
|
type: "primary",
|
|
3211
3390
|
disabled: _ctx.disabled,
|
|
3212
3391
|
plain: "",
|
|
3213
|
-
onClick: _cache[
|
|
3392
|
+
onClick: _cache[1] || (_cache[1] = ($event) => newHandler())
|
|
3214
3393
|
}, {
|
|
3215
3394
|
default: withCtx(() => [
|
|
3216
3395
|
createTextVNode("添加")
|
|
@@ -3222,20 +3401,30 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
3222
3401
|
ref_key: "addDialog",
|
|
3223
3402
|
ref: addDialog,
|
|
3224
3403
|
"label-width": "80px",
|
|
3225
|
-
title:
|
|
3404
|
+
title: fieldTitle.value,
|
|
3226
3405
|
config: dataSourceFieldsConfig,
|
|
3227
3406
|
values: fieldValues.value,
|
|
3228
3407
|
parentValues: _ctx.model[_ctx.name],
|
|
3229
3408
|
disabled: _ctx.disabled,
|
|
3230
3409
|
width: width.value,
|
|
3231
3410
|
onSubmit: fieldChange
|
|
3232
|
-
}, null, 8, ["title", "values", "parentValues", "disabled", "width"])
|
|
3411
|
+
}, null, 8, ["title", "values", "parentValues", "disabled", "width"]),
|
|
3412
|
+
createVNode(unref(MFormDrawer), {
|
|
3413
|
+
ref_key: "addFromJsonDialog",
|
|
3414
|
+
ref: addFromJsonDialog,
|
|
3415
|
+
title: "快速添加数据定义",
|
|
3416
|
+
config: jsonFromConfig,
|
|
3417
|
+
values: jsonFromValues.value,
|
|
3418
|
+
disabled: _ctx.disabled,
|
|
3419
|
+
width: width.value,
|
|
3420
|
+
onSubmit: addFromJsonFromChange
|
|
3421
|
+
}, null, 8, ["values", "disabled", "width"])
|
|
3233
3422
|
]);
|
|
3234
3423
|
};
|
|
3235
3424
|
}
|
|
3236
3425
|
});
|
|
3237
3426
|
|
|
3238
|
-
const _sfc_main$
|
|
3427
|
+
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
3239
3428
|
__name: "DataSourceFieldSelect",
|
|
3240
3429
|
props: {
|
|
3241
3430
|
config: {},
|
|
@@ -3253,18 +3442,25 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
3253
3442
|
const props = __props;
|
|
3254
3443
|
const services = inject("services");
|
|
3255
3444
|
const dataSources = computed(() => services?.dataSourceService.get("dataSources"));
|
|
3256
|
-
const
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3445
|
+
const getOptionChildren = (fields = []) => fields.map((field) => ({
|
|
3446
|
+
label: field.title || field.name,
|
|
3447
|
+
value: field.name,
|
|
3448
|
+
children: field.type === "array" ? [] : getOptionChildren(field.fields)
|
|
3449
|
+
}));
|
|
3450
|
+
const cascaderConfig = computed(() => {
|
|
3451
|
+
const valueIsKey = props.config.value === "key";
|
|
3452
|
+
return {
|
|
3453
|
+
type: "cascader",
|
|
3454
|
+
name: props.name,
|
|
3455
|
+
checkStrictly: !valueIsKey,
|
|
3456
|
+
text: "",
|
|
3457
|
+
options: () => dataSources.value?.filter((ds) => ds.fields?.length)?.map((ds) => ({
|
|
3458
|
+
label: ds.title || ds.id,
|
|
3459
|
+
value: valueIsKey ? ds.id : `${DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
|
|
3460
|
+
children: getOptionChildren(ds.fields)
|
|
3461
|
+
})) || []
|
|
3462
|
+
};
|
|
3463
|
+
});
|
|
3268
3464
|
const onChangeHandler = (value) => {
|
|
3269
3465
|
emit("change", value);
|
|
3270
3466
|
};
|
|
@@ -3273,7 +3469,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
3273
3469
|
return openBlock(), createBlock(_component_m_form_container, {
|
|
3274
3470
|
config: {
|
|
3275
3471
|
..._ctx.config,
|
|
3276
|
-
...cascaderConfig
|
|
3472
|
+
...cascaderConfig.value
|
|
3277
3473
|
},
|
|
3278
3474
|
model: _ctx.model,
|
|
3279
3475
|
onChange: onChangeHandler
|
|
@@ -3283,9 +3479,9 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
3283
3479
|
});
|
|
3284
3480
|
|
|
3285
3481
|
const _hoisted_1$r = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
3286
|
-
const _hoisted_2$
|
|
3287
|
-
const _hoisted_3$
|
|
3288
|
-
const _sfc_main$
|
|
3482
|
+
const _hoisted_2$m = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
3483
|
+
const _hoisted_3$a = { class: "el-input__inner" };
|
|
3484
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
3289
3485
|
...{
|
|
3290
3486
|
name: "MEditorDataSourceInput"
|
|
3291
3487
|
},
|
|
@@ -3474,12 +3670,12 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
3474
3670
|
}
|
|
3475
3671
|
), {
|
|
3476
3672
|
suffix: withCtx(() => [
|
|
3477
|
-
createVNode(_sfc_main$
|
|
3673
|
+
createVNode(_sfc_main$M, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
3478
3674
|
]),
|
|
3479
3675
|
default: withCtx(({ item }) => [
|
|
3480
3676
|
createElementVNode("div", _hoisted_1$r, [
|
|
3481
3677
|
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
3482
|
-
createElementVNode("span", _hoisted_2$
|
|
3678
|
+
createElementVNode("span", _hoisted_2$m, toDisplayString(item.value), 1)
|
|
3483
3679
|
])
|
|
3484
3680
|
]),
|
|
3485
3681
|
_: 1
|
|
@@ -3491,7 +3687,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
3491
3687
|
createElementVNode("div", {
|
|
3492
3688
|
class: normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
3493
3689
|
}, [
|
|
3494
|
-
createElementVNode("div", _hoisted_3$
|
|
3690
|
+
createElementVNode("div", _hoisted_3$a, [
|
|
3495
3691
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayState.value, (item, index) => {
|
|
3496
3692
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
3497
3693
|
item.type === "text" ? (openBlock(), createElementBlock("span", {
|
|
@@ -3509,7 +3705,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
3509
3705
|
}, 1032, ["size"])) : createCommentVNode("", true)
|
|
3510
3706
|
], 64);
|
|
3511
3707
|
}), 256)),
|
|
3512
|
-
createVNode(_sfc_main$
|
|
3708
|
+
createVNode(_sfc_main$M, {
|
|
3513
3709
|
class: "tmagic-data-source-input-icon",
|
|
3514
3710
|
icon: unref(Coin)
|
|
3515
3711
|
}, null, 8, ["icon"])
|
|
@@ -3593,8 +3789,8 @@ const useDataSourceMethod = () => {
|
|
|
3593
3789
|
};
|
|
3594
3790
|
|
|
3595
3791
|
const _hoisted_1$q = { class: "m-editor-data-source-methods" };
|
|
3596
|
-
const _hoisted_2$
|
|
3597
|
-
const _sfc_main$
|
|
3792
|
+
const _hoisted_2$l = { class: "m-editor-data-source-methods-footer" };
|
|
3793
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
3598
3794
|
...{
|
|
3599
3795
|
name: "MEditorDataSourceMethods"
|
|
3600
3796
|
},
|
|
@@ -3668,7 +3864,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
3668
3864
|
data: _ctx.model[_ctx.name],
|
|
3669
3865
|
columns: methodColumns
|
|
3670
3866
|
}, null, 8, ["data"]),
|
|
3671
|
-
createElementVNode("div", _hoisted_2$
|
|
3867
|
+
createElementVNode("div", _hoisted_2$l, [
|
|
3672
3868
|
createVNode(unref(TMagicButton), {
|
|
3673
3869
|
size: "small",
|
|
3674
3870
|
type: "primary",
|
|
@@ -3682,7 +3878,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
3682
3878
|
_: 1
|
|
3683
3879
|
}, 8, ["disabled"])
|
|
3684
3880
|
]),
|
|
3685
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
3881
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
|
|
3686
3882
|
key: 0,
|
|
3687
3883
|
ref_key: "codeBlockEditor",
|
|
3688
3884
|
ref: codeBlockEditor,
|
|
@@ -3698,8 +3894,8 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
3698
3894
|
});
|
|
3699
3895
|
|
|
3700
3896
|
const _hoisted_1$p = { class: "m-fields-data-source-method-select" };
|
|
3701
|
-
const _hoisted_2$
|
|
3702
|
-
const _sfc_main$
|
|
3897
|
+
const _hoisted_2$k = { class: "data-source-method-select-container" };
|
|
3898
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
3703
3899
|
...{
|
|
3704
3900
|
name: "MEditorDataSourceMethodSelect"
|
|
3705
3901
|
},
|
|
@@ -3719,7 +3915,8 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
3719
3915
|
setup(__props, { emit }) {
|
|
3720
3916
|
const props = __props;
|
|
3721
3917
|
const services = inject("services");
|
|
3722
|
-
const
|
|
3918
|
+
const dataSourceService = services?.dataSourceService;
|
|
3919
|
+
const dataSources = computed(() => dataSourceService?.get("dataSources"));
|
|
3723
3920
|
const getParamItemsConfig = ([dataSourceId, medthodName] = ["", ""]) => {
|
|
3724
3921
|
if (!dataSourceId)
|
|
3725
3922
|
return [];
|
|
@@ -3741,24 +3938,30 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
3741
3938
|
props.model.params = {};
|
|
3742
3939
|
}
|
|
3743
3940
|
};
|
|
3744
|
-
const
|
|
3941
|
+
const methodsOptions = computed(
|
|
3942
|
+
() => dataSources.value?.filter((ds) => ds.methods?.length || dataSourceService?.getFormMethod(ds.type).length)?.map((ds) => ({
|
|
3943
|
+
label: ds.title || ds.id,
|
|
3944
|
+
value: ds.id,
|
|
3945
|
+
children: [
|
|
3946
|
+
...dataSourceService?.getFormMethod(ds.type) || [],
|
|
3947
|
+
...(ds.methods || []).map((method) => ({
|
|
3948
|
+
label: method.name,
|
|
3949
|
+
value: method.name
|
|
3950
|
+
}))
|
|
3951
|
+
]
|
|
3952
|
+
})) || []
|
|
3953
|
+
);
|
|
3954
|
+
const cascaderConfig = computed(() => ({
|
|
3745
3955
|
type: "cascader",
|
|
3746
3956
|
text: "数据源方法",
|
|
3747
3957
|
name: props.name,
|
|
3748
3958
|
labelWidth: "80px",
|
|
3749
|
-
options:
|
|
3750
|
-
label: ds.title || ds.id,
|
|
3751
|
-
value: ds.id,
|
|
3752
|
-
children: ds.methods?.map((method) => ({
|
|
3753
|
-
label: method.name,
|
|
3754
|
-
value: method.name
|
|
3755
|
-
}))
|
|
3756
|
-
})) || [],
|
|
3959
|
+
options: methodsOptions.value,
|
|
3757
3960
|
onChange: (formState, dataSourceMethod) => {
|
|
3758
3961
|
setParamsConfig(dataSourceMethod, formState);
|
|
3759
3962
|
return dataSourceMethod;
|
|
3760
3963
|
}
|
|
3761
|
-
};
|
|
3964
|
+
}));
|
|
3762
3965
|
const onChangeHandler = (value) => {
|
|
3763
3966
|
props.model.params = value.params;
|
|
3764
3967
|
emit("change", props.model);
|
|
@@ -3766,7 +3969,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
3766
3969
|
const { codeBlockEditor, codeConfig, editCode, submitCode } = useDataSourceMethod();
|
|
3767
3970
|
const editCodeHandler = () => {
|
|
3768
3971
|
const [id, name] = props.model[props.name];
|
|
3769
|
-
const dataSource =
|
|
3972
|
+
const dataSource = dataSourceService?.getDataSourceById(id);
|
|
3770
3973
|
if (!dataSource)
|
|
3771
3974
|
return;
|
|
3772
3975
|
editCode(dataSource, name);
|
|
@@ -3778,21 +3981,21 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
3778
3981
|
return (_ctx, _cache) => {
|
|
3779
3982
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
3780
3983
|
return openBlock(), createElementBlock("div", _hoisted_1$p, [
|
|
3781
|
-
createElementVNode("div", _hoisted_2$
|
|
3984
|
+
createElementVNode("div", _hoisted_2$k, [
|
|
3782
3985
|
createVNode(_component_m_form_container, {
|
|
3783
3986
|
class: "select",
|
|
3784
|
-
config: cascaderConfig,
|
|
3987
|
+
config: cascaderConfig.value,
|
|
3785
3988
|
model: _ctx.model,
|
|
3786
3989
|
onChange: onChangeHandler
|
|
3787
|
-
}, null, 8, ["model"]),
|
|
3788
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
3990
|
+
}, null, 8, ["config", "model"]),
|
|
3991
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$M, {
|
|
3789
3992
|
key: 0,
|
|
3790
3993
|
class: "icon",
|
|
3791
3994
|
icon: !_ctx.disabled ? unref(Edit) : unref(View),
|
|
3792
3995
|
onClick: editCodeHandler
|
|
3793
3996
|
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
3794
3997
|
]),
|
|
3795
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
3998
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$N, {
|
|
3796
3999
|
key: 0,
|
|
3797
4000
|
name: "params",
|
|
3798
4001
|
model: _ctx.model,
|
|
@@ -3801,7 +4004,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
3801
4004
|
"params-config": paramsConfig.value,
|
|
3802
4005
|
onChange: onChangeHandler
|
|
3803
4006
|
}, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true),
|
|
3804
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
4007
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
|
|
3805
4008
|
key: 1,
|
|
3806
4009
|
ref_key: "codeBlockEditor",
|
|
3807
4010
|
ref: codeBlockEditor,
|
|
@@ -3814,11 +4017,13 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
3814
4017
|
}
|
|
3815
4018
|
});
|
|
3816
4019
|
|
|
3817
|
-
const
|
|
4020
|
+
const _hoisted_1$o = { class: "m-editor-data-source-fields" };
|
|
4021
|
+
const _hoisted_2$j = { class: "m-editor-data-source-fields-footer" };
|
|
4022
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
3818
4023
|
...{
|
|
3819
|
-
name: "
|
|
4024
|
+
name: "MEditorDataSourceMocks"
|
|
3820
4025
|
},
|
|
3821
|
-
__name: "
|
|
4026
|
+
__name: "DataSourceMocks",
|
|
3822
4027
|
props: {
|
|
3823
4028
|
config: {},
|
|
3824
4029
|
model: {},
|
|
@@ -3831,122 +4036,367 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
3831
4036
|
lastValues: {}
|
|
3832
4037
|
},
|
|
3833
4038
|
emits: ["change"],
|
|
3834
|
-
setup(__props, { emit }) {
|
|
3835
|
-
const props = __props;
|
|
3836
|
-
const { dataSourceService } = inject("services") || {};
|
|
3837
|
-
const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
|
|
3838
|
-
const selectConfig = computed(() => {
|
|
3839
|
-
const { type, dataSourceType, ...config } = props.config;
|
|
3840
|
-
return {
|
|
3841
|
-
...config,
|
|
3842
|
-
type: "select",
|
|
3843
|
-
valueKey: "dataSourceId",
|
|
3844
|
-
options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
|
|
3845
|
-
value: {
|
|
3846
|
-
isBindDataSource: true,
|
|
3847
|
-
dataSourceType: ds.type,
|
|
3848
|
-
dataSourceId: ds.id
|
|
3849
|
-
},
|
|
3850
|
-
text: ds.title || ds.id
|
|
3851
|
-
}))
|
|
3852
|
-
};
|
|
3853
|
-
});
|
|
3854
|
-
const changeHandler = (value) => {
|
|
3855
|
-
emit("change", value);
|
|
3856
|
-
};
|
|
3857
|
-
return (_ctx, _cache) => {
|
|
3858
|
-
return openBlock(), createBlock(unref(MSelect), {
|
|
3859
|
-
model: _ctx.model,
|
|
3860
|
-
name: _ctx.name,
|
|
3861
|
-
size: _ctx.size,
|
|
3862
|
-
prop: _ctx.prop,
|
|
3863
|
-
disabled: _ctx.disabled,
|
|
3864
|
-
config: selectConfig.value,
|
|
3865
|
-
"last-values": _ctx.lastValues,
|
|
3866
|
-
onChange: changeHandler
|
|
3867
|
-
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]);
|
|
3868
|
-
};
|
|
3869
|
-
}
|
|
3870
|
-
});
|
|
3871
|
-
|
|
3872
|
-
const _hoisted_1$o = { class: "m-fields-event-select" };
|
|
3873
|
-
const _hoisted_2$h = {
|
|
3874
|
-
key: 1,
|
|
3875
|
-
class: "fullWidth"
|
|
3876
|
-
};
|
|
3877
|
-
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
3878
|
-
...{
|
|
3879
|
-
name: "MEditorEventSelect"
|
|
3880
|
-
},
|
|
3881
|
-
__name: "EventSelect",
|
|
3882
|
-
props: {
|
|
3883
|
-
config: {},
|
|
3884
|
-
model: {},
|
|
3885
|
-
initValues: {},
|
|
3886
|
-
values: {},
|
|
3887
|
-
name: {},
|
|
3888
|
-
prop: {},
|
|
3889
|
-
disabled: { type: Boolean },
|
|
3890
|
-
size: {},
|
|
3891
|
-
lastValues: {}
|
|
3892
|
-
},
|
|
3893
|
-
emits: ["change"],
|
|
3894
4039
|
setup(__props, { emit }) {
|
|
3895
4040
|
const props = __props;
|
|
3896
4041
|
const services = inject("services");
|
|
3897
|
-
const
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
};
|
|
3908
|
-
return { ...defaultEventNameConfig, ...props.config.eventNameConfig };
|
|
3909
|
-
});
|
|
3910
|
-
const actionTypeConfig = computed(() => {
|
|
3911
|
-
const defaultActionTypeConfig = {
|
|
3912
|
-
name: "actionType",
|
|
3913
|
-
text: "联动类型",
|
|
3914
|
-
labelWidth: "80px",
|
|
3915
|
-
type: "select",
|
|
3916
|
-
defaultValue: ActionType.COMP,
|
|
3917
|
-
options: () => [
|
|
3918
|
-
{
|
|
3919
|
-
text: "组件",
|
|
3920
|
-
label: "组件",
|
|
3921
|
-
value: ActionType.COMP
|
|
3922
|
-
},
|
|
4042
|
+
const width = computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
|
|
4043
|
+
const addDialog = ref();
|
|
4044
|
+
const drawerTitle = ref("");
|
|
4045
|
+
const formValues = ref({});
|
|
4046
|
+
const formConfig = [
|
|
4047
|
+
{ name: "index", type: "hidden", filter: "number", defaultValue: -1 },
|
|
4048
|
+
{
|
|
4049
|
+
name: "title",
|
|
4050
|
+
text: "名称",
|
|
4051
|
+
rules: [
|
|
3923
4052
|
{
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
disabled: !Object.keys(services?.codeBlockService.getCodeDsl() || {}).length,
|
|
3927
|
-
value: ActionType.CODE
|
|
4053
|
+
required: true,
|
|
4054
|
+
message: "请输入字段名称"
|
|
3928
4055
|
},
|
|
3929
4056
|
{
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
disabled: !services?.dataSourceService.get("dataSources")?.filter((ds) => ds.methods?.length).length,
|
|
3933
|
-
value: ActionType.DATA_SOURCE
|
|
4057
|
+
required: true,
|
|
4058
|
+
message: "请输入名称"
|
|
3934
4059
|
}
|
|
3935
4060
|
]
|
|
3936
|
-
}
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
type: "
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4061
|
+
},
|
|
4062
|
+
{
|
|
4063
|
+
name: "description",
|
|
4064
|
+
text: "描述"
|
|
4065
|
+
},
|
|
4066
|
+
{
|
|
4067
|
+
name: "enable",
|
|
4068
|
+
text: "启用",
|
|
4069
|
+
type: "switch"
|
|
4070
|
+
},
|
|
4071
|
+
{
|
|
4072
|
+
name: "useInEditor",
|
|
4073
|
+
text: "编辑器中使用",
|
|
4074
|
+
type: "switch"
|
|
4075
|
+
},
|
|
4076
|
+
{
|
|
4077
|
+
name: "data",
|
|
4078
|
+
text: "mock数据",
|
|
4079
|
+
type: "vs-code",
|
|
4080
|
+
language: "json",
|
|
4081
|
+
options: inject("codeOptions", {}),
|
|
4082
|
+
defaultValue: "{}",
|
|
4083
|
+
height: "400px",
|
|
4084
|
+
onChange: (formState, v) => {
|
|
4085
|
+
if (typeof v !== "string")
|
|
4086
|
+
return v;
|
|
4087
|
+
return JSON.parse(v);
|
|
4088
|
+
},
|
|
4089
|
+
rules: [
|
|
4090
|
+
{
|
|
4091
|
+
validator: ({ value, callback }) => {
|
|
4092
|
+
if (typeof value !== "string")
|
|
4093
|
+
return callback();
|
|
4094
|
+
try {
|
|
4095
|
+
JSON.parse(value);
|
|
4096
|
+
callback();
|
|
4097
|
+
} catch (error) {
|
|
4098
|
+
callback(error);
|
|
4099
|
+
}
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
]
|
|
4103
|
+
}
|
|
4104
|
+
];
|
|
4105
|
+
const columns = [
|
|
4106
|
+
{
|
|
4107
|
+
type: "expand",
|
|
4108
|
+
component: _sfc_main$S,
|
|
4109
|
+
props: (row) => ({
|
|
4110
|
+
initValues: row.data,
|
|
4111
|
+
language: "json",
|
|
4112
|
+
height: "150px",
|
|
4113
|
+
options: {
|
|
4114
|
+
readOnly: true
|
|
4115
|
+
}
|
|
4116
|
+
})
|
|
4117
|
+
},
|
|
4118
|
+
{
|
|
4119
|
+
label: "名称",
|
|
4120
|
+
prop: "title"
|
|
4121
|
+
},
|
|
4122
|
+
{
|
|
4123
|
+
label: "描述",
|
|
4124
|
+
prop: "description"
|
|
4125
|
+
},
|
|
4126
|
+
{
|
|
4127
|
+
label: "是否启用",
|
|
4128
|
+
prop: "enable",
|
|
4129
|
+
type: "component",
|
|
4130
|
+
component: TMagicSwitch,
|
|
4131
|
+
props: (row) => ({
|
|
4132
|
+
modelValue: row.enable,
|
|
4133
|
+
activeValue: true,
|
|
4134
|
+
inactiveValue: false
|
|
4135
|
+
}),
|
|
4136
|
+
listeners: (row, index) => ({
|
|
4137
|
+
"update:modelValue": (v) => {
|
|
4138
|
+
toggleValue(row, "enable", v, index);
|
|
4139
|
+
}
|
|
4140
|
+
})
|
|
4141
|
+
},
|
|
4142
|
+
{
|
|
4143
|
+
label: "编辑器中使用",
|
|
4144
|
+
prop: "useInEditor",
|
|
4145
|
+
type: "component",
|
|
4146
|
+
component: TMagicSwitch,
|
|
4147
|
+
props: (row) => ({
|
|
4148
|
+
modelValue: row.useInEditor,
|
|
4149
|
+
activeValue: true,
|
|
4150
|
+
inactiveValue: false
|
|
4151
|
+
}),
|
|
4152
|
+
listeners: (row, index) => ({
|
|
4153
|
+
"update:modelValue": (v) => {
|
|
4154
|
+
toggleValue(row, "useInEditor", v, index);
|
|
4155
|
+
}
|
|
4156
|
+
})
|
|
4157
|
+
},
|
|
4158
|
+
{
|
|
4159
|
+
label: "操作",
|
|
4160
|
+
fixed: "right",
|
|
4161
|
+
actions: [
|
|
4162
|
+
{
|
|
4163
|
+
text: "编辑",
|
|
4164
|
+
handler: (row, index) => {
|
|
4165
|
+
formValues.value = {
|
|
4166
|
+
...row,
|
|
4167
|
+
index
|
|
4168
|
+
};
|
|
4169
|
+
drawerTitle.value = `编辑${row.title}`;
|
|
4170
|
+
addDialog.value?.show();
|
|
4171
|
+
}
|
|
4172
|
+
},
|
|
4173
|
+
{
|
|
4174
|
+
text: "删除",
|
|
4175
|
+
buttonType: "danger",
|
|
4176
|
+
handler: async (row, index) => {
|
|
4177
|
+
await tMagicMessageBox.confirm(`确定删除${row.title}?`, "提示");
|
|
4178
|
+
props.model[props.name].splice(index, 1);
|
|
4179
|
+
emit("change", props.model[props.name]);
|
|
4180
|
+
}
|
|
4181
|
+
}
|
|
4182
|
+
]
|
|
4183
|
+
}
|
|
4184
|
+
];
|
|
4185
|
+
const newHandler = () => {
|
|
4186
|
+
const isFirstRow = props.model[props.name].length === 0;
|
|
4187
|
+
formValues.value = {
|
|
4188
|
+
data: getDefaultValueFromFields(props.model.fields || []),
|
|
4189
|
+
useInEditor: isFirstRow,
|
|
4190
|
+
enable: isFirstRow
|
|
4191
|
+
};
|
|
4192
|
+
drawerTitle.value = "新增Mock";
|
|
4193
|
+
addDialog.value?.show();
|
|
4194
|
+
};
|
|
4195
|
+
const formChangeHandler = ({ index, ...value }) => {
|
|
4196
|
+
if (index > -1) {
|
|
4197
|
+
props.model[props.name][index] = value;
|
|
4198
|
+
} else {
|
|
4199
|
+
props.model[props.name].push(value);
|
|
4200
|
+
}
|
|
4201
|
+
addDialog.value?.hide();
|
|
4202
|
+
emit("change", props.model[props.name]);
|
|
4203
|
+
};
|
|
4204
|
+
const toggleValue = (row, key, value, index) => {
|
|
4205
|
+
if (value) {
|
|
4206
|
+
props.model[props.name].forEach((item) => {
|
|
4207
|
+
item[key] = false;
|
|
4208
|
+
});
|
|
4209
|
+
}
|
|
4210
|
+
formChangeHandler({
|
|
4211
|
+
...row,
|
|
4212
|
+
[key]: value,
|
|
4213
|
+
index
|
|
4214
|
+
});
|
|
4215
|
+
};
|
|
4216
|
+
return (_ctx, _cache) => {
|
|
4217
|
+
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
4218
|
+
createVNode(unref(MagicTable), {
|
|
4219
|
+
data: _ctx.model[_ctx.name],
|
|
4220
|
+
columns
|
|
4221
|
+
}, null, 8, ["data"]),
|
|
4222
|
+
createElementVNode("div", _hoisted_2$j, [
|
|
4223
|
+
createVNode(unref(TMagicButton), {
|
|
4224
|
+
size: "small",
|
|
4225
|
+
type: "primary",
|
|
4226
|
+
disabled: _ctx.disabled,
|
|
4227
|
+
plain: "",
|
|
4228
|
+
onClick: _cache[0] || (_cache[0] = ($event) => newHandler())
|
|
4229
|
+
}, {
|
|
4230
|
+
default: withCtx(() => [
|
|
4231
|
+
createTextVNode("添加")
|
|
4232
|
+
]),
|
|
4233
|
+
_: 1
|
|
4234
|
+
}, 8, ["disabled"])
|
|
4235
|
+
]),
|
|
4236
|
+
createVNode(unref(MFormDrawer), {
|
|
4237
|
+
ref_key: "addDialog",
|
|
4238
|
+
ref: addDialog,
|
|
4239
|
+
"label-width": "120px",
|
|
4240
|
+
title: drawerTitle.value,
|
|
4241
|
+
config: formConfig,
|
|
4242
|
+
values: formValues.value,
|
|
4243
|
+
parentValues: _ctx.model[_ctx.name],
|
|
4244
|
+
disabled: _ctx.disabled,
|
|
4245
|
+
width: width.value,
|
|
4246
|
+
onSubmit: formChangeHandler
|
|
4247
|
+
}, null, 8, ["title", "values", "parentValues", "disabled", "width"])
|
|
4248
|
+
]);
|
|
4249
|
+
};
|
|
4250
|
+
}
|
|
4251
|
+
});
|
|
4252
|
+
|
|
4253
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
4254
|
+
...{
|
|
4255
|
+
name: "MEditorDataSourceSelect"
|
|
4256
|
+
},
|
|
4257
|
+
__name: "DataSourceSelect",
|
|
4258
|
+
props: {
|
|
4259
|
+
config: {},
|
|
4260
|
+
model: {},
|
|
4261
|
+
initValues: {},
|
|
4262
|
+
values: {},
|
|
4263
|
+
name: {},
|
|
4264
|
+
prop: {},
|
|
4265
|
+
disabled: { type: Boolean, default: false },
|
|
4266
|
+
size: {},
|
|
4267
|
+
lastValues: {}
|
|
4268
|
+
},
|
|
4269
|
+
emits: ["change"],
|
|
4270
|
+
setup(__props, { emit }) {
|
|
4271
|
+
const props = __props;
|
|
4272
|
+
const { dataSourceService } = inject("services") || {};
|
|
4273
|
+
const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
|
|
4274
|
+
const selectConfig = computed(() => {
|
|
4275
|
+
const { type, dataSourceType, ...config } = props.config;
|
|
4276
|
+
return {
|
|
4277
|
+
...config,
|
|
4278
|
+
type: "select",
|
|
4279
|
+
valueKey: "dataSourceId",
|
|
4280
|
+
options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
|
|
4281
|
+
value: {
|
|
4282
|
+
isBindDataSource: true,
|
|
4283
|
+
dataSourceType: ds.type,
|
|
4284
|
+
dataSourceId: ds.id
|
|
4285
|
+
},
|
|
4286
|
+
text: ds.title || ds.id
|
|
4287
|
+
}))
|
|
4288
|
+
};
|
|
4289
|
+
});
|
|
4290
|
+
const changeHandler = (value) => {
|
|
4291
|
+
emit("change", value);
|
|
4292
|
+
};
|
|
4293
|
+
return (_ctx, _cache) => {
|
|
4294
|
+
return openBlock(), createBlock(unref(MSelect), {
|
|
4295
|
+
model: _ctx.model,
|
|
4296
|
+
name: _ctx.name,
|
|
4297
|
+
size: _ctx.size,
|
|
4298
|
+
prop: _ctx.prop,
|
|
4299
|
+
disabled: _ctx.disabled,
|
|
4300
|
+
config: selectConfig.value,
|
|
4301
|
+
"last-values": _ctx.lastValues,
|
|
4302
|
+
onChange: changeHandler
|
|
4303
|
+
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]);
|
|
4304
|
+
};
|
|
4305
|
+
}
|
|
4306
|
+
});
|
|
4307
|
+
|
|
4308
|
+
const _hoisted_1$n = { class: "m-fields-event-select" };
|
|
4309
|
+
const _hoisted_2$i = {
|
|
4310
|
+
key: 1,
|
|
4311
|
+
class: "fullWidth"
|
|
4312
|
+
};
|
|
4313
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
4314
|
+
...{
|
|
4315
|
+
name: "MEditorEventSelect"
|
|
4316
|
+
},
|
|
4317
|
+
__name: "EventSelect",
|
|
4318
|
+
props: {
|
|
4319
|
+
config: {},
|
|
4320
|
+
model: {},
|
|
4321
|
+
initValues: {},
|
|
4322
|
+
values: {},
|
|
4323
|
+
name: {},
|
|
4324
|
+
prop: {},
|
|
4325
|
+
disabled: { type: Boolean },
|
|
4326
|
+
size: {},
|
|
4327
|
+
lastValues: {}
|
|
4328
|
+
},
|
|
4329
|
+
emits: ["change"],
|
|
4330
|
+
setup(__props, { emit }) {
|
|
4331
|
+
const props = __props;
|
|
4332
|
+
const services = inject("services");
|
|
4333
|
+
const editorService = services?.editorService;
|
|
4334
|
+
const dataSourceService = services?.dataSourceService;
|
|
4335
|
+
const eventsService = services?.eventsService;
|
|
4336
|
+
const codeBlockService = services?.codeBlockService;
|
|
4337
|
+
const eventNameConfig = computed(() => {
|
|
4338
|
+
const defaultEventNameConfig = {
|
|
4339
|
+
name: "name",
|
|
4340
|
+
text: "事件",
|
|
4341
|
+
type: "select",
|
|
4342
|
+
labelWidth: "40px",
|
|
4343
|
+
options: (mForm, { formValue }) => {
|
|
4344
|
+
let events = [];
|
|
4345
|
+
if (!eventsService || !dataSourceService)
|
|
4346
|
+
return events;
|
|
4347
|
+
if (props.config.src === "component") {
|
|
4348
|
+
events = eventsService.getEvent(formValue.type);
|
|
4349
|
+
} else if (props.config.src === "datasource") {
|
|
4350
|
+
events = dataSourceService.getFormEvent(formValue.type);
|
|
4351
|
+
}
|
|
4352
|
+
return events.map((option) => ({
|
|
4353
|
+
text: option.label,
|
|
4354
|
+
value: option.value
|
|
4355
|
+
}));
|
|
4356
|
+
}
|
|
4357
|
+
};
|
|
4358
|
+
return { ...defaultEventNameConfig, ...props.config.eventNameConfig };
|
|
4359
|
+
});
|
|
4360
|
+
const actionTypeConfig = computed(() => {
|
|
4361
|
+
const defaultActionTypeConfig = {
|
|
4362
|
+
name: "actionType",
|
|
4363
|
+
text: "联动类型",
|
|
4364
|
+
labelWidth: "80px",
|
|
4365
|
+
type: "select",
|
|
4366
|
+
defaultValue: ActionType.COMP,
|
|
4367
|
+
options: () => [
|
|
4368
|
+
{
|
|
4369
|
+
text: "组件",
|
|
4370
|
+
label: "组件",
|
|
4371
|
+
value: ActionType.COMP
|
|
4372
|
+
},
|
|
4373
|
+
{
|
|
4374
|
+
text: "代码",
|
|
4375
|
+
label: "代码",
|
|
4376
|
+
disabled: !Object.keys(codeBlockService?.getCodeDsl() || {}).length,
|
|
4377
|
+
value: ActionType.CODE
|
|
4378
|
+
},
|
|
4379
|
+
{
|
|
4380
|
+
text: "数据源",
|
|
4381
|
+
label: "数据源",
|
|
4382
|
+
disabled: !dataSourceService?.get("dataSources")?.filter((ds) => ds.methods?.length || dataSourceService?.getFormMethod(ds.type).length).length,
|
|
4383
|
+
value: ActionType.DATA_SOURCE
|
|
4384
|
+
}
|
|
4385
|
+
]
|
|
4386
|
+
};
|
|
4387
|
+
return { ...defaultActionTypeConfig, ...props.config.actionTypeConfig };
|
|
4388
|
+
});
|
|
4389
|
+
const targetCompConfig = computed(() => {
|
|
4390
|
+
const defaultTargetCompConfig = {
|
|
4391
|
+
name: "to",
|
|
4392
|
+
text: "联动组件",
|
|
4393
|
+
labelWidth: "80px",
|
|
4394
|
+
type: "ui-select",
|
|
4395
|
+
display: (mForm, { model }) => model.actionType === ActionType.COMP
|
|
4396
|
+
};
|
|
4397
|
+
return { ...defaultTargetCompConfig, ...props.config.targetCompConfig };
|
|
4398
|
+
});
|
|
4399
|
+
const compActionConfig = computed(() => {
|
|
3950
4400
|
const defaultCompActionConfig = {
|
|
3951
4401
|
name: "method",
|
|
3952
4402
|
text: "动作",
|
|
@@ -3954,10 +4404,10 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
3954
4404
|
type: "select",
|
|
3955
4405
|
display: (mForm, { model }) => model.actionType === ActionType.COMP,
|
|
3956
4406
|
options: (mForm, { model }) => {
|
|
3957
|
-
const node =
|
|
4407
|
+
const node = editorService?.getNodeById(model.to);
|
|
3958
4408
|
if (!node?.type)
|
|
3959
4409
|
return [];
|
|
3960
|
-
return
|
|
4410
|
+
return eventsService?.getMethod(node.type).map((option) => ({
|
|
3961
4411
|
text: option.label,
|
|
3962
4412
|
value: option.value
|
|
3963
4413
|
}));
|
|
@@ -3970,7 +4420,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
3970
4420
|
type: "code-select-col",
|
|
3971
4421
|
labelWidth: 0,
|
|
3972
4422
|
name: "codeId",
|
|
3973
|
-
disabled: () => !
|
|
4423
|
+
disabled: () => !codeBlockService?.getEditStatus(),
|
|
3974
4424
|
display: (mForm, { model }) => model.actionType === ActionType.CODE
|
|
3975
4425
|
};
|
|
3976
4426
|
return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
|
|
@@ -3992,7 +4442,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
3992
4442
|
name: "name",
|
|
3993
4443
|
label: "事件名",
|
|
3994
4444
|
type: eventNameConfig.value.type,
|
|
3995
|
-
options: (mForm, { formValue }) =>
|
|
4445
|
+
options: (mForm, { formValue }) => eventsService?.getEvent(formValue.type).map((option) => ({
|
|
3996
4446
|
text: option.label,
|
|
3997
4447
|
value: option.value
|
|
3998
4448
|
}))
|
|
@@ -4007,10 +4457,10 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4007
4457
|
label: "动作",
|
|
4008
4458
|
type: compActionConfig.value.type,
|
|
4009
4459
|
options: (mForm, { model }) => {
|
|
4010
|
-
const node =
|
|
4460
|
+
const node = editorService?.getNodeById(model.to);
|
|
4011
4461
|
if (!node?.type)
|
|
4012
4462
|
return [];
|
|
4013
|
-
return
|
|
4463
|
+
return eventsService?.getMethod(node.type).map((option) => ({
|
|
4014
4464
|
text: option.label,
|
|
4015
4465
|
value: option.value
|
|
4016
4466
|
}));
|
|
@@ -4064,7 +4514,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4064
4514
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
4065
4515
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
4066
4516
|
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
4067
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4517
|
+
return openBlock(), createElementBlock("div", _hoisted_1$n, [
|
|
4068
4518
|
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
4069
4519
|
key: 0,
|
|
4070
4520
|
ref: "eventForm",
|
|
@@ -4074,7 +4524,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4074
4524
|
model: _ctx.model,
|
|
4075
4525
|
config: tableConfig.value,
|
|
4076
4526
|
onChange: onChangeHandler
|
|
4077
|
-
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
4527
|
+
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$i, [
|
|
4078
4528
|
createVNode(unref(TMagicButton), {
|
|
4079
4529
|
class: "create-button",
|
|
4080
4530
|
type: "primary",
|
|
@@ -4123,9 +4573,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4123
4573
|
}
|
|
4124
4574
|
});
|
|
4125
4575
|
|
|
4126
|
-
const _hoisted_1$
|
|
4127
|
-
const _hoisted_2$
|
|
4128
|
-
const _sfc_main$
|
|
4576
|
+
const _hoisted_1$m = { class: "m-fields-key-value" };
|
|
4577
|
+
const _hoisted_2$h = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
4578
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
4129
4579
|
...{
|
|
4130
4580
|
name: "MEditorKeyValue"
|
|
4131
4581
|
},
|
|
@@ -4170,7 +4620,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4170
4620
|
records.value.splice(index, 1);
|
|
4171
4621
|
};
|
|
4172
4622
|
return (_ctx, _cache) => {
|
|
4173
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4623
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
4174
4624
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
4175
4625
|
return openBlock(), createElementBlock("div", {
|
|
4176
4626
|
class: "m-fields-key-value-item",
|
|
@@ -4184,7 +4634,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4184
4634
|
size: _ctx.size,
|
|
4185
4635
|
onChange: keyChangeHandler
|
|
4186
4636
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
4187
|
-
_hoisted_2$
|
|
4637
|
+
_hoisted_2$h,
|
|
4188
4638
|
createVNode(unref(TMagicInput), {
|
|
4189
4639
|
placeholder: "value",
|
|
4190
4640
|
modelValue: records.value[index][1],
|
|
@@ -4223,12 +4673,12 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4223
4673
|
}
|
|
4224
4674
|
});
|
|
4225
4675
|
|
|
4226
|
-
const _hoisted_1$
|
|
4676
|
+
const _hoisted_1$l = {
|
|
4227
4677
|
key: 1,
|
|
4228
4678
|
class: "m-fields-ui-select",
|
|
4229
4679
|
style: { "display": "flex" }
|
|
4230
4680
|
};
|
|
4231
|
-
const _sfc_main$
|
|
4681
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
4232
4682
|
...{
|
|
4233
4683
|
name: "MEditorUISelect"
|
|
4234
4684
|
},
|
|
@@ -4317,7 +4767,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
4317
4767
|
]),
|
|
4318
4768
|
_: 1
|
|
4319
4769
|
}, 8, ["icon", "disabled", "size"])
|
|
4320
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
4770
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
4321
4771
|
val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4322
4772
|
createVNode(unref(TMagicTooltip), {
|
|
4323
4773
|
content: "清除",
|
|
@@ -4414,7 +4864,7 @@ const useGetSo = (target, emit) => {
|
|
|
4414
4864
|
};
|
|
4415
4865
|
};
|
|
4416
4866
|
|
|
4417
|
-
const _sfc_main$
|
|
4867
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
4418
4868
|
...{
|
|
4419
4869
|
name: "MEditorResizer"
|
|
4420
4870
|
},
|
|
@@ -4435,7 +4885,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
4435
4885
|
}
|
|
4436
4886
|
});
|
|
4437
4887
|
|
|
4438
|
-
const _sfc_main$
|
|
4888
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
4439
4889
|
...{
|
|
4440
4890
|
name: "MEditorLayout"
|
|
4441
4891
|
},
|
|
@@ -4547,7 +4997,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
4547
4997
|
}, [
|
|
4548
4998
|
renderSlot(_ctx.$slots, "left")
|
|
4549
4999
|
], 6),
|
|
4550
|
-
createVNode(_sfc_main$
|
|
5000
|
+
createVNode(_sfc_main$A, { onChange: changeLeft })
|
|
4551
5001
|
], 64)) : createCommentVNode("", true),
|
|
4552
5002
|
createElementVNode("div", {
|
|
4553
5003
|
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -4556,7 +5006,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
4556
5006
|
renderSlot(_ctx.$slots, "center")
|
|
4557
5007
|
], 6),
|
|
4558
5008
|
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
4559
|
-
createVNode(_sfc_main$
|
|
5009
|
+
createVNode(_sfc_main$A, { onChange: changeRight }),
|
|
4560
5010
|
createElementVNode("div", {
|
|
4561
5011
|
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
4562
5012
|
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -4569,10 +5019,10 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
4569
5019
|
}
|
|
4570
5020
|
});
|
|
4571
5021
|
|
|
4572
|
-
const _hoisted_1$
|
|
4573
|
-
const _hoisted_2$
|
|
4574
|
-
const _hoisted_3$
|
|
4575
|
-
const _sfc_main$
|
|
5022
|
+
const _hoisted_1$k = { class: "m-editor-empty-panel" };
|
|
5023
|
+
const _hoisted_2$g = { class: "m-editor-empty-content" };
|
|
5024
|
+
const _hoisted_3$9 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
5025
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
4576
5026
|
...{
|
|
4577
5027
|
name: "MEditorAddPageBox"
|
|
4578
5028
|
},
|
|
@@ -4592,16 +5042,16 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
4592
5042
|
});
|
|
4593
5043
|
};
|
|
4594
5044
|
return (_ctx, _cache) => {
|
|
4595
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4596
|
-
createElementVNode("div", _hoisted_2$
|
|
5045
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
5046
|
+
createElementVNode("div", _hoisted_2$g, [
|
|
4597
5047
|
createElementVNode("div", {
|
|
4598
5048
|
class: "m-editor-empty-button",
|
|
4599
5049
|
onClick: clickHandler
|
|
4600
5050
|
}, [
|
|
4601
5051
|
createElementVNode("div", null, [
|
|
4602
|
-
createVNode(_sfc_main$
|
|
5052
|
+
createVNode(_sfc_main$M, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
4603
5053
|
]),
|
|
4604
|
-
_hoisted_3$
|
|
5054
|
+
_hoisted_3$9
|
|
4605
5055
|
])
|
|
4606
5056
|
])
|
|
4607
5057
|
]);
|
|
@@ -4613,7 +5063,7 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
|
4613
5063
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
4614
5064
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
4615
5065
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
4616
|
-
const _sfc_main$
|
|
5066
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
4617
5067
|
...{
|
|
4618
5068
|
name: "MEditorFramework"
|
|
4619
5069
|
},
|
|
@@ -4690,13 +5140,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
4690
5140
|
renderSlot(_ctx.$slots, "nav"),
|
|
4691
5141
|
renderSlot(_ctx.$slots, "content-before"),
|
|
4692
5142
|
showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
|
|
4693
|
-
createVNode(_sfc_main$
|
|
5143
|
+
createVNode(_sfc_main$S, {
|
|
4694
5144
|
class: "m-editor-content",
|
|
4695
5145
|
"init-values": root.value,
|
|
4696
5146
|
options: unref(codeOptions),
|
|
4697
5147
|
onSave: saveCode
|
|
4698
5148
|
}, null, 8, ["init-values", "options"])
|
|
4699
|
-
]) : (openBlock(), createBlock(_sfc_main$
|
|
5149
|
+
]) : (openBlock(), createBlock(_sfc_main$z, {
|
|
4700
5150
|
key: 1,
|
|
4701
5151
|
class: "m-editor-content",
|
|
4702
5152
|
"left-class": "m-editor-framework-left",
|
|
@@ -4715,7 +5165,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
4715
5165
|
]),
|
|
4716
5166
|
center: withCtx(() => [
|
|
4717
5167
|
pageLength.value > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
4718
|
-
createVNode(_sfc_main$
|
|
5168
|
+
createVNode(_sfc_main$y)
|
|
4719
5169
|
])
|
|
4720
5170
|
]),
|
|
4721
5171
|
_: 2
|
|
@@ -4740,12 +5190,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
4740
5190
|
}
|
|
4741
5191
|
});
|
|
4742
5192
|
|
|
4743
|
-
const _hoisted_1$
|
|
5193
|
+
const _hoisted_1$j = {
|
|
4744
5194
|
key: 1,
|
|
4745
5195
|
class: "menu-item-text"
|
|
4746
5196
|
};
|
|
4747
|
-
const _hoisted_2$
|
|
4748
|
-
const _sfc_main$
|
|
5197
|
+
const _hoisted_2$f = { class: "el-dropdown-link menubar-menu-button" };
|
|
5198
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
4749
5199
|
...{
|
|
4750
5200
|
name: "MEditorToolButton"
|
|
4751
5201
|
},
|
|
@@ -4824,7 +5274,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
4824
5274
|
_ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
4825
5275
|
key: 0,
|
|
4826
5276
|
direction: _ctx.data.direction || "vertical"
|
|
4827
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5277
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$j, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
4828
5278
|
_ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
4829
5279
|
key: 0,
|
|
4830
5280
|
effect: "dark",
|
|
@@ -4838,7 +5288,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
4838
5288
|
disabled: disabled.value
|
|
4839
5289
|
}, {
|
|
4840
5290
|
default: withCtx(() => [
|
|
4841
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
5291
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$M, {
|
|
4842
5292
|
key: 0,
|
|
4843
5293
|
icon: _ctx.data.icon
|
|
4844
5294
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -4852,17 +5302,18 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
4852
5302
|
key: 1,
|
|
4853
5303
|
size: "small",
|
|
4854
5304
|
text: "",
|
|
4855
|
-
disabled: disabled.value
|
|
5305
|
+
disabled: disabled.value,
|
|
5306
|
+
title: _ctx.data.text
|
|
4856
5307
|
}, {
|
|
4857
5308
|
default: withCtx(() => [
|
|
4858
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
5309
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$M, {
|
|
4859
5310
|
key: 0,
|
|
4860
5311
|
icon: _ctx.data.icon
|
|
4861
5312
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
4862
5313
|
createElementVNode("span", null, toDisplayString(_ctx.data.text), 1)
|
|
4863
5314
|
]),
|
|
4864
5315
|
_: 1
|
|
4865
|
-
}, 8, ["disabled"]))
|
|
5316
|
+
}, 8, ["disabled", "title"]))
|
|
4866
5317
|
], 64)) : _ctx.data.type === "dropdown" ? (openBlock(), createBlock(unref(TMagicDropdown), {
|
|
4867
5318
|
key: 3,
|
|
4868
5319
|
trigger: "click",
|
|
@@ -4888,7 +5339,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
4888
5339
|
})) : createCommentVNode("", true)
|
|
4889
5340
|
]),
|
|
4890
5341
|
default: withCtx(() => [
|
|
4891
|
-
createElementVNode("span", _hoisted_2$
|
|
5342
|
+
createElementVNode("span", _hoisted_2$f, [
|
|
4892
5343
|
createTextVNode(toDisplayString(_ctx.data.text), 1),
|
|
4893
5344
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
4894
5345
|
default: withCtx(() => [
|
|
@@ -4905,7 +5356,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
4905
5356
|
}
|
|
4906
5357
|
});
|
|
4907
5358
|
|
|
4908
|
-
const _sfc_main$
|
|
5359
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
4909
5360
|
...{
|
|
4910
5361
|
name: "MEditorNavMenu"
|
|
4911
5362
|
},
|
|
@@ -5067,7 +5518,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
5067
5518
|
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
5068
5519
|
}, [
|
|
5069
5520
|
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
5070
|
-
return openBlock(), createBlock(_sfc_main$
|
|
5521
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
5071
5522
|
data: item,
|
|
5072
5523
|
key: index
|
|
5073
5524
|
}, null, 8, ["data"]);
|
|
@@ -5079,8 +5530,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
5079
5530
|
}
|
|
5080
5531
|
});
|
|
5081
5532
|
|
|
5082
|
-
const _hoisted_1$
|
|
5083
|
-
const _sfc_main$
|
|
5533
|
+
const _hoisted_1$i = { class: "m-editor-props-panel" };
|
|
5534
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
5084
5535
|
...{
|
|
5085
5536
|
name: "MEditorPropsPanel"
|
|
5086
5537
|
},
|
|
@@ -5133,7 +5584,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
5133
5584
|
};
|
|
5134
5585
|
__expose({ configForm, submit });
|
|
5135
5586
|
return (_ctx, _cache) => {
|
|
5136
|
-
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$
|
|
5587
|
+
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
5137
5588
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
5138
5589
|
createVNode(unref(MForm), {
|
|
5139
5590
|
ref_key: "configForm",
|
|
@@ -5153,7 +5604,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
5153
5604
|
}
|
|
5154
5605
|
});
|
|
5155
5606
|
|
|
5156
|
-
const _sfc_main$
|
|
5607
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
5157
5608
|
...{
|
|
5158
5609
|
name: "MEditorSearchInput"
|
|
5159
5610
|
},
|
|
@@ -5161,8 +5612,12 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
5161
5612
|
emits: ["search"],
|
|
5162
5613
|
setup(__props, { emit }) {
|
|
5163
5614
|
const filterText = ref("");
|
|
5615
|
+
let timer = null;
|
|
5164
5616
|
const filterTextChangeHandler = () => {
|
|
5165
|
-
|
|
5617
|
+
timer && clearTimeout(timer);
|
|
5618
|
+
timer = setTimeout(() => {
|
|
5619
|
+
emit("search", filterText.value);
|
|
5620
|
+
}, 300);
|
|
5166
5621
|
};
|
|
5167
5622
|
return (_ctx, _cache) => {
|
|
5168
5623
|
return openBlock(), createBlock(unref(TMagicInput), {
|
|
@@ -5188,8 +5643,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
5188
5643
|
}
|
|
5189
5644
|
});
|
|
5190
5645
|
|
|
5191
|
-
const _hoisted_1$
|
|
5192
|
-
const _hoisted_2$
|
|
5646
|
+
const _hoisted_1$h = { xmlns: "http://www.w3.org/2000/svg" };
|
|
5647
|
+
const _hoisted_2$e = /* @__PURE__ */ createElementVNode("g", {
|
|
5193
5648
|
fill: "#7C878E",
|
|
5194
5649
|
"fill-rule": "evenodd"
|
|
5195
5650
|
}, [
|
|
@@ -5199,50 +5654,50 @@ const _hoisted_2$d = /* @__PURE__ */ createElementVNode("g", {
|
|
|
5199
5654
|
}),
|
|
5200
5655
|
/* @__PURE__ */ createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
|
|
5201
5656
|
], -1);
|
|
5202
|
-
const _hoisted_3$
|
|
5203
|
-
_hoisted_2$
|
|
5657
|
+
const _hoisted_3$8 = [
|
|
5658
|
+
_hoisted_2$e
|
|
5204
5659
|
];
|
|
5205
|
-
const _sfc_main$
|
|
5660
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
5206
5661
|
...{
|
|
5207
5662
|
name: "MEditorAppManageIcon"
|
|
5208
5663
|
},
|
|
5209
5664
|
__name: "AppManageIcon",
|
|
5210
5665
|
setup(__props) {
|
|
5211
5666
|
return (_ctx, _cache) => {
|
|
5212
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
5667
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$h, _hoisted_3$8);
|
|
5213
5668
|
};
|
|
5214
5669
|
}
|
|
5215
5670
|
});
|
|
5216
5671
|
|
|
5217
|
-
const _hoisted_1$
|
|
5672
|
+
const _hoisted_1$g = {
|
|
5218
5673
|
viewBox: "0 0 32 32",
|
|
5219
5674
|
version: "1.1",
|
|
5220
5675
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5221
5676
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
5222
5677
|
};
|
|
5223
|
-
const _hoisted_2$
|
|
5224
|
-
const _hoisted_4$
|
|
5225
|
-
_hoisted_2$
|
|
5678
|
+
const _hoisted_2$d = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2);
|
|
5679
|
+
const _hoisted_4$6 = [
|
|
5680
|
+
_hoisted_2$d
|
|
5226
5681
|
];
|
|
5227
|
-
const _sfc_main$
|
|
5682
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
5228
5683
|
...{
|
|
5229
5684
|
name: "MEditorCodeIcon"
|
|
5230
5685
|
},
|
|
5231
5686
|
__name: "CodeIcon",
|
|
5232
5687
|
setup(__props) {
|
|
5233
5688
|
return (_ctx, _cache) => {
|
|
5234
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
5689
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$g, _hoisted_4$6);
|
|
5235
5690
|
};
|
|
5236
5691
|
}
|
|
5237
5692
|
});
|
|
5238
5693
|
|
|
5239
|
-
const _hoisted_1$
|
|
5240
|
-
const _hoisted_2$
|
|
5241
|
-
const _hoisted_3$
|
|
5694
|
+
const _hoisted_1$f = ["id"];
|
|
5695
|
+
const _hoisted_2$c = { class: "list-item" };
|
|
5696
|
+
const _hoisted_3$7 = {
|
|
5242
5697
|
key: 2,
|
|
5243
5698
|
class: "right-tool"
|
|
5244
5699
|
};
|
|
5245
|
-
const _sfc_main$
|
|
5700
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
5246
5701
|
...{
|
|
5247
5702
|
name: "MEditorCodeBlockList"
|
|
5248
5703
|
},
|
|
@@ -5343,26 +5798,26 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
5343
5798
|
id: data.id,
|
|
5344
5799
|
class: "list-container"
|
|
5345
5800
|
}, [
|
|
5346
|
-
createElementVNode("div", _hoisted_2$
|
|
5347
|
-
data.type === "code" ? (openBlock(), createBlock(_sfc_main$
|
|
5801
|
+
createElementVNode("div", _hoisted_2$c, [
|
|
5802
|
+
data.type === "code" ? (openBlock(), createBlock(_sfc_main$r, {
|
|
5348
5803
|
key: 0,
|
|
5349
5804
|
class: "codeIcon"
|
|
5350
5805
|
})) : createCommentVNode("", true),
|
|
5351
|
-
data.type === "node" ? (openBlock(), createBlock(_sfc_main$
|
|
5806
|
+
data.type === "node" ? (openBlock(), createBlock(_sfc_main$s, {
|
|
5352
5807
|
key: 1,
|
|
5353
5808
|
class: "compIcon"
|
|
5354
5809
|
})) : createCommentVNode("", true),
|
|
5355
5810
|
createElementVNode("span", {
|
|
5356
5811
|
class: normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
5357
5812
|
}, toDisplayString(data.name) + " (" + toDisplayString(data.id) + ")", 3),
|
|
5358
|
-
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
5813
|
+
data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
|
|
5359
5814
|
createVNode(unref(TMagicTooltip), {
|
|
5360
5815
|
effect: "dark",
|
|
5361
5816
|
content: editable.value ? "编辑" : "查看",
|
|
5362
5817
|
placement: "bottom"
|
|
5363
5818
|
}, {
|
|
5364
5819
|
default: withCtx(() => [
|
|
5365
|
-
createVNode(_sfc_main$
|
|
5820
|
+
createVNode(_sfc_main$M, {
|
|
5366
5821
|
icon: editable.value ? unref(Edit) : unref(View),
|
|
5367
5822
|
class: "edit-icon",
|
|
5368
5823
|
onClick: withModifiers(($event) => editCode(data.id), ["stop"])
|
|
@@ -5377,7 +5832,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
5377
5832
|
placement: "bottom"
|
|
5378
5833
|
}, {
|
|
5379
5834
|
default: withCtx(() => [
|
|
5380
|
-
createVNode(_sfc_main$
|
|
5835
|
+
createVNode(_sfc_main$M, {
|
|
5381
5836
|
icon: unref(Close),
|
|
5382
5837
|
class: "edit-icon",
|
|
5383
5838
|
onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -5391,7 +5846,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
5391
5846
|
})
|
|
5392
5847
|
])) : createCommentVNode("", true)
|
|
5393
5848
|
])
|
|
5394
|
-
], 8, _hoisted_1$
|
|
5849
|
+
], 8, _hoisted_1$f)
|
|
5395
5850
|
]),
|
|
5396
5851
|
_: 3
|
|
5397
5852
|
}, 8, ["default-expanded-keys", "data"]);
|
|
@@ -5399,8 +5854,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
5399
5854
|
}
|
|
5400
5855
|
});
|
|
5401
5856
|
|
|
5402
|
-
const _hoisted_1$
|
|
5403
|
-
const _sfc_main$
|
|
5857
|
+
const _hoisted_1$e = { class: "search-wrapper" };
|
|
5858
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
5404
5859
|
...{
|
|
5405
5860
|
name: "MEditorCodeBlockListPanel"
|
|
5406
5861
|
},
|
|
@@ -5420,8 +5875,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
5420
5875
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
5421
5876
|
default: withCtx(() => [
|
|
5422
5877
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
5423
|
-
createElementVNode("div", _hoisted_1$
|
|
5424
|
-
createVNode(_sfc_main$
|
|
5878
|
+
createElementVNode("div", _hoisted_1$e, [
|
|
5879
|
+
createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
|
|
5425
5880
|
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
5426
5881
|
key: 0,
|
|
5427
5882
|
class: "create-code-button",
|
|
@@ -5437,7 +5892,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
5437
5892
|
renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
5438
5893
|
])
|
|
5439
5894
|
]),
|
|
5440
|
-
createVNode(_sfc_main$
|
|
5895
|
+
createVNode(_sfc_main$q, {
|
|
5441
5896
|
ref_key: "codeBlockList",
|
|
5442
5897
|
ref: codeBlockList,
|
|
5443
5898
|
"custom-error": _ctx.customError,
|
|
@@ -5452,7 +5907,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
5452
5907
|
]),
|
|
5453
5908
|
_: 3
|
|
5454
5909
|
}, 8, ["custom-error", "onEdit", "onRemove"]),
|
|
5455
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
5910
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$O, {
|
|
5456
5911
|
key: 0,
|
|
5457
5912
|
ref_key: "codeBlockEditor",
|
|
5458
5913
|
ref: codeBlockEditor,
|
|
@@ -5467,7 +5922,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
5467
5922
|
}
|
|
5468
5923
|
});
|
|
5469
5924
|
|
|
5470
|
-
const _sfc_main$
|
|
5925
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
5471
5926
|
...{
|
|
5472
5927
|
name: "MEditorDataSourceConfigPanel"
|
|
5473
5928
|
},
|
|
@@ -5521,13 +5976,13 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
5521
5976
|
}
|
|
5522
5977
|
});
|
|
5523
5978
|
|
|
5524
|
-
const _hoisted_1$
|
|
5525
|
-
const _hoisted_2$
|
|
5526
|
-
const _hoisted_3$
|
|
5979
|
+
const _hoisted_1$d = ["id"];
|
|
5980
|
+
const _hoisted_2$b = { class: "list-item" };
|
|
5981
|
+
const _hoisted_3$6 = {
|
|
5527
5982
|
key: 2,
|
|
5528
5983
|
class: "right-tool"
|
|
5529
5984
|
};
|
|
5530
|
-
const _sfc_main$
|
|
5985
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
5531
5986
|
...{
|
|
5532
5987
|
name: "MEditorDataSourceList"
|
|
5533
5988
|
},
|
|
@@ -5622,13 +6077,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
5622
6077
|
id: data.id,
|
|
5623
6078
|
class: "list-container"
|
|
5624
6079
|
}, [
|
|
5625
|
-
createElementVNode("div", _hoisted_2$
|
|
5626
|
-
data.type === "code" ? (openBlock(), createBlock(_sfc_main$
|
|
6080
|
+
createElementVNode("div", _hoisted_2$b, [
|
|
6081
|
+
data.type === "code" ? (openBlock(), createBlock(_sfc_main$M, {
|
|
5627
6082
|
key: 0,
|
|
5628
6083
|
class: "codeIcon",
|
|
5629
6084
|
icon: unref(Coin)
|
|
5630
6085
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
5631
|
-
data.type === "node" ? (openBlock(), createBlock(_sfc_main$
|
|
6086
|
+
data.type === "node" ? (openBlock(), createBlock(_sfc_main$M, {
|
|
5632
6087
|
key: 1,
|
|
5633
6088
|
class: "compIcon",
|
|
5634
6089
|
icon: unref(Aim)
|
|
@@ -5636,14 +6091,14 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
5636
6091
|
createElementVNode("span", {
|
|
5637
6092
|
class: normalizeClass(["name", { code: data.type === "ds", hook: data.type === "key" }])
|
|
5638
6093
|
}, toDisplayString(data.type === "key" ? data.name : `${data.name}(${data.id})`), 3),
|
|
5639
|
-
data.type === "ds" ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
6094
|
+
data.type === "ds" ? (openBlock(), createElementBlock("div", _hoisted_3$6, [
|
|
5640
6095
|
createVNode(unref(TMagicTooltip), {
|
|
5641
6096
|
effect: "dark",
|
|
5642
6097
|
content: editable.value ? "编辑" : "查看",
|
|
5643
6098
|
placement: "bottom"
|
|
5644
6099
|
}, {
|
|
5645
6100
|
default: withCtx(() => [
|
|
5646
|
-
createVNode(_sfc_main$
|
|
6101
|
+
createVNode(_sfc_main$M, {
|
|
5647
6102
|
icon: editable.value ? unref(Edit) : unref(View),
|
|
5648
6103
|
class: "edit-icon",
|
|
5649
6104
|
onClick: withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
|
|
@@ -5658,7 +6113,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
5658
6113
|
placement: "bottom"
|
|
5659
6114
|
}, {
|
|
5660
6115
|
default: withCtx(() => [
|
|
5661
|
-
createVNode(_sfc_main$
|
|
6116
|
+
createVNode(_sfc_main$M, {
|
|
5662
6117
|
icon: unref(Close),
|
|
5663
6118
|
class: "edit-icon",
|
|
5664
6119
|
onClick: withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
|
|
@@ -5672,7 +6127,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
5672
6127
|
})
|
|
5673
6128
|
])) : createCommentVNode("", true)
|
|
5674
6129
|
])
|
|
5675
|
-
], 8, _hoisted_1$
|
|
6130
|
+
], 8, _hoisted_1$d)
|
|
5676
6131
|
]),
|
|
5677
6132
|
_: 3
|
|
5678
6133
|
}, 8, ["data"]);
|
|
@@ -5680,9 +6135,9 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
5680
6135
|
}
|
|
5681
6136
|
});
|
|
5682
6137
|
|
|
5683
|
-
const _hoisted_1$
|
|
5684
|
-
const _hoisted_2$
|
|
5685
|
-
const _sfc_main$
|
|
6138
|
+
const _hoisted_1$c = { class: "search-wrapper" };
|
|
6139
|
+
const _hoisted_2$a = { class: "data-source-list-panel-add-menu" };
|
|
6140
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
5686
6141
|
...{
|
|
5687
6142
|
name: "MEditorDataSourceListPanel"
|
|
5688
6143
|
},
|
|
@@ -5742,8 +6197,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
5742
6197
|
return (_ctx, _cache) => {
|
|
5743
6198
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
|
|
5744
6199
|
default: withCtx(() => [
|
|
5745
|
-
createElementVNode("div", _hoisted_1$
|
|
5746
|
-
createVNode(_sfc_main$
|
|
6200
|
+
createElementVNode("div", _hoisted_1$c, [
|
|
6201
|
+
createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
|
|
5747
6202
|
editable.value ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
5748
6203
|
key: 0,
|
|
5749
6204
|
placement: "right"
|
|
@@ -5760,9 +6215,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
5760
6215
|
})
|
|
5761
6216
|
]),
|
|
5762
6217
|
default: withCtx(() => [
|
|
5763
|
-
createElementVNode("div", _hoisted_2$
|
|
6218
|
+
createElementVNode("div", _hoisted_2$a, [
|
|
5764
6219
|
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
5765
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6220
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
5766
6221
|
data: {
|
|
5767
6222
|
type: "button",
|
|
5768
6223
|
text: item.text,
|
|
@@ -5778,11 +6233,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
5778
6233
|
_: 1
|
|
5779
6234
|
})) : createCommentVNode("", true)
|
|
5780
6235
|
]),
|
|
5781
|
-
createVNode(_sfc_main$
|
|
6236
|
+
createVNode(_sfc_main$n, {
|
|
5782
6237
|
onEdit: editHandler,
|
|
5783
6238
|
onRemove: removeHandler
|
|
5784
6239
|
}),
|
|
5785
|
-
createVNode(_sfc_main$
|
|
6240
|
+
createVNode(_sfc_main$o, {
|
|
5786
6241
|
ref_key: "editDialog",
|
|
5787
6242
|
ref: editDialog,
|
|
5788
6243
|
disabled: !editable.value,
|
|
@@ -5797,136 +6252,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
5797
6252
|
}
|
|
5798
6253
|
});
|
|
5799
6254
|
|
|
5800
|
-
const
|
|
5801
|
-
const _hoisted_2$8 = ["title"];
|
|
5802
|
-
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
5803
|
-
...{
|
|
5804
|
-
name: "MEditorComponentListPanel"
|
|
5805
|
-
},
|
|
5806
|
-
__name: "ComponentListPanel",
|
|
5807
|
-
setup(__props) {
|
|
5808
|
-
const searchText = ref("");
|
|
5809
|
-
const filterTextChangeHandler = (v) => {
|
|
5810
|
-
searchText.value = v;
|
|
5811
|
-
};
|
|
5812
|
-
const services = inject("services");
|
|
5813
|
-
const stageOptions = inject("stageOptions");
|
|
5814
|
-
const stage = computed(() => services?.editorService.get("stage"));
|
|
5815
|
-
const list = computed(
|
|
5816
|
-
() => services?.componentListService.getList().map((group) => ({
|
|
5817
|
-
...group,
|
|
5818
|
-
items: group.items.filter((item) => item.text.includes(searchText.value))
|
|
5819
|
-
}))
|
|
5820
|
-
);
|
|
5821
|
-
const collapseValue = computed(
|
|
5822
|
-
() => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
|
|
5823
|
-
);
|
|
5824
|
-
let timeout;
|
|
5825
|
-
let clientX;
|
|
5826
|
-
let clientY;
|
|
5827
|
-
const appendComponent = ({ text, type, data = {} }) => {
|
|
5828
|
-
services?.editorService.add({
|
|
5829
|
-
name: text,
|
|
5830
|
-
type,
|
|
5831
|
-
...data
|
|
5832
|
-
});
|
|
5833
|
-
};
|
|
5834
|
-
const dragstartHandler = ({ text, type, data = {} }, e) => {
|
|
5835
|
-
if (e.dataTransfer) {
|
|
5836
|
-
e.dataTransfer.setData(
|
|
5837
|
-
"text/json",
|
|
5838
|
-
serialize({
|
|
5839
|
-
name: text,
|
|
5840
|
-
type,
|
|
5841
|
-
...data
|
|
5842
|
-
})
|
|
5843
|
-
);
|
|
5844
|
-
}
|
|
5845
|
-
};
|
|
5846
|
-
const dragendHandler = () => {
|
|
5847
|
-
if (timeout) {
|
|
5848
|
-
globalThis.clearTimeout(timeout);
|
|
5849
|
-
timeout = void 0;
|
|
5850
|
-
}
|
|
5851
|
-
const doc = stage.value?.renderer.contentWindow?.document;
|
|
5852
|
-
if (doc && stageOptions) {
|
|
5853
|
-
removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
|
|
5854
|
-
}
|
|
5855
|
-
clientX = 0;
|
|
5856
|
-
clientY = 0;
|
|
5857
|
-
};
|
|
5858
|
-
const dragHandler = (e) => {
|
|
5859
|
-
if (e.clientX !== clientX || e.clientY !== clientY) {
|
|
5860
|
-
clientX = e.clientX;
|
|
5861
|
-
clientY = e.clientY;
|
|
5862
|
-
if (timeout) {
|
|
5863
|
-
globalThis.clearTimeout(timeout);
|
|
5864
|
-
timeout = void 0;
|
|
5865
|
-
}
|
|
5866
|
-
return;
|
|
5867
|
-
}
|
|
5868
|
-
if (timeout || !stage.value)
|
|
5869
|
-
return;
|
|
5870
|
-
timeout = stage.value.delayedMarkContainer(e);
|
|
5871
|
-
};
|
|
5872
|
-
return (_ctx, _cache) => {
|
|
5873
|
-
return openBlock(), createBlock(unref(TMagicScrollbar), null, {
|
|
5874
|
-
default: withCtx(() => [
|
|
5875
|
-
renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
5876
|
-
createVNode(unref(TMagicCollapse), {
|
|
5877
|
-
class: "ui-component-panel",
|
|
5878
|
-
"model-value": collapseValue.value
|
|
5879
|
-
}, {
|
|
5880
|
-
default: withCtx(() => [
|
|
5881
|
-
createVNode(_sfc_main$s, { onSearch: filterTextChangeHandler }),
|
|
5882
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
|
|
5883
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
5884
|
-
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
5885
|
-
key: index,
|
|
5886
|
-
name: `${index}`
|
|
5887
|
-
}, {
|
|
5888
|
-
title: withCtx(() => [
|
|
5889
|
-
createVNode(_sfc_main$K, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
5890
|
-
createTextVNode(toDisplayString(group.title), 1)
|
|
5891
|
-
]),
|
|
5892
|
-
default: withCtx(() => [
|
|
5893
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(group.items, (item) => {
|
|
5894
|
-
return openBlock(), createElementBlock("div", {
|
|
5895
|
-
class: "component-item",
|
|
5896
|
-
draggable: "true",
|
|
5897
|
-
key: item.type,
|
|
5898
|
-
onClick: ($event) => appendComponent(item),
|
|
5899
|
-
onDragstart: ($event) => dragstartHandler(item, $event),
|
|
5900
|
-
onDragend: dragendHandler,
|
|
5901
|
-
onDrag: dragHandler
|
|
5902
|
-
}, [
|
|
5903
|
-
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
5904
|
-
createVNode(_sfc_main$K, {
|
|
5905
|
-
title: item.text,
|
|
5906
|
-
icon: item.icon
|
|
5907
|
-
}, null, 8, ["title", "icon"]),
|
|
5908
|
-
createElementVNode("span", {
|
|
5909
|
-
title: item.text
|
|
5910
|
-
}, toDisplayString(item.text), 9, _hoisted_2$8)
|
|
5911
|
-
])
|
|
5912
|
-
], 40, _hoisted_1$c);
|
|
5913
|
-
}), 128))
|
|
5914
|
-
]),
|
|
5915
|
-
_: 2
|
|
5916
|
-
}, 1032, ["name"])) : createCommentVNode("", true)
|
|
5917
|
-
], 64);
|
|
5918
|
-
}), 256))
|
|
5919
|
-
]),
|
|
5920
|
-
_: 3
|
|
5921
|
-
}, 8, ["model-value"])
|
|
5922
|
-
]),
|
|
5923
|
-
_: 3
|
|
5924
|
-
});
|
|
5925
|
-
};
|
|
5926
|
-
}
|
|
5927
|
-
});
|
|
5928
|
-
|
|
5929
|
-
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
6255
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
5930
6256
|
...{
|
|
5931
6257
|
name: "MEditorContentMenu"
|
|
5932
6258
|
},
|
|
@@ -6003,11 +6329,14 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
6003
6329
|
};
|
|
6004
6330
|
const showSubMenu = (item, index) => {
|
|
6005
6331
|
const menuItem = item;
|
|
6006
|
-
if (typeof item !== "object"
|
|
6332
|
+
if (typeof item !== "object") {
|
|
6007
6333
|
return;
|
|
6008
6334
|
}
|
|
6009
6335
|
subMenuData.value = menuItem.items || [];
|
|
6010
6336
|
setTimeout(() => {
|
|
6337
|
+
if (!visible.value) {
|
|
6338
|
+
return;
|
|
6339
|
+
}
|
|
6011
6340
|
if (menu.value) {
|
|
6012
6341
|
let y = menu.value.offsetTop;
|
|
6013
6342
|
if (buttons.value?.[index].$el) {
|
|
@@ -6056,7 +6385,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
6056
6385
|
renderSlot(_ctx.$slots, "title"),
|
|
6057
6386
|
createElementVNode("div", null, [
|
|
6058
6387
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
6059
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6388
|
+
return openBlock(), createBlock(_sfc_main$w, {
|
|
6060
6389
|
"event-type": "mouseup",
|
|
6061
6390
|
ref_for: true,
|
|
6062
6391
|
ref_key: "buttons",
|
|
@@ -6099,26 +6428,26 @@ const _hoisted_1$b = {
|
|
|
6099
6428
|
fill: "currentColor",
|
|
6100
6429
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6101
6430
|
};
|
|
6102
|
-
const _hoisted_2$
|
|
6431
|
+
const _hoisted_2$9 = /* @__PURE__ */ createElementVNode("path", {
|
|
6103
6432
|
"fill-rule": "evenodd",
|
|
6104
6433
|
d: "M9.828 4H2.19a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91H9v1H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31L.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181L15.546 8H14.54l.265-2.91A1 1 0 0 0 13.81 4H9.828zm-2.95-1.707L7.587 3H2.19c-.24 0-.47.042-.684.12L1.5 2.98a1 1 0 0 1 1-.98h3.672a1 1 0 0 1 .707.293z"
|
|
6105
6434
|
}, null, -1);
|
|
6106
|
-
const _hoisted_3$
|
|
6435
|
+
const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("path", {
|
|
6107
6436
|
"fill-rule": "evenodd",
|
|
6108
6437
|
d: "M11 11.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5z"
|
|
6109
6438
|
}, null, -1);
|
|
6110
|
-
const _hoisted_4$
|
|
6111
|
-
_hoisted_2$
|
|
6112
|
-
_hoisted_3$
|
|
6439
|
+
const _hoisted_4$5 = [
|
|
6440
|
+
_hoisted_2$9,
|
|
6441
|
+
_hoisted_3$5
|
|
6113
6442
|
];
|
|
6114
|
-
const _sfc_main$
|
|
6443
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
6115
6444
|
...{
|
|
6116
6445
|
name: "MEditorFolderMinusIcon"
|
|
6117
6446
|
},
|
|
6118
6447
|
__name: "FolderMinusIcon",
|
|
6119
6448
|
setup(__props) {
|
|
6120
6449
|
return (_ctx, _cache) => {
|
|
6121
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$b, _hoisted_4$
|
|
6450
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$b, _hoisted_4$5);
|
|
6122
6451
|
};
|
|
6123
6452
|
}
|
|
6124
6453
|
});
|
|
@@ -6198,7 +6527,7 @@ const useMoveToMenu = (services) => {
|
|
|
6198
6527
|
};
|
|
6199
6528
|
};
|
|
6200
6529
|
|
|
6201
|
-
const _sfc_main$
|
|
6530
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
6202
6531
|
...{
|
|
6203
6532
|
name: "MEditorLayerMenu"
|
|
6204
6533
|
},
|
|
@@ -6261,7 +6590,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
6261
6590
|
{
|
|
6262
6591
|
type: "button",
|
|
6263
6592
|
text: "全部折叠",
|
|
6264
|
-
icon: _sfc_main$
|
|
6593
|
+
icon: _sfc_main$k,
|
|
6265
6594
|
display: () => isPage(node.value),
|
|
6266
6595
|
handler: () => {
|
|
6267
6596
|
emit("collapse-all");
|
|
@@ -6287,7 +6616,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
6287
6616
|
show
|
|
6288
6617
|
});
|
|
6289
6618
|
return (_ctx, _cache) => {
|
|
6290
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6619
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
6291
6620
|
"menu-data": menuData.value,
|
|
6292
6621
|
ref_key: "menu",
|
|
6293
6622
|
ref: menu,
|
|
@@ -6297,9 +6626,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
6297
6626
|
}
|
|
6298
6627
|
});
|
|
6299
6628
|
|
|
6300
|
-
const
|
|
6301
|
-
|
|
6302
|
-
__name: "LayerNode",
|
|
6629
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
6630
|
+
__name: "LayerNodeTool",
|
|
6303
6631
|
props: {
|
|
6304
6632
|
data: {}
|
|
6305
6633
|
},
|
|
@@ -6316,342 +6644,673 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
6316
6644
|
});
|
|
6317
6645
|
};
|
|
6318
6646
|
return (_ctx, _cache) => {
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
})) : (openBlock(), createBlock(_component_el_icon, {
|
|
6334
|
-
key: 1,
|
|
6335
|
-
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
6336
|
-
class: "node-lock",
|
|
6337
|
-
title: "点击隐藏"
|
|
6338
|
-
}, {
|
|
6339
|
-
default: withCtx(() => [
|
|
6340
|
-
createVNode(unref(View))
|
|
6341
|
-
]),
|
|
6342
|
-
_: 1
|
|
6343
|
-
}))
|
|
6344
|
-
], 64)) : createCommentVNode("", true)
|
|
6345
|
-
])
|
|
6346
|
-
], 64);
|
|
6647
|
+
return _ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6648
|
+
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$M, {
|
|
6649
|
+
key: 0,
|
|
6650
|
+
icon: unref(Hide),
|
|
6651
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
6652
|
+
title: "点击显示"
|
|
6653
|
+
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$M, {
|
|
6654
|
+
key: 1,
|
|
6655
|
+
icon: unref(View),
|
|
6656
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
6657
|
+
class: "node-lock",
|
|
6658
|
+
title: "点击隐藏"
|
|
6659
|
+
}, null, 8, ["icon"]))
|
|
6660
|
+
], 64)) : createCommentVNode("", true);
|
|
6347
6661
|
};
|
|
6348
6662
|
}
|
|
6349
6663
|
});
|
|
6350
6664
|
|
|
6351
|
-
const
|
|
6352
|
-
|
|
6353
|
-
|
|
6665
|
+
const dragState = {
|
|
6666
|
+
dragOverNodeId: "",
|
|
6667
|
+
dropType: "",
|
|
6668
|
+
container: null
|
|
6669
|
+
};
|
|
6670
|
+
const getNodeEl = (el) => {
|
|
6671
|
+
if (el.dataset.nodeId) {
|
|
6672
|
+
return el;
|
|
6673
|
+
}
|
|
6674
|
+
if (el.parentElement) {
|
|
6675
|
+
return getNodeEl(el.parentElement);
|
|
6676
|
+
}
|
|
6677
|
+
};
|
|
6678
|
+
const removeStatusClass = (el) => {
|
|
6679
|
+
if (!el)
|
|
6680
|
+
return;
|
|
6681
|
+
["drag-before", "drag-after", "drag-inner"].forEach((className) => {
|
|
6682
|
+
el.querySelectorAll(`.${className}`).forEach((el2) => {
|
|
6683
|
+
removeClassName(el2, className);
|
|
6684
|
+
});
|
|
6685
|
+
});
|
|
6686
|
+
};
|
|
6687
|
+
const useDrag = (services) => {
|
|
6688
|
+
const handleDragStart = (event) => {
|
|
6689
|
+
if (!event.dataTransfer || !event.target || !event.currentTarget)
|
|
6690
|
+
return;
|
|
6691
|
+
const targetEl = getNodeEl(event.target);
|
|
6692
|
+
if (!targetEl || targetEl !== event.currentTarget)
|
|
6693
|
+
return;
|
|
6694
|
+
event.dataTransfer.effectAllowed = "move";
|
|
6695
|
+
try {
|
|
6696
|
+
event.dataTransfer.setData(
|
|
6697
|
+
"text/json",
|
|
6698
|
+
JSON.stringify({
|
|
6699
|
+
dragType: DragType.LAYER_TREE
|
|
6700
|
+
})
|
|
6701
|
+
);
|
|
6702
|
+
} catch {
|
|
6703
|
+
}
|
|
6704
|
+
};
|
|
6705
|
+
const handleDragOver = (event) => {
|
|
6706
|
+
if (!event.target)
|
|
6707
|
+
return;
|
|
6708
|
+
const targetEl = getNodeEl(event.target);
|
|
6709
|
+
if (!targetEl)
|
|
6710
|
+
return;
|
|
6711
|
+
const labelEl = targetEl.children[0];
|
|
6712
|
+
if (!labelEl)
|
|
6713
|
+
return;
|
|
6714
|
+
const { top: targetTop, height: targetHeight } = labelEl.getBoundingClientRect();
|
|
6715
|
+
const distance = event.clientY - targetTop;
|
|
6716
|
+
const isContainer = targetEl.dataset.isContainer === "true";
|
|
6717
|
+
if (distance < targetHeight / 3) {
|
|
6718
|
+
dragState.dropType = "before";
|
|
6719
|
+
addClassName(labelEl, globalThis.document, "drag-before");
|
|
6720
|
+
removeClassName(labelEl, "drag-after", "drag-inner");
|
|
6721
|
+
} else if (distance > targetHeight * 2 / 3) {
|
|
6722
|
+
dragState.dropType = "after";
|
|
6723
|
+
addClassName(labelEl, globalThis.document, "drag-after");
|
|
6724
|
+
removeClassName(labelEl, "drag-before", "drag-inner");
|
|
6725
|
+
} else if (isContainer) {
|
|
6726
|
+
dragState.dropType = "inner";
|
|
6727
|
+
addClassName(labelEl, globalThis.document, "drag-inner");
|
|
6728
|
+
removeClassName(labelEl, "drag-before", "drag-after");
|
|
6729
|
+
}
|
|
6730
|
+
if (!dragState.dropType) {
|
|
6731
|
+
return;
|
|
6732
|
+
}
|
|
6733
|
+
dragState.dragOverNodeId = targetEl.dataset.nodeId || "";
|
|
6734
|
+
dragState.container = event.currentTarget;
|
|
6735
|
+
event.preventDefault();
|
|
6736
|
+
};
|
|
6737
|
+
const handleDragLeave = (event) => {
|
|
6738
|
+
if (!event.target || !event.currentTarget)
|
|
6739
|
+
return;
|
|
6740
|
+
const targetEl = getNodeEl(event.target);
|
|
6741
|
+
if (!targetEl || targetEl !== event.currentTarget)
|
|
6742
|
+
return;
|
|
6743
|
+
const labelEl = targetEl.children[0];
|
|
6744
|
+
removeClassName(labelEl, "drag-before", "drag-after", "drag-inner");
|
|
6745
|
+
};
|
|
6746
|
+
const handleDragEnd = (event, node) => {
|
|
6747
|
+
if (!event.target || !event.currentTarget)
|
|
6748
|
+
return;
|
|
6749
|
+
const targetEl = getNodeEl(event.target);
|
|
6750
|
+
if (!targetEl || targetEl !== event.currentTarget)
|
|
6751
|
+
return;
|
|
6752
|
+
removeStatusClass(dragState.container);
|
|
6753
|
+
if (node && dragState.dragOverNodeId && dragState.dropType && services) {
|
|
6754
|
+
const targetInfo = services.editorService.getNodeInfo(dragState.dragOverNodeId, false);
|
|
6755
|
+
const targetNode = targetInfo.node;
|
|
6756
|
+
let targetParent = targetInfo.parent;
|
|
6757
|
+
if (!targetParent || !targetNode)
|
|
6758
|
+
return;
|
|
6759
|
+
let targetIndex = -1;
|
|
6760
|
+
if (Array.isArray(targetNode.items) && dragState.dropType === "inner") {
|
|
6761
|
+
targetIndex = targetNode.items.length;
|
|
6762
|
+
targetParent = targetNode;
|
|
6763
|
+
} else {
|
|
6764
|
+
targetIndex = getNodeIndex(dragState.dragOverNodeId, targetParent);
|
|
6765
|
+
}
|
|
6766
|
+
if (dragState.dropType === "after") {
|
|
6767
|
+
targetIndex += 1;
|
|
6768
|
+
}
|
|
6769
|
+
services?.editorService.dragTo(node, targetParent, targetIndex);
|
|
6770
|
+
}
|
|
6771
|
+
dragState.dragOverNodeId = "";
|
|
6772
|
+
dragState.dropType = "";
|
|
6773
|
+
dragState.container = null;
|
|
6774
|
+
};
|
|
6775
|
+
return {
|
|
6776
|
+
handleDragStart,
|
|
6777
|
+
handleDragEnd,
|
|
6778
|
+
handleDragLeave,
|
|
6779
|
+
handleDragOver
|
|
6780
|
+
};
|
|
6781
|
+
};
|
|
6782
|
+
|
|
6783
|
+
const updateStatus = (nodeStatusMap, id, status) => {
|
|
6784
|
+
const nodeStatus = nodeStatusMap.get(id);
|
|
6785
|
+
if (!nodeStatus)
|
|
6786
|
+
return;
|
|
6787
|
+
getKeys(status).forEach((key) => {
|
|
6788
|
+
if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
|
|
6789
|
+
nodeStatus[key] = Boolean(status[key]);
|
|
6790
|
+
}
|
|
6791
|
+
});
|
|
6792
|
+
};
|
|
6793
|
+
const useFilter = (nodeStatusMap, page) => {
|
|
6794
|
+
const filterIsMatch = (value, data) => {
|
|
6795
|
+
if (!value) {
|
|
6796
|
+
return true;
|
|
6797
|
+
}
|
|
6798
|
+
let name = "";
|
|
6799
|
+
if (data.name) {
|
|
6800
|
+
name = data.name;
|
|
6801
|
+
} else if (data.items) {
|
|
6802
|
+
name = "container";
|
|
6803
|
+
}
|
|
6804
|
+
return `${data.id}${name}${data.type}`.includes(value);
|
|
6805
|
+
};
|
|
6806
|
+
const filterNode = (text) => (node, parents) => {
|
|
6807
|
+
if (!nodeStatusMap.value)
|
|
6808
|
+
return;
|
|
6809
|
+
const visible = filterIsMatch(text, node);
|
|
6810
|
+
if (visible && parents.length) {
|
|
6811
|
+
parents.forEach((parent) => {
|
|
6812
|
+
updateStatus(nodeStatusMap.value, parent.id, {
|
|
6813
|
+
visible,
|
|
6814
|
+
expand: true
|
|
6815
|
+
});
|
|
6816
|
+
});
|
|
6817
|
+
}
|
|
6818
|
+
updateStatus(nodeStatusMap.value, node.id, {
|
|
6819
|
+
visible
|
|
6820
|
+
});
|
|
6821
|
+
};
|
|
6822
|
+
const filter = (text) => {
|
|
6823
|
+
if (!page.value?.items?.length)
|
|
6824
|
+
return;
|
|
6825
|
+
page.value.items.forEach((node) => {
|
|
6826
|
+
traverseNode(node, filterNode(text));
|
|
6827
|
+
});
|
|
6828
|
+
};
|
|
6829
|
+
return {
|
|
6830
|
+
filterText: ref(""),
|
|
6831
|
+
filterTextChangeHandler(text) {
|
|
6832
|
+
filter(text);
|
|
6833
|
+
}
|
|
6834
|
+
};
|
|
6835
|
+
};
|
|
6836
|
+
|
|
6837
|
+
const _hoisted_1$a = ["draggable", "data-node-id", "data-is-container"];
|
|
6838
|
+
const _hoisted_2$8 = { class: "layer-node-label" };
|
|
6839
|
+
const _hoisted_3$4 = { class: "layer-node-tool" };
|
|
6840
|
+
const _hoisted_4$4 = {
|
|
6841
|
+
key: 0,
|
|
6842
|
+
class: "magic-editor-layer-node-children"
|
|
6843
|
+
};
|
|
6844
|
+
const throttleTime = 300;
|
|
6845
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
6354
6846
|
...{
|
|
6355
|
-
name: "
|
|
6847
|
+
name: "MEditorLayerNode"
|
|
6356
6848
|
},
|
|
6357
|
-
__name: "
|
|
6849
|
+
__name: "LayerNode",
|
|
6358
6850
|
props: {
|
|
6359
|
-
|
|
6851
|
+
data: {},
|
|
6852
|
+
parent: {},
|
|
6853
|
+
indent: { default: 0 },
|
|
6854
|
+
filterText: { default: "" },
|
|
6855
|
+
isCtrlKeyDown: { type: Boolean, default: false }
|
|
6360
6856
|
},
|
|
6361
|
-
|
|
6857
|
+
emits: ["node-contextmenu"],
|
|
6858
|
+
setup(__props, { emit }) {
|
|
6859
|
+
const props = __props;
|
|
6362
6860
|
const services = inject("services");
|
|
6861
|
+
const nodeStatusMap = inject("nodeStatusMap");
|
|
6363
6862
|
const editorService = services?.editorService;
|
|
6364
|
-
const
|
|
6365
|
-
const
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
const currentNodeKey = ref();
|
|
6371
|
-
const clicked = ref(false);
|
|
6372
|
-
const treeProps = {
|
|
6373
|
-
children: "items",
|
|
6374
|
-
label: "name",
|
|
6375
|
-
value: "id",
|
|
6376
|
-
disabled: (data) => Boolean(data.items?.length),
|
|
6377
|
-
class: (data) => {
|
|
6378
|
-
if (clicked.value || isPage(data))
|
|
6379
|
-
return "";
|
|
6380
|
-
if (data.id === highlightNode?.value?.id && !checkedKeys.value.includes(data.id)) {
|
|
6381
|
-
return "cus-tree-node-hover";
|
|
6382
|
-
}
|
|
6863
|
+
const uiService = services?.uiService;
|
|
6864
|
+
const nodeStatus = computed(
|
|
6865
|
+
() => nodeStatusMap?.value?.get(props.data.id) || {
|
|
6866
|
+
selected: false,
|
|
6867
|
+
expand: false,
|
|
6868
|
+
visible: false
|
|
6383
6869
|
}
|
|
6870
|
+
);
|
|
6871
|
+
const expanded = computed(() => nodeStatus.value.expand);
|
|
6872
|
+
const selected = computed(() => nodeStatus.value.selected);
|
|
6873
|
+
const visible = computed(() => nodeStatus.value.visible);
|
|
6874
|
+
const hasChilren = computed(() => props.data.items?.length > 0);
|
|
6875
|
+
const nodeEl = ref();
|
|
6876
|
+
const { handleDragStart, handleDragEnd, handleDragLeave } = useDrag(services);
|
|
6877
|
+
const expandHandler = () => {
|
|
6878
|
+
if (!nodeStatusMap?.value)
|
|
6879
|
+
return;
|
|
6880
|
+
updateStatus(nodeStatusMap.value, props.data.id, {
|
|
6881
|
+
expand: !expanded.value
|
|
6882
|
+
});
|
|
6883
|
+
};
|
|
6884
|
+
const nodeClickHandler = () => {
|
|
6885
|
+
if (!nodeStatusMap?.value)
|
|
6886
|
+
return;
|
|
6887
|
+
if (uiService?.get("uiSelectMode")) {
|
|
6888
|
+
document.dispatchEvent(new CustomEvent("ui-select", { detail: props.data }));
|
|
6889
|
+
return;
|
|
6890
|
+
}
|
|
6891
|
+
if (hasChilren.value && !props.isCtrlKeyDown) {
|
|
6892
|
+
updateStatus(nodeStatusMap.value, props.data.id, {
|
|
6893
|
+
expand: true
|
|
6894
|
+
});
|
|
6895
|
+
}
|
|
6896
|
+
nextTick(() => {
|
|
6897
|
+
select(props.data);
|
|
6898
|
+
});
|
|
6899
|
+
};
|
|
6900
|
+
const contextmenuHandler = (event) => {
|
|
6901
|
+
event.preventDefault();
|
|
6902
|
+
nodeClickHandler();
|
|
6903
|
+
emit("node-contextmenu", event, props.data);
|
|
6904
|
+
};
|
|
6905
|
+
const nodeContentmenuHandler = (event, node) => {
|
|
6906
|
+
emit("node-contextmenu", event, node);
|
|
6384
6907
|
};
|
|
6385
|
-
const isMultiSelect = computed(() => isCtrlKeyDown.value || checkedKeys.value.length > 1);
|
|
6386
|
-
const nodes = computed(() => editorService?.get("nodes") || []);
|
|
6387
|
-
const page = computed(() => editorService?.get("page"));
|
|
6388
|
-
const values = computed(() => page.value ? [page.value] : []);
|
|
6389
|
-
const highlightNode = computed(() => editorService?.get("highlightNode"));
|
|
6390
6908
|
const select = async (data) => {
|
|
6391
6909
|
if (!data.id) {
|
|
6392
6910
|
throw new Error("没有id");
|
|
6393
6911
|
}
|
|
6394
|
-
|
|
6395
|
-
|
|
6912
|
+
if (props.isCtrlKeyDown) {
|
|
6913
|
+
multiSelect(data);
|
|
6914
|
+
} else {
|
|
6915
|
+
await editorService?.select(data);
|
|
6916
|
+
editorService?.get("stage")?.select(data.id);
|
|
6917
|
+
}
|
|
6396
6918
|
};
|
|
6397
6919
|
const multiSelect = async (data) => {
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6920
|
+
const nodes = editorService?.get("nodes") || [];
|
|
6921
|
+
const newNodes = [];
|
|
6922
|
+
let isCancel = false;
|
|
6923
|
+
nodes.forEach((node) => {
|
|
6924
|
+
if (node.id === data.id) {
|
|
6925
|
+
isCancel = true;
|
|
6926
|
+
return;
|
|
6927
|
+
}
|
|
6928
|
+
newNodes.push(node.id);
|
|
6929
|
+
});
|
|
6930
|
+
if (!isCancel || newNodes.length === 0) {
|
|
6931
|
+
newNodes.push(data.id);
|
|
6404
6932
|
}
|
|
6405
|
-
editorService?.
|
|
6406
|
-
editorService?.get("stage")?.
|
|
6933
|
+
await editorService?.multiSelect(newNodes);
|
|
6934
|
+
editorService?.get("stage")?.multiSelect(newNodes);
|
|
6407
6935
|
};
|
|
6408
|
-
const
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
if (ingType === NodeType.PAGE && data.type !== NodeType.PAGE)
|
|
6415
|
-
return false;
|
|
6416
|
-
if (!data?.type)
|
|
6417
|
-
return false;
|
|
6418
|
-
if (["prev", "next"].includes(type))
|
|
6419
|
-
return true;
|
|
6420
|
-
if (data.items || data.type === "container")
|
|
6421
|
-
return true;
|
|
6422
|
-
return false;
|
|
6936
|
+
const highlightHandler = throttle(() => {
|
|
6937
|
+
highlight();
|
|
6938
|
+
}, throttleTime);
|
|
6939
|
+
const highlight = () => {
|
|
6940
|
+
editorService?.highlight(props.data);
|
|
6941
|
+
editorService?.get("stage")?.highlight(props.data.id);
|
|
6423
6942
|
};
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6943
|
+
return (_ctx, _cache) => {
|
|
6944
|
+
const _component_LayerNode = resolveComponent("LayerNode", true);
|
|
6945
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
6946
|
+
class: "magic-editor-layer-node",
|
|
6947
|
+
ref_key: "nodeEl",
|
|
6948
|
+
ref: nodeEl,
|
|
6949
|
+
draggable: !unref(isPage)(_ctx.data),
|
|
6950
|
+
"data-node-id": _ctx.data.id,
|
|
6951
|
+
"data-is-container": Array.isArray(_ctx.data.items),
|
|
6952
|
+
onDragstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
6953
|
+
(...args) => unref(handleDragStart) && unref(handleDragStart)(...args)),
|
|
6954
|
+
onDragleave: _cache[2] || (_cache[2] = //@ts-ignore
|
|
6955
|
+
(...args) => unref(handleDragLeave) && unref(handleDragLeave)(...args)),
|
|
6956
|
+
onDragend: _cache[3] || (_cache[3] = ($event) => unref(handleDragEnd)($event, _ctx.data))
|
|
6957
|
+
}, [
|
|
6958
|
+
createElementVNode("div", {
|
|
6959
|
+
class: normalizeClass(["layer-node", { selected: selected.value, expanded: expanded.value }]),
|
|
6960
|
+
style: normalizeStyle(`padding-left: ${_ctx.indent}px`),
|
|
6961
|
+
onContextmenu: contextmenuHandler,
|
|
6962
|
+
onMouseenter: _cache[0] || (_cache[0] = ($event) => unref(highlightHandler)())
|
|
6963
|
+
}, [
|
|
6964
|
+
createVNode(_sfc_main$M, {
|
|
6965
|
+
class: "expand-icon",
|
|
6966
|
+
style: normalizeStyle(hasChilren.value ? "" : "color: transparent; cursor: default"),
|
|
6967
|
+
icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
|
|
6968
|
+
onClick: expandHandler
|
|
6969
|
+
}, null, 8, ["style", "icon"]),
|
|
6970
|
+
createElementVNode("div", {
|
|
6971
|
+
class: "layer-node-content",
|
|
6972
|
+
onClick: nodeClickHandler
|
|
6973
|
+
}, [
|
|
6974
|
+
renderSlot(_ctx.$slots, "layer-node-content", { data: _ctx.data }, () => [
|
|
6975
|
+
createElementVNode("div", _hoisted_2$8, toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
|
|
6976
|
+
createElementVNode("div", _hoisted_3$4, [
|
|
6977
|
+
createVNode(_sfc_main$i, { data: _ctx.data }, null, 8, ["data"])
|
|
6978
|
+
])
|
|
6979
|
+
])
|
|
6980
|
+
])
|
|
6981
|
+
], 38),
|
|
6982
|
+
hasChilren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$4, [
|
|
6983
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (item) => {
|
|
6984
|
+
return openBlock(), createBlock(_component_LayerNode, {
|
|
6985
|
+
data: item,
|
|
6986
|
+
parent: _ctx.data,
|
|
6987
|
+
key: item.id,
|
|
6988
|
+
indent: _ctx.indent + 11,
|
|
6989
|
+
"filter-text": _ctx.filterText,
|
|
6990
|
+
"is-ctrl-key-down": _ctx.isCtrlKeyDown,
|
|
6991
|
+
onNodeContextmenu: nodeContentmenuHandler
|
|
6992
|
+
}, {
|
|
6993
|
+
"layer-node-content": withCtx(({ data: nodeData }) => [
|
|
6994
|
+
renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData })
|
|
6995
|
+
]),
|
|
6996
|
+
_: 2
|
|
6997
|
+
}, 1032, ["data", "parent", "indent", "filter-text", "is-ctrl-key-down"]);
|
|
6998
|
+
}), 128))
|
|
6999
|
+
])) : createCommentVNode("", true)
|
|
7000
|
+
], 40, _hoisted_1$a)), [
|
|
7001
|
+
[vShow, visible.value]
|
|
7002
|
+
]);
|
|
6451
7003
|
};
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
7004
|
+
}
|
|
7005
|
+
});
|
|
7006
|
+
|
|
7007
|
+
const useKeybinding = (services) => {
|
|
7008
|
+
const keybindingService = services?.keybindingService;
|
|
7009
|
+
const isCtrlKeyDown = ref(false);
|
|
7010
|
+
const windowBlurHandler = () => {
|
|
7011
|
+
isCtrlKeyDown.value = false;
|
|
7012
|
+
};
|
|
7013
|
+
keybindingService?.registeCommand("layer-panel-global-keyup", () => {
|
|
7014
|
+
isCtrlKeyDown.value = false;
|
|
7015
|
+
});
|
|
7016
|
+
keybindingService?.registeCommand("layer-panel-global-keydwon", () => {
|
|
7017
|
+
isCtrlKeyDown.value = true;
|
|
7018
|
+
});
|
|
7019
|
+
keybindingService?.registe([
|
|
7020
|
+
{
|
|
7021
|
+
command: "layer-panel-global-keydwon",
|
|
7022
|
+
keybinding: "ctrl",
|
|
7023
|
+
when: [["global", "keydown"]]
|
|
7024
|
+
},
|
|
7025
|
+
{
|
|
7026
|
+
command: "layer-panel-global-keyup",
|
|
7027
|
+
keybinding: "ctrl",
|
|
7028
|
+
when: [["global", "keyup"]]
|
|
7029
|
+
}
|
|
7030
|
+
]);
|
|
7031
|
+
onMounted(() => {
|
|
7032
|
+
globalThis.addEventListener("blur", windowBlurHandler);
|
|
7033
|
+
});
|
|
7034
|
+
onBeforeUnmount(() => {
|
|
7035
|
+
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
7036
|
+
});
|
|
7037
|
+
return {
|
|
7038
|
+
isCtrlKeyDown
|
|
7039
|
+
};
|
|
7040
|
+
};
|
|
7041
|
+
|
|
7042
|
+
const createPageNodeStatus = (services, pageId) => {
|
|
7043
|
+
const map = /* @__PURE__ */ new Map();
|
|
7044
|
+
map.set(pageId, {
|
|
7045
|
+
visible: true,
|
|
7046
|
+
expand: true,
|
|
7047
|
+
selected: true
|
|
7048
|
+
});
|
|
7049
|
+
services?.editorService.getNodeById(pageId)?.items.forEach(
|
|
7050
|
+
(node) => traverseNode(node, (node2) => {
|
|
7051
|
+
map.set(node2.id, {
|
|
7052
|
+
visible: true,
|
|
7053
|
+
expand: false,
|
|
7054
|
+
selected: false
|
|
7055
|
+
});
|
|
7056
|
+
})
|
|
7057
|
+
);
|
|
7058
|
+
return map;
|
|
7059
|
+
};
|
|
7060
|
+
const useNodeStatus = (services, page) => {
|
|
7061
|
+
const nodes = computed(() => services?.editorService.get("nodes") || []);
|
|
7062
|
+
const nodeStatusMaps = ref(/* @__PURE__ */ new Map());
|
|
7063
|
+
const nodeStatusMap = computed(
|
|
7064
|
+
() => page.value ? nodeStatusMaps.value.get(page.value.id) : /* @__PURE__ */ new Map()
|
|
7065
|
+
);
|
|
7066
|
+
watch(
|
|
7067
|
+
() => page.value?.id,
|
|
7068
|
+
(pageId) => {
|
|
7069
|
+
if (!pageId || nodeStatusMaps.value.has(pageId)) {
|
|
7070
|
+
return;
|
|
6455
7071
|
}
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
7072
|
+
nodeStatusMaps.value.set(pageId, createPageNodeStatus(services, pageId));
|
|
7073
|
+
},
|
|
7074
|
+
{
|
|
7075
|
+
immediate: true
|
|
7076
|
+
}
|
|
7077
|
+
);
|
|
7078
|
+
watch(
|
|
7079
|
+
nodes,
|
|
7080
|
+
(nodes2) => {
|
|
7081
|
+
if (!nodeStatusMap.value)
|
|
7082
|
+
return;
|
|
7083
|
+
for (const [id, status] of nodeStatusMap.value.entries()) {
|
|
7084
|
+
status.selected = nodes2.some((node) => node.id === id);
|
|
7085
|
+
if (status.selected) {
|
|
7086
|
+
getNodePath(id, page.value?.items).forEach((node) => {
|
|
7087
|
+
updateStatus(nodeStatusMap.value, node.id, {
|
|
7088
|
+
expand: true
|
|
7089
|
+
});
|
|
7090
|
+
});
|
|
7091
|
+
}
|
|
6461
7092
|
}
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
idsLength > checkedKeysLength ? checkedKeys.value : ids
|
|
6474
|
-
).length) {
|
|
6475
|
-
tree.value?.setCheckedKeys([], false);
|
|
6476
|
-
checkedKeys.value = ids.filter((id) => id !== page.value?.id);
|
|
6477
|
-
expandedKeys.value = union(expandedKeys.value, ids);
|
|
6478
|
-
}
|
|
6479
|
-
[currentNodeKey.value] = ids;
|
|
6480
|
-
setTimeout(() => {
|
|
6481
|
-
tree.value?.setCurrentKey(currentNodeKey.value);
|
|
7093
|
+
},
|
|
7094
|
+
{
|
|
7095
|
+
immediate: true
|
|
7096
|
+
}
|
|
7097
|
+
);
|
|
7098
|
+
services?.editorService.on("add", (newNodes) => {
|
|
7099
|
+
newNodes.forEach((node) => {
|
|
7100
|
+
nodeStatusMap.value?.set(node.id, {
|
|
7101
|
+
visible: true,
|
|
7102
|
+
expand: Array.isArray(node.items),
|
|
7103
|
+
selected: true
|
|
6482
7104
|
});
|
|
6483
7105
|
});
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
}
|
|
7106
|
+
});
|
|
7107
|
+
services?.editorService.on("remove", (nodes2) => {
|
|
7108
|
+
nodes2.forEach((node) => {
|
|
7109
|
+
nodeStatusMap.value?.delete(node.id);
|
|
6489
7110
|
});
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
7111
|
+
});
|
|
7112
|
+
return {
|
|
7113
|
+
nodeStatusMaps,
|
|
7114
|
+
nodeStatusMap
|
|
7115
|
+
};
|
|
7116
|
+
};
|
|
7117
|
+
|
|
7118
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
7119
|
+
...{
|
|
7120
|
+
name: "MEditorLayerPanel"
|
|
7121
|
+
},
|
|
7122
|
+
__name: "LayerPanel",
|
|
7123
|
+
props: {
|
|
7124
|
+
layerContentMenu: {}
|
|
7125
|
+
},
|
|
7126
|
+
setup(__props) {
|
|
7127
|
+
const services = inject("services");
|
|
7128
|
+
const editorService = services?.editorService;
|
|
7129
|
+
const page = computed(() => editorService?.get("page"));
|
|
7130
|
+
const root = computed(() => editorService?.get("root"));
|
|
7131
|
+
const { nodeStatusMap } = useNodeStatus(services, page);
|
|
7132
|
+
const { isCtrlKeyDown } = useKeybinding(services);
|
|
7133
|
+
provide("nodeStatusMap", nodeStatusMap);
|
|
7134
|
+
const { filterText, filterTextChangeHandler } = useFilter(nodeStatusMap, page);
|
|
7135
|
+
const collapseAllHandler = () => {
|
|
7136
|
+
if (!page.value || !nodeStatusMap.value)
|
|
7137
|
+
return;
|
|
7138
|
+
const items = nodeStatusMap.value.entries();
|
|
7139
|
+
for (const [id, status] of items) {
|
|
7140
|
+
if (id === page.value.id) {
|
|
7141
|
+
continue;
|
|
7142
|
+
}
|
|
7143
|
+
status.expand = false;
|
|
7144
|
+
}
|
|
7145
|
+
};
|
|
7146
|
+
const menu = ref();
|
|
7147
|
+
const contextmenu = (event) => {
|
|
7148
|
+
event.preventDefault();
|
|
7149
|
+
menu.value?.show(event);
|
|
6494
7150
|
};
|
|
6495
|
-
const
|
|
6496
|
-
|
|
7151
|
+
const { handleDragOver } = useDrag(services);
|
|
7152
|
+
return (_ctx, _cache) => {
|
|
7153
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
7154
|
+
default: withCtx(() => [
|
|
7155
|
+
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
7156
|
+
createVNode(_sfc_main$t, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
7157
|
+
createElementVNode("div", {
|
|
7158
|
+
class: "magic-editor-layer-tree",
|
|
7159
|
+
tabindex: "-1",
|
|
7160
|
+
onDragover: _cache[0] || (_cache[0] = //@ts-ignore
|
|
7161
|
+
(...args) => unref(handleDragOver) && unref(handleDragOver)(...args))
|
|
7162
|
+
}, [
|
|
7163
|
+
page.value && root.value ? (openBlock(), createBlock(_sfc_main$h, {
|
|
7164
|
+
key: 0,
|
|
7165
|
+
data: page.value,
|
|
7166
|
+
"filter-text": unref(filterText),
|
|
7167
|
+
"is-ctrl-key-down": unref(isCtrlKeyDown),
|
|
7168
|
+
onNodeContextmenu: contextmenu
|
|
7169
|
+
}, {
|
|
7170
|
+
"layer-node-content": withCtx(({ data: nodeData }) => [
|
|
7171
|
+
renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData })
|
|
7172
|
+
]),
|
|
7173
|
+
_: 3
|
|
7174
|
+
}, 8, ["data", "filter-text", "is-ctrl-key-down"])) : createCommentVNode("", true)
|
|
7175
|
+
], 32),
|
|
7176
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
7177
|
+
createVNode(_sfc_main$j, {
|
|
7178
|
+
ref_key: "menu",
|
|
7179
|
+
ref: menu,
|
|
7180
|
+
"layer-content-menu": _ctx.layerContentMenu,
|
|
7181
|
+
onCollapseAll: collapseAllHandler
|
|
7182
|
+
}, null, 8, ["layer-content-menu"])
|
|
7183
|
+
]))
|
|
7184
|
+
]),
|
|
7185
|
+
_: 3
|
|
7186
|
+
});
|
|
7187
|
+
};
|
|
7188
|
+
}
|
|
7189
|
+
});
|
|
7190
|
+
|
|
7191
|
+
const _hoisted_1$9 = ["onClick", "onDragstart"];
|
|
7192
|
+
const _hoisted_2$7 = ["title"];
|
|
7193
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
7194
|
+
...{
|
|
7195
|
+
name: "MEditorComponentListPanel"
|
|
7196
|
+
},
|
|
7197
|
+
__name: "ComponentListPanel",
|
|
7198
|
+
setup(__props) {
|
|
7199
|
+
const searchText = ref("");
|
|
7200
|
+
const filterTextChangeHandler = (v) => {
|
|
7201
|
+
searchText.value = v;
|
|
7202
|
+
};
|
|
7203
|
+
const services = inject("services");
|
|
7204
|
+
const stageOptions = inject("stageOptions");
|
|
7205
|
+
const stage = computed(() => services?.editorService.get("stage"));
|
|
7206
|
+
const list = computed(
|
|
7207
|
+
() => services?.componentListService.getList().map((group) => ({
|
|
7208
|
+
...group,
|
|
7209
|
+
items: group.items.filter((item) => item.text.includes(searchText.value))
|
|
7210
|
+
}))
|
|
7211
|
+
);
|
|
7212
|
+
const collapseValue = computed(
|
|
7213
|
+
() => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
|
|
7214
|
+
);
|
|
7215
|
+
let timeout;
|
|
7216
|
+
let clientX;
|
|
7217
|
+
let clientY;
|
|
7218
|
+
const appendComponent = ({ text, type, data = {} }) => {
|
|
7219
|
+
services?.editorService.add({
|
|
7220
|
+
name: text,
|
|
7221
|
+
type,
|
|
7222
|
+
...data
|
|
7223
|
+
});
|
|
6497
7224
|
};
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
if (!tree.value?.$el.contains(document.activeElement)) {
|
|
6511
|
-
isCtrlKeyDown.value = false;
|
|
6512
|
-
}
|
|
6513
|
-
});
|
|
6514
|
-
keybindingService?.registe([
|
|
6515
|
-
{
|
|
6516
|
-
command: "layer-panel-not-ctrl-keydown",
|
|
6517
|
-
when: [["layer-panel", "keydown"]]
|
|
6518
|
-
},
|
|
6519
|
-
{
|
|
6520
|
-
command: "layer-panel-ctrl-keydown",
|
|
6521
|
-
keybinding: "ctrl",
|
|
6522
|
-
when: [["layer-panel", "keydown"]]
|
|
6523
|
-
},
|
|
6524
|
-
{
|
|
6525
|
-
command: "layer-panel-ctrl-keyup",
|
|
6526
|
-
keybinding: "ctrl",
|
|
6527
|
-
when: [["layer-panel", "keyup"]]
|
|
6528
|
-
},
|
|
6529
|
-
{
|
|
6530
|
-
command: "layer-panel-global-keydwon",
|
|
6531
|
-
keybinding: "ctrl",
|
|
6532
|
-
when: [["global", "keydown"]]
|
|
6533
|
-
}
|
|
6534
|
-
]);
|
|
6535
|
-
watch(tree, () => {
|
|
6536
|
-
if (tree.value?.$el) {
|
|
6537
|
-
keybindingService?.registeEl("layer-panel", tree.value.$el);
|
|
6538
|
-
tree.value.$el.addEventListener("blur", windowBlurHandler);
|
|
6539
|
-
} else {
|
|
6540
|
-
keybindingService?.unregisteEl("layer-panel");
|
|
6541
|
-
}
|
|
6542
|
-
});
|
|
6543
|
-
onMounted(() => {
|
|
6544
|
-
editorService?.on("remove", editorServiceRemoveHandler);
|
|
6545
|
-
globalThis.addEventListener("blur", windowBlurHandler);
|
|
6546
|
-
});
|
|
6547
|
-
onBeforeUnmount(() => {
|
|
6548
|
-
tree.value?.$el.removeEventListener("blur", windowBlurHandler);
|
|
6549
|
-
});
|
|
6550
|
-
onUnmounted(() => {
|
|
6551
|
-
editorService?.off("remove", editorServiceRemoveHandler);
|
|
6552
|
-
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
6553
|
-
});
|
|
6554
|
-
const highlightHandler = throttle((data) => {
|
|
6555
|
-
highlight(data);
|
|
6556
|
-
}, throttleTime);
|
|
6557
|
-
const toggleClickFlag = () => {
|
|
6558
|
-
clicked.value = !clicked.value;
|
|
7225
|
+
const dragstartHandler = ({ text, type, data = {} }, e) => {
|
|
7226
|
+
e.dataTransfer?.setData(
|
|
7227
|
+
"text/json",
|
|
7228
|
+
serialize({
|
|
7229
|
+
dragType: DragType.COMPONENT_LIST,
|
|
7230
|
+
data: {
|
|
7231
|
+
name: text,
|
|
7232
|
+
type,
|
|
7233
|
+
...data
|
|
7234
|
+
}
|
|
7235
|
+
})
|
|
7236
|
+
);
|
|
6559
7237
|
};
|
|
6560
|
-
const
|
|
6561
|
-
if (
|
|
6562
|
-
|
|
7238
|
+
const dragendHandler = () => {
|
|
7239
|
+
if (timeout) {
|
|
7240
|
+
globalThis.clearTimeout(timeout);
|
|
7241
|
+
timeout = void 0;
|
|
6563
7242
|
}
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
multiSelect(nodes.value.map((node) => node.id));
|
|
7243
|
+
const doc = stage.value?.renderer.contentWindow?.document;
|
|
7244
|
+
if (doc && stageOptions) {
|
|
7245
|
+
removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
|
|
6568
7246
|
}
|
|
7247
|
+
clientX = 0;
|
|
7248
|
+
clientY = 0;
|
|
6569
7249
|
};
|
|
6570
|
-
const
|
|
6571
|
-
if (
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
7250
|
+
const dragHandler = (e) => {
|
|
7251
|
+
if (e.clientX !== clientX || e.clientY !== clientY) {
|
|
7252
|
+
clientX = e.clientX;
|
|
7253
|
+
clientY = e.clientY;
|
|
7254
|
+
if (timeout) {
|
|
7255
|
+
globalThis.clearTimeout(timeout);
|
|
7256
|
+
timeout = void 0;
|
|
7257
|
+
}
|
|
6576
7258
|
return;
|
|
6577
7259
|
}
|
|
6578
|
-
|
|
6579
|
-
};
|
|
6580
|
-
const contextmenu = async (event, data) => {
|
|
6581
|
-
event.preventDefault();
|
|
6582
|
-
if (nodes.value.length < 2) {
|
|
6583
|
-
await select(data);
|
|
6584
|
-
}
|
|
6585
|
-
menu.value?.show(event);
|
|
6586
|
-
};
|
|
6587
|
-
const collapseAllHandler = () => {
|
|
6588
|
-
const page2 = editorService?.get("page");
|
|
6589
|
-
if (!tree.value || !page2)
|
|
7260
|
+
if (timeout || !stage.value)
|
|
6590
7261
|
return;
|
|
6591
|
-
|
|
6592
|
-
rootNode.childNodes.forEach((node) => {
|
|
6593
|
-
node.collapse();
|
|
6594
|
-
handleCollapse(node.data);
|
|
6595
|
-
});
|
|
7262
|
+
timeout = stage.value.delayedMarkContainer(e);
|
|
6596
7263
|
};
|
|
6597
7264
|
return (_ctx, _cache) => {
|
|
6598
|
-
return openBlock(), createBlock(unref(TMagicScrollbar),
|
|
7265
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), null, {
|
|
6599
7266
|
default: withCtx(() => [
|
|
6600
|
-
renderSlot(_ctx.$slots, "
|
|
6601
|
-
createVNode(
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
class: "magic-editor-layer-tree",
|
|
6605
|
-
ref_key: "tree",
|
|
6606
|
-
ref: tree,
|
|
6607
|
-
"node-key": "id",
|
|
6608
|
-
"empty-text": "页面空荡荡的",
|
|
6609
|
-
tabindex: "-1",
|
|
6610
|
-
draggable: "",
|
|
6611
|
-
"default-expanded-keys": expandedKeys.value,
|
|
6612
|
-
"default-checked-keys": checkedKeys.value,
|
|
6613
|
-
"current-node-key": currentNodeKey.value,
|
|
6614
|
-
data: values.value,
|
|
6615
|
-
"expand-on-click-node": false,
|
|
6616
|
-
"highlight-current": !isMultiSelect.value,
|
|
6617
|
-
"check-on-click-node": true,
|
|
6618
|
-
props: treeProps,
|
|
6619
|
-
"filter-node-method": filterNode,
|
|
6620
|
-
"allow-drop": allowDrop,
|
|
6621
|
-
"show-checkbox": isMultiSelect.value,
|
|
6622
|
-
onNodeClick: clickHandler,
|
|
6623
|
-
onNodeContextmenu: contextmenu,
|
|
6624
|
-
onNodeDragEnd: handleDragEnd,
|
|
6625
|
-
onNodeCollapse: handleCollapse,
|
|
6626
|
-
onNodeExpand: handleExpand,
|
|
6627
|
-
onCheck: checkHandler,
|
|
6628
|
-
onMousedown: toggleClickFlag,
|
|
6629
|
-
onMouseup: toggleClickFlag
|
|
7267
|
+
renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
7268
|
+
createVNode(unref(TMagicCollapse), {
|
|
7269
|
+
class: "ui-component-panel",
|
|
7270
|
+
"model-value": collapseValue.value
|
|
6630
7271
|
}, {
|
|
6631
|
-
default: withCtx((
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
7272
|
+
default: withCtx(() => [
|
|
7273
|
+
createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
|
|
7274
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
|
|
7275
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
7276
|
+
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
7277
|
+
key: index,
|
|
7278
|
+
name: `${index}`
|
|
7279
|
+
}, {
|
|
7280
|
+
title: withCtx(() => [
|
|
7281
|
+
createVNode(_sfc_main$M, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
7282
|
+
createTextVNode(toDisplayString(group.title), 1)
|
|
7283
|
+
]),
|
|
7284
|
+
default: withCtx(() => [
|
|
7285
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(group.items, (item) => {
|
|
7286
|
+
return openBlock(), createElementBlock("div", {
|
|
7287
|
+
class: "component-item",
|
|
7288
|
+
draggable: "true",
|
|
7289
|
+
key: item.type,
|
|
7290
|
+
onClick: ($event) => appendComponent(item),
|
|
7291
|
+
onDragstart: ($event) => dragstartHandler(item, $event),
|
|
7292
|
+
onDragend: dragendHandler,
|
|
7293
|
+
onDrag: dragHandler
|
|
7294
|
+
}, [
|
|
7295
|
+
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
7296
|
+
createVNode(_sfc_main$M, {
|
|
7297
|
+
title: item.text,
|
|
7298
|
+
icon: item.icon
|
|
7299
|
+
}, null, 8, ["title", "icon"]),
|
|
7300
|
+
createElementVNode("span", {
|
|
7301
|
+
title: item.text
|
|
7302
|
+
}, toDisplayString(item.text), 9, _hoisted_2$7)
|
|
7303
|
+
])
|
|
7304
|
+
], 40, _hoisted_1$9);
|
|
7305
|
+
}), 128))
|
|
7306
|
+
]),
|
|
7307
|
+
_: 2
|
|
7308
|
+
}, 1032, ["name"])) : createCommentVNode("", true)
|
|
7309
|
+
], 64);
|
|
7310
|
+
}), 256))
|
|
6644
7311
|
]),
|
|
6645
7312
|
_: 3
|
|
6646
|
-
}, 8, ["
|
|
6647
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
6648
|
-
createVNode(_sfc_main$h, {
|
|
6649
|
-
ref_key: "menu",
|
|
6650
|
-
ref: menu,
|
|
6651
|
-
"layer-content-menu": _ctx.layerContentMenu,
|
|
6652
|
-
onCollapseAll: collapseAllHandler
|
|
6653
|
-
}, null, 8, ["layer-content-menu"])
|
|
6654
|
-
]))
|
|
7313
|
+
}, 8, ["model-value"])
|
|
6655
7314
|
]),
|
|
6656
7315
|
_: 3
|
|
6657
7316
|
});
|
|
@@ -6688,7 +7347,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
6688
7347
|
type: "component",
|
|
6689
7348
|
icon: Goods,
|
|
6690
7349
|
text: "组件",
|
|
6691
|
-
component: _sfc_main$
|
|
7350
|
+
component: _sfc_main$f,
|
|
6692
7351
|
slots: {}
|
|
6693
7352
|
},
|
|
6694
7353
|
layer: {
|
|
@@ -6699,7 +7358,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
6699
7358
|
props: {
|
|
6700
7359
|
layerContentMenu: props.layerContentMenu
|
|
6701
7360
|
},
|
|
6702
|
-
component: _sfc_main$
|
|
7361
|
+
component: _sfc_main$g,
|
|
6703
7362
|
slots: {}
|
|
6704
7363
|
},
|
|
6705
7364
|
"code-block": {
|
|
@@ -6707,7 +7366,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
6707
7366
|
type: "component",
|
|
6708
7367
|
icon: EditPen,
|
|
6709
7368
|
text: "代码编辑",
|
|
6710
|
-
component: _sfc_main$
|
|
7369
|
+
component: _sfc_main$p,
|
|
6711
7370
|
slots: {}
|
|
6712
7371
|
},
|
|
6713
7372
|
"data-source": {
|
|
@@ -6715,7 +7374,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
6715
7374
|
type: "component",
|
|
6716
7375
|
icon: Coin,
|
|
6717
7376
|
text: "数据源",
|
|
6718
|
-
component: _sfc_main$
|
|
7377
|
+
component: _sfc_main$m,
|
|
6719
7378
|
slots: {}
|
|
6720
7379
|
}
|
|
6721
7380
|
};
|
|
@@ -6740,7 +7399,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
6740
7399
|
key: config.$key ?? index,
|
|
6741
7400
|
onClick: ($event) => activeTabName.value = config.text || `${index}`
|
|
6742
7401
|
}, [
|
|
6743
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
7402
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$M, {
|
|
6744
7403
|
key: 0,
|
|
6745
7404
|
icon: config.icon
|
|
6746
7405
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -6801,16 +7460,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
6801
7460
|
} : void 0,
|
|
6802
7461
|
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
6803
7462
|
name: "layer-node-content",
|
|
6804
|
-
fn: withCtx(({ data: nodeData
|
|
7463
|
+
fn: withCtx(({ data: nodeData }) => [
|
|
6805
7464
|
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-content", {
|
|
6806
7465
|
key: 0,
|
|
6807
|
-
data: nodeData
|
|
6808
|
-
node
|
|
7466
|
+
data: nodeData
|
|
6809
7467
|
}) : config.slots?.layerNodeContent ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
6810
7468
|
key: 1,
|
|
6811
|
-
data: nodeData
|
|
6812
|
-
|
|
6813
|
-
}, null, 8, ["data", "node"])) : createCommentVNode("", true)
|
|
7469
|
+
data: nodeData
|
|
7470
|
+
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
6814
7471
|
]),
|
|
6815
7472
|
key: "5"
|
|
6816
7473
|
} : void 0
|
|
@@ -7440,7 +8097,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
7440
8097
|
content: _ctx.pinned ? "取消置于顶层自动隐藏" : "置于顶层不消失"
|
|
7441
8098
|
}, {
|
|
7442
8099
|
default: withCtx(() => [
|
|
7443
|
-
createVNode(_sfc_main$
|
|
8100
|
+
createVNode(_sfc_main$M, {
|
|
7444
8101
|
style: { "margin-left": "10px", "cursor": "pointer" },
|
|
7445
8102
|
icon: _ctx.pinned ? _sfc_main$a : _sfc_main$b,
|
|
7446
8103
|
onClick: pinHandler
|
|
@@ -7456,7 +8113,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
7456
8113
|
onClick: closeHandler
|
|
7457
8114
|
}, {
|
|
7458
8115
|
default: withCtx(() => [
|
|
7459
|
-
createVNode(_sfc_main$
|
|
8116
|
+
createVNode(_sfc_main$M, { icon: unref(Close) }, null, 8, ["icon"])
|
|
7460
8117
|
]),
|
|
7461
8118
|
_: 1
|
|
7462
8119
|
})
|
|
@@ -7493,6 +8150,13 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
7493
8150
|
nodeList.value = [];
|
|
7494
8151
|
menu.value?.hide();
|
|
7495
8152
|
};
|
|
8153
|
+
const clearTimeoutLazy = () => {
|
|
8154
|
+
globalThis.setTimeout(() => {
|
|
8155
|
+
if (timeout) {
|
|
8156
|
+
globalThis.clearTimeout(timeout);
|
|
8157
|
+
}
|
|
8158
|
+
}, 300);
|
|
8159
|
+
};
|
|
7496
8160
|
const unWatch = watch(
|
|
7497
8161
|
stage,
|
|
7498
8162
|
(stage2) => {
|
|
@@ -7507,7 +8171,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
7507
8171
|
return;
|
|
7508
8172
|
}
|
|
7509
8173
|
timeout = globalThis.setTimeout(() => {
|
|
7510
|
-
const els = stage2
|
|
8174
|
+
const els = stage2.renderer.getElementsFromPoint(event) || [];
|
|
7511
8175
|
const nodes = getNodes(
|
|
7512
8176
|
els.map((el) => el.id),
|
|
7513
8177
|
page.value?.items
|
|
@@ -7522,7 +8186,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
7522
8186
|
}, 1500);
|
|
7523
8187
|
});
|
|
7524
8188
|
stage2.on("mouseleave", () => {
|
|
7525
|
-
|
|
8189
|
+
clearTimeoutLazy();
|
|
7526
8190
|
});
|
|
7527
8191
|
unWatch();
|
|
7528
8192
|
},
|
|
@@ -7561,11 +8225,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
7561
8225
|
})
|
|
7562
8226
|
);
|
|
7563
8227
|
const mouseenterHandler = () => {
|
|
7564
|
-
|
|
7565
|
-
if (timeout) {
|
|
7566
|
-
globalThis.clearTimeout(timeout);
|
|
7567
|
-
}
|
|
7568
|
-
}, 300);
|
|
8228
|
+
clearTimeoutLazy();
|
|
7569
8229
|
};
|
|
7570
8230
|
const dragMenuHandler = ({ deltaY, deltaX }) => {
|
|
7571
8231
|
if (!menu.value)
|
|
@@ -7580,9 +8240,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
7580
8240
|
menu.value?.hide();
|
|
7581
8241
|
};
|
|
7582
8242
|
return (_ctx, _cache) => {
|
|
7583
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8243
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
7584
8244
|
ref_key: "menu",
|
|
7585
8245
|
ref: menu,
|
|
8246
|
+
class: "magic-editor-node-list-menu",
|
|
8247
|
+
style: { "max-width": "280px" },
|
|
7586
8248
|
"menu-data": menuData.value,
|
|
7587
8249
|
active: node.value?.id,
|
|
7588
8250
|
"auto-hide": !pinned.value,
|
|
@@ -7764,7 +8426,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
7764
8426
|
};
|
|
7765
8427
|
__expose({ show });
|
|
7766
8428
|
return (_ctx, _cache) => {
|
|
7767
|
-
return openBlock(), createBlock(_sfc_main$
|
|
8429
|
+
return openBlock(), createBlock(_sfc_main$l, {
|
|
7768
8430
|
"menu-data": menuData.value,
|
|
7769
8431
|
ref_key: "menu",
|
|
7770
8432
|
ref: menu
|
|
@@ -7859,17 +8521,26 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
7859
8521
|
services?.editorService.set("stage", null);
|
|
7860
8522
|
services?.keybindingService.unregisteEl("stage");
|
|
7861
8523
|
});
|
|
8524
|
+
const parseDSL = getConfig("parseDSL");
|
|
7862
8525
|
const contextmenuHandler = (e) => {
|
|
7863
8526
|
e.preventDefault();
|
|
7864
8527
|
menu.value?.show(e);
|
|
7865
8528
|
};
|
|
7866
8529
|
const dragoverHandler = (e) => {
|
|
7867
|
-
e.preventDefault();
|
|
7868
8530
|
if (!e.dataTransfer)
|
|
7869
8531
|
return;
|
|
8532
|
+
e.preventDefault();
|
|
7870
8533
|
e.dataTransfer.dropEffect = "move";
|
|
7871
8534
|
};
|
|
7872
8535
|
const dropHandler = async (e) => {
|
|
8536
|
+
if (!e.dataTransfer)
|
|
8537
|
+
return;
|
|
8538
|
+
const data = e.dataTransfer.getData("text/json");
|
|
8539
|
+
if (!data)
|
|
8540
|
+
return;
|
|
8541
|
+
const config = parseDSL(`(${data})`);
|
|
8542
|
+
if (!config || config.dragType !== DragType.COMPONENT_LIST)
|
|
8543
|
+
return;
|
|
7873
8544
|
e.preventDefault();
|
|
7874
8545
|
const doc = stage?.renderer.contentWindow?.document;
|
|
7875
8546
|
const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
|
|
@@ -7877,18 +8548,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
7877
8548
|
if (parentEl) {
|
|
7878
8549
|
parent = services?.editorService.getNodeById(parentEl.id, false);
|
|
7879
8550
|
}
|
|
7880
|
-
if (
|
|
7881
|
-
const parseDSL = getConfig("parseDSL");
|
|
7882
|
-
const data = e.dataTransfer.getData("text/json");
|
|
7883
|
-
if (!data)
|
|
7884
|
-
return;
|
|
7885
|
-
const config = parseDSL(`(${data})`);
|
|
7886
|
-
if (!config)
|
|
7887
|
-
return;
|
|
8551
|
+
if (parent && stageContainer.value && stage) {
|
|
7888
8552
|
const layout = await services?.editorService.getLayout(parent);
|
|
7889
8553
|
const containerRect = stageContainer.value.getBoundingClientRect();
|
|
7890
8554
|
const { scrollTop, scrollLeft } = stage.mask;
|
|
7891
|
-
const { style = {} } = config;
|
|
8555
|
+
const { style = {} } = config.data;
|
|
7892
8556
|
let top = 0;
|
|
7893
8557
|
let left = 0;
|
|
7894
8558
|
let position = "relative";
|
|
@@ -7902,14 +8566,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
7902
8566
|
top = top - calcValueByFontsize(doc, parentTop);
|
|
7903
8567
|
}
|
|
7904
8568
|
}
|
|
7905
|
-
config.style = {
|
|
8569
|
+
config.data.style = {
|
|
7906
8570
|
...style,
|
|
7907
8571
|
position,
|
|
7908
8572
|
top: top / zoom.value,
|
|
7909
8573
|
left: left / zoom.value
|
|
7910
8574
|
};
|
|
7911
|
-
config.inputEvent = e;
|
|
7912
|
-
services?.editorService.add(config, parent);
|
|
8575
|
+
config.data.inputEvent = e;
|
|
8576
|
+
services?.editorService.add(config.data, parent);
|
|
7913
8577
|
}
|
|
7914
8578
|
};
|
|
7915
8579
|
return (_ctx, _cache) => {
|
|
@@ -8095,14 +8759,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
8095
8759
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
8096
8760
|
onClick: addPage
|
|
8097
8761
|
}, [
|
|
8098
|
-
createVNode(_sfc_main$
|
|
8762
|
+
createVNode(_sfc_main$M, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
8099
8763
|
])) : (openBlock(), createElementBlock("div", _hoisted_1$2)),
|
|
8100
8764
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
8101
8765
|
key: 2,
|
|
8102
8766
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
8103
8767
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
8104
8768
|
}, [
|
|
8105
|
-
createVNode(_sfc_main$
|
|
8769
|
+
createVNode(_sfc_main$M, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
8106
8770
|
])) : createCommentVNode("", true),
|
|
8107
8771
|
pageLength.value ? (openBlock(), createElementBlock("div", {
|
|
8108
8772
|
key: 3,
|
|
@@ -8118,7 +8782,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
8118
8782
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
8119
8783
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
8120
8784
|
}, [
|
|
8121
|
-
createVNode(_sfc_main$
|
|
8785
|
+
createVNode(_sfc_main$M, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
8122
8786
|
])) : createCommentVNode("", true)
|
|
8123
8787
|
], 512);
|
|
8124
8788
|
};
|
|
@@ -8190,7 +8854,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8190
8854
|
default: withCtx(() => [
|
|
8191
8855
|
createElementVNode("div", null, [
|
|
8192
8856
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
8193
|
-
createVNode(_sfc_main$
|
|
8857
|
+
createVNode(_sfc_main$w, {
|
|
8194
8858
|
data: {
|
|
8195
8859
|
type: "button",
|
|
8196
8860
|
text: "复制",
|
|
@@ -8198,7 +8862,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8198
8862
|
handler: () => copy(item)
|
|
8199
8863
|
}
|
|
8200
8864
|
}, null, 8, ["data"]),
|
|
8201
|
-
createVNode(_sfc_main$
|
|
8865
|
+
createVNode(_sfc_main$w, {
|
|
8202
8866
|
data: {
|
|
8203
8867
|
type: "button",
|
|
8204
8868
|
text: "删除",
|
|
@@ -9039,119 +9703,23 @@ const keybindingConfig = [
|
|
|
9039
9703
|
}
|
|
9040
9704
|
];
|
|
9041
9705
|
|
|
9042
|
-
const
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
},
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
}
|
|
9059
|
-
/** 左侧面板配置 */
|
|
9060
|
-
sidebar: {
|
|
9061
|
-
type: Object
|
|
9062
|
-
},
|
|
9063
|
-
/** 顶部工具栏配置 */
|
|
9064
|
-
menu: {
|
|
9065
|
-
type: Object,
|
|
9066
|
-
default: () => ({ left: [], right: [] })
|
|
9067
|
-
},
|
|
9068
|
-
/** 组件树右键菜单 */
|
|
9069
|
-
layerContentMenu: {
|
|
9070
|
-
type: Array,
|
|
9071
|
-
default: () => []
|
|
9072
|
-
},
|
|
9073
|
-
/** 画布右键菜单 */
|
|
9074
|
-
stageContentMenu: {
|
|
9075
|
-
type: Array,
|
|
9076
|
-
default: () => []
|
|
9077
|
-
},
|
|
9078
|
-
/** 中间工作区域中画布渲染的内容 */
|
|
9079
|
-
render: {
|
|
9080
|
-
type: Function
|
|
9081
|
-
},
|
|
9082
|
-
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
9083
|
-
runtimeUrl: String,
|
|
9084
|
-
/** 选中时是否自动滚动到可视区域 */
|
|
9085
|
-
autoScrollIntoView: Boolean,
|
|
9086
|
-
/** 组件的属性配置表单的dsl */
|
|
9087
|
-
propsConfigs: {
|
|
9088
|
-
type: Object,
|
|
9089
|
-
default: () => ({})
|
|
9090
|
-
},
|
|
9091
|
-
/** 添加组件时的默认值 */
|
|
9092
|
-
propsValues: {
|
|
9093
|
-
type: Object,
|
|
9094
|
-
default: () => ({})
|
|
9095
|
-
},
|
|
9096
|
-
/** 组件联动事件选项列表 */
|
|
9097
|
-
eventMethodList: {
|
|
9098
|
-
type: Object,
|
|
9099
|
-
default: () => ({})
|
|
9100
|
-
},
|
|
9101
|
-
/** 添加数据源时的默认值 */
|
|
9102
|
-
datasourceValues: {
|
|
9103
|
-
type: Object,
|
|
9104
|
-
default: () => ({})
|
|
9105
|
-
},
|
|
9106
|
-
/** 数据源的属性配置表单的dsl */
|
|
9107
|
-
datasourceConfigs: {
|
|
9108
|
-
type: Object,
|
|
9109
|
-
default: () => ({})
|
|
9110
|
-
},
|
|
9111
|
-
/** 画布中组件选中框的移动范围 */
|
|
9112
|
-
moveableOptions: {
|
|
9113
|
-
type: [Object, Function]
|
|
9114
|
-
},
|
|
9115
|
-
/** 编辑器初始化时默认选中的组件ID */
|
|
9116
|
-
defaultSelected: {
|
|
9117
|
-
type: [Number, String]
|
|
9118
|
-
},
|
|
9119
|
-
canSelect: {
|
|
9120
|
-
type: Function,
|
|
9121
|
-
default: (el) => Boolean(el.id)
|
|
9122
|
-
},
|
|
9123
|
-
isContainer: {
|
|
9124
|
-
type: Function,
|
|
9125
|
-
default: (el) => el.classList.contains("magic-ui-container")
|
|
9126
|
-
},
|
|
9127
|
-
containerHighlightClassName: {
|
|
9128
|
-
type: String,
|
|
9129
|
-
default: CONTAINER_HIGHLIGHT_CLASS_NAME
|
|
9130
|
-
},
|
|
9131
|
-
containerHighlightDuration: {
|
|
9132
|
-
type: Number,
|
|
9133
|
-
default: 800
|
|
9134
|
-
},
|
|
9135
|
-
containerHighlightType: {
|
|
9136
|
-
type: String,
|
|
9137
|
-
default: ContainerHighlightType.DEFAULT
|
|
9138
|
-
},
|
|
9139
|
-
stageRect: {
|
|
9140
|
-
type: [String, Object]
|
|
9141
|
-
},
|
|
9142
|
-
codeOptions: {
|
|
9143
|
-
type: Object,
|
|
9144
|
-
default: () => ({})
|
|
9145
|
-
},
|
|
9146
|
-
updateDragEl: {
|
|
9147
|
-
type: Function
|
|
9148
|
-
},
|
|
9149
|
-
disabledDragStart: {
|
|
9150
|
-
type: Boolean
|
|
9151
|
-
},
|
|
9152
|
-
extendFormState: {
|
|
9153
|
-
type: Function
|
|
9154
|
-
}
|
|
9706
|
+
const defaultEditorProps = {
|
|
9707
|
+
componentGroupList: () => [],
|
|
9708
|
+
datasourceList: () => [],
|
|
9709
|
+
menu: () => ({ left: [], right: [] }),
|
|
9710
|
+
layerContentMenu: () => [],
|
|
9711
|
+
stageContentMenu: () => [],
|
|
9712
|
+
propsConfigs: () => ({}),
|
|
9713
|
+
propsValues: () => ({}),
|
|
9714
|
+
eventMethodList: () => ({}),
|
|
9715
|
+
datasourceValues: () => ({}),
|
|
9716
|
+
datasourceConfigs: () => ({}),
|
|
9717
|
+
canSelect: (el) => Boolean(el.id),
|
|
9718
|
+
isContainer: (el) => el.classList.contains("magic-ui-container"),
|
|
9719
|
+
containerHighlightClassName: CONTAINER_HIGHLIGHT_CLASS_NAME,
|
|
9720
|
+
containerHighlightDuration: 800,
|
|
9721
|
+
containerHighlightType: ContainerHighlightType.DEFAULT,
|
|
9722
|
+
codeOptions: () => ({})
|
|
9155
9723
|
};
|
|
9156
9724
|
|
|
9157
9725
|
const createCodeBlockTarget = (id, codeBlock) => new Target({
|
|
@@ -9172,20 +9740,26 @@ const createCodeBlockTarget = (id, codeBlock) => new Target({
|
|
|
9172
9740
|
const createDataSourceTarget = (id) => new Target({
|
|
9173
9741
|
type: DepTargetType.DATA_SOURCE,
|
|
9174
9742
|
id,
|
|
9175
|
-
isTarget: (key, value) =>
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9743
|
+
isTarget: (key, value) => {
|
|
9744
|
+
if (value?.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)) {
|
|
9745
|
+
return true;
|
|
9746
|
+
}
|
|
9747
|
+
if (!Array.isArray(value) || typeof value[0] !== "string") {
|
|
9748
|
+
return false;
|
|
9749
|
+
}
|
|
9750
|
+
const [prefixId] = value;
|
|
9751
|
+
const prefixIndex = prefixId.indexOf(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX);
|
|
9752
|
+
if (prefixIndex === -1) {
|
|
9753
|
+
return false;
|
|
9754
|
+
}
|
|
9755
|
+
const dsId = prefixId.substring(prefixIndex + DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX.length);
|
|
9756
|
+
return dsId === id && Boolean(dataSourceService.getDataSourceById(id));
|
|
9757
|
+
}
|
|
9179
9758
|
});
|
|
9180
9759
|
const createDataSourceCondTarget = (id) => new Target({
|
|
9181
9760
|
type: DepTargetType.DATA_SOURCE_COND,
|
|
9182
9761
|
id,
|
|
9183
|
-
isTarget: (key, value) =>
|
|
9184
|
-
if (!Array.isArray(value) || value[0] !== id)
|
|
9185
|
-
return false;
|
|
9186
|
-
const ds = dataSourceService.getDataSourceById(id);
|
|
9187
|
-
return Boolean(ds?.fields?.find((field) => field.name === value[1]));
|
|
9188
|
-
}
|
|
9762
|
+
isTarget: (key, value) => Array.isArray(value) && value[0] === id && Boolean(dataSourceService.getDataSourceById(id))
|
|
9189
9763
|
});
|
|
9190
9764
|
const createDataSourceMethodTarget = (id) => new Target({
|
|
9191
9765
|
type: DepTargetType.DATA_SOURCE_METHOD,
|
|
@@ -9212,7 +9786,7 @@ const initServiceState = (props, {
|
|
|
9212
9786
|
watch(
|
|
9213
9787
|
() => props.modelValue,
|
|
9214
9788
|
(modelValue) => {
|
|
9215
|
-
editorService.set("root", modelValue);
|
|
9789
|
+
editorService.set("root", modelValue || null);
|
|
9216
9790
|
},
|
|
9217
9791
|
{
|
|
9218
9792
|
immediate: true
|
|
@@ -9220,28 +9794,28 @@ const initServiceState = (props, {
|
|
|
9220
9794
|
);
|
|
9221
9795
|
watch(
|
|
9222
9796
|
() => props.componentGroupList,
|
|
9223
|
-
(componentGroupList) => componentListService.setList(componentGroupList),
|
|
9797
|
+
(componentGroupList) => componentGroupList && componentListService.setList(componentGroupList),
|
|
9224
9798
|
{
|
|
9225
9799
|
immediate: true
|
|
9226
9800
|
}
|
|
9227
9801
|
);
|
|
9228
9802
|
watch(
|
|
9229
9803
|
() => props.datasourceList,
|
|
9230
|
-
(datasourceList) => dataSourceService.set("datasourceTypeList", datasourceList),
|
|
9804
|
+
(datasourceList) => datasourceList && dataSourceService.set("datasourceTypeList", datasourceList),
|
|
9231
9805
|
{
|
|
9232
9806
|
immediate: true
|
|
9233
9807
|
}
|
|
9234
9808
|
);
|
|
9235
9809
|
watch(
|
|
9236
9810
|
() => props.propsConfigs,
|
|
9237
|
-
(configs) => propsService.setPropsConfigs(configs),
|
|
9811
|
+
(configs) => configs && propsService.setPropsConfigs(configs),
|
|
9238
9812
|
{
|
|
9239
9813
|
immediate: true
|
|
9240
9814
|
}
|
|
9241
9815
|
);
|
|
9242
9816
|
watch(
|
|
9243
9817
|
() => props.propsValues,
|
|
9244
|
-
(values) => propsService.setPropsValues(values),
|
|
9818
|
+
(values) => values && propsService.setPropsValues(values),
|
|
9245
9819
|
{
|
|
9246
9820
|
immediate: true
|
|
9247
9821
|
}
|
|
@@ -9251,7 +9825,7 @@ const initServiceState = (props, {
|
|
|
9251
9825
|
(eventMethodList) => {
|
|
9252
9826
|
const eventsList = {};
|
|
9253
9827
|
const methodsList = {};
|
|
9254
|
-
Object.keys(eventMethodList).forEach((type) => {
|
|
9828
|
+
eventMethodList && Object.keys(eventMethodList).forEach((type) => {
|
|
9255
9829
|
eventsList[type] = eventMethodList[type].events;
|
|
9256
9830
|
methodsList[type] = eventMethodList[type].methods;
|
|
9257
9831
|
});
|
|
@@ -9265,7 +9839,7 @@ const initServiceState = (props, {
|
|
|
9265
9839
|
watch(
|
|
9266
9840
|
() => props.datasourceConfigs,
|
|
9267
9841
|
(configs) => {
|
|
9268
|
-
Object.entries(configs).forEach(([key, value]) => {
|
|
9842
|
+
configs && Object.entries(configs).forEach(([key, value]) => {
|
|
9269
9843
|
dataSourceService.setFormConfig(key, value);
|
|
9270
9844
|
});
|
|
9271
9845
|
},
|
|
@@ -9276,7 +9850,7 @@ const initServiceState = (props, {
|
|
|
9276
9850
|
watch(
|
|
9277
9851
|
() => props.datasourceValues,
|
|
9278
9852
|
(values) => {
|
|
9279
|
-
Object.entries(values).forEach(([key, value]) => {
|
|
9853
|
+
values && Object.entries(values).forEach(([key, value]) => {
|
|
9280
9854
|
dataSourceService.setFormValue(key, value);
|
|
9281
9855
|
});
|
|
9282
9856
|
},
|
|
@@ -9284,6 +9858,26 @@ const initServiceState = (props, {
|
|
|
9284
9858
|
immediate: true
|
|
9285
9859
|
}
|
|
9286
9860
|
);
|
|
9861
|
+
watch(
|
|
9862
|
+
() => props.datasourceEventMethodList,
|
|
9863
|
+
(eventMethodList) => {
|
|
9864
|
+
const eventsList = {};
|
|
9865
|
+
const methodsList = {};
|
|
9866
|
+
eventMethodList && Object.keys(eventMethodList).forEach((type) => {
|
|
9867
|
+
eventsList[type] = eventMethodList[type].events;
|
|
9868
|
+
methodsList[type] = eventMethodList[type].methods;
|
|
9869
|
+
});
|
|
9870
|
+
Object.entries(eventsList).forEach(([key, value]) => {
|
|
9871
|
+
dataSourceService.setFormEvent(key, value);
|
|
9872
|
+
});
|
|
9873
|
+
Object.entries(methodsList).forEach(([key, value]) => {
|
|
9874
|
+
dataSourceService.setFormMethod(key, value);
|
|
9875
|
+
});
|
|
9876
|
+
},
|
|
9877
|
+
{
|
|
9878
|
+
immediate: true
|
|
9879
|
+
}
|
|
9880
|
+
);
|
|
9287
9881
|
watch(
|
|
9288
9882
|
() => props.defaultSelected,
|
|
9289
9883
|
(defaultSelected) => defaultSelected && editorService.select(defaultSelected),
|
|
@@ -9405,6 +9999,8 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
9405
9999
|
if (toRaw(value) !== toRaw(preValue)) {
|
|
9406
10000
|
emit("update:modelValue", value);
|
|
9407
10001
|
}
|
|
10002
|
+
if (!value)
|
|
10003
|
+
return;
|
|
9408
10004
|
value.codeBlocks = value.codeBlocks || {};
|
|
9409
10005
|
value.dataSources = value.dataSources || [];
|
|
9410
10006
|
codeBlockService.setCodeDsl(value.codeBlocks);
|
|
@@ -9487,18 +10083,44 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
9487
10083
|
});
|
|
9488
10084
|
};
|
|
9489
10085
|
|
|
9490
|
-
const _sfc_main = defineComponent({
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
10086
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10087
|
+
...{
|
|
10088
|
+
name: "MEditor"
|
|
10089
|
+
},
|
|
10090
|
+
__name: "Editor",
|
|
10091
|
+
props: mergeDefaults({
|
|
10092
|
+
modelValue: {},
|
|
10093
|
+
componentGroupList: {},
|
|
10094
|
+
datasourceList: {},
|
|
10095
|
+
sidebar: {},
|
|
10096
|
+
menu: {},
|
|
10097
|
+
layerContentMenu: {},
|
|
10098
|
+
stageContentMenu: {},
|
|
10099
|
+
render: { type: Function },
|
|
10100
|
+
runtimeUrl: {},
|
|
10101
|
+
autoScrollIntoView: { type: Boolean },
|
|
10102
|
+
propsConfigs: {},
|
|
10103
|
+
propsValues: {},
|
|
10104
|
+
eventMethodList: {},
|
|
10105
|
+
datasourceValues: {},
|
|
10106
|
+
datasourceConfigs: {},
|
|
10107
|
+
datasourceEventMethodList: {},
|
|
10108
|
+
moveableOptions: { type: Function },
|
|
10109
|
+
defaultSelected: {},
|
|
10110
|
+
canSelect: { type: Function },
|
|
10111
|
+
isContainer: { type: Function },
|
|
10112
|
+
containerHighlightClassName: {},
|
|
10113
|
+
containerHighlightDuration: {},
|
|
10114
|
+
containerHighlightType: {},
|
|
10115
|
+
stageRect: {},
|
|
10116
|
+
codeOptions: {},
|
|
10117
|
+
updateDragEl: { type: Function },
|
|
10118
|
+
disabledDragStart: { type: Boolean },
|
|
10119
|
+
extendFormState: { type: Function }
|
|
10120
|
+
}, defaultEditorProps),
|
|
9500
10121
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
9501
|
-
setup(
|
|
10122
|
+
setup(__props, { expose: __expose, emit }) {
|
|
10123
|
+
const props = __props;
|
|
9502
10124
|
const services = {
|
|
9503
10125
|
componentListService,
|
|
9504
10126
|
eventsService,
|
|
@@ -9534,119 +10156,101 @@ const _sfc_main = defineComponent({
|
|
|
9534
10156
|
disabledDragStart: props.disabledDragStart
|
|
9535
10157
|
})
|
|
9536
10158
|
);
|
|
9537
|
-
|
|
10159
|
+
__expose(services);
|
|
10160
|
+
return (_ctx, _cache) => {
|
|
10161
|
+
return openBlock(), createBlock(_sfc_main$x, null, {
|
|
10162
|
+
header: withCtx(() => [
|
|
10163
|
+
renderSlot(_ctx.$slots, "header")
|
|
10164
|
+
]),
|
|
10165
|
+
nav: withCtx(() => [
|
|
10166
|
+
renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
|
|
10167
|
+
createVNode(_sfc_main$v, { data: _ctx.menu }, null, 8, ["data"])
|
|
10168
|
+
])
|
|
10169
|
+
]),
|
|
10170
|
+
"content-before": withCtx(() => [
|
|
10171
|
+
renderSlot(_ctx.$slots, "content-before")
|
|
10172
|
+
]),
|
|
10173
|
+
"src-code": withCtx(() => [
|
|
10174
|
+
renderSlot(_ctx.$slots, "src-code", { editorService: unref(editorService) })
|
|
10175
|
+
]),
|
|
10176
|
+
sidebar: withCtx(() => [
|
|
10177
|
+
renderSlot(_ctx.$slots, "sidebar", { editorService: unref(editorService) }, () => [
|
|
10178
|
+
createVNode(_sfc_main$e, {
|
|
10179
|
+
data: _ctx.sidebar,
|
|
10180
|
+
"layer-content-menu": _ctx.layerContentMenu
|
|
10181
|
+
}, {
|
|
10182
|
+
"layer-panel-header": withCtx(() => [
|
|
10183
|
+
renderSlot(_ctx.$slots, "layer-panel-header")
|
|
10184
|
+
]),
|
|
10185
|
+
"layer-node-content": withCtx(({ data }) => [
|
|
10186
|
+
renderSlot(_ctx.$slots, "layer-node-content", { data })
|
|
10187
|
+
]),
|
|
10188
|
+
"component-list-panel-header": withCtx(() => [
|
|
10189
|
+
renderSlot(_ctx.$slots, "component-list-panel-header")
|
|
10190
|
+
]),
|
|
10191
|
+
"component-list-item": withCtx(({ component }) => [
|
|
10192
|
+
renderSlot(_ctx.$slots, "component-list-item", { component })
|
|
10193
|
+
]),
|
|
10194
|
+
"code-block-panel-header": withCtx(() => [
|
|
10195
|
+
renderSlot(_ctx.$slots, "code-block-panel-header")
|
|
10196
|
+
]),
|
|
10197
|
+
"code-block-panel-tool": withCtx(({ id, data }) => [
|
|
10198
|
+
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
10199
|
+
id,
|
|
10200
|
+
data
|
|
10201
|
+
})
|
|
10202
|
+
]),
|
|
10203
|
+
_: 3
|
|
10204
|
+
}, 8, ["data", "layer-content-menu"])
|
|
10205
|
+
])
|
|
10206
|
+
]),
|
|
10207
|
+
workspace: withCtx(() => [
|
|
10208
|
+
renderSlot(_ctx.$slots, "workspace", { editorService: unref(editorService) }, () => [
|
|
10209
|
+
createVNode(_sfc_main$1, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
10210
|
+
stage: withCtx(() => [
|
|
10211
|
+
renderSlot(_ctx.$slots, "stage")
|
|
10212
|
+
]),
|
|
10213
|
+
"workspace-content": withCtx(() => [
|
|
10214
|
+
renderSlot(_ctx.$slots, "workspace-content", { editorService: unref(editorService) })
|
|
10215
|
+
]),
|
|
10216
|
+
"page-bar-title": withCtx(({ page }) => [
|
|
10217
|
+
renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
10218
|
+
]),
|
|
10219
|
+
"page-bar-popover": withCtx(({ page }) => [
|
|
10220
|
+
renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
10221
|
+
]),
|
|
10222
|
+
_: 3
|
|
10223
|
+
}, 8, ["stage-content-menu"])
|
|
10224
|
+
])
|
|
10225
|
+
]),
|
|
10226
|
+
"props-panel": withCtx(() => [
|
|
10227
|
+
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
10228
|
+
createVNode(_sfc_main$u, {
|
|
10229
|
+
"extend-state": _ctx.extendFormState,
|
|
10230
|
+
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
10231
|
+
}, {
|
|
10232
|
+
"props-panel-header": withCtx(() => [
|
|
10233
|
+
renderSlot(_ctx.$slots, "props-panel-header")
|
|
10234
|
+
]),
|
|
10235
|
+
_: 3
|
|
10236
|
+
}, 8, ["extend-state"])
|
|
10237
|
+
])
|
|
10238
|
+
]),
|
|
10239
|
+
empty: withCtx(() => [
|
|
10240
|
+
renderSlot(_ctx.$slots, "empty", { editorService: unref(editorService) })
|
|
10241
|
+
]),
|
|
10242
|
+
"content-after": withCtx(() => [
|
|
10243
|
+
renderSlot(_ctx.$slots, "content-after")
|
|
10244
|
+
]),
|
|
10245
|
+
footer: withCtx(() => [
|
|
10246
|
+
renderSlot(_ctx.$slots, "footer")
|
|
10247
|
+
]),
|
|
10248
|
+
_: 3
|
|
10249
|
+
});
|
|
10250
|
+
};
|
|
9538
10251
|
}
|
|
9539
10252
|
});
|
|
9540
10253
|
|
|
9541
|
-
const _export_sfc = (sfc, props) => {
|
|
9542
|
-
const target = sfc.__vccOpts || sfc;
|
|
9543
|
-
for (const [key, val] of props) {
|
|
9544
|
-
target[key] = val;
|
|
9545
|
-
}
|
|
9546
|
-
return target;
|
|
9547
|
-
};
|
|
9548
|
-
|
|
9549
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
9550
|
-
const _component_TMagicNavMenu = resolveComponent("TMagicNavMenu");
|
|
9551
|
-
const _component_Sidebar = resolveComponent("Sidebar");
|
|
9552
|
-
const _component_Workspace = resolveComponent("Workspace");
|
|
9553
|
-
const _component_PropsPanel = resolveComponent("PropsPanel");
|
|
9554
|
-
const _component_Framework = resolveComponent("Framework");
|
|
9555
|
-
return openBlock(), createBlock(_component_Framework, null, {
|
|
9556
|
-
header: withCtx(() => [
|
|
9557
|
-
renderSlot(_ctx.$slots, "header")
|
|
9558
|
-
]),
|
|
9559
|
-
nav: withCtx(() => [
|
|
9560
|
-
renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
9561
|
-
createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
9562
|
-
])
|
|
9563
|
-
]),
|
|
9564
|
-
"content-before": withCtx(() => [
|
|
9565
|
-
renderSlot(_ctx.$slots, "content-before")
|
|
9566
|
-
]),
|
|
9567
|
-
"src-code": withCtx(() => [
|
|
9568
|
-
renderSlot(_ctx.$slots, "src-code", { editorService: _ctx.editorService })
|
|
9569
|
-
]),
|
|
9570
|
-
sidebar: withCtx(() => [
|
|
9571
|
-
renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
9572
|
-
createVNode(_component_Sidebar, {
|
|
9573
|
-
data: _ctx.sidebar,
|
|
9574
|
-
"layer-content-menu": _ctx.layerContentMenu
|
|
9575
|
-
}, {
|
|
9576
|
-
"layer-panel-header": withCtx(() => [
|
|
9577
|
-
renderSlot(_ctx.$slots, "layer-panel-header")
|
|
9578
|
-
]),
|
|
9579
|
-
"layer-node-content": withCtx(({ node, data }) => [
|
|
9580
|
-
renderSlot(_ctx.$slots, "layer-node-content", {
|
|
9581
|
-
data,
|
|
9582
|
-
node
|
|
9583
|
-
})
|
|
9584
|
-
]),
|
|
9585
|
-
"component-list-panel-header": withCtx(() => [
|
|
9586
|
-
renderSlot(_ctx.$slots, "component-list-panel-header")
|
|
9587
|
-
]),
|
|
9588
|
-
"component-list-item": withCtx(({ component }) => [
|
|
9589
|
-
renderSlot(_ctx.$slots, "component-list-item", { component })
|
|
9590
|
-
]),
|
|
9591
|
-
"code-block-panel-header": withCtx(() => [
|
|
9592
|
-
renderSlot(_ctx.$slots, "code-block-panel-header")
|
|
9593
|
-
]),
|
|
9594
|
-
"code-block-panel-tool": withCtx(({ id, data }) => [
|
|
9595
|
-
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
9596
|
-
id,
|
|
9597
|
-
data
|
|
9598
|
-
})
|
|
9599
|
-
]),
|
|
9600
|
-
_: 3
|
|
9601
|
-
}, 8, ["data", "layer-content-menu"])
|
|
9602
|
-
])
|
|
9603
|
-
]),
|
|
9604
|
-
workspace: withCtx(() => [
|
|
9605
|
-
renderSlot(_ctx.$slots, "workspace", { editorService: _ctx.editorService }, () => [
|
|
9606
|
-
createVNode(_component_Workspace, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
9607
|
-
stage: withCtx(() => [
|
|
9608
|
-
renderSlot(_ctx.$slots, "stage")
|
|
9609
|
-
]),
|
|
9610
|
-
"workspace-content": withCtx(() => [
|
|
9611
|
-
renderSlot(_ctx.$slots, "workspace-content", { editorService: _ctx.editorService })
|
|
9612
|
-
]),
|
|
9613
|
-
"page-bar-title": withCtx(({ page }) => [
|
|
9614
|
-
renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
9615
|
-
]),
|
|
9616
|
-
"page-bar-popover": withCtx(({ page }) => [
|
|
9617
|
-
renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
9618
|
-
]),
|
|
9619
|
-
_: 3
|
|
9620
|
-
}, 8, ["stage-content-menu"])
|
|
9621
|
-
])
|
|
9622
|
-
]),
|
|
9623
|
-
"props-panel": withCtx(() => [
|
|
9624
|
-
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
9625
|
-
createVNode(_component_PropsPanel, {
|
|
9626
|
-
"extend-state": _ctx.extendFormState,
|
|
9627
|
-
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
9628
|
-
}, {
|
|
9629
|
-
"props-panel-header": withCtx(() => [
|
|
9630
|
-
renderSlot(_ctx.$slots, "props-panel-header")
|
|
9631
|
-
]),
|
|
9632
|
-
_: 3
|
|
9633
|
-
}, 8, ["extend-state"])
|
|
9634
|
-
])
|
|
9635
|
-
]),
|
|
9636
|
-
empty: withCtx(() => [
|
|
9637
|
-
renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
|
|
9638
|
-
]),
|
|
9639
|
-
"content-after": withCtx(() => [
|
|
9640
|
-
renderSlot(_ctx.$slots, "content-after")
|
|
9641
|
-
]),
|
|
9642
|
-
footer: withCtx(() => [
|
|
9643
|
-
renderSlot(_ctx.$slots, "footer")
|
|
9644
|
-
]),
|
|
9645
|
-
_: 3
|
|
9646
|
-
});
|
|
9647
|
-
}
|
|
9648
|
-
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
9649
|
-
|
|
9650
10254
|
const index$1 = '';
|
|
9651
10255
|
|
|
9652
10256
|
const defaultInstallOpt = {
|
|
@@ -9658,23 +10262,24 @@ const index = {
|
|
|
9658
10262
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
9659
10263
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
9660
10264
|
setConfig(option);
|
|
9661
|
-
app.component(
|
|
9662
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
9663
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
9664
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
9665
|
-
app.component("magic-code-editor", _sfc_main$
|
|
9666
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
9667
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
9668
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
9669
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
9670
|
-
app.component("m-fields-
|
|
9671
|
-
app.component("m-fields-
|
|
9672
|
-
app.component("m-fields-data-source-
|
|
9673
|
-
app.component("m-fields-data-source-
|
|
9674
|
-
app.component("m-fields-data-source-
|
|
9675
|
-
app.component("m-fields-data-source-
|
|
10265
|
+
app.component(_sfc_main.name, _sfc_main);
|
|
10266
|
+
app.component("m-fields-ui-select", _sfc_main$B);
|
|
10267
|
+
app.component("m-fields-code-link", _sfc_main$Q);
|
|
10268
|
+
app.component("m-fields-vs-code", _sfc_main$R);
|
|
10269
|
+
app.component("magic-code-editor", _sfc_main$S);
|
|
10270
|
+
app.component("m-fields-code-select", _sfc_main$P);
|
|
10271
|
+
app.component("m-fields-code-select-col", _sfc_main$L);
|
|
10272
|
+
app.component("m-fields-event-select", _sfc_main$D);
|
|
10273
|
+
app.component("m-fields-data-source-fields", _sfc_main$K);
|
|
10274
|
+
app.component("m-fields-data-source-mocks", _sfc_main$F);
|
|
10275
|
+
app.component("m-fields-key-value", _sfc_main$C);
|
|
10276
|
+
app.component("m-fields-data-source-input", _sfc_main$I);
|
|
10277
|
+
app.component("m-fields-data-source-select", _sfc_main$E);
|
|
10278
|
+
app.component("m-fields-data-source-methods", _sfc_main$H);
|
|
10279
|
+
app.component("m-fields-data-source-method-select", _sfc_main$G);
|
|
10280
|
+
app.component("m-fields-data-source-field-select", _sfc_main$J);
|
|
9676
10281
|
}
|
|
9677
10282
|
};
|
|
9678
10283
|
|
|
9679
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$
|
|
10284
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$O as CodeBlockEditor, _sfc_main$q as CodeBlockList, _sfc_main$p as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$P as CodeSelect, _sfc_main$L as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$l as ContentMenu, _sfc_main$J as DataSourceFieldSelect, _sfc_main$K as DataSourceFields, _sfc_main$I as DataSourceInput, _sfc_main$G as DataSourceMethodSelect, _sfc_main$H as DataSourceMethods, _sfc_main$F as DataSourceMocks, _sfc_main$E as DataSourceSelect, DepTargetType, DragType, _sfc_main$D as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$M as Icon, KeyBindingCommand, _sfc_main$C as KeyValue, Keys, LayerOffset, _sfc_main$g as LayerPanel, Layout, _sfc_main$z as LayoutContainer, _sfc_main$u as PropsPanel, _sfc_main$A as Resizer, _sfc_main$z as SplitView, _sfc_main$S as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$w as ToolButton, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useStage, warn };
|
|
9680
10285
|
//# sourceMappingURL=tmagic-editor.js.map
|