Skip to content

Commit

Permalink
fix(material/datepicker): remove dependency on NgClass (#28865)
Browse files Browse the repository at this point in the history
We can set classes directly through `[class]` instead of having to import `NgClass`.
  • Loading branch information
crisbeto committed Apr 15, 2024
1 parent b3298f1 commit 524fe62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/material/datepicker/datepicker-base.ts
Expand Up @@ -74,7 +74,7 @@ import {
MatDateRangeSelectionStrategy,
} from './date-range-selection-strategy';
import {MatDatepickerIntl} from './datepicker-intl';
import {DOCUMENT, NgClass} from '@angular/common';
import {DOCUMENT} from '@angular/common';
import {MatButton} from '@angular/material/button';
import {CdkTrapFocus} from '@angular/cdk/a11y';

Expand Down Expand Up @@ -135,7 +135,7 @@ export const MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [CdkTrapFocus, MatCalendar, NgClass, CdkPortalOutlet, MatButton],
imports: [CdkTrapFocus, MatCalendar, CdkPortalOutlet, MatButton],
})
export class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>>
implements OnInit, AfterViewInit, OnDestroy
Expand Down Expand Up @@ -446,10 +446,7 @@ export abstract class MatDatepickerBase<
/** Emits when the datepicker has been closed. */
@Output('closed') readonly closedStream = new EventEmitter<void>();

/**
* Classes to be passed to the date picker panel.
* Supports string and string array values, similar to `ngClass`.
*/
/** Classes to be passed to the date picker panel. */
@Input()
get panelClass(): string | string[] {
return this._panelClass;
Expand Down
2 changes: 1 addition & 1 deletion src/material/datepicker/datepicker-content.html
Expand Up @@ -8,7 +8,7 @@
[class.mat-datepicker-content-container-with-actions]="_actionsPortal">
<mat-calendar
[id]="datepicker.id"
[ngClass]="datepicker.panelClass"
[class]="datepicker.panelClass"
[startAt]="datepicker.startAt"
[startView]="datepicker.startView"
[minDate]="datepicker._getMinDate()"
Expand Down

0 comments on commit 524fe62

Please sign in to comment.