@tmagic/editor 1.3.0-beta.2 → 1.3.0-beta.4
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 +52 -60
- package/dist/tmagic-editor.js +1634 -1065
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +1659 -1087
- 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/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 +18 -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 +1 -1
- package/src/layouts/workspace/viewer/Stage.vue +19 -17
- package/src/services/dataSource.ts +10 -0
- package/src/services/editor.ts +45 -5
- package/src/theme/common/var.scss +2 -2
- 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 +60 -0
- package/src/utils/data-source/index.ts +11 -0
- package/src/utils/dep.ts +26 -11
- package/src/utils/editor.ts +14 -3
- package/src/utils/props.ts +3 -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 +3 -0
- package/types/services/editor.d.ts +1 -0
- package/types/type.d.ts +60 -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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('monaco-editor'), require('serialize-javascript'), require('@tmagic/design'), require('@tmagic/schema'), require('@tmagic/form'), require('@tmagic/table'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'monaco-editor', 'serialize-javascript', '@tmagic/design', '@tmagic/schema', '@tmagic/form', '@tmagic/table', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.monaco, global.serialize, global.design, global.schema, global.form, global.table, global.
|
|
5
|
-
})(this, (function (exports, vue, iconsVue, lodashEs, monaco, serialize, design, schema, form, table,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('monaco-editor'), require('serialize-javascript'), require('@tmagic/design'), require('@tmagic/schema'), require('@tmagic/form'), require('@tmagic/table'), require('@tmagic/utils'), require('gesto'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'monaco-editor', 'serialize-javascript', '@tmagic/design', '@tmagic/schema', '@tmagic/form', '@tmagic/table', '@tmagic/utils', 'gesto', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.monaco, global.serialize, global.design, global.schema, global.form, global.table, global.utils, global.Gesto, global.StageCore, global.events, global.core, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, iconsVue, lodashEs, monaco, serialize, design, schema, form, table, utils, Gesto, StageCore, events, core, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -23,10 +23,16 @@
|
|
|
23
23
|
|
|
24
24
|
const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
|
|
25
25
|
|
|
26
|
+
let $TMAGIC_EDITOR = {};
|
|
27
|
+
const setConfig = (option) => {
|
|
28
|
+
$TMAGIC_EDITOR = option;
|
|
29
|
+
};
|
|
30
|
+
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
31
|
+
|
|
26
32
|
const _hoisted_1$w = {
|
|
27
33
|
class: /* @__PURE__ */ vue.normalizeClass(`magic-code-editor`)
|
|
28
34
|
};
|
|
29
|
-
const _sfc_main$
|
|
35
|
+
const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
|
|
30
36
|
...{
|
|
31
37
|
name: "MEditorCodeEditor"
|
|
32
38
|
},
|
|
@@ -40,7 +46,8 @@
|
|
|
40
46
|
tabSize: 2
|
|
41
47
|
}) },
|
|
42
48
|
height: {},
|
|
43
|
-
autoSave: { type: Boolean, default: true }
|
|
49
|
+
autoSave: { type: Boolean, default: true },
|
|
50
|
+
parse: { type: Boolean, default: false }
|
|
44
51
|
},
|
|
45
52
|
emits: ["initd", "save"],
|
|
46
53
|
setup(__props, { expose: __expose, emit }) {
|
|
@@ -48,7 +55,7 @@
|
|
|
48
55
|
const toString = (v, language) => {
|
|
49
56
|
let value = "";
|
|
50
57
|
if (typeof v !== "string") {
|
|
51
|
-
if (
|
|
58
|
+
if (language === "json") {
|
|
52
59
|
value = JSON.stringify(v, null, 2);
|
|
53
60
|
} else {
|
|
54
61
|
value = serialize(v, {
|
|
@@ -64,6 +71,15 @@
|
|
|
64
71
|
}
|
|
65
72
|
return value;
|
|
66
73
|
};
|
|
74
|
+
const parse = (v, language) => {
|
|
75
|
+
if (typeof v !== "string") {
|
|
76
|
+
return v;
|
|
77
|
+
}
|
|
78
|
+
if (language === "json") {
|
|
79
|
+
return JSON.parse(v);
|
|
80
|
+
}
|
|
81
|
+
return getConfig("parseDSL")(v);
|
|
82
|
+
};
|
|
67
83
|
let vsEditor = null;
|
|
68
84
|
let vsDiffEditor = null;
|
|
69
85
|
const values = vue.ref("");
|
|
@@ -76,7 +92,7 @@
|
|
|
76
92
|
}, 300)
|
|
77
93
|
);
|
|
78
94
|
const setEditorValue = (v, m) => {
|
|
79
|
-
values.value = toString(v, props.language);
|
|
95
|
+
values.value = toString(v, props.language.toLocaleLowerCase());
|
|
80
96
|
if (props.type === "diff") {
|
|
81
97
|
const originalModel = monaco__namespace.editor.createModel(values.value, "text/javascript");
|
|
82
98
|
const modifiedModel = monaco__namespace.editor.createModel(toString(m, props.language), "text/javascript");
|
|
@@ -111,7 +127,7 @@
|
|
|
111
127
|
e.stopPropagation();
|
|
112
128
|
const newValue = getEditorValue();
|
|
113
129
|
values.value = newValue;
|
|
114
|
-
emit("save", newValue);
|
|
130
|
+
emit("save", props.parse ? parse(newValue, props.language) : newValue);
|
|
115
131
|
}
|
|
116
132
|
});
|
|
117
133
|
if (props.type !== "diff" && props.autoSave) {
|
|
@@ -119,7 +135,7 @@
|
|
|
119
135
|
const newValue = getEditorValue();
|
|
120
136
|
if (values.value !== newValue) {
|
|
121
137
|
values.value = newValue;
|
|
122
|
-
emit("save", newValue);
|
|
138
|
+
emit("save", props.parse ? parse(newValue, props.language) : newValue);
|
|
123
139
|
}
|
|
124
140
|
});
|
|
125
141
|
}
|
|
@@ -201,7 +217,7 @@
|
|
|
201
217
|
}
|
|
202
218
|
});
|
|
203
219
|
|
|
204
|
-
const _sfc_main$
|
|
220
|
+
const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
|
|
205
221
|
...{
|
|
206
222
|
name: "MEditorCode"
|
|
207
223
|
},
|
|
@@ -225,7 +241,7 @@
|
|
|
225
241
|
emit("change", v);
|
|
226
242
|
};
|
|
227
243
|
return (_ctx, _cache) => {
|
|
228
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
244
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$S, {
|
|
229
245
|
height: _ctx.config.height,
|
|
230
246
|
"init-values": _ctx.model[_ctx.name],
|
|
231
247
|
language: _ctx.config.language,
|
|
@@ -233,19 +249,14 @@
|
|
|
233
249
|
..._ctx.config.options,
|
|
234
250
|
readOnly: _ctx.disabled
|
|
235
251
|
},
|
|
252
|
+
parse: _ctx.config.parse,
|
|
236
253
|
onSave: save
|
|
237
|
-
}, null, 8, ["height", "init-values", "language", "options"]);
|
|
254
|
+
}, null, 8, ["height", "init-values", "language", "options", "parse"]);
|
|
238
255
|
};
|
|
239
256
|
}
|
|
240
257
|
});
|
|
241
258
|
|
|
242
|
-
|
|
243
|
-
const setConfig = (option) => {
|
|
244
|
-
$TMAGIC_EDITOR = option;
|
|
245
|
-
};
|
|
246
|
-
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
247
|
-
|
|
248
|
-
const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
|
|
259
|
+
const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
|
|
249
260
|
...{
|
|
250
261
|
name: "MEditorCodeLink"
|
|
251
262
|
},
|
|
@@ -324,7 +335,7 @@
|
|
|
324
335
|
}
|
|
325
336
|
});
|
|
326
337
|
|
|
327
|
-
const _sfc_main$
|
|
338
|
+
const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
|
|
328
339
|
...{
|
|
329
340
|
name: "MEditorCodeSelect"
|
|
330
341
|
},
|
|
@@ -397,10 +408,10 @@
|
|
|
397
408
|
});
|
|
398
409
|
|
|
399
410
|
const _hoisted_1$v = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
400
|
-
const _hoisted_2$
|
|
401
|
-
const _hoisted_3$
|
|
402
|
-
const _hoisted_4$
|
|
403
|
-
const _sfc_main$
|
|
411
|
+
const _hoisted_2$p = { style: { "flex": "1" } };
|
|
412
|
+
const _hoisted_3$b = { style: { "flex": "1" } };
|
|
413
|
+
const _hoisted_4$7 = { class: "dialog-footer" };
|
|
414
|
+
const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
|
|
404
415
|
...{
|
|
405
416
|
name: "MEditorCodeBlockEditor"
|
|
406
417
|
},
|
|
@@ -619,7 +630,7 @@
|
|
|
619
630
|
fullscreen: ""
|
|
620
631
|
}, {
|
|
621
632
|
footer: vue.withCtx(() => [
|
|
622
|
-
vue.createElementVNode("span", _hoisted_4$
|
|
633
|
+
vue.createElementVNode("span", _hoisted_4$7, [
|
|
623
634
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
624
635
|
size: "small",
|
|
625
636
|
onClick: _cache[1] || (_cache[1] = ($event) => difVisible.value = false)
|
|
@@ -643,7 +654,7 @@
|
|
|
643
654
|
]),
|
|
644
655
|
default: vue.withCtx(() => [
|
|
645
656
|
vue.createElementVNode("div", _hoisted_1$v, [
|
|
646
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
657
|
+
vue.createElementVNode("div", _hoisted_2$p, [
|
|
647
658
|
vue.createVNode(vue.unref(design.TMagicTag), {
|
|
648
659
|
size: "small",
|
|
649
660
|
type: "info"
|
|
@@ -654,7 +665,7 @@
|
|
|
654
665
|
_: 1
|
|
655
666
|
})
|
|
656
667
|
]),
|
|
657
|
-
vue.createElementVNode("div", _hoisted_3$
|
|
668
|
+
vue.createElementVNode("div", _hoisted_3$b, [
|
|
658
669
|
vue.createVNode(vue.unref(design.TMagicTag), {
|
|
659
670
|
size: "small",
|
|
660
671
|
type: "success"
|
|
@@ -666,7 +677,7 @@
|
|
|
666
677
|
})
|
|
667
678
|
])
|
|
668
679
|
]),
|
|
669
|
-
difVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
680
|
+
difVisible.value ? (vue.openBlock(), vue.createBlock(_sfc_main$S, {
|
|
670
681
|
key: 0,
|
|
671
682
|
ref_key: "magicVsEditor",
|
|
672
683
|
ref: magicVsEditor,
|
|
@@ -807,6 +818,17 @@
|
|
|
807
818
|
type: "event-select"
|
|
808
819
|
}
|
|
809
820
|
]
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
type: "panel",
|
|
824
|
+
title: "mock数据",
|
|
825
|
+
items: [
|
|
826
|
+
{
|
|
827
|
+
name: "mocks",
|
|
828
|
+
type: "data-source-mocks",
|
|
829
|
+
defaultValue: () => []
|
|
830
|
+
}
|
|
831
|
+
]
|
|
810
832
|
}
|
|
811
833
|
];
|
|
812
834
|
const getFormConfig = (type, configs) => {
|
|
@@ -988,7 +1010,8 @@
|
|
|
988
1010
|
editable: true,
|
|
989
1011
|
configs: {},
|
|
990
1012
|
values: {},
|
|
991
|
-
events: {}
|
|
1013
|
+
events: {},
|
|
1014
|
+
methods: {}
|
|
992
1015
|
});
|
|
993
1016
|
set(name, value) {
|
|
994
1017
|
this.state[name] = value;
|
|
@@ -1014,6 +1037,12 @@
|
|
|
1014
1037
|
setFormEvent(type, value = []) {
|
|
1015
1038
|
this.get("events")[type] = value;
|
|
1016
1039
|
}
|
|
1040
|
+
getFormMethod(type = "base") {
|
|
1041
|
+
return this.get("methods")[type] || [];
|
|
1042
|
+
}
|
|
1043
|
+
setFormMethod(type, value = []) {
|
|
1044
|
+
this.get("methods")[type] = value;
|
|
1045
|
+
}
|
|
1017
1046
|
add(config) {
|
|
1018
1047
|
const newConfig = {
|
|
1019
1048
|
...config,
|
|
@@ -1260,6 +1289,8 @@
|
|
|
1260
1289
|
{
|
|
1261
1290
|
type: "groupList",
|
|
1262
1291
|
name: "displayConds",
|
|
1292
|
+
titlePrefix: "条件组",
|
|
1293
|
+
expandAll: true,
|
|
1263
1294
|
items: [
|
|
1264
1295
|
{
|
|
1265
1296
|
type: "table",
|
|
@@ -1268,6 +1299,7 @@
|
|
|
1268
1299
|
{
|
|
1269
1300
|
type: "data-source-field-select",
|
|
1270
1301
|
name: "field",
|
|
1302
|
+
value: "key",
|
|
1271
1303
|
label: "字段"
|
|
1272
1304
|
},
|
|
1273
1305
|
{
|
|
@@ -1453,6 +1485,11 @@
|
|
|
1453
1485
|
DepTargetType2["DATA_SOURCE_COND"] = "data-source-cond";
|
|
1454
1486
|
return DepTargetType2;
|
|
1455
1487
|
})(DepTargetType || {});
|
|
1488
|
+
var DragType = /* @__PURE__ */ ((DragType2) => {
|
|
1489
|
+
DragType2["COMPONENT_LIST"] = "component-list";
|
|
1490
|
+
DragType2["LAYER_TREE"] = "layer-tree";
|
|
1491
|
+
return DragType2;
|
|
1492
|
+
})(DragType || {});
|
|
1456
1493
|
|
|
1457
1494
|
const COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
1458
1495
|
const getPageList = (app) => {
|
|
@@ -1475,9 +1512,9 @@
|
|
|
1475
1512
|
};
|
|
1476
1513
|
const generatePageNameByApp = (app) => generatePageName(getPageNameList(getPageList(app)));
|
|
1477
1514
|
const isFixed = (node) => node.style?.position === "fixed";
|
|
1478
|
-
const getNodeIndex = (
|
|
1515
|
+
const getNodeIndex = (id, parent) => {
|
|
1479
1516
|
const items = parent?.items || [];
|
|
1480
|
-
return items.findIndex((item) => `${item.id}` === `${
|
|
1517
|
+
return items.findIndex((item) => `${item.id}` === `${id}`);
|
|
1481
1518
|
};
|
|
1482
1519
|
const getRelativeStyle = (style = {}) => ({
|
|
1483
1520
|
...style,
|
|
@@ -1613,6 +1650,15 @@
|
|
|
1613
1650
|
space: 2,
|
|
1614
1651
|
unsafe: true
|
|
1615
1652
|
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
1653
|
+
const traverseNode = (node, cb, parents = []) => {
|
|
1654
|
+
cb(node, parents);
|
|
1655
|
+
if (node.items?.length) {
|
|
1656
|
+
parents.push(node);
|
|
1657
|
+
node.items.forEach((item) => {
|
|
1658
|
+
traverseNode(item, cb, parents);
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1616
1662
|
|
|
1617
1663
|
class UndoRedo {
|
|
1618
1664
|
elementList;
|
|
@@ -1991,7 +2037,7 @@
|
|
|
1991
2037
|
}
|
|
1992
2038
|
const propsService = new Props();
|
|
1993
2039
|
|
|
1994
|
-
|
|
2040
|
+
class Editor extends BaseService {
|
|
1995
2041
|
state = vue.reactive({
|
|
1996
2042
|
root: null,
|
|
1997
2043
|
page: null,
|
|
@@ -2026,7 +2072,8 @@
|
|
|
2026
2072
|
"move",
|
|
2027
2073
|
"undo",
|
|
2028
2074
|
"redo",
|
|
2029
|
-
"highlight"
|
|
2075
|
+
"highlight",
|
|
2076
|
+
"dragTo"
|
|
2030
2077
|
],
|
|
2031
2078
|
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
2032
2079
|
["select", "update", "moveLayer"]
|
|
@@ -2169,7 +2216,7 @@
|
|
|
2169
2216
|
const parent = vue.toRaw(this.getParentById(node.id));
|
|
2170
2217
|
if (!parent)
|
|
2171
2218
|
return node;
|
|
2172
|
-
const index = getNodeIndex(node, parent);
|
|
2219
|
+
const index = getNodeIndex(node.id, parent);
|
|
2173
2220
|
const nextNode = parent.items[index + 1] || parent.items[0];
|
|
2174
2221
|
await this.select(nextNode);
|
|
2175
2222
|
this.get("stage")?.select(nextNode.id);
|
|
@@ -2182,7 +2229,7 @@
|
|
|
2182
2229
|
throw new Error("page不能为空");
|
|
2183
2230
|
if (!root)
|
|
2184
2231
|
throw new Error("root不能为空");
|
|
2185
|
-
const index = getNodeIndex(page, root);
|
|
2232
|
+
const index = getNodeIndex(page.id, root);
|
|
2186
2233
|
const nextPage = root.items[index + 1] || root.items[0];
|
|
2187
2234
|
await this.select(nextPage);
|
|
2188
2235
|
this.get("stage")?.select(nextPage.id);
|
|
@@ -2303,7 +2350,7 @@
|
|
|
2303
2350
|
const { parent, node: curNode } = this.getNodeInfo(node.id);
|
|
2304
2351
|
if (!parent || !curNode)
|
|
2305
2352
|
throw new Error("找不要删除的节点");
|
|
2306
|
-
const index = getNodeIndex(curNode, parent);
|
|
2353
|
+
const index = getNodeIndex(curNode.id, parent);
|
|
2307
2354
|
if (typeof index !== "number" || index === -1)
|
|
2308
2355
|
throw new Error("找不要删除的节点");
|
|
2309
2356
|
parent.items?.splice(index, 1);
|
|
@@ -2371,7 +2418,7 @@
|
|
|
2371
2418
|
if (!parent)
|
|
2372
2419
|
throw new Error("获取不到父级节点");
|
|
2373
2420
|
const parentNodeItems = parent.items;
|
|
2374
|
-
const index = getNodeIndex(newConfig, parent);
|
|
2421
|
+
const index = getNodeIndex(newConfig.id, parent);
|
|
2375
2422
|
if (!parentNodeItems || typeof index === "undefined" || index === -1)
|
|
2376
2423
|
throw new Error("更新的节点未找到");
|
|
2377
2424
|
const newLayout = await this.getLayout(newConfig);
|
|
@@ -2561,7 +2608,7 @@
|
|
|
2561
2608
|
const target = this.getNodeById(targetId, false);
|
|
2562
2609
|
const stage = this.get("stage");
|
|
2563
2610
|
if (root && node && parent && stage) {
|
|
2564
|
-
const index = getNodeIndex(node, parent);
|
|
2611
|
+
const index = getNodeIndex(node.id, parent);
|
|
2565
2612
|
parent.items?.splice(index, 1);
|
|
2566
2613
|
await stage.remove({ id: node.id, parentId: parent.id, root });
|
|
2567
2614
|
const layout = await this.getLayout(target);
|
|
@@ -2583,6 +2630,38 @@
|
|
|
2583
2630
|
return newConfig;
|
|
2584
2631
|
}
|
|
2585
2632
|
}
|
|
2633
|
+
async dragTo(config, targetParent, targetIndex) {
|
|
2634
|
+
if (!targetParent || !Array.isArray(targetParent.items))
|
|
2635
|
+
return;
|
|
2636
|
+
const { parent, node: curNode } = this.getNodeInfo(config.id, false);
|
|
2637
|
+
if (!parent || !curNode)
|
|
2638
|
+
throw new Error("找不要删除的节点");
|
|
2639
|
+
const index = getNodeIndex(curNode.id, parent);
|
|
2640
|
+
if (typeof index !== "number" || index === -1)
|
|
2641
|
+
throw new Error("找不要删除的节点");
|
|
2642
|
+
if (parent.id === targetParent.id) {
|
|
2643
|
+
if (index === targetIndex)
|
|
2644
|
+
return;
|
|
2645
|
+
if (index < targetIndex) {
|
|
2646
|
+
targetIndex -= 1;
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
parent.items?.splice(index, 1);
|
|
2650
|
+
targetParent.items?.splice(targetIndex, 0, config);
|
|
2651
|
+
const page = this.get("page");
|
|
2652
|
+
const root = this.get("root");
|
|
2653
|
+
const stage = this.get("stage");
|
|
2654
|
+
if (stage && page && root) {
|
|
2655
|
+
stage.update({
|
|
2656
|
+
config: lodashEs.cloneDeep(page),
|
|
2657
|
+
parentId: root.id,
|
|
2658
|
+
root: lodashEs.cloneDeep(root)
|
|
2659
|
+
});
|
|
2660
|
+
}
|
|
2661
|
+
this.addModifiedNodeId(config.id);
|
|
2662
|
+
this.addModifiedNodeId(parent.id);
|
|
2663
|
+
this.pushHistoryState();
|
|
2664
|
+
}
|
|
2586
2665
|
/**
|
|
2587
2666
|
* 撤销当前操作
|
|
2588
2667
|
* @returns 上一次数据
|
|
@@ -2727,8 +2806,8 @@
|
|
|
2727
2806
|
page
|
|
2728
2807
|
};
|
|
2729
2808
|
}
|
|
2730
|
-
}
|
|
2731
|
-
const editorService = new Editor
|
|
2809
|
+
}
|
|
2810
|
+
const editorService = new Editor();
|
|
2732
2811
|
|
|
2733
2812
|
const beforePaste = async (position, config) => {
|
|
2734
2813
|
if (!config[0]?.style)
|
|
@@ -2802,7 +2881,7 @@
|
|
|
2802
2881
|
return newNode;
|
|
2803
2882
|
};
|
|
2804
2883
|
|
|
2805
|
-
const _sfc_main$
|
|
2884
|
+
const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
|
|
2806
2885
|
...{
|
|
2807
2886
|
name: "MEditorCodeParams"
|
|
2808
2887
|
},
|
|
@@ -2852,7 +2931,7 @@
|
|
|
2852
2931
|
});
|
|
2853
2932
|
|
|
2854
2933
|
const _hoisted_1$u = ["src"];
|
|
2855
|
-
const _sfc_main$
|
|
2934
|
+
const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
|
|
2856
2935
|
...{
|
|
2857
2936
|
name: "MEditorIcon"
|
|
2858
2937
|
},
|
|
@@ -2953,8 +3032,8 @@
|
|
|
2953
3032
|
};
|
|
2954
3033
|
|
|
2955
3034
|
const _hoisted_1$t = { class: "m-fields-code-select-col" };
|
|
2956
|
-
const _hoisted_2$
|
|
2957
|
-
const _sfc_main$
|
|
3035
|
+
const _hoisted_2$o = { class: "code-select-container" };
|
|
3036
|
+
const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
|
|
2958
3037
|
...{
|
|
2959
3038
|
name: "MEditorCodeSelectCol"
|
|
2960
3039
|
},
|
|
@@ -3029,21 +3108,21 @@
|
|
|
3029
3108
|
return (_ctx, _cache) => {
|
|
3030
3109
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
3031
3110
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, [
|
|
3032
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
3111
|
+
vue.createElementVNode("div", _hoisted_2$o, [
|
|
3033
3112
|
vue.createVNode(_component_m_form_container, {
|
|
3034
3113
|
class: "select",
|
|
3035
3114
|
config: selectConfig,
|
|
3036
3115
|
model: _ctx.model,
|
|
3037
3116
|
onChange: onParamsChangeHandler
|
|
3038
3117
|
}, null, 8, ["model"]),
|
|
3039
|
-
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3118
|
+
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
3040
3119
|
key: 0,
|
|
3041
3120
|
class: "icon",
|
|
3042
3121
|
icon: !_ctx.disabled ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3043
3122
|
onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(editCode)(_ctx.model[_ctx.name]))
|
|
3044
3123
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true)
|
|
3045
3124
|
]),
|
|
3046
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3125
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
3047
3126
|
key: 0,
|
|
3048
3127
|
name: "params",
|
|
3049
3128
|
model: _ctx.model,
|
|
@@ -3051,7 +3130,7 @@
|
|
|
3051
3130
|
"params-config": paramsConfig.value,
|
|
3052
3131
|
onChange: onParamsChangeHandler
|
|
3053
3132
|
}, null, 8, ["model", "size", "params-config"])) : vue.createCommentVNode("", true),
|
|
3054
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3133
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
3055
3134
|
key: 1,
|
|
3056
3135
|
ref_key: "codeBlockEditor",
|
|
3057
3136
|
ref: codeBlockEditor,
|
|
@@ -3065,8 +3144,8 @@
|
|
|
3065
3144
|
});
|
|
3066
3145
|
|
|
3067
3146
|
const _hoisted_1$s = { class: "m-editor-data-source-fields" };
|
|
3068
|
-
const _hoisted_2$
|
|
3069
|
-
const _sfc_main$
|
|
3147
|
+
const _hoisted_2$n = { class: "m-editor-data-source-fields-footer" };
|
|
3148
|
+
const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
3070
3149
|
...{
|
|
3071
3150
|
name: "MEditorDataSourceFields"
|
|
3072
3151
|
},
|
|
@@ -3088,11 +3167,11 @@
|
|
|
3088
3167
|
const services = vue.inject("services");
|
|
3089
3168
|
const addDialog = vue.ref();
|
|
3090
3169
|
const fieldValues = vue.ref({});
|
|
3091
|
-
const
|
|
3170
|
+
const fieldTitle = vue.ref("");
|
|
3092
3171
|
const width = vue.computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
|
|
3093
3172
|
const newHandler = () => {
|
|
3094
3173
|
fieldValues.value = {};
|
|
3095
|
-
|
|
3174
|
+
fieldTitle.value = "新增属性";
|
|
3096
3175
|
addDialog.value?.show();
|
|
3097
3176
|
};
|
|
3098
3177
|
const fieldChange = ({ index, ...value }) => {
|
|
@@ -3132,7 +3211,7 @@
|
|
|
3132
3211
|
...row,
|
|
3133
3212
|
index
|
|
3134
3213
|
};
|
|
3135
|
-
|
|
3214
|
+
fieldTitle.value = `编辑${row.title}`;
|
|
3136
3215
|
addDialog.value?.show();
|
|
3137
3216
|
}
|
|
3138
3217
|
},
|
|
@@ -3202,12 +3281,16 @@
|
|
|
3202
3281
|
{
|
|
3203
3282
|
name: "defaultValue",
|
|
3204
3283
|
text: "默认值",
|
|
3284
|
+
height: "200px",
|
|
3285
|
+
parse: true,
|
|
3205
3286
|
type: (mForm, { model }) => {
|
|
3206
3287
|
if (model.type === "number")
|
|
3207
3288
|
return "number";
|
|
3208
3289
|
if (model.type === "boolean")
|
|
3209
3290
|
return "select";
|
|
3210
|
-
|
|
3291
|
+
if (model.type === "string")
|
|
3292
|
+
return "text";
|
|
3293
|
+
return "vs-code";
|
|
3211
3294
|
},
|
|
3212
3295
|
options: [
|
|
3213
3296
|
{ text: "true", value: true },
|
|
@@ -3224,22 +3307,98 @@
|
|
|
3224
3307
|
name: "fields",
|
|
3225
3308
|
type: "data-source-fields",
|
|
3226
3309
|
defaultValue: [],
|
|
3227
|
-
display: (formState, { model }) => model.type === "object"
|
|
3310
|
+
display: (formState, { model }) => model.type === "object" || model.type === "array"
|
|
3311
|
+
}
|
|
3312
|
+
];
|
|
3313
|
+
const addFromJsonDialog = vue.ref();
|
|
3314
|
+
const jsonFromConfig = [
|
|
3315
|
+
{
|
|
3316
|
+
name: "data",
|
|
3317
|
+
type: "vs-code",
|
|
3318
|
+
labelWidth: "0",
|
|
3319
|
+
language: "json",
|
|
3320
|
+
height: "600px",
|
|
3321
|
+
options: vue.inject("codeOptions", {})
|
|
3228
3322
|
}
|
|
3229
3323
|
];
|
|
3324
|
+
const jsonFromValues = vue.ref({
|
|
3325
|
+
data: {}
|
|
3326
|
+
});
|
|
3327
|
+
const newFromJsonHandler = () => {
|
|
3328
|
+
addFromJsonDialog.value?.show();
|
|
3329
|
+
};
|
|
3330
|
+
const getValueType = (value) => {
|
|
3331
|
+
if (Array.isArray(value))
|
|
3332
|
+
return "array";
|
|
3333
|
+
if (value === null)
|
|
3334
|
+
return "null";
|
|
3335
|
+
if (typeof value === "object")
|
|
3336
|
+
return "object";
|
|
3337
|
+
if (typeof value === "number")
|
|
3338
|
+
return "number";
|
|
3339
|
+
if (typeof value === "boolean")
|
|
3340
|
+
return "boolean";
|
|
3341
|
+
if (typeof value === "string")
|
|
3342
|
+
return "string";
|
|
3343
|
+
return "any";
|
|
3344
|
+
};
|
|
3345
|
+
const getFieldsConfig = (value) => {
|
|
3346
|
+
if (!value || typeof value !== "object")
|
|
3347
|
+
throw new Error("数据格式错误");
|
|
3348
|
+
const fields = [];
|
|
3349
|
+
Object.entries(value).forEach(([key, value2]) => {
|
|
3350
|
+
const type = getValueType(value2);
|
|
3351
|
+
let childFields = [];
|
|
3352
|
+
if (Array.isArray(value2) && value2.length > 0) {
|
|
3353
|
+
childFields = getFieldsConfig(value2[0]);
|
|
3354
|
+
} else if (type === "object") {
|
|
3355
|
+
childFields = getFieldsConfig(value2);
|
|
3356
|
+
}
|
|
3357
|
+
fields.push({
|
|
3358
|
+
name: key,
|
|
3359
|
+
title: key,
|
|
3360
|
+
type,
|
|
3361
|
+
defaultValue: value2,
|
|
3362
|
+
fields: childFields
|
|
3363
|
+
});
|
|
3364
|
+
});
|
|
3365
|
+
return fields;
|
|
3366
|
+
};
|
|
3367
|
+
const addFromJsonFromChange = ({ data }) => {
|
|
3368
|
+
console.log(data);
|
|
3369
|
+
try {
|
|
3370
|
+
const value = JSON.parse(data);
|
|
3371
|
+
props.model[props.name] = getFieldsConfig(value);
|
|
3372
|
+
addFromJsonDialog.value?.hide();
|
|
3373
|
+
emit("change", props.model[props.name]);
|
|
3374
|
+
} catch (e) {
|
|
3375
|
+
design.tMagicMessage.error(e.message);
|
|
3376
|
+
}
|
|
3377
|
+
};
|
|
3230
3378
|
return (_ctx, _cache) => {
|
|
3231
3379
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$s, [
|
|
3232
3380
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
3233
3381
|
data: _ctx.model[_ctx.name],
|
|
3234
3382
|
columns: fieldColumns
|
|
3235
3383
|
}, null, 8, ["data"]),
|
|
3236
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
3384
|
+
vue.createElementVNode("div", _hoisted_2$n, [
|
|
3385
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3386
|
+
size: "small",
|
|
3387
|
+
disabled: _ctx.disabled,
|
|
3388
|
+
plain: "",
|
|
3389
|
+
onClick: _cache[0] || (_cache[0] = ($event) => newFromJsonHandler())
|
|
3390
|
+
}, {
|
|
3391
|
+
default: vue.withCtx(() => [
|
|
3392
|
+
vue.createTextVNode("快速添加")
|
|
3393
|
+
]),
|
|
3394
|
+
_: 1
|
|
3395
|
+
}, 8, ["disabled"]),
|
|
3237
3396
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3238
3397
|
size: "small",
|
|
3239
3398
|
type: "primary",
|
|
3240
3399
|
disabled: _ctx.disabled,
|
|
3241
3400
|
plain: "",
|
|
3242
|
-
onClick: _cache[
|
|
3401
|
+
onClick: _cache[1] || (_cache[1] = ($event) => newHandler())
|
|
3243
3402
|
}, {
|
|
3244
3403
|
default: vue.withCtx(() => [
|
|
3245
3404
|
vue.createTextVNode("添加")
|
|
@@ -3251,20 +3410,30 @@
|
|
|
3251
3410
|
ref_key: "addDialog",
|
|
3252
3411
|
ref: addDialog,
|
|
3253
3412
|
"label-width": "80px",
|
|
3254
|
-
title:
|
|
3413
|
+
title: fieldTitle.value,
|
|
3255
3414
|
config: dataSourceFieldsConfig,
|
|
3256
3415
|
values: fieldValues.value,
|
|
3257
3416
|
parentValues: _ctx.model[_ctx.name],
|
|
3258
3417
|
disabled: _ctx.disabled,
|
|
3259
3418
|
width: width.value,
|
|
3260
3419
|
onSubmit: fieldChange
|
|
3261
|
-
}, null, 8, ["title", "values", "parentValues", "disabled", "width"])
|
|
3420
|
+
}, null, 8, ["title", "values", "parentValues", "disabled", "width"]),
|
|
3421
|
+
vue.createVNode(vue.unref(form.MFormDrawer), {
|
|
3422
|
+
ref_key: "addFromJsonDialog",
|
|
3423
|
+
ref: addFromJsonDialog,
|
|
3424
|
+
title: "快速添加数据定义",
|
|
3425
|
+
config: jsonFromConfig,
|
|
3426
|
+
values: jsonFromValues.value,
|
|
3427
|
+
disabled: _ctx.disabled,
|
|
3428
|
+
width: width.value,
|
|
3429
|
+
onSubmit: addFromJsonFromChange
|
|
3430
|
+
}, null, 8, ["values", "disabled", "width"])
|
|
3262
3431
|
]);
|
|
3263
3432
|
};
|
|
3264
3433
|
}
|
|
3265
3434
|
});
|
|
3266
3435
|
|
|
3267
|
-
const _sfc_main$
|
|
3436
|
+
const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
|
|
3268
3437
|
__name: "DataSourceFieldSelect",
|
|
3269
3438
|
props: {
|
|
3270
3439
|
config: {},
|
|
@@ -3282,18 +3451,25 @@
|
|
|
3282
3451
|
const props = __props;
|
|
3283
3452
|
const services = vue.inject("services");
|
|
3284
3453
|
const dataSources = vue.computed(() => services?.dataSourceService.get("dataSources"));
|
|
3285
|
-
const
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3454
|
+
const getOptionChildren = (fields = []) => fields.map((field) => ({
|
|
3455
|
+
label: field.title || field.name,
|
|
3456
|
+
value: field.name,
|
|
3457
|
+
children: field.type === "array" ? [] : getOptionChildren(field.fields)
|
|
3458
|
+
}));
|
|
3459
|
+
const cascaderConfig = vue.computed(() => {
|
|
3460
|
+
const valueIsKey = props.config.value === "key";
|
|
3461
|
+
return {
|
|
3462
|
+
type: "cascader",
|
|
3463
|
+
name: props.name,
|
|
3464
|
+
checkStrictly: !valueIsKey,
|
|
3465
|
+
text: "",
|
|
3466
|
+
options: () => dataSources.value?.filter((ds) => ds.fields?.length)?.map((ds) => ({
|
|
3467
|
+
label: ds.title || ds.id,
|
|
3468
|
+
value: valueIsKey ? ds.id : `${utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX}${ds.id}`,
|
|
3469
|
+
children: getOptionChildren(ds.fields)
|
|
3470
|
+
})) || []
|
|
3471
|
+
};
|
|
3472
|
+
});
|
|
3297
3473
|
const onChangeHandler = (value) => {
|
|
3298
3474
|
emit("change", value);
|
|
3299
3475
|
};
|
|
@@ -3302,7 +3478,7 @@
|
|
|
3302
3478
|
return vue.openBlock(), vue.createBlock(_component_m_form_container, {
|
|
3303
3479
|
config: {
|
|
3304
3480
|
..._ctx.config,
|
|
3305
|
-
...cascaderConfig
|
|
3481
|
+
...cascaderConfig.value
|
|
3306
3482
|
},
|
|
3307
3483
|
model: _ctx.model,
|
|
3308
3484
|
onChange: onChangeHandler
|
|
@@ -3312,9 +3488,9 @@
|
|
|
3312
3488
|
});
|
|
3313
3489
|
|
|
3314
3490
|
const _hoisted_1$r = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
3315
|
-
const _hoisted_2$
|
|
3316
|
-
const _hoisted_3$
|
|
3317
|
-
const _sfc_main$
|
|
3491
|
+
const _hoisted_2$m = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
3492
|
+
const _hoisted_3$a = { class: "el-input__inner" };
|
|
3493
|
+
const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
|
|
3318
3494
|
...{
|
|
3319
3495
|
name: "MEditorDataSourceInput"
|
|
3320
3496
|
},
|
|
@@ -3503,12 +3679,12 @@
|
|
|
3503
3679
|
}
|
|
3504
3680
|
), {
|
|
3505
3681
|
suffix: vue.withCtx(() => [
|
|
3506
|
-
vue.createVNode(_sfc_main$
|
|
3682
|
+
vue.createVNode(_sfc_main$M, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
3507
3683
|
]),
|
|
3508
3684
|
default: vue.withCtx(({ item }) => [
|
|
3509
3685
|
vue.createElementVNode("div", _hoisted_1$r, [
|
|
3510
3686
|
vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
|
|
3511
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
3687
|
+
vue.createElementVNode("span", _hoisted_2$m, vue.toDisplayString(item.value), 1)
|
|
3512
3688
|
])
|
|
3513
3689
|
]),
|
|
3514
3690
|
_: 1
|
|
@@ -3520,7 +3696,7 @@
|
|
|
3520
3696
|
vue.createElementVNode("div", {
|
|
3521
3697
|
class: vue.normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
3522
3698
|
}, [
|
|
3523
|
-
vue.createElementVNode("div", _hoisted_3$
|
|
3699
|
+
vue.createElementVNode("div", _hoisted_3$a, [
|
|
3524
3700
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayState.value, (item, index) => {
|
|
3525
3701
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
3526
3702
|
item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
@@ -3538,7 +3714,7 @@
|
|
|
3538
3714
|
}, 1032, ["size"])) : vue.createCommentVNode("", true)
|
|
3539
3715
|
], 64);
|
|
3540
3716
|
}), 256)),
|
|
3541
|
-
vue.createVNode(_sfc_main$
|
|
3717
|
+
vue.createVNode(_sfc_main$M, {
|
|
3542
3718
|
class: "tmagic-data-source-input-icon",
|
|
3543
3719
|
icon: vue.unref(iconsVue.Coin)
|
|
3544
3720
|
}, null, 8, ["icon"])
|
|
@@ -3622,8 +3798,8 @@
|
|
|
3622
3798
|
};
|
|
3623
3799
|
|
|
3624
3800
|
const _hoisted_1$q = { class: "m-editor-data-source-methods" };
|
|
3625
|
-
const _hoisted_2$
|
|
3626
|
-
const _sfc_main$
|
|
3801
|
+
const _hoisted_2$l = { class: "m-editor-data-source-methods-footer" };
|
|
3802
|
+
const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
3627
3803
|
...{
|
|
3628
3804
|
name: "MEditorDataSourceMethods"
|
|
3629
3805
|
},
|
|
@@ -3697,7 +3873,7 @@
|
|
|
3697
3873
|
data: _ctx.model[_ctx.name],
|
|
3698
3874
|
columns: methodColumns
|
|
3699
3875
|
}, null, 8, ["data"]),
|
|
3700
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
3876
|
+
vue.createElementVNode("div", _hoisted_2$l, [
|
|
3701
3877
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3702
3878
|
size: "small",
|
|
3703
3879
|
type: "primary",
|
|
@@ -3711,7 +3887,7 @@
|
|
|
3711
3887
|
_: 1
|
|
3712
3888
|
}, 8, ["disabled"])
|
|
3713
3889
|
]),
|
|
3714
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3890
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
3715
3891
|
key: 0,
|
|
3716
3892
|
ref_key: "codeBlockEditor",
|
|
3717
3893
|
ref: codeBlockEditor,
|
|
@@ -3727,8 +3903,8 @@
|
|
|
3727
3903
|
});
|
|
3728
3904
|
|
|
3729
3905
|
const _hoisted_1$p = { class: "m-fields-data-source-method-select" };
|
|
3730
|
-
const _hoisted_2$
|
|
3731
|
-
const _sfc_main$
|
|
3906
|
+
const _hoisted_2$k = { class: "data-source-method-select-container" };
|
|
3907
|
+
const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
3732
3908
|
...{
|
|
3733
3909
|
name: "MEditorDataSourceMethodSelect"
|
|
3734
3910
|
},
|
|
@@ -3748,7 +3924,8 @@
|
|
|
3748
3924
|
setup(__props, { emit }) {
|
|
3749
3925
|
const props = __props;
|
|
3750
3926
|
const services = vue.inject("services");
|
|
3751
|
-
const
|
|
3927
|
+
const dataSourceService = services?.dataSourceService;
|
|
3928
|
+
const dataSources = vue.computed(() => dataSourceService?.get("dataSources"));
|
|
3752
3929
|
const getParamItemsConfig = ([dataSourceId, medthodName] = ["", ""]) => {
|
|
3753
3930
|
if (!dataSourceId)
|
|
3754
3931
|
return [];
|
|
@@ -3770,24 +3947,30 @@
|
|
|
3770
3947
|
props.model.params = {};
|
|
3771
3948
|
}
|
|
3772
3949
|
};
|
|
3773
|
-
const
|
|
3950
|
+
const methodsOptions = vue.computed(
|
|
3951
|
+
() => dataSources.value?.filter((ds) => ds.methods?.length || dataSourceService?.getFormMethod(ds.type).length)?.map((ds) => ({
|
|
3952
|
+
label: ds.title || ds.id,
|
|
3953
|
+
value: ds.id,
|
|
3954
|
+
children: [
|
|
3955
|
+
...dataSourceService?.getFormMethod(ds.type) || [],
|
|
3956
|
+
...(ds.methods || []).map((method) => ({
|
|
3957
|
+
label: method.name,
|
|
3958
|
+
value: method.name
|
|
3959
|
+
}))
|
|
3960
|
+
]
|
|
3961
|
+
})) || []
|
|
3962
|
+
);
|
|
3963
|
+
const cascaderConfig = vue.computed(() => ({
|
|
3774
3964
|
type: "cascader",
|
|
3775
3965
|
text: "数据源方法",
|
|
3776
3966
|
name: props.name,
|
|
3777
3967
|
labelWidth: "80px",
|
|
3778
|
-
options:
|
|
3779
|
-
label: ds.title || ds.id,
|
|
3780
|
-
value: ds.id,
|
|
3781
|
-
children: ds.methods?.map((method) => ({
|
|
3782
|
-
label: method.name,
|
|
3783
|
-
value: method.name
|
|
3784
|
-
}))
|
|
3785
|
-
})) || [],
|
|
3968
|
+
options: methodsOptions.value,
|
|
3786
3969
|
onChange: (formState, dataSourceMethod) => {
|
|
3787
3970
|
setParamsConfig(dataSourceMethod, formState);
|
|
3788
3971
|
return dataSourceMethod;
|
|
3789
3972
|
}
|
|
3790
|
-
};
|
|
3973
|
+
}));
|
|
3791
3974
|
const onChangeHandler = (value) => {
|
|
3792
3975
|
props.model.params = value.params;
|
|
3793
3976
|
emit("change", props.model);
|
|
@@ -3795,7 +3978,7 @@
|
|
|
3795
3978
|
const { codeBlockEditor, codeConfig, editCode, submitCode } = useDataSourceMethod();
|
|
3796
3979
|
const editCodeHandler = () => {
|
|
3797
3980
|
const [id, name] = props.model[props.name];
|
|
3798
|
-
const dataSource =
|
|
3981
|
+
const dataSource = dataSourceService?.getDataSourceById(id);
|
|
3799
3982
|
if (!dataSource)
|
|
3800
3983
|
return;
|
|
3801
3984
|
editCode(dataSource, name);
|
|
@@ -3807,21 +3990,21 @@
|
|
|
3807
3990
|
return (_ctx, _cache) => {
|
|
3808
3991
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
3809
3992
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
|
|
3810
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
3993
|
+
vue.createElementVNode("div", _hoisted_2$k, [
|
|
3811
3994
|
vue.createVNode(_component_m_form_container, {
|
|
3812
3995
|
class: "select",
|
|
3813
|
-
config: cascaderConfig,
|
|
3996
|
+
config: cascaderConfig.value,
|
|
3814
3997
|
model: _ctx.model,
|
|
3815
3998
|
onChange: onChangeHandler
|
|
3816
|
-
}, null, 8, ["model"]),
|
|
3817
|
-
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3999
|
+
}, null, 8, ["config", "model"]),
|
|
4000
|
+
_ctx.model[_ctx.name] ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
3818
4001
|
key: 0,
|
|
3819
4002
|
class: "icon",
|
|
3820
4003
|
icon: !_ctx.disabled ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
3821
4004
|
onClick: editCodeHandler
|
|
3822
4005
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true)
|
|
3823
4006
|
]),
|
|
3824
|
-
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4007
|
+
paramsConfig.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$N, {
|
|
3825
4008
|
key: 0,
|
|
3826
4009
|
name: "params",
|
|
3827
4010
|
model: _ctx.model,
|
|
@@ -3830,7 +4013,7 @@
|
|
|
3830
4013
|
"params-config": paramsConfig.value,
|
|
3831
4014
|
onChange: onChangeHandler
|
|
3832
4015
|
}, null, 8, ["model", "size", "disabled", "params-config"])) : vue.createCommentVNode("", true),
|
|
3833
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
4016
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
3834
4017
|
key: 1,
|
|
3835
4018
|
ref_key: "codeBlockEditor",
|
|
3836
4019
|
ref: codeBlockEditor,
|
|
@@ -3843,11 +4026,13 @@
|
|
|
3843
4026
|
}
|
|
3844
4027
|
});
|
|
3845
4028
|
|
|
3846
|
-
const
|
|
4029
|
+
const _hoisted_1$o = { class: "m-editor-data-source-fields" };
|
|
4030
|
+
const _hoisted_2$j = { class: "m-editor-data-source-fields-footer" };
|
|
4031
|
+
const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
|
|
3847
4032
|
...{
|
|
3848
|
-
name: "
|
|
4033
|
+
name: "MEditorDataSourceMocks"
|
|
3849
4034
|
},
|
|
3850
|
-
__name: "
|
|
4035
|
+
__name: "DataSourceMocks",
|
|
3851
4036
|
props: {
|
|
3852
4037
|
config: {},
|
|
3853
4038
|
model: {},
|
|
@@ -3860,132 +4045,367 @@
|
|
|
3860
4045
|
lastValues: {}
|
|
3861
4046
|
},
|
|
3862
4047
|
emits: ["change"],
|
|
3863
|
-
setup(__props, { emit }) {
|
|
3864
|
-
const props = __props;
|
|
3865
|
-
const { dataSourceService } = vue.inject("services") || {};
|
|
3866
|
-
const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
|
|
3867
|
-
const selectConfig = vue.computed(() => {
|
|
3868
|
-
const { type, dataSourceType, ...config } = props.config;
|
|
3869
|
-
return {
|
|
3870
|
-
...config,
|
|
3871
|
-
type: "select",
|
|
3872
|
-
valueKey: "dataSourceId",
|
|
3873
|
-
options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
|
|
3874
|
-
value: {
|
|
3875
|
-
isBindDataSource: true,
|
|
3876
|
-
dataSourceType: ds.type,
|
|
3877
|
-
dataSourceId: ds.id
|
|
3878
|
-
},
|
|
3879
|
-
text: ds.title || ds.id
|
|
3880
|
-
}))
|
|
3881
|
-
};
|
|
3882
|
-
});
|
|
3883
|
-
const changeHandler = (value) => {
|
|
3884
|
-
emit("change", value);
|
|
3885
|
-
};
|
|
3886
|
-
return (_ctx, _cache) => {
|
|
3887
|
-
return vue.openBlock(), vue.createBlock(vue.unref(form.MSelect), {
|
|
3888
|
-
model: _ctx.model,
|
|
3889
|
-
name: _ctx.name,
|
|
3890
|
-
size: _ctx.size,
|
|
3891
|
-
prop: _ctx.prop,
|
|
3892
|
-
disabled: _ctx.disabled,
|
|
3893
|
-
config: selectConfig.value,
|
|
3894
|
-
"last-values": _ctx.lastValues,
|
|
3895
|
-
onChange: changeHandler
|
|
3896
|
-
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]);
|
|
3897
|
-
};
|
|
3898
|
-
}
|
|
3899
|
-
});
|
|
3900
|
-
|
|
3901
|
-
const _hoisted_1$o = { class: "m-fields-event-select" };
|
|
3902
|
-
const _hoisted_2$h = {
|
|
3903
|
-
key: 1,
|
|
3904
|
-
class: "fullWidth"
|
|
3905
|
-
};
|
|
3906
|
-
const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
3907
|
-
...{
|
|
3908
|
-
name: "MEditorEventSelect"
|
|
3909
|
-
},
|
|
3910
|
-
__name: "EventSelect",
|
|
3911
|
-
props: {
|
|
3912
|
-
config: {},
|
|
3913
|
-
model: {},
|
|
3914
|
-
initValues: {},
|
|
3915
|
-
values: {},
|
|
3916
|
-
name: {},
|
|
3917
|
-
prop: {},
|
|
3918
|
-
disabled: { type: Boolean },
|
|
3919
|
-
size: {},
|
|
3920
|
-
lastValues: {}
|
|
3921
|
-
},
|
|
3922
|
-
emits: ["change"],
|
|
3923
4048
|
setup(__props, { emit }) {
|
|
3924
4049
|
const props = __props;
|
|
3925
4050
|
const services = vue.inject("services");
|
|
3926
|
-
const
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
if (props.config.src === "component") {
|
|
3937
|
-
events = services.eventsService.getEvent(formValue.type);
|
|
3938
|
-
} else if (props.config.src === "datasource") {
|
|
3939
|
-
events = services.dataSourceService.getFormEvent(formValue.type);
|
|
3940
|
-
}
|
|
3941
|
-
return events.map((option) => ({
|
|
3942
|
-
text: option.label,
|
|
3943
|
-
value: option.value
|
|
3944
|
-
}));
|
|
3945
|
-
}
|
|
3946
|
-
};
|
|
3947
|
-
return { ...defaultEventNameConfig, ...props.config.eventNameConfig };
|
|
3948
|
-
});
|
|
3949
|
-
const actionTypeConfig = vue.computed(() => {
|
|
3950
|
-
const defaultActionTypeConfig = {
|
|
3951
|
-
name: "actionType",
|
|
3952
|
-
text: "联动类型",
|
|
3953
|
-
labelWidth: "80px",
|
|
3954
|
-
type: "select",
|
|
3955
|
-
defaultValue: schema.ActionType.COMP,
|
|
3956
|
-
options: () => [
|
|
3957
|
-
{
|
|
3958
|
-
text: "组件",
|
|
3959
|
-
label: "组件",
|
|
3960
|
-
value: schema.ActionType.COMP
|
|
3961
|
-
},
|
|
4051
|
+
const width = vue.computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
|
|
4052
|
+
const addDialog = vue.ref();
|
|
4053
|
+
const drawerTitle = vue.ref("");
|
|
4054
|
+
const formValues = vue.ref({});
|
|
4055
|
+
const formConfig = [
|
|
4056
|
+
{ name: "index", type: "hidden", filter: "number", defaultValue: -1 },
|
|
4057
|
+
{
|
|
4058
|
+
name: "title",
|
|
4059
|
+
text: "名称",
|
|
4060
|
+
rules: [
|
|
3962
4061
|
{
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
disabled: !Object.keys(services?.codeBlockService.getCodeDsl() || {}).length,
|
|
3966
|
-
value: schema.ActionType.CODE
|
|
4062
|
+
required: true,
|
|
4063
|
+
message: "请输入字段名称"
|
|
3967
4064
|
},
|
|
3968
4065
|
{
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
disabled: !services?.dataSourceService.get("dataSources")?.filter((ds) => ds.methods?.length).length,
|
|
3972
|
-
value: schema.ActionType.DATA_SOURCE
|
|
4066
|
+
required: true,
|
|
4067
|
+
message: "请输入名称"
|
|
3973
4068
|
}
|
|
3974
4069
|
]
|
|
3975
|
-
}
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
type: "
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
4070
|
+
},
|
|
4071
|
+
{
|
|
4072
|
+
name: "description",
|
|
4073
|
+
text: "描述"
|
|
4074
|
+
},
|
|
4075
|
+
{
|
|
4076
|
+
name: "enable",
|
|
4077
|
+
text: "启用",
|
|
4078
|
+
type: "switch"
|
|
4079
|
+
},
|
|
4080
|
+
{
|
|
4081
|
+
name: "useInEditor",
|
|
4082
|
+
text: "编辑器中使用",
|
|
4083
|
+
type: "switch"
|
|
4084
|
+
},
|
|
4085
|
+
{
|
|
4086
|
+
name: "data",
|
|
4087
|
+
text: "mock数据",
|
|
4088
|
+
type: "vs-code",
|
|
4089
|
+
language: "json",
|
|
4090
|
+
options: vue.inject("codeOptions", {}),
|
|
4091
|
+
defaultValue: "{}",
|
|
4092
|
+
height: "400px",
|
|
4093
|
+
onChange: (formState, v) => {
|
|
4094
|
+
if (typeof v !== "string")
|
|
4095
|
+
return v;
|
|
4096
|
+
return JSON.parse(v);
|
|
4097
|
+
},
|
|
4098
|
+
rules: [
|
|
4099
|
+
{
|
|
4100
|
+
validator: ({ value, callback }) => {
|
|
4101
|
+
if (typeof value !== "string")
|
|
4102
|
+
return callback();
|
|
4103
|
+
try {
|
|
4104
|
+
JSON.parse(value);
|
|
4105
|
+
callback();
|
|
4106
|
+
} catch (error) {
|
|
4107
|
+
callback(error);
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
]
|
|
4112
|
+
}
|
|
4113
|
+
];
|
|
4114
|
+
const columns = [
|
|
4115
|
+
{
|
|
4116
|
+
type: "expand",
|
|
4117
|
+
component: _sfc_main$S,
|
|
4118
|
+
props: (row) => ({
|
|
4119
|
+
initValues: row.data,
|
|
4120
|
+
language: "json",
|
|
4121
|
+
height: "150px",
|
|
4122
|
+
options: {
|
|
4123
|
+
readOnly: true
|
|
4124
|
+
}
|
|
4125
|
+
})
|
|
4126
|
+
},
|
|
4127
|
+
{
|
|
4128
|
+
label: "名称",
|
|
4129
|
+
prop: "title"
|
|
4130
|
+
},
|
|
4131
|
+
{
|
|
4132
|
+
label: "描述",
|
|
4133
|
+
prop: "description"
|
|
4134
|
+
},
|
|
4135
|
+
{
|
|
4136
|
+
label: "是否启用",
|
|
4137
|
+
prop: "enable",
|
|
4138
|
+
type: "component",
|
|
4139
|
+
component: design.TMagicSwitch,
|
|
4140
|
+
props: (row) => ({
|
|
4141
|
+
modelValue: row.enable,
|
|
4142
|
+
activeValue: true,
|
|
4143
|
+
inactiveValue: false
|
|
4144
|
+
}),
|
|
4145
|
+
listeners: (row, index) => ({
|
|
4146
|
+
"update:modelValue": (v) => {
|
|
4147
|
+
toggleValue(row, "enable", v, index);
|
|
4148
|
+
}
|
|
4149
|
+
})
|
|
4150
|
+
},
|
|
4151
|
+
{
|
|
4152
|
+
label: "编辑器中使用",
|
|
4153
|
+
prop: "useInEditor",
|
|
4154
|
+
type: "component",
|
|
4155
|
+
component: design.TMagicSwitch,
|
|
4156
|
+
props: (row) => ({
|
|
4157
|
+
modelValue: row.useInEditor,
|
|
4158
|
+
activeValue: true,
|
|
4159
|
+
inactiveValue: false
|
|
4160
|
+
}),
|
|
4161
|
+
listeners: (row, index) => ({
|
|
4162
|
+
"update:modelValue": (v) => {
|
|
4163
|
+
toggleValue(row, "useInEditor", v, index);
|
|
4164
|
+
}
|
|
4165
|
+
})
|
|
4166
|
+
},
|
|
4167
|
+
{
|
|
4168
|
+
label: "操作",
|
|
4169
|
+
fixed: "right",
|
|
4170
|
+
actions: [
|
|
4171
|
+
{
|
|
4172
|
+
text: "编辑",
|
|
4173
|
+
handler: (row, index) => {
|
|
4174
|
+
formValues.value = {
|
|
4175
|
+
...row,
|
|
4176
|
+
index
|
|
4177
|
+
};
|
|
4178
|
+
drawerTitle.value = `编辑${row.title}`;
|
|
4179
|
+
addDialog.value?.show();
|
|
4180
|
+
}
|
|
4181
|
+
},
|
|
4182
|
+
{
|
|
4183
|
+
text: "删除",
|
|
4184
|
+
buttonType: "danger",
|
|
4185
|
+
handler: async (row, index) => {
|
|
4186
|
+
await design.tMagicMessageBox.confirm(`确定删除${row.title}?`, "提示");
|
|
4187
|
+
props.model[props.name].splice(index, 1);
|
|
4188
|
+
emit("change", props.model[props.name]);
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
]
|
|
4192
|
+
}
|
|
4193
|
+
];
|
|
4194
|
+
const newHandler = () => {
|
|
4195
|
+
const isFirstRow = props.model[props.name].length === 0;
|
|
4196
|
+
formValues.value = {
|
|
4197
|
+
data: utils.getDefaultValueFromFields(props.model.fields || []),
|
|
4198
|
+
useInEditor: isFirstRow,
|
|
4199
|
+
enable: isFirstRow
|
|
4200
|
+
};
|
|
4201
|
+
drawerTitle.value = "新增Mock";
|
|
4202
|
+
addDialog.value?.show();
|
|
4203
|
+
};
|
|
4204
|
+
const formChangeHandler = ({ index, ...value }) => {
|
|
4205
|
+
if (index > -1) {
|
|
4206
|
+
props.model[props.name][index] = value;
|
|
4207
|
+
} else {
|
|
4208
|
+
props.model[props.name].push(value);
|
|
4209
|
+
}
|
|
4210
|
+
addDialog.value?.hide();
|
|
4211
|
+
emit("change", props.model[props.name]);
|
|
4212
|
+
};
|
|
4213
|
+
const toggleValue = (row, key, value, index) => {
|
|
4214
|
+
if (value) {
|
|
4215
|
+
props.model[props.name].forEach((item) => {
|
|
4216
|
+
item[key] = false;
|
|
4217
|
+
});
|
|
4218
|
+
}
|
|
4219
|
+
formChangeHandler({
|
|
4220
|
+
...row,
|
|
4221
|
+
[key]: value,
|
|
4222
|
+
index
|
|
4223
|
+
});
|
|
4224
|
+
};
|
|
4225
|
+
return (_ctx, _cache) => {
|
|
4226
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
|
|
4227
|
+
vue.createVNode(vue.unref(table.MagicTable), {
|
|
4228
|
+
data: _ctx.model[_ctx.name],
|
|
4229
|
+
columns
|
|
4230
|
+
}, null, 8, ["data"]),
|
|
4231
|
+
vue.createElementVNode("div", _hoisted_2$j, [
|
|
4232
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4233
|
+
size: "small",
|
|
4234
|
+
type: "primary",
|
|
4235
|
+
disabled: _ctx.disabled,
|
|
4236
|
+
plain: "",
|
|
4237
|
+
onClick: _cache[0] || (_cache[0] = ($event) => newHandler())
|
|
4238
|
+
}, {
|
|
4239
|
+
default: vue.withCtx(() => [
|
|
4240
|
+
vue.createTextVNode("添加")
|
|
4241
|
+
]),
|
|
4242
|
+
_: 1
|
|
4243
|
+
}, 8, ["disabled"])
|
|
4244
|
+
]),
|
|
4245
|
+
vue.createVNode(vue.unref(form.MFormDrawer), {
|
|
4246
|
+
ref_key: "addDialog",
|
|
4247
|
+
ref: addDialog,
|
|
4248
|
+
"label-width": "120px",
|
|
4249
|
+
title: drawerTitle.value,
|
|
4250
|
+
config: formConfig,
|
|
4251
|
+
values: formValues.value,
|
|
4252
|
+
parentValues: _ctx.model[_ctx.name],
|
|
4253
|
+
disabled: _ctx.disabled,
|
|
4254
|
+
width: width.value,
|
|
4255
|
+
onSubmit: formChangeHandler
|
|
4256
|
+
}, null, 8, ["title", "values", "parentValues", "disabled", "width"])
|
|
4257
|
+
]);
|
|
4258
|
+
};
|
|
4259
|
+
}
|
|
4260
|
+
});
|
|
4261
|
+
|
|
4262
|
+
const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
|
|
4263
|
+
...{
|
|
4264
|
+
name: "MEditorDataSourceSelect"
|
|
4265
|
+
},
|
|
4266
|
+
__name: "DataSourceSelect",
|
|
4267
|
+
props: {
|
|
4268
|
+
config: {},
|
|
4269
|
+
model: {},
|
|
4270
|
+
initValues: {},
|
|
4271
|
+
values: {},
|
|
4272
|
+
name: {},
|
|
4273
|
+
prop: {},
|
|
4274
|
+
disabled: { type: Boolean, default: false },
|
|
4275
|
+
size: {},
|
|
4276
|
+
lastValues: {}
|
|
4277
|
+
},
|
|
4278
|
+
emits: ["change"],
|
|
4279
|
+
setup(__props, { emit }) {
|
|
4280
|
+
const props = __props;
|
|
4281
|
+
const { dataSourceService } = vue.inject("services") || {};
|
|
4282
|
+
const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
|
|
4283
|
+
const selectConfig = vue.computed(() => {
|
|
4284
|
+
const { type, dataSourceType, ...config } = props.config;
|
|
4285
|
+
return {
|
|
4286
|
+
...config,
|
|
4287
|
+
type: "select",
|
|
4288
|
+
valueKey: "dataSourceId",
|
|
4289
|
+
options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
|
|
4290
|
+
value: {
|
|
4291
|
+
isBindDataSource: true,
|
|
4292
|
+
dataSourceType: ds.type,
|
|
4293
|
+
dataSourceId: ds.id
|
|
4294
|
+
},
|
|
4295
|
+
text: ds.title || ds.id
|
|
4296
|
+
}))
|
|
4297
|
+
};
|
|
4298
|
+
});
|
|
4299
|
+
const changeHandler = (value) => {
|
|
4300
|
+
emit("change", value);
|
|
4301
|
+
};
|
|
4302
|
+
return (_ctx, _cache) => {
|
|
4303
|
+
return vue.openBlock(), vue.createBlock(vue.unref(form.MSelect), {
|
|
4304
|
+
model: _ctx.model,
|
|
4305
|
+
name: _ctx.name,
|
|
4306
|
+
size: _ctx.size,
|
|
4307
|
+
prop: _ctx.prop,
|
|
4308
|
+
disabled: _ctx.disabled,
|
|
4309
|
+
config: selectConfig.value,
|
|
4310
|
+
"last-values": _ctx.lastValues,
|
|
4311
|
+
onChange: changeHandler
|
|
4312
|
+
}, null, 8, ["model", "name", "size", "prop", "disabled", "config", "last-values"]);
|
|
4313
|
+
};
|
|
4314
|
+
}
|
|
4315
|
+
});
|
|
4316
|
+
|
|
4317
|
+
const _hoisted_1$n = { class: "m-fields-event-select" };
|
|
4318
|
+
const _hoisted_2$i = {
|
|
4319
|
+
key: 1,
|
|
4320
|
+
class: "fullWidth"
|
|
4321
|
+
};
|
|
4322
|
+
const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
|
|
4323
|
+
...{
|
|
4324
|
+
name: "MEditorEventSelect"
|
|
4325
|
+
},
|
|
4326
|
+
__name: "EventSelect",
|
|
4327
|
+
props: {
|
|
4328
|
+
config: {},
|
|
4329
|
+
model: {},
|
|
4330
|
+
initValues: {},
|
|
4331
|
+
values: {},
|
|
4332
|
+
name: {},
|
|
4333
|
+
prop: {},
|
|
4334
|
+
disabled: { type: Boolean },
|
|
4335
|
+
size: {},
|
|
4336
|
+
lastValues: {}
|
|
4337
|
+
},
|
|
4338
|
+
emits: ["change"],
|
|
4339
|
+
setup(__props, { emit }) {
|
|
4340
|
+
const props = __props;
|
|
4341
|
+
const services = vue.inject("services");
|
|
4342
|
+
const editorService = services?.editorService;
|
|
4343
|
+
const dataSourceService = services?.dataSourceService;
|
|
4344
|
+
const eventsService = services?.eventsService;
|
|
4345
|
+
const codeBlockService = services?.codeBlockService;
|
|
4346
|
+
const eventNameConfig = vue.computed(() => {
|
|
4347
|
+
const defaultEventNameConfig = {
|
|
4348
|
+
name: "name",
|
|
4349
|
+
text: "事件",
|
|
4350
|
+
type: "select",
|
|
4351
|
+
labelWidth: "40px",
|
|
4352
|
+
options: (mForm, { formValue }) => {
|
|
4353
|
+
let events = [];
|
|
4354
|
+
if (!eventsService || !dataSourceService)
|
|
4355
|
+
return events;
|
|
4356
|
+
if (props.config.src === "component") {
|
|
4357
|
+
events = eventsService.getEvent(formValue.type);
|
|
4358
|
+
} else if (props.config.src === "datasource") {
|
|
4359
|
+
events = dataSourceService.getFormEvent(formValue.type);
|
|
4360
|
+
}
|
|
4361
|
+
return events.map((option) => ({
|
|
4362
|
+
text: option.label,
|
|
4363
|
+
value: option.value
|
|
4364
|
+
}));
|
|
4365
|
+
}
|
|
4366
|
+
};
|
|
4367
|
+
return { ...defaultEventNameConfig, ...props.config.eventNameConfig };
|
|
4368
|
+
});
|
|
4369
|
+
const actionTypeConfig = vue.computed(() => {
|
|
4370
|
+
const defaultActionTypeConfig = {
|
|
4371
|
+
name: "actionType",
|
|
4372
|
+
text: "联动类型",
|
|
4373
|
+
labelWidth: "80px",
|
|
4374
|
+
type: "select",
|
|
4375
|
+
defaultValue: schema.ActionType.COMP,
|
|
4376
|
+
options: () => [
|
|
4377
|
+
{
|
|
4378
|
+
text: "组件",
|
|
4379
|
+
label: "组件",
|
|
4380
|
+
value: schema.ActionType.COMP
|
|
4381
|
+
},
|
|
4382
|
+
{
|
|
4383
|
+
text: "代码",
|
|
4384
|
+
label: "代码",
|
|
4385
|
+
disabled: !Object.keys(codeBlockService?.getCodeDsl() || {}).length,
|
|
4386
|
+
value: schema.ActionType.CODE
|
|
4387
|
+
},
|
|
4388
|
+
{
|
|
4389
|
+
text: "数据源",
|
|
4390
|
+
label: "数据源",
|
|
4391
|
+
disabled: !dataSourceService?.get("dataSources")?.filter((ds) => ds.methods?.length || dataSourceService?.getFormMethod(ds.type).length).length,
|
|
4392
|
+
value: schema.ActionType.DATA_SOURCE
|
|
4393
|
+
}
|
|
4394
|
+
]
|
|
4395
|
+
};
|
|
4396
|
+
return { ...defaultActionTypeConfig, ...props.config.actionTypeConfig };
|
|
4397
|
+
});
|
|
4398
|
+
const targetCompConfig = vue.computed(() => {
|
|
4399
|
+
const defaultTargetCompConfig = {
|
|
4400
|
+
name: "to",
|
|
4401
|
+
text: "联动组件",
|
|
4402
|
+
labelWidth: "80px",
|
|
4403
|
+
type: "ui-select",
|
|
4404
|
+
display: (mForm, { model }) => model.actionType === schema.ActionType.COMP
|
|
4405
|
+
};
|
|
4406
|
+
return { ...defaultTargetCompConfig, ...props.config.targetCompConfig };
|
|
4407
|
+
});
|
|
4408
|
+
const compActionConfig = vue.computed(() => {
|
|
3989
4409
|
const defaultCompActionConfig = {
|
|
3990
4410
|
name: "method",
|
|
3991
4411
|
text: "动作",
|
|
@@ -3993,10 +4413,10 @@
|
|
|
3993
4413
|
type: "select",
|
|
3994
4414
|
display: (mForm, { model }) => model.actionType === schema.ActionType.COMP,
|
|
3995
4415
|
options: (mForm, { model }) => {
|
|
3996
|
-
const node =
|
|
4416
|
+
const node = editorService?.getNodeById(model.to);
|
|
3997
4417
|
if (!node?.type)
|
|
3998
4418
|
return [];
|
|
3999
|
-
return
|
|
4419
|
+
return eventsService?.getMethod(node.type).map((option) => ({
|
|
4000
4420
|
text: option.label,
|
|
4001
4421
|
value: option.value
|
|
4002
4422
|
}));
|
|
@@ -4009,7 +4429,7 @@
|
|
|
4009
4429
|
type: "code-select-col",
|
|
4010
4430
|
labelWidth: 0,
|
|
4011
4431
|
name: "codeId",
|
|
4012
|
-
disabled: () => !
|
|
4432
|
+
disabled: () => !codeBlockService?.getEditStatus(),
|
|
4013
4433
|
display: (mForm, { model }) => model.actionType === schema.ActionType.CODE
|
|
4014
4434
|
};
|
|
4015
4435
|
return { ...defaultCodeActionConfig, ...props.config.codeActionConfig };
|
|
@@ -4031,7 +4451,7 @@
|
|
|
4031
4451
|
name: "name",
|
|
4032
4452
|
label: "事件名",
|
|
4033
4453
|
type: eventNameConfig.value.type,
|
|
4034
|
-
options: (mForm, { formValue }) =>
|
|
4454
|
+
options: (mForm, { formValue }) => eventsService?.getEvent(formValue.type).map((option) => ({
|
|
4035
4455
|
text: option.label,
|
|
4036
4456
|
value: option.value
|
|
4037
4457
|
}))
|
|
@@ -4046,10 +4466,10 @@
|
|
|
4046
4466
|
label: "动作",
|
|
4047
4467
|
type: compActionConfig.value.type,
|
|
4048
4468
|
options: (mForm, { model }) => {
|
|
4049
|
-
const node =
|
|
4469
|
+
const node = editorService?.getNodeById(model.to);
|
|
4050
4470
|
if (!node?.type)
|
|
4051
4471
|
return [];
|
|
4052
|
-
return
|
|
4472
|
+
return eventsService?.getMethod(node.type).map((option) => ({
|
|
4053
4473
|
text: option.label,
|
|
4054
4474
|
value: option.value
|
|
4055
4475
|
}));
|
|
@@ -4103,7 +4523,7 @@
|
|
|
4103
4523
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
4104
4524
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
4105
4525
|
const _component_m_form_panel = vue.resolveComponent("m-form-panel");
|
|
4106
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4526
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
|
|
4107
4527
|
isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
|
|
4108
4528
|
key: 0,
|
|
4109
4529
|
ref: "eventForm",
|
|
@@ -4113,7 +4533,7 @@
|
|
|
4113
4533
|
model: _ctx.model,
|
|
4114
4534
|
config: tableConfig.value,
|
|
4115
4535
|
onChange: onChangeHandler
|
|
4116
|
-
}, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
4536
|
+
}, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$i, [
|
|
4117
4537
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4118
4538
|
class: "create-button",
|
|
4119
4539
|
type: "primary",
|
|
@@ -4162,9 +4582,9 @@
|
|
|
4162
4582
|
}
|
|
4163
4583
|
});
|
|
4164
4584
|
|
|
4165
|
-
const _hoisted_1$
|
|
4166
|
-
const _hoisted_2$
|
|
4167
|
-
const _sfc_main$
|
|
4585
|
+
const _hoisted_1$m = { class: "m-fields-key-value" };
|
|
4586
|
+
const _hoisted_2$h = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
4587
|
+
const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
4168
4588
|
...{
|
|
4169
4589
|
name: "MEditorKeyValue"
|
|
4170
4590
|
},
|
|
@@ -4209,7 +4629,7 @@
|
|
|
4209
4629
|
records.value.splice(index, 1);
|
|
4210
4630
|
};
|
|
4211
4631
|
return (_ctx, _cache) => {
|
|
4212
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4632
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
|
|
4213
4633
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
|
|
4214
4634
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4215
4635
|
class: "m-fields-key-value-item",
|
|
@@ -4223,7 +4643,7 @@
|
|
|
4223
4643
|
size: _ctx.size,
|
|
4224
4644
|
onChange: keyChangeHandler
|
|
4225
4645
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
4226
|
-
_hoisted_2$
|
|
4646
|
+
_hoisted_2$h,
|
|
4227
4647
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
4228
4648
|
placeholder: "value",
|
|
4229
4649
|
modelValue: records.value[index][1],
|
|
@@ -4262,12 +4682,12 @@
|
|
|
4262
4682
|
}
|
|
4263
4683
|
});
|
|
4264
4684
|
|
|
4265
|
-
const _hoisted_1$
|
|
4685
|
+
const _hoisted_1$l = {
|
|
4266
4686
|
key: 1,
|
|
4267
4687
|
class: "m-fields-ui-select",
|
|
4268
4688
|
style: { "display": "flex" }
|
|
4269
4689
|
};
|
|
4270
|
-
const _sfc_main$
|
|
4690
|
+
const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
4271
4691
|
...{
|
|
4272
4692
|
name: "MEditorUISelect"
|
|
4273
4693
|
},
|
|
@@ -4356,7 +4776,7 @@
|
|
|
4356
4776
|
]),
|
|
4357
4777
|
_: 1
|
|
4358
4778
|
}, 8, ["icon", "disabled", "size"])
|
|
4359
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4779
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
4360
4780
|
val.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
4361
4781
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
4362
4782
|
content: "清除",
|
|
@@ -4453,7 +4873,7 @@
|
|
|
4453
4873
|
};
|
|
4454
4874
|
};
|
|
4455
4875
|
|
|
4456
|
-
const _sfc_main$
|
|
4876
|
+
const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
|
|
4457
4877
|
...{
|
|
4458
4878
|
name: "MEditorResizer"
|
|
4459
4879
|
},
|
|
@@ -4474,7 +4894,7 @@
|
|
|
4474
4894
|
}
|
|
4475
4895
|
});
|
|
4476
4896
|
|
|
4477
|
-
const _sfc_main$
|
|
4897
|
+
const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
|
|
4478
4898
|
...{
|
|
4479
4899
|
name: "MEditorLayout"
|
|
4480
4900
|
},
|
|
@@ -4586,7 +5006,7 @@
|
|
|
4586
5006
|
}, [
|
|
4587
5007
|
vue.renderSlot(_ctx.$slots, "left")
|
|
4588
5008
|
], 6),
|
|
4589
|
-
vue.createVNode(_sfc_main$
|
|
5009
|
+
vue.createVNode(_sfc_main$A, { onChange: changeLeft })
|
|
4590
5010
|
], 64)) : vue.createCommentVNode("", true),
|
|
4591
5011
|
vue.createElementVNode("div", {
|
|
4592
5012
|
class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -4595,7 +5015,7 @@
|
|
|
4595
5015
|
vue.renderSlot(_ctx.$slots, "center")
|
|
4596
5016
|
], 6),
|
|
4597
5017
|
hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
4598
|
-
vue.createVNode(_sfc_main$
|
|
5018
|
+
vue.createVNode(_sfc_main$A, { onChange: changeRight }),
|
|
4599
5019
|
vue.createElementVNode("div", {
|
|
4600
5020
|
class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
4601
5021
|
style: vue.normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -4608,10 +5028,10 @@
|
|
|
4608
5028
|
}
|
|
4609
5029
|
});
|
|
4610
5030
|
|
|
4611
|
-
const _hoisted_1$
|
|
4612
|
-
const _hoisted_2$
|
|
4613
|
-
const _hoisted_3$
|
|
4614
|
-
const _sfc_main$
|
|
5031
|
+
const _hoisted_1$k = { class: "m-editor-empty-panel" };
|
|
5032
|
+
const _hoisted_2$g = { class: "m-editor-empty-content" };
|
|
5033
|
+
const _hoisted_3$9 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
|
|
5034
|
+
const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
4615
5035
|
...{
|
|
4616
5036
|
name: "MEditorAddPageBox"
|
|
4617
5037
|
},
|
|
@@ -4631,16 +5051,16 @@
|
|
|
4631
5051
|
});
|
|
4632
5052
|
};
|
|
4633
5053
|
return (_ctx, _cache) => {
|
|
4634
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4635
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
5054
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
|
|
5055
|
+
vue.createElementVNode("div", _hoisted_2$g, [
|
|
4636
5056
|
vue.createElementVNode("div", {
|
|
4637
5057
|
class: "m-editor-empty-button",
|
|
4638
5058
|
onClick: clickHandler
|
|
4639
5059
|
}, [
|
|
4640
5060
|
vue.createElementVNode("div", null, [
|
|
4641
|
-
vue.createVNode(_sfc_main$
|
|
5061
|
+
vue.createVNode(_sfc_main$M, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
4642
5062
|
]),
|
|
4643
|
-
_hoisted_3$
|
|
5063
|
+
_hoisted_3$9
|
|
4644
5064
|
])
|
|
4645
5065
|
])
|
|
4646
5066
|
]);
|
|
@@ -4652,7 +5072,7 @@
|
|
|
4652
5072
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
4653
5073
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
4654
5074
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
4655
|
-
const _sfc_main$
|
|
5075
|
+
const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
4656
5076
|
...{
|
|
4657
5077
|
name: "MEditorFramework"
|
|
4658
5078
|
},
|
|
@@ -4729,13 +5149,13 @@
|
|
|
4729
5149
|
vue.renderSlot(_ctx.$slots, "nav"),
|
|
4730
5150
|
vue.renderSlot(_ctx.$slots, "content-before"),
|
|
4731
5151
|
showSrc.value ? vue.renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
|
|
4732
|
-
vue.createVNode(_sfc_main$
|
|
5152
|
+
vue.createVNode(_sfc_main$S, {
|
|
4733
5153
|
class: "m-editor-content",
|
|
4734
5154
|
"init-values": root.value,
|
|
4735
5155
|
options: vue.unref(codeOptions),
|
|
4736
5156
|
onSave: saveCode
|
|
4737
5157
|
}, null, 8, ["init-values", "options"])
|
|
4738
|
-
]) : (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5158
|
+
]) : (vue.openBlock(), vue.createBlock(_sfc_main$z, {
|
|
4739
5159
|
key: 1,
|
|
4740
5160
|
class: "m-editor-content",
|
|
4741
5161
|
"left-class": "m-editor-framework-left",
|
|
@@ -4754,7 +5174,7 @@
|
|
|
4754
5174
|
]),
|
|
4755
5175
|
center: vue.withCtx(() => [
|
|
4756
5176
|
pageLength.value > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
4757
|
-
vue.createVNode(_sfc_main$
|
|
5177
|
+
vue.createVNode(_sfc_main$y)
|
|
4758
5178
|
])
|
|
4759
5179
|
]),
|
|
4760
5180
|
_: 2
|
|
@@ -4779,12 +5199,12 @@
|
|
|
4779
5199
|
}
|
|
4780
5200
|
});
|
|
4781
5201
|
|
|
4782
|
-
const _hoisted_1$
|
|
5202
|
+
const _hoisted_1$j = {
|
|
4783
5203
|
key: 1,
|
|
4784
5204
|
class: "menu-item-text"
|
|
4785
5205
|
};
|
|
4786
|
-
const _hoisted_2$
|
|
4787
|
-
const _sfc_main$
|
|
5206
|
+
const _hoisted_2$f = { class: "el-dropdown-link menubar-menu-button" };
|
|
5207
|
+
const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
4788
5208
|
...{
|
|
4789
5209
|
name: "MEditorToolButton"
|
|
4790
5210
|
},
|
|
@@ -4863,7 +5283,7 @@
|
|
|
4863
5283
|
_ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
4864
5284
|
key: 0,
|
|
4865
5285
|
direction: _ctx.data.direction || "vertical"
|
|
4866
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5286
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
4867
5287
|
_ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
4868
5288
|
key: 0,
|
|
4869
5289
|
effect: "dark",
|
|
@@ -4877,7 +5297,7 @@
|
|
|
4877
5297
|
disabled: disabled.value
|
|
4878
5298
|
}, {
|
|
4879
5299
|
default: vue.withCtx(() => [
|
|
4880
|
-
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5300
|
+
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
4881
5301
|
key: 0,
|
|
4882
5302
|
icon: _ctx.data.icon
|
|
4883
5303
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -4895,7 +5315,7 @@
|
|
|
4895
5315
|
title: _ctx.data.text
|
|
4896
5316
|
}, {
|
|
4897
5317
|
default: vue.withCtx(() => [
|
|
4898
|
-
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5318
|
+
_ctx.data.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
4899
5319
|
key: 0,
|
|
4900
5320
|
icon: _ctx.data.icon
|
|
4901
5321
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -4928,7 +5348,7 @@
|
|
|
4928
5348
|
})) : vue.createCommentVNode("", true)
|
|
4929
5349
|
]),
|
|
4930
5350
|
default: vue.withCtx(() => [
|
|
4931
|
-
vue.createElementVNode("span", _hoisted_2$
|
|
5351
|
+
vue.createElementVNode("span", _hoisted_2$f, [
|
|
4932
5352
|
vue.createTextVNode(vue.toDisplayString(_ctx.data.text), 1),
|
|
4933
5353
|
vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
|
|
4934
5354
|
default: vue.withCtx(() => [
|
|
@@ -4945,7 +5365,7 @@
|
|
|
4945
5365
|
}
|
|
4946
5366
|
});
|
|
4947
5367
|
|
|
4948
|
-
const _sfc_main$
|
|
5368
|
+
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
4949
5369
|
...{
|
|
4950
5370
|
name: "MEditorNavMenu"
|
|
4951
5371
|
},
|
|
@@ -5107,7 +5527,7 @@
|
|
|
5107
5527
|
style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
5108
5528
|
}, [
|
|
5109
5529
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
|
|
5110
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5530
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
5111
5531
|
data: item,
|
|
5112
5532
|
key: index
|
|
5113
5533
|
}, null, 8, ["data"]);
|
|
@@ -5119,8 +5539,8 @@
|
|
|
5119
5539
|
}
|
|
5120
5540
|
});
|
|
5121
5541
|
|
|
5122
|
-
const _hoisted_1$
|
|
5123
|
-
const _sfc_main$
|
|
5542
|
+
const _hoisted_1$i = { class: "m-editor-props-panel" };
|
|
5543
|
+
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
5124
5544
|
...{
|
|
5125
5545
|
name: "MEditorPropsPanel"
|
|
5126
5546
|
},
|
|
@@ -5173,7 +5593,7 @@
|
|
|
5173
5593
|
};
|
|
5174
5594
|
__expose({ configForm, submit });
|
|
5175
5595
|
return (_ctx, _cache) => {
|
|
5176
|
-
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5596
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
|
|
5177
5597
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
5178
5598
|
vue.createVNode(vue.unref(form.MForm), {
|
|
5179
5599
|
ref_key: "configForm",
|
|
@@ -5193,7 +5613,7 @@
|
|
|
5193
5613
|
}
|
|
5194
5614
|
});
|
|
5195
5615
|
|
|
5196
|
-
const _sfc_main$
|
|
5616
|
+
const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
5197
5617
|
...{
|
|
5198
5618
|
name: "MEditorSearchInput"
|
|
5199
5619
|
},
|
|
@@ -5201,8 +5621,12 @@
|
|
|
5201
5621
|
emits: ["search"],
|
|
5202
5622
|
setup(__props, { emit }) {
|
|
5203
5623
|
const filterText = vue.ref("");
|
|
5624
|
+
let timer = null;
|
|
5204
5625
|
const filterTextChangeHandler = () => {
|
|
5205
|
-
|
|
5626
|
+
timer && clearTimeout(timer);
|
|
5627
|
+
timer = setTimeout(() => {
|
|
5628
|
+
emit("search", filterText.value);
|
|
5629
|
+
}, 300);
|
|
5206
5630
|
};
|
|
5207
5631
|
return (_ctx, _cache) => {
|
|
5208
5632
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInput), {
|
|
@@ -5228,8 +5652,8 @@
|
|
|
5228
5652
|
}
|
|
5229
5653
|
});
|
|
5230
5654
|
|
|
5231
|
-
const _hoisted_1$
|
|
5232
|
-
const _hoisted_2$
|
|
5655
|
+
const _hoisted_1$h = { xmlns: "http://www.w3.org/2000/svg" };
|
|
5656
|
+
const _hoisted_2$e = /* @__PURE__ */ vue.createElementVNode("g", {
|
|
5233
5657
|
fill: "#7C878E",
|
|
5234
5658
|
"fill-rule": "evenodd"
|
|
5235
5659
|
}, [
|
|
@@ -5239,50 +5663,50 @@
|
|
|
5239
5663
|
}),
|
|
5240
5664
|
/* @__PURE__ */ vue.createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
|
|
5241
5665
|
], -1);
|
|
5242
|
-
const _hoisted_3$
|
|
5243
|
-
_hoisted_2$
|
|
5666
|
+
const _hoisted_3$8 = [
|
|
5667
|
+
_hoisted_2$e
|
|
5244
5668
|
];
|
|
5245
|
-
const _sfc_main$
|
|
5669
|
+
const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
5246
5670
|
...{
|
|
5247
5671
|
name: "MEditorAppManageIcon"
|
|
5248
5672
|
},
|
|
5249
5673
|
__name: "AppManageIcon",
|
|
5250
5674
|
setup(__props) {
|
|
5251
5675
|
return (_ctx, _cache) => {
|
|
5252
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
5676
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$h, _hoisted_3$8);
|
|
5253
5677
|
};
|
|
5254
5678
|
}
|
|
5255
5679
|
});
|
|
5256
5680
|
|
|
5257
|
-
const _hoisted_1$
|
|
5681
|
+
const _hoisted_1$g = {
|
|
5258
5682
|
viewBox: "0 0 32 32",
|
|
5259
5683
|
version: "1.1",
|
|
5260
5684
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5261
5685
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
5262
5686
|
};
|
|
5263
|
-
const _hoisted_2$
|
|
5264
|
-
const _hoisted_4$
|
|
5265
|
-
_hoisted_2$
|
|
5687
|
+
const _hoisted_2$d = /* @__PURE__ */ vue.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);
|
|
5688
|
+
const _hoisted_4$6 = [
|
|
5689
|
+
_hoisted_2$d
|
|
5266
5690
|
];
|
|
5267
|
-
const _sfc_main$
|
|
5691
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
5268
5692
|
...{
|
|
5269
5693
|
name: "MEditorCodeIcon"
|
|
5270
5694
|
},
|
|
5271
5695
|
__name: "CodeIcon",
|
|
5272
5696
|
setup(__props) {
|
|
5273
5697
|
return (_ctx, _cache) => {
|
|
5274
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
5698
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$g, _hoisted_4$6);
|
|
5275
5699
|
};
|
|
5276
5700
|
}
|
|
5277
5701
|
});
|
|
5278
5702
|
|
|
5279
|
-
const _hoisted_1$
|
|
5280
|
-
const _hoisted_2$
|
|
5281
|
-
const _hoisted_3$
|
|
5703
|
+
const _hoisted_1$f = ["id"];
|
|
5704
|
+
const _hoisted_2$c = { class: "list-item" };
|
|
5705
|
+
const _hoisted_3$7 = {
|
|
5282
5706
|
key: 2,
|
|
5283
5707
|
class: "right-tool"
|
|
5284
5708
|
};
|
|
5285
|
-
const _sfc_main$
|
|
5709
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
5286
5710
|
...{
|
|
5287
5711
|
name: "MEditorCodeBlockList"
|
|
5288
5712
|
},
|
|
@@ -5383,26 +5807,26 @@
|
|
|
5383
5807
|
id: data.id,
|
|
5384
5808
|
class: "list-container"
|
|
5385
5809
|
}, [
|
|
5386
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
5387
|
-
data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5810
|
+
vue.createElementVNode("div", _hoisted_2$c, [
|
|
5811
|
+
data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$r, {
|
|
5388
5812
|
key: 0,
|
|
5389
5813
|
class: "codeIcon"
|
|
5390
5814
|
})) : vue.createCommentVNode("", true),
|
|
5391
|
-
data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5815
|
+
data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
5392
5816
|
key: 1,
|
|
5393
5817
|
class: "compIcon"
|
|
5394
5818
|
})) : vue.createCommentVNode("", true),
|
|
5395
5819
|
vue.createElementVNode("span", {
|
|
5396
5820
|
class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
|
|
5397
5821
|
}, vue.toDisplayString(data.name) + " (" + vue.toDisplayString(data.id) + ")", 3),
|
|
5398
|
-
data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$
|
|
5822
|
+
data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$7, [
|
|
5399
5823
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
5400
5824
|
effect: "dark",
|
|
5401
5825
|
content: editable.value ? "编辑" : "查看",
|
|
5402
5826
|
placement: "bottom"
|
|
5403
5827
|
}, {
|
|
5404
5828
|
default: vue.withCtx(() => [
|
|
5405
|
-
vue.createVNode(_sfc_main$
|
|
5829
|
+
vue.createVNode(_sfc_main$M, {
|
|
5406
5830
|
icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
5407
5831
|
class: "edit-icon",
|
|
5408
5832
|
onClick: vue.withModifiers(($event) => editCode(data.id), ["stop"])
|
|
@@ -5417,7 +5841,7 @@
|
|
|
5417
5841
|
placement: "bottom"
|
|
5418
5842
|
}, {
|
|
5419
5843
|
default: vue.withCtx(() => [
|
|
5420
|
-
vue.createVNode(_sfc_main$
|
|
5844
|
+
vue.createVNode(_sfc_main$M, {
|
|
5421
5845
|
icon: vue.unref(iconsVue.Close),
|
|
5422
5846
|
class: "edit-icon",
|
|
5423
5847
|
onClick: vue.withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -5431,7 +5855,7 @@
|
|
|
5431
5855
|
})
|
|
5432
5856
|
])) : vue.createCommentVNode("", true)
|
|
5433
5857
|
])
|
|
5434
|
-
], 8, _hoisted_1$
|
|
5858
|
+
], 8, _hoisted_1$f)
|
|
5435
5859
|
]),
|
|
5436
5860
|
_: 3
|
|
5437
5861
|
}, 8, ["default-expanded-keys", "data"]);
|
|
@@ -5439,8 +5863,8 @@
|
|
|
5439
5863
|
}
|
|
5440
5864
|
});
|
|
5441
5865
|
|
|
5442
|
-
const _hoisted_1$
|
|
5443
|
-
const _sfc_main$
|
|
5866
|
+
const _hoisted_1$e = { class: "search-wrapper" };
|
|
5867
|
+
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
5444
5868
|
...{
|
|
5445
5869
|
name: "MEditorCodeBlockListPanel"
|
|
5446
5870
|
},
|
|
@@ -5460,8 +5884,8 @@
|
|
|
5460
5884
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
5461
5885
|
default: vue.withCtx(() => [
|
|
5462
5886
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
5463
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
5464
|
-
vue.createVNode(_sfc_main$
|
|
5887
|
+
vue.createElementVNode("div", _hoisted_1$e, [
|
|
5888
|
+
vue.createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
|
|
5465
5889
|
editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
5466
5890
|
key: 0,
|
|
5467
5891
|
class: "create-code-button",
|
|
@@ -5477,7 +5901,7 @@
|
|
|
5477
5901
|
vue.renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
5478
5902
|
])
|
|
5479
5903
|
]),
|
|
5480
|
-
vue.createVNode(_sfc_main$
|
|
5904
|
+
vue.createVNode(_sfc_main$q, {
|
|
5481
5905
|
ref_key: "codeBlockList",
|
|
5482
5906
|
ref: codeBlockList,
|
|
5483
5907
|
"custom-error": _ctx.customError,
|
|
@@ -5492,7 +5916,7 @@
|
|
|
5492
5916
|
]),
|
|
5493
5917
|
_: 3
|
|
5494
5918
|
}, 8, ["custom-error", "onEdit", "onRemove"]),
|
|
5495
|
-
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
5919
|
+
vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
|
|
5496
5920
|
key: 0,
|
|
5497
5921
|
ref_key: "codeBlockEditor",
|
|
5498
5922
|
ref: codeBlockEditor,
|
|
@@ -5507,7 +5931,7 @@
|
|
|
5507
5931
|
}
|
|
5508
5932
|
});
|
|
5509
5933
|
|
|
5510
|
-
const _sfc_main$
|
|
5934
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
5511
5935
|
...{
|
|
5512
5936
|
name: "MEditorDataSourceConfigPanel"
|
|
5513
5937
|
},
|
|
@@ -5561,13 +5985,13 @@
|
|
|
5561
5985
|
}
|
|
5562
5986
|
});
|
|
5563
5987
|
|
|
5564
|
-
const _hoisted_1$
|
|
5565
|
-
const _hoisted_2$
|
|
5566
|
-
const _hoisted_3$
|
|
5988
|
+
const _hoisted_1$d = ["id"];
|
|
5989
|
+
const _hoisted_2$b = { class: "list-item" };
|
|
5990
|
+
const _hoisted_3$6 = {
|
|
5567
5991
|
key: 2,
|
|
5568
5992
|
class: "right-tool"
|
|
5569
5993
|
};
|
|
5570
|
-
const _sfc_main$
|
|
5994
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
5571
5995
|
...{
|
|
5572
5996
|
name: "MEditorDataSourceList"
|
|
5573
5997
|
},
|
|
@@ -5662,13 +6086,13 @@
|
|
|
5662
6086
|
id: data.id,
|
|
5663
6087
|
class: "list-container"
|
|
5664
6088
|
}, [
|
|
5665
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
5666
|
-
data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6089
|
+
vue.createElementVNode("div", _hoisted_2$b, [
|
|
6090
|
+
data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
5667
6091
|
key: 0,
|
|
5668
6092
|
class: "codeIcon",
|
|
5669
6093
|
icon: vue.unref(iconsVue.Coin)
|
|
5670
6094
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
5671
|
-
data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6095
|
+
data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
5672
6096
|
key: 1,
|
|
5673
6097
|
class: "compIcon",
|
|
5674
6098
|
icon: vue.unref(iconsVue.Aim)
|
|
@@ -5676,14 +6100,14 @@
|
|
|
5676
6100
|
vue.createElementVNode("span", {
|
|
5677
6101
|
class: vue.normalizeClass(["name", { code: data.type === "ds", hook: data.type === "key" }])
|
|
5678
6102
|
}, vue.toDisplayString(data.type === "key" ? data.name : `${data.name}(${data.id})`), 3),
|
|
5679
|
-
data.type === "ds" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$
|
|
6103
|
+
data.type === "ds" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$6, [
|
|
5680
6104
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
5681
6105
|
effect: "dark",
|
|
5682
6106
|
content: editable.value ? "编辑" : "查看",
|
|
5683
6107
|
placement: "bottom"
|
|
5684
6108
|
}, {
|
|
5685
6109
|
default: vue.withCtx(() => [
|
|
5686
|
-
vue.createVNode(_sfc_main$
|
|
6110
|
+
vue.createVNode(_sfc_main$M, {
|
|
5687
6111
|
icon: editable.value ? vue.unref(iconsVue.Edit) : vue.unref(iconsVue.View),
|
|
5688
6112
|
class: "edit-icon",
|
|
5689
6113
|
onClick: vue.withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
|
|
@@ -5698,7 +6122,7 @@
|
|
|
5698
6122
|
placement: "bottom"
|
|
5699
6123
|
}, {
|
|
5700
6124
|
default: vue.withCtx(() => [
|
|
5701
|
-
vue.createVNode(_sfc_main$
|
|
6125
|
+
vue.createVNode(_sfc_main$M, {
|
|
5702
6126
|
icon: vue.unref(iconsVue.Close),
|
|
5703
6127
|
class: "edit-icon",
|
|
5704
6128
|
onClick: vue.withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
|
|
@@ -5712,7 +6136,7 @@
|
|
|
5712
6136
|
})
|
|
5713
6137
|
])) : vue.createCommentVNode("", true)
|
|
5714
6138
|
])
|
|
5715
|
-
], 8, _hoisted_1$
|
|
6139
|
+
], 8, _hoisted_1$d)
|
|
5716
6140
|
]),
|
|
5717
6141
|
_: 3
|
|
5718
6142
|
}, 8, ["data"]);
|
|
@@ -5720,9 +6144,9 @@
|
|
|
5720
6144
|
}
|
|
5721
6145
|
});
|
|
5722
6146
|
|
|
5723
|
-
const _hoisted_1$
|
|
5724
|
-
const _hoisted_2$
|
|
5725
|
-
const _sfc_main$
|
|
6147
|
+
const _hoisted_1$c = { class: "search-wrapper" };
|
|
6148
|
+
const _hoisted_2$a = { class: "data-source-list-panel-add-menu" };
|
|
6149
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
5726
6150
|
...{
|
|
5727
6151
|
name: "MEditorDataSourceListPanel"
|
|
5728
6152
|
},
|
|
@@ -5782,8 +6206,8 @@
|
|
|
5782
6206
|
return (_ctx, _cache) => {
|
|
5783
6207
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
|
|
5784
6208
|
default: vue.withCtx(() => [
|
|
5785
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
5786
|
-
vue.createVNode(_sfc_main$
|
|
6209
|
+
vue.createElementVNode("div", _hoisted_1$c, [
|
|
6210
|
+
vue.createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
|
|
5787
6211
|
editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
|
|
5788
6212
|
key: 0,
|
|
5789
6213
|
placement: "right"
|
|
@@ -5800,9 +6224,9 @@
|
|
|
5800
6224
|
})
|
|
5801
6225
|
]),
|
|
5802
6226
|
default: vue.withCtx(() => [
|
|
5803
|
-
vue.createElementVNode("div", _hoisted_2$
|
|
6227
|
+
vue.createElementVNode("div", _hoisted_2$a, [
|
|
5804
6228
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
|
|
5805
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6229
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
5806
6230
|
data: {
|
|
5807
6231
|
type: "button",
|
|
5808
6232
|
text: item.text,
|
|
@@ -5818,11 +6242,11 @@
|
|
|
5818
6242
|
_: 1
|
|
5819
6243
|
})) : vue.createCommentVNode("", true)
|
|
5820
6244
|
]),
|
|
5821
|
-
vue.createVNode(_sfc_main$
|
|
6245
|
+
vue.createVNode(_sfc_main$n, {
|
|
5822
6246
|
onEdit: editHandler,
|
|
5823
6247
|
onRemove: removeHandler
|
|
5824
6248
|
}),
|
|
5825
|
-
vue.createVNode(_sfc_main$
|
|
6249
|
+
vue.createVNode(_sfc_main$o, {
|
|
5826
6250
|
ref_key: "editDialog",
|
|
5827
6251
|
ref: editDialog,
|
|
5828
6252
|
disabled: !editable.value,
|
|
@@ -5837,136 +6261,7 @@
|
|
|
5837
6261
|
}
|
|
5838
6262
|
});
|
|
5839
6263
|
|
|
5840
|
-
const
|
|
5841
|
-
const _hoisted_2$8 = ["title"];
|
|
5842
|
-
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
5843
|
-
...{
|
|
5844
|
-
name: "MEditorComponentListPanel"
|
|
5845
|
-
},
|
|
5846
|
-
__name: "ComponentListPanel",
|
|
5847
|
-
setup(__props) {
|
|
5848
|
-
const searchText = vue.ref("");
|
|
5849
|
-
const filterTextChangeHandler = (v) => {
|
|
5850
|
-
searchText.value = v;
|
|
5851
|
-
};
|
|
5852
|
-
const services = vue.inject("services");
|
|
5853
|
-
const stageOptions = vue.inject("stageOptions");
|
|
5854
|
-
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
5855
|
-
const list = vue.computed(
|
|
5856
|
-
() => services?.componentListService.getList().map((group) => ({
|
|
5857
|
-
...group,
|
|
5858
|
-
items: group.items.filter((item) => item.text.includes(searchText.value))
|
|
5859
|
-
}))
|
|
5860
|
-
);
|
|
5861
|
-
const collapseValue = vue.computed(
|
|
5862
|
-
() => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
|
|
5863
|
-
);
|
|
5864
|
-
let timeout;
|
|
5865
|
-
let clientX;
|
|
5866
|
-
let clientY;
|
|
5867
|
-
const appendComponent = ({ text, type, data = {} }) => {
|
|
5868
|
-
services?.editorService.add({
|
|
5869
|
-
name: text,
|
|
5870
|
-
type,
|
|
5871
|
-
...data
|
|
5872
|
-
});
|
|
5873
|
-
};
|
|
5874
|
-
const dragstartHandler = ({ text, type, data = {} }, e) => {
|
|
5875
|
-
if (e.dataTransfer) {
|
|
5876
|
-
e.dataTransfer.setData(
|
|
5877
|
-
"text/json",
|
|
5878
|
-
serialize({
|
|
5879
|
-
name: text,
|
|
5880
|
-
type,
|
|
5881
|
-
...data
|
|
5882
|
-
})
|
|
5883
|
-
);
|
|
5884
|
-
}
|
|
5885
|
-
};
|
|
5886
|
-
const dragendHandler = () => {
|
|
5887
|
-
if (timeout) {
|
|
5888
|
-
globalThis.clearTimeout(timeout);
|
|
5889
|
-
timeout = void 0;
|
|
5890
|
-
}
|
|
5891
|
-
const doc = stage.value?.renderer.contentWindow?.document;
|
|
5892
|
-
if (doc && stageOptions) {
|
|
5893
|
-
utils.removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
|
|
5894
|
-
}
|
|
5895
|
-
clientX = 0;
|
|
5896
|
-
clientY = 0;
|
|
5897
|
-
};
|
|
5898
|
-
const dragHandler = (e) => {
|
|
5899
|
-
if (e.clientX !== clientX || e.clientY !== clientY) {
|
|
5900
|
-
clientX = e.clientX;
|
|
5901
|
-
clientY = e.clientY;
|
|
5902
|
-
if (timeout) {
|
|
5903
|
-
globalThis.clearTimeout(timeout);
|
|
5904
|
-
timeout = void 0;
|
|
5905
|
-
}
|
|
5906
|
-
return;
|
|
5907
|
-
}
|
|
5908
|
-
if (timeout || !stage.value)
|
|
5909
|
-
return;
|
|
5910
|
-
timeout = stage.value.delayedMarkContainer(e);
|
|
5911
|
-
};
|
|
5912
|
-
return (_ctx, _cache) => {
|
|
5913
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), null, {
|
|
5914
|
-
default: vue.withCtx(() => [
|
|
5915
|
-
vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
5916
|
-
vue.createVNode(vue.unref(design.TMagicCollapse), {
|
|
5917
|
-
class: "ui-component-panel",
|
|
5918
|
-
"model-value": collapseValue.value
|
|
5919
|
-
}, {
|
|
5920
|
-
default: vue.withCtx(() => [
|
|
5921
|
-
vue.createVNode(_sfc_main$s, { onSearch: filterTextChangeHandler }),
|
|
5922
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
|
|
5923
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
5924
|
-
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
5925
|
-
key: index,
|
|
5926
|
-
name: `${index}`
|
|
5927
|
-
}, {
|
|
5928
|
-
title: vue.withCtx(() => [
|
|
5929
|
-
vue.createVNode(_sfc_main$K, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
5930
|
-
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
5931
|
-
]),
|
|
5932
|
-
default: vue.withCtx(() => [
|
|
5933
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.items, (item) => {
|
|
5934
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
5935
|
-
class: "component-item",
|
|
5936
|
-
draggable: "true",
|
|
5937
|
-
key: item.type,
|
|
5938
|
-
onClick: ($event) => appendComponent(item),
|
|
5939
|
-
onDragstart: ($event) => dragstartHandler(item, $event),
|
|
5940
|
-
onDragend: dragendHandler,
|
|
5941
|
-
onDrag: dragHandler
|
|
5942
|
-
}, [
|
|
5943
|
-
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
5944
|
-
vue.createVNode(_sfc_main$K, {
|
|
5945
|
-
title: item.text,
|
|
5946
|
-
icon: item.icon
|
|
5947
|
-
}, null, 8, ["title", "icon"]),
|
|
5948
|
-
vue.createElementVNode("span", {
|
|
5949
|
-
title: item.text
|
|
5950
|
-
}, vue.toDisplayString(item.text), 9, _hoisted_2$8)
|
|
5951
|
-
])
|
|
5952
|
-
], 40, _hoisted_1$c);
|
|
5953
|
-
}), 128))
|
|
5954
|
-
]),
|
|
5955
|
-
_: 2
|
|
5956
|
-
}, 1032, ["name"])) : vue.createCommentVNode("", true)
|
|
5957
|
-
], 64);
|
|
5958
|
-
}), 256))
|
|
5959
|
-
]),
|
|
5960
|
-
_: 3
|
|
5961
|
-
}, 8, ["model-value"])
|
|
5962
|
-
]),
|
|
5963
|
-
_: 3
|
|
5964
|
-
});
|
|
5965
|
-
};
|
|
5966
|
-
}
|
|
5967
|
-
});
|
|
5968
|
-
|
|
5969
|
-
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
6264
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
5970
6265
|
...{
|
|
5971
6266
|
name: "MEditorContentMenu"
|
|
5972
6267
|
},
|
|
@@ -6043,11 +6338,14 @@
|
|
|
6043
6338
|
};
|
|
6044
6339
|
const showSubMenu = (item, index) => {
|
|
6045
6340
|
const menuItem = item;
|
|
6046
|
-
if (typeof item !== "object"
|
|
6341
|
+
if (typeof item !== "object") {
|
|
6047
6342
|
return;
|
|
6048
6343
|
}
|
|
6049
6344
|
subMenuData.value = menuItem.items || [];
|
|
6050
6345
|
setTimeout(() => {
|
|
6346
|
+
if (!visible.value) {
|
|
6347
|
+
return;
|
|
6348
|
+
}
|
|
6051
6349
|
if (menu.value) {
|
|
6052
6350
|
let y = menu.value.offsetTop;
|
|
6053
6351
|
if (buttons.value?.[index].$el) {
|
|
@@ -6096,7 +6394,7 @@
|
|
|
6096
6394
|
vue.renderSlot(_ctx.$slots, "title"),
|
|
6097
6395
|
vue.createElementVNode("div", null, [
|
|
6098
6396
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
|
|
6099
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6397
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$w, {
|
|
6100
6398
|
"event-type": "mouseup",
|
|
6101
6399
|
ref_for: true,
|
|
6102
6400
|
ref_key: "buttons",
|
|
@@ -6139,26 +6437,26 @@
|
|
|
6139
6437
|
fill: "currentColor",
|
|
6140
6438
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6141
6439
|
};
|
|
6142
|
-
const _hoisted_2$
|
|
6440
|
+
const _hoisted_2$9 = /* @__PURE__ */ vue.createElementVNode("path", {
|
|
6143
6441
|
"fill-rule": "evenodd",
|
|
6144
6442
|
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"
|
|
6145
6443
|
}, null, -1);
|
|
6146
|
-
const _hoisted_3$
|
|
6444
|
+
const _hoisted_3$5 = /* @__PURE__ */ vue.createElementVNode("path", {
|
|
6147
6445
|
"fill-rule": "evenodd",
|
|
6148
6446
|
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"
|
|
6149
6447
|
}, null, -1);
|
|
6150
|
-
const _hoisted_4$
|
|
6151
|
-
_hoisted_2$
|
|
6152
|
-
_hoisted_3$
|
|
6448
|
+
const _hoisted_4$5 = [
|
|
6449
|
+
_hoisted_2$9,
|
|
6450
|
+
_hoisted_3$5
|
|
6153
6451
|
];
|
|
6154
|
-
const _sfc_main$
|
|
6452
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
6155
6453
|
...{
|
|
6156
6454
|
name: "MEditorFolderMinusIcon"
|
|
6157
6455
|
},
|
|
6158
6456
|
__name: "FolderMinusIcon",
|
|
6159
6457
|
setup(__props) {
|
|
6160
6458
|
return (_ctx, _cache) => {
|
|
6161
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$b, _hoisted_4$
|
|
6459
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$b, _hoisted_4$5);
|
|
6162
6460
|
};
|
|
6163
6461
|
}
|
|
6164
6462
|
});
|
|
@@ -6238,7 +6536,7 @@
|
|
|
6238
6536
|
};
|
|
6239
6537
|
};
|
|
6240
6538
|
|
|
6241
|
-
const _sfc_main$
|
|
6539
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
6242
6540
|
...{
|
|
6243
6541
|
name: "MEditorLayerMenu"
|
|
6244
6542
|
},
|
|
@@ -6301,7 +6599,7 @@
|
|
|
6301
6599
|
{
|
|
6302
6600
|
type: "button",
|
|
6303
6601
|
text: "全部折叠",
|
|
6304
|
-
icon: _sfc_main$
|
|
6602
|
+
icon: _sfc_main$k,
|
|
6305
6603
|
display: () => utils.isPage(node.value),
|
|
6306
6604
|
handler: () => {
|
|
6307
6605
|
emit("collapse-all");
|
|
@@ -6327,7 +6625,7 @@
|
|
|
6327
6625
|
show
|
|
6328
6626
|
});
|
|
6329
6627
|
return (_ctx, _cache) => {
|
|
6330
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
6628
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
6331
6629
|
"menu-data": menuData.value,
|
|
6332
6630
|
ref_key: "menu",
|
|
6333
6631
|
ref: menu,
|
|
@@ -6337,9 +6635,8 @@
|
|
|
6337
6635
|
}
|
|
6338
6636
|
});
|
|
6339
6637
|
|
|
6340
|
-
const
|
|
6341
|
-
|
|
6342
|
-
__name: "LayerNode",
|
|
6638
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
6639
|
+
__name: "LayerNodeTool",
|
|
6343
6640
|
props: {
|
|
6344
6641
|
data: {}
|
|
6345
6642
|
},
|
|
@@ -6356,342 +6653,673 @@
|
|
|
6356
6653
|
});
|
|
6357
6654
|
};
|
|
6358
6655
|
return (_ctx, _cache) => {
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
})) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
|
|
6374
|
-
key: 1,
|
|
6375
|
-
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
6376
|
-
class: "node-lock",
|
|
6377
|
-
title: "点击隐藏"
|
|
6378
|
-
}, {
|
|
6379
|
-
default: vue.withCtx(() => [
|
|
6380
|
-
vue.createVNode(vue.unref(iconsVue.View))
|
|
6381
|
-
]),
|
|
6382
|
-
_: 1
|
|
6383
|
-
}))
|
|
6384
|
-
], 64)) : vue.createCommentVNode("", true)
|
|
6385
|
-
])
|
|
6386
|
-
], 64);
|
|
6656
|
+
return _ctx.data.type !== "page" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
6657
|
+
_ctx.data.visible === false ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
6658
|
+
key: 0,
|
|
6659
|
+
icon: vue.unref(iconsVue.Hide),
|
|
6660
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
6661
|
+
title: "点击显示"
|
|
6662
|
+
}, null, 8, ["icon"])) : (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
6663
|
+
key: 1,
|
|
6664
|
+
icon: vue.unref(iconsVue.View),
|
|
6665
|
+
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
6666
|
+
class: "node-lock",
|
|
6667
|
+
title: "点击隐藏"
|
|
6668
|
+
}, null, 8, ["icon"]))
|
|
6669
|
+
], 64)) : vue.createCommentVNode("", true);
|
|
6387
6670
|
};
|
|
6388
6671
|
}
|
|
6389
6672
|
});
|
|
6390
6673
|
|
|
6391
|
-
const
|
|
6392
|
-
|
|
6393
|
-
|
|
6674
|
+
const dragState = {
|
|
6675
|
+
dragOverNodeId: "",
|
|
6676
|
+
dropType: "",
|
|
6677
|
+
container: null
|
|
6678
|
+
};
|
|
6679
|
+
const getNodeEl = (el) => {
|
|
6680
|
+
if (el.dataset.nodeId) {
|
|
6681
|
+
return el;
|
|
6682
|
+
}
|
|
6683
|
+
if (el.parentElement) {
|
|
6684
|
+
return getNodeEl(el.parentElement);
|
|
6685
|
+
}
|
|
6686
|
+
};
|
|
6687
|
+
const removeStatusClass = (el) => {
|
|
6688
|
+
if (!el)
|
|
6689
|
+
return;
|
|
6690
|
+
["drag-before", "drag-after", "drag-inner"].forEach((className) => {
|
|
6691
|
+
el.querySelectorAll(`.${className}`).forEach((el2) => {
|
|
6692
|
+
utils.removeClassName(el2, className);
|
|
6693
|
+
});
|
|
6694
|
+
});
|
|
6695
|
+
};
|
|
6696
|
+
const useDrag = (services) => {
|
|
6697
|
+
const handleDragStart = (event) => {
|
|
6698
|
+
if (!event.dataTransfer || !event.target || !event.currentTarget)
|
|
6699
|
+
return;
|
|
6700
|
+
const targetEl = getNodeEl(event.target);
|
|
6701
|
+
if (!targetEl || targetEl !== event.currentTarget)
|
|
6702
|
+
return;
|
|
6703
|
+
event.dataTransfer.effectAllowed = "move";
|
|
6704
|
+
try {
|
|
6705
|
+
event.dataTransfer.setData(
|
|
6706
|
+
"text/json",
|
|
6707
|
+
JSON.stringify({
|
|
6708
|
+
dragType: DragType.LAYER_TREE
|
|
6709
|
+
})
|
|
6710
|
+
);
|
|
6711
|
+
} catch {
|
|
6712
|
+
}
|
|
6713
|
+
};
|
|
6714
|
+
const handleDragOver = (event) => {
|
|
6715
|
+
if (!event.target)
|
|
6716
|
+
return;
|
|
6717
|
+
const targetEl = getNodeEl(event.target);
|
|
6718
|
+
if (!targetEl)
|
|
6719
|
+
return;
|
|
6720
|
+
const labelEl = targetEl.children[0];
|
|
6721
|
+
if (!labelEl)
|
|
6722
|
+
return;
|
|
6723
|
+
const { top: targetTop, height: targetHeight } = labelEl.getBoundingClientRect();
|
|
6724
|
+
const distance = event.clientY - targetTop;
|
|
6725
|
+
const isContainer = targetEl.dataset.isContainer === "true";
|
|
6726
|
+
if (distance < targetHeight / 3) {
|
|
6727
|
+
dragState.dropType = "before";
|
|
6728
|
+
utils.addClassName(labelEl, globalThis.document, "drag-before");
|
|
6729
|
+
utils.removeClassName(labelEl, "drag-after", "drag-inner");
|
|
6730
|
+
} else if (distance > targetHeight * 2 / 3) {
|
|
6731
|
+
dragState.dropType = "after";
|
|
6732
|
+
utils.addClassName(labelEl, globalThis.document, "drag-after");
|
|
6733
|
+
utils.removeClassName(labelEl, "drag-before", "drag-inner");
|
|
6734
|
+
} else if (isContainer) {
|
|
6735
|
+
dragState.dropType = "inner";
|
|
6736
|
+
utils.addClassName(labelEl, globalThis.document, "drag-inner");
|
|
6737
|
+
utils.removeClassName(labelEl, "drag-before", "drag-after");
|
|
6738
|
+
}
|
|
6739
|
+
if (!dragState.dropType) {
|
|
6740
|
+
return;
|
|
6741
|
+
}
|
|
6742
|
+
dragState.dragOverNodeId = targetEl.dataset.nodeId || "";
|
|
6743
|
+
dragState.container = event.currentTarget;
|
|
6744
|
+
event.preventDefault();
|
|
6745
|
+
};
|
|
6746
|
+
const handleDragLeave = (event) => {
|
|
6747
|
+
if (!event.target || !event.currentTarget)
|
|
6748
|
+
return;
|
|
6749
|
+
const targetEl = getNodeEl(event.target);
|
|
6750
|
+
if (!targetEl || targetEl !== event.currentTarget)
|
|
6751
|
+
return;
|
|
6752
|
+
const labelEl = targetEl.children[0];
|
|
6753
|
+
utils.removeClassName(labelEl, "drag-before", "drag-after", "drag-inner");
|
|
6754
|
+
};
|
|
6755
|
+
const handleDragEnd = (event, node) => {
|
|
6756
|
+
if (!event.target || !event.currentTarget)
|
|
6757
|
+
return;
|
|
6758
|
+
const targetEl = getNodeEl(event.target);
|
|
6759
|
+
if (!targetEl || targetEl !== event.currentTarget)
|
|
6760
|
+
return;
|
|
6761
|
+
removeStatusClass(dragState.container);
|
|
6762
|
+
if (node && dragState.dragOverNodeId && dragState.dropType && services) {
|
|
6763
|
+
const targetInfo = services.editorService.getNodeInfo(dragState.dragOverNodeId, false);
|
|
6764
|
+
const targetNode = targetInfo.node;
|
|
6765
|
+
let targetParent = targetInfo.parent;
|
|
6766
|
+
if (!targetParent || !targetNode)
|
|
6767
|
+
return;
|
|
6768
|
+
let targetIndex = -1;
|
|
6769
|
+
if (Array.isArray(targetNode.items) && dragState.dropType === "inner") {
|
|
6770
|
+
targetIndex = targetNode.items.length;
|
|
6771
|
+
targetParent = targetNode;
|
|
6772
|
+
} else {
|
|
6773
|
+
targetIndex = getNodeIndex(dragState.dragOverNodeId, targetParent);
|
|
6774
|
+
}
|
|
6775
|
+
if (dragState.dropType === "after") {
|
|
6776
|
+
targetIndex += 1;
|
|
6777
|
+
}
|
|
6778
|
+
services?.editorService.dragTo(node, targetParent, targetIndex);
|
|
6779
|
+
}
|
|
6780
|
+
dragState.dragOverNodeId = "";
|
|
6781
|
+
dragState.dropType = "";
|
|
6782
|
+
dragState.container = null;
|
|
6783
|
+
};
|
|
6784
|
+
return {
|
|
6785
|
+
handleDragStart,
|
|
6786
|
+
handleDragEnd,
|
|
6787
|
+
handleDragLeave,
|
|
6788
|
+
handleDragOver
|
|
6789
|
+
};
|
|
6790
|
+
};
|
|
6791
|
+
|
|
6792
|
+
const updateStatus = (nodeStatusMap, id, status) => {
|
|
6793
|
+
const nodeStatus = nodeStatusMap.get(id);
|
|
6794
|
+
if (!nodeStatus)
|
|
6795
|
+
return;
|
|
6796
|
+
utils.getKeys(status).forEach((key) => {
|
|
6797
|
+
if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
|
|
6798
|
+
nodeStatus[key] = Boolean(status[key]);
|
|
6799
|
+
}
|
|
6800
|
+
});
|
|
6801
|
+
};
|
|
6802
|
+
const useFilter = (nodeStatusMap, page) => {
|
|
6803
|
+
const filterIsMatch = (value, data) => {
|
|
6804
|
+
if (!value) {
|
|
6805
|
+
return true;
|
|
6806
|
+
}
|
|
6807
|
+
let name = "";
|
|
6808
|
+
if (data.name) {
|
|
6809
|
+
name = data.name;
|
|
6810
|
+
} else if (data.items) {
|
|
6811
|
+
name = "container";
|
|
6812
|
+
}
|
|
6813
|
+
return `${data.id}${name}${data.type}`.includes(value);
|
|
6814
|
+
};
|
|
6815
|
+
const filterNode = (text) => (node, parents) => {
|
|
6816
|
+
if (!nodeStatusMap.value)
|
|
6817
|
+
return;
|
|
6818
|
+
const visible = filterIsMatch(text, node);
|
|
6819
|
+
if (visible && parents.length) {
|
|
6820
|
+
parents.forEach((parent) => {
|
|
6821
|
+
updateStatus(nodeStatusMap.value, parent.id, {
|
|
6822
|
+
visible,
|
|
6823
|
+
expand: true
|
|
6824
|
+
});
|
|
6825
|
+
});
|
|
6826
|
+
}
|
|
6827
|
+
updateStatus(nodeStatusMap.value, node.id, {
|
|
6828
|
+
visible
|
|
6829
|
+
});
|
|
6830
|
+
};
|
|
6831
|
+
const filter = (text) => {
|
|
6832
|
+
if (!page.value?.items?.length)
|
|
6833
|
+
return;
|
|
6834
|
+
page.value.items.forEach((node) => {
|
|
6835
|
+
traverseNode(node, filterNode(text));
|
|
6836
|
+
});
|
|
6837
|
+
};
|
|
6838
|
+
return {
|
|
6839
|
+
filterText: vue.ref(""),
|
|
6840
|
+
filterTextChangeHandler(text) {
|
|
6841
|
+
filter(text);
|
|
6842
|
+
}
|
|
6843
|
+
};
|
|
6844
|
+
};
|
|
6845
|
+
|
|
6846
|
+
const _hoisted_1$a = ["draggable", "data-node-id", "data-is-container"];
|
|
6847
|
+
const _hoisted_2$8 = { class: "layer-node-label" };
|
|
6848
|
+
const _hoisted_3$4 = { class: "layer-node-tool" };
|
|
6849
|
+
const _hoisted_4$4 = {
|
|
6850
|
+
key: 0,
|
|
6851
|
+
class: "magic-editor-layer-node-children"
|
|
6852
|
+
};
|
|
6853
|
+
const throttleTime = 300;
|
|
6854
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
6394
6855
|
...{
|
|
6395
|
-
name: "
|
|
6856
|
+
name: "MEditorLayerNode"
|
|
6396
6857
|
},
|
|
6397
|
-
__name: "
|
|
6858
|
+
__name: "LayerNode",
|
|
6398
6859
|
props: {
|
|
6399
|
-
|
|
6860
|
+
data: {},
|
|
6861
|
+
parent: {},
|
|
6862
|
+
indent: { default: 0 },
|
|
6863
|
+
filterText: { default: "" },
|
|
6864
|
+
isCtrlKeyDown: { type: Boolean, default: false }
|
|
6400
6865
|
},
|
|
6401
|
-
|
|
6866
|
+
emits: ["node-contextmenu"],
|
|
6867
|
+
setup(__props, { emit }) {
|
|
6868
|
+
const props = __props;
|
|
6402
6869
|
const services = vue.inject("services");
|
|
6870
|
+
const nodeStatusMap = vue.inject("nodeStatusMap");
|
|
6403
6871
|
const editorService = services?.editorService;
|
|
6404
|
-
const
|
|
6405
|
-
const
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
const currentNodeKey = vue.ref();
|
|
6411
|
-
const clicked = vue.ref(false);
|
|
6412
|
-
const treeProps = {
|
|
6413
|
-
children: "items",
|
|
6414
|
-
label: "name",
|
|
6415
|
-
value: "id",
|
|
6416
|
-
disabled: (data) => Boolean(data.items?.length),
|
|
6417
|
-
class: (data) => {
|
|
6418
|
-
if (clicked.value || utils.isPage(data))
|
|
6419
|
-
return "";
|
|
6420
|
-
if (data.id === highlightNode?.value?.id && !checkedKeys.value.includes(data.id)) {
|
|
6421
|
-
return "cus-tree-node-hover";
|
|
6422
|
-
}
|
|
6872
|
+
const uiService = services?.uiService;
|
|
6873
|
+
const nodeStatus = vue.computed(
|
|
6874
|
+
() => nodeStatusMap?.value?.get(props.data.id) || {
|
|
6875
|
+
selected: false,
|
|
6876
|
+
expand: false,
|
|
6877
|
+
visible: false
|
|
6423
6878
|
}
|
|
6879
|
+
);
|
|
6880
|
+
const expanded = vue.computed(() => nodeStatus.value.expand);
|
|
6881
|
+
const selected = vue.computed(() => nodeStatus.value.selected);
|
|
6882
|
+
const visible = vue.computed(() => nodeStatus.value.visible);
|
|
6883
|
+
const hasChilren = vue.computed(() => props.data.items?.length > 0);
|
|
6884
|
+
const nodeEl = vue.ref();
|
|
6885
|
+
const { handleDragStart, handleDragEnd, handleDragLeave } = useDrag(services);
|
|
6886
|
+
const expandHandler = () => {
|
|
6887
|
+
if (!nodeStatusMap?.value)
|
|
6888
|
+
return;
|
|
6889
|
+
updateStatus(nodeStatusMap.value, props.data.id, {
|
|
6890
|
+
expand: !expanded.value
|
|
6891
|
+
});
|
|
6892
|
+
};
|
|
6893
|
+
const nodeClickHandler = () => {
|
|
6894
|
+
if (!nodeStatusMap?.value)
|
|
6895
|
+
return;
|
|
6896
|
+
if (uiService?.get("uiSelectMode")) {
|
|
6897
|
+
document.dispatchEvent(new CustomEvent("ui-select", { detail: props.data }));
|
|
6898
|
+
return;
|
|
6899
|
+
}
|
|
6900
|
+
if (hasChilren.value && !props.isCtrlKeyDown) {
|
|
6901
|
+
updateStatus(nodeStatusMap.value, props.data.id, {
|
|
6902
|
+
expand: true
|
|
6903
|
+
});
|
|
6904
|
+
}
|
|
6905
|
+
vue.nextTick(() => {
|
|
6906
|
+
select(props.data);
|
|
6907
|
+
});
|
|
6908
|
+
};
|
|
6909
|
+
const contextmenuHandler = (event) => {
|
|
6910
|
+
event.preventDefault();
|
|
6911
|
+
nodeClickHandler();
|
|
6912
|
+
emit("node-contextmenu", event, props.data);
|
|
6913
|
+
};
|
|
6914
|
+
const nodeContentmenuHandler = (event, node) => {
|
|
6915
|
+
emit("node-contextmenu", event, node);
|
|
6424
6916
|
};
|
|
6425
|
-
const isMultiSelect = vue.computed(() => isCtrlKeyDown.value || checkedKeys.value.length > 1);
|
|
6426
|
-
const nodes = vue.computed(() => editorService?.get("nodes") || []);
|
|
6427
|
-
const page = vue.computed(() => editorService?.get("page"));
|
|
6428
|
-
const values = vue.computed(() => page.value ? [page.value] : []);
|
|
6429
|
-
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
6430
6917
|
const select = async (data) => {
|
|
6431
6918
|
if (!data.id) {
|
|
6432
6919
|
throw new Error("没有id");
|
|
6433
6920
|
}
|
|
6434
|
-
|
|
6435
|
-
|
|
6921
|
+
if (props.isCtrlKeyDown) {
|
|
6922
|
+
multiSelect(data);
|
|
6923
|
+
} else {
|
|
6924
|
+
await editorService?.select(data);
|
|
6925
|
+
editorService?.get("stage")?.select(data.id);
|
|
6926
|
+
}
|
|
6436
6927
|
};
|
|
6437
6928
|
const multiSelect = async (data) => {
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6929
|
+
const nodes = editorService?.get("nodes") || [];
|
|
6930
|
+
const newNodes = [];
|
|
6931
|
+
let isCancel = false;
|
|
6932
|
+
nodes.forEach((node) => {
|
|
6933
|
+
if (node.id === data.id) {
|
|
6934
|
+
isCancel = true;
|
|
6935
|
+
return;
|
|
6936
|
+
}
|
|
6937
|
+
newNodes.push(node.id);
|
|
6938
|
+
});
|
|
6939
|
+
if (!isCancel || newNodes.length === 0) {
|
|
6940
|
+
newNodes.push(data.id);
|
|
6444
6941
|
}
|
|
6445
|
-
editorService?.
|
|
6446
|
-
editorService?.get("stage")?.
|
|
6942
|
+
await editorService?.multiSelect(newNodes);
|
|
6943
|
+
editorService?.get("stage")?.multiSelect(newNodes);
|
|
6447
6944
|
};
|
|
6448
|
-
const
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
if (ingType === schema.NodeType.PAGE && data.type !== schema.NodeType.PAGE)
|
|
6455
|
-
return false;
|
|
6456
|
-
if (!data?.type)
|
|
6457
|
-
return false;
|
|
6458
|
-
if (["prev", "next"].includes(type))
|
|
6459
|
-
return true;
|
|
6460
|
-
if (data.items || data.type === "container")
|
|
6461
|
-
return true;
|
|
6462
|
-
return false;
|
|
6945
|
+
const highlightHandler = lodashEs.throttle(() => {
|
|
6946
|
+
highlight();
|
|
6947
|
+
}, throttleTime);
|
|
6948
|
+
const highlight = () => {
|
|
6949
|
+
editorService?.highlight(props.data);
|
|
6950
|
+
editorService?.get("stage")?.highlight(props.data.id);
|
|
6463
6951
|
};
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6952
|
+
return (_ctx, _cache) => {
|
|
6953
|
+
const _component_LayerNode = vue.resolveComponent("LayerNode", true);
|
|
6954
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
6955
|
+
class: "magic-editor-layer-node",
|
|
6956
|
+
ref_key: "nodeEl",
|
|
6957
|
+
ref: nodeEl,
|
|
6958
|
+
draggable: !vue.unref(utils.isPage)(_ctx.data),
|
|
6959
|
+
"data-node-id": _ctx.data.id,
|
|
6960
|
+
"data-is-container": Array.isArray(_ctx.data.items),
|
|
6961
|
+
onDragstart: _cache[1] || (_cache[1] = //@ts-ignore
|
|
6962
|
+
(...args) => vue.unref(handleDragStart) && vue.unref(handleDragStart)(...args)),
|
|
6963
|
+
onDragleave: _cache[2] || (_cache[2] = //@ts-ignore
|
|
6964
|
+
(...args) => vue.unref(handleDragLeave) && vue.unref(handleDragLeave)(...args)),
|
|
6965
|
+
onDragend: _cache[3] || (_cache[3] = ($event) => vue.unref(handleDragEnd)($event, _ctx.data))
|
|
6966
|
+
}, [
|
|
6967
|
+
vue.createElementVNode("div", {
|
|
6968
|
+
class: vue.normalizeClass(["layer-node", { selected: selected.value, expanded: expanded.value }]),
|
|
6969
|
+
style: vue.normalizeStyle(`padding-left: ${_ctx.indent}px`),
|
|
6970
|
+
onContextmenu: contextmenuHandler,
|
|
6971
|
+
onMouseenter: _cache[0] || (_cache[0] = ($event) => vue.unref(highlightHandler)())
|
|
6972
|
+
}, [
|
|
6973
|
+
vue.createVNode(_sfc_main$M, {
|
|
6974
|
+
class: "expand-icon",
|
|
6975
|
+
style: vue.normalizeStyle(hasChilren.value ? "" : "color: transparent; cursor: default"),
|
|
6976
|
+
icon: expanded.value ? vue.unref(iconsVue.ArrowDown) : vue.unref(iconsVue.ArrowRight),
|
|
6977
|
+
onClick: expandHandler
|
|
6978
|
+
}, null, 8, ["style", "icon"]),
|
|
6979
|
+
vue.createElementVNode("div", {
|
|
6980
|
+
class: "layer-node-content",
|
|
6981
|
+
onClick: nodeClickHandler
|
|
6982
|
+
}, [
|
|
6983
|
+
vue.renderSlot(_ctx.$slots, "layer-node-content", { data: _ctx.data }, () => [
|
|
6984
|
+
vue.createElementVNode("div", _hoisted_2$8, vue.toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
|
|
6985
|
+
vue.createElementVNode("div", _hoisted_3$4, [
|
|
6986
|
+
vue.createVNode(_sfc_main$i, { data: _ctx.data }, null, 8, ["data"])
|
|
6987
|
+
])
|
|
6988
|
+
])
|
|
6989
|
+
])
|
|
6990
|
+
], 38),
|
|
6991
|
+
hasChilren.value && expanded.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
|
|
6992
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.data.items, (item) => {
|
|
6993
|
+
return vue.openBlock(), vue.createBlock(_component_LayerNode, {
|
|
6994
|
+
data: item,
|
|
6995
|
+
parent: _ctx.data,
|
|
6996
|
+
key: item.id,
|
|
6997
|
+
indent: _ctx.indent + 11,
|
|
6998
|
+
"filter-text": _ctx.filterText,
|
|
6999
|
+
"is-ctrl-key-down": _ctx.isCtrlKeyDown,
|
|
7000
|
+
onNodeContextmenu: nodeContentmenuHandler
|
|
7001
|
+
}, {
|
|
7002
|
+
"layer-node-content": vue.withCtx(({ data: nodeData }) => [
|
|
7003
|
+
vue.renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData })
|
|
7004
|
+
]),
|
|
7005
|
+
_: 2
|
|
7006
|
+
}, 1032, ["data", "parent", "indent", "filter-text", "is-ctrl-key-down"]);
|
|
7007
|
+
}), 128))
|
|
7008
|
+
])) : vue.createCommentVNode("", true)
|
|
7009
|
+
], 40, _hoisted_1$a)), [
|
|
7010
|
+
[vue.vShow, visible.value]
|
|
7011
|
+
]);
|
|
7012
|
+
};
|
|
7013
|
+
}
|
|
7014
|
+
});
|
|
7015
|
+
|
|
7016
|
+
const useKeybinding = (services) => {
|
|
7017
|
+
const keybindingService = services?.keybindingService;
|
|
7018
|
+
const isCtrlKeyDown = vue.ref(false);
|
|
7019
|
+
const windowBlurHandler = () => {
|
|
7020
|
+
isCtrlKeyDown.value = false;
|
|
7021
|
+
};
|
|
7022
|
+
keybindingService?.registeCommand("layer-panel-global-keyup", () => {
|
|
7023
|
+
isCtrlKeyDown.value = false;
|
|
7024
|
+
});
|
|
7025
|
+
keybindingService?.registeCommand("layer-panel-global-keydwon", () => {
|
|
7026
|
+
isCtrlKeyDown.value = true;
|
|
7027
|
+
});
|
|
7028
|
+
keybindingService?.registe([
|
|
7029
|
+
{
|
|
7030
|
+
command: "layer-panel-global-keydwon",
|
|
7031
|
+
keybinding: "ctrl",
|
|
7032
|
+
when: [["global", "keydown"]]
|
|
7033
|
+
},
|
|
7034
|
+
{
|
|
7035
|
+
command: "layer-panel-global-keyup",
|
|
7036
|
+
keybinding: "ctrl",
|
|
7037
|
+
when: [["global", "keyup"]]
|
|
7038
|
+
}
|
|
7039
|
+
]);
|
|
7040
|
+
vue.onMounted(() => {
|
|
7041
|
+
globalThis.addEventListener("blur", windowBlurHandler);
|
|
7042
|
+
});
|
|
7043
|
+
vue.onBeforeUnmount(() => {
|
|
7044
|
+
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
7045
|
+
});
|
|
7046
|
+
return {
|
|
7047
|
+
isCtrlKeyDown
|
|
7048
|
+
};
|
|
7049
|
+
};
|
|
7050
|
+
|
|
7051
|
+
const createPageNodeStatus = (services, pageId) => {
|
|
7052
|
+
const map = /* @__PURE__ */ new Map();
|
|
7053
|
+
map.set(pageId, {
|
|
7054
|
+
visible: true,
|
|
7055
|
+
expand: true,
|
|
7056
|
+
selected: true
|
|
7057
|
+
});
|
|
7058
|
+
services?.editorService.getNodeById(pageId)?.items.forEach(
|
|
7059
|
+
(node) => traverseNode(node, (node2) => {
|
|
7060
|
+
map.set(node2.id, {
|
|
7061
|
+
visible: true,
|
|
7062
|
+
expand: false,
|
|
7063
|
+
selected: false
|
|
7064
|
+
});
|
|
7065
|
+
})
|
|
7066
|
+
);
|
|
7067
|
+
return map;
|
|
7068
|
+
};
|
|
7069
|
+
const useNodeStatus = (services, page) => {
|
|
7070
|
+
const nodes = vue.computed(() => services?.editorService.get("nodes") || []);
|
|
7071
|
+
const nodeStatusMaps = vue.ref(/* @__PURE__ */ new Map());
|
|
7072
|
+
const nodeStatusMap = vue.computed(
|
|
7073
|
+
() => page.value ? nodeStatusMaps.value.get(page.value.id) : /* @__PURE__ */ new Map()
|
|
7074
|
+
);
|
|
7075
|
+
vue.watch(
|
|
7076
|
+
() => page.value?.id,
|
|
7077
|
+
(pageId) => {
|
|
7078
|
+
if (!pageId || nodeStatusMaps.value.has(pageId)) {
|
|
6485
7079
|
return;
|
|
6486
7080
|
}
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
}
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
7081
|
+
nodeStatusMaps.value.set(pageId, createPageNodeStatus(services, pageId));
|
|
7082
|
+
},
|
|
7083
|
+
{
|
|
7084
|
+
immediate: true
|
|
7085
|
+
}
|
|
7086
|
+
);
|
|
7087
|
+
vue.watch(
|
|
7088
|
+
nodes,
|
|
7089
|
+
(nodes2) => {
|
|
7090
|
+
if (!nodeStatusMap.value)
|
|
7091
|
+
return;
|
|
7092
|
+
for (const [id, status] of nodeStatusMap.value.entries()) {
|
|
7093
|
+
status.selected = nodes2.some((node) => node.id === id);
|
|
7094
|
+
if (status.selected) {
|
|
7095
|
+
utils.getNodePath(id, page.value?.items).forEach((node) => {
|
|
7096
|
+
updateStatus(nodeStatusMap.value, node.id, {
|
|
7097
|
+
expand: true
|
|
7098
|
+
});
|
|
7099
|
+
});
|
|
7100
|
+
}
|
|
6495
7101
|
}
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
7102
|
+
},
|
|
7103
|
+
{
|
|
7104
|
+
immediate: true
|
|
7105
|
+
}
|
|
7106
|
+
);
|
|
7107
|
+
services?.editorService.on("add", (newNodes) => {
|
|
7108
|
+
newNodes.forEach((node) => {
|
|
7109
|
+
nodeStatusMap.value?.set(node.id, {
|
|
7110
|
+
visible: true,
|
|
7111
|
+
expand: Array.isArray(node.items),
|
|
7112
|
+
selected: true
|
|
7113
|
+
});
|
|
7114
|
+
});
|
|
7115
|
+
});
|
|
7116
|
+
services?.editorService.on("remove", (nodes2) => {
|
|
7117
|
+
nodes2.forEach((node) => {
|
|
7118
|
+
nodeStatusMap.value?.delete(node.id);
|
|
7119
|
+
});
|
|
7120
|
+
});
|
|
7121
|
+
return {
|
|
7122
|
+
nodeStatusMaps,
|
|
7123
|
+
nodeStatusMap
|
|
7124
|
+
};
|
|
7125
|
+
};
|
|
7126
|
+
|
|
7127
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
7128
|
+
...{
|
|
7129
|
+
name: "MEditorLayerPanel"
|
|
7130
|
+
},
|
|
7131
|
+
__name: "LayerPanel",
|
|
7132
|
+
props: {
|
|
7133
|
+
layerContentMenu: {}
|
|
7134
|
+
},
|
|
7135
|
+
setup(__props) {
|
|
7136
|
+
const services = vue.inject("services");
|
|
7137
|
+
const editorService = services?.editorService;
|
|
7138
|
+
const page = vue.computed(() => editorService?.get("page"));
|
|
7139
|
+
const root = vue.computed(() => editorService?.get("root"));
|
|
7140
|
+
const { nodeStatusMap } = useNodeStatus(services, page);
|
|
7141
|
+
const { isCtrlKeyDown } = useKeybinding(services);
|
|
7142
|
+
vue.provide("nodeStatusMap", nodeStatusMap);
|
|
7143
|
+
const { filterText, filterTextChangeHandler } = useFilter(nodeStatusMap, page);
|
|
7144
|
+
const collapseAllHandler = () => {
|
|
7145
|
+
if (!page.value || !nodeStatusMap.value)
|
|
7146
|
+
return;
|
|
7147
|
+
const items = nodeStatusMap.value.entries();
|
|
7148
|
+
for (const [id, status] of items) {
|
|
7149
|
+
if (id === page.value.id) {
|
|
7150
|
+
continue;
|
|
7151
|
+
}
|
|
7152
|
+
status.expand = false;
|
|
6501
7153
|
}
|
|
6502
|
-
return `${data.id}${name}${data.type}`.indexOf(value) !== -1;
|
|
6503
7154
|
};
|
|
6504
|
-
const
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
7155
|
+
const menu = vue.ref();
|
|
7156
|
+
const contextmenu = (event) => {
|
|
7157
|
+
event.preventDefault();
|
|
7158
|
+
menu.value?.show(event);
|
|
7159
|
+
};
|
|
7160
|
+
const { handleDragOver } = useDrag(services);
|
|
7161
|
+
return (_ctx, _cache) => {
|
|
7162
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
|
|
7163
|
+
default: vue.withCtx(() => [
|
|
7164
|
+
vue.renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
7165
|
+
vue.createVNode(_sfc_main$t, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
7166
|
+
vue.createElementVNode("div", {
|
|
7167
|
+
class: "magic-editor-layer-tree",
|
|
7168
|
+
tabindex: "-1",
|
|
7169
|
+
onDragover: _cache[0] || (_cache[0] = //@ts-ignore
|
|
7170
|
+
(...args) => vue.unref(handleDragOver) && vue.unref(handleDragOver)(...args))
|
|
7171
|
+
}, [
|
|
7172
|
+
page.value && root.value ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
|
|
7173
|
+
key: 0,
|
|
7174
|
+
data: page.value,
|
|
7175
|
+
"filter-text": vue.unref(filterText),
|
|
7176
|
+
"is-ctrl-key-down": vue.unref(isCtrlKeyDown),
|
|
7177
|
+
onNodeContextmenu: contextmenu
|
|
7178
|
+
}, {
|
|
7179
|
+
"layer-node-content": vue.withCtx(({ data: nodeData }) => [
|
|
7180
|
+
vue.renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData })
|
|
7181
|
+
]),
|
|
7182
|
+
_: 3
|
|
7183
|
+
}, 8, ["data", "filter-text", "is-ctrl-key-down"])) : vue.createCommentVNode("", true)
|
|
7184
|
+
], 32),
|
|
7185
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
7186
|
+
vue.createVNode(_sfc_main$j, {
|
|
7187
|
+
ref_key: "menu",
|
|
7188
|
+
ref: menu,
|
|
7189
|
+
"layer-content-menu": _ctx.layerContentMenu,
|
|
7190
|
+
onCollapseAll: collapseAllHandler
|
|
7191
|
+
}, null, 8, ["layer-content-menu"])
|
|
7192
|
+
]))
|
|
7193
|
+
]),
|
|
7194
|
+
_: 3
|
|
7195
|
+
});
|
|
7196
|
+
};
|
|
7197
|
+
}
|
|
7198
|
+
});
|
|
7199
|
+
|
|
7200
|
+
const _hoisted_1$9 = ["onClick", "onDragstart"];
|
|
7201
|
+
const _hoisted_2$7 = ["title"];
|
|
7202
|
+
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
7203
|
+
...{
|
|
7204
|
+
name: "MEditorComponentListPanel"
|
|
7205
|
+
},
|
|
7206
|
+
__name: "ComponentListPanel",
|
|
7207
|
+
setup(__props) {
|
|
7208
|
+
const searchText = vue.ref("");
|
|
7209
|
+
const filterTextChangeHandler = (v) => {
|
|
7210
|
+
searchText.value = v;
|
|
7211
|
+
};
|
|
7212
|
+
const services = vue.inject("services");
|
|
7213
|
+
const stageOptions = vue.inject("stageOptions");
|
|
7214
|
+
const stage = vue.computed(() => services?.editorService.get("stage"));
|
|
7215
|
+
const list = vue.computed(
|
|
7216
|
+
() => services?.componentListService.getList().map((group) => ({
|
|
7217
|
+
...group,
|
|
7218
|
+
items: group.items.filter((item) => item.text.includes(searchText.value))
|
|
7219
|
+
}))
|
|
7220
|
+
);
|
|
7221
|
+
const collapseValue = vue.computed(
|
|
7222
|
+
() => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
|
|
7223
|
+
);
|
|
7224
|
+
let timeout;
|
|
7225
|
+
let clientX;
|
|
7226
|
+
let clientY;
|
|
7227
|
+
const appendComponent = ({ text, type, data = {} }) => {
|
|
7228
|
+
services?.editorService.add({
|
|
7229
|
+
name: text,
|
|
7230
|
+
type,
|
|
7231
|
+
...data
|
|
6522
7232
|
});
|
|
6523
|
-
});
|
|
6524
|
-
vue.watch(isMultiSelect, (isMultiSelect2) => {
|
|
6525
|
-
if (!isMultiSelect2) {
|
|
6526
|
-
currentNodeKey.value = editorService?.get("node")?.id;
|
|
6527
|
-
tree.value?.setCurrentKey(currentNodeKey.value);
|
|
6528
|
-
}
|
|
6529
|
-
});
|
|
6530
|
-
const editorServiceRemoveHandler = () => {
|
|
6531
|
-
setTimeout(() => {
|
|
6532
|
-
tree.value?.getNode(editorService?.get("node")?.id)?.updateChildren();
|
|
6533
|
-
}, 0);
|
|
6534
7233
|
};
|
|
6535
|
-
const
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
isCtrlKeyDown.value = false;
|
|
6548
|
-
});
|
|
6549
|
-
keybindingService?.registeCommand("layer-panel-global-keydwon", () => {
|
|
6550
|
-
if (!tree.value?.$el.contains(document.activeElement)) {
|
|
6551
|
-
isCtrlKeyDown.value = false;
|
|
6552
|
-
}
|
|
6553
|
-
});
|
|
6554
|
-
keybindingService?.registe([
|
|
6555
|
-
{
|
|
6556
|
-
command: "layer-panel-not-ctrl-keydown",
|
|
6557
|
-
when: [["layer-panel", "keydown"]]
|
|
6558
|
-
},
|
|
6559
|
-
{
|
|
6560
|
-
command: "layer-panel-ctrl-keydown",
|
|
6561
|
-
keybinding: "ctrl",
|
|
6562
|
-
when: [["layer-panel", "keydown"]]
|
|
6563
|
-
},
|
|
6564
|
-
{
|
|
6565
|
-
command: "layer-panel-ctrl-keyup",
|
|
6566
|
-
keybinding: "ctrl",
|
|
6567
|
-
when: [["layer-panel", "keyup"]]
|
|
6568
|
-
},
|
|
6569
|
-
{
|
|
6570
|
-
command: "layer-panel-global-keydwon",
|
|
6571
|
-
keybinding: "ctrl",
|
|
6572
|
-
when: [["global", "keydown"]]
|
|
6573
|
-
}
|
|
6574
|
-
]);
|
|
6575
|
-
vue.watch(tree, () => {
|
|
6576
|
-
if (tree.value?.$el) {
|
|
6577
|
-
keybindingService?.registeEl("layer-panel", tree.value.$el);
|
|
6578
|
-
tree.value.$el.addEventListener("blur", windowBlurHandler);
|
|
6579
|
-
} else {
|
|
6580
|
-
keybindingService?.unregisteEl("layer-panel");
|
|
6581
|
-
}
|
|
6582
|
-
});
|
|
6583
|
-
vue.onMounted(() => {
|
|
6584
|
-
editorService?.on("remove", editorServiceRemoveHandler);
|
|
6585
|
-
globalThis.addEventListener("blur", windowBlurHandler);
|
|
6586
|
-
});
|
|
6587
|
-
vue.onBeforeUnmount(() => {
|
|
6588
|
-
tree.value?.$el.removeEventListener("blur", windowBlurHandler);
|
|
6589
|
-
});
|
|
6590
|
-
vue.onUnmounted(() => {
|
|
6591
|
-
editorService?.off("remove", editorServiceRemoveHandler);
|
|
6592
|
-
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
6593
|
-
});
|
|
6594
|
-
const highlightHandler = lodashEs.throttle((data) => {
|
|
6595
|
-
highlight(data);
|
|
6596
|
-
}, throttleTime);
|
|
6597
|
-
const toggleClickFlag = () => {
|
|
6598
|
-
clicked.value = !clicked.value;
|
|
7234
|
+
const dragstartHandler = ({ text, type, data = {} }, e) => {
|
|
7235
|
+
e.dataTransfer?.setData(
|
|
7236
|
+
"text/json",
|
|
7237
|
+
serialize({
|
|
7238
|
+
dragType: DragType.COMPONENT_LIST,
|
|
7239
|
+
data: {
|
|
7240
|
+
name: text,
|
|
7241
|
+
type,
|
|
7242
|
+
...data
|
|
7243
|
+
}
|
|
7244
|
+
})
|
|
7245
|
+
);
|
|
6599
7246
|
};
|
|
6600
|
-
const
|
|
6601
|
-
if (
|
|
6602
|
-
|
|
7247
|
+
const dragendHandler = () => {
|
|
7248
|
+
if (timeout) {
|
|
7249
|
+
globalThis.clearTimeout(timeout);
|
|
7250
|
+
timeout = void 0;
|
|
6603
7251
|
}
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
multiSelect(nodes.value.map((node) => node.id));
|
|
7252
|
+
const doc = stage.value?.renderer.contentWindow?.document;
|
|
7253
|
+
if (doc && stageOptions) {
|
|
7254
|
+
utils.removeClassNameByClassName(doc, stageOptions.containerHighlightClassName);
|
|
6608
7255
|
}
|
|
7256
|
+
clientX = 0;
|
|
7257
|
+
clientY = 0;
|
|
6609
7258
|
};
|
|
6610
|
-
const
|
|
6611
|
-
if (
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
7259
|
+
const dragHandler = (e) => {
|
|
7260
|
+
if (e.clientX !== clientX || e.clientY !== clientY) {
|
|
7261
|
+
clientX = e.clientX;
|
|
7262
|
+
clientY = e.clientY;
|
|
7263
|
+
if (timeout) {
|
|
7264
|
+
globalThis.clearTimeout(timeout);
|
|
7265
|
+
timeout = void 0;
|
|
7266
|
+
}
|
|
6616
7267
|
return;
|
|
6617
7268
|
}
|
|
6618
|
-
|
|
6619
|
-
};
|
|
6620
|
-
const contextmenu = async (event, data) => {
|
|
6621
|
-
event.preventDefault();
|
|
6622
|
-
if (nodes.value.length < 2) {
|
|
6623
|
-
await select(data);
|
|
6624
|
-
}
|
|
6625
|
-
menu.value?.show(event);
|
|
6626
|
-
};
|
|
6627
|
-
const collapseAllHandler = () => {
|
|
6628
|
-
const page2 = editorService?.get("page");
|
|
6629
|
-
if (!tree.value || !page2)
|
|
7269
|
+
if (timeout || !stage.value)
|
|
6630
7270
|
return;
|
|
6631
|
-
|
|
6632
|
-
rootNode.childNodes.forEach((node) => {
|
|
6633
|
-
node.collapse();
|
|
6634
|
-
handleCollapse(node.data);
|
|
6635
|
-
});
|
|
7271
|
+
timeout = stage.value.delayedMarkContainer(e);
|
|
6636
7272
|
};
|
|
6637
7273
|
return (_ctx, _cache) => {
|
|
6638
|
-
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar),
|
|
7274
|
+
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), null, {
|
|
6639
7275
|
default: vue.withCtx(() => [
|
|
6640
|
-
vue.renderSlot(_ctx.$slots, "
|
|
6641
|
-
vue.createVNode(
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
class: "magic-editor-layer-tree",
|
|
6645
|
-
ref_key: "tree",
|
|
6646
|
-
ref: tree,
|
|
6647
|
-
"node-key": "id",
|
|
6648
|
-
"empty-text": "页面空荡荡的",
|
|
6649
|
-
tabindex: "-1",
|
|
6650
|
-
draggable: "",
|
|
6651
|
-
"default-expanded-keys": expandedKeys.value,
|
|
6652
|
-
"default-checked-keys": checkedKeys.value,
|
|
6653
|
-
"current-node-key": currentNodeKey.value,
|
|
6654
|
-
data: values.value,
|
|
6655
|
-
"expand-on-click-node": false,
|
|
6656
|
-
"highlight-current": !isMultiSelect.value,
|
|
6657
|
-
"check-on-click-node": true,
|
|
6658
|
-
props: treeProps,
|
|
6659
|
-
"filter-node-method": filterNode,
|
|
6660
|
-
"allow-drop": allowDrop,
|
|
6661
|
-
"show-checkbox": isMultiSelect.value,
|
|
6662
|
-
onNodeClick: clickHandler,
|
|
6663
|
-
onNodeContextmenu: contextmenu,
|
|
6664
|
-
onNodeDragEnd: handleDragEnd,
|
|
6665
|
-
onNodeCollapse: handleCollapse,
|
|
6666
|
-
onNodeExpand: handleExpand,
|
|
6667
|
-
onCheck: checkHandler,
|
|
6668
|
-
onMousedown: toggleClickFlag,
|
|
6669
|
-
onMouseup: toggleClickFlag
|
|
7276
|
+
vue.renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
7277
|
+
vue.createVNode(vue.unref(design.TMagicCollapse), {
|
|
7278
|
+
class: "ui-component-panel",
|
|
7279
|
+
"model-value": collapseValue.value
|
|
6670
7280
|
}, {
|
|
6671
|
-
default: vue.withCtx((
|
|
6672
|
-
vue.
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
7281
|
+
default: vue.withCtx(() => [
|
|
7282
|
+
vue.createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
|
|
7283
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
|
|
7284
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
7285
|
+
group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
|
|
7286
|
+
key: index,
|
|
7287
|
+
name: `${index}`
|
|
7288
|
+
}, {
|
|
7289
|
+
title: vue.withCtx(() => [
|
|
7290
|
+
vue.createVNode(_sfc_main$M, { icon: vue.unref(iconsVue.Grid) }, null, 8, ["icon"]),
|
|
7291
|
+
vue.createTextVNode(vue.toDisplayString(group.title), 1)
|
|
7292
|
+
]),
|
|
7293
|
+
default: vue.withCtx(() => [
|
|
7294
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.items, (item) => {
|
|
7295
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
7296
|
+
class: "component-item",
|
|
7297
|
+
draggable: "true",
|
|
7298
|
+
key: item.type,
|
|
7299
|
+
onClick: ($event) => appendComponent(item),
|
|
7300
|
+
onDragstart: ($event) => dragstartHandler(item, $event),
|
|
7301
|
+
onDragend: dragendHandler,
|
|
7302
|
+
onDrag: dragHandler
|
|
7303
|
+
}, [
|
|
7304
|
+
vue.renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
7305
|
+
vue.createVNode(_sfc_main$M, {
|
|
7306
|
+
title: item.text,
|
|
7307
|
+
icon: item.icon
|
|
7308
|
+
}, null, 8, ["title", "icon"]),
|
|
7309
|
+
vue.createElementVNode("span", {
|
|
7310
|
+
title: item.text
|
|
7311
|
+
}, vue.toDisplayString(item.text), 9, _hoisted_2$7)
|
|
7312
|
+
])
|
|
7313
|
+
], 40, _hoisted_1$9);
|
|
7314
|
+
}), 128))
|
|
7315
|
+
]),
|
|
7316
|
+
_: 2
|
|
7317
|
+
}, 1032, ["name"])) : vue.createCommentVNode("", true)
|
|
7318
|
+
], 64);
|
|
7319
|
+
}), 256))
|
|
6684
7320
|
]),
|
|
6685
7321
|
_: 3
|
|
6686
|
-
}, 8, ["
|
|
6687
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
6688
|
-
vue.createVNode(_sfc_main$h, {
|
|
6689
|
-
ref_key: "menu",
|
|
6690
|
-
ref: menu,
|
|
6691
|
-
"layer-content-menu": _ctx.layerContentMenu,
|
|
6692
|
-
onCollapseAll: collapseAllHandler
|
|
6693
|
-
}, null, 8, ["layer-content-menu"])
|
|
6694
|
-
]))
|
|
7322
|
+
}, 8, ["model-value"])
|
|
6695
7323
|
]),
|
|
6696
7324
|
_: 3
|
|
6697
7325
|
});
|
|
@@ -6728,7 +7356,7 @@
|
|
|
6728
7356
|
type: "component",
|
|
6729
7357
|
icon: iconsVue.Goods,
|
|
6730
7358
|
text: "组件",
|
|
6731
|
-
component: _sfc_main$
|
|
7359
|
+
component: _sfc_main$f,
|
|
6732
7360
|
slots: {}
|
|
6733
7361
|
},
|
|
6734
7362
|
layer: {
|
|
@@ -6739,7 +7367,7 @@
|
|
|
6739
7367
|
props: {
|
|
6740
7368
|
layerContentMenu: props.layerContentMenu
|
|
6741
7369
|
},
|
|
6742
|
-
component: _sfc_main$
|
|
7370
|
+
component: _sfc_main$g,
|
|
6743
7371
|
slots: {}
|
|
6744
7372
|
},
|
|
6745
7373
|
"code-block": {
|
|
@@ -6747,7 +7375,7 @@
|
|
|
6747
7375
|
type: "component",
|
|
6748
7376
|
icon: iconsVue.EditPen,
|
|
6749
7377
|
text: "代码编辑",
|
|
6750
|
-
component: _sfc_main$
|
|
7378
|
+
component: _sfc_main$p,
|
|
6751
7379
|
slots: {}
|
|
6752
7380
|
},
|
|
6753
7381
|
"data-source": {
|
|
@@ -6755,7 +7383,7 @@
|
|
|
6755
7383
|
type: "component",
|
|
6756
7384
|
icon: iconsVue.Coin,
|
|
6757
7385
|
text: "数据源",
|
|
6758
|
-
component: _sfc_main$
|
|
7386
|
+
component: _sfc_main$m,
|
|
6759
7387
|
slots: {}
|
|
6760
7388
|
}
|
|
6761
7389
|
};
|
|
@@ -6780,7 +7408,7 @@
|
|
|
6780
7408
|
key: config.$key ?? index,
|
|
6781
7409
|
onClick: ($event) => activeTabName.value = config.text || `${index}`
|
|
6782
7410
|
}, [
|
|
6783
|
-
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
7411
|
+
config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$M, {
|
|
6784
7412
|
key: 0,
|
|
6785
7413
|
icon: config.icon
|
|
6786
7414
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
@@ -6841,16 +7469,14 @@
|
|
|
6841
7469
|
} : void 0,
|
|
6842
7470
|
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
6843
7471
|
name: "layer-node-content",
|
|
6844
|
-
fn: vue.withCtx(({ data: nodeData
|
|
7472
|
+
fn: vue.withCtx(({ data: nodeData }) => [
|
|
6845
7473
|
config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
6846
7474
|
key: 0,
|
|
6847
|
-
data: nodeData
|
|
6848
|
-
node
|
|
7475
|
+
data: nodeData
|
|
6849
7476
|
}) : config.slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
6850
7477
|
key: 1,
|
|
6851
|
-
data: nodeData
|
|
6852
|
-
|
|
6853
|
-
}, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
|
|
7478
|
+
data: nodeData
|
|
7479
|
+
}, null, 8, ["data"])) : vue.createCommentVNode("", true)
|
|
6854
7480
|
]),
|
|
6855
7481
|
key: "5"
|
|
6856
7482
|
} : void 0
|
|
@@ -7480,7 +8106,7 @@
|
|
|
7480
8106
|
content: _ctx.pinned ? "取消置于顶层自动隐藏" : "置于顶层不消失"
|
|
7481
8107
|
}, {
|
|
7482
8108
|
default: vue.withCtx(() => [
|
|
7483
|
-
vue.createVNode(_sfc_main$
|
|
8109
|
+
vue.createVNode(_sfc_main$M, {
|
|
7484
8110
|
style: { "margin-left": "10px", "cursor": "pointer" },
|
|
7485
8111
|
icon: _ctx.pinned ? _sfc_main$a : _sfc_main$b,
|
|
7486
8112
|
onClick: pinHandler
|
|
@@ -7496,7 +8122,7 @@
|
|
|
7496
8122
|
onClick: closeHandler
|
|
7497
8123
|
}, {
|
|
7498
8124
|
default: vue.withCtx(() => [
|
|
7499
|
-
vue.createVNode(_sfc_main$
|
|
8125
|
+
vue.createVNode(_sfc_main$M, { icon: vue.unref(iconsVue.Close) }, null, 8, ["icon"])
|
|
7500
8126
|
]),
|
|
7501
8127
|
_: 1
|
|
7502
8128
|
})
|
|
@@ -7554,7 +8180,7 @@
|
|
|
7554
8180
|
return;
|
|
7555
8181
|
}
|
|
7556
8182
|
timeout = globalThis.setTimeout(() => {
|
|
7557
|
-
const els = stage2
|
|
8183
|
+
const els = stage2.renderer.getElementsFromPoint(event) || [];
|
|
7558
8184
|
const nodes = utils.getNodes(
|
|
7559
8185
|
els.map((el) => el.id),
|
|
7560
8186
|
page.value?.items
|
|
@@ -7623,7 +8249,7 @@
|
|
|
7623
8249
|
menu.value?.hide();
|
|
7624
8250
|
};
|
|
7625
8251
|
return (_ctx, _cache) => {
|
|
7626
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8252
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
7627
8253
|
ref_key: "menu",
|
|
7628
8254
|
ref: menu,
|
|
7629
8255
|
class: "magic-editor-node-list-menu",
|
|
@@ -7809,7 +8435,7 @@
|
|
|
7809
8435
|
};
|
|
7810
8436
|
__expose({ show });
|
|
7811
8437
|
return (_ctx, _cache) => {
|
|
7812
|
-
return vue.openBlock(), vue.createBlock(_sfc_main$
|
|
8438
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
7813
8439
|
"menu-data": menuData.value,
|
|
7814
8440
|
ref_key: "menu",
|
|
7815
8441
|
ref: menu
|
|
@@ -7904,17 +8530,26 @@
|
|
|
7904
8530
|
services?.editorService.set("stage", null);
|
|
7905
8531
|
services?.keybindingService.unregisteEl("stage");
|
|
7906
8532
|
});
|
|
8533
|
+
const parseDSL = getConfig("parseDSL");
|
|
7907
8534
|
const contextmenuHandler = (e) => {
|
|
7908
8535
|
e.preventDefault();
|
|
7909
8536
|
menu.value?.show(e);
|
|
7910
8537
|
};
|
|
7911
8538
|
const dragoverHandler = (e) => {
|
|
7912
|
-
e.preventDefault();
|
|
7913
8539
|
if (!e.dataTransfer)
|
|
7914
8540
|
return;
|
|
8541
|
+
e.preventDefault();
|
|
7915
8542
|
e.dataTransfer.dropEffect = "move";
|
|
7916
8543
|
};
|
|
7917
8544
|
const dropHandler = async (e) => {
|
|
8545
|
+
if (!e.dataTransfer)
|
|
8546
|
+
return;
|
|
8547
|
+
const data = e.dataTransfer.getData("text/json");
|
|
8548
|
+
if (!data)
|
|
8549
|
+
return;
|
|
8550
|
+
const config = parseDSL(`(${data})`);
|
|
8551
|
+
if (!config || config.dragType !== DragType.COMPONENT_LIST)
|
|
8552
|
+
return;
|
|
7918
8553
|
e.preventDefault();
|
|
7919
8554
|
const doc = stage?.renderer.contentWindow?.document;
|
|
7920
8555
|
const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
|
|
@@ -7922,18 +8557,11 @@
|
|
|
7922
8557
|
if (parentEl) {
|
|
7923
8558
|
parent = services?.editorService.getNodeById(parentEl.id, false);
|
|
7924
8559
|
}
|
|
7925
|
-
if (
|
|
7926
|
-
const parseDSL = getConfig("parseDSL");
|
|
7927
|
-
const data = e.dataTransfer.getData("text/json");
|
|
7928
|
-
if (!data)
|
|
7929
|
-
return;
|
|
7930
|
-
const config = parseDSL(`(${data})`);
|
|
7931
|
-
if (!config)
|
|
7932
|
-
return;
|
|
8560
|
+
if (parent && stageContainer.value && stage) {
|
|
7933
8561
|
const layout = await services?.editorService.getLayout(parent);
|
|
7934
8562
|
const containerRect = stageContainer.value.getBoundingClientRect();
|
|
7935
8563
|
const { scrollTop, scrollLeft } = stage.mask;
|
|
7936
|
-
const { style = {} } = config;
|
|
8564
|
+
const { style = {} } = config.data;
|
|
7937
8565
|
let top = 0;
|
|
7938
8566
|
let left = 0;
|
|
7939
8567
|
let position = "relative";
|
|
@@ -7947,14 +8575,14 @@
|
|
|
7947
8575
|
top = top - StageCore.calcValueByFontsize(doc, parentTop);
|
|
7948
8576
|
}
|
|
7949
8577
|
}
|
|
7950
|
-
config.style = {
|
|
8578
|
+
config.data.style = {
|
|
7951
8579
|
...style,
|
|
7952
8580
|
position,
|
|
7953
8581
|
top: top / zoom.value,
|
|
7954
8582
|
left: left / zoom.value
|
|
7955
8583
|
};
|
|
7956
|
-
config.inputEvent = e;
|
|
7957
|
-
services?.editorService.add(config, parent);
|
|
8584
|
+
config.data.inputEvent = e;
|
|
8585
|
+
services?.editorService.add(config.data, parent);
|
|
7958
8586
|
}
|
|
7959
8587
|
};
|
|
7960
8588
|
return (_ctx, _cache) => {
|
|
@@ -8140,14 +8768,14 @@
|
|
|
8140
8768
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
8141
8769
|
onClick: addPage
|
|
8142
8770
|
}, [
|
|
8143
|
-
vue.createVNode(_sfc_main$
|
|
8771
|
+
vue.createVNode(_sfc_main$M, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
8144
8772
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2)),
|
|
8145
8773
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
8146
8774
|
key: 2,
|
|
8147
8775
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
8148
8776
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
8149
8777
|
}, [
|
|
8150
|
-
vue.createVNode(_sfc_main$
|
|
8778
|
+
vue.createVNode(_sfc_main$M, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
|
|
8151
8779
|
])) : vue.createCommentVNode("", true),
|
|
8152
8780
|
pageLength.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
8153
8781
|
key: 3,
|
|
@@ -8163,7 +8791,7 @@
|
|
|
8163
8791
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
8164
8792
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
8165
8793
|
}, [
|
|
8166
|
-
vue.createVNode(_sfc_main$
|
|
8794
|
+
vue.createVNode(_sfc_main$M, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
|
|
8167
8795
|
])) : vue.createCommentVNode("", true)
|
|
8168
8796
|
], 512);
|
|
8169
8797
|
};
|
|
@@ -8235,7 +8863,7 @@
|
|
|
8235
8863
|
default: vue.withCtx(() => [
|
|
8236
8864
|
vue.createElementVNode("div", null, [
|
|
8237
8865
|
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
8238
|
-
vue.createVNode(_sfc_main$
|
|
8866
|
+
vue.createVNode(_sfc_main$w, {
|
|
8239
8867
|
data: {
|
|
8240
8868
|
type: "button",
|
|
8241
8869
|
text: "复制",
|
|
@@ -8243,7 +8871,7 @@
|
|
|
8243
8871
|
handler: () => copy(item)
|
|
8244
8872
|
}
|
|
8245
8873
|
}, null, 8, ["data"]),
|
|
8246
|
-
vue.createVNode(_sfc_main$
|
|
8874
|
+
vue.createVNode(_sfc_main$w, {
|
|
8247
8875
|
data: {
|
|
8248
8876
|
type: "button",
|
|
8249
8877
|
text: "删除",
|
|
@@ -9084,119 +9712,23 @@
|
|
|
9084
9712
|
}
|
|
9085
9713
|
];
|
|
9086
9714
|
|
|
9087
|
-
const
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
},
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
}
|
|
9104
|
-
/** 左侧面板配置 */
|
|
9105
|
-
sidebar: {
|
|
9106
|
-
type: Object
|
|
9107
|
-
},
|
|
9108
|
-
/** 顶部工具栏配置 */
|
|
9109
|
-
menu: {
|
|
9110
|
-
type: Object,
|
|
9111
|
-
default: () => ({ left: [], right: [] })
|
|
9112
|
-
},
|
|
9113
|
-
/** 组件树右键菜单 */
|
|
9114
|
-
layerContentMenu: {
|
|
9115
|
-
type: Array,
|
|
9116
|
-
default: () => []
|
|
9117
|
-
},
|
|
9118
|
-
/** 画布右键菜单 */
|
|
9119
|
-
stageContentMenu: {
|
|
9120
|
-
type: Array,
|
|
9121
|
-
default: () => []
|
|
9122
|
-
},
|
|
9123
|
-
/** 中间工作区域中画布渲染的内容 */
|
|
9124
|
-
render: {
|
|
9125
|
-
type: Function
|
|
9126
|
-
},
|
|
9127
|
-
/** 中间工作区域中画布通过iframe渲染时的页面url */
|
|
9128
|
-
runtimeUrl: String,
|
|
9129
|
-
/** 选中时是否自动滚动到可视区域 */
|
|
9130
|
-
autoScrollIntoView: Boolean,
|
|
9131
|
-
/** 组件的属性配置表单的dsl */
|
|
9132
|
-
propsConfigs: {
|
|
9133
|
-
type: Object,
|
|
9134
|
-
default: () => ({})
|
|
9135
|
-
},
|
|
9136
|
-
/** 添加组件时的默认值 */
|
|
9137
|
-
propsValues: {
|
|
9138
|
-
type: Object,
|
|
9139
|
-
default: () => ({})
|
|
9140
|
-
},
|
|
9141
|
-
/** 组件联动事件选项列表 */
|
|
9142
|
-
eventMethodList: {
|
|
9143
|
-
type: Object,
|
|
9144
|
-
default: () => ({})
|
|
9145
|
-
},
|
|
9146
|
-
/** 添加数据源时的默认值 */
|
|
9147
|
-
datasourceValues: {
|
|
9148
|
-
type: Object,
|
|
9149
|
-
default: () => ({})
|
|
9150
|
-
},
|
|
9151
|
-
/** 数据源的属性配置表单的dsl */
|
|
9152
|
-
datasourceConfigs: {
|
|
9153
|
-
type: Object,
|
|
9154
|
-
default: () => ({})
|
|
9155
|
-
},
|
|
9156
|
-
/** 画布中组件选中框的移动范围 */
|
|
9157
|
-
moveableOptions: {
|
|
9158
|
-
type: [Object, Function]
|
|
9159
|
-
},
|
|
9160
|
-
/** 编辑器初始化时默认选中的组件ID */
|
|
9161
|
-
defaultSelected: {
|
|
9162
|
-
type: [Number, String]
|
|
9163
|
-
},
|
|
9164
|
-
canSelect: {
|
|
9165
|
-
type: Function,
|
|
9166
|
-
default: (el) => Boolean(el.id)
|
|
9167
|
-
},
|
|
9168
|
-
isContainer: {
|
|
9169
|
-
type: Function,
|
|
9170
|
-
default: (el) => el.classList.contains("magic-ui-container")
|
|
9171
|
-
},
|
|
9172
|
-
containerHighlightClassName: {
|
|
9173
|
-
type: String,
|
|
9174
|
-
default: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME
|
|
9175
|
-
},
|
|
9176
|
-
containerHighlightDuration: {
|
|
9177
|
-
type: Number,
|
|
9178
|
-
default: 800
|
|
9179
|
-
},
|
|
9180
|
-
containerHighlightType: {
|
|
9181
|
-
type: String,
|
|
9182
|
-
default: StageCore.ContainerHighlightType.DEFAULT
|
|
9183
|
-
},
|
|
9184
|
-
stageRect: {
|
|
9185
|
-
type: [String, Object]
|
|
9186
|
-
},
|
|
9187
|
-
codeOptions: {
|
|
9188
|
-
type: Object,
|
|
9189
|
-
default: () => ({})
|
|
9190
|
-
},
|
|
9191
|
-
updateDragEl: {
|
|
9192
|
-
type: Function
|
|
9193
|
-
},
|
|
9194
|
-
disabledDragStart: {
|
|
9195
|
-
type: Boolean
|
|
9196
|
-
},
|
|
9197
|
-
extendFormState: {
|
|
9198
|
-
type: Function
|
|
9199
|
-
}
|
|
9715
|
+
const defaultEditorProps = {
|
|
9716
|
+
componentGroupList: () => [],
|
|
9717
|
+
datasourceList: () => [],
|
|
9718
|
+
menu: () => ({ left: [], right: [] }),
|
|
9719
|
+
layerContentMenu: () => [],
|
|
9720
|
+
stageContentMenu: () => [],
|
|
9721
|
+
propsConfigs: () => ({}),
|
|
9722
|
+
propsValues: () => ({}),
|
|
9723
|
+
eventMethodList: () => ({}),
|
|
9724
|
+
datasourceValues: () => ({}),
|
|
9725
|
+
datasourceConfigs: () => ({}),
|
|
9726
|
+
canSelect: (el) => Boolean(el.id),
|
|
9727
|
+
isContainer: (el) => el.classList.contains("magic-ui-container"),
|
|
9728
|
+
containerHighlightClassName: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME,
|
|
9729
|
+
containerHighlightDuration: 800,
|
|
9730
|
+
containerHighlightType: StageCore.ContainerHighlightType.DEFAULT,
|
|
9731
|
+
codeOptions: () => ({})
|
|
9200
9732
|
};
|
|
9201
9733
|
|
|
9202
9734
|
const createCodeBlockTarget = (id, codeBlock) => new Target({
|
|
@@ -9217,20 +9749,26 @@
|
|
|
9217
9749
|
const createDataSourceTarget = (id) => new Target({
|
|
9218
9750
|
type: DepTargetType.DATA_SOURCE,
|
|
9219
9751
|
id,
|
|
9220
|
-
isTarget: (key, value) =>
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9752
|
+
isTarget: (key, value) => {
|
|
9753
|
+
if (value?.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)) {
|
|
9754
|
+
return true;
|
|
9755
|
+
}
|
|
9756
|
+
if (!Array.isArray(value) || typeof value[0] !== "string") {
|
|
9757
|
+
return false;
|
|
9758
|
+
}
|
|
9759
|
+
const [prefixId] = value;
|
|
9760
|
+
const prefixIndex = prefixId.indexOf(utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX);
|
|
9761
|
+
if (prefixIndex === -1) {
|
|
9762
|
+
return false;
|
|
9763
|
+
}
|
|
9764
|
+
const dsId = prefixId.substring(prefixIndex + utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX.length);
|
|
9765
|
+
return dsId === id && Boolean(dataSourceService.getDataSourceById(id));
|
|
9766
|
+
}
|
|
9224
9767
|
});
|
|
9225
9768
|
const createDataSourceCondTarget = (id) => new Target({
|
|
9226
9769
|
type: DepTargetType.DATA_SOURCE_COND,
|
|
9227
9770
|
id,
|
|
9228
|
-
isTarget: (key, value) =>
|
|
9229
|
-
if (!Array.isArray(value) || value[0] !== id)
|
|
9230
|
-
return false;
|
|
9231
|
-
const ds = dataSourceService.getDataSourceById(id);
|
|
9232
|
-
return Boolean(ds?.fields?.find((field) => field.name === value[1]));
|
|
9233
|
-
}
|
|
9771
|
+
isTarget: (key, value) => Array.isArray(value) && value[0] === id && Boolean(dataSourceService.getDataSourceById(id))
|
|
9234
9772
|
});
|
|
9235
9773
|
const createDataSourceMethodTarget = (id) => new Target({
|
|
9236
9774
|
type: DepTargetType.DATA_SOURCE_METHOD,
|
|
@@ -9257,7 +9795,7 @@
|
|
|
9257
9795
|
vue.watch(
|
|
9258
9796
|
() => props.modelValue,
|
|
9259
9797
|
(modelValue) => {
|
|
9260
|
-
editorService.set("root", modelValue);
|
|
9798
|
+
editorService.set("root", modelValue || null);
|
|
9261
9799
|
},
|
|
9262
9800
|
{
|
|
9263
9801
|
immediate: true
|
|
@@ -9265,28 +9803,28 @@
|
|
|
9265
9803
|
);
|
|
9266
9804
|
vue.watch(
|
|
9267
9805
|
() => props.componentGroupList,
|
|
9268
|
-
(componentGroupList) => componentListService.setList(componentGroupList),
|
|
9806
|
+
(componentGroupList) => componentGroupList && componentListService.setList(componentGroupList),
|
|
9269
9807
|
{
|
|
9270
9808
|
immediate: true
|
|
9271
9809
|
}
|
|
9272
9810
|
);
|
|
9273
9811
|
vue.watch(
|
|
9274
9812
|
() => props.datasourceList,
|
|
9275
|
-
(datasourceList) => dataSourceService.set("datasourceTypeList", datasourceList),
|
|
9813
|
+
(datasourceList) => datasourceList && dataSourceService.set("datasourceTypeList", datasourceList),
|
|
9276
9814
|
{
|
|
9277
9815
|
immediate: true
|
|
9278
9816
|
}
|
|
9279
9817
|
);
|
|
9280
9818
|
vue.watch(
|
|
9281
9819
|
() => props.propsConfigs,
|
|
9282
|
-
(configs) => propsService.setPropsConfigs(configs),
|
|
9820
|
+
(configs) => configs && propsService.setPropsConfigs(configs),
|
|
9283
9821
|
{
|
|
9284
9822
|
immediate: true
|
|
9285
9823
|
}
|
|
9286
9824
|
);
|
|
9287
9825
|
vue.watch(
|
|
9288
9826
|
() => props.propsValues,
|
|
9289
|
-
(values) => propsService.setPropsValues(values),
|
|
9827
|
+
(values) => values && propsService.setPropsValues(values),
|
|
9290
9828
|
{
|
|
9291
9829
|
immediate: true
|
|
9292
9830
|
}
|
|
@@ -9296,7 +9834,7 @@
|
|
|
9296
9834
|
(eventMethodList) => {
|
|
9297
9835
|
const eventsList = {};
|
|
9298
9836
|
const methodsList = {};
|
|
9299
|
-
Object.keys(eventMethodList).forEach((type) => {
|
|
9837
|
+
eventMethodList && Object.keys(eventMethodList).forEach((type) => {
|
|
9300
9838
|
eventsList[type] = eventMethodList[type].events;
|
|
9301
9839
|
methodsList[type] = eventMethodList[type].methods;
|
|
9302
9840
|
});
|
|
@@ -9310,7 +9848,7 @@
|
|
|
9310
9848
|
vue.watch(
|
|
9311
9849
|
() => props.datasourceConfigs,
|
|
9312
9850
|
(configs) => {
|
|
9313
|
-
Object.entries(configs).forEach(([key, value]) => {
|
|
9851
|
+
configs && Object.entries(configs).forEach(([key, value]) => {
|
|
9314
9852
|
dataSourceService.setFormConfig(key, value);
|
|
9315
9853
|
});
|
|
9316
9854
|
},
|
|
@@ -9321,7 +9859,7 @@
|
|
|
9321
9859
|
vue.watch(
|
|
9322
9860
|
() => props.datasourceValues,
|
|
9323
9861
|
(values) => {
|
|
9324
|
-
Object.entries(values).forEach(([key, value]) => {
|
|
9862
|
+
values && Object.entries(values).forEach(([key, value]) => {
|
|
9325
9863
|
dataSourceService.setFormValue(key, value);
|
|
9326
9864
|
});
|
|
9327
9865
|
},
|
|
@@ -9329,6 +9867,26 @@
|
|
|
9329
9867
|
immediate: true
|
|
9330
9868
|
}
|
|
9331
9869
|
);
|
|
9870
|
+
vue.watch(
|
|
9871
|
+
() => props.datasourceEventMethodList,
|
|
9872
|
+
(eventMethodList) => {
|
|
9873
|
+
const eventsList = {};
|
|
9874
|
+
const methodsList = {};
|
|
9875
|
+
eventMethodList && Object.keys(eventMethodList).forEach((type) => {
|
|
9876
|
+
eventsList[type] = eventMethodList[type].events;
|
|
9877
|
+
methodsList[type] = eventMethodList[type].methods;
|
|
9878
|
+
});
|
|
9879
|
+
Object.entries(eventsList).forEach(([key, value]) => {
|
|
9880
|
+
dataSourceService.setFormEvent(key, value);
|
|
9881
|
+
});
|
|
9882
|
+
Object.entries(methodsList).forEach(([key, value]) => {
|
|
9883
|
+
dataSourceService.setFormMethod(key, value);
|
|
9884
|
+
});
|
|
9885
|
+
},
|
|
9886
|
+
{
|
|
9887
|
+
immediate: true
|
|
9888
|
+
}
|
|
9889
|
+
);
|
|
9332
9890
|
vue.watch(
|
|
9333
9891
|
() => props.defaultSelected,
|
|
9334
9892
|
(defaultSelected) => defaultSelected && editorService.select(defaultSelected),
|
|
@@ -9450,6 +10008,8 @@
|
|
|
9450
10008
|
if (vue.toRaw(value) !== vue.toRaw(preValue)) {
|
|
9451
10009
|
emit("update:modelValue", value);
|
|
9452
10010
|
}
|
|
10011
|
+
if (!value)
|
|
10012
|
+
return;
|
|
9453
10013
|
value.codeBlocks = value.codeBlocks || {};
|
|
9454
10014
|
value.dataSources = value.dataSources || [];
|
|
9455
10015
|
codeBlockService.setCodeDsl(value.codeBlocks);
|
|
@@ -9532,18 +10092,44 @@
|
|
|
9532
10092
|
});
|
|
9533
10093
|
};
|
|
9534
10094
|
|
|
9535
|
-
const _sfc_main = vue.defineComponent({
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
10095
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
10096
|
+
...{
|
|
10097
|
+
name: "MEditor"
|
|
10098
|
+
},
|
|
10099
|
+
__name: "Editor",
|
|
10100
|
+
props: vue.mergeDefaults({
|
|
10101
|
+
modelValue: {},
|
|
10102
|
+
componentGroupList: {},
|
|
10103
|
+
datasourceList: {},
|
|
10104
|
+
sidebar: {},
|
|
10105
|
+
menu: {},
|
|
10106
|
+
layerContentMenu: {},
|
|
10107
|
+
stageContentMenu: {},
|
|
10108
|
+
render: { type: Function },
|
|
10109
|
+
runtimeUrl: {},
|
|
10110
|
+
autoScrollIntoView: { type: Boolean },
|
|
10111
|
+
propsConfigs: {},
|
|
10112
|
+
propsValues: {},
|
|
10113
|
+
eventMethodList: {},
|
|
10114
|
+
datasourceValues: {},
|
|
10115
|
+
datasourceConfigs: {},
|
|
10116
|
+
datasourceEventMethodList: {},
|
|
10117
|
+
moveableOptions: { type: Function },
|
|
10118
|
+
defaultSelected: {},
|
|
10119
|
+
canSelect: { type: Function },
|
|
10120
|
+
isContainer: { type: Function },
|
|
10121
|
+
containerHighlightClassName: {},
|
|
10122
|
+
containerHighlightDuration: {},
|
|
10123
|
+
containerHighlightType: {},
|
|
10124
|
+
stageRect: {},
|
|
10125
|
+
codeOptions: {},
|
|
10126
|
+
updateDragEl: { type: Function },
|
|
10127
|
+
disabledDragStart: { type: Boolean },
|
|
10128
|
+
extendFormState: { type: Function }
|
|
10129
|
+
}, defaultEditorProps),
|
|
9545
10130
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
9546
|
-
setup(
|
|
10131
|
+
setup(__props, { expose: __expose, emit }) {
|
|
10132
|
+
const props = __props;
|
|
9547
10133
|
const services = {
|
|
9548
10134
|
componentListService,
|
|
9549
10135
|
eventsService,
|
|
@@ -9579,119 +10165,101 @@
|
|
|
9579
10165
|
disabledDragStart: props.disabledDragStart
|
|
9580
10166
|
})
|
|
9581
10167
|
);
|
|
9582
|
-
|
|
10168
|
+
__expose(services);
|
|
10169
|
+
return (_ctx, _cache) => {
|
|
10170
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$x, null, {
|
|
10171
|
+
header: vue.withCtx(() => [
|
|
10172
|
+
vue.renderSlot(_ctx.$slots, "header")
|
|
10173
|
+
]),
|
|
10174
|
+
nav: vue.withCtx(() => [
|
|
10175
|
+
vue.renderSlot(_ctx.$slots, "nav", { editorService: vue.unref(editorService) }, () => [
|
|
10176
|
+
vue.createVNode(_sfc_main$v, { data: _ctx.menu }, null, 8, ["data"])
|
|
10177
|
+
])
|
|
10178
|
+
]),
|
|
10179
|
+
"content-before": vue.withCtx(() => [
|
|
10180
|
+
vue.renderSlot(_ctx.$slots, "content-before")
|
|
10181
|
+
]),
|
|
10182
|
+
"src-code": vue.withCtx(() => [
|
|
10183
|
+
vue.renderSlot(_ctx.$slots, "src-code", { editorService: vue.unref(editorService) })
|
|
10184
|
+
]),
|
|
10185
|
+
sidebar: vue.withCtx(() => [
|
|
10186
|
+
vue.renderSlot(_ctx.$slots, "sidebar", { editorService: vue.unref(editorService) }, () => [
|
|
10187
|
+
vue.createVNode(_sfc_main$e, {
|
|
10188
|
+
data: _ctx.sidebar,
|
|
10189
|
+
"layer-content-menu": _ctx.layerContentMenu
|
|
10190
|
+
}, {
|
|
10191
|
+
"layer-panel-header": vue.withCtx(() => [
|
|
10192
|
+
vue.renderSlot(_ctx.$slots, "layer-panel-header")
|
|
10193
|
+
]),
|
|
10194
|
+
"layer-node-content": vue.withCtx(({ data }) => [
|
|
10195
|
+
vue.renderSlot(_ctx.$slots, "layer-node-content", { data })
|
|
10196
|
+
]),
|
|
10197
|
+
"component-list-panel-header": vue.withCtx(() => [
|
|
10198
|
+
vue.renderSlot(_ctx.$slots, "component-list-panel-header")
|
|
10199
|
+
]),
|
|
10200
|
+
"component-list-item": vue.withCtx(({ component }) => [
|
|
10201
|
+
vue.renderSlot(_ctx.$slots, "component-list-item", { component })
|
|
10202
|
+
]),
|
|
10203
|
+
"code-block-panel-header": vue.withCtx(() => [
|
|
10204
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-header")
|
|
10205
|
+
]),
|
|
10206
|
+
"code-block-panel-tool": vue.withCtx(({ id, data }) => [
|
|
10207
|
+
vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
10208
|
+
id,
|
|
10209
|
+
data
|
|
10210
|
+
})
|
|
10211
|
+
]),
|
|
10212
|
+
_: 3
|
|
10213
|
+
}, 8, ["data", "layer-content-menu"])
|
|
10214
|
+
])
|
|
10215
|
+
]),
|
|
10216
|
+
workspace: vue.withCtx(() => [
|
|
10217
|
+
vue.renderSlot(_ctx.$slots, "workspace", { editorService: vue.unref(editorService) }, () => [
|
|
10218
|
+
vue.createVNode(_sfc_main$1, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
10219
|
+
stage: vue.withCtx(() => [
|
|
10220
|
+
vue.renderSlot(_ctx.$slots, "stage")
|
|
10221
|
+
]),
|
|
10222
|
+
"workspace-content": vue.withCtx(() => [
|
|
10223
|
+
vue.renderSlot(_ctx.$slots, "workspace-content", { editorService: vue.unref(editorService) })
|
|
10224
|
+
]),
|
|
10225
|
+
"page-bar-title": vue.withCtx(({ page }) => [
|
|
10226
|
+
vue.renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
10227
|
+
]),
|
|
10228
|
+
"page-bar-popover": vue.withCtx(({ page }) => [
|
|
10229
|
+
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
10230
|
+
]),
|
|
10231
|
+
_: 3
|
|
10232
|
+
}, 8, ["stage-content-menu"])
|
|
10233
|
+
])
|
|
10234
|
+
]),
|
|
10235
|
+
"props-panel": vue.withCtx(() => [
|
|
10236
|
+
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
10237
|
+
vue.createVNode(_sfc_main$u, {
|
|
10238
|
+
"extend-state": _ctx.extendFormState,
|
|
10239
|
+
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
10240
|
+
}, {
|
|
10241
|
+
"props-panel-header": vue.withCtx(() => [
|
|
10242
|
+
vue.renderSlot(_ctx.$slots, "props-panel-header")
|
|
10243
|
+
]),
|
|
10244
|
+
_: 3
|
|
10245
|
+
}, 8, ["extend-state"])
|
|
10246
|
+
])
|
|
10247
|
+
]),
|
|
10248
|
+
empty: vue.withCtx(() => [
|
|
10249
|
+
vue.renderSlot(_ctx.$slots, "empty", { editorService: vue.unref(editorService) })
|
|
10250
|
+
]),
|
|
10251
|
+
"content-after": vue.withCtx(() => [
|
|
10252
|
+
vue.renderSlot(_ctx.$slots, "content-after")
|
|
10253
|
+
]),
|
|
10254
|
+
footer: vue.withCtx(() => [
|
|
10255
|
+
vue.renderSlot(_ctx.$slots, "footer")
|
|
10256
|
+
]),
|
|
10257
|
+
_: 3
|
|
10258
|
+
});
|
|
10259
|
+
};
|
|
9583
10260
|
}
|
|
9584
10261
|
});
|
|
9585
10262
|
|
|
9586
|
-
const _export_sfc = (sfc, props) => {
|
|
9587
|
-
const target = sfc.__vccOpts || sfc;
|
|
9588
|
-
for (const [key, val] of props) {
|
|
9589
|
-
target[key] = val;
|
|
9590
|
-
}
|
|
9591
|
-
return target;
|
|
9592
|
-
};
|
|
9593
|
-
|
|
9594
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
9595
|
-
const _component_TMagicNavMenu = vue.resolveComponent("TMagicNavMenu");
|
|
9596
|
-
const _component_Sidebar = vue.resolveComponent("Sidebar");
|
|
9597
|
-
const _component_Workspace = vue.resolveComponent("Workspace");
|
|
9598
|
-
const _component_PropsPanel = vue.resolveComponent("PropsPanel");
|
|
9599
|
-
const _component_Framework = vue.resolveComponent("Framework");
|
|
9600
|
-
return vue.openBlock(), vue.createBlock(_component_Framework, null, {
|
|
9601
|
-
header: vue.withCtx(() => [
|
|
9602
|
-
vue.renderSlot(_ctx.$slots, "header")
|
|
9603
|
-
]),
|
|
9604
|
-
nav: vue.withCtx(() => [
|
|
9605
|
-
vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
9606
|
-
vue.createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
9607
|
-
])
|
|
9608
|
-
]),
|
|
9609
|
-
"content-before": vue.withCtx(() => [
|
|
9610
|
-
vue.renderSlot(_ctx.$slots, "content-before")
|
|
9611
|
-
]),
|
|
9612
|
-
"src-code": vue.withCtx(() => [
|
|
9613
|
-
vue.renderSlot(_ctx.$slots, "src-code", { editorService: _ctx.editorService })
|
|
9614
|
-
]),
|
|
9615
|
-
sidebar: vue.withCtx(() => [
|
|
9616
|
-
vue.renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
9617
|
-
vue.createVNode(_component_Sidebar, {
|
|
9618
|
-
data: _ctx.sidebar,
|
|
9619
|
-
"layer-content-menu": _ctx.layerContentMenu
|
|
9620
|
-
}, {
|
|
9621
|
-
"layer-panel-header": vue.withCtx(() => [
|
|
9622
|
-
vue.renderSlot(_ctx.$slots, "layer-panel-header")
|
|
9623
|
-
]),
|
|
9624
|
-
"layer-node-content": vue.withCtx(({ node, data }) => [
|
|
9625
|
-
vue.renderSlot(_ctx.$slots, "layer-node-content", {
|
|
9626
|
-
data,
|
|
9627
|
-
node
|
|
9628
|
-
})
|
|
9629
|
-
]),
|
|
9630
|
-
"component-list-panel-header": vue.withCtx(() => [
|
|
9631
|
-
vue.renderSlot(_ctx.$slots, "component-list-panel-header")
|
|
9632
|
-
]),
|
|
9633
|
-
"component-list-item": vue.withCtx(({ component }) => [
|
|
9634
|
-
vue.renderSlot(_ctx.$slots, "component-list-item", { component })
|
|
9635
|
-
]),
|
|
9636
|
-
"code-block-panel-header": vue.withCtx(() => [
|
|
9637
|
-
vue.renderSlot(_ctx.$slots, "code-block-panel-header")
|
|
9638
|
-
]),
|
|
9639
|
-
"code-block-panel-tool": vue.withCtx(({ id, data }) => [
|
|
9640
|
-
vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
9641
|
-
id,
|
|
9642
|
-
data
|
|
9643
|
-
})
|
|
9644
|
-
]),
|
|
9645
|
-
_: 3
|
|
9646
|
-
}, 8, ["data", "layer-content-menu"])
|
|
9647
|
-
])
|
|
9648
|
-
]),
|
|
9649
|
-
workspace: vue.withCtx(() => [
|
|
9650
|
-
vue.renderSlot(_ctx.$slots, "workspace", { editorService: _ctx.editorService }, () => [
|
|
9651
|
-
vue.createVNode(_component_Workspace, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
9652
|
-
stage: vue.withCtx(() => [
|
|
9653
|
-
vue.renderSlot(_ctx.$slots, "stage")
|
|
9654
|
-
]),
|
|
9655
|
-
"workspace-content": vue.withCtx(() => [
|
|
9656
|
-
vue.renderSlot(_ctx.$slots, "workspace-content", { editorService: _ctx.editorService })
|
|
9657
|
-
]),
|
|
9658
|
-
"page-bar-title": vue.withCtx(({ page }) => [
|
|
9659
|
-
vue.renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
9660
|
-
]),
|
|
9661
|
-
"page-bar-popover": vue.withCtx(({ page }) => [
|
|
9662
|
-
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
9663
|
-
]),
|
|
9664
|
-
_: 3
|
|
9665
|
-
}, 8, ["stage-content-menu"])
|
|
9666
|
-
])
|
|
9667
|
-
]),
|
|
9668
|
-
"props-panel": vue.withCtx(() => [
|
|
9669
|
-
vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
9670
|
-
vue.createVNode(_component_PropsPanel, {
|
|
9671
|
-
"extend-state": _ctx.extendFormState,
|
|
9672
|
-
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
9673
|
-
}, {
|
|
9674
|
-
"props-panel-header": vue.withCtx(() => [
|
|
9675
|
-
vue.renderSlot(_ctx.$slots, "props-panel-header")
|
|
9676
|
-
]),
|
|
9677
|
-
_: 3
|
|
9678
|
-
}, 8, ["extend-state"])
|
|
9679
|
-
])
|
|
9680
|
-
]),
|
|
9681
|
-
empty: vue.withCtx(() => [
|
|
9682
|
-
vue.renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
|
|
9683
|
-
]),
|
|
9684
|
-
"content-after": vue.withCtx(() => [
|
|
9685
|
-
vue.renderSlot(_ctx.$slots, "content-after")
|
|
9686
|
-
]),
|
|
9687
|
-
footer: vue.withCtx(() => [
|
|
9688
|
-
vue.renderSlot(_ctx.$slots, "footer")
|
|
9689
|
-
]),
|
|
9690
|
-
_: 3
|
|
9691
|
-
});
|
|
9692
|
-
}
|
|
9693
|
-
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
9694
|
-
|
|
9695
10263
|
const index$1 = '';
|
|
9696
10264
|
|
|
9697
10265
|
const defaultInstallOpt = {
|
|
@@ -9703,59 +10271,62 @@
|
|
|
9703
10271
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
9704
10272
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
9705
10273
|
setConfig(option);
|
|
9706
|
-
app.component(
|
|
9707
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
9708
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
9709
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
9710
|
-
app.component("magic-code-editor", _sfc_main$
|
|
9711
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
9712
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
9713
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
9714
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
9715
|
-
app.component("m-fields-
|
|
9716
|
-
app.component("m-fields-
|
|
9717
|
-
app.component("m-fields-data-source-
|
|
9718
|
-
app.component("m-fields-data-source-
|
|
9719
|
-
app.component("m-fields-data-source-
|
|
9720
|
-
app.component("m-fields-data-source-
|
|
10274
|
+
app.component(_sfc_main.name, _sfc_main);
|
|
10275
|
+
app.component("m-fields-ui-select", _sfc_main$B);
|
|
10276
|
+
app.component("m-fields-code-link", _sfc_main$Q);
|
|
10277
|
+
app.component("m-fields-vs-code", _sfc_main$R);
|
|
10278
|
+
app.component("magic-code-editor", _sfc_main$S);
|
|
10279
|
+
app.component("m-fields-code-select", _sfc_main$P);
|
|
10280
|
+
app.component("m-fields-code-select-col", _sfc_main$L);
|
|
10281
|
+
app.component("m-fields-event-select", _sfc_main$D);
|
|
10282
|
+
app.component("m-fields-data-source-fields", _sfc_main$K);
|
|
10283
|
+
app.component("m-fields-data-source-mocks", _sfc_main$F);
|
|
10284
|
+
app.component("m-fields-key-value", _sfc_main$C);
|
|
10285
|
+
app.component("m-fields-data-source-input", _sfc_main$I);
|
|
10286
|
+
app.component("m-fields-data-source-select", _sfc_main$E);
|
|
10287
|
+
app.component("m-fields-data-source-methods", _sfc_main$H);
|
|
10288
|
+
app.component("m-fields-data-source-method-select", _sfc_main$G);
|
|
10289
|
+
app.component("m-fields-data-source-field-select", _sfc_main$J);
|
|
9721
10290
|
}
|
|
9722
10291
|
};
|
|
9723
10292
|
|
|
9724
10293
|
exports.CODE_DRAFT_STORAGE_KEY = CODE_DRAFT_STORAGE_KEY;
|
|
9725
10294
|
exports.COPY_STORAGE_KEY = COPY_STORAGE_KEY;
|
|
9726
|
-
exports.CodeBlockEditor = _sfc_main$
|
|
9727
|
-
exports.CodeBlockList = _sfc_main$
|
|
9728
|
-
exports.CodeBlockListPanel = _sfc_main$
|
|
10295
|
+
exports.CodeBlockEditor = _sfc_main$O;
|
|
10296
|
+
exports.CodeBlockList = _sfc_main$q;
|
|
10297
|
+
exports.CodeBlockListPanel = _sfc_main$p;
|
|
9729
10298
|
exports.CodeDeleteErrorType = CodeDeleteErrorType;
|
|
9730
|
-
exports.CodeSelect = _sfc_main$
|
|
9731
|
-
exports.CodeSelectCol = _sfc_main$
|
|
10299
|
+
exports.CodeSelect = _sfc_main$P;
|
|
10300
|
+
exports.CodeSelectCol = _sfc_main$L;
|
|
9732
10301
|
exports.ColumnLayout = ColumnLayout;
|
|
9733
|
-
exports.ComponentListPanel = _sfc_main$
|
|
9734
|
-
exports.ContentMenu = _sfc_main$
|
|
9735
|
-
exports.DataSourceFieldSelect = _sfc_main$
|
|
9736
|
-
exports.DataSourceFields = _sfc_main$
|
|
9737
|
-
exports.DataSourceInput = _sfc_main$
|
|
9738
|
-
exports.DataSourceMethodSelect = _sfc_main$
|
|
9739
|
-
exports.DataSourceMethods = _sfc_main$
|
|
9740
|
-
exports.
|
|
10302
|
+
exports.ComponentListPanel = _sfc_main$f;
|
|
10303
|
+
exports.ContentMenu = _sfc_main$l;
|
|
10304
|
+
exports.DataSourceFieldSelect = _sfc_main$J;
|
|
10305
|
+
exports.DataSourceFields = _sfc_main$K;
|
|
10306
|
+
exports.DataSourceInput = _sfc_main$I;
|
|
10307
|
+
exports.DataSourceMethodSelect = _sfc_main$G;
|
|
10308
|
+
exports.DataSourceMethods = _sfc_main$H;
|
|
10309
|
+
exports.DataSourceMocks = _sfc_main$F;
|
|
10310
|
+
exports.DataSourceSelect = _sfc_main$E;
|
|
9741
10311
|
exports.DepTargetType = DepTargetType;
|
|
9742
|
-
exports.
|
|
10312
|
+
exports.DragType = DragType;
|
|
10313
|
+
exports.EventSelect = _sfc_main$D;
|
|
9743
10314
|
exports.Fixed2Other = Fixed2Other;
|
|
9744
10315
|
exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
|
|
9745
|
-
exports.Icon = _sfc_main$
|
|
10316
|
+
exports.Icon = _sfc_main$M;
|
|
9746
10317
|
exports.KeyBindingCommand = KeyBindingCommand;
|
|
9747
|
-
exports.KeyValue = _sfc_main$
|
|
10318
|
+
exports.KeyValue = _sfc_main$C;
|
|
9748
10319
|
exports.Keys = Keys;
|
|
9749
10320
|
exports.LayerOffset = LayerOffset;
|
|
9750
|
-
exports.LayerPanel = _sfc_main$
|
|
10321
|
+
exports.LayerPanel = _sfc_main$g;
|
|
9751
10322
|
exports.Layout = Layout;
|
|
9752
|
-
exports.LayoutContainer = _sfc_main$
|
|
9753
|
-
exports.PropsPanel = _sfc_main$
|
|
9754
|
-
exports.Resizer = _sfc_main$
|
|
9755
|
-
exports.SplitView = _sfc_main$
|
|
9756
|
-
exports.TMagicCodeEditor = _sfc_main$
|
|
9757
|
-
exports.TMagicEditor =
|
|
9758
|
-
exports.ToolButton = _sfc_main$
|
|
10323
|
+
exports.LayoutContainer = _sfc_main$z;
|
|
10324
|
+
exports.PropsPanel = _sfc_main$u;
|
|
10325
|
+
exports.Resizer = _sfc_main$A;
|
|
10326
|
+
exports.SplitView = _sfc_main$z;
|
|
10327
|
+
exports.TMagicCodeEditor = _sfc_main$S;
|
|
10328
|
+
exports.TMagicEditor = _sfc_main;
|
|
10329
|
+
exports.ToolButton = _sfc_main$w;
|
|
9759
10330
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
9760
10331
|
exports.advancedTabConfig = advancedTabConfig;
|
|
9761
10332
|
exports.beforePaste = beforePaste;
|
|
@@ -9797,6 +10368,7 @@
|
|
|
9797
10368
|
exports.setLayout = setLayout;
|
|
9798
10369
|
exports.storageService = storageService;
|
|
9799
10370
|
exports.styleTabConfig = styleTabConfig;
|
|
10371
|
+
exports.traverseNode = traverseNode;
|
|
9800
10372
|
exports.uiService = uiService;
|
|
9801
10373
|
exports.useCodeBlockEdit = useCodeBlockEdit;
|
|
9802
10374
|
exports.useDataSourceMethod = useDataSourceMethod;
|