@wlcm/angular 18.2.24 → 18.2.26

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 (32) hide show
  1. package/datepicker/esm2022/index.mjs +2 -5
  2. package/datepicker/esm2022/lib/components/range/date-range-picker/date-range-picker.component.mjs +174 -0
  3. package/datepicker/esm2022/lib/components/range/date-range-picker-bottom-panel/date-range-picker-bottom-panel.component.mjs +5 -5
  4. package/datepicker/esm2022/lib/components/range/date-range-picker-input/date-range-picker-input.component.mjs +8 -10
  5. package/datepicker/esm2022/lib/constants/datepicker.constants.mjs +1 -1
  6. package/datepicker/esm2022/lib/constants/range/date-range-picker.constants.mjs +1 -3
  7. package/datepicker/esm2022/lib/directives/datepicker-trigger.base.mjs +9 -5
  8. package/datepicker/esm2022/lib/directives/ragne/date-range-picker-input.base.mjs +4 -6
  9. package/datepicker/esm2022/lib/models/range/data-range-calendar.models.mjs +1 -1
  10. package/datepicker/esm2022/lib/models/range/date-range-picker.models.mjs +2 -27
  11. package/datepicker/fesm2022/wlcm-angular-datepicker.mjs +696 -792
  12. package/datepicker/fesm2022/wlcm-angular-datepicker.mjs.map +1 -1
  13. package/datepicker/index.d.ts +1 -4
  14. package/datepicker/lib/components/range/{double-calendar-range-picker/double-calendar-range-picker.component.d.ts → date-range-picker/date-range-picker.component.d.ts} +16 -12
  15. package/datepicker/lib/components/range/date-range-picker-bottom-panel/date-range-picker-bottom-panel.component.d.ts +3 -3
  16. package/datepicker/lib/components/range/date-range-picker-input/date-range-picker-input.component.d.ts +5 -5
  17. package/datepicker/lib/constants/datepicker.constants.d.ts +1 -1
  18. package/datepicker/lib/constants/range/date-range-picker.constants.d.ts +1 -2
  19. package/datepicker/lib/directives/datepicker-trigger.base.d.ts +3 -2
  20. package/datepicker/lib/models/range/date-range-picker.models.d.ts +1 -15
  21. package/forms/esm2022/lib/forms/components/autocomplete/autocomplete.component.mjs +9 -10
  22. package/forms/esm2022/lib/forms/components/select/select.component.mjs +4 -17
  23. package/forms/fesm2022/wlcm-angular-forms.mjs +11 -25
  24. package/forms/fesm2022/wlcm-angular-forms.mjs.map +1 -1
  25. package/forms/lib/forms/components/autocomplete/autocomplete.component.d.ts +3 -2
  26. package/forms/lib/forms/components/select/select.component.d.ts +0 -1
  27. package/package.json +1 -1
  28. package/styles/components/datepicker/date-range-picker/_date-range-picker-body.scss +1 -1
  29. package/styles/components/datepicker/date-range-picker/_date-range-picker-input.scss +0 -1
  30. package/datepicker/esm2022/lib/components/range/double-calendar-range-picker/double-calendar-range-picker.component.mjs +0 -168
  31. package/datepicker/esm2022/lib/components/range/single-calendar-range-picker/single-calendar-range-picker.component.mjs +0 -95
  32. package/datepicker/lib/components/range/single-calendar-range-picker/single-calendar-range-picker.component.d.ts +0 -27
@@ -1,32 +1,146 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, input, Injector, ViewContainerRef, Directive, HostBinding, HostListener, forwardRef, ElementRef, Optional, Inject, signal, computed, Component, Type, ViewChild, inject, Host, Input, ContentChild, output, effect, viewChild, contentChild, NgModule } from '@angular/core';
2
+ import { Component, output, input, effect, Directive, forwardRef, Optional, Inject, Injectable, InjectionToken, ElementRef, Injector, ViewContainerRef, HostBinding, signal, computed, ViewChild, HostListener, inject, Host, ContentChild, viewChild, contentChild, NgModule } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
- import * as i2 from '@angular/material/datepicker';
5
- import { MatRangeDateSelectionModel, MatDateSelectionModel, DateRange, yearsPerPage, MatCalendar, MAT_DATE_RANGE_SELECTION_STRATEGY, DefaultMatCalendarRangeStrategy, MatDatepickerModule, MatMonthView, MatSingleDateSelectionModel } from '@angular/material/datepicker';
4
+ import * as i2$1 from '@angular/material/datepicker';
5
+ import { yearsPerPage, MatCalendar, MatRangeDateSelectionModel, MatDateSelectionModel, MAT_DATE_RANGE_SELECTION_STRATEGY, DefaultMatCalendarRangeStrategy, MatMonthView, MatDatepickerModule, DateRange, MatSingleDateSelectionModel } from '@angular/material/datepicker';
6
6
  import { WLCM_FORM_FIELD, WLCM_FORM_CONTROL_PROVIDER, WLCM_INPUT_BINDER, WlcmFormsModule } from '@wlcm/angular/forms';
7
- import { merge, EMPTY, filter, BehaviorSubject, switchMap, fromEvent, map, Subject, tap, startWith, takeUntil } from 'rxjs';
8
- import * as i3 from '@angular/forms';
9
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, ControlContainer } from '@angular/forms';
10
- import * as i1$1 from '@angular/material/core';
11
- import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
7
+ import { merge, EMPTY, filter, Subject, tap, startWith, takeUntil, BehaviorSubject, switchMap, fromEvent, map } from 'rxjs';
8
+ import * as i1$1 from '@angular/cdk/overlay';
9
+ import { OverlayRef, CdkOverlayOrigin, OverlayConfig, Overlay } from '@angular/cdk/overlay';
12
10
  import { __decorate, __metadata } from 'tslib';
13
- import { format, isBefore, startOfDay, isAfter, parse, isValid, endOfMonth, add, startOfMonth } from 'date-fns';
14
- import { DateFnsAdapter } from '@angular/material-date-fns-adapter';
15
- import { enUS } from 'date-fns/locale';
16
- import * as i1 from '@angular/cdk/overlay';
17
- import { OverlayRef, OverlayConfig, Overlay } from '@angular/cdk/overlay';
18
- import { ComponentPortal } from '@angular/cdk/portal';
19
11
  import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
20
- import * as i2$1 from '@wlcm/angular/button';
12
+ import * as i2 from '@wlcm/angular/button';
21
13
  import { WlcmButtonModule } from '@wlcm/angular/button';
14
+ import * as i1 from '@angular/material/core';
15
+ import { MAT_DATE_FORMATS, MAT_DATE_LOCALE, DateAdapter } from '@angular/material/core';
16
+ import { isBefore, startOfDay, isAfter, format, endOfMonth, add, startOfMonth, parse, isValid } from 'date-fns';
22
17
  import { WlcmIconName, WlcmIconDirective } from '@wlcm/angular/core';
18
+ import { DateFnsAdapter } from '@angular/material-date-fns-adapter';
19
+ import { enUS } from 'date-fns/locale';
20
+ import { ComponentPortal } from '@angular/cdk/portal';
21
+ import * as i3 from '@angular/forms';
22
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, ControlContainer } from '@angular/forms';
23
23
 
24
- const WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL = new InjectionToken('WLCM_DATE_RANGE_SELECTION_MODEL');
25
- const WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL_PROVIDER = {
26
- provide: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL,
27
- useFactory: (adapter) => new MatRangeDateSelectionModel(adapter),
28
- deps: [DateAdapter],
29
- };
24
+ class WlcmDateRangePickerBottomPanelComponent {
25
+ constructor(picker) {
26
+ this.picker = picker;
27
+ }
28
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerBottomPanelComponent, deps: [{ token: WlcmDateRangePickerComponent }], target: i0.ɵɵFactoryTarget.Component }); }
29
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDateRangePickerBottomPanelComponent, isStandalone: true, selector: "wlcm-date-range-picker-bottom-panel", ngImport: i0, template: "<div class=\"wlcm-date-range-picker-bottom-panel\">\n <wlcm-button type=\"paddingless\" (clicked)=\"picker.reset()\">Reset</wlcm-button>\n\n <wlcm-button (clicked)=\"picker.apply()\" [isDisabled]=\"!picker.isComplete()\">\n Apply\n </wlcm-button>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: WlcmButtonModule }, { kind: "component", type: i2.WlcmButtonComponent, selector: "wlcm-button", inputs: ["type", "size", "isDisabled", "isLoading"], outputs: ["clicked"] }] }); }
30
+ }
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerBottomPanelComponent, decorators: [{
32
+ type: Component,
33
+ args: [{ selector: 'wlcm-date-range-picker-bottom-panel', standalone: true, imports: [CommonModule, WlcmButtonModule], template: "<div class=\"wlcm-date-range-picker-bottom-panel\">\n <wlcm-button type=\"paddingless\" (clicked)=\"picker.reset()\">Reset</wlcm-button>\n\n <wlcm-button (clicked)=\"picker.apply()\" [isDisabled]=\"!picker.isComplete()\">\n Apply\n </wlcm-button>\n</div>\n" }]
34
+ }], ctorParameters: () => [{ type: WlcmDateRangePickerComponent }] });
35
+
36
+ class WlcmDataRangeCalendar {
37
+ constructor(location, element, calendar, dateAdapter, datepickerConfig) {
38
+ this.element = element;
39
+ this.calendar = calendar;
40
+ this.dateAdapter = dateAdapter;
41
+ this.datepickerConfig = datepickerConfig;
42
+ this.dateChange = output();
43
+ this.viewChange = output();
44
+ this.disabled = input(false);
45
+ this.location = location;
46
+ effect(() => {
47
+ if (this.disabled()) {
48
+ this.element.nativeElement.classList.add('wlcm-calendar-disabled');
49
+ }
50
+ else {
51
+ this.element.nativeElement.classList.remove('wlcm-calendar-disabled');
52
+ }
53
+ });
54
+ this.handleConfigValues();
55
+ }
56
+ get minDate() {
57
+ return this.datepickerConfig.minDate?.();
58
+ }
59
+ get maxDate() {
60
+ return this.datepickerConfig.maxDate?.();
61
+ }
62
+ prevMonth() {
63
+ this.dateChange.emit(this.dateAdapter.addCalendarMonths(this.calendar.activeDate, -1));
64
+ }
65
+ nextMonth() {
66
+ this.dateChange.emit(this.dateAdapter.addCalendarMonths(this.calendar.activeDate, 1));
67
+ }
68
+ prevYear() {
69
+ this.dateChange.emit(this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? -1 : -yearsPerPage));
70
+ }
71
+ nextYear() {
72
+ this.dateChange.emit(this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? 1 : yearsPerPage));
73
+ }
74
+ handleConfigValues() {
75
+ this.calendar.dateFilter = (date) => {
76
+ if (this.minDate && isBefore(startOfDay(date), startOfDay(this.minDate)))
77
+ return false;
78
+ if (this.maxDate && isAfter(startOfDay(date), startOfDay(this.maxDate)))
79
+ return false;
80
+ return true;
81
+ };
82
+ }
83
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDataRangeCalendar, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
84
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.6", type: WlcmDataRangeCalendar, inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange", viewChange: "viewChange" }, ngImport: i0 }); }
85
+ }
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDataRangeCalendar, decorators: [{
87
+ type: Directive
88
+ }], ctorParameters: () => [{ type: undefined }, { type: i0.ElementRef }, { type: i2$1.MatCalendar }, { type: i1.DateAdapter }, { type: undefined }] });
89
+
90
+ class WlcmCalendarHeaderComponent {
91
+ constructor(dateAdapter, dateFormats, calendar) {
92
+ this.dateAdapter = dateAdapter;
93
+ this.dateFormats = dateFormats;
94
+ this.calendar = calendar;
95
+ this.WlcmIconName = WlcmIconName;
96
+ this.next = input();
97
+ this.previous = input();
98
+ this.disableLeftArrow = input(false);
99
+ this.disableRightArrow = input(false);
100
+ this.displayLeftArrow = input(true);
101
+ this.displayRightArrow = input(true);
102
+ }
103
+ previousClicked() {
104
+ if (this.previous())
105
+ return this.previous()();
106
+ this.calendar.activeDate =
107
+ this.calendar.currentView == 'month'
108
+ ? this.dateAdapter.addCalendarMonths(this.calendar.activeDate, -1)
109
+ : this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? -1 : -yearsPerPage);
110
+ }
111
+ nextClicked() {
112
+ if (this.next())
113
+ return this.next()();
114
+ this.calendar.activeDate =
115
+ this.calendar.currentView == 'month'
116
+ ? this.dateAdapter.addCalendarMonths(this.calendar.activeDate, 1)
117
+ : this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? 1 : yearsPerPage);
118
+ }
119
+ changeCalendarView() {
120
+ if (this.calendar.currentView === 'multi-year') {
121
+ this.calendar.currentView = 'month';
122
+ return;
123
+ }
124
+ this.calendar.currentView = 'multi-year';
125
+ }
126
+ get periodLabel() {
127
+ return this.dateAdapter.format(this.calendar.activeDate, this.dateFormats.display.monthYearLabel);
128
+ }
129
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmCalendarHeaderComponent, deps: [{ token: i1.DateAdapter }, { token: MAT_DATE_FORMATS, optional: true }, { token: forwardRef(() => MatCalendar) }], target: i0.ɵɵFactoryTarget.Component }); }
130
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.6", type: WlcmCalendarHeaderComponent, isStandalone: true, selector: "wlcm-calendar-header", inputs: { next: { classPropertyName: "next", publicName: "next", isSignal: true, isRequired: false, transformFunction: null }, previous: { classPropertyName: "previous", publicName: "previous", isSignal: true, isRequired: false, transformFunction: null }, disableLeftArrow: { classPropertyName: "disableLeftArrow", publicName: "disableLeftArrow", isSignal: true, isRequired: false, transformFunction: null }, disableRightArrow: { classPropertyName: "disableRightArrow", publicName: "disableRightArrow", isSignal: true, isRequired: false, transformFunction: null }, displayLeftArrow: { classPropertyName: "displayLeftArrow", publicName: "displayLeftArrow", isSignal: true, isRequired: false, transformFunction: null }, displayRightArrow: { classPropertyName: "displayRightArrow", publicName: "displayRightArrow", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "wlcm-calendar-header" }, ngImport: i0, template: "<div class=\"wlcm-calendar-header-button-container\">\n @if (displayLeftArrow()) {\n <button\n class=\"wlcm-calendar-header-button wlcm-calendar-header-button-left\"\n [disabled]=\"disableLeftArrow()\"\n (click)=\"previousClicked()\"\n >\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n </button>\n }\n</div>\n\n<button\n class=\"wlcm-calendar-header-change-view-button\"\n (click)=\"changeCalendarView()\"\n>\n <div class=\"wlcm-calendar-header-period-label\">\n {{ periodLabel }}\n </div>\n\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n</button>\n\n<div class=\"wlcm-calendar-header-button-container\">\n @if (displayRightArrow()) {\n <button\n class=\"wlcm-calendar-header-button wlcm-calendar-header-button-right\"\n [disabled]=\"disableRightArrow()\"\n (click)=\"nextClicked()\"\n >\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n </button>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: WlcmIconDirective, selector: "[wlcmIcon]", inputs: ["wlcmIcon", "wlcmIconStopPropagation"], outputs: ["wlcmIconClicked"] }] }); }
131
+ }
132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmCalendarHeaderComponent, decorators: [{
133
+ type: Component,
134
+ args: [{ selector: 'wlcm-calendar-header', host: { class: 'wlcm-calendar-header' }, standalone: true, imports: [CommonModule, WlcmIconDirective], template: "<div class=\"wlcm-calendar-header-button-container\">\n @if (displayLeftArrow()) {\n <button\n class=\"wlcm-calendar-header-button wlcm-calendar-header-button-left\"\n [disabled]=\"disableLeftArrow()\"\n (click)=\"previousClicked()\"\n >\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n </button>\n }\n</div>\n\n<button\n class=\"wlcm-calendar-header-change-view-button\"\n (click)=\"changeCalendarView()\"\n>\n <div class=\"wlcm-calendar-header-period-label\">\n {{ periodLabel }}\n </div>\n\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n</button>\n\n<div class=\"wlcm-calendar-header-button-container\">\n @if (displayRightArrow()) {\n <button\n class=\"wlcm-calendar-header-button wlcm-calendar-header-button-right\"\n [disabled]=\"disableRightArrow()\"\n (click)=\"nextClicked()\"\n >\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n </button>\n }\n</div>\n" }]
135
+ }], ctorParameters: () => [{ type: i1.DateAdapter }, { type: undefined, decorators: [{
136
+ type: Optional
137
+ }, {
138
+ type: Inject,
139
+ args: [MAT_DATE_FORMATS]
140
+ }] }, { type: i2$1.MatCalendar, decorators: [{
141
+ type: Inject,
142
+ args: [forwardRef(() => MatCalendar)]
143
+ }] }] });
30
144
 
