Skip to content

Commit

Permalink
refactor(all): use the transform attribute of @input() instead of @In…
Browse files Browse the repository at this point in the history
…putBoolean() and @InputNumber()
  • Loading branch information
minlovehua committed Apr 2, 2024
1 parent df715d6 commit e076819
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/card/card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ThyCard {
* 左右是否有内边距,已废弃,如需配置间距使用 spacing 工具样式覆盖默认间距
* @deprecated
*/
@Input({ alias: 'thyHasLeftRightPadding', transform: booleanAttribute })
@Input({ transform: booleanAttribute })
thyHasLeftRightPadding: boolean | string = true;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/color-picker/color-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ export class ThyColorPickerDirective extends _BaseMixin implements OnInit, OnDes
/**
* 显示延迟时间
*/
@Input({ alias: 'thyShowDelay', transform: numberAttribute })
@Input({ transform: numberAttribute })
set thyShowDelay(value: number) {
this.showDelay = value;
}

/**
* 隐藏延迟时间
*/
@Input({ alias: 'thyHideDelay', transform: numberAttribute })
@Input({ transform: numberAttribute })
set thyHideDelay(value: number) {
this.hideDelay = value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dropdown/dropdown-menu-item.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class ThyDropdownMenuItemActiveDirective {
*/
@HostBinding('class.active')
@Input({ transform: booleanAttribute })
thyDropdownMenuItemActive: boolean | string;
thyDropdownMenuItemActive: boolean;

constructor() {}
}
4 changes: 2 additions & 2 deletions src/dropdown/dropdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class ThyDropdownDirective extends ThyOverlayDirectiveBase implements OnI
* 打开延迟毫秒
* @default 100
*/
@Input({ alias: 'thyShowDelay', transform: numberAttribute })
@Input({ transform: numberAttribute })
set thyShowDelay(value: number) {
this.showDelay = value;
}
Expand All @@ -82,7 +82,7 @@ export class ThyDropdownDirective extends ThyOverlayDirectiveBase implements OnI
* 关闭延迟毫秒
* @default 100
*/
@Input({ alias: 'thyHideDelay', transform: numberAttribute })
@Input({ transform: numberAttribute })
set thyHideDelay(value: number) {
this.hideDelay = value;
}
Expand Down
6 changes: 3 additions & 3 deletions src/menu/group/menu-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class ThyMenuGroup implements OnInit {
* 已废弃,请使用 thyCollapsed
* @deprecated
*/
@Input({ alias: 'thyExpand', transform: booleanAttribute })
@Input({ transform: booleanAttribute })
set thyExpand(value: boolean) {
this.isCollapsed = !!!value;
}
Expand All @@ -92,7 +92,7 @@ export class ThyMenuGroup implements OnInit {
* 是否处于收起状态
* @default false
*/
@Input({ alias: 'thyCollapsed', transform: booleanAttribute })
@Input({ transform: booleanAttribute })
set thyCollapsed(value: boolean) {
this.isCollapsed = value;
}
Expand All @@ -105,7 +105,7 @@ export class ThyMenuGroup implements OnInit {
/**
* 是否显示 Icon
*/
@Input({ alias: 'thyShowIcon', transform: booleanAttribute })
@Input({ transform: booleanAttribute })
set thyShowIcon(value: boolean) {
this.showIcon = value;
}
Expand Down
4 changes: 2 additions & 2 deletions src/popover/popover.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ export class ThyPopoverDirective extends ThyOverlayDirectiveBase implements OnIn
/**
* 显示延迟时间
*/
@Input({ alias: 'thyShowDelay', transform: numberAttribute })
@Input({ transform: numberAttribute })
set thyShowDelay(value: number) {
this.showDelay = value;
}

/**
* 隐藏延迟时间
*/
@Input({ alias: 'thyHideDelay', transform: numberAttribute })
@Input({ transform: numberAttribute })
set thyHideDelay(value: number) {
this.hideDelay = value;
}
Expand Down

0 comments on commit e076819

Please sign in to comment.