-
-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathSimpleUIDef.ts
More file actions
159 lines (114 loc) · 4.24 KB
/
SimpleUIDef.ts
File metadata and controls
159 lines (114 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import * as vscode from 'vscode';
export interface SimpleUIConfig {
title: string; // title for this config
ref_id?: string; // 用于唯一地标识该配置,避免重复打开两个完全一样的配置
readonly?: boolean;
iconName?: string;
viewColumn?: vscode.ViewColumn;
notTakeFocus?: boolean;
btns?: {
'submit'?: SimpleUIBtnInfo;
'reset'?: SimpleUIBtnInfo;
};
items: {
[key: string]: SimpleUIConfigItem;
};
};
export interface SimpleUIBtnInfo {
title: string; // title for button
hidden?: boolean; // hide this button
disabled?: boolean; // button is disabled
}
export interface SimpleUIConfigData {
value: any;
default: any;
}
export interface SimpleUIConfigItem {
type: 'input' | 'options' | 'table' | 'text' | 'bool' | 'divider' | 'tag' | 'button';
attrs: { [key: string]: string | boolean | number };
name: string; // readable title
description?: string; // a description for this item
data: SimpleUIConfigData |
SimpleUIConfigData_input |
SimpleUIConfigData_options |
SimpleUIConfigData_table |
SimpleUIConfigData_text |
SimpleUIConfigData_boolean |
SimpleUIConfigData_divider |
SimpleUIConfigData_tag |
SimpleUIConfigData_button;
};
// input box
//
// all attrs:
// - 'singleLine': [bool] Make it as a single line input box.
// - 'size': [number] Sets the width of the element to a specified number of characters.
// - 'readonly': [bool] When true, the control will be immutable by any user interaction.
// - 'disabled': [bool] Prevents the user from interacting with the button––it cannot be pressed or focused.
//
// attrs only for multi-line input boxs:
// - 'rows': [number] Sizes the component vertically by a number of character rows.
// - 'resize': [string] The resize mode of the component. Options: 'none', 'vertical', 'horizontal', 'both'.
//
export interface SimpleUIConfigData_input extends SimpleUIConfigData {
value: string;
default: string;
placeHolder?: string;
}
// options box
//
// all attrs:
// - 'disabled': [bool] Prevents the user from interacting with the button––it cannot be pressed or focused.
// - 'style': [string] CSS style for dropdown, like: 'width: 300px;'
//
export interface SimpleUIConfigData_options extends SimpleUIConfigData {
value: number; // index of enum
default: number;
enum: string[];
enumDescriptions: string[];
}
export interface SimpleUIConfigData_table extends SimpleUIConfigData {
value: { [col: string]: string }[];
default: { [col: string]: string }[];
}
// text
//
// all attrs:
// - 'style': [string] CSS style for this element, like: 'font-size: 24px;'
//
export interface SimpleUIConfigData_text extends SimpleUIConfigData {
subType?: 'raw' | 'code';
value: string;
}
// boolean
//
// all attrs:
// - 'readonly': [bool] When true, the control will be immutable by user interaction.
// - 'disabled': [bool] Prevents the user from interacting with the button––it cannot be pressed or focused.
//
export interface SimpleUIConfigData_boolean extends SimpleUIConfigData {
value: boolean;
default: boolean;
}
// divider line
//
// all attrs:
// - 'role': [string] Indicates the semantic meaning of the divider.
// The 'separator' option is the default value and indicates that the divider semantically separates content.
// The 'presentation' option indicates that the divider has no semantic value and is for visual presentation only.
//
export interface SimpleUIConfigData_divider extends SimpleUIConfigData {
// divider not have content
}
export interface SimpleUIConfigData_tag extends SimpleUIConfigData {
value: string;
}
// button
//
// all attrs:
// - 'disabled': [bool] Prevents the user from interacting with the button––it cannot be pressed or focused.
// - 'appearance': [string] Determines the visual appearance (primary, secondary) of the button.
//
export interface SimpleUIConfigData_button extends SimpleUIConfigData {
clickEvent: string; // a message will be emit when button has been clicked
}