@odx/angular 2.6.1 → 2.8.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 (216) hide show
  1. package/CHANGELOG.md +47 -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/cdk/expandable/lib/directives/extandable-container.directive.d.ts +1 -0
  8. package/cdk/expandable/lib/expandable.tokens.d.ts +1 -1
  9. package/cdk/expandable/lib/facade/expandable-container.d.ts +1 -0
  10. package/charts-config/index.d.ts +1 -1
  11. package/charts-config/lib/charts-theme.directive.d.ts +2 -2
  12. package/charts-config/lib/charts-theme.service.d.ts +3 -3
  13. package/components/autocomplete/lib/autocomplete.component.d.ts +2 -2
  14. package/components/autocomplete/lib/autocomplete.module.d.ts +2 -2
  15. package/components/autocomplete/lib/directives/autocomplete-input-control.directive.d.ts +9 -0
  16. package/components/autocomplete/lib/directives/index.d.ts +1 -1
  17. package/components/calendar/README.md +3 -0
  18. package/components/calendar/index.d.ts +5 -0
  19. package/components/calendar/lib/calendar.component.d.ts +18 -0
  20. package/components/calendar/lib/calendar.config.d.ts +100 -0
  21. package/components/calendar/lib/components/calendar-header/calendar-header.component.d.ts +27 -0
  22. package/components/calendar/lib/components/calendar-header/index.d.ts +1 -0
  23. package/components/calendar/lib/components/calendar-month/calendar-month.component.d.ts +21 -0
  24. package/components/calendar/lib/components/calendar-month/index.d.ts +1 -0
  25. package/components/calendar/lib/components/calendar-year/calendar-year.component.d.ts +18 -0
  26. package/components/calendar/lib/components/calendar-year/index.d.ts +1 -0
  27. package/components/calendar/lib/components/calendar-years/calendar-years.component.d.ts +20 -0
  28. package/components/calendar/lib/components/calendar-years/index.d.ts +1 -0
  29. package/components/calendar/lib/components/index.d.ts +4 -0
  30. package/components/calendar/lib/directives/calendar-cell.directive.d.ts +34 -0
  31. package/components/calendar/lib/directives/calendar-view.directive.d.ts +29 -0
  32. package/components/calendar/lib/directives/index.d.ts +2 -0
  33. package/components/calendar/lib/enums/calendar-view.enum.d.ts +5 -0
  34. package/components/calendar/lib/enums/index.d.ts +1 -0
  35. package/components/calendar/lib/models/date-filter.d.ts +1 -0
  36. package/components/calendar/lib/models/date-type.d.ts +1 -0
  37. package/components/calendar/lib/models/date-validator.d.ts +1 -0
  38. package/components/calendar/lib/models/index.d.ts +3 -0
  39. package/components/calendar/lib/pipes/date-label.pipe.d.ts +18 -0
  40. package/components/calendar/lib/pipes/index.d.ts +1 -0
  41. package/components/calendar/lib/services/calendar-month.service.d.ts +13 -0
  42. package/components/calendar/lib/services/calendar-year.service.d.ts +11 -0
  43. package/components/calendar/lib/services/calendar-years.service.d.ts +9 -0
  44. package/components/calendar/lib/services/calendar.service.d.ts +25 -0
  45. package/components/calendar/lib/services/index.d.ts +4 -0
  46. package/components/calendar/lib/utils/check-identical-date.d.ts +2 -0
  47. package/components/calendar/lib/utils/get-A11y-label.d.ts +3 -0
  48. package/components/calendar/lib/utils/index.d.ts +7 -0
  49. package/components/calendar/lib/utils/parse-date.d.ts +2 -0
  50. package/components/calendar/lib/utils/validate-max-date.d.ts +2 -0
  51. package/components/calendar/lib/utils/validate-min-date.d.ts +2 -0
  52. package/components/calendar/lib/utils/validate-next-date-set.d.ts +2 -0
  53. package/components/calendar/lib/utils/validate-previous-date-set.d.ts +2 -0
  54. package/components/datepicker/README.md +3 -0
  55. package/components/datepicker/index.d.ts +5 -0
  56. package/components/datepicker/lib/datepicker.component.d.ts +37 -0
  57. package/components/datepicker/lib/datepicker.config.d.ts +29 -0
  58. package/components/datepicker/lib/datepicker.module.d.ts +9 -0
  59. package/components/datepicker/lib/directives/datepicker-input-control.directive.d.ts +24 -0
  60. package/components/datepicker/lib/directives/index.d.ts +1 -0
  61. package/components/datepicker/lib/models/datepicker-input-date-order.d.ts +6 -0
  62. package/components/datepicker/lib/models/datepicker-input-pattern.d.ts +11 -0
  63. package/components/datepicker/lib/models/index.d.ts +2 -0
  64. package/components/datepicker/lib/utils/get-datepicker-input-pattern.d.ts +3 -0
  65. package/components/datepicker/lib/utils/get-datepicker-input-value-as-date.d.ts +2 -0
  66. package/components/datepicker/lib/utils/index.d.ts +2 -0
  67. package/components/modal/lib/components/modal-hero/modal-hero.component.d.ts +2 -1
  68. package/components/rail-navigation/lib/components/rail-navigation-item/rail-navigation-item.component.d.ts +2 -1
  69. package/components/select/lib/directives/index.d.ts +1 -1
  70. package/components/select/lib/directives/select-input-control.directive.d.ts +9 -0
  71. package/components/select/lib/select.component.d.ts +2 -2
  72. package/components/select/lib/select.module.d.ts +2 -2
  73. package/esm2020/cdk/autocomplete-control/index.mjs +1 -2
  74. package/esm2020/cdk/autocomplete-control/lib/autocomplete-control.mjs +1 -1
  75. package/esm2020/cdk/autocomplete-control/lib/pipes/base-search-filter-pipe.mjs +1 -1
  76. package/esm2020/cdk/custom-form-control/index.mjs +2 -1
  77. package/esm2020/cdk/custom-form-control/lib/input-control.directive.mjs +35 -0
  78. package/esm2020/cdk/expandable/lib/directives/expandable-item.directive.mjs +4 -4
  79. package/esm2020/cdk/expandable/lib/directives/extandable-container.directive.mjs +17 -2
  80. package/esm2020/cdk/expandable/lib/expandable.tokens.mjs +2 -2
  81. package/esm2020/cdk/expandable/lib/facade/expandable-container.mjs +1 -1
  82. package/esm2020/charts-config/index.mjs +2 -2
  83. package/esm2020/charts-config/lib/charts-theme.directive.mjs +7 -7
  84. package/esm2020/charts-config/lib/charts-theme.module.mjs +4 -4
  85. package/esm2020/charts-config/lib/charts-theme.service.mjs +5 -5
  86. package/esm2020/components/accordion/lib/accordion.component.mjs +4 -4
  87. package/esm2020/components/autocomplete/lib/autocomplete.component.mjs +4 -5
  88. package/esm2020/components/autocomplete/lib/autocomplete.module.mjs +4 -4
  89. package/esm2020/components/autocomplete/lib/directives/autocomplete-input-control.directive.mjs +32 -0
  90. package/esm2020/components/autocomplete/lib/directives/index.mjs +2 -2
  91. package/esm2020/components/calendar/index.mjs +6 -0
  92. package/esm2020/components/calendar/lib/calendar.component.mjs +57 -0
  93. package/esm2020/components/calendar/lib/calendar.config.mjs +15 -0
  94. package/esm2020/components/calendar/lib/components/calendar-header/calendar-header.component.mjs +51 -0
  95. package/esm2020/components/calendar/lib/components/calendar-header/index.mjs +2 -0
  96. package/esm2020/components/calendar/lib/components/calendar-month/calendar-month.component.mjs +59 -0
  97. package/esm2020/components/calendar/lib/components/calendar-month/index.mjs +2 -0
  98. package/esm2020/components/calendar/lib/components/calendar-year/calendar-year.component.mjs +57 -0
  99. package/esm2020/components/calendar/lib/components/calendar-year/index.mjs +2 -0
  100. package/esm2020/components/calendar/lib/components/calendar-years/calendar-years.component.mjs +65 -0
  101. package/esm2020/components/calendar/lib/components/calendar-years/index.mjs +2 -0
  102. package/esm2020/components/calendar/lib/components/index.mjs +5 -0
  103. package/esm2020/components/calendar/lib/directives/calendar-cell.directive.mjs +92 -0
  104. package/esm2020/components/calendar/lib/directives/calendar-view.directive.mjs +39 -0
  105. package/esm2020/components/calendar/lib/directives/index.mjs +3 -0
  106. package/esm2020/components/calendar/lib/enums/calendar-view.enum.mjs +7 -0
  107. package/esm2020/components/calendar/lib/enums/index.mjs +2 -0
  108. package/esm2020/components/calendar/lib/models/date-filter.mjs +2 -0
  109. package/esm2020/components/calendar/lib/models/date-type.mjs +2 -0
  110. package/esm2020/components/calendar/lib/models/date-validator.mjs +2 -0
  111. package/esm2020/components/calendar/lib/models/index.mjs +4 -0
  112. package/esm2020/components/calendar/lib/pipes/date-label.pipe.mjs +25 -0
  113. package/esm2020/components/calendar/lib/pipes/index.mjs +2 -0
  114. package/esm2020/components/calendar/lib/services/calendar-month.service.mjs +38 -0
  115. package/esm2020/components/calendar/lib/services/calendar-year.service.mjs +31 -0
  116. package/esm2020/components/calendar/lib/services/calendar-years.service.mjs +33 -0
  117. package/esm2020/components/calendar/lib/services/calendar.service.mjs +74 -0
  118. package/esm2020/components/calendar/lib/services/index.mjs +5 -0
  119. package/esm2020/components/calendar/lib/utils/check-identical-date.mjs +11 -0
  120. package/esm2020/components/calendar/lib/utils/get-A11y-label.mjs +10 -0
  121. package/esm2020/components/calendar/lib/utils/index.mjs +8 -0
  122. package/esm2020/components/calendar/lib/utils/parse-date.mjs +15 -0
  123. package/esm2020/components/calendar/lib/utils/validate-max-date.mjs +11 -0
  124. package/esm2020/components/calendar/lib/utils/validate-min-date.mjs +11 -0
  125. package/esm2020/components/calendar/lib/utils/validate-next-date-set.mjs +12 -0
  126. package/esm2020/components/calendar/lib/utils/validate-previous-date-set.mjs +12 -0
  127. package/esm2020/components/calendar/odx-angular-components-calendar.mjs +5 -0
  128. package/esm2020/components/datepicker/index.mjs +6 -0
  129. package/esm2020/components/datepicker/lib/datepicker.component.mjs +118 -0
  130. package/esm2020/components/datepicker/lib/datepicker.config.mjs +7 -0
  131. package/esm2020/components/datepicker/lib/datepicker.module.mjs +19 -0
  132. package/esm2020/components/datepicker/lib/directives/datepicker-input-control.directive.mjs +60 -0
  133. package/esm2020/components/datepicker/lib/directives/index.mjs +2 -0
  134. package/esm2020/components/datepicker/lib/models/datepicker-input-date-order.mjs +6 -0
  135. package/esm2020/components/datepicker/lib/models/datepicker-input-pattern.mjs +11 -0
  136. package/esm2020/components/datepicker/lib/models/index.mjs +3 -0
  137. package/esm2020/components/datepicker/lib/utils/get-datepicker-input-pattern.mjs +16 -0
  138. package/esm2020/components/datepicker/lib/utils/get-datepicker-input-value-as-date.mjs +30 -0
  139. package/esm2020/components/datepicker/lib/utils/index.mjs +3 -0
  140. package/esm2020/components/datepicker/odx-angular-components-datepicker.mjs +5 -0
  141. package/esm2020/components/list/lib/list.component.mjs +4 -4
  142. package/esm2020/components/modal/lib/components/basic-modal/basic-modal.component.mjs +2 -2
  143. package/esm2020/components/modal/lib/components/modal-hero/modal-hero.component.mjs +6 -3
  144. package/esm2020/components/rail-navigation/lib/components/rail-navigation-item/rail-navigation-item.component.mjs +8 -5
  145. package/esm2020/components/rail-navigation/lib/rail-navigation.component.mjs +1 -1
  146. package/esm2020/components/rich-list/lib/rich-list.component.mjs +4 -4
  147. package/esm2020/components/select/lib/directives/index.mjs +2 -2
  148. package/esm2020/components/select/lib/directives/select-input-control.directive.mjs +35 -0
  149. package/esm2020/components/select/lib/select.component.mjs +4 -4
  150. package/esm2020/components/select/lib/select.module.mjs +4 -4
  151. package/esm2020/utils/lib/helpers/index.mjs +2 -2
  152. package/fesm2015/odx-angular-cdk-autocomplete-control.mjs +4 -39
  153. package/fesm2015/odx-angular-cdk-autocomplete-control.mjs.map +1 -1
  154. package/fesm2015/odx-angular-cdk-custom-form-control.mjs +34 -2
  155. package/fesm2015/odx-angular-cdk-custom-form-control.mjs.map +1 -1
  156. package/fesm2015/odx-angular-cdk-expandable.mjs +18 -4
  157. package/fesm2015/odx-angular-cdk-expandable.mjs.map +1 -1
  158. package/fesm2015/odx-angular-charts-config.mjs +13 -13
  159. package/fesm2015/odx-angular-charts-config.mjs.map +1 -1
  160. package/fesm2015/odx-angular-components-accordion.mjs +3 -3
  161. package/fesm2015/odx-angular-components-accordion.mjs.map +1 -1
  162. package/fesm2015/odx-angular-components-autocomplete.mjs +15 -12
  163. package/fesm2015/odx-angular-components-autocomplete.mjs.map +1 -1
  164. package/fesm2015/odx-angular-components-calendar.mjs +623 -0
  165. package/fesm2015/odx-angular-components-calendar.mjs.map +1 -0
  166. package/fesm2015/odx-angular-components-datepicker.mjs +249 -0
  167. package/fesm2015/odx-angular-components-datepicker.mjs.map +1 -0
  168. package/fesm2015/odx-angular-components-list.mjs +3 -3
  169. package/fesm2015/odx-angular-components-list.mjs.map +1 -1
  170. package/fesm2015/odx-angular-components-modal.mjs +6 -3
  171. package/fesm2015/odx-angular-components-modal.mjs.map +1 -1
  172. package/fesm2015/odx-angular-components-rail-navigation.mjs +6 -3
  173. package/fesm2015/odx-angular-components-rail-navigation.mjs.map +1 -1
  174. package/fesm2015/odx-angular-components-rich-list.mjs +3 -3
  175. package/fesm2015/odx-angular-components-rich-list.mjs.map +1 -1
  176. package/fesm2015/odx-angular-components-select.mjs +14 -13
  177. package/fesm2015/odx-angular-components-select.mjs.map +1 -1
  178. package/fesm2015/odx-angular-utils.mjs +21 -21
  179. package/fesm2015/odx-angular-utils.mjs.map +1 -1
  180. package/fesm2020/odx-angular-cdk-autocomplete-control.mjs +4 -39
  181. package/fesm2020/odx-angular-cdk-autocomplete-control.mjs.map +1 -1
  182. package/fesm2020/odx-angular-cdk-custom-form-control.mjs +34 -2
  183. package/fesm2020/odx-angular-cdk-custom-form-control.mjs.map +1 -1
  184. package/fesm2020/odx-angular-cdk-expandable.mjs +18 -4
  185. package/fesm2020/odx-angular-cdk-expandable.mjs.map +1 -1
  186. package/fesm2020/odx-angular-charts-config.mjs +13 -13
  187. package/fesm2020/odx-angular-charts-config.mjs.map +1 -1
  188. package/fesm2020/odx-angular-components-accordion.mjs +3 -3
  189. package/fesm2020/odx-angular-components-accordion.mjs.map +1 -1
  190. package/fesm2020/odx-angular-components-autocomplete.mjs +15 -12
  191. package/fesm2020/odx-angular-components-autocomplete.mjs.map +1 -1
  192. package/fesm2020/odx-angular-components-calendar.mjs +621 -0
  193. package/fesm2020/odx-angular-components-calendar.mjs.map +1 -0
  194. package/fesm2020/odx-angular-components-datepicker.mjs +249 -0
  195. package/fesm2020/odx-angular-components-datepicker.mjs.map +1 -0
  196. package/fesm2020/odx-angular-components-list.mjs +3 -3
  197. package/fesm2020/odx-angular-components-list.mjs.map +1 -1
  198. package/fesm2020/odx-angular-components-modal.mjs +6 -3
  199. package/fesm2020/odx-angular-components-modal.mjs.map +1 -1
  200. package/fesm2020/odx-angular-components-rail-navigation.mjs +6 -3
  201. package/fesm2020/odx-angular-components-rail-navigation.mjs.map +1 -1
  202. package/fesm2020/odx-angular-components-rich-list.mjs +3 -3
  203. package/fesm2020/odx-angular-components-rich-list.mjs.map +1 -1
  204. package/fesm2020/odx-angular-components-select.mjs +14 -13
  205. package/fesm2020/odx-angular-components-select.mjs.map +1 -1
  206. package/fesm2020/odx-angular-utils.mjs +21 -21
  207. package/fesm2020/odx-angular-utils.mjs.map +1 -1
  208. package/package.json +29 -7
  209. package/utils/lib/helpers/index.d.ts +1 -1
  210. package/cdk/autocomplete-control/lib/abstract/index.d.ts +0 -1
  211. package/components/autocomplete/lib/directives/autocomplete-search-field.directive.d.ts +0 -9
  212. package/components/select/lib/directives/select-search-field.directive.d.ts +0 -9
  213. package/esm2020/cdk/autocomplete-control/lib/abstract/base-search-field.directive.mjs +0 -38
  214. package/esm2020/cdk/autocomplete-control/lib/abstract/index.mjs +0 -2
  215. package/esm2020/components/autocomplete/lib/directives/autocomplete-search-field.directive.mjs +0 -26
  216. package/esm2020/components/select/lib/directives/select-search-field.directive.mjs +0 -35
