@odx/angular 2.11.3 → 2.12.0
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/CHANGELOG.md +15 -0
- package/components/calendar/index.d.ts +5 -1
- package/components/calendar/lib/calendar.component.d.ts +11 -11
- package/components/calendar/lib/calendar.config.d.ts +42 -0
- package/components/calendar/lib/{services/calendar.service.d.ts → calendar.service.d.ts} +4 -14
- package/components/calendar/lib/components/calendar-header/calendar-header.component.d.ts +17 -27
- package/components/calendar/lib/components/calendar-month/calendar-month.component.d.ts +11 -12
- package/components/calendar/lib/components/calendar-year/calendar-year.component.d.ts +10 -10
- package/components/calendar/lib/components/calendar-years/calendar-years.component.d.ts +9 -9
- package/components/calendar/lib/directives/calendar-cell.directive.d.ts +20 -13
- package/components/calendar/lib/directives/calendar-view.directive.d.ts +23 -12
- package/components/calendar/lib/{enums/calendar-view.enum.d.ts → models/calendar-view.d.ts} +1 -1
- package/components/calendar/lib/models/index.d.ts +1 -0
- package/components/calendar/lib/pipes/date-label.pipe.d.ts +7 -0
- package/components/calendar/lib/services/calendar-month.service.d.ts +6 -8
- package/components/calendar/lib/services/calendar-year.service.d.ts +4 -6
- package/components/calendar/lib/services/calendar-years.service.d.ts +3 -4
- package/components/calendar/lib/services/index.d.ts +0 -1
- package/components/calendar/lib/utils/check-identical-date.d.ts +2 -2
- package/components/calendar/lib/utils/get-A11y-label.d.ts +2 -2
- package/components/calendar/lib/utils/index.d.ts +1 -0
- package/components/calendar/lib/utils/is-date-disabled.d.ts +2 -0
- package/components/calendar/lib/utils/validate-max-date.d.ts +2 -2
- package/components/calendar/lib/utils/validate-min-date.d.ts +2 -2
- package/components/calendar/lib/utils/validate-next-date-set.d.ts +2 -2
- package/components/calendar/lib/utils/validate-previous-date-set.d.ts +2 -2
- package/components/datepicker/lib/datepicker.component.d.ts +3 -1
- package/components/main-menu/index.d.ts +1 -0
- package/components/main-menu/lib/helpers/create-main-menu-links.d.ts +2 -0
- package/components/main-menu/lib/helpers/index.d.ts +1 -0
- package/components/main-menu/lib/main-menu.component.d.ts +3 -0
- package/components/main-menu/lib/main-menu.config.d.ts +8 -0
- package/components/main-menu/lib/main-menu.i18n.d.ts +3 -0
- package/components/main-menu/lib/models/index.d.ts +1 -0
- package/components/main-menu/lib/models/main-menu-link.d.ts +4 -0
- package/esm2020/components/calendar/index.mjs +6 -2
- package/esm2020/components/calendar/lib/calendar.component.mjs +12 -19
- package/esm2020/components/calendar/lib/calendar.config.mjs +8 -1
- package/esm2020/components/calendar/lib/calendar.service.mjs +36 -0
- package/esm2020/components/calendar/lib/components/calendar-header/calendar-header.component.mjs +33 -27
- package/esm2020/components/calendar/lib/components/calendar-month/calendar-month.component.mjs +6 -6
- package/esm2020/components/calendar/lib/components/calendar-year/calendar-year.component.mjs +7 -7
- package/esm2020/components/calendar/lib/components/calendar-years/calendar-years.component.mjs +9 -8
- package/esm2020/components/calendar/lib/directives/calendar-cell.directive.mjs +8 -11
- package/esm2020/components/calendar/lib/directives/calendar-view.directive.mjs +24 -14
- package/esm2020/components/calendar/lib/models/calendar-view.mjs +7 -0
- package/esm2020/components/calendar/lib/models/index.mjs +2 -1
- package/esm2020/components/calendar/lib/pipes/date-label.pipe.mjs +4 -4
- package/esm2020/components/calendar/lib/services/calendar-month.service.mjs +2 -2
- package/esm2020/components/calendar/lib/services/calendar-year.service.mjs +7 -5
- package/esm2020/components/calendar/lib/services/calendar-years.service.mjs +12 -9
- package/esm2020/components/calendar/lib/services/index.mjs +1 -2
- package/esm2020/components/calendar/lib/utils/check-identical-date.mjs +7 -7
- package/esm2020/components/calendar/lib/utils/get-A11y-label.mjs +7 -7
- package/esm2020/components/calendar/lib/utils/index.mjs +2 -1
- package/esm2020/components/calendar/lib/utils/is-date-disabled.mjs +10 -0
- package/esm2020/components/calendar/lib/utils/validate-max-date.mjs +7 -7
- package/esm2020/components/calendar/lib/utils/validate-min-date.mjs +7 -7
- package/esm2020/components/calendar/lib/utils/validate-next-date-set.mjs +7 -8
- package/esm2020/components/calendar/lib/utils/validate-previous-date-set.mjs +7 -8
- package/esm2020/components/datepicker/lib/datepicker.component.mjs +7 -4
- package/esm2020/components/main-menu/index.mjs +2 -1
- package/esm2020/components/main-menu/lib/helpers/create-main-menu-links.mjs +13 -0
- package/esm2020/components/main-menu/lib/helpers/index.mjs +2 -0
- package/esm2020/components/main-menu/lib/main-menu.component.mjs +11 -5
- package/esm2020/components/main-menu/lib/main-menu.config.mjs +6 -0
- package/esm2020/components/main-menu/lib/main-menu.i18n.mjs +17 -0
- package/esm2020/components/main-menu/lib/models/index.mjs +2 -0
- package/esm2020/components/main-menu/lib/models/main-menu-link.mjs +2 -0
- package/esm2020/index.mjs +2 -1
- package/esm2020/internal/translate/index.mjs +7 -0
- package/esm2020/internal/translate/lib/helpers/get-language-code.mjs +6 -0
- package/esm2020/internal/translate/lib/helpers/index.mjs +2 -0
- package/esm2020/internal/translate/lib/models/index.mjs +2 -0
- package/esm2020/internal/translate/lib/models/translation.mjs +2 -0
- package/esm2020/internal/translate/lib/pipes/index.mjs +2 -0
- package/esm2020/internal/translate/lib/pipes/translate.pipe.mjs +22 -0
- package/esm2020/internal/translate/lib/services/index.mjs +2 -0
- package/esm2020/internal/translate/lib/services/language.service.mjs +21 -0
- package/esm2020/internal/translate/lib/translate.config.mjs +15 -0
- package/esm2020/internal/translate/lib/translate.service.mjs +16 -0
- package/esm2020/internal/translate/odx-angular-internal-translate.mjs +5 -0
- package/esm2020/lib/services/window-ref.mjs +3 -2
- package/esm2020/utils/lib/helpers/build-website-url.mjs +6 -0
- package/esm2020/utils/lib/helpers/index.mjs +2 -1
- package/fesm2015/odx-angular-components-calendar.mjs +254 -270
- package/fesm2015/odx-angular-components-calendar.mjs.map +1 -1
- package/fesm2015/odx-angular-components-datepicker.mjs +5 -2
- package/fesm2015/odx-angular-components-datepicker.mjs.map +1 -1
- package/fesm2015/odx-angular-components-main-menu.mjs +43 -6
- package/fesm2015/odx-angular-components-main-menu.mjs.map +1 -1
- package/fesm2015/odx-angular-internal-translate.mjs +75 -0
- package/fesm2015/odx-angular-internal-translate.mjs.map +1 -0
- package/fesm2015/odx-angular-utils.mjs +6 -1
- package/fesm2015/odx-angular-utils.mjs.map +1 -1
- package/fesm2015/odx-angular.mjs +3 -1
- package/fesm2015/odx-angular.mjs.map +1 -1
- package/fesm2020/odx-angular-components-calendar.mjs +254 -269
- package/fesm2020/odx-angular-components-calendar.mjs.map +1 -1
- package/fesm2020/odx-angular-components-datepicker.mjs +5 -2
- package/fesm2020/odx-angular-components-datepicker.mjs.map +1 -1
- package/fesm2020/odx-angular-components-main-menu.mjs +43 -6
- package/fesm2020/odx-angular-components-main-menu.mjs.map +1 -1
- package/fesm2020/odx-angular-internal-translate.mjs +74 -0
- package/fesm2020/odx-angular-internal-translate.mjs.map +1 -0
- package/fesm2020/odx-angular-utils.mjs +6 -1
- package/fesm2020/odx-angular-utils.mjs.map +1 -1
- package/fesm2020/odx-angular.mjs +3 -1
- package/fesm2020/odx-angular.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/internal/translate/README.md +3 -0
- package/internal/translate/index.d.ts +6 -0
- package/internal/translate/lib/helpers/get-language-code.d.ts +1 -0
- package/internal/translate/lib/helpers/index.d.ts +1 -0
- package/internal/translate/lib/models/index.d.ts +1 -0
- package/internal/translate/lib/models/translation.d.ts +2 -0
- package/internal/translate/lib/pipes/index.d.ts +1 -0
- package/internal/translate/lib/pipes/translate.pipe.d.ts +9 -0
- package/internal/translate/lib/services/index.d.ts +1 -0
- package/internal/translate/lib/services/language.service.d.ts +8 -0
- package/internal/translate/lib/translate.config.d.ts +9 -0
- package/internal/translate/lib/translate.service.d.ts +10 -0
- package/package.json +11 -3
- package/utils/lib/helpers/build-website-url.d.ts +2 -0
- package/utils/lib/helpers/index.d.ts +1 -0
- package/components/calendar/lib/enums/index.d.ts +0 -1
- package/esm2020/components/calendar/lib/enums/calendar-view.enum.mjs +0 -7
- package/esm2020/components/calendar/lib/enums/index.mjs +0 -2
- package/esm2020/components/calendar/lib/services/calendar.service.mjs +0 -73
|
@@ -1,56 +1,69 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable,
|
|
4
|
+
import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, Pipe, inject, Directive } from '@angular/core';
|
|
5
5
|
import * as i2 from '@odx/angular';
|
|
6
6
|
import { CoreModule, DisabledController } from '@odx/angular';
|
|
7
7
|
import { CSSComponent, CSSModifier } from '@odx/angular/internal';
|
|
8
|
-
import {
|
|
8
|
+
import { isString, isPresent, injectElement, hasChanged, createConfigTokens, deferFn, untilDestroyed, trackByIndex, isFunction } from '@odx/angular/utils';
|
|
9
|
+
import { isSameDay, isSameMonth, isSameYear, endOfDay, endOfMonth, endOfYear, startOfDay, startOfMonth, startOfYear, isValid, toDate, addMonths, subMonths, isEqual, format, startOfWeek, addDays, endOfWeek, eachMonthOfInterval, addYears, getYear, setYear, subDays, subWeeks, addWeeks, setMonth, getMonth } from 'date-fns';
|
|
10
|
+
import { BehaviorSubject, Subject, shareReplay, merge, filter, distinctUntilChanged, map, defer, of } from 'rxjs';
|
|
9
11
|
import { ActionGroupComponent } from '@odx/angular/components/action-group';
|
|
10
12
|
import { ButtonComponent } from '@odx/angular/components/button';
|
|
11
13
|
import { IconComponent } from '@odx/angular/components/icon';
|
|
12
|
-
import { BehaviorSubject, shareReplay, tap, map } from 'rxjs';
|
|
13
14
|
import { enGB } from 'date-fns/locale';
|
|
14
|
-
import { isSameDay, isSameMonth, isSameYear, isValid, toDate, endOfDay, endOfMonth, endOfYear, startOfDay, startOfMonth, startOfYear, addMonths, subMonths, startOfWeek, addDays, endOfWeek, eachMonthOfInterval, addYears, getYear, setYear, format, subDays, subWeeks, addWeeks, setMonth, getMonth } from 'date-fns';
|
|
15
15
|
import * as i1 from '@angular/common';
|
|
16
16
|
import { DOCUMENT } from '@angular/common';
|
|
17
|
+
import * as i2$1 from '@ngrx/component';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
dayA11yLabel: 'MMMM dd, yyyy',
|
|
25
|
-
monthA11yLabel: 'MMMM, yyyy',
|
|
26
|
-
yearA11yLabel: 'yyyy',
|
|
27
|
-
displayAdjacentDays: true,
|
|
28
|
-
locale: new BehaviorSubject(enGB),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
var CalendarViewEnum;
|
|
32
|
-
(function (CalendarViewEnum) {
|
|
33
|
-
CalendarViewEnum["Month"] = "month";
|
|
34
|
-
CalendarViewEnum["Year"] = "year";
|
|
35
|
-
CalendarViewEnum["Years"] = "years";
|
|
36
|
-
})(CalendarViewEnum || (CalendarViewEnum = {}));
|
|
19
|
+
var CalendarView;
|
|
20
|
+
(function (CalendarView) {
|
|
21
|
+
CalendarView["Month"] = "month";
|
|
22
|
+
CalendarView["Year"] = "year";
|
|
23
|
+
CalendarView["Years"] = "years";
|
|
24
|
+
})(CalendarView || (CalendarView = {}));
|
|
37
25
|
|
|
38
|
-
const
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
26
|
+
const dateValidators$4 = {
|
|
27
|
+
[CalendarView.Month]: (currentDate, date) => isSameDay(currentDate, date),
|
|
28
|
+
[CalendarView.Year]: (currentDate, date) => isSameMonth(currentDate, date),
|
|
29
|
+
[CalendarView.Years]: (currentDate, date) => isSameYear(currentDate, date),
|
|
42
30
|
};
|
|
43
31
|
function checkIdenticalDate(currentDate, date, calendarView) {
|
|
44
|
-
return
|
|
32
|
+
return dateValidators$4[calendarView](currentDate, date);
|
|
45
33
|
}
|
|
46
34
|
|
|
47
|
-
const
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[
|
|
35
|
+
const labelResolvers = {
|
|
36
|
+
[CalendarView.Month]: (config) => config.dayA11yLabel,
|
|
37
|
+
[CalendarView.Year]: (config) => config.monthA11yLabel,
|
|
38
|
+
[CalendarView.Years]: (config) => config.yearA11yLabel,
|
|
51
39
|
};
|
|
52
40
|
function getA11yLabel(calendarView, config) {
|
|
53
|
-
return
|
|
41
|
+
return labelResolvers[calendarView](config);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const dateValidators$3 = {
|
|
45
|
+
[CalendarView.Month]: (maxDate, date) => endOfDay(maxDate) < endOfDay(date),
|
|
46
|
+
[CalendarView.Year]: (maxDate, date) => endOfMonth(maxDate) < endOfMonth(date),
|
|
47
|
+
[CalendarView.Years]: (maxDate, date) => endOfYear(maxDate) < endOfYear(date),
|
|
48
|
+
};
|
|
49
|
+
function validateMaxDate(maxDate, date, calendarView) {
|
|
50
|
+
return dateValidators$3[calendarView](maxDate, date);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const dateValidators$2 = {
|
|
54
|
+
[CalendarView.Month]: (minDate, date) => startOfDay(minDate) > startOfDay(date),
|
|
55
|
+
[CalendarView.Year]: (minDate, date) => startOfMonth(minDate) > startOfMonth(date),
|
|
56
|
+
[CalendarView.Years]: (minDate, date) => startOfYear(minDate) > startOfYear(date),
|
|
57
|
+
};
|
|
58
|
+
function validateMinDate(maxDate, date, calendarView) {
|
|
59
|
+
return dateValidators$2[calendarView](maxDate, date);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function isDateDisabled(date, calendarView, minDate, maxDate, filterFn) {
|
|
63
|
+
const minDateValidation = minDate && validateMinDate(minDate, date, calendarView);
|
|
64
|
+
const maxDateValidation = maxDate && validateMaxDate(maxDate, date, calendarView);
|
|
65
|
+
const isDateFiltered = calendarView === CalendarView.Month && !!(filterFn === null || filterFn === void 0 ? void 0 : filterFn(date));
|
|
66
|
+
return minDateValidation || maxDateValidation || isDateFiltered;
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
function parseDate(value) {
|
|
@@ -66,236 +79,98 @@ function parseDate(value) {
|
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
|
|
69
|
-
const
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
};
|
|
74
|
-
function validateMaxDate(maxDate, date, calendarView) {
|
|
75
|
-
return functionList$3[calendarView](maxDate, date);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const functionList$2 = {
|
|
79
|
-
[CalendarViewEnum.Month]: (minDate, date) => startOfDay(minDate) > startOfDay(date),
|
|
80
|
-
[CalendarViewEnum.Year]: (minDate, date) => startOfMonth(minDate) > startOfMonth(date),
|
|
81
|
-
[CalendarViewEnum.Years]: (minDate, date) => startOfYear(minDate) > startOfYear(date),
|
|
82
|
-
};
|
|
83
|
-
function validateMinDate(maxDate, date, calendarView) {
|
|
84
|
-
return functionList$2[calendarView](maxDate, date);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const functionList$1 = {
|
|
88
|
-
[CalendarViewEnum.Month]: (maxDate, date) => maxDate < startOfMonth(addMonths(date, 1)),
|
|
89
|
-
[CalendarViewEnum.Year]: (maxDate, date) => maxDate < startOfYear(addMonths(date, 12)),
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
91
|
-
[CalendarViewEnum.Years]: (maxDate, date) => false,
|
|
82
|
+
const dateValidators$1 = {
|
|
83
|
+
[CalendarView.Month]: (maxDate, date) => maxDate < startOfMonth(addMonths(date, 1)),
|
|
84
|
+
[CalendarView.Year]: (maxDate, date) => maxDate < startOfYear(addMonths(date, 12)),
|
|
85
|
+
[CalendarView.Years]: () => false,
|
|
92
86
|
};
|
|
93
87
|
function validateNextDateSet(maxDate, date, calendarView) {
|
|
94
|
-
return
|
|
88
|
+
return dateValidators$1[calendarView](maxDate, date);
|
|
95
89
|
}
|
|
96
90
|
|
|
97
|
-
const
|
|
98
|
-
[
|
|
99
|
-
[
|
|
100
|
-
|
|
101
|
-
[CalendarViewEnum.Years]: () => false,
|
|
91
|
+
const dateValidators = {
|
|
92
|
+
[CalendarView.Month]: (minDate, date) => minDate > endOfMonth(subMonths(date, 1)),
|
|
93
|
+
[CalendarView.Year]: (minDate, date) => minDate > endOfYear(subMonths(date, 12)),
|
|
94
|
+
[CalendarView.Years]: () => false,
|
|
102
95
|
};
|
|
103
96
|
function validatePreviousDateSet(minDate, date, calendarView) {
|
|
104
|
-
return
|
|
97
|
+
return dateValidators[calendarView](minDate, date);
|
|
105
98
|
}
|
|
106
99
|
|
|
107
100
|
class CalendarService {
|
|
108
101
|
constructor() {
|
|
109
|
-
this.calendarView$$ = new BehaviorSubject(
|
|
110
|
-
this.activeDate$$ = new
|
|
102
|
+
this.calendarView$$ = new BehaviorSubject(CalendarView.Month);
|
|
103
|
+
this.activeDate$$ = new Subject();
|
|
111
104
|
this.selectedDate$$ = new BehaviorSubject(null);
|
|
112
|
-
this.minDate = null;
|
|
113
|
-
this.maxDate = null;
|
|
114
|
-
this.filterFn = null;
|
|
115
105
|
this.calendarView$ = this.calendarView$$.pipe(shareReplay({ refCount: true }));
|
|
116
|
-
this.
|
|
117
|
-
this.
|
|
106
|
+
this.selectedDate$ = this.selectedDate$$.pipe(shareReplay({ refCount: true }));
|
|
107
|
+
this.activeDate$ = merge(this.activeDate$$, this.selectedDate$).pipe(filter(Boolean), distinctUntilChanged((prev, curr) => isEqual(prev, curr)), shareReplay({ refCount: true }));
|
|
118
108
|
}
|
|
119
109
|
setActiveDate(value) {
|
|
120
|
-
if (isPresent(value))
|
|
121
|
-
|
|
122
|
-
|
|
110
|
+
if (!isPresent(value))
|
|
111
|
+
return;
|
|
112
|
+
this.activeDate$$.next(parseDate(value));
|
|
123
113
|
}
|
|
124
114
|
selectDate(value) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
else {
|
|
129
|
-
this.selectedDate$$.next(null);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
get activeDate() {
|
|
133
|
-
return this.activeDate$$.getValue();
|
|
134
|
-
}
|
|
135
|
-
get selectedDate() {
|
|
136
|
-
return this.selectedDate$$.getValue();
|
|
115
|
+
const date = isPresent(value) ? startOfDay(parseDate(value)) : null;
|
|
116
|
+
this.selectedDate$$.next(date);
|
|
117
|
+
this.setActiveDate(date);
|
|
137
118
|
}
|
|
138
119
|
changeView(view) {
|
|
139
120
|
this.calendarView$$.next(view);
|
|
140
121
|
}
|
|
141
|
-
get calendarCurrentView() {
|
|
142
|
-
return this.calendarView$$.getValue();
|
|
143
|
-
}
|
|
144
|
-
isDateDisabled(date) {
|
|
145
|
-
var _a, _b;
|
|
146
|
-
const minDate = this.minDate && validateMinDate(this.minDate, date, this.calendarCurrentView);
|
|
147
|
-
const maxDate = this.maxDate && validateMaxDate(this.maxDate, date, this.calendarCurrentView);
|
|
148
|
-
let isDateFiltered = false;
|
|
149
|
-
if (this.calendarCurrentView === CalendarViewEnum.Month) {
|
|
150
|
-
isDateFiltered = (_b = (_a = this.filterFn) === null || _a === void 0 ? void 0 : _a.call(this, date)) !== null && _b !== void 0 ? _b : false;
|
|
151
|
-
}
|
|
152
|
-
return minDate || maxDate || isDateFiltered;
|
|
153
|
-
}
|
|
154
|
-
isPreviousDateSetDisabled() {
|
|
155
|
-
return this.minDate ? validatePreviousDateSet(this.minDate, this.activeDate, this.calendarCurrentView) : false;
|
|
156
|
-
}
|
|
157
|
-
isNextDateSetDisabled() {
|
|
158
|
-
return this.maxDate ? validateNextDateSet(this.maxDate, this.activeDate, this.calendarCurrentView) : false;
|
|
159
|
-
}
|
|
160
122
|
}
|
|
161
123
|
CalendarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
162
124
|
CalendarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarService });
|
|
163
|
-
__decorate([
|
|
164
|
-
Pure,
|
|
165
|
-
__metadata("design:type", Function),
|
|
166
|
-
__metadata("design:paramtypes", [Date]),
|
|
167
|
-
__metadata("design:returntype", Boolean)
|
|
168
|
-
], CalendarService.prototype, "isDateDisabled", null);
|
|
169
125
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarService, decorators: [{
|
|
170
126
|
type: Injectable
|
|
171
|
-
}], propDecorators: { isDateDisabled: [] } });
|
|
172
|
-
|
|
173
|
-
class CalendarMonthService {
|
|
174
|
-
constructor() {
|
|
175
|
-
this.calendar = inject(CalendarService);
|
|
176
|
-
this.weekDays$ = this.calendar.activeDate$.pipe(map((date) => this.generateWeekDays(date)));
|
|
177
|
-
this.weeks$ = this.calendar.activeDate$.pipe(map((date) => this.generateWeeks(date)));
|
|
178
|
-
}
|
|
179
|
-
generateWeekDays(date) {
|
|
180
|
-
const firstWeekDay = startOfWeek(date, { weekStartsOn: 1 });
|
|
181
|
-
return Array.from({ length: 7 }, (_, i) => addDays(firstWeekDay, i));
|
|
182
|
-
}
|
|
183
|
-
generateWeeks(date) {
|
|
184
|
-
const startOfTheSelectedMonth = startOfMonth(date);
|
|
185
|
-
const endOfTheSelectedMonth = endOfMonth(date);
|
|
186
|
-
const startDate = startOfWeek(startOfTheSelectedMonth, { weekStartsOn: 1 });
|
|
187
|
-
const endDate = endOfWeek(endOfTheSelectedMonth);
|
|
188
|
-
const allWeeks = [];
|
|
189
|
-
let currentDate = startDate;
|
|
190
|
-
while (currentDate <= endDate) {
|
|
191
|
-
allWeeks.push(this.generateDaysForWeek(currentDate, date));
|
|
192
|
-
currentDate = addDays(currentDate, 7);
|
|
193
|
-
}
|
|
194
|
-
return allWeeks;
|
|
195
|
-
}
|
|
196
|
-
generateDaysForWeek(date, currentDate) {
|
|
197
|
-
return Array.from({ length: 7 }).map((_, i) => addDays(date, i), currentDate);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
CalendarMonthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
201
|
-
CalendarMonthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService });
|
|
202
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService, decorators: [{
|
|
203
|
-
type: Injectable
|
|
204
|
-
}] });
|
|
205
|
-
|
|
206
|
-
class CalendarYearService {
|
|
207
|
-
constructor() {
|
|
208
|
-
this.calendar = inject(CalendarService);
|
|
209
|
-
this.seasonSeparator = 3;
|
|
210
|
-
this.seasons$ = this.calendar.activeDate$.pipe(map((selectedDate) => this.generateSeasons(selectedDate)));
|
|
211
|
-
}
|
|
212
|
-
generateSeasons(date) {
|
|
213
|
-
const seasons = [];
|
|
214
|
-
const months = eachMonthOfInterval({
|
|
215
|
-
start: startOfYear(date),
|
|
216
|
-
end: endOfYear(date),
|
|
217
|
-
});
|
|
218
|
-
let index = 0;
|
|
219
|
-
while (index < months.length) {
|
|
220
|
-
seasons.push(months.slice(index, index + this.seasonSeparator));
|
|
221
|
-
index += this.seasonSeparator;
|
|
222
|
-
}
|
|
223
|
-
return seasons;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
CalendarYearService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
227
|
-
CalendarYearService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService });
|
|
228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService, decorators: [{
|
|
229
|
-
type: Injectable
|
|
230
|
-
}] });
|
|
231
|
-
|
|
232
|
-
class CalendarYearsService {
|
|
233
|
-
constructor() {
|
|
234
|
-
this.yearsSeparator = 3;
|
|
235
|
-
this.yearsLimit = 100;
|
|
236
|
-
this.date = new Date();
|
|
237
|
-
}
|
|
238
|
-
get years() {
|
|
239
|
-
const startDate = startOfYear(addYears(this.date, -this.yearsLimit));
|
|
240
|
-
const startYear = getYear(startDate);
|
|
241
|
-
const endDate = startOfYear(addYears(this.date, this.yearsLimit));
|
|
242
|
-
const endYear = getYear(endDate);
|
|
243
|
-
const years = [];
|
|
244
|
-
const yearRows = [];
|
|
245
|
-
for (let i = startYear; i <= endYear; i++) {
|
|
246
|
-
years.push(setYear(startDate, i));
|
|
247
|
-
}
|
|
248
|
-
let index = 0;
|
|
249
|
-
while (index < years.length) {
|
|
250
|
-
yearRows.push(years.slice(index, index + this.yearsSeparator));
|
|
251
|
-
index += this.yearsSeparator;
|
|
252
|
-
}
|
|
253
|
-
return yearRows;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
CalendarYearsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
257
|
-
CalendarYearsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService });
|
|
258
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService, decorators: [{
|
|
259
|
-
type: Injectable
|
|
260
127
|
}] });
|
|
261
128
|
|
|
262
129
|
let CalendarHeaderComponent = class CalendarHeaderComponent {
|
|
263
130
|
constructor() {
|
|
264
|
-
this.
|
|
131
|
+
this.isPreviousDisabled = false;
|
|
132
|
+
this.isNextDisabled = false;
|
|
265
133
|
this.element = injectElement();
|
|
134
|
+
this.minDate = null;
|
|
135
|
+
this.maxDate = null;
|
|
266
136
|
this.previous = new EventEmitter();
|
|
267
137
|
this.next = new EventEmitter();
|
|
268
138
|
this.changeView = new EventEmitter();
|
|
269
|
-
|
|
139
|
+
}
|
|
140
|
+
ngOnChanges(changes) {
|
|
141
|
+
if (hasChanged(changes, ['activeDate', 'calendarView', 'minDate', 'maxDate'], false)) {
|
|
142
|
+
this.isPreviousDisabled = this.minDate ? validatePreviousDateSet(this.minDate, this.activeDate, this.calendarView) : false;
|
|
143
|
+
this.isNextDisabled = this.maxDate ? validateNextDateSet(this.maxDate, this.activeDate, this.calendarView) : false;
|
|
144
|
+
}
|
|
270
145
|
}
|
|
271
146
|
previousClicked(event) {
|
|
272
|
-
|
|
147
|
+
if (this.isPreviousDisabled)
|
|
148
|
+
return;
|
|
149
|
+
this.previous.emit(event);
|
|
273
150
|
}
|
|
274
151
|
nextClicked(event) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
return this.calendar.activeDate$.pipe(map(() => this.isPreviousDisabled));
|
|
279
|
-
}
|
|
280
|
-
get handleIsNextDisabled$() {
|
|
281
|
-
return this.calendar.activeDate$.pipe(map(() => this.isNextDisabled));
|
|
282
|
-
}
|
|
283
|
-
get isPreviousDisabled() {
|
|
284
|
-
return this.calendar.isPreviousDateSetDisabled();
|
|
285
|
-
}
|
|
286
|
-
get isNextDisabled() {
|
|
287
|
-
return this.calendar.isNextDateSetDisabled();
|
|
152
|
+
if (this.isNextDisabled)
|
|
153
|
+
return;
|
|
154
|
+
this.next.emit(event);
|
|
288
155
|
}
|
|
289
156
|
};
|
|
290
157
|
CalendarHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
291
|
-
CalendarHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarHeaderComponent, isStandalone: true, selector: "odx-calendar-header", outputs: { previous: "previous", next: "next", changeView: "changeView" }, ngImport: i0, template: "<odx-action-group>\n <button odxButton (click)=\"previousClicked($event)\"
|
|
158
|
+
CalendarHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarHeaderComponent, isStandalone: true, selector: "odx-calendar-header", inputs: { activeDate: "activeDate", calendarView: "calendarView", minDate: "minDate", maxDate: "maxDate" }, outputs: { previous: "previous", next: "next", changeView: "changeView" }, usesOnChanges: true, ngImport: i0, template: "<odx-action-group>\n <button odxButton [disabled]=\"isPreviousDisabled\" (click)=\"previousClicked($event)\">\n <odx-icon name=\"chevron-left\"></odx-icon>\n </button>\n\n <button odxButton class=\"odx-calendar-header__title\" (click)=\"changeView.emit()\">\n <ng-content></ng-content>\n </button>\n\n <button odxButton [disabled]=\"isNextDisabled\" (click)=\"nextClicked($event)\">\n <odx-icon name=\"chevron-right\"></odx-icon>\n </button>\n</odx-action-group>\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i2.DisabledController, selector: "[disabled]", inputs: ["disabled"] }, { kind: "component", type: ActionGroupComponent, selector: "odx-action-group", inputs: ["reverse"] }, { kind: "component", type: ButtonComponent, selector: "button[odxButton], a[odxButton]", inputs: ["variant", "size"] }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
292
159
|
CalendarHeaderComponent = __decorate([
|
|
293
160
|
CSSComponent('calendar-header')
|
|
294
161
|
], CalendarHeaderComponent);
|
|
295
162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarHeaderComponent, decorators: [{
|
|
296
163
|
type: Component,
|
|
297
|
-
args: [{ selector: 'odx-calendar-header', standalone: true, imports: [CoreModule, ActionGroupComponent, ButtonComponent, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<odx-action-group>\n <button odxButton (click)=\"previousClicked($event)\"
|
|
298
|
-
}], propDecorators: {
|
|
164
|
+
args: [{ selector: 'odx-calendar-header', standalone: true, imports: [CoreModule, ActionGroupComponent, ButtonComponent, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<odx-action-group>\n <button odxButton [disabled]=\"isPreviousDisabled\" (click)=\"previousClicked($event)\">\n <odx-icon name=\"chevron-left\"></odx-icon>\n </button>\n\n <button odxButton class=\"odx-calendar-header__title\" (click)=\"changeView.emit()\">\n <ng-content></ng-content>\n </button>\n\n <button odxButton [disabled]=\"isNextDisabled\" (click)=\"nextClicked($event)\">\n <odx-icon name=\"chevron-right\"></odx-icon>\n </button>\n</odx-action-group>\n" }]
|
|
165
|
+
}], propDecorators: { activeDate: [{
|
|
166
|
+
type: Input
|
|
167
|
+
}], calendarView: [{
|
|
168
|
+
type: Input
|
|
169
|
+
}], minDate: [{
|
|
170
|
+
type: Input
|
|
171
|
+
}], maxDate: [{
|
|
172
|
+
type: Input
|
|
173
|
+
}], previous: [{
|
|
299
174
|
type: Output
|
|
300
175
|
}], next: [{
|
|
301
176
|
type: Output
|
|
@@ -303,6 +178,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
303
178
|
type: Output
|
|
304
179
|
}] } });
|
|
305
180
|
|
|
181
|
+
const { CalendarConfig, CalendarDefaultConfig, injectCalendarConfig, provideCalendarConfig } = createConfigTokens('Calendar', '@odx/angular/components/calendar', {
|
|
182
|
+
monthYearLabel: 'LLLL yyyy',
|
|
183
|
+
monthLabel: 'LLL',
|
|
184
|
+
weekLabel: 'EEEEE',
|
|
185
|
+
dayLabel: 'd',
|
|
186
|
+
yearLabel: 'yyyy',
|
|
187
|
+
dayA11yLabel: 'MMMM dd, yyyy',
|
|
188
|
+
monthA11yLabel: 'MMMM, yyyy',
|
|
189
|
+
yearA11yLabel: 'yyyy',
|
|
190
|
+
displayAdjacentDays: true,
|
|
191
|
+
locale: new BehaviorSubject(enGB),
|
|
192
|
+
yearView: {
|
|
193
|
+
itemsPerRow: 3,
|
|
194
|
+
},
|
|
195
|
+
yearsView: {
|
|
196
|
+
itemsPerRow: 3,
|
|
197
|
+
padding: 100,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
|
|
306
201
|
class DateLabelPipe {
|
|
307
202
|
constructor() {
|
|
308
203
|
this.config = injectCalendarConfig();
|
|
@@ -314,28 +209,28 @@ class DateLabelPipe {
|
|
|
314
209
|
}
|
|
315
210
|
}
|
|
316
211
|
DateLabelPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
317
|
-
DateLabelPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, isStandalone: true, name: "odxDateLabel"
|
|
212
|
+
DateLabelPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, isStandalone: true, name: "odxDateLabel" });
|
|
318
213
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, decorators: [{
|
|
319
214
|
type: Pipe,
|
|
320
215
|
args: [{
|
|
321
|
-
pure: false,
|
|
322
|
-
name: 'odxDateLabel',
|
|
323
216
|
standalone: true,
|
|
217
|
+
name: 'odxDateLabel',
|
|
218
|
+
pure: true,
|
|
324
219
|
}]
|
|
325
220
|
}] });
|
|
326
221
|
|
|
327
222
|
let CalendarCellDirective = class CalendarCellDirective {
|
|
328
223
|
constructor() {
|
|
329
224
|
this.disabledController = DisabledController.inject();
|
|
225
|
+
this.config = injectCalendarConfig();
|
|
226
|
+
this.dateLabelPipe = inject(DateLabelPipe);
|
|
330
227
|
this.isActive = false;
|
|
331
228
|
this.isSelected = false;
|
|
332
229
|
this.isHidden = false;
|
|
230
|
+
this.ariaLabel = '';
|
|
333
231
|
this.isCurrent = false;
|
|
334
232
|
this.adjacent = false;
|
|
335
233
|
this.element = injectElement();
|
|
336
|
-
this.dateLabelPipe = inject(DateLabelPipe);
|
|
337
|
-
this.config = injectCalendarConfig();
|
|
338
|
-
this.calendarView = CalendarViewEnum.Month;
|
|
339
234
|
this.activeDate = null;
|
|
340
235
|
this.selectedDate = null;
|
|
341
236
|
}
|
|
@@ -344,12 +239,13 @@ let CalendarCellDirective = class CalendarCellDirective {
|
|
|
344
239
|
return !!((_a = this.disabledController) === null || _a === void 0 ? void 0 : _a.disabled);
|
|
345
240
|
}
|
|
346
241
|
ngOnChanges(changes) {
|
|
347
|
-
if (hasChanged(changes, ['date'], false)) {
|
|
242
|
+
if (hasChanged(changes, ['date', 'calendarView'], false)) {
|
|
243
|
+
this.ariaLabel = this.dateLabelPipe.transform(this.date, getA11yLabel(this.calendarView, this.config));
|
|
348
244
|
this.isCurrent = checkIdenticalDate(this.date, new Date(), this.calendarView);
|
|
349
245
|
}
|
|
350
246
|
if (this.activeDate && hasChanged(changes, ['date', 'activeDate'], false)) {
|
|
351
247
|
this.isActive = checkIdenticalDate(this.date, this.activeDate, this.calendarView);
|
|
352
|
-
if (this.calendarView ===
|
|
248
|
+
if (this.calendarView === CalendarView.Month) {
|
|
353
249
|
this.adjacent = !isSameMonth(this.date, this.activeDate);
|
|
354
250
|
this.isHidden = this.adjacent && !this.config.displayAdjacentDays;
|
|
355
251
|
}
|
|
@@ -361,10 +257,6 @@ let CalendarCellDirective = class CalendarCellDirective {
|
|
|
361
257
|
deferFn(() => this.element.nativeElement.focus());
|
|
362
258
|
}
|
|
363
259
|
}
|
|
364
|
-
get ariaLabel() {
|
|
365
|
-
const dateFormat = getA11yLabel(this.calendarView, this.config);
|
|
366
|
-
return this.dateLabelPipe.transform(this.date, dateFormat);
|
|
367
|
-
}
|
|
368
260
|
};
|
|
369
261
|
CalendarCellDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
370
262
|
CalendarCellDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CalendarCellDirective, isStandalone: true, selector: "[odxCalendarCell]", inputs: { date: ["odxCalendarCell", "date"], calendarView: ["odxCalendarCellCalendarView", "calendarView"], activeDate: ["odxCalendarCellActiveDate", "activeDate"], selectedDate: ["odxCalendarCellSelectedDate", "selectedDate"] }, host: { properties: { "class.is-disabled": "isDisabled", "class.is-selected": "isSelected", "attr.hidden": "isHidden || null", "tabindex": "isActive ? 0 : -1", "attr.aria-label": "ariaLabel", "attr.aria-disabled": "isDisabled", "attr.type": "\"button\"" } }, providers: [DisabledController.connect(), DateLabelPipe], usesOnChanges: true, ngImport: i0 });
|
|
@@ -414,19 +306,18 @@ class CalendarViewDirective {
|
|
|
414
306
|
this.takeUntilDestroyed = untilDestroyed();
|
|
415
307
|
this.calendar = inject(CalendarService);
|
|
416
308
|
this.config = injectCalendarConfig();
|
|
309
|
+
this.trackByIndex = trackByIndex;
|
|
417
310
|
this.element = injectElement();
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
trackByIndex(index) {
|
|
423
|
-
return index;
|
|
311
|
+
this.selectedDate = null;
|
|
312
|
+
this.minDate = null;
|
|
313
|
+
this.maxDate = null;
|
|
314
|
+
this.filterFn = null;
|
|
424
315
|
}
|
|
425
316
|
isDateDisabled(value) {
|
|
426
|
-
return this.
|
|
317
|
+
return isDateDisabled(value, this.currentView, this.minDate, this.maxDate, this.filterFn);
|
|
427
318
|
}
|
|
428
319
|
changeView() {
|
|
429
|
-
this.calendar.changeView(this.
|
|
320
|
+
this.calendar.changeView(this.nextView);
|
|
430
321
|
}
|
|
431
322
|
updateActiveDate(event, date) {
|
|
432
323
|
event.preventDefault();
|
|
@@ -435,20 +326,121 @@ class CalendarViewDirective {
|
|
|
435
326
|
}
|
|
436
327
|
}
|
|
437
328
|
CalendarViewDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarViewDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
438
|
-
CalendarViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CalendarViewDirective, isStandalone: true, ngImport: i0 });
|
|
329
|
+
CalendarViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CalendarViewDirective, isStandalone: true, inputs: { activeDate: "activeDate", selectedDate: "selectedDate", minDate: "minDate", maxDate: "maxDate", filterFn: "filterFn" }, ngImport: i0 });
|
|
439
330
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarViewDirective, decorators: [{
|
|
440
331
|
type: Directive,
|
|
441
332
|
args: [{
|
|
442
333
|
standalone: true,
|
|
443
334
|
}]
|
|
335
|
+
}], propDecorators: { activeDate: [{
|
|
336
|
+
type: Input
|
|
337
|
+
}], selectedDate: [{
|
|
338
|
+
type: Input
|
|
339
|
+
}], minDate: [{
|
|
340
|
+
type: Input
|
|
341
|
+
}], maxDate: [{
|
|
342
|
+
type: Input
|
|
343
|
+
}], filterFn: [{
|
|
344
|
+
type: Input
|
|
345
|
+
}] } });
|
|
346
|
+
|
|
347
|
+
class CalendarMonthService {
|
|
348
|
+
constructor() {
|
|
349
|
+
this.calendar = inject(CalendarService);
|
|
350
|
+
this.weekDays$ = this.calendar.activeDate$.pipe(map((date) => this.generateWeekDays(date)));
|
|
351
|
+
this.weeks$ = this.calendar.activeDate$.pipe(map((date) => this.generateWeeks(date)));
|
|
352
|
+
}
|
|
353
|
+
generateWeekDays(date) {
|
|
354
|
+
const firstWeekDay = startOfWeek(date, { weekStartsOn: 1 });
|
|
355
|
+
return Array.from({ length: 7 }, (_, i) => addDays(firstWeekDay, i));
|
|
356
|
+
}
|
|
357
|
+
generateWeeks(date) {
|
|
358
|
+
const startOfTheSelectedMonth = startOfMonth(date);
|
|
359
|
+
const endOfTheSelectedMonth = endOfMonth(date);
|
|
360
|
+
const startDate = startOfWeek(startOfTheSelectedMonth, { weekStartsOn: 1 });
|
|
361
|
+
const endDate = endOfWeek(endOfTheSelectedMonth);
|
|
362
|
+
const allWeeks = [];
|
|
363
|
+
let currentDate = startDate;
|
|
364
|
+
while (currentDate <= endDate) {
|
|
365
|
+
allWeeks.push(this.generateDaysForWeek(currentDate, date));
|
|
366
|
+
currentDate = addDays(currentDate, 7);
|
|
367
|
+
}
|
|
368
|
+
return allWeeks;
|
|
369
|
+
}
|
|
370
|
+
generateDaysForWeek(date, currentDate) {
|
|
371
|
+
return Array.from({ length: 7 }).map((_, i) => addDays(date, i), currentDate);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
CalendarMonthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
375
|
+
CalendarMonthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService });
|
|
376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService, decorators: [{
|
|
377
|
+
type: Injectable
|
|
378
|
+
}] });
|
|
379
|
+
|
|
380
|
+
class CalendarYearService {
|
|
381
|
+
constructor() {
|
|
382
|
+
this.config = injectCalendarConfig();
|
|
383
|
+
this.calendar = inject(CalendarService);
|
|
384
|
+
this.seasons$ = this.calendar.activeDate$.pipe(map((selectedDate) => this.generateSeasons(selectedDate)));
|
|
385
|
+
}
|
|
386
|
+
generateSeasons(date) {
|
|
387
|
+
const { itemsPerRow } = this.config.yearView;
|
|
388
|
+
const seasons = [];
|
|
389
|
+
const months = eachMonthOfInterval({
|
|
390
|
+
start: startOfYear(date),
|
|
391
|
+
end: endOfYear(date),
|
|
392
|
+
});
|
|
393
|
+
let index = 0;
|
|
394
|
+
while (index < months.length) {
|
|
395
|
+
seasons.push(months.slice(index, index + itemsPerRow));
|
|
396
|
+
index += itemsPerRow;
|
|
397
|
+
}
|
|
398
|
+
return seasons;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
CalendarYearService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
402
|
+
CalendarYearService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService });
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService, decorators: [{
|
|
404
|
+
type: Injectable
|
|
405
|
+
}] });
|
|
406
|
+
|
|
407
|
+
class CalendarYearsService {
|
|
408
|
+
constructor() {
|
|
409
|
+
this.config = injectCalendarConfig();
|
|
410
|
+
this.years$ = defer(() => of(this.generateYears()));
|
|
411
|
+
}
|
|
412
|
+
generateYears() {
|
|
413
|
+
const { itemsPerRow, padding } = this.config.yearsView;
|
|
414
|
+
const now = Date.now();
|
|
415
|
+
const startDate = startOfYear(addYears(now, -padding));
|
|
416
|
+
const startYear = getYear(startDate);
|
|
417
|
+
const endDate = startOfYear(addYears(now, padding));
|
|
418
|
+
const endYear = getYear(endDate);
|
|
419
|
+
const years = [];
|
|
420
|
+
const yearRows = [];
|
|
421
|
+
for (let i = startYear; i <= endYear; i++) {
|
|
422
|
+
years.push(setYear(startDate, i));
|
|
423
|
+
}
|
|
424
|
+
let index = 0;
|
|
425
|
+
while (index < years.length) {
|
|
426
|
+
yearRows.push(years.slice(index, index + itemsPerRow));
|
|
427
|
+
index += itemsPerRow;
|
|
428
|
+
}
|
|
429
|
+
return yearRows;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
CalendarYearsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
433
|
+
CalendarYearsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService });
|
|
434
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService, decorators: [{
|
|
435
|
+
type: Injectable
|
|
444
436
|
}] });
|
|
445
437
|
|
|
446
438
|
let CalendarMonthComponent = class CalendarMonthComponent extends CalendarViewDirective {
|
|
447
439
|
constructor() {
|
|
448
440
|
super(...arguments);
|
|
449
441
|
this.calendarMonth = inject(CalendarMonthService);
|
|
450
|
-
this.
|
|
451
|
-
this.
|
|
442
|
+
this.nextView = CalendarView.Years;
|
|
443
|
+
this.currentView = CalendarView.Month;
|
|
452
444
|
this.selectedChange = new EventEmitter();
|
|
453
445
|
}
|
|
454
446
|
previousDay(event) {
|
|
@@ -477,13 +469,13 @@ let CalendarMonthComponent = class CalendarMonthComponent extends CalendarViewDi
|
|
|
477
469
|
}
|
|
478
470
|
};
|
|
479
471
|
CalendarMonthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
480
|
-
CalendarMonthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarMonthComponent, isStandalone: true, selector: "odx-calendar-month", outputs: { selectedChange: "selectedChange" }, providers: [CalendarMonthService], usesInheritance: true, ngImport: i0, template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead>\n <tr>\n <th colspan=\"7\">\n <odx-calendar-header
|
|
472
|
+
CalendarMonthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarMonthComponent, isStandalone: true, selector: "odx-calendar-month", outputs: { selectedChange: "selectedChange" }, providers: [CalendarMonthService], usesInheritance: true, ngImport: i0, template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead>\n <tr>\n <th colspan=\"7\">\n <odx-calendar-header\n [calendarView]=\"currentView\"\n [activeDate]=\"activeDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n (previous)=\"previousMonth($event)\"\n (next)=\"nextMonth($event)\"\n (changeView)=\"changeView()\"\n >\n {{ activeDate | odxDateLabel: config.monthYearLabel }}\n </odx-calendar-header>\n </th>\n </tr>\n\n <tr class=\"odx-calendar__weekdays\">\n <td *ngFor=\"let day of calendarMonth.weekDays$ | async\">\n {{ day | odxDateLabel: config.weekLabel }}\n </td>\n </tr>\n </thead>\n\n <tbody\n class=\"odx-calendar__body\"\n (keydown.ArrowLeft)=\"previousDay($event)\"\n (keydown.ArrowRight)=\"nextDay($event)\"\n (keydown.ArrowUp)=\"previousWeek($event)\"\n (keydown.ArrowDown)=\"nextWeek($event)\"\n (keydown.PageUp)=\"previousMonth($event)\"\n (keydown.PageDown)=\"nextMonth($event)\"\n >\n <tr *ngFor=\"let week of calendarMonth.weeks$ | async; trackBy: trackByIndex\">\n <td role=\"gridcell\" *ngFor=\"let day of week; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(day)\"\n [odxCalendarCell]=\"day\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellCalendarView]=\"currentView\"\n [odxCalendarCellSelectedDate]=\"selectedDate\"\n (click)=\"selectDate(day)\"\n >\n {{ day | odxDateLabel: config.dayLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "directive", type: i2.DisabledController, selector: "[disabled]", inputs: ["disabled"] }, { kind: "directive", type: CalendarCellDirective, selector: "[odxCalendarCell]", inputs: ["odxCalendarCell", "odxCalendarCellCalendarView", "odxCalendarCellActiveDate", "odxCalendarCellSelectedDate"] }, { kind: "component", type: CalendarHeaderComponent, selector: "odx-calendar-header", inputs: ["activeDate", "calendarView", "minDate", "maxDate"], outputs: ["previous", "next", "changeView"] }, { kind: "pipe", type: DateLabelPipe, name: "odxDateLabel" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
481
473
|
CalendarMonthComponent = __decorate([
|
|
482
474
|
CSSComponent('calendar-month')
|
|
483
475
|
], CalendarMonthComponent);
|
|
484
476
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthComponent, decorators: [{
|
|
485
477
|
type: Component,
|
|
486
|
-
args: [{ selector: 'odx-calendar-month', standalone: true, imports: [CoreModule, CalendarCellDirective, CalendarHeaderComponent, DateLabelPipe], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarMonthService], template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead>\n <tr>\n <th colspan=\"7\">\n <odx-calendar-header
|
|
478
|
+
args: [{ selector: 'odx-calendar-month', standalone: true, imports: [CoreModule, CalendarCellDirective, CalendarHeaderComponent, DateLabelPipe], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarMonthService], template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead>\n <tr>\n <th colspan=\"7\">\n <odx-calendar-header\n [calendarView]=\"currentView\"\n [activeDate]=\"activeDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n (previous)=\"previousMonth($event)\"\n (next)=\"nextMonth($event)\"\n (changeView)=\"changeView()\"\n >\n {{ activeDate | odxDateLabel: config.monthYearLabel }}\n </odx-calendar-header>\n </th>\n </tr>\n\n <tr class=\"odx-calendar__weekdays\">\n <td *ngFor=\"let day of calendarMonth.weekDays$ | async\">\n {{ day | odxDateLabel: config.weekLabel }}\n </td>\n </tr>\n </thead>\n\n <tbody\n class=\"odx-calendar__body\"\n (keydown.ArrowLeft)=\"previousDay($event)\"\n (keydown.ArrowRight)=\"nextDay($event)\"\n (keydown.ArrowUp)=\"previousWeek($event)\"\n (keydown.ArrowDown)=\"nextWeek($event)\"\n (keydown.PageUp)=\"previousMonth($event)\"\n (keydown.PageDown)=\"nextMonth($event)\"\n >\n <tr *ngFor=\"let week of calendarMonth.weeks$ | async; trackBy: trackByIndex\">\n <td role=\"gridcell\" *ngFor=\"let day of week; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(day)\"\n [odxCalendarCell]=\"day\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellCalendarView]=\"currentView\"\n [odxCalendarCellSelectedDate]=\"selectedDate\"\n (click)=\"selectDate(day)\"\n >\n {{ day | odxDateLabel: config.dayLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n" }]
|
|
487
479
|
}], propDecorators: { selectedChange: [{
|
|
488
480
|
type: Output
|
|
489
481
|
}] } });
|
|
@@ -492,8 +484,8 @@ let CalendarYearComponent = class CalendarYearComponent extends CalendarViewDire
|
|
|
492
484
|
constructor() {
|
|
493
485
|
super(...arguments);
|
|
494
486
|
this.calendarYear = inject(CalendarYearService);
|
|
495
|
-
this.
|
|
496
|
-
this.
|
|
487
|
+
this.nextView = CalendarView.Month;
|
|
488
|
+
this.currentView = CalendarView.Year;
|
|
497
489
|
}
|
|
498
490
|
previousMonth(event) {
|
|
499
491
|
this.updateActiveDate(event, subMonths(this.activeDate, 1));
|
|
@@ -516,19 +508,19 @@ let CalendarYearComponent = class CalendarYearComponent extends CalendarViewDire
|
|
|
516
508
|
selectDate(value) {
|
|
517
509
|
if (this.isDateDisabled(value))
|
|
518
510
|
return;
|
|
519
|
-
const date = setMonth(this.
|
|
511
|
+
const date = setMonth(this.activeDate, getMonth(value));
|
|
520
512
|
this.calendar.selectDate(date);
|
|
521
513
|
this.changeView();
|
|
522
514
|
}
|
|
523
515
|
};
|
|
524
516
|
CalendarYearComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
525
|
-
CalendarYearComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarYearComponent, isStandalone: true, selector: "odx-calendar-year", providers: [CalendarYearService], usesInheritance: true, ngImport: i0, template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead>\n <tr>\n <th colspan=\"3\">\n <odx-calendar-header
|
|
517
|
+
CalendarYearComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarYearComponent, isStandalone: true, selector: "odx-calendar-year", providers: [CalendarYearService], usesInheritance: true, ngImport: i0, template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead>\n <tr>\n <th colspan=\"3\">\n <odx-calendar-header\n (previous)=\"previousYear($event)\"\n [calendarView]=\"currentView\"\n [activeDate]=\"activeDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n (next)=\"nextYear($event)\"\n (changeView)=\"changeView()\"\n >\n {{ activeDate | odxDateLabel: config.yearLabel }}\n </odx-calendar-header>\n </th>\n </tr>\n </thead>\n\n <tbody\n class=\"odx-calendar__body\"\n (keydown.ArrowLeft)=\"previousMonth($event)\"\n (keydown.ArrowRight)=\"nextMonth($event)\"\n (keydown.ArrowUp)=\"previousSeason($event)\"\n (keydown.ArrowDown)=\"nextSeason($event)\"\n (keydown.PageDown)=\"nextYear($event)\"\n (keydown.PageUp)=\"previousYear($event)\"\n >\n <tr class=\"odx-calendar__season\" *ngFor=\"let season of calendarYear.seasons$ | async; trackBy: trackByIndex\">\n <td role=\"gridcell\" *ngFor=\"let month of season; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(month)\"\n [odxCalendarCell]=\"month\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellCalendarView]=\"currentView\"\n [odxCalendarCellSelectedDate]=\"selectedDate\"\n (click)=\"selectDate(month)\"\n >\n {{ month | odxDateLabel: config.monthLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "directive", type: i2.DisabledController, selector: "[disabled]", inputs: ["disabled"] }, { kind: "directive", type: CalendarCellDirective, selector: "[odxCalendarCell]", inputs: ["odxCalendarCell", "odxCalendarCellCalendarView", "odxCalendarCellActiveDate", "odxCalendarCellSelectedDate"] }, { kind: "component", type: CalendarHeaderComponent, selector: "odx-calendar-header", inputs: ["activeDate", "calendarView", "minDate", "maxDate"], outputs: ["previous", "next", "changeView"] }, { kind: "pipe", type: DateLabelPipe, name: "odxDateLabel" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
526
518
|
CalendarYearComponent = __decorate([
|
|
527
519
|
CSSComponent('calendar-year')
|
|
528
520
|
], CalendarYearComponent);
|
|
529
521
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearComponent, decorators: [{
|
|
530
522
|
type: Component,
|
|
531
|
-
args: [{ selector: 'odx-calendar-year', standalone: true, imports: [CoreModule, CalendarCellDirective, CalendarHeaderComponent, DateLabelPipe], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarYearService], template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead>\n <tr>\n <th colspan=\"3\">\n <odx-calendar-header
|
|
523
|
+
args: [{ selector: 'odx-calendar-year', standalone: true, imports: [CoreModule, CalendarCellDirective, CalendarHeaderComponent, DateLabelPipe], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarYearService], template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead>\n <tr>\n <th colspan=\"3\">\n <odx-calendar-header\n (previous)=\"previousYear($event)\"\n [calendarView]=\"currentView\"\n [activeDate]=\"activeDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n (next)=\"nextYear($event)\"\n (changeView)=\"changeView()\"\n >\n {{ activeDate | odxDateLabel: config.yearLabel }}\n </odx-calendar-header>\n </th>\n </tr>\n </thead>\n\n <tbody\n class=\"odx-calendar__body\"\n (keydown.ArrowLeft)=\"previousMonth($event)\"\n (keydown.ArrowRight)=\"nextMonth($event)\"\n (keydown.ArrowUp)=\"previousSeason($event)\"\n (keydown.ArrowDown)=\"nextSeason($event)\"\n (keydown.PageDown)=\"nextYear($event)\"\n (keydown.PageUp)=\"previousYear($event)\"\n >\n <tr class=\"odx-calendar__season\" *ngFor=\"let season of calendarYear.seasons$ | async; trackBy: trackByIndex\">\n <td role=\"gridcell\" *ngFor=\"let month of season; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(month)\"\n [odxCalendarCell]=\"month\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellCalendarView]=\"currentView\"\n [odxCalendarCellSelectedDate]=\"selectedDate\"\n (click)=\"selectDate(month)\"\n >\n {{ month | odxDateLabel: config.monthLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n" }]
|
|
532
524
|
}] });
|
|
533
525
|
|
|
534
526
|
let CalendarYearsComponent = class CalendarYearsComponent extends CalendarViewDirective {
|
|
@@ -536,8 +528,8 @@ let CalendarYearsComponent = class CalendarYearsComponent extends CalendarViewDi
|
|
|
536
528
|
super(...arguments);
|
|
537
529
|
this.document = inject(DOCUMENT);
|
|
538
530
|
this.calendarYears = inject(CalendarYearsService);
|
|
539
|
-
this.
|
|
540
|
-
this.
|
|
531
|
+
this.nextView = CalendarView.Year;
|
|
532
|
+
this.currentView = CalendarView.Years;
|
|
541
533
|
}
|
|
542
534
|
ngAfterViewInit() {
|
|
543
535
|
deferFn(() => this.scrollCurrentYearIntoView());
|
|
@@ -557,7 +549,7 @@ let CalendarYearsComponent = class CalendarYearsComponent extends CalendarViewDi
|
|
|
557
549
|
selectDate(value) {
|
|
558
550
|
if (this.isDateDisabled(value))
|
|
559
551
|
return;
|
|
560
|
-
const date = setYear(this.
|
|
552
|
+
const date = setYear(this.activeDate, getYear(value));
|
|
561
553
|
this.calendar.selectDate(date);
|
|
562
554
|
this.changeView();
|
|
563
555
|
}
|
|
@@ -571,48 +563,40 @@ let CalendarYearsComponent = class CalendarYearsComponent extends CalendarViewDi
|
|
|
571
563
|
}
|
|
572
564
|
};
|
|
573
565
|
CalendarYearsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
574
|
-
CalendarYearsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarYearsComponent, isStandalone: true, selector: "odx-calendar-years", providers: [CalendarYearsService], usesInheritance: true, ngImport: i0, template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead aria-hidden=\"true\">\n <th></th>\n </thead>\n\n <tbody\n
|
|
566
|
+
CalendarYearsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarYearsComponent, isStandalone: true, selector: "odx-calendar-years", providers: [CalendarYearsService], usesInheritance: true, ngImport: i0, template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\" *ngrxLet=\"calendar.activeDate$ as activeDate\">\n <thead aria-hidden=\"true\">\n <th></th>\n </thead>\n\n <tbody\n class=\"odx-calendar__body\"\n (keydown.ArrowLeft)=\"previousYear($event)\"\n (keydown.ArrowRight)=\"nextYear($event)\"\n (keydown.ArrowUp)=\"previousRow($event)\"\n (keydown.ArrowDown)=\"nextRow($event)\"\n >\n <tr class=\"odx-calendar__year-row\" *ngFor=\"let yearRow of calendarYears.years$ | async; trackBy: trackByIndex\">\n <td role=\"gridcell\" *ngFor=\"let year of yearRow; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(year)\"\n [odxCalendarCell]=\"year\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellCalendarView]=\"currentView\"\n [odxCalendarCellSelectedDate]=\"calendar.selectedDate$ | async\"\n (click)=\"selectDate(year)\"\n >\n {{ year | odxDateLabel: config.yearLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "directive", type: i2$1.LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "directive", type: i2.DisabledController, selector: "[disabled]", inputs: ["disabled"] }, { kind: "directive", type: CalendarCellDirective, selector: "[odxCalendarCell]", inputs: ["odxCalendarCell", "odxCalendarCellCalendarView", "odxCalendarCellActiveDate", "odxCalendarCellSelectedDate"] }, { kind: "pipe", type: DateLabelPipe, name: "odxDateLabel" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
575
567
|
CalendarYearsComponent = __decorate([
|
|
576
568
|
CSSComponent('calendar-years')
|
|
577
569
|
], CalendarYearsComponent);
|
|
578
570
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsComponent, decorators: [{
|
|
579
571
|
type: Component,
|
|
580
|
-
args: [{ selector: 'odx-calendar-years', standalone: true, imports: [CoreModule, CalendarCellDirective, CalendarHeaderComponent, DateLabelPipe], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarYearsService], template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\">\n <thead aria-hidden=\"true\">\n <th></th>\n </thead>\n\n <tbody\n
|
|
572
|
+
args: [{ selector: 'odx-calendar-years', standalone: true, imports: [CoreModule, CalendarCellDirective, CalendarHeaderComponent, DateLabelPipe], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarYearsService], template: "<table class=\"odx-calendar__table\" role=\"grid\" aria-describedby=\"odx-calendar\" *ngrxLet=\"calendar.activeDate$ as activeDate\">\n <thead aria-hidden=\"true\">\n <th></th>\n </thead>\n\n <tbody\n class=\"odx-calendar__body\"\n (keydown.ArrowLeft)=\"previousYear($event)\"\n (keydown.ArrowRight)=\"nextYear($event)\"\n (keydown.ArrowUp)=\"previousRow($event)\"\n (keydown.ArrowDown)=\"nextRow($event)\"\n >\n <tr class=\"odx-calendar__year-row\" *ngFor=\"let yearRow of calendarYears.years$ | async; trackBy: trackByIndex\">\n <td role=\"gridcell\" *ngFor=\"let year of yearRow; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(year)\"\n [odxCalendarCell]=\"year\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellCalendarView]=\"currentView\"\n [odxCalendarCellSelectedDate]=\"calendar.selectedDate$ | async\"\n (click)=\"selectDate(year)\"\n >\n {{ year | odxDateLabel: config.yearLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n" }]
|
|
581
573
|
}] });
|
|
582
574
|
|
|
583
575
|
let CalendarComponent = class CalendarComponent {
|
|
584
576
|
constructor() {
|
|
577
|
+
this.CalendarView = CalendarView;
|
|
585
578
|
this.calendar = inject(CalendarService);
|
|
586
579
|
this.element = injectElement();
|
|
587
|
-
this.
|
|
580
|
+
this.selectedDate = null;
|
|
588
581
|
this.minDate = null;
|
|
589
582
|
this.maxDate = null;
|
|
590
583
|
this.filterFn = null;
|
|
591
|
-
this.
|
|
592
|
-
}
|
|
593
|
-
set selectedDate(value) {
|
|
594
|
-
this.calendar.selectDate(value);
|
|
584
|
+
this.selectedDateChange = new EventEmitter();
|
|
595
585
|
}
|
|
596
586
|
ngOnChanges(changes) {
|
|
597
|
-
if (hasChanged(changes, '
|
|
598
|
-
this.calendar.
|
|
599
|
-
}
|
|
600
|
-
if (hasChanged(changes, 'maxDate', false)) {
|
|
601
|
-
this.calendar.maxDate = this.maxDate;
|
|
602
|
-
}
|
|
603
|
-
if (hasChanged(changes, 'filterFn', false)) {
|
|
604
|
-
this.calendar.filterFn = this.filterFn;
|
|
587
|
+
if (hasChanged(changes, 'selectedDate', false)) {
|
|
588
|
+
this.calendar.selectDate(this.selectedDate);
|
|
605
589
|
}
|
|
606
590
|
}
|
|
607
591
|
};
|
|
608
592
|
CalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
609
|
-
CalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarComponent, isStandalone: true, selector: "odx-calendar", inputs: { selectedDate: "selectedDate", minDate: "minDate", maxDate: "maxDate", filterFn: "filterFn" }, outputs: {
|
|
593
|
+
CalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CalendarComponent, isStandalone: true, selector: "odx-calendar", inputs: { selectedDate: "selectedDate", minDate: "minDate", maxDate: "maxDate", filterFn: "filterFn" }, outputs: { selectedDateChange: "selectedDateChange" }, providers: [CalendarService], usesOnChanges: true, ngImport: i0, template: "<ng-template [ngrxLet]=\"{ activeDate: calendar.activeDate$, calendarView: calendar.calendarView$, selectedDate: calendar.selectedDate$ }\" let-vm>\n <ng-container [ngSwitch]=\"vm.calendarView\">\n <odx-calendar-year\n [activeDate]=\"vm.activeDate\"\n [selectedDate]=\"vm.selectedDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [filterFn]=\"filterFn\"\n *ngSwitchCase=\"CalendarView.Year\"\n ></odx-calendar-year>\n <odx-calendar-years\n [activeDate]=\"vm.activeDate\"\n [selectedDate]=\"vm.selectedDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [filterFn]=\"filterFn\"\n *ngSwitchCase=\"CalendarView.Years\"\n ></odx-calendar-years>\n <odx-calendar-month\n [activeDate]=\"vm.activeDate\"\n [selectedDate]=\"vm.selectedDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [filterFn]=\"filterFn\"\n (selectedChange)=\"selectedDateChange.emit($event)\"\n *ngSwitchDefault\n ></odx-calendar-month>\n </ng-container>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i2$1.LetDirective, selector: "[ngrxLet]", inputs: ["ngrxLet", "ngrxLetSuspenseTpl"] }, { kind: "ngmodule", type: A11yModule }, { kind: "component", type: CalendarMonthComponent, selector: "odx-calendar-month", outputs: ["selectedChange"] }, { kind: "component", type: CalendarYearComponent, selector: "odx-calendar-year" }, { kind: "component", type: CalendarYearsComponent, selector: "odx-calendar-years" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
610
594
|
CalendarComponent = __decorate([
|
|
611
595
|
CSSComponent('calendar')
|
|
612
596
|
], CalendarComponent);
|
|
613
597
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarComponent, decorators: [{
|
|
614
598
|
type: Component,
|
|
615
|
-
args: [{ selector: 'odx-calendar', standalone: true, imports: [CoreModule, A11yModule, CalendarMonthComponent, CalendarYearComponent, CalendarYearsComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarService], template: "<ng-
|
|
599
|
+
args: [{ selector: 'odx-calendar', standalone: true, imports: [CoreModule, A11yModule, CalendarMonthComponent, CalendarYearComponent, CalendarYearsComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarService], template: "<ng-template [ngrxLet]=\"{ activeDate: calendar.activeDate$, calendarView: calendar.calendarView$, selectedDate: calendar.selectedDate$ }\" let-vm>\n <ng-container [ngSwitch]=\"vm.calendarView\">\n <odx-calendar-year\n [activeDate]=\"vm.activeDate\"\n [selectedDate]=\"vm.selectedDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [filterFn]=\"filterFn\"\n *ngSwitchCase=\"CalendarView.Year\"\n ></odx-calendar-year>\n <odx-calendar-years\n [activeDate]=\"vm.activeDate\"\n [selectedDate]=\"vm.selectedDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [filterFn]=\"filterFn\"\n *ngSwitchCase=\"CalendarView.Years\"\n ></odx-calendar-years>\n <odx-calendar-month\n [activeDate]=\"vm.activeDate\"\n [selectedDate]=\"vm.selectedDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [filterFn]=\"filterFn\"\n (selectedChange)=\"selectedDateChange.emit($event)\"\n *ngSwitchDefault\n ></odx-calendar-month>\n </ng-container>\n</ng-template>\n" }]
|
|
616
600
|
}], propDecorators: { selectedDate: [{
|
|
617
601
|
type: Input
|
|
618
602
|
}], minDate: [{
|
|
@@ -621,7 +605,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
621
605
|
type: Input
|
|
622
606
|
}], filterFn: [{
|
|
623
607
|
type: Input
|
|
624
|
-
}],
|
|
608
|
+
}], selectedDateChange: [{
|
|
625
609
|
type: Output
|
|
626
610
|
}] } });
|
|
627
611
|
|
|
@@ -629,5 +613,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
629
613
|
* Generated bundle index. Do not edit.
|
|
630
614
|
*/
|
|
631
615
|
|
|
632
|
-
export { CalendarComponent, CalendarConfig, CalendarDefaultConfig,
|
|
616
|
+
export { CalendarCellDirective, CalendarComponent, CalendarConfig, CalendarDefaultConfig, CalendarHeaderComponent, CalendarMonthComponent, CalendarMonthService, CalendarService, CalendarView, CalendarViewDirective, CalendarYearComponent, CalendarYearService, CalendarYearsComponent, CalendarYearsService, DateLabelPipe, checkIdenticalDate, getA11yLabel, injectCalendarConfig, isDateDisabled, parseDate, provideCalendarConfig, validateMaxDate, validateMinDate, validateNextDateSet, validatePreviousDateSet };
|
|
633
617
|
//# sourceMappingURL=odx-angular-components-calendar.mjs.map
|