31
145
  function range(length, valueFunction) {
32
146
  const valuesArray = Array(length);
@@ -72,53 +186,237 @@ const WLCM_DEFAULT_DATEPICKER_PROVIDERS = [
72
186
  const WLCM_DATEPICKER_CONFIG = new InjectionToken('WLCM_DATEPICKER_CONFIG', { providedIn: 'root', factory: () => ({ selectOnly: false }) });
73
187
  const WLCM_DATEPICKER_INPUT_CLASS = 'wlcm-datepicker-input';
74
188
 
75
- let WlcmDatepickerTrigger = class WlcmDatepickerTrigger {
76
- get isOnlySelect() {
77
- return this.selectOnly();
189
+ class WlcmDateRangeCalendarHeaderComponent {
190
+ constructor(rangeCalendar, dateFormats, calendar, datepickerConfig) {
191
+ this.rangeCalendar = rangeCalendar;
192
+ this.dateFormats = dateFormats;
193
+ this.calendar = calendar;
194
+ this.datepickerConfig = datepickerConfig;
195
+ this.WlcmIconName = WlcmIconName;
196
+ this.previous = () => {
197
+ if (this.isPreviousDisabled)
198
+ return;
199
+ if (this.calendar.currentView !== 'month') {
200
+ return this.rangeCalendar.prevYear();
201
+ }
202
+ return this.rangeCalendar.prevMonth();
203
+ };
204
+ this.next = () => {
205
+ if (this.isNextDisabled)
206
+ return;
207
+ if (this.calendar.currentView !== 'month') {
208
+ return this.rangeCalendar.nextYear();
209
+ }
210
+ return this.rangeCalendar.nextMonth();
211
+ };
78
212
  }
79
- constructor(overlay, viewContainerRef, selectionModel) {
80
- this.overlay = overlay;
81
- this.viewContainerRef = viewContainerRef;
82
- this.selectionModel = selectionModel;
83
- this.minDate = input(this.defaultDatepickerConfig.minDate?.());
84
- this.maxDate = input(this.defaultDatepickerConfig.maxDate?.());
85
- this.selectOnly = input(this.defaultDatepickerConfig.selectOnly || false);
86
- this.overlayRef = this.overlay.create(this.createOverlayConfig());
87
- this.handleBackdropClick();
213
+ get minDate() {
214
+ return this.datepickerConfig.minDate?.();
88
215
  }
89
- open() {
90
- const injector = Injector.create({
91
- providers: [{ provide: OverlayRef, useValue: this.overlayRef }],
92
- parent: this.datepickerInjector,
93
- });
94
- const portal = new ComponentPortal(this.componentType, this.viewContainerRef, injector);
95
- this.updatePositionStrategy();
96
- this.componentRef = this.overlayRef.attach(portal);
216
+ get maxDate() {
217
+ return this.datepickerConfig.maxDate?.();
97
218
  }
98
- close() {
99
- this.overlayRef.detach();
219
+ get isPreviousDisabled() {
220
+ if (!this.minDate)
221
+ return false;
222
+ let previousPeriod = endOfMonth(add(this.calendar.activeDate, { months: -1 }));
223
+ if (this.calendar.currentView !== 'month') {
224
+ previousPeriod = add(this.calendar.activeDate, { years: -1 });
225
+ }
226
+ return isBefore(previousPeriod, this.minDate);
100
227
  }
101
- get isOpen() {
102
- return this.overlayRef.hasAttached();
228
+ get isNextDisabled() {
229
+ if (!this.maxDate)
230
+ return false;
231
+ let nextPeriod = startOfMonth(add(this.calendar.activeDate, { months: 1 }));
232
+ if (this.calendar.currentView !== 'month') {
233
+ nextPeriod = add(this.calendar.activeDate, { years: 1 });
234
+ }
235
+ return isBefore(this.maxDate, nextPeriod);
103
236
  }
104
- get opened() {
105
- return merge(this.overlayRef?.attachments() || EMPTY).pipe(filter(() => this.overlayRef.hasAttached()));
237
+ get canDisplayLeftArrow() {
238
+ return !this.rangeCalendar || this.rangeCalendar.location === 'left' || this.calendar.currentView !== 'month';
106
239
  }
107
- get closed() {
108
- return (this.overlayRef?.detachments() || EMPTY).pipe(filter(() => !this.overlayRef.hasAttached()));
240
+ get canDisplayRightArrow() {
241
+ return !this.rangeCalendar || this.rangeCalendar.location === 'right' || this.calendar.currentView !== 'month';
109
242
  }
110
- get datepickerInjector() {
111
- const parent = this.viewContainerRef.injector;
112
- return Injector.create({
113
- parent,
114
- providers: [{ provide: WLCM_DATEPICKER_CONFIG, useValue: this.datepickerConfig }],
115
- });
243
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangeCalendarHeaderComponent, deps: [{ token: WlcmDataRangeCalendar, optional: true }, { token: MAT_DATE_FORMATS, optional: true }, { token: forwardRef(() => MatCalendar) }, { token: WLCM_DATEPICKER_CONFIG }], target: i0.ɵɵFactoryTarget.Component }); }
244
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDateRangeCalendarHeaderComponent, isStandalone: true, selector: "wlcm-date-range-calendar-header", ngImport: i0, template: "<wlcm-calendar-header\n [next]=\"next\"\n [previous]=\"previous\"\n [disableLeftArrow]=\"isPreviousDisabled\"\n [disableRightArrow]=\"isNextDisabled\"\n [displayLeftArrow]=\"canDisplayLeftArrow && !rangeCalendar.disabled()\"\n [displayRightArrow]=\"canDisplayRightArrow && !rangeCalendar.disabled()\"\n></wlcm-calendar-header>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: WlcmCalendarHeaderComponent, selector: "wlcm-calendar-header", inputs: ["next", "previous", "disableLeftArrow", "disableRightArrow", "displayLeftArrow", "displayRightArrow"] }] }); }
245
+ }
246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangeCalendarHeaderComponent, decorators: [{
247
+ type: Component,
248
+ args: [{ selector: 'wlcm-date-range-calendar-header', standalone: true, imports: [CommonModule, WlcmCalendarHeaderComponent, WlcmIconDirective], template: "<wlcm-calendar-header\n [next]=\"next\"\n [previous]=\"previous\"\n [disableLeftArrow]=\"isPreviousDisabled\"\n [disableRightArrow]=\"isNextDisabled\"\n [displayLeftArrow]=\"canDisplayLeftArrow && !rangeCalendar.disabled()\"\n [displayRightArrow]=\"canDisplayRightArrow && !rangeCalendar.disabled()\"\n></wlcm-calendar-header>\n" }]
249
+ }], ctorParameters: () => [{ type: WlcmDataRangeCalendar, decorators: [{
250
+ type: Optional
251
+ }] }, { type: undefined, decorators: [{
252
+ type: Optional
253
+ }, {
254
+ type: Inject,
255
+ args: [MAT_DATE_FORMATS]
256
+ }] }, { type: i2$1.MatCalendar, decorators: [{
257
+ type: Inject,
258
+ args: [forwardRef(() => MatCalendar)]
259
+ }] }, { type: undefined, decorators: [{
260
+ type: Inject,
261
+ args: [WLCM_DATEPICKER_CONFIG]
262
+ }] }] });
263
+
264
+ const WLCM_DATE_RANGE_PICKER_CONFIG = new InjectionToken('WLCM_DATE_RANGE_PICKER_CONFIG', { providedIn: 'root', factory: () => ({}) });
265
+
266
+ const WLCM_DATE_RANGE_SELECTION_MODEL = new InjectionToken('WLCM_DATE_RANGE_SELECTION_MODEL');
267
+ const WLCM_DATE_RANGE_SELECTION_MODEL_PROVIDER = {
268
+ provide: WLCM_DATE_RANGE_SELECTION_MODEL,
269
+ useFactory: (adapter) => new MatRangeDateSelectionModel(adapter),
270
+ deps: [DateAdapter],
271
+ };
272
+
273
+ const WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL = new InjectionToken('WLCM_DATE_RANGE_SELECTION_MODEL');
274
+ const WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL_PROVIDER = {
275
+ provide: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL,
276
+ useFactory: (adapter) => new MatRangeDateSelectionModel(adapter),
277
+ deps: [DateAdapter],
278
+ };
279
+
280
+ let WlcmLeftCalendarDirective = class WlcmLeftCalendarDirective extends WlcmDataRangeCalendar {
281
+ constructor(element, dateAdapter, calendar, datepickerConfig) {
282
+ super('left', element, calendar, dateAdapter, datepickerConfig);
283
+ this.element = element;
284
+ this.dateAdapter = dateAdapter;
285
+ this.calendar = calendar;
286
+ this.datepickerConfig = datepickerConfig;
287
+ this.handleYearChange();
288
+ this.handleMonthChange();
116
289
  }
117
- get defaultDatepickerConfig() {
290
+ handleYearChange() {
291
+ this.calendar.yearSelected.pipe(untilDestroyed(this)).subscribe((date) => this.dateChange.emit(date));
292
+ }
293
+ handleMonthChange() {
294
+ this.calendar.monthSelected.pipe(untilDestroyed(this)).subscribe((date) => this.dateChange.emit(date));
295
+ }
296
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmLeftCalendarDirective, deps: [{ token: i0.ElementRef }, { token: i1.DateAdapter }, { token: forwardRef(() => MatCalendar) }, { token: WLCM_DATEPICKER_CONFIG }], target: i0.ɵɵFactoryTarget.Directive }); }
297
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmLeftCalendarDirective, isStandalone: true, selector: "[wlcmLeftCalendar]", providers: [{ provide: WlcmDataRangeCalendar, useExisting: forwardRef(() => WlcmLeftCalendarDirective) }], usesInheritance: true, ngImport: i0 }); }
298
+ };
299
+ WlcmLeftCalendarDirective = __decorate([
300
+ UntilDestroy(),
301
+ __metadata("design:paramtypes", [ElementRef,
302
+ DateAdapter,
303
+ MatCalendar, Object])
304
+ ], WlcmLeftCalendarDirective);
305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmLeftCalendarDirective, decorators: [{
306
+ type: Directive,
307
+ args: [{
308
+ selector: '[wlcmLeftCalendar]',
309
+ standalone: true,
310
+ providers: [{ provide: WlcmDataRangeCalendar, useExisting: forwardRef(() => WlcmLeftCalendarDirective) }],
311
+ }]
312
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.DateAdapter }, { type: i2$1.MatCalendar, decorators: [{
313
+ type: Inject,
314
+ args: [forwardRef(() => MatCalendar)]
315
+ }] }, { type: undefined, decorators: [{
316
+ type: Inject,
317
+ args: [WLCM_DATEPICKER_CONFIG]
318
+ }] }] });
319
+
320
+ let WlcmRightCalendarDirective = class WlcmRightCalendarDirective extends WlcmDataRangeCalendar {
321
+ constructor(element, dateAdapter, calendar, datepickerConfig) {
322
+ super('right', element, calendar, dateAdapter, datepickerConfig);
323
+ this.element = element;
324
+ this.dateAdapter = dateAdapter;
325
+ this.calendar = calendar;
326
+ this.datepickerConfig = datepickerConfig;
327
+ this.handleYearChange();
328
+ this.handleMonthChange();
329
+ }
330
+ handleYearChange() {
331
+ this.calendar.yearSelected
332
+ .pipe(untilDestroyed(this))
333
+ .subscribe((date) => this.dateChange.emit(this.dateAdapter.addCalendarMonths(date, -1)));
334
+ }
335
+ handleMonthChange() {
336
+ this.calendar.monthSelected
337
+ .pipe(untilDestroyed(this))
338
+ .subscribe((date) => this.dateChange.emit(this.dateAdapter.addCalendarMonths(date, -1)));
339
+ }
340
+ nextMonth() {
341
+ this.dateChange.emit(this.calendar.activeDate);
342
+ }
343
+ prevYear() {
344
+ this.dateChange.emit(this.dateAdapter.addCalendarMonths(this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? -1 : -yearsPerPage), -1));
345
+ }
346
+ nextYear() {
347
+ this.dateChange.emit(this.dateAdapter.addCalendarMonths(this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? 1 : yearsPerPage), -1));
348
+ }
349
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmRightCalendarDirective, deps: [{ token: i0.ElementRef }, { token: i1.DateAdapter }, { token: forwardRef(() => MatCalendar) }, { token: WLCM_DATEPICKER_CONFIG }], target: i0.ɵɵFactoryTarget.Directive }); }
350
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmRightCalendarDirective, isStandalone: true, selector: "[wlcmRightCalendar]", providers: [{ provide: WlcmDataRangeCalendar, useExisting: forwardRef(() => WlcmRightCalendarDirective) }], usesInheritance: true, ngImport: i0 }); }
351
+ };
352
+ WlcmRightCalendarDirective = __decorate([
353
+ UntilDestroy(),
354
+ __metadata("design:paramtypes", [ElementRef,
355
+ DateAdapter,
356
+ MatCalendar, Object])
357
+ ], WlcmRightCalendarDirective);
358
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmRightCalendarDirective, decorators: [{
359
+ type: Directive,
360
+ args: [{
361
+ selector: '[wlcmRightCalendar]',
362
+ standalone: true,
363
+ providers: [{ provide: WlcmDataRangeCalendar, useExisting: forwardRef(() => WlcmRightCalendarDirective) }],
364
+ }]
365
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.DateAdapter }, { type: i2$1.MatCalendar, decorators: [{
366
+ type: Inject,
367
+ args: [forwardRef(() => MatCalendar)]
368
+ }] }, { type: undefined, decorators: [{
369
+ type: Inject,
370
+ args: [WLCM_DATEPICKER_CONFIG]
371
+ }] }] });
372
+
373
+ let WlcmDatepickerTrigger = class WlcmDatepickerTrigger {
374
+ get isOnlySelect() {
375
+ return this.selectOnly();
376
+ }
377
+ constructor(overlay, viewContainerRef, selectionModel) {
378
+ this.overlay = overlay;
379
+ this.viewContainerRef = viewContainerRef;
380
+ this.selectionModel = selectionModel;
381
+ this.minDate = input(this.defaultDatepickerConfig.minDate?.());
382
+ this.maxDate = input(this.defaultDatepickerConfig.maxDate?.());
383
+ this.selectOnly = input(this.defaultDatepickerConfig.selectOnly || false);
384
+ this.overlayRef = this.overlay.create(this.createOverlayConfig());
385
+ this.handleBackdropClick();
386
+ }
387
+ open() {
388
+ const injector = Injector.create({
389
+ providers: [{ provide: OverlayRef, useValue: this.overlayRef }],
390
+ parent: this.datepickerInjector,
391
+ });
392
+ const portal = new ComponentPortal(this.componentType, this.viewContainerRef, injector);
393
+ this.updatePositionStrategy();
394
+ this.componentRef = this.overlayRef.attach(portal);
395
+ }
396
+ close() {
397
+ this.overlayRef.detach();
398
+ }
399
+ get isOpen() {
400
+ return this.overlayRef.hasAttached();
401
+ }
402
+ get opened() {
403
+ return merge(this.overlayRef?.attachments() || EMPTY).pipe(filter(() => this.overlayRef.hasAttached()));
404
+ }
405
+ get closed() {
406
+ return (this.overlayRef?.detachments() || EMPTY).pipe(filter(() => !this.overlayRef.hasAttached()));
407
+ }
408
+ get datepickerInjector() {
409
+ const parent = this.viewContainerRef.injector;
410
+ return Injector.create({
411
+ parent,
412
+ providers: [{ provide: WLCM_DATEPICKER_CONFIG, useValue: this.datepickerConfig }],
413
+ });
414
+ }
415
+ get defaultDatepickerConfig() {
118
416
  return this.viewContainerRef.injector.get(WLCM_DATEPICKER_CONFIG, {}, { optional: true });
119
417
  }
120
418
  get datepickerConfig() {
121
- const config = this.defaultDatepickerConfig;
419
+ const config = { ...this.defaultDatepickerConfig };
122
420
  if (this.minDate())
123
421
  config.minDate = this.minDate;
124
422
  if (this.maxDate())
@@ -126,6 +424,9 @@ let WlcmDatepickerTrigger = class WlcmDatepickerTrigger {
126
424
  config.selectOnly = this.selectOnly();
127
425
  return config;
128
426
  }
427
+ get overlayOrigin() {
428
+ return new CdkOverlayOrigin(this.connectedTo);
429
+ }
129
430
  handleBackdropClick() {
130
431
  this.overlayRef
131
432
  .backdropClick()
@@ -133,7 +434,8 @@ let WlcmDatepickerTrigger = class WlcmDatepickerTrigger {
133
434
  .subscribe(() => this.close());
134
435
  }
135
436
  updatePositionStrategy() {
136
- const strategy = this.overlay.position().flexibleConnectedTo(this.connectedTo);
437
+ const origin = this.overlayOrigin.elementRef;
438
+ const strategy = this.overlay.position().flexibleConnectedTo(origin);
137
439
  strategy.withPositions([
138
440
  { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
139
441
  { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
@@ -149,7 +451,7 @@ let WlcmDatepickerTrigger = class WlcmDatepickerTrigger {
149
451
  backdropClass: 'transparent',
150
452
  });
151
453
  }
152
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerTrigger, deps: [{ token: i1.Overlay }, { token: i0.ViewContainerRef }, { token: i2.MatDateSelectionModel }], target: i0.ɵɵFactoryTarget.Directive }); }
454
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerTrigger, deps: [{ token: i1$1.Overlay }, { token: i0.ViewContainerRef }, { token: i2$1.MatDateSelectionModel }], target: i0.ɵɵFactoryTarget.Directive }); }
153
455
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.6", type: WlcmDatepickerTrigger, inputs: { minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, selectOnly: { classPropertyName: "selectOnly", publicName: "selectOnly", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.wlcm-datepicker-select-only-mode": "this.isOnlySelect" } }, ngImport: i0 }); }
154
456
  };
