@tmagic/editor 1.4.8 → 1.4.10
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 +26 -0
- package/dist/tmagic-editor.js +3213 -2820
- package/dist/tmagic-editor.umd.cjs +3237 -2839
- package/package.json +14 -12
- package/src/Editor.vue +212 -0
- package/src/components/CodeBlockEditor.vue +268 -0
- package/src/components/CodeParams.vue +60 -0
- package/src/components/ContentMenu.vue +193 -0
- package/src/components/FloatingBox.vue +178 -0
- package/src/components/Icon.vue +27 -0
- package/src/components/Resizer.vue +23 -0
- package/src/components/ScrollBar.vue +151 -0
- package/src/components/ScrollViewer.vue +128 -0
- package/src/components/SearchInput.vue +37 -0
- package/src/components/SplitView.vue +186 -0
- package/src/components/ToolButton.vue +138 -0
- package/src/components/Tree.vue +71 -0
- package/src/components/TreeNode.vue +150 -0
- package/src/editorProps.ts +120 -0
- package/src/fields/Code.vue +50 -0
- package/src/fields/CodeLink.vue +80 -0
- package/src/fields/CodeSelect.vue +132 -0
- package/src/fields/CodeSelectCol.vue +139 -0
- package/src/fields/CondOpSelect.vue +87 -0
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +152 -0
- package/src/fields/DataSourceFieldSelect/Index.vue +168 -0
- package/src/fields/DataSourceFields.vue +329 -0
- package/src/fields/DataSourceInput.vue +339 -0
- package/src/fields/DataSourceMethodSelect.vue +153 -0
- package/src/fields/DataSourceMethods.vue +104 -0
- package/src/fields/DataSourceMocks.vue +255 -0
- package/src/fields/DataSourceSelect.vue +98 -0
- package/src/fields/DisplayConds.vue +145 -0
- package/src/fields/EventSelect.vue +375 -0
- package/src/fields/KeyValue.vue +137 -0
- package/src/fields/PageFragmentSelect.vue +63 -0
- package/src/fields/UISelect.vue +135 -0
- package/src/hooks/index.ts +24 -0
- package/src/hooks/use-code-block-edit.ts +83 -0
- package/src/hooks/use-data-source-edit.ts +46 -0
- package/src/hooks/use-data-source-method.ts +100 -0
- package/src/hooks/use-editor-content-height.ts +26 -0
- package/src/hooks/use-filter.ts +55 -0
- package/src/hooks/use-float-box.ts +76 -0
- package/src/hooks/use-getso.ts +35 -0
- package/src/hooks/use-next-float-box-position.ts +29 -0
- package/src/hooks/use-node-status.ts +48 -0
- package/src/hooks/use-stage.ts +129 -0
- package/src/hooks/use-window-rect.ts +20 -0
- package/src/icons/AppManageIcon.vue +15 -0
- package/src/icons/CenterIcon.vue +13 -0
- package/src/icons/CodeIcon.vue +28 -0
- package/src/icons/FolderMinusIcon.vue +22 -0
- package/src/icons/PinIcon.vue +25 -0
- package/src/icons/PinnedIcon.vue +25 -0
- package/src/index.ts +124 -0
- package/src/initService.ts +448 -0
- package/src/layouts/AddPageBox.vue +55 -0
- package/src/layouts/CodeEditor.vue +226 -0
- package/src/layouts/Framework.vue +165 -0
- package/src/layouts/NavMenu.vue +200 -0
- package/src/layouts/PropsPanel.vue +131 -0
- package/src/layouts/page-bar/AddButton.vue +48 -0
- package/src/layouts/page-bar/PageBar.vue +165 -0
- package/src/layouts/page-bar/PageBarScrollContainer.vue +192 -0
- package/src/layouts/page-bar/PageList.vue +55 -0
- package/src/layouts/page-bar/SwitchTypeButton.vue +45 -0
- package/src/layouts/sidebar/ComponentListPanel.vue +134 -0
- package/src/layouts/sidebar/Sidebar.vue +278 -0
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +160 -0
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +70 -0
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +84 -0
- package/src/layouts/sidebar/data-source/DataSourceList.vue +172 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +106 -0
- package/src/layouts/sidebar/layer/LayerMenu.vue +128 -0
- package/src/layouts/sidebar/layer/LayerNodeTool.vue +32 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +119 -0
- package/src/layouts/sidebar/layer/use-click.ts +113 -0
- package/src/layouts/sidebar/layer/use-drag.ts +167 -0
- package/src/layouts/sidebar/layer/use-keybinding.ts +54 -0
- package/src/layouts/sidebar/layer/use-node-status.ts +114 -0
- package/src/layouts/workspace/Breadcrumb.vue +35 -0
- package/src/layouts/workspace/Workspace.vue +46 -0
- package/src/layouts/workspace/viewer/NodeListMenu.vue +115 -0
- package/src/layouts/workspace/viewer/Stage.vue +246 -0
- package/src/layouts/workspace/viewer/StageOverlay.vue +68 -0
- package/src/layouts/workspace/viewer/ViewerMenu.vue +145 -0
- package/src/services/BaseService.ts +230 -0
- package/src/services/codeBlock.ts +327 -0
- package/src/services/componentList.ts +58 -0
- package/src/services/dataSource.ts +216 -0
- package/src/services/dep.ts +152 -0
- package/src/services/editor.ts +1135 -0
- package/src/services/events.ts +93 -0
- package/src/services/history.ts +126 -0
- package/src/services/keybinding.ts +220 -0
- package/src/services/props.ts +286 -0
- package/src/services/stageOverlay.ts +212 -0
- package/src/services/storage.ts +155 -0
- package/src/services/ui.ts +157 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/theme/breadcrumb.scss +6 -0
- package/src/theme/code-block.scss +6 -0
- package/src/theme/code-editor.scss +38 -0
- package/src/theme/common/var.scss +14 -0
- package/src/theme/component-list-panel.scss +95 -0
- package/src/theme/content-menu.scss +76 -0
- package/src/theme/data-source-field-select.scss +16 -0
- package/src/theme/data-source-field.scss +12 -0
- package/src/theme/data-source-fields.scss +13 -0
- package/src/theme/data-source-input.scss +18 -0
- package/src/theme/data-source-methods.scss +13 -0
- package/src/theme/data-source.scss +28 -0
- package/src/theme/event.scss +37 -0
- package/src/theme/floating-box.scss +32 -0
- package/src/theme/framework.scss +69 -0
- package/src/theme/icon.scss +12 -0
- package/src/theme/index.scss +10 -0
- package/src/theme/key-value.scss +20 -0
- package/src/theme/layer-panel.scss +26 -0
- package/src/theme/layout.scss +9 -0
- package/src/theme/nav-menu.scss +78 -0
- package/src/theme/page-bar.scss +102 -0
- package/src/theme/page-fragment-select.scss +14 -0
- package/src/theme/props-panel.scss +55 -0
- package/src/theme/resizer.scss +66 -0
- package/src/theme/ruler.scss +38 -0
- package/src/theme/search-input.scss +14 -0
- package/src/theme/sidebar.scss +79 -0
- package/src/theme/stage.scss +76 -0
- package/src/theme/theme.scss +28 -0
- package/src/theme/tree.scss +89 -0
- package/src/theme/workspace.scss +9 -0
- package/src/type.ts +780 -0
- package/src/utils/compose.ts +52 -0
- package/src/utils/config.ts +29 -0
- package/src/utils/content-menu.ts +95 -0
- package/src/utils/data-source/formConfigs/base.ts +30 -0
- package/src/utils/data-source/formConfigs/http.ts +60 -0
- package/src/utils/data-source/index.ts +249 -0
- package/src/utils/editor.ts +313 -0
- package/src/utils/idle-task.ts +72 -0
- package/src/utils/index.ts +24 -0
- package/src/utils/keybinding-config.ts +125 -0
- package/src/utils/logger.ts +47 -0
- package/src/utils/monaco-editor.ts +8 -0
- package/src/utils/operator.ts +106 -0
- package/src/utils/props.ts +407 -0
- package/src/utils/scroll-viewer.ts +165 -0
- package/src/utils/tree.ts +15 -0
- package/src/utils/undo-redo.ts +76 -0
- package/types/editorProps.d.ts +3 -1
- package/types/fields/CondOpSelect.vue.d.ts +17 -0
- package/types/fields/DataSourceFieldSelect/FieldSelect.vue.d.ts +36 -0
- package/types/fields/{DataSourceFieldSelect.vue.d.ts → DataSourceFieldSelect/Index.vue.d.ts} +1 -1
- package/types/fields/DisplayConds.vue.d.ts +32 -0
- package/types/index.d.ts +3 -1
- package/types/layouts/Framework.vue.d.ts +3 -1
- package/types/layouts/PropsPanel.vue.d.ts +21 -21
- package/types/layouts/page-bar/PageBar.vue.d.ts +6 -0
- package/types/layouts/page-bar/PageBarScrollContainer.vue.d.ts +3 -0
- package/types/layouts/page-bar/PageList.vue.d.ts +25 -0
- package/types/services/ui.d.ts +1 -0
- package/types/type.d.ts +30 -4
- package/types/utils/data-source/index.d.ts +1 -0
- package/types/utils/props.d.ts +12 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 4H21V6H2V4Z" fill="black" fill-opacity="0.9" />
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 11H18V13H5V11Z" fill="black" fill-opacity="0.9" />
|
|
5
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 18H21V20H2V18Z" fill="black" fill-opacity="0.9" />
|
|
6
|
+
</svg>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
defineOptions({
|
|
11
|
+
name: 'MEditorCenterIcon',
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs>
|
|
4
|
+
<g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="03图标" transform="translate(-561.000000, -2356.000000)">
|
|
6
|
+
<g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)">
|
|
7
|
+
<g id="路径">
|
|
8
|
+
<mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask>
|
|
9
|
+
<use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use>
|
|
10
|
+
<path
|
|
11
|
+
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"
|
|
12
|
+
id="形状"
|
|
13
|
+
fill="#1D1F24"
|
|
14
|
+
mask="url(#mask-2)"
|
|
15
|
+
></path>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
<g id="icon切图" transform="translate(226.000000, 1782.000000)"></g>
|
|
19
|
+
</g>
|
|
20
|
+
</g>
|
|
21
|
+
</svg>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
defineOptions({
|
|
26
|
+
name: 'MEditorCodeIcon',
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
width="1em"
|
|
4
|
+
height="1em"
|
|
5
|
+
viewBox="0 0 16 16"
|
|
6
|
+
class="bi bi-folder-minus"
|
|
7
|
+
fill="currentColor"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
fill-rule="evenodd"
|
|
12
|
+
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"
|
|
13
|
+
/>
|
|
14
|
+
<path fill-rule="evenodd" 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" />
|
|
15
|
+
</svg>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script lang="ts" setup>
|
|
19
|
+
defineOptions({
|
|
20
|
+
name: 'MEditorFolderMinusIcon',
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
class="icon icon-tabler icon-tabler-pin"
|
|
5
|
+
width="24"
|
|
6
|
+
height="24"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
stroke="currentColor"
|
|
10
|
+
fill="none"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"
|
|
13
|
+
>
|
|
14
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
15
|
+
<path d="M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4" />
|
|
16
|
+
<line x1="9" y1="15" x2="4.5" y2="19.5" />
|
|
17
|
+
<line x1="14.5" y1="4" x2="20" y2="9.5" />
|
|
18
|
+
</svg>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script lang="ts" setup>
|
|
22
|
+
defineOptions({
|
|
23
|
+
name: 'MEditorPinIcon',
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
class="icon icon-tabler icon-tabler-pinned"
|
|
5
|
+
width="24"
|
|
6
|
+
height="24"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
stroke="currentColor"
|
|
10
|
+
fill="none"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"
|
|
13
|
+
>
|
|
14
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
15
|
+
<path d="M9 4v6l-2 4v2h10v-2l-2 -4v-6" />
|
|
16
|
+
<line x1="12" y1="16" x2="12" y2="21" />
|
|
17
|
+
<line x1="8" y1="4" x2="16" y2="4" />
|
|
18
|
+
</svg>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script lang="ts" setup>
|
|
22
|
+
defineOptions({
|
|
23
|
+
name: 'MEditorPinnedIcon',
|
|
24
|
+
});
|
|
25
|
+
</script>
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making TMagicEditor available.
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 THL A29 Limited, a Tencent company. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { App } from 'vue';
|
|
19
|
+
|
|
20
|
+
import Code from './fields/Code.vue';
|
|
21
|
+
import CodeLink from './fields/CodeLink.vue';
|
|
22
|
+
import CodeSelect from './fields/CodeSelect.vue';
|
|
23
|
+
import CodeSelectCol from './fields/CodeSelectCol.vue';
|
|
24
|
+
import CondOpSelect from './fields/CondOpSelect.vue';
|
|
25
|
+
import DataSourceFields from './fields/DataSourceFields.vue';
|
|
26
|
+
import DataSourceFieldSelect from './fields/DataSourceFieldSelect/Index.vue';
|
|
27
|
+
import DataSourceInput from './fields/DataSourceInput.vue';
|
|
28
|
+
import DataSourceMethods from './fields/DataSourceMethods.vue';
|
|
29
|
+
import DataSourceMethodSelect from './fields/DataSourceMethodSelect.vue';
|
|
30
|
+
import DataSourceMocks from './fields/DataSourceMocks.vue';
|
|
31
|
+
import DataSourceSelect from './fields/DataSourceSelect.vue';
|
|
32
|
+
import DisplayConds from './fields/DisplayConds.vue';
|
|
33
|
+
import EventSelect from './fields/EventSelect.vue';
|
|
34
|
+
import KeyValue from './fields/KeyValue.vue';
|
|
35
|
+
import PageFragmentSelect from './fields/PageFragmentSelect.vue';
|
|
36
|
+
import uiSelect from './fields/UISelect.vue';
|
|
37
|
+
import CodeEditor from './layouts/CodeEditor.vue';
|
|
38
|
+
import { setConfig } from './utils/config';
|
|
39
|
+
import Editor from './Editor.vue';
|
|
40
|
+
import type { InstallOptions } from './type';
|
|
41
|
+
|
|
42
|
+
import './theme/index.scss';
|
|
43
|
+
|
|
44
|
+
export type { OnDrag } from 'gesto';
|
|
45
|
+
|
|
46
|
+
export { DepTargetType } from '@tmagic/dep';
|
|
47
|
+
export type { MoveableOptions } from '@tmagic/stage';
|
|
48
|
+
export * from './type';
|
|
49
|
+
export * from './hooks';
|
|
50
|
+
export * from './utils';
|
|
51
|
+
export { default as TMagicEditor } from './Editor.vue';
|
|
52
|
+
export { default as TMagicCodeEditor } from './layouts/CodeEditor.vue';
|
|
53
|
+
export { default as editorService } from './services/editor';
|
|
54
|
+
export { default as propsService } from './services/props';
|
|
55
|
+
export { default as historyService } from './services/history';
|
|
56
|
+
export { default as storageService } from './services/storage';
|
|
57
|
+
export { default as eventsService } from './services/events';
|
|
58
|
+
export { default as dataSourceService } from './services/dataSource';
|
|
59
|
+
export { default as stageOverlayService } from './services/stageOverlay';
|
|
60
|
+
export { default as uiService } from './services/ui';
|
|
61
|
+
export { default as codeBlockService } from './services/codeBlock';
|
|
62
|
+
export { default as depService } from './services/dep';
|
|
63
|
+
export { default as ComponentListPanel } from './layouts/sidebar/ComponentListPanel.vue';
|
|
64
|
+
export { default as LayerPanel } from './layouts/sidebar/layer/LayerPanel.vue';
|
|
65
|
+
export { default as CodeSelect } from './fields/CodeSelect.vue';
|
|
66
|
+
export { default as CodeSelectCol } from './fields/CodeSelectCol.vue';
|
|
67
|
+
export { default as DataSourceFields } from './fields/DataSourceFields.vue';
|
|
68
|
+
export { default as DataSourceMocks } from './fields/DataSourceMocks.vue';
|
|
69
|
+
export { default as DataSourceMethods } from './fields/DataSourceMethods.vue';
|
|
70
|
+
export { default as DataSourceInput } from './fields/DataSourceInput.vue';
|
|
71
|
+
export { default as DataSourceSelect } from './fields/DataSourceSelect.vue';
|
|
72
|
+
export { default as DataSourceMethodSelect } from './fields/DataSourceMethodSelect.vue';
|
|
73
|
+
export { default as DataSourceFieldSelect } from './fields/DataSourceFieldSelect/Index.vue';
|
|
74
|
+
export { default as EventSelect } from './fields/EventSelect.vue';
|
|
75
|
+
export { default as KeyValue } from './fields/KeyValue.vue';
|
|
76
|
+
export { default as CodeBlockList } from './layouts/sidebar/code-block/CodeBlockList.vue';
|
|
77
|
+
export { default as CodeBlockListPanel } from './layouts/sidebar/code-block/CodeBlockListPanel.vue';
|
|
78
|
+
export { default as DataSourceConfigPanel } from './layouts/sidebar/data-source/DataSourceConfigPanel.vue';
|
|
79
|
+
export { default as PropsPanel } from './layouts/PropsPanel.vue';
|
|
80
|
+
export { default as ToolButton } from './components/ToolButton.vue';
|
|
81
|
+
export { default as ContentMenu } from './components/ContentMenu.vue';
|
|
82
|
+
export { default as Icon } from './components/Icon.vue';
|
|
83
|
+
export { default as LayoutContainer } from './components/SplitView.vue';
|
|
84
|
+
export { default as SplitView } from './components/SplitView.vue';
|
|
85
|
+
export { default as Resizer } from './components/Resizer.vue';
|
|
86
|
+
export { default as CodeBlockEditor } from './components/CodeBlockEditor.vue';
|
|
87
|
+
export { default as FloatingBox } from './components/FloatingBox.vue';
|
|
88
|
+
export { default as PageFragmentSelect } from './fields/PageFragmentSelect.vue';
|
|
89
|
+
export { default as DisplayConds } from './fields/DisplayConds.vue';
|
|
90
|
+
export { default as CondOpSelect } from './fields/CondOpSelect.vue';
|
|
91
|
+
|
|
92
|
+
const defaultInstallOpt: InstallOptions = {
|
|
93
|
+
// eslint-disable-next-line no-eval
|
|
94
|
+
parseDSL: (dsl: string) => eval(dsl),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default {
|
|
98
|
+
install: (app: App, opt?: Partial<InstallOptions>): void => {
|
|
99
|
+
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
100
|
+
|
|
101
|
+
// eslint-disable-next-line no-param-reassign
|
|
102
|
+
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
103
|
+
setConfig(option);
|
|
104
|
+
app.component(`${Editor.name || 'MEditor'}`, Editor);
|
|
105
|
+
app.component('magic-code-editor', CodeEditor);
|
|
106
|
+
app.component('m-fields-ui-select', uiSelect);
|
|
107
|
+
app.component('m-fields-code-link', CodeLink);
|
|
108
|
+
app.component('m-fields-vs-code', Code);
|
|
109
|
+
app.component('m-fields-code-select', CodeSelect);
|
|
110
|
+
app.component('m-fields-code-select-col', CodeSelectCol);
|
|
111
|
+
app.component('m-fields-event-select', EventSelect);
|
|
112
|
+
app.component('m-fields-data-source-fields', DataSourceFields);
|
|
113
|
+
app.component('m-fields-data-source-mocks', DataSourceMocks);
|
|
114
|
+
app.component('m-fields-key-value', KeyValue);
|
|
115
|
+
app.component('m-fields-data-source-input', DataSourceInput);
|
|
116
|
+
app.component('m-fields-data-source-select', DataSourceSelect);
|
|
117
|
+
app.component('m-fields-data-source-methods', DataSourceMethods);
|
|
118
|
+
app.component('m-fields-data-source-method-select', DataSourceMethodSelect);
|
|
119
|
+
app.component('m-fields-data-source-field-select', DataSourceFieldSelect);
|
|
120
|
+
app.component('m-fields-page-fragment-select', PageFragmentSelect);
|
|
121
|
+
app.component('m-fields-display-conds', DisplayConds);
|
|
122
|
+
app.component('m-fields-cond-op-select', CondOpSelect);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { onBeforeUnmount, reactive, toRaw, watch } from 'vue';
|
|
2
|
+
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
|
|
4
|
+
import type { EventOption } from '@tmagic/core';
|
|
5
|
+
import {
|
|
6
|
+
createCodeBlockTarget,
|
|
7
|
+
createDataSourceCondTarget,
|
|
8
|
+
createDataSourceMethodTarget,
|
|
9
|
+
createDataSourceTarget,
|
|
10
|
+
DepTargetType,
|
|
11
|
+
Target,
|
|
12
|
+
} from '@tmagic/dep';
|
|
13
|
+
import type { CodeBlockContent, DataSourceSchema, Id, MApp, MNode, MPage, MPageFragment } from '@tmagic/schema';
|
|
14
|
+
import { isPage } from '@tmagic/utils';
|
|
15
|
+
|
|
16
|
+
import PropsPanel from './layouts/PropsPanel.vue';
|
|
17
|
+
import { EditorProps } from './editorProps';
|
|
18
|
+
import { Services } from './type';
|
|
19
|
+
import { traverseNode } from './utils';
|
|
20
|
+
|
|
21
|
+
export declare type LooseRequired<T> = {
|
|
22
|
+
[P in string & keyof T]: T[P];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const initServiceState = (
|
|
26
|
+
props: EditorProps,
|
|
27
|
+
{
|
|
28
|
+
editorService,
|
|
29
|
+
historyService,
|
|
30
|
+
componentListService,
|
|
31
|
+
propsService,
|
|
32
|
+
eventsService,
|
|
33
|
+
uiService,
|
|
34
|
+
codeBlockService,
|
|
35
|
+
keybindingService,
|
|
36
|
+
dataSourceService,
|
|
37
|
+
}: Services,
|
|
38
|
+
) => {
|
|
39
|
+
// 初始值变化,重新设置节点信息
|
|
40
|
+
watch(
|
|
41
|
+
() => props.modelValue,
|
|
42
|
+
(modelValue) => {
|
|
43
|
+
editorService.set('root', modelValue || null);
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
immediate: true,
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
watch(
|
|
51
|
+
() => props.disabledMultiSelect,
|
|
52
|
+
(disabledMultiSelect) => {
|
|
53
|
+
editorService.set('disabledMultiSelect', disabledMultiSelect || false);
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
immediate: true,
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
watch(
|
|
61
|
+
() => props.componentGroupList,
|
|
62
|
+
(componentGroupList) => componentGroupList && componentListService.setList(componentGroupList),
|
|
63
|
+
{
|
|
64
|
+
immediate: true,
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
watch(
|
|
69
|
+
() => props.datasourceList,
|
|
70
|
+
(datasourceList) => datasourceList && dataSourceService.set('datasourceTypeList', datasourceList),
|
|
71
|
+
{
|
|
72
|
+
immediate: true,
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
watch(
|
|
77
|
+
() => props.propsConfigs,
|
|
78
|
+
(configs) => configs && propsService.setPropsConfigs(configs),
|
|
79
|
+
{
|
|
80
|
+
immediate: true,
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
watch(
|
|
85
|
+
() => props.propsValues,
|
|
86
|
+
(values) => values && propsService.setPropsValues(values),
|
|
87
|
+
{
|
|
88
|
+
immediate: true,
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
watch(
|
|
93
|
+
() => props.eventMethodList,
|
|
94
|
+
(eventMethodList) => {
|
|
95
|
+
const eventsList: Record<string, EventOption[]> = {};
|
|
96
|
+
const methodsList: Record<string, EventOption[]> = {};
|
|
97
|
+
|
|
98
|
+
eventMethodList &&
|
|
99
|
+
Object.keys(eventMethodList).forEach((type: string) => {
|
|
100
|
+
eventsList[type] = eventMethodList[type].events;
|
|
101
|
+
methodsList[type] = eventMethodList[type].methods;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
eventsService.setEvents(eventsList);
|
|
105
|
+
eventsService.setMethods(methodsList);
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
immediate: true,
|
|
109
|
+
},
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
watch(
|
|
113
|
+
() => props.datasourceConfigs,
|
|
114
|
+
(configs) => {
|
|
115
|
+
configs &&
|
|
116
|
+
Object.entries(configs).forEach(([key, value]) => {
|
|
117
|
+
dataSourceService.setFormConfig(key, value);
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
immediate: true,
|
|
122
|
+
},
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
watch(
|
|
126
|
+
() => props.datasourceValues,
|
|
127
|
+
(values) => {
|
|
128
|
+
values &&
|
|
129
|
+
Object.entries(values).forEach(([key, value]) => {
|
|
130
|
+
dataSourceService.setFormValue(key, value);
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
immediate: true,
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
watch(
|
|
139
|
+
() => props.datasourceEventMethodList,
|
|
140
|
+
(eventMethodList) => {
|
|
141
|
+
const eventsList: Record<string, EventOption[]> = {};
|
|
142
|
+
const methodsList: Record<string, EventOption[]> = {};
|
|
143
|
+
|
|
144
|
+
eventMethodList &&
|
|
145
|
+
Object.keys(eventMethodList).forEach((type: string) => {
|
|
146
|
+
eventsList[type] = eventMethodList[type].events;
|
|
147
|
+
methodsList[type] = eventMethodList[type].methods;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
Object.entries(eventsList).forEach(([key, value]) => {
|
|
151
|
+
dataSourceService.setFormEvent(key, value);
|
|
152
|
+
});
|
|
153
|
+
Object.entries(methodsList).forEach(([key, value]) => {
|
|
154
|
+
dataSourceService.setFormMethod(key, value);
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
immediate: true,
|
|
159
|
+
},
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
watch(
|
|
163
|
+
() => props.defaultSelected,
|
|
164
|
+
(defaultSelected) => defaultSelected && editorService.select(defaultSelected),
|
|
165
|
+
{
|
|
166
|
+
immediate: true,
|
|
167
|
+
},
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
watch(
|
|
171
|
+
() => props.stageRect,
|
|
172
|
+
(stageRect) => stageRect && uiService.set('stageRect', stageRect),
|
|
173
|
+
{
|
|
174
|
+
immediate: true,
|
|
175
|
+
},
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
onBeforeUnmount(() => {
|
|
179
|
+
editorService.resetState();
|
|
180
|
+
historyService.resetState();
|
|
181
|
+
propsService.resetState();
|
|
182
|
+
uiService.resetState();
|
|
183
|
+
componentListService.resetState();
|
|
184
|
+
codeBlockService.resetState();
|
|
185
|
+
keybindingService.reset();
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const initServiceEvents = (
|
|
190
|
+
props: EditorProps,
|
|
191
|
+
emit: ((event: 'props-panel-mounted', instance: InstanceType<typeof PropsPanel>) => void) &
|
|
192
|
+
((event: 'update:modelValue', value: MApp | null) => void),
|
|
193
|
+
{ editorService, codeBlockService, dataSourceService, depService }: Services,
|
|
194
|
+
) => {
|
|
195
|
+
const getApp = () => {
|
|
196
|
+
const stage = editorService.get('stage');
|
|
197
|
+
return stage?.renderer.runtime?.getApp?.();
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const updateDataSourceSchema = () => {
|
|
201
|
+
const root = editorService.get('root');
|
|
202
|
+
|
|
203
|
+
if (root?.dataSources) {
|
|
204
|
+
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const targetAddHandler = (target: Target) => {
|
|
209
|
+
const root = editorService.get('root');
|
|
210
|
+
if (!root) return;
|
|
211
|
+
|
|
212
|
+
if (target.type === DepTargetType.DATA_SOURCE) {
|
|
213
|
+
if (!root.dataSourceDeps) {
|
|
214
|
+
root.dataSourceDeps = {};
|
|
215
|
+
}
|
|
216
|
+
root.dataSourceDeps[target.id] = target.deps;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (target.type === DepTargetType.DATA_SOURCE_COND) {
|
|
220
|
+
if (!root.dataSourceCondDeps) {
|
|
221
|
+
root.dataSourceCondDeps = {};
|
|
222
|
+
}
|
|
223
|
+
root.dataSourceCondDeps[target.id] = target.deps;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const targetRemoveHandler = (id: string | number) => {
|
|
228
|
+
const root = editorService.get('root');
|
|
229
|
+
|
|
230
|
+
if (root?.dataSourceDeps) {
|
|
231
|
+
delete root.dataSourceDeps[id];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (root?.dataSourceCondDeps) {
|
|
235
|
+
delete root.dataSourceCondDeps[id];
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const collectedHandler = (nodes: MNode[], deep: boolean) => {
|
|
240
|
+
const root = editorService.get('root');
|
|
241
|
+
const stage = editorService.get('stage');
|
|
242
|
+
|
|
243
|
+
if (!root || !stage) return;
|
|
244
|
+
|
|
245
|
+
const app = getApp();
|
|
246
|
+
|
|
247
|
+
if (!app) return;
|
|
248
|
+
|
|
249
|
+
if (app.dsl) {
|
|
250
|
+
app.dsl.dataSourceDeps = root.dataSourceDeps;
|
|
251
|
+
app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
|
|
252
|
+
app.dsl.dataSources = root.dataSources;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
updateDataSourceSchema();
|
|
256
|
+
|
|
257
|
+
const allNodes: MNode[] = [];
|
|
258
|
+
|
|
259
|
+
if (deep) {
|
|
260
|
+
nodes.forEach((node) => {
|
|
261
|
+
traverseNode<MNode>(node, (node) => {
|
|
262
|
+
if (!allNodes.includes(node)) {
|
|
263
|
+
allNodes.push(node);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
} else {
|
|
268
|
+
allNodes.push(...nodes);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const deps = Object.values(root.dataSourceDeps || {});
|
|
272
|
+
deps.forEach((dep) => {
|
|
273
|
+
Object.keys(dep).forEach((id) => {
|
|
274
|
+
const node = allNodes.find((node) => node.id === id);
|
|
275
|
+
node &&
|
|
276
|
+
stage.update({
|
|
277
|
+
config: cloneDeep(node),
|
|
278
|
+
parentId: editorService.getParentById(node.id)?.id,
|
|
279
|
+
root: cloneDeep(root),
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
depService.on('add-target', targetAddHandler);
|
|
286
|
+
depService.on('remove-target', targetRemoveHandler);
|
|
287
|
+
depService.on('collected', collectedHandler);
|
|
288
|
+
|
|
289
|
+
const initDataSourceDepTarget = (ds: DataSourceSchema) => {
|
|
290
|
+
depService.addTarget(createDataSourceTarget(ds, reactive({})));
|
|
291
|
+
depService.addTarget(createDataSourceMethodTarget(ds, reactive({})));
|
|
292
|
+
depService.addTarget(createDataSourceCondTarget(ds, reactive({})));
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const rootChangeHandler = async (value: MApp | null, preValue?: MApp | null) => {
|
|
296
|
+
if (!value) return;
|
|
297
|
+
|
|
298
|
+
value.codeBlocks = value.codeBlocks || {};
|
|
299
|
+
value.dataSources = value.dataSources || [];
|
|
300
|
+
|
|
301
|
+
codeBlockService.setCodeDsl(value.codeBlocks);
|
|
302
|
+
dataSourceService.set('dataSources', value.dataSources);
|
|
303
|
+
|
|
304
|
+
depService.removeTargets(DepTargetType.CODE_BLOCK);
|
|
305
|
+
|
|
306
|
+
Object.entries(value.codeBlocks).forEach(([id, code]) => {
|
|
307
|
+
depService.addTarget(createCodeBlockTarget(id, code));
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
dataSourceService.get('dataSources').forEach((ds) => {
|
|
311
|
+
initDataSourceDepTarget(ds);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
if (Array.isArray(value.items)) {
|
|
315
|
+
value.items.forEach((page) => {
|
|
316
|
+
depService.collectIdle([page], { pageId: page.id }, true);
|
|
317
|
+
});
|
|
318
|
+
} else {
|
|
319
|
+
depService.clear();
|
|
320
|
+
delete value.dataSourceDeps;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const nodeId = editorService.get('node')?.id || props.defaultSelected;
|
|
324
|
+
let node;
|
|
325
|
+
if (nodeId) {
|
|
326
|
+
node = editorService.getNodeById(nodeId);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (node && node !== value) {
|
|
330
|
+
await editorService.select(node.id);
|
|
331
|
+
} else if (value.items?.length) {
|
|
332
|
+
await editorService.select(value.items[0]);
|
|
333
|
+
} else if (value.id) {
|
|
334
|
+
editorService.set('nodes', [value]);
|
|
335
|
+
editorService.set('parent', null);
|
|
336
|
+
editorService.set('page', null);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (toRaw(value) !== toRaw(preValue)) {
|
|
340
|
+
emit('update:modelValue', value);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const collectIdle = (nodes: MNode[], deep: boolean) => {
|
|
345
|
+
nodes.forEach((node) => {
|
|
346
|
+
let pageId: Id | undefined;
|
|
347
|
+
|
|
348
|
+
if (isPage(node)) {
|
|
349
|
+
pageId = node.id;
|
|
350
|
+
} else {
|
|
351
|
+
const info = editorService.getNodeInfo(node.id);
|
|
352
|
+
pageId = info.page?.id;
|
|
353
|
+
}
|
|
354
|
+
depService.collectIdle([node], { pageId }, deep);
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
// 新增节点,收集依赖
|
|
359
|
+
const nodeAddHandler = (nodes: MNode[]) => {
|
|
360
|
+
collectIdle(nodes, true);
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// 节点更新,收集依赖
|
|
364
|
+
const nodeUpdateHandler = (nodes: MNode[]) => {
|
|
365
|
+
collectIdle(nodes, false);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// 节点删除,清除对齐的依赖收集
|
|
369
|
+
const nodeRemoveHandler = (nodes: MNode[]) => {
|
|
370
|
+
depService.clear(nodes);
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
// 由于历史记录变化是更新整个page,所以历史记录变化时,需要重新收集依赖
|
|
374
|
+
const historyChangeHandler = (page: MPage | MPageFragment) => {
|
|
375
|
+
depService.collectIdle([page], { pageId: page.id }, true);
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
editorService.on('history-change', historyChangeHandler);
|
|
379
|
+
editorService.on('root-change', rootChangeHandler);
|
|
380
|
+
editorService.on('add', nodeAddHandler);
|
|
381
|
+
editorService.on('remove', nodeRemoveHandler);
|
|
382
|
+
editorService.on('update', nodeUpdateHandler);
|
|
383
|
+
|
|
384
|
+
const codeBlockAddOrUpdateHandler = (id: Id, codeBlock: CodeBlockContent) => {
|
|
385
|
+
if (depService.hasTarget(id, DepTargetType.CODE_BLOCK)) {
|
|
386
|
+
depService.getTarget(id, DepTargetType.CODE_BLOCK)!.name = codeBlock.name;
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
depService.addTarget(createCodeBlockTarget(id, codeBlock));
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const codeBlockRemoveHandler = (id: Id) => {
|
|
394
|
+
depService.removeTarget(id, DepTargetType.CODE_BLOCK);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
codeBlockService.on('addOrUpdate', codeBlockAddOrUpdateHandler);
|
|
398
|
+
codeBlockService.on('remove', codeBlockRemoveHandler);
|
|
399
|
+
|
|
400
|
+
const dataSourceAddHandler = (config: DataSourceSchema) => {
|
|
401
|
+
initDataSourceDepTarget(config);
|
|
402
|
+
getApp()?.dataSourceManager?.addDataSource(config);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const dataSourceUpdateHandler = (config: DataSourceSchema) => {
|
|
406
|
+
const root = editorService.get('root');
|
|
407
|
+
removeDataSourceTarget(config.id);
|
|
408
|
+
initDataSourceDepTarget(config);
|
|
409
|
+
|
|
410
|
+
(root?.items || []).forEach((page) => {
|
|
411
|
+
depService.collectIdle([page], { pageId: page.id }, true);
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
const removeDataSourceTarget = (id: string) => {
|
|
416
|
+
depService.removeTarget(id, DepTargetType.DATA_SOURCE);
|
|
417
|
+
depService.removeTarget(id, DepTargetType.DATA_SOURCE_COND);
|
|
418
|
+
depService.removeTarget(id, DepTargetType.DATA_SOURCE_METHOD);
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
const dataSourceRemoveHandler = (id: string) => {
|
|
422
|
+
removeDataSourceTarget(id);
|
|
423
|
+
getApp()?.dataSourceManager?.removeDataSource(id);
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
dataSourceService.on('add', dataSourceAddHandler);
|
|
427
|
+
dataSourceService.on('update', dataSourceUpdateHandler);
|
|
428
|
+
dataSourceService.on('remove', dataSourceRemoveHandler);
|
|
429
|
+
|
|
430
|
+
onBeforeUnmount(() => {
|
|
431
|
+
depService.off('add-target', targetAddHandler);
|
|
432
|
+
depService.off('remove-target', targetRemoveHandler);
|
|
433
|
+
depService.off('collected', collectedHandler);
|
|
434
|
+
|
|
435
|
+
editorService.off('history-change', historyChangeHandler);
|
|
436
|
+
editorService.off('root-change', rootChangeHandler);
|
|
437
|
+
editorService.off('add', nodeAddHandler);
|
|
438
|
+
editorService.off('remove', nodeRemoveHandler);
|
|
439
|
+
editorService.off('update', nodeUpdateHandler);
|
|
440
|
+
|
|
441
|
+
codeBlockService.off('addOrUpdate', codeBlockAddOrUpdateHandler);
|
|
442
|
+
codeBlockService.off('remove', codeBlockRemoveHandler);
|
|
443
|
+
|
|
444
|
+
dataSourceService.off('add', dataSourceAddHandler);
|
|
445
|
+
dataSourceService.off('update', dataSourceUpdateHandler);
|
|
446
|
+
dataSourceService.off('remove', dataSourceRemoveHandler);
|
|
447
|
+
});
|
|
448
|
+
};
|