diff --git a/projects/addon-mobile/components/mobile-calendar/mobile-calendar.component.ts b/projects/addon-mobile/components/mobile-calendar/mobile-calendar.component.ts index 1628a3bc23a6..1946b04ee826 100644 --- a/projects/addon-mobile/components/mobile-calendar/mobile-calendar.component.ts +++ b/projects/addon-mobile/components/mobile-calendar/mobile-calendar.component.ts @@ -128,7 +128,9 @@ export class TuiMobileCalendar implements AfterViewInit { protected readonly cancelWord$ = inject(TUI_CANCEL_WORD); protected readonly doneWord$ = inject(TUI_DONE_WORD); protected readonly unorderedWeekDays$ = inject(TUI_SHORT_WEEK_DAYS); - protected readonly chooseDayOrRangeTexts$ = inject(TUI_CHOOSE_DAY_OR_RANGE_TEXTS); + protected readonly chooseDayOrRangeTexts$ = inject(TUI_CHOOSE_DAY_OR_RANGE_TEXTS, { + optional: true, + }); protected readonly years = Array.from({length: RANGE}, (_, i) => i + STARTING_YEAR); protected readonly months = Array.from( {length: RANGE * 12}, @@ -165,7 +167,7 @@ export class TuiMobileCalendar implements AfterViewInit { constructor() { inject(TUI_VALUE_STREAM) .pipe(takeUntilDestroyed()) - .subscribe((value) => { + .subscribe(value => { this.value = value; }); } @@ -255,7 +257,7 @@ export class TuiMobileCalendar implements AfterViewInit { protected readonly disabledItemHandlerMapper: TuiMapper< [TuiBooleanHandler, TuiDay, TuiDay], TuiBooleanHandler - > = (disabledItemHandler, min, max) => (item) => + > = (disabledItemHandler, min, max) => item => item.dayBefore(min) || (max !== null && item.dayAfter(max)) || disabledItemHandler(item); @@ -367,7 +369,7 @@ export class TuiMobileCalendar implements AfterViewInit { .pipe( // Ignore smooth scroll resulting from click on the exact year windowToggle(touchstart$, () => click$), - mergeMap((x) => x), + mergeMap(x => x), // Delay is required to run months scroll in the next frame to prevent flicker delay(0), map( @@ -378,10 +380,10 @@ export class TuiMobileCalendar implements AfterViewInit { Math.floor(YEARS_IN_ROW / 2) + STARTING_YEAR, ), - filter((activeYear) => activeYear !== this.activeYear), + filter(activeYear => activeYear !== this.activeYear), takeUntilDestroyed(this.destroyRef), ) - .subscribe((activeYear) => { + .subscribe(activeYear => { this.activeMonth += this.getMonthOffset(activeYear); this.activeYear = activeYear; this.scrollToActiveMonth(); diff --git a/projects/addon-mobile/components/mobile-calendar/mobile-calendar.template.html b/projects/addon-mobile/components/mobile-calendar/mobile-calendar.template.html index f83c18adaf1f..2146719ebda7 100644 --- a/projects/addon-mobile/components/mobile-calendar/mobile-calendar.template.html +++ b/projects/addon-mobile/components/mobile-calendar/mobile-calendar.template.html @@ -1,4 +1,7 @@ -
+