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