155
457
  WlcmDatepickerTrigger = __decorate([
@@ -160,100 +462,265 @@ WlcmDatepickerTrigger = __decorate([
160
462
  ], WlcmDatepickerTrigger);
161
463
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerTrigger, decorators: [{
162
464
  type: Directive
163
- }], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.ViewContainerRef }, { type: i2.MatDateSelectionModel }], propDecorators: { isOnlySelect: [{
465
+ }], ctorParameters: () => [{ type: i1$1.Overlay }, { type: i0.ViewContainerRef }, { type: i2$1.MatDateSelectionModel }], propDecorators: { isOnlySelect: [{
164
466
  type: HostBinding,
165
467
  args: ['class.wlcm-datepicker-select-only-mode']
166
468
  }] } });
167
469
 
168
- class WlcmDatepickerInputBase {
169
- handleBlur() {
170
- this.updateSelection();
171
- this._touched?.();
172
- }
173
- handleInput() {
174
- if (this.isValidFormat(this.currentValue, this.dateFormats.parse.dateInput)) {
175
- this.updateSelection();
176
- }
177
- this._validatorChanged?.();
178
- }
179
- get datepickerInputClass() {
180
- return WLCM_DATEPICKER_INPUT_CLASS;
181
- }
182
- constructor(element, dateAdapter, dateFormats, trigger) {
183
- this.element = element;
184
- this.dateAdapter = dateAdapter;
185
- this.dateFormats = dateFormats;
470
+ class WlcmCalendarDirective {
471
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmCalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
472
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmCalendarDirective, isStandalone: true, selector: "[wlcmCalendar]", host: { classAttribute: "wlcm-calendar" }, ngImport: i0 }); }
473
+ }
474
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmCalendarDirective, decorators: [{
475
+ type: Directive,
476
+ args: [{
477
+ selector: '[wlcmCalendar]',
478
+ host: { class: 'wlcm-calendar' },
479
+ standalone: true,
480
+ }]
481
+ }] });
482
+
483
+ let WlcmDateRangePickerComponent = class WlcmDateRangePickerComponent {
484
+ constructor(rangeConfig, rangeSelectionStrategy, localSelectionModel, triggerSelectionModel, trigger, datepickerConfig, dateAdapter) {
485
+ this.rangeConfig = rangeConfig;
486
+ this.rangeSelectionStrategy = rangeSelectionStrategy;
487
+ this.localSelectionModel = localSelectionModel;
488
+ this.triggerSelectionModel = triggerSelectionModel;
186
489
  this.trigger = trigger;
187
- }
188
- writeValue(value) {
189
- this.updateInputValue(value);
190
- }
191
- registerOnChange(callback) {
192
- this._changed = callback;
193
- }
194
- registerOnTouched(callback) {
195
- this._touched = callback;
196
- }
197
- registerOnValidatorChange(callback) {
198
- this._validatorChanged = callback;
199
- }
200
- validate() {
201
- if (!this.currentValue)
202
- return null;
203
- const isValid = this.isValidFormat(this.currentValue, this.dateFormats.parse.dateInput);
204
- if (!isValid) {
205
- return {
206
- [WlcmDateValidation.Format]: { value: this.currentValue, format: this.dateFormats.parse.dateInput },
207
- required: false,
208
- };
209
- }
210
- const date = this.parseCurrentValue();
211
- if (this.minDate && isBefore(startOfDay(date), startOfDay(this.minDate))) {
212
- return { [WlcmDateValidation.MinDate]: { minDate: this.minDate, currentDate: date } };
490
+ this.datepickerConfig = datepickerConfig;
491
+ this.dateAdapter = dateAdapter;
492
+ this.headerComponent = WlcmDateRangeCalendarHeaderComponent;
493
+ this._isViewInitialized = false;
494
+ this._isComplete = signal(false);
495
+ this.isComplete = computed(() => this._isComplete());
496
+ this.startDate = signal(new Date());
497
+ this.leftCalendarYearViewActivated = signal(false);
498
+ this.rightCalendarYearViewActivated = signal(false);
499
+ this.handleSelectionChanged();
500
+ this.localSelectionModel.updateSelection(this.triggerSelectionModel.selection, this);
501
+ if (this.triggerSelectionModel.selection.start) {
502
+ this.startDate.set(this.triggerSelectionModel.selection.start);
213
503
  }
214
- if (this.maxDate && isAfter(startOfDay(date), startOfDay(this.maxDate))) {
215
- return { [WlcmDateValidation.MaxDate]: { maxDate: this.maxDate, currentDate: date } };
504
+ if (this.rangeConfig.headerComponent) {
505
+ this.headerComponent = this.rangeConfig.headerComponent;
216
506
  }
217
- return null;
507
+ effect(() => {
508
+ if (!this._isViewInitialized)
509
+ return;
510
+ this.leftCalendar.activeDate = this.startDate();
511
+ this.rightCalendar.activeDate = this.dateAdapter.addCalendarMonths(this.startDate(), 1);
512
+ this.rightCalendar.startAt = this.dateAdapter.addCalendarMonths(this.startDate(), 1);
513
+ });
218
514
  }
219
- parseCurrentValue() {
220
- const date = this.dateAdapter.parse(this.currentValue, this.dateFormats.parse.dateInput);
221
- return this.dateAdapter.getValidDateOrNull(date);
515
+ ngAfterViewInit() {
516
+ this._isViewInitialized = true;
517
+ this.leftCalendar.viewChanged.pipe(untilDestroyed(this)).subscribe((view) => {
518
+ this.leftCalendarYearViewActivated.set(view !== 'month');
519
+ });
520
+ this.rightCalendar.viewChanged.pipe(untilDestroyed(this)).subscribe((view) => {
521
+ this.rightCalendarYearViewActivated.set(view !== 'month');
522
+ });
523
+ this.handleRightCalendarPreviewChange();
222
524
  }
223
- isValidFormat(value, pattern) {
224
- const parsedDate = parse(value, pattern, new Date());
225
- return isValid(parsedDate) && value === format(parsedDate, pattern);
525
+ calendarSelection(event) {
526
+ const newSelection = this.rangeSelectionStrategy.selectionFinished(event.value, this.localSelectionModel.selection, event.event);
527
+ this.localSelectionModel.updateSelection(newSelection, this);
226
528
  }
227
- get minDate() {
228
- return this.trigger.minDate?.();
529
+ calendarDragDrop(event) {
530
+ this.localSelectionModel.updateSelection(event.value, this);
229
531
  }
230
- get maxDate() {
231
- return this.trigger.maxDate?.();
532
+ apply() {
533
+ this.triggerSelectionModel.updateSelection(this.localSelectionModel.selection, this);
534
+ this.trigger.close();
232
535
  }
233
- get inputElement() {
234
- return this.element.nativeElement;
536
+ reset() {
537
+ this.trigger.close();
235
538
  }
236
- get currentValue() {
237
- return this.inputElement.value;
539
+ get selected() {
540
+ return this.localSelectionModel.selection;
238
541
  }
239
- updateInputValue(value) {
240
- let newValue = '';
241
- if (value) {
242
- newValue = this.dateAdapter.format(value, this.dateFormats.display.dateInput);
243
- }
244
- this.inputElement.value = newValue;
542
+ get leftCalendarActiveCell() {
543
+ return this.leftCalendarElement.nativeElement.querySelector('.mat-calendar-body-active');
245
544
  }
246
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerInputBase, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
247
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDatepickerInputBase, host: { listeners: { "blur": "handleBlur()", "input": "handleInput()" }, properties: { "class": "this.datepickerInputClass" } }, ngImport: i0 }); }
248
- }
249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerInputBase, decorators: [{
250
- type: Directive
251
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.DateAdapter }, { type: undefined }, { type: WlcmDatepickerTrigger }], propDecorators: { handleBlur: [{
252
- type: HostListener,
253
- args: ['blur']
254
- }], handleInput: [{
255
- type: HostListener,
256
- args: ['input']
545
+ handleSelectionChanged() {
546
+ this.localSelectionModel.selectionChanged
547
+ .pipe(untilDestroyed(this))
548
+ .subscribe(() => this._isComplete.set(this.localSelectionModel.isComplete()));
549
+ }
550
+ handleRightCalendarPreviewChange() {
551
+ const viewChanged = new Subject();
552
+ this.rightCalendar.viewChanged
553
+ .pipe(untilDestroyed(this))
554
+ .pipe(tap(() => viewChanged.next()))
555
+ .pipe(startWith(this.rightCalendar.currentView))
556
+ .subscribe((view) => {
557
+ if (view !== 'month')
558
+ return;
559
+ this.rightCalendar.monthView._matCalendarBody.previewChange
560
+ .pipe(takeUntil(viewChanged), untilDestroyed(this))
561
+ .subscribe(() => {
562
+ if (this.leftCalendar.currentView !== 'month' || !this.leftCalendar.monthView._rangeStart)
563
+ return;
564
+ this.leftCalendar.monthView._previewStart = this.rightCalendar.monthView._previewStart;
565
+ this.leftCalendar.monthView._previewEnd = this.rightCalendar.monthView._previewEnd;
566
+ const activeCell = this.leftCalendarActiveCell;
567
+ if (activeCell && activeCell === document.activeElement)
568
+ activeCell.blur();
569
+ this.leftCalendar.monthView._changeDetectorRef.markForCheck();
570
+ });
571
+ });
572
+ }
573
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerComponent, deps: [{ token: WLCM_DATE_RANGE_PICKER_CONFIG, optional: true }, { token: MAT_DATE_RANGE_SELECTION_STRATEGY }, { token: WLCM_DATE_RANGE_SELECTION_MODEL }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WlcmDatepickerTrigger }, { token: WLCM_DATEPICKER_CONFIG }, { token: i1.DateAdapter }], target: i0.ɵɵFactoryTarget.Component }); }
574
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDateRangePickerComponent, isStandalone: true, selector: "wlcm-date-range-picker", providers: [
575
+ {
576
+ provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
577
+ useClass: DefaultMatCalendarRangeStrategy,
578
+ },
579
+ WLCM_DATE_RANGE_SELECTION_MODEL_PROVIDER,
580
+ ], viewQueries: [{ propertyName: "leftCalendar", first: true, predicate: WlcmLeftCalendarDirective, descendants: true, read: MatCalendar }, { propertyName: "rightCalendar", first: true, predicate: WlcmRightCalendarDirective, descendants: true, read: MatCalendar }, { propertyName: "leftCalendarElement", first: true, predicate: WlcmLeftCalendarDirective, descendants: true, read: ElementRef }, { propertyName: "monthView", first: true, predicate: MatMonthView, descendants: true }], ngImport: i0, template: "<div class=\"wlcm-date-range-picker-panel\">\n <div class=\"wlcm-date-range-picker-body\">\n <mat-calendar\n wlcmCalendar\n wlcmLeftCalendar\n [selected]=\"selected\"\n [disabled]=\"rightCalendarYearViewActivated()\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n (dateChange)=\"startDate.set($event)\"\n ></mat-calendar>\n\n <mat-calendar\n wlcmCalendar\n wlcmRightCalendar\n [selected]=\"selected\"\n [disabled]=\"leftCalendarYearViewActivated()\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n (dateChange)=\"startDate.set($event)\"\n ></mat-calendar>\n </div>\n\n <wlcm-date-range-picker-bottom-panel></wlcm-date-range-picker-bottom-panel>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2$1.MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "directive", type: WlcmCalendarDirective, selector: "[wlcmCalendar]" }, { kind: "directive", type: WlcmLeftCalendarDirective, selector: "[wlcmLeftCalendar]" }, { kind: "directive", type: WlcmRightCalendarDirective, selector: "[wlcmRightCalendar]" }, { kind: "component", type: WlcmDateRangePickerBottomPanelComponent, selector: "wlcm-date-range-picker-bottom-panel" }] }); }
581
+ };
582
+ WlcmDateRangePickerComponent = __decorate([
583
+ UntilDestroy(),
584
+ __metadata("design:paramtypes", [Object, Object, MatDateSelectionModel,
585
+ MatDateSelectionModel,
586
+ WlcmDatepickerTrigger, Object, DateAdapter])
587
+ ], WlcmDateRangePickerComponent);
588
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerComponent, decorators: [{
589
+ type: Component,
590
+ args: [{ selector: 'wlcm-date-range-picker', standalone: true, imports: [
591
+ CommonModule,
592
+ MatDatepickerModule,
593
+ WlcmCalendarDirective,
594
+ WlcmLeftCalendarDirective,
595
+ WlcmRightCalendarDirective,
596
+ WlcmDateRangePickerBottomPanelComponent,
597
+ ], providers: [
598
+ {
599
+ provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
600
+ useClass: DefaultMatCalendarRangeStrategy,
601
+ },
602
+ WLCM_DATE_RANGE_SELECTION_MODEL_PROVIDER,
603
+ ], template: "<div class=\"wlcm-date-range-picker-panel\">\n <div class=\"wlcm-date-range-picker-body\">\n <mat-calendar\n wlcmCalendar\n wlcmLeftCalendar\n [selected]=\"selected\"\n [disabled]=\"rightCalendarYearViewActivated()\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n (dateChange)=\"startDate.set($event)\"\n ></mat-calendar>\n\n <mat-calendar\n wlcmCalendar\n wlcmRightCalendar\n [selected]=\"selected\"\n [disabled]=\"leftCalendarYearViewActivated()\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n (dateChange)=\"startDate.set($event)\"\n ></mat-calendar>\n </div>\n\n <wlcm-date-range-picker-bottom-panel></wlcm-date-range-picker-bottom-panel>\n</div>\n" }]
604
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
605
+ type: Optional
606
+ }, {
607
+ type: Inject,
608
+ args: [WLCM_DATE_RANGE_PICKER_CONFIG]
609
+ }] }, { type: undefined, decorators: [{
610
+ type: Inject,
611
+ args: [MAT_DATE_RANGE_SELECTION_STRATEGY]
612
+ }] }, { type: i2$1.MatDateSelectionModel, decorators: [{
613
+ type: Inject,
614
+ args: [WLCM_DATE_RANGE_SELECTION_MODEL]
615
+ }] }, { type: i2$1.MatDateSelectionModel, decorators: [{
616
+ type: Inject,
617
+ args: [WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL]
618
+ }] }, { type: WlcmDatepickerTrigger }, { type: undefined, decorators: [{
619
+ type: Inject,
620
+ args: [WLCM_DATEPICKER_CONFIG]
621
+ }] }, { type: i1.DateAdapter }], propDecorators: { leftCalendar: [{
622
+ type: ViewChild,
623
+ args: [WlcmLeftCalendarDirective, { read: MatCalendar }]
624
+ }], rightCalendar: [{
625
+ type: ViewChild,
626
+ args: [WlcmRightCalendarDirective, { read: MatCalendar }]
627
+ }], leftCalendarElement: [{
628
+ type: ViewChild,
629
+ args: [WlcmLeftCalendarDirective, { read: ElementRef }]
630
+ }], monthView: [{
631
+ type: ViewChild,
632
+ args: [MatMonthView]
633
+ }] } });
634
+
635
+ class WlcmDatepickerInputBase {
636
+ handleBlur() {
637
+ this.updateSelection();
638
+ this._touched?.();
639
+ }
640
+ handleInput() {
641
+ if (this.isValidFormat(this.currentValue, this.dateFormats.parse.dateInput)) {
642
+ this.updateSelection();
643
+ }
644
+ this._validatorChanged?.();
645
+ }
646
+ get datepickerInputClass() {
647
+ return WLCM_DATEPICKER_INPUT_CLASS;
648
+ }
649
+ constructor(element, dateAdapter, dateFormats, trigger) {
650
+ this.element = element;
651
+ this.dateAdapter = dateAdapter;
652
+ this.dateFormats = dateFormats;
653
+ this.trigger = trigger;
654
+ }
655
+ writeValue(value) {
656
+ this.updateInputValue(value);
657
+ }
658
+ registerOnChange(callback) {
659
+ this._changed = callback;
660
+ }
661
+ registerOnTouched(callback) {
662
+ this._touched = callback;
663
+ }
664
+ registerOnValidatorChange(callback) {
665
+ this._validatorChanged = callback;
666
+ }
667
+ validate() {
668
+ if (!this.currentValue)
669
+ return null;
670
+ const isValid = this.isValidFormat(this.currentValue, this.dateFormats.parse.dateInput);
671
+ if (!isValid) {
672
+ return {
673
+ [WlcmDateValidation.Format]: { value: this.currentValue, format: this.dateFormats.parse.dateInput },
674
+ required: false,
675
+ };
676
+ }
677
+ const date = this.parseCurrentValue();
678
+ if (this.minDate && isBefore(startOfDay(date), startOfDay(this.minDate))) {
679
+ return { [WlcmDateValidation.MinDate]: { minDate: this.minDate, currentDate: date } };
680
+ }
681
+ if (this.maxDate && isAfter(startOfDay(date), startOfDay(this.maxDate))) {
682
+ return { [WlcmDateValidation.MaxDate]: { maxDate: this.maxDate, currentDate: date } };
683
+ }
684
+ return null;
685
+ }
686
+ parseCurrentValue() {
687
+ const date = this.dateAdapter.parse(this.currentValue, this.dateFormats.parse.dateInput);
688
+ return this.dateAdapter.getValidDateOrNull(date);
689
+ }
690
+ isValidFormat(value, pattern) {
691
+ const parsedDate = parse(value, pattern, new Date());
692
+ return isValid(parsedDate) && value === format(parsedDate, pattern);
693
+ }
694
+ get minDate() {
695
+ return this.trigger.minDate?.();
696
+ }
697
+ get maxDate() {
698
+ return this.trigger.maxDate?.();
699
+ }
700
+ get inputElement() {
701
+ return this.element.nativeElement;
702
+ }
703
+ get currentValue() {
704
+ return this.inputElement.value;
705
+ }
706
+ updateInputValue(value) {
707
+ let newValue = '';
708
+ if (value) {
709
+ newValue = this.dateAdapter.format(value, this.dateFormats.display.dateInput);
710
+ }
711
+ this.inputElement.value = newValue;
712
+ }
713
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerInputBase, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
714
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDatepickerInputBase, host: { listeners: { "blur": "handleBlur()", "input": "handleInput()" }, properties: { "class": "this.datepickerInputClass" } }, ngImport: i0 }); }
715
+ }
716
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerInputBase, decorators: [{
717
+ type: Directive
718
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.DateAdapter }, { type: undefined }, { type: WlcmDatepickerTrigger }], propDecorators: { handleBlur: [{
719
+ type: HostListener,
720
+ args: ['blur']
721
+ }], handleInput: [{
722
+ type: HostListener,
723
+ args: ['input']
257
724
  }], datepickerInputClass: [{
258
725
  type: HostBinding,
259
726
  args: ['class']
@@ -286,11 +753,9 @@ class WlcmDateRangePickerInputBase extends WlcmDatepickerInputBase {
286
753
  this.changeInputSize();
287
754
  }
288
755
  changeInputSize() {
289
- requestAnimationFrame(() => {
290
- const value = this.currentValue || this.inputElement.placeholder;
291
- this._inputMirror.innerHTML = value;
292
- this.inputElement.style.width = `${this._inputMirror.offsetWidth + 2}px`;
293
- });
756
+ const value = this.currentValue || this.inputElement.placeholder;
757
+ this._inputMirror.innerHTML = value;
758
+ this.inputElement.style.width = `${this._inputMirror.offsetWidth + 2}px`;
294
759
  }
295
760
  createInputMirror() {
296
761
  const inputMirror = document.createElement('div');
@@ -308,13 +773,78 @@ class WlcmDateRangePickerInputBase extends WlcmDatepickerInputBase {
308
773
  }
309
774
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerInputBase, decorators: [{
310
775
  type: Directive
311
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.DateAdapter }, { type: undefined }, { type: WlcmDatepickerTrigger }] });
776
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.DateAdapter }, { type: undefined }, { type: WlcmDatepickerTrigger }] });
312
777
 
