@nasl/types 0.1.3 → 0.1.4
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/nasl.ui.ast.d.ts +2 -1
- package/nasl.ui.ast.schema.json +5 -2
- package/nasl.ui.decorators.d.ts +30 -6
- package/nasl.ui.options.d.ts +17 -8
- package/package.json +1 -1
- package/tsconfig.json +1 -1
package/nasl.ui.ast.d.ts
CHANGED
|
@@ -181,6 +181,7 @@ export interface BooleanLiteral {
|
|
|
181
181
|
export interface StringLiteral {
|
|
182
182
|
concept: 'StringLiteral';
|
|
183
183
|
value: string;
|
|
184
|
+
i18nKey: string;
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
/**
|
|
@@ -264,7 +265,7 @@ export type LogicItem = NullLiteral | BooleanLiteral | StringLiteral | NumericLi
|
|
|
264
265
|
export interface Param {
|
|
265
266
|
concept: 'Param';
|
|
266
267
|
name: string;
|
|
267
|
-
description
|
|
268
|
+
description?: string;
|
|
268
269
|
typeAnnotation: TypeAnnotation;
|
|
269
270
|
defaultValue?: DefaultValue;
|
|
270
271
|
}
|
package/nasl.ui.ast.schema.json
CHANGED
|
@@ -490,11 +490,15 @@
|
|
|
490
490
|
},
|
|
491
491
|
"value": {
|
|
492
492
|
"type": "string"
|
|
493
|
+
},
|
|
494
|
+
"i18nKey": {
|
|
495
|
+
"type": "string"
|
|
493
496
|
}
|
|
494
497
|
},
|
|
495
498
|
"required": [
|
|
496
499
|
"concept",
|
|
497
|
-
"value"
|
|
500
|
+
"value",
|
|
501
|
+
"i18nKey"
|
|
498
502
|
],
|
|
499
503
|
"additionalProperties": false,
|
|
500
504
|
"description": "字符串字面量"
|
|
@@ -752,7 +756,6 @@
|
|
|
752
756
|
"required": [
|
|
753
757
|
"concept",
|
|
754
758
|
"name",
|
|
755
|
-
"description",
|
|
756
759
|
"typeAnnotation"
|
|
757
760
|
],
|
|
758
761
|
"additionalProperties": false,
|
package/nasl.ui.decorators.d.ts
CHANGED
|
@@ -5,16 +5,40 @@ declare namespace nasl.ui {
|
|
|
5
5
|
// name: '__ViewComponent';
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export class ViewComponentOptions {
|
|
9
|
+
// name: '__ViewComponentOptions';
|
|
10
|
+
|
|
11
|
+
@Prop({
|
|
12
|
+
title: '显示条件',
|
|
13
|
+
description: '是否展示组件',
|
|
14
|
+
setter: {
|
|
15
|
+
concept: 'SwitchSetter',
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
if: nasl.core.Boolean;
|
|
19
|
+
|
|
20
|
+
@Prop({
|
|
21
|
+
title: '工具提示',
|
|
22
|
+
description: '在鼠标悬停时显示的文字',
|
|
23
|
+
})
|
|
24
|
+
tooltip: nasl.core.String;
|
|
25
|
+
}
|
|
26
|
+
|
|
8
27
|
export function Component(options?: ViewComponentOptions): (target: any) => void;
|
|
9
28
|
|
|
10
|
-
export function Prop(options?:
|
|
11
|
-
export function Prop<T extends object, K extends keyof T>(options?:
|
|
29
|
+
export function Prop(options?: PropOpts<never, never>): (target: any, key: string) => void;
|
|
30
|
+
export function Prop<T extends object, K extends keyof T>(options?: PropOpts<T, K>): (target: T, key: K) => void;
|
|
31
|
+
|
|
32
|
+
export function Event(options?: EventOpts): (target: any, key: string) => void;
|
|
12
33
|
|
|
13
|
-
export function
|
|
34
|
+
export function Slot(options?: SlotOpts): (target: any, key: string) => void;
|
|
14
35
|
|
|
15
|
-
|
|
36
|
+
/**
|
|
37
|
+
* 与类型推导有关,必须将返回值类型放在第一个参数位置
|
|
38
|
+
*/
|
|
39
|
+
export type SlotType<T extends (...args: Array<any>) => Array<any>> = (ret: ReturnType<T>, ...args: Parameters<T>) => ReturnType<T>;
|
|
16
40
|
|
|
17
|
-
export function Method(options?:
|
|
41
|
+
export function Method(options?: LogicOpts): (target: any, key: string) => void;
|
|
18
42
|
|
|
19
|
-
export function Param(options?:
|
|
43
|
+
export function Param(options?: ParamOpts): (target: any, key: string, paramIndex: number) => void;
|
|
20
44
|
}
|
package/nasl.ui.options.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare namespace nasl.ui {
|
|
|
4
4
|
/**
|
|
5
5
|
* 设置器基类
|
|
6
6
|
*/
|
|
7
|
-
export type BaseSetter<T, K> = InputSetter | SwitchSetter | EnumSelectSetter<T, K> | CapsulesSetter<T, K> | NumberInputSetter | IconSetter | ImageSetter | PropertySelectSetter;
|
|
7
|
+
export type BaseSetter<T extends object, K extends keyof T> = InputSetter | SwitchSetter | EnumSelectSetter<T, K> | CapsulesSetter<T, K> | NumberInputSetter | IconSetter | ImageSetter | PropertySelectSetter;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* 输入框设置器
|
|
@@ -25,7 +25,7 @@ declare namespace nasl.ui {
|
|
|
25
25
|
/**
|
|
26
26
|
* 枚举选择设置器
|
|
27
27
|
*/
|
|
28
|
-
export interface EnumSelectSetter<T, K> {
|
|
28
|
+
export interface EnumSelectSetter<T extends object, K extends keyof T> {
|
|
29
29
|
concept: 'EnumSelectSetter';
|
|
30
30
|
options: Array<SetterOption<T, K>>;
|
|
31
31
|
}
|
|
@@ -33,7 +33,7 @@ declare namespace nasl.ui {
|
|
|
33
33
|
/**
|
|
34
34
|
* 胶囊设置器
|
|
35
35
|
*/
|
|
36
|
-
export interface CapsulesSetter<T, K> {
|
|
36
|
+
export interface CapsulesSetter<T extends object, K extends keyof T> {
|
|
37
37
|
concept: 'CapsulesSetter';
|
|
38
38
|
options: Array<SetterOption<T, K>>;
|
|
39
39
|
}
|
|
@@ -77,7 +77,7 @@ declare namespace nasl.ui {
|
|
|
77
77
|
/**
|
|
78
78
|
* 页面组件
|
|
79
79
|
*/
|
|
80
|
-
export interface
|
|
80
|
+
export interface ViewComponentOpts {
|
|
81
81
|
kebabName?: string;
|
|
82
82
|
title: string;
|
|
83
83
|
group?: string;
|
|
@@ -89,7 +89,7 @@ declare namespace nasl.ui {
|
|
|
89
89
|
/**
|
|
90
90
|
* 组件属性
|
|
91
91
|
*/
|
|
92
|
-
export interface
|
|
92
|
+
export interface PropOpts<T extends object, K extends keyof T> {
|
|
93
93
|
title: string;
|
|
94
94
|
group?: '基础信息' | '数据属性' | '主要属性' | '交互属性' | '状态属性' | '样式属性' | '工具属性';
|
|
95
95
|
icon?: string;
|
|
@@ -110,7 +110,7 @@ declare namespace nasl.ui {
|
|
|
110
110
|
/**
|
|
111
111
|
* 组件事件
|
|
112
112
|
*/
|
|
113
|
-
export interface
|
|
113
|
+
export interface EventOpts {
|
|
114
114
|
title: string;
|
|
115
115
|
description?: string;
|
|
116
116
|
}
|
|
@@ -118,7 +118,7 @@ declare namespace nasl.ui {
|
|
|
118
118
|
/**
|
|
119
119
|
* 插槽
|
|
120
120
|
*/
|
|
121
|
-
export interface
|
|
121
|
+
export interface SlotOpts {
|
|
122
122
|
title: string;
|
|
123
123
|
description?: string;
|
|
124
124
|
emptyBackground?: string;
|
|
@@ -128,11 +128,20 @@ declare namespace nasl.ui {
|
|
|
128
128
|
/**
|
|
129
129
|
* 逻辑声明
|
|
130
130
|
*/
|
|
131
|
-
export interface
|
|
131
|
+
export interface LogicOpts {
|
|
132
132
|
title: string;
|
|
133
133
|
description: string;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
/**
|
|
137
|
+
* 带分组的参数
|
|
138
|
+
*/
|
|
139
|
+
export interface ParamOpts {
|
|
140
|
+
description?: string;
|
|
141
|
+
title: string;
|
|
142
|
+
group?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
136
145
|
/**
|
|
137
146
|
* 设置器枚举选项
|
|
138
147
|
*/
|
package/package.json
CHANGED