@coreui/angular-pro 5.2.20 → 5.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/esm2022/lib/calendar/calendar/calendar.component.mjs +312 -410
  2. package/esm2022/lib/calendar/calendar-month/calendar-class-month.pipe.mjs +3 -2
  3. package/esm2022/lib/calendar/calendar-month/calendar-class-row.pipe.mjs +2 -4
  4. package/esm2022/lib/calendar/calendar-month/calendar-day.directive.mjs +2 -2
  5. package/esm2022/lib/calendar/calendar-month/calendar-month.component.mjs +182 -262
  6. package/esm2022/lib/calendar/calendar-month/calendar-row.directive.mjs +33 -31
  7. package/esm2022/lib/calendar/calendar-navigation/calendar-navigation.component.mjs +41 -13
  8. package/esm2022/lib/calendar/calendar.service.mjs +13 -10
  9. package/esm2022/lib/calendar/calendar.utils.mjs +19 -12
  10. package/esm2022/lib/date-picker/date-picker.component.mjs +23 -26
  11. package/esm2022/lib/date-range-picker/date-range-picker/date-range-picker.component.mjs +193 -295
  12. package/fesm2022/coreui-angular-pro.mjs +803 -1044
  13. package/fesm2022/coreui-angular-pro.mjs.map +1 -1
  14. package/lib/calendar/calendar/calendar.component.d.ts +60 -80
  15. package/lib/calendar/calendar-month/calendar-class-row.pipe.d.ts +2 -1
  16. package/lib/calendar/calendar-month/calendar-month.component.d.ts +33 -59
  17. package/lib/calendar/calendar-month/calendar-row.directive.d.ts +1 -1
  18. package/lib/calendar/calendar-navigation/calendar-navigation.component.d.ts +16 -6
  19. package/lib/calendar/calendar.service.d.ts +11 -3
  20. package/lib/calendar/calendar.utils.d.ts +4 -3
  21. package/lib/date-picker/date-picker.component.d.ts +9 -10
  22. package/lib/date-range-picker/date-range-picker/date-range-picker.component.d.ts +65 -94
  23. package/package.json +2 -2
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Directive, Input, TemplateRef, Renderer2, booleanAttribute, NgModule, input, computed, Injectable, effect, Component, output, contentChildren, EventEmitter, HostBinding, Output, ContentChildren, HostListener, DestroyRef, signal, RendererFactory2, Pipe, numberAttribute, ViewChildren, PLATFORM_ID, Inject, afterNextRender, ViewChild, forwardRef, ContentChild, Optional, model, ChangeDetectionStrategy, ChangeDetectorRef, NgZone, contentChild, viewChild, ViewContainerRef, viewChildren, untracked } from '@angular/core';
2
+ import { inject, ElementRef, Directive, Input, TemplateRef, Renderer2, booleanAttribute, NgModule, input, computed, Injectable, effect, Component, output, contentChildren, EventEmitter, HostBinding, Output, ContentChildren, HostListener, DestroyRef, signal, RendererFactory2, numberAttribute, Pipe, ViewChildren, model, PLATFORM_ID, Inject, afterNextRender, ViewChild, forwardRef, ContentChild, Optional, viewChild, ChangeDetectionStrategy, ChangeDetectorRef, NgZone, contentChild, ViewContainerRef, viewChildren, untracked } from '@angular/core';
3
3
  import { NgTemplateOutlet, DOCUMENT, NgClass, NgOptimizedImage, AsyncPipe, NgStyle, isPlatformServer, isPlatformBrowser, formatDate, I18nPluralPipe, JsonPipe } from '@angular/common';
4
4
  import * as i1 from '@angular/animations';
5
5
  import { animation, animate, style, useAnimation, trigger, state, transition, group, query } from '@angular/animations';
6
- import { takeUntilDestroyed, toObservable, outputToObservable, toSignal } from '@angular/core/rxjs-interop';
6
+ import { takeUntilDestroyed, toObservable, toSignal } from '@angular/core/rxjs-interop';
7
7
  import { fromEvent, Subject, BehaviorSubject, Observable, skip, merge, takeWhile, distinctUntilChanged as distinctUntilChanged$1, map as map$1, debounceTime as debounceTime$1 } from 'rxjs';
8
8
  import * as i1$1 from '@angular/router';
9
9
  import { RouterModule, NavigationEnd, RouterLink } from '@angular/router';
@@ -12,8 +12,9 @@ import * as i1$2 from '@angular/cdk/a11y';
12
12
  import { FocusMonitor, A11yModule, FocusKeyManager } from '@angular/cdk/a11y';
13
13
  import * as i1$3 from '@angular/forms';
14
14
  import { FormGroup, FormControl, Validators, NG_VALUE_ACCESSOR, ReactiveFormsModule, FormsModule } from '@angular/forms';
15
- import { createPopper } from '@popperjs/core';
16
15
  import * as i1$4 from '@angular/cdk/layout';
16
+ import { BreakpointObserver } from '@angular/cdk/layout';
17
+ import { createPopper } from '@popperjs/core';
17
18
  import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
18
19
  import { SelectionModel } from '@angular/cdk/collections';
19
20
  import { IconDirective } from '@coreui/icons-angular';