313
778
  var WlcmDateRangeValidation;
314
779
  (function (WlcmDateRangeValidation) {
315
780
  WlcmDateRangeValidation["StartExceedsEnd"] = "wlcmDateRangeStartExceedsEnd";
316
781
  })(WlcmDateRangeValidation || (WlcmDateRangeValidation = {}));
317
782
 
783
+ let DateRangePickerInputEndDirective = class DateRangePickerInputEndDirective extends WlcmDateRangePickerInputBase {
784
+ constructor(element, dateAdapter, dateFormats, selectionModel, trigger) {
785
+ super(element, dateAdapter, dateFormats, trigger);
786
+ this.element = element;
787
+ this.dateAdapter = dateAdapter;
788
+ this.dateFormats = dateFormats;
789
+ this.selectionModel = selectionModel;
790
+ this.trigger = trigger;
791
+ this.updateSelection = () => {
792
+ let end = this.parseCurrentValue();
793
+ this.selectionModel.updateSelection(new DateRange(this.selectionModel.selection.start, end), this);
794
+ };
795
+ this.handleSelectionChange();
796
+ }
797
+ validate() {
798
+ const defaultErrors = super.validate();
799
+ if (isValid(this.selectionModel.selection.start)) {
800
+ const endDate = this.parseCurrentValue();
801
+ if (endDate && isAfter(this.selectionModel.selection.start, endDate)) {
802
+ return { [WlcmDateRangeValidation.StartExceedsEnd]: true, ...(defaultErrors ?? {}) };
803
+ }
804
+ }
805
+ return defaultErrors;
806
+ }
807
+ handleSelectionChange() {
808
+ this.selectionModel.selectionChanged.pipe(untilDestroyed(this)).subscribe(({ selection }) => {
809
+ const validDate = this.dateAdapter.getValidDateOrNull(selection.end);
810
+ this._changed?.(validDate);
811
+ this.updateInputValue(validDate);
812
+ this._validatorChanged?.();
813
+ });
814
+ }
815
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: DateRangePickerInputEndDirective, deps: [{ token: i0.ElementRef }, { token: i1.DateAdapter }, { token: MAT_DATE_FORMATS, optional: true }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WlcmDatepickerTrigger }], target: i0.ɵɵFactoryTarget.Directive }); }
816
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: DateRangePickerInputEndDirective, isStandalone: true, selector: "[wlcmDateRangePickerInputEnd]", host: { classAttribute: "wlcm-date-range-picker-input-field" }, providers: [
817
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DateRangePickerInputEndDirective), multi: true },
818
+ { provide: NG_VALIDATORS, useExisting: forwardRef(() => DateRangePickerInputEndDirective), multi: true },
819
+ ], usesInheritance: true, ngImport: i0 }); }
820
+ };
821
+ DateRangePickerInputEndDirective = __decorate([
822
+ UntilDestroy(),
823
+ __metadata("design:paramtypes", [ElementRef,
824
+ DateAdapter, Object, MatDateSelectionModel,
825
+ WlcmDatepickerTrigger])
826
+ ], DateRangePickerInputEndDirective);
827
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: DateRangePickerInputEndDirective, decorators: [{
828
+ type: Directive,
829
+ args: [{
830
+ selector: '[wlcmDateRangePickerInputEnd]',
831
+ host: { class: 'wlcm-date-range-picker-input-field' },
832
+ standalone: true,
833
+ providers: [
834
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DateRangePickerInputEndDirective), multi: true },
835
+ { provide: NG_VALIDATORS, useExisting: forwardRef(() => DateRangePickerInputEndDirective), multi: true },
836
+ ],
837
+ }]
838
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.DateAdapter }, { type: undefined, decorators: [{
839
+ type: Optional
840
+ }, {
841
+ type: Inject,
842
+ args: [MAT_DATE_FORMATS]
843
+ }] }, { type: i2$1.MatDateSelectionModel, decorators: [{
844
+ type: Inject,
845
+ args: [WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL]
846
+ }] }, { type: WlcmDatepickerTrigger }] });
847
+
318
848
  let DateRangePickerInputStartDirective = class DateRangePickerInputStartDirective extends WlcmDateRangePickerInputBase {
319
849
  constructor(element, dateAdapter, dateFormats, selectionModel, trigger) {
320
850
  super(element, dateAdapter, dateFormats, trigger);
@@ -347,7 +877,7 @@ let DateRangePickerInputStartDirective = class DateRangePickerInputStartDirectiv
347
877
  this._validatorChanged?.();
348
878
  });
