@tmagic/editor 1.0.0-beta.15 → 1.0.0-beta.16
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/coverage/clover.xml +28 -22
- package/coverage/coverage-final.json +2 -1
- package/coverage/lcov-report/index.html +15 -15
- package/coverage/lcov-report/src/Editor.vue.html +1 -1
- package/coverage/lcov-report/src/components/ContentMenu.vue.html +1 -1
- package/coverage/lcov-report/src/components/Icon.vue.html +1 -1
- package/coverage/lcov-report/src/components/ScrollViewer.vue.html +1 -1
- package/coverage/lcov-report/src/components/ToolButton.vue.html +3 -3
- package/coverage/lcov-report/src/components/index.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/layouts/AddPageBox.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/Framework.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/NavMenu.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/PropsPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/Resizer.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/index.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/ComponentListPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/LayerMenu.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/LayerPanel.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/sidebar/Sidebar.vue.html +23 -140
- package/coverage/lcov-report/{undo-redo.ts.html → src/layouts/sidebar/TabPane.vue.html} +94 -118
- package/coverage/lcov-report/src/layouts/sidebar/index.html +31 -16
- package/coverage/lcov-report/src/layouts/workspace/PageBar.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/Stage.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/ViewerMenu.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/Workspace.vue.html +1 -1
- package/coverage/lcov-report/src/layouts/workspace/index.html +1 -1
- package/coverage/lcov-report/src/services/BaseService.ts.html +1 -1
- package/coverage/lcov-report/src/services/componentList.ts.html +1 -1
- package/coverage/lcov-report/src/services/editor.ts.html +2 -2
- package/coverage/lcov-report/src/services/events.ts.html +1 -1
- package/coverage/lcov-report/src/services/history.ts.html +1 -1
- package/coverage/lcov-report/src/services/index.html +1 -1
- package/coverage/lcov-report/src/services/props.ts.html +1 -1
- package/coverage/lcov-report/src/services/ui.ts.html +1 -1
- package/coverage/lcov-report/src/type.ts.html +1 -1
- package/coverage/lcov-report/src/utils/compose.ts.html +1 -1
- package/coverage/lcov-report/src/utils/config.ts.html +1 -1
- package/coverage/lcov-report/src/utils/editor.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov-report/src/utils/index.ts.html +1 -1
- package/coverage/lcov-report/src/utils/logger.ts.html +1 -1
- package/coverage/lcov-report/src/utils/props.ts.html +1 -1
- package/coverage/lcov-report/src/utils/scroll-viewer.ts.html +1 -1
- package/coverage/lcov-report/src/utils/undo-redo.ts.html +1 -1
- package/coverage/lcov.info +56 -48
- package/dist/style.css +3 -0
- package/dist/tmagic-editor.es.js +185 -124
- package/dist/tmagic-editor.es.js.map +1 -1
- package/dist/tmagic-editor.umd.js +186 -125
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/dist/types/src/fields/UISelect.vue.d.ts +4 -1
- package/dist/types/src/layouts/CodeEditor.vue.d.ts +13 -4
- package/dist/types/src/layouts/sidebar/Sidebar.vue.d.ts +2 -3
- package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +14 -0
- package/package.json +7 -7
- package/src/components/ToolButton.vue +2 -2
- package/src/fields/UISelect.vue +14 -6
- package/src/layouts/CodeEditor.vue +20 -10
- package/src/layouts/sidebar/Sidebar.vue +13 -52
- package/src/layouts/sidebar/TabPane.vue +68 -0
- package/src/services/editor.ts +1 -1
- package/src/theme/props-panel.scss +4 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefineComponent,
|
|
1
|
+
import type { DefineComponent, ComponentOptionsMixin, EmitsOptions, VNodeProps, AllowedComponentProps, ComponentCustomProps, ComputedRef, Ref, ExtractPropTypes } from 'vue';
|
|
2
2
|
declare const _default: DefineComponent<{
|
|
3
3
|
labelWidth: StringConstructor;
|
|
4
4
|
config: ObjectConstructor;
|
|
@@ -9,6 +9,9 @@ declare const _default: DefineComponent<{
|
|
|
9
9
|
};
|
|
10
10
|
name: StringConstructor;
|
|
11
11
|
}, {
|
|
12
|
+
Delete: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
13
|
+
Pointer: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
14
|
+
Close: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
|
|
12
15
|
val: ComputedRef<any>;
|
|
13
16
|
uiSelectMode: Ref<boolean>;
|
|
14
17
|
toName: ComputedRef<string>;
|
|
@@ -8,13 +8,17 @@ declare const _default: DefineComponent<{
|
|
|
8
8
|
type: (StringConstructor | ObjectConstructor)[];
|
|
9
9
|
};
|
|
10
10
|
type: {
|
|
11
|
-
type: StringConstructor
|
|
11
|
+
type: StringConstructor;
|
|
12
12
|
default: () => string;
|
|
13
13
|
};
|
|
14
14
|
language: {
|
|
15
|
-
type: StringConstructor
|
|
15
|
+
type: StringConstructor;
|
|
16
16
|
default: () => string;
|
|
17
17
|
};
|
|
18
|
+
options: {
|
|
19
|
+
type: ObjectConstructor;
|
|
20
|
+
default: () => {};
|
|
21
|
+
};
|
|
18
22
|
}, {
|
|
19
23
|
values: Ref<string>;
|
|
20
24
|
loading: Ref<boolean>;
|
|
@@ -30,18 +34,23 @@ declare const _default: DefineComponent<{
|
|
|
30
34
|
type: (StringConstructor | ObjectConstructor)[];
|
|
31
35
|
};
|
|
32
36
|
type: {
|
|
33
|
-
type: StringConstructor
|
|
37
|
+
type: StringConstructor;
|
|
34
38
|
default: () => string;
|
|
35
39
|
};
|
|
36
40
|
language: {
|
|
37
|
-
type: StringConstructor
|
|
41
|
+
type: StringConstructor;
|
|
38
42
|
default: () => string;
|
|
39
43
|
};
|
|
44
|
+
options: {
|
|
45
|
+
type: ObjectConstructor;
|
|
46
|
+
default: () => {};
|
|
47
|
+
};
|
|
40
48
|
}>> & {
|
|
41
49
|
onInitd?: ((...args: any[]) => any) | undefined;
|
|
42
50
|
onSave?: ((...args: any[]) => any) | undefined;
|
|
43
51
|
}, {
|
|
44
52
|
type: string;
|
|
45
53
|
language: string;
|
|
54
|
+
options: Record<string, any>;
|
|
46
55
|
}>;
|
|
47
56
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DefineComponent, Ref,
|
|
2
|
-
import { SideBarData
|
|
1
|
+
import type { DefineComponent, Ref, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { SideBarData } from '../../type';
|
|
3
3
|
declare const _default: DefineComponent<{
|
|
4
4
|
data: {
|
|
5
5
|
type: PropType<SideBarData>;
|
|
@@ -11,7 +11,6 @@ declare const _default: DefineComponent<{
|
|
|
11
11
|
};
|
|
12
12
|
}, {
|
|
13
13
|
activeTabName: Ref<string>;
|
|
14
|
-
items: ComputedRef<SideComponent[] | Record<string, any>[]>;
|
|
15
14
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
16
15
|
data: {
|
|
17
16
|
type: PropType<SideBarData>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DefineComponent, ComputedRef, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { SideComponent, SideItem } from '../../type';
|
|
3
|
+
declare const _default: DefineComponent<{
|
|
4
|
+
data: {
|
|
5
|
+
type: PropType<SideItem>;
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
config: ComputedRef<SideComponent | undefined>;
|
|
9
|
+
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
10
|
+
data: {
|
|
11
|
+
type: PropType<SideItem>;
|
|
12
|
+
};
|
|
13
|
+
}>>, {}>;
|
|
14
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.0-beta.
|
|
2
|
+
"version": "1.0.0-beta.16",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"dist/*",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@element-plus/icons": "0.0.11",
|
|
47
|
-
"@tmagic/core": "^1.0.0-beta.
|
|
48
|
-
"@tmagic/form": "^1.0.0-beta.
|
|
49
|
-
"@tmagic/schema": "^1.0.0-beta.
|
|
50
|
-
"@tmagic/stage": "^1.0.0-beta.
|
|
51
|
-
"@tmagic/utils": "^1.0.0-beta.
|
|
47
|
+
"@tmagic/core": "^1.0.0-beta.16",
|
|
48
|
+
"@tmagic/form": "^1.0.0-beta.16",
|
|
49
|
+
"@tmagic/schema": "^1.0.0-beta.16",
|
|
50
|
+
"@tmagic/stage": "^1.0.0-beta.16",
|
|
51
|
+
"@tmagic/utils": "^1.0.0-beta.16",
|
|
52
52
|
"buffer": "^6.0.3",
|
|
53
53
|
"color": "^3.1.3",
|
|
54
54
|
"element-plus": "^2.2.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"vite-plugin-dts": "^0.9.6",
|
|
81
81
|
"vue-tsc": "^0.0.24"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "2aebfb1b8ceb5c8e26dfb59b643ed9f4f4b7bd15"
|
|
84
84
|
}
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
<template v-else-if="item.type === 'zoom'">
|
|
14
14
|
<tool-button
|
|
15
|
-
:data="{ type: 'button', icon:
|
|
15
|
+
:data="{ type: 'button', icon: ZoomOut, handler: zoomOutHandler, tooltip: '缩小' }"
|
|
16
16
|
:event-type="eventType"
|
|
17
17
|
></tool-button>
|
|
18
18
|
<span class="menu-item-text" style="margin: 0 5px">{{ parseInt(`${zoom * 100}`, 10) }}%</span>
|
|
19
19
|
<tool-button
|
|
20
|
-
:data="{ type: 'button', icon:
|
|
20
|
+
:data="{ type: 'button', icon: ZoomIn, handler: zoomInHandler, tooltip: '放大' }"
|
|
21
21
|
:event-type="eventType"
|
|
22
22
|
></tool-button>
|
|
23
23
|
</template>
|
package/src/fields/UISelect.vue
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="m-fields-ui-select" v-if="uiSelectMode" @click="cancelHandler">
|
|
3
|
-
<
|
|
3
|
+
<el-button type="danger" :icon="Delete" text style="padding: 0">取消</el-button>
|
|
4
4
|
</div>
|
|
5
|
-
<div class="m-fields-ui-select" v-else @click="startSelect">
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
<div class="m-fields-ui-select" v-else @click="startSelect" style="display: flex">
|
|
6
|
+
<el-tooltip content="清除">
|
|
7
|
+
<el-button v-if="val" style="padding: 0" type="danger" :icon="Close" text @click.stop="deleteHandler"></el-button>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
<el-tooltip :content="val ? toName + '_' + val : '点击此处选择'">
|
|
10
|
+
<el-button text style="padding: 0; margin: 0">{{ val ? toName + '_' + val : '点击此处选择' }}</el-button>
|
|
11
|
+
</el-tooltip>
|
|
9
12
|
</div>
|
|
10
13
|
</template>
|
|
11
14
|
|
|
12
15
|
<script lang="ts">
|
|
13
|
-
import { computed, defineComponent, inject, ref } from 'vue';
|
|
16
|
+
import { computed, defineComponent, inject, markRaw, ref } from 'vue';
|
|
17
|
+
import { Close, Delete, Pointer } from '@element-plus/icons';
|
|
14
18
|
|
|
15
19
|
import { FormState } from '@tmagic/form';
|
|
16
20
|
|
|
@@ -60,6 +64,10 @@ export default defineComponent({
|
|
|
60
64
|
};
|
|
61
65
|
|
|
62
66
|
return {
|
|
67
|
+
Delete: markRaw(Delete),
|
|
68
|
+
Pointer: markRaw(Pointer),
|
|
69
|
+
Close: markRaw(Close),
|
|
70
|
+
|
|
63
71
|
val,
|
|
64
72
|
uiSelectMode,
|
|
65
73
|
toName: computed(() => {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import { defineComponent, onMounted, onUnmounted, ref, watch } from 'vue';
|
|
7
|
+
import { throttle } from 'lodash-es';
|
|
7
8
|
import * as monaco from 'monaco-editor';
|
|
8
9
|
import serialize from 'serialize-javascript';
|
|
9
10
|
|
|
@@ -36,14 +37,19 @@ export default defineComponent({
|
|
|
36
37
|
},
|
|
37
38
|
|
|
38
39
|
type: {
|
|
39
|
-
type:
|
|
40
|
+
type: String,
|
|
40
41
|
default: () => '',
|
|
41
42
|
},
|
|
42
43
|
|
|
43
44
|
language: {
|
|
44
|
-
type:
|
|
45
|
+
type: String,
|
|
45
46
|
default: () => 'javascript',
|
|
46
47
|
},
|
|
48
|
+
|
|
49
|
+
options: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => ({}),
|
|
52
|
+
},
|
|
47
53
|
},
|
|
48
54
|
|
|
49
55
|
emits: ['initd', 'save'],
|
|
@@ -51,10 +57,18 @@ export default defineComponent({
|
|
|
51
57
|
setup(props, { emit }) {
|
|
52
58
|
let vsEditor: monaco.editor.IStandaloneCodeEditor | null = null;
|
|
53
59
|
let vsDiffEditor: monaco.editor.IStandaloneDiffEditor | null = null;
|
|
60
|
+
|
|
54
61
|
const values = ref('');
|
|
55
62
|
const loading = ref(false);
|
|
56
63
|
const codeEditor = ref<HTMLDivElement>();
|
|
57
64
|
|
|
65
|
+
const resizeObserver = new globalThis.ResizeObserver(
|
|
66
|
+
throttle((): void => {
|
|
67
|
+
vsEditor?.layout();
|
|
68
|
+
vsDiffEditor?.layout();
|
|
69
|
+
}, 300),
|
|
70
|
+
);
|
|
71
|
+
|
|
58
72
|
const setEditorValue = (v: string | any, m: string | any) => {
|
|
59
73
|
values.value = toString(v, props.language);
|
|
60
74
|
|
|
@@ -71,11 +85,6 @@ export default defineComponent({
|
|
|
71
85
|
return vsEditor?.setValue(values.value);
|
|
72
86
|
};
|
|
73
87
|
|
|
74
|
-
const resizeHandler = () => {
|
|
75
|
-
vsEditor?.layout();
|
|
76
|
-
vsDiffEditor?.layout();
|
|
77
|
-
};
|
|
78
|
-
|
|
79
88
|
const getEditorValue = () =>
|
|
80
89
|
props.type === 'diff' ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue();
|
|
81
90
|
|
|
@@ -88,8 +97,9 @@ export default defineComponent({
|
|
|
88
97
|
tabSize: 2,
|
|
89
98
|
theme: 'vs-dark',
|
|
90
99
|
fontFamily: 'dm, Menlo, Monaco, "Courier New", monospace',
|
|
91
|
-
fontSize:
|
|
100
|
+
fontSize: 14,
|
|
92
101
|
formatOnPaste: true,
|
|
102
|
+
...props.options,
|
|
93
103
|
};
|
|
94
104
|
|
|
95
105
|
if (props.type === 'diff') {
|
|
@@ -117,7 +127,7 @@ export default defineComponent({
|
|
|
117
127
|
});
|
|
118
128
|
}
|
|
119
129
|
|
|
120
|
-
|
|
130
|
+
resizeObserver.observe(codeEditor.value);
|
|
121
131
|
};
|
|
122
132
|
|
|
123
133
|
watch(
|
|
@@ -140,7 +150,7 @@ export default defineComponent({
|
|
|
140
150
|
});
|
|
141
151
|
|
|
142
152
|
onUnmounted(() => {
|
|
143
|
-
|
|
153
|
+
resizeObserver.disconnect();
|
|
144
154
|
});
|
|
145
155
|
|
|
146
156
|
return {
|
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-tabs
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<component :is="item.component" v-bind="item.props || {}" v-on="item.listeners || {}">
|
|
12
|
-
<template #layer-node-content="{ data, node }" v-if="item.slots?.layerNodeContent">
|
|
13
|
-
<component :is="item.slots.layerNodeContent" :data="data" :node="node" />
|
|
14
|
-
</template>
|
|
15
|
-
</component>
|
|
16
|
-
</el-tab-pane>
|
|
2
|
+
<el-tabs
|
|
3
|
+
v-if="data.type === 'tabs' && data.items.length"
|
|
4
|
+
class="m-editor-sidebar"
|
|
5
|
+
v-model="activeTabName"
|
|
6
|
+
type="card"
|
|
7
|
+
tab-position="left"
|
|
8
|
+
>
|
|
9
|
+
<tab-pane v-for="(item, index) in data.items" :key="index" :data="item"></tab-pane>
|
|
17
10
|
</el-tabs>
|
|
18
11
|
</template>
|
|
19
12
|
|
|
20
13
|
<script lang="ts">
|
|
21
|
-
import {
|
|
22
|
-
import { Coin, Files } from '@element-plus/icons';
|
|
14
|
+
import { defineComponent, PropType, ref, watch } from 'vue';
|
|
23
15
|
|
|
24
|
-
import
|
|
25
|
-
import { SideBarData, SideComponent } from '@editor/type';
|
|
16
|
+
import { SideBarData } from '@editor/type';
|
|
26
17
|
|
|
27
|
-
import
|
|
28
|
-
import LayerPanel from './LayerPanel.vue';
|
|
18
|
+
import TabPane from './TabPane.vue';
|
|
29
19
|
|
|
30
20
|
export default defineComponent({
|
|
31
|
-
|
|
21
|
+
components: { TabPane },
|
|
32
22
|
|
|
33
|
-
|
|
23
|
+
name: 'm-sidebar',
|
|
34
24
|
|
|
35
25
|
props: {
|
|
36
26
|
data: {
|
|
@@ -51,35 +41,6 @@ export default defineComponent({
|
|
|
51
41
|
|
|
52
42
|
return {
|
|
53
43
|
activeTabName,
|
|
54
|
-
|
|
55
|
-
items: computed<SideComponent[] | Record<string, any>[]>(() =>
|
|
56
|
-
props.data?.items.map((item) => {
|
|
57
|
-
if (typeof item !== 'string') {
|
|
58
|
-
return item;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
switch (item) {
|
|
62
|
-
case 'component-list':
|
|
63
|
-
return {
|
|
64
|
-
type: 'component',
|
|
65
|
-
icon: Coin,
|
|
66
|
-
text: '组件',
|
|
67
|
-
component: ComponentListPanel,
|
|
68
|
-
slots: {},
|
|
69
|
-
};
|
|
70
|
-
case 'layer':
|
|
71
|
-
return {
|
|
72
|
-
type: 'component',
|
|
73
|
-
icon: Files,
|
|
74
|
-
text: '已选组件',
|
|
75
|
-
component: LayerPanel,
|
|
76
|
-
slots: {},
|
|
77
|
-
};
|
|
78
|
-
default:
|
|
79
|
-
return {};
|
|
80
|
-
}
|
|
81
|
-
}),
|
|
82
|
-
),
|
|
83
44
|
};
|
|
84
45
|
},
|
|
85
46
|
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-tab-pane v-if="config" :name="config.text">
|
|
3
|
+
<template #label>
|
|
4
|
+
<div :key="config.text">
|
|
5
|
+
<m-icon v-if="config.icon" :icon="config.icon"></m-icon>
|
|
6
|
+
<div v-if="config.text" class="magic-editor-tab-panel-title">{{ config.text }}</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<component :is="config.component" v-bind="config.props || {}" v-on="config?.listeners || {}">
|
|
11
|
+
<template #layer-node-content="{ data, node }" v-if="config.slots?.layerNodeContent">
|
|
12
|
+
<component :is="config.slots?.layerNodeContent" :data="data" :node="node" />
|
|
13
|
+
</template>
|
|
14
|
+
</component>
|
|
15
|
+
</el-tab-pane>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { computed, defineComponent, PropType } from 'vue';
|
|
20
|
+
import { Coin, Files } from '@element-plus/icons';
|
|
21
|
+
|
|
22
|
+
import MIcon from '@editor/components/Icon.vue';
|
|
23
|
+
import { SideComponent, SideItem } from '@editor/type';
|
|
24
|
+
|
|
25
|
+
import ComponentListPanel from './ComponentListPanel.vue';
|
|
26
|
+
import LayerPanel from './LayerPanel.vue';
|
|
27
|
+
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
components: { MIcon },
|
|
30
|
+
|
|
31
|
+
props: {
|
|
32
|
+
data: {
|
|
33
|
+
type: Object as PropType<SideItem>,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
setup(props) {
|
|
38
|
+
return {
|
|
39
|
+
config: computed<SideComponent | undefined>(() => {
|
|
40
|
+
if (typeof props.data !== 'string') {
|
|
41
|
+
return props.data;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
switch (props.data) {
|
|
45
|
+
case 'component-list':
|
|
46
|
+
return {
|
|
47
|
+
type: 'component',
|
|
48
|
+
icon: Coin,
|
|
49
|
+
text: '组件',
|
|
50
|
+
component: ComponentListPanel,
|
|
51
|
+
slots: {},
|
|
52
|
+
};
|
|
53
|
+
case 'layer':
|
|
54
|
+
return {
|
|
55
|
+
type: 'component',
|
|
56
|
+
icon: Files,
|
|
57
|
+
text: '已选组件',
|
|
58
|
+
component: LayerPanel,
|
|
59
|
+
slots: {},
|
|
60
|
+
};
|
|
61
|
+
default:
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
</script>
|
package/src/services/editor.ts
CHANGED