Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f99829d

Browse files
committedJan 16, 2025
refactor: type hostClasses() as Record<string, boolean>
1 parent 0787927 commit f99829d

26 files changed

+31
-31
lines changed
 

‎projects/coreui-angular/src/lib/accordion/accordion-button/accordion-button.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class AccordionButtonDirective {
2222
return {
2323
'accordion-button': true,
2424
collapsed: this.collapsed()
25-
};
25+
} as Record<string, boolean>;
2626
});
2727

2828
readonly ariaExpanded = computed(() => !this.collapsed());

‎projects/coreui-angular/src/lib/accordion/accordion/accordion.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export class AccordionComponent {
2929
this.#accordionService.alwaysOpen = this.alwaysOpen();
3030
});
3131

32-
readonly hostClasses = computed<Record<string, boolean>>(() => ({
32+
readonly hostClasses = computed(() => ({
3333
accordion: true,
3434
'accordion-flush': this.flush()
35-
}));
35+
}) as Record<string, boolean>);
3636
}

‎projects/coreui-angular/src/lib/button-group/button-group/button-group.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ export class ButtonGroupComponent {
3030
'btn-group': !this.vertical(),
3131
'btn-group-vertical': this.vertical(),
3232
[`btn-group-${this.size()}`]: !!this.size()
33-
};
33+
} as Record<string, boolean>;
3434
});
3535
}

‎projects/coreui-angular/src/lib/form/form-check/form-check.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ export class FormCheckComponent {
4949
[`form-switch-${sizing}`]: isSwitch && !!sizing,
5050
'form-check-inline': this.inline(),
5151
'form-check-reverse': this.reverse()
52-
};
52+
} as Record<string, boolean>;
5353
});
5454
}

‎projects/coreui-angular/src/lib/form/form-feedback/form-feedback.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ export class FormFeedbackComponent {
2727
// 'valid-tooltip': valid === true && tooltip,
2828
// 'invalid-feedback': valid !== true && !tooltip,
2929
// 'invalid-tooltip': valid !== true && tooltip
30-
};
30+
} as Record<string, boolean>;
3131
});
3232
}

‎projects/coreui-angular/src/lib/form/form-floating/form-floating.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export class FormFloatingDirective {
1414
readonly hostClasses = computed(() => {
1515
return {
1616
'form-floating': this.floating()
17-
};
17+
} as Record<string, boolean>;
1818
});
1919
}

‎projects/coreui-angular/src/lib/form/form-select/form-select.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ export class FormSelectDirective {
2525
[`form-select-${sizing}`]: !!sizing,
2626
'is-valid': valid === true,
2727
'is-invalid': valid === false
28-
};
28+
} as Record<string, boolean>;
2929
});
3030
}

‎projects/coreui-angular/src/lib/form/form/form.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ export class FormDirective {
1515
readonly hostClasses = computed(() => {
1616
return {
1717
'was-validated': this.validated()
18-
};
18+
} as Record<string, boolean>;
1919
});
2020
}

‎projects/coreui-angular/src/lib/list-group/list-group-item.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class ListGroupItemDirective {
5050
active: !!this.active(),
5151
disabled: this._disabled(),
5252
[`list-group-item-${this.color()}`]: !!this.color()
53-
};
53+
} as Record<string, boolean>;
5454
});
5555

5656
readonly _disabled = computed(() => this.disabled());

‎projects/coreui-angular/src/lib/modal/modal-dialog/modal-dialog.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ export class ModalDialogComponent {
4343
[`modal-fullscreen-${fullscreen}-down`]: typeof fullscreen === 'string',
4444
'modal-dialog-scrollable': this.scrollable(),
4545
[`modal-${size}`]: !!size
46-
};
46+
} as Record<string, boolean>;
4747
});
4848
}

‎projects/coreui-angular/src/lib/nav/nav.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ export class NavComponent {
2626
nav: true,
2727
[`nav-${layout}`]: !!layout,
2828
[`nav-${variant}`]: !!variant
29-
};
29+
} as Record<string, boolean>;
3030
});
3131
}

‎projects/coreui-angular/src/lib/placeholder/placeholder-animation.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export class PlaceholderAnimationDirective {
2222
readonly hostClasses = computed(() => {
2323
return {
2424
[`placeholder-${this.animation()}`]: this.placeholder()?.visible() && !!this.animation()
25-
};
25+
} as Record<string, boolean>;
2626
});
2727
}

‎projects/coreui-angular/src/lib/placeholder/placeholder.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ export class PlaceholderDirective {
3232
return {
3333
placeholder: this.visible(),
3434
[`placeholder-${this.size()}`]: !!this.size()
35-
};
35+
} as Record<string, boolean>;
3636
});
3737
}

‎projects/coreui-angular/src/lib/popover/popover/popover.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ export class PopoverComponent implements OnDestroy {
4848
readonly viewContainerRef = viewChild('popoverTemplate', { read: ViewContainerRef });
4949
private textNode!: Text;
5050

51-
readonly hostClasses = computed<Record<string, boolean>>(() => {
51+
readonly hostClasses = computed(() => {
5252
return {
5353
popover: true,
5454
fade: true,
5555
show: this.visible(),
5656
'bs-popover-auto': true
57-
};
57+
} as Record<string, boolean>;
5858
});
5959

6060
ngOnDestroy(): void {

‎projects/coreui-angular/src/lib/spinner/spinner.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ export class SpinnerComponent {
4949
[`spinner-${this.variant()}`]: true,
5050
[`text-${this.color()}`]: !!this.color(),
5151
[`spinner-${this.variant()}-${this.size()}`]: !!this.size()
52-
};
52+
} as Record<string, boolean>;
5353
});
5454
}