349
879
  }
350
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: DateRangePickerInputStartDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.DateAdapter }, { token: MAT_DATE_FORMATS, optional: true }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WlcmDatepickerTrigger }], target: i0.ɵɵFactoryTarget.Directive }); }
880
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: DateRangePickerInputStartDirective, deps: [{ token: i0.ElementRef }, { token: i1.DateAdapter }, { token: MAT_DATE_FORMATS, optional: true }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WlcmDatepickerTrigger }], target: i0.ɵɵFactoryTarget.Directive }); }
351
881
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: DateRangePickerInputStartDirective, isStandalone: true, selector: "[wlcmDateRangePickerInputStart]", host: { classAttribute: "wlcm-date-range-picker-input-field" }, providers: [
352
882
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DateRangePickerInputStartDirective), multi: true },
353
883
  { provide: NG_VALIDATORS, useExisting: forwardRef(() => DateRangePickerInputStartDirective), multi: true },
@@ -370,278 +900,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
370
900
  { provide: NG_VALIDATORS, useExisting: forwardRef(() => DateRangePickerInputStartDirective), multi: true },
371
901
  ],
372
902
  }]
373
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.DateAdapter }, { type: undefined, decorators: [{
903
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.DateAdapter }, { type: undefined, decorators: [{
374
904
  type: Optional
375
905
  }, {
376
906
  type: Inject,
377
907
  args: [MAT_DATE_FORMATS]
378
- }] }, { type: i2.MatDateSelectionModel, decorators: [{
908
+ }] }, { type: i2$1.MatDateSelectionModel, decorators: [{
379
909
  type: Inject,
380
910
  args: [WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL]
381
911
  }] }, { type: WlcmDatepickerTrigger }] });
382
912
 
383
- const WLCM_DATE_RANGE_SELECTION_MODEL = new InjectionToken('WLCM_DATE_RANGE_SELECTION_MODEL');
384
- const WLCM_DATE_RANGE_SELECTION_MODEL_PROVIDER = {
385
- provide: WLCM_DATE_RANGE_SELECTION_MODEL,
386
- useFactory: (adapter) => new MatRangeDateSelectionModel(adapter),
387
- deps: [DateAdapter],
388
- };
389
-
390
- class WlcmDateRangePicker {
391
- constructor(localSelectionModel, rangeSelectionStrategy) {
392
- this.localSelectionModel = localSelectionModel;
393
- this.rangeSelectionStrategy = rangeSelectionStrategy;
394
- this._isComplete = signal(false);
395
- this.isComplete = computed(() => this._isComplete());
396
- this.handleSelectionChanged();
397
- }
398
- calendarSelection(event) {
399
- const newSelection = this.rangeSelectionStrategy.selectionFinished(event.value, this.localSelectionModel.selection, event.event);
400
- this.localSelectionModel.updateSelection(newSelection, this);
401
- }
402
- calendarDragDrop(event) {
403
- this.localSelectionModel.updateSelection(event.value, this);
913
+ class DateRangePickerErrors {
914
+ static throwNoStartInputError() {
915
+ throw new Error('The input element with the wlcmDateRangePickerInputStart directive is missing');
404
916
  }
405
- get selected() {
406
- return this.localSelectionModel.selection;
407
- }
408
- handleSelectionChanged() {
409
- this.localSelectionModel.selectionChanged
410
- .pipe(untilDestroyed(this))
411
- .subscribe(() => this._isComplete.set(this.localSelectionModel.isComplete()));
412
- }
413
- }
414
-
415
- class WlcmDateRangePickerBottomPanelComponent {
416
- constructor(picker) {
417
- this.picker = picker;
418
- }
419
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerBottomPanelComponent, deps: [{ token: WlcmDateRangePicker }], target: i0.ɵɵFactoryTarget.Component }); }
420
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDateRangePickerBottomPanelComponent, isStandalone: true, selector: "wlcm-date-range-picker-bottom-panel", ngImport: i0, template: "<div class=\"wlcm-date-range-picker-bottom-panel\">\n <wlcm-button type=\"paddingless\" (clicked)=\"picker.reset()\">Reset</wlcm-button>\n\n <wlcm-button (clicked)=\"picker.apply()\" [isDisabled]=\"!picker.isComplete()\">\n Apply\n </wlcm-button>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: WlcmButtonModule }, { kind: "component", type: i2$1.WlcmButtonComponent, selector: "wlcm-button", inputs: ["type", "size", "isDisabled", "isLoading"], outputs: ["clicked"] }] }); }
421
- }
422
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerBottomPanelComponent, decorators: [{
423
- type: Component,
424
- args: [{ selector: 'wlcm-date-range-picker-bottom-panel', standalone: true, imports: [CommonModule, WlcmButtonModule], template: "<div class=\"wlcm-date-range-picker-bottom-panel\">\n <wlcm-button type=\"paddingless\" (clicked)=\"picker.reset()\">Reset</wlcm-button>\n\n <wlcm-button (clicked)=\"picker.apply()\" [isDisabled]=\"!picker.isComplete()\">\n Apply\n </wlcm-button>\n</div>\n" }]
425
- }], ctorParameters: () => [{ type: WlcmDateRangePicker }] });
426
-
427
- const WLCM_DATE_RANGE_PICKER_CONFIG = new InjectionToken('WLCM_DATE_RANGE_PICKER_CONFIG', { providedIn: 'root', factory: () => ({}) });
428
- const WLCM_DATE_RANGE_PICKER_BP = new InjectionToken('WLCM_DATE_RANGE_PICKER_BP', { providedIn: 'root', factory: () => WlcmDateRangePickerBottomPanelComponent });
429
-
430
- class WlcmCalendarHeaderComponent {
431
- constructor(dateAdapter, dateFormats, calendar) {
432
- this.dateAdapter = dateAdapter;
433
- this.dateFormats = dateFormats;
434
- this.calendar = calendar;
435
- this.WlcmIconName = WlcmIconName;
436
- this.next = input();
437
- this.previous = input();
438
- this.disableLeftArrow = input(false);
439
- this.disableRightArrow = input(false);
440
- this.displayLeftArrow = input(true);
441
- this.displayRightArrow = input(true);
442
- }
443
- previousClicked() {
444
- if (this.previous())
445
- return this.previous()();
446
- this.calendar.activeDate =
447
- this.calendar.currentView == 'month'
448
- ? this.dateAdapter.addCalendarMonths(this.calendar.activeDate, -1)
449
- : this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? -1 : -yearsPerPage);
450
- }
451
- nextClicked() {
452
- if (this.next())
453
- return this.next()();
454
- this.calendar.activeDate =
455
- this.calendar.currentView == 'month'
456
- ? this.dateAdapter.addCalendarMonths(this.calendar.activeDate, 1)
457
- : this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? 1 : yearsPerPage);
458
- }
459
- changeCalendarView() {
460
- if (this.calendar.currentView === 'multi-year') {
461
- this.calendar.currentView = 'month';
462
- return;
463
- }
464
- this.calendar.currentView = 'multi-year';
465
- }
466
- get periodLabel() {
467
- return this.dateAdapter.format(this.calendar.activeDate, this.dateFormats.display.monthYearLabel);
468
- }
469
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmCalendarHeaderComponent, deps: [{ token: i1$1.DateAdapter }, { token: MAT_DATE_FORMATS, optional: true }, { token: forwardRef(() => MatCalendar) }], target: i0.ɵɵFactoryTarget.Component }); }
470
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.6", type: WlcmCalendarHeaderComponent, isStandalone: true, selector: "wlcm-calendar-header", inputs: { next: { classPropertyName: "next", publicName: "next", isSignal: true, isRequired: false, transformFunction: null }, previous: { classPropertyName: "previous", publicName: "previous", isSignal: true, isRequired: false, transformFunction: null }, disableLeftArrow: { classPropertyName: "disableLeftArrow", publicName: "disableLeftArrow", isSignal: true, isRequired: false, transformFunction: null }, disableRightArrow: { classPropertyName: "disableRightArrow", publicName: "disableRightArrow", isSignal: true, isRequired: false, transformFunction: null }, displayLeftArrow: { classPropertyName: "displayLeftArrow", publicName: "displayLeftArrow", isSignal: true, isRequired: false, transformFunction: null }, displayRightArrow: { classPropertyName: "displayRightArrow", publicName: "displayRightArrow", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "wlcm-calendar-header" }, ngImport: i0, template: "<div class=\"wlcm-calendar-header-button-container\">\n @if (displayLeftArrow()) {\n <button\n class=\"wlcm-calendar-header-button wlcm-calendar-header-button-left\"\n [disabled]=\"disableLeftArrow()\"\n (click)=\"previousClicked()\"\n >\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n </button>\n }\n</div>\n\n<button\n class=\"wlcm-calendar-header-change-view-button\"\n (click)=\"changeCalendarView()\"\n>\n <div class=\"wlcm-calendar-header-period-label\">\n {{ periodLabel }}\n </div>\n\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n</button>\n\n<div class=\"wlcm-calendar-header-button-container\">\n @if (displayRightArrow()) {\n <button\n class=\"wlcm-calendar-header-button wlcm-calendar-header-button-right\"\n [disabled]=\"disableRightArrow()\"\n (click)=\"nextClicked()\"\n >\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n </button>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: WlcmIconDirective, selector: "[wlcmIcon]", inputs: ["wlcmIcon", "wlcmIconStopPropagation"], outputs: ["wlcmIconClicked"] }] }); }
471
- }
472
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmCalendarHeaderComponent, decorators: [{
473
- type: Component,
474
- args: [{ selector: 'wlcm-calendar-header', host: { class: 'wlcm-calendar-header' }, standalone: true, imports: [CommonModule, WlcmIconDirective], template: "<div class=\"wlcm-calendar-header-button-container\">\n @if (displayLeftArrow()) {\n <button\n class=\"wlcm-calendar-header-button wlcm-calendar-header-button-left\"\n [disabled]=\"disableLeftArrow()\"\n (click)=\"previousClicked()\"\n >\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n </button>\n }\n</div>\n\n<button\n class=\"wlcm-calendar-header-change-view-button\"\n (click)=\"changeCalendarView()\"\n>\n <div class=\"wlcm-calendar-header-period-label\">\n {{ periodLabel }}\n </div>\n\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n</button>\n\n<div class=\"wlcm-calendar-header-button-container\">\n @if (displayRightArrow()) {\n <button\n class=\"wlcm-calendar-header-button wlcm-calendar-header-button-right\"\n [disabled]=\"disableRightArrow()\"\n (click)=\"nextClicked()\"\n >\n <ng-container [wlcmIcon]=\"WlcmIconName.CHEVRON_DOWN\"></ng-container>\n </button>\n }\n</div>\n" }]
475
- }], ctorParameters: () => [{ type: i1$1.DateAdapter }, { type: undefined, decorators: [{
476
- type: Optional
477
- }, {
478
- type: Inject,
479
- args: [MAT_DATE_FORMATS]
480
- }] }, { type: i2.MatCalendar, decorators: [{
481
- type: Inject,
482
- args: [forwardRef(() => MatCalendar)]
483
- }] }] });
484
-
485
- class WlcmCalendarDirective {
486
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmCalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
487
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmCalendarDirective, isStandalone: true, selector: "[wlcmCalendar]", host: { classAttribute: "wlcm-calendar" }, ngImport: i0 }); }
488
- }
489
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmCalendarDirective, decorators: [{
490
- type: Directive,
491
- args: [{
492
- selector: '[wlcmCalendar]',
493
- host: { class: 'wlcm-calendar' },
494
- standalone: true,
495
- }]
496
- }] });
497
-
498
- let SingleCalendarRangePickerComponent = class SingleCalendarRangePickerComponent extends WlcmDateRangePicker {
499
- constructor(rangeSelectionStrategy, localSelectionModel, triggerSelectionModel, trigger, datepickerConfig, pickerBottomPanel, dateAdapter) {
500
- super(localSelectionModel, rangeSelectionStrategy);
501
- this.rangeSelectionStrategy = rangeSelectionStrategy;
502
- this.localSelectionModel = localSelectionModel;
503
- this.triggerSelectionModel = triggerSelectionModel;
504
- this.trigger = trigger;
505
- this.datepickerConfig = datepickerConfig;
506
- this.pickerBottomPanel = pickerBottomPanel;
507
- this.dateAdapter = dateAdapter;
508
- this.headerComponent = WlcmCalendarHeaderComponent;
509
- this.localSelectionModel.updateSelection(this.triggerSelectionModel.selection, this);
510
- }
511
- ngAfterViewInit() {
512
- this.bottomPanelContainer.createComponent(this.pickerBottomPanel);
513
- }
514
- get minDate() {
515
- return this.datepickerConfig.minDate?.();
516
- }
517
- get maxDate() {
518
- return this.datepickerConfig.maxDate?.();
519
- }
520
- apply() {
521
- this.triggerSelectionModel.updateSelection(this.localSelectionModel.selection, this);
522
- this.trigger.close();
523
- }
524
- reset() {
525
- this.trigger.close();
526
- }
527
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: SingleCalendarRangePickerComponent, deps: [{ token: MAT_DATE_RANGE_SELECTION_STRATEGY }, { token: WLCM_DATE_RANGE_SELECTION_MODEL }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WlcmDatepickerTrigger }, { token: WLCM_DATEPICKER_CONFIG }, { token: WLCM_DATE_RANGE_PICKER_BP }, { token: i1$1.DateAdapter }], target: i0.ɵɵFactoryTarget.Component }); }
528
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: SingleCalendarRangePickerComponent, isStandalone: true, selector: "wlcm-single-calendar-range-picker", providers: [
529
- {
530
- provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
531
- useClass: DefaultMatCalendarRangeStrategy,
532
- },
533
- { provide: WlcmDateRangePicker, useExisting: forwardRef(() => SingleCalendarRangePickerComponent) },
534
- WLCM_DATE_RANGE_SELECTION_MODEL_PROVIDER,
535
- ], viewQueries: [{ propertyName: "bottomPanelContainer", first: true, predicate: ["bottomPanelContainer"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: "<div class=\"wlcm-date-range-picker-panel\">\n <div class=\"signal-calendar-range-picker-body\">\n <mat-calendar\n wlcmCalendar\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [selected]=\"selected\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n ></mat-calendar>\n </div>\n\n <ng-container #bottomPanelContainer></ng-container>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2.MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "directive", type: WlcmCalendarDirective, selector: "[wlcmCalendar]" }] }); }
536
- };
537
- SingleCalendarRangePickerComponent = __decorate([
538
- UntilDestroy(),
539
- __metadata("design:paramtypes", [Object, MatDateSelectionModel,
540
- MatDateSelectionModel,
541
- WlcmDatepickerTrigger, Object, Type,
542
- DateAdapter])
543
- ], SingleCalendarRangePickerComponent);
544
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: SingleCalendarRangePickerComponent, decorators: [{
545
- type: Component,
546
- args: [{ selector: 'wlcm-single-calendar-range-picker', imports: [CommonModule, MatDatepickerModule, WlcmCalendarDirective], standalone: true, providers: [
547
- {
548
- provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
549
- useClass: DefaultMatCalendarRangeStrategy,
550
- },
551
- { provide: WlcmDateRangePicker, useExisting: forwardRef(() => SingleCalendarRangePickerComponent) },
552
- WLCM_DATE_RANGE_SELECTION_MODEL_PROVIDER,
553
- ], template: "<div class=\"wlcm-date-range-picker-panel\">\n <div class=\"signal-calendar-range-picker-body\">\n <mat-calendar\n wlcmCalendar\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [selected]=\"selected\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n ></mat-calendar>\n </div>\n\n <ng-container #bottomPanelContainer></ng-container>\n</div>\n" }]
554
- }], ctorParameters: () => [{ type: undefined, decorators: [{
555
- type: Inject,
556
- args: [MAT_DATE_RANGE_SELECTION_STRATEGY]
557
- }] }, { type: i2.MatDateSelectionModel, decorators: [{
558
- type: Inject,
559
- args: [WLCM_DATE_RANGE_SELECTION_MODEL]
560
- }] }, { type: i2.MatDateSelectionModel, decorators: [{
561
- type: Inject,
562
- args: [WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL]
563
- }] }, { type: WlcmDatepickerTrigger }, { type: undefined, decorators: [{
564
- type: Inject,
565
- args: [WLCM_DATEPICKER_CONFIG]
566
- }] }, { type: i0.Type, decorators: [{
567
- type: Inject,
568
- args: [WLCM_DATE_RANGE_PICKER_BP]
569
- }] }, { type: i1$1.DateAdapter }], propDecorators: { bottomPanelContainer: [{
570
- type: ViewChild,
571
- args: ['bottomPanelContainer', { read: ViewContainerRef }]
572
- }] } });
573
-
574
- let DateRangePickerInputEndDirective = class DateRangePickerInputEndDirective extends WlcmDateRangePickerInputBase {
575
- constructor(element, dateAdapter, dateFormats, selectionModel, trigger) {
576
- super(element, dateAdapter, dateFormats, trigger);
577
- this.element = element;
578
- this.dateAdapter = dateAdapter;
579
- this.dateFormats = dateFormats;
580
- this.selectionModel = selectionModel;
581
- this.trigger = trigger;
582
- this.updateSelection = () => {
583
- let end = this.parseCurrentValue();
584
- this.selectionModel.updateSelection(new DateRange(this.selectionModel.selection.start, end), this);
585
- };
586
- this.handleSelectionChange();
587
- }
588
- validate() {
589
- const defaultErrors = super.validate();
590
- if (isValid(this.selectionModel.selection.start)) {
591
- const endDate = this.parseCurrentValue();
592
- if (endDate && isAfter(this.selectionModel.selection.start, endDate)) {
593
- return { [WlcmDateRangeValidation.StartExceedsEnd]: true, ...(defaultErrors ?? {}) };
594
- }
595
- }
596
- return defaultErrors;
597
- }
598
- handleSelectionChange() {
599
- this.selectionModel.selectionChanged.pipe(untilDestroyed(this)).subscribe(({ selection }) => {
600
- const validDate = this.dateAdapter.getValidDateOrNull(selection.end);
601
- this._changed?.(validDate);
602
- this.updateInputValue(validDate);
603
- this._validatorChanged?.();
604
- });
605
- }
606
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: DateRangePickerInputEndDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.DateAdapter }, { token: MAT_DATE_FORMATS, optional: true }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WlcmDatepickerTrigger }], target: i0.ɵɵFactoryTarget.Directive }); }
607
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: DateRangePickerInputEndDirective, isStandalone: true, selector: "[wlcmDateRangePickerInputEnd]", host: { classAttribute: "wlcm-date-range-picker-input-field" }, providers: [
608
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DateRangePickerInputEndDirective), multi: true },
609
- { provide: NG_VALIDATORS, useExisting: forwardRef(() => DateRangePickerInputEndDirective), multi: true },
610
- ], usesInheritance: true, ngImport: i0 }); }
611
- };
612
- DateRangePickerInputEndDirective = __decorate([
613
- UntilDestroy(),
614
- __metadata("design:paramtypes", [ElementRef,
615
- DateAdapter, Object, MatDateSelectionModel,
616
- WlcmDatepickerTrigger])
617
- ], DateRangePickerInputEndDirective);
618
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: DateRangePickerInputEndDirective, decorators: [{
619
- type: Directive,
620
- args: [{
621
- selector: '[wlcmDateRangePickerInputEnd]',
622
- host: { class: 'wlcm-date-range-picker-input-field' },
623
- standalone: true,
624
- providers: [
625
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DateRangePickerInputEndDirective), multi: true },
626
- { provide: NG_VALIDATORS, useExisting: forwardRef(() => DateRangePickerInputEndDirective), multi: true },
627
- ],
628
- }]
629
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.DateAdapter }, { type: undefined, decorators: [{
630
- type: Optional
631
- }, {
632
- type: Inject,
633
- args: [MAT_DATE_FORMATS]
634
- }] }, { type: i2.MatDateSelectionModel, decorators: [{
635
- type: Inject,
636
- args: [WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL]
637
- }] }, { type: WlcmDatepickerTrigger }] });
638
-
639
- class DateRangePickerErrors {
640
- static throwNoStartInputError() {
641
- throw new Error('The input element with the wlcmDateRangePickerInputStart directive is missing');
642
- }
643
- static throwNoEndInputError() {
644
- throw new Error('The input element with the wlcmDateRangePickerInputEnd directive is missing');
917
+ static throwNoEndInputError() {
918
+ throw new Error('The input element with the wlcmDateRangePickerInputEnd directive is missing');
645
919
  }
646
920
  }
647
921
 
@@ -657,7 +931,7 @@ class WlcmDateRangePickerInputComponent extends WlcmDatepickerTrigger {
657
931
  this._blurStream$ = new BehaviorSubject(EMPTY);
658
932
  this.focus$ = this._focusStream$.pipe(switchMap((stream) => stream));
659
933
  this.blur$ = this._blurStream$.pipe(switchMap((stream) => stream));
660
- this.componentType = SingleCalendarRangePickerComponent;
934
+ this.componentType = WlcmDateRangePickerComponent;
661
935
  }
662
936
  ngAfterContentInit() {
663
937
  this.checkInputs();
@@ -703,8 +977,8 @@ class WlcmDateRangePickerInputComponent extends WlcmDatepickerTrigger {
703
977
  this._focusStream$.next(merge(...focusObservables).pipe(map(voidFn)));
704
978
  this._blurStream$.next(merge(...blurObservables).pipe(map(() => this.control?.markAsTouched())));
705
979
  }
706
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerInputComponent, deps: [{ token: i1.Overlay }, { token: i0.ViewContainerRef }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WLCM_FORM_FIELD, host: true }, { token: ControlContainer, host: true }], target: i0.ɵɵFactoryTarget.Component }); }
707
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDateRangePickerInputComponent, isStandalone: true, selector: "wlcm-date-range-picker-input", inputs: { componentType: "componentType" }, host: { classAttribute: "wlcm-date-range-picker-input" }, providers: [
980
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangePickerInputComponent, deps: [{ token: i1$1.Overlay }, { token: i0.ViewContainerRef }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WLCM_FORM_FIELD, host: true }, { token: ControlContainer, host: true }], target: i0.ɵɵFactoryTarget.Component }); }
981
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDateRangePickerInputComponent, isStandalone: true, selector: "wlcm-date-range-picker-input", host: { classAttribute: "wlcm-date-range-picker-input" }, providers: [
708
982
  WLCM_FORM_CONTROL_PROVIDER,
709
983
  WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL_PROVIDER,
710
984
  {
@@ -731,7 +1005,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
731
1005
  },
732
1006
  { provide: WlcmDatepickerTrigger, useExisting: forwardRef(() => WlcmDateRangePickerInputComponent) },
733
1007
  ], template: "<div class=\"wlcm-date-range-picker-inputs-container\">\n <div class=\"wlcm-date-range-picker-input-field-wrapper\">\n <ng-content select=\"[wlcmDateRangePickerInputStart]\"></ng-content>\n </div>\n\n <div class=\"wlcm-date-range-picker-input-dash\"></div>\n\n <div class=\"wlcm-date-range-picker-input-field-wrapper\">\n <ng-content select=\"[wlcmDateRangePickerInputEnd]\"></ng-content>\n </div>\n</div>\n", styles: [".wlcm-date-range-picker-inputs-container{display:flex;align-items:center}\n"] }]
