Skip to content

Commit 7acd80c

Browse files
committed
feat(styles): add style interfaces for radio, button, switch and checkbox
1 parent 34071c6 commit 7acd80c

File tree

4 files changed

+160
-4
lines changed

4 files changed

+160
-4
lines changed

packages/vtable/src/body-helper/style/ButtonStyle.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,41 @@ import type { ButtonStyle as ButtonStyleThemeOption } from '../../ts-types/colum
44

55
let defaultStyle: ButtonStyle;
66

7-
export class ButtonStyle extends Style {
7+
/**
8+
* 复选框样式接口,继承自 IStyleOption
9+
*/
10+
export interface IButtonStyle extends IStyleOption {
11+
/**
12+
* 按钮的颜色
13+
*/
14+
buttonColor?: string;
15+
/**
16+
* 按钮的边框颜色
17+
*/
18+
buttonBorderColor?: string;
19+
/**
20+
* 按钮的边框宽度
21+
*/
22+
buttonLineWidth?: number;
23+
/**
24+
* 按钮的圆角半径
25+
*/
26+
buttonBorderRadius?: number;
27+
/**
28+
* 按钮悬停时的颜色
29+
*/
30+
buttonHoverColor?: string;
31+
/**
32+
* 按钮悬停时的边框颜色
33+
*/
34+
buttonHoverBorderColor?: string;
35+
/**
36+
* 按钮悬停时的文本颜色
37+
*/
38+
buttonTextHoverColor?: string;
39+
}
40+
41+
export class ButtonStyle extends Style implements IButtonStyle {
842
private _buttonColor: string;
943
private _buttonBorderColor: string;
1044
private _buttonLineWidth: number;

packages/vtable/src/body-helper/style/CheckboxStyle.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,57 @@ import type { CheckboxStyle as CheckboxStyleThemeOption } from '../../ts-types/c
44

55
let defaultStyle: CheckboxStyle;
66

7-
export class CheckboxStyle extends Style {
7+
/**
8+
* 复选框样式接口,继承自 IStyleOption
9+
*/
10+
export interface ICheckboxStyle extends IStyleOption {
11+
/**
12+
* 复选框的尺寸
13+
*/
14+
size?: number;
15+
/**
16+
* 文本与图标之间的间距
17+
*/
18+
spaceBetweenTextAndIcon?: number;
19+
/**
20+
* 默认状态下的填充颜色
21+
*/
22+
defaultFill?: string;
23+
/**
24+
* 默认状态下的边框颜色
25+
*/
26+
defaultStroke?: string;
27+
/**
28+
* 禁用状态下的填充颜色
29+
*/
30+
disableFill?: string;
31+
/**
32+
* 选中状态下的填充颜色
33+
*/
34+
checkedFill?: string;
35+
/**
36+
* 选中状态下的边框颜色
37+
*/
38+
checkedStroke?: string;
39+
/**
40+
* 禁用且选中状态下的填充颜色
41+
*/
42+
disableCheckedFill?: string;
43+
/**
44+
* 禁用且选中状态下的边框颜色
45+
*/
46+
disableCheckedStroke?: string;
47+
/**
48+
* 选中状态下的图标图片
49+
*/
50+
checkIconImage?: string;
51+
/**
52+
* 部分选中状态下的图标图片
53+
*/
54+
indeterminateIconImage?: string;
55+
}
56+
57+
export class CheckboxStyle extends Style implements ICheckboxStyle {
858
private _size: number;
959
private _spaceBetweenTextAndIcon: number;
1060

packages/vtable/src/body-helper/style/RadioStyle.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@ import type { RadioStyle as RadioStyleThemeOption } from '../../ts-types/column/
44

55
let defaultStyle: RadioStyle;
66

7-
export class RadioStyle extends Style {
7+
/**
8+
* 单选框样式接口,继承自 IStyleOption
9+
*/
10+
export interface IRadioStyle extends IStyleOption {
11+
/**
12+
* 单选框的尺寸
13+
*/
14+
size?: number;
15+
/**
16+
* 文本与图标之间的间距
17+
*/
18+
spaceBetweenTextAndIcon?: number;
19+
/**
20+
* 单元格内多个单选框,单选框直接的间距
21+
*/
22+
spaceBetweenRadio?: number;
23+
/**
24+
* 单选框的外部半径
25+
*/
26+
outerRadius?: number;
27+
/**
28+
* 单选框的内部半径
29+
*/
30+
innerRadius?: number;
31+
}
32+
33+
export class RadioStyle extends Style implements IRadioStyle {
834
private _size: number;
935
private _spaceBetweenTextAndIcon: number;
1036
private _spaceBetweenRadio: number;

packages/vtable/src/body-helper/style/SwitchStyle.ts

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,53 @@ import type { SwitchStyle as SwitchStyleThemeOption } from '../../ts-types/colum
44

55
let defaultStyle: SwitchStyle;
66

7-
export class SwitchStyle extends Style {
7+
/**
8+
* 开关样式接口,继承自 IStyleOption
9+
*/
10+
export interface ISwitchStyle extends IStyleOption {
11+
/**
12+
* 开关的尺寸
13+
*/
14+
size?: number;
15+
/**
16+
* 文本与开关之间的间距
17+
*/
18+
spaceBetweenTextAndCircle?: number;
19+
/**
20+
* 开关的圆半径
21+
*/
22+
circleRadius?: number;
23+
/**
24+
* 开关的宽度
25+
*/
26+
boxWidth?: number;
27+
/**
28+
* 开关的高度
29+
*/
30+
boxHeight?: number;
31+
/**
32+
* 选中状态下的填充颜色
33+
*/
34+
checkedFill?: string;
35+
/**
36+
* 未选中状态下的填充颜色
37+
*/
38+
uncheckedFill?: string;
39+
/**
40+
* 禁用且选中状态下的填充颜色
41+
*/
42+
disableCheckedFill?: string;
43+
/**
44+
* 禁用且未选中状态下的填充颜色
45+
*/
46+
disableUncheckedFill?: string;
47+
/**
48+
* 开关圆的填充颜色
49+
*/
50+
circleFill?: string;
51+
}
52+
53+
export class SwitchStyle extends Style implements ISwitchStyle {
854
private _spaceBetweenTextAndCircle: number;
955
private _circleRadius: number;
1056
private _boxWidth: number;

0 commit comments

Comments
 (0)