@tmagic/editor 1.2.14 → 1.3.0-alpha.0
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 +173 -80
- package/dist/tmagic-editor.js +975 -222
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +984 -230
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -9
- package/src/Editor.vue +2 -0
- package/src/components/CodeDraftEditor.vue +2 -2
- package/src/components/SearchInput.vue +6 -3
- package/src/editorProps.ts +5 -0
- package/src/fields/CodeSelect.vue +1 -0
- package/src/fields/DataSourceFields.vue +178 -0
- package/src/fields/EventSelect.vue +1 -0
- package/src/fields/KeyValue.vue +93 -0
- package/src/icons/AppManageIcon.vue +1 -1
- package/src/icons/CodeIcon.vue +1 -10
- package/src/index.ts +6 -0
- package/src/initService.ts +59 -3
- package/src/layouts/sidebar/LayerPanel.vue +2 -0
- package/src/layouts/sidebar/Sidebar.vue +24 -14
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +11 -4
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +84 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +130 -0
- package/src/services/codeBlock.ts +0 -2
- package/src/services/dataSource.ts +90 -0
- package/src/services/props.ts +2 -15
- package/src/theme/code-block.scss +4 -66
- package/src/theme/data-source-fields.scss +13 -0
- package/src/theme/data-source.scss +17 -0
- package/src/theme/dep-list.scss +59 -0
- package/src/theme/key-value.scss +13 -0
- package/src/theme/sidebar.scss +26 -6
- package/src/theme/theme.scss +4 -0
- package/src/type.ts +3 -1
- package/src/utils/data-source/formConfigs/base.ts +32 -0
- package/src/utils/data-source/formConfigs/http.ts +50 -0
- package/src/utils/data-source/index.ts +31 -0
- package/src/utils/dep.ts +9 -1
- package/src/utils/props.ts +1 -0
- package/types/Editor.vue.d.ts +9 -0
- package/types/components/ContentMenu.vue.d.ts +2 -2
- package/types/components/ScrollViewer.vue.d.ts +1 -1
- package/types/editorProps.d.ts +4 -0
- package/types/fields/DataSourceFields.vue.d.ts +40 -0
- package/types/fields/KeyValue.vue.d.ts +50 -0
- package/types/index.d.ts +2 -0
- package/types/initService.d.ts +1 -1
- package/types/layouts/CodeEditor.vue.d.ts +1 -1
- package/types/layouts/sidebar/Sidebar.vue.d.ts +2 -2
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +22 -0
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +12 -0
- package/types/services/dataSource.d.ts +25 -0
- package/types/services/props.d.ts +17 -12
- package/types/type.d.ts +3 -1
- package/types/utils/data-source/formConfigs/base.d.ts +3 -0
- package/types/utils/data-source/formConfigs/http.d.ts +3 -0
- package/types/utils/data-source/index.d.ts +2 -0
- package/types/utils/dep.d.ts +2 -1
- package/types/utils/props.d.ts +2 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<TMagicScrollbar class="m-editor-code-block-list">
|
|
2
|
+
<TMagicScrollbar class="m-editor-code-block-list m-editor-dep-list-panel">
|
|
3
3
|
<slot name="code-block-panel-header">
|
|
4
|
-
<div class="
|
|
4
|
+
<div class="search-wrapper">
|
|
5
5
|
<SearchInput @search="filterTextChangeHandler"></SearchInput>
|
|
6
6
|
<TMagicButton class="create-code-button" type="primary" size="small" @click="createCodeBlock" v-if="editable"
|
|
7
7
|
>新增</TMagicButton
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
:default-expanded-keys="expandedKeys"
|
|
19
19
|
:expand-on-click-node="false"
|
|
20
20
|
:data="codeList"
|
|
21
|
+
:props="treeProps"
|
|
21
22
|
:highlight-current="true"
|
|
22
23
|
:filter-node-method="filterNode"
|
|
23
24
|
@node-click="clickHandler"
|
|
@@ -27,8 +28,8 @@
|
|
|
27
28
|
<div class="list-item">
|
|
28
29
|
<CodeIcon v-if="data.type === 'code'" class="codeIcon"></CodeIcon>
|
|
29
30
|
<AppManageIcon v-if="data.type === 'node'" class="compIcon"></AppManageIcon>
|
|
30
|
-
<span class="
|
|
31
|
-
>{{ data.name }}
|
|
31
|
+
<span class="name" :class="{ code: data.type === 'code', hook: data.type === 'key' }"
|
|
32
|
+
>{{ data.name }} ({{ data.id }})</span
|
|
32
33
|
>
|
|
33
34
|
<!-- 右侧工具栏 -->
|
|
34
35
|
<div class="right-tool" v-if="data.type === 'code'">
|
|
@@ -75,6 +76,12 @@ const props = defineProps<{
|
|
|
75
76
|
paramsColConfig?: ColumnConfig;
|
|
76
77
|
}>();
|
|
77
78
|
|
|
79
|
+
const treeProps = {
|
|
80
|
+
children: 'children',
|
|
81
|
+
label: 'name',
|
|
82
|
+
value: 'id',
|
|
83
|
+
};
|
|
84
|
+
|
|
78
85
|
const { codeBlockService, depService, editorService } = inject<Services>('services') || {};
|
|
79
86
|
|
|
80
87
|
// 代码块列表
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TMagicDrawer
|
|
3
|
+
v-model="visible"
|
|
4
|
+
:title="title"
|
|
5
|
+
:close-on-press-escape="true"
|
|
6
|
+
:append-to-body="true"
|
|
7
|
+
:show-close="true"
|
|
8
|
+
:close-on-click-modal="true"
|
|
9
|
+
:size="size"
|
|
10
|
+
>
|
|
11
|
+
<MForm ref="form" :config="dataSourceConfig" :init-values="initValues" @change="changeHandler"></MForm>
|
|
12
|
+
|
|
13
|
+
<template #footer>
|
|
14
|
+
<div>
|
|
15
|
+
<TMagicButton type="primary" @click="submitHandler">确定</TMagicButton>
|
|
16
|
+
<TMagicButton @click="hide">关闭</TMagicButton>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
</TMagicDrawer>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { computed, inject, ref, watchEffect } from 'vue';
|
|
24
|
+
|
|
25
|
+
import { TMagicButton, TMagicDrawer, tMagicMessage } from '@tmagic/design';
|
|
26
|
+
import { MForm } from '@tmagic/form';
|
|
27
|
+
|
|
28
|
+
import type { Services } from '@editor/type';
|
|
29
|
+
|
|
30
|
+
const props = defineProps<{
|
|
31
|
+
title?: string;
|
|
32
|
+
values: any;
|
|
33
|
+
}>();
|
|
34
|
+
|
|
35
|
+
const type = ref('base');
|
|
36
|
+
|
|
37
|
+
const emit = defineEmits(['submit']);
|
|
38
|
+
|
|
39
|
+
const services = inject<Services>('services');
|
|
40
|
+
|
|
41
|
+
const size = computed(() => globalThis.document.body.clientWidth - (services?.uiService.get('columnWidth').left || 0));
|
|
42
|
+
|
|
43
|
+
const dataSourceConfig = computed(() => services?.dataSourceService.getFormConfig(type.value) || []);
|
|
44
|
+
|
|
45
|
+
const form = ref<InstanceType<typeof MForm>>();
|
|
46
|
+
|
|
47
|
+
const initValues = ref({});
|
|
48
|
+
|
|
49
|
+
watchEffect(() => {
|
|
50
|
+
initValues.value = props.values;
|
|
51
|
+
type.value = props.values.type || 'base';
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const changeHandler = (value: Record<string, any>) => {
|
|
55
|
+
if (value.type === type.value) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
type.value = value.type || 'base';
|
|
59
|
+
initValues.value = value;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const submitHandler = async () => {
|
|
63
|
+
try {
|
|
64
|
+
const values = await form.value?.submitForm();
|
|
65
|
+
emit('submit', values);
|
|
66
|
+
} catch (error: any) {
|
|
67
|
+
tMagicMessage.error(error.message);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const visible = ref(false);
|
|
72
|
+
|
|
73
|
+
const hide = () => {
|
|
74
|
+
visible.value = false;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
defineExpose({
|
|
78
|
+
show() {
|
|
79
|
+
visible.value = true;
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
hide,
|
|
83
|
+
});
|
|
84
|
+
</script>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TMagicScrollbar class="data-source-list-panel m-editor-dep-list-panel">
|
|
3
|
+
<div class="search-wrapper">
|
|
4
|
+
<SearchInput @search="filterTextChangeHandler"></SearchInput>
|
|
5
|
+
<TMagicButton type="primary" size="small" @click="addHandler">新增</TMagicButton>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<!-- 数据源列表 -->
|
|
9
|
+
<TMagicTree
|
|
10
|
+
ref="tree"
|
|
11
|
+
class="magic-editor-layer-tree"
|
|
12
|
+
node-key="id"
|
|
13
|
+
empty-text="暂无代码块"
|
|
14
|
+
default-expand-all
|
|
15
|
+
:expand-on-click-node="false"
|
|
16
|
+
:data="list"
|
|
17
|
+
:highlight-current="true"
|
|
18
|
+
>
|
|
19
|
+
<template #default="{ data }">
|
|
20
|
+
<div :id="data.id" class="list-container">
|
|
21
|
+
<div class="list-item">
|
|
22
|
+
<Icon v-if="data.type === 'code'" class="codeIcon" :icon="Coin"></Icon>
|
|
23
|
+
<Icon v-if="data.type === 'node'" class="compIcon" :icon="Aim"></Icon>
|
|
24
|
+
<span class="name" :class="{ code: data.type === 'code', hook: data.type === 'key' }"
|
|
25
|
+
>{{ data.name }}({{ data.id }})</span
|
|
26
|
+
>
|
|
27
|
+
<!-- 右侧工具栏 -->
|
|
28
|
+
<div class="right-tool" v-if="data.type === 'code'">
|
|
29
|
+
<TMagicTooltip effect="dark" content="编辑" placement="bottom">
|
|
30
|
+
<Icon class="edit-icon" :icon="Edit" @click.stop="editHandler(`${data.id}`)"></Icon>
|
|
31
|
+
</TMagicTooltip>
|
|
32
|
+
<TMagicTooltip effect="dark" content="删除" placement="bottom">
|
|
33
|
+
<Icon :icon="Close" class="edit-icon" @click.stop="removeHandler(`${data.id}`)"></Icon>
|
|
34
|
+
</TMagicTooltip>
|
|
35
|
+
<slot name="data-source-panel-tool" :id="data.id" :data="data.codeBlockContent"></slot>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
</TMagicTree>
|
|
41
|
+
|
|
42
|
+
<DataSourceConfigPanel
|
|
43
|
+
ref="editDialog"
|
|
44
|
+
:values="dataSourceValues"
|
|
45
|
+
:title="typeof dataSourceValues.id !== 'undefined' ? `编辑${dataSourceValues.title}` : '新增'"
|
|
46
|
+
@submit="submitDataSourceHandler"
|
|
47
|
+
></DataSourceConfigPanel>
|
|
48
|
+
</TMagicScrollbar>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script setup lang="ts" name="MEditorDataSourceListPanel">
|
|
52
|
+
import { computed, inject, ref } from 'vue';
|
|
53
|
+
import { Aim, Close, Coin, Edit } from '@element-plus/icons-vue';
|
|
54
|
+
|
|
55
|
+
import { TMagicButton, tMagicMessageBox, TMagicScrollbar, TMagicTooltip, TMagicTree } from '@tmagic/design';
|
|
56
|
+
import { DataSourceSchema } from '@tmagic/schema';
|
|
57
|
+
|
|
58
|
+
import Icon from '@editor/components/Icon.vue';
|
|
59
|
+
import SearchInput from '@editor/components/SearchInput.vue';
|
|
60
|
+
import type { Services } from '@editor/type';
|
|
61
|
+
|
|
62
|
+
import DataSourceConfigPanel from './DataSourceConfigPanel.vue';
|
|
63
|
+
|
|
64
|
+
const services = inject<Partial<Services>>('services', {});
|
|
65
|
+
const { dataSourceService, depService } = inject<Services>('services') || {};
|
|
66
|
+
|
|
67
|
+
const list = computed(() =>
|
|
68
|
+
Object.values(depService?.targets['data-source'] || {}).map((target) => ({
|
|
69
|
+
id: target.id,
|
|
70
|
+
name: target.name,
|
|
71
|
+
type: 'code',
|
|
72
|
+
children: Object.entries(target.deps).map(([id, dep]) => ({
|
|
73
|
+
name: dep.name,
|
|
74
|
+
type: 'node',
|
|
75
|
+
id,
|
|
76
|
+
children: dep.keys.map((key) => ({ name: key, id: key, type: 'key' })),
|
|
77
|
+
})),
|
|
78
|
+
})),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const editDialog = ref<InstanceType<typeof DataSourceConfigPanel>>();
|
|
82
|
+
|
|
83
|
+
const dataSourceValues = ref<Record<string, any>>({});
|
|
84
|
+
|
|
85
|
+
const addHandler = () => {
|
|
86
|
+
if (!editDialog.value) return;
|
|
87
|
+
|
|
88
|
+
dataSourceValues.value = {};
|
|
89
|
+
|
|
90
|
+
editDialog.value.show();
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const editHandler = (id: string) => {
|
|
94
|
+
if (!editDialog.value || !services) return;
|
|
95
|
+
|
|
96
|
+
dataSourceValues.value = {
|
|
97
|
+
...dataSourceService?.getDataSourceById(id),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
editDialog.value.show();
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const removeHandler = async (id: string) => {
|
|
104
|
+
await tMagicMessageBox.confirm('确定删除?', '提示', {
|
|
105
|
+
confirmButtonText: '确定',
|
|
106
|
+
cancelButtonText: '取消',
|
|
107
|
+
type: 'warning',
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
dataSourceService?.remove(id);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const submitDataSourceHandler = (value: DataSourceSchema) => {
|
|
114
|
+
if (!services) return;
|
|
115
|
+
|
|
116
|
+
if (value.id) {
|
|
117
|
+
dataSourceService?.update(value);
|
|
118
|
+
} else {
|
|
119
|
+
dataSourceService?.add(value);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
editDialog.value?.hide();
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const tree = ref<InstanceType<typeof TMagicTree>>();
|
|
126
|
+
|
|
127
|
+
const filterTextChangeHandler = (val: string) => {
|
|
128
|
+
tree.value?.filter(val);
|
|
129
|
+
};
|
|
130
|
+
</script>
|
|
@@ -23,7 +23,6 @@ import { CodeBlockContent, CodeBlockDSL, Id } from '@tmagic/schema';
|
|
|
23
23
|
|
|
24
24
|
import type { CodeState } from '@editor/type';
|
|
25
25
|
import { CODE_DRAFT_STORAGE_KEY } from '@editor/type';
|
|
26
|
-
import { info } from '@editor/utils/logger';
|
|
27
26
|
|
|
28
27
|
import BaseService from './BaseService';
|
|
29
28
|
|
|
@@ -55,7 +54,6 @@ class CodeBlock extends BaseService {
|
|
|
55
54
|
*/
|
|
56
55
|
public async setCodeDsl(codeDsl: CodeBlockDSL): Promise<void> {
|
|
57
56
|
this.state.codeDsl = codeDsl;
|
|
58
|
-
info('[code-block]:code-dsl-change', this.state.codeDsl);
|
|
59
57
|
this.emit('code-dsl-change', this.state.codeDsl);
|
|
60
58
|
}
|
|
61
59
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
|
|
4
|
+
import type { FormConfig } from '@tmagic/form';
|
|
5
|
+
import { DataSourceSchema } from '@tmagic/schema';
|
|
6
|
+
import { guid } from '@tmagic/utils';
|
|
7
|
+
|
|
8
|
+
import { getFormConfig } from '@editor/utils/data-source';
|
|
9
|
+
|
|
10
|
+
import BaseService from './BaseService';
|
|
11
|
+
|
|
12
|
+
interface State {
|
|
13
|
+
dataSources: DataSourceSchema[];
|
|
14
|
+
configs: Record<string, FormConfig>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type StateKey = keyof State;
|
|
18
|
+
class DataSource extends BaseService {
|
|
19
|
+
private state = reactive<State>({
|
|
20
|
+
dataSources: [],
|
|
21
|
+
configs: {},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
public set<K extends StateKey, T extends State[K]>(name: K, value: T) {
|
|
25
|
+
this.state[name] = value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public get<K extends StateKey>(name: K): State[K] {
|
|
29
|
+
return this.state[name];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public getFormConfig(type = 'base') {
|
|
33
|
+
return getFormConfig(type, this.get('configs'));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public setFormConfig(type: string, config: FormConfig) {
|
|
37
|
+
this.get('configs')[type] = config;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public add(config: DataSourceSchema) {
|
|
41
|
+
const newConfig = {
|
|
42
|
+
...config,
|
|
43
|
+
id: this.createId(),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
this.get('dataSources').push(newConfig);
|
|
47
|
+
|
|
48
|
+
this.emit('add', newConfig);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public update(config: DataSourceSchema) {
|
|
52
|
+
const dataSources = this.get('dataSources');
|
|
53
|
+
|
|
54
|
+
const index = dataSources.findIndex((ds) => ds.id === config.id);
|
|
55
|
+
|
|
56
|
+
dataSources[index] = cloneDeep(config);
|
|
57
|
+
|
|
58
|
+
this.emit('update', config);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public remove(id: string) {
|
|
62
|
+
const dataSources = this.get('dataSources');
|
|
63
|
+
const index = dataSources.findIndex((ds) => ds.id === id);
|
|
64
|
+
dataSources.splice(index, 1);
|
|
65
|
+
|
|
66
|
+
this.emit('remove', id);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public getDataSourceById(id: string) {
|
|
70
|
+
return this.get('dataSources').find((ds) => ds.id === id);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public resetState() {
|
|
74
|
+
this.set('dataSources', []);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public destroy() {
|
|
78
|
+
this.removeAllListeners();
|
|
79
|
+
this.resetState();
|
|
80
|
+
this.removeAllPlugins();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private createId(): string {
|
|
84
|
+
return `ds_${guid()}`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type DataSourceService = DataSource;
|
|
89
|
+
|
|
90
|
+
export default new DataSource();
|
package/src/services/props.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { cloneDeep, mergeWith } from 'lodash-es';
|
|
|
21
21
|
|
|
22
22
|
import type { FormConfig } from '@tmagic/form';
|
|
23
23
|
import type { MComponent, MNode } from '@tmagic/schema';
|
|
24
|
-
import { toLine } from '@tmagic/utils';
|
|
24
|
+
import { guid, toLine } from '@tmagic/utils';
|
|
25
25
|
|
|
26
26
|
import type { PropsState } from '@editor/type';
|
|
27
27
|
import { fillConfig } from '@editor/utils/props';
|
|
@@ -130,7 +130,7 @@ class Props extends BaseService {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
public async createId(type: string | number): Promise<string> {
|
|
133
|
-
return `${type}_${
|
|
133
|
+
return `${type}_${guid()}`;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/**
|
|
@@ -181,19 +181,6 @@ class Props extends BaseService {
|
|
|
181
181
|
this.removeAllListeners();
|
|
182
182
|
this.removeAllPlugins();
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* 生成指定位数的GUID,无【-】格式
|
|
187
|
-
* @param digit 位数,默认值8
|
|
188
|
-
* @returns
|
|
189
|
-
*/
|
|
190
|
-
private guid(digit = 8): string {
|
|
191
|
-
return 'x'.repeat(digit).replace(/[xy]/g, (c) => {
|
|
192
|
-
const r = (Math.random() * 16) | 0;
|
|
193
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
194
|
-
return v.toString(16);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
184
|
}
|
|
198
185
|
|
|
199
186
|
export type PropsService = Props;
|
|
@@ -1,81 +1,19 @@
|
|
|
1
1
|
.m-editor-code-block-list {
|
|
2
2
|
height: 100%;
|
|
3
3
|
|
|
4
|
-
.magic-editor-layer-tree {
|
|
5
|
-
padding-top: 48px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.code-header-wrapper {
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
position: absolute;
|
|
13
|
-
top: 0;
|
|
14
|
-
width: 100%;
|
|
15
|
-
z-index: 1;
|
|
16
|
-
|
|
17
|
-
.search-input {
|
|
18
|
-
flex: 1;
|
|
19
|
-
position: relative;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.create-code-button {
|
|
23
|
-
margin-left: 2px;
|
|
24
|
-
margin-right: 10px;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.divider {
|
|
29
|
-
margin: 10px 0 0 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
4
|
.list-container {
|
|
33
|
-
width: 100%;
|
|
34
|
-
overflow: hidden;
|
|
35
5
|
.list-item {
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
width: 100%;
|
|
39
|
-
align-items: center;
|
|
40
|
-
|
|
41
|
-
.right-tool {
|
|
42
|
-
display: flex;
|
|
43
|
-
width: fit-content !important;
|
|
44
|
-
align-items: center;
|
|
45
|
-
margin-right: 10px;
|
|
46
|
-
.edit-icon {
|
|
47
|
-
margin: 0 5px;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
6
|
.codeIcon {
|
|
52
|
-
width:
|
|
53
|
-
height:
|
|
7
|
+
width: 22px;
|
|
8
|
+
height: 22px;
|
|
54
9
|
margin-right: 5px;
|
|
55
10
|
}
|
|
56
11
|
|
|
57
12
|
.compIcon {
|
|
58
|
-
width:
|
|
59
|
-
height:
|
|
13
|
+
width: 22px;
|
|
14
|
+
height: 22px;
|
|
60
15
|
margin-right: 5px;
|
|
61
16
|
}
|
|
62
|
-
|
|
63
|
-
.code-name {
|
|
64
|
-
white-space: nowrap;
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
text-overflow: ellipsis;
|
|
67
|
-
width: 0 !important;
|
|
68
|
-
flex: 1;
|
|
69
|
-
line-height: 22px;
|
|
70
|
-
|
|
71
|
-
&.code {
|
|
72
|
-
color: #000;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&.hook {
|
|
76
|
-
color: #909399;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
17
|
}
|
|
80
18
|
}
|
|
81
19
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.m-editor-dep-list-panel {
|
|
2
|
+
.magic-editor-layer-tree {
|
|
3
|
+
padding-top: 48px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.search-wrapper {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
|
|
15
|
+
.search-input {
|
|
16
|
+
flex: 1;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tmagic-design-button {
|
|
21
|
+
margin-right: 10px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.list-container {
|
|
26
|
+
width: 100%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
.list-item {
|
|
29
|
+
display: flex;
|
|
30
|
+
width: 100%;
|
|
31
|
+
align-items: center;
|
|
32
|
+
|
|
33
|
+
.right-tool {
|
|
34
|
+
display: flex;
|
|
35
|
+
width: fit-content !important;
|
|
36
|
+
align-items: center;
|
|
37
|
+
.edit-icon {
|
|
38
|
+
margin: 0 5px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
.name {
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
text-overflow: ellipsis;
|
|
45
|
+
width: 0 !important;
|
|
46
|
+
flex: 1;
|
|
47
|
+
line-height: 22px;
|
|
48
|
+
|
|
49
|
+
&.code {
|
|
50
|
+
color: #000;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.hook {
|
|
54
|
+
color: #909399;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/theme/sidebar.scss
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
.m-editor-sidebar {
|
|
1
|
+
.m-editor-sidebar.tmagic-design-tabs {
|
|
2
2
|
height: 100%;
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
.el-tabs__header,
|
|
5
|
+
.t-tabs__header {
|
|
5
6
|
background: $--sidebar-heder-background-color;
|
|
6
7
|
border: 0;
|
|
8
|
+
height: 100%;
|
|
9
|
+
|
|
10
|
+
.t-tabs__nav--card {
|
|
11
|
+
background-color: transparent;
|
|
12
|
+
}
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
.t-tabs__nav--card.t-tabs__nav-item:not(.t-is-disabled):not(
|
|
15
|
+
.t-is-active
|
|
16
|
+
):hover {
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.is-left,
|
|
21
|
+
&.t-is-left {
|
|
9
22
|
width: 40px;
|
|
10
23
|
margin-right: 0;
|
|
11
24
|
}
|
|
@@ -23,7 +36,8 @@
|
|
|
23
36
|
margin-left: 2px;
|
|
24
37
|
}
|
|
25
38
|
|
|
26
|
-
.el-tabs__item.is-left
|
|
39
|
+
.el-tabs__item.is-left,
|
|
40
|
+
.t-tabs__nav-item {
|
|
27
41
|
line-height: 15px;
|
|
28
42
|
border: 0;
|
|
29
43
|
height: auto;
|
|
@@ -31,8 +45,10 @@
|
|
|
31
45
|
color: rgb(255, 255, 255);
|
|
32
46
|
box-sizing: border-box;
|
|
33
47
|
|
|
34
|
-
&.is-left
|
|
35
|
-
|
|
48
|
+
&.is-left,
|
|
49
|
+
&.t-is-left {
|
|
50
|
+
&.is-active,
|
|
51
|
+
&.t-is-active {
|
|
36
52
|
background: $--sidebar-content-background-color;
|
|
37
53
|
border: 0;
|
|
38
54
|
|
|
@@ -51,6 +67,10 @@
|
|
|
51
67
|
}
|
|
52
68
|
}
|
|
53
69
|
|
|
70
|
+
.t-tabs__nav-item {
|
|
71
|
+
padding: 7px;
|
|
72
|
+
}
|
|
73
|
+
|
|
54
74
|
i {
|
|
55
75
|
font-size: 25px;
|
|
56
76
|
color: rgba(255, 255, 255, 0.6);
|
package/src/theme/theme.scss
CHANGED
package/src/type.ts
CHANGED
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
|
|
31
31
|
import type { CodeBlockService } from './services/codeBlock';
|
|
32
32
|
import type { ComponentListService } from './services/componentList';
|
|
33
|
+
import { DataSourceService } from './services/dataSource';
|
|
33
34
|
import type { DepService } from './services/dep';
|
|
34
35
|
import type { EditorService } from './services/editor';
|
|
35
36
|
import type { EventsService } from './services/events';
|
|
@@ -56,6 +57,7 @@ export interface Services {
|
|
|
56
57
|
uiService: UiService;
|
|
57
58
|
codeBlockService: CodeBlockService;
|
|
58
59
|
depService: DepService;
|
|
60
|
+
dataSourceService: DataSourceService;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
export interface StageOptions {
|
|
@@ -264,7 +266,7 @@ export interface SideComponent extends MenuComponent {
|
|
|
264
266
|
* layer: 已选组件树
|
|
265
267
|
* code-block: 代码块
|
|
266
268
|
*/
|
|
267
|
-
export type SideItem = 'component-list' | 'layer' | 'code-block' | SideComponent;
|
|
269
|
+
export type SideItem = 'component-list' | 'layer' | 'code-block' | 'data-source' | SideComponent;
|
|
268
270
|
|
|
269
271
|
/** 工具栏 */
|
|
270
272
|
export interface SideBarData {
|