734
- }], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.ViewContainerRef }, { type: i2.MatDateSelectionModel, decorators: [{
1008
+ }], ctorParameters: () => [{ type: i1$1.Overlay }, { type: i0.ViewContainerRef }, { type: i2$1.MatDateSelectionModel, decorators: [{
735
1009
  type: Inject,
736
1010
  args: [WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL]
737
1011
  }] }, { type: undefined, decorators: [{
@@ -744,9 +1018,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
744
1018
  }, {
745
1019
  type: Inject,
746
1020
  args: [ControlContainer]
747
- }] }], propDecorators: { componentType: [{
748
- type: Input
749
- }], startInput: [{
1021
+ }] }], propDecorators: { startInput: [{
750
1022
  type: ContentChild,
751
1023
  args: [DateRangePickerInputStartDirective]
752
1024
  }], endInput: [{
@@ -754,374 +1026,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
754
1026
  args: [DateRangePickerInputEndDirective]
755
1027
  }] } });
756
1028
 
757
- class WlcmDataRangeCalendar {
758
- constructor(location, element, calendar, dateAdapter, datepickerConfig) {
759
- this.element = element;
760
- this.calendar = calendar;
761
- this.dateAdapter = dateAdapter;
762
- this.datepickerConfig = datepickerConfig;
763
- this.dateChange = output();
764
- this.viewChange = output();
765
- this.disabled = input(false);
766
- this.location = location;
767
- effect(() => {
768
- if (this.disabled()) {
769
- this.element.nativeElement.classList.add('wlcm-calendar-disabled');
770
- }
771
- else {
772
- this.element.nativeElement.classList.remove('wlcm-calendar-disabled');
773
- }
774
- });
775
- this.handleConfigValues();
776
- }
777
- get minDate() {
778
- return this.datepickerConfig.minDate?.();
779
- }
780
- get maxDate() {
781
- return this.datepickerConfig.maxDate?.();
782
- }
783
- prevMonth() {
784
- this.dateChange.emit(this.dateAdapter.addCalendarMonths(this.calendar.activeDate, -1));
785
- }
786
- nextMonth() {
787
- this.dateChange.emit(this.dateAdapter.addCalendarMonths(this.calendar.activeDate, 1));
788
- }
789
- prevYear() {
790
- this.dateChange.emit(this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? -1 : -yearsPerPage));
791
- }
792
- nextYear() {
793
- this.dateChange.emit(this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? 1 : yearsPerPage));
794
- }
795
- handleConfigValues() {
796
- this.calendar.dateFilter = (date) => {
797
- if (this.minDate && isBefore(startOfDay(date), startOfDay(this.minDate)))
798
- return false;
799
- if (this.maxDate && isAfter(startOfDay(date), startOfDay(this.maxDate)))
800
- return false;
801
- return true;
802
- };
803
- }
804
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDataRangeCalendar, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
805
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.6", type: WlcmDataRangeCalendar, inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange", viewChange: "viewChange" }, ngImport: i0 }); }
806
- }
807
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDataRangeCalendar, decorators: [{
808
- type: Directive
809
- }], ctorParameters: () => [{ type: undefined }, { type: i0.ElementRef }, { type: i2.MatCalendar }, { type: i1$1.DateAdapter }, { type: undefined }] });
810
-
811
- let WlcmLeftCalendarDirective = class WlcmLeftCalendarDirective extends WlcmDataRangeCalendar {
812
- constructor(element, dateAdapter, calendar, datepickerConfig) {
813
- super('left', element, calendar, dateAdapter, datepickerConfig);
814
- this.element = element;
815
- this.dateAdapter = dateAdapter;
816
- this.calendar = calendar;
817
- this.datepickerConfig = datepickerConfig;
818
- this.handleYearChange();
819
- this.handleMonthChange();
820
- }
821
- handleYearChange() {
822
- this.calendar.yearSelected.pipe(untilDestroyed(this)).subscribe((date) => this.dateChange.emit(date));
823
- }
824
- handleMonthChange() {
825
- this.calendar.monthSelected.pipe(untilDestroyed(this)).subscribe((date) => this.dateChange.emit(date));
826
- }
827
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmLeftCalendarDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.DateAdapter }, { token: forwardRef(() => MatCalendar) }, { token: WLCM_DATEPICKER_CONFIG }], target: i0.ɵɵFactoryTarget.Directive }); }
828
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmLeftCalendarDirective, isStandalone: true, selector: "[wlcmLeftCalendar]", providers: [{ provide: WlcmDataRangeCalendar, useExisting: forwardRef(() => WlcmLeftCalendarDirective) }], usesInheritance: true, ngImport: i0 }); }
829
- };
830
- WlcmLeftCalendarDirective = __decorate([
831
- UntilDestroy(),
832
- __metadata("design:paramtypes", [ElementRef,
833
- DateAdapter,
834
- MatCalendar, Object])
835
- ], WlcmLeftCalendarDirective);
836
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmLeftCalendarDirective, decorators: [{
837
- type: Directive,
838
- args: [{
839
- selector: '[wlcmLeftCalendar]',
840
- standalone: true,
841
- providers: [{ provide: WlcmDataRangeCalendar, useExisting: forwardRef(() => WlcmLeftCalendarDirective) }],
842
- }]
843
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.DateAdapter }, { type: i2.MatCalendar, decorators: [{
844
- type: Inject,
845
- args: [forwardRef(() => MatCalendar)]
846
- }] }, { type: undefined, decorators: [{
847
- type: Inject,
848
- args: [WLCM_DATEPICKER_CONFIG]
849
- }] }] });
850
-
851
- let WlcmRightCalendarDirective = class WlcmRightCalendarDirective extends WlcmDataRangeCalendar {
852
- constructor(element, dateAdapter, calendar, datepickerConfig) {
853
- super('right', element, calendar, dateAdapter, datepickerConfig);
854
- this.element = element;
855
- this.dateAdapter = dateAdapter;
856
- this.calendar = calendar;
857
- this.datepickerConfig = datepickerConfig;
858
- this.handleYearChange();
859
- this.handleMonthChange();
860
- }
861
- handleYearChange() {
862
- this.calendar.yearSelected
863
- .pipe(untilDestroyed(this))
864
- .subscribe((date) => this.dateChange.emit(this.dateAdapter.addCalendarMonths(date, -1)));
865
- }
866
- handleMonthChange() {
867
- this.calendar.monthSelected
868
- .pipe(untilDestroyed(this))
869
- .subscribe((date) => this.dateChange.emit(this.dateAdapter.addCalendarMonths(date, -1)));
870
- }
871
- nextMonth() {
872
- this.dateChange.emit(this.calendar.activeDate);
873
- }
874
- prevYear() {
875
- this.dateChange.emit(this.dateAdapter.addCalendarMonths(this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? -1 : -yearsPerPage), -1));
876
- }
877
- nextYear() {
878
- this.dateChange.emit(this.dateAdapter.addCalendarMonths(this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView == 'year' ? 1 : yearsPerPage), -1));
879
- }
880
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmRightCalendarDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.DateAdapter }, { token: forwardRef(() => MatCalendar) }, { token: WLCM_DATEPICKER_CONFIG }], target: i0.ɵɵFactoryTarget.Directive }); }
881
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmRightCalendarDirective, isStandalone: true, selector: "[wlcmRightCalendar]", providers: [{ provide: WlcmDataRangeCalendar, useExisting: forwardRef(() => WlcmRightCalendarDirective) }], usesInheritance: true, ngImport: i0 }); }
882
- };
883
- WlcmRightCalendarDirective = __decorate([
884
- UntilDestroy(),
885
- __metadata("design:paramtypes", [ElementRef,
886
- DateAdapter,
887
- MatCalendar, Object])
888
- ], WlcmRightCalendarDirective);
889
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmRightCalendarDirective, decorators: [{
890
- type: Directive,
891
- args: [{
892
- selector: '[wlcmRightCalendar]',
893
- standalone: true,
894
- providers: [{ provide: WlcmDataRangeCalendar, useExisting: forwardRef(() => WlcmRightCalendarDirective) }],
895
- }]
896
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.DateAdapter }, { type: i2.MatCalendar, decorators: [{
897
- type: Inject,
898
- args: [forwardRef(() => MatCalendar)]
899
- }] }, { type: undefined, decorators: [{
900
- type: Inject,
901
- args: [WLCM_DATEPICKER_CONFIG]
902
- }] }] });
903
-
904
- class WlcmDateRangeCalendarHeaderComponent {
905
- constructor(rangeCalendar, dateFormats, calendar, datepickerConfig) {
906
- this.rangeCalendar = rangeCalendar;
907
- this.dateFormats = dateFormats;
908
- this.calendar = calendar;
909
- this.datepickerConfig = datepickerConfig;
910
- this.WlcmIconName = WlcmIconName;
911
- this.previous = () => {
912
- if (this.isPreviousDisabled)
913
- return;
914
- if (this.calendar.currentView !== 'month') {
915
- return this.rangeCalendar.prevYear();
916
- }
917
- return this.rangeCalendar.prevMonth();
918
- };
919
- this.next = () => {
920
- if (this.isNextDisabled)
921
- return;
922
- if (this.calendar.currentView !== 'month') {
923
- return this.rangeCalendar.nextYear();
924
- }
925
- return this.rangeCalendar.nextMonth();
926
- };
927
- }
928
- get minDate() {
929
- return this.datepickerConfig.minDate?.();
930
- }
931
- get maxDate() {
932
- return this.datepickerConfig.maxDate?.();
933
- }
934
- get isPreviousDisabled() {
935
- if (!this.minDate)
936
- return false;
937
- let previousPeriod = endOfMonth(add(this.calendar.activeDate, { months: -1 }));
938
- if (this.calendar.currentView !== 'month') {
939
- previousPeriod = add(this.calendar.activeDate, { years: -1 });
940
- }
941
- return isBefore(previousPeriod, this.minDate);
942
- }
943
- get isNextDisabled() {
944
- if (!this.maxDate)
945
- return false;
946
- let nextPeriod = startOfMonth(add(this.calendar.activeDate, { months: 1 }));
947
- if (this.calendar.currentView !== 'month') {
948
- nextPeriod = add(this.calendar.activeDate, { years: 1 });
949
- }
950
- return isBefore(this.maxDate, nextPeriod);
951
- }
952
- get canDisplayLeftArrow() {
953
- return !this.rangeCalendar || this.rangeCalendar.location === 'left' || this.calendar.currentView !== 'month';
954
- }
955
- get canDisplayRightArrow() {
956
- return !this.rangeCalendar || this.rangeCalendar.location === 'right' || this.calendar.currentView !== 'month';
957
- }
958
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangeCalendarHeaderComponent, deps: [{ token: WlcmDataRangeCalendar, optional: true }, { token: MAT_DATE_FORMATS, optional: true }, { token: forwardRef(() => MatCalendar) }, { token: WLCM_DATEPICKER_CONFIG }], target: i0.ɵɵFactoryTarget.Component }); }
959
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDateRangeCalendarHeaderComponent, isStandalone: true, selector: "wlcm-date-range-calendar-header", ngImport: i0, template: "<wlcm-calendar-header\n [next]=\"next\"\n [previous]=\"previous\"\n [disableLeftArrow]=\"isPreviousDisabled\"\n [disableRightArrow]=\"isNextDisabled\"\n [displayLeftArrow]=\"canDisplayLeftArrow && !rangeCalendar.disabled()\"\n [displayRightArrow]=\"canDisplayRightArrow && !rangeCalendar.disabled()\"\n></wlcm-calendar-header>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: WlcmCalendarHeaderComponent, selector: "wlcm-calendar-header", inputs: ["next", "previous", "disableLeftArrow", "disableRightArrow", "displayLeftArrow", "displayRightArrow"] }] }); }
960
- }
961
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDateRangeCalendarHeaderComponent, decorators: [{
962
- type: Component,
963
- args: [{ selector: 'wlcm-date-range-calendar-header', standalone: true, imports: [CommonModule, WlcmCalendarHeaderComponent, WlcmIconDirective], template: "<wlcm-calendar-header\n [next]=\"next\"\n [previous]=\"previous\"\n [disableLeftArrow]=\"isPreviousDisabled\"\n [disableRightArrow]=\"isNextDisabled\"\n [displayLeftArrow]=\"canDisplayLeftArrow && !rangeCalendar.disabled()\"\n [displayRightArrow]=\"canDisplayRightArrow && !rangeCalendar.disabled()\"\n></wlcm-calendar-header>\n" }]
964
- }], ctorParameters: () => [{ type: WlcmDataRangeCalendar, decorators: [{
965
- type: Optional
966
- }] }, { type: undefined, decorators: [{
967
- type: Optional
968
- }, {
969
- type: Inject,
970
- args: [MAT_DATE_FORMATS]
971
- }] }, { type: i2.MatCalendar, decorators: [{
972
- type: Inject,
973
- args: [forwardRef(() => MatCalendar)]
974
- }] }, { type: undefined, decorators: [{
975
- type: Inject,
976
- args: [WLCM_DATEPICKER_CONFIG]
977
- }] }] });
978
-
979
- let DoubleCalendarRangePickerComponent = class DoubleCalendarRangePickerComponent extends WlcmDateRangePicker {
980
- constructor(rangeConfig, rangeSelectionStrategy, localSelectionModel, triggerSelectionModel, trigger, datepickerConfig, pickerBottomPanel, dateAdapter) {
981
- super(localSelectionModel, rangeSelectionStrategy);
982
- this.rangeConfig = rangeConfig;
983
- this.rangeSelectionStrategy = rangeSelectionStrategy;
984
- this.localSelectionModel = localSelectionModel;
985
- this.triggerSelectionModel = triggerSelectionModel;
986
- this.trigger = trigger;
987
- this.datepickerConfig = datepickerConfig;
988
- this.pickerBottomPanel = pickerBottomPanel;
989
- this.dateAdapter = dateAdapter;
990
- this.headerComponent = WlcmDateRangeCalendarHeaderComponent;
991
- this._isViewInitialized = signal(false);
992
- this.startDate = signal(new Date());
993
- this.leftCalendarYearViewActivated = signal(false);
994
- this.rightCalendarYearViewActivated = signal(false);
995
- this.localSelectionModel.updateSelection(this.triggerSelectionModel.selection, this);
996
- if (this.triggerSelectionModel.selection.start) {
997
- this.startDate.set(this.triggerSelectionModel.selection.start);
998
- }
999
- if (this.rangeConfig.headerComponent) {
1000
- this.headerComponent = this.rangeConfig.headerComponent;
1001
- }
1002
- effect(() => {
1003
- if (!this._isViewInitialized())
1004
- return;
1005
- const startDate = this.startDate();
1006
- this.leftCalendar.activeDate = startDate;
1007
- this.rightCalendar.activeDate = this.dateAdapter.addCalendarMonths(startDate, 1);
1008
- this.rightCalendar.startAt = this.rightCalendar.activeDate;
1009
- });
1010
- }
1011
- ngAfterViewInit() {
1012
- this._isViewInitialized.set(true);
1013
- this.leftCalendar.viewChanged.pipe(untilDestroyed(this)).subscribe((view) => {
1014
- this.leftCalendarYearViewActivated.set(view !== 'month');
1015
- });
1016
- this.rightCalendar.viewChanged.pipe(untilDestroyed(this)).subscribe((view) => {
1017
- this.rightCalendarYearViewActivated.set(view !== 'month');
1018
- });
1019
- this.bottomPanelContainer.createComponent(this.pickerBottomPanel);
1020
- this.handleRightCalendarPreviewChange();
1021
- }
1022
- apply() {
1023
- this.triggerSelectionModel.updateSelection(this.localSelectionModel.selection, this);
1024
- this.trigger.close();
1025
- }
1026
- reset() {
1027
- this.trigger.close();
1028
- }
1029
- get leftCalendarActiveCell() {
1030
- return this.leftCalendarElement.nativeElement.querySelector('.mat-calendar-body-active');
1031
- }
1032
- handleRightCalendarPreviewChange() {
1033
- const viewChanged = new Subject();
1034
- this.rightCalendar.viewChanged
1035
- .pipe(untilDestroyed(this))
1036
- .pipe(tap(() => viewChanged.next()))
1037
- .pipe(startWith(this.rightCalendar.currentView))
1038
- .subscribe((view) => {
1039
- if (view !== 'month')
1040
- return;
1041
- this.rightCalendar.monthView._matCalendarBody.previewChange
1042
- .pipe(takeUntil(viewChanged), untilDestroyed(this))
1043
- .subscribe(() => {
1044
- if (this.leftCalendar.currentView !== 'month' || !this.leftCalendar.monthView._rangeStart)
1045
- return;
1046
- this.leftCalendar.monthView._previewStart = this.rightCalendar.monthView._previewStart;
1047
- this.leftCalendar.monthView._previewEnd = this.rightCalendar.monthView._previewEnd;
1048
- const activeCell = this.leftCalendarActiveCell;
1049
- if (activeCell && activeCell === document.activeElement)
1050
- activeCell.blur();
1051
- this.leftCalendar.monthView._changeDetectorRef.markForCheck();
1052
- });
1053
- });
1054
- }
1055
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: DoubleCalendarRangePickerComponent, deps: [{ token: WLCM_DATE_RANGE_PICKER_CONFIG, optional: true }, { token: MAT_DATE_RANGE_SELECTION_STRATEGY }, { token: WLCM_DATE_RANGE_SELECTION_MODEL }, { token: WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL }, { token: WlcmDatepickerTrigger }, { token: WLCM_DATEPICKER_CONFIG }, { token: WLCM_DATE_RANGE_PICKER_BP }, { token: i1$1.DateAdapter }], target: i0.ɵɵFactoryTarget.Component }); }
1056
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.6", type: DoubleCalendarRangePickerComponent, isStandalone: true, selector: "wlcm-double-calendar-range-picker", providers: [
1057
- {
1058
- provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
1059
- useClass: DefaultMatCalendarRangeStrategy,
1060
- },
1061
- { provide: WlcmDateRangePicker, useExisting: forwardRef(() => DoubleCalendarRangePickerComponent) },
1062
- WLCM_DATE_RANGE_SELECTION_MODEL_PROVIDER,
1063
- ], viewQueries: [{ propertyName: "leftCalendar", first: true, predicate: WlcmLeftCalendarDirective, descendants: true, read: MatCalendar }, { propertyName: "rightCalendar", first: true, predicate: WlcmRightCalendarDirective, descendants: true, read: MatCalendar }, { propertyName: "leftCalendarElement", first: true, predicate: WlcmLeftCalendarDirective, descendants: true, read: ElementRef }, { propertyName: "bottomPanelContainer", first: true, predicate: ["bottomPanelContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "monthView", first: true, predicate: MatMonthView, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"wlcm-date-range-picker-panel\">\n <div class=\"double-calendar-range-picker-body\">\n <mat-calendar\n wlcmCalendar\n wlcmLeftCalendar\n [selected]=\"selected\"\n [disabled]=\"rightCalendarYearViewActivated()\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n (dateChange)=\"startDate.set($event)\"\n ></mat-calendar>\n\n <mat-calendar\n wlcmCalendar\n wlcmRightCalendar\n [selected]=\"selected\"\n [disabled]=\"leftCalendarYearViewActivated()\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n (dateChange)=\"startDate.set($event)\"\n ></mat-calendar>\n </div>\n\n <ng-container #bottomPanelContainer></ng-container>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2.MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "directive", type: WlcmCalendarDirective, selector: "[wlcmCalendar]" }, { kind: "directive", type: WlcmLeftCalendarDirective, selector: "[wlcmLeftCalendar]" }, { kind: "directive", type: WlcmRightCalendarDirective, selector: "[wlcmRightCalendar]" }] }); }
1064
- };
1065
- DoubleCalendarRangePickerComponent = __decorate([
1066
- UntilDestroy(),
1067
- __metadata("design:paramtypes", [Object, Object, MatDateSelectionModel,
1068
- MatDateSelectionModel,
1069
- WlcmDatepickerTrigger, Object, Type,
1070
- DateAdapter])
1071
- ], DoubleCalendarRangePickerComponent);
1072
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: DoubleCalendarRangePickerComponent, decorators: [{
1073
- type: Component,
1074
- args: [{ selector: 'wlcm-double-calendar-range-picker', imports: [
1075
- CommonModule,
1076
- MatDatepickerModule,
1077
- WlcmCalendarDirective,
1078
- WlcmLeftCalendarDirective,
1079
- WlcmRightCalendarDirective,
1080
- ], standalone: true, providers: [
1081
- {
1082
- provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
1083
- useClass: DefaultMatCalendarRangeStrategy,
1084
- },
1085
- { provide: WlcmDateRangePicker, useExisting: forwardRef(() => DoubleCalendarRangePickerComponent) },
1086
- WLCM_DATE_RANGE_SELECTION_MODEL_PROVIDER,
1087
- ], template: "<div class=\"wlcm-date-range-picker-panel\">\n <div class=\"double-calendar-range-picker-body\">\n <mat-calendar\n wlcmCalendar\n wlcmLeftCalendar\n [selected]=\"selected\"\n [disabled]=\"rightCalendarYearViewActivated()\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n (dateChange)=\"startDate.set($event)\"\n ></mat-calendar>\n\n <mat-calendar\n wlcmCalendar\n wlcmRightCalendar\n [selected]=\"selected\"\n [disabled]=\"leftCalendarYearViewActivated()\"\n [headerComponent]=\"headerComponent\"\n (_userSelection)=\"calendarSelection($event)\"\n (_userDragDrop)=\"calendarDragDrop($event)\"\n (dateChange)=\"startDate.set($event)\"\n ></mat-calendar>\n </div>\n\n <ng-container #bottomPanelContainer></ng-container>\n</div>\n" }]
1088
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1089
- type: Optional
1090
- }, {
1091
- type: Inject,
1092
- args: [WLCM_DATE_RANGE_PICKER_CONFIG]
1093
- }] }, { type: undefined, decorators: [{
1094
- type: Inject,
1095
- args: [MAT_DATE_RANGE_SELECTION_STRATEGY]
1096
- }] }, { type: i2.MatDateSelectionModel, decorators: [{
1097
- type: Inject,
1098
- args: [WLCM_DATE_RANGE_SELECTION_MODEL]
1099
- }] }, { type: i2.MatDateSelectionModel, decorators: [{
1100
- type: Inject,
1101
- args: [WLCM_DATE_RANGE_TRIGGER_SELECTION_MODEL]
1102
- }] }, { type: WlcmDatepickerTrigger }, { type: undefined, decorators: [{
1103
- type: Inject,
1104
- args: [WLCM_DATEPICKER_CONFIG]
1105
- }] }, { type: i0.Type, decorators: [{
1106
- type: Inject,
1107
- args: [WLCM_DATE_RANGE_PICKER_BP]
1108
- }] }, { type: i1$1.DateAdapter }], propDecorators: { leftCalendar: [{
1109
- type: ViewChild,
1110
- args: [WlcmLeftCalendarDirective, { read: MatCalendar }]
1111
- }], rightCalendar: [{
1112
- type: ViewChild,
1113
- args: [WlcmRightCalendarDirective, { read: MatCalendar }]
1114
- }], leftCalendarElement: [{
1115
- type: ViewChild,
1116
- args: [WlcmLeftCalendarDirective, { read: ElementRef }]
1117
- }], bottomPanelContainer: [{
1118
- type: ViewChild,
1119
- args: ['bottomPanelContainer', { read: ViewContainerRef }]
1120
- }], monthView: [{
1121
- type: ViewChild,
1122
- args: [MatMonthView]
1123
- }] } });
1124
-
1125
1029
  let WlcmDatepickerInputDirective = class WlcmDatepickerInputDirective extends WlcmDatepickerInputBase {
1126
1030
  constructor(element, dateAdapter, dateFormats, selectionModel, trigger) {
1127
1031
  super(element, dateAdapter, dateFormats, trigger);
@@ -1147,7 +1051,7 @@ let WlcmDatepickerInputDirective = class WlcmDatepickerInputDirective extends Wl
1147
1051
  this._touched?.();
1148
1052
  });