@@ -1720,19 +1721,23 @@ function dateTransform(value) {
1720
1721
  const convertIsoWeekToDate = (isoWeek) => {
1721
1722
  const [year, week] = isoWeek.split(/w/i);
1722
1723
  // Get date for 4th of January for year
1723
- const date = new Date(Number(year), 0, 4);
1724
+ const date = new Date(parseInt(year), 0, 4);
1724
1725
  // Get previous Monday, add 7 days for each week after first
1725
- date.setDate(date.getDate() - (date.getDay() || 7) + 1 + (Number(week) - 1) * 7);
1726
+ date.setDate(date.getDate() - (date.getDay() || 7) + 1 + (parseInt(week ?? 1) - 1) * 7);
1726
1727
  return date;
1727
1728
  };
1728
- const convertToDateObject = (date, selectionType) => {
1729
+ const convertToDateObject = (date, selectionType, propName) => {
1729
1730
  if (date instanceof Date) {
1730
- return date;
1731
+ return new Date(date);
1732
+ }
1733
+ if (isValidDate(date)) {
1734
+ return new Date(date);
1731
1735
  }
1732
1736
  if (selectionType === 'week') {
1733
1737
  return convertIsoWeekToDate(date);
1734
1738
  }
1735
- return new Date(Date.parse(date));
1739
+ return tryDate(date, propName ?? 'convertToDateObject');
1740
+ // return new Date(Date.parse(date));
1736
1741
  };
1737
1742
  const convertToLocalDate = (d, locale, options = {}) => d.toLocaleDateString(locale, options);
1738
1743
  const convertToLocalTime = (d, locale, options = {}) => d.toLocaleTimeString(locale, options);
@@ -1958,6 +1963,9 @@ const isLastDayOfMonth = (date) => {
1958
1963
  test.setDate(test.getDate() + 1);
1959
1964
  return test.getMonth() !== month;
1960
1965
  };
1966
+ const equalDates = (a, b) => {
1967
+ return (a && b && a.getTime() === b.getTime()) || (a === null && b === null);
1968
+ };
1961
1969
  const isSameDateAs = (date, date2) => {
1962
1970
  return (date.getDate() == date2.getDate() &&
1963
1971
  date.getMonth() == date2.getMonth() &&
@@ -2010,19 +2018,19 @@ const tryDate = (value, propName = 'date') => {
2010
2018
  }
2011
2019
  return _value;
2012
2020
  };
2013
- const isDateInRangeDisabled = (startDate, endDate, dates) => {
2014
- if (!dates || !dates.length) {
2021
+ const isDateInRangeDisabled = (startDate, endDate, dates, dateFilter) => {
2022
+ if ((!dates || !dates.length) && !dateFilter) {
2015
2023
  return false;
2016
2024
  }
2017
2025
  if (startDate && endDate) {
2018
2026
  const date = new Date(startDate);
2019
2027
  let disabled = false;
2020
- while (date < endDate) {
2021
- date.setDate(date.getDate() + 1);
2022
- if (isDateDisabled(date, null, null, dates)) {
2023
- disabled = true;
2028
+ while (date <= endDate) {
2029
+ disabled = isDateDisabled(date, null, null, dates) || (dateFilter ? !dateFilter(date) : false);
2030
+ if (disabled) {
2024
2031
  break;
2025
2032
  }
2033
+ date.setDate(date.getDate() + 1);
2026
2034
  }
2027
2035
  return disabled;
2028
2036
  }
@@ -2101,6 +2109,7 @@ const isDateInRangeDisabled = (startDate, endDate, dates) => {
2101
2109
  // // getDate('12/07/1997');
2102
2110
 
2103
2111
  class CalendarService {
2112
+ #differ;
2104
2113
  constructor(keyValueDiffers) {
2105
2114
  this.keyValueDiffers = keyValueDiffers;
2106
2115
  this.calendarStateObject = {
@@ -2122,12 +2131,14 @@ class CalendarService {
2122
2131
  selectAdjacentDays: false,
2123
2132
  selectionType: 'day',
2124
2133
  showWeekNumber: false,
2125
- weekNumbersLabel: undefined
2134
+ weekNumbersLabel: undefined,
2135
+ firstDayOfWeek: 1
2126
2136
  };
2127
- this.calendarState = new BehaviorSubject(this.calendarStateObject);
2128
- this.calendarState$ = this.calendarState.asObservable();
2129
- this.differ = this.keyValueDiffers.find(this.calendarStateObject).create();
2137
+ this.#calendarState = new BehaviorSubject(this.calendarStateObject);
2138
+ this.calendarState$ = this.#calendarState.asObservable();
2139
+ this.#differ = this.keyValueDiffers.find(this.calendarStateObject).create();
2130
2140
  }
2141
+ #calendarState;
2131
2142
  update(state) {
2132
2143
  const keys = Object.keys(state);
2133
2144
  for (const key of keys) {
@@ -2140,15 +2151,15 @@ class CalendarService {
2140
2151
  }
2141
2152
  this.calendarStateObject[key] = state[key];
2142
2153
  }
2143
- if (this.differ) {
2144
- const changes = this.differ.diff(this.calendarStateObject);
2154
+ if (this.#differ) {
2155
+ const changes = this.#differ.diff(this.calendarStateObject);
2145
2156
  if (changes) {
2146
2157
  const newState = { ...this.calendarStateObject };
2147
- changes.forEachChangedItem(item => {
2148
- // console.log('changes', item.key, item, );
2158
+ changes.forEachChangedItem((item) => {
2159
+ // console.log('changes', item.key, item);
2149
2160
  newState[item.key] = item.currentValue;
2150
2161
  });
2151
- this.calendarState.next(newState);
2162
+ this.#calendarState.next(newState);
2152
2163
  }
2153
2164
  }
2154
2165
  }
@@ -2161,24 +2172,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
2161
2172
 
2162
2173
  class CalendarNavigationComponent {
2163
2174
  #destroyRef;
2164
- constructor(calendarService) {
2165
- this.calendarService = calendarService;
2175
+ #calendarService;
2176
+ constructor() {
2166
2177
  this.#destroyRef = inject(DestroyRef);
2167
- this.addMonths = input(0);
2178
+ this.#calendarService = inject(CalendarService);
2179
+ this.pageIndex = input(0, { transform: numberAttribute });
2180
+ this.addMonths = computed(() => {
2181
+ const view = this.view();
2182
+ const pageIndex = this.pageIndex();
2183
+ return pageIndex * (view === 'years' ? 144 : view === 'months' ? 12 : 1);
2184
+ });
2168
2185
  this.navigation = input(true);
2186
+ this.maxDate = signal(null);
2187
+ this.minDate = signal(null);
2169
2188
  this.calendarDate = signal(new Date());
2170
2189
  this.navYearFirst = signal(false);
2171
2190
  this.locale = signal('default');
2172
2191
  this.view = signal('days');
2173
- this.selectionType = 'day';
2192
+ this.selectionType = signal('day');
2193
+ this.ariaNextMonthLabel = input('Next month');
2194
+ this.ariaNextYearLabel = input('Next year');
2195
+ this.ariaPrevMonthLabel = input('Previous month');
2196
+ this.ariaPrevYearLabel = input('Previous year');
2174
2197
  this.navigationClick = output();
2175
2198
  this.date = computed(() => {
2176
2199
  return new Date(this.calendarDate().getFullYear(), this.calendarDate().getMonth() + this.addMonths());
2177
2200
  });
2201
+ this.disableNextMonth = computed(() => {
2202
+ const maxDate = this.maxDate();
2203
+ return maxDate ? this.date() >= maxDate : false;
2204
+ });
2205
+ this.disablePrevMonth = computed(() => {
2206
+ const minDate = this.minDate();
2207
+ return minDate ? this.date() <= minDate : false;
2208
+ });
2209
+ this.disableNextYear = computed(() => {
2210
+ const maxDate = this.maxDate();
2211
+ return maxDate ? this.date().getFullYear() + 1 >= maxDate.getFullYear() : false;
2212
+ });
2213
+ this.disablePrevYear = computed(() => {
2214
+ const minDate = this.minDate();
2215
+ return minDate ? this.date().getFullYear() - 1 <= minDate.getFullYear() : false;
2216
+ });
2178
2217
  this.calendarStateSubscribe();
2179
2218
  }
2180
2219
  calendarStateSubscribe() {
2181
- this.calendarService.calendarState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((state) => {
2220
+ this.#calendarService.calendarState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((state) => {
2182
2221
  const keys = Object.keys(state);
2183
2222
  for (const key of keys) {
2184
2223
  if (key in this) {
@@ -2191,7 +2230,7 @@ class CalendarNavigationComponent {
2191
2230
  }
2192
2231
  setView(view) {
2193
2232
  this.view.set(view);
2194
- this.calendarService.update({ view: view });
2233
+ this.#calendarService.update({ view: view });
2195
2234
  }
2196
2235
  handleNavigationClick(direction, years = false) {
2197
2236
  this.navigationClick.emit({ direction, years: years });
@@ -2202,15 +2241,15 @@ class CalendarNavigationComponent {
2202
2241
  this.handleNavigationClick(direction, years);
2203
2242
  }
2204
2243
  }
2205
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarNavigationComponent, deps: [{ token: CalendarService }], target: i0.ɵɵFactoryTarget.Component }); }
2206
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: CalendarNavigationComponent, isStandalone: true, selector: "c-calendar-navigation", inputs: { addMonths: { classPropertyName: "addMonths", publicName: "addMonths", isSignal: true, isRequired: false, transformFunction: null }, navigation: { classPropertyName: "navigation", publicName: "navigation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { navigationClick: "navigationClick" }, host: { classAttribute: "calendar-nav" }, ngImport: i0, template: "@if (navigation()) {\n <div class=\"calendar-nav-prev\">\n <button\n (click)=\"handleNavigationClick('prev', true)\"\n (keyup)=\"handleNavigationKeyUp($event, 'prev', true)\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-double-prev\"></span>\n </button>\n @if (view() === 'days') {\n <button\n (click)=\"handleNavigationClick('prev')\"\n (keyup)=\"handleNavigationKeyUp($event, 'prev')\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-prev\"></span>\n </button>\n }\n </div>\n}\n<div [ngStyle]=\"navYearFirst() ? { display: 'flex', justifyContent: 'center' } : {}\" aria-live=\"polite\" class=\"calendar-nav-date\">\n @if (view() === 'days') {\n <button\n (click)=\"setView('months')\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n {{ date().toLocaleDateString(locale(), { month: 'long' }) }}\n </button>\n }\n <button\n (click)=\"setView('years')\"\n [ngStyle]=\"navYearFirst() ? { order: '-1' } : {}\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n {{ date().toLocaleDateString(locale(), { year: 'numeric' }) }}\n </button>\n</div>\n@if (navigation()) {\n <div class=\"calendar-nav-next\">\n @if (view() === 'days') {\n <button\n (click)=\"handleNavigationClick('next')\"\n (keyup)=\"handleNavigationKeyUp($event, 'next')\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-next\"></span>\n </button>\n }\n <button\n (click)=\"handleNavigationClick('next', true)\"\n (keyup)=\"handleNavigationKeyUp($event, 'next', true)\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-double-next\"></span>\n </button>\n </div>\n}\n", styles: [""], dependencies: [{ kind: "directive", type: ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "type", "variant"], exportAs: ["cButton"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
2244
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarNavigationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2245
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: CalendarNavigationComponent, isStandalone: true, selector: "c-calendar-navigation", inputs: { pageIndex: { classPropertyName: "pageIndex", publicName: "pageIndex", isSignal: true, isRequired: false, transformFunction: null }, navigation: { classPropertyName: "navigation", publicName: "navigation", isSignal: true, isRequired: false, transformFunction: null }, ariaNextMonthLabel: { classPropertyName: "ariaNextMonthLabel", publicName: "ariaNextMonthLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaNextYearLabel: { classPropertyName: "ariaNextYearLabel", publicName: "ariaNextYearLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaPrevMonthLabel: { classPropertyName: "ariaPrevMonthLabel", publicName: "ariaPrevMonthLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaPrevYearLabel: { classPropertyName: "ariaPrevYearLabel", publicName: "ariaPrevYearLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { navigationClick: "navigationClick" }, host: { classAttribute: "calendar-nav" }, ngImport: i0, template: "@if (navigation()) {\n <div class=\"calendar-nav-prev\">\n <button\n (click)=\"handleNavigationClick('prev', true)\"\n (keyup)=\"handleNavigationKeyUp($event, 'prev', true)\"\n cButton\n [disabled]=\"disablePrevYear()\"\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaPrevYearLabel()\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-double-prev\"></span>\n </button>\n @if (view() === 'days') {\n <button\n (click)=\"handleNavigationClick('prev')\"\n (keyup)=\"handleNavigationKeyUp($event, 'prev')\"\n cButton\n [disabled]=\"disablePrevMonth()\"\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaPrevMonthLabel()\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-prev\"></span>\n </button>\n }\n </div>\n}\n<div [ngStyle]=\"navYearFirst() ? { display: 'flex', justifyContent: 'center' } : {}\" aria-live=\"polite\" class=\"calendar-nav-date\">\n @if (view() === 'days') {\n <button\n (click)=\"setView('months')\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n {{ date().toLocaleDateString(locale(), { month: 'long' }) }}\n </button>\n }\n <button\n (click)=\"setView('years')\"\n [ngStyle]=\"navYearFirst() ? { order: '-1' } : {}\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n {{ date().toLocaleDateString(locale(), { year: 'numeric' }) }}\n </button>\n</div>\n@if (navigation()) {\n <div class=\"calendar-nav-next\">\n @if (view() === 'days') {\n <button\n (click)=\"handleNavigationClick('next')\"\n (keyup)=\"handleNavigationKeyUp($event, 'next')\"\n [disabled]=\"disableNextMonth()\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaNextMonthLabel()\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-next\"></span>\n </button>\n }\n <button\n (click)=\"handleNavigationClick('next', true)\"\n (keyup)=\"handleNavigationKeyUp($event, 'next', true)\"\n cButton\n [disabled]=\"disableNextYear()\"\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaNextYearLabel()\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-double-next\"></span>\n </button>\n </div>\n}\n", styles: [""], dependencies: [{ kind: "directive", type: ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "type", "variant"], exportAs: ["cButton"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
2207
2246
  }
2208
2247
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarNavigationComponent, decorators: [{
2209
2248
  type: Component,
2210
2249
  args: [{ selector: 'c-calendar-navigation', standalone: true, imports: [ButtonDirective, NgStyle], host: {
2211
2250
  class: 'calendar-nav'
2212
- }, template: "@if (navigation()) {\n <div class=\"calendar-nav-prev\">\n <button\n (click)=\"handleNavigationClick('prev', true)\"\n (keyup)=\"handleNavigationKeyUp($event, 'prev', true)\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-double-prev\"></span>\n </button>\n @if (view() === 'days') {\n <button\n (click)=\"handleNavigationClick('prev')\"\n (keyup)=\"handleNavigationKeyUp($event, 'prev')\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-prev\"></span>\n </button>\n }\n </div>\n}\n<div [ngStyle]=\"navYearFirst() ? { display: 'flex', justifyContent: 'center' } : {}\" aria-live=\"polite\" class=\"calendar-nav-date\">\n @if (view() === 'days') {\n <button\n (click)=\"setView('months')\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n {{ date().toLocaleDateString(locale(), { month: 'long' }) }}\n </button>\n }\n <button\n (click)=\"setView('years')\"\n [ngStyle]=\"navYearFirst() ? { order: '-1' } : {}\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n {{ date().toLocaleDateString(locale(), { year: 'numeric' }) }}\n </button>\n</div>\n@if (navigation()) {\n <div class=\"calendar-nav-next\">\n @if (view() === 'days') {\n <button\n (click)=\"handleNavigationClick('next')\"\n (keyup)=\"handleNavigationKeyUp($event, 'next')\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-next\"></span>\n </button>\n }\n <button\n (click)=\"handleNavigationClick('next', true)\"\n (keyup)=\"handleNavigationKeyUp($event, 'next', true)\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-double-next\"></span>\n </button>\n </div>\n}\n" }]
2213
- }], ctorParameters: () => [{ type: CalendarService }] });
2251
+ }, template: "@if (navigation()) {\n <div class=\"calendar-nav-prev\">\n <button\n (click)=\"handleNavigationClick('prev', true)\"\n (keyup)=\"handleNavigationKeyUp($event, 'prev', true)\"\n cButton\n [disabled]=\"disablePrevYear()\"\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaPrevYearLabel()\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-double-prev\"></span>\n </button>\n @if (view() === 'days') {\n <button\n (click)=\"handleNavigationClick('prev')\"\n (keyup)=\"handleNavigationKeyUp($event, 'prev')\"\n cButton\n [disabled]=\"disablePrevMonth()\"\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaPrevMonthLabel()\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-prev\"></span>\n </button>\n }\n </div>\n}\n<div [ngStyle]=\"navYearFirst() ? { display: 'flex', justifyContent: 'center' } : {}\" aria-live=\"polite\" class=\"calendar-nav-date\">\n @if (view() === 'days') {\n <button\n (click)=\"setView('months')\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n {{ date().toLocaleDateString(locale(), { month: 'long' }) }}\n </button>\n }\n <button\n (click)=\"setView('years')\"\n [ngStyle]=\"navYearFirst() ? { order: '-1' } : {}\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n >\n {{ date().toLocaleDateString(locale(), { year: 'numeric' }) }}\n </button>\n</div>\n@if (navigation()) {\n <div class=\"calendar-nav-next\">\n @if (view() === 'days') {\n <button\n (click)=\"handleNavigationClick('next')\"\n (keyup)=\"handleNavigationKeyUp($event, 'next')\"\n [disabled]=\"disableNextMonth()\"\n cButton\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaNextMonthLabel()\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-next\"></span>\n </button>\n }\n <button\n (click)=\"handleNavigationClick('next', true)\"\n (keyup)=\"handleNavigationKeyUp($event, 'next', true)\"\n cButton\n [disabled]=\"disableNextYear()\"\n color=\"transparent\"\n size=\"sm\"\n tabindex=\"0\"\n [attr.aria-label]=\"ariaNextYearLabel()\"\n >\n <span class=\"calendar-nav-icon calendar-nav-icon-double-next\"></span>\n </button>\n </div>\n}\n" }]
2252
+ }], ctorParameters: () => [] });
2214
2253
 
2215
2254
  class CalendarWeekdayPipe {
2216
2255
  transform(date, weekdayFormat = 'short', locale = 'default') {
@@ -2252,7 +2291,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
2252
2291
 
2253
2292
  class CalendarClassMonthPipe {
2254
2293
  transform(calendarDate, monthIndex) {
2255
- const date = new Date(new Date(calendarDate).getFullYear(), monthIndex, 1);
2294
+ const year = new Date(calendarDate).getFullYear();
2295
+ const date = new Date(year, monthIndex, 1);
2256
2296
  return {
2257
2297
  'calendar-cell': true,
2258
2298
  month: true,
@@ -2373,7 +2413,7 @@ class CalendarDayDirective {
2373
2413
  selectEndDate &&
2374
2414
  !!isDateInRange(date, state.startDate, state.hoverDate);
2375
2415
  inRange = month === 'current' && (isDateInRange(date, state.startDate, state.endDate) || !!start || !!end);
2376
- disabledRange = isDateInRangeDisabled(state.startDate, date, state.disabledDates);
2416
+ disabledRange = isDateInRangeDisabled(state.startDate, date, state.disabledDates, state.dateFilter);
2377
2417
  disabledDate = isDateDisabled(date, state.minDate, state.maxDate, state.disabledDates);
2378
2418
  disabledByFilter = typeof state.dateFilter === 'function' && date ? !state.dateFilter(date) : false;
2379
2419
  this.disabled = disabledDate || disabledByFilter;
@@ -2463,9 +2503,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
2463
2503
  class CalendarClassRowPipe {
2464
2504
  transform(week, datesConfig) {
2465
2505
  const { minDate, maxDate, disabledDates, dateFilter, calendarDate, selectionType } = { ...datesConfig };
2466
- const date = convertToDateObject(week.weekNumber === 0
2467
- ? `${calendarDate.getFullYear()}W53`
2468
- : `${calendarDate.getFullYear()}W${week.weekNumber}`, selectionType);
2506
+ const date = convertToDateObject(week.weekNumber === 0 ? `${calendarDate.getFullYear()}W53` : `${calendarDate.getFullYear()}W${week.weekNumber}`, selectionType);
2469
2507
  const isDisabled = isDateDisabled(date, minDate, maxDate, disabledDates) || (dateFilter ? !dateFilter(date) : false);
2470
2508
  return {
2471
2509
  'calendar-row': true,
@@ -2501,7 +2539,7 @@ class CalendarRowDirective {
2501
2539
  this.selectionType = 'week';
2502
2540
  this.calendarDate = new Date();
2503
2541
  this.locale = 'default';
2504
- this.#tabindex = signal(-1);
2542
+ this.tabindex = signal(-1);
2505
2543
  this.#calendarService.calendarState$
2506
2544
  .pipe(distinctUntilChanged(), takeUntilDestroyed(this.#destroyRef))
2507
2545
  .subscribe((state) => {
@@ -2522,17 +2560,13 @@ class CalendarRowDirective {
2522
2560
  }
2523
2561
  set week(value) {
2524
2562
  this.current = value.days.some((day) => day.month === 'current');
2525
- this.#tabindex.set(this.selectionType === 'week' && this.current && !this.disabled ? 0 : -1);
2563
+ this.tabindex.set(this.selectionType === 'week' && this.current && !this.disabled ? 0 : -1);
2526
2564
  this.#week = value;
2527
2565
  }
2528
2566
  get week() {
2529
2567
  return this.#week;
2530
2568
  }
2531
2569
  #week;
2532
- get tabindex() {
2533
- return this.#tabindex();
2534
- }
2535
- #tabindex;
2536
2570
  get selectEndDate() {
2537
2571
  return this.range && !!this.startDate && !this.endDate;
2538
2572
  }
@@ -2545,26 +2579,35 @@ class CalendarRowDirective {
2545
2579
  const week = this.week;
2546
2580
  const calendarDate = this.calendarDate;
2547
2581
  const selectionType = this.selectionType;
2548
- this.date = convertToDateObject(week.weekNumber === 0 ? `${calendarDate.getFullYear()}W53` : `${calendarDate.getFullYear()}W${week.weekNumber}`, selectionType);
2549
2582
  this.current = week.days.some((day) => day.month === 'current');
2550
- const inRange = this.selectionType === 'week' && isDateInRange(this.date, this.startDate, this.endDate);
2551
- const rangeHover = this.selectionType === 'week' && this.hoverDate && this.selectEndDate
2552
- ? isDateInRange(this.date, this.startDate, this.hoverDate)
2553
- : isDateInRange(this.date, this.hoverDate, this.endDate);
2554
- const selected = isDateSelected(this.date, this.startDate, this.endDate);
2555
- const disabledDate = isDateDisabled(this.date, this.minDate, this.maxDate, this.disabledDates);
2556
- const disabledByFilter = Object.prototype.toString.call(this.dateFilter) === '[object Function]' && this.date
2557
- ? !this.dateFilter(this.date)
2558
- : false;
2559
- this.disabled = disabledDate || disabledByFilter;
2560
- return {
2561
- 'calendar-row': true,
2562
- disabled: this.disabled,
2563
- range: inRange,
2564
- 'range-hover': rangeHover,
2565
- selected: selected,
2566
- current: this.current
2567
- };
2583
+ if (this.selectionType === 'week') {
2584
+ this.date = convertToDateObject(week.weekNumber === 0 ? `${calendarDate.getFullYear()}W53` : `${calendarDate.getFullYear()}W${week.weekNumber}`, 'week');
2585
+ const inRange = isDateInRange(this.date, this.startDate, this.endDate);
2586
+ const rangeHover = this.hoverDate &&
2587
+ (this.selectEndDate
2588
+ ? isDateInRange(this.date, this.startDate, this.hoverDate)
2589
+ : isDateInRange(this.date, this.hoverDate, this.endDate));
2590
+ const selected = isDateSelected(this.date, this.startDate, this.endDate);
2591
+ const disabledDate = isDateDisabled(this.date, this.minDate, this.maxDate, this.disabledDates);
2592
+ const disabledByFilter = Object.prototype.toString.call(this.dateFilter) === '[object Function]' && this.date
2593
+ ? !this.dateFilter(this.date)
2594
+ : false;
2595
+ this.disabled = disabledDate || disabledByFilter;
2596
+ return {
2597
+ 'calendar-row': true,
2598
+ disabled: this.disabled,
2599
+ range: inRange,
2600
+ 'range-hover': rangeHover,
2601
+ selected: selected,
2602
+ current: this.current
2603
+ };
2604
+ }
2605
+ else {
2606
+ return {
2607
+ 'calendar-row': true,
2608
+ current: this.current
2609
+ };
2610
+ }
2568
2611
  }
2569
2612
  get ariaSelected() {
2570
2613
  return this.hostClasses?.['selected'] ? true : null;
@@ -2576,7 +2619,7 @@ class CalendarRowDirective {
2576
2619
  return this.date?.toLocaleDateString(this.locale) ?? '';
2577
2620
  }
2578
2621
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2579
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: CalendarRowDirective, isStandalone: true, selector: "[cCalendarRow]", inputs: { week: ["cCalendarRow", "week"] }, host: { properties: { "attr.aria-selected": "ariaSelected", "attr.tabindex": "this.tabindex", "class": "this.hostClasses" } }, exportAs: ["cCalendarRow"], ngImport: i0 }); }
2622
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: CalendarRowDirective, isStandalone: true, selector: "[cCalendarRow]", inputs: { week: ["cCalendarRow", "week"] }, host: { properties: { "attr.aria-selected": "ariaSelected", "attr.tabindex": "tabindex()", "class": "this.hostClasses" } }, exportAs: ["cCalendarRow"], ngImport: i0 }); }
2580
2623
  }
2581
2624
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarRowDirective, decorators: [{
2582
2625
  type: Directive,
@@ -2584,14 +2627,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
2584
2627
  selector: '[cCalendarRow]',
2585
2628
  standalone: true,
2586
2629
  exportAs: 'cCalendarRow',
2587
- host: { '[attr.aria-selected]': 'ariaSelected' }
2630
+ host: { '[attr.aria-selected]': 'ariaSelected', '[attr.tabindex]': 'tabindex()' }
2588
2631
  }]
2589
2632
  }], ctorParameters: () => [], propDecorators: { week: [{
2590
2633
  type: Input,
2591
2634
  args: [{ alias: 'cCalendarRow', required: true }]
2592
- }], tabindex: [{
2593
- type: HostBinding,
2594
- args: ['attr.tabindex']
2595
2635
  }], hostClasses: [{
2596
2636
  type: HostBinding,
2597
2637
  args: ['class']
@@ -2599,13 +2639,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
2599
2639
 
2600
2640
  class CalendarMonthComponent {
2601
2641
  #destroyRef;
2602
- constructor(calendarService) {
2603
- this.calendarService = calendarService;
2642
+ #calendarService;
2643
+ constructor() {
2604
2644
  this.#destroyRef = inject(DestroyRef);
2605
- this.addMonths = 0;
2606
- this._startDate = null;
2607
- this._endDate = null;
2608
- this._disabledDates = [];
2645
+ this.#calendarService = inject(CalendarService);
2646
+ this.pageIndex = input(0, { transform: numberAttribute });
2647
+ this.addMonths = computed(() => {
2648
+ const view = this.view();
2649
+ const pageIndex = this.pageIndex();
2650
+ return pageIndex * (view === 'years' ? 144 : view === 'months' ? 12 : 1);
2651
+ });
2652
+ /**
2653
+ * Initial selected date.
2654
+ * @type (Date | null)
2655
+ */
2656
+ this.startDate = signal(null, { equal: equalDates });
2657
+ /**
2658
+ * Initial selected to date (range).
2659
+ * @type Date | null
2660
+ */
2661
+ this.endDate = signal(null, { equal: equalDates });
2662
+ this.datesEffect = effect(() => {
2663
+ const startDate = this.startDate();
2664
+ const endDate = startDate && this.range() ? this.endDate() : null;
2665
+ this.#calendarService.update({ startDate: startDate, endDate: endDate });
2666
+ }, { allowSignalWrites: true });
2667
+ /**
2668
+ * Specify the list of dates that cannot be selected.
2669
+ * @type Date[] | Date[][]
2670
+ */
2671
+ this.disabledDates = signal([]);
2609
2672
  /**
2610
2673
  * Sets the day of start week.
2611
2674
  * - 0 - Sunday,
@@ -2616,199 +2679,120 @@ class CalendarMonthComponent {
2616
2679
  * - 5 - Friday,
2617
2680
  * - 6 - Saturday,
2618
2681
  */
2619
- this.firstDayOfWeek = 1;
2620
- this.#locale = signal('default');
2682
+ this.firstDayOfWeek = signal(1);
2683
+ /**
2684
+ * Sets the default locale for components. If not set, it is inherited from the browser.
2685
+ * @default 'default'
2686
+ */
2687
+ this.locale = signal('default');
2621
2688
  /**
2622
2689
  * Allow range selection.
2623
2690
  * @type boolean
2624
2691
  * @default false
2625
2692
  */
2626
- this.range = false;
2693
+ this.range = signal(false);
2627
2694
  /**
2628
2695
  * Set length or format of day name.
2629
2696
  * @type number | 'long' | 'narrow' | 'short'
2630
2697
  * @default 'short'
2631
2698
  */
2632
- this.weekdayFormat = 'short';
2633
- this.#view = signal('days');
2634
- this._maxDate = null;
2635
- this._minDate = null;
2699
+ this.weekdayFormat = signal('short');
2700
+ /**
2701
+ * Set calendar view.
2702
+ * @type 'days' | 'months' | 'years'
2703
+ * @default 'days'
2704
+ */
2705
+ this.view = signal('days');
2706
+ /**
2707
+ * Max selectable date.
2708
+ */
2709
+ this.maxDate = signal(null, { equal: equalDates });
2710
+ /**
2711
+ * Min selectable date.
2712
+ */
2713
+ this.minDate = signal(null, { equal: equalDates });
2636
2714
  this.listOfMonths = computed(() => {
2637
- return createGroupsInArray(getMonthsNames(this.#locale(), this.calendarDate$$().getFullYear()), 4);
2715
+ return createGroupsInArray(getMonthsNames(this.locale(), this.date().getFullYear()), 4);
2716
+ });
2717
+ this.listOfYears = computed(() => createGroupsInArray(getYears(this.date().getFullYear()), 4));
2718
+ /**
2719
+ * Default date of the component
2720
+ * @type Date
2721
+ */
2722
+ this.calendarDate = signal(new Date(), { equal: equalDates });
2723
+ this.date = computed(() => {
2724
+ const date = this.calendarDate();
2725
+ return new Date(date.getFullYear(), date.getMonth() + this.addMonths(), 1, 0, 0, 0, 0);
2726
+ }, { equal: (a, b) => a.getTime() === b.getTime() });
2727
+ this.calendarDateEffect = effect(() => {
2728
+ this.#calendarService.update({ calendarDate: this.calendarDate() });
2729
+ }, { allowSignalWrites: true });
2730
+ this.dateFilter = signal(undefined);
2731
+ this.dayFormat = signal('numeric');
2732
+ this.selectAdjacentDays = signal(false);
2733
+ this.showAdjacentDays = signal(true);
2734
+ this.selectionType = signal('day');
2735
+ this.showWeekNumber = signal(false);
2736
+ this.weekNumbersLabel = signal('');
2737
+ this.monthDetails = computed(() => {
2738
+ const date = this.date();
2739
+ return getMonthDetails(date.getFullYear(), date.getMonth(), this.firstDayOfWeek());
2740
+ });
2741
+ this.weekDays = computed(() => {
2742
+ const monthDetails = this.monthDetails();
2743
+ return monthDetails[0].days;
2638
2744
  });
2639
- this.listOfYears = computed(() => createGroupsInArray(getYears(this.calendarDate$$().getFullYear()), 4));
2640
- this.calendarDate$$ = signal(new Date());
2641
- this.#selectionType = signal('month');
2642
- this.showWeekNumber = true;
2643
- this.isDateInRangeDisabled = isDateInRangeDisabled;
2644
- this.isDateBetweenMinMax = isDateBetweenMinMax;
2645
2745
  this.calendarStateSubscribe();
2646
2746
  }
2647
- /**
2648
- * Initial selected date.
2649
- * @type (Date | null)
2650
- */
2651
- set startDate(value) {
2652
- const date = !!value ? tryDate(value, 'startDate') : null;
2653
- if (this._startDate?.getTime() !== date?.getTime()) {
2654
- this._startDate = date;
2655
- this.calendarService.update({ startDate: this._startDate });
2656
- }
2657
- }
2658
- get startDate() {
2659
- return this._startDate;
2660
- }
2661
- /**
2662
- * Initial selected to date (range).
2663
- * @type Date | null
2664
- */
2665
- set endDate(value) {
2666
- const date = !!value ? tryDate(value, 'endDate') : null;
2667
- if (this._endDate?.getTime() !== date?.getTime()) {
2668
- this._endDate = date;
2669
- this.calendarService.update({ endDate: this._endDate });
2670
- }
2671
- }
2672
- get endDate() {
2673
- return this._endDate;
2674
- }
2675
- /**
2676
- * Specify the list of dates that cannot be selected.
2677
- * @type Date[] | Date[][]
2678
- */
2679
- set disabledDates(value) {
2680
- this._disabledDates = value;
2681
- }
2682
- get disabledDates() {
2683
- return this._disabledDates;
2684
- }
2685
- /**
2686
- * Sets the default locale for components. If not set, it is inherited from the browser.
2687
- * @default 'default'
2688
- */
2689
- set locale(value) {
2690
- this.#locale.set(value);
2691
- // this.listOfMonths = createGroupsInArray(getMonthsNames(value), 4);
2692
- }
2693
- get locale() {
2694
- return this.#locale();
2695
- }
2696
- #locale;
2697
- /**
2698
- * Set calendar view.
2699
- * @type 'days' | 'months' | 'years'
2700
- * @default 'days'
2701
- */
2702
- set view(value) {
2703
- this.#view.set(value);
2704
- }
2705
- get view() {
2706
- return this.#view();
2707
- }
2708
- #view;
2709
- /**
2710
- * Max selectable date.
2711
- */
2712
- set maxDate(value) {
2713
- this._maxDate = value ? tryDate(value, 'maxDate') : null;
2714
- }
2715
- get maxDate() {
2716
- return this._maxDate;
2717
- }
2718
- /**
2719
- * Min selectable date.
2720
- */
2721
- set minDate(value) {
2722
- this._minDate = value ? tryDate(value, 'minDate') : null;
2723
- }
2724
- get minDate() {
2725
- return this._minDate;
2726
- }
2727
- /**
2728
- * Default date of the component
2729
- * @type Date
2730
- */
2731
- set calendarDate(value) {
2732
- const _value = new Date(tryDate(value ?? this.startDate, 'calendarDate'));
2733
- if (!!_value && this.calendarDate$$().getTime() !== _value.getTime()) {
2734
- this.calendarDate$$.set(new Date(new Date(_value.setDate(1)).setHours(0, 0, 0, 0)));
2735
- this.setMonthDetails(this.date);
2736
- this.calendarService.update({ calendarDate: this.calendarDate$$() });
2737
- }
2738
- }
2739
- get calendarDate() {
2740
- return this.calendarDate$$();
2741
- }
2742
- get date() {
2743
- return new Date(this.calendarDate?.getFullYear(), this.calendarDate?.getMonth() + this.addMonths);
2744
- }
2745
- set selectionType(value) {
2746
- this.#selectionType.set(value);
2747
- }
2748
- get selectionType() {
2749
- return this.#selectionType();
2750
- }
2751
- #selectionType;
2752
- get monthDetails() {
2753
- return this._monthDetails;
2754
- }
2755
- get weekDays() {
2756
- return this.monthDetails[0].days;
2757
- }
2758
- ngOnInit() {
2759
- this.setMonthDetails(this.date);
2760
- }
2761
- setMonthDetails(date = this.date) {
2762
- this._monthDetails = getMonthDetails(date.getFullYear(), date.getMonth(), this.firstDayOfWeek);
2763
- }
2764
2747
  yearNumber(year) {
2765
- return new Date(year, 0).toLocaleDateString(this.locale, { year: 'numeric' });
2748
+ return new Date(year, 0).toLocaleDateString(this.locale(), { year: 'numeric' });
2766
2749
  }
2767
2750
  isDateDisabled(date) {
2768
- if (this.selectionType === 'year') {
2769
- const minDate = this.minDate ? new Date(this.minDate.getFullYear(), 0, 1, 0, 0, 0, 0) : null;
2770
- const maxDate = this.maxDate ? new Date(this.maxDate.getFullYear(), 11, 31, 0, 0, 0, 0) : null;
2771
- return (isDateDisabled(date, minDate, maxDate, this.disabledDates) || (this.dateFilter ? !this.dateFilter(date) : false));
2772
- }
2773
- if (this.selectionType === 'month') {
2774
- const minDate = this.minDate
2775
- ? new Date(this.minDate.getFullYear(), this.minDate.getMonth(), 1, 0, 0, 0, 0)
2776
- : null;
2777
- const maxDate = this.maxDate
2778
- ? new Date(this.maxDate.getFullYear(), this.maxDate.getMonth() + 1, 1, 0, 0, -1, 0)
2779
- : null;
2780
- return (isDateDisabled(date, minDate, maxDate, this.disabledDates) || (this.dateFilter ? !this.dateFilter(date) : false));
2781
- }
2782
- return (isDateDisabled(date, this.minDate, this.maxDate, this.disabledDates) ||
2783
- (this.dateFilter ? !this.dateFilter(date) : false));
2751
+ const selectionType = this.selectionType();
2752
+ const disabledDates = this.disabledDates();
2753
+ const dateFilterFn = this.dateFilter();
2754
+ const maxDate = this.maxDate();
2755
+ const minDate = this.minDate();
2756
+ if (selectionType === 'year') {
2757
+ const min = minDate ? new Date(minDate.getFullYear(), 0, 1, 0, 0, 0, 0) : null;
2758
+ const max = maxDate ? new Date(maxDate.getFullYear(), 11, 31, 0, 0, 0, 0) : null;
2759
+ return isDateDisabled(date, min, max, disabledDates) || (dateFilterFn ? !dateFilterFn(date) : false);
2760
+ }
2761
+ if (selectionType === 'month') {
2762
+ const min = minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), 1, 0, 0, 0, 0) : null;
2763
+ const max = maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth() + 1, 1, 0, 0, -1, 0) : null;
2764
+ return isDateDisabled(date, min, max, disabledDates) || (dateFilterFn ? !dateFilterFn(date) : false);
2765
+ }
2766
+ return isDateDisabled(date, minDate, maxDate, disabledDates) || (dateFilterFn ? !dateFilterFn(date) : false);
2784
2767
  }
2785
2768
  calendarCellTitle(date) {
2786
- return date.toLocaleDateString(this.locale);
2769
+ return date.toLocaleDateString(this.locale());
2787
2770
  }
2788
2771
  handleCellMouseEnter(hoverDate) {
2789
2772
  if (!hoverDate) {
2790
2773
  return;
2791
2774
  }
2792
- const updateHoverValue = (['day', 'week'].includes(this.selectionType) && this.view === 'days') ||
2793
- (['month'].includes(this.selectionType) && this.view === 'months') ||
2794
- (['year'].includes(this.selectionType) && this.view === 'years');
2775
+ const selectionType = this.selectionType();
2776
+ const updateHoverValue = (['day', 'week'].includes(selectionType) && this.view() === 'days') ||
2777
+ (['month'].includes(selectionType) && this.view() === 'months') ||
2778
+ (['year'].includes(selectionType) && this.view() === 'years');
2795
2779
  // if (updateHoverValue) {
2796
2780
  const hoverValue = this.isDateDisabled(hoverDate) || !updateHoverValue ? null : hoverDate;
2797
- this.calendarService.update({ hoverDate: hoverValue });
2781
+ this.#calendarService.update({ hoverDate: hoverValue });
2798
2782
  // }
2799
2783
  }
2800
2784
  handleYearCellClick(year) {
2801
- if (this.selectionType === 'year') {
2785
+ if (this.selectionType() === 'year') {
2802
2786
  let date = new Date(year, 0, 1, 0, 0, 0, 0);
2803
- if (this.range && this.startDate && !this.endDate) {
2787
+ if (this.range() && this.startDate() && !this.endDate()) {
2804
2788
  date = new Date(date.getFullYear(), 12, 1, 0, 0, -1, 0);
2805
2789
  }
2806
2790
  this.handleDayCellClick(date);
2807
2791
  return;
2808
2792
  }
2809
2793
  const calendarDate = new Date(year, 0, 1, 0, 0, 0, 0);
2810
- this.view = 'months';
2811
- this.calendarService.update({ view: this.view, calendarDate: calendarDate });
2794
+ this.view.set('months');
2795
+ this.#calendarService.update({ view: this.view(), calendarDate: calendarDate });
2812
2796
  }
2813
2797
  handleYearCellKeyUp($event, date) {
2814
2798
  if (!date) {
@@ -2840,26 +2824,28 @@ class CalendarMonthComponent {
2840
2824
  if (!value) {
2841
2825
  return;
2842
2826
  }
2843
- if (this.selectionType === 'month') {
2827
+ if (this.selectionType() === 'month') {
2844
2828
  let date = new Date(value.getFullYear(), value.getMonth(), 1, 0, 0, 0, 0);
2845
- if (this.range && this.startDate && !this.endDate) {
2829
+ if (this.range() && this.startDate() && !this.endDate()) {
2846
2830
  date = new Date(date.getFullYear(), date.getMonth() + 1, 1, 0, 0, -1, 0);
2847
2831
  }
2848
2832
  this.handleDayCellClick(date);
2849
2833
  return;
2850
2834
  }
2851
- this.setCalendarPage(0, 0, value.getMonth() - this.addMonths);
2852
- this.view = 'days';
2853
- this.calendarService.update({ view: this.view });
2835
+ this.view.set('days');
2836
+ this.#calendarService.update({ view: this.view() });
2837
+ // this.setCalendarPage(0, 0, value.getMonth() - this.addMonths());
2838
+ const calendarDate = new Date(value.getFullYear(), value.getMonth() - this.addMonths(), 1, 0, 0, 0, 0);
2839
+ this.#calendarService.update({ calendarDate: calendarDate });
2854
2840
  }
2855
2841
  setCalendarPage(years, months = 0, setMonth) {
2856
- const year = this.date.getFullYear();
2857
- const month = this.date.getMonth();
2842
+ const year = this.date().getFullYear();
2843
+ const month = this.date().getMonth();
2858
2844
  const d = new Date(year, month, 1, 0, 0, 0, 0);
2859
2845
  years && d.setFullYear(d.getFullYear() + years);
2860
2846
  months && d.setMonth(d.getMonth() + months);
2861
2847
  typeof setMonth === 'number' && d.setMonth(setMonth);
2862
- this.calendarService.update({ calendarDate: d });
2848
+ this.#calendarService.update({ calendarDate: d });
2863
2849
  }
2864
2850
  handleDayCellKeyDown($event, date) {
2865
2851
  if (!date) {
@@ -2871,22 +2857,23 @@ class CalendarMonthComponent {
2871
2857
  $event.preventDefault();
2872
2858
  this.handleCellMouseEnter(date);
2873
2859
  const eventKey = $event.key === 'Tab' ? ($event.shiftKey ? 'ArrowLeft' : 'ArrowRight') : $event.key;
2874
- if (this.maxDate &&
2875
- date >= convertToDateObject(this.maxDate, this.selectionType) &&
2860
+ const selectionType = this.selectionType();
2861
+ const view = this.view();
2862
+ const maxDate = this.maxDate();
2863
+ if (maxDate &&
2864
+ date >= convertToDateObject(maxDate, selectionType) &&
2876
2865
  ['ArrowRight', 'ArrowDown'].includes(eventKey)) {
2877
2866
  return;
2878
2867
  }
2879
- if (this.minDate &&
2880
- date <= convertToDateObject(this.minDate, this.selectionType) &&
2881
- ['ArrowLeft', 'ArrowUp'].includes(eventKey)) {
2868
+ const minDate = this.minDate();
2869
+ if (minDate && date <= convertToDateObject(minDate, selectionType) && ['ArrowLeft', 'ArrowUp'].includes(eventKey)) {
2882
2870
  return;
2883
2871
  }
2884
2872
  let element = $event.target;
2885
- if (this.selectionType === 'week' && this.view === 'days' && element.tabIndex === -1) {
2873
+ if (selectionType === 'week' && view === 'days' && element.tabIndex === -1) {
2886
2874
  element = element.closest('tr[tabindex="0"]');
2887
2875
  }
2888
- const elements = ['week'].includes(this.selectionType) && this.view === 'days' ? this.calendarRows : this.calendarDays;
2889
- // @ts-ignore
2876
+ const elements = ['week'].includes(selectionType) && view === 'days' ? this.calendarRows : this.calendarDays;
2890
2877
  const list = elements
2891
2878
  .toArray()
2892
2879
  .map((calendarCell) => calendarCell.elementRef.nativeElement)
@@ -2902,8 +2889,8 @@ class CalendarMonthComponent {
2902
2889
  const gap = {
2903
2890
  ArrowRight: 1,
2904
2891
  ArrowLeft: -1,
2905
- ArrowUp: this.selectionType === 'week' && this.view === 'days' ? -1 : this.view === 'days' ? -7 : -3,
2906
- ArrowDown: this.selectionType === 'week' && this.view === 'days' ? 1 : this.view === 'days' ? 7 : 3
2892
+ ArrowUp: selectionType === 'week' && view === 'days' ? -1 : view === 'days' ? -7 : -3,
2893
+ ArrowDown: selectionType === 'week' && view === 'days' ? 1 : view === 'days' ? 7 : 3
2907
2894
  };
2908
2895
  if ((eventKey === 'ArrowRight' && last) ||
2909
2896
  (eventKey === 'ArrowDown' && toBoundary.end < gap.ArrowDown) ||
@@ -2915,7 +2902,7 @@ class CalendarMonthComponent {
2915
2902
  const _list = change
2916
2903
  .toArray()
2917
2904
  // .filter(element => this.selectionType === 'week' ? element?.elementRef.nativeElement.tabIndex === 0 : element?.elementRef.nativeElement.classList.contains('current'));
2918
- .filter((element) => element?.elementRef.nativeElement.tabIndex === 0);
2905
+ .filter((directive) => directive?.elementRef.nativeElement.tabIndex === 0);
2919
2906
  if (_list.length) {
2920
2907
  let dayToFocus;
2921
2908
  switch (eventKey) {
@@ -2942,16 +2929,16 @@ class CalendarMonthComponent {
2942
2929
  }
2943
2930
  }
2944
2931
  });
2945
- if (this.view === 'days') {
2946
- this.setCalendarPage(0, ['ArrowRight', 'ArrowDown'].includes(eventKey) ? 1 : -1);
2947
- }
2948
- if (this.view === 'months') {
2949
- this.setCalendarPage(['ArrowRight', 'ArrowDown'].includes(eventKey) ? 1 : -1);
2950
- // this.calendarDays?.reset(this.calendarDays.toArray());
2951
- // this.calendarDays?.notifyOnChanges();
2952
- }
2953
- if (this.view === 'years') {
2954
- this.setCalendarPage(['ArrowRight', 'ArrowDown'].includes(eventKey) ? 12 : -12);
2932
+ switch (view) {
2933
+ case 'days':
2934
+ this.setCalendarPage(0, ['ArrowRight', 'ArrowDown'].includes(eventKey) ? 1 : -1);
2935
+ break;
2936
+ case 'months':
2937
+ this.setCalendarPage(['ArrowRight', 'ArrowDown'].includes(eventKey) ? 1 : -1);
2938
+ break;
2939
+ case 'years':
2940
+ this.setCalendarPage(['ArrowRight', 'ArrowDown'].includes(eventKey) ? 12 : -12);
2941
+ break;
2955
2942
  }
2956
2943
  return;
2957
2944
  }
@@ -2976,7 +2963,7 @@ class CalendarMonthComponent {
2976
2963
  }
2977
2964
  }
2978
2965
  handleCellMouseLeave() {
2979
- this.calendarService.update({ hoverDate: null });
2966
+ this.#calendarService.update({ hoverDate: null });
2980
2967
  }
2981
2968
  handleDayCellKeyUp($event, date) {
2982
2969
  if (['Space', 'Enter'].includes($event.code)) {
@@ -2989,67 +2976,66 @@ class CalendarMonthComponent {
2989
2976
  }
2990
2977
  }
2991
2978
  handleDayCellClick(date) {
2992
- if (this.selectionType === 'day' && this.isDateDisabled(date)) {
2979
+ if (this.selectionType() === 'day' && this.isDateDisabled(date)) {
2993
2980
  return;
2994
2981
  }
2995
- if (!this.range) {
2996
- this.endDate = null;
2997
- this.startDate = date;
2982
+ if (!this.range()) {
2983
+ this.endDate.set(null);
2984
+ this.startDate.set(date);
2998
2985
  return;
2999
2986
  }
3000
- if (this.startDate && this.endDate) {
3001
- this.calendarDate = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0, 0);
3002
- this.endDate = null;
3003
- this.startDate = null;
2987
+ const startDate = this.startDate();
2988
+ const endDate = this.endDate();
2989
+ if (startDate && endDate) {
2990
+ this.startDate.set(null);
2991
+ this.endDate.set(null);
3004
2992
  return;
3005
2993
  }
3006
- if (!!this.startDate && !this.endDate) {
3007
- if (this.startDate && date < this.startDate) {
3008
- this.endDate = null;
3009
- this.startDate = date;
2994
+ if (!!startDate && !endDate) {
2995
+ if (startDate && date < startDate) {
2996
+ this.endDate.set(null);
2997
+ this.startDate.set(date);
3010
2998
  }
3011
2999
  else {
3012
- this.endDate = date;
3000
+ const addDays = this.selectionType() !== 'week' ? 1 : 7;
3001
+ this.endDate.set(new Date(date.getFullYear(), date.getMonth(), date.getDate() + addDays, 0, 0, -1, 0));
3013
3002
  }
3014
3003
  }
3015
3004
  else {
3016
- this.endDate = null;
3017
- this.startDate = date;
3005
+ this.endDate.set(null);
3006
+ this.startDate.set(date);
3018
3007
  }
3019
- if (this.startDate && this.endDate) {
3020
- // @ts-ignore
3021
- if (isDateInRangeDisabled(this.startDate, this.endDate, this.disabledDates)) {
3022
- this.startDate = null;
3023
- this.endDate = null;
3024
- return;
3008
+ {
3009
+ const startDate = this.startDate();
3010
+ const endDate = this.endDate();
3011
+ if (startDate && endDate) {
3012
+ const dateFilterFn = this.dateFilter();
3013
+ if (isDateInRangeDisabled(startDate, endDate, this.disabledDates(), dateFilterFn)) {
3014
+ this.startDate.set(null);
3015
+ this.endDate.set(null);
3016
+ return;
3017
+ }
3025
3018
  }
3026
- // let date = new Date(this.startDate);
3027
- // while (date < this.endDate) {
3028
- // date.setDate(date.getDate() + 1);
3029
- // if (this.isDateDisabled(date)) {
3030
- // this.startDate = null;
3031
- // this.endDate = null;
3032
- // break;
3033
- // }
3034
- // }
3035
3019
  }
3036
3020
  }
3037
3021
  calendarStateSubscribe() {
3038
- this.calendarService.calendarState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((state) => {
3022
+ this.#calendarService.calendarState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((state) => {
3039
3023
  const keys = Object.keys(state);
3040
3024
  for (const key of keys) {
3041
- // if (key in this) {
3042
- // @ts-ignore
3043
- this[key] = state[key];
3044
- // }
3025
+ if (key in this) {
3026
+ // @ts-ignore
3027
+ const isWritableSignal = typeof this[key] === 'function' && typeof this[key].set === 'function';
3028
+ // @ts-ignore
3029
+ isWritableSignal ? this[key].set(state[key]) : (this[key] = state[key]);
3030
+ }
3045
3031
  }
3046
3032
  });
3047
3033
  }
3048
3034
  getMonthStart(index) {
3049
- return new Date(this.calendarDate.getFullYear(), index, 1, 0, 0, 0, 0);
3035
+ return new Date(this.calendarDate().getFullYear(), index + this.addMonths(), 1, 0, 0, 0, 0);
3050
3036
  }
3051
3037
  getMonthEnd(index) {
3052
- return new Date(this.calendarDate.getFullYear(), index + 1, 1, 0, 0, -1, 0);
3038
+ return new Date(this.calendarDate().getFullYear(), index + 1 + this.addMonths(), 1, 0, 0, -1, 0);
3053
3039
  }
3054
3040
  getYearStart(year) {
3055
3041
  return new Date(year, 0, 1);
@@ -3057,8 +3043,8 @@ class CalendarMonthComponent {
3057
3043
  getYearEnd(year) {
3058
3044
  return new Date(year, 11, 1, 0, 0, -1, 0);
3059
3045
  }
3060
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarMonthComponent, deps: [{ token: CalendarService }], target: i0.ɵɵFactoryTarget.Component }); }
3061
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: CalendarMonthComponent, isStandalone: true, selector: "c-calendar-month", inputs: { addMonths: "addMonths", startDate: "startDate", endDate: "endDate", disabledDates: "disabledDates", firstDayOfWeek: ["firstDayOfWeek", "firstDayOfWeek", numberAttribute], locale: "locale", range: ["range", "range", booleanAttribute], weekdayFormat: "weekdayFormat", view: "view", maxDate: "maxDate", minDate: "minDate", calendarDate: "calendarDate" }, viewQueries: [{ propertyName: "calendarDays", predicate: CalendarDayDirective, descendants: true }, { propertyName: "calendarRows", predicate: CalendarRowDirective, descendants: true }], exportAs: ["cCalendarMonth"], ngImport: i0, template: "<table>\n @if (view === 'days') {\n <thead>\n <tr>\n @if (showWeekNumber) {\n <th class=\"calendar-cell\">\n <div class=\"calendar-header-cell-inner\">{{ weekNumbersLabel }}</div>\n </th>\n }\n @for (weekDay of weekDays; track weekDay.date; let i = $index) {\n @let date = weekDay.date ;\n <th class=\"calendar-cell\" abbr=\"{{date | calendarWeekday:'long':locale}}\">\n <div class=\"calendar-header-cell-inner\">\n {{ date | calendarWeekday:weekdayFormat:locale }}\n </div>\n </th>\n }\n </tr>\n </thead>\n }\n <tbody (mouseleave)=\"handleCellMouseLeave()\">\n @switch (view) {\n @case ('years') {\n @for (yearsRow of listOfYears(); track yearsRow; let rowIdx = $index) {\n <tr>\n @for (year of yearsRow; track year; let idx = $index) {\n <td\n #calendarYear=\"cCalendarDay\"\n (click)=\"!calendarYear.disabled$() && handleYearCellClick(year)\"\n (keydown)=\"calendarYear.date() && handleDayCellKeyDown($event, calendarYear.date())\"\n (keyup)=\"handleYearCellKeyUp($event, calendarYear.date())\"\n (mouseenter)=\"calendarYear.date() && handleCellMouseEnter(calendarYear.date())\"\n [attr.aria-label]=\"calendarYear.date()?.getFullYear()\"\n [date]=\"getYearStart(year)\"\n [ngClass]=\"year | calendarClassYear\"\n [tabindex]=\"calendarYear.disabled$() ? -1 : 0\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ yearNumber(year) }}\n </div>\n </td>\n }\n </tr>\n }\n }\n @case ('months') {\n @for (monthsRow of listOfMonths(); track monthsRow; let rowIdx = $index) {\n <tr>\n @for (month of monthsRow; track month; let idx = $index) {\n <td\n #calendarMonth=\"cCalendarDay\"\n (click)=\"!calendarMonth.disabled$() && handleMonthCellClick(calendarMonth.date())\"\n (keydown)=\"calendarMonth.date() && handleDayCellKeyDown($event, calendarMonth.date())\"\n (keyup)=\"handleMonthCellKeyUp($event, calendarMonth.date())\"\n (mouseenter)=\"calendarMonth.date() && handleCellMouseEnter(calendarMonth.date())\"\n [attr.aria-label]=\"calendarMonth.date()?.getFullYear()+' '+month.month\"\n [date]=\"getMonthStart(rowIdx*3+idx)\"\n [ngClass]=\"calendarDate | calendarClassMonth:(rowIdx*3+idx)\"\n [tabindex]=\"calendarMonth.disabled$() ? -1 : 0\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ month.month }}\n </div>\n </td>\n }\n </tr>\n }\n\n }\n @default {\n @for (week of monthDetails; track week; let i = $index) {\n <tr #calendarRow=\"cCalendarRow\"\n (click)=\"selectionType === 'week' && (calendarRow.current) && calendarRow.date && handleDayCellClick(calendarRow.date)\"\n (keydown)=\"selectionType === 'week' && (calendarRow.current) && calendarRow.date && handleDayCellKeyDown($event, calendarRow.date)\"\n (keyup)=\"selectionType === 'week' && (calendarRow.current) && calendarRow.date && handleDayCellKeyUp($event, calendarRow.date)\"\n (mouseenter)=\"selectionType === 'week' && calendarRow.date && handleCellMouseEnter(calendarRow.date)\"\n [cCalendarRow]=\"week\"\n >\n @if (showWeekNumber) {\n <th class=\"calendar-cell-week-number\">\n {{ week.weekNumber === 0 ? 53 : week.weekNumber }}\n </th>\n }\n @for (dateObj of week.days; track dateObj.date; let idx = $index) {\n @if (dateObj.month === 'current' || showAdjacentDays) {\n <td #calendarCell=\"cCalendarDay\"\n (click)=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && handleDayCellClick(dateObj.date)\"\n (keydown)=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && handleDayCellKeyDown($event, dateObj.date)\"\n (keyup)=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && handleDayCellKeyUp($event, dateObj.date)\"\n (mouseenter)=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && handleCellMouseEnter(dateObj.date)\"\n [attr.aria-label]=\"dateObj.date | calendarDayTitle:locale\"\n [date]=\"dateObj.date\"\n [month]=\"dateObj.month\"\n [ngClass]=\"dateObj | calendarClassDay:{minDate, maxDate, disabledDates, dateFilter}\"\n [tabindex]=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && !isDateDisabled(dateObj.date) ? 0 : -1\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ dateObj.date | calendarDay:dayFormat:locale }}\n </div>\n </td>\n } @else {\n <td class=\"calendar-cell\"></td>\n }\n }\n </tr>\n }\n\n }\n }\n\n </tbody>\n</table>\n\n", styles: [".btn-transparent:focus-visible{outline:-webkit-focus-ring-color auto 1px}.calendar-row:focus-visible{box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem}.calendar-row:focus-within:not([tabindex=\"-1\"]){outline:0;box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem;outline-style:auto!important}.calendar-row:focus:not([tabindex=\"-1\"]){outline:0;box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem;outline-style:auto!important}.calendar-cell:focus:not(:focus-visible):not([tabindex=\"-1\"]){box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem}\n"], dependencies: [{ kind: "directive", type: CalendarDayDirective, selector: "[cCalendarDay]", inputs: ["date", "month"], exportAs: ["cCalendarDay"] }, { kind: "pipe", type: CalendarDayPipe, name: "calendarDay" }, { kind: "pipe", type: CalendarDayTitlePipe, name: "calendarDayTitle" }, { kind: "directive", type: CalendarRowDirective, selector: "[cCalendarRow]", inputs: ["cCalendarRow"], exportAs: ["cCalendarRow"] }, { kind: "pipe", type: CalendarClassDayPipe, name: "calendarClassDay" }, { kind: "pipe", type: CalendarClassMonthPipe, name: "calendarClassMonth" }, { kind: "pipe", type: CalendarClassYearPipe, name: "calendarClassYear" }, { kind: "pipe", type: CalendarWeekdayPipe, name: "calendarWeekday" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
3046
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarMonthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3047
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: CalendarMonthComponent, isStandalone: true, selector: "c-calendar-month", inputs: { pageIndex: { classPropertyName: "pageIndex", publicName: "pageIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "calendarDays", predicate: CalendarDayDirective, descendants: true }, { propertyName: "calendarRows", predicate: CalendarRowDirective, descendants: true }], exportAs: ["cCalendarMonth"], ngImport: i0, template: "<table>\n @if (view() === 'days') {\n <thead>\n <tr>\n @if (showWeekNumber()) {\n <th class=\"calendar-cell\">\n <div class=\"calendar-header-cell-inner\">{{ weekNumbersLabel() }}</div>\n </th>\n }\n @for (weekDay of weekDays(); track weekDay.date; let i = $index) {\n @let date = weekDay.date ;\n <th class=\"calendar-cell\" abbr=\"{{date | calendarWeekday:'long':locale()}}\">\n <div class=\"calendar-header-cell-inner\">\n {{ date | calendarWeekday:weekdayFormat():locale() }}\n </div>\n </th>\n }\n </tr>\n </thead>\n }\n <tbody (mouseleave)=\"handleCellMouseLeave()\">\n @switch (view()) {\n @case ('years') {\n @for (yearsRow of listOfYears(); track yearsRow[0]; let rowIdx = $index) {\n <tr>\n @for (year of yearsRow; track year; let idx = $index) {\n <td\n #calendarYear=\"cCalendarDay\"\n (click)=\"!calendarYear.disabled$() && handleYearCellClick(year)\"\n (keydown)=\"calendarYear.date() && handleDayCellKeyDown($event, calendarYear.date())\"\n (keyup)=\"handleYearCellKeyUp($event, calendarYear.date())\"\n (mouseenter)=\"calendarYear.date() && handleCellMouseEnter(calendarYear.date())\"\n [attr.aria-label]=\"calendarYear.date()?.getFullYear()\"\n [date]=\"getYearStart(year)\"\n [ngClass]=\"year | calendarClassYear\"\n [tabindex]=\"calendarYear.disabled$() ? -1 : 0\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ yearNumber(year) }}\n </div>\n </td>\n }\n </tr>\n }\n }\n @case ('months') {\n @for (monthsRow of listOfMonths(); track monthsRow[0]; let rowIdx = $index) {\n <tr>\n @for (month of monthsRow; track month; let idx = $index) {\n @let monthStart = getMonthStart(rowIdx*3+idx);\n <td\n #calendarMonth=\"cCalendarDay\"\n (click)=\"!calendarMonth.disabled$() && handleMonthCellClick(calendarMonth.date())\"\n (keydown)=\"calendarMonth.date() && handleDayCellKeyDown($event, calendarMonth.date())\"\n (keyup)=\"handleMonthCellKeyUp($event, calendarMonth.date())\"\n (mouseenter)=\"calendarMonth.date() && handleCellMouseEnter(calendarMonth.date())\"\n [attr.aria-label]=\"calendarMonth.date()?.getFullYear()+' '+month.month\"\n [date]=\"monthStart\"\n [ngClass]=\"monthStart | calendarClassMonth:(rowIdx*3+idx)\"\n [tabindex]=\"calendarMonth.disabled$() ? -1 : 0\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ month.month }}\n </div>\n </td>\n }\n </tr>\n }\n\n }\n @default {\n @let weekSelection = selectionType() === 'week';\n @let daySelection = selectionType() === 'day';\n @for (week of monthDetails(); track week.days[0]; let i = $index) {\n <tr #calendarRow=\"cCalendarRow\"\n (click)=\"weekSelection && (calendarRow.current) && calendarRow.date && handleDayCellClick(calendarRow.date)\"\n (keydown)=\"weekSelection && (calendarRow.current) && calendarRow.date && handleDayCellKeyDown($event, calendarRow.date)\"\n (keyup)=\"weekSelection && (calendarRow.current) && calendarRow.date && handleDayCellKeyUp($event, calendarRow.date)\"\n (mouseenter)=\"weekSelection && calendarRow.date && handleCellMouseEnter(calendarRow.date)\"\n [cCalendarRow]=\"week\"\n >\n @if (showWeekNumber()) {\n <th class=\"calendar-cell-week-number\">\n {{ week.weekNumber === 0 ? 53 : week.weekNumber }}\n </th>\n }\n @for (dateObj of week.days; track dateObj.date; let idx = $index) {\n @let currentMonth = dateObj.month === 'current';\n @if (currentMonth || showAdjacentDays()) {\n @let selectable = daySelection && (currentMonth || selectAdjacentDays());\n <td #calendarCell=\"cCalendarDay\"\n (click)=\"selectable && handleDayCellClick(dateObj.date)\"\n (keydown)=\"selectable && handleDayCellKeyDown($event, dateObj.date)\"\n (keyup)=\"selectable && handleDayCellKeyUp($event, dateObj.date)\"\n (mouseenter)=\"selectable && handleCellMouseEnter(dateObj.date)\"\n [attr.aria-label]=\"dateObj.date | calendarDayTitle:locale()\"\n [date]=\"dateObj.date\"\n [month]=\"dateObj.month\"\n [ngClass]=\"dateObj | calendarClassDay:{minDate: minDate(), maxDate: maxDate(), disabledDates: disabledDates(), dateFilter: dateFilter()}\"\n [tabindex]=\"selectable && !isDateDisabled(dateObj.date) ? 0 : -1\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ dateObj.date | calendarDay:dayFormat():locale() }}\n </div>\n </td>\n } @else {\n <td class=\"calendar-cell\"></td>\n }\n }\n </tr>\n }\n }\n }\n </tbody>\n</table>\n\n", styles: [".btn-transparent:focus-visible{outline:-webkit-focus-ring-color auto 1px}.calendar-row:focus-visible{box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem}.calendar-row:focus-within:not([tabindex=\"-1\"]){outline:0;box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem;outline-style:auto!important}.calendar-row:focus:not([tabindex=\"-1\"]){outline:0;box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem;outline-style:auto!important}.calendar-cell:focus:not(:focus-visible):not([tabindex=\"-1\"]){box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem}.calendar-cell-inner{-webkit-user-select:none;user-select:none}\n"], dependencies: [{ kind: "directive", type: CalendarDayDirective, selector: "[cCalendarDay]", inputs: ["date", "month"], exportAs: ["cCalendarDay"] }, { kind: "pipe", type: CalendarDayPipe, name: "calendarDay" }, { kind: "pipe", type: CalendarDayTitlePipe, name: "calendarDayTitle" }, { kind: "directive", type: CalendarRowDirective, selector: "[cCalendarRow]", inputs: ["cCalendarRow"], exportAs: ["cCalendarRow"] }, { kind: "pipe", type: CalendarClassDayPipe, name: "calendarClassDay" }, { kind: "pipe", type: CalendarClassMonthPipe, name: "calendarClassMonth" }, { kind: "pipe", type: CalendarClassYearPipe, name: "calendarClassYear" }, { kind: "pipe", type: CalendarWeekdayPipe, name: "calendarWeekday" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
3062
3048
  }
3063
3049
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarMonthComponent, decorators: [{
3064
3050
  type: Component,
@@ -3074,34 +3060,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
3074
3060
  CalendarWeekdayPipe,
3075
3061
  NgClass,
3076
3062
  AsyncPipe
3077
- ], template: "<table>\n @if (view === 'days') {\n <thead>\n <tr>\n @if (showWeekNumber) {\n <th class=\"calendar-cell\">\n <div class=\"calendar-header-cell-inner\">{{ weekNumbersLabel }}</div>\n </th>\n }\n @for (weekDay of weekDays; track weekDay.date; let i = $index) {\n @let date = weekDay.date ;\n <th class=\"calendar-cell\" abbr=\"{{date | calendarWeekday:'long':locale}}\">\n <div class=\"calendar-header-cell-inner\">\n {{ date | calendarWeekday:weekdayFormat:locale }}\n </div>\n </th>\n }\n </tr>\n </thead>\n }\n <tbody (mouseleave)=\"handleCellMouseLeave()\">\n @switch (view) {\n @case ('years') {\n @for (yearsRow of listOfYears(); track yearsRow; let rowIdx = $index) {\n <tr>\n @for (year of yearsRow; track year; let idx = $index) {\n <td\n #calendarYear=\"cCalendarDay\"\n (click)=\"!calendarYear.disabled$() && handleYearCellClick(year)\"\n (keydown)=\"calendarYear.date() && handleDayCellKeyDown($event, calendarYear.date())\"\n (keyup)=\"handleYearCellKeyUp($event, calendarYear.date())\"\n (mouseenter)=\"calendarYear.date() && handleCellMouseEnter(calendarYear.date())\"\n [attr.aria-label]=\"calendarYear.date()?.getFullYear()\"\n [date]=\"getYearStart(year)\"\n [ngClass]=\"year | calendarClassYear\"\n [tabindex]=\"calendarYear.disabled$() ? -1 : 0\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ yearNumber(year) }}\n </div>\n </td>\n }\n </tr>\n }\n }\n @case ('months') {\n @for (monthsRow of listOfMonths(); track monthsRow; let rowIdx = $index) {\n <tr>\n @for (month of monthsRow; track month; let idx = $index) {\n <td\n #calendarMonth=\"cCalendarDay\"\n (click)=\"!calendarMonth.disabled$() && handleMonthCellClick(calendarMonth.date())\"\n (keydown)=\"calendarMonth.date() && handleDayCellKeyDown($event, calendarMonth.date())\"\n (keyup)=\"handleMonthCellKeyUp($event, calendarMonth.date())\"\n (mouseenter)=\"calendarMonth.date() && handleCellMouseEnter(calendarMonth.date())\"\n [attr.aria-label]=\"calendarMonth.date()?.getFullYear()+' '+month.month\"\n [date]=\"getMonthStart(rowIdx*3+idx)\"\n [ngClass]=\"calendarDate | calendarClassMonth:(rowIdx*3+idx)\"\n [tabindex]=\"calendarMonth.disabled$() ? -1 : 0\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ month.month }}\n </div>\n </td>\n }\n </tr>\n }\n\n }\n @default {\n @for (week of monthDetails; track week; let i = $index) {\n <tr #calendarRow=\"cCalendarRow\"\n (click)=\"selectionType === 'week' && (calendarRow.current) && calendarRow.date && handleDayCellClick(calendarRow.date)\"\n (keydown)=\"selectionType === 'week' && (calendarRow.current) && calendarRow.date && handleDayCellKeyDown($event, calendarRow.date)\"\n (keyup)=\"selectionType === 'week' && (calendarRow.current) && calendarRow.date && handleDayCellKeyUp($event, calendarRow.date)\"\n (mouseenter)=\"selectionType === 'week' && calendarRow.date && handleCellMouseEnter(calendarRow.date)\"\n [cCalendarRow]=\"week\"\n >\n @if (showWeekNumber) {\n <th class=\"calendar-cell-week-number\">\n {{ week.weekNumber === 0 ? 53 : week.weekNumber }}\n </th>\n }\n @for (dateObj of week.days; track dateObj.date; let idx = $index) {\n @if (dateObj.month === 'current' || showAdjacentDays) {\n <td #calendarCell=\"cCalendarDay\"\n (click)=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && handleDayCellClick(dateObj.date)\"\n (keydown)=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && handleDayCellKeyDown($event, dateObj.date)\"\n (keyup)=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && handleDayCellKeyUp($event, dateObj.date)\"\n (mouseenter)=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && handleCellMouseEnter(dateObj.date)\"\n [attr.aria-label]=\"dateObj.date | calendarDayTitle:locale\"\n [date]=\"dateObj.date\"\n [month]=\"dateObj.month\"\n [ngClass]=\"dateObj | calendarClassDay:{minDate, maxDate, disabledDates, dateFilter}\"\n [tabindex]=\"selectionType === 'day' && (dateObj.month === 'current' || selectAdjacentDays) && !isDateDisabled(dateObj.date) ? 0 : -1\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ dateObj.date | calendarDay:dayFormat:locale }}\n </div>\n </td>\n } @else {\n <td class=\"calendar-cell\"></td>\n }\n }\n </tr>\n }\n\n }\n }\n\n </tbody>\n</table>\n\n", styles: [".btn-transparent:focus-visible{outline:-webkit-focus-ring-color auto 1px}.calendar-row:focus-visible{box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem}.calendar-row:focus-within:not([tabindex=\"-1\"]){outline:0;box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem;outline-style:auto!important}.calendar-row:focus:not([tabindex=\"-1\"]){outline:0;box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem;outline-style:auto!important}.calendar-cell:focus:not(:focus-visible):not([tabindex=\"-1\"]){box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem}\n"] }]
3078
- }], ctorParameters: () => [{ type: CalendarService }], propDecorators: { addMonths: [{
3079
- type: Input
3080
- }], startDate: [{
3081
- type: Input
3082
- }], endDate: [{
3083
- type: Input
3084
- }], disabledDates: [{
3085
- type: Input
3086
- }], firstDayOfWeek: [{
3087
- type: Input,
3088
- args: [{ transform: numberAttribute }]
3089
- }], locale: [{
3090
- type: Input
3091
- }], range: [{
3092
- type: Input,
3093
- args: [{ transform: booleanAttribute }]
3094
- }], weekdayFormat: [{
3095
- type: Input
3096
- }], view: [{
3097
- type: Input
3098
- }], maxDate: [{
3099
- type: Input
3100
- }], minDate: [{
3101
- type: Input
3102
- }], calendarDate: [{
3103
- type: Input
3104
- }], calendarDays: [{
3063
+ ], template: "<table>\n @if (view() === 'days') {\n <thead>\n <tr>\n @if (showWeekNumber()) {\n <th class=\"calendar-cell\">\n <div class=\"calendar-header-cell-inner\">{{ weekNumbersLabel() }}</div>\n </th>\n }\n @for (weekDay of weekDays(); track weekDay.date; let i = $index) {\n @let date = weekDay.date ;\n <th class=\"calendar-cell\" abbr=\"{{date | calendarWeekday:'long':locale()}}\">\n <div class=\"calendar-header-cell-inner\">\n {{ date | calendarWeekday:weekdayFormat():locale() }}\n </div>\n </th>\n }\n </tr>\n </thead>\n }\n <tbody (mouseleave)=\"handleCellMouseLeave()\">\n @switch (view()) {\n @case ('years') {\n @for (yearsRow of listOfYears(); track yearsRow[0]; let rowIdx = $index) {\n <tr>\n @for (year of yearsRow; track year; let idx = $index) {\n <td\n #calendarYear=\"cCalendarDay\"\n (click)=\"!calendarYear.disabled$() && handleYearCellClick(year)\"\n (keydown)=\"calendarYear.date() && handleDayCellKeyDown($event, calendarYear.date())\"\n (keyup)=\"handleYearCellKeyUp($event, calendarYear.date())\"\n (mouseenter)=\"calendarYear.date() && handleCellMouseEnter(calendarYear.date())\"\n [attr.aria-label]=\"calendarYear.date()?.getFullYear()\"\n [date]=\"getYearStart(year)\"\n [ngClass]=\"year | calendarClassYear\"\n [tabindex]=\"calendarYear.disabled$() ? -1 : 0\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ yearNumber(year) }}\n </div>\n </td>\n }\n </tr>\n }\n }\n @case ('months') {\n @for (monthsRow of listOfMonths(); track monthsRow[0]; let rowIdx = $index) {\n <tr>\n @for (month of monthsRow; track month; let idx = $index) {\n @let monthStart = getMonthStart(rowIdx*3+idx);\n <td\n #calendarMonth=\"cCalendarDay\"\n (click)=\"!calendarMonth.disabled$() && handleMonthCellClick(calendarMonth.date())\"\n (keydown)=\"calendarMonth.date() && handleDayCellKeyDown($event, calendarMonth.date())\"\n (keyup)=\"handleMonthCellKeyUp($event, calendarMonth.date())\"\n (mouseenter)=\"calendarMonth.date() && handleCellMouseEnter(calendarMonth.date())\"\n [attr.aria-label]=\"calendarMonth.date()?.getFullYear()+' '+month.month\"\n [date]=\"monthStart\"\n [ngClass]=\"monthStart | calendarClassMonth:(rowIdx*3+idx)\"\n [tabindex]=\"calendarMonth.disabled$() ? -1 : 0\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ month.month }}\n </div>\n </td>\n }\n </tr>\n }\n\n }\n @default {\n @let weekSelection = selectionType() === 'week';\n @let daySelection = selectionType() === 'day';\n @for (week of monthDetails(); track week.days[0]; let i = $index) {\n <tr #calendarRow=\"cCalendarRow\"\n (click)=\"weekSelection && (calendarRow.current) && calendarRow.date && handleDayCellClick(calendarRow.date)\"\n (keydown)=\"weekSelection && (calendarRow.current) && calendarRow.date && handleDayCellKeyDown($event, calendarRow.date)\"\n (keyup)=\"weekSelection && (calendarRow.current) && calendarRow.date && handleDayCellKeyUp($event, calendarRow.date)\"\n (mouseenter)=\"weekSelection && calendarRow.date && handleCellMouseEnter(calendarRow.date)\"\n [cCalendarRow]=\"week\"\n >\n @if (showWeekNumber()) {\n <th class=\"calendar-cell-week-number\">\n {{ week.weekNumber === 0 ? 53 : week.weekNumber }}\n </th>\n }\n @for (dateObj of week.days; track dateObj.date; let idx = $index) {\n @let currentMonth = dateObj.month === 'current';\n @if (currentMonth || showAdjacentDays()) {\n @let selectable = daySelection && (currentMonth || selectAdjacentDays());\n <td #calendarCell=\"cCalendarDay\"\n (click)=\"selectable && handleDayCellClick(dateObj.date)\"\n (keydown)=\"selectable && handleDayCellKeyDown($event, dateObj.date)\"\n (keyup)=\"selectable && handleDayCellKeyUp($event, dateObj.date)\"\n (mouseenter)=\"selectable && handleCellMouseEnter(dateObj.date)\"\n [attr.aria-label]=\"dateObj.date | calendarDayTitle:locale()\"\n [date]=\"dateObj.date\"\n [month]=\"dateObj.month\"\n [ngClass]=\"dateObj | calendarClassDay:{minDate: minDate(), maxDate: maxDate(), disabledDates: disabledDates(), dateFilter: dateFilter()}\"\n [tabindex]=\"selectable && !isDateDisabled(dateObj.date) ? 0 : -1\"\n cCalendarDay\n >\n <div class=\"calendar-cell-inner\">\n {{ dateObj.date | calendarDay:dayFormat():locale() }}\n </div>\n </td>\n } @else {\n <td class=\"calendar-cell\"></td>\n }\n }\n </tr>\n }\n }\n }\n </tbody>\n</table>\n\n", styles: [".btn-transparent:focus-visible{outline:-webkit-focus-ring-color auto 1px}.calendar-row:focus-visible{box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem}.calendar-row:focus-within:not([tabindex=\"-1\"]){outline:0;box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem;outline-style:auto!important}.calendar-row:focus:not([tabindex=\"-1\"]){outline:0;box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem;outline-style:auto!important}.calendar-cell:focus:not(:focus-visible):not([tabindex=\"-1\"]){box-shadow:var(--cui-calendar-cell-focus-box-shadow);border-radius:.375rem}.calendar-cell-inner{-webkit-user-select:none;user-select:none}\n"] }]
3064
+ }], ctorParameters: () => [], propDecorators: { calendarDays: [{
3105
3065
  type: ViewChildren,
3106
3066
  args: [CalendarDayDirective]
3107
3067
  }], calendarRows: [{
@@ -3128,365 +3088,335 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
3128
3088
  }] });
3129
3089
 
3130
3090
  class CalendarComponent {
3131
- #destroyRef;
3132
- constructor(calendarService) {
3133
- this.calendarService = calendarService;
3091
+ constructor() {
3134
3092
  this.#destroyRef = inject(DestroyRef);
3135
- this._calendarDate = tryDate(new Date());
3136
- this._calendars = 1;
3137
- this._dayFormat = 'numeric';
3138
- this._disabledDates = [];
3139
- this._startDate = null;
3140
- this._endDate = null;
3141
- this._firstDayOfWeek = 1;
3142
- this._locale = 'default';
3143
- this._maxDate = null;
3144
- this._minDate = null;
3145
- this._navigation = true;
3146
- this._navYearFirst = false;
3147
- this._range = false;
3148
- this._view = 'days';
3149
- this._weekdayFormat = 'short';
3150
- // #selectionType = signal<SelectionType>('month');
3151
- this.#selectionType = 'day';
3152
- this.#showWeekNumber = signal(false);
3153
- this.calendarCellHover = new EventEmitter();
3154
- this.calendarDateChange = new EventEmitter();
3155
- this.endDateChange = new EventEmitter();
3156
- this.startDateChange = new EventEmitter();
3157
- this.viewChange = new EventEmitter();
3158
- this._hoverDate = null;
3159
- this.getCalendarDate = getCalendarDate;
3160
- this.calendarStateSubscribe();
3161
- }
3162
- /**
3163
- * Default date of the component
3164
- * @type Date | string
3165
- */
3166
- set calendarDate(value) {
3167
- // const _value = new Date(tryDate((value ?? this.startDate ?? new Date()), 'calendarDate'));
3168
- const _value = new Date(tryDate(value ?? this.startDate, 'calendarDate'));
3169
- // if (!isDateBetweenMinMax(_value, this.minDate, this.maxDate)) {
3170
- // // _value = _value < (this.minDate ?? 0) ? this.minDate ?? this.maxDate ?? _value : this.maxDate ?? this.minDate ?? _value;
3171
- // // return;
3172
- // _value = this._calendarDate;
3173
- // }
3174
- if (!!_value && this._calendarDate.getTime() !== _value.getTime()) {
3175
- const _calendarDate = new Date(new Date(_value.setDate(1)).setHours(0, 0, 0, 0));
3176
- this._calendarDate = _calendarDate;
3177
- this.calendarDateChange.emit(_calendarDate);
3178
- this.calendarService.update({ calendarDate: _calendarDate });
3179
- }
3180
- }
3181
- get calendarDate() {
3182
- return this._calendarDate;
3183
- }
3184
- /**
3185
- * The number of calendars that render on desktop devices.
3186
- * @type number
3187
- * default 1
3188
- */
3189
- set calendars(value) {
3190
- this._calendars = value;
3191
- }
3192
- get calendars() {
3193
- return this._calendars;
3194
- }
3195
- get calendarsArray() {
3196
- return Array.from({ length: this.calendars }, (v, i) => i);
3197
- }
3198
- /**
3199
- * Set the format of day name.
3200
- * @default 'numeric'
3201
- * @type DayFormatType
3202
- */
3203
- set dayFormat(value) {
3204
- this._dayFormat = value;
3205
- this.calendarService.update({ dayFormat: this._dayFormat });
3206
- }
3207
- get dayFormat() {
3208
- return this._dayFormat;
3209
- }
3210
- /**
3211
- * Specify the list of dates that cannot be selected.
3212
- * @type Date[] | Date[][]
3213
- */
3214
- set disabledDates(value) {
3215
- this._disabledDates = value;
3216
- this.calendarService.update({ disabledDates: this._disabledDates });
3217
- }
3218
- get disabledDates() {
3219
- return this._disabledDates;
3220
- }
3221
- /**
3222
- * Initial selected date.
3223
- * @type (Date | null)
3224
- */
3225
- set startDate(value) {
3226
- const date = !!value ? tryDate(value, 'startDate') : null;
3227
- if (this._startDate?.getTime() !== date?.getTime()) {
3228
- this._startDate = date;
3229
- this.calendarService.update({ startDate: this._startDate });
3230
- if (!this.range || !this._startDate || (this.endDate && this._startDate > this.endDate)) {
3231
- this.endDate = null;
3232
- }
3233
- }
3234
- }
3235
- get startDate() {
3236
- return this._startDate;
3237
- }
3238
- /**
3239
- * Initial selected to date (range).
3240
- * @type Date | null
3241
- */
3242
- set endDate(value) {
3243
- const date = !!value ? tryDate(value, 'endDate') : null;
3244
- if (this._endDate?.getTime() !== date?.getTime()) {
3245
- this._endDate = date;
3246
- // this._endDate = this.range ? this._endDate : null;
3247
- this.calendarService.update({ endDate: this._endDate });
3248
- }
3249
- }
3250
- get endDate() {
3251
- return this.range ? this._endDate : null;
3252
- }
3253
- /**
3254
- * Sets the day of start week.
3255
- * - 0 - Sunday,
3256
- * - 1 - Monday,
3257
- * - 2 - Tuesday,
3258
- * - 3 - Wednesday,
3259
- * - 4 - Thursday,
3260
- * - 5 - Friday,
3261
- * - 6 - Saturday,
3262
- *
3263
- * @type number
3264
- * @default 1
3265
- */
3266
- set firstDayOfWeek(value) {
3267
- this._firstDayOfWeek = value;
3268
- }
3269
- get firstDayOfWeek() {
3270
- return this._firstDayOfWeek;
3271
- }
3272
- /**
3273
- * Sets the default locale for components. If not set, it is inherited from the browser.
3274
- * @default 'default'
3275
- */
3276
- set locale(value) {
3277
- this._locale = value;
3278
- this.calendarService.update({ locale: value });
3279
- }
3280
- get locale() {
3281
- return this._locale;
3282
- }
3283
- /**
3284
- * Max selectable date.
3285
- */
3286
- set maxDate(value) {
3287
- this._maxDate = !!value ? tryDate(value, 'maxDate') : null;
3288
- this.calendarService.update({ maxDate: this._maxDate });
3289
- }
3290
- get maxDate() {
3291
- return this._maxDate;
3292
- }
3293
- /**
3294
- * Min selectable date.
3295
- */
3296
- set minDate(value) {
3297
- this._minDate = value ? tryDate(value, 'minDate') : null;
3298
- this.calendarService.update({ minDate: this._minDate });
3299
- }
3300
- get minDate() {
3301
- return this._minDate;
3302
- }
3303
- /**
3304
- * Show navigation.
3305
- * @type boolean
3306
- */
3307
- set navigation(value) {
3308
- this._navigation = value;
3309
- }
3310
- get navigation() {
3311
- return this._navigation;
3312
- }
3313
- /**
3314
- * Reorder year-month navigation, and render year first.
3315
- * @type boolean
3316
- * @default false
3317
- */
3318
- set navYearFirst(value) {
3319
- this._navYearFirst = value;
3320
- this.calendarService.update({ navYearFirst: this._navYearFirst });
3321
- }
3322
- get navYearFirst() {
3323
- return this._navYearFirst;
3324
- }
3325
- /**
3326
- * Allow range selection.
3327
- * @type boolean
3328
- * @default false
3329
- */
3330
- set range(value) {
3331
- this._range = value;
3332
- this.calendarService.update({ range: this._range });
3333
- }
3334
- get range() {
3335
- return this._range;
3336
- }
3337
- /**
3338
- * Set calendar view.
3339
- * @type 'days' | 'months' | 'years'
3340
- * @default 'days'
3341
- */
3342
- set view(value) {
3343
- // if (!['days', 'weeks'].includes(this.selectionType)) {
3344
- // value = this.selectionType === 'month' ? 'months' : 'years';
3345
- // }
3346
- this._view = value;
3347
- this.calendarService.update({ view: value });
3348
- }
3349
- get view() {
3350
- return this._view;
3351
- }
3352
- /**
3353
- * Set length or format of day name.
3354
- * @type number | 'long' | 'narrow' | 'short'
3355
- * @default 'short'
3356
- */
3357
- set weekdayFormat(value) {
3358
- this._weekdayFormat = value;
3359
- this.calendarService.update({ weekdayFormat: this._weekdayFormat });
3360
- }
3361
- get weekdayFormat() {
3362
- return this._weekdayFormat;
3363
- }
3364
- set dateFilter(value) {
3365
- this.calendarService.update({ dateFilter: value });
3366
- }
3367
- /**
3368
- * Set whether days in adjacent months shown before or after the current month are selectable. This only applies if the `showAdjacentDays` option is set to true.
3369
- * @type boolean
3370
- * @default false
3371
- * @since 4.4.10
3372
- */
3373
- set selectAdjacentDays(value) {
3374
- this.calendarService.update({ selectAdjacentDays: value });
3375
- }
3376
- /**
3377
- * Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
3378
- * @type boolean
3379
- * @default true
3380
- * @since 4.4.10
3381
- */
3382
- set showAdjacentDays(value) {
3383
- this.calendarService.update({ showAdjacentDays: value ?? true });
3384
- }
3385
- /**
3386
- * Specify the type of date selection as day, week, month, or year.
3387
- * @type 'day' | 'week' | 'month' | 'year'
3388
- * @default 'day'
3389
- * @since 5.0.0
3390
- */
3391
- set selectionType(value) {
3392
- this.calendars = ['month', 'year'].includes(value) ? 1 : this.calendars;
3393
- this.#selectionType = value;
3394
- this.view = ['day', 'week'].includes(value) ? 'days' : value === 'month' ? 'months' : 'years';
3395
- this.calendarService.update({ selectionType: value, view: this.view });
3396
- }
3397
- get selectionType() {
3398
- return this.#selectionType;
3399
- }
3400
- // #selectionType = signal<SelectionType>('month');
3401
- #selectionType;
3402
- /**
3403
- * Set whether to display week numbers in the calendar.
3404
- * @type boolean
3405
- * @default false
3406
- * @since 5.0.0
3407
- */
3408
- set showWeekNumber(value) {
3409
- this.#showWeekNumber.set(value);
3410
- this.calendarService.update({ showWeekNumber: value });
3411
- }
3412
- #showWeekNumber;
3413
- /**
3414
- * Label displayed over week numbers in the calendar.
3415
- * @type string
3416
- * @default undefined
3417
- * @since 5.0.0
3418
- */
3419
- set weekNumbersLabel(value) {
3420
- this.calendarService.update({ weekNumbersLabel: value });
3421
- }
3422
- // used with calendarService
3423
- set hoverDate(value) {
3424
- this._hoverDate = value;
3425
- this.calendarCellHover.emit(value);
3426
- }
3427
- get hoverDate() {
3428
- return this._hoverDate;
3429
- }
3430
- get hostClasses() {
3431
- const selectionType = this.#selectionType;
3432
- const view = this.view;
3433
- return {
3434
- calendars: true,
3435
- [`select-${selectionType}`]: selectionType && view === 'days',
3436
- 'show-week-numbers': this.#showWeekNumber()
3437
- };
3093
+ this.#calendarService = inject(CalendarService);
3094
+ this.calendarDateChange = output();
3095
+ /**
3096
+ * Default date of the component
3097
+ * @type Date | string
3098
+ */
3099
+ this.calendarDateModel = model(new Date(new Date().setDate(1)).setHours(0, 0, 0, 0), {
3100
+ alias: 'calendarDate'
3101
+ });
3102
+ this.calendarDate = computed(() => {
3103
+ const date = convertToDateObject(this.calendarDateModel() ?? this.startDate() ?? new Date(), this.selectionType(), 'calendarDate') ?? new Date();
3104
+ const calendarDate = new Date(new Date(date.setDate(1)).setHours(0, 0, 0, 0));
3105
+ return convertToDateObject(calendarDate, this.selectionType(), 'calendarDate');
3106
+ }, { equal: equalDates });
3107
+ this.calendarDateEffect = effect(() => {
3108
+ this.#calendarService.update({ calendarDate: this.calendarDate() });
3109
+ this.calendarDateChange.emit(this.calendarDate());
3110
+ }, { allowSignalWrites: true });
3111
+ /**
3112
+ * The number of calendars that render on desktop devices.
3113
+ * @type number
3114
+ * default 1
3115
+ */
3116
+ this.calendars = input(1, { transform: numberAttribute });
3117
+ this.calendarsArray = computed(() => {
3118
+ const calendars = ['month', 'year'].includes(this.selectionType()) ? 1 : this.calendars();
3119
+ return Array.from({ length: calendars }, (v, i) => i);
3120
+ });
3121
+ /**
3122
+ * Set the format of day name.
3123
+ * @default 'numeric'
3124
+ * @type DayFormatType
3125
+ */
3126
+ this.dayFormat = input('numeric');
3127
+ this.dayFormatEffect = effect(() => {
3128
+ this.#calendarService.update({ dayFormat: this.dayFormat() });
3129
+ }, { allowSignalWrites: true });
3130
+ /**
3131
+ * Specify the list of dates that cannot be selected.
3132
+ * @type (Date | Date[])[]
3133
+ */
3134
+ this.disabledDates = input([]);
3135
+ this.disabledDatesEffect = effect(() => {
3136
+ this.#calendarService.update({ disabledDates: this.disabledDates() });
3137
+ }, { allowSignalWrites: true });
3138
+ this.endDateChange = output();
3139
+ this.startDateChange = output();
3140
+ /**
3141
+ * Initial selected date.
3142
+ * @type (Date | null)
3143
+ */
3144
+ this.startDateModel = model(null, { alias: 'startDate' });
3145
+ this.startDate = computed(() => {
3146
+ const date = this.startDateModel() ?? null;
3147
+ return !!date ? convertToDateObject(date, this.selectionType(), 'startDate') : null;
3148
+ }, { equal: equalDates });
3149
+ /**
3150
+ * Initial selected to date (range).
3151
+ * @type Date | null
3152
+ */
3153
+ this.endDateModel = model(null, { alias: 'endDate' });
3154
+ this.endDate = computed(() => {
3155
+ const date = this.endDateModel() ?? null;
3156
+ return !!date && this.range() ? convertToDateObject(date, this.selectionType(), 'endDate') : null;
3157
+ }, { equal: equalDates });
3158
+ this.datesEffect = effect(() => {
3159
+ this.#calendarService.update({ startDate: this.startDate(), endDate: this.endDate() });
3160
+ this.startDateChange.emit(this.startDate());
3161
+ this.endDateChange.emit(this.endDate());
3162
+ }, { allowSignalWrites: true });
3163
+ /**
3164
+ * Sets the day of start week.
3165
+ * - 0 - Sunday,
3166
+ * - 1 - Monday,
3167
+ * - 2 - Tuesday,
3168
+ * - 3 - Wednesday,
3169
+ * - 4 - Thursday,
3170
+ * - 5 - Friday,
3171
+ * - 6 - Saturday,
3172
+ *
3173
+ * @type number
3174
+ * @default 1
3175
+ */
3176
+ this.firstDayOfWeek = input(1);
3177
+ this.firstDayOfWeekEffect = effect(() => {
3178
+ this.#calendarService.update({ firstDayOfWeek: this.firstDayOfWeek() });
3179
+ }, { allowSignalWrites: true });
3180
+ /**
3181
+ * Sets the default locale for components. If not set, it is inherited from the browser.
3182
+ * @default 'default'
3183
+ */
3184
+ this.locale = input('default');
3185
+ this.localeEffect = effect(() => {
3186
+ this.#calendarService.update({ locale: this.locale() });
3187
+ }, { allowSignalWrites: true });
3188
+ /**
3189
+ * Max selectable date.
3190
+ */
3191
+ this.maxDateInput = input(null, { alias: 'maxDate' });
3192
+ this.maxDateEffect = effect(() => {
3193
+ const date = this.maxDateInput();
3194
+ const maxDate = !!date ? convertToDateObject(date, undefined, 'maxDate') : null;
3195
+ this.#calendarService.update({ maxDate: maxDate });
3196
+ }, { allowSignalWrites: true });
3197
+ /**
3198
+ * Min selectable date.
3199
+ */
3200
+ this.minDateInput = input(null, { alias: 'minDate' });
3201
+ this.minDateEffect = effect(() => {
3202
+ const date = this.minDateInput();
3203
+ const minDate = !!date ? convertToDateObject(date, undefined, 'minDate') : null;
3204
+ this.#calendarService.update({ minDate: minDate });
3205
+ }, { allowSignalWrites: true });
3206
+ /**
3207
+ * Show navigation.
3208
+ * @type boolean
3209
+ */
3210
+ this.navigation = input(true, { transform: booleanAttribute });
3211
+ /**
3212
+ * Reorder year-month navigation, and render year first.
3213
+ * @type boolean
3214
+ * @default false
3215
+ */
3216
+ this.navYearFirst = input(false, { transform: booleanAttribute });
3217
+ this.navYearFirstEffect = effect(() => {
3218
+ this.#calendarService.update({ navYearFirst: this.navYearFirst() });
3219
+ }, { allowSignalWrites: true });
3220
+ /**
3221
+ * Allow range selection.
3222
+ * @type boolean
3223
+ * @default false
3224
+ */
3225
+ this.range = input(false, { transform: booleanAttribute });
3226
+ this.rangeEffect = effect(() => {
3227
+ this.#calendarService.update({ range: this.range() });
3228
+ }, { allowSignalWrites: true });
3229
+ /**
3230
+ * Set calendar view.
3231
+ * @type 'days' | 'months' | 'years'
3232
+ * @default 'days'
3233
+ */
3234
+ this.view = model('days');
3235
+ this.viewEffect = effect(() => {
3236
+ this.#calendarService.update({ view: this.view() });
3237
+ }, { allowSignalWrites: true });
3238
+ /**
3239
+ * Set length or format of day name.
3240
+ * @type number | 'long' | 'narrow' | 'short'
3241
+ * @default 'short'
3242
+ */
3243
+ this.weekdayFormat = input('short');
3244
+ this.weekdayFormatEffect = effect(() => {
3245
+ this.#calendarService.update({ weekdayFormat: this.weekdayFormat() });
3246
+ }, { allowSignalWrites: true });
3247
+ this.dateFilter = input();
3248
+ this.dateFilterEffect = effect(() => {
3249
+ this.#calendarService.update({ dateFilter: this.dateFilter() });
3250
+ }, { allowSignalWrites: true });
3251
+ /**
3252
+ * Set whether days in adjacent months shown before or after the current month are selectable. This only applies if the `showAdjacentDays` option is set to true.
3253
+ * @type boolean
3254
+ * @default false
3255
+ * @since 4.4.10
3256
+ */
3257
+ this.selectAdjacentDays = input(false, { transform: booleanAttribute });
3258
+ this.selectAdjacentDaysEffect = effect(() => {
3259
+ this.#calendarService.update({ selectAdjacentDays: this.selectAdjacentDays() });
3260
+ }, { allowSignalWrites: true });
3261
+ /**
3262
+ * Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
3263
+ * @type boolean
3264
+ * @default true
3265
+ * @since 4.4.10
3266
+ */
3267
+ this.showAdjacentDays = input(true, { transform: booleanAttribute });
3268
+ this.showAdjacentDaysEffect = effect(() => {
3269
+ this.#calendarService.update({ showAdjacentDays: this.showAdjacentDays() });
3270
+ }, { allowSignalWrites: true });
3271
+ /**
3272
+ * Specify the type of date selection as day, week, month, or year.
3273
+ * @type 'day' | 'week' | 'month' | 'year'
3274
+ * @default 'day'
3275
+ * @since 5.0.0
3276
+ */
3277
+ this.selectionType = input('day');
3278
+ this.selectionTypeEffect = effect(() => {
3279
+ const selectionType = this.selectionType();
3280
+ const view = ['day', 'week'].includes(selectionType) ? 'days' : selectionType === 'month' ? 'months' : 'years';
3281
+ this.#calendarService.update({ selectionType: selectionType, view: view });
3282
+ }, { allowSignalWrites: true });
3283
+ /**
3284
+ * Set whether to display week numbers in the calendar.
3285
+ * @type boolean
3286
+ * @default false
3287
+ * @since 5.0.0
3288
+ */
3289
+ this.showWeekNumber = input(false, { transform: booleanAttribute });
3290
+ this.showWeekNumberEffect = effect(() => {
3291
+ this.#calendarService.update({ showWeekNumber: this.showWeekNumber() });
3292
+ }, { allowSignalWrites: true });
3293
+ /**
3294
+ * Label displayed over week numbers in the calendar.
3295
+ * @type string
3296
+ * @default undefined
3297
+ * @since 5.0.0
3298
+ */
3299
+ this.weekNumbersLabel = input();
3300
+ this.weekNumbersLabelEffect = effect(() => {
3301
+ this.#calendarService.update({ weekNumbersLabel: this.weekNumbersLabel() });
3302
+ }, { allowSignalWrites: true });
3303
+ this.ariaNextMonthLabel = input('Next month');
3304
+ this.ariaNextYearLabel = input('Next year');
3305
+ this.ariaPrevMonthLabel = input('Previous month');
3306
+ this.ariaPrevYearLabel = input('Previous year');
3307
+ this.calendarCellHover = output();
3308
+ // used with calendarService
3309
+ this.hoverDate = signal(null);
3310
+ this.hoverDateEffect = effect(() => {
3311
+ this.calendarCellHover.emit(this.hoverDate());
3312
+ }, { allowSignalWrites: true });
3313
+ this.hostClasses = computed(() => {
3314
+ const selectionType = this.selectionType();
3315
+ const view = this.view();
3316
+ return {
3317
+ calendars: true,
3318
+ [`select-${selectionType}`]: selectionType && view === 'days',
3319
+ 'show-week-numbers': this.showWeekNumber()
3320
+ };
3321
+ });
3438
3322
  }
3323
+ #destroyRef;
3324
+ #calendarService;
3325
+ // @ViewChildren(CalendarMonthComponent) calendarMonths!: QueryList<CalendarMonthComponent>;
3439
3326
  ngOnInit() {
3440
- this.calendarService.update({
3441
- locale: this.locale ?? 'default',
3442
- view: this.view,
3443
- range: this.range,
3444
- selectionType: this.selectionType
3327
+ this.#calendarService.update({
3328
+ locale: this.locale() ?? 'default',
3329
+ view: this.view(),
3330
+ range: this.range(),
3331
+ selectionType: this.selectionType()
3445
3332
  // showAdjacentDays: this.showAdjacentDays,
3446
3333
  // selectAdjacentDays: this.selectAdjacentDays
3447
3334
  });
3448
3335
  }
3336
+ ngAfterViewInit() {
3337
+ setTimeout(() => {
3338
+ this.calendarStateSubscribe();
3339
+ });
3340
+ }
3449
3341
  calendarStateSubscribe() {
3450
- this.calendarService.calendarState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((state) => {
3342
+ const inputs = [
3343
+ 'dateFilter',
3344
+ 'dayFormat',
3345
+ 'disabledDates',
3346
+ 'firstDayOfWeek',
3347
+ 'locale',
3348
+ 'maxDate',
3349
+ 'minDate',
3350
+ 'navYearFirst',
3351
+ 'range',
3352
+ 'selectAdjacentDays',
3353
+ 'selectionType',
3354
+ 'showAdjacentDays',
3355
+ 'showWeekNumber',
3356
+ 'weekdayFormat',
3357
+ 'weekNumbersLabel'
3358
+ ];
3359
+ // const models = ['startDate', 'endDate', 'calendarDate'];
3360
+ this.#calendarService.calendarState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((state) => {
3451
3361
  const keys = Object.keys(state);
3452
3362
  for (const key of keys) {
3453
3363
  if (key in this) {
3364
+ if (inputs.includes(key)) {
3365
+ continue;
3366
+ }
3367
+ // if (models.includes(key) && state[key] !== undefined) {
3368
+ // const model = `${key}Model`;
3369
+ // // @ts-ignore
3370
+ // this[model].set(state[key]);
3371
+ // }
3372
+ if (key === 'startDate') {
3373
+ this.startDateModel.set(state[key]);
3374
+ continue;
3375
+ }
3376
+ if (key === 'endDate') {
3377
+ this.endDateModel.set(state[key]);
3378
+ continue;
3379
+ }
3380
+ if (key === 'calendarDate') {
3381
+ this.calendarDateModel.set(state[key]);
3382
+ continue;
3383
+ }
3384
+ if (key === 'view') {
3385
+ this.view.set(state[key]);
3386
+ continue;
3387
+ }
3388
+ // @ts-ignore
3389
+ const isWritableSignal = typeof this[key] === 'function' && typeof this[key].set === 'function';
3390
+ // @ts-ignore
3391
+ const isReadonlySignal = typeof this[key] === 'function' && typeof this[key].set === 'undefined';
3454
3392
  // @ts-ignore
3455
- if (this[key] !== state[key]) {
3393
+ if (isWritableSignal && !isReadonlySignal ? this[key]() !== state[key] : this[key] !== state[key]) {
3456
3394
  // @ts-ignore
3457
- this[key] = state[key];
3458
- if (key === 'startDate') {
3459
- setTimeout(() => {
3460
- this.startDateChange.emit(this._startDate);
3461
- });
3462
- continue;
3463
- }
3464
- if (key === 'endDate') {
3465
- setTimeout(() => {
3466
- this.endDateChange.emit(this._endDate);
3467
- });
3468
- }
3395
+ isWritableSignal ? this[key].set(state[key]) : (this[key] = state[key]);
3396
+ // this[key] = state[key];
3469
3397
  }
3470
3398
  }
3471
3399
  }
3472
3400
  });
3473
3401
  }
3474
3402
  setCalendarPage(years, months = 0, setMonth) {
3475
- const year = this.calendarDate.getFullYear();
3476
- const month = this.calendarDate.getMonth();
3403
+ const calendarDate = this.calendarDate();
3404
+ const year = calendarDate.getFullYear();
3405
+ const month = calendarDate.getMonth();
3477
3406
  const d = new Date(year, month, 1);
3478
3407
  years && d.setFullYear(d.getFullYear() + years);
3479
3408
  months && d.setMonth(d.getMonth() + months);
3480
3409
  typeof setMonth === 'number' && d.setMonth(setMonth);
3481
- this.calendarDate = d;
3410
+ this.calendarDateModel.set(d);
3482
3411
  }
3483
3412
  handleNavigationClick(direction, years = false) {
3413
+ const view = this.view();
3484
3414
  if (direction === 'prev') {
3485
3415
  if (years) {
3486
- this.setCalendarPage(this.view === 'years' ? -10 : -1);
3416
+ this.setCalendarPage(view === 'years' ? -10 : -1);
3487
3417
  return;
3488
3418
  }
3489
- if (this.view !== 'days') {
3419
+ if (view !== 'days') {
3490
3420
  this.setCalendarPage(-1);
3491
3421
  return;
3492
3422
  }
@@ -3495,10 +3425,10 @@ class CalendarComponent {
3495
3425
  }
3496
3426
  if (direction === 'next') {
3497
3427
  if (years) {
3498
- this.setCalendarPage(this.view === 'years' ? 10 : 1);
3428
+ this.setCalendarPage(view === 'years' ? 10 : 1);
3499
3429
  return;
3500
3430
  }
3501
- if (this.view !== 'days') {
3431
+ if (view !== 'days') {
3502
3432
  this.setCalendarPage(1);
3503
3433
  return;
3504
3434
  }
@@ -3511,87 +3441,20 @@ class CalendarComponent {
3511
3441
  * @type void
3512
3442
  */
3513
3443
  clearDates() {
3514
- this.calendarService.update({ endDate: null });
3515
- this.calendarService.update({ startDate: null });
3444
+ this.#calendarService.update({ startDate: null, endDate: null });
3516
3445
  }
3517
3446
  handleFocusChange($event) {
3518
3447
  if ($event === null) {
3519
- this.calendarService.update({ hoverDate: null });
3448
+ this.#calendarService.update({ hoverDate: null });
3520
3449
  }
3521
3450
  }
3522
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarComponent, deps: [{ token: CalendarService }], target: i0.ɵɵFactoryTarget.Component }); }
3523
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: CalendarComponent, isStandalone: true, selector: "c-calendar", inputs: { calendarDate: "calendarDate", calendars: ["calendars", "calendars", numberAttribute], dayFormat: "dayFormat", disabledDates: "disabledDates", startDate: "startDate", endDate: "endDate", firstDayOfWeek: ["firstDayOfWeek", "firstDayOfWeek", numberAttribute], locale: "locale", maxDate: "maxDate", minDate: "minDate", navigation: ["navigation", "navigation", booleanAttribute], navYearFirst: ["navYearFirst", "navYearFirst", booleanAttribute], range: ["range", "range", booleanAttribute], view: "view", weekdayFormat: "weekdayFormat", dateFilter: "dateFilter", selectAdjacentDays: ["selectAdjacentDays", "selectAdjacentDays", booleanAttribute], showAdjacentDays: ["showAdjacentDays", "showAdjacentDays", booleanAttribute], selectionType: "selectionType", showWeekNumber: ["showWeekNumber", "showWeekNumber", booleanAttribute], weekNumbersLabel: "weekNumbersLabel" }, outputs: { calendarCellHover: "calendarCellHover", calendarDateChange: "calendarDateChange", endDateChange: "endDateChange", startDateChange: "startDateChange", viewChange: "viewChange" }, host: { properties: { "class": "this.hostClasses" } }, providers: [CalendarService], viewQueries: [{ propertyName: "calendarMonths", predicate: CalendarMonthComponent, descendants: true }], exportAs: ["cCalendar"], ngImport: i0, template: "@for (calendar of calendarsArray; track calendar; let i = $index) {\n <div [ngClass]=\"view | calendarClassView\">\n <c-calendar-navigation\n (navigationClick)=\"handleNavigationClick($event.direction, $event.years)\"\n [addMonths]=\"i\"\n [navigation]=\"navigation\"\n />\n\n <c-calendar-month\n [addMonths]=\"i\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [weekdayFormat]=\"weekdayFormat\"\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"handleFocusChange($event)\"\n />\n </div>\n}\n", styles: [".btn-transparent:focus-visible{outline:-webkit-focus-ring-color auto 1px}\n"], dependencies: [{ kind: "component", type: CalendarNavigationComponent, selector: "c-calendar-navigation", inputs: ["addMonths", "navigation"], outputs: ["navigationClick"] }, { kind: "pipe", type: CalendarClassViewPipe, name: "calendarClassView" }, { kind: "component", type: CalendarMonthComponent, selector: "c-calendar-month", inputs: ["addMonths", "startDate", "endDate", "disabledDates", "firstDayOfWeek", "locale", "range", "weekdayFormat", "view", "maxDate", "minDate", "calendarDate"], exportAs: ["cCalendarMonth"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$2.CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }] }); }
3451
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3452
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: CalendarComponent, isStandalone: true, selector: "c-calendar", inputs: { calendarDateModel: { classPropertyName: "calendarDateModel", publicName: "calendarDate", isSignal: true, isRequired: false, transformFunction: null }, calendars: { classPropertyName: "calendars", publicName: "calendars", isSignal: true, isRequired: false, transformFunction: null }, dayFormat: { classPropertyName: "dayFormat", publicName: "dayFormat", isSignal: true, isRequired: false, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, startDateModel: { classPropertyName: "startDateModel", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDateModel: { classPropertyName: "endDateModel", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, maxDateInput: { classPropertyName: "maxDateInput", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, minDateInput: { classPropertyName: "minDateInput", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, navigation: { classPropertyName: "navigation", publicName: "navigation", isSignal: true, isRequired: false, transformFunction: null }, navYearFirst: { classPropertyName: "navYearFirst", publicName: "navYearFirst", isSignal: true, isRequired: false, transformFunction: null }, range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, weekdayFormat: { classPropertyName: "weekdayFormat", publicName: "weekdayFormat", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, selectAdjacentDays: { classPropertyName: "selectAdjacentDays", publicName: "selectAdjacentDays", isSignal: true, isRequired: false, transformFunction: null }, showAdjacentDays: { classPropertyName: "showAdjacentDays", publicName: "showAdjacentDays", isSignal: true, isRequired: false, transformFunction: null }, selectionType: { classPropertyName: "selectionType", publicName: "selectionType", isSignal: true, isRequired: false, transformFunction: null }, showWeekNumber: { classPropertyName: "showWeekNumber", publicName: "showWeekNumber", isSignal: true, isRequired: false, transformFunction: null }, weekNumbersLabel: { classPropertyName: "weekNumbersLabel", publicName: "weekNumbersLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaNextMonthLabel: { classPropertyName: "ariaNextMonthLabel", publicName: "ariaNextMonthLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaNextYearLabel: { classPropertyName: "ariaNextYearLabel", publicName: "ariaNextYearLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaPrevMonthLabel: { classPropertyName: "ariaPrevMonthLabel", publicName: "ariaPrevMonthLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaPrevYearLabel: { classPropertyName: "ariaPrevYearLabel", publicName: "ariaPrevYearLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { calendarDateChange: "calendarDateChange", calendarDateModel: "calendarDateChange", endDateChange: "endDateChange", startDateChange: "startDateChange", startDateModel: "startDateChange", endDateModel: "endDateChange", view: "viewChange", calendarCellHover: "calendarCellHover" }, host: { properties: { "class": "hostClasses()" }, classAttribute: "calendar" }, providers: [CalendarService], exportAs: ["cCalendar"], ngImport: i0, template: "@for (calendar of calendarsArray(); track calendar; let i = $index) {\n <div [ngClass]=\"view() | calendarClassView\">\n <c-calendar-navigation\n (navigationClick)=\"handleNavigationClick($event.direction, $event.years)\"\n [pageIndex]=\"i\"\n [navigation]=\"navigation()\"\n [ariaNextMonthLabel]=\"ariaNextMonthLabel()\"\n [ariaNextYearLabel]=\"ariaNextYearLabel()\"\n [ariaPrevMonthLabel]=\"ariaPrevMonthLabel()\"\n [ariaPrevYearLabel]=\"ariaPrevYearLabel()\"\n />\n\n <c-calendar-month\n [pageIndex]=\"i\"\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"handleFocusChange($event)\"\n />\n </div>\n}\n", styles: [".btn-transparent:focus-visible{outline:-webkit-focus-ring-color auto 1px}\n"], dependencies: [{ kind: "component", type: CalendarNavigationComponent, selector: "c-calendar-navigation", inputs: ["pageIndex", "navigation", "ariaNextMonthLabel", "ariaNextYearLabel", "ariaPrevMonthLabel", "ariaPrevYearLabel"], outputs: ["navigationClick"] }, { kind: "pipe", type: CalendarClassViewPipe, name: "calendarClassView" }, { kind: "component", type: CalendarMonthComponent, selector: "c-calendar-month", inputs: ["pageIndex"], exportAs: ["cCalendarMonth"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$2.CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }] }); }
3524
3453
  }
3525
3454
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarComponent, decorators: [{
3526
3455
  type: Component,
3527
- args: [{ selector: 'c-calendar', exportAs: 'cCalendar', providers: [CalendarService], standalone: true, imports: [CalendarNavigationComponent, CalendarClassViewPipe, CalendarMonthComponent, NgClass, A11yModule], template: "@for (calendar of calendarsArray; track calendar; let i = $index) {\n <div [ngClass]=\"view | calendarClassView\">\n <c-calendar-navigation\n (navigationClick)=\"handleNavigationClick($event.direction, $event.years)\"\n [addMonths]=\"i\"\n [navigation]=\"navigation\"\n />\n\n <c-calendar-month\n [addMonths]=\"i\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [weekdayFormat]=\"weekdayFormat\"\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"handleFocusChange($event)\"\n />\n </div>\n}\n", styles: [".btn-transparent:focus-visible{outline:-webkit-focus-ring-color auto 1px}\n"] }]
3528
- }], ctorParameters: () => [{ type: CalendarService }], propDecorators: { calendarDate: [{
3529
- type: Input
3530
- }], calendars: [{
3531
- type: Input,
3532
- args: [{ transform: numberAttribute }]
3533
- }], dayFormat: [{
3534
- type: Input
3535
- }], disabledDates: [{
3536
- type: Input
3537
- }], startDate: [{
3538
- type: Input
3539
- }], endDate: [{
3540
- type: Input
3541
- }], firstDayOfWeek: [{
3542
- type: Input,
3543
- args: [{ transform: numberAttribute }]
3544
- }], locale: [{
3545
- type: Input
3546
- }], maxDate: [{
3547
- type: Input
3548
- }], minDate: [{
3549
- type: Input
3550
- }], navigation: [{
3551
- type: Input,
3552
- args: [{ transform: booleanAttribute }]
3553
- }], navYearFirst: [{
3554
- type: Input,
3555
- args: [{ transform: booleanAttribute }]
3556
- }], range: [{
3557
- type: Input,
3558
- args: [{ transform: booleanAttribute }]
3559
- }], view: [{
3560
- type: Input
3561
- }], weekdayFormat: [{
3562
- type: Input
3563
- }], dateFilter: [{
3564
- type: Input
3565
- }], selectAdjacentDays: [{
3566
- type: Input,
3567
- args: [{ transform: booleanAttribute }]
3568
- }], showAdjacentDays: [{
3569
- type: Input,
3570
- args: [{ transform: booleanAttribute }]
3571
- }], selectionType: [{
3572
- type: Input
3573
- }], showWeekNumber: [{
3574
- type: Input,
3575
- args: [{ transform: booleanAttribute }]
3576
- }], weekNumbersLabel: [{
3577
- type: Input
3578
- }], calendarCellHover: [{
3579
- type: Output
3580
- }], calendarDateChange: [{
3581
- type: Output
3582
- }], endDateChange: [{
3583
- type: Output
3584
- }], startDateChange: [{
3585
- type: Output
3586
- }], viewChange: [{
3587
- type: Output
3588
- }], hostClasses: [{
3589
- type: HostBinding,
3590
- args: ['class']
3591
- }], calendarMonths: [{
3592
- type: ViewChildren,
3593
- args: [CalendarMonthComponent]
3594
- }] } });
3456
+ args: [{ selector: 'c-calendar', exportAs: 'cCalendar', providers: [CalendarService], standalone: true, imports: [CalendarNavigationComponent, CalendarClassViewPipe, CalendarMonthComponent, NgClass, A11yModule], host: { class: 'calendar', '[class]': 'hostClasses()' }, template: "@for (calendar of calendarsArray(); track calendar; let i = $index) {\n <div [ngClass]=\"view() | calendarClassView\">\n <c-calendar-navigation\n (navigationClick)=\"handleNavigationClick($event.direction, $event.years)\"\n [pageIndex]=\"i\"\n [navigation]=\"navigation()\"\n [ariaNextMonthLabel]=\"ariaNextMonthLabel()\"\n [ariaNextYearLabel]=\"ariaNextYearLabel()\"\n [ariaPrevMonthLabel]=\"ariaPrevMonthLabel()\"\n [ariaPrevYearLabel]=\"ariaPrevYearLabel()\"\n />\n\n <c-calendar-month\n [pageIndex]=\"i\"\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"handleFocusChange($event)\"\n />\n </div>\n}\n", styles: [".btn-transparent:focus-visible{outline:-webkit-focus-ring-color auto 1px}\n"] }]
3457
+ }] });
3595
3458
 
3596
3459
  class CalendarModule {
3597
3460
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: CalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
@@ -7513,198 +7376,259 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
7513
7376
  // };
7514
7377
  // }
7515
7378
  class DateRangePickerComponent {
7516
- constructor(breakpointObserver) {
7517
- this.breakpointObserver = breakpointObserver;
7379
+ constructor() {
7380
+ this.#breakpointObserver = inject(BreakpointObserver);
7381
+ this.#destroyRef = inject(DestroyRef);
7518
7382
  /**
7519
7383
  * Set the format of day name.
7520
7384
  * @default 'numeric'
7521
7385
  * @type DayFormatType
7522
7386
  */
7523
- this.dayFormat = 'numeric';
7387
+ this.dayFormat = input('numeric');
7524
7388
  /**
7525
7389
  * The number of calendars that render on desktop devices.
7526
7390
  * @type number
7527
7391
  * @default 2
7528
7392
  */
7529
- this.calendars = 2;
7393
+ this.calendars = input(2, { transform: numberAttribute });
7530
7394
  /**
7531
7395
  * Toggle visibility or set the content of the cleaner button.
7532
7396
  * @type boolean
7533
7397
  * @default true
7534
7398
  */
7535
- this.cleaner = true;
7399
+ this.cleaner = input(true, { transform: booleanAttribute });
7536
7400
  /**
7537
7401
  * Determine if the dropdown should be closed after value setting.
7538
7402
  * @type boolean
7539
7403
  * @default false
7540
7404
  */
7541
- this.closeOnSelect = false;
7405
+ this.closeOnSelect = input(false, { transform: booleanAttribute });
7406
+ /**
7407
+ * Set date format.
7408
+ * We use Angular formatDate() function, see:
7409
+ * - https://angular.io/api/common/formatDate
7410
+ * - https://angular.io/api/common/DatePipe#pre-defined-format-options
7411
+ */
7412
+ this.format = input();
7542
7413
  /**
7543
7414
  * Toggle visibility or set the content of the input indicator.
7544
7415
  * @type boolean
7545
7416
  * @default true
7546
7417
  */
7547
- this.indicator = true;
7548
- this.#inputReadOnly = false;
7418
+ this.indicator = input(true);
7419
+ /**
7420
+ * Custom function to format the selected date into a string according to a custom format.
7421
+ * @since v5.0.0
7422
+ */
7423
+ this.inputDateFormat = input();
7424
+ /**
7425
+ * Custom function to parse the input value into a valid Date object.
7426
+ * @since v5.0.0
7427
+ */
7428
+ this.inputDateParse = input();
7429
+ /**
7430
+ * Toggle the readonly state for the component.
7431
+ * @type boolean
7432
+ * @default false
7433
+ */
7434
+ this.inputReadOnlyInput = input(false, { transform: booleanAttribute, alias: 'inputReadOnly' });
7435
+ this.inputReadOnly = computed(() => {
7436
+ return this.inputReadOnlyInput() || typeof this.format() === 'string';
7437
+ });
7549
7438
  /**
7550
7439
  * Reorder year-month navigation, and render year first.
7551
7440
  * @type boolean
7552
7441
  * @default false
7553
7442
  */
7554
- this.navYearFirst = false;
7443
+ this.navYearFirst = input(false, { transform: booleanAttribute });
7555
7444
  /**
7556
7445
  * Specifies short hints that are visible in start date and end date inputs.
7557
7446
  * type string
7558
7447
  */
7559
- this.placeholder = ['Start date', 'End date'];
7448
+ this.placeholder = input(['Start date', 'End date']);
7449
+ /**
7450
+ * Predefined date ranges the user can select from.
7451
+ * @type ICalendarRanges
7452
+ */
7453
+ this.ranges = input();
7560
7454
  /**
7561
7455
  * Sets the color context of the cancel button to one of CoreUI’s themed colors.
7562
7456
  * @type 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
7563
7457
  * @default 'secondary'
7564
7458
  */
7565
- this.rangesButtonsColor = 'secondary';
7459
+ this.rangesButtonsColor = input('secondary');
7566
7460
  /**
7567
7461
  * Size the ranges button small or large.
7568
7462
  * @type 'sm' | 'lg' | ''
7569
7463
  */
7570
- this.rangesButtonsSize = '';
7464
+ this.rangesButtonsSize = input('');
7571
7465
  /**
7572
7466
  * Set the ranges button variant to an outlined button or a ghost button.
7573
7467
  * @type 'outline' | 'ghost' | undefined
7574
7468
  */
7575
- this.rangesButtonsVariant = 'ghost';
7469
+ this.rangesButtonsVariant = input('ghost');
7576
7470
  /**
7577
7471
  * Default icon or character that separates two dates.
7578
7472
  * @type boolean
7579
7473
  * @default true
7580
7474
  */
7581
- this.separator = true;
7582
- this.#timepicker = false;
7475
+ this.separator = input(true, { transform: booleanAttribute });
7476
+ /**
7477
+ * Size the component small or large.
7478
+ * @type 'sm' | 'lg' | undefined
7479
+ * @default undefined
7480
+ */
7481
+ this.size = input();
7482
+ /**
7483
+ * Provide an additional time selection by adding select boxes to choose time.
7484
+ * @type boolean
7485
+ * @default false
7486
+ */
7487
+ this.timepickerInput = input(false, { transform: booleanAttribute, alias: 'timepicker' });
7583
7488
  /**
7584
7489
  * Toggle visual validation feedback.
7585
7490
  * @type boolean | undefined
7586
7491
  * @default undefined
7587
7492
  */
7588
- this.valid = undefined;
7493
+ this.valid = input();
7589
7494
  /**
7590
7495
  * Toggle the visibility of the dropdown date-picker component.
7591
7496
  * @type boolean
7592
7497
  * @default false
7593
7498
  */
7594
- this.visible = false;
7595
- this.startDateModel = model(undefined, {
7499
+ this.visibleInput = input(false, { transform: booleanAttribute });
7500
+ this.visibleInputEffect = effect(() => {
7501
+ this.visible.set(this.visibleInput());
7502
+ }, { allowSignalWrites: true });
7503
+ this.visible = signal(false);
7504
+ this.startDateModel = model(null, {
7596
7505
  alias: 'startDate'
7597
7506
  });
7598
7507
  this.dateModelEffect = effect(() => {
7599
7508
  this.dateRangeGroup.patchValue({ startDateInput: this.startDateValue(), endDateInput: this.endDateValue() });
7600
- });
7601
- this.startDateChange = outputToObservable(this.startDateModel);
7509
+ const startDate = this.startDate();
7510
+ const endDate = this.endDate();
7511
+ this.value = this.range() ? { startDate: startDate, endDate: endDate } : startDate;
7512
+ this.startDateModel.set(startDate);
7513
+ this.endDateModel.set(endDate);
7514
+ }, { allowSignalWrites: true });
7602
7515
  this.startDate = computed(() => {
7603
- const prevDate = this.#startDate ? new Date(this.#startDate) : null;
7604
- const currDate = this.startDateModel() ? new Date(this.startDateModel()) : null;
7605
- if (prevDate?.getTime() !== currDate?.getTime()) {
7606
- return currDate;
7607
- }
7608
- return prevDate;
7609
- });
7610
- this.#startDate = null;
7611
- this.endDateModel = model(undefined, {
7516
+ const startDate = this.startDateModel();
7517
+ return startDate ? new Date(startDate) : null;
7518
+ }, { equal: equalDates });
7519
+ this.startDateChange = toObservable(this.startDate);
7520
+ this.endDateModel = model(null, {
7612
7521
  alias: 'endDate'
7613
7522
  });
7614
- this.endDateChange = outputToObservable(this.endDateModel);
7615
7523
  this.endDate = computed(() => {
7616
- const prevDate = this.#endDate ? new Date(this.#endDate) : null;
7617
- const currDate = this.endDateModel() ? new Date(this.endDateModel()) : null;
7618
- if (prevDate?.getTime() !== currDate?.getTime()) {
7619
- return currDate;
7620
- }
7621
- return prevDate;
7622
- });
7623
- this.#endDate = null;
7524
+ const endDate = this.endDateModel();
7525
+ return endDate ? new Date(endDate) : null;
7526
+ }, { equal: equalDates });
7527
+ this.endDateChange = toObservable(this.endDate);
7624
7528
  this.calendarDate = new Date();
7625
- this.disabledDates = [];
7529
+ this.disabledDates = input([]);
7626
7530
  /**
7627
7531
  * Set first day of week.
7628
- * @type number
7532
+ * @type DaysOfWeek
7629
7533
  * @default 1 (Monday)
7630
7534
  */
7631
- this.firstDayOfWeek = 1;
7535
+ this.firstDayOfWeek = input(1);
7632
7536
  this.locale = input('default');
7633
- this.maxDate = null;
7634
- this.minDate = null;
7537
+ this.maxDate = input(null);
7538
+ this.minDate = input(null);
7635
7539
  /**
7636
7540
  * Show calendar navigation.
7637
7541
  * @type boolean
7638
7542
  * @default true
7639
7543
  */
7640
- this.navigation = true;
7544
+ this.navigation = input(true, { transform: booleanAttribute });
7641
7545
  /**
7642
7546
  * Allow range selection.
7643
7547
  * @type boolean
7644
- * @default false
7548
+ * @default true
7645
7549
  */
7646
- this.range = true;
7647
- this.#disabled = false;
7550
+ this.rangeInput = input(true, { transform: booleanAttribute, alias: 'range' });
7551
+ this.range = computed(() => {
7552
+ return this.rangeInput();
7553
+ });
7554
+ this.dateFilter = input();
7555
+ this.disabledInput = input(false, { transform: booleanAttribute, alias: 'disabled' });
7556
+ this.disabledEffect = effect(() => {
7557
+ this.disabled() ? this.dateRangeGroup.disable() : this.dateRangeGroup.enable();
7558
+ });
7559
+ this.disabled = computed(() => {
7560
+ return this.#disabled() || this.disabledInput();
7561
+ });
7562
+ this.#disabled = signal(false);
7648
7563
  this._value = {};
7649
7564
  /**
7650
7565
  * Set length or format of day name.
7651
7566
  * @type WeekdayFormatType
7652
7567
  * @default 'short'
7653
7568
  */
7654
- this.weekdayFormat = 'short';
7569
+ this.weekdayFormat = input('short');
7655
7570
  /**
7656
7571
  * Optional popper Options object
7657
7572
  * @type Partial<Options>
7658
7573
  */
7659
- this.popperjsOptions = {
7660
- strategy: 'absolute'
7661
- };
7574
+ this.popperjsOptions = input({ strategy: 'absolute' }, { alias: 'popperOptions' });
7662
7575
  /**
7663
7576
  * Set whether days in adjacent months shown before or after the current month are selectable. This only applies if the `showAdjacentDays` option is set to true.
7664
7577
  * @type boolean
7665
7578
  * @default false
7666
7579
  * @since 4.4.10
7667
7580
  */
7668
- this.selectAdjacentDays = false;
7581
+ this.selectAdjacentDays = input(false, { transform: booleanAttribute });
7669
7582
  /**
7670
7583
  * Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
7671
7584
  * @type boolean
7672
7585
  * @default true
7673
7586
  * @since 4.4.10
7674
7587
  */
7675
- this.showAdjacentDays = true;
7588
+ this.showAdjacentDays = input(true, { transform: booleanAttribute });
7676
7589
  /**
7677
7590
  * Specify the type of date selection as day, week, month, or year.
7678
7591
  * @type 'day' | 'week' | 'month' | 'year'
7679
7592
  * @default 'day'
7680
7593
  * @since 5.0.0
7681
7594
  */
7682
- this.selectionType = 'day';
7595
+ this.selectionType = input('day');
7683
7596
  /**
7684
7597
  * Set whether to display week numbers in the calendar.
7685
7598
  * @type boolean
7686
7599
  * @default false
7687
7600
  * @since 5.0.0
7688
7601
  */
7689
- this.showWeekNumber = false;
7690
- this.valueChange = new EventEmitter();
7691
- this.calendarCellHover = new EventEmitter();
7692
- this.calendarDateChange = new EventEmitter();
7693
- this.templates = {};
7602
+ this.showWeekNumber = input(false, { transform: booleanAttribute });
7603
+ /**
7604
+ * Label displayed over week numbers in the calendar.
7605
+ * @type string
7606
+ * @default undefined
7607
+ * @since 5.0.0
7608
+ */
7609
+ this.weekNumbersLabel = input();
7610
+ this.valueChange = output();
7611
+ this.calendarCellHover = output();
7612
+ this.calendarDateChange = output();
7613
+ this.startDateElementRef = viewChild('startDateElementRef');
7614
+ this.endDateElementRef = viewChild('endDateElementRef');
7615
+ this.contentTemplates = contentChildren(TemplateIdDirective, { descendants: true });
7616
+ this.templates = computed(() => {
7617
+ return this.contentTemplates().reduce((acc, child) => {
7618
+ acc[child.id] = child.templateRef;
7619
+ return acc;
7620
+ }, {});
7621
+ });
7694
7622
  this.dateChangeSubscriptions = [];
7695
7623
  this.isMobile = true;
7696
7624
  this.showRanges = false;
7697
7625
  this.startDateValue = computed(() => {
7698
7626
  const locale = this.locale() ?? 'default';
7699
- const dateFormatted = this.formatDate(this.startDate());
7700
- this.#startDate = this.startDate();
7701
- return dateFormatted;
7627
+ return this.formatDate(this.startDate());
7702
7628
  });
7703
7629
  this.endDateValue = computed(() => {
7704
7630
  const locale = this.locale() ?? 'default';
7705
- const dateFormatted = this.formatDate(this.endDate());
7706
- this.#endDate = this.endDate();
7707
- return dateFormatted;
7631
+ return this.formatDate(this.endDate());
7708
7632
  });
7709
7633
  // todo: validation
7710
7634
  // startDateInput = new FormControl({ value: this.startDateValue, disabled: this.disabled }, [
@@ -7720,9 +7644,11 @@ class DateRangePickerComponent {
7720
7644
  // // invalidDateStringValidator(this.locale)
7721
7645
  // ]);
7722
7646
  this.dateRangeGroup = new FormGroup({
7723
- startDateInput: new FormControl({ value: '', disabled: this.disabled }, [Validators.required]),
7724
- endDateInput: new FormControl({ value: '', disabled: this.disabled }, [Validators.required])
7647
+ startDateInput: new FormControl({ value: '', disabled: this.disabled() }, [Validators.required]),
7648
+ endDateInput: new FormControl({ value: '', disabled: this.disabled() }, [Validators.required])
7725
7649
  });
7650
+ this.inputStartHoverValue = signal(null);
7651
+ this.inputEndHoverValue = signal(null);
7726
7652
  this.#breakpoints = {
7727
7653
  OneCalendarRanges: '(min-width: 480px)',
7728
7654
  TwoCalendars: '(max-width: 650px)',
@@ -7743,52 +7669,23 @@ class DateRangePickerComponent {
7743
7669
  /* empty */
7744
7670
  };
7745
7671
  }
7746
- /**
7747
- * Toggle the readonly state for the component.
7748
- * @type boolean
7749
- * @default false
7750
- */
7751
- set inputReadOnly(value) {
7752
- this.#inputReadOnly = value;
7753
- }
7754
- get inputReadOnly() {
7755
- return this.#inputReadOnly || typeof this.format === 'string';
7756
- }
7757
- #inputReadOnly;
7758
- /**
7759
- * Provide an additional time selection by adding select boxes to choose time.
7760
- * @type boolean
7761
- * @default false
7762
- */
7763
- set timepicker(value) {
7764
- this.#timepicker = value;
7765
- }
7672
+ #breakpointObserver;
7673
+ #destroyRef;
7766
7674
  get timepicker() {
7767
7675
  return false;
7768
- // return this.#timepicker;
7769
- }
7770
- #timepicker;
7771
- #startDate;
7772
- #endDate;
7773
- set disabled(value) {
7774
- this.#disabled = value;
7775
- this.#disabled ? this.dateRangeGroup.disable() : this.dateRangeGroup.enable();
7776
- }
7777
- get disabled() {
7778
- return this.#disabled;
7676
+ // return this.timepickerInput();
7779
7677
  }
7780
7678
  #disabled;
7781
7679
  set value(value) {
7782
- const newValue = this.range ? { ...value } : value;
7680
+ const newValue = this.range() ? { ...value } : value;
7783
7681
  if (JSON.stringify(this._value) !== JSON.stringify(newValue)) {
7784
7682
  this._value = newValue;
7785
7683
  this.onChange(newValue);
7786
7684
  this.onTouched();
7787
- this.valueChange.emit(this.value);
7788
- // this.dateRangeGroup.setValue({ startDateInput: this.startDateValue(), endDateInput: this.endDateValue() });
7789
- if (this.closeOnSelect) {
7790
- const hasValue = this.range ? !!(this.value.startDate && this.value.endDate) : !!this.value;
7791
- this.visible = !hasValue;
7685
+ this.valueChange.emit(this._value);
7686
+ if (this.closeOnSelect() && this.visible()) {
7687
+ const hasValue = this.range() ? !!(this._value.startDate && this._value.endDate) : !!this._value;
7688
+ this.visible.set(!hasValue);
7792
7689
  }
7793
7690
  }
7794
7691
  }
@@ -7822,49 +7719,44 @@ class DateRangePickerComponent {
7822
7719
  this.onTouched();
7823
7720
  }
7824
7721
  get startDatePlaceholder() {
7825
- return Array.isArray(this.placeholder) ? this.placeholder[0] : this.placeholder;
7722
+ const placeholder = this.placeholder();
7723
+ return Array.isArray(placeholder) ? placeholder[0] : placeholder;
7826
7724
  }
7827
7725
  get endDatePlaceholder() {
7828
- return Array.isArray(this.placeholder) ? this.placeholder[1] : this.placeholder;
7829
- }
7830
- set inputStartHoverValue(value) {
7831
- this._inputStartHoverValue = value;
7832
- }
7833
- get inputStartHoverValue() {
7834
- return this._inputStartHoverValue;
7835
- }
7836
- set inputEndHoverValue(value) {
7837
- this._inputEndHoverValue = value;
7838
- }
7839
- get inputEndHoverValue() {
7840
- return this._inputEndHoverValue;
7726
+ const placeholder = this.placeholder();
7727
+ return Array.isArray(placeholder) ? placeholder[1] : placeholder;
7841
7728
  }
7842
7729
  get datePickerClasses() {
7843
7730
  return {
7844
7731
  'date-picker': true,
7845
- [`date-picker-${this.size}`]: this.size,
7846
- disabled: this.disabled,
7847
- 'is-valid': this.valid === true,
7848
- 'is-invalid': this.valid === false
7732
+ [`date-picker-${this.size()}`]: this.size(),
7733
+ disabled: this.disabled(),
7734
+ 'is-valid': this.valid() === true,
7735
+ 'is-invalid': this.valid() === false
7849
7736
  };
7850
7737
  }
7851
7738
  formatDate(date) {
7739
+ const format = this.format();
7740
+ const inputDateFormat = this.inputDateFormat();
7741
+ const locale = this.locale();
7852
7742
  return !date || !isValidDate(date)
7853
7743
  ? ''
7854
- : typeof this.inputDateFormat === 'function'
7855
- ? this.inputDateFormat(date)
7856
- : !!this.format && !!this.locale() && this.locale() !== 'default'
7857
- ? formatDate(date, this.format, this.locale())
7744
+ : typeof inputDateFormat === 'function'
7745
+ ? inputDateFormat(date)
7746
+ : !!format && !!locale && locale !== 'default'
7747
+ ? formatDate(date, format, locale)
7858
7748
  : this.timepicker
7859
- ? date.toLocaleString(this.locale())
7860
- : date.toLocaleDateString(this.locale());
7749
+ ? date.toLocaleString(locale)
7750
+ : date.toLocaleDateString(locale);
7861
7751
  }
7862
7752
  #breakpoints;
7863
7753
  ngOnInit() {
7864
- this.customRanges = this.ranges ? Object.entries(this.ranges) : [];
7754
+ const ranges = this.ranges();
7755
+ this.customRanges = ranges ? Object.entries(ranges) : [];
7865
7756
  const breakpoints = this.#breakpoints;
7866
- this.layoutChanges = this.breakpointObserver
7757
+ this.#breakpointObserver
7867
7758
  .observe([breakpoints.OneCalendarRanges, breakpoints.TwoCalendars, breakpoints.TwoCalendarsRanges])
7759
+ .pipe(takeUntilDestroyed(this.#destroyRef))
7868
7760
  .subscribe((result) => {
7869
7761
  if (result.matches) {
7870
7762
  this.isMobile =
@@ -7878,33 +7770,8 @@ class DateRangePickerComponent {
7878
7770
  this.subscribeDateChange();
7879
7771
  }
7880
7772
  ngOnDestroy() {
7881
- this.layoutChanges?.unsubscribe();
7882
7773
  this.subscribeDateChange(false);
7883
7774
  }
7884
- ngAfterViewInit() {
7885
- setTimeout(() => {
7886
- this.contentTemplates.forEach((child) => {
7887
- this.templates[child.id] = child.templateRef;
7888
- });
7889
- });
7890
- }
7891
- ngOnChanges(changes) {
7892
- if (changes['date']) {
7893
- // for date-picker component
7894
- const date = this.convertValueToDate(changes['date']?.currentValue) ?? null;
7895
- this.handleStartDateChange(date);
7896
- this.calendarDate = date ?? this.calendarDate;
7897
- }
7898
- if (changes['startDate']) {
7899
- const date = this.convertValueToDate(changes['startDate']?.currentValue) ?? null;
7900
- this.handleStartDateChange(date);
7901
- this.calendarDate = date ?? this.calendarDate;
7902
- }
7903
- if (changes['endDate']) {
7904
- const date = this.convertValueToDate(changes['endDate']?.currentValue) ?? null;
7905
- this.handleEndDateChange(date);
7906
- }
7907
- }
7908
7775
  convertValueToDate(value) {
7909
7776
  if (!value) {
7910
7777
  return null;
@@ -7915,8 +7782,9 @@ class DateRangePickerComponent {
7915
7782
  return new Date(value);
7916
7783
  }
7917
7784
  inputParse(date) {
7918
- if (typeof this.inputDateParse === 'function') {
7919
- const parsedDate = this.inputDateParse(date);
7785
+ const inputDateParse = this.inputDateParse();
7786
+ if (typeof inputDateParse === 'function') {
7787
+ const parsedDate = inputDateParse(date);
7920
7788
  if (isValidDate(parsedDate)) {
7921
7789
  return parsedDate;
7922
7790
  }
@@ -7934,15 +7802,15 @@ class DateRangePickerComponent {
7934
7802
  handleCalendarCellHover($event) {
7935
7803
  this.calendarCellHover.emit($event);
7936
7804
  if (!this.startDate()) {
7937
- this.setInputValue(this.startDateElementRef, $event);
7938
- this.inputStartHoverValue = $event;
7939
- this.setInputValue(this.endDateElementRef, null);
7940
- this.inputEndHoverValue = null;
7805
+ this.setInputValue(this.startDateElementRef(), $event);
7806
+ this.inputStartHoverValue.set($event);
7807
+ this.setInputValue(this.endDateElementRef(), null);
7808
+ this.inputEndHoverValue.set(null);
7941
7809
  return;
7942
7810
  }
7943
7811
  if (!this.endDate()) {
7944
- this.setInputValue(this.endDateElementRef, $event);
7945
- this.inputEndHoverValue = $event;
7812
+ this.setInputValue(this.endDateElementRef(), $event);
7813
+ this.inputEndHoverValue.set($event);
7946
7814
  return;
7947
7815
  }
7948
7816
  }
@@ -7953,21 +7821,16 @@ class DateRangePickerComponent {
7953
7821
  }
7954
7822
  handleStartDateChange(date) {
7955
7823
  this.startDateModel.set(date ?? null);
7956
- this.dateRangeGroup.patchValue({ startDateInput: this.startDateValue() });
7957
- this.inputStartHoverValue = null;
7958
- this.value = this.range ? { startDate: this.startDate(), endDate: this.endDate() } : this.startDate();
7824
+ this.inputStartHoverValue.set(null);
7959
7825
  }
7960
7826
  handleEndDateChange(date) {
7961
- if (!this.range) {
7827
+ if (!this.range()) {
7962
7828
  return;
7963
7829
  }
7964
7830
  this.endDateModel.set(date ?? null);
7965
- this.dateRangeGroup.patchValue({ endDateInput: this.endDateValue() });
7966
- this.inputEndHoverValue = null;
7967
- this.value = this.range ? { startDate: this.startDate(), endDate: this.endDate() } : this.startDate();
7831
+ this.inputEndHoverValue.set(null);
7968
7832
  }
7969
7833
  handleClear($event) {
7970
- // this.calendarComponent.clearDates();
7971
7834
  this.handleStartDateChange(null);
7972
7835
  this.handleEndDateChange(null);
7973
7836
  }
@@ -7975,14 +7838,13 @@ class DateRangePickerComponent {
7975
7838
  const inputValue = $event.target.value;
7976
7839
  const date = this.inputParse(inputValue);
7977
7840
  if (!date) {
7978
- // this.calendarComponent.clearDates();
7979
7841
  this.handleStartDateChange(null);
7980
7842
  this.handleEndDateChange(null);
7981
7843
  return;
7982
7844
  }
7983
7845
  if (date instanceof Date && date.getTime()) {
7984
- // @ts-ignore
7985
- if (!(this.forbiddenDate(date) || (this.endDate() && this.endDate() < date))) {
7846
+ const endDate = this.endDate();
7847
+ if (!(this.forbiddenDate(date) || (endDate && endDate < date))) {
7986
7848
  this.calendarDate = date;
7987
7849
  this.handleStartDateChange(date);
7988
7850
  }
@@ -7997,8 +7859,8 @@ class DateRangePickerComponent {
7997
7859
  return;
7998
7860
  }
7999
7861
  if (date instanceof Date && date.getTime()) {
8000
- // @ts-ignore
8001
- if (!(this.forbiddenDate(date) || (this.startDate() && this.startDate() > date))) {
7862
+ const startDate = this.startDate();
7863
+ if (!(this.forbiddenDate(date) || (startDate && startDate > date))) {
8002
7864
  this.calendarDate = date;
8003
7865
  this.handleEndDateChange(date);
8004
7866
  }
@@ -8009,8 +7871,9 @@ class DateRangePickerComponent {
8009
7871
  this.handleEndDateChange(this.endDate() ?? null);
8010
7872
  }
8011
7873
  forbiddenDate(date) {
8012
- return (isDateDisabled(date, this.minDate, this.maxDate, this.disabledDates) ||
8013
- (this.dateFilter ? !this.dateFilter(date) : false));
7874
+ const dateFilter = this.dateFilter();
7875
+ return (isDateDisabled(date, this.minDate(), this.maxDate(), this.disabledDates()) ||
7876
+ (dateFilter ? !dateFilter(date) : false));
8014
7877
  }
8015
7878
  registerOnChange(fn) {
8016
7879
  this.onChange = fn;
@@ -8019,31 +7882,31 @@ class DateRangePickerComponent {
8019
7882
  this.onTouched = fn;
8020
7883
  }
8021
7884
  setDisabledState(isDisabled) {
8022
- this.disabled = isDisabled;
7885
+ this.#disabled.set(isDisabled);
8023
7886
  }
8024
7887
  writeValue(value) {
8025
7888
  if (!!value) {
8026
- this.handleStartDateChange(this.range ? value.startDate : value);
8027
- this.handleEndDateChange(this.range ? value.endDate : null);
7889
+ this.handleStartDateChange(this.range() ? value.startDate : value);
7890
+ this.handleEndDateChange(this.range() ? value.endDate : null);
8028
7891
  }
8029
7892
  }
8030
7893
  handleStartTimeChange(time) {
8031
7894
  this.startDateModel.set(time ?? this.startDate());
8032
7895
  }
8033
7896
  handleEndTimeChange(time) {
8034
- if (!this.range) {
7897
+ if (!this.range()) {
8035
7898
  return;
8036
7899
  }
8037
7900
  this.endDateModel.set(time ?? this.endDate());
8038
7901
  }
8039
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DateRangePickerComponent, deps: [{ token: i1$4.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component }); }
8040
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: DateRangePickerComponent, isStandalone: true, selector: "c-date-range-picker", inputs: { dayFormat: { classPropertyName: "dayFormat", publicName: "dayFormat", isSignal: false, isRequired: false, transformFunction: null }, calendars: { classPropertyName: "calendars", publicName: "calendars", isSignal: false, isRequired: false, transformFunction: numberAttribute }, cleaner: { classPropertyName: "cleaner", publicName: "cleaner", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, format: { classPropertyName: "format", publicName: "format", isSignal: false, isRequired: false, transformFunction: null }, indicator: { classPropertyName: "indicator", publicName: "indicator", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, inputDateFormat: { classPropertyName: "inputDateFormat", publicName: "inputDateFormat", isSignal: false, isRequired: false, transformFunction: null }, inputDateParse: { classPropertyName: "inputDateParse", publicName: "inputDateParse", isSignal: false, isRequired: false, transformFunction: null }, inputReadOnly: { classPropertyName: "inputReadOnly", publicName: "inputReadOnly", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, navYearFirst: { classPropertyName: "navYearFirst", publicName: "navYearFirst", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: false, isRequired: false, transformFunction: null }, rangesButtonsColor: { classPropertyName: "rangesButtonsColor", publicName: "rangesButtonsColor", isSignal: false, isRequired: false, transformFunction: null }, rangesButtonsSize: { classPropertyName: "rangesButtonsSize", publicName: "rangesButtonsSize", isSignal: false, isRequired: false, transformFunction: null }, rangesButtonsVariant: { classPropertyName: "rangesButtonsVariant", publicName: "rangesButtonsVariant", isSignal: false, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, size: { classPropertyName: "size", publicName: "size", isSignal: false, isRequired: false, transformFunction: null }, timepicker: { classPropertyName: "timepicker", publicName: "timepicker", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, valid: { classPropertyName: "valid", publicName: "valid", isSignal: false, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, startDateModel: { classPropertyName: "startDateModel", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDateModel: { classPropertyName: "endDateModel", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, calendarDate: { classPropertyName: "calendarDate", publicName: "calendarDate", isSignal: false, isRequired: false, transformFunction: dateTransform }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: false, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: false, isRequired: false, transformFunction: numberAttribute }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, navigation: { classPropertyName: "navigation", publicName: "navigation", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, range: { classPropertyName: "range", publicName: "range", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, weekdayFormat: { classPropertyName: "weekdayFormat", publicName: "weekdayFormat", isSignal: false, isRequired: false, transformFunction: null }, popperjsOptions: { classPropertyName: "popperjsOptions", publicName: "popperOptions", isSignal: false, isRequired: false, transformFunction: null }, selectAdjacentDays: { classPropertyName: "selectAdjacentDays", publicName: "selectAdjacentDays", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, showAdjacentDays: { classPropertyName: "showAdjacentDays", publicName: "showAdjacentDays", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, selectionType: { classPropertyName: "selectionType", publicName: "selectionType", isSignal: false, isRequired: false, transformFunction: null }, showWeekNumber: { classPropertyName: "showWeekNumber", publicName: "showWeekNumber", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, weekNumbersLabel: { classPropertyName: "weekNumbersLabel", publicName: "weekNumbersLabel", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { startDateModel: "startDateChange", endDateModel: "endDateChange", valueChange: "valueChange", calendarCellHover: "calendarCellHover", calendarDateChange: "calendarDateChange" }, host: { listeners: { "focusout": "onBlur()" }, properties: { "class": "this.datePickerClasses" } }, providers: [
7902
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DateRangePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7903
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: DateRangePickerComponent, isStandalone: true, selector: "c-date-range-picker", inputs: { dayFormat: { classPropertyName: "dayFormat", publicName: "dayFormat", isSignal: true, isRequired: false, transformFunction: null }, calendars: { classPropertyName: "calendars", publicName: "calendars", isSignal: true, isRequired: false, transformFunction: null }, cleaner: { classPropertyName: "cleaner", publicName: "cleaner", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, indicator: { classPropertyName: "indicator", publicName: "indicator", isSignal: true, isRequired: false, transformFunction: null }, inputDateFormat: { classPropertyName: "inputDateFormat", publicName: "inputDateFormat", isSignal: true, isRequired: false, transformFunction: null }, inputDateParse: { classPropertyName: "inputDateParse", publicName: "inputDateParse", isSignal: true, isRequired: false, transformFunction: null }, inputReadOnlyInput: { classPropertyName: "inputReadOnlyInput", publicName: "inputReadOnly", isSignal: true, isRequired: false, transformFunction: null }, navYearFirst: { classPropertyName: "navYearFirst", publicName: "navYearFirst", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, rangesButtonsColor: { classPropertyName: "rangesButtonsColor", publicName: "rangesButtonsColor", isSignal: true, isRequired: false, transformFunction: null }, rangesButtonsSize: { classPropertyName: "rangesButtonsSize", publicName: "rangesButtonsSize", isSignal: true, isRequired: false, transformFunction: null }, rangesButtonsVariant: { classPropertyName: "rangesButtonsVariant", publicName: "rangesButtonsVariant", isSignal: true, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, timepickerInput: { classPropertyName: "timepickerInput", publicName: "timepicker", isSignal: true, isRequired: false, transformFunction: null }, valid: { classPropertyName: "valid", publicName: "valid", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visibleInput", isSignal: true, isRequired: false, transformFunction: null }, startDateModel: { classPropertyName: "startDateModel", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDateModel: { classPropertyName: "endDateModel", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, calendarDate: { classPropertyName: "calendarDate", publicName: "calendarDate", isSignal: false, isRequired: false, transformFunction: dateTransform }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, navigation: { classPropertyName: "navigation", publicName: "navigation", isSignal: true, isRequired: false, transformFunction: null }, rangeInput: { classPropertyName: "rangeInput", publicName: "range", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, weekdayFormat: { classPropertyName: "weekdayFormat", publicName: "weekdayFormat", isSignal: true, isRequired: false, transformFunction: null }, popperjsOptions: { classPropertyName: "popperjsOptions", publicName: "popperOptions", isSignal: true, isRequired: false, transformFunction: null }, selectAdjacentDays: { classPropertyName: "selectAdjacentDays", publicName: "selectAdjacentDays", isSignal: true, isRequired: false, transformFunction: null }, showAdjacentDays: { classPropertyName: "showAdjacentDays", publicName: "showAdjacentDays", isSignal: true, isRequired: false, transformFunction: null }, selectionType: { classPropertyName: "selectionType", publicName: "selectionType", isSignal: true, isRequired: false, transformFunction: null }, showWeekNumber: { classPropertyName: "showWeekNumber", publicName: "showWeekNumber", isSignal: true, isRequired: false, transformFunction: null }, weekNumbersLabel: { classPropertyName: "weekNumbersLabel", publicName: "weekNumbersLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startDateModel: "startDateChange", endDateModel: "endDateChange", valueChange: "valueChange", calendarCellHover: "calendarCellHover", calendarDateChange: "calendarDateChange" }, host: { listeners: { "focusout": "onBlur()" }, properties: { "class": "this.datePickerClasses" } }, providers: [
8041
7904
  {
8042
7905
  provide: NG_VALUE_ACCESSOR,
8043
7906
  useExisting: forwardRef(() => DateRangePickerComponent),
8044
7907
  multi: true
8045
7908
  }
8046
- ], queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true }], viewQueries: [{ propertyName: "startDateElementRef", first: true, predicate: ["startDateElementRef"], descendants: true }, { propertyName: "endDateElementRef", first: true, predicate: ["endDateElementRef"], descendants: true }], exportAs: ["cDateRangePicker"], usesOnChanges: true, ngImport: i0, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"range ? undefined : valid\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range && separator !== false) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"valid ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner && startDateElementRef.value && !disabled) {\n <div (click)=\"!disabled && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor\"\n [size]=\"rangesButtonsSize\"\n [variant]=\"rangesButtonsVariant\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars\"\n [dateFilter]=\"dateFilter\"\n [dayFormat]=\"dayFormat\"\n [disabledDates]=\"disabledDates\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [navYearFirst]=\"navYearFirst\"\n [navigation]=\"navigation\"\n [range]=\"range\"\n [selectAdjacentDays]=\"selectAdjacentDays\"\n [selectionType]=\"selectionType\"\n [showAdjacentDays]=\"showAdjacentDays\"\n [showWeekNumber]=\"showWeekNumber\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel\"\n [weekdayFormat]=\"weekdayFormat\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @if (templates?.datePickerFooter) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"templates?.datePickerFooter; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: CalendarComponent, selector: "c-calendar", inputs: ["calendarDate", "calendars", "dayFormat", "disabledDates", "startDate", "endDate", "firstDayOfWeek", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "range", "view", "weekdayFormat", "dateFilter", "selectAdjacentDays", "showAdjacentDays", "selectionType", "showWeekNumber", "weekNumbersLabel"], outputs: ["calendarCellHover", "calendarDateChange", "endDateChange", "startDateChange", "viewChange"], exportAs: ["cCalendar"] }, { kind: "component", type: TimePickerComponent, selector: "c-time-picker", inputs: ["cleaner", "dateTimeFormatOptions", "disabled", "filterHours", "filterMinutes", "filterSeconds", "indicator", "inputReadOnly", "locale", "placeholder", "seconds", "size", "time", "variant", "valid", "visible"], outputs: ["timeChange"], exportAs: ["cTimePicker"] }, { kind: "directive", type: ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "type", "variant"], exportAs: ["cButton"] }, { kind: "component", type: DropdownComponent, selector: "c-dropdown", inputs: ["alignment", "autoClose", "direction", "placement", "popper", "popperOptions", "variant", "visible"], outputs: ["visibleChange"], exportAs: ["cDropdown"] }, { kind: "directive", type: DropdownToggleDirective, selector: "[cDropdownToggle]", inputs: ["dropdownComponent", "disabled", "caret", "split"], exportAs: ["cDropdownToggle"] }, { kind: "directive", type: DropdownMenuDirective, selector: "[cDropdownMenu]", inputs: ["alignment", "visible"], exportAs: ["cDropdownMenu"] }, { kind: "directive", type: FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "pipe", type: CustomRangeKeyPipe, name: "customRangeKey" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
7909
+ ], queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "startDateElementRef", first: true, predicate: ["startDateElementRef"], descendants: true, isSignal: true }, { propertyName: "endDateElementRef", first: true, predicate: ["endDateElementRef"], descendants: true, isSignal: true }], exportAs: ["cDateRangePicker"], ngImport: i0, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions()\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled() ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue()}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly() ?? null\"\n [valid]=\"range() ? undefined : valid()\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range() && separator()) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range()) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue()}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly() ?? null\"\n [valid]=\"valid() ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator()) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner() && startDateElementRef.value && !disabled()) {\n <div (click)=\"!disabled() && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges() && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor()\"\n [size]=\"rangesButtonsSize()\"\n [variant]=\"rangesButtonsVariant()\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars()\"\n [dateFilter]=\"dateFilter()\"\n [dayFormat]=\"dayFormat()\"\n [disabledDates]=\"disabledDates()\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [navYearFirst]=\"navYearFirst()\"\n [navigation]=\"navigation()\"\n [range]=\"range()\"\n [selectAdjacentDays]=\"selectAdjacentDays()\"\n [selectionType]=\"selectionType()\"\n [showAdjacentDays]=\"showAdjacentDays()\"\n [showWeekNumber]=\"showWeekNumber()\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel()\"\n [weekdayFormat]=\"weekdayFormat()\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range()) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @let footer = templates()?.['datePickerFooter'];\n @if (footer) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"footer; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: CalendarComponent, selector: "c-calendar", inputs: ["calendarDate", "calendars", "dayFormat", "disabledDates", "startDate", "endDate", "firstDayOfWeek", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "range", "view", "weekdayFormat", "dateFilter", "selectAdjacentDays", "showAdjacentDays", "selectionType", "showWeekNumber", "weekNumbersLabel", "ariaNextMonthLabel", "ariaNextYearLabel", "ariaPrevMonthLabel", "ariaPrevYearLabel"], outputs: ["calendarDateChange", "endDateChange", "startDateChange", "viewChange", "calendarCellHover"], exportAs: ["cCalendar"] }, { kind: "component", type: TimePickerComponent, selector: "c-time-picker", inputs: ["cleaner", "dateTimeFormatOptions", "disabled", "filterHours", "filterMinutes", "filterSeconds", "indicator", "inputReadOnly", "locale", "placeholder", "seconds", "size", "time", "variant", "valid", "visible"], outputs: ["timeChange"], exportAs: ["cTimePicker"] }, { kind: "directive", type: ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "type", "variant"], exportAs: ["cButton"] }, { kind: "component", type: DropdownComponent, selector: "c-dropdown", inputs: ["alignment", "autoClose", "direction", "placement", "popper", "popperOptions", "variant", "visible"], outputs: ["visibleChange"], exportAs: ["cDropdown"] }, { kind: "directive", type: DropdownToggleDirective, selector: "[cDropdownToggle]", inputs: ["dropdownComponent", "disabled", "caret", "split"], exportAs: ["cDropdownToggle"] }, { kind: "directive", type: DropdownMenuDirective, selector: "[cDropdownMenu]", inputs: ["alignment", "visible"], exportAs: ["cDropdownMenu"] }, { kind: "directive", type: FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "pipe", type: CustomRangeKeyPipe, name: "customRangeKey" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8047
7910
  }
8048
7911
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DateRangePickerComponent, decorators: [{
8049
7912
  type: Component,
@@ -8067,114 +7930,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
8067
7930
  useExisting: forwardRef(() => DateRangePickerComponent),
8068
7931
  multi: true
8069
7932
  }
8070
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"range ? undefined : valid\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range && separator !== false) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"valid ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner && startDateElementRef.value && !disabled) {\n <div (click)=\"!disabled && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor\"\n [size]=\"rangesButtonsSize\"\n [variant]=\"rangesButtonsVariant\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars\"\n [dateFilter]=\"dateFilter\"\n [dayFormat]=\"dayFormat\"\n [disabledDates]=\"disabledDates\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [navYearFirst]=\"navYearFirst\"\n [navigation]=\"navigation\"\n [range]=\"range\"\n [selectAdjacentDays]=\"selectAdjacentDays\"\n [selectionType]=\"selectionType\"\n [showAdjacentDays]=\"showAdjacentDays\"\n [showWeekNumber]=\"showWeekNumber\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel\"\n [weekdayFormat]=\"weekdayFormat\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @if (templates?.datePickerFooter) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"templates?.datePickerFooter; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"] }]
8071
- }], ctorParameters: () => [{ type: i1$4.BreakpointObserver }], propDecorators: { dayFormat: [{
8072
- type: Input
8073
- }], calendars: [{
8074
- type: Input,
8075
- args: [{ transform: numberAttribute }]
8076
- }], cleaner: [{
8077
- type: Input,
8078
- args: [{ transform: booleanAttribute }]
8079
- }], closeOnSelect: [{
8080
- type: Input,
8081
- args: [{ transform: booleanAttribute }]
8082
- }], format: [{
8083
- type: Input
8084
- }], indicator: [{
8085
- type: Input,
8086
- args: [{ transform: booleanAttribute }]
8087
- }], inputDateFormat: [{
8088
- type: Input
8089
- }], inputDateParse: [{
8090
- type: Input
8091
- }], inputReadOnly: [{
8092
- type: Input,
8093
- args: [{ transform: booleanAttribute }]
8094
- }], navYearFirst: [{
8095
- type: Input,
8096
- args: [{ transform: booleanAttribute }]
8097
- }], placeholder: [{
8098
- type: Input
8099
- }], ranges: [{
8100
- type: Input
8101
- }], rangesButtonsColor: [{
8102
- type: Input
8103
- }], rangesButtonsSize: [{
8104
- type: Input
8105
- }], rangesButtonsVariant: [{
8106
- type: Input
8107
- }], separator: [{
8108
- type: Input,
8109
- args: [{ transform: booleanAttribute }]
8110
- }], size: [{
8111
- type: Input
8112
- }], timepicker: [{
8113
- type: Input,
8114
- args: [{ transform: booleanAttribute }]
8115
- }], valid: [{
8116
- type: Input
8117
- }], visible: [{
8118
- type: Input,
8119
- args: [{ transform: booleanAttribute }]
8120
- }], calendarDate: [{
7933
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions()\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled() ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue()}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly() ?? null\"\n [valid]=\"range() ? undefined : valid()\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range() && separator()) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range()) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue()}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly() ?? null\"\n [valid]=\"valid() ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator()) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner() && startDateElementRef.value && !disabled()) {\n <div (click)=\"!disabled() && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges() && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor()\"\n [size]=\"rangesButtonsSize()\"\n [variant]=\"rangesButtonsVariant()\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars()\"\n [dateFilter]=\"dateFilter()\"\n [dayFormat]=\"dayFormat()\"\n [disabledDates]=\"disabledDates()\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [navYearFirst]=\"navYearFirst()\"\n [navigation]=\"navigation()\"\n [range]=\"range()\"\n [selectAdjacentDays]=\"selectAdjacentDays()\"\n [selectionType]=\"selectionType()\"\n [showAdjacentDays]=\"showAdjacentDays()\"\n [showWeekNumber]=\"showWeekNumber()\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel()\"\n [weekdayFormat]=\"weekdayFormat()\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range()) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @let footer = templates()?.['datePickerFooter'];\n @if (footer) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"footer; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"] }]
7934
+ }], propDecorators: { calendarDate: [{
8121
7935
  type: Input,
8122
7936
  args: [{ transform: dateTransform }]
8123
- }], disabledDates: [{
8124
- type: Input
8125
- }], firstDayOfWeek: [{
8126
- type: Input,
8127
- args: [{ transform: numberAttribute }]
8128
- }], maxDate: [{
8129
- type: Input
8130
- }], minDate: [{
8131
- type: Input
8132
- }], navigation: [{
8133
- type: Input,
8134
- args: [{ transform: booleanAttribute }]
8135
- }], range: [{
8136
- type: Input,
8137
- args: [{ transform: booleanAttribute }]
8138
- }], dateFilter: [{
8139
- type: Input
8140
- }], disabled: [{
8141
- type: Input,
8142
- args: [{ transform: booleanAttribute }]
8143
7937
  }], value: [{
8144
7938
  type: Input
8145
- }], weekdayFormat: [{
8146
- type: Input
8147
- }], popperjsOptions: [{
8148
- type: Input,
8149
- args: ['popperOptions']
8150
- }], selectAdjacentDays: [{
8151
- type: Input,
8152
- args: [{ transform: booleanAttribute }]
8153
- }], showAdjacentDays: [{
8154
- type: Input,
8155
- args: [{ transform: booleanAttribute }]
8156
- }], selectionType: [{
8157
- type: Input
8158
- }], showWeekNumber: [{
8159
- type: Input,
8160
- args: [{ transform: booleanAttribute }]
8161
- }], weekNumbersLabel: [{
8162
- type: Input
8163
- }], valueChange: [{
8164
- type: Output
8165
- }], calendarCellHover: [{
8166
- type: Output
8167
- }], calendarDateChange: [{
8168
- type: Output
8169
- }], startDateElementRef: [{
8170
- type: ViewChild,
8171
- args: ['startDateElementRef']
8172
- }], endDateElementRef: [{
8173
- type: ViewChild,
8174
- args: ['endDateElementRef']
8175
- }], contentTemplates: [{
8176
- type: ContentChildren,
8177
- args: [TemplateIdDirective, { descendants: true }]
8178
7939
  }], onBlur: [{
8179
7940
  type: HostListener,
8180
7941
  args: ['focusout']
@@ -8197,30 +7958,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
8197
7958
  }] });
8198
7959
 
8199
7960
  class DatePickerComponent extends DateRangePickerComponent {
8200
- constructor(breakpointObserver) {
8201
- super(breakpointObserver);
8202
- this.placeholder = 'Select date';
7961
+ constructor() {
7962
+ super(...arguments);
8203
7963
  this.dateChange = output();
8204
- this.range = false;
8205
- this.calendars = 1;
8206
- this.endDate = model(null);
8207
- }
8208
- set date(value) {
8209
- this.startDateModel.set(value);
7964
+ this.calendars = input(1, { transform: numberAttribute });
7965
+ this.placeholder = input('Select date');
7966
+ this.range = signal(false);
7967
+ this.endDate = signal(null);
7968
+ this.startDateModel = model(null, {
7969
+ alias: 'date'
7970
+ });
8210
7971
  }
8211
7972
  get date() {
8212
7973
  return this.startDate();
8213
7974
  }
8214
7975
  writeValue(value) {
8215
- this.date = value;
7976
+ this.startDateModel.set(value);
8216
7977
  super.writeValue(value);
8217
7978
  }
8218
7979
  subscribeDateChange(subscribe = true) {
8219
7980
  if (subscribe) {
8220
7981
  this.dateChangeSubscriptions.push(this.startDateChange.subscribe((next) => {
8221
- this.date = next;
8222
- this.onChange(next);
8223
- this.dateChange.emit(this.date);
7982
+ if (this.startDateModel()?.getTime() !== next?.getTime()) {
7983
+ this.startDateModel.set(next);
7984
+ this.onChange(next);
7985
+ this.dateChange.emit(next);
7986
+ }
8224
7987
  }));
8225
7988
  return;
8226
7989
  }
@@ -8228,14 +7991,14 @@ class DatePickerComponent extends DateRangePickerComponent {
8228
7991
  subscription?.unsubscribe();
8229
7992
  });
8230
7993
  }
8231
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DatePickerComponent, deps: [{ token: i1$4.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component }); }
8232
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: DatePickerComponent, isStandalone: true, selector: "c-date-picker", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange", endDate: "endDateChange" }, providers: [
7994
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DatePickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
7995
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", type: DatePickerComponent, isStandalone: true, selector: "c-date-picker", inputs: { calendars: { classPropertyName: "calendars", publicName: "calendars", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, startDateModel: { classPropertyName: "startDateModel", publicName: "date", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange", startDateModel: "dateChange" }, providers: [
8233
7996
  {
8234
7997
  provide: NG_VALUE_ACCESSOR,
8235
7998
  useExisting: forwardRef(() => DatePickerComponent),
8236
7999
  multi: true
8237
8000
  }
8238
- ], exportAs: ["cDatePicker"], usesInheritance: true, ngImport: i0, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"range ? undefined : valid\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range && separator !== false) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"valid ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner && startDateElementRef.value && !disabled) {\n <div (click)=\"!disabled && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor\"\n [size]=\"rangesButtonsSize\"\n [variant]=\"rangesButtonsVariant\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars\"\n [dateFilter]=\"dateFilter\"\n [dayFormat]=\"dayFormat\"\n [disabledDates]=\"disabledDates\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [navYearFirst]=\"navYearFirst\"\n [navigation]=\"navigation\"\n [range]=\"range\"\n [selectAdjacentDays]=\"selectAdjacentDays\"\n [selectionType]=\"selectionType\"\n [showAdjacentDays]=\"showAdjacentDays\"\n [showWeekNumber]=\"showWeekNumber\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel\"\n [weekdayFormat]=\"weekdayFormat\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @if (templates?.datePickerFooter) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"templates?.datePickerFooter; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: CalendarComponent, selector: "c-calendar", inputs: ["calendarDate", "calendars", "dayFormat", "disabledDates", "startDate", "endDate", "firstDayOfWeek", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "range", "view", "weekdayFormat", "dateFilter", "selectAdjacentDays", "showAdjacentDays", "selectionType", "showWeekNumber", "weekNumbersLabel"], outputs: ["calendarCellHover", "calendarDateChange", "endDateChange", "startDateChange", "viewChange"], exportAs: ["cCalendar"] }, { kind: "component", type: TimePickerComponent, selector: "c-time-picker", inputs: ["cleaner", "dateTimeFormatOptions", "disabled", "filterHours", "filterMinutes", "filterSeconds", "indicator", "inputReadOnly", "locale", "placeholder", "seconds", "size", "time", "variant", "valid", "visible"], outputs: ["timeChange"], exportAs: ["cTimePicker"] }, { kind: "directive", type: ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "type", "variant"], exportAs: ["cButton"] }, { kind: "component", type: DropdownComponent, selector: "c-dropdown", inputs: ["alignment", "autoClose", "direction", "placement", "popper", "popperOptions", "variant", "visible"], outputs: ["visibleChange"], exportAs: ["cDropdown"] }, { kind: "directive", type: DropdownToggleDirective, selector: "[cDropdownToggle]", inputs: ["dropdownComponent", "disabled", "caret", "split"], exportAs: ["cDropdownToggle"] }, { kind: "directive", type: DropdownMenuDirective, selector: "[cDropdownMenu]", inputs: ["alignment", "visible"], exportAs: ["cDropdownMenu"] }, { kind: "directive", type: FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "pipe", type: CustomRangeKeyPipe, name: "customRangeKey" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8001
+ ], exportAs: ["cDatePicker"], usesInheritance: true, ngImport: i0, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions()\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled() ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue()}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly() ?? null\"\n [valid]=\"range() ? undefined : valid()\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range() && separator()) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range()) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue()}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly() ?? null\"\n [valid]=\"valid() ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator()) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner() && startDateElementRef.value && !disabled()) {\n <div (click)=\"!disabled() && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges() && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor()\"\n [size]=\"rangesButtonsSize()\"\n [variant]=\"rangesButtonsVariant()\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars()\"\n [dateFilter]=\"dateFilter()\"\n [dayFormat]=\"dayFormat()\"\n [disabledDates]=\"disabledDates()\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [navYearFirst]=\"navYearFirst()\"\n [navigation]=\"navigation()\"\n [range]=\"range()\"\n [selectAdjacentDays]=\"selectAdjacentDays()\"\n [selectionType]=\"selectionType()\"\n [showAdjacentDays]=\"showAdjacentDays()\"\n [showWeekNumber]=\"showWeekNumber()\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel()\"\n [weekdayFormat]=\"weekdayFormat()\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range()) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @let footer = templates()?.['datePickerFooter'];\n @if (footer) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"footer; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: CalendarComponent, selector: "c-calendar", inputs: ["calendarDate", "calendars", "dayFormat", "disabledDates", "startDate", "endDate", "firstDayOfWeek", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "range", "view", "weekdayFormat", "dateFilter", "selectAdjacentDays", "showAdjacentDays", "selectionType", "showWeekNumber", "weekNumbersLabel", "ariaNextMonthLabel", "ariaNextYearLabel", "ariaPrevMonthLabel", "ariaPrevYearLabel"], outputs: ["calendarDateChange", "endDateChange", "startDateChange", "viewChange", "calendarCellHover"], exportAs: ["cCalendar"] }, { kind: "component", type: TimePickerComponent, selector: "c-time-picker", inputs: ["cleaner", "dateTimeFormatOptions", "disabled", "filterHours", "filterMinutes", "filterSeconds", "indicator", "inputReadOnly", "locale", "placeholder", "seconds", "size", "time", "variant", "valid", "visible"], outputs: ["timeChange"], exportAs: ["cTimePicker"] }, { kind: "directive", type: ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "type", "variant"], exportAs: ["cButton"] }, { kind: "component", type: DropdownComponent, selector: "c-dropdown", inputs: ["alignment", "autoClose", "direction", "placement", "popper", "popperOptions", "variant", "visible"], outputs: ["visibleChange"], exportAs: ["cDropdown"] }, { kind: "directive", type: DropdownToggleDirective, selector: "[cDropdownToggle]", inputs: ["dropdownComponent", "disabled", "caret", "split"], exportAs: ["cDropdownToggle"] }, { kind: "directive", type: DropdownMenuDirective, selector: "[cDropdownMenu]", inputs: ["alignment", "visible"], exportAs: ["cDropdownMenu"] }, { kind: "directive", type: FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "pipe", type: CustomRangeKeyPipe, name: "customRangeKey" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8239
8002
  }
8240
8003
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DatePickerComponent, decorators: [{
8241
8004
  type: Component,
@@ -8259,12 +8022,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
8259
8022
  useExisting: forwardRef(() => DatePickerComponent),
8260
8023
  multi: true
8261
8024
  }
8262
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"range ? undefined : valid\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range && separator !== false) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"valid ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner && startDateElementRef.value && !disabled) {\n <div (click)=\"!disabled && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor\"\n [size]=\"rangesButtonsSize\"\n [variant]=\"rangesButtonsVariant\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars\"\n [dateFilter]=\"dateFilter\"\n [dayFormat]=\"dayFormat\"\n [disabledDates]=\"disabledDates\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [navYearFirst]=\"navYearFirst\"\n [navigation]=\"navigation\"\n [range]=\"range\"\n [selectAdjacentDays]=\"selectAdjacentDays\"\n [selectionType]=\"selectionType\"\n [showAdjacentDays]=\"showAdjacentDays\"\n [showWeekNumber]=\"showWeekNumber\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel\"\n [weekdayFormat]=\"weekdayFormat\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @if (templates?.datePickerFooter) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"templates?.datePickerFooter; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"] }]
8263
- }], ctorParameters: () => [{ type: i1$4.BreakpointObserver }], propDecorators: { placeholder: [{
8264
- type: Input
8265
- }], date: [{
8266
- type: Input
8267
- }] } });
8025
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions()\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled() ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue()}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly() ?? null\"\n [valid]=\"range() ? undefined : valid()\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range() && separator()) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range()) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue()}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly() ?? null\"\n [valid]=\"valid() ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator()) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner() && startDateElementRef.value && !disabled()) {\n <div (click)=\"!disabled() && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges() && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor()\"\n [size]=\"rangesButtonsSize()\"\n [variant]=\"rangesButtonsVariant()\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars()\"\n [dateFilter]=\"dateFilter()\"\n [dayFormat]=\"dayFormat()\"\n [disabledDates]=\"disabledDates()\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate()\"\n [minDate]=\"minDate()\"\n [navYearFirst]=\"navYearFirst()\"\n [navigation]=\"navigation()\"\n [range]=\"range()\"\n [selectAdjacentDays]=\"selectAdjacentDays()\"\n [selectionType]=\"selectionType()\"\n [showAdjacentDays]=\"showAdjacentDays()\"\n [showWeekNumber]=\"showWeekNumber()\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel()\"\n [weekdayFormat]=\"weekdayFormat()\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range()) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @let footer = templates()?.['datePickerFooter'];\n @if (footer) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"footer; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"] }]
8026
+ }] });
8268
8027
 
8269
8028
  class DatePickerModule {
8270
8029
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: DatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }