@tmagic/editor 1.3.4 → 1.3.6
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 +73 -51
- package/dist/tmagic-editor.js +1171 -1102
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +1188 -1119
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +17 -17
- package/src/Editor.vue +5 -0
- package/src/components/FloatingBox.vue +117 -0
- package/src/components/Tree.vue +5 -0
- package/src/components/TreeNode.vue +8 -2
- package/src/editorProps.ts +7 -0
- package/src/hooks/use-filter.ts +55 -0
- package/src/hooks/use-node-status.ts +48 -0
- package/src/hooks/use-stage.ts +1 -0
- package/src/initService.ts +28 -12
- package/src/layouts/sidebar/Sidebar.vue +7 -2
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +55 -65
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +2 -1
- package/src/layouts/sidebar/data-source/DataSourceList.vue +63 -59
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +1 -1
- package/src/layouts/sidebar/layer/LayerPanel.vue +24 -7
- package/src/layouts/sidebar/layer/use-node-status.ts +8 -11
- package/src/layouts/workspace/viewer/NodeListMenu.vue +67 -128
- package/src/layouts/workspace/viewer/Stage.vue +2 -1
- package/src/layouts/workspace/viewer/ViewerMenu.vue +1 -6
- package/src/services/BaseService.ts +63 -26
- package/src/services/codeBlock.ts +7 -1
- package/src/services/dep.ts +12 -8
- package/src/services/editor.ts +66 -30
- package/src/services/props.ts +70 -12
- package/src/services/storage.ts +23 -13
- package/src/services/ui.ts +4 -1
- package/src/theme/floating-box.scss +30 -0
- package/src/theme/layer-panel.scss +19 -0
- package/src/theme/stage.scss +24 -0
- package/src/theme/theme.scss +1 -1
- package/src/theme/tree.scss +12 -1
- package/src/type.ts +6 -3
- package/src/utils/compose.ts +25 -6
- package/src/utils/content-menu.ts +4 -5
- package/src/utils/editor.ts +12 -3
- package/src/utils/operator.ts +1 -2
- package/types/components/CodeBlockEditor.vue.d.ts +6 -2
- package/types/components/CodeParams.vue.d.ts +3 -1
- package/types/components/ContentMenu.vue.d.ts +13 -5
- package/types/components/FloatingBox.vue.d.ts +78 -0
- package/types/components/Resizer.vue.d.ts +6 -1
- package/types/components/ScrollBar.vue.d.ts +3 -1
- package/types/components/ScrollViewer.vue.d.ts +3 -3
- package/types/components/SearchInput.vue.d.ts +3 -1
- package/types/components/SplitView.vue.d.ts +8 -4
- package/types/components/ToolButton.vue.d.ts +1 -1
- package/types/components/Tree.vue.d.ts +27 -8
- package/types/components/TreeNode.vue.d.ts +24 -7
- package/types/editorProps.d.ts +7 -1
- package/types/fields/Code.vue.d.ts +6 -2
- package/types/fields/CodeLink.vue.d.ts +5 -3
- package/types/fields/CodeSelect.vue.d.ts +3 -1
- package/types/fields/CodeSelectCol.vue.d.ts +3 -1
- package/types/fields/DataSourceFieldSelect.vue.d.ts +3 -1
- package/types/fields/DataSourceFields.vue.d.ts +5 -3
- package/types/fields/DataSourceInput.vue.d.ts +8 -4
- package/types/fields/DataSourceMethodSelect.vue.d.ts +3 -1
- package/types/fields/DataSourceMethods.vue.d.ts +5 -3
- package/types/fields/DataSourceMocks.vue.d.ts +5 -3
- package/types/fields/DataSourceSelect.vue.d.ts +5 -3
- package/types/fields/EventSelect.vue.d.ts +3 -1
- package/types/fields/KeyValue.vue.d.ts +2 -2
- package/types/fields/UISelect.vue.d.ts +3 -1
- package/types/hooks/use-code-block-edit.d.ts +14 -5
- package/types/hooks/use-data-source-method.d.ts +14 -5
- package/types/hooks/use-filter.d.ts +7 -0
- package/types/hooks/use-node-status.d.ts +6 -0
- package/types/layouts/CodeEditor.vue.d.ts +4 -1
- package/types/layouts/Framework.vue.d.ts +1 -1
- package/types/layouts/PropsPanel.vue.d.ts +10 -4
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/Sidebar.vue.d.ts +5 -5
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +9 -3
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +3 -1
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +8 -2
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +6 -2
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/layer/use-click.d.ts +14 -5
- package/types/layouts/sidebar/layer/use-node-status.d.ts +3 -4
- package/types/layouts/workspace/Workspace.vue.d.ts +1 -1
- package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +1 -14
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +1 -1
- package/types/services/BaseService.d.ts +4 -1
- package/types/services/dep.d.ts +6 -5
- package/types/services/editor.d.ts +9 -3
- package/types/services/props.d.ts +25 -1
- package/types/services/storage.d.ts +7 -7
- package/types/type.d.ts +8 -6
- package/types/utils/compose.d.ts +1 -1
- package/types/utils/editor.d.ts +5 -1
- package/src/layouts/sidebar/layer/use-filter.ts +0 -59
- package/src/layouts/workspace/viewer/NodeListMenuTitle.vue +0 -68
- package/src/theme/dep-list.scss +0 -59
- package/types/layouts/sidebar/layer/use-filter.d.ts +0 -7
- package/types/layouts/workspace/viewer/NodeListMenuTitle.vue.d.ts +0 -15
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, resolveDynamicComponent, createTextVNode, createCommentVNode, toRaw, nextTick, mergeProps, toDisplayString, renderList, createStaticVNode, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, provide, Transition, toHandlers, mergeDefaults } from 'vue';
|
|
2
|
-
import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search,
|
|
3
|
-
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, map, has, pick, keys } from 'lodash-es';
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, resolveDynamicComponent, createTextVNode, createCommentVNode, toRaw, nextTick, mergeProps, toDisplayString, renderList, createStaticVNode, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, provide, Transition, toHandlers, onBeforeUnmount, mergeDefaults } from 'vue';
|
|
2
|
+
import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, ArrowRight, CopyDocument, DocumentCopy, Files, Hide, Goods, List, EditPen, Top, Bottom, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons-vue';
|
|
3
|
+
import { throttle, isEmpty, cloneDeep, mergeWith, get, set, isObject, uniq, map, has, pick, keys } from 'lodash-es';
|
|
4
4
|
import * as monaco from 'monaco-editor';
|
|
5
5
|
import serialize from 'serialize-javascript';
|
|
6
|
-
import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem,
|
|
6
|
+
import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
7
7
|
import { HookType, NodeType, ActionType } from '@tmagic/schema';
|
|
8
8
|
import { MFormBox, MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
|
|
9
9
|
import { MagicTable } from '@tmagic/table';
|
|
10
10
|
import { guid, isPop, getNodePath, isNumber, isPage, toLine, getDefaultValueFromFields, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, addClassName, removeClassName, removeClassNameByClassName, convertToNumber, getNodes } from '@tmagic/utils';
|
|
11
11
|
import Gesto from 'gesto';
|
|
12
12
|
import Moveable from 'moveable';
|
|
13
|
-
import { DepTargetType,
|
|
13
|
+
import { Watcher, DepTargetType, createRelatedCompTarget, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
|
|
14
14
|
export { DepTargetType } from '@tmagic/dep';
|
|
15
|
-
import StageCore, { GuidesType,
|
|
15
|
+
import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType, RenderType } from '@tmagic/stage';
|
|
16
16
|
import { EventEmitter } from 'events';
|
|
17
17
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
18
18
|
import KeyController from 'keycon';
|
|
@@ -23,10 +23,10 @@ const setConfig = (option) => {
|
|
|
23
23
|
};
|
|
24
24
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
25
25
|
|
|
26
|
-
const _hoisted_1$
|
|
26
|
+
const _hoisted_1$s = {
|
|
27
27
|
class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
|
|
28
28
|
};
|
|
29
|
-
const _sfc_main$
|
|
29
|
+
const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
30
30
|
...{
|
|
31
31
|
name: "MEditorCodeEditor"
|
|
32
32
|
},
|
|
@@ -184,7 +184,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
186
|
return (_ctx, _cache) => {
|
|
187
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
187
|
+
return openBlock(), createElementBlock("div", _hoisted_1$s, [
|
|
188
188
|
(openBlock(), createBlock(Teleport, {
|
|
189
189
|
to: "body",
|
|
190
190
|
disabled: !fullScreen.value
|
|
@@ -212,7 +212,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
|
|
215
|
-
const _sfc_main$
|
|
215
|
+
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
216
216
|
...{
|
|
217
217
|
name: "MEditorCode"
|
|
218
218
|
},
|
|
@@ -237,7 +237,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
237
237
|
emit("change", v);
|
|
238
238
|
};
|
|
239
239
|
return (_ctx, _cache) => {
|
|
240
|
-
return openBlock(), createBlock(_sfc_main$
|
|
240
|
+
return openBlock(), createBlock(_sfc_main$Q, {
|
|
241
241
|
height: _ctx.config.height,
|
|
242
242
|
"init-values": _ctx.model[_ctx.name],
|
|
243
243
|
language: _ctx.config.language,
|
|
@@ -252,7 +252,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
|
|
255
|
-
const _sfc_main$
|
|
255
|
+
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
256
256
|
...{
|
|
257
257
|
name: "MEditorCodeLink"
|
|
258
258
|
},
|
|
@@ -332,7 +332,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
332
332
|
}
|
|
333
333
|
});
|
|
334
334
|
|
|
335
|
-
const _sfc_main$
|
|
335
|
+
const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
336
336
|
...{
|
|
337
337
|
name: "MEditorCodeSelect"
|
|
338
338
|
},
|
|
@@ -405,11 +405,11 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
405
405
|
}
|
|
406
406
|
});
|
|
407
407
|
|
|
408
|
-
const _hoisted_1$
|
|
409
|
-
const _hoisted_2$
|
|
410
|
-
const _hoisted_3$
|
|
411
|
-
const _hoisted_4$
|
|
412
|
-
const _sfc_main$
|
|
408
|
+
const _hoisted_1$r = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
409
|
+
const _hoisted_2$j = { style: { "flex": "1" } };
|
|
410
|
+
const _hoisted_3$7 = { style: { "flex": "1" } };
|
|
411
|
+
const _hoisted_4$5 = { class: "dialog-footer" };
|
|
412
|
+
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
413
413
|
...{
|
|
414
414
|
name: "MEditorCodeBlockEditor"
|
|
415
415
|
},
|
|
@@ -630,7 +630,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
630
630
|
fullscreen: ""
|
|
631
631
|
}, {
|
|
632
632
|
footer: withCtx(() => [
|
|
633
|
-
createElementVNode("span", _hoisted_4$
|
|
633
|
+
createElementVNode("span", _hoisted_4$5, [
|
|
634
634
|
createVNode(unref(TMagicButton), {
|
|
635
635
|
size: "small",
|
|
636
636
|
onClick: _cache[1] || (_cache[1] = ($event) => difVisible.value = false)
|
|
@@ -653,8 +653,8 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
653
653
|
])
|
|
654
654
|
]),
|
|
655
655
|
default: withCtx(() => [
|
|
656
|
-
createElementVNode("div", _hoisted_1$
|
|
657
|
-
createElementVNode("div", _hoisted_2$
|
|
656
|
+
createElementVNode("div", _hoisted_1$r, [
|
|
657
|
+
createElementVNode("div", _hoisted_2$j, [
|
|
658
658
|
createVNode(unref(TMagicTag), {
|
|
659
659
|
size: "small",
|
|
660
660
|
type: "info"
|
|
@@ -665,7 +665,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
665
665
|
_: 1
|
|
666
666
|
})
|
|
667
667
|
]),
|
|
668
|
-
createElementVNode("div", _hoisted_3$
|
|
668
|
+
createElementVNode("div", _hoisted_3$7, [
|
|
669
669
|
createVNode(unref(TMagicTag), {
|
|
670
670
|
size: "small",
|
|
671
671
|
type: "success"
|
|
@@ -677,7 +677,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
677
677
|
})
|
|
678
678
|
])
|
|
679
679
|
]),
|
|
680
|
-
difVisible.value ? (openBlock(), createBlock(_sfc_main$
|
|
680
|
+
difVisible.value ? (openBlock(), createBlock(_sfc_main$Q, {
|
|
681
681
|
key: 0,
|
|
682
682
|
ref_key: "magicVsEditor",
|
|
683
683
|
ref: magicVsEditor,
|
|
@@ -963,7 +963,7 @@ const getDisplayField = (dataSources, key) => {
|
|
|
963
963
|
return displayState;
|
|
964
964
|
};
|
|
965
965
|
|
|
966
|
-
const compose = (middleware) => {
|
|
966
|
+
const compose = (middleware, isAsync) => {
|
|
967
967
|
if (!Array.isArray(middleware))
|
|
968
968
|
throw new TypeError("Middleware 必须是一个数组!");
|
|
969
969
|
for (const fn of middleware) {
|
|
@@ -974,18 +974,34 @@ const compose = (middleware) => {
|
|
|
974
974
|
let index = -1;
|
|
975
975
|
return dispatch(0);
|
|
976
976
|
function dispatch(i) {
|
|
977
|
-
if (i <= index)
|
|
978
|
-
|
|
977
|
+
if (i <= index) {
|
|
978
|
+
const error = new Error("next() 被多次调用");
|
|
979
|
+
if (isAsync) {
|
|
980
|
+
return Promise.reject(error);
|
|
981
|
+
}
|
|
982
|
+
throw error;
|
|
983
|
+
}
|
|
979
984
|
index = i;
|
|
980
985
|
let fn = middleware[i];
|
|
981
986
|
if (i === middleware.length && next)
|
|
982
987
|
fn = next;
|
|
983
|
-
if (!fn)
|
|
984
|
-
|
|
988
|
+
if (!fn) {
|
|
989
|
+
if (isAsync) {
|
|
990
|
+
return Promise.resolve();
|
|
991
|
+
}
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
if (isAsync) {
|
|
995
|
+
try {
|
|
996
|
+
return Promise.resolve(fn(...args, dispatch.bind(null, i + 1)));
|
|
997
|
+
} catch (err) {
|
|
998
|
+
return Promise.reject(err);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
985
1001
|
try {
|
|
986
|
-
return
|
|
1002
|
+
return fn(...args, dispatch.bind(null, i + 1));
|
|
987
1003
|
} catch (err) {
|
|
988
|
-
|
|
1004
|
+
throw err;
|
|
989
1005
|
}
|
|
990
1006
|
}
|
|
991
1007
|
};
|
|
@@ -993,7 +1009,29 @@ const compose = (middleware) => {
|
|
|
993
1009
|
|
|
994
1010
|
const methodName = (prefix, name) => `${prefix}${name[0].toUpperCase()}${name.substring(1)}`;
|
|
995
1011
|
const isError = (error) => Object.prototype.toString.call(error) === "[object Error]";
|
|
996
|
-
const doAction =
|
|
1012
|
+
const doAction = (args, scope, sourceMethod, beforeMethodName, afterMethodName, fn) => {
|
|
1013
|
+
try {
|
|
1014
|
+
let beforeArgs = args;
|
|
1015
|
+
for (const beforeMethod of scope.pluginOptionsList[beforeMethodName]) {
|
|
1016
|
+
beforeArgs = beforeMethod(...beforeArgs) || [];
|
|
1017
|
+
if (isError(beforeArgs))
|
|
1018
|
+
throw beforeArgs;
|
|
1019
|
+
if (!Array.isArray(beforeArgs)) {
|
|
1020
|
+
beforeArgs = [beforeArgs];
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
let returnValue = fn(beforeArgs, sourceMethod.bind(scope));
|
|
1024
|
+
for (const afterMethod of scope.pluginOptionsList[afterMethodName]) {
|
|
1025
|
+
returnValue = afterMethod(returnValue, ...beforeArgs);
|
|
1026
|
+
if (isError(returnValue))
|
|
1027
|
+
throw returnValue;
|
|
1028
|
+
}
|
|
1029
|
+
return returnValue;
|
|
1030
|
+
} catch (error) {
|
|
1031
|
+
throw error;
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
const doAsyncAction = async (args, scope, sourceMethod, beforeMethodName, afterMethodName, fn) => {
|
|
997
1035
|
try {
|
|
998
1036
|
let beforeArgs = args;
|
|
999
1037
|
for (const beforeMethod of scope.pluginOptionsList[beforeMethodName]) {
|
|
@@ -1022,7 +1060,7 @@ class BaseService extends EventEmitter {
|
|
|
1022
1060
|
doingTask = false;
|
|
1023
1061
|
constructor(methods = [], serialMethods = []) {
|
|
1024
1062
|
super();
|
|
1025
|
-
methods.forEach((propertyName) => {
|
|
1063
|
+
methods.forEach(({ name: propertyName, isAsync }) => {
|
|
1026
1064
|
const scope = this;
|
|
1027
1065
|
const sourceMethod = scope[propertyName];
|
|
1028
1066
|
const beforeMethodName = methodName("before", propertyName);
|
|
@@ -1030,16 +1068,16 @@ class BaseService extends EventEmitter {
|
|
|
1030
1068
|
this.pluginOptionsList[beforeMethodName] = [];
|
|
1031
1069
|
this.pluginOptionsList[afterMethodName] = [];
|
|
1032
1070
|
this.middleware[propertyName] = [];
|
|
1033
|
-
const fn = compose(this.middleware[propertyName]);
|
|
1071
|
+
const fn = compose(this.middleware[propertyName], isAsync);
|
|
1034
1072
|
Object.defineProperty(scope, propertyName, {
|
|
1035
|
-
value: async (...args) => {
|
|
1073
|
+
value: isAsync ? async (...args) => {
|
|
1036
1074
|
if (!serialMethods.includes(propertyName)) {
|
|
1037
|
-
return
|
|
1075
|
+
return doAsyncAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
|
|
1038
1076
|
}
|
|
1039
1077
|
const promise = new Promise((resolve, reject) => {
|
|
1040
1078
|
this.taskList.push(async () => {
|
|
1041
1079
|
try {
|
|
1042
|
-
const value = await
|
|
1080
|
+
const value = await doAsyncAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
|
|
1043
1081
|
resolve(value);
|
|
1044
1082
|
} catch (e) {
|
|
1045
1083
|
reject(e);
|
|
@@ -1050,7 +1088,7 @@ class BaseService extends EventEmitter {
|
|
|
1050
1088
|
this.doTask();
|
|
1051
1089
|
}
|
|
1052
1090
|
return promise;
|
|
1053
|
-
}
|
|
1091
|
+
} : (...args) => doAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn)
|
|
1054
1092
|
});
|
|
1055
1093
|
});
|
|
1056
1094
|
}
|
|
@@ -1737,11 +1775,50 @@ const traverseNode = (node, cb, parents = []) => {
|
|
|
1737
1775
|
if (node.items?.length) {
|
|
1738
1776
|
parents.push(node);
|
|
1739
1777
|
node.items.forEach((item) => {
|
|
1740
|
-
traverseNode(item, cb, parents);
|
|
1778
|
+
traverseNode(item, cb, [...parents]);
|
|
1741
1779
|
});
|
|
1742
1780
|
}
|
|
1743
1781
|
};
|
|
1744
1782
|
|
|
1783
|
+
class Dep extends BaseService {
|
|
1784
|
+
watcher = new Watcher({ initialTargets: reactive({}) });
|
|
1785
|
+
removeTargets(type = DepTargetType.DEFAULT) {
|
|
1786
|
+
this.watcher.removeTargets(type);
|
|
1787
|
+
this.emit("remove-target");
|
|
1788
|
+
}
|
|
1789
|
+
getTargets(type = DepTargetType.DEFAULT) {
|
|
1790
|
+
return this.watcher.getTargets(type);
|
|
1791
|
+
}
|
|
1792
|
+
getTarget(id, type = DepTargetType.DEFAULT) {
|
|
1793
|
+
return this.watcher.getTarget(id, type);
|
|
1794
|
+
}
|
|
1795
|
+
addTarget(target) {
|
|
1796
|
+
this.watcher.addTarget(target);
|
|
1797
|
+
this.emit("add-target", target);
|
|
1798
|
+
}
|
|
1799
|
+
removeTarget(id, type = DepTargetType.DEFAULT) {
|
|
1800
|
+
this.watcher.removeTarget(id, type);
|
|
1801
|
+
this.emit("remove-target");
|
|
1802
|
+
}
|
|
1803
|
+
clearTargets() {
|
|
1804
|
+
this.watcher.clearTargets();
|
|
1805
|
+
}
|
|
1806
|
+
collect(nodes, deep = false, type) {
|
|
1807
|
+
this.watcher.collect(nodes, deep, type);
|
|
1808
|
+
this.emit("collected", nodes, deep);
|
|
1809
|
+
}
|
|
1810
|
+
clear(nodes) {
|
|
1811
|
+
return this.watcher.clear(nodes);
|
|
1812
|
+
}
|
|
1813
|
+
hasTarget(id, type = DepTargetType.DEFAULT) {
|
|
1814
|
+
return this.watcher.hasTarget(id, type);
|
|
1815
|
+
}
|
|
1816
|
+
hasSpecifiedTypeTarget(type = DepTargetType.DEFAULT) {
|
|
1817
|
+
return this.watcher.hasSpecifiedTypeTarget(type);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
const depService = new Dep();
|
|
1821
|
+
|
|
1745
1822
|
class UndoRedo {
|
|
1746
1823
|
elementList;
|
|
1747
1824
|
listCursor;
|
|
@@ -1883,7 +1960,14 @@ class WebStorage extends BaseService {
|
|
|
1883
1960
|
storage = globalThis.localStorage;
|
|
1884
1961
|
namespace = "tmagic";
|
|
1885
1962
|
constructor() {
|
|
1886
|
-
super([
|
|
1963
|
+
super([
|
|
1964
|
+
{ name: "getStorage", isAsync: false },
|
|
1965
|
+
{ name: "getNamespace", isAsync: false },
|
|
1966
|
+
{ name: "clear", isAsync: false },
|
|
1967
|
+
{ name: "getItem", isAsync: false },
|
|
1968
|
+
{ name: "removeItem", isAsync: false },
|
|
1969
|
+
{ name: "setItem", isAsync: false }
|
|
1970
|
+
]);
|
|
1887
1971
|
}
|
|
1888
1972
|
/**
|
|
1889
1973
|
* 获取数据存储对象,可以通过
|
|
@@ -1895,24 +1979,25 @@ class WebStorage extends BaseService {
|
|
|
1895
1979
|
* },
|
|
1896
1980
|
* });
|
|
1897
1981
|
*/
|
|
1898
|
-
|
|
1982
|
+
getStorage() {
|
|
1899
1983
|
return this.storage;
|
|
1900
1984
|
}
|
|
1901
|
-
|
|
1985
|
+
getNamespace() {
|
|
1902
1986
|
return this.namespace;
|
|
1903
1987
|
}
|
|
1904
1988
|
/**
|
|
1905
1989
|
* 清理,支持storageService.usePlugin
|
|
1906
1990
|
*/
|
|
1907
|
-
|
|
1908
|
-
const storage =
|
|
1991
|
+
clear() {
|
|
1992
|
+
const storage = this.getStorage();
|
|
1909
1993
|
storage.clear();
|
|
1910
1994
|
}
|
|
1911
1995
|
/**
|
|
1912
1996
|
* 获取存储项,支持storageService.usePlugin
|
|
1913
1997
|
*/
|
|
1914
|
-
|
|
1915
|
-
const
|
|
1998
|
+
getItem(key, options = {}) {
|
|
1999
|
+
const storage = this.getStorage();
|
|
2000
|
+
const namespace = this.getNamespace();
|
|
1916
2001
|
const { protocol = options.protocol, item } = this.getValueAndProtocol(
|
|
1917
2002
|
storage.getItem(`${options.namespace || namespace}:${key}`)
|
|
1918
2003
|
);
|
|
@@ -1934,22 +2019,24 @@ class WebStorage extends BaseService {
|
|
|
1934
2019
|
/**
|
|
1935
2020
|
* 获取指定索引位置的key
|
|
1936
2021
|
*/
|
|
1937
|
-
|
|
1938
|
-
const storage =
|
|
2022
|
+
key(index) {
|
|
2023
|
+
const storage = this.getStorage();
|
|
1939
2024
|
return storage.key(index);
|
|
1940
2025
|
}
|
|
1941
2026
|
/**
|
|
1942
2027
|
* 移除存储项,支持storageService.usePlugin
|
|
1943
2028
|
*/
|
|
1944
|
-
|
|
1945
|
-
const
|
|
2029
|
+
removeItem(key, options = {}) {
|
|
2030
|
+
const storage = this.getStorage();
|
|
2031
|
+
const namespace = this.getNamespace();
|
|
1946
2032
|
storage.removeItem(`${options.namespace || namespace}:${key}`);
|
|
1947
2033
|
}
|
|
1948
2034
|
/**
|
|
1949
2035
|
* 设置存储项,支持storageService.usePlugin
|
|
1950
2036
|
*/
|
|
1951
|
-
|
|
1952
|
-
const
|
|
2037
|
+
setItem(key, value, options = {}) {
|
|
2038
|
+
const storage = this.getStorage();
|
|
2039
|
+
const namespace = this.getNamespace();
|
|
1953
2040
|
let item = value;
|
|
1954
2041
|
const protocol = options.protocol ? `${options.protocol}:` : "";
|
|
1955
2042
|
if (typeof value === "string" /* STRING */ || typeof value === "number" /* NUMBER */) {
|
|
@@ -1986,18 +2073,19 @@ const storageService = new WebStorage();
|
|
|
1986
2073
|
class Props extends BaseService {
|
|
1987
2074
|
state = reactive({
|
|
1988
2075
|
propsConfigMap: {},
|
|
1989
|
-
propsValueMap: {}
|
|
2076
|
+
propsValueMap: {},
|
|
2077
|
+
relateIdMap: {}
|
|
1990
2078
|
});
|
|
1991
2079
|
constructor() {
|
|
1992
2080
|
super([
|
|
1993
|
-
"setPropsConfig",
|
|
1994
|
-
"getPropsConfig",
|
|
1995
|
-
"setPropsValue",
|
|
1996
|
-
"getPropsValue",
|
|
1997
|
-
"createId",
|
|
1998
|
-
"setNewItemId",
|
|
1999
|
-
"fillConfig",
|
|
2000
|
-
"getDefaultPropsValue"
|
|
2081
|
+
{ name: "setPropsConfig", isAsync: true },
|
|
2082
|
+
{ name: "getPropsConfig", isAsync: true },
|
|
2083
|
+
{ name: "setPropsValue", isAsync: true },
|
|
2084
|
+
{ name: "getPropsValue", isAsync: true },
|
|
2085
|
+
{ name: "createId", isAsync: false },
|
|
2086
|
+
{ name: "setNewItemId", isAsync: true },
|
|
2087
|
+
{ name: "fillConfig", isAsync: true },
|
|
2088
|
+
{ name: "getDefaultPropsValue", isAsync: true }
|
|
2001
2089
|
]);
|
|
2002
2090
|
}
|
|
2003
2091
|
setPropsConfigs(configs) {
|
|
@@ -2077,11 +2165,17 @@ class Props extends BaseService {
|
|
|
2077
2165
|
}
|
|
2078
2166
|
/**
|
|
2079
2167
|
* 将组件与组件的子元素配置中的id都设置成一个新的ID
|
|
2168
|
+
* 如果没有相同ID并且force为false则保持不变
|
|
2080
2169
|
* @param {Object} config 组件配置
|
|
2170
|
+
* @param {Boolean} force 是否强制设置新的ID
|
|
2081
2171
|
*/
|
|
2082
2172
|
/* eslint no-param-reassign: ["error", { "props": false }] */
|
|
2083
|
-
async setNewItemId(config) {
|
|
2084
|
-
|
|
2173
|
+
async setNewItemId(config, force = true) {
|
|
2174
|
+
if (force || editorService.getNodeById(config.id)) {
|
|
2175
|
+
const newId = await this.createId(config.type || "component");
|
|
2176
|
+
this.setRelateId(config.id, newId);
|
|
2177
|
+
config.id = newId;
|
|
2178
|
+
}
|
|
2085
2179
|
if (config.items && Array.isArray(config.items)) {
|
|
2086
2180
|
for (const item of config.items) {
|
|
2087
2181
|
await this.setNewItemId(item);
|
|
@@ -2111,11 +2205,59 @@ class Props extends BaseService {
|
|
|
2111
2205
|
this.state.propsConfigMap = {};
|
|
2112
2206
|
this.state.propsValueMap = {};
|
|
2113
2207
|
}
|
|
2208
|
+
/**
|
|
2209
|
+
* 替换关联ID
|
|
2210
|
+
* @param originConfigs 原组件配置
|
|
2211
|
+
* @param targetConfigs 待替换的组件配置
|
|
2212
|
+
*/
|
|
2213
|
+
replaceRelateId(originConfigs, targetConfigs) {
|
|
2214
|
+
const relateIdMap = this.getRelateIdMap();
|
|
2215
|
+
if (Object.keys(relateIdMap).length === 0)
|
|
2216
|
+
return;
|
|
2217
|
+
const target = depService.getTarget(DepTargetType.RELATED_COMP_WHEN_COPY, DepTargetType.RELATED_COMP_WHEN_COPY);
|
|
2218
|
+
if (!target)
|
|
2219
|
+
return;
|
|
2220
|
+
originConfigs.forEach((config) => {
|
|
2221
|
+
const newId = relateIdMap[config.id];
|
|
2222
|
+
const targetConfig = targetConfigs.find((targetConfig2) => targetConfig2.id === newId);
|
|
2223
|
+
if (!targetConfig)
|
|
2224
|
+
return;
|
|
2225
|
+
target.deps[config.id]?.keys?.forEach((fullKey) => {
|
|
2226
|
+
const relateOriginId = get(config, fullKey);
|
|
2227
|
+
const relateTargetId = relateIdMap[relateOriginId];
|
|
2228
|
+
if (!relateTargetId)
|
|
2229
|
+
return;
|
|
2230
|
+
set(targetConfig, fullKey, relateTargetId);
|
|
2231
|
+
});
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
/**
|
|
2235
|
+
* 清除setNewItemId前后映射关系
|
|
2236
|
+
*/
|
|
2237
|
+
clearRelateId() {
|
|
2238
|
+
this.state.relateIdMap = {};
|
|
2239
|
+
}
|
|
2114
2240
|
destroy() {
|
|
2115
2241
|
this.resetState();
|
|
2116
2242
|
this.removeAllListeners();
|
|
2117
2243
|
this.removeAllPlugins();
|
|
2118
2244
|
}
|
|
2245
|
+
/**
|
|
2246
|
+
* 获取setNewItemId前后映射关系
|
|
2247
|
+
* @param oldId 原组件ID
|
|
2248
|
+
* @returns 新旧ID映射
|
|
2249
|
+
*/
|
|
2250
|
+
getRelateIdMap() {
|
|
2251
|
+
return this.state.relateIdMap;
|
|
2252
|
+
}
|
|
2253
|
+
/**
|
|
2254
|
+
* 记录setNewItemId前后映射关系
|
|
2255
|
+
* @param oldId 原组件ID
|
|
2256
|
+
* @param newId 分配的新ID
|
|
2257
|
+
*/
|
|
2258
|
+
setRelateId(oldId, newId) {
|
|
2259
|
+
this.state.relateIdMap[oldId] = newId;
|
|
2260
|
+
}
|
|
2119
2261
|
}
|
|
2120
2262
|
const propsService = new Props();
|
|
2121
2263
|
|
|
@@ -2135,27 +2277,27 @@ class Editor extends BaseService {
|
|
|
2135
2277
|
constructor() {
|
|
2136
2278
|
super(
|
|
2137
2279
|
[
|
|
2138
|
-
"getLayout",
|
|
2139
|
-
"select",
|
|
2140
|
-
"doAdd",
|
|
2141
|
-
"add",
|
|
2142
|
-
"doRemove",
|
|
2143
|
-
"remove",
|
|
2144
|
-
"doUpdate",
|
|
2145
|
-
"update",
|
|
2146
|
-
"sort",
|
|
2147
|
-
"copy",
|
|
2148
|
-
"paste",
|
|
2149
|
-
"doPaste",
|
|
2150
|
-
"doAlignCenter",
|
|
2151
|
-
"alignCenter",
|
|
2152
|
-
"moveLayer",
|
|
2153
|
-
"moveToContainer",
|
|
2154
|
-
"move",
|
|
2155
|
-
"undo",
|
|
2156
|
-
"redo",
|
|
2157
|
-
"highlight",
|
|
2158
|
-
"dragTo"
|
|
2280
|
+
{ name: "getLayout", isAsync: true },
|
|
2281
|
+
{ name: "select", isAsync: true },
|
|
2282
|
+
{ name: "doAdd", isAsync: true },
|
|
2283
|
+
{ name: "add", isAsync: true },
|
|
2284
|
+
{ name: "doRemove", isAsync: true },
|
|
2285
|
+
{ name: "remove", isAsync: true },
|
|
2286
|
+
{ name: "doUpdate", isAsync: true },
|
|
2287
|
+
{ name: "update", isAsync: true },
|
|
2288
|
+
{ name: "sort", isAsync: true },
|
|
2289
|
+
{ name: "copy", isAsync: true },
|
|
2290
|
+
{ name: "paste", isAsync: true },
|
|
2291
|
+
{ name: "doPaste", isAsync: true },
|
|
2292
|
+
{ name: "doAlignCenter", isAsync: true },
|
|
2293
|
+
{ name: "alignCenter", isAsync: true },
|
|
2294
|
+
{ name: "moveLayer", isAsync: true },
|
|
2295
|
+
{ name: "moveToContainer", isAsync: true },
|
|
2296
|
+
{ name: "move", isAsync: true },
|
|
2297
|
+
{ name: "undo", isAsync: true },
|
|
2298
|
+
{ name: "redo", isAsync: true },
|
|
2299
|
+
{ name: "highlight", isAsync: true },
|
|
2300
|
+
{ name: "dragTo", isAsync: true }
|
|
2159
2301
|
],
|
|
2160
2302
|
// 需要注意循环依赖问题,如果函数间有相互调用的话,不能设置为串行调用
|
|
2161
2303
|
["select", "update", "moveLayer"]
|
|
@@ -2570,12 +2712,46 @@ class Editor extends BaseService {
|
|
|
2570
2712
|
this.pushHistoryState();
|
|
2571
2713
|
}
|
|
2572
2714
|
/**
|
|
2573
|
-
*
|
|
2715
|
+
* 将组件节点配置存储到localStorage中
|
|
2574
2716
|
* @param config 组件节点配置
|
|
2575
|
-
* @returns
|
|
2717
|
+
* @returns
|
|
2718
|
+
*/
|
|
2719
|
+
copy(config) {
|
|
2720
|
+
storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
|
|
2721
|
+
protocol: Protocol.OBJECT
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
/**
|
|
2725
|
+
* 复制时会带上组件关联的依赖
|
|
2726
|
+
* @param config 组件节点配置
|
|
2727
|
+
* @returns
|
|
2576
2728
|
*/
|
|
2577
|
-
|
|
2578
|
-
|
|
2729
|
+
copyWithRelated(config) {
|
|
2730
|
+
const copyNodes = Array.isArray(config) ? config : [config];
|
|
2731
|
+
depService.getTarget(DepTargetType.RELATED_COMP_WHEN_COPY, DepTargetType.RELATED_COMP_WHEN_COPY)?.removeDep();
|
|
2732
|
+
depService.collect(copyNodes, true, DepTargetType.RELATED_COMP_WHEN_COPY);
|
|
2733
|
+
const customTarget = depService.getTarget(
|
|
2734
|
+
DepTargetType.RELATED_COMP_WHEN_COPY,
|
|
2735
|
+
DepTargetType.RELATED_COMP_WHEN_COPY
|
|
2736
|
+
);
|
|
2737
|
+
if (customTarget) {
|
|
2738
|
+
Object.keys(customTarget.deps).forEach((nodeId) => {
|
|
2739
|
+
const node = this.getNodeById(nodeId);
|
|
2740
|
+
if (!node)
|
|
2741
|
+
return;
|
|
2742
|
+
customTarget.deps[nodeId].keys.forEach((key) => {
|
|
2743
|
+
const relateNodeId = get(node, key);
|
|
2744
|
+
const isExist = copyNodes.find((node2) => node2.id === relateNodeId);
|
|
2745
|
+
if (!isExist) {
|
|
2746
|
+
const relateNode = this.getNodeById(relateNodeId);
|
|
2747
|
+
if (relateNode) {
|
|
2748
|
+
copyNodes.push(relateNode);
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
});
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
storageService.setItem(COPY_STORAGE_KEY, copyNodes, {
|
|
2579
2755
|
protocol: Protocol.OBJECT
|
|
2580
2756
|
});
|
|
2581
2757
|
}
|
|
@@ -2585,7 +2761,7 @@ class Editor extends BaseService {
|
|
|
2585
2761
|
* @returns 添加后的组件节点配置
|
|
2586
2762
|
*/
|
|
2587
2763
|
async paste(position = {}) {
|
|
2588
|
-
const config =
|
|
2764
|
+
const config = storageService.getItem(COPY_STORAGE_KEY);
|
|
2589
2765
|
if (!Array.isArray(config))
|
|
2590
2766
|
return;
|
|
2591
2767
|
const node = this.get("node");
|
|
@@ -2597,9 +2773,11 @@ class Editor extends BaseService {
|
|
|
2597
2773
|
}
|
|
2598
2774
|
}
|
|
2599
2775
|
const pasteConfigs = await this.doPaste(config, position);
|
|
2776
|
+
propsService.replaceRelateId(config, pasteConfigs);
|
|
2600
2777
|
return this.add(pasteConfigs, parent);
|
|
2601
2778
|
}
|
|
2602
2779
|
async doPaste(config, position = {}) {
|
|
2780
|
+
propsService.clearRelateId();
|
|
2603
2781
|
const pasteConfigs = await beforePaste(position, cloneDeep(config));
|
|
2604
2782
|
return pasteConfigs;
|
|
2605
2783
|
}
|
|
@@ -2916,7 +3094,7 @@ const beforePaste = async (position, config) => {
|
|
|
2916
3094
|
if (pastePosition.top && configItem.style?.top) {
|
|
2917
3095
|
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
2918
3096
|
}
|
|
2919
|
-
const pasteConfig = await propsService.setNewItemId(configItem);
|
|
3097
|
+
const pasteConfig = await propsService.setNewItemId(configItem, false);
|
|
2920
3098
|
if (pasteConfig.style) {
|
|
2921
3099
|
const { left, top } = pasteConfig.style;
|
|
2922
3100
|
if (typeof left === "number" || !!left && !isNaN(Number(left))) {
|
|
@@ -2970,7 +3148,7 @@ const getDefaultConfig = async (addNode, parentNode) => {
|
|
|
2970
3148
|
return newNode;
|
|
2971
3149
|
};
|
|
2972
3150
|
|
|
2973
|
-
const _sfc_main$
|
|
3151
|
+
const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
2974
3152
|
...{
|
|
2975
3153
|
name: "MEditorCodeParams"
|
|
2976
3154
|
},
|
|
@@ -3020,8 +3198,8 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
3020
3198
|
}
|
|
3021
3199
|
});
|
|
3022
3200
|
|
|
3023
|
-
const _hoisted_1$
|
|
3024
|
-
const _sfc_main$
|
|
3201
|
+
const _hoisted_1$q = ["src"];
|
|
3202
|
+
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
3025
3203
|
...{
|
|
3026
3204
|
name: "MEditorIcon"
|
|
3027
3205
|
},
|
|
@@ -3045,7 +3223,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
3045
3223
|
class: "magic-editor-icon"
|
|
3046
3224
|
}, {
|
|
3047
3225
|
default: withCtx(() => [
|
|
3048
|
-
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$
|
|
3226
|
+
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$q)
|
|
3049
3227
|
]),
|
|
3050
3228
|
_: 1
|
|
3051
3229
|
})) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
@@ -3123,9 +3301,9 @@ const useCodeBlockEdit = (codeBlockService) => {
|
|
|
3123
3301
|
};
|
|
3124
3302
|
};
|
|
3125
3303
|
|
|
3126
|
-
const _hoisted_1$
|
|
3127
|
-
const _hoisted_2$
|
|
3128
|
-
const _sfc_main$
|
|
3304
|
+
const _hoisted_1$p = { class: "m-fields-code-select-col" };
|
|
3305
|
+
const _hoisted_2$i = { class: "code-select-container" };
|
|
3306
|
+
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
3129
3307
|
...{
|
|
3130
3308
|
name: "MEditorCodeSelectCol"
|
|
3131
3309
|
},
|
|
@@ -3198,8 +3376,8 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3198
3376
|
const { codeBlockEditor, codeConfig, editCode, submitCodeBlockHandler } = useCodeBlockEdit(services?.codeBlockService);
|
|
3199
3377
|
return (_ctx, _cache) => {
|
|
3200
3378
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
3201
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3202
|
-
createElementVNode("div", _hoisted_2$
|
|
3379
|
+
return openBlock(), createElementBlock("div", _hoisted_1$p, [
|
|
3380
|
+
createElementVNode("div", _hoisted_2$i, [
|
|
3203
3381
|
createVNode(_component_m_form_container, {
|
|
3204
3382
|
class: "select",
|
|
3205
3383
|
config: selectConfig,
|
|
@@ -3207,14 +3385,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3207
3385
|
size: _ctx.size,
|
|
3208
3386
|
onChange: onParamsChangeHandler
|
|
3209
3387
|
}, null, 8, ["model", "size"]),
|
|
3210
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
3388
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$K, {
|
|
3211
3389
|
key: 0,
|
|
3212
3390
|
class: "icon",
|
|
3213
3391
|
icon: !_ctx.disabled ? unref(Edit) : unref(View),
|
|
3214
3392
|
onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
|
|
3215
3393
|
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
3216
3394
|
]),
|
|
3217
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
3395
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$L, {
|
|
3218
3396
|
key: 0,
|
|
3219
3397
|
name: "params",
|
|
3220
3398
|
model: _ctx.model,
|
|
@@ -3222,7 +3400,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3222
3400
|
"params-config": paramsConfig.value,
|
|
3223
3401
|
onChange: onParamsChangeHandler
|
|
3224
3402
|
}, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true),
|
|
3225
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
3403
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
|
|
3226
3404
|
key: 1,
|
|
3227
3405
|
ref_key: "codeBlockEditor",
|
|
3228
3406
|
ref: codeBlockEditor,
|
|
@@ -3235,9 +3413,9 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3235
3413
|
}
|
|
3236
3414
|
});
|
|
3237
3415
|
|
|
3238
|
-
const _hoisted_1$
|
|
3239
|
-
const _hoisted_2$
|
|
3240
|
-
const _sfc_main$
|
|
3416
|
+
const _hoisted_1$o = { class: "m-editor-data-source-fields" };
|
|
3417
|
+
const _hoisted_2$h = { class: "m-editor-data-source-fields-footer" };
|
|
3418
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
3241
3419
|
...{
|
|
3242
3420
|
name: "MEditorDataSourceFields"
|
|
3243
3421
|
},
|
|
@@ -3472,12 +3650,12 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
3472
3650
|
}
|
|
3473
3651
|
};
|
|
3474
3652
|
return (_ctx, _cache) => {
|
|
3475
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3653
|
+
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
3476
3654
|
createVNode(unref(MagicTable), {
|
|
3477
3655
|
data: _ctx.model[_ctx.name],
|
|
3478
3656
|
columns: fieldColumns
|
|
3479
3657
|
}, null, 8, ["data"]),
|
|
3480
|
-
createElementVNode("div", _hoisted_2$
|
|
3658
|
+
createElementVNode("div", _hoisted_2$h, [
|
|
3481
3659
|
createVNode(unref(TMagicButton), {
|
|
3482
3660
|
size: "small",
|
|
3483
3661
|
disabled: _ctx.disabled,
|
|
@@ -3529,7 +3707,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
3529
3707
|
}
|
|
3530
3708
|
});
|
|
3531
3709
|
|
|
3532
|
-
const _sfc_main$
|
|
3710
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
3533
3711
|
__name: "DataSourceFieldSelect",
|
|
3534
3712
|
props: {
|
|
3535
3713
|
config: {},
|
|
@@ -3584,10 +3762,10 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
3584
3762
|
}
|
|
3585
3763
|
});
|
|
3586
3764
|
|
|
3587
|
-
const _hoisted_1$
|
|
3588
|
-
const _hoisted_2$
|
|
3589
|
-
const _hoisted_3$
|
|
3590
|
-
const _sfc_main$
|
|
3765
|
+
const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
3766
|
+
const _hoisted_2$g = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
3767
|
+
const _hoisted_3$6 = { class: "el-input__inner" };
|
|
3768
|
+
const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
3591
3769
|
...{
|
|
3592
3770
|
name: "MEditorDataSourceInput"
|
|
3593
3771
|
},
|
|
@@ -3777,12 +3955,12 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
3777
3955
|
}
|
|
3778
3956
|
), {
|
|
3779
3957
|
suffix: withCtx(() => [
|
|
3780
|
-
createVNode(_sfc_main$
|
|
3958
|
+
createVNode(_sfc_main$K, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
3781
3959
|
]),
|
|
3782
3960
|
default: withCtx(({ item }) => [
|
|
3783
|
-
createElementVNode("div", _hoisted_1$
|
|
3961
|
+
createElementVNode("div", _hoisted_1$n, [
|
|
3784
3962
|
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
3785
|
-
createElementVNode("span", _hoisted_2$
|
|
3963
|
+
createElementVNode("span", _hoisted_2$g, toDisplayString(item.value), 1)
|
|
3786
3964
|
])
|
|
3787
3965
|
]),
|
|
3788
3966
|
_: 1
|
|
@@ -3794,7 +3972,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
3794
3972
|
createElementVNode("div", {
|
|
3795
3973
|
class: normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
|
|
3796
3974
|
}, [
|
|
3797
|
-
createElementVNode("div", _hoisted_3$
|
|
3975
|
+
createElementVNode("div", _hoisted_3$6, [
|
|
3798
3976
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayState.value, (item, index) => {
|
|
3799
3977
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
3800
3978
|
item.type === "text" ? (openBlock(), createElementBlock("span", {
|
|
@@ -3812,7 +3990,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
3812
3990
|
}, 1032, ["size"])) : createCommentVNode("", true)
|
|
3813
3991
|
], 64);
|
|
3814
3992
|
}), 256)),
|
|
3815
|
-
createVNode(_sfc_main$
|
|
3993
|
+
createVNode(_sfc_main$K, {
|
|
3816
3994
|
class: "tmagic-data-source-input-icon",
|
|
3817
3995
|
icon: unref(Coin)
|
|
3818
3996
|
}, null, 8, ["icon"])
|
|
@@ -3895,9 +4073,9 @@ const useDataSourceMethod = () => {
|
|
|
3895
4073
|
};
|
|
3896
4074
|
};
|
|
3897
4075
|
|
|
3898
|
-
const _hoisted_1$
|
|
3899
|
-
const _hoisted_2$
|
|
3900
|
-
const _sfc_main$
|
|
4076
|
+
const _hoisted_1$m = { class: "m-editor-data-source-methods" };
|
|
4077
|
+
const _hoisted_2$f = { class: "m-editor-data-source-methods-footer" };
|
|
4078
|
+
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
3901
4079
|
...{
|
|
3902
4080
|
name: "MEditorDataSourceMethods"
|
|
3903
4081
|
},
|
|
@@ -3967,12 +4145,12 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
3967
4145
|
emit("change", props.model[props.name]);
|
|
3968
4146
|
};
|
|
3969
4147
|
return (_ctx, _cache) => {
|
|
3970
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4148
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
3971
4149
|
createVNode(unref(MagicTable), {
|
|
3972
4150
|
data: _ctx.model[_ctx.name],
|
|
3973
4151
|
columns: methodColumns
|
|
3974
4152
|
}, null, 8, ["data"]),
|
|
3975
|
-
createElementVNode("div", _hoisted_2$
|
|
4153
|
+
createElementVNode("div", _hoisted_2$f, [
|
|
3976
4154
|
createVNode(unref(TMagicButton), {
|
|
3977
4155
|
size: "small",
|
|
3978
4156
|
type: "primary",
|
|
@@ -3986,7 +4164,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
3986
4164
|
_: 1
|
|
3987
4165
|
}, 8, ["disabled"])
|
|
3988
4166
|
]),
|
|
3989
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
4167
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
|
|
3990
4168
|
key: 0,
|
|
3991
4169
|
ref_key: "codeBlockEditor",
|
|
3992
4170
|
ref: codeBlockEditor,
|
|
@@ -4001,9 +4179,9 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
4001
4179
|
}
|
|
4002
4180
|
});
|
|
4003
4181
|
|
|
4004
|
-
const _hoisted_1$
|
|
4005
|
-
const _hoisted_2$
|
|
4006
|
-
const _sfc_main$
|
|
4182
|
+
const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
|
|
4183
|
+
const _hoisted_2$e = { class: "data-source-method-select-container" };
|
|
4184
|
+
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
4007
4185
|
...{
|
|
4008
4186
|
name: "MEditorDataSourceMethodSelect"
|
|
4009
4187
|
},
|
|
@@ -4086,22 +4264,22 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4086
4264
|
};
|
|
4087
4265
|
return (_ctx, _cache) => {
|
|
4088
4266
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
4089
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4090
|
-
createElementVNode("div", _hoisted_2$
|
|
4267
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
4268
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
4091
4269
|
createVNode(_component_m_form_container, {
|
|
4092
4270
|
class: "select",
|
|
4093
4271
|
config: cascaderConfig.value,
|
|
4094
4272
|
model: _ctx.model,
|
|
4095
4273
|
onChange: onChangeHandler
|
|
4096
4274
|
}, null, 8, ["config", "model"]),
|
|
4097
|
-
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$
|
|
4275
|
+
_ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$K, {
|
|
4098
4276
|
key: 0,
|
|
4099
4277
|
class: "icon",
|
|
4100
4278
|
icon: !_ctx.disabled ? unref(Edit) : unref(View),
|
|
4101
4279
|
onClick: editCodeHandler
|
|
4102
4280
|
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
4103
4281
|
]),
|
|
4104
|
-
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$
|
|
4282
|
+
paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$L, {
|
|
4105
4283
|
key: 0,
|
|
4106
4284
|
name: "params",
|
|
4107
4285
|
model: _ctx.model,
|
|
@@ -4110,7 +4288,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4110
4288
|
"params-config": paramsConfig.value,
|
|
4111
4289
|
onChange: onChangeHandler
|
|
4112
4290
|
}, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true),
|
|
4113
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
4291
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
|
|
4114
4292
|
key: 1,
|
|
4115
4293
|
ref_key: "codeBlockEditor",
|
|
4116
4294
|
ref: codeBlockEditor,
|
|
@@ -4123,9 +4301,9 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4123
4301
|
}
|
|
4124
4302
|
});
|
|
4125
4303
|
|
|
4126
|
-
const _hoisted_1$
|
|
4127
|
-
const _hoisted_2$
|
|
4128
|
-
const _sfc_main$
|
|
4304
|
+
const _hoisted_1$k = { class: "m-editor-data-source-fields" };
|
|
4305
|
+
const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
|
|
4306
|
+
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
4129
4307
|
...{
|
|
4130
4308
|
name: "MEditorDataSourceMocks"
|
|
4131
4309
|
},
|
|
@@ -4212,7 +4390,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
4212
4390
|
const columns = [
|
|
4213
4391
|
{
|
|
4214
4392
|
type: "expand",
|
|
4215
|
-
component: _sfc_main$
|
|
4393
|
+
component: _sfc_main$Q,
|
|
4216
4394
|
props: (row) => ({
|
|
4217
4395
|
initValues: row.data,
|
|
4218
4396
|
language: "json",
|
|
@@ -4321,12 +4499,12 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
4321
4499
|
});
|
|
4322
4500
|
};
|
|
4323
4501
|
return (_ctx, _cache) => {
|
|
4324
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4502
|
+
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
4325
4503
|
createVNode(unref(MagicTable), {
|
|
4326
4504
|
data: _ctx.model[_ctx.name],
|
|
4327
4505
|
columns
|
|
4328
4506
|
}, null, 8, ["data"]),
|
|
4329
|
-
createElementVNode("div", _hoisted_2$
|
|
4507
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
4330
4508
|
createVNode(unref(TMagicButton), {
|
|
4331
4509
|
size: "small",
|
|
4332
4510
|
type: "primary",
|
|
@@ -4357,7 +4535,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
4357
4535
|
}
|
|
4358
4536
|
});
|
|
4359
4537
|
|
|
4360
|
-
const _sfc_main$
|
|
4538
|
+
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
4361
4539
|
...{
|
|
4362
4540
|
name: "MEditorDataSourceSelect"
|
|
4363
4541
|
},
|
|
@@ -4414,12 +4592,12 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
4414
4592
|
}
|
|
4415
4593
|
});
|
|
4416
4594
|
|
|
4417
|
-
const _hoisted_1$
|
|
4418
|
-
const _hoisted_2$
|
|
4595
|
+
const _hoisted_1$j = { class: "m-fields-event-select" };
|
|
4596
|
+
const _hoisted_2$c = {
|
|
4419
4597
|
key: 1,
|
|
4420
4598
|
class: "fullWidth"
|
|
4421
4599
|
};
|
|
4422
|
-
const _sfc_main$
|
|
4600
|
+
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
4423
4601
|
...{
|
|
4424
4602
|
name: "MEditorEventSelect"
|
|
4425
4603
|
},
|
|
@@ -4622,7 +4800,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
4622
4800
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
4623
4801
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
4624
4802
|
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
4625
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4803
|
+
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
4626
4804
|
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
4627
4805
|
key: 0,
|
|
4628
4806
|
ref: "eventForm",
|
|
@@ -4632,7 +4810,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
4632
4810
|
model: _ctx.model,
|
|
4633
4811
|
config: tableConfig.value,
|
|
4634
4812
|
onChange: onChangeHandler
|
|
4635
|
-
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
4813
|
+
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$c, [
|
|
4636
4814
|
createVNode(unref(TMagicButton), {
|
|
4637
4815
|
class: "create-button",
|
|
4638
4816
|
type: "primary",
|
|
@@ -4682,32 +4860,32 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
4682
4860
|
}
|
|
4683
4861
|
});
|
|
4684
4862
|
|
|
4685
|
-
const _hoisted_1$
|
|
4863
|
+
const _hoisted_1$i = {
|
|
4686
4864
|
viewBox: "0 0 32 32",
|
|
4687
4865
|
version: "1.1",
|
|
4688
4866
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4689
4867
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
4690
4868
|
};
|
|
4691
|
-
const _hoisted_2$
|
|
4692
|
-
const _hoisted_4$
|
|
4693
|
-
_hoisted_2$
|
|
4869
|
+
const _hoisted_2$b = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2);
|
|
4870
|
+
const _hoisted_4$4 = [
|
|
4871
|
+
_hoisted_2$b
|
|
4694
4872
|
];
|
|
4695
|
-
const _sfc_main$
|
|
4873
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
4696
4874
|
...{
|
|
4697
4875
|
name: "MEditorCodeIcon"
|
|
4698
4876
|
},
|
|
4699
4877
|
__name: "CodeIcon",
|
|
4700
4878
|
setup(__props) {
|
|
4701
4879
|
return (_ctx, _cache) => {
|
|
4702
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
4880
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$i, _hoisted_4$4);
|
|
4703
4881
|
};
|
|
4704
4882
|
}
|
|
4705
4883
|
});
|
|
4706
4884
|
|
|
4707
|
-
const _hoisted_1$
|
|
4708
|
-
const _hoisted_2$
|
|
4709
|
-
const _hoisted_3$
|
|
4710
|
-
const _sfc_main$
|
|
4885
|
+
const _hoisted_1$h = { class: "m-fields-key-value" };
|
|
4886
|
+
const _hoisted_2$a = { key: 0 };
|
|
4887
|
+
const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
4888
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
4711
4889
|
...{
|
|
4712
4890
|
name: "MEditorKeyValue"
|
|
4713
4891
|
},
|
|
@@ -4765,8 +4943,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4765
4943
|
emit("change", v);
|
|
4766
4944
|
};
|
|
4767
4945
|
return (_ctx, _cache) => {
|
|
4768
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4769
|
-
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
4946
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
4947
|
+
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
|
|
4770
4948
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
4771
4949
|
return openBlock(), createElementBlock("div", {
|
|
4772
4950
|
class: "m-fields-key-value-item",
|
|
@@ -4780,7 +4958,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4780
4958
|
size: _ctx.size,
|
|
4781
4959
|
onChange: keyChangeHandler
|
|
4782
4960
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
|
|
4783
|
-
_hoisted_3$
|
|
4961
|
+
_hoisted_3$5,
|
|
4784
4962
|
createVNode(unref(TMagicInput), {
|
|
4785
4963
|
placeholder: "value",
|
|
4786
4964
|
modelValue: records.value[index][1],
|
|
@@ -4815,7 +4993,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4815
4993
|
_: 1
|
|
4816
4994
|
}, 8, ["size", "disabled", "icon"])
|
|
4817
4995
|
])) : createCommentVNode("", true),
|
|
4818
|
-
_ctx.config.advanced && showCode.value ? (openBlock(), createBlock(_sfc_main$
|
|
4996
|
+
_ctx.config.advanced && showCode.value ? (openBlock(), createBlock(_sfc_main$Q, {
|
|
4819
4997
|
key: 1,
|
|
4820
4998
|
height: "200px",
|
|
4821
4999
|
"init-values": _ctx.model[_ctx.name],
|
|
@@ -4831,7 +5009,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4831
5009
|
size: "default",
|
|
4832
5010
|
disabled: _ctx.disabled,
|
|
4833
5011
|
text: "",
|
|
4834
|
-
icon: _sfc_main$
|
|
5012
|
+
icon: _sfc_main$A,
|
|
4835
5013
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
4836
5014
|
}, null, 8, ["disabled"])) : createCommentVNode("", true)
|
|
4837
5015
|
]);
|
|
@@ -4839,12 +5017,12 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4839
5017
|
}
|
|
4840
5018
|
});
|
|
4841
5019
|
|
|
4842
|
-
const _hoisted_1$
|
|
5020
|
+
const _hoisted_1$g = {
|
|
4843
5021
|
key: 1,
|
|
4844
5022
|
class: "m-fields-ui-select",
|
|
4845
5023
|
style: { "display": "flex" }
|
|
4846
5024
|
};
|
|
4847
|
-
const _sfc_main$
|
|
5025
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
4848
5026
|
...{
|
|
4849
5027
|
name: "MEditorUISelect"
|
|
4850
5028
|
},
|
|
@@ -4934,7 +5112,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4934
5112
|
]),
|
|
4935
5113
|
_: 1
|
|
4936
5114
|
}, 8, ["icon", "disabled", "size"])
|
|
4937
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5115
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
4938
5116
|
val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4939
5117
|
createVNode(unref(TMagicTooltip), {
|
|
4940
5118
|
content: "清除",
|
|
@@ -5001,8 +5179,6 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
5001
5179
|
}
|
|
5002
5180
|
});
|
|
5003
5181
|
|
|
5004
|
-
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
5005
|
-
|
|
5006
5182
|
const useGetSo = (target, emit) => {
|
|
5007
5183
|
let getso;
|
|
5008
5184
|
const isDraging = ref(false);
|
|
@@ -5031,7 +5207,7 @@ const useGetSo = (target, emit) => {
|
|
|
5031
5207
|
};
|
|
5032
5208
|
};
|
|
5033
5209
|
|
|
5034
|
-
const _sfc_main$
|
|
5210
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
5035
5211
|
...{
|
|
5036
5212
|
name: "MEditorResizer"
|
|
5037
5213
|
},
|
|
@@ -5053,7 +5229,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
5053
5229
|
}
|
|
5054
5230
|
});
|
|
5055
5231
|
|
|
5056
|
-
const _sfc_main$
|
|
5232
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
5057
5233
|
...{
|
|
5058
5234
|
name: "MEditorLayout"
|
|
5059
5235
|
},
|
|
@@ -5180,7 +5356,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5180
5356
|
}, [
|
|
5181
5357
|
renderSlot(_ctx.$slots, "left")
|
|
5182
5358
|
], 6),
|
|
5183
|
-
createVNode(_sfc_main$
|
|
5359
|
+
createVNode(_sfc_main$x, { onChange: changeLeft })
|
|
5184
5360
|
], 64)) : createCommentVNode("", true),
|
|
5185
5361
|
createElementVNode("div", {
|
|
5186
5362
|
class: normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
|
|
@@ -5189,7 +5365,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5189
5365
|
renderSlot(_ctx.$slots, "center")
|
|
5190
5366
|
], 6),
|
|
5191
5367
|
hasRight.value && _ctx.$slots.right ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
5192
|
-
createVNode(_sfc_main$
|
|
5368
|
+
createVNode(_sfc_main$x, { onChange: changeRight }),
|
|
5193
5369
|
createElementVNode("div", {
|
|
5194
5370
|
class: normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
|
|
5195
5371
|
style: normalizeStyle(`width: ${_ctx.right}px`)
|
|
@@ -5202,10 +5378,10 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
5202
5378
|
}
|
|
5203
5379
|
});
|
|
5204
5380
|
|
|
5205
|
-
const _hoisted_1$
|
|
5206
|
-
const _hoisted_2$
|
|
5207
|
-
const _hoisted_3$
|
|
5208
|
-
const _sfc_main$
|
|
5381
|
+
const _hoisted_1$f = { class: "m-editor-empty-panel" };
|
|
5382
|
+
const _hoisted_2$9 = { class: "m-editor-empty-content" };
|
|
5383
|
+
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
5384
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
5209
5385
|
...{
|
|
5210
5386
|
name: "MEditorAddPageBox"
|
|
5211
5387
|
},
|
|
@@ -5225,16 +5401,16 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5225
5401
|
});
|
|
5226
5402
|
};
|
|
5227
5403
|
return (_ctx, _cache) => {
|
|
5228
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5229
|
-
createElementVNode("div", _hoisted_2$
|
|
5404
|
+
return openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
5405
|
+
createElementVNode("div", _hoisted_2$9, [
|
|
5230
5406
|
createElementVNode("div", {
|
|
5231
5407
|
class: "m-editor-empty-button",
|
|
5232
5408
|
onClick: clickHandler
|
|
5233
5409
|
}, [
|
|
5234
5410
|
createElementVNode("div", null, [
|
|
5235
|
-
createVNode(_sfc_main$
|
|
5411
|
+
createVNode(_sfc_main$K, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
5236
5412
|
]),
|
|
5237
|
-
_hoisted_3$
|
|
5413
|
+
_hoisted_3$4
|
|
5238
5414
|
])
|
|
5239
5415
|
])
|
|
5240
5416
|
]);
|
|
@@ -5246,7 +5422,7 @@ const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
|
5246
5422
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
5247
5423
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
5248
5424
|
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
5249
|
-
const _sfc_main$
|
|
5425
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
5250
5426
|
...{
|
|
5251
5427
|
name: "MEditorFramework"
|
|
5252
5428
|
},
|
|
@@ -5321,13 +5497,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5321
5497
|
renderSlot(_ctx.$slots, "nav"),
|
|
5322
5498
|
renderSlot(_ctx.$slots, "content-before"),
|
|
5323
5499
|
showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
|
|
5324
|
-
createVNode(_sfc_main$
|
|
5500
|
+
createVNode(_sfc_main$Q, {
|
|
5325
5501
|
class: "m-editor-content",
|
|
5326
5502
|
"init-values": root.value,
|
|
5327
5503
|
options: unref(codeOptions),
|
|
5328
5504
|
onSave: saveCode
|
|
5329
5505
|
}, null, 8, ["init-values", "options"])
|
|
5330
|
-
]) : (openBlock(), createBlock(_sfc_main$
|
|
5506
|
+
]) : (openBlock(), createBlock(_sfc_main$w, {
|
|
5331
5507
|
key: 1,
|
|
5332
5508
|
ref_key: "splitView",
|
|
5333
5509
|
ref: splitView,
|
|
@@ -5349,7 +5525,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5349
5525
|
]),
|
|
5350
5526
|
center: withCtx(() => [
|
|
5351
5527
|
pageLength.value > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
5352
|
-
createVNode(_sfc_main$
|
|
5528
|
+
createVNode(_sfc_main$v)
|
|
5353
5529
|
])
|
|
5354
5530
|
]),
|
|
5355
5531
|
_: 2
|
|
@@ -5374,12 +5550,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5374
5550
|
}
|
|
5375
5551
|
});
|
|
5376
5552
|
|
|
5377
|
-
const _hoisted_1$
|
|
5553
|
+
const _hoisted_1$e = {
|
|
5378
5554
|
key: 1,
|
|
5379
5555
|
class: "menu-item-text"
|
|
5380
5556
|
};
|
|
5381
|
-
const _hoisted_2$
|
|
5382
|
-
const _sfc_main$
|
|
5557
|
+
const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
|
|
5558
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
5383
5559
|
...{
|
|
5384
5560
|
name: "MEditorToolButton"
|
|
5385
5561
|
},
|
|
@@ -5458,7 +5634,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5458
5634
|
_ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
5459
5635
|
key: 0,
|
|
5460
5636
|
direction: _ctx.data.direction || "vertical"
|
|
5461
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5637
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$e, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
5462
5638
|
_ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
5463
5639
|
key: 0,
|
|
5464
5640
|
effect: "dark",
|
|
@@ -5472,7 +5648,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5472
5648
|
disabled: disabled.value
|
|
5473
5649
|
}, {
|
|
5474
5650
|
default: withCtx(() => [
|
|
5475
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
5651
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$K, {
|
|
5476
5652
|
key: 0,
|
|
5477
5653
|
icon: _ctx.data.icon
|
|
5478
5654
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -5490,7 +5666,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5490
5666
|
title: _ctx.data.text
|
|
5491
5667
|
}, {
|
|
5492
5668
|
default: withCtx(() => [
|
|
5493
|
-
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
5669
|
+
_ctx.data.icon ? (openBlock(), createBlock(_sfc_main$K, {
|
|
5494
5670
|
key: 0,
|
|
5495
5671
|
icon: _ctx.data.icon
|
|
5496
5672
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -5523,7 +5699,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5523
5699
|
})) : createCommentVNode("", true)
|
|
5524
5700
|
]),
|
|
5525
5701
|
default: withCtx(() => [
|
|
5526
|
-
createElementVNode("span", _hoisted_2$
|
|
5702
|
+
createElementVNode("span", _hoisted_2$8, [
|
|
5527
5703
|
createTextVNode(toDisplayString(_ctx.data.text), 1),
|
|
5528
5704
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
5529
5705
|
default: withCtx(() => [
|
|
@@ -5540,7 +5716,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
5540
5716
|
}
|
|
5541
5717
|
});
|
|
5542
5718
|
|
|
5543
|
-
const _sfc_main$
|
|
5719
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
5544
5720
|
...{
|
|
5545
5721
|
name: "MEditorNavMenu"
|
|
5546
5722
|
},
|
|
@@ -5702,7 +5878,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
5702
5878
|
style: normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
|
|
5703
5879
|
}, [
|
|
5704
5880
|
(openBlock(true), createElementBlock(Fragment, null, renderList(buttons.value[key], (item, index) => {
|
|
5705
|
-
return openBlock(), createBlock(_sfc_main$
|
|
5881
|
+
return openBlock(), createBlock(_sfc_main$t, {
|
|
5706
5882
|
data: item,
|
|
5707
5883
|
key: index
|
|
5708
5884
|
}, null, 8, ["data"]);
|
|
@@ -5714,8 +5890,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
5714
5890
|
}
|
|
5715
5891
|
});
|
|
5716
5892
|
|
|
5717
|
-
const _hoisted_1$
|
|
5718
|
-
const _sfc_main$
|
|
5893
|
+
const _hoisted_1$d = { class: "m-editor-props-panel" };
|
|
5894
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
5719
5895
|
...{
|
|
5720
5896
|
name: "MEditorPropsPanel"
|
|
5721
5897
|
},
|
|
@@ -5769,7 +5945,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
5769
5945
|
};
|
|
5770
5946
|
__expose({ configForm, submit });
|
|
5771
5947
|
return (_ctx, _cache) => {
|
|
5772
|
-
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$
|
|
5948
|
+
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
5773
5949
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
5774
5950
|
createVNode(unref(MForm), {
|
|
5775
5951
|
ref_key: "configForm",
|
|
@@ -5920,7 +6096,7 @@ const useFloatBox = (slideKeys) => {
|
|
|
5920
6096
|
};
|
|
5921
6097
|
};
|
|
5922
6098
|
|
|
5923
|
-
const _sfc_main$
|
|
6099
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
5924
6100
|
...{
|
|
5925
6101
|
name: "MEditorSearchInput"
|
|
5926
6102
|
},
|
|
@@ -5960,198 +6136,403 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
5960
6136
|
}
|
|
5961
6137
|
});
|
|
5962
6138
|
|
|
5963
|
-
const
|
|
5964
|
-
const
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
})
|
|
5972
|
-
|
|
5973
|
-
], -1);
|
|
5974
|
-
const _hoisted_3$8 = [
|
|
5975
|
-
_hoisted_2$d
|
|
5976
|
-
];
|
|
5977
|
-
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
5978
|
-
...{
|
|
5979
|
-
name: "MEditorAppManageIcon"
|
|
5980
|
-
},
|
|
5981
|
-
__name: "AppManageIcon",
|
|
5982
|
-
setup(__props) {
|
|
5983
|
-
return (_ctx, _cache) => {
|
|
5984
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$h, _hoisted_3$8);
|
|
5985
|
-
};
|
|
5986
|
-
}
|
|
5987
|
-
});
|
|
6139
|
+
const updateStatus = (nodeStatusMap, id, status) => {
|
|
6140
|
+
const nodeStatus = nodeStatusMap.get(id);
|
|
6141
|
+
if (!nodeStatus)
|
|
6142
|
+
return;
|
|
6143
|
+
getKeys(status).forEach((key) => {
|
|
6144
|
+
if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
|
|
6145
|
+
nodeStatus[key] = Boolean(status[key]);
|
|
6146
|
+
}
|
|
6147
|
+
});
|
|
6148
|
+
};
|
|
5988
6149
|
|
|
5989
|
-
const _hoisted_1$
|
|
5990
|
-
const _hoisted_2$
|
|
5991
|
-
const _hoisted_3$
|
|
5992
|
-
|
|
5993
|
-
|
|
6150
|
+
const _hoisted_1$c = ["draggable", "data-node-id", "data-is-container"];
|
|
6151
|
+
const _hoisted_2$7 = { class: "tree-node-label" };
|
|
6152
|
+
const _hoisted_3$3 = { class: "tree-node-tool" };
|
|
6153
|
+
const _hoisted_4$3 = {
|
|
6154
|
+
key: 0,
|
|
6155
|
+
class: "m-editor-tree-node-children"
|
|
5994
6156
|
};
|
|
5995
|
-
const _sfc_main$
|
|
6157
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
5996
6158
|
...{
|
|
5997
|
-
name: "
|
|
6159
|
+
name: "MEditorTreeNode"
|
|
5998
6160
|
},
|
|
5999
|
-
__name: "
|
|
6161
|
+
__name: "TreeNode",
|
|
6000
6162
|
props: {
|
|
6001
|
-
|
|
6163
|
+
data: {},
|
|
6164
|
+
nodeStatusMap: {},
|
|
6165
|
+
indent: { default: 0 }
|
|
6002
6166
|
},
|
|
6003
|
-
emits: ["
|
|
6004
|
-
setup(__props, {
|
|
6167
|
+
emits: ["node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
|
|
6168
|
+
setup(__props, { emit: __emit }) {
|
|
6169
|
+
const treeEmit = inject("treeEmit");
|
|
6005
6170
|
const props = __props;
|
|
6006
|
-
const
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
type: "node",
|
|
6013
|
-
id,
|
|
6014
|
-
children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
|
|
6015
|
-
}));
|
|
6016
|
-
return {
|
|
6017
|
-
id: target.id,
|
|
6018
|
-
name: target.name,
|
|
6019
|
-
type: "code",
|
|
6020
|
-
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
6021
|
-
children: compNodes
|
|
6022
|
-
};
|
|
6023
|
-
})
|
|
6024
|
-
);
|
|
6025
|
-
const expandedKeys = computed(() => codeList.value.map((item) => item.id));
|
|
6026
|
-
const editable = computed(() => codeBlockService?.getEditStatus());
|
|
6027
|
-
const filterNode = (value, data) => {
|
|
6028
|
-
if (!value) {
|
|
6029
|
-
return true;
|
|
6171
|
+
const nodeStatus = computed(
|
|
6172
|
+
() => props.nodeStatusMap?.get(props.data.id) || {
|
|
6173
|
+
selected: false,
|
|
6174
|
+
expand: false,
|
|
6175
|
+
visible: false,
|
|
6176
|
+
draggable: false
|
|
6030
6177
|
}
|
|
6031
|
-
|
|
6178
|
+
);
|
|
6179
|
+
const expanded = computed(() => nodeStatus.value.expand);
|
|
6180
|
+
const selected = computed(() => nodeStatus.value.selected);
|
|
6181
|
+
const visible = computed(() => nodeStatus.value.visible);
|
|
6182
|
+
const draggable = computed(() => nodeStatus.value.draggable);
|
|
6183
|
+
const hasChilren = computed(() => props.data.items?.some((item) => props.nodeStatusMap.get(item.id)?.visible));
|
|
6184
|
+
const handleDragStart = (event) => {
|
|
6185
|
+
treeEmit?.("node-dragstart", event, props.data);
|
|
6032
6186
|
};
|
|
6033
|
-
const
|
|
6034
|
-
|
|
6035
|
-
editorService?.select(compId);
|
|
6036
|
-
stage?.select(compId);
|
|
6187
|
+
const handleDragLeave = (event) => {
|
|
6188
|
+
treeEmit?.("node-dragleave", event, props.data);
|
|
6037
6189
|
};
|
|
6038
|
-
const
|
|
6039
|
-
|
|
6040
|
-
selectComp(data.id);
|
|
6041
|
-
} else if (data.type === "key") {
|
|
6042
|
-
selectComp(node.parent.data.id);
|
|
6043
|
-
}
|
|
6190
|
+
const handleDragEnd = (event) => {
|
|
6191
|
+
treeEmit?.("node-dragend", event, props.data);
|
|
6044
6192
|
};
|
|
6045
|
-
const
|
|
6046
|
-
|
|
6193
|
+
const nodeContentmenuHandler = (event) => {
|
|
6194
|
+
treeEmit?.("node-contextmenu", event, props.data);
|
|
6047
6195
|
};
|
|
6048
|
-
const
|
|
6049
|
-
|
|
6050
|
-
const existBinds = Boolean(currentCode?.children.length);
|
|
6051
|
-
const undeleteableList = codeBlockService?.getUndeletableList() || [];
|
|
6052
|
-
if (!existBinds && !undeleteableList.includes(id)) {
|
|
6053
|
-
await tMagicMessageBox.confirm("确定删除该代码块吗?", "提示", {
|
|
6054
|
-
confirmButtonText: "确定",
|
|
6055
|
-
cancelButtonText: "取消",
|
|
6056
|
-
type: "warning"
|
|
6057
|
-
});
|
|
6058
|
-
emit("remove", id);
|
|
6059
|
-
} else {
|
|
6060
|
-
if (typeof props.customError === "function") {
|
|
6061
|
-
props.customError(id, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
6062
|
-
} else {
|
|
6063
|
-
tMagicMessage.error("代码块删除失败");
|
|
6064
|
-
}
|
|
6065
|
-
}
|
|
6196
|
+
const mouseenterHandler = (event) => {
|
|
6197
|
+
treeEmit?.("node-mouseenter", event, props.data);
|
|
6066
6198
|
};
|
|
6067
|
-
const
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6199
|
+
const expandHandler = () => {
|
|
6200
|
+
updateStatus(props.nodeStatusMap, props.data.id, {
|
|
6201
|
+
expand: !expanded.value
|
|
6202
|
+
});
|
|
6203
|
+
};
|
|
6204
|
+
const nodeClickHandler = (event) => {
|
|
6205
|
+
treeEmit?.("node-click", event, props.data);
|
|
6206
|
+
};
|
|
6207
|
+
return (_ctx, _cache) => {
|
|
6208
|
+
const _component_TreeNode = resolveComponent("TreeNode", true);
|
|
6209
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
6210
|
+
class: "m-editor-tree-node",
|
|
6211
|
+
draggable: draggable.value,
|
|
6212
|
+
"data-node-id": _ctx.data.id,
|
|
6213
|
+
"data-is-container": Array.isArray(_ctx.data.items),
|
|
6214
|
+
onDragstart: handleDragStart,
|
|
6215
|
+
onDragleave: handleDragLeave,
|
|
6216
|
+
onDragend: handleDragEnd
|
|
6217
|
+
}, [
|
|
6218
|
+
createElementVNode("div", {
|
|
6219
|
+
class: normalizeClass(["tree-node", { selected: selected.value, expanded: expanded.value }]),
|
|
6220
|
+
style: normalizeStyle(`padding-left: ${_ctx.indent}px`),
|
|
6221
|
+
onContextmenu: nodeContentmenuHandler,
|
|
6222
|
+
onMouseenter: mouseenterHandler
|
|
6223
|
+
}, [
|
|
6224
|
+
createVNode(_sfc_main$K, {
|
|
6225
|
+
class: "expand-icon",
|
|
6226
|
+
style: normalizeStyle(hasChilren.value ? "" : "color: transparent; cursor: default"),
|
|
6227
|
+
icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
|
|
6228
|
+
onClick: expandHandler
|
|
6229
|
+
}, null, 8, ["style", "icon"]),
|
|
6230
|
+
createElementVNode("div", {
|
|
6231
|
+
class: "tree-node-content",
|
|
6232
|
+
onClick: nodeClickHandler
|
|
6233
|
+
}, [
|
|
6234
|
+
renderSlot(_ctx.$slots, "tree-node-content", { data: _ctx.data }, () => [
|
|
6235
|
+
createElementVNode("div", _hoisted_2$7, [
|
|
6236
|
+
renderSlot(_ctx.$slots, "tree-node-label", { data: _ctx.data }, () => [
|
|
6237
|
+
createTextVNode(toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1)
|
|
6238
|
+
])
|
|
6239
|
+
]),
|
|
6240
|
+
createElementVNode("div", _hoisted_3$3, [
|
|
6241
|
+
renderSlot(_ctx.$slots, "tree-node-tool", { data: _ctx.data })
|
|
6242
|
+
])
|
|
6243
|
+
])
|
|
6244
|
+
])
|
|
6245
|
+
], 38),
|
|
6246
|
+
hasChilren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
|
|
6247
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (item) => {
|
|
6248
|
+
return openBlock(), createBlock(_component_TreeNode, {
|
|
6249
|
+
key: item.id,
|
|
6250
|
+
data: item,
|
|
6251
|
+
"node-status-map": _ctx.nodeStatusMap,
|
|
6252
|
+
indent: _ctx.indent + 11
|
|
6253
|
+
}, {
|
|
6254
|
+
"tree-node-content": withCtx(({ data: nodeData }) => [
|
|
6255
|
+
renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })
|
|
6256
|
+
]),
|
|
6257
|
+
"tree-node-label": withCtx(({ data: nodeData }) => [
|
|
6258
|
+
renderSlot(_ctx.$slots, "tree-node-label", { data: nodeData })
|
|
6259
|
+
]),
|
|
6260
|
+
"tree-node-tool": withCtx(({ data: nodeData }) => [
|
|
6261
|
+
renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
|
|
6262
|
+
]),
|
|
6263
|
+
_: 2
|
|
6264
|
+
}, 1032, ["data", "node-status-map", "indent"]);
|
|
6265
|
+
}), 128))
|
|
6266
|
+
])) : createCommentVNode("", true)
|
|
6267
|
+
], 40, _hoisted_1$c)), [
|
|
6268
|
+
[vShow, visible.value]
|
|
6269
|
+
]);
|
|
6270
|
+
};
|
|
6271
|
+
}
|
|
6272
|
+
});
|
|
6273
|
+
|
|
6274
|
+
const _hoisted_1$b = { key: 1 };
|
|
6275
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
6276
|
+
...{
|
|
6277
|
+
name: "MEditorTree"
|
|
6278
|
+
},
|
|
6279
|
+
__name: "Tree",
|
|
6280
|
+
props: {
|
|
6281
|
+
data: {},
|
|
6282
|
+
nodeStatusMap: {},
|
|
6283
|
+
indent: { default: 0 },
|
|
6284
|
+
emptyText: { default: "暂无数据" }
|
|
6285
|
+
},
|
|
6286
|
+
emits: ["node-dragover", "node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
|
|
6287
|
+
setup(__props, { emit: __emit }) {
|
|
6288
|
+
const emit = __emit;
|
|
6289
|
+
provide("treeEmit", emit);
|
|
6290
|
+
const handleDragOver = (event) => {
|
|
6291
|
+
emit("node-dragover", event);
|
|
6292
|
+
};
|
|
6293
|
+
return (_ctx, _cache) => {
|
|
6294
|
+
return openBlock(), createElementBlock("div", {
|
|
6295
|
+
class: "m-editor-tree",
|
|
6296
|
+
onDragover: handleDragOver
|
|
6297
|
+
}, [
|
|
6298
|
+
_ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
|
|
6299
|
+
return openBlock(), createBlock(_sfc_main$p, {
|
|
6300
|
+
key: item.id,
|
|
6301
|
+
data: item,
|
|
6302
|
+
indent: _ctx.indent,
|
|
6303
|
+
"node-status-map": _ctx.nodeStatusMap
|
|
6304
|
+
}, {
|
|
6305
|
+
"tree-node-content": withCtx(({ data: nodeData }) => [
|
|
6306
|
+
renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })
|
|
6307
|
+
]),
|
|
6308
|
+
"tree-node-label": withCtx(({ data: nodeData }) => [
|
|
6309
|
+
renderSlot(_ctx.$slots, "tree-node-label", { data: nodeData })
|
|
6310
|
+
]),
|
|
6311
|
+
"tree-node-tool": withCtx(({ data: nodeData }) => [
|
|
6312
|
+
renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
|
|
6313
|
+
]),
|
|
6314
|
+
_: 2
|
|
6315
|
+
}, 1032, ["data", "indent", "node-status-map"]);
|
|
6316
|
+
}), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
6317
|
+
createElementVNode("p", null, toDisplayString(_ctx.emptyText), 1)
|
|
6318
|
+
]))
|
|
6319
|
+
], 32);
|
|
6320
|
+
};
|
|
6321
|
+
}
|
|
6322
|
+
});
|
|
6323
|
+
|
|
6324
|
+
const useFilter = (nodeData, nodeStatusMap, filterNodeMethod) => {
|
|
6325
|
+
const filterIsMatch = (value, data) => {
|
|
6326
|
+
const string = !Array.isArray(value) ? [value] : value;
|
|
6327
|
+
if (!string.length) {
|
|
6328
|
+
return true;
|
|
6329
|
+
}
|
|
6330
|
+
return string.some((v) => filterNodeMethod(v, data));
|
|
6331
|
+
};
|
|
6332
|
+
const filter = (text) => {
|
|
6333
|
+
if (!nodeData.value.length)
|
|
6334
|
+
return;
|
|
6335
|
+
nodeData.value.forEach((node) => {
|
|
6336
|
+
traverseNode(node, (node2, parents) => {
|
|
6337
|
+
if (!nodeStatusMap.value)
|
|
6338
|
+
return;
|
|
6339
|
+
const visible = filterIsMatch(text, node2);
|
|
6340
|
+
if (visible && parents.length) {
|
|
6341
|
+
parents.forEach((parent) => {
|
|
6342
|
+
updateStatus(nodeStatusMap.value, parent.id, {
|
|
6343
|
+
visible,
|
|
6344
|
+
expand: true
|
|
6345
|
+
});
|
|
6346
|
+
});
|
|
6347
|
+
}
|
|
6348
|
+
updateStatus(nodeStatusMap.value, node2.id, {
|
|
6349
|
+
visible
|
|
6350
|
+
});
|
|
6351
|
+
});
|
|
6352
|
+
});
|
|
6353
|
+
};
|
|
6354
|
+
return {
|
|
6355
|
+
filterText: ref(""),
|
|
6356
|
+
filterTextChangeHandler(text) {
|
|
6357
|
+
filter(text);
|
|
6358
|
+
}
|
|
6359
|
+
};
|
|
6360
|
+
};
|
|
6361
|
+
|
|
6362
|
+
const createPageNodeStatus$1 = (nodeData, initalLayerNodeStatus) => {
|
|
6363
|
+
const map = /* @__PURE__ */ new Map();
|
|
6364
|
+
nodeData.forEach(
|
|
6365
|
+
(node) => traverseNode(node, (node2) => {
|
|
6366
|
+
map.set(
|
|
6367
|
+
node2.id,
|
|
6368
|
+
initalLayerNodeStatus?.get(node2.id) || {
|
|
6369
|
+
visible: true,
|
|
6370
|
+
expand: false,
|
|
6371
|
+
selected: false,
|
|
6372
|
+
draggable: false
|
|
6373
|
+
}
|
|
6374
|
+
);
|
|
6375
|
+
})
|
|
6376
|
+
);
|
|
6377
|
+
return map;
|
|
6378
|
+
};
|
|
6379
|
+
const useNodeStatus$1 = (nodeData) => {
|
|
6380
|
+
const nodeStatusMap = ref(/* @__PURE__ */ new Map());
|
|
6381
|
+
watch(
|
|
6382
|
+
nodeData,
|
|
6383
|
+
(nodeData2) => {
|
|
6384
|
+
nodeStatusMap.value = createPageNodeStatus$1(nodeData2, nodeStatusMap.value);
|
|
6385
|
+
},
|
|
6386
|
+
{
|
|
6387
|
+
immediate: true,
|
|
6388
|
+
deep: true
|
|
6389
|
+
}
|
|
6390
|
+
);
|
|
6391
|
+
return {
|
|
6392
|
+
nodeStatusMap
|
|
6393
|
+
};
|
|
6394
|
+
};
|
|
6395
|
+
|
|
6396
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
6397
|
+
...{
|
|
6398
|
+
name: "MEditorCodeBlockList"
|
|
6399
|
+
},
|
|
6400
|
+
__name: "CodeBlockList",
|
|
6401
|
+
props: {
|
|
6402
|
+
customError: { type: Function }
|
|
6403
|
+
},
|
|
6404
|
+
emits: ["edit", "remove"],
|
|
6405
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6406
|
+
const props = __props;
|
|
6407
|
+
const emit = __emit;
|
|
6408
|
+
const services = inject("services");
|
|
6409
|
+
const { codeBlockService, depService, editorService } = services || {};
|
|
6410
|
+
const codeList = computed(
|
|
6411
|
+
() => Object.values(depService?.getTargets(DepTargetType.CODE_BLOCK) || {}).map((target) => {
|
|
6412
|
+
const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
|
|
6413
|
+
name: dep.name,
|
|
6414
|
+
type: "node",
|
|
6415
|
+
id: `${target.id}_${id}`,
|
|
6416
|
+
key: id,
|
|
6417
|
+
items: dep.keys.map((key) => {
|
|
6418
|
+
const data2 = { name: `${key}`, id: `${target.id}_${id}_${key}`, type: "key" };
|
|
6419
|
+
return data2;
|
|
6420
|
+
})
|
|
6421
|
+
}));
|
|
6422
|
+
const data = {
|
|
6423
|
+
id: target.id,
|
|
6424
|
+
key: target.id,
|
|
6425
|
+
name: target.name,
|
|
6426
|
+
type: "code",
|
|
6427
|
+
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
6428
|
+
items: compNodes
|
|
6429
|
+
};
|
|
6430
|
+
return data;
|
|
6431
|
+
})
|
|
6432
|
+
);
|
|
6433
|
+
const filterNode = (value, data) => {
|
|
6434
|
+
if (!value) {
|
|
6435
|
+
return true;
|
|
6436
|
+
}
|
|
6437
|
+
return `${data.name}${data.id}`.toLocaleLowerCase().includes(value.toLocaleLowerCase());
|
|
6438
|
+
};
|
|
6439
|
+
const { nodeStatusMap } = useNodeStatus$1(codeList);
|
|
6440
|
+
const { filterTextChangeHandler } = useFilter(codeList, nodeStatusMap, filterNode);
|
|
6441
|
+
const editable = computed(() => codeBlockService?.getEditStatus());
|
|
6442
|
+
const selectComp = (compId) => {
|
|
6443
|
+
const stage = editorService?.get("stage");
|
|
6444
|
+
editorService?.select(compId);
|
|
6445
|
+
stage?.select(compId);
|
|
6446
|
+
};
|
|
6447
|
+
const clickHandler = (event, data) => {
|
|
6448
|
+
if (data.type === "node") {
|
|
6449
|
+
selectComp(data.key);
|
|
6450
|
+
}
|
|
6451
|
+
};
|
|
6452
|
+
const editCode = (id) => {
|
|
6453
|
+
emit("edit", id);
|
|
6454
|
+
};
|
|
6455
|
+
const deleteCode = async (id) => {
|
|
6456
|
+
const currentCode = codeList.value.find((codeItem) => codeItem.id === id);
|
|
6457
|
+
const existBinds = Boolean(currentCode?.items?.length);
|
|
6458
|
+
const undeleteableList = codeBlockService?.getUndeletableList() || [];
|
|
6459
|
+
if (!existBinds && !undeleteableList.includes(id)) {
|
|
6460
|
+
await tMagicMessageBox.confirm("确定删除该代码块吗?", "提示", {
|
|
6461
|
+
confirmButtonText: "确定",
|
|
6462
|
+
cancelButtonText: "取消",
|
|
6463
|
+
type: "warning"
|
|
6464
|
+
});
|
|
6465
|
+
emit("remove", id);
|
|
6466
|
+
} else {
|
|
6467
|
+
if (typeof props.customError === "function") {
|
|
6468
|
+
props.customError(id, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
6469
|
+
} else {
|
|
6470
|
+
tMagicMessage.error("代码块删除失败");
|
|
6471
|
+
}
|
|
6071
6472
|
}
|
|
6473
|
+
};
|
|
6474
|
+
__expose({
|
|
6475
|
+
filter: filterTextChangeHandler
|
|
6072
6476
|
});
|
|
6073
6477
|
return (_ctx, _cache) => {
|
|
6074
|
-
return openBlock(), createBlock(
|
|
6075
|
-
ref_key: "tree",
|
|
6076
|
-
ref: tree,
|
|
6077
|
-
class: "magic-editor-layer-tree",
|
|
6078
|
-
"node-key": "id",
|
|
6079
|
-
"empty-text": "暂无代码块",
|
|
6080
|
-
"default-expanded-keys": expandedKeys.value,
|
|
6081
|
-
"expand-on-click-node": false,
|
|
6478
|
+
return openBlock(), createBlock(_sfc_main$o, {
|
|
6082
6479
|
data: codeList.value,
|
|
6083
|
-
|
|
6084
|
-
children: "children",
|
|
6085
|
-
label: "name",
|
|
6086
|
-
value: "id"
|
|
6087
|
-
},
|
|
6088
|
-
"highlight-current": true,
|
|
6089
|
-
"filter-node-method": filterNode,
|
|
6480
|
+
"node-status-map": unref(nodeStatusMap),
|
|
6090
6481
|
onNodeClick: clickHandler
|
|
6091
6482
|
}, {
|
|
6092
|
-
|
|
6483
|
+
"tree-node-label": withCtx(({ data }) => [
|
|
6093
6484
|
createElementVNode("div", {
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
]),
|
|
6137
|
-
_: 2
|
|
6138
|
-
}, 1024)) : createCommentVNode("", true),
|
|
6139
|
-
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
6140
|
-
id: data.id,
|
|
6141
|
-
data: data.codeBlockContent
|
|
6142
|
-
})
|
|
6143
|
-
])) : createCommentVNode("", true)
|
|
6144
|
-
])
|
|
6145
|
-
], 8, _hoisted_1$g)
|
|
6485
|
+
class: normalizeClass({
|
|
6486
|
+
code: data.type === "code",
|
|
6487
|
+
hook: data.type === "key",
|
|
6488
|
+
disabled: data.type === "key" || data.type === "code"
|
|
6489
|
+
})
|
|
6490
|
+
}, toDisplayString(data.name) + " " + toDisplayString(data.key ? `(${data.key})` : ""), 3)
|
|
6491
|
+
]),
|
|
6492
|
+
"tree-node-tool": withCtx(({ data }) => [
|
|
6493
|
+
data.type === "code" ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
6494
|
+
key: 0,
|
|
6495
|
+
effect: "dark",
|
|
6496
|
+
content: editable.value ? "编辑" : "查看",
|
|
6497
|
+
placement: "bottom"
|
|
6498
|
+
}, {
|
|
6499
|
+
default: withCtx(() => [
|
|
6500
|
+
createVNode(_sfc_main$K, {
|
|
6501
|
+
icon: editable.value ? unref(Edit) : unref(View),
|
|
6502
|
+
class: "edit-icon",
|
|
6503
|
+
onClick: withModifiers(($event) => editCode(`${data.key}`), ["stop"])
|
|
6504
|
+
}, null, 8, ["icon", "onClick"])
|
|
6505
|
+
]),
|
|
6506
|
+
_: 2
|
|
6507
|
+
}, 1032, ["content"])) : createCommentVNode("", true),
|
|
6508
|
+
data.type === "code" && editable.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
6509
|
+
key: 1,
|
|
6510
|
+
effect: "dark",
|
|
6511
|
+
content: "删除",
|
|
6512
|
+
placement: "bottom"
|
|
6513
|
+
}, {
|
|
6514
|
+
default: withCtx(() => [
|
|
6515
|
+
createVNode(_sfc_main$K, {
|
|
6516
|
+
icon: unref(Close),
|
|
6517
|
+
class: "edit-icon",
|
|
6518
|
+
onClick: withModifiers(($event) => deleteCode(`${data.key}`), ["stop"])
|
|
6519
|
+
}, null, 8, ["icon", "onClick"])
|
|
6520
|
+
]),
|
|
6521
|
+
_: 2
|
|
6522
|
+
}, 1024)) : createCommentVNode("", true),
|
|
6523
|
+
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
6524
|
+
id: data.key,
|
|
6525
|
+
data
|
|
6526
|
+
})
|
|
6146
6527
|
]),
|
|
6147
6528
|
_: 3
|
|
6148
|
-
}, 8, ["
|
|
6529
|
+
}, 8, ["data", "node-status-map"]);
|
|
6149
6530
|
};
|
|
6150
6531
|
}
|
|
6151
6532
|
});
|
|
6152
6533
|
|
|
6153
|
-
const _hoisted_1$
|
|
6154
|
-
const _sfc_main$
|
|
6534
|
+
const _hoisted_1$a = { class: "search-wrapper" };
|
|
6535
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
6155
6536
|
...{
|
|
6156
6537
|
name: "MEditorCodeBlockListPanel"
|
|
6157
6538
|
},
|
|
@@ -6170,11 +6551,11 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6170
6551
|
};
|
|
6171
6552
|
return (_ctx, _cache) => {
|
|
6172
6553
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
6173
|
-
createVNode(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-
|
|
6554
|
+
createVNode(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-layer-panel" }, {
|
|
6174
6555
|
default: withCtx(() => [
|
|
6175
6556
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
6176
|
-
createElementVNode("div", _hoisted_1$
|
|
6177
|
-
createVNode(_sfc_main$
|
|
6557
|
+
createElementVNode("div", _hoisted_1$a, [
|
|
6558
|
+
createVNode(_sfc_main$q, { onSearch: filterTextChangeHandler }),
|
|
6178
6559
|
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
6179
6560
|
key: 0,
|
|
6180
6561
|
class: "create-code-button",
|
|
@@ -6190,7 +6571,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6190
6571
|
renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
6191
6572
|
])
|
|
6192
6573
|
]),
|
|
6193
|
-
createVNode(_sfc_main$
|
|
6574
|
+
createVNode(_sfc_main$n, {
|
|
6194
6575
|
ref_key: "codeBlockList",
|
|
6195
6576
|
ref: codeBlockList,
|
|
6196
6577
|
"custom-error": _ctx.customError,
|
|
@@ -6208,7 +6589,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6208
6589
|
]),
|
|
6209
6590
|
_: 3
|
|
6210
6591
|
}),
|
|
6211
|
-
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$
|
|
6592
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$M, {
|
|
6212
6593
|
key: 0,
|
|
6213
6594
|
ref_key: "codeBlockEditor",
|
|
6214
6595
|
ref: codeBlockEditor,
|
|
@@ -6222,7 +6603,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
6222
6603
|
}
|
|
6223
6604
|
});
|
|
6224
6605
|
|
|
6225
|
-
const _sfc_main$
|
|
6606
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
6226
6607
|
...{
|
|
6227
6608
|
name: "MEditorDataSourceConfigPanel"
|
|
6228
6609
|
},
|
|
@@ -6278,13 +6659,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6278
6659
|
}
|
|
6279
6660
|
});
|
|
6280
6661
|
|
|
6281
|
-
const
|
|
6282
|
-
const _hoisted_2$b = { class: "list-item" };
|
|
6283
|
-
const _hoisted_3$6 = {
|
|
6284
|
-
key: 2,
|
|
6285
|
-
class: "right-tool"
|
|
6286
|
-
};
|
|
6287
|
-
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
6662
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
6288
6663
|
...{
|
|
6289
6664
|
name: "MEditorDataSourceList"
|
|
6290
6665
|
},
|
|
@@ -6298,20 +6673,27 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
6298
6673
|
const dsDep = computed(() => depService?.getTargets(DepTargetType.DATA_SOURCE) || {});
|
|
6299
6674
|
const dsMethodDep = computed(() => depService?.getTargets(DepTargetType.DATA_SOURCE_METHOD) || {});
|
|
6300
6675
|
const dsCondDep = computed(() => depService?.getTargets(DepTargetType.DATA_SOURCE_COND) || {});
|
|
6301
|
-
const getKeyTreeConfig = (dep, type) => dep.keys.map((key) => ({
|
|
6302
|
-
|
|
6676
|
+
const getKeyTreeConfig = (dep, type, parentKey) => dep.keys.map((key) => ({
|
|
6677
|
+
name: key,
|
|
6678
|
+
id: `${parentKey}_${key}`,
|
|
6679
|
+
type: "key",
|
|
6680
|
+
isMethod: type === "method",
|
|
6681
|
+
isCond: type === "cond"
|
|
6682
|
+
}));
|
|
6683
|
+
const getNodeTreeConfig = (id, dep, type, parentKey) => ({
|
|
6303
6684
|
name: dep.name,
|
|
6304
6685
|
type: "node",
|
|
6305
|
-
id
|
|
6306
|
-
|
|
6686
|
+
id: `${parentKey}_${id}`,
|
|
6687
|
+
key: id,
|
|
6688
|
+
items: getKeyTreeConfig(dep, type, `${parentKey}_${id}`)
|
|
6307
6689
|
});
|
|
6308
|
-
const mergeChildren = (
|
|
6690
|
+
const mergeChildren = (dsId, items, deps, type) => {
|
|
6309
6691
|
Object.entries(deps).forEach(([id, dep]) => {
|
|
6310
|
-
const nodeItem =
|
|
6692
|
+
const nodeItem = items.find((item) => item.key === id);
|
|
6311
6693
|
if (nodeItem) {
|
|
6312
|
-
nodeItem.
|
|
6694
|
+
nodeItem.items = nodeItem.items.concat(getKeyTreeConfig(dep, type, nodeItem.key));
|
|
6313
6695
|
} else {
|
|
6314
|
-
|
|
6696
|
+
items.push(getNodeTreeConfig(id, dep, type, dsId));
|
|
6315
6697
|
}
|
|
6316
6698
|
});
|
|
6317
6699
|
};
|
|
@@ -6320,18 +6702,27 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
6320
6702
|
const dsDeps = dsDep.value[ds.id]?.deps || {};
|
|
6321
6703
|
const dsMethodDeps = dsMethodDep.value[ds.id]?.deps || {};
|
|
6322
6704
|
const dsCondDeps = dsCondDep.value[ds.id]?.deps || {};
|
|
6323
|
-
const
|
|
6324
|
-
mergeChildren(
|
|
6325
|
-
mergeChildren(
|
|
6326
|
-
mergeChildren(
|
|
6705
|
+
const items = [];
|
|
6706
|
+
mergeChildren(ds.id, items, dsDeps);
|
|
6707
|
+
mergeChildren(ds.id, items, dsMethodDeps, "method");
|
|
6708
|
+
mergeChildren(ds.id, items, dsCondDeps, "cond");
|
|
6327
6709
|
return {
|
|
6328
6710
|
id: ds.id,
|
|
6711
|
+
key: ds.id,
|
|
6329
6712
|
name: ds.title,
|
|
6330
6713
|
type: "ds",
|
|
6331
|
-
|
|
6714
|
+
items
|
|
6332
6715
|
};
|
|
6333
6716
|
})
|
|
6334
6717
|
);
|
|
6718
|
+
const filterNode = (value, data) => {
|
|
6719
|
+
if (!value) {
|
|
6720
|
+
return true;
|
|
6721
|
+
}
|
|
6722
|
+
return `${data.name}${data.id}`.toLocaleLowerCase().includes(value.toLocaleLowerCase());
|
|
6723
|
+
};
|
|
6724
|
+
const { nodeStatusMap } = useNodeStatus$1(list);
|
|
6725
|
+
const { filterTextChangeHandler } = useFilter(list, nodeStatusMap, filterNode);
|
|
6335
6726
|
const editHandler = (id) => {
|
|
6336
6727
|
emit("edit", id);
|
|
6337
6728
|
};
|
|
@@ -6348,95 +6739,71 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
6348
6739
|
editorService?.select(compId);
|
|
6349
6740
|
stage?.select(compId);
|
|
6350
6741
|
};
|
|
6351
|
-
const clickHandler = (
|
|
6742
|
+
const clickHandler = (event, data) => {
|
|
6352
6743
|
if (data.type === "node") {
|
|
6353
|
-
selectComp(data.
|
|
6354
|
-
} else if (data.type === "key") {
|
|
6355
|
-
selectComp(node.parent.data.id);
|
|
6744
|
+
selectComp(data.key);
|
|
6356
6745
|
}
|
|
6357
6746
|
};
|
|
6358
|
-
const tree = ref();
|
|
6359
6747
|
__expose({
|
|
6360
|
-
filter
|
|
6361
|
-
tree.value?.filter(val);
|
|
6362
|
-
}
|
|
6748
|
+
filter: filterTextChangeHandler
|
|
6363
6749
|
});
|
|
6364
6750
|
return (_ctx, _cache) => {
|
|
6365
|
-
return openBlock(), createBlock(
|
|
6366
|
-
ref_key: "tree",
|
|
6367
|
-
ref: tree,
|
|
6368
|
-
class: "magic-editor-layer-tree",
|
|
6369
|
-
"node-key": "id",
|
|
6370
|
-
"empty-text": "暂无代码块",
|
|
6371
|
-
"default-expand-all": "",
|
|
6372
|
-
"expand-on-click-node": false,
|
|
6751
|
+
return openBlock(), createBlock(_sfc_main$o, {
|
|
6373
6752
|
data: list.value,
|
|
6374
|
-
"
|
|
6753
|
+
"node-status-map": unref(nodeStatusMap),
|
|
6375
6754
|
onNodeClick: clickHandler
|
|
6376
6755
|
}, {
|
|
6377
|
-
|
|
6756
|
+
"tree-node-label": withCtx(({ data }) => [
|
|
6378
6757
|
createElementVNode("div", {
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
createVNode(_sfc_main$N, {
|
|
6419
|
-
icon: unref(Close),
|
|
6420
|
-
class: "edit-icon",
|
|
6421
|
-
onClick: withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
|
|
6422
|
-
}, null, 8, ["icon", "onClick"])
|
|
6423
|
-
]),
|
|
6424
|
-
_: 2
|
|
6425
|
-
}, 1024)) : createCommentVNode("", true),
|
|
6426
|
-
renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
|
|
6427
|
-
])) : createCommentVNode("", true)
|
|
6428
|
-
])
|
|
6429
|
-
], 8, _hoisted_1$e)
|
|
6758
|
+
class: normalizeClass({
|
|
6759
|
+
ds: data.type === "ds",
|
|
6760
|
+
hook: data.type === "key",
|
|
6761
|
+
disabled: data.type === "key" || data.type === "ds"
|
|
6762
|
+
})
|
|
6763
|
+
}, toDisplayString(data.name) + " " + toDisplayString(data.key ? `(${data.key})` : ""), 3)
|
|
6764
|
+
]),
|
|
6765
|
+
"tree-node-tool": withCtx(({ data }) => [
|
|
6766
|
+
data.type === "ds" ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
6767
|
+
key: 0,
|
|
6768
|
+
effect: "dark",
|
|
6769
|
+
content: editable.value ? "编辑" : "查看",
|
|
6770
|
+
placement: "bottom"
|
|
6771
|
+
}, {
|
|
6772
|
+
default: withCtx(() => [
|
|
6773
|
+
createVNode(_sfc_main$K, {
|
|
6774
|
+
icon: editable.value ? unref(Edit) : unref(View),
|
|
6775
|
+
class: "edit-icon",
|
|
6776
|
+
onClick: withModifiers(($event) => editHandler(`${data.key}`), ["stop"])
|
|
6777
|
+
}, null, 8, ["icon", "onClick"])
|
|
6778
|
+
]),
|
|
6779
|
+
_: 2
|
|
6780
|
+
}, 1032, ["content"])) : createCommentVNode("", true),
|
|
6781
|
+
data.type === "ds" && editable.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
6782
|
+
key: 1,
|
|
6783
|
+
effect: "dark",
|
|
6784
|
+
content: "删除",
|
|
6785
|
+
placement: "bottom"
|
|
6786
|
+
}, {
|
|
6787
|
+
default: withCtx(() => [
|
|
6788
|
+
createVNode(_sfc_main$K, {
|
|
6789
|
+
icon: unref(Close),
|
|
6790
|
+
class: "edit-icon",
|
|
6791
|
+
onClick: withModifiers(($event) => removeHandler(`${data.key}`), ["stop"])
|
|
6792
|
+
}, null, 8, ["icon", "onClick"])
|
|
6793
|
+
]),
|
|
6794
|
+
_: 2
|
|
6795
|
+
}, 1024)) : createCommentVNode("", true),
|
|
6796
|
+
renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
|
|
6430
6797
|
]),
|
|
6431
6798
|
_: 3
|
|
6432
|
-
}, 8, ["data"]);
|
|
6799
|
+
}, 8, ["data", "node-status-map"]);
|
|
6433
6800
|
};
|
|
6434
6801
|
}
|
|
6435
6802
|
});
|
|
6436
6803
|
|
|
6437
|
-
const _hoisted_1$
|
|
6438
|
-
const _hoisted_2$
|
|
6439
|
-
const _sfc_main$
|
|
6804
|
+
const _hoisted_1$9 = { class: "search-wrapper" };
|
|
6805
|
+
const _hoisted_2$6 = { class: "data-source-list-panel-add-menu" };
|
|
6806
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
6440
6807
|
...{
|
|
6441
6808
|
name: "MEditorDataSourceListPanel"
|
|
6442
6809
|
},
|
|
@@ -6498,10 +6865,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6498
6865
|
};
|
|
6499
6866
|
return (_ctx, _cache) => {
|
|
6500
6867
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
6501
|
-
createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-
|
|
6868
|
+
createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-layer-panel" }, {
|
|
6502
6869
|
default: withCtx(() => [
|
|
6503
|
-
createElementVNode("div", _hoisted_1$
|
|
6504
|
-
createVNode(_sfc_main$
|
|
6870
|
+
createElementVNode("div", _hoisted_1$9, [
|
|
6871
|
+
createVNode(_sfc_main$q, { onSearch: filterTextChangeHandler }),
|
|
6505
6872
|
editable.value ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
6506
6873
|
key: 0,
|
|
6507
6874
|
placement: "right"
|
|
@@ -6518,9 +6885,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6518
6885
|
})
|
|
6519
6886
|
]),
|
|
6520
6887
|
default: withCtx(() => [
|
|
6521
|
-
createElementVNode("div", _hoisted_2$
|
|
6888
|
+
createElementVNode("div", _hoisted_2$6, [
|
|
6522
6889
|
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
6523
|
-
return openBlock(), createBlock(_sfc_main$
|
|
6890
|
+
return openBlock(), createBlock(_sfc_main$t, {
|
|
6524
6891
|
data: {
|
|
6525
6892
|
type: "button",
|
|
6526
6893
|
text: item.text,
|
|
@@ -6536,14 +6903,14 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6536
6903
|
_: 1
|
|
6537
6904
|
})) : createCommentVNode("", true)
|
|
6538
6905
|
]),
|
|
6539
|
-
createVNode(_sfc_main$
|
|
6906
|
+
createVNode(_sfc_main$k, {
|
|
6540
6907
|
onEdit: editHandler,
|
|
6541
6908
|
onRemove: removeHandler
|
|
6542
6909
|
})
|
|
6543
6910
|
]),
|
|
6544
6911
|
_: 1
|
|
6545
6912
|
}),
|
|
6546
|
-
createVNode(_sfc_main$
|
|
6913
|
+
createVNode(_sfc_main$l, {
|
|
6547
6914
|
ref_key: "editDialog",
|
|
6548
6915
|
ref: editDialog,
|
|
6549
6916
|
disabled: !editable.value,
|
|
@@ -6557,182 +6924,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6557
6924
|
}
|
|
6558
6925
|
});
|
|
6559
6926
|
|
|
6560
|
-
const
|
|
6561
|
-
const nodeStatus = nodeStatusMap.get(id);
|
|
6562
|
-
if (!nodeStatus)
|
|
6563
|
-
return;
|
|
6564
|
-
getKeys(status).forEach((key) => {
|
|
6565
|
-
if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
|
|
6566
|
-
nodeStatus[key] = Boolean(status[key]);
|
|
6567
|
-
}
|
|
6568
|
-
});
|
|
6569
|
-
};
|
|
6570
|
-
|
|
6571
|
-
const _hoisted_1$c = ["draggable", "data-node-id", "data-is-container"];
|
|
6572
|
-
const _hoisted_2$9 = { class: "tree-node-label" };
|
|
6573
|
-
const _hoisted_3$5 = { class: "tree-node-tool" };
|
|
6574
|
-
const _hoisted_4$5 = {
|
|
6575
|
-
key: 0,
|
|
6576
|
-
class: "m-editor-tree-node-children"
|
|
6577
|
-
};
|
|
6578
|
-
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
6579
|
-
...{
|
|
6580
|
-
name: "MEditorTreeNode"
|
|
6581
|
-
},
|
|
6582
|
-
__name: "TreeNode",
|
|
6583
|
-
props: {
|
|
6584
|
-
data: {},
|
|
6585
|
-
nodeStatusMap: {},
|
|
6586
|
-
indent: { default: 0 }
|
|
6587
|
-
},
|
|
6588
|
-
emits: ["node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
|
|
6589
|
-
setup(__props, { emit: __emit }) {
|
|
6590
|
-
const treeEmit = inject("treeEmit");
|
|
6591
|
-
const props = __props;
|
|
6592
|
-
const nodeStatus = computed(
|
|
6593
|
-
() => props.nodeStatusMap?.get(props.data.id) || {
|
|
6594
|
-
selected: false,
|
|
6595
|
-
expand: false,
|
|
6596
|
-
visible: false,
|
|
6597
|
-
draggable: false
|
|
6598
|
-
}
|
|
6599
|
-
);
|
|
6600
|
-
const expanded = computed(() => nodeStatus.value.expand);
|
|
6601
|
-
const selected = computed(() => nodeStatus.value.selected);
|
|
6602
|
-
const visible = computed(() => nodeStatus.value.visible);
|
|
6603
|
-
const draggable = computed(() => nodeStatus.value.draggable);
|
|
6604
|
-
const hasChilren = computed(() => props.data.items && props.data.items.length > 0);
|
|
6605
|
-
const handleDragStart = (event) => {
|
|
6606
|
-
treeEmit?.("node-dragstart", event, props.data);
|
|
6607
|
-
};
|
|
6608
|
-
const handleDragLeave = (event) => {
|
|
6609
|
-
treeEmit?.("node-dragleave", event, props.data);
|
|
6610
|
-
};
|
|
6611
|
-
const handleDragEnd = (event) => {
|
|
6612
|
-
treeEmit?.("node-dragend", event, props.data);
|
|
6613
|
-
};
|
|
6614
|
-
const nodeContentmenuHandler = (event) => {
|
|
6615
|
-
treeEmit?.("node-contextmenu", event, props.data);
|
|
6616
|
-
};
|
|
6617
|
-
const mouseenterHandler = (event) => {
|
|
6618
|
-
treeEmit?.("node-mouseenter", event, props.data);
|
|
6619
|
-
};
|
|
6620
|
-
const expandHandler = () => {
|
|
6621
|
-
updateStatus(props.nodeStatusMap, props.data.id, {
|
|
6622
|
-
expand: !expanded.value
|
|
6623
|
-
});
|
|
6624
|
-
};
|
|
6625
|
-
const nodeClickHandler = (event) => {
|
|
6626
|
-
treeEmit?.("node-click", event, props.data);
|
|
6627
|
-
};
|
|
6628
|
-
return (_ctx, _cache) => {
|
|
6629
|
-
const _component_TreeNode = resolveComponent("TreeNode", true);
|
|
6630
|
-
return withDirectives((openBlock(), createElementBlock("div", {
|
|
6631
|
-
class: "m-editor-tree-node",
|
|
6632
|
-
draggable: draggable.value,
|
|
6633
|
-
"data-node-id": _ctx.data.id,
|
|
6634
|
-
"data-is-container": Array.isArray(_ctx.data.items),
|
|
6635
|
-
onDragstart: handleDragStart,
|
|
6636
|
-
onDragleave: handleDragLeave,
|
|
6637
|
-
onDragend: handleDragEnd
|
|
6638
|
-
}, [
|
|
6639
|
-
createElementVNode("div", {
|
|
6640
|
-
class: normalizeClass(["tree-node", { selected: selected.value, expanded: expanded.value }]),
|
|
6641
|
-
style: normalizeStyle(`padding-left: ${_ctx.indent}px`),
|
|
6642
|
-
onContextmenu: nodeContentmenuHandler,
|
|
6643
|
-
onMouseenter: mouseenterHandler
|
|
6644
|
-
}, [
|
|
6645
|
-
createVNode(_sfc_main$N, {
|
|
6646
|
-
class: "expand-icon",
|
|
6647
|
-
style: normalizeStyle(hasChilren.value ? "" : "color: transparent; cursor: default"),
|
|
6648
|
-
icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
|
|
6649
|
-
onClick: expandHandler
|
|
6650
|
-
}, null, 8, ["style", "icon"]),
|
|
6651
|
-
createElementVNode("div", {
|
|
6652
|
-
class: "tree-node-content",
|
|
6653
|
-
onClick: nodeClickHandler
|
|
6654
|
-
}, [
|
|
6655
|
-
renderSlot(_ctx.$slots, "tree-node-content", { data: _ctx.data }, () => [
|
|
6656
|
-
createElementVNode("div", _hoisted_2$9, toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1),
|
|
6657
|
-
createElementVNode("div", _hoisted_3$5, [
|
|
6658
|
-
renderSlot(_ctx.$slots, "tree-node-tool", { data: _ctx.data })
|
|
6659
|
-
])
|
|
6660
|
-
])
|
|
6661
|
-
])
|
|
6662
|
-
], 38),
|
|
6663
|
-
hasChilren.value && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
|
|
6664
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.items, (item) => {
|
|
6665
|
-
return openBlock(), createBlock(_component_TreeNode, {
|
|
6666
|
-
key: item.id,
|
|
6667
|
-
data: item,
|
|
6668
|
-
"node-status-map": _ctx.nodeStatusMap,
|
|
6669
|
-
indent: _ctx.indent + 11
|
|
6670
|
-
}, {
|
|
6671
|
-
"tree-node-content": withCtx(({ data: nodeData }) => [
|
|
6672
|
-
renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })
|
|
6673
|
-
]),
|
|
6674
|
-
"tree-node-tool": withCtx(({ data: nodeData }) => [
|
|
6675
|
-
renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
|
|
6676
|
-
]),
|
|
6677
|
-
_: 2
|
|
6678
|
-
}, 1032, ["data", "node-status-map", "indent"]);
|
|
6679
|
-
}), 128))
|
|
6680
|
-
])) : createCommentVNode("", true)
|
|
6681
|
-
], 40, _hoisted_1$c)), [
|
|
6682
|
-
[vShow, visible.value]
|
|
6683
|
-
]);
|
|
6684
|
-
};
|
|
6685
|
-
}
|
|
6686
|
-
});
|
|
6687
|
-
|
|
6688
|
-
const _hoisted_1$b = { key: 1 };
|
|
6689
|
-
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
6690
|
-
...{
|
|
6691
|
-
name: "MEditorTree"
|
|
6692
|
-
},
|
|
6693
|
-
__name: "Tree",
|
|
6694
|
-
props: {
|
|
6695
|
-
data: {},
|
|
6696
|
-
nodeStatusMap: {},
|
|
6697
|
-
indent: { default: 0 },
|
|
6698
|
-
emptyText: { default: "暂无数据" }
|
|
6699
|
-
},
|
|
6700
|
-
emits: ["node-dragover", "node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
|
|
6701
|
-
setup(__props, { emit: __emit }) {
|
|
6702
|
-
const emit = __emit;
|
|
6703
|
-
provide("treeEmit", emit);
|
|
6704
|
-
const handleDragOver = (event) => {
|
|
6705
|
-
emit("node-dragover", event);
|
|
6706
|
-
};
|
|
6707
|
-
return (_ctx, _cache) => {
|
|
6708
|
-
return openBlock(), createElementBlock("div", {
|
|
6709
|
-
class: "m-editor-tree",
|
|
6710
|
-
onDragover: handleDragOver
|
|
6711
|
-
}, [
|
|
6712
|
-
_ctx.data?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.data, (item) => {
|
|
6713
|
-
return openBlock(), createBlock(_sfc_main$m, {
|
|
6714
|
-
key: item.id,
|
|
6715
|
-
data: item,
|
|
6716
|
-
indent: _ctx.indent,
|
|
6717
|
-
"node-status-map": _ctx.nodeStatusMap
|
|
6718
|
-
}, {
|
|
6719
|
-
"tree-node-content": withCtx(({ data: nodeData }) => [
|
|
6720
|
-
renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })
|
|
6721
|
-
]),
|
|
6722
|
-
"tree-node-tool": withCtx(({ data: nodeData }) => [
|
|
6723
|
-
renderSlot(_ctx.$slots, "tree-node-tool", { data: nodeData })
|
|
6724
|
-
]),
|
|
6725
|
-
_: 2
|
|
6726
|
-
}, 1032, ["data", "indent", "node-status-map"]);
|
|
6727
|
-
}), 128)) : (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
6728
|
-
createElementVNode("p", null, toDisplayString(_ctx.emptyText), 1)
|
|
6729
|
-
]))
|
|
6730
|
-
], 32);
|
|
6731
|
-
};
|
|
6732
|
-
}
|
|
6733
|
-
});
|
|
6734
|
-
|
|
6735
|
-
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
6927
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
6736
6928
|
...{
|
|
6737
6929
|
name: "MEditorContentMenu"
|
|
6738
6930
|
},
|
|
@@ -6863,7 +7055,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
6863
7055
|
renderSlot(_ctx.$slots, "title"),
|
|
6864
7056
|
createElementVNode("div", null, [
|
|
6865
7057
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
6866
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7058
|
+
return openBlock(), createBlock(_sfc_main$t, {
|
|
6867
7059
|
"event-type": "mouseup",
|
|
6868
7060
|
ref_for: true,
|
|
6869
7061
|
ref_key: "buttons",
|
|
@@ -6898,7 +7090,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
6898
7090
|
}
|
|
6899
7091
|
});
|
|
6900
7092
|
|
|
6901
|
-
const _hoisted_1$
|
|
7093
|
+
const _hoisted_1$8 = {
|
|
6902
7094
|
width: "1em",
|
|
6903
7095
|
height: "1em",
|
|
6904
7096
|
viewBox: "0 0 16 16",
|
|
@@ -6906,26 +7098,26 @@ const _hoisted_1$a = {
|
|
|
6906
7098
|
fill: "currentColor",
|
|
6907
7099
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6908
7100
|
};
|
|
6909
|
-
const _hoisted_2$
|
|
7101
|
+
const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("path", {
|
|
6910
7102
|
"fill-rule": "evenodd",
|
|
6911
7103
|
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"
|
|
6912
7104
|
}, null, -1);
|
|
6913
|
-
const _hoisted_3$
|
|
7105
|
+
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("path", {
|
|
6914
7106
|
"fill-rule": "evenodd",
|
|
6915
7107
|
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"
|
|
6916
7108
|
}, null, -1);
|
|
6917
|
-
const _hoisted_4$
|
|
6918
|
-
_hoisted_2$
|
|
6919
|
-
_hoisted_3$
|
|
7109
|
+
const _hoisted_4$2 = [
|
|
7110
|
+
_hoisted_2$5,
|
|
7111
|
+
_hoisted_3$2
|
|
6920
7112
|
];
|
|
6921
|
-
const _sfc_main$
|
|
7113
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
6922
7114
|
...{
|
|
6923
7115
|
name: "MEditorFolderMinusIcon"
|
|
6924
7116
|
},
|
|
6925
7117
|
__name: "FolderMinusIcon",
|
|
6926
7118
|
setup(__props) {
|
|
6927
7119
|
return (_ctx, _cache) => {
|
|
6928
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
7120
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$8, _hoisted_4$2);
|
|
6929
7121
|
};
|
|
6930
7122
|
}
|
|
6931
7123
|
});
|
|
@@ -6943,7 +7135,6 @@ const useDeleteMenu = () => ({
|
|
|
6943
7135
|
nodes && services?.editorService?.remove(nodes);
|
|
6944
7136
|
}
|
|
6945
7137
|
});
|
|
6946
|
-
const canPaste = ref(false);
|
|
6947
7138
|
const useCopyMenu = () => ({
|
|
6948
7139
|
type: "button",
|
|
6949
7140
|
text: "复制",
|
|
@@ -6951,14 +7142,13 @@ const useCopyMenu = () => ({
|
|
|
6951
7142
|
handler: (services) => {
|
|
6952
7143
|
const nodes = services?.editorService?.get("nodes");
|
|
6953
7144
|
nodes && services?.editorService?.copy(nodes);
|
|
6954
|
-
canPaste.value = true;
|
|
6955
7145
|
}
|
|
6956
7146
|
});
|
|
6957
7147
|
const usePasteMenu = (menu) => ({
|
|
6958
7148
|
type: "button",
|
|
6959
7149
|
text: "粘贴",
|
|
6960
7150
|
icon: markRaw(DocumentCopy),
|
|
6961
|
-
display: () =>
|
|
7151
|
+
display: (services) => !!services?.storageService?.getItem(COPY_STORAGE_KEY),
|
|
6962
7152
|
handler: (services) => {
|
|
6963
7153
|
const nodes = services?.editorService?.get("nodes");
|
|
6964
7154
|
if (!nodes || nodes.length === 0)
|
|
@@ -7005,7 +7195,7 @@ const useMoveToMenu = (services) => {
|
|
|
7005
7195
|
};
|
|
7006
7196
|
};
|
|
7007
7197
|
|
|
7008
|
-
const _sfc_main$
|
|
7198
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
7009
7199
|
...{
|
|
7010
7200
|
name: "MEditorLayerMenu"
|
|
7011
7201
|
},
|
|
@@ -7069,7 +7259,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
7069
7259
|
{
|
|
7070
7260
|
type: "button",
|
|
7071
7261
|
text: "全部折叠",
|
|
7072
|
-
icon: _sfc_main$
|
|
7262
|
+
icon: _sfc_main$h,
|
|
7073
7263
|
display: () => isPage(node.value),
|
|
7074
7264
|
handler: () => {
|
|
7075
7265
|
emit("collapse-all");
|
|
@@ -7095,7 +7285,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
7095
7285
|
show
|
|
7096
7286
|
});
|
|
7097
7287
|
return (_ctx, _cache) => {
|
|
7098
|
-
return openBlock(), createBlock(_sfc_main$
|
|
7288
|
+
return openBlock(), createBlock(_sfc_main$i, {
|
|
7099
7289
|
"menu-data": menuData.value,
|
|
7100
7290
|
ref_key: "menu",
|
|
7101
7291
|
ref: menu,
|
|
@@ -7105,7 +7295,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
7105
7295
|
}
|
|
7106
7296
|
});
|
|
7107
7297
|
|
|
7108
|
-
const _sfc_main$
|
|
7298
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
7109
7299
|
__name: "LayerNodeTool",
|
|
7110
7300
|
props: {
|
|
7111
7301
|
data: {}
|
|
@@ -7124,12 +7314,12 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
7124
7314
|
};
|
|
7125
7315
|
return (_ctx, _cache) => {
|
|
7126
7316
|
return _ctx.data.type !== "page" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
7127
|
-
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$
|
|
7317
|
+
_ctx.data.visible === false ? (openBlock(), createBlock(_sfc_main$K, {
|
|
7128
7318
|
key: 0,
|
|
7129
7319
|
icon: unref(Hide),
|
|
7130
7320
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => setNodeVisible(true), ["stop"])),
|
|
7131
7321
|
title: "点击显示"
|
|
7132
|
-
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$
|
|
7322
|
+
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$K, {
|
|
7133
7323
|
key: 1,
|
|
7134
7324
|
icon: unref(View),
|
|
7135
7325
|
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => setNodeVisible(false), ["stop"])),
|
|
@@ -7331,50 +7521,6 @@ const useDrag = (services) => {
|
|
|
7331
7521
|
};
|
|
7332
7522
|
};
|
|
7333
7523
|
|
|
7334
|
-
const useFilter = (nodeStatusMap, page) => {
|
|
7335
|
-
const filterIsMatch = (value, data) => {
|
|
7336
|
-
if (!value) {
|
|
7337
|
-
return true;
|
|
7338
|
-
}
|
|
7339
|
-
let name = "";
|
|
7340
|
-
if (data.name) {
|
|
7341
|
-
name = data.name;
|
|
7342
|
-
} else if (data.items) {
|
|
7343
|
-
name = "container";
|
|
7344
|
-
}
|
|
7345
|
-
return `${data.id}${name}${data.type}`.includes(value);
|
|
7346
|
-
};
|
|
7347
|
-
const filterNode = (text) => (node, parents) => {
|
|
7348
|
-
if (!nodeStatusMap.value)
|
|
7349
|
-
return;
|
|
7350
|
-
const visible = filterIsMatch(text, node);
|
|
7351
|
-
if (visible && parents.length) {
|
|
7352
|
-
parents.forEach((parent) => {
|
|
7353
|
-
updateStatus(nodeStatusMap.value, parent.id, {
|
|
7354
|
-
visible,
|
|
7355
|
-
expand: true
|
|
7356
|
-
});
|
|
7357
|
-
});
|
|
7358
|
-
}
|
|
7359
|
-
updateStatus(nodeStatusMap.value, node.id, {
|
|
7360
|
-
visible
|
|
7361
|
-
});
|
|
7362
|
-
};
|
|
7363
|
-
const filter = (text) => {
|
|
7364
|
-
if (!page.value?.items?.length)
|
|
7365
|
-
return;
|
|
7366
|
-
page.value.items.forEach((node) => {
|
|
7367
|
-
traverseNode(node, filterNode(text));
|
|
7368
|
-
});
|
|
7369
|
-
};
|
|
7370
|
-
return {
|
|
7371
|
-
filterText: ref(""),
|
|
7372
|
-
filterTextChangeHandler(text) {
|
|
7373
|
-
filter(text);
|
|
7374
|
-
}
|
|
7375
|
-
};
|
|
7376
|
-
};
|
|
7377
|
-
|
|
7378
7524
|
var KeyBindingContainerKey = /* @__PURE__ */ ((KeyBindingContainerKey2) => {
|
|
7379
7525
|
KeyBindingContainerKey2["STAGE"] = "stage";
|
|
7380
7526
|
KeyBindingContainerKey2["LAYER_PANEL"] = "layer-panel";
|
|
@@ -7537,15 +7683,15 @@ const useKeybinding = (services, contianer) => {
|
|
|
7537
7683
|
};
|
|
7538
7684
|
};
|
|
7539
7685
|
|
|
7540
|
-
const createPageNodeStatus = (
|
|
7686
|
+
const createPageNodeStatus = (page, initalLayerNodeStatus) => {
|
|
7541
7687
|
const map = /* @__PURE__ */ new Map();
|
|
7542
|
-
map.set(
|
|
7688
|
+
map.set(page.id, {
|
|
7543
7689
|
visible: true,
|
|
7544
7690
|
expand: true,
|
|
7545
7691
|
selected: true,
|
|
7546
7692
|
draggable: false
|
|
7547
7693
|
});
|
|
7548
|
-
|
|
7694
|
+
page.items.forEach(
|
|
7549
7695
|
(node) => traverseNode(node, (node2) => {
|
|
7550
7696
|
map.set(
|
|
7551
7697
|
node2.id,
|
|
@@ -7560,7 +7706,8 @@ const createPageNodeStatus = (services, pageId, initalLayerNodeStatus) => {
|
|
|
7560
7706
|
);
|
|
7561
7707
|
return map;
|
|
7562
7708
|
};
|
|
7563
|
-
const useNodeStatus = (services
|
|
7709
|
+
const useNodeStatus = (services) => {
|
|
7710
|
+
const page = computed(() => services?.editorService.get("page"));
|
|
7564
7711
|
const nodes = computed(() => services?.editorService.get("nodes") || []);
|
|
7565
7712
|
const nodeStatusMaps = ref(/* @__PURE__ */ new Map());
|
|
7566
7713
|
const nodeStatusMap = computed(
|
|
@@ -7572,7 +7719,7 @@ const useNodeStatus = (services, page) => {
|
|
|
7572
7719
|
if (!page2) {
|
|
7573
7720
|
return;
|
|
7574
7721
|
}
|
|
7575
|
-
nodeStatusMaps.value.set(page2.id, createPageNodeStatus(
|
|
7722
|
+
nodeStatusMaps.value.set(page2.id, createPageNodeStatus(page2, nodeStatusMaps.value.get(page2.id)));
|
|
7576
7723
|
},
|
|
7577
7724
|
{
|
|
7578
7725
|
immediate: true
|
|
@@ -7623,7 +7770,7 @@ const useNodeStatus = (services, page) => {
|
|
|
7623
7770
|
};
|
|
7624
7771
|
};
|
|
7625
7772
|
|
|
7626
|
-
const _sfc_main$
|
|
7773
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
7627
7774
|
...{
|
|
7628
7775
|
name: "MEditorLayerPanel"
|
|
7629
7776
|
},
|
|
@@ -7636,9 +7783,19 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7636
7783
|
const editorService = services?.editorService;
|
|
7637
7784
|
const tree = ref();
|
|
7638
7785
|
const page = computed(() => editorService?.get("page"));
|
|
7639
|
-
const
|
|
7786
|
+
const nodeData = computed(() => !page.value ? [] : [page.value]);
|
|
7787
|
+
const { nodeStatusMap } = useNodeStatus(services);
|
|
7640
7788
|
const { isCtrlKeyDown } = useKeybinding(services, tree);
|
|
7641
|
-
const
|
|
7789
|
+
const filterNodeMethod = (v, data) => {
|
|
7790
|
+
let name = "";
|
|
7791
|
+
if (data.name) {
|
|
7792
|
+
name = data.name;
|
|
7793
|
+
} else if (data.items) {
|
|
7794
|
+
name = "container";
|
|
7795
|
+
}
|
|
7796
|
+
return `${data.id}${name}${data.type}`.includes(v);
|
|
7797
|
+
};
|
|
7798
|
+
const { filterTextChangeHandler } = useFilter(nodeData, nodeStatusMap, filterNodeMethod);
|
|
7642
7799
|
const collapseAllHandler = () => {
|
|
7643
7800
|
if (!page.value || !nodeStatusMap.value)
|
|
7644
7801
|
return;
|
|
@@ -7661,13 +7818,13 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7661
7818
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-layer-panel" }, {
|
|
7662
7819
|
default: withCtx(() => [
|
|
7663
7820
|
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
7664
|
-
createVNode(_sfc_main$
|
|
7665
|
-
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$
|
|
7821
|
+
createVNode(_sfc_main$q, { onSearch: unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
|
|
7822
|
+
page.value && unref(nodeStatusMap) ? (openBlock(), createBlock(_sfc_main$o, {
|
|
7666
7823
|
key: 0,
|
|
7667
7824
|
tabindex: "-1",
|
|
7668
7825
|
ref_key: "tree",
|
|
7669
7826
|
ref: tree,
|
|
7670
|
-
data:
|
|
7827
|
+
data: nodeData.value,
|
|
7671
7828
|
"node-status-map": unref(nodeStatusMap),
|
|
7672
7829
|
onNodeDragover: unref(handleDragOver),
|
|
7673
7830
|
onNodeDragstart: unref(handleDragStart),
|
|
@@ -7677,18 +7834,21 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7677
7834
|
onNodeMouseenter: unref(mouseenterHandler),
|
|
7678
7835
|
onNodeClick: unref(nodeClickHandler)
|
|
7679
7836
|
}, {
|
|
7680
|
-
"tree-node-
|
|
7681
|
-
renderSlot(_ctx.$slots, "layer-node-
|
|
7682
|
-
|
|
7837
|
+
"tree-node-content": withCtx(({ data: nodeData2 }) => [
|
|
7838
|
+
renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData2 })
|
|
7839
|
+
]),
|
|
7840
|
+
"tree-node-tool": withCtx(({ data: nodeData2 }) => [
|
|
7841
|
+
renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData2 }, () => [
|
|
7842
|
+
createVNode(_sfc_main$f, { data: nodeData2 }, null, 8, ["data"])
|
|
7683
7843
|
])
|
|
7684
7844
|
]),
|
|
7685
|
-
"tree-node-
|
|
7686
|
-
renderSlot(_ctx.$slots, "layer-node-
|
|
7845
|
+
"tree-node-label": withCtx(({ data: nodeData2 }) => [
|
|
7846
|
+
renderSlot(_ctx.$slots, "layer-node-label", { data: nodeData2 })
|
|
7687
7847
|
]),
|
|
7688
7848
|
_: 3
|
|
7689
7849
|
}, 8, ["data", "node-status-map", "onNodeDragover", "onNodeDragstart", "onNodeDragleave", "onNodeDragend", "onNodeContextmenu", "onNodeMouseenter", "onNodeClick"])) : createCommentVNode("", true),
|
|
7690
7850
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
7691
|
-
createVNode(_sfc_main$
|
|
7851
|
+
createVNode(_sfc_main$g, {
|
|
7692
7852
|
ref_key: "menu",
|
|
7693
7853
|
ref: menu,
|
|
7694
7854
|
"layer-content-menu": _ctx.layerContentMenu,
|
|
@@ -7702,9 +7862,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
7702
7862
|
}
|
|
7703
7863
|
});
|
|
7704
7864
|
|
|
7705
|
-
const _hoisted_1$
|
|
7706
|
-
const _hoisted_2$
|
|
7707
|
-
const _sfc_main$
|
|
7865
|
+
const _hoisted_1$7 = ["onClick", "onDragstart"];
|
|
7866
|
+
const _hoisted_2$4 = ["title"];
|
|
7867
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
7708
7868
|
...{
|
|
7709
7869
|
name: "MEditorComponentListPanel"
|
|
7710
7870
|
},
|
|
@@ -7784,7 +7944,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
7784
7944
|
"model-value": collapseValue.value
|
|
7785
7945
|
}, {
|
|
7786
7946
|
default: withCtx(() => [
|
|
7787
|
-
createVNode(_sfc_main$
|
|
7947
|
+
createVNode(_sfc_main$q, { onSearch: filterTextChangeHandler }),
|
|
7788
7948
|
(openBlock(true), createElementBlock(Fragment, null, renderList(list.value, (group, index) => {
|
|
7789
7949
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
7790
7950
|
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
@@ -7792,7 +7952,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
7792
7952
|
name: `${index}`
|
|
7793
7953
|
}, {
|
|
7794
7954
|
title: withCtx(() => [
|
|
7795
|
-
createVNode(_sfc_main$
|
|
7955
|
+
createVNode(_sfc_main$K, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
7796
7956
|
createTextVNode(toDisplayString(group.title), 1)
|
|
7797
7957
|
]),
|
|
7798
7958
|
default: withCtx(() => [
|
|
@@ -7813,7 +7973,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
7813
7973
|
content: item.desc
|
|
7814
7974
|
}, {
|
|
7815
7975
|
default: withCtx(() => [
|
|
7816
|
-
createVNode(_sfc_main$
|
|
7976
|
+
createVNode(_sfc_main$K, {
|
|
7817
7977
|
icon: item.icon
|
|
7818
7978
|
}, null, 8, ["icon"])
|
|
7819
7979
|
]),
|
|
@@ -7821,9 +7981,9 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
7821
7981
|
}, 1032, ["disabled", "content"]),
|
|
7822
7982
|
createElementVNode("span", {
|
|
7823
7983
|
title: item.text
|
|
7824
|
-
}, toDisplayString(item.text), 9, _hoisted_2$
|
|
7984
|
+
}, toDisplayString(item.text), 9, _hoisted_2$4)
|
|
7825
7985
|
])
|
|
7826
|
-
], 40, _hoisted_1$
|
|
7986
|
+
], 40, _hoisted_1$7);
|
|
7827
7987
|
}), 128))
|
|
7828
7988
|
]),
|
|
7829
7989
|
_: 2
|
|
@@ -7840,20 +8000,20 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
7840
8000
|
}
|
|
7841
8001
|
});
|
|
7842
8002
|
|
|
7843
|
-
const _hoisted_1$
|
|
8003
|
+
const _hoisted_1$6 = {
|
|
7844
8004
|
key: 0,
|
|
7845
8005
|
class: "m-editor-sidebar"
|
|
7846
8006
|
};
|
|
7847
|
-
const _hoisted_2$
|
|
7848
|
-
const _hoisted_3$
|
|
7849
|
-
const _hoisted_4$
|
|
8007
|
+
const _hoisted_2$3 = { class: "m-editor-sidebar-header" };
|
|
8008
|
+
const _hoisted_3$1 = ["onClick", "onDragend"];
|
|
8009
|
+
const _hoisted_4$1 = {
|
|
7850
8010
|
key: 1,
|
|
7851
8011
|
class: "magic-editor-tab-panel-title"
|
|
7852
8012
|
};
|
|
7853
|
-
const _hoisted_5$
|
|
7854
|
-
const _hoisted_6
|
|
8013
|
+
const _hoisted_5$1 = { class: "m-editor-float-box-list" };
|
|
8014
|
+
const _hoisted_6 = ["onClick"];
|
|
7855
8015
|
const _hoisted_7 = { class: "m-editor-float-box-body" };
|
|
7856
|
-
const _sfc_main$
|
|
8016
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
7857
8017
|
...{
|
|
7858
8018
|
name: "MEditorSidebar"
|
|
7859
8019
|
},
|
|
@@ -7873,7 +8033,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7873
8033
|
type: "component",
|
|
7874
8034
|
icon: Goods,
|
|
7875
8035
|
text: "组件",
|
|
7876
|
-
component: _sfc_main$
|
|
8036
|
+
component: _sfc_main$d,
|
|
7877
8037
|
slots: {}
|
|
7878
8038
|
},
|
|
7879
8039
|
layer: {
|
|
@@ -7884,7 +8044,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7884
8044
|
props: {
|
|
7885
8045
|
layerContentMenu: props.layerContentMenu
|
|
7886
8046
|
},
|
|
7887
|
-
component: _sfc_main$
|
|
8047
|
+
component: _sfc_main$e,
|
|
7888
8048
|
slots: {}
|
|
7889
8049
|
},
|
|
7890
8050
|
"code-block": {
|
|
@@ -7892,7 +8052,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7892
8052
|
type: "component",
|
|
7893
8053
|
icon: EditPen,
|
|
7894
8054
|
text: "代码编辑",
|
|
7895
|
-
component: _sfc_main$
|
|
8055
|
+
component: _sfc_main$m,
|
|
7896
8056
|
slots: {},
|
|
7897
8057
|
boxComponentConfig: {
|
|
7898
8058
|
props: {
|
|
@@ -7905,7 +8065,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7905
8065
|
type: "component",
|
|
7906
8066
|
icon: Coin,
|
|
7907
8067
|
text: "数据源",
|
|
7908
|
-
component: _sfc_main$
|
|
8068
|
+
component: _sfc_main$j,
|
|
7909
8069
|
slots: {},
|
|
7910
8070
|
boxComponentConfig: {
|
|
7911
8071
|
props: {
|
|
@@ -7948,24 +8108,24 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7948
8108
|
});
|
|
7949
8109
|
return (_ctx, _cache) => {
|
|
7950
8110
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
7951
|
-
_ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
7952
|
-
createElementVNode("div", _hoisted_2$
|
|
8111
|
+
_ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
8112
|
+
createElementVNode("div", _hoisted_2$3, [
|
|
7953
8113
|
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
7954
8114
|
return withDirectives((openBlock(), createElementBlock("div", {
|
|
7955
8115
|
class: normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
|
|
8116
|
+
draggable: "true",
|
|
7956
8117
|
key: config.$key ?? index,
|
|
7957
8118
|
onClick: ($event) => activeTabName.value = config.text || `${index}`,
|
|
7958
|
-
draggable: "true",
|
|
7959
8119
|
onDragstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
7960
8120
|
(...args) => unref(dragstartHandler) && unref(dragstartHandler)(...args)),
|
|
7961
8121
|
onDragend: ($event) => unref(dragendHandler)(config.$key, $event)
|
|
7962
8122
|
}, [
|
|
7963
|
-
config.icon ? (openBlock(), createBlock(_sfc_main$
|
|
8123
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$K, {
|
|
7964
8124
|
key: 0,
|
|
7965
8125
|
icon: config.icon
|
|
7966
8126
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
7967
|
-
config.text ? (openBlock(), createElementBlock("div", _hoisted_4$
|
|
7968
|
-
], 42, _hoisted_3$
|
|
8127
|
+
config.text ? (openBlock(), createElementBlock("div", _hoisted_4$1, toDisplayString(config.text), 1)) : createCommentVNode("", true)
|
|
8128
|
+
], 42, _hoisted_3$1)), [
|
|
7969
8129
|
[vShow, !unref(floatBoxStates)?.get(config.$key)?.status]
|
|
7970
8130
|
]);
|
|
7971
8131
|
}), 128))
|
|
@@ -8034,6 +8194,19 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
8034
8194
|
]),
|
|
8035
8195
|
key: "5"
|
|
8036
8196
|
} : void 0,
|
|
8197
|
+
config.$key === "layer" || config.slots?.layerNodeLabel ? {
|
|
8198
|
+
name: "layer-node-label",
|
|
8199
|
+
fn: withCtx(({ data: nodeData }) => [
|
|
8200
|
+
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-label", {
|
|
8201
|
+
key: 0,
|
|
8202
|
+
data: nodeData
|
|
8203
|
+
}) : config.slots?.layerNodeLabel ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeTool), {
|
|
8204
|
+
key: 1,
|
|
8205
|
+
data: nodeData
|
|
8206
|
+
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
8207
|
+
]),
|
|
8208
|
+
key: "6"
|
|
8209
|
+
} : void 0,
|
|
8037
8210
|
config.$key === "layer" || config.slots?.layerNodeTool ? {
|
|
8038
8211
|
name: "layer-node-tool",
|
|
8039
8212
|
fn: withCtx(({ data: nodeData }) => [
|
|
@@ -8045,7 +8218,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
8045
8218
|
data: nodeData
|
|
8046
8219
|
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
8047
8220
|
]),
|
|
8048
|
-
key: "
|
|
8221
|
+
key: "7"
|
|
8049
8222
|
} : void 0,
|
|
8050
8223
|
config.$key === "data-source" || config.slots?.codeBlockPanelTool ? {
|
|
8051
8224
|
name: "data-source-panel-tool",
|
|
@@ -8055,7 +8228,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
8055
8228
|
data
|
|
8056
8229
|
}) : config.slots?.DataSourcePanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
8057
8230
|
]),
|
|
8058
|
-
key: "
|
|
8231
|
+
key: "8"
|
|
8059
8232
|
} : void 0
|
|
8060
8233
|
]), 1040)) : createCommentVNode("", true)
|
|
8061
8234
|
])), [
|
|
@@ -8064,7 +8237,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
8064
8237
|
}), 128))
|
|
8065
8238
|
])) : createCommentVNode("", true),
|
|
8066
8239
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
8067
|
-
createElementVNode("div", _hoisted_5$
|
|
8240
|
+
createElementVNode("div", _hoisted_5$1, [
|
|
8068
8241
|
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
8069
8242
|
return withDirectives((openBlock(), createElementBlock("div", {
|
|
8070
8243
|
key: config.$key ?? index,
|
|
@@ -8083,12 +8256,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
8083
8256
|
onClick: ($event) => unref(showFloatBox)(config.$key)
|
|
8084
8257
|
}, [
|
|
8085
8258
|
createElementVNode("div", null, toDisplayString(config.text), 1),
|
|
8086
|
-
createVNode(_sfc_main$
|
|
8259
|
+
createVNode(_sfc_main$K, {
|
|
8087
8260
|
class: "m-editor-float-box-close",
|
|
8088
8261
|
icon: unref(Close),
|
|
8089
8262
|
onClick: withModifiers(($event) => unref(closeFloatBox)(config.$key), ["stop"])
|
|
8090
8263
|
}, null, 8, ["icon", "onClick"])
|
|
8091
|
-
], 10, _hoisted_6
|
|
8264
|
+
], 10, _hoisted_6),
|
|
8092
8265
|
createElementVNode("div", _hoisted_7, [
|
|
8093
8266
|
config && unref(floatBoxStates)?.get(config.$key)?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.boxComponentConfig?.component || config.component), mergeProps({ key: 0 }, config.boxComponentConfig?.props || config.props || {}, toHandlers(config?.listeners || {})), null, 16)) : createCommentVNode("", true)
|
|
8094
8267
|
])
|
|
@@ -8231,7 +8404,7 @@ class ScrollViewer extends EventEmitter {
|
|
|
8231
8404
|
};
|
|
8232
8405
|
}
|
|
8233
8406
|
|
|
8234
|
-
const _sfc_main$
|
|
8407
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
8235
8408
|
...{
|
|
8236
8409
|
name: "MEditorScrollBar"
|
|
8237
8410
|
},
|
|
@@ -8319,9 +8492,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
8319
8492
|
}
|
|
8320
8493
|
});
|
|
8321
8494
|
|
|
8322
|
-
const
|
|
8323
|
-
|
|
8324
|
-
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
8495
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
8325
8496
|
...{
|
|
8326
8497
|
name: "MEditorScrollViewer"
|
|
8327
8498
|
},
|
|
@@ -8407,14 +8578,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
8407
8578
|
}, [
|
|
8408
8579
|
renderSlot(_ctx.$slots, "default")
|
|
8409
8580
|
], 4),
|
|
8410
|
-
scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$
|
|
8581
|
+
scrollHeight.value > _ctx.wrapHeight ? (openBlock(), createBlock(_sfc_main$b, {
|
|
8411
8582
|
key: 0,
|
|
8412
8583
|
"scroll-size": scrollHeight.value,
|
|
8413
8584
|
size: _ctx.wrapHeight,
|
|
8414
8585
|
pos: vOffset.value,
|
|
8415
8586
|
onScroll: vScrollHandler
|
|
8416
8587
|
}, null, 8, ["scroll-size", "size", "pos"])) : createCommentVNode("", true),
|
|
8417
|
-
scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$
|
|
8588
|
+
scrollWidth.value > _ctx.wrapWidth ? (openBlock(), createBlock(_sfc_main$b, {
|
|
8418
8589
|
key: 1,
|
|
8419
8590
|
"is-horizontal": true,
|
|
8420
8591
|
"scroll-size": scrollWidth.value,
|
|
@@ -8453,7 +8624,10 @@ const state = reactive({
|
|
|
8453
8624
|
});
|
|
8454
8625
|
class Ui extends BaseService {
|
|
8455
8626
|
constructor() {
|
|
8456
|
-
super([
|
|
8627
|
+
super([
|
|
8628
|
+
{ name: "zoom", isAsync: true },
|
|
8629
|
+
{ name: "calcZoom", isAsync: true }
|
|
8630
|
+
]);
|
|
8457
8631
|
}
|
|
8458
8632
|
set(name, value) {
|
|
8459
8633
|
const mask = editorService.get("stage")?.mask;
|
|
@@ -8544,6 +8718,7 @@ const useStage = (stageOptions) => {
|
|
|
8544
8718
|
containerHighlightDuration: stageOptions.containerHighlightDuration,
|
|
8545
8719
|
containerHighlightType: stageOptions.containerHighlightType,
|
|
8546
8720
|
disabledDragStart: stageOptions.disabledDragStart,
|
|
8721
|
+
renderType: stageOptions.renderType,
|
|
8547
8722
|
canSelect: (el, event, stop) => {
|
|
8548
8723
|
const elCanSelect = stageOptions.canSelect(el);
|
|
8549
8724
|
if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
|
|
@@ -8609,228 +8784,142 @@ const useStage = (stageOptions) => {
|
|
|
8609
8784
|
return stage;
|
|
8610
8785
|
};
|
|
8611
8786
|
|
|
8612
|
-
const _hoisted_1$
|
|
8613
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8614
|
-
class: "icon icon-tabler icon-tabler-pin",
|
|
8615
|
-
width: "24",
|
|
8616
|
-
height: "24",
|
|
8617
|
-
viewBox: "0 0 24 24",
|
|
8618
|
-
"stroke-width": "2",
|
|
8619
|
-
stroke: "currentColor",
|
|
8620
|
-
fill: "none",
|
|
8621
|
-
"stroke-linecap": "round",
|
|
8622
|
-
"stroke-linejoin": "round"
|
|
8623
|
-
};
|
|
8624
|
-
const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("path", {
|
|
8625
|
-
stroke: "none",
|
|
8626
|
-
d: "M0 0h24v24H0z",
|
|
8627
|
-
fill: "none"
|
|
8628
|
-
}, null, -1);
|
|
8629
|
-
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("path", { d: "M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4" }, null, -1);
|
|
8630
|
-
const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("line", {
|
|
8631
|
-
x1: "9",
|
|
8632
|
-
y1: "15",
|
|
8633
|
-
x2: "4.5",
|
|
8634
|
-
y2: "19.5"
|
|
8635
|
-
}, null, -1);
|
|
8636
|
-
const _hoisted_5$2 = /* @__PURE__ */ createElementVNode("line", {
|
|
8637
|
-
x1: "14.5",
|
|
8638
|
-
y1: "4",
|
|
8639
|
-
x2: "20",
|
|
8640
|
-
y2: "9.5"
|
|
8641
|
-
}, null, -1);
|
|
8642
|
-
const _hoisted_6$1 = [
|
|
8643
|
-
_hoisted_2$5,
|
|
8644
|
-
_hoisted_3$2,
|
|
8645
|
-
_hoisted_4$2,
|
|
8646
|
-
_hoisted_5$2
|
|
8647
|
-
];
|
|
8648
|
-
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
8649
|
-
...{
|
|
8650
|
-
name: "MEditorPinIcon"
|
|
8651
|
-
},
|
|
8652
|
-
__name: "PinIcon",
|
|
8653
|
-
setup(__props) {
|
|
8654
|
-
return (_ctx, _cache) => {
|
|
8655
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$7, _hoisted_6$1);
|
|
8656
|
-
};
|
|
8657
|
-
}
|
|
8658
|
-
});
|
|
8659
|
-
|
|
8660
|
-
const _hoisted_1$6 = {
|
|
8661
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
8662
|
-
class: "icon icon-tabler icon-tabler-pinned",
|
|
8663
|
-
width: "24",
|
|
8664
|
-
height: "24",
|
|
8665
|
-
viewBox: "0 0 24 24",
|
|
8666
|
-
"stroke-width": "2",
|
|
8667
|
-
stroke: "currentColor",
|
|
8668
|
-
fill: "none",
|
|
8669
|
-
"stroke-linecap": "round",
|
|
8670
|
-
"stroke-linejoin": "round"
|
|
8671
|
-
};
|
|
8672
|
-
const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("path", {
|
|
8673
|
-
stroke: "none",
|
|
8674
|
-
d: "M0 0h24v24H0z",
|
|
8675
|
-
fill: "none"
|
|
8676
|
-
}, null, -1);
|
|
8677
|
-
const _hoisted_3$1 = /* @__PURE__ */ createElementVNode("path", { d: "M9 4v6l-2 4v2h10v-2l-2 -4v-6" }, null, -1);
|
|
8678
|
-
const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("line", {
|
|
8679
|
-
x1: "12",
|
|
8680
|
-
y1: "16",
|
|
8681
|
-
x2: "12",
|
|
8682
|
-
y2: "21"
|
|
8683
|
-
}, null, -1);
|
|
8684
|
-
const _hoisted_5$1 = /* @__PURE__ */ createElementVNode("line", {
|
|
8685
|
-
x1: "8",
|
|
8686
|
-
y1: "4",
|
|
8687
|
-
x2: "16",
|
|
8688
|
-
y2: "4"
|
|
8689
|
-
}, null, -1);
|
|
8690
|
-
const _hoisted_6 = [
|
|
8691
|
-
_hoisted_2$4,
|
|
8692
|
-
_hoisted_3$1,
|
|
8693
|
-
_hoisted_4$1,
|
|
8694
|
-
_hoisted_5$1
|
|
8695
|
-
];
|
|
8696
|
-
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
8697
|
-
...{
|
|
8698
|
-
name: "MEditorPinnedIcon"
|
|
8699
|
-
},
|
|
8700
|
-
__name: "PinnedIcon",
|
|
8701
|
-
setup(__props) {
|
|
8702
|
-
return (_ctx, _cache) => {
|
|
8703
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$6, _hoisted_6);
|
|
8704
|
-
};
|
|
8705
|
-
}
|
|
8706
|
-
});
|
|
8707
|
-
|
|
8708
|
-
const _hoisted_1$5 = /* @__PURE__ */ createElementVNode("span", null, "可选组件", -1);
|
|
8709
|
-
const _hoisted_2$3 = { style: { "margin-right": "10px" } };
|
|
8787
|
+
const _hoisted_1$5 = { class: "m-editor-float-box-body" };
|
|
8710
8788
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
8711
|
-
|
|
8712
|
-
name: "MEditorNodeListMenuTitle"
|
|
8713
|
-
},
|
|
8714
|
-
__name: "NodeListMenuTitle",
|
|
8789
|
+
__name: "FloatingBox",
|
|
8715
8790
|
props: {
|
|
8716
|
-
|
|
8791
|
+
visible: { type: Boolean, default: false },
|
|
8792
|
+
position: { default: () => ({ left: 0, top: 0 }) },
|
|
8793
|
+
rect: { default: () => ({ width: "auto", height: "auto" }) },
|
|
8794
|
+
title: { default: "" }
|
|
8717
8795
|
},
|
|
8718
|
-
emits: ["
|
|
8719
|
-
setup(__props, { emit: __emit }) {
|
|
8796
|
+
emits: ["update:visible"],
|
|
8797
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8720
8798
|
const props = __props;
|
|
8721
8799
|
const emit = __emit;
|
|
8722
|
-
const
|
|
8723
|
-
|
|
8800
|
+
const target = ref();
|
|
8801
|
+
const dragTarget = ref();
|
|
8802
|
+
const style = computed(() => ({
|
|
8803
|
+
left: `${props.position.left}px`,
|
|
8804
|
+
top: `${props.position.top}px`,
|
|
8805
|
+
width: typeof props.rect.width === "string" ? props.rect.width : `${props.rect.width}px`,
|
|
8806
|
+
height: typeof props.rect.height === "string" ? props.rect.height : `${props.rect.height}px`
|
|
8807
|
+
}));
|
|
8808
|
+
let moveable = null;
|
|
8809
|
+
const initMoveable = () => {
|
|
8810
|
+
moveable = new Moveable(globalThis.document.body, {
|
|
8811
|
+
className: "m-editor-floating-box-moveable",
|
|
8812
|
+
target: target.value,
|
|
8813
|
+
draggable: true,
|
|
8814
|
+
resizable: true,
|
|
8815
|
+
edge: true,
|
|
8816
|
+
keepRatio: false,
|
|
8817
|
+
origin: false,
|
|
8818
|
+
snappable: true,
|
|
8819
|
+
dragTarget: dragTarget.value,
|
|
8820
|
+
dragTargetSelf: false,
|
|
8821
|
+
linePadding: 10,
|
|
8822
|
+
controlPadding: 10
|
|
8823
|
+
});
|
|
8824
|
+
moveable.on("drag", (e) => {
|
|
8825
|
+
e.target.style.transform = e.transform;
|
|
8826
|
+
});
|
|
8827
|
+
moveable.on("resize", (e) => {
|
|
8828
|
+
e.target.style.width = `${e.width}px`;
|
|
8829
|
+
e.target.style.height = `${e.height}px`;
|
|
8830
|
+
e.target.style.transform = e.drag.transform;
|
|
8831
|
+
});
|
|
8832
|
+
};
|
|
8833
|
+
const destroyMoveable = () => {
|
|
8834
|
+
moveable?.destroy();
|
|
8835
|
+
moveable = null;
|
|
8724
8836
|
};
|
|
8837
|
+
watch(
|
|
8838
|
+
() => props.visible,
|
|
8839
|
+
async (visible) => {
|
|
8840
|
+
if (visible) {
|
|
8841
|
+
await nextTick();
|
|
8842
|
+
initMoveable();
|
|
8843
|
+
} else {
|
|
8844
|
+
destroyMoveable();
|
|
8845
|
+
}
|
|
8846
|
+
},
|
|
8847
|
+
{
|
|
8848
|
+
immediate: true
|
|
8849
|
+
}
|
|
8850
|
+
);
|
|
8851
|
+
onBeforeUnmount(() => {
|
|
8852
|
+
destroyMoveable();
|
|
8853
|
+
});
|
|
8725
8854
|
const closeHandler = () => {
|
|
8726
|
-
emit("
|
|
8855
|
+
emit("update:visible", false);
|
|
8727
8856
|
};
|
|
8728
|
-
|
|
8729
|
-
|
|
8857
|
+
__expose({
|
|
8858
|
+
target
|
|
8859
|
+
});
|
|
8730
8860
|
return (_ctx, _cache) => {
|
|
8731
|
-
return openBlock(),
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
ref: target
|
|
8861
|
+
return _ctx.visible ? (openBlock(), createBlock(Teleport, {
|
|
8862
|
+
key: 0,
|
|
8863
|
+
to: "body"
|
|
8735
8864
|
}, [
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
_hoisted_1$5,
|
|
8750
|
-
createElementVNode("div", _hoisted_2$3, [
|
|
8751
|
-
createVNode(unref(TMagicButton), {
|
|
8752
|
-
text: "",
|
|
8753
|
-
size: "small",
|
|
8754
|
-
onClick: closeHandler
|
|
8755
|
-
}, {
|
|
8756
|
-
default: withCtx(() => [
|
|
8757
|
-
createVNode(_sfc_main$N, { icon: unref(Close) }, null, 8, ["icon"])
|
|
8865
|
+
createElementVNode("div", {
|
|
8866
|
+
ref_key: "target",
|
|
8867
|
+
ref: target,
|
|
8868
|
+
class: "m-editor-float-box",
|
|
8869
|
+
style: normalizeStyle(style.value)
|
|
8870
|
+
}, [
|
|
8871
|
+
createElementVNode("div", {
|
|
8872
|
+
ref_key: "dragTarget",
|
|
8873
|
+
ref: dragTarget,
|
|
8874
|
+
class: "m-editor-float-box-title"
|
|
8875
|
+
}, [
|
|
8876
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
8877
|
+
createElementVNode("span", null, toDisplayString(_ctx.title), 1)
|
|
8758
8878
|
]),
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8879
|
+
createElementVNode("div", null, [
|
|
8880
|
+
createVNode(unref(TMagicButton), {
|
|
8881
|
+
text: "",
|
|
8882
|
+
size: "small",
|
|
8883
|
+
icon: unref(Close),
|
|
8884
|
+
onClick: closeHandler
|
|
8885
|
+
}, null, 8, ["icon"])
|
|
8886
|
+
])
|
|
8887
|
+
], 512),
|
|
8888
|
+
createElementVNode("div", _hoisted_1$5, [
|
|
8889
|
+
renderSlot(_ctx.$slots, "body")
|
|
8890
|
+
])
|
|
8891
|
+
], 4)
|
|
8892
|
+
])) : createCommentVNode("", true);
|
|
8763
8893
|
};
|
|
8764
8894
|
}
|
|
8765
8895
|
});
|
|
8766
8896
|
|
|
8767
|
-
const PINNED_STATUE_CACHE_KEY = "tmagic-pinned-node-list-pinned-status";
|
|
8768
8897
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
8769
8898
|
__name: "NodeListMenu",
|
|
8770
|
-
props: {
|
|
8771
|
-
isMultiSelect: { type: Boolean }
|
|
8772
|
-
},
|
|
8773
8899
|
setup(__props) {
|
|
8774
|
-
const props = __props;
|
|
8775
|
-
const menu = ref();
|
|
8776
|
-
const nodeList = ref([]);
|
|
8777
|
-
const pinned = ref(Boolean(globalThis.localStorage.getItem(PINNED_STATUE_CACHE_KEY)));
|
|
8778
|
-
const firstShow = ref(true);
|
|
8779
8900
|
const services = inject("services");
|
|
8780
8901
|
const editorService = services?.editorService;
|
|
8781
|
-
const
|
|
8902
|
+
const visible = ref(false);
|
|
8903
|
+
const buttonVisible = ref(false);
|
|
8904
|
+
const button = ref();
|
|
8905
|
+
const box = ref();
|
|
8782
8906
|
const stage = computed(() => editorService?.get("stage"));
|
|
8783
8907
|
const page = computed(() => editorService?.get("page"));
|
|
8784
|
-
const
|
|
8785
|
-
|
|
8786
|
-
const
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
}
|
|
8790
|
-
if (pinned.value) {
|
|
8791
|
-
return;
|
|
8792
|
-
}
|
|
8793
|
-
nodeList.value = [];
|
|
8794
|
-
menu.value?.hide();
|
|
8795
|
-
};
|
|
8796
|
-
const clearTimeoutLazy = () => {
|
|
8797
|
-
globalThis.setTimeout(() => {
|
|
8798
|
-
if (timeout) {
|
|
8799
|
-
globalThis.clearTimeout(timeout);
|
|
8800
|
-
}
|
|
8801
|
-
}, 300);
|
|
8802
|
-
};
|
|
8908
|
+
const nodes = computed(() => editorService?.get("nodes") || []);
|
|
8909
|
+
const nodeData = computed(() => !page.value ? [] : [page.value]);
|
|
8910
|
+
const { nodeStatusMap } = useNodeStatus(services);
|
|
8911
|
+
const filterNodeMethod = (value, data) => data.id === value;
|
|
8912
|
+
const { filterTextChangeHandler } = useFilter(nodeData, nodeStatusMap, filterNodeMethod);
|
|
8803
8913
|
const unWatch = watch(
|
|
8804
8914
|
stage,
|
|
8805
8915
|
(stage2) => {
|
|
8806
8916
|
if (!stage2)
|
|
8807
8917
|
return;
|
|
8808
|
-
stage2.on("
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
if (props.isMultiSelect || stage2.getDragStatus() !== StageDragStatus.END) {
|
|
8814
|
-
return;
|
|
8815
|
-
}
|
|
8816
|
-
timeout = globalThis.setTimeout(() => {
|
|
8817
|
-
const els = stage2.renderer.getElementsFromPoint(event) || [];
|
|
8818
|
-
const nodes = getNodes(
|
|
8819
|
-
els.map((el) => el.id),
|
|
8820
|
-
page.value?.items
|
|
8821
|
-
);
|
|
8822
|
-
if (pinned.value && nodes.length === 0) {
|
|
8823
|
-
return;
|
|
8824
|
-
}
|
|
8825
|
-
nodeList.value = nodes;
|
|
8826
|
-
if (nodeList.value.length > 1) {
|
|
8827
|
-
menu.value?.show(pinned.value && !firstShow.value ? void 0 : event);
|
|
8828
|
-
firstShow.value = false;
|
|
8829
|
-
}
|
|
8830
|
-
}, 1500);
|
|
8831
|
-
});
|
|
8832
|
-
stage2.on("mouseleave", () => {
|
|
8833
|
-
clearTimeoutLazy();
|
|
8918
|
+
stage2.on("select", (el, event) => {
|
|
8919
|
+
const els = stage2.renderer.getElementsFromPoint(event) || [];
|
|
8920
|
+
const ids = els.map((el2) => el2.id).filter((id) => Boolean(id));
|
|
8921
|
+
buttonVisible.value = ids.length > 3;
|
|
8922
|
+
filterTextChangeHandler(ids);
|
|
8834
8923
|
});
|
|
8835
8924
|
unWatch();
|
|
8836
8925
|
},
|
|
@@ -8838,75 +8927,75 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
8838
8927
|
immediate: true
|
|
8839
8928
|
}
|
|
8840
8929
|
);
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
return map;
|
|
8849
|
-
});
|
|
8850
|
-
const menuData = computed(
|
|
8851
|
-
() => nodeList.value.map((node2) => {
|
|
8852
|
-
let text = node2.name;
|
|
8853
|
-
let icon;
|
|
8854
|
-
if (node2.type) {
|
|
8855
|
-
const item = componentMap.value[node2.type];
|
|
8856
|
-
text += ` (${item?.text})`;
|
|
8857
|
-
icon = item?.icon;
|
|
8930
|
+
watch(
|
|
8931
|
+
nodes,
|
|
8932
|
+
(nodes2) => {
|
|
8933
|
+
if (!nodeStatusMap.value)
|
|
8934
|
+
return;
|
|
8935
|
+
for (const [id, status] of nodeStatusMap.value.entries()) {
|
|
8936
|
+
status.selected = nodes2.some((node) => node.id === id);
|
|
8858
8937
|
}
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
icon,
|
|
8864
|
-
handler: async () => {
|
|
8865
|
-
await editorService?.select(node2);
|
|
8866
|
-
stage.value?.select(node2.id);
|
|
8867
|
-
}
|
|
8868
|
-
};
|
|
8869
|
-
})
|
|
8938
|
+
},
|
|
8939
|
+
{
|
|
8940
|
+
immediate: true
|
|
8941
|
+
}
|
|
8870
8942
|
);
|
|
8871
|
-
const
|
|
8872
|
-
|
|
8943
|
+
const clickHandler = async (event, data) => {
|
|
8944
|
+
await editorService?.select(data.id);
|
|
8945
|
+
stage.value?.select(data.id);
|
|
8873
8946
|
};
|
|
8874
|
-
const
|
|
8875
|
-
|
|
8947
|
+
const menuPosition = ref({
|
|
8948
|
+
left: 0,
|
|
8949
|
+
top: 0
|
|
8950
|
+
});
|
|
8951
|
+
watch(visible, async (visible2) => {
|
|
8952
|
+
if (!button.value || !visible2) {
|
|
8876
8953
|
return;
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
};
|
|
8886
|
-
watch(pinned, () => {
|
|
8887
|
-
globalThis.localStorage.setItem(PINNED_STATUE_CACHE_KEY, pinned.value.toString());
|
|
8954
|
+
}
|
|
8955
|
+
await nextTick();
|
|
8956
|
+
const rect = button.value.getBoundingClientRect();
|
|
8957
|
+
const height = box.value?.target?.clientHeight || 0;
|
|
8958
|
+
menuPosition.value = {
|
|
8959
|
+
left: rect.left + rect.width + 5,
|
|
8960
|
+
top: rect.top - height / 2 + rect.height / 2
|
|
8961
|
+
};
|
|
8888
8962
|
});
|
|
8889
8963
|
return (_ctx, _cache) => {
|
|
8890
|
-
return openBlock(),
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8964
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
8965
|
+
page.value && buttonVisible.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
8966
|
+
key: 0,
|
|
8967
|
+
content: "点击查看当前位置下的组件"
|
|
8968
|
+
}, {
|
|
8969
|
+
default: withCtx(() => [
|
|
8970
|
+
createElementVNode("div", {
|
|
8971
|
+
ref_key: "button",
|
|
8972
|
+
ref: button,
|
|
8973
|
+
class: "m-editor-stage-float-button",
|
|
8974
|
+
onClick: _cache[0] || (_cache[0] = ($event) => visible.value = true)
|
|
8975
|
+
}, "可选组件", 512)
|
|
8976
|
+
]),
|
|
8977
|
+
_: 1
|
|
8978
|
+
})) : createCommentVNode("", true),
|
|
8979
|
+
page.value && unref(nodeStatusMap) && buttonVisible.value ? (openBlock(), createBlock(_sfc_main$9, {
|
|
8980
|
+
key: 1,
|
|
8981
|
+
ref_key: "box",
|
|
8982
|
+
ref: box,
|
|
8983
|
+
visible: visible.value,
|
|
8984
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => visible.value = $event),
|
|
8985
|
+
title: "当前位置下的组件",
|
|
8986
|
+
position: menuPosition.value
|
|
8987
|
+
}, {
|
|
8988
|
+
body: withCtx(() => [
|
|
8989
|
+
createVNode(_sfc_main$o, {
|
|
8990
|
+
class: "m-editor-node-list-menu magic-editor-layer-tree",
|
|
8991
|
+
data: nodeData.value,
|
|
8992
|
+
"node-status-map": unref(nodeStatusMap),
|
|
8993
|
+
onNodeClick: clickHandler
|
|
8994
|
+
}, null, 8, ["data", "node-status-map"])
|
|
8995
|
+
]),
|
|
8996
|
+
_: 1
|
|
8997
|
+
}, 8, ["visible", "position"])) : createCommentVNode("", true)
|
|
8998
|
+
], 64);
|
|
8910
8999
|
};
|
|
8911
9000
|
}
|
|
8912
9001
|
});
|
|
@@ -8968,7 +9057,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
8968
9057
|
const services = inject("services");
|
|
8969
9058
|
const editorService = services?.editorService;
|
|
8970
9059
|
const menu = ref();
|
|
8971
|
-
const canPaste = ref(false);
|
|
8972
9060
|
const canCenter = ref(false);
|
|
8973
9061
|
const node = computed(() => editorService?.get("node"));
|
|
8974
9062
|
const nodes = computed(() => editorService?.get("nodes"));
|
|
@@ -9066,14 +9154,12 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
9066
9154
|
},
|
|
9067
9155
|
{ immediate: true }
|
|
9068
9156
|
);
|
|
9069
|
-
const show =
|
|
9157
|
+
const show = (e) => {
|
|
9070
9158
|
menu.value?.show(e);
|
|
9071
|
-
const data = await storageService.getItem(COPY_STORAGE_KEY);
|
|
9072
|
-
canPaste.value = data !== "undefined" && !!data;
|
|
9073
9159
|
};
|
|
9074
9160
|
__expose({ show });
|
|
9075
9161
|
return (_ctx, _cache) => {
|
|
9076
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9162
|
+
return openBlock(), createBlock(_sfc_main$i, {
|
|
9077
9163
|
"menu-data": menuData.value,
|
|
9078
9164
|
ref_key: "menu",
|
|
9079
9165
|
ref: menu
|
|
@@ -9230,7 +9316,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
9230
9316
|
}
|
|
9231
9317
|
};
|
|
9232
9318
|
return (_ctx, _cache) => {
|
|
9233
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9319
|
+
return openBlock(), createBlock(_sfc_main$a, {
|
|
9234
9320
|
class: "m-editor-stage",
|
|
9235
9321
|
ref_key: "stageWrap",
|
|
9236
9322
|
ref: stageWrap,
|
|
@@ -9256,17 +9342,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
9256
9342
|
onDrop: dropHandler,
|
|
9257
9343
|
onDragover: dragoverHandler
|
|
9258
9344
|
}, null, 36),
|
|
9345
|
+
createVNode(_sfc_main$8),
|
|
9259
9346
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
9260
9347
|
createVNode(_sfc_main$6, {
|
|
9261
9348
|
ref_key: "menu",
|
|
9262
9349
|
ref: menu,
|
|
9263
9350
|
"is-multi-select": isMultiSelect.value,
|
|
9264
9351
|
"stage-content-menu": _ctx.stageContentMenu
|
|
9265
|
-
}, null, 8, ["is-multi-select", "stage-content-menu"])
|
|
9266
|
-
createVNode(_sfc_main$8, {
|
|
9267
|
-
ref: "nodeList",
|
|
9268
|
-
"is-multi-select": isMultiSelect.value
|
|
9269
|
-
}, null, 8, ["is-multi-select"])
|
|
9352
|
+
}, null, 8, ["is-multi-select", "stage-content-menu"])
|
|
9270
9353
|
]))
|
|
9271
9354
|
]),
|
|
9272
9355
|
_: 1
|
|
@@ -9412,14 +9495,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
9412
9495
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
9413
9496
|
onClick: addPage
|
|
9414
9497
|
}, [
|
|
9415
|
-
createVNode(_sfc_main$
|
|
9498
|
+
createVNode(_sfc_main$K, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
9416
9499
|
])) : (openBlock(), createElementBlock("div", _hoisted_1$2)),
|
|
9417
9500
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
9418
9501
|
key: 2,
|
|
9419
9502
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
9420
9503
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
9421
9504
|
}, [
|
|
9422
|
-
createVNode(_sfc_main$
|
|
9505
|
+
createVNode(_sfc_main$K, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
9423
9506
|
])) : createCommentVNode("", true),
|
|
9424
9507
|
pageLength.value ? (openBlock(), createElementBlock("div", {
|
|
9425
9508
|
key: 3,
|
|
@@ -9435,7 +9518,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
9435
9518
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
9436
9519
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
9437
9520
|
}, [
|
|
9438
|
-
createVNode(_sfc_main$
|
|
9521
|
+
createVNode(_sfc_main$K, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
9439
9522
|
])) : createCommentVNode("", true)
|
|
9440
9523
|
], 512);
|
|
9441
9524
|
};
|
|
@@ -9507,7 +9590,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9507
9590
|
default: withCtx(() => [
|
|
9508
9591
|
createElementVNode("div", null, [
|
|
9509
9592
|
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
9510
|
-
createVNode(_sfc_main$
|
|
9593
|
+
createVNode(_sfc_main$t, {
|
|
9511
9594
|
data: {
|
|
9512
9595
|
type: "button",
|
|
9513
9596
|
text: "复制",
|
|
@@ -9515,7 +9598,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9515
9598
|
handler: () => copy(item)
|
|
9516
9599
|
}
|
|
9517
9600
|
}, null, 8, ["data"]),
|
|
9518
|
-
createVNode(_sfc_main$
|
|
9601
|
+
createVNode(_sfc_main$t, {
|
|
9519
9602
|
data: {
|
|
9520
9603
|
type: "button",
|
|
9521
9604
|
text: "删除",
|
|
@@ -9582,7 +9665,13 @@ class CodeBlock extends BaseService {
|
|
|
9582
9665
|
paramsColConfig: void 0
|
|
9583
9666
|
});
|
|
9584
9667
|
constructor() {
|
|
9585
|
-
super([
|
|
9668
|
+
super([
|
|
9669
|
+
{ name: "setCodeDslById", isAsync: true },
|
|
9670
|
+
{ name: "setEditStatus", isAsync: true },
|
|
9671
|
+
{ name: "setCombineIds", isAsync: true },
|
|
9672
|
+
{ name: "setUndeleteableList", isAsync: true },
|
|
9673
|
+
{ name: "deleteCodeDslByIds", isAsync: true }
|
|
9674
|
+
]);
|
|
9586
9675
|
}
|
|
9587
9676
|
/**
|
|
9588
9677
|
* 设置活动的代码块dsl数据源
|
|
@@ -9785,42 +9874,6 @@ class ComponentList extends BaseService {
|
|
|
9785
9874
|
}
|
|
9786
9875
|
const componentListService = new ComponentList();
|
|
9787
9876
|
|
|
9788
|
-
class Dep extends BaseService {
|
|
9789
|
-
watcher = new Watcher({ initialTargets: reactive({}) });
|
|
9790
|
-
removeTargets(type = DepTargetType.DEFAULT) {
|
|
9791
|
-
this.watcher.removeTargets(type);
|
|
9792
|
-
this.emit("remove-target");
|
|
9793
|
-
}
|
|
9794
|
-
getTargets(type = DepTargetType.DEFAULT) {
|
|
9795
|
-
return this.watcher.getTargets(type);
|
|
9796
|
-
}
|
|
9797
|
-
getTarget(id) {
|
|
9798
|
-
return this.watcher.getTarget(id);
|
|
9799
|
-
}
|
|
9800
|
-
addTarget(target) {
|
|
9801
|
-
this.watcher.addTarget(target);
|
|
9802
|
-
this.emit("add-target", target);
|
|
9803
|
-
}
|
|
9804
|
-
removeTarget(id) {
|
|
9805
|
-
this.watcher.removeTarget(id);
|
|
9806
|
-
this.emit("remove-target");
|
|
9807
|
-
}
|
|
9808
|
-
clearTargets() {
|
|
9809
|
-
this.watcher.clearTargets();
|
|
9810
|
-
}
|
|
9811
|
-
collect(nodes, deep = false) {
|
|
9812
|
-
this.watcher.collect(nodes, deep);
|
|
9813
|
-
this.emit("collected", nodes, deep);
|
|
9814
|
-
}
|
|
9815
|
-
clear(nodes) {
|
|
9816
|
-
return this.watcher.clear(nodes);
|
|
9817
|
-
}
|
|
9818
|
-
hasTarget(id) {
|
|
9819
|
-
return this.watcher.hasTarget(id);
|
|
9820
|
-
}
|
|
9821
|
-
}
|
|
9822
|
-
const depService = new Dep();
|
|
9823
|
-
|
|
9824
9877
|
let eventMap = reactive({});
|
|
9825
9878
|
let methodMap = reactive({});
|
|
9826
9879
|
class Events extends BaseService {
|
|
@@ -10040,7 +10093,8 @@ const defaultEditorProps = {
|
|
|
10040
10093
|
containerHighlightClassName: CONTAINER_HIGHLIGHT_CLASS_NAME,
|
|
10041
10094
|
containerHighlightDuration: 800,
|
|
10042
10095
|
containerHighlightType: ContainerHighlightType.DEFAULT,
|
|
10043
|
-
codeOptions: () => ({})
|
|
10096
|
+
codeOptions: () => ({}),
|
|
10097
|
+
renderType: RenderType.IFRAME
|
|
10044
10098
|
};
|
|
10045
10099
|
|
|
10046
10100
|
const initServiceState = (props, {
|
|
@@ -10178,13 +10232,13 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
10178
10232
|
const stage = editorService.get("stage");
|
|
10179
10233
|
return stage?.renderer.runtime?.getApp?.();
|
|
10180
10234
|
};
|
|
10181
|
-
const
|
|
10235
|
+
const updateDataSourceSchema = () => {
|
|
10182
10236
|
const root = editorService.get("root");
|
|
10183
10237
|
if (root?.dataSources) {
|
|
10184
10238
|
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
10185
10239
|
}
|
|
10186
10240
|
};
|
|
10187
|
-
const
|
|
10241
|
+
const updateNodeWhenDataSourceChange = (nodes) => {
|
|
10188
10242
|
const root = editorService.get("root");
|
|
10189
10243
|
const stage = editorService.get("stage");
|
|
10190
10244
|
if (!root || !stage)
|
|
@@ -10197,7 +10251,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
10197
10251
|
app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
|
|
10198
10252
|
app.dsl.dataSources = root.dataSources;
|
|
10199
10253
|
}
|
|
10200
|
-
|
|
10254
|
+
updateDataSourceSchema();
|
|
10201
10255
|
nodes.forEach((node) => {
|
|
10202
10256
|
const deps = Object.values(root.dataSourceDeps || {});
|
|
10203
10257
|
deps.forEach((dep) => {
|
|
@@ -10238,10 +10292,10 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
10238
10292
|
}
|
|
10239
10293
|
};
|
|
10240
10294
|
const depUpdateHandler = (node) => {
|
|
10241
|
-
|
|
10295
|
+
updateNodeWhenDataSourceChange([node]);
|
|
10242
10296
|
};
|
|
10243
10297
|
const collectedHandler = (nodes) => {
|
|
10244
|
-
|
|
10298
|
+
updateNodeWhenDataSourceChange(nodes);
|
|
10245
10299
|
};
|
|
10246
10300
|
depService.on("add-target", targetAddHandler);
|
|
10247
10301
|
depService.on("remove-target", targetRemoveHandler);
|
|
@@ -10263,7 +10317,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
10263
10317
|
Object.entries(value.codeBlocks).forEach(([id, code]) => {
|
|
10264
10318
|
depService.addTarget(createCodeBlockTarget(id, code));
|
|
10265
10319
|
});
|
|
10266
|
-
|
|
10320
|
+
dataSourceService.get("dataSources").forEach((ds) => {
|
|
10267
10321
|
initDataSourceDepTarget(ds);
|
|
10268
10322
|
});
|
|
10269
10323
|
if (Array.isArray(value.items)) {
|
|
@@ -10308,14 +10362,14 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
10308
10362
|
editorService.on("remove", nodeRemoveHandler);
|
|
10309
10363
|
editorService.on("update", nodeUpdateHandler);
|
|
10310
10364
|
const codeBlockAddOrUpdateHandler = (id, codeBlock) => {
|
|
10311
|
-
if (depService.hasTarget(id)) {
|
|
10312
|
-
depService.getTarget(id).name = codeBlock.name;
|
|
10365
|
+
if (depService.hasTarget(id, DepTargetType.CODE_BLOCK)) {
|
|
10366
|
+
depService.getTarget(id, DepTargetType.CODE_BLOCK).name = codeBlock.name;
|
|
10313
10367
|
return;
|
|
10314
10368
|
}
|
|
10315
10369
|
depService.addTarget(createCodeBlockTarget(id, codeBlock));
|
|
10316
10370
|
};
|
|
10317
10371
|
const codeBlockRemoveHandler = (id) => {
|
|
10318
|
-
depService.removeTarget(id);
|
|
10372
|
+
depService.removeTarget(id, DepTargetType.CODE_BLOCK);
|
|
10319
10373
|
};
|
|
10320
10374
|
codeBlockService.on("addOrUpdate", codeBlockAddOrUpdateHandler);
|
|
10321
10375
|
codeBlockService.on("remove", codeBlockRemoveHandler);
|
|
@@ -10325,17 +10379,28 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
10325
10379
|
};
|
|
10326
10380
|
const dataSourceUpdateHandler = (config) => {
|
|
10327
10381
|
const root = editorService.get("root");
|
|
10382
|
+
removeDataSourceTarget(config.id);
|
|
10383
|
+
initDataSourceDepTarget(config);
|
|
10384
|
+
depService.collect(root?.items || [], true);
|
|
10328
10385
|
const targets = depService.getTargets(DepTargetType.DATA_SOURCE);
|
|
10329
10386
|
const nodes = getNodes(Object.keys(targets[config.id].deps), root?.items);
|
|
10330
|
-
|
|
10387
|
+
updateNodeWhenDataSourceChange(nodes);
|
|
10388
|
+
};
|
|
10389
|
+
const removeDataSourceTarget = (id) => {
|
|
10390
|
+
depService.removeTarget(id, DepTargetType.DATA_SOURCE);
|
|
10391
|
+
depService.removeTarget(id, DepTargetType.DATA_SOURCE_COND);
|
|
10392
|
+
depService.removeTarget(id, DepTargetType.DATA_SOURCE_METHOD);
|
|
10331
10393
|
};
|
|
10332
10394
|
const dataSourceRemoveHandler = (id) => {
|
|
10333
|
-
|
|
10395
|
+
removeDataSourceTarget(id);
|
|
10334
10396
|
getApp()?.dataSourceManager?.removeDataSource(id);
|
|
10335
10397
|
};
|
|
10336
10398
|
dataSourceService.on("add", dataSourceAddHandler);
|
|
10337
10399
|
dataSourceService.on("update", dataSourceUpdateHandler);
|
|
10338
10400
|
dataSourceService.on("remove", dataSourceRemoveHandler);
|
|
10401
|
+
if (props.collectorOptions && !depService.hasTarget(DepTargetType.RELATED_COMP_WHEN_COPY)) {
|
|
10402
|
+
depService.addTarget(createRelatedCompTarget(props.collectorOptions));
|
|
10403
|
+
}
|
|
10339
10404
|
onUnmounted(() => {
|
|
10340
10405
|
depService.off("add-target", targetAddHandler);
|
|
10341
10406
|
depService.off("remove-target", targetRemoveHandler);
|
|
@@ -10369,6 +10434,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10369
10434
|
stageContentMenu: {},
|
|
10370
10435
|
render: { type: Function },
|
|
10371
10436
|
runtimeUrl: {},
|
|
10437
|
+
renderType: {},
|
|
10372
10438
|
autoScrollIntoView: { type: Boolean },
|
|
10373
10439
|
propsConfigs: {},
|
|
10374
10440
|
propsValues: {},
|
|
@@ -10387,7 +10453,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10387
10453
|
codeOptions: {},
|
|
10388
10454
|
updateDragEl: { type: Function },
|
|
10389
10455
|
disabledDragStart: { type: Boolean },
|
|
10390
|
-
extendFormState: { type: Function }
|
|
10456
|
+
extendFormState: { type: Function },
|
|
10457
|
+
collectorOptions: {}
|
|
10391
10458
|
}, defaultEditorProps),
|
|
10392
10459
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
10393
10460
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -10425,18 +10492,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10425
10492
|
containerHighlightClassName: props.containerHighlightClassName,
|
|
10426
10493
|
containerHighlightDuration: props.containerHighlightDuration,
|
|
10427
10494
|
containerHighlightType: props.containerHighlightType,
|
|
10428
|
-
disabledDragStart: props.disabledDragStart
|
|
10495
|
+
disabledDragStart: props.disabledDragStart,
|
|
10496
|
+
renderType: props.renderType
|
|
10429
10497
|
})
|
|
10430
10498
|
);
|
|
10431
10499
|
__expose(services);
|
|
10432
10500
|
return (_ctx, _cache) => {
|
|
10433
|
-
return openBlock(), createBlock(_sfc_main$
|
|
10501
|
+
return openBlock(), createBlock(_sfc_main$u, null, {
|
|
10434
10502
|
header: withCtx(() => [
|
|
10435
10503
|
renderSlot(_ctx.$slots, "header")
|
|
10436
10504
|
]),
|
|
10437
10505
|
nav: withCtx(() => [
|
|
10438
10506
|
renderSlot(_ctx.$slots, "nav", { editorService: unref(editorService) }, () => [
|
|
10439
|
-
createVNode(_sfc_main$
|
|
10507
|
+
createVNode(_sfc_main$s, { data: _ctx.menu }, null, 8, ["data"])
|
|
10440
10508
|
])
|
|
10441
10509
|
]),
|
|
10442
10510
|
"content-before": withCtx(() => [
|
|
@@ -10447,7 +10515,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10447
10515
|
]),
|
|
10448
10516
|
sidebar: withCtx(() => [
|
|
10449
10517
|
renderSlot(_ctx.$slots, "sidebar", { editorService: unref(editorService) }, () => [
|
|
10450
|
-
createVNode(_sfc_main$
|
|
10518
|
+
createVNode(_sfc_main$c, {
|
|
10451
10519
|
data: _ctx.sidebar,
|
|
10452
10520
|
"layer-content-menu": _ctx.layerContentMenu
|
|
10453
10521
|
}, {
|
|
@@ -10457,6 +10525,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10457
10525
|
"layer-node-content": withCtx(({ data }) => [
|
|
10458
10526
|
renderSlot(_ctx.$slots, "layer-node-content", { data })
|
|
10459
10527
|
]),
|
|
10528
|
+
"layer-node-label": withCtx(({ data }) => [
|
|
10529
|
+
renderSlot(_ctx.$slots, "layer-node-label", { data })
|
|
10530
|
+
]),
|
|
10460
10531
|
"layer-node-tool": withCtx(({ data }) => [
|
|
10461
10532
|
renderSlot(_ctx.$slots, "layer-node-tool", { data })
|
|
10462
10533
|
]),
|
|
@@ -10503,7 +10574,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10503
10574
|
]),
|
|
10504
10575
|
"props-panel": withCtx(() => [
|
|
10505
10576
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
10506
|
-
createVNode(_sfc_main$
|
|
10577
|
+
createVNode(_sfc_main$r, {
|
|
10507
10578
|
"extend-state": _ctx.extendFormState,
|
|
10508
10579
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
10509
10580
|
}, {
|
|
@@ -10529,8 +10600,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10529
10600
|
}
|
|
10530
10601
|
});
|
|
10531
10602
|
|
|
10532
|
-
const index$1 = '';
|
|
10533
|
-
|
|
10534
10603
|
const defaultInstallOpt = {
|
|
10535
10604
|
// eslint-disable-next-line no-eval
|
|
10536
10605
|
parseDSL: (dsl) => eval(dsl)
|
|
@@ -10541,23 +10610,23 @@ const index = {
|
|
|
10541
10610
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
10542
10611
|
setConfig(option);
|
|
10543
10612
|
app.component(_sfc_main.name, _sfc_main);
|
|
10544
|
-
app.component("m-fields-ui-select", _sfc_main$
|
|
10545
|
-
app.component("m-fields-code-link", _sfc_main$
|
|
10546
|
-
app.component("m-fields-vs-code", _sfc_main$
|
|
10547
|
-
app.component("magic-code-editor", _sfc_main$
|
|
10548
|
-
app.component("m-fields-code-select", _sfc_main$
|
|
10549
|
-
app.component("m-fields-code-select-col", _sfc_main$
|
|
10550
|
-
app.component("m-fields-event-select", _sfc_main$
|
|
10551
|
-
app.component("m-fields-data-source-fields", _sfc_main$
|
|
10552
|
-
app.component("m-fields-data-source-mocks", _sfc_main$
|
|
10553
|
-
app.component("m-fields-key-value", _sfc_main$
|
|
10554
|
-
app.component("m-fields-data-source-input", _sfc_main$
|
|
10555
|
-
app.component("m-fields-data-source-select", _sfc_main$
|
|
10556
|
-
app.component("m-fields-data-source-methods", _sfc_main$
|
|
10557
|
-
app.component("m-fields-data-source-method-select", _sfc_main$
|
|
10558
|
-
app.component("m-fields-data-source-field-select", _sfc_main$
|
|
10613
|
+
app.component("m-fields-ui-select", _sfc_main$y);
|
|
10614
|
+
app.component("m-fields-code-link", _sfc_main$O);
|
|
10615
|
+
app.component("m-fields-vs-code", _sfc_main$P);
|
|
10616
|
+
app.component("magic-code-editor", _sfc_main$Q);
|
|
10617
|
+
app.component("m-fields-code-select", _sfc_main$N);
|
|
10618
|
+
app.component("m-fields-code-select-col", _sfc_main$J);
|
|
10619
|
+
app.component("m-fields-event-select", _sfc_main$B);
|
|
10620
|
+
app.component("m-fields-data-source-fields", _sfc_main$I);
|
|
10621
|
+
app.component("m-fields-data-source-mocks", _sfc_main$D);
|
|
10622
|
+
app.component("m-fields-key-value", _sfc_main$z);
|
|
10623
|
+
app.component("m-fields-data-source-input", _sfc_main$G);
|
|
10624
|
+
app.component("m-fields-data-source-select", _sfc_main$C);
|
|
10625
|
+
app.component("m-fields-data-source-methods", _sfc_main$F);
|
|
10626
|
+
app.component("m-fields-data-source-method-select", _sfc_main$E);
|
|
10627
|
+
app.component("m-fields-data-source-field-select", _sfc_main$H);
|
|
10559
10628
|
}
|
|
10560
10629
|
};
|
|
10561
10630
|
|
|
10562
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$
|
|
10631
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$M as CodeBlockEditor, _sfc_main$n as CodeBlockList, _sfc_main$m as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$N as CodeSelect, _sfc_main$J as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$i as ContentMenu, _sfc_main$H as DataSourceFieldSelect, _sfc_main$I as DataSourceFields, _sfc_main$G as DataSourceInput, _sfc_main$E as DataSourceMethodSelect, _sfc_main$F as DataSourceMethods, _sfc_main$D as DataSourceMocks, _sfc_main$C as DataSourceSelect, DragType, _sfc_main$B as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$K as Icon, KeyBindingCommand, _sfc_main$z as KeyValue, Keys, LayerOffset, _sfc_main$e as LayerPanel, Layout, _sfc_main$w as LayoutContainer, _sfc_main$r as PropsPanel, _sfc_main$x as Resizer, _sfc_main$w as SplitView, _sfc_main$Q as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$t as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChilrenLayout, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };
|
|
10563
10632
|
//# sourceMappingURL=tmagic-editor.js.map
|