1149
1053
  }
1150
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerInputDirective, deps: [{ token: i0.ElementRef }, { token: i1$1.DateAdapter }, { token: MAT_DATE_FORMATS }, { token: i2.MatDateSelectionModel }, { token: WlcmDatepickerTrigger }], target: i0.ɵɵFactoryTarget.Directive }); }
1054
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerInputDirective, deps: [{ token: i0.ElementRef }, { token: i1.DateAdapter }, { token: MAT_DATE_FORMATS }, { token: i2$1.MatDateSelectionModel }, { token: WlcmDatepickerTrigger }], target: i0.ɵɵFactoryTarget.Directive }); }
1151
1055
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.6", type: WlcmDatepickerInputDirective, isStandalone: true, selector: "[wlcmDatepickerInput]", host: { classAttribute: "wlcm-form-field-input" }, providers: [
1152
1056
  { provide: NG_VALIDATORS, useExisting: forwardRef(() => WlcmDatepickerInputDirective), multi: true },
1153
1057
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => WlcmDatepickerInputDirective), multi: true },
@@ -1171,10 +1075,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
1171
1075
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => WlcmDatepickerInputDirective), multi: true },
1172
1076
  ],
1173
1077
  }]
1174
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.DateAdapter }, { type: undefined, decorators: [{
1078
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.DateAdapter }, { type: undefined, decorators: [{
1175
1079
  type: Inject,
1176
1080
  args: [MAT_DATE_FORMATS]
1177
- }] }, { type: i2.MatDateSelectionModel }, { type: WlcmDatepickerTrigger }] });
1081
+ }] }, { type: i2$1.MatDateSelectionModel }, { type: WlcmDatepickerTrigger }] });
1178
1082
 
