@@ -26,13 +26,12 @@ import {
2626 Renderer2 ,
2727} from '@angular/core' ;
2828import { _IdGenerator } from '@angular/cdk/a11y' ;
29- import { NgClass } from '@angular/common' ;
3029import { _CdkPrivateStyleLoader } from '@angular/cdk/private' ;
3130import { _StructuralStylesLoader } from '../core' ;
3231import { MatDatepickerIntl } from './datepicker-intl' ;
3332
3433/** Extra CSS classes that can be associated with a calendar cell. */
35- export type MatCalendarCellCssClasses = string | string [ ] | Set < string > | { [ key : string ] : any } ;
34+ export type MatCalendarCellCssClasses = string | string [ ] | Set < string > | Record < string , any > ;
3635
3736/** Function that can generate the extra classes that should be added to a calendar cell. */
3837export type MatCalendarCellClassFunction < D > = (
@@ -48,16 +47,19 @@ let uniqueIdCounter = 0;
4847 */
4948export class MatCalendarCell < D = any > {
5049 readonly id = uniqueIdCounter ++ ;
50+ readonly cssClasses : string | string [ ] | Record < string , any > | undefined ;
5151
5252 constructor (
5353 public value : number ,
5454 public displayValue : string ,
5555 public ariaLabel : string ,
5656 public enabled : boolean ,
57- public cssClasses : MatCalendarCellCssClasses = { } ,
57+ cssClasses ? : MatCalendarCellCssClasses ,
5858 public compareValue = value ,
5959 public rawValue ?: D ,
60- ) { }
60+ ) {
61+ this . cssClasses = cssClasses instanceof Set ? Array . from ( cssClasses ) : cssClasses ;
62+ }
6163}
6264
6365/** Event emitted when a date inside the calendar is triggered as a result of a user action. */
@@ -95,7 +97,6 @@ const passiveEventOptions = {passive: true};
9597 exportAs : 'matCalendarBody' ,
9698 encapsulation : ViewEncapsulation . None ,
9799 changeDetection : ChangeDetectionStrategy . OnPush ,
98- imports : [ NgClass ] ,
99100} )
100101export class MatCalendarBody < D = any > implements OnChanges , OnDestroy , AfterViewChecked {
101102 private _elementRef = inject < ElementRef < HTMLElement > > ( ElementRef ) ;
0 commit comments