@tmagic/editor 1.2.15 → 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 +32 -0
- package/dist/tmagic-editor.js +949 -185
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +959 -194
- 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/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/index.ts +6 -0
- package/src/initService.ts +59 -3
- package/src/layouts/sidebar/LayerPanel.vue +2 -0
- package/src/layouts/sidebar/Sidebar.vue +14 -5
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +7 -0
- 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/theme/data-source-fields.scss +13 -0
- package/src/theme/data-source.scss +17 -0
- package/src/theme/key-value.scss +13 -0
- package/src/theme/theme.scss +3 -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 +2 -3
- 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
|
@@ -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/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 {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FormConfig } from '@tmagic/form';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
name: 'id',
|
|
6
|
+
type: 'hidden',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'type',
|
|
10
|
+
text: '类型',
|
|
11
|
+
type: 'select',
|
|
12
|
+
options: [
|
|
13
|
+
{ text: '基础', value: 'base' },
|
|
14
|
+
{ text: 'HTTP', value: 'http' },
|
|
15
|
+
],
|
|
16
|
+
defaultValue: 'base',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'title',
|
|
20
|
+
text: '名称',
|
|
21
|
+
rules: [
|
|
22
|
+
{
|
|
23
|
+
required: true,
|
|
24
|
+
message: '请输入名称',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'description',
|
|
30
|
+
text: '描述',
|
|
31
|
+
},
|
|
32
|
+
] as FormConfig;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FormConfig } from '@tmagic/form';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
name: 'autoFetch',
|
|
6
|
+
text: '自动请求',
|
|
7
|
+
type: 'switch',
|
|
8
|
+
defaultValue: true,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
type: 'fieldset',
|
|
12
|
+
name: 'options',
|
|
13
|
+
legend: 'HTTP 配置',
|
|
14
|
+
items: [
|
|
15
|
+
{
|
|
16
|
+
name: 'url',
|
|
17
|
+
text: 'URL',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'method',
|
|
21
|
+
text: 'Method',
|
|
22
|
+
type: 'select',
|
|
23
|
+
options: [
|
|
24
|
+
{ text: 'GET', value: 'GET' },
|
|
25
|
+
{ text: 'POST', value: 'POST' },
|
|
26
|
+
{ text: 'PUT', value: 'PUT' },
|
|
27
|
+
{ text: 'DELETE', value: 'DELETE' },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'params',
|
|
32
|
+
type: 'key-value',
|
|
33
|
+
defaultValue: {},
|
|
34
|
+
text: '参数',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'data',
|
|
38
|
+
type: 'key-value',
|
|
39
|
+
defaultValue: {},
|
|
40
|
+
text: '请求体',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'headers',
|
|
44
|
+
type: 'key-value',
|
|
45
|
+
defaultValue: {},
|
|
46
|
+
text: '请求头',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
] as FormConfig;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FormConfig } from '@tmagic/form';
|
|
2
|
+
|
|
3
|
+
import BaseFormConfig from './formConfigs/base';
|
|
4
|
+
import HttpFormConfig from './formConfigs/http';
|
|
5
|
+
|
|
6
|
+
const fillConfig = (config: FormConfig): FormConfig => [
|
|
7
|
+
...BaseFormConfig,
|
|
8
|
+
...config,
|
|
9
|
+
{
|
|
10
|
+
type: 'panel',
|
|
11
|
+
title: '数据定义',
|
|
12
|
+
items: [
|
|
13
|
+
{
|
|
14
|
+
name: 'fields',
|
|
15
|
+
type: 'data-source-fields',
|
|
16
|
+
defaultValue: [],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export const getFormConfig = (type: string, configs: Record<string, FormConfig>): FormConfig => {
|
|
23
|
+
switch (type) {
|
|
24
|
+
case 'base':
|
|
25
|
+
return fillConfig([]);
|
|
26
|
+
case 'http':
|
|
27
|
+
return fillConfig(HttpFormConfig);
|
|
28
|
+
default:
|
|
29
|
+
return fillConfig(configs[type] || []);
|
|
30
|
+
}
|
|
31
|
+
};
|
package/src/utils/dep.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isEmpty } from 'lodash-es';
|
|
2
2
|
|
|
3
|
-
import { CodeBlockContent, HookType, Id } from '@tmagic/schema';
|
|
3
|
+
import { CodeBlockContent, DataSourceSchema, HookType, Id } from '@tmagic/schema';
|
|
4
4
|
|
|
5
5
|
import { Target } from '@editor/services/dep';
|
|
6
6
|
import type { HookData } from '@editor/type';
|
|
@@ -19,3 +19,11 @@ export const createCodeBlockTarget = (id: Id, codeBlock: CodeBlockContent) =>
|
|
|
19
19
|
return false;
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
|
+
|
|
23
|
+
export const createDataSourceTarget = (id: Id, ds: DataSourceSchema) =>
|
|
24
|
+
new Target({
|
|
25
|
+
type: 'data-source',
|
|
26
|
+
id,
|
|
27
|
+
name: ds.title || `${id}`,
|
|
28
|
+
isTarget: (key: string | number, value: any) => typeof value === 'string' && value.includes(`${id}`),
|
|
29
|
+
});
|
package/src/utils/props.ts
CHANGED
package/types/Editor.vue.d.ts
CHANGED
|
@@ -47,6 +47,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
47
47
|
}>>;
|
|
48
48
|
default: () => {};
|
|
49
49
|
};
|
|
50
|
+
dataScourceConfigs: {
|
|
51
|
+
type: import("vue").PropType<Record<string, import("@tmagic/form").FormConfig>>;
|
|
52
|
+
default: () => {};
|
|
53
|
+
};
|
|
50
54
|
moveableOptions: {
|
|
51
55
|
type: import("vue").PropType<import("@tmagic/stage").MoveableOptions | ((config?: import("@tmagic/stage").CustomizeMoveableOptionsCallbackConfig | undefined) => import("@tmagic/stage").MoveableOptions)>;
|
|
52
56
|
};
|
|
@@ -134,6 +138,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
134
138
|
}>>;
|
|
135
139
|
default: () => {};
|
|
136
140
|
};
|
|
141
|
+
dataScourceConfigs: {
|
|
142
|
+
type: import("vue").PropType<Record<string, import("@tmagic/form").FormConfig>>;
|
|
143
|
+
default: () => {};
|
|
144
|
+
};
|
|
137
145
|
moveableOptions: {
|
|
138
146
|
type: import("vue").PropType<import("@tmagic/stage").MoveableOptions | ((config?: import("@tmagic/stage").CustomizeMoveableOptionsCallbackConfig | undefined) => import("@tmagic/stage").MoveableOptions)>;
|
|
139
147
|
};
|
|
@@ -190,6 +198,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
190
198
|
events: import("@tmagic/core").EventOption[];
|
|
191
199
|
methods: import("@tmagic/core").EventOption[];
|
|
192
200
|
}>;
|
|
201
|
+
dataScourceConfigs: Record<string, import("@tmagic/form").FormConfig>;
|
|
193
202
|
canSelect: (el: HTMLElement) => boolean | Promise<boolean>;
|
|
194
203
|
isContainer: (el: HTMLElement) => boolean | Promise<boolean>;
|
|
195
204
|
containerHighlightClassName: string;
|
|
@@ -8,15 +8,15 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
8
8
|
}>, {
|
|
9
9
|
hide: () => void;
|
|
10
10
|
show: (e: MouseEvent) => void;
|
|
11
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("
|
|
11
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("show" | "hide")[], "show" | "hide", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
12
12
|
menuData?: (MenuButton | MenuComponent)[] | undefined;
|
|
13
13
|
isSubMenu?: boolean | undefined;
|
|
14
14
|
}>, {
|
|
15
15
|
menuData: () => never[];
|
|
16
16
|
isSubMenu: boolean;
|
|
17
17
|
}>>> & {
|
|
18
|
-
onHide?: ((...args: any[]) => any) | undefined;
|
|
19
18
|
onShow?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
onHide?: ((...args: any[]) => any) | undefined;
|
|
20
20
|
}, {
|
|
21
21
|
menuData: (MenuButton | MenuComponent)[];
|
|
22
22
|
isSubMenu: boolean;
|
package/types/editorProps.d.ts
CHANGED
|
@@ -64,6 +64,10 @@ declare const _default: {
|
|
|
64
64
|
}>>;
|
|
65
65
|
default: () => {};
|
|
66
66
|
};
|
|
67
|
+
dataScourceConfigs: {
|
|
68
|
+
type: PropType<Record<string, FormConfig>>;
|
|
69
|
+
default: () => {};
|
|
70
|
+
};
|
|
67
71
|
/** 画布中组件选中框的移动范围 */
|
|
68
72
|
moveableOptions: {
|
|
69
73
|
type: PropType<MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions)>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
config: {
|
|
3
|
+
type: 'data-source-fields';
|
|
4
|
+
};
|
|
5
|
+
model: any;
|
|
6
|
+
prop: string;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
name: string;
|
|
9
|
+
}>, {
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
12
|
+
config: {
|
|
13
|
+
type: 'data-source-fields';
|
|
14
|
+
};
|
|
15
|
+
model: any;
|
|
16
|
+
prop: string;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
name: string;
|
|
19
|
+
}>, {
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
}>>> & {
|
|
22
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
28
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
29
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
30
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
31
|
+
} : {
|
|
32
|
+
type: import('vue').PropType<T[K]>;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
type __VLS_WithDefaults<P, D> = {
|
|
37
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
38
|
+
default: D[K];
|
|
39
|
+
} : P[K];
|
|
40
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
config: {
|
|
3
|
+
type: 'key-value';
|
|
4
|
+
name: string;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
model: Record<string, any>;
|
|
8
|
+
name: string;
|
|
9
|
+
prop: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
lastValues?: Record<string, any> | undefined;
|
|
12
|
+
size?: "default" | "small" | "large" | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
change: (value: Record<string, any>) => void;
|
|
17
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
18
|
+
config: {
|
|
19
|
+
type: 'key-value';
|
|
20
|
+
name: string;
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
model: Record<string, any>;
|
|
24
|
+
name: string;
|
|
25
|
+
prop: string;
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
lastValues?: Record<string, any> | undefined;
|
|
28
|
+
size?: "default" | "small" | "large" | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
}>>> & {
|
|
32
|
+
onChange?: ((value: Record<string, any>) => any) | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
export default _default;
|
|
37
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
38
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
39
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
40
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
41
|
+
} : {
|
|
42
|
+
type: import('vue').PropType<T[K]>;
|
|
43
|
+
required: true;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
type __VLS_WithDefaults<P, D> = {
|
|
47
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
48
|
+
default: D[K];
|
|
49
|
+
} : P[K];
|
|
50
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ export { default as ComponentListPanel } from './layouts/sidebar/ComponentListPa
|
|
|
18
18
|
export { default as LayerPanel } from './layouts/sidebar/LayerPanel.vue';
|
|
19
19
|
export { default as CodeSelect } from './fields/CodeSelect.vue';
|
|
20
20
|
export { default as CodeSelectCol } from './fields/CodeSelectCol.vue';
|
|
21
|
+
export { default as DataSourceFields } from './fields/DataSourceFields.vue';
|
|
21
22
|
export { default as EventSelect } from './fields/EventSelect.vue';
|
|
23
|
+
export { default as KeyValue } from './fields/KeyValue.vue';
|
|
22
24
|
export { default as CodeBlockList } from './layouts/sidebar/code-block/CodeBlockList.vue';
|
|
23
25
|
export { default as PropsPanel } from './layouts/PropsPanel.vue';
|
|
24
26
|
export { default as ToolButton } from './components/ToolButton.vue';
|
package/types/initService.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export declare type LooseRequired<T> = {
|
|
|
5
5
|
[P in string & keyof T]: T[P];
|
|
6
6
|
};
|
|
7
7
|
export declare const initServiceState: (props: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, { editorService, historyService, componentListService, propsService, eventsService, uiService, codeBlockService, }: Services) => void;
|
|
8
|
-
export declare const initServiceEvents: (props: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, emit: (event: 'props-panel-mounted' | 'update:modelValue', ...args: any[]) => void, { editorService, codeBlockService, depService }: Services) => void;
|
|
8
|
+
export declare const initServiceEvents: (props: Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>, emit: (event: 'props-panel-mounted' | 'update:modelValue', ...args: any[]) => void, { editorService, codeBlockService, dataSourceService, depService }: Services) => void;
|
|
@@ -37,10 +37,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
37
37
|
onSave?: ((...args: any[]) => any) | undefined;
|
|
38
38
|
onInitd?: ((...args: any[]) => any) | undefined;
|
|
39
39
|
}, {
|
|
40
|
-
language: string;
|
|
41
40
|
options: {
|
|
42
41
|
[key: string]: any;
|
|
43
42
|
};
|
|
43
|
+
language: string;
|
|
44
44
|
autoSave: boolean;
|
|
45
45
|
}>;
|
|
46
46
|
export default _default;
|