Skip to content

Commit 027ee0c

Browse files
committed
- Optimize configuration ui
1 parent 46d3fbf commit 027ee0c

3 files changed

Lines changed: 64 additions & 4 deletions

File tree

res/html/builder_options/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

res/html/simple_config_ui/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SimpleUIDef.ts

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,23 @@ export interface SimpleUIConfig {
77

88
iconName?: string;
99

10+
btns?: {
11+
'submit'?: SimpleUIBtnInfo;
12+
'reset'?: SimpleUIBtnInfo;
13+
};
14+
1015
items: {
1116
[key: string]: SimpleUIConfigItem;
1217
};
1318
};
1419

20+
export interface SimpleUIBtnInfo {
21+
22+
title: string; // title for button
23+
24+
disabled?: boolean; // button is disabled
25+
}
26+
1527
export interface SimpleUIConfigData {
1628

1729
value: any;
@@ -21,7 +33,7 @@ export interface SimpleUIConfigData {
2133

2234
export interface SimpleUIConfigItem {
2335

24-
type: 'input' | 'options' | 'table' | 'text' | 'bool';
36+
type: 'input' | 'options' | 'table' | 'text' | 'bool' | 'divider' | 'tag';
2537

2638
attrs: { [key: string]: string | boolean | number };
2739

@@ -34,9 +46,23 @@ export interface SimpleUIConfigItem {
3446
SimpleUIConfigData_options |
3547
SimpleUIConfigData_table |
3648
SimpleUIConfigData_text |
37-
SimpleUIConfigData_boolean;
49+
SimpleUIConfigData_boolean |
50+
SimpleUIConfigData_divider |
51+
SimpleUIConfigData_tag;
3852
};
3953

54+
// input box
55+
//
56+
// all attrs:
57+
// - 'singleLine': [bool] Make it as a single line input box.
58+
// - 'size': [number] Sets the width of the element to a specified number of characters.
59+
// - 'readonly': [bool] When true, the control will be immutable by any user interaction.
60+
// - 'disabled': [bool] Prevents the user from interacting with the button––it cannot be pressed or focused.
61+
//
62+
// attrs only for multi-line input boxs:
63+
// - 'rows': [number] Sizes the component vertically by a number of character rows.
64+
// - 'resize': [string] The resize mode of the component. Options: 'none', 'vertical', 'horizontal', 'both'.
65+
//
4066
export interface SimpleUIConfigData_input extends SimpleUIConfigData {
4167

4268
value: string;
@@ -46,6 +72,11 @@ export interface SimpleUIConfigData_input extends SimpleUIConfigData {
4672
placeHolder?: string;
4773
}
4874

75+
// options box
76+
//
77+
// all attrs:
78+
// - 'disabled': [bool] Prevents the user from interacting with the button––it cannot be pressed or focused.
79+
//
4980
export interface SimpleUIConfigData_options extends SimpleUIConfigData {
5081

5182
value: number; // index of enum
@@ -64,14 +95,43 @@ export interface SimpleUIConfigData_table extends SimpleUIConfigData {
6495
default: { [col: string]: string }[];
6596
}
6697

98+
// text
99+
//
100+
// all attrs:
101+
// - 'style': [string] CSS style for this element, like: 'font-size: 24px;'
102+
//
67103
export interface SimpleUIConfigData_text extends SimpleUIConfigData {
68104

105+
subType?: 'raw' | 'code';
106+
69107
value: string;
70108
}
71109

110+
// boolean
111+
//
112+
// all attrs:
113+
// - 'readonly': [bool] When true, the control will be immutable by user interaction.
114+
// - 'disabled': [bool] Prevents the user from interacting with the button––it cannot be pressed or focused.
115+
//
72116
export interface SimpleUIConfigData_boolean extends SimpleUIConfigData {
73117

74118
value: boolean;
75119

76120
default: boolean;
77121
}
122+
123+
// divider line
124+
//
125+
// all attrs:
126+
// - 'role': [string] Indicates the semantic meaning of the divider.
127+
// The 'separator' option is the default value and indicates that the divider semantically separates content.
128+
// The 'presentation' option indicates that the divider has no semantic value and is for visual presentation only.
129+
//
130+
export interface SimpleUIConfigData_divider extends SimpleUIConfigData {
131+
// divider not have content
132+
}
133+
134+
export interface SimpleUIConfigData_tag extends SimpleUIConfigData {
135+
136+
value: string;
137+
}

0 commit comments

Comments
 (0)