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