@odx/angular 2.6.1 → 2.7.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.
Files changed (174) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/cdk/autocomplete-control/index.d.ts +0 -1
  3. package/cdk/autocomplete-control/lib/autocomplete-control.d.ts +2 -3
  4. package/cdk/autocomplete-control/lib/pipes/base-search-filter-pipe.d.ts +3 -3
  5. package/cdk/custom-form-control/index.d.ts +1 -0
  6. package/cdk/{autocomplete-control/lib/abstract/base-search-field.directive.d.ts → custom-form-control/lib/input-control.directive.d.ts} +3 -3
  7. package/charts-config/lib/charts-theme.directive.d.ts +1 -1
  8. package/charts-config/lib/charts-theme.service.d.ts +3 -3
  9. package/components/autocomplete/lib/autocomplete.component.d.ts +2 -2
  10. package/components/autocomplete/lib/autocomplete.module.d.ts +2 -2
  11. package/components/autocomplete/lib/directives/autocomplete-input-control.directive.d.ts +9 -0
  12. package/components/autocomplete/lib/directives/index.d.ts +1 -1
  13. package/components/calendar/README.md +3 -0
  14. package/components/calendar/index.d.ts +5 -0
  15. package/components/calendar/lib/calendar.component.d.ts +18 -0
  16. package/components/calendar/lib/calendar.config.d.ts +100 -0
  17. package/components/calendar/lib/components/calendar-header/calendar-header.component.d.ts +27 -0
  18. package/components/calendar/lib/components/calendar-header/index.d.ts +1 -0
  19. package/components/calendar/lib/components/calendar-month/calendar-month.component.d.ts +21 -0
  20. package/components/calendar/lib/components/calendar-month/index.d.ts +1 -0
  21. package/components/calendar/lib/components/calendar-year/calendar-year.component.d.ts +18 -0
  22. package/components/calendar/lib/components/calendar-year/index.d.ts +1 -0
  23. package/components/calendar/lib/components/calendar-years/calendar-years.component.d.ts +20 -0
  24. package/components/calendar/lib/components/calendar-years/index.d.ts +1 -0
  25. package/components/calendar/lib/components/index.d.ts +4 -0
  26. package/components/calendar/lib/directives/calendar-cell.directive.d.ts +34 -0
  27. package/components/calendar/lib/directives/calendar-view.directive.d.ts +29 -0
  28. package/components/calendar/lib/directives/index.d.ts +2 -0
  29. package/components/calendar/lib/enums/calendar-view.enum.d.ts +5 -0
  30. package/components/calendar/lib/enums/index.d.ts +1 -0
  31. package/components/calendar/lib/models/date-filter.d.ts +1 -0
  32. package/components/calendar/lib/models/date-type.d.ts +1 -0
  33. package/components/calendar/lib/models/date-validator.d.ts +1 -0
  34. package/components/calendar/lib/models/index.d.ts +3 -0
  35. package/components/calendar/lib/pipes/date-label.pipe.d.ts +18 -0
  36. package/components/calendar/lib/pipes/index.d.ts +1 -0
  37. package/components/calendar/lib/services/calendar-month.service.d.ts +13 -0
  38. package/components/calendar/lib/services/calendar-year.service.d.ts +11 -0
  39. package/components/calendar/lib/services/calendar-years.service.d.ts +9 -0
  40. package/components/calendar/lib/services/calendar.service.d.ts +25 -0
  41. package/components/calendar/lib/services/index.d.ts +4 -0
  42. package/components/calendar/lib/utils/check-identical-date.d.ts +2 -0
  43. package/components/calendar/lib/utils/get-A11y-label.d.ts +3 -0
  44. package/components/calendar/lib/utils/index.d.ts +7 -0
  45. package/components/calendar/lib/utils/parse-date.d.ts +2 -0
  46. package/components/calendar/lib/utils/validate-max-date.d.ts +2 -0
  47. package/components/calendar/lib/utils/validate-min-date.d.ts +2 -0
  48. package/components/calendar/lib/utils/validate-next-date-set.d.ts +2 -0
  49. package/components/calendar/lib/utils/validate-previous-date-set.d.ts +2 -0
  50. package/components/datepicker/README.md +3 -0
  51. package/components/datepicker/index.d.ts +5 -0
  52. package/components/datepicker/lib/datepicker.component.d.ts +37 -0
  53. package/components/datepicker/lib/datepicker.config.d.ts +29 -0
  54. package/components/datepicker/lib/datepicker.module.d.ts +9 -0
  55. package/components/datepicker/lib/directives/datepicker-input-control.directive.d.ts +24 -0
  56. package/components/datepicker/lib/directives/index.d.ts +1 -0
  57. package/components/datepicker/lib/models/datepicker-input-date-order.d.ts +6 -0
  58. package/components/datepicker/lib/models/datepicker-input-pattern.d.ts +11 -0
  59. package/components/datepicker/lib/models/index.d.ts +2 -0
  60. package/components/datepicker/lib/utils/get-datepicker-input-pattern.d.ts +3 -0
  61. package/components/datepicker/lib/utils/get-datepicker-input-value-as-date.d.ts +2 -0
  62. package/components/datepicker/lib/utils/index.d.ts +2 -0
  63. package/components/select/lib/directives/index.d.ts +1 -1
  64. package/components/select/lib/directives/select-input-control.directive.d.ts +9 -0
  65. package/components/select/lib/select.component.d.ts +2 -2
  66. package/components/select/lib/select.module.d.ts +2 -2
  67. package/esm2020/cdk/autocomplete-control/index.mjs +1 -2
  68. package/esm2020/cdk/autocomplete-control/lib/autocomplete-control.mjs +1 -1
  69. package/esm2020/cdk/autocomplete-control/lib/pipes/base-search-filter-pipe.mjs +1 -1
  70. package/esm2020/cdk/custom-form-control/index.mjs +2 -1
  71. package/esm2020/cdk/custom-form-control/lib/input-control.directive.mjs +35 -0
  72. package/esm2020/charts-config/lib/charts-theme.directive.mjs +5 -5
  73. package/esm2020/charts-config/lib/charts-theme.module.mjs +4 -4
  74. package/esm2020/charts-config/lib/charts-theme.service.mjs +5 -5
  75. package/esm2020/components/autocomplete/lib/autocomplete.component.mjs +4 -5
  76. package/esm2020/components/autocomplete/lib/autocomplete.module.mjs +4 -4
  77. package/esm2020/components/autocomplete/lib/directives/autocomplete-input-control.directive.mjs +32 -0
  78. package/esm2020/components/autocomplete/lib/directives/index.mjs +2 -2
  79. package/esm2020/components/calendar/index.mjs +6 -0
  80. package/esm2020/components/calendar/lib/calendar.component.mjs +57 -0
  81. package/esm2020/components/calendar/lib/calendar.config.mjs +15 -0
  82. package/esm2020/components/calendar/lib/components/calendar-header/calendar-header.component.mjs +51 -0
  83. package/esm2020/components/calendar/lib/components/calendar-header/index.mjs +2 -0
  84. package/esm2020/components/calendar/lib/components/calendar-month/calendar-month.component.mjs +59 -0
  85. package/esm2020/components/calendar/lib/components/calendar-month/index.mjs +2 -0
  86. package/esm2020/components/calendar/lib/components/calendar-year/calendar-year.component.mjs +57 -0
  87. package/esm2020/components/calendar/lib/components/calendar-year/index.mjs +2 -0
  88. package/esm2020/components/calendar/lib/components/calendar-years/calendar-years.component.mjs +65 -0
  89. package/esm2020/components/calendar/lib/components/calendar-years/index.mjs +2 -0
  90. package/esm2020/components/calendar/lib/components/index.mjs +5 -0
  91. package/esm2020/components/calendar/lib/directives/calendar-cell.directive.mjs +92 -0
  92. package/esm2020/components/calendar/lib/directives/calendar-view.directive.mjs +39 -0
  93. package/esm2020/components/calendar/lib/directives/index.mjs +3 -0
  94. package/esm2020/components/calendar/lib/enums/calendar-view.enum.mjs +7 -0
  95. package/esm2020/components/calendar/lib/enums/index.mjs +2 -0
  96. package/esm2020/components/calendar/lib/models/date-filter.mjs +2 -0
  97. package/esm2020/components/calendar/lib/models/date-type.mjs +2 -0
  98. package/esm2020/components/calendar/lib/models/date-validator.mjs +2 -0
  99. package/esm2020/components/calendar/lib/models/index.mjs +4 -0
  100. package/esm2020/components/calendar/lib/pipes/date-label.pipe.mjs +25 -0
  101. package/esm2020/components/calendar/lib/pipes/index.mjs +2 -0
  102. package/esm2020/components/calendar/lib/services/calendar-month.service.mjs +38 -0
  103. package/esm2020/components/calendar/lib/services/calendar-year.service.mjs +31 -0
  104. package/esm2020/components/calendar/lib/services/calendar-years.service.mjs +33 -0
  105. package/esm2020/components/calendar/lib/services/calendar.service.mjs +74 -0
  106. package/esm2020/components/calendar/lib/services/index.mjs +5 -0
  107. package/esm2020/components/calendar/lib/utils/check-identical-date.mjs +11 -0
  108. package/esm2020/components/calendar/lib/utils/get-A11y-label.mjs +10 -0
  109. package/esm2020/components/calendar/lib/utils/index.mjs +8 -0
  110. package/esm2020/components/calendar/lib/utils/parse-date.mjs +15 -0
  111. package/esm2020/components/calendar/lib/utils/validate-max-date.mjs +11 -0
  112. package/esm2020/components/calendar/lib/utils/validate-min-date.mjs +11 -0
  113. package/esm2020/components/calendar/lib/utils/validate-next-date-set.mjs +12 -0
  114. package/esm2020/components/calendar/lib/utils/validate-previous-date-set.mjs +12 -0
  115. package/esm2020/components/calendar/odx-angular-components-calendar.mjs +5 -0
  116. package/esm2020/components/datepicker/index.mjs +6 -0
  117. package/esm2020/components/datepicker/lib/datepicker.component.mjs +118 -0
  118. package/esm2020/components/datepicker/lib/datepicker.config.mjs +7 -0
  119. package/esm2020/components/datepicker/lib/datepicker.module.mjs +19 -0
  120. package/esm2020/components/datepicker/lib/directives/datepicker-input-control.directive.mjs +60 -0
  121. package/esm2020/components/datepicker/lib/directives/index.mjs +2 -0
  122. package/esm2020/components/datepicker/lib/models/datepicker-input-date-order.mjs +6 -0
  123. package/esm2020/components/datepicker/lib/models/datepicker-input-pattern.mjs +11 -0
  124. package/esm2020/components/datepicker/lib/models/index.mjs +3 -0
  125. package/esm2020/components/datepicker/lib/utils/get-datepicker-input-pattern.mjs +16 -0
  126. package/esm2020/components/datepicker/lib/utils/get-datepicker-input-value-as-date.mjs +30 -0
  127. package/esm2020/components/datepicker/lib/utils/index.mjs +3 -0
  128. package/esm2020/components/datepicker/odx-angular-components-datepicker.mjs +5 -0
  129. package/esm2020/components/select/lib/directives/index.mjs +2 -2
  130. package/esm2020/components/select/lib/directives/select-input-control.directive.mjs +35 -0
  131. package/esm2020/components/select/lib/select.component.mjs +4 -4
  132. package/esm2020/components/select/lib/select.module.mjs +4 -4
  133. package/esm2020/utils/lib/helpers/index.mjs +2 -2
  134. package/fesm2015/odx-angular-cdk-autocomplete-control.mjs +4 -39
  135. package/fesm2015/odx-angular-cdk-autocomplete-control.mjs.map +1 -1
  136. package/fesm2015/odx-angular-cdk-custom-form-control.mjs +34 -2
  137. package/fesm2015/odx-angular-cdk-custom-form-control.mjs.map +1 -1
  138. package/fesm2015/odx-angular-charts-config.mjs +10 -10
  139. package/fesm2015/odx-angular-charts-config.mjs.map +1 -1
  140. package/fesm2015/odx-angular-components-autocomplete.mjs +15 -12
  141. package/fesm2015/odx-angular-components-autocomplete.mjs.map +1 -1
  142. package/fesm2015/odx-angular-components-calendar.mjs +623 -0
  143. package/fesm2015/odx-angular-components-calendar.mjs.map +1 -0
  144. package/fesm2015/odx-angular-components-datepicker.mjs +249 -0
  145. package/fesm2015/odx-angular-components-datepicker.mjs.map +1 -0
  146. package/fesm2015/odx-angular-components-select.mjs +14 -13
  147. package/fesm2015/odx-angular-components-select.mjs.map +1 -1
  148. package/fesm2015/odx-angular-utils.mjs +21 -21
  149. package/fesm2015/odx-angular-utils.mjs.map +1 -1
  150. package/fesm2020/odx-angular-cdk-autocomplete-control.mjs +4 -39
  151. package/fesm2020/odx-angular-cdk-autocomplete-control.mjs.map +1 -1
  152. package/fesm2020/odx-angular-cdk-custom-form-control.mjs +34 -2
  153. package/fesm2020/odx-angular-cdk-custom-form-control.mjs.map +1 -1
  154. package/fesm2020/odx-angular-charts-config.mjs +10 -10
  155. package/fesm2020/odx-angular-charts-config.mjs.map +1 -1
  156. package/fesm2020/odx-angular-components-autocomplete.mjs +15 -12
  157. package/fesm2020/odx-angular-components-autocomplete.mjs.map +1 -1
  158. package/fesm2020/odx-angular-components-calendar.mjs +621 -0
  159. package/fesm2020/odx-angular-components-calendar.mjs.map +1 -0
  160. package/fesm2020/odx-angular-components-datepicker.mjs +249 -0
  161. package/fesm2020/odx-angular-components-datepicker.mjs.map +1 -0
  162. package/fesm2020/odx-angular-components-select.mjs +14 -13
  163. package/fesm2020/odx-angular-components-select.mjs.map +1 -1
  164. package/fesm2020/odx-angular-utils.mjs +21 -21
  165. package/fesm2020/odx-angular-utils.mjs.map +1 -1
  166. package/package.json +21 -3
  167. package/utils/lib/helpers/index.d.ts +1 -1
  168. package/cdk/autocomplete-control/lib/abstract/index.d.ts +0 -1
  169. package/components/autocomplete/lib/directives/autocomplete-search-field.directive.d.ts +0 -9
  170. package/components/select/lib/directives/select-search-field.directive.d.ts +0 -9
  171. package/esm2020/cdk/autocomplete-control/lib/abstract/base-search-field.directive.mjs +0 -38
  172. package/esm2020/cdk/autocomplete-control/lib/abstract/index.mjs +0 -2
  173. package/esm2020/components/autocomplete/lib/directives/autocomplete-search-field.directive.mjs +0 -26
  174. package/esm2020/components/select/lib/directives/select-search-field.directive.mjs +0 -35
