@@ -13,14 +13,17 @@ import {
1313 ElementRef ,
1414 ChangeDetectorRef ,
1515 ChangeDetectionStrategy ,
16+ inject ,
17+ DestroyRef ,
18+ AfterContentChecked
1619} from '@angular/core' ;
1720import { NG_VALUE_ACCESSOR } from '@angular/forms' ;
1821import { TitleCasePipe } from '@angular/common' ;
1922import { CalendarSelection , ScrollDirection } from '../../calendar/calendar' ;
2023import { IgxDayItemComponent } from './day-item.component' ;
2124import { DateRangeType } from '../../core/dates' ;
2225import { IgxCalendarBaseDirective } from '../calendar-base' ;
23- import { PlatformUtil , intoChunks } from '../../core/utils' ;
26+ import { PlatformUtil , intoChunks , getComponentTheme } from '../../core/utils' ;
2427import { IViewChangingEventArgs } from './days-view.interface' ;
2528import {
2629 areSameMonth ,
@@ -31,6 +34,7 @@ import {
3134 isDateInRanges ,
3235} from "../common/helpers" ;
3336import { CalendarDay } from '../common/model' ;
37+ import { IgxTheme , THEME_TOKEN , ThemeToken } from "../../services/theme/theme.token" ;
3438
3539let NEXT_ID = 0 ;
3640
@@ -47,7 +51,7 @@ let NEXT_ID = 0;
4751 changeDetection : ChangeDetectionStrategy . OnPush ,
4852 imports : [ IgxDayItemComponent , TitleCasePipe ]
4953} )
50- export class IgxDaysViewComponent extends IgxCalendarBaseDirective {
54+ export class IgxDaysViewComponent extends IgxCalendarBaseDirective implements AfterContentChecked {
5155 #standalone = true ;
5256
5357 /**
@@ -197,6 +201,33 @@ export class IgxDaysViewComponent extends IgxCalendarBaseDirective {
197201 private _hideTrailingDays : boolean ;
198202 private _showActiveDay : boolean ;
199203
204+ private _destroyRef = inject ( DestroyRef ) ;
205+ private _theme : IgxTheme ;
206+
207+ @HostBinding ( 'class.igx-days-view' )
208+ public defaultClass = true ;
209+
210+ // Theme-specific classes
211+ @HostBinding ( 'class.igx-days-view--material' )
212+ protected get isMaterial ( ) : boolean {
213+ return this . _theme === 'material' ;
214+ }
215+
216+ @HostBinding ( 'class.igx-days-view--fluent' )
217+ protected get isFluent ( ) : boolean {
218+ return this . _theme === 'fluent' ;
219+ }
220+
221+ @HostBinding ( 'class.igx-days-view--bootstrap' )
222+ protected get isBootstrap ( ) : boolean {
223+ return this . _theme === 'bootstrap' ;
224+ }
225+
226+ @HostBinding ( 'class.igx-days-view--indigo' )
227+ protected get isIndigo ( ) : boolean {
228+ return this . _theme === 'indigo' ;
229+ }
230+
200231 /**
201232 * @hidden
202233 */
@@ -205,8 +236,37 @@ export class IgxDaysViewComponent extends IgxCalendarBaseDirective {
205236 @Inject ( LOCALE_ID ) _localeId : string ,
206237 protected el : ElementRef ,
207238 public override cdr : ChangeDetectorRef ,
239+ @Inject ( THEME_TOKEN ) private themeToken : ThemeToken
240+
208241 ) {
209242 super ( platform , _localeId , null , cdr ) ;
243+
244+ this . _theme = this . themeToken . theme ;
245+
246+ const themeChange = this . themeToken . onChange ( ( theme ) => {
247+ if ( this . _theme !== theme ) {
248+ this . _theme = theme ;
249+ this . cdr . detectChanges ( ) ;
250+ }
251+ } ) ;
252+
253+ this . _destroyRef . onDestroy ( ( ) => themeChange . unsubscribe ( ) ) ;
254+ }
255+
256+ private setComponentTheme ( ) {
257+ // allow DOM theme override (same pattern as input-group)
258+ if ( ! this . themeToken . preferToken ) {
259+ const theme = getComponentTheme ( this . el . nativeElement ) ;
260+
261+ if ( theme && theme !== this . _theme ) {
262+ this . _theme = theme ;
263+ this . cdr . markForCheck ( ) ;
264+ }
265+ }
266+ }
267+
268+ public ngAfterContentChecked ( ) {
269+ this . setComponentTheme ( ) ;
210270 }
211271
212272 /**
0 commit comments