@vtj/core 0.1.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.cjs +7 -0
- package/dist/index.mjs +1281 -0
- package/package.json +37 -45
- package/types/index.d.ts +4 -0
- package/types/models/base.d.ts +7 -0
- package/types/models/block.d.ts +195 -0
- package/types/models/directive.d.ts +32 -0
- package/types/models/event.d.ts +11 -0
- package/types/models/history.d.ts +42 -0
- package/types/models/index.d.ts +8 -0
- package/types/models/node.d.ts +174 -0
- package/types/models/project.d.ts +168 -0
- package/types/models/prop.d.ts +15 -0
- package/types/protocols/assets/dependencie.d.ts +41 -0
- package/types/protocols/assets/index.d.ts +2 -0
- package/types/protocols/assets/material.d.ts +198 -0
- package/types/protocols/index.d.ts +4 -0
- package/types/protocols/schemas/block.d.ts +106 -0
- package/types/protocols/schemas/dataSource.d.ts +75 -0
- package/types/protocols/schemas/file.d.ts +56 -0
- package/types/protocols/schemas/history.d.ts +31 -0
- package/types/protocols/schemas/index.d.ts +6 -0
- package/types/protocols/schemas/node.d.ts +130 -0
- package/types/protocols/schemas/project.d.ts +48 -0
- package/types/protocols/service.d.ts +19 -0
- package/types/protocols/shared.d.ts +34 -0
- package/types/tools/emitter.d.ts +27 -0
- package/types/tools/index.d.ts +2 -0
- package/types/tools/util.d.ts +6 -0
- package/types/version.d.ts +8 -0
- package/CHANGELOG.md +0 -0
- package/README.md +0 -2
- package/index.cjs.js +0 -60
- package/index.es.js +0 -1219
- package/types.d.ts +0 -275
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { ProjectSchema, Dependencie, PageFile, BlockFile, ApiSchema } from '../protocols';
|
|
2
|
+
import { type ModelEventType } from '../tools';
|
|
3
|
+
export interface ProjectModelEvent {
|
|
4
|
+
model: ProjectModel;
|
|
5
|
+
type: ModelEventType;
|
|
6
|
+
data: any;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 项目信息更新时触发事件
|
|
10
|
+
*/
|
|
11
|
+
export declare const EVENT_PROJECT_CHANGE = "EVENT_PROJECT_CHANGE";
|
|
12
|
+
/**
|
|
13
|
+
* 打开/关闭文件时触发事件
|
|
14
|
+
*/
|
|
15
|
+
export declare const EVENT_PROJECT_ACTIVED = "EVENT_PROJECT_ACTIVED";
|
|
16
|
+
/**
|
|
17
|
+
* 依赖更新时触发
|
|
18
|
+
*/
|
|
19
|
+
export declare const EVENT_PROJECT_DEPS_CHANGE = "EVENT_PROJECT_DEPS_CHANGE";
|
|
20
|
+
/**
|
|
21
|
+
* 页面文件更新
|
|
22
|
+
*/
|
|
23
|
+
export declare const EVENT_PROJECT_PAGES_CHANGE = "EVENT_PROJECT_PAGES_CHANGE";
|
|
24
|
+
/**
|
|
25
|
+
* 区块文件更新
|
|
26
|
+
*/
|
|
27
|
+
export declare const EVENT_PROJECT_BLOCKS_CHANGE = "EVENT_PROJECT_BLOCKS_CHANGE";
|
|
28
|
+
/**
|
|
29
|
+
* API更新
|
|
30
|
+
*/
|
|
31
|
+
export declare const EVENT_PROJECT_APIS_CHANGE = "EVENT_PROJECT_APIS_CHANGE";
|
|
32
|
+
/**
|
|
33
|
+
* 项目发布
|
|
34
|
+
*/
|
|
35
|
+
export declare const EVENT_PROJECT_PUBLISH = "EVENT_PROJECT_PUBLISH";
|
|
36
|
+
/**
|
|
37
|
+
* 项目文件发布
|
|
38
|
+
*/
|
|
39
|
+
export declare const EVENT_PROJECT_FILE_PUBLISH = "EVENT_PROJECT_FILE_PUBLISH";
|
|
40
|
+
export declare class ProjectModel {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
homepage: string;
|
|
45
|
+
dependencies: Dependencie[];
|
|
46
|
+
pages: PageFile[];
|
|
47
|
+
blocks: BlockFile[];
|
|
48
|
+
apis: ApiSchema[];
|
|
49
|
+
currentFile: PageFile | BlockFile | null;
|
|
50
|
+
static attrs: string[];
|
|
51
|
+
constructor(schema: ProjectSchema);
|
|
52
|
+
update(schema: Partial<ProjectSchema>, silent?: boolean): void;
|
|
53
|
+
isPageFile(file: PageFile | BlockFile): file is PageFile;
|
|
54
|
+
toDsl(): ProjectSchema;
|
|
55
|
+
/**
|
|
56
|
+
* 打开文件
|
|
57
|
+
* @param file
|
|
58
|
+
* @param silent
|
|
59
|
+
*/
|
|
60
|
+
active(file: BlockFile | PageFile, silent?: boolean): void;
|
|
61
|
+
/**
|
|
62
|
+
* 关闭文件
|
|
63
|
+
* @param silent
|
|
64
|
+
*/
|
|
65
|
+
deactivate(silent?: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* 新增或更新依赖
|
|
68
|
+
* @param item
|
|
69
|
+
* @param silent
|
|
70
|
+
*/
|
|
71
|
+
setDeps(item: Dependencie, silent?: boolean): void;
|
|
72
|
+
/**
|
|
73
|
+
* 删除依赖
|
|
74
|
+
* @param item
|
|
75
|
+
* @param silent
|
|
76
|
+
*/
|
|
77
|
+
removeDeps(item: Dependencie, silent?: boolean): void;
|
|
78
|
+
/**
|
|
79
|
+
* 根据页面id查找页面或目录
|
|
80
|
+
* @param id
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
83
|
+
getPage(id: string): PageFile | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* 查找全部页面,不含目录
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
88
|
+
getPages(): PageFile[];
|
|
89
|
+
/**
|
|
90
|
+
* 新建页面
|
|
91
|
+
* @param page
|
|
92
|
+
* @param parentId
|
|
93
|
+
* @param silent
|
|
94
|
+
*/
|
|
95
|
+
createPage(page: PageFile, parentId?: string, silent?: boolean): void;
|
|
96
|
+
/**
|
|
97
|
+
* 更新页面
|
|
98
|
+
* @param page
|
|
99
|
+
* @param silent
|
|
100
|
+
*/
|
|
101
|
+
updatePage(page: PageFile, silent?: boolean): void;
|
|
102
|
+
/**
|
|
103
|
+
* 复制页面
|
|
104
|
+
* @param page
|
|
105
|
+
* @param parentId
|
|
106
|
+
* @param silent
|
|
107
|
+
*/
|
|
108
|
+
clonePage(page: PageFile, parentId?: string, silent?: boolean): void;
|
|
109
|
+
/**
|
|
110
|
+
* 删除页面或目录
|
|
111
|
+
* @param id
|
|
112
|
+
* @param silent
|
|
113
|
+
*/
|
|
114
|
+
removePage(id: string, silent?: boolean): void;
|
|
115
|
+
/**
|
|
116
|
+
* 获取区块文件
|
|
117
|
+
* @param id
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
getBlock(id: string): BlockFile | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* 创建区块
|
|
123
|
+
* @param block
|
|
124
|
+
* @param silent
|
|
125
|
+
*/
|
|
126
|
+
createBlock(block: BlockFile, silent?: boolean): void;
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @param block 更新区块
|
|
130
|
+
* @param silent
|
|
131
|
+
*/
|
|
132
|
+
updateBlock(block: BlockFile, silent?: boolean): void;
|
|
133
|
+
/**
|
|
134
|
+
* 删除区块
|
|
135
|
+
* @param id
|
|
136
|
+
* @param silent
|
|
137
|
+
*/
|
|
138
|
+
removeBlock(id: string, silent?: boolean): void;
|
|
139
|
+
/**
|
|
140
|
+
* 检查是否存在名称的区块
|
|
141
|
+
* @param name
|
|
142
|
+
* @param excludes
|
|
143
|
+
* @returns
|
|
144
|
+
*/
|
|
145
|
+
existBlockName(name: string, excludes?: string[]): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* 检测是否存在名称的页面
|
|
148
|
+
* @param name
|
|
149
|
+
* @param excludes
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
existPageName(name: string, excludes?: string[]): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* 新增或更新api
|
|
155
|
+
* @param item
|
|
156
|
+
* @param silent
|
|
157
|
+
*/
|
|
158
|
+
setApi(item: ApiSchema, silent?: boolean): void;
|
|
159
|
+
/**
|
|
160
|
+
* 删除api
|
|
161
|
+
* @param name
|
|
162
|
+
* @param silent
|
|
163
|
+
*/
|
|
164
|
+
removeApi(name: string, silent?: boolean): void;
|
|
165
|
+
existApiName(name: string, excludes?: string[]): boolean;
|
|
166
|
+
setHomepage(id: string, silent?: boolean): void;
|
|
167
|
+
publish(file?: PageFile | BlockFile): void;
|
|
168
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JSONValue, JSExpression, JSFunction, NodeProps } from '../protocols';
|
|
2
|
+
export declare class PropModel {
|
|
3
|
+
name: string;
|
|
4
|
+
value?: JSONValue | JSExpression | JSFunction;
|
|
5
|
+
defaultValue?: JSONValue | JSExpression | JSFunction;
|
|
6
|
+
/**
|
|
7
|
+
* 标识是否设置了值, 设置的值与默认值一致,表示未设置,在转换成dsl时会排查该属性
|
|
8
|
+
*/
|
|
9
|
+
isUnset: boolean;
|
|
10
|
+
constructor(name: string, value?: JSONValue | JSExpression | JSFunction, defaultValue?: JSONValue | JSExpression | JSFunction);
|
|
11
|
+
setValue(value: JSONValue | JSExpression | JSFunction): void;
|
|
12
|
+
getValue(): JSONValue | JSExpression | JSFunction;
|
|
13
|
+
static toDsl(props?: Record<string, PropModel>): NodeProps;
|
|
14
|
+
static parse(props?: NodeProps): Record<string, PropModel>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 依赖包
|
|
3
|
+
*/
|
|
4
|
+
export interface Dependencie {
|
|
5
|
+
/**
|
|
6
|
+
* 包名
|
|
7
|
+
*/
|
|
8
|
+
package: string;
|
|
9
|
+
/**
|
|
10
|
+
* 版本号
|
|
11
|
+
*/
|
|
12
|
+
version: string;
|
|
13
|
+
/**
|
|
14
|
+
* 必须依赖
|
|
15
|
+
*/
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 官方内置提供
|
|
19
|
+
*/
|
|
20
|
+
official?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 启用
|
|
23
|
+
*/
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 库导出名称
|
|
27
|
+
*/
|
|
28
|
+
library: string;
|
|
29
|
+
/**
|
|
30
|
+
* 加载资源url
|
|
31
|
+
*/
|
|
32
|
+
urls: string[];
|
|
33
|
+
/**
|
|
34
|
+
* 资产配置url
|
|
35
|
+
*/
|
|
36
|
+
assetsUrl?: string;
|
|
37
|
+
/**
|
|
38
|
+
* 资产配置导出名称
|
|
39
|
+
*/
|
|
40
|
+
assetsLibrary?: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { JSONValue, DataType } from '../shared';
|
|
2
|
+
import type { NodeSchema, NodeFrom } from '../schemas';
|
|
3
|
+
/**
|
|
4
|
+
* 物料描述
|
|
5
|
+
*/
|
|
6
|
+
export interface Material {
|
|
7
|
+
/**
|
|
8
|
+
* 版本号
|
|
9
|
+
*/
|
|
10
|
+
version: string;
|
|
11
|
+
/**
|
|
12
|
+
* 物料名称标识
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* 产出导出变量名称
|
|
17
|
+
*/
|
|
18
|
+
library: string;
|
|
19
|
+
/**
|
|
20
|
+
* 物料中文名称
|
|
21
|
+
*/
|
|
22
|
+
label: string;
|
|
23
|
+
/**
|
|
24
|
+
* 分类配置
|
|
25
|
+
*/
|
|
26
|
+
categories: MaterialCategory[];
|
|
27
|
+
/**
|
|
28
|
+
* 组件描述
|
|
29
|
+
*/
|
|
30
|
+
components: MaterialDescription[];
|
|
31
|
+
/**
|
|
32
|
+
* 排序号,物料在组件库的排序,数字小的在前
|
|
33
|
+
*/
|
|
34
|
+
order: number;
|
|
35
|
+
}
|
|
36
|
+
export interface MaterialCategory {
|
|
37
|
+
id: number | string;
|
|
38
|
+
category: string;
|
|
39
|
+
}
|
|
40
|
+
export interface MaterialDescription {
|
|
41
|
+
/**
|
|
42
|
+
* 组件名称
|
|
43
|
+
*/
|
|
44
|
+
name: string;
|
|
45
|
+
/**
|
|
46
|
+
* 组件别名,即组件库导出的原始名称 如 import { Button } from 'ant-design-vue'
|
|
47
|
+
*/
|
|
48
|
+
alias?: string;
|
|
49
|
+
/**
|
|
50
|
+
* 组件库导出的名称 如 import { Button } from 'ant-design-vue'
|
|
51
|
+
* parent: Button
|
|
52
|
+
* alias: Group
|
|
53
|
+
* name: AButtonGroup
|
|
54
|
+
* const AButtonGroup = Button.Group;
|
|
55
|
+
* 当 parent 有值时 alias 可以设置多级,如 Group.Item
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
parent?: string;
|
|
59
|
+
/**
|
|
60
|
+
* 组件预览图标
|
|
61
|
+
*/
|
|
62
|
+
icon?: string;
|
|
63
|
+
/**
|
|
64
|
+
* 组件中文名称描述
|
|
65
|
+
*/
|
|
66
|
+
label?: string;
|
|
67
|
+
/**
|
|
68
|
+
* 组件文档Url
|
|
69
|
+
*/
|
|
70
|
+
doc?: string;
|
|
71
|
+
/**
|
|
72
|
+
* 分类Id
|
|
73
|
+
*/
|
|
74
|
+
categoryId?: number | string;
|
|
75
|
+
/**
|
|
76
|
+
* 组件支持属性,待定义
|
|
77
|
+
*/
|
|
78
|
+
props?: MaterialProp[];
|
|
79
|
+
/**
|
|
80
|
+
* 组件支持事件
|
|
81
|
+
*/
|
|
82
|
+
events?: Array<string | MaterialEvent>;
|
|
83
|
+
/**
|
|
84
|
+
* 组件支持的插槽
|
|
85
|
+
*/
|
|
86
|
+
slots?: Array<string | MaterialSlot>;
|
|
87
|
+
/**
|
|
88
|
+
* 初始化时的低代码片段
|
|
89
|
+
*/
|
|
90
|
+
snippet?: Partial<NodeSchema>;
|
|
91
|
+
/**
|
|
92
|
+
* 只能放置在哪些组件内, 如果不设置,则表示可以放置在任何组件内, false表示不能放置在任何组件内
|
|
93
|
+
*/
|
|
94
|
+
parentIncludes?: boolean | string[];
|
|
95
|
+
/**
|
|
96
|
+
* 只能允许哪些子组件, 如果不设置,则表示可以放置任何子组件, false表示不能放置在任何子组件
|
|
97
|
+
*/
|
|
98
|
+
childIncludes?: boolean | string[];
|
|
99
|
+
/**
|
|
100
|
+
* 不显示在组件面板
|
|
101
|
+
*/
|
|
102
|
+
hidden?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* 组件来源
|
|
105
|
+
*/
|
|
106
|
+
from?: NodeFrom;
|
|
107
|
+
/**
|
|
108
|
+
* Block Id
|
|
109
|
+
*/
|
|
110
|
+
id?: string;
|
|
111
|
+
/**
|
|
112
|
+
* 所属包名
|
|
113
|
+
*/
|
|
114
|
+
package?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 组件支持的属性
|
|
118
|
+
*/
|
|
119
|
+
export interface MaterialProp {
|
|
120
|
+
/**
|
|
121
|
+
* 属性名称
|
|
122
|
+
*/
|
|
123
|
+
name: string;
|
|
124
|
+
/**
|
|
125
|
+
* 属性名称 中文
|
|
126
|
+
*/
|
|
127
|
+
label?: string;
|
|
128
|
+
/**
|
|
129
|
+
* 提示说明
|
|
130
|
+
*/
|
|
131
|
+
title?: string;
|
|
132
|
+
/**
|
|
133
|
+
* 默认值
|
|
134
|
+
*/
|
|
135
|
+
defaultValue?: JSONValue;
|
|
136
|
+
/**
|
|
137
|
+
* 设置器
|
|
138
|
+
*/
|
|
139
|
+
setters?: string | MaterialSetter | Array<string | MaterialSetter>;
|
|
140
|
+
/**
|
|
141
|
+
* 值可选项
|
|
142
|
+
*/
|
|
143
|
+
options?: string[] | {
|
|
144
|
+
label: string;
|
|
145
|
+
value: JSONValue;
|
|
146
|
+
}[];
|
|
147
|
+
/**
|
|
148
|
+
* 数据类型
|
|
149
|
+
*/
|
|
150
|
+
type?: DataType[];
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* 属性设置器
|
|
154
|
+
*/
|
|
155
|
+
export interface MaterialSetter {
|
|
156
|
+
/**
|
|
157
|
+
* 设置器名称标识
|
|
158
|
+
*/
|
|
159
|
+
name: string;
|
|
160
|
+
/**
|
|
161
|
+
* 实现组件
|
|
162
|
+
*/
|
|
163
|
+
component?: any;
|
|
164
|
+
/**
|
|
165
|
+
* 显示描述文本
|
|
166
|
+
*/
|
|
167
|
+
label?: string;
|
|
168
|
+
/**
|
|
169
|
+
* 组件配置参数
|
|
170
|
+
*/
|
|
171
|
+
props?: Record<string, any>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* 组件支持的事件
|
|
175
|
+
*/
|
|
176
|
+
export interface MaterialEvent {
|
|
177
|
+
/**
|
|
178
|
+
* 事件名称
|
|
179
|
+
*/
|
|
180
|
+
name: string;
|
|
181
|
+
/**
|
|
182
|
+
* 事件回调参数名
|
|
183
|
+
*/
|
|
184
|
+
params?: string[];
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 组件支持的插槽
|
|
188
|
+
*/
|
|
189
|
+
export interface MaterialSlot {
|
|
190
|
+
/**
|
|
191
|
+
* 插槽名称
|
|
192
|
+
*/
|
|
193
|
+
name: string;
|
|
194
|
+
/**
|
|
195
|
+
* 插槽回传的参数名
|
|
196
|
+
*/
|
|
197
|
+
params?: string[];
|
|
198
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { JSExpression, JSFunction, JSONValue } from '../shared';
|
|
2
|
+
import type { NodeSchema } from './node';
|
|
3
|
+
import type { DataSourceSchema } from './dataSource';
|
|
4
|
+
export interface BlockSchema {
|
|
5
|
+
/**
|
|
6
|
+
* 唯一标识
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 组件名
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* 锁定
|
|
15
|
+
*/
|
|
16
|
+
locked?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 注入
|
|
19
|
+
*/
|
|
20
|
+
inject?: BlockInject[];
|
|
21
|
+
/**
|
|
22
|
+
* 状态数据
|
|
23
|
+
*/
|
|
24
|
+
state?: BlockState;
|
|
25
|
+
/**
|
|
26
|
+
* 生命周期集
|
|
27
|
+
*/
|
|
28
|
+
lifeCycles?: Record<string, JSFunction>;
|
|
29
|
+
/**
|
|
30
|
+
* 自定义方法
|
|
31
|
+
*/
|
|
32
|
+
methods?: Record<string, JSFunction>;
|
|
33
|
+
/**
|
|
34
|
+
* 计算属性
|
|
35
|
+
*/
|
|
36
|
+
computed?: Record<string, JSFunction>;
|
|
37
|
+
/**
|
|
38
|
+
* 侦听器
|
|
39
|
+
*/
|
|
40
|
+
watch?: BlockWatch[];
|
|
41
|
+
/**
|
|
42
|
+
* 样式
|
|
43
|
+
*/
|
|
44
|
+
css?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 定义属性参数
|
|
47
|
+
*/
|
|
48
|
+
props?: Array<string | BlockProp>;
|
|
49
|
+
/**
|
|
50
|
+
* 定义事件
|
|
51
|
+
*/
|
|
52
|
+
emits?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* 定义插槽
|
|
55
|
+
*/
|
|
56
|
+
slots?: string[];
|
|
57
|
+
/**
|
|
58
|
+
* 节点树
|
|
59
|
+
*/
|
|
60
|
+
nodes?: NodeSchema[];
|
|
61
|
+
/**
|
|
62
|
+
* 数据源
|
|
63
|
+
*/
|
|
64
|
+
dataSources?: Record<string, DataSourceSchema>;
|
|
65
|
+
/**
|
|
66
|
+
* babel代码转换缓存
|
|
67
|
+
*/
|
|
68
|
+
transform?: Record<string, string>;
|
|
69
|
+
/**
|
|
70
|
+
* 标记
|
|
71
|
+
*/
|
|
72
|
+
__VTJ_BLOCK__?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* 版本
|
|
75
|
+
*/
|
|
76
|
+
__VERSION__?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 注入描述
|
|
80
|
+
*/
|
|
81
|
+
export interface BlockInject {
|
|
82
|
+
name: string;
|
|
83
|
+
from?: string | JSExpression;
|
|
84
|
+
default?: JSONValue | JSExpression;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 组件状态描述
|
|
88
|
+
*/
|
|
89
|
+
export type BlockState = Record<string, JSONValue | JSExpression | JSFunction>;
|
|
90
|
+
/**
|
|
91
|
+
* 侦听器描述
|
|
92
|
+
*/
|
|
93
|
+
export interface BlockWatch {
|
|
94
|
+
id?: string;
|
|
95
|
+
source: JSFunction | JSExpression;
|
|
96
|
+
deep?: boolean;
|
|
97
|
+
immediate?: boolean;
|
|
98
|
+
handler: JSFunction;
|
|
99
|
+
}
|
|
100
|
+
export interface BlockProp {
|
|
101
|
+
name: string;
|
|
102
|
+
type?: BlockPropDataType | BlockPropDataType[];
|
|
103
|
+
required?: boolean;
|
|
104
|
+
default?: JSONValue | JSExpression;
|
|
105
|
+
}
|
|
106
|
+
export type BlockPropDataType = 'String' | 'Number' | 'Boolean' | 'Array' | 'Object' | 'Function' | 'Date';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { JSFunction, JSExpression } from '../shared';
|
|
2
|
+
/**
|
|
3
|
+
* 数据源类型,目前仅实现api类型
|
|
4
|
+
*/
|
|
5
|
+
export type DataSourceType = 'api' | 'cube' | 'meta';
|
|
6
|
+
/**
|
|
7
|
+
* 请求方法
|
|
8
|
+
*/
|
|
9
|
+
export type ApiMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'jsonp';
|
|
10
|
+
/**
|
|
11
|
+
* 项目级API类型数据源
|
|
12
|
+
*/
|
|
13
|
+
export interface ApiSchema {
|
|
14
|
+
/**
|
|
15
|
+
* 唯一标识
|
|
16
|
+
*/
|
|
17
|
+
id: string;
|
|
18
|
+
/**
|
|
19
|
+
* 接口名称
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* 接口描述说明
|
|
24
|
+
*/
|
|
25
|
+
label?: string;
|
|
26
|
+
/**
|
|
27
|
+
* 接口请求url
|
|
28
|
+
*/
|
|
29
|
+
url: string;
|
|
30
|
+
/**
|
|
31
|
+
* 接口请求方法
|
|
32
|
+
*/
|
|
33
|
+
method?: ApiMethod;
|
|
34
|
+
/**
|
|
35
|
+
* 请求 设置配置
|
|
36
|
+
*/
|
|
37
|
+
settings?: Record<string, any>;
|
|
38
|
+
/**
|
|
39
|
+
* 请求头配置
|
|
40
|
+
*/
|
|
41
|
+
headers?: JSExpression | JSFunction;
|
|
42
|
+
/**
|
|
43
|
+
* jsonp请求配置
|
|
44
|
+
*/
|
|
45
|
+
jsonpOptions?: Record<string, any>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 页面级引用数据源
|
|
49
|
+
*/
|
|
50
|
+
export interface DataSourceSchema {
|
|
51
|
+
/**
|
|
52
|
+
* 数据源类型
|
|
53
|
+
*/
|
|
54
|
+
type: DataSourceType;
|
|
55
|
+
/**
|
|
56
|
+
* 数据源引用唯一标识
|
|
57
|
+
*/
|
|
58
|
+
ref: string;
|
|
59
|
+
/**
|
|
60
|
+
* 数据源名称
|
|
61
|
+
*/
|
|
62
|
+
name: string;
|
|
63
|
+
/**
|
|
64
|
+
* 描述标题
|
|
65
|
+
*/
|
|
66
|
+
label?: string;
|
|
67
|
+
/**
|
|
68
|
+
* 数据转换函数
|
|
69
|
+
*/
|
|
70
|
+
transform?: JSFunction;
|
|
71
|
+
/**
|
|
72
|
+
* 测试用例
|
|
73
|
+
*/
|
|
74
|
+
test?: JSFunction;
|
|
75
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { BlockSchema } from './block';
|
|
2
|
+
/**
|
|
3
|
+
* 文件类型
|
|
4
|
+
*/
|
|
5
|
+
export type FileType = 'block' | 'page';
|
|
6
|
+
export interface BlockFile {
|
|
7
|
+
/**
|
|
8
|
+
* 文件类型
|
|
9
|
+
*/
|
|
10
|
+
type: FileType;
|
|
11
|
+
/**
|
|
12
|
+
* 唯一标识
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* 文件名
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* 页面标题
|
|
21
|
+
*/
|
|
22
|
+
title: string;
|
|
23
|
+
/**
|
|
24
|
+
* 文件内容
|
|
25
|
+
*/
|
|
26
|
+
dsl?: BlockSchema;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 页面描述
|
|
30
|
+
*/
|
|
31
|
+
export interface PageFile extends BlockFile {
|
|
32
|
+
/**
|
|
33
|
+
* 是否目录
|
|
34
|
+
*/
|
|
35
|
+
dir?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 菜单icon
|
|
38
|
+
*/
|
|
39
|
+
icon?: string;
|
|
40
|
+
/**
|
|
41
|
+
* 目录包含的页面
|
|
42
|
+
*/
|
|
43
|
+
children?: PageFile[];
|
|
44
|
+
/**
|
|
45
|
+
* 是否在母版内
|
|
46
|
+
*/
|
|
47
|
+
mask?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 不在菜单显示
|
|
50
|
+
*/
|
|
51
|
+
hidden?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 源码文件,非低代码页面
|
|
54
|
+
*/
|
|
55
|
+
raw?: boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { BlockSchema } from './block';
|
|
2
|
+
/**
|
|
3
|
+
* 历史记录描述
|
|
4
|
+
*/
|
|
5
|
+
export interface HistorySchema {
|
|
6
|
+
/**
|
|
7
|
+
* 页面或区块文件id
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* 历史记录项
|
|
12
|
+
*/
|
|
13
|
+
items?: HistoryItem[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 记录项
|
|
17
|
+
*/
|
|
18
|
+
export interface HistoryItem {
|
|
19
|
+
/**
|
|
20
|
+
* 记录项唯一标识
|
|
21
|
+
*/
|
|
22
|
+
id: string;
|
|
23
|
+
/**
|
|
24
|
+
* 记录项描述
|
|
25
|
+
*/
|
|
26
|
+
label: string;
|
|
27
|
+
/**
|
|
28
|
+
* 记录项内容
|
|
29
|
+
*/
|
|
30
|
+
dsl?: BlockSchema;
|
|
31
|
+
}
|