@@ -0,0 +1,621 @@
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 {
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
+ const minDate = this.minDate && validateMinDate(this.minDate, date, this.calendarCurrentView);
146
+ const maxDate = this.maxDate && validateMaxDate(this.maxDate, date, this.calendarCurrentView);
147
+ let isDateFiltered = false;
148
+ if (this.calendarCurrentView === CalendarViewEnum.Month) {
149
+ isDateFiltered = this.filterFn?.(date) ?? false;
150
+ }
151
+ return minDate || maxDate || isDateFiltered;
152
+ }
153
+ isPreviousDateSetDisabled() {
154
+ return this.minDate ? validatePreviousDateSet(this.minDate, this.activeDate, this.calendarCurrentView) : false;
155
+ }
156
+ isNextDateSetDisabled() {
157
+ return this.maxDate ? validateNextDateSet(this.maxDate, this.activeDate, this.calendarCurrentView) : false;
158
+ }
159
+ }
160
+ CalendarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
161
+ CalendarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarService });
162
+ __decorate([
163
+ Pure,
164
+ __metadata("design:type", Function),
165
+ __metadata("design:paramtypes", [Date]),
166
+ __metadata("design:returntype", Boolean)
167
+ ], CalendarService.prototype, "isDateDisabled", null);
168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarService, decorators: [{
169
+ type: Injectable
170
+ }], propDecorators: { isDateDisabled: [] } });
171
+
172
+ class CalendarMonthService {
173
+ constructor() {
174
+ this.calendar = inject(CalendarService);
175
+ this.weekDays$ = this.calendar.activeDate$.pipe(map((date) => this.generateWeekDays(date)));
176
+ this.weeks$ = this.calendar.activeDate$.pipe(map((date) => this.generateWeeks(date)));
177
+ }
178
+ generateWeekDays(date) {
179
+ const firstWeekDay = startOfWeek(date, { weekStartsOn: 1 });
180
+ return Array.from({ length: 7 }, (_, i) => addDays(firstWeekDay, i));
181
+ }
182
+ generateWeeks(date) {
183
+ const startOfTheSelectedMonth = startOfMonth(date);
184
+ const endOfTheSelectedMonth = endOfMonth(date);
185
+ const startDate = startOfWeek(startOfTheSelectedMonth, { weekStartsOn: 1 });
186
+ const endDate = endOfWeek(endOfTheSelectedMonth);
187
+ const allWeeks = [];
188
+ let currentDate = startDate;
189
+ while (currentDate <= endDate) {
190
+ allWeeks.push(this.generateDaysForWeek(currentDate, date));
191
+ currentDate = addDays(currentDate, 7);
192
+ }
193
+ return allWeeks;
194
+ }
195
+ generateDaysForWeek(date, currentDate) {
196
+ return Array.from({ length: 7 }).map((_, i) => addDays(date, i), currentDate);
197
+ }
198
+ }
199
+ CalendarMonthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
200
+ CalendarMonthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService });
201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthService, decorators: [{
202
+ type: Injectable
203
+ }] });
204
+
205
+ class CalendarYearService {
206
+ constructor() {
207
+ this.calendar = inject(CalendarService);
208
+ this.seasonSeparator = 3;
209
+ this.seasons$ = this.calendar.activeDate$.pipe(map((selectedDate) => this.generateSeasons(selectedDate)));
210
+ }
211
+ generateSeasons(date) {
212
+ const seasons = [];
213
+ const months = eachMonthOfInterval({
214
+ start: startOfYear(date),
215
+ end: endOfYear(date),
216
+ });
217
+ let index = 0;
218
+ while (index < months.length) {
219
+ seasons.push(months.slice(index, index + this.seasonSeparator));
220
+ index += this.seasonSeparator;
221
+ }
222
+ return seasons;
223
+ }
224
+ }
225
+ CalendarYearService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
226
+ CalendarYearService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService });
227
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearService, decorators: [{
228
+ type: Injectable
229
+ }] });
230
+
231
+ class CalendarYearsService {
232
+ constructor() {
233
+ this.yearsSeparator = 3;
234
+ this.yearsLimit = 100;
235
+ this.date = new Date();
236
+ }
237
+ get years() {
238
+ const startDate = startOfYear(addYears(this.date, -this.yearsLimit));
239
+ const startYear = getYear(startDate);
240
+ const endDate = startOfYear(addYears(this.date, this.yearsLimit));
241
+ const endYear = getYear(endDate);
242
+ const years = [];
243
+ const yearRows = [];
244
+ for (let i = startYear; i <= endYear; i++) {
245
+ years.push(setYear(startDate, i));
246
+ }
247
+ let index = 0;
248
+ while (index < years.length) {
249
+ yearRows.push(years.slice(index, index + this.yearsSeparator));
250
+ index += this.yearsSeparator;
251
+ }
252
+ return yearRows;
253
+ }
254
+ }
255
+ CalendarYearsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
256
+ CalendarYearsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService });
257
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsService, decorators: [{
258
+ type: Injectable
259
+ }] });
260
+
261
+ let CalendarHeaderComponent = class CalendarHeaderComponent {
262
+ constructor() {
263
+ this.calendar = inject(CalendarService);
264
+ this.element = injectElement();
265
+ this.previous = new EventEmitter();
266
+ this.next = new EventEmitter();
267
+ this.changeView = new EventEmitter();
268
+ this.config = injectCalendarConfig();
269
+ }
270
+ previousClicked(event) {
271
+ !this.isPreviousDisabled && this.previous.emit(event);
272
+ }
273
+ nextClicked(event) {
274
+ !this.isNextDisabled && this.next.emit(event);
275
+ }
276
+ get isPreviousDisabled() {
277
+ return this.calendar.isPreviousDateSetDisabled();
278
+ }
279
+ get isNextDisabled() {
280
+ return this.calendar.isNextDateSetDisabled();
281
+ }
282
+ };
283
+ CalendarHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
284
+ 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 });
285
+ CalendarHeaderComponent = __decorate([
286
+ CSSComponent('calendar-header')
287
+ ], CalendarHeaderComponent);
288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarHeaderComponent, decorators: [{
289
+ type: Component,
290
+ 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" }]
291
+ }], propDecorators: { previous: [{
292
+ type: Output
293
+ }], next: [{
294
+ type: Output
295
+ }], changeView: [{
296
+ type: Output
297
+ }] } });
298
+
299
+ class DateLabelPipe {
300
+ constructor() {
301
+ this.config = injectCalendarConfig();
302
+ }
303
+ transform(value, dateFormat) {
304
+ if (!value)
305
+ return '';
306
+ return format(value, dateFormat, { locale: this.config.locale.getValue() });
307
+ }
308
+ }
309
+ DateLabelPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
310
+ DateLabelPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, isStandalone: true, name: "odxDateLabel", pure: false });
311
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateLabelPipe, decorators: [{
312
+ type: Pipe,
313
+ args: [{
314
+ pure: false,
315
+ name: 'odxDateLabel',
316
+ standalone: true,
317
+ }]
318
+ }] });
319
+
320
+ let CalendarCellDirective = class CalendarCellDirective {
321
+ constructor() {
322
+ this.disabledController = DisabledController.inject();
323
+ this.isActive = false;
324
+ this.isSelected = false;
325
+ this.isCurrent = false;
326
+ this.adjacent = false;
327
+ this.element = injectElement();
328
+ this.dateLabelPipe = inject(DateLabelPipe);
329
+ this.config = injectCalendarConfig();
330
+ this.calendarView = CalendarViewEnum.Month;
331
+ this.activeDate = null;
332
+ this.selectedDate = null;
333
+ }
334
+ get isDisabled() {
335
+ return !!this.disabledController?.disabled;
336
+ }
337
+ ngOnChanges(changes) {
338
+ if (hasChanged(changes, ['date'], false)) {
339
+ this.isCurrent = checkIdenticalDate(this.date, new Date(), this.calendarView);
340
+ }
341
+ if (this.activeDate && hasChanged(changes, ['date', 'activeDate'], false)) {
342
+ this.isActive = checkIdenticalDate(this.date, this.activeDate, this.calendarView);
343
+ if (this.calendarView === CalendarViewEnum.Month) {
344
+ this.adjacent = !isSameMonth(this.date, this.activeDate);
345
+ }
346
+ }
347
+ if (this.selectedDate && hasChanged(changes, ['date', 'selectedDate'], false)) {
348
+ this.isSelected = checkIdenticalDate(this.date, this.selectedDate, this.calendarView);
349
+ }
350
+ if (this.isActive) {
351
+ deferFn(() => this.element.nativeElement.focus());
352
+ }
353
+ }
354
+ get ariaLabel() {
355
+ const dateFormat = getA11yLabel(this.calendarView, this.config);
356
+ return this.dateLabelPipe.transform(this.date, dateFormat);
357
+ }
358
+ };
359
+ CalendarCellDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
360
+ 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 });
361
+ __decorate([
362
+ CSSModifier(),
363
+ __metadata("design:type", Object)
364
+ ], CalendarCellDirective.prototype, "isCurrent", void 0);
365
+ __decorate([
366
+ CSSModifier(),
367
+ __metadata("design:type", Object)
368
+ ], CalendarCellDirective.prototype, "adjacent", void 0);
369
+ CalendarCellDirective = __decorate([
370
+ CSSComponent('calendar-cell')
371
+ ], CalendarCellDirective);
372
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarCellDirective, decorators: [{
373
+ type: Directive,
374
+ args: [{
375
+ selector: '[odxCalendarCell]',
376
+ standalone: true,
377
+ providers: [DisabledController.connect(), DateLabelPipe],
378
+ host: {
379
+ '[class.is-disabled]': 'isDisabled',
380
+ '[class.is-selected]': 'isSelected',
381
+ '[tabindex]': 'isActive ? 0 : -1',
382
+ '[attr.aria-label]': 'ariaLabel',
383
+ '[attr.aria-disabled]': 'isDisabled',
384
+ },
385
+ }]
386
+ }], propDecorators: { isCurrent: [], adjacent: [], date: [{
387
+ type: Input,
388
+ args: ['odxCalendarCell']
389
+ }], calendarView: [{
390
+ type: Input,
391
+ args: ['odxCalendarCellCalendarView']
392
+ }], activeDate: [{
393
+ type: Input,
394
+ args: ['odxCalendarCellActiveDate']
395
+ }], selectedDate: [{
396
+ type: Input,
397
+ args: ['odxCalendarCellSelectedDate']
398
+ }] } });
399
+
400
+ class CalendarViewDirective {
401
+ constructor() {
402
+ this.takeUntilDestroyed = untilDestroyed();
403
+ this.calendar = inject(CalendarService);
404
+ this.config = injectCalendarConfig();
405
+ this.element = injectElement();
406
+ }
407
+ get activeDate() {
408
+ return this.calendar.activeDate;
409
+ }
410
+ trackByIndex(index) {
411
+ return index;
412
+ }
413
+ isDateDisabled(value) {
414
+ return this.calendar.isDateDisabled(value);
415
+ }
416
+ changeView() {
417
+ this.calendar.changeView(this.calendarNextView);
418
+ }
419
+ updateActiveDate(event, date) {
420
+ event.preventDefault();
421
+ event.stopPropagation();
422
+ this.calendar.setActiveDate(date);
423
+ }
424
+ }
425
+ CalendarViewDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarViewDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
426
+ CalendarViewDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CalendarViewDirective, isStandalone: true, ngImport: i0 });
427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarViewDirective, decorators: [{
428
+ type: Directive,
429
+ args: [{
430
+ standalone: true,
431
+ }]
432
+ }] });
433
+
434
+ let CalendarMonthComponent = class CalendarMonthComponent extends CalendarViewDirective {
435
+ constructor() {
436
+ super(...arguments);
437
+ this.calendarMonth = inject(CalendarMonthService);
438
+ this.calendarNextView = CalendarViewEnum.Years;
439
+ this.calendarCurrentView = CalendarViewEnum.Month;
440
+ this.selectedChange = new EventEmitter();
441
+ }
442
+ previousDay(event) {
443
+ this.updateActiveDate(event, subDays(this.activeDate, 1));
444
+ }
445
+ nextDay(event) {
446
+ this.updateActiveDate(event, addDays(this.activeDate, 1));
447
+ }
448
+ previousWeek(event) {
449
+ this.updateActiveDate(event, subWeeks(this.activeDate, 1));
450
+ }
451
+ nextWeek(event) {
452
+ this.updateActiveDate(event, addWeeks(this.activeDate, 1));
453
+ }
454
+ previousMonth(event) {
455
+ this.updateActiveDate(event, subMonths(this.activeDate, 1));
456
+ }
457
+ nextMonth(event) {
458
+ this.updateActiveDate(event, addMonths(this.activeDate, 1));
459
+ }
460
+ selectDate(value) {
461
+ if (this.isDateDisabled(value))
462
+ return;
463
+ this.calendar.selectDate(value);
464
+ this.selectedChange.emit(value);
465
+ }
466
+ };
467
+ CalendarMonthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
468
+ 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 });
469
+ CalendarMonthComponent = __decorate([
470
+ CSSComponent('calendar-month')
471
+ ], CalendarMonthComponent);
472
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarMonthComponent, decorators: [{
473
+ type: Component,
474
+ 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" }]
475
+ }], propDecorators: { selectedChange: [{
476
+ type: Output
477
+ }] } });
478
+
479
+ let CalendarYearComponent = class CalendarYearComponent extends CalendarViewDirective {
480
+ constructor() {
481
+ super(...arguments);
482
+ this.calendarYear = inject(CalendarYearService);
483
+ this.calendarNextView = CalendarViewEnum.Month;
484
+ this.calendarCurrentView = CalendarViewEnum.Year;
485
+ }
486
+ previousMonth(event) {
487
+ this.updateActiveDate(event, subMonths(this.activeDate, 1));
488
+ }
489
+ nextMonth(event) {
490
+ this.updateActiveDate(event, addMonths(this.activeDate, 1));
491
+ }
492
+ previousSeason(event) {
493
+ this.updateActiveDate(event, subMonths(this.activeDate, 3));
494
+ }
495
+ nextSeason(event) {
496
+ this.updateActiveDate(event, addMonths(this.activeDate, 3));
497
+ }
498
+ previousYear(event) {
499
+ this.updateActiveDate(event, subMonths(this.activeDate, 12));
500
+ }
501
+ nextYear(event) {
502
+ this.updateActiveDate(event, addMonths(this.activeDate, 12));
503
+ }
504
+ selectDate(value) {
505
+ if (this.isDateDisabled(value))
506
+ return;
507
+ const date = setMonth(this.calendar.activeDate, getMonth(value));
508
+ this.calendar.selectDate(date);
509
+ this.changeView();
510
+ }
511
+ };
512
+ CalendarYearComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
513
+ 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 });
514
+ CalendarYearComponent = __decorate([
515
+ CSSComponent('calendar-year')
516
+ ], CalendarYearComponent);
517
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearComponent, decorators: [{
518
+ type: Component,
519
+ 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" }]
520
+ }] });
521
+
522
+ let CalendarYearsComponent = class CalendarYearsComponent extends CalendarViewDirective {
523
+ constructor() {
524
+ super(...arguments);
525
+ this.document = inject(DOCUMENT);
526
+ this.calendarYears = inject(CalendarYearsService);
527
+ this.calendarNextView = CalendarViewEnum.Year;
528
+ this.calendarCurrentView = CalendarViewEnum.Years;
529
+ }
530
+ ngAfterViewInit() {
531
+ deferFn(() => this.scrollCurrentYearIntoView());
532
+ }
533
+ previousYear(event) {
534
+ this.updateActiveDate(event, subMonths(this.activeDate, 12));
535
+ }
536
+ nextYear(event) {
537
+ this.updateActiveDate(event, addMonths(this.activeDate, 12));
538
+ }
539
+ previousRow(event) {
540
+ this.updateActiveDate(event, subMonths(this.activeDate, 12 * 3));
541
+ }
542
+ nextRow(event) {
543
+ this.updateActiveDate(event, addMonths(this.activeDate, 12 * 3));
544
+ }
545
+ selectDate(value) {
546
+ if (this.isDateDisabled(value))
547
+ return;
548
+ const date = setYear(this.calendar.activeDate, getYear(value));
549
+ this.calendar.selectDate(date);
550
+ this.changeView();
551
+ }
552
+ scrollCurrentYearIntoView() {
553
+ const selectedYear = this.document.querySelector('.odx-calendar-cell.is-selected');
554
+ const currentYear = this.document.querySelector('.odx-calendar-cell--is-current');
555
+ const element = selectedYear || currentYear;
556
+ if (element && isFunction(element.scrollIntoView)) {
557
+ element.scrollIntoView({ block: 'center', behavior: 'smooth' });
558
+ }
559
+ }
560
+ };
561
+ CalendarYearsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
562
+ 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 });
563
+ CalendarYearsComponent = __decorate([
564
+ CSSComponent('calendar-years')
565
+ ], CalendarYearsComponent);
566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarYearsComponent, decorators: [{
567
+ type: Component,
568
+ 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" }]
569
+ }] });
570
+
571
+ let CalendarComponent = class CalendarComponent {
572
+ constructor() {
573
+ this.calendar = inject(CalendarService);
574
+ this.element = injectElement();
575
+ this.calendarView = CalendarViewEnum;
576
+ this.minDate = null;
577
+ this.maxDate = null;
578
+ this.filterFn = null;
579
+ this.selectedChange = new EventEmitter();
580
+ }
581
+ set selectedDate(value) {
582
+ this.calendar.selectDate(value);
583
+ }
584
+ ngOnChanges(changes) {
585
+ if (hasChanged(changes, 'minDate', false)) {
586
+ this.calendar.minDate = this.minDate;
587
+ }
588
+ if (hasChanged(changes, 'maxDate', false)) {
589
+ this.calendar.maxDate = this.maxDate;
590
+ }
591
+ if (hasChanged(changes, 'filterFn', false)) {
592
+ this.calendar.filterFn = this.filterFn;
593
+ }
594
+ }
595
+ };
596
+ CalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
597
+ 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 });
598
+ CalendarComponent = __decorate([
599
+ CSSComponent('calendar')
600
+ ], CalendarComponent);
601
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarComponent, decorators: [{
602
+ type: Component,
603
+ 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" }]
604
+ }], propDecorators: { selectedDate: [{
605
+ type: Input
606
+ }], minDate: [{
607
+ type: Input
608
+ }], maxDate: [{
609
+ type: Input
610
+ }], filterFn: [{
611
+ type: Input
612
+ }], selectedChange: [{
613
+ type: Output
614
+ }] } });
615
+
616
+ /**
617
+ * Generated bundle index. Do not edit.
618
+ */
619
+
620
+ export { CalendarComponent, CalendarConfig, CalendarDefaultConfig, CalendarViewEnum, DateLabelPipe, injectCalendarConfig, provideCalendarConfig };
621
+ //# sourceMappingURL=odx-angular-components-calendar.mjs.map