‎projects/coreui-angular/src/lib/table/table-color.directive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ export class TableColorDirective {
1313
* Use contextual color for tables, table rows or individual cells.
1414
* @return Colors
1515
*/
16-
readonly color = input<Colors>(undefined, { alias: "cTableColor" });
16+
readonly color = input<Colors>(undefined, { alias: 'cTableColor' });
1717

18-
readonly hostClasses = computed((): Record<string,boolean> => {
18+
readonly hostClasses = computed(() => {
1919
return {
2020
[`table-${this.color()}`]: !!this.color()
21-
};
21+
} as Record<string, boolean>;
2222
});
2323
}

‎projects/coreui-angular/src/lib/table/table.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class TableDirective {
106106
'table-sm': small,
107107
'table-striped': striped,
108108
'table-striped-columns': stripedColumns
109-
};
109+
} as Record<string, boolean>;
110110
});
111111

112112
readonly #responsiveWrapperEffect = effect(() => {

‎projects/coreui-angular/src/lib/tabs-2/tab-panel/tab-panel.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class TabPanelComponent {
104104
fade: this.transition(),
105105
show: this.show(),
106106
invisible: this.tabsService.activeItem()?.disabled
107-
}));
107+
}) as Record<string, boolean>);
108108

109109
@HostBinding('@.disabled')
110110
get animationDisabled(): boolean {

‎projects/coreui-angular/src/lib/tabs-2/tab/tab.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class TabDirective implements FocusableOption, OnInit {
9494
'nav-link': true,
9595
active: this.isActive(),
9696
disabled: this.#disabled()
97-
}));
97+
}) as Record<string, boolean>);
9898

9999
readonly propId = computed(() => this.id() ?? `${this.#tabsService.id()}-tab-${this.itemKey()}`);
100100

‎projects/coreui-angular/src/lib/tabs-2/tabs-list/tabs-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class TabsListComponent {
5454
nav: true,
5555
[`nav-${this.layout()}`]: this.layout(),
5656
[`nav-${this.variant()}`]: this.variant()
57-
}));
57+
}) as Record<string, boolean>);
5858

5959
readonly tabs = contentChildren(TabDirective);
6060
#focusKeyManager!: FocusKeyManager<TabDirective>;

‎projects/coreui-angular/src/lib/toast/toaster/toaster.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class ToasterComponent implements OnInit {
9696
'translate-middle-x': placement.includes('center') && !placement.includes('middle'),
9797
'translate-middle-y': placement.includes('middle') && !placement.includes('center'),
9898
'translate-middle': placement.includes('middle') && placement.includes('center')
99-
};
99+
} as Record<string, boolean>;
100100
});
101101

102102
ngOnInit(): void {

‎projects/coreui-angular/src/lib/tooltip/tooltip/tooltip.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ export class TooltipComponent implements OnDestroy {
4646
readonly viewContainerRef = viewChild('tooltipTemplate', { read: ViewContainerRef });
4747
private textNode!: Text;
4848

49-
readonly hostClasses = computed<Record<string, boolean>>(() => {
49+
readonly hostClasses = computed(() => {
5050
return {
5151
tooltip: true,
5252
fade: true,
5353
show: this.visible(),
5454
'bs-tooltip-auto': true
55-
};
55+
} as Record<string, boolean>;
5656
});
5757

5858
ngOnDestroy(): void {

‎projects/coreui-angular/src/lib/utilities/align.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ export class AlignDirective {
1717
const align = this.align();
1818
return {
1919
[`align-${align}`]: !!align
20-
};
20+
} as Record<string, boolean>;
2121
});
2222
}

‎projects/coreui-angular/src/lib/utilities/bg-color.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ export class BgColorDirective {
2323
return {
2424
[`bg-${color}`]: !!color,
2525
'bg-gradient': this.gradient()
26-
};
26+
} as Record<string, boolean>;
2727
});
2828
}

‎projects/coreui-angular/src/lib/utilities/border.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class BorderDirective {
1313
*/
1414
readonly cBorder = input<Border>(true);
1515

16-
readonly hostClasses = computed(() => {
16+
readonly hostClasses = computed<Record<string, boolean>>(() => {
1717
const border = this.cBorder();
1818
if (typeof border === 'boolean') {
1919
return { border: true };

‎projects/coreui-angular/src/lib/utilities/rounded.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class RoundedDirective {
1313
*/
1414
readonly cRounded = input<Rounded>(true);
1515

16-
readonly hostClasses = computed(() => {
16+
readonly hostClasses = computed<Record<string, boolean>>(() => {
1717
const rounded = this.cRounded();
1818
if (typeof rounded === 'boolean') {
1919
return { rounded: true };

0 commit comments

Comments
 (0)
Please sign in to comment.