@tmagic/editor 1.3.5 → 1.3.7
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/LICENSE +5432 -0
- package/dist/style.css +88 -62
- package/dist/tmagic-editor.js +2448 -2016
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +2453 -2019
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +23 -23
- package/src/Editor.vue +15 -7
- package/src/components/CodeBlockEditor.vue +2 -2
- package/src/components/ContentMenu.vue +5 -5
- package/src/components/FloatingBox.vue +117 -0
- package/src/components/ScrollBar.vue +2 -2
- package/src/components/ScrollViewer.vue +2 -2
- package/src/components/SplitView.vue +2 -2
- package/src/components/Tree.vue +5 -0
- package/src/components/TreeNode.vue +10 -4
- package/src/editorProps.ts +20 -3
- package/src/fields/PageFragmentSelect.vue +55 -0
- package/src/hooks/use-filter.ts +55 -0
- package/src/hooks/use-getso.ts +2 -2
- package/src/hooks/use-node-status.ts +48 -0
- package/src/hooks/use-stage.ts +19 -1
- package/src/index.ts +3 -0
- package/src/initService.ts +43 -17
- package/src/layouts/AddPageBox.vue +16 -4
- package/src/layouts/CodeEditor.vue +2 -2
- package/src/layouts/Framework.vue +17 -3
- package/src/layouts/PropsPanel.vue +2 -2
- package/src/layouts/page-bar/AddButton.vue +48 -0
- package/src/layouts/page-bar/PageBar.vue +158 -0
- package/src/layouts/{workspace → page-bar}/PageBarScrollContainer.vue +61 -35
- package/src/layouts/page-bar/SwitchTypeButton.vue +45 -0
- package/src/layouts/sidebar/Sidebar.vue +9 -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/LayerMenu.vue +39 -27
- package/src/layouts/sidebar/layer/LayerPanel.vue +31 -8
- package/src/layouts/sidebar/layer/use-click.ts +5 -3
- package/src/layouts/sidebar/layer/use-keybinding.ts +8 -8
- package/src/layouts/sidebar/layer/use-node-status.ts +10 -13
- package/src/layouts/workspace/Workspace.vue +6 -7
- package/src/layouts/workspace/viewer/NodeListMenu.vue +68 -129
- package/src/layouts/workspace/viewer/Stage.vue +14 -6
- package/src/layouts/workspace/viewer/ViewerMenu.vue +94 -86
- 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 +131 -64
- package/src/services/history.ts +6 -2
- package/src/services/keybinding.ts +48 -13
- package/src/services/props.ts +70 -12
- package/src/services/storage.ts +23 -13
- package/src/services/ui.ts +4 -1
- package/src/theme/code-block.scss +0 -16
- package/src/theme/floating-box.scss +30 -0
- package/src/theme/layer-panel.scss +19 -0
- package/src/theme/page-bar.scss +18 -1
- 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 +28 -10
- package/src/utils/compose.ts +25 -6
- package/src/utils/content-menu.ts +6 -7
- package/src/utils/editor.ts +34 -18
- package/src/utils/operator.ts +5 -6
- 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 +3 -3
- package/types/components/Tree.vue.d.ts +27 -8
- package/types/components/TreeNode.vue.d.ts +24 -7
- package/types/editorProps.d.ts +16 -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/PageFragmentSelect.vue.d.ts +31 -0
- 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/index.d.ts +1 -0
- package/types/layouts/AddPageBox.vue.d.ts +14 -1
- package/types/layouts/CodeEditor.vue.d.ts +4 -1
- package/types/layouts/Framework.vue.d.ts +14 -1
- package/types/layouts/PropsPanel.vue.d.ts +19 -13
- package/types/layouts/{workspace/viewer/NodeListMenuTitle.vue.d.ts → page-bar/AddButton.vue.d.ts} +3 -2
- package/types/layouts/page-bar/PageBar.vue.d.ts +28 -0
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +24 -0
- package/types/layouts/page-bar/SwitchTypeButton.vue.d.ts +20 -0
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +1 -1
- package/types/layouts/sidebar/Sidebar.vue.d.ts +7 -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 +26 -3
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +3 -1
- package/types/layouts/sidebar/layer/use-click.d.ts +37 -6
- package/types/layouts/sidebar/layer/use-keybinding.d.ts +1 -1
- package/types/layouts/sidebar/layer/use-node-status.d.ts +3 -4
- package/types/layouts/workspace/Workspace.vue.d.ts +3 -1
- package/types/layouts/workspace/viewer/NodeListMenu.vue.d.ts +1 -14
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +2 -0
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +9 -1
- package/types/services/BaseService.d.ts +4 -1
- package/types/services/dataSource.d.ts +1 -0
- package/types/services/dep.d.ts +6 -5
- package/types/services/editor.d.ts +12 -5
- package/types/services/history.d.ts +3 -2
- package/types/services/keybinding.d.ts +21 -1
- package/types/services/props.d.ts +25 -1
- package/types/services/storage.d.ts +7 -7
- package/types/type.d.ts +32 -17
- package/types/utils/compose.d.ts +1 -1
- package/types/utils/editor.d.ts +14 -8
- package/src/layouts/sidebar/layer/use-filter.ts +0 -59
- package/src/layouts/workspace/PageBar.vue +0 -87
- 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/PageBar.vue.d.ts +0 -15
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +0 -9
|
@@ -7,111 +7,121 @@ import { computed, inject, markRaw, ref, watch } from 'vue';
|
|
|
7
7
|
import { Bottom, Top } from '@element-plus/icons-vue';
|
|
8
8
|
|
|
9
9
|
import { NodeType } from '@tmagic/schema';
|
|
10
|
-
import { isPage } from '@tmagic/utils';
|
|
10
|
+
import { isPage, isPageFragment } from '@tmagic/utils';
|
|
11
11
|
|
|
12
12
|
import ContentMenu from '@editor/components/ContentMenu.vue';
|
|
13
13
|
import CenterIcon from '@editor/icons/CenterIcon.vue';
|
|
14
|
-
import storageService from '@editor/services/storage';
|
|
15
14
|
import { LayerOffset, Layout, MenuButton, MenuComponent, Services } from '@editor/type';
|
|
16
15
|
import { useCopyMenu, useDeleteMenu, useMoveToMenu, usePasteMenu } from '@editor/utils/content-menu';
|
|
17
|
-
import { COPY_STORAGE_KEY } from '@editor/utils/editor';
|
|
18
16
|
|
|
19
17
|
defineOptions({
|
|
20
18
|
name: 'MEditorViewerMenu',
|
|
21
19
|
});
|
|
22
20
|
|
|
23
21
|
const props = withDefaults(
|
|
24
|
-
defineProps<{
|
|
25
|
-
|
|
22
|
+
defineProps<{
|
|
23
|
+
isMultiSelect?: boolean;
|
|
24
|
+
stageContentMenu: (MenuButton | MenuComponent)[];
|
|
25
|
+
customContentMenu?: (menus: (MenuButton | MenuComponent)[], type: string) => (MenuButton | MenuComponent)[];
|
|
26
|
+
}>(),
|
|
27
|
+
{
|
|
28
|
+
isMultiSelect: false,
|
|
29
|
+
stageContentMenu: () => [],
|
|
30
|
+
customContentMenu: (menus: (MenuButton | MenuComponent)[]) => menus,
|
|
31
|
+
},
|
|
26
32
|
);
|
|
27
33
|
|
|
28
34
|
const services = inject<Services>('services');
|
|
29
35
|
const editorService = services?.editorService;
|
|
30
36
|
const menu = ref<InstanceType<typeof ContentMenu>>();
|
|
31
|
-
const canPaste = ref(false);
|
|
32
37
|
const canCenter = ref(false);
|
|
33
38
|
|
|
34
39
|
const node = computed(() => editorService?.get('node'));
|
|
35
40
|
const nodes = computed(() => editorService?.get('nodes'));
|
|
36
41
|
const parent = computed(() => editorService?.get('parent'));
|
|
37
42
|
|
|
38
|
-
const menuData = computed<(MenuButton | MenuComponent)[]>(() =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
43
|
+
const menuData = computed<(MenuButton | MenuComponent)[]>(() =>
|
|
44
|
+
props.customContentMenu(
|
|
45
|
+
[
|
|
46
|
+
{
|
|
47
|
+
type: 'button',
|
|
48
|
+
text: '水平居中',
|
|
49
|
+
icon: markRaw(CenterIcon),
|
|
50
|
+
display: () => canCenter.value,
|
|
51
|
+
handler: () => {
|
|
52
|
+
if (!nodes.value) return;
|
|
53
|
+
editorService?.alignCenter(nodes.value);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
useCopyMenu(),
|
|
57
|
+
usePasteMenu(menu),
|
|
58
|
+
{
|
|
59
|
+
type: 'divider',
|
|
60
|
+
direction: 'horizontal',
|
|
61
|
+
display: () => {
|
|
62
|
+
if (!node.value) return false;
|
|
63
|
+
return !isPage(node.value) && !isPageFragment(node.value);
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'button',
|
|
68
|
+
text: '上移一层',
|
|
69
|
+
icon: markRaw(Top),
|
|
70
|
+
display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
|
|
71
|
+
handler: () => {
|
|
72
|
+
editorService?.moveLayer(1);
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'button',
|
|
77
|
+
text: '下移一层',
|
|
78
|
+
icon: markRaw(Bottom),
|
|
79
|
+
display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
|
|
80
|
+
handler: () => {
|
|
81
|
+
editorService?.moveLayer(-1);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: 'button',
|
|
86
|
+
text: '置顶',
|
|
87
|
+
icon: markRaw(Top),
|
|
88
|
+
display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
|
|
89
|
+
handler: () => {
|
|
90
|
+
editorService?.moveLayer(LayerOffset.TOP);
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'button',
|
|
95
|
+
text: '置底',
|
|
96
|
+
icon: markRaw(Bottom),
|
|
97
|
+
display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
|
|
98
|
+
handler: () => {
|
|
99
|
+
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
useMoveToMenu(services),
|
|
103
|
+
{
|
|
104
|
+
type: 'divider',
|
|
105
|
+
direction: 'horizontal',
|
|
106
|
+
display: () => !isPage(node.value) && !isPageFragment(node.value) && !props.isMultiSelect,
|
|
107
|
+
},
|
|
108
|
+
useDeleteMenu(),
|
|
109
|
+
{
|
|
110
|
+
type: 'divider',
|
|
111
|
+
direction: 'horizontal',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: 'button',
|
|
115
|
+
text: '清空参考线',
|
|
116
|
+
handler: () => {
|
|
117
|
+
editorService?.get('stage')?.clearGuides();
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
...props.stageContentMenu,
|
|
121
|
+
],
|
|
122
|
+
'viewer',
|
|
123
|
+
),
|
|
124
|
+
);
|
|
115
125
|
|
|
116
126
|
watch(
|
|
117
127
|
parent,
|
|
@@ -127,10 +137,8 @@ watch(
|
|
|
127
137
|
{ immediate: true },
|
|
128
138
|
);
|
|
129
139
|
|
|
130
|
-
const show =
|
|
140
|
+
const show = (e: MouseEvent) => {
|
|
131
141
|
menu.value?.show(e);
|
|
132
|
-
const data = await storageService.getItem(COPY_STORAGE_KEY);
|
|
133
|
-
canPaste.value = data !== 'undefined' && !!data;
|
|
134
142
|
};
|
|
135
143
|
|
|
136
144
|
defineExpose({ show });
|
|
@@ -24,13 +24,48 @@ const methodName = (prefix: string, name: string) => `${prefix}${name[0].toUpper
|
|
|
24
24
|
|
|
25
25
|
const isError = (error: any): boolean => Object.prototype.toString.call(error) === '[object Error]';
|
|
26
26
|
|
|
27
|
-
const doAction =
|
|
27
|
+
const doAction = (
|
|
28
28
|
args: any[],
|
|
29
29
|
scope: any,
|
|
30
30
|
sourceMethod: any,
|
|
31
31
|
beforeMethodName: string,
|
|
32
32
|
afterMethodName: string,
|
|
33
|
-
fn: (args: any[], next?: Function | undefined) =>
|
|
33
|
+
fn: (args: any[], next?: Function | undefined) => void,
|
|
34
|
+
) => {
|
|
35
|
+
try {
|
|
36
|
+
let beforeArgs = args;
|
|
37
|
+
|
|
38
|
+
for (const beforeMethod of scope.pluginOptionsList[beforeMethodName]) {
|
|
39
|
+
beforeArgs = beforeMethod(...beforeArgs) || [];
|
|
40
|
+
|
|
41
|
+
if (isError(beforeArgs)) throw beforeArgs;
|
|
42
|
+
|
|
43
|
+
if (!Array.isArray(beforeArgs)) {
|
|
44
|
+
beforeArgs = [beforeArgs];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let returnValue: any = fn(beforeArgs, sourceMethod.bind(scope));
|
|
49
|
+
|
|
50
|
+
for (const afterMethod of scope.pluginOptionsList[afterMethodName]) {
|
|
51
|
+
returnValue = afterMethod(returnValue, ...beforeArgs);
|
|
52
|
+
|
|
53
|
+
if (isError(returnValue)) throw returnValue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return returnValue;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const doAsyncAction = async (
|
|
63
|
+
args: any[],
|
|
64
|
+
scope: any,
|
|
65
|
+
sourceMethod: any,
|
|
66
|
+
beforeMethodName: string,
|
|
67
|
+
afterMethodName: string,
|
|
68
|
+
fn: (args: any[], next?: Function | undefined) => Promise<void> | void,
|
|
34
69
|
) => {
|
|
35
70
|
try {
|
|
36
71
|
let beforeArgs = args;
|
|
@@ -112,10 +147,10 @@ export default class extends EventEmitter {
|
|
|
112
147
|
private taskList: (() => Promise<void>)[] = [];
|
|
113
148
|
private doingTask = false;
|
|
114
149
|
|
|
115
|
-
constructor(methods: string[] = [], serialMethods: string[] = []) {
|
|
150
|
+
constructor(methods: { name: string; isAsync: boolean }[] = [], serialMethods: string[] = []) {
|
|
116
151
|
super();
|
|
117
152
|
|
|
118
|
-
methods.forEach((
|
|
153
|
+
methods.forEach(({ name: propertyName, isAsync }) => {
|
|
119
154
|
const scope = this as any;
|
|
120
155
|
|
|
121
156
|
const sourceMethod = scope[propertyName];
|
|
@@ -127,32 +162,34 @@ export default class extends EventEmitter {
|
|
|
127
162
|
this.pluginOptionsList[afterMethodName] = [];
|
|
128
163
|
this.middleware[propertyName] = [];
|
|
129
164
|
|
|
130
|
-
const fn = compose(this.middleware[propertyName]);
|
|
165
|
+
const fn = compose(this.middleware[propertyName], isAsync);
|
|
131
166
|
Object.defineProperty(scope, propertyName, {
|
|
132
|
-
value:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
// 由于async await,所以会出现函数执行到await时让出线程,导致执行顺序出错,例如调用了select(1) -> update -> select(2),这个时候就有可能出现update了2;
|
|
138
|
-
// 这里保证函数调用严格按顺序执行;
|
|
139
|
-
const promise = new Promise<any>((resolve, reject) => {
|
|
140
|
-
this.taskList.push(async () => {
|
|
141
|
-
try {
|
|
142
|
-
const value = await doAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
|
|
143
|
-
resolve(value);
|
|
144
|
-
} catch (e) {
|
|
145
|
-
reject(e);
|
|
167
|
+
value: isAsync
|
|
168
|
+
? async (...args: any[]) => {
|
|
169
|
+
if (!serialMethods.includes(propertyName)) {
|
|
170
|
+
return doAsyncAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
|
|
146
171
|
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
172
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
173
|
+
// 由于async await,所以会出现函数执行到await时让出线程,导致执行顺序出错,例如调用了select(1) -> update -> select(2),这个时候就有可能出现update了2;
|
|
174
|
+
// 这里保证函数调用严格按顺序执行;
|
|
175
|
+
const promise = new Promise<any>((resolve, reject) => {
|
|
176
|
+
this.taskList.push(async () => {
|
|
177
|
+
try {
|
|
178
|
+
const value = await doAsyncAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
|
|
179
|
+
resolve(value);
|
|
180
|
+
} catch (e) {
|
|
181
|
+
reject(e);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
if (!this.doingTask) {
|
|
187
|
+
this.doTask();
|
|
188
|
+
}
|
|
153
189
|
|
|
154
|
-
|
|
155
|
-
|
|
190
|
+
return promise;
|
|
191
|
+
}
|
|
192
|
+
: (...args: any[]) => doAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn),
|
|
156
193
|
});
|
|
157
194
|
});
|
|
158
195
|
}
|
|
@@ -38,7 +38,13 @@ class CodeBlock extends BaseService {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
constructor() {
|
|
41
|
-
super([
|
|
41
|
+
super([
|
|
42
|
+
{ name: 'setCodeDslById', isAsync: true },
|
|
43
|
+
{ name: 'setEditStatus', isAsync: true },
|
|
44
|
+
{ name: 'setCombineIds', isAsync: true },
|
|
45
|
+
{ name: 'setUndeleteableList', isAsync: true },
|
|
46
|
+
{ name: 'deleteCodeDslByIds', isAsync: true },
|
|
47
|
+
]);
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
/**
|
package/src/services/dep.ts
CHANGED
|
@@ -35,8 +35,8 @@ class Dep extends BaseService {
|
|
|
35
35
|
return this.watcher.getTargets(type);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
public getTarget(id: Id) {
|
|
39
|
-
return this.watcher.getTarget(id);
|
|
38
|
+
public getTarget(id: Id, type: string = DepTargetType.DEFAULT) {
|
|
39
|
+
return this.watcher.getTarget(id, type);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
public addTarget(target: Target) {
|
|
@@ -44,8 +44,8 @@ class Dep extends BaseService {
|
|
|
44
44
|
this.emit('add-target', target);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
public removeTarget(id: Id) {
|
|
48
|
-
this.watcher.removeTarget(id);
|
|
47
|
+
public removeTarget(id: Id, type: string = DepTargetType.DEFAULT) {
|
|
48
|
+
this.watcher.removeTarget(id, type);
|
|
49
49
|
this.emit('remove-target');
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -53,8 +53,8 @@ class Dep extends BaseService {
|
|
|
53
53
|
this.watcher.clearTargets();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
public collect(nodes: MNode[], deep = false) {
|
|
57
|
-
this.watcher.collect(nodes, deep);
|
|
56
|
+
public collect(nodes: MNode[], deep = false, type?: DepTargetType) {
|
|
57
|
+
this.watcher.collect(nodes, deep, type);
|
|
58
58
|
this.emit('collected', nodes, deep);
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -62,8 +62,12 @@ class Dep extends BaseService {
|
|
|
62
62
|
return this.watcher.clear(nodes);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
public hasTarget(id: Id) {
|
|
66
|
-
return this.watcher.hasTarget(id);
|
|
65
|
+
public hasTarget(id: Id, type: string = DepTargetType.DEFAULT) {
|
|
66
|
+
return this.watcher.hasTarget(id, type);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public hasSpecifiedTypeTarget(type: string = DepTargetType.DEFAULT): boolean {
|
|
70
|
+
return this.watcher.hasSpecifiedTypeTarget(type);
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|