1179
1083
  class WlcmDatepickerPanelComponent {
1180
1084
  constructor(selectionModel, trigger, config) {
@@ -1188,13 +1092,13 @@ class WlcmDatepickerPanelComponent {
1188
1092
  this.selectionModel.updateSelection(date, this);
1189
1093
  this.trigger.close();
1190
1094
  }
1191
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerPanelComponent, deps: [{ token: i2.MatDateSelectionModel }, { token: WlcmDatepickerTrigger }, { token: WLCM_DATEPICKER_CONFIG }], target: i0.ɵɵFactoryTarget.Component }); }
1192
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.6", type: WlcmDatepickerPanelComponent, isStandalone: true, selector: "wlcm-datepicker-panel", host: { classAttribute: "wlcm-datepicker-panel" }, viewQueries: [{ propertyName: "matCalendar", first: true, predicate: MatCalendar, descendants: true, isSignal: true }], ngImport: i0, template: "<mat-calendar\n wlcmCalendar\n [minDate]=\"config.minDate?.()\"\n [maxDate]=\"config.maxDate?.()\"\n [startAt]=\"selectionModel.selection\"\n [selected]=\"selectionModel.selection\"\n [headerComponent]=\"headerComponent\"\n (selectedChange)=\"select($event)\"\n></mat-calendar>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2.MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "directive", type: WlcmCalendarDirective, selector: "[wlcmCalendar]" }] }); }
1095
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerPanelComponent, deps: [{ token: i2$1.MatDateSelectionModel }, { token: WlcmDatepickerTrigger }, { token: WLCM_DATEPICKER_CONFIG }], target: i0.ɵɵFactoryTarget.Component }); }
1096
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.6", type: WlcmDatepickerPanelComponent, isStandalone: true, selector: "wlcm-datepicker-panel", host: { classAttribute: "wlcm-datepicker-panel" }, viewQueries: [{ propertyName: "matCalendar", first: true, predicate: MatCalendar, descendants: true, isSignal: true }], ngImport: i0, template: "<mat-calendar\n wlcmCalendar\n [minDate]=\"config.minDate?.()\"\n [maxDate]=\"config.maxDate?.()\"\n [startAt]=\"selectionModel.selection\"\n [selected]=\"selectionModel.selection\"\n [headerComponent]=\"headerComponent\"\n (selectedChange)=\"select($event)\"\n></mat-calendar>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2$1.MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "directive", type: WlcmCalendarDirective, selector: "[wlcmCalendar]" }] }); }
1193
1097
  }
1194
1098
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerPanelComponent, decorators: [{
1195
1099
  type: Component,
1196
1100
  args: [{ selector: 'wlcm-datepicker-panel', host: { class: 'wlcm-datepicker-panel' }, standalone: true, imports: [CommonModule, MatDatepickerModule, WlcmCalendarDirective], template: "<mat-calendar\n wlcmCalendar\n [minDate]=\"config.minDate?.()\"\n [maxDate]=\"config.maxDate?.()\"\n [startAt]=\"selectionModel.selection\"\n [selected]=\"selectionModel.selection\"\n [headerComponent]=\"headerComponent\"\n (selectedChange)=\"select($event)\"\n></mat-calendar>\n" }]
1197
- }], ctorParameters: () => [{ type: i2.MatDateSelectionModel }, { type: WlcmDatepickerTrigger }, { type: undefined, decorators: [{
1101
+ }], ctorParameters: () => [{ type: i2$1.MatDateSelectionModel }, { type: WlcmDatepickerTrigger }, { type: undefined, decorators: [{
1198
1102
  type: Inject,
1199
1103
  args: [WLCM_DATEPICKER_CONFIG]
1200
1104
  }] }] });
@@ -1241,7 +1145,7 @@ class WlcmDatepickerInputContainerComponent extends WlcmDatepickerTrigger {
1241
1145
  this._focusStream$.next(merge(...focusObservables).pipe(map(voidFn)));
1242
1146
  this._blurStream$.next(merge(...blurObservables).pipe(map(voidFn)));
1243
1147
  }
1244
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerInputContainerComponent, deps: [{ token: i1.Overlay }, { token: i0.ViewContainerRef }, { token: i2.MatDateSelectionModel }, { token: WLCM_FORM_FIELD, host: true }], target: i0.ɵɵFactoryTarget.Component }); }
1148
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: WlcmDatepickerInputContainerComponent, deps: [{ token: i1$1.Overlay }, { token: i0.ViewContainerRef }, { token: i2$1.MatDateSelectionModel }, { token: WLCM_FORM_FIELD, host: true }], target: i0.ɵɵFactoryTarget.Component }); }
1245
1149
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.6", type: WlcmDatepickerInputContainerComponent, isStandalone: true, selector: "wlcm-datepicker-input-container", host: { classAttribute: "wlcm-datepicker-input-container" }, providers: [
1246
1150
  {
1247
1151
  provide: WLCM_INPUT_BINDER,
@@ -1271,7 +1175,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
1271
1175
  { provide: WlcmDatepickerTrigger, useExisting: forwardRef(() => WlcmDatepickerInputContainerComponent) },
1272
1176
  { provide: MatDateSelectionModel, useClass: MatSingleDateSelectionModel },
1273
1177
  ], template: "<ng-content select=\"[wlcmDatepickerInput]\"></ng-content>\n" }]
1274
- }], ctorParameters: () => [{ type: i1.Overlay }, { type: i0.ViewContainerRef }, { type: i2.MatDateSelectionModel }, { type: undefined, decorators: [{
1178
+ }], ctorParameters: () => [{ type: i1$1.Overlay }, { type: i0.ViewContainerRef }, { type: i2$1.MatDateSelectionModel }, { type: undefined, decorators: [{
1275
1179
  type: Host
1276
1180
  }, {
1277
1181
  type: Inject,
@@ -1321,5 +1225,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
1321
1225
  * Generated bundle index. Do not edit.
1322
1226
  */
1323
1227
 
1324
- export { DateRangePickerInputEndDirective, DateRangePickerInputStartDirective, DoubleCalendarRangePickerComponent, SingleCalendarRangePickerComponent, WLCM_DATEPICKER_CONFIG, WlcmDateRangeInputValidator, WlcmDateRangePicker, WlcmDateRangePickerInputComponent, WlcmDateRangeValidation, WlcmDateValidation, WlcmDatepickerInputContainerComponent, WlcmDatepickerInputDirective, WlcmDatepickerModule };
1228
+ export { DateRangePickerInputEndDirective, DateRangePickerInputStartDirective, WLCM_DATEPICKER_CONFIG, WlcmDateRangeInputValidator, WlcmDateRangePickerInputComponent, WlcmDateRangeValidation, WlcmDateValidation, WlcmDatepickerInputContainerComponent, WlcmDatepickerInputDirective, WlcmDatepickerModule };
1325
1229
  //# sourceMappingURL=wlcm-angular-datepicker.mjs.map