@@ -0,0 +1,623 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { A11yModule } from '@angular/cdk/a11y';
3
+ import * as i0 from '@angular/core';
4
+ import { Injectable, inject, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Output, Pipe, Directive, Input } from '@angular/core';
5
+ import * as i2 from '@odx/angular';
6
+ import { CoreModule, DisabledController } from '@odx/angular';
7
+ import { CSSComponent, CSSModifier } from '@odx/angular/internal';
8
+ import { createConfigTokens, isString, isPresent, Pure, injectElement, hasChanged, deferFn, untilDestroyed, isFunction } from '@odx/angular/utils';
9
+ import { ActionGroupComponent } from '@odx/angular/components/action-group';
10
+ import { ButtonComponent } from '@odx/angular/components/button';
11
+ import { IconComponent } from '@odx/angular/components/icon';
12
+ import { enGB } from 'date-fns/locale';
13
+ import { BehaviorSubject, shareReplay, tap, map } from 'rxjs';
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
+ import * as i1 from '@angular/common';
16
+ import { DOCUMENT } from '@angular/common';
17
+
18
+ const { CalendarConfig, CalendarDefaultConfig, injectCalendarConfig, provideCalendarConfig } = createConfigTokens('Calendar', '@odx/angular/components/calendar', {
19
+ monthYearLabel: 'LLLL yyyy',
20
+ monthLabel: 'LLL',
21
+ weekLabel: 'EEEEE',
22
+ dayLabel: 'd',
23
+ yearLabel: 'yyyy',
24
+ dayA11yLabel: 'MMMM dd, yyyy',
25
+ monthA11yLabel: 'MMMM, yyyy',
26
+ yearA11yLabel: 'yyyy',
27
+ locale: new BehaviorSubject(enGB),
28
+ });
29
+
30
+ var CalendarViewEnum;
31
+ (function (CalendarViewEnum) {
32
+ CalendarViewEnum["Month"] = "month";
33
+ CalendarViewEnum["Year"] = "year";
34
+ CalendarViewEnum["Years"] = "years";
35
+ })(CalendarViewEnum || (CalendarViewEnum = {}));
36
+
37
+ const functionList$5 = {
38
+ [CalendarViewEnum.Month]: (currentDate, date) => isSameDay(currentDate, date),
39
+ [CalendarViewEnum.Year]: (currentDate, date) => isSameMonth(currentDate, date),
40
+ [CalendarViewEnum.Years]: (currentDate, date) => isSameYear(currentDate, date),
41
+ };
42
+ function checkIdenticalDate(currentDate, date, calendarView) {
43
+ return functionList$5[calendarView](currentDate, date);
44
+ }
45
+
46
+ const functionList$4 = {
47
+ [CalendarViewEnum.Month]: (config) => config.dayA11yLabel,
48
+ [CalendarViewEnum.Year]: (config) => config.monthA11yLabel,
49
+ [CalendarViewEnum.Years]: (config) => config.yearA11yLabel,
50
+ };
51
+ function getA11yLabel(calendarView, config) {
52
+ return functionList$4[calendarView](config);
53
+ }
54
+
55
+ function parseDate(value) {
56
+ try {
57
+ const timestamp = isString(value) ? Date.parse(value) : value;
58
+ if (!isValid(timestamp)) {
59
+ return new Date();
60
+ }
61
+ return toDate(timestamp);
62
+ }
63
+ catch (_a) {
64
+ return new Date();
65
+ }
66
+ }
67
+
68
+ const functionList$3 = {
69
+ [CalendarViewEnum.Month]: (maxDate, date) => endOfDay(maxDate) < endOfDay(date),
70
+ [CalendarViewEnum.Year]: (maxDate, date) => endOfMonth(maxDate) < endOfMonth(date),
71
+ [CalendarViewEnum.Years]: (maxDate, date) => endOfYear(maxDate) < endOfYear(date),
72
+ };
73
+ function validateMaxDate(maxDate, date, calendarView) {
74
+ return functionList$3[calendarView](maxDate, date);
75
+ }
76
+
77
+ const functionList$2 = {
78
+ [CalendarViewEnum.Month]: (minDate, date) => startOfDay(minDate) > startOfDay(date),
79
+ [CalendarViewEnum.Year]: (minDate, date) => startOfMonth(minDate) > startOfMonth(date),
80
+ [CalendarViewEnum.Years]: (minDate, date) => startOfYear(minDate) > startOfYear(date),
81
+ };
82
+ function validateMinDate(maxDate, date, calendarView) {
83
+ return functionList$2[calendarView](maxDate, date);
84
+ }
85
+
86
+ const functionList$1 = {
87
+ [CalendarViewEnum.Month]: (maxDate, date) => maxDate < startOfMonth(addMonths(date, 1)),
88
+ [CalendarViewEnum.Year]: (maxDate, date) => maxDate < startOfYear(addMonths(date, 12)),
89
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
+ [CalendarViewEnum.Years]: (maxDate, date) => false,
91
+ };
92
+ function validateNextDateSet(maxDate, date, calendarView) {
93
+ return functionList$1[calendarView](maxDate, date);
94
+ }
95
+
96
+ const functionList = {
97
+ [CalendarViewEnum.Month]: (minDate, date) => minDate > endOfMonth(subMonths(date, 1)),
98
+ [CalendarViewEnum.Year]: (minDate, date) => minDate > endOfYear(subMonths(date, 12)),
99
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
100
+ [CalendarViewEnum.Years]: () => false,
101
+ };
102
+ function validatePreviousDateSet(minDate, date, calendarView) {
103
+ return functionList[calendarView](minDate, date);
104
+ }
105
+
106
+ class CalendarService {
107
+ constructor() {
108
+ this.calendarView$$ = new BehaviorSubject(CalendarViewEnum.Month);
109
+ this.activeDate$$ = new BehaviorSubject(startOfDay(new Date()));
110
+ this.selectedDate$$ = new BehaviorSubject(null);
111
+ this.minDate = null;
112
+ this.maxDate = null;
113
+ this.filterFn = null;
114
+ this.calendarView$ = this.calendarView$$.pipe(shareReplay({ refCount: true }));
115
+ this.activeDate$ = this.activeDate$$.pipe(shareReplay({ refCount: true }));
116
+ this.selectedDate$ = this.selectedDate$$.pipe(tap((date) => isPresent(date) && this.setActiveDate(date)), shareReplay({ refCount: true }));
117
+ }
118
+ setActiveDate(value) {
119
+ if (isPresent(value)) {
120
+ this.activeDate$$.next(parseDate(value));
121
+ }
122
+ }
123
+ selectDate(value) {
124
+ if (isPresent(value)) {
125
+ this.activeDate$$.next(parseDate(value));
126
+ this.selectedDate$$.next(parseDate(value));
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();
137
+ }
138
+ changeView(view) {
139
+ this.calendarView$$.next(view);
140
+ }
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
+ }
161
+ CalendarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
162
+ 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
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarService, decorators: [{
170
+ 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
+ }] });
261
+
262
+ let CalendarHeaderComponent = class CalendarHeaderComponent {
263
+ constructor() {
264
+ this.calendar = inject(CalendarService);
265
+ this.element = injectElement();
266
+ this.previous = new EventEmitter();
267
+ this.next = new EventEmitter();
268
+ this.changeView = new EventEmitter();
269
+ this.config = injectCalendarConfig();
270
+ }
271
+ previousClicked(event) {
272
+ !this.isPreviousDisabled && this.previous.emit(event);
273
+ }
274
+ nextClicked(event) {
275
+ !this.isNextDisabled && this.next.emit(event);
276
+ }
277
+ get isPreviousDisabled() {
278
+ return this.calendar.isPreviousDateSetDisabled();
279
+ }
280
+ get isNextDisabled() {
281
+ return this.calendar.isNextDateSetDisabled();
282
+ }
283
+ };
284
+ CalendarHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
285
+ 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)\" [disabled]=\"isPreviousDisabled\">\n <odx-icon name=\"chevron-left\"></odx-icon>\n </button>\n\n <button class=\"odx-calendar-header__title\" odxButton (click)=\"changeView.emit()\">\n <ng-content></ng-content>\n </button>\n\n <button odxButton (click)=\"nextClicked($event)\" [disabled]=\"isNextDisabled\">\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 });
286
+ CalendarHeaderComponent = __decorate([
287
+ CSSComponent('calendar-header')
288
+ ], CalendarHeaderComponent);
289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarHeaderComponent, decorators: [{
290
+ type: Component,
291
+ 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)\" [disabled]=\"isPreviousDisabled\">\n <odx-icon name=\"chevron-left\"></odx-icon>\n </button>\n\n <button class=\"odx-calendar-header__title\" odxButton (click)=\"changeView.emit()\">\n <ng-content></ng-content>\n </button>\n\n <button odxButton (click)=\"nextClicked($event)\" [disabled]=\"isNextDisabled\">\n <odx-icon name=\"chevron-right\"></odx-icon>\n </button>\n</odx-action-group>\n" }]
292
+ }], propDecorators: { previous: [{
293
+ type: Output
294
+ }], next: [{
295
+ type: Output
296
+ }], changeView: [{
297
+ type: Output
298
+ }] } });
299
+
300
+ class DateLabelPipe {
301
+ constructor() {
302
+ this.config = injectCalendarConfig();
303
+ }
304
+ transform(value, dateFormat) {
305
+ if (!value)
306
+ return '';
307
+ return format(value, dateFormat, { locale: this.config.locale.getValue() });
308
+ }
309
+ }
310
+ DateLabelPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
311
+ DateLabelPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, isStandalone: true, name: "odxDateLabel", pure: false });
312
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, decorators: [{
313
+ type: Pipe,
314
+ args: [{
315
+ pure: false,
316
+ name: 'odxDateLabel',
317
+ standalone: true,
318
+ }]
319
+ }] });
320
+
321
+ let CalendarCellDirective = class CalendarCellDirective {
322
+ constructor() {
323
+ this.disabledController = DisabledController.inject();
324
+ this.isActive = false;
325
+ this.isSelected = false;
326
+ this.isCurrent = false;
327
+ this.adjacent = false;
328
+ this.element = injectElement();
329
+ this.dateLabelPipe = inject(DateLabelPipe);
330
+ this.config = injectCalendarConfig();
331
+ this.calendarView = CalendarViewEnum.Month;
332
+ this.activeDate = null;
333
+ this.selectedDate = null;
334
+ }
335
+ get isDisabled() {
336
+ var _a;
337
+ return !!((_a = this.disabledController) === null || _a === void 0 ? void 0 : _a.disabled);
338
+ }
339
+ ngOnChanges(changes) {
340
+ if (hasChanged(changes, ['date'], false)) {
341
+ this.isCurrent = checkIdenticalDate(this.date, new Date(), this.calendarView);
342
+ }
343
+ if (this.activeDate && hasChanged(changes, ['date', 'activeDate'], false)) {
344
+ this.isActive = checkIdenticalDate(this.date, this.activeDate, this.calendarView);
345
+ if (this.calendarView === CalendarViewEnum.Month) {
346
+ this.adjacent = !isSameMonth(this.date, this.activeDate);
347
+ }
348
+ }
349
+ if (this.selectedDate && hasChanged(changes, ['date', 'selectedDate'], false)) {
350
+ this.isSelected = checkIdenticalDate(this.date, this.selectedDate, this.calendarView);
351
+ }
352
+ if (this.isActive) {
353
+ deferFn(() => this.element.nativeElement.focus());
354
+ }
355
+ }
356
+ get ariaLabel() {
357
+ const dateFormat = getA11yLabel(this.calendarView, this.config);
358
+ return this.dateLabelPipe.transform(this.date, dateFormat);
359
+ }
360
+ };
361
+ CalendarCellDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
362
+ 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", "tabindex": "isActive ? 0 : -1", "attr.aria-label": "ariaLabel", "attr.aria-disabled": "isDisabled" } }, providers: [DisabledController.connect(), DateLabelPipe], usesOnChanges: true, ngImport: i0 });
363
+ __decorate([
364
+ CSSModifier(),
365
+ __metadata("design:type", Object)
366
+ ], CalendarCellDirective.prototype, "isCurrent", void 0);
367
+ __decorate([
368
+ CSSModifier(),
369
+ __metadata("design:type", Object)
370
+ ], CalendarCellDirective.prototype, "adjacent", void 0);
371
+ CalendarCellDirective = __decorate([
372
+ CSSComponent('calendar-cell')
373
+ ], CalendarCellDirective);
374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarCellDirective, decorators: [{
375
+ type: Directive,
376
+ args: [{
377
+ selector: '[odxCalendarCell]',
378
+ standalone: true,
379
+ providers: [DisabledController.connect(), DateLabelPipe],
380
+ host: {
381
+ '[class.is-disabled]': 'isDisabled',
382
+ '[class.is-selected]': 'isSelected',
383
+ '[tabindex]': 'isActive ? 0 : -1',
384
+ '[attr.aria-label]': 'ariaLabel',
385
+ '[attr.aria-disabled]': 'isDisabled',
386
+ },
387
+ }]
388
+ }], propDecorators: { isCurrent: [], adjacent: [], date: [{
389
+ type: Input,
390
+ args: ['odxCalendarCell']
391
+ }], calendarView: [{
392
+ type: Input,
393
+ args: ['odxCalendarCellCalendarView']
394
+ }], activeDate: [{
395
+ type: Input,
396
+ args: ['odxCalendarCellActiveDate']
397
+ }], selectedDate: [{
398
+ type: Input,
399
+ args: ['odxCalendarCellSelectedDate']
400
+ }] } });
401
+
402
+ class CalendarViewDirective {
403
+ constructor() {
404
+ this.takeUntilDestroyed = untilDestroyed();
405
+ this.calendar = inject(CalendarService);
406
+ this.config = injectCalendarConfig();
407
+ this.element = injectElement();
408
+ }
409
+ get activeDate() {
410
+ return this.calendar.activeDate;
411
+ }
412
+ trackByIndex(index) {
413
+ return index;
414
+ }
415
+ isDateDisabled(value) {
416
+ return this.calendar.isDateDisabled(value);
417
+ }
418
+ changeView() {
419
+ this.calendar.changeView(this.calendarNextView);
420
+ }
421
+ updateActiveDate(event, date) {
422
+ event.preventDefault();
423
+ event.stopPropagation();
424
+ this.calendar.setActiveDate(date);
425
+ }
426
+ }
427
+ CalendarViewDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarViewDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
428
+ CalendarViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CalendarViewDirective, isStandalone: true, ngImport: i0 });
429
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarViewDirective, decorators: [{
430
+ type: Directive,
431
+ args: [{
432
+ standalone: true,
433
+ }]
434
+ }] });
435
+
436
+ let CalendarMonthComponent = class CalendarMonthComponent extends CalendarViewDirective {
437
+ constructor() {
438
+ super(...arguments);
439
+ this.calendarMonth = inject(CalendarMonthService);
440
+ this.calendarNextView = CalendarViewEnum.Years;
441
+ this.calendarCurrentView = CalendarViewEnum.Month;
442
+ this.selectedChange = new EventEmitter();
443
+ }
444
+ previousDay(event) {
445
+ this.updateActiveDate(event, subDays(this.activeDate, 1));
446
+ }
447
+ nextDay(event) {
448
+ this.updateActiveDate(event, addDays(this.activeDate, 1));
449
+ }
450
+ previousWeek(event) {
451
+ this.updateActiveDate(event, subWeeks(this.activeDate, 1));
452
+ }
453
+ nextWeek(event) {
454
+ this.updateActiveDate(event, addWeeks(this.activeDate, 1));
455
+ }
456
+ previousMonth(event) {
457
+ this.updateActiveDate(event, subMonths(this.activeDate, 1));
458
+ }
459
+ nextMonth(event) {
460
+ this.updateActiveDate(event, addMonths(this.activeDate, 1));
461
+ }
462
+ selectDate(value) {
463
+ if (this.isDateDisabled(value))
464
+ return;
465
+ this.calendar.selectDate(value);
466
+ this.selectedChange.emit(value);
467
+ }
468
+ };
469
+ CalendarMonthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
470
+ 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 (previous)=\"previousMonth($event)\" (next)=\"nextMonth($event)\" (changeView)=\"changeView()\">\n {{ calendar.activeDate$ | async | 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 *ngIf=\"calendar.activeDate$ | async as activeDate\"\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; let i = index; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(day)\"\n [odxCalendarCell]=\"day\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellSelectedDate]=\"calendar.selectedDate$ | async\"\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: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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", outputs: ["previous", "next", "changeView"] }, { kind: "pipe", type: DateLabelPipe, name: "odxDateLabel" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
471
+ CalendarMonthComponent = __decorate([
472
+ CSSComponent('calendar-month')
473
+ ], CalendarMonthComponent);
474
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthComponent, decorators: [{
475
+ type: Component,
476
+ 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 (previous)=\"previousMonth($event)\" (next)=\"nextMonth($event)\" (changeView)=\"changeView()\">\n {{ calendar.activeDate$ | async | 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 *ngIf=\"calendar.activeDate$ | async as activeDate\"\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; let i = index; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(day)\"\n [odxCalendarCell]=\"day\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellSelectedDate]=\"calendar.selectedDate$ | async\"\n (click)=\"selectDate(day)\"\n >\n {{ day | odxDateLabel: config.dayLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n" }]
477
+ }], propDecorators: { selectedChange: [{
478
+ type: Output
479
+ }] } });
480
+
481
+ let CalendarYearComponent = class CalendarYearComponent extends CalendarViewDirective {
482
+ constructor() {
483
+ super(...arguments);
484
+ this.calendarYear = inject(CalendarYearService);
485
+ this.calendarNextView = CalendarViewEnum.Month;
486
+ this.calendarCurrentView = CalendarViewEnum.Year;
487
+ }
488
+ previousMonth(event) {
489
+ this.updateActiveDate(event, subMonths(this.activeDate, 1));
490
+ }
491
+ nextMonth(event) {
492
+ this.updateActiveDate(event, addMonths(this.activeDate, 1));
493
+ }
494
+ previousSeason(event) {
495
+ this.updateActiveDate(event, subMonths(this.activeDate, 3));
496
+ }
497
+ nextSeason(event) {
498
+ this.updateActiveDate(event, addMonths(this.activeDate, 3));
499
+ }
500
+ previousYear(event) {
501
+ this.updateActiveDate(event, subMonths(this.activeDate, 12));
502
+ }
503
+ nextYear(event) {
504
+ this.updateActiveDate(event, addMonths(this.activeDate, 12));
505
+ }
506
+ selectDate(value) {
507
+ if (this.isDateDisabled(value))
508
+ return;
509
+ const date = setMonth(this.calendar.activeDate, getMonth(value));
510
+ this.calendar.selectDate(date);
511
+ this.changeView();
512
+ }
513
+ };
514
+ CalendarYearComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
515
+ 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 (previous)=\"previousYear($event)\" (next)=\"nextYear($event)\" (changeView)=\"changeView()\">\n {{ calendar.activeDate$ | async | odxDateLabel: config.yearLabel }}\n </odx-calendar-header>\n </th>\n </tr>\n </thead>\n\n <tbody\n *ngIf=\"calendar.activeDate$ | async as activeDate\"\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; let i = index; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(month)\"\n [odxCalendarCell]=\"month\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellSelectedDate]=\"calendar.selectedDate$ | async\"\n [odxCalendarCellCalendarView]=\"calendarCurrentView\"\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: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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", outputs: ["previous", "next", "changeView"] }, { kind: "pipe", type: DateLabelPipe, name: "odxDateLabel" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
516
+ CalendarYearComponent = __decorate([
517
+ CSSComponent('calendar-year')
518
+ ], CalendarYearComponent);
519
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearComponent, decorators: [{
520
+ type: Component,
521
+ 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 (previous)=\"previousYear($event)\" (next)=\"nextYear($event)\" (changeView)=\"changeView()\">\n {{ calendar.activeDate$ | async | odxDateLabel: config.yearLabel }}\n </odx-calendar-header>\n </th>\n </tr>\n </thead>\n\n <tbody\n *ngIf=\"calendar.activeDate$ | async as activeDate\"\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; let i = index; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(month)\"\n [odxCalendarCell]=\"month\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellSelectedDate]=\"calendar.selectedDate$ | async\"\n [odxCalendarCellCalendarView]=\"calendarCurrentView\"\n (click)=\"selectDate(month)\"\n >\n {{ month | odxDateLabel: config.monthLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n" }]
522
+ }] });
523
+
524
+ let CalendarYearsComponent = class CalendarYearsComponent extends CalendarViewDirective {
525
+ constructor() {
526
+ super(...arguments);
527
+ this.document = inject(DOCUMENT);
528
+ this.calendarYears = inject(CalendarYearsService);
529
+ this.calendarNextView = CalendarViewEnum.Year;
530
+ this.calendarCurrentView = CalendarViewEnum.Years;
531
+ }
532
+ ngAfterViewInit() {
533
+ deferFn(() => this.scrollCurrentYearIntoView());
534
+ }
535
+ previousYear(event) {
536
+ this.updateActiveDate(event, subMonths(this.activeDate, 12));
537
+ }
538
+ nextYear(event) {
539
+ this.updateActiveDate(event, addMonths(this.activeDate, 12));
540
+ }
541
+ previousRow(event) {
542
+ this.updateActiveDate(event, subMonths(this.activeDate, 12 * 3));
543
+ }
544
+ nextRow(event) {
545
+ this.updateActiveDate(event, addMonths(this.activeDate, 12 * 3));
546
+ }
547
+ selectDate(value) {
548
+ if (this.isDateDisabled(value))
549
+ return;
550
+ const date = setYear(this.calendar.activeDate, getYear(value));
551
+ this.calendar.selectDate(date);
552
+ this.changeView();
553
+ }
554
+ scrollCurrentYearIntoView() {
555
+ const selectedYear = this.document.querySelector('.odx-calendar-cell.is-selected');
556
+ const currentYear = this.document.querySelector('.odx-calendar-cell--is-current');
557
+ const element = selectedYear || currentYear;
558
+ if (element && isFunction(element.scrollIntoView)) {
559
+ element.scrollIntoView({ block: 'center', behavior: 'smooth' });
560
+ }
561
+ }
562
+ };
563
+ CalendarYearsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
564
+ 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 *ngIf=\"calendar.activeDate$ | async as activeDate\"\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; trackBy: trackByIndex\">\n <td role=\"gridcell\" *ngFor=\"let year of yearRow; let i = index; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(year)\"\n [odxCalendarCell]=\"year\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellSelectedDate]=\"calendar.selectedDate$ | async\"\n [odxCalendarCellCalendarView]=\"calendarCurrentView\"\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: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: "pipe", type: DateLabelPipe, name: "odxDateLabel" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
565
+ CalendarYearsComponent = __decorate([
566
+ CSSComponent('calendar-years')
567
+ ], CalendarYearsComponent);
568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsComponent, decorators: [{
569
+ type: Component,
570
+ 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 *ngIf=\"calendar.activeDate$ | async as activeDate\"\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; trackBy: trackByIndex\">\n <td role=\"gridcell\" *ngFor=\"let year of yearRow; let i = index; trackBy: trackByIndex\">\n <button\n [disabled]=\"isDateDisabled(year)\"\n [odxCalendarCell]=\"year\"\n [odxCalendarCellActiveDate]=\"activeDate\"\n [odxCalendarCellSelectedDate]=\"calendar.selectedDate$ | async\"\n [odxCalendarCellCalendarView]=\"calendarCurrentView\"\n (click)=\"selectDate(year)\"\n >\n {{ year | odxDateLabel: config.yearLabel }}\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n" }]
571
+ }] });
572
+
573
+ let CalendarComponent = class CalendarComponent {
574
+ constructor() {
575
+ this.calendar = inject(CalendarService);
576
+ this.element = injectElement();
577
+ this.calendarView = CalendarViewEnum;
578
+ this.minDate = null;
579
+ this.maxDate = null;
580
+ this.filterFn = null;
581
+ this.selectedChange = new EventEmitter();
582
+ }
583
+ set selectedDate(value) {
584
+ this.calendar.selectDate(value);
585
+ }
586
+ ngOnChanges(changes) {
587
+ if (hasChanged(changes, 'minDate', false)) {
588
+ this.calendar.minDate = this.minDate;
589
+ }
590
+ if (hasChanged(changes, 'maxDate', false)) {
591
+ this.calendar.maxDate = this.maxDate;
592
+ }
593
+ if (hasChanged(changes, 'filterFn', false)) {
594
+ this.calendar.filterFn = this.filterFn;
595
+ }
596
+ }
597
+ };
598
+ CalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
599
+ 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: { selectedChange: "selectedChange" }, providers: [CalendarService], usesOnChanges: true, ngImport: i0, template: "<ng-container [ngSwitch]=\"calendar.calendarCurrentView\">\n <odx-calendar-year *ngSwitchCase=\"calendarView.Year\"></odx-calendar-year>\n <odx-calendar-years *ngSwitchCase=\"calendarView.Years\"></odx-calendar-years>\n <odx-calendar-month *ngSwitchDefault (selectedChange)=\"selectedChange.emit($event)\"></odx-calendar-month>\n</ng-container>\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: "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 });
600
+ CalendarComponent = __decorate([
601
+ CSSComponent('calendar')
602
+ ], CalendarComponent);
603
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarComponent, decorators: [{
604
+ type: Component,
605
+ args: [{ selector: 'odx-calendar', standalone: true, imports: [CoreModule, A11yModule, CalendarMonthComponent, CalendarYearComponent, CalendarYearsComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [CalendarService], template: "<ng-container [ngSwitch]=\"calendar.calendarCurrentView\">\n <odx-calendar-year *ngSwitchCase=\"calendarView.Year\"></odx-calendar-year>\n <odx-calendar-years *ngSwitchCase=\"calendarView.Years\"></odx-calendar-years>\n <odx-calendar-month *ngSwitchDefault (selectedChange)=\"selectedChange.emit($event)\"></odx-calendar-month>\n</ng-container>\n" }]
606
+ }], propDecorators: { selectedDate: [{
607
+ type: Input
608
+ }], minDate: [{
609
+ type: Input
610
+ }], maxDate: [{
611
+ type: Input
612
+ }], filterFn: [{
613
+ type: Input
614
+ }], selectedChange: [{
615
+ type: Output
616
+ }] } });
617
+
618
+ /**
619
+ * Generated bundle index. Do not edit.
620
+ */
621
+
622
+ export { CalendarComponent, CalendarConfig, CalendarDefaultConfig, CalendarViewEnum, DateLabelPipe, injectCalendarConfig, provideCalendarConfig };
623
+ //# sourceMappingURL=odx-angular-components-calendar.mjs.map