@progress/kendo-angular-dateinputs 21.4.1 → 22.0.0-develop.1

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 (141) hide show
  1. package/calendar/localization/calendar-messages.d.ts +1 -1
  2. package/calendar/localization/multiview-calendar-messages.d.ts +1 -1
  3. package/dateinput/localization/messages.d.ts +1 -1
  4. package/datepicker/localization/messages.d.ts +1 -1
  5. package/daterange/date-range-input.d.ts +1 -1
  6. package/daterange/localization/messages.d.ts +1 -1
  7. package/datetimepicker/localization/messages.d.ts +1 -1
  8. package/fesm2022/progress-kendo-angular-dateinputs.mjs +262 -262
  9. package/package.json +15 -23
  10. package/timepicker/localization/messages.d.ts +1 -1
  11. package/esm2022/calendar/calendar.component.mjs +0 -1711
  12. package/esm2022/calendar/calendar.module.mjs +0 -91
  13. package/esm2022/calendar/calendars.module.mjs +0 -87
  14. package/esm2022/calendar/footer.component.mjs +0 -77
  15. package/esm2022/calendar/for.directive.mjs +0 -116
  16. package/esm2022/calendar/header.component.mjs +0 -367
  17. package/esm2022/calendar/horizontal-view-list.component.mjs +0 -580
  18. package/esm2022/calendar/localization/calendar-custom-messages.component.mjs +0 -51
  19. package/esm2022/calendar/localization/calendar-localized-messages.directive.mjs +0 -39
  20. package/esm2022/calendar/localization/calendar-messages.mjs +0 -45
  21. package/esm2022/calendar/localization/multiview-calendar-custom-messages.component.mjs +0 -51
  22. package/esm2022/calendar/localization/multiview-calendar-localized-messages.directive.mjs +0 -39
  23. package/esm2022/calendar/localization/multiview-calendar-messages.mjs +0 -45
  24. package/esm2022/calendar/models/cell-context.interface.mjs +0 -5
  25. package/esm2022/calendar/models/navigation-action.enum.mjs +0 -20
  26. package/esm2022/calendar/models/orientation.mjs +0 -5
  27. package/esm2022/calendar/models/row-length-options.interface.mjs +0 -5
  28. package/esm2022/calendar/models/scrollable.interface.mjs +0 -5
  29. package/esm2022/calendar/models/selection-range-end.type.mjs +0 -5
  30. package/esm2022/calendar/models/selection-range.interface.mjs +0 -10
  31. package/esm2022/calendar/models/selection.mjs +0 -50
  32. package/esm2022/calendar/models/type.mjs +0 -5
  33. package/esm2022/calendar/models/view-service.interface.mjs +0 -5
  34. package/esm2022/calendar/models/view.enum.mjs +0 -16
  35. package/esm2022/calendar/models/view.type.mjs +0 -5
  36. package/esm2022/calendar/multiview-calendar.component.mjs +0 -1564
  37. package/esm2022/calendar/multiview-calendar.module.mjs +0 -89
  38. package/esm2022/calendar/navigation.component.mjs +0 -230
  39. package/esm2022/calendar/services/bus-view.service.mjs +0 -83
  40. package/esm2022/calendar/services/century-view.service.mjs +0 -219
  41. package/esm2022/calendar/services/decade-view.service.mjs +0 -217
  42. package/esm2022/calendar/services/disabled-dates.service.mjs +0 -66
  43. package/esm2022/calendar/services/dom.service.mjs +0 -203
  44. package/esm2022/calendar/services/month-view.service.mjs +0 -223
  45. package/esm2022/calendar/services/navigation.service.mjs +0 -60
  46. package/esm2022/calendar/services/scroll-sync.service.mjs +0 -89
  47. package/esm2022/calendar/services/selection.service.mjs +0 -62
  48. package/esm2022/calendar/services/weeknames.service.mjs +0 -33
  49. package/esm2022/calendar/services/year-view.service.mjs +0 -204
  50. package/esm2022/calendar/templates/cell-template.directive.mjs +0 -45
  51. package/esm2022/calendar/templates/century-cell-template.directive.mjs +0 -43
  52. package/esm2022/calendar/templates/decade-cell-template.directive.mjs +0 -43
  53. package/esm2022/calendar/templates/footer-template.directive.mjs +0 -44
  54. package/esm2022/calendar/templates/header-template.directive.mjs +0 -47
  55. package/esm2022/calendar/templates/header-title-template.directive.mjs +0 -43
  56. package/esm2022/calendar/templates/month-cell-template.directive.mjs +0 -43
  57. package/esm2022/calendar/templates/navigation-item-template.directive.mjs +0 -43
  58. package/esm2022/calendar/templates/weeknumber-cell-template.directive.mjs +0 -43
  59. package/esm2022/calendar/templates/year-cell-template.directive.mjs +0 -43
  60. package/esm2022/calendar/view-list.component.mjs +0 -497
  61. package/esm2022/calendar/view.component.mjs +0 -432
  62. package/esm2022/common/dom-queries.mjs +0 -24
  63. package/esm2022/common/models/fillmode.mjs +0 -5
  64. package/esm2022/common/models/rounded.mjs +0 -5
  65. package/esm2022/common/models/size.mjs +0 -5
  66. package/esm2022/common/models/week-days-format.mjs +0 -5
  67. package/esm2022/common/picker.service.mjs +0 -17
  68. package/esm2022/common/utils.mjs +0 -70
  69. package/esm2022/dateinput/arrow.enum.mjs +0 -13
  70. package/esm2022/dateinput/dateinput.component.mjs +0 -1196
  71. package/esm2022/dateinput/dateinput.module.mjs +0 -45
  72. package/esm2022/dateinput/localization/dateinput-custom-messages.component.mjs +0 -60
  73. package/esm2022/dateinput/localization/dateinput-localized-messages.directive.mjs +0 -39
  74. package/esm2022/dateinput/localization/messages.mjs +0 -39
  75. package/esm2022/dateinput/models/format-placeholder.model.mjs +0 -5
  76. package/esm2022/dateinput/models/format-settings.model.mjs +0 -5
  77. package/esm2022/dateinput/models/incremental-steps.model.mjs +0 -5
  78. package/esm2022/dateinputs.module.mjs +0 -136
  79. package/esm2022/datepicker/datepicker.component.mjs +0 -1758
  80. package/esm2022/datepicker/datepicker.module.mjs +0 -83
  81. package/esm2022/datepicker/localization/datepicker-custom-messages.component.mjs +0 -53
  82. package/esm2022/datepicker/localization/datepicker-localized-messages.directive.mjs +0 -39
  83. package/esm2022/datepicker/localization/messages.mjs +0 -63
  84. package/esm2022/daterange/auto-correct-on.type.mjs +0 -5
  85. package/esm2022/daterange/date-range-end-input.directive.mjs +0 -105
  86. package/esm2022/daterange/date-range-input.mjs +0 -138
  87. package/esm2022/daterange/date-range-popup-template.directive.mjs +0 -36
  88. package/esm2022/daterange/date-range-popup.component.mjs +0 -1051
  89. package/esm2022/daterange/date-range-selection.directive.mjs +0 -223
  90. package/esm2022/daterange/date-range-start-input.directive.mjs +0 -109
  91. package/esm2022/daterange/date-range.component.mjs +0 -116
  92. package/esm2022/daterange/date-range.module.mjs +0 -103
  93. package/esm2022/daterange/date-range.service.mjs +0 -225
  94. package/esm2022/daterange/localization/daterange-popup-custom-messages.component.mjs +0 -43
  95. package/esm2022/daterange/localization/daterange-popup-localized-messages.directive.mjs +0 -39
  96. package/esm2022/daterange/localization/messages.mjs +0 -51
  97. package/esm2022/datetimepicker/datetimepicker.component.mjs +0 -2505
  98. package/esm2022/datetimepicker/datetimepicker.module.mjs +0 -106
  99. package/esm2022/datetimepicker/localization/datetimepicker-custom-messages.component.mjs +0 -52
  100. package/esm2022/datetimepicker/localization/localized-messages.directive.mjs +0 -39
  101. package/esm2022/datetimepicker/localization/messages.mjs +0 -153
  102. package/esm2022/datetimepicker/models/active-tab.type.mjs +0 -5
  103. package/esm2022/defaults.mjs +0 -24
  104. package/esm2022/directives.mjs +0 -146
  105. package/esm2022/index.mjs +0 -78
  106. package/esm2022/package-metadata.mjs +0 -16
  107. package/esm2022/popup-settings.model.mjs +0 -5
  108. package/esm2022/preventable-event.mjs +0 -27
  109. package/esm2022/progress-kendo-angular-dateinputs.mjs +0 -8
  110. package/esm2022/timepicker/localization/messages.mjs +0 -105
  111. package/esm2022/timepicker/localization/timepicker-custom-messages.component.mjs +0 -54
  112. package/esm2022/timepicker/localization/timepicker-localized-messages.directive.mjs +0 -39
  113. package/esm2022/timepicker/localization/timeselector-custom-messages.component.mjs +0 -45
  114. package/esm2022/timepicker/localization/timeselector-localized-messages.directive.mjs +0 -39
  115. package/esm2022/timepicker/models/incremental-steps.model.mjs +0 -5
  116. package/esm2022/timepicker/models/list-item.interface.mjs +0 -5
  117. package/esm2022/timepicker/models/list-service-settings.mjs +0 -5
  118. package/esm2022/timepicker/models/list-service.interface.mjs +0 -5
  119. package/esm2022/timepicker/models/time-part.default.mjs +0 -14
  120. package/esm2022/timepicker/services/dayperiod.service.mjs +0 -131
  121. package/esm2022/timepicker/services/dom.service.mjs +0 -126
  122. package/esm2022/timepicker/services/hours.service.mjs +0 -130
  123. package/esm2022/timepicker/services/milliseconds.service.mjs +0 -131
  124. package/esm2022/timepicker/services/minutes.service.mjs +0 -128
  125. package/esm2022/timepicker/services/seconds.service.mjs +0 -128
  126. package/esm2022/timepicker/timelist.component.mjs +0 -388
  127. package/esm2022/timepicker/timepicker.component.mjs +0 -1598
  128. package/esm2022/timepicker/timepicker.module.mjs +0 -71
  129. package/esm2022/timepicker/timeselector.component.mjs +0 -728
  130. package/esm2022/timepicker/util.mjs +0 -70
  131. package/esm2022/util.mjs +0 -406
  132. package/esm2022/validators/disabled-date.validator.mjs +0 -18
  133. package/esm2022/validators/disabled-dates-range.validator.mjs +0 -26
  134. package/esm2022/validators/incomplete-date.validator.mjs +0 -18
  135. package/esm2022/validators/max.validator.mjs +0 -21
  136. package/esm2022/validators/min.validator.mjs +0 -21
  137. package/esm2022/validators/time-range.validator.mjs +0 -23
  138. package/esm2022/virtualization/models/scrollable.interface.mjs +0 -5
  139. package/esm2022/virtualization/services/row-height.service.mjs +0 -73
  140. package/esm2022/virtualization/services/scroller.service.mjs +0 -109
  141. package/esm2022/virtualization/virtualization.component.mjs +0 -324
@@ -1,1711 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Component, ChangeDetectorRef, ChangeDetectionStrategy, ContentChild, EventEmitter, ElementRef, Renderer2, isDevMode, forwardRef, HostBinding, Input, Output, ViewChild, Optional, NgZone, Injector } from '@angular/core';
6
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, NgControl } from '@angular/forms';
7
- import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { cloneDate, isEqual } from '@progress/kendo-date-math';
9
- import { hasObservers, KendoInput, guid, Keys, isObject, ResizeSensorComponent, normalizeKeys } from '@progress/kendo-angular-common';
10
- import { validatePackage } from '@progress/kendo-licensing';
11
- import { packageMetadata } from '../package-metadata';
12
- import { MultiViewCalendarComponent } from './multiview-calendar.component';
13
- import { NavigationComponent } from './navigation.component';
14
- import { ViewListComponent } from './view-list.component';
15
- import { CalendarDOMService } from './services/dom.service';
16
- import { BusViewService } from './services/bus-view.service';
17
- import { NavigationService } from './services/navigation.service';
18
- import { DisabledDatesService } from './services/disabled-dates.service';
19
- import { SelectionService } from './services/selection.service';
20
- import { ScrollSyncService } from './services/scroll-sync.service';
21
- import { CellTemplateDirective } from './templates/cell-template.directive';
22
- import { MonthCellTemplateDirective } from './templates/month-cell-template.directive';
23
- import { YearCellTemplateDirective } from './templates/year-cell-template.directive';
24
- import { DecadeCellTemplateDirective } from './templates/decade-cell-template.directive';
25
- import { CenturyCellTemplateDirective } from './templates/century-cell-template.directive';
26
- import { WeekNumberCellTemplateDirective } from './templates/weeknumber-cell-template.directive';
27
- import { HeaderTitleTemplateDirective } from './templates/header-title-template.directive';
28
- import { NavigationItemTemplateDirective } from './templates/navigation-item-template.directive';
29
- import { PickerService } from '../common/picker.service';
30
- import { CalendarViewEnum } from './models/view.enum';
31
- import { handleRangeSelection } from './models/selection';
32
- import { minValidator } from '../validators/min.validator';
33
- import { maxValidator } from '../validators/max.validator';
34
- import { MIN_DATE, MAX_DATE } from '../defaults';
35
- import { areDatesEqual, dateInRange, DEFAULT_SIZE, getSizeClass, getToday, hasExistingValue, last, noop } from '../util';
36
- import { closest } from '../common/dom-queries';
37
- import { requiresZoneOnBlur, preventDefault, isPresent, isArrowWithShiftPressed, selectors, attributeNames, isNullOrDate } from '../common/utils';
38
- import { from as fromPromise } from 'rxjs';
39
- import { HeaderTemplateDirective } from './templates/header-template.directive';
40
- import { FooterTemplateDirective } from './templates/footer-template.directive';
41
- import { MultiViewCalendarCustomMessagesComponent } from './localization/multiview-calendar-custom-messages.component';
42
- import { CalendarLocalizedMessagesDirective } from './localization/calendar-localized-messages.directive';
43
- import * as i0 from "@angular/core";
44
- import * as i1 from "./services/bus-view.service";
45
- import * as i2 from "./services/dom.service";
46
- import * as i3 from "./services/navigation.service";
47
- import * as i4 from "./services/scroll-sync.service";
48
- import * as i5 from "./services/disabled-dates.service";
49
- import * as i6 from "@progress/kendo-angular-l10n";
50
- import * as i7 from "./services/selection.service";
51
- import * as i8 from "../common/picker.service";
52
- const BOTTOM_VIEW_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/dateinputs/api/CalendarComponent/#toc-bottomview';
53
- const TOP_VIEW_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/dateinputs/api/CalendarComponent/#toc-topview';
54
- const MIN_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/dateinputs/api/CalendarComponent/#toc-min';
55
- const MAX_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/dateinputs/api/CalendarComponent/#toc-max';
56
- const VALUE_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/dateinputs/calendar/#toc-using-with-json';
57
- const virtualizationProp = x => x ? x.virtualization : null;
58
- /**
59
- * @hidden
60
- */
61
- export const CALENDAR_VALUE_ACCESSOR = {
62
- multi: true,
63
- provide: NG_VALUE_ACCESSOR,
64
- useExisting: forwardRef(() => CalendarComponent)
65
- };
66
- /**
67
- * @hidden
68
- */
69
- export const CALENDAR_RANGE_VALIDATORS = {
70
- multi: true,
71
- provide: NG_VALIDATORS,
72
- useExisting: forwardRef(() => CalendarComponent)
73
- };
74
- /**
75
- * @hidden
76
- */
77
- export const KENDO_INPUT_PROVIDER = {
78
- provide: KendoInput,
79
- useExisting: forwardRef(() => CalendarComponent)
80
- };
81
- /**
82
- * Represents the [Kendo UI Calendar component for Angular](slug:overview_calendar).
83
- * @example
84
- * ```html
85
- * <kendo-calendar></kendo-calendar>
86
- * ```
87
- *
88
- * @remarks
89
- * Supported children components are: {@link CalendarCustomMessagesComponent}.
90
- */
91
- export class CalendarComponent {
92
- bus;
93
- dom;
94
- element;
95
- navigator;
96
- renderer;
97
- cdr;
98
- ngZone;
99
- injector;
100
- scrollSyncService;
101
- disabledDatesService;
102
- localization;
103
- selectionService;
104
- pickerService;
105
- /**
106
- * Shows days that fall outside the current month and the default values per Calendar type are false for infinite and true for classic ([see example]({% slug viewoptions_calendar %}#toc-displaying-other-month-days)).
107
- */
108
- set showOtherMonthDays(_showOtherMonthDays) {
109
- this._showOtherMonthDays = _showOtherMonthDays;
110
- }
111
- get showOtherMonthDays() {
112
- if (this._showOtherMonthDays === undefined) {
113
- return this.type === 'classic';
114
- }
115
- return this._showOtherMonthDays;
116
- }
117
- _showOtherMonthDays;
118
- /**
119
- * @hidden
120
- */
121
- id;
122
- /**
123
- * @hidden
124
- */
125
- get popupId() {
126
- return `kendo-popup-${this.bus.calendarId}`;
127
- }
128
- /**
129
- * Specifies the focused date of the Calendar
130
- * ([see example]({% slug dates_calendar %}#toc-focused-dates)).
131
- *
132
- * If the Calendar is outside the `min` or `max` range, the component normalizes the defined `focusedDate`.
133
- */
134
- set focusedDate(focusedDate) {
135
- if (this.activeViewDate && !isEqual(this._focusedDate, focusedDate)) {
136
- const service = this.bus.service(this.activeViewEnum);
137
- const lastDayInPeriod = service.lastDayOfPeriod(this.activeViewDate);
138
- const isFocusedDateInRange = service.isInRange(focusedDate, this.activeViewDate, lastDayInPeriod);
139
- if (!isFocusedDateInRange) {
140
- this.emitNavigate(focusedDate);
141
- }
142
- }
143
- this._focusedDate = focusedDate || getToday();
144
- this.setAriaActivedescendant();
145
- }
146
- get focusedDate() {
147
- if (this._focusedDate > this.max) {
148
- return this.max;
149
- }
150
- if (this._focusedDate < this.min) {
151
- return this.min;
152
- }
153
- return this._focusedDate;
154
- }
155
- /**
156
- * @hidden
157
- */
158
- get headerId() {
159
- return this.id + '-header';
160
- }
161
- /**
162
- * Specifies the minimum allowed date value
163
- * ([see example]({% slug dateranges_calendar %})).
164
- *
165
- * @default 1900-1-1
166
- */
167
- set min(min) {
168
- this._min = min || new Date(MIN_DATE);
169
- }
170
- get min() {
171
- return this._min;
172
- }
173
- /**
174
- * Specifies the maximum allowed date value
175
- * ([see example]({% slug dateranges_calendar %})).
176
- *
177
- * @default 2099-12-31
178
- */
179
- set max(max) {
180
- this._max = max || new Date(MAX_DATE);
181
- }
182
- get max() {
183
- return this._max;
184
- }
185
- /**
186
- * Determines whether the built-in `min` or `max` validators are enforced when validating a form.
187
- *
188
- * @default false
189
- */
190
- rangeValidation = false;
191
- /**
192
- * Specifies the format of the displayed week day names.
193
- *
194
- * @default 'short'
195
- */
196
- weekDaysFormat = "short";
197
- /**
198
- * Toggles the visibility of the footer.
199
- *
200
- * @default false
201
- */
202
- footer = false;
203
- /**
204
- * Sets the Calendar selection mode
205
- * ([see example]({% slug selection_calendar %})).
206
- * @default 'single'
207
- */
208
- set selection(_selection) {
209
- this._selection = _selection;
210
- this.selectionSetter = true;
211
- }
212
- get selection() {
213
- return this._selection;
214
- }
215
- _selection = 'single';
216
- /**
217
- * Allows reverse selection when using `range` selection.
218
- * If `allowReverse` is set to `true`, the component skips the validation of whether the start date is after the end date.
219
- *
220
- * @default false
221
- */
222
- allowReverse = false;
223
- /**
224
- * Sets or gets the `value` property of the Calendar and defines the selected value of the component.
225
- *
226
- * The `value` has to be a valid [JavaScript `Date`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date) instance when in `single` selection mode, an array of valid JavaScript Date instances when in `multiple` selection mode, or an object of type `SelectionRange` when in `range` selection mode.
227
- */
228
- set value(candidate) {
229
- this.valueSetter = true;
230
- this._value = candidate;
231
- }
232
- get value() {
233
- return this._value;
234
- }
235
- /**
236
- * Sets or gets the `disabled` property of the Calendar and
237
- * determines whether the component is active
238
- * ([see example]({% slug disabled_calendar %})).
239
- * To learn how to disable the component in reactive forms, refer to the article on [Forms Support](slug:formssupport_calendar#toc-managing-the-calendar-disabled-state-in-reactive-forms).
240
- */
241
- disabled = false;
242
- /**
243
- * Specifies the `tabindex` property of the Calendar. Based on the
244
- * [HTML `tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) behavior,
245
- * it determines whether the component is focusable.
246
- *
247
- * @default 0
248
- */
249
- tabindex = 0;
250
- /**
251
- * @hidden
252
- */
253
- set tabIndex(tabIndex) {
254
- this.tabindex = tabIndex;
255
- }
256
- get tabIndex() {
257
- return this.tabindex;
258
- }
259
- /**
260
- * Specifies the dates of the Calendar that will be disabled
261
- * ([see example]({% slug disabled_dates_calendar %})).
262
- */
263
- set disabledDates(value) {
264
- this.disabledDatesService.initialize(value);
265
- this._disabledDates = value;
266
- }
267
- get disabledDates() {
268
- return this._disabledDates;
269
- }
270
- /**
271
- * Determines whether the navigation side-bar will be displayed
272
- * ([see example]({% slug sidebar_calendar %})).
273
- * Applies to the [`infinite`]({% slug api_dateinputs_calendarcomponent %}#toc-type) Calendar only.
274
- *
275
- * @default true
276
- */
277
- navigation = true;
278
- /**
279
- * Defines the active view that the Calendar initially renders
280
- * ([see example]({% slug viewoptions_calendar %})).
281
- * You have to set `activeView` within the `topView`-`bottomView` range.
282
- *
283
- * @default 'month'
284
- */
285
- activeView = CalendarViewEnum[CalendarViewEnum.month];
286
- /**
287
- * Defines the bottommost view to which the user can navigate
288
- * ([see example](slug:viewdepth_calendar)).
289
- *
290
- * @default 'month'
291
- */
292
- bottomView = CalendarViewEnum[CalendarViewEnum.month];
293
- /**
294
- * Defines the topmost view to which the user can navigate
295
- * ([see example](slug:viewdepth_calendar)).
296
- *
297
- * @default 'century'
298
- */
299
- topView = CalendarViewEnum[CalendarViewEnum.century];
300
- /**
301
- * Specifies the Calendar type.
302
- *
303
- * @default 'infinite'
304
- */
305
- set type(type) {
306
- this.renderer.removeClass(this.element.nativeElement, `k-calendar-${this.type}`);
307
- if (type === 'infinite') {
308
- this.renderer.addClass(this.element.nativeElement, `k-calendar-${type}`);
309
- }
310
- this._type = type;
311
- }
312
- get type() {
313
- return this._type;
314
- }
315
- /**
316
- * Determines whether to enable animation when navigating to previous/next view.
317
- * Applies to the [`classic`]({% slug api_dateinputs_calendarcomponent %}#toc-type) Calendar only.
318
- *
319
- * This feature uses the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API). In order to run the animation in browsers that do not support it, you need the `web-animations-js` polyfill.
320
- *
321
- * @default false
322
- */
323
- animateNavigation = false;
324
- /**
325
- * Determines whether to display a week number column in the `month` view
326
- * ([see example]({% slug weeknumcolumn_calendar %})).
327
- *
328
- * @default false
329
- */
330
- weekNumber = false;
331
- /**
332
- * @hidden
333
- */
334
- closePopup = new EventEmitter();
335
- /**
336
- * Fires when the active view is changed
337
- * ([see example](slug:events_calendar)).
338
- */
339
- activeViewChange = new EventEmitter();
340
- /**
341
- * Fires when navigating in the currently active view
342
- * ([see example](slug:events_calendar)).
343
- */
344
- navigate = new EventEmitter();
345
- /**
346
- * Fires when the active view date is changed
347
- * ([see example](slug:events_calendar)).
348
- * Applies to the [`infinite`]({% slug api_dateinputs_calendarcomponent %}#toc-type) Calendar only.
349
- */
350
- activeViewDateChange = new EventEmitter();
351
- /**
352
- * Fires each time the Calendar gets blurred
353
- * ([see example](slug:events_calendar)).
354
- */
355
- onBlur = new EventEmitter();
356
- /**
357
- * Fires each time the Calendar gets focused
358
- * ([see example](slug:events_calendar)).
359
- */
360
- onFocus = new EventEmitter();
361
- /**
362
- * Fires when the value is changed
363
- * ([see example](slug:events_calendar)).
364
- */
365
- valueChange = new EventEmitter();
366
- /**
367
- * @hidden
368
- *
369
- * Queries the template for a cell template declaration.
370
- * Ignored if a `[cellTemplate]` value is explicitly provided.
371
- */
372
- cellTemplate;
373
- /**
374
- * @hidden
375
- *
376
- * Defines the template for each cell.
377
- * Takes precedence over nested templates in the KendoCalendar tag.
378
- */
379
- set cellTemplateRef(template) {
380
- this._cellTemplateRef = template;
381
- }
382
- get cellTemplateRef() {
383
- return this._cellTemplateRef || this.cellTemplate;
384
- }
385
- /**
386
- * @hidden
387
- *
388
- * Queries the template for a month cell template declaration.
389
- * Ignored if a `[monthCellTemplate]` value is explicitly provided.
390
- */
391
- monthCellTemplate;
392
- /**
393
- * @hidden
394
- *
395
- * Defines the template for each month cell.
396
- * Takes precedence over nested templates in the KendoCalendar tag.
397
- */
398
- set monthCellTemplateRef(template) {
399
- this._monthCellTemplateRef = template;
400
- }
401
- get monthCellTemplateRef() {
402
- return this._monthCellTemplateRef || this.monthCellTemplate;
403
- }
404
- /**
405
- * @hidden
406
- *
407
- * Queries the template for a year cell template declaration.
408
- * Ignored if a `[yearCellTemplate]` value is explicitly provided.
409
- */
410
- yearCellTemplate;
411
- /**
412
- * @hidden
413
- *
414
- * Defines the template for each year cell.
415
- * Takes precedence over nested templates in the KendoCalendar tag.
416
- */
417
- set yearCellTemplateRef(template) {
418
- this._yearCellTemplateRef = template;
419
- }
420
- get yearCellTemplateRef() {
421
- return this._yearCellTemplateRef || this.yearCellTemplate;
422
- }
423
- /**
424
- * @hidden
425
- *
426
- * Queries the template for a decade cell template declaration.
427
- * Ignored if a `[decadeCellTemplate]` value is explicitly provided.
428
- */
429
- decadeCellTemplate;
430
- /**
431
- * @hidden
432
- *
433
- * Defines the template for each decade cell.
434
- * Takes precedence over nested templates in the KendoCalendar tag.
435
- */
436
- set decadeCellTemplateRef(template) {
437
- this._decadeCellTemplateRef = template;
438
- }
439
- get decadeCellTemplateRef() {
440
- return this._decadeCellTemplateRef || this.decadeCellTemplate;
441
- }
442
- /**
443
- * @hidden
444
- *
445
- * Queries the template for a century cell template declaration.
446
- * Ignored if a `[centuryCellTemplate]` value is explicitly provided.
447
- */
448
- centuryCellTemplate;
449
- /**
450
- * @hidden
451
- *
452
- * Defines the template for each century cell.
453
- * Takes precedence over nested templates in the KendoCalendar tag.
454
- */
455
- set centuryCellTemplateRef(template) {
456
- this._centuryCellTemplateRef = template;
457
- }
458
- get centuryCellTemplateRef() {
459
- return this._centuryCellTemplateRef || this.centuryCellTemplate;
460
- }
461
- /**
462
- * @hidden
463
- *
464
- * Queries the template for a week number cell template declaration.
465
- * Ignored if a `[weekNumberTemplate]` value is explicitly provided.
466
- */
467
- weekNumberTemplate;
468
- /**
469
- * @hidden
470
- *
471
- * Defines the template for the week cell.
472
- * Takes precedence over nested templates in the KendoCalendar tag.
473
- */
474
- set weekNumberTemplateRef(template) {
475
- this._weekNumberTemplateRef = template;
476
- }
477
- get weekNumberTemplateRef() {
478
- return this._weekNumberTemplateRef || this.weekNumberTemplate;
479
- }
480
- /**
481
- * @hidden
482
- *
483
- * Queries the template for a header title template declaration.
484
- * Ignored if a `[headerTitleTemplate]` value is explicitly provided.
485
- */
486
- headerTitleTemplate;
487
- /**
488
- * @hidden
489
- *
490
- * Queries the template for a header template declaration.
491
- * Ignored if a `[headerTemplate]` value is explicitly provided.
492
- */
493
- headerTemplate;
494
- /**
495
- * @hidden
496
- *
497
- * Queries the template for a footer template declaration.
498
- * Ignored if a `[footerTemplate]` value is explicitly provided.
499
- */
500
- footerTemplate;
501
- /**
502
- * @hidden
503
- *
504
- * Defines the template for the header title.
505
- * Takes precedence over nested templates in the KendoCalendar tag.
506
- */
507
- set headerTitleTemplateRef(template) {
508
- this._headerTitleTemplateRef = template;
509
- }
510
- get headerTitleTemplateRef() {
511
- return this._headerTitleTemplateRef || this.headerTitleTemplate;
512
- }
513
- /**
514
- * @hidden
515
- *
516
- * Defines the template for the header.
517
- * Takes precedence over nested templates in the KendoCalendar tag.
518
- */
519
- set headerTemplateRef(template) {
520
- this._headerTemplateRef = template;
521
- }
522
- get headerTemplateRef() {
523
- return this._headerTemplateRef || this.headerTemplate;
524
- }
525
- /**
526
- * @hidden
527
- *
528
- * Defines the template for the footer.
529
- */
530
- set footerTemplateRef(template) {
531
- this._footerTemplateRef = template;
532
- }
533
- get footerTemplateRef() {
534
- return this._footerTemplateRef || this.footerTemplate;
535
- }
536
- /**
537
- * @hidden
538
- *
539
- * Queries the template for a navigation item template declaration.
540
- * Ignored if a `[navigationItemTemplate]` value is explicitly provided.
541
- */
542
- navigationItemTemplate;
543
- /**
544
- * @hidden
545
- *
546
- * Defines the template for the navigation item.
547
- * Takes precedence over nested templates in the KendoCalendar tag.
548
- */
549
- set navigationItemTemplateRef(template) {
550
- this._navigationItemTemplateRef = template;
551
- }
552
- get navigationItemTemplateRef() {
553
- return this._navigationItemTemplateRef || this.navigationItemTemplate;
554
- }
555
- /**
556
- * @hidden
557
- *
558
- * TODO: Make visible when true sizing of all calendar elements is implemented
559
- * Sets the size of the component.
560
- *
561
- * The possible values are:
562
- * * `small`
563
- * * `medium` (Default)
564
- * * `large`
565
- * * `none`
566
- *
567
- */
568
- set size(size) {
569
- this._size = size;
570
- }
571
- get size() {
572
- return this._size;
573
- }
574
- _size = DEFAULT_SIZE;
575
- /**
576
- * Specifies which end of the defined selection range should be marked as active.
577
- * Value will be ignored if the selection range is undefined. If range selection is used then the default value is 'start'.
578
- *
579
- * @default 'start'
580
- */
581
- set activeRangeEnd(_activeRangeEnd) {
582
- this._activeRangeEnd = _activeRangeEnd;
583
- }
584
- get activeRangeEnd() {
585
- return this._activeRangeEnd;
586
- }
587
- _activeRangeEnd = 'start';
588
- navigationView;
589
- monthView;
590
- multiViewCalendar;
591
- isActive = false;
592
- cellUID = guid();
593
- selectionRange = { start: null, end: null };
594
- selectedDates = [];
595
- rangePivot;
596
- _disabledDates;
597
- _min = new Date(MIN_DATE);
598
- _max = new Date(MAX_DATE);
599
- _focusedDate = getToday();
600
- _value;
601
- onControlChange = noop;
602
- onControlTouched = noop;
603
- onValidatorChange = noop;
604
- minValidateFn = noop;
605
- maxValidateFn = noop;
606
- changes = {};
607
- valueSetter = false;
608
- selectionSetter = false;
609
- syncNavigation = true;
610
- viewChangeSubscription;
611
- _type = 'infinite';
612
- _cellTemplateRef;
613
- _monthCellTemplateRef;
614
- _yearCellTemplateRef;
615
- _decadeCellTemplateRef;
616
- _centuryCellTemplateRef;
617
- _weekNumberTemplateRef;
618
- _headerTitleTemplateRef;
619
- _headerTemplateRef;
620
- _footerTemplateRef;
621
- _navigationItemTemplateRef;
622
- get activeViewEnum() {
623
- const activeView = CalendarViewEnum[this.activeView];
624
- return activeView < this.bottomViewEnum ? this.bottomViewEnum : activeView;
625
- }
626
- get bottomViewEnum() {
627
- return CalendarViewEnum[this.bottomView];
628
- }
629
- get topViewEnum() {
630
- return CalendarViewEnum[this.topView];
631
- }
632
- get widgetId() {
633
- return this.id;
634
- }
635
- get ariaDisabled() {
636
- // in Classic mode, the inner MultiViewCalendar should handle the disabled class and aria attr
637
- return this.type === 'classic' ? undefined : this.disabled;
638
- }
639
- domEvents = [];
640
- control;
641
- pageChangeSubscription;
642
- resolvedPromise = Promise.resolve(null);
643
- destroyed = false;
644
- localizationChangeSubscription;
645
- activeViewDate;
646
- currentlyFocusedElement;
647
- canHover = false;
648
- constructor(bus, dom, element, navigator, renderer, cdr, ngZone, injector, scrollSyncService, disabledDatesService, localization, selectionService, pickerService) {
649
- this.bus = bus;
650
- this.dom = dom;
651
- this.element = element;
652
- this.navigator = navigator;
653
- this.renderer = renderer;
654
- this.cdr = cdr;
655
- this.ngZone = ngZone;
656
- this.injector = injector;
657
- this.scrollSyncService = scrollSyncService;
658
- this.disabledDatesService = disabledDatesService;
659
- this.localization = localization;
660
- this.selectionService = selectionService;
661
- this.pickerService = pickerService;
662
- validatePackage(packageMetadata);
663
- this.id = `kendo-calendarid-${this.bus.calendarId}`;
664
- if (this.pickerService) {
665
- this.pickerService.calendar = this;
666
- }
667
- }
668
- ngOnInit() {
669
- this.setClasses(this.element.nativeElement);
670
- if (this.type === 'infinite') {
671
- this.dom.calculateHeights(this.element.nativeElement);
672
- this.scrollSyncService.configure(this.activeViewEnum);
673
- }
674
- this.localizationChangeSubscription = this.localization.changes.subscribe(() => this.cdr.markForCheck());
675
- this.viewChangeSubscription = this.bus.viewChanged.subscribe(({ view }) => this.handleActiveViewChange(CalendarViewEnum[view]));
676
- this.control = this.injector.get(NgControl, null);
677
- if (this.element) {
678
- this.ngZone.runOutsideAngular(() => {
679
- this.bindEvents();
680
- });
681
- }
682
- }
683
- ngOnChanges(changes) {
684
- this.changes = changes;
685
- this.verifyChanges();
686
- this.bus.configure(this.bottomViewEnum, this.topViewEnum);
687
- this.scrollSyncService.configure(this.activeViewEnum);
688
- }
689
- ngDoCheck() {
690
- if (this.valueSetter || this.selectionSetter) {
691
- if (this.selection === 'range' &&
692
- (this.value?.start || this.value?.end) &&
693
- this.focusedDate.getTime() !== this.value.start?.getTime() &&
694
- this.focusedDate.getTime() !== this.value.end?.getTime()) {
695
- this.focusedDate = this.value.start || this.value.end || getToday();
696
- }
697
- this.setValue(this.value);
698
- this.valueSetter = false;
699
- this.selectionSetter = false;
700
- }
701
- if (hasExistingValue(this.changes, 'focusedDate')) {
702
- const focusedDate = this.changes.focusedDate.currentValue;
703
- this.focusedDate = dateInRange(focusedDate, this.min, this.max);
704
- }
705
- if (this.changes.navigation) {
706
- this.syncNavigation = true;
707
- }
708
- if (this.changes.min || this.changes.max || this.changes.rangeValidation) {
709
- this.minValidateFn = this.rangeValidation ? minValidator(this.min) : noop;
710
- this.maxValidateFn = this.rangeValidation ? maxValidator(this.max) : noop;
711
- this.onValidatorChange();
712
- }
713
- this.changes = {};
714
- }
715
- ngAfterViewInit() {
716
- this.setAriaActivedescendant();
717
- if (this.size !== 'none') {
718
- const element = this.type === 'infinite' ? this.element : this.multiViewCalendar.element;
719
- this.renderer.removeClass(element.nativeElement, getSizeClass('calendar', this.size));
720
- this.renderer.addClass(element.nativeElement, getSizeClass('calendar', this.size));
721
- }
722
- }
723
- ngAfterViewChecked() {
724
- if (!this.syncNavigation) {
725
- return;
726
- }
727
- this.syncNavigation = false;
728
- this.scrollSyncService.sync(virtualizationProp(this.navigationView), virtualizationProp(this.monthView));
729
- }
730
- ngOnDestroy() {
731
- this.scrollSyncService.destroy();
732
- this.domEvents.forEach(unbindCallback => unbindCallback());
733
- if (this.pickerService) {
734
- this.pickerService.calendar = null;
735
- }
736
- if (this.viewChangeSubscription) {
737
- this.viewChangeSubscription.unsubscribe();
738
- }
739
- if (this.pageChangeSubscription) {
740
- this.pageChangeSubscription.unsubscribe();
741
- }
742
- if (this.localizationChangeSubscription) {
743
- this.localizationChangeSubscription.unsubscribe();
744
- }
745
- this.destroyed = true;
746
- }
747
- /**
748
- * @hidden
749
- */
750
- onCellEnter(date) {
751
- if (this.selection === 'range' && this.canHover) {
752
- this.ngZone.run(() => {
753
- if (this.allowReverse) {
754
- if (this.activeRangeEnd === 'end' && this.selectionRange.start) {
755
- this.selectionRange = { start: this.selectionRange.start, end: date };
756
- }
757
- if (this.activeRangeEnd === 'start' && this.selectionRange.end) {
758
- this.selectionRange = { start: date, end: this.selectionRange.end };
759
- }
760
- }
761
- else {
762
- if (this.activeRangeEnd === 'end' && this.selectionRange.start && date >= this.selectionRange.start) {
763
- this.selectionRange = { start: this.selectionRange.start, end: date };
764
- }
765
- if (this.selectionRange.start && date < this.selectionRange.start) {
766
- this.selectionRange = { start: this.selectionRange.start, end: null };
767
- }
768
- }
769
- });
770
- }
771
- }
772
- /**
773
- * @hidden
774
- */
775
- onResize() {
776
- this.focusedDate = new Date(this.focusedDate);
777
- this.cdr.detectChanges();
778
- }
779
- /**
780
- * Focuses the Calendar by making the table.k-calendar-table element active.
781
- */
782
- focus() {
783
- this.currentlyFocusedElement = this.type === 'infinite' ?
784
- this.element?.nativeElement.querySelector(selectors.infiniteCalendarTable) :
785
- this.element?.nativeElement.querySelector(selectors.multiViewCalendarTable);
786
- this.currentlyFocusedElement?.focus();
787
- }
788
- /**
789
- * Blurs the Calendar component.
790
- */
791
- blur() {
792
- const blurTarget = this.type === 'infinite' ?
793
- this.currentlyFocusedElement :
794
- this.multiViewCalendar;
795
- if (isPresent(blurTarget)) {
796
- blurTarget.blur();
797
- }
798
- }
799
- /**
800
- * @hidden
801
- */
802
- containsElement(element) {
803
- return Boolean(closest(element, node => node === this.element.nativeElement));
804
- }
805
- /**
806
- * @hidden
807
- */
808
- handleNavigation(candidate) {
809
- if (this.disabled) {
810
- return;
811
- }
812
- const focusTarget = candidate ? new Date(cloneDate(candidate).setDate(1)) : this.focusedDate;
813
- this.focusedDate = dateInRange(focusTarget, this.min, this.max);
814
- this.detectChanges();
815
- }
816
- /**
817
- * @hidden
818
- */
819
- onPageChange() {
820
- if (!NgZone.isInAngularZone()) {
821
- if (this.pageChangeSubscription) {
822
- this.pageChangeSubscription.unsubscribe();
823
- }
824
- this.pageChangeSubscription = fromPromise(this.resolvedPromise)
825
- .subscribe(() => {
826
- this.detectChanges(); // requires zone if templates
827
- });
828
- }
829
- }
830
- /**
831
- * @hidden
832
- */
833
- handleMultiViewCalendarValueChange(value, focusedDate) {
834
- if (this.selection === 'range') {
835
- this.valueChange.emit(value);
836
- }
837
- else {
838
- const selectedDates = (Array.isArray(value) ? value : [value]);
839
- this.handleDateChange({ selectedDates, focusedDate });
840
- }
841
- }
842
- /**
843
- * @hidden
844
- */
845
- handleDateChange(args) {
846
- const selectedDates = Array.isArray(args.selectedDates) ? args.selectedDates : [args.selectedDates];
847
- const canNavigateDown = this.bus.canMoveDown(this.activeViewEnum);
848
- const availableDates = selectedDates.filter(date => !this.disabledDatesService.isDateDisabled(date));
849
- this.focusedDate = args.focusedDate || this.focusedDate;
850
- if (this.disabled) {
851
- return;
852
- }
853
- if (!canNavigateDown && areDatesEqual(availableDates, this.selectedDates)) {
854
- this.emitSameDate();
855
- return;
856
- }
857
- if (canNavigateDown) {
858
- this.bus.moveDown(this.activeViewEnum);
859
- return;
860
- }
861
- if (this.disabledDatesService.isDateDisabled(this.focusedDate)) {
862
- return;
863
- }
864
- if (this.selection === 'range') {
865
- return;
866
- }
867
- this.ngZone.run(() => {
868
- this.selectedDates = availableDates.map(date => cloneDate(date));
869
- this.value = this.parseSelectionToValue(availableDates);
870
- this.onControlChange(this.parseSelectionToValue(availableDates));
871
- this.valueChange.emit(this.parseSelectionToValue(availableDates));
872
- this.cdr.markForCheck();
873
- });
874
- }
875
- /**
876
- * @hidden
877
- */
878
- writeValue(candidate) {
879
- this.verifyValue(candidate);
880
- this.value = candidate;
881
- this.cdr.markForCheck();
882
- }
883
- /**
884
- * @hidden
885
- */
886
- registerOnChange(fn) {
887
- this.onControlChange = fn;
888
- }
889
- /**
890
- * @hidden
891
- */
892
- registerOnTouched(fn) {
893
- this.onControlTouched = fn;
894
- }
895
- /**
896
- * @hidden
897
- */
898
- setDisabledState(isDisabled) {
899
- this.disabled = isDisabled;
900
- this.cdr.markForCheck();
901
- }
902
- /**
903
- * @hidden
904
- */
905
- validate(control) {
906
- return this.minValidateFn(control) || this.maxValidateFn(control);
907
- }
908
- /**
909
- * @hidden
910
- */
911
- registerOnValidatorChange(fn) {
912
- this.onValidatorChange = fn;
913
- }
914
- /**
915
- * @hidden
916
- */
917
- activeCellTemplate() {
918
- switch (this.activeViewEnum) {
919
- case CalendarViewEnum.month:
920
- return this.monthCellTemplateRef || this.cellTemplateRef;
921
- case CalendarViewEnum.year:
922
- return this.yearCellTemplateRef;
923
- case CalendarViewEnum.decade:
924
- return this.decadeCellTemplateRef;
925
- case CalendarViewEnum.century:
926
- return this.centuryCellTemplateRef;
927
- default:
928
- return null;
929
- }
930
- }
931
- /**
932
- * @hidden
933
- */
934
- handleNavigate(event) {
935
- this.focusedDate = event.focusedDate;
936
- this.activeView = event.activeView;
937
- this.emitNavigate(this.focusedDate);
938
- }
939
- /**
940
- * @hidden
941
- */
942
- emitNavigate(focusedDate) {
943
- const activeView = CalendarViewEnum[this.activeViewEnum];
944
- this.navigate.emit({ activeView, focusedDate });
945
- }
946
- /**
947
- * @hidden
948
- */
949
- emitEvent(emitter, args) {
950
- if (hasObservers(emitter)) {
951
- this.ngZone.run(() => {
952
- emitter.emit(args);
953
- });
954
- }
955
- }
956
- /**
957
- * @hidden
958
- */
959
- handleActiveDateChange(date) {
960
- this.activeViewDate = date;
961
- this.emitEvent(this.activeViewDateChange, date);
962
- }
963
- /**
964
- * @hidden
965
- */
966
- handleActiveViewChange(view) {
967
- this.activeView = view;
968
- this.emitEvent(this.activeViewChange, view);
969
- if (this.type === 'infinite') {
970
- this.scrollSyncService.configure(this.activeViewEnum);
971
- }
972
- this.detectChanges(); // requires zone if templates
973
- }
974
- /**
975
- * @hidden
976
- */
977
- handleCellClick({ date, modifiers }) {
978
- this.focus();
979
- if (this.selection === 'range' && this.activeViewEnum === CalendarViewEnum[this.bottomView]) {
980
- this.performRangeSelection(date);
981
- }
982
- else {
983
- this.selectionService.lastClicked = date;
984
- this.performSelection(date, modifiers);
985
- }
986
- }
987
- /**
988
- * @hidden
989
- */
990
- handleWeekNumberClick(dates) {
991
- if (this.selection === 'single') {
992
- return;
993
- }
994
- this.ngZone.run(() => {
995
- if (this.selection === 'multiple') {
996
- this.handleDateChange({
997
- selectedDates: dates,
998
- focusedDate: last(dates),
999
- });
1000
- }
1001
- if (this.selection === 'range') {
1002
- this.canHover = false;
1003
- this.activeRangeEnd = 'start';
1004
- const shouldEmitValueChange = this.selectionRange.start?.getTime() !== dates[0].getTime() ||
1005
- this.selectionRange.end?.getTime() !== last(dates).getTime();
1006
- this.value = { start: dates[0], end: last(dates) };
1007
- if (shouldEmitValueChange) {
1008
- this.valueChange.emit(this.value);
1009
- }
1010
- }
1011
- });
1012
- }
1013
- /**
1014
- * @hidden
1015
- */
1016
- handleBlur(args) {
1017
- if (this.element.nativeElement.contains(args.relatedTarget)) {
1018
- return;
1019
- }
1020
- this.isActive = false;
1021
- // the injector can get the NgControl instance of the parent component (for example, the DateTimePicker)
1022
- // and enters the zone for no reason because the parent component is still untouched
1023
- if (!this.pickerService && requiresZoneOnBlur(this.control)) {
1024
- this.ngZone.run(() => {
1025
- this.onControlTouched();
1026
- this.emitBlur(args);
1027
- this.cdr.markForCheck();
1028
- });
1029
- }
1030
- else {
1031
- this.emitBlur(args);
1032
- this.detectChanges();
1033
- }
1034
- }
1035
- /**
1036
- * @hidden
1037
- */
1038
- handleFocus() {
1039
- this.isActive = true;
1040
- if (!NgZone.isInAngularZone()) {
1041
- this.detectChanges();
1042
- }
1043
- this.emitFocus();
1044
- }
1045
- /**
1046
- * @hidden
1047
- */
1048
- handleMultiViewCalendarKeydown(args) {
1049
- // Prevent form from submitting on enter if used in datepicker (classic view)
1050
- if (isPresent(this.pickerService) && (args.code === Keys.Enter || args.code === Keys.NumpadEnter)) {
1051
- args.preventDefault();
1052
- }
1053
- }
1054
- setClasses(element) {
1055
- this.renderer.removeClass(element, `k-calendar-${this.type}`);
1056
- if (this.type === 'infinite') {
1057
- this.renderer.addClass(element, 'k-calendar');
1058
- this.renderer.addClass(element, `k-calendar-${this.type}`);
1059
- }
1060
- }
1061
- verifyChanges() {
1062
- if (!isDevMode()) {
1063
- return;
1064
- }
1065
- if (this.min > this.max) {
1066
- throw new Error(`The max value should be bigger than the min. See ${MIN_DOC_LINK} and ${MAX_DOC_LINK}.`);
1067
- }
1068
- if (this.bottomViewEnum > this.topViewEnum) {
1069
- throw new Error(`The topView should be greater than bottomView. See ${BOTTOM_VIEW_DOC_LINK} and ${TOP_VIEW_DOC_LINK}.`);
1070
- }
1071
- }
1072
- verifyValue(candidate) {
1073
- if (!isDevMode()) {
1074
- return;
1075
- }
1076
- if (this.selection === 'single' && candidate && !(isNullOrDate(candidate))) {
1077
- throw new Error(`When using 'single' selection the 'value' should be a valid JavaScript Date instance. Check ${VALUE_DOC_LINK} for possible resolution.`);
1078
- }
1079
- else if (this.selection === 'multiple' && candidate) {
1080
- if (Array.isArray(candidate)) {
1081
- const onlyDates = candidate.every(value => value instanceof Date);
1082
- if (!onlyDates) {
1083
- throw new Error(`When using 'multiple' selection the 'value' should be an array of valid JavaScript Date instances. Check ${VALUE_DOC_LINK} for possible resolution.`);
1084
- }
1085
- }
1086
- if (Object.keys(candidate).find(k => k === 'start') && Object.keys(candidate).find(k => k === 'end')) {
1087
- throw new Error(`When using 'multiple' selection the 'value' should be an array of valid JavaScript Date instances. Check ${VALUE_DOC_LINK} for possible resolution.`);
1088
- }
1089
- }
1090
- else if (this.selection === 'range' && candidate && !(isNullOrDate(candidate['start']) && isNullOrDate(candidate['end']))) {
1091
- throw new Error(`The 'value' should be an object with start and end dates. Check ${VALUE_DOC_LINK} for possible resolution.`);
1092
- }
1093
- }
1094
- bindEvents() {
1095
- const element = this.element.nativeElement;
1096
- this.domEvents.push(this.renderer.listen(element, 'focus', this.handleFocus.bind(this)), this.renderer.listen(element, 'mousedown', preventDefault), this.renderer.listen(element, 'click', this.handleComponentClick.bind(this)), this.renderer.listen(element, 'keydown', this.handleKeydown.bind(this)), this.renderer.listen(element, 'mouseleave', this.setRangeSelectionToValue.bind(this)));
1097
- }
1098
- setRangeSelectionToValue() {
1099
- if (this.selection === 'range' && this.type === 'infinite' && this.value) {
1100
- this.ngZone.run(() => {
1101
- this.selectionRange = this.value;
1102
- this.cdr.markForCheck();
1103
- });
1104
- }
1105
- }
1106
- emitBlur(args) {
1107
- if (this.pickerService) {
1108
- this.pickerService.onBlur.emit(args);
1109
- }
1110
- this.onBlur.emit();
1111
- }
1112
- emitFocus() {
1113
- if (this.pickerService) {
1114
- this.pickerService.onFocus.emit();
1115
- }
1116
- this.onFocus.emit();
1117
- }
1118
- handleComponentClick() {
1119
- if (!this.isActive) {
1120
- if (this.type === 'infinite' && this.monthView.isScrolled()) {
1121
- this.focusedDate = cloneDate(this.focusedDate); //XXX: forces change detect
1122
- this.detectChanges();
1123
- }
1124
- this.focus();
1125
- }
1126
- }
1127
- handleKeydown(args) {
1128
- if (this.type === 'infinite') {
1129
- // reserve the alt + arrow key commands for the picker
1130
- const ctrlKey = args.ctrlKey || args.metaKey;
1131
- const code = normalizeKeys(args);
1132
- const arrowKeyPressed = [Keys.ArrowUp, Keys.ArrowRight, Keys.ArrowDown, Keys.ArrowLeft].indexOf(code) !== -1;
1133
- const reserveKeyCommandsForPicker = isPresent(this.pickerService) && arrowKeyPressed && args.altKey;
1134
- if (reserveKeyCommandsForPicker) {
1135
- return;
1136
- }
1137
- if (ctrlKey && arrowKeyPressed) {
1138
- args.preventDefault();
1139
- }
1140
- // Prevent form from submitting on enter if used in datepicker (infinite view)
1141
- const preventSubmitInDatePicker = isPresent(this.pickerService) && code === Keys.Enter;
1142
- if (preventSubmitInDatePicker) {
1143
- args.preventDefault();
1144
- }
1145
- const candidate = dateInRange(this.navigator.move(this.focusedDate, this.navigator.action(args), this.activeViewEnum), this.min, this.max);
1146
- if (!isEqual(this.focusedDate, candidate)) {
1147
- this.focusedDate = candidate;
1148
- this.detectChanges();
1149
- args.preventDefault();
1150
- }
1151
- if (code === Keys.Enter) {
1152
- this.selectionService.lastClicked = this.focusedDate;
1153
- if (this.selection !== 'range') {
1154
- this.performSelection(this.focusedDate, args);
1155
- }
1156
- else {
1157
- this.performRangeSelection(this.focusedDate);
1158
- }
1159
- }
1160
- if (code === Keys.KeyT) {
1161
- this.focusToday();
1162
- }
1163
- if (isArrowWithShiftPressed(args) && this.selection !== 'range') {
1164
- args.anyArrow = true;
1165
- this.performSelection(this.focusedDate, args);
1166
- }
1167
- }
1168
- }
1169
- focusToday() {
1170
- this.focusedDate = getToday();
1171
- this.bus.moveToBottom(this.activeViewEnum);
1172
- this.cdr.detectChanges();
1173
- }
1174
- detectChanges() {
1175
- if (!this.destroyed) {
1176
- this.cdr.detectChanges();
1177
- }
1178
- }
1179
- emitSameDate() {
1180
- if (this.pickerService) {
1181
- this.pickerService.sameDateSelected.emit();
1182
- }
1183
- }
1184
- setAriaActivedescendant() {
1185
- // in Classic mode, the inner MultiViewCalendar handles the activedescendant
1186
- const infiniteCalendarTable = this.element.nativeElement?.querySelector(selectors.infiniteCalendarTable);
1187
- const activedescendantHandledByInnerMultiViewCalendar = !isPresent(infiniteCalendarTable) || (this.type === 'classic' && !infiniteCalendarTable.hasAttribute(attributeNames.ariaActiveDescendant));
1188
- if (activedescendantHandledByInnerMultiViewCalendar) {
1189
- return;
1190
- }
1191
- if (this.type === 'classic') {
1192
- this.renderer.removeAttribute(infiniteCalendarTable, attributeNames.ariaActiveDescendant);
1193
- return;
1194
- }
1195
- const focusedCellId = this.cellUID + this.focusedDate.getTime();
1196
- this.renderer.setAttribute(infiniteCalendarTable, attributeNames.ariaActiveDescendant, focusedCellId);
1197
- }
1198
- parseSelectionToValue(selection) {
1199
- selection = selection || [];
1200
- return this.selection === 'single' ? cloneDate(last(selection)) : selection.map(date => cloneDate(date));
1201
- }
1202
- setValue(candidate) {
1203
- this.verifyValue(candidate);
1204
- if (candidate === null) {
1205
- this._value = null;
1206
- this.selectedDates = [];
1207
- this.selectionRange = { start: null, end: null };
1208
- }
1209
- else if (Array.isArray(candidate)) {
1210
- this.selectionRange = { start: null, end: null };
1211
- this._value = candidate.filter(date => isPresent(date)).map(element => cloneDate(element));
1212
- }
1213
- else if (isObject(candidate) && Object.keys(candidate).find(k => k === 'start') && Object.keys(candidate).find(k => k === 'end')) {
1214
- this.selectedDates = [];
1215
- this.selectionRange = { start: null, end: null };
1216
- this._value = { start: null, end: null };
1217
- this._value.start = candidate.start instanceof Date ? cloneDate(candidate.start) : null;
1218
- this._value.end = candidate.end instanceof Date ? cloneDate(candidate.end) : null;
1219
- this.selectionRange = Object.assign({}, this._value);
1220
- if (this._value?.start && !this._value?.end) {
1221
- this.activeRangeEnd = 'end';
1222
- this.canHover = true;
1223
- }
1224
- if (this._value?.end && !this._value?.start) {
1225
- this.activeRangeEnd = 'start';
1226
- this.canHover = true;
1227
- }
1228
- if (this._value?.end && this._value?.start) {
1229
- this.canHover = false;
1230
- }
1231
- }
1232
- else {
1233
- this.selectionRange = { start: null, end: null };
1234
- this._value = cloneDate(candidate);
1235
- }
1236
- if (this.selection !== 'range') {
1237
- const selection = [].concat(candidate).filter(date => isPresent(date)).map(date => cloneDate(date));
1238
- if (!areDatesEqual(selection, this.selectedDates)) {
1239
- const lastSelected = last(selection);
1240
- this.rangePivot = cloneDate(lastSelected);
1241
- this.focusedDate = cloneDate(lastSelected) || this.focusedDate;
1242
- this.selectedDates = selection;
1243
- }
1244
- }
1245
- }
1246
- performRangeSelection(date) {
1247
- this.focusedDate = date;
1248
- const clonedRangeSelection = Object.assign({}, this.selectionRange);
1249
- const emitValueChange = (this.activeRangeEnd === 'start' && this.value?.start?.getTime() !== date?.getTime()) ||
1250
- (this.activeRangeEnd === 'end' && this.value?.end?.getTime() !== date?.getTime());
1251
- this.ngZone.run(() => {
1252
- const rangeSelection = handleRangeSelection(date, clonedRangeSelection, this.activeRangeEnd, this.allowReverse);
1253
- this.activeRangeEnd = rangeSelection.activeRangeEnd;
1254
- if (this.canHover && rangeSelection.activeRangeEnd === 'end' && rangeSelection.selectionRange.end?.getTime() === date.getTime()) {
1255
- this.activeRangeEnd = 'start';
1256
- rangeSelection.activeRangeEnd = 'start';
1257
- }
1258
- this.canHover = this.activeRangeEnd === 'end' && rangeSelection.selectionRange.start && !rangeSelection.selectionRange.end;
1259
- if (emitValueChange && (this.value?.start?.getTime() !== rangeSelection.selectionRange?.start?.getTime() ||
1260
- this.value?.end?.getTime() !== rangeSelection.selectionRange?.end?.getTime())) {
1261
- this.value = rangeSelection.selectionRange;
1262
- this.valueChange.emit(this.value);
1263
- }
1264
- this.cdr.markForCheck();
1265
- });
1266
- }
1267
- performSelection(date, selectionModifiers) {
1268
- const selection = this.selectionService.performSelection({
1269
- date: date,
1270
- modifiers: selectionModifiers,
1271
- selectionMode: this.selection,
1272
- activeViewEnum: this.activeViewEnum,
1273
- rangePivot: this.rangePivot,
1274
- selectedDates: this.selectedDates
1275
- });
1276
- this.rangePivot = selection.rangePivot;
1277
- this.handleDateChange({
1278
- selectedDates: selection.selectedDates,
1279
- focusedDate: date
1280
- });
1281
- }
1282
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CalendarComponent, deps: [{ token: i1.BusViewService }, { token: i2.CalendarDOMService }, { token: i0.ElementRef }, { token: i3.NavigationService }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i4.ScrollSyncService }, { token: i5.DisabledDatesService }, { token: i6.LocalizationService }, { token: i7.SelectionService }, { token: i8.PickerService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1283
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: CalendarComponent, isStandalone: true, selector: "kendo-calendar", inputs: { showOtherMonthDays: "showOtherMonthDays", id: "id", focusedDate: "focusedDate", min: "min", max: "max", rangeValidation: "rangeValidation", weekDaysFormat: "weekDaysFormat", footer: "footer", selection: "selection", allowReverse: "allowReverse", value: "value", disabled: "disabled", tabindex: "tabindex", tabIndex: "tabIndex", disabledDates: "disabledDates", navigation: "navigation", activeView: "activeView", bottomView: "bottomView", topView: "topView", type: "type", animateNavigation: "animateNavigation", weekNumber: "weekNumber", cellTemplateRef: ["cellTemplate", "cellTemplateRef"], monthCellTemplateRef: ["monthCellTemplate", "monthCellTemplateRef"], yearCellTemplateRef: ["yearCellTemplate", "yearCellTemplateRef"], decadeCellTemplateRef: ["decadeCellTemplate", "decadeCellTemplateRef"], centuryCellTemplateRef: ["centuryCellTemplate", "centuryCellTemplateRef"], weekNumberTemplateRef: ["weekNumberTemplate", "weekNumberTemplateRef"], headerTitleTemplateRef: ["headerTitleTemplate", "headerTitleTemplateRef"], headerTemplateRef: ["headerTemplate", "headerTemplateRef"], footerTemplateRef: ["footerTemplate", "footerTemplateRef"], navigationItemTemplateRef: ["navigationItemTemplate", "navigationItemTemplateRef"], size: "size", activeRangeEnd: "activeRangeEnd" }, outputs: { closePopup: "closePopup", activeViewChange: "activeViewChange", navigate: "navigate", activeViewDateChange: "activeViewDateChange", onBlur: "blur", onFocus: "focus", valueChange: "valueChange" }, host: { properties: { "class.k-week-number": "this.weekNumber", "attr.id": "this.widgetId", "attr.aria-disabled": "this.ariaDisabled", "class.k-disabled": "this.ariaDisabled" } }, providers: [
1284
- BusViewService,
1285
- CALENDAR_VALUE_ACCESSOR,
1286
- CALENDAR_RANGE_VALIDATORS,
1287
- KENDO_INPUT_PROVIDER,
1288
- LocalizationService,
1289
- DisabledDatesService,
1290
- {
1291
- provide: L10N_PREFIX,
1292
- useValue: 'kendo.calendar'
1293
- },
1294
- NavigationService,
1295
- ScrollSyncService,
1296
- SelectionService
1297
- ], queries: [{ propertyName: "cellTemplate", first: true, predicate: CellTemplateDirective, descendants: true }, { propertyName: "monthCellTemplate", first: true, predicate: MonthCellTemplateDirective, descendants: true }, { propertyName: "yearCellTemplate", first: true, predicate: YearCellTemplateDirective, descendants: true }, { propertyName: "decadeCellTemplate", first: true, predicate: DecadeCellTemplateDirective, descendants: true }, { propertyName: "centuryCellTemplate", first: true, predicate: CenturyCellTemplateDirective, descendants: true }, { propertyName: "weekNumberTemplate", first: true, predicate: WeekNumberCellTemplateDirective, descendants: true }, { propertyName: "headerTitleTemplate", first: true, predicate: HeaderTitleTemplateDirective, descendants: true }, { propertyName: "headerTemplate", first: true, predicate: HeaderTemplateDirective, descendants: true }, { propertyName: "footerTemplate", first: true, predicate: FooterTemplateDirective, descendants: true }, { propertyName: "navigationItemTemplate", first: true, predicate: NavigationItemTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "navigationView", first: true, predicate: NavigationComponent, descendants: true }, { propertyName: "monthView", first: true, predicate: ViewListComponent, descendants: true }, { propertyName: "multiViewCalendar", first: true, predicate: MultiViewCalendarComponent, descendants: true }], exportAs: ["kendo-calendar"], usesOnChanges: true, ngImport: i0, template: `
1298
- <ng-container kendoCalendarLocalizedMessages
1299
- i18n-today="kendo.calendar.today|The label for the today button in the calendar header"
1300
- today="Today"
1301
-
1302
- i18n-prevButtonTitle="kendo.calendar.prevButtonTitle|The title of the previous button in the Classic calendar"
1303
- prevButtonTitle="Navigate to previous view"
1304
-
1305
- i18n-nextButtonTitle="kendo.calendar.nextButtonTitle|The title of the next button in the Classic calendar"
1306
- nextButtonTitle="Navigate to next view"
1307
-
1308
- i18n-parentViewButtonTitle="kendo.calendar.parentViewButtonTitle|The title of the parent view button in the calendar header"
1309
- parentViewButtonTitle="Navigate to parent view"
1310
- >
1311
- </ng-container>
1312
- @if (type === 'infinite') {
1313
- @if (navigation) {
1314
- <kendo-calendar-navigation
1315
- [activeView]="activeViewEnum"
1316
- [focusedDate]="focusedDate"
1317
- [min]="min"
1318
- [max]="max"
1319
- [templateRef]="navigationItemTemplateRef?.templateRef"
1320
- (valueChange)="handleNavigation($event)"
1321
- (pageChange)="onPageChange()"
1322
- >
1323
- </kendo-calendar-navigation>
1324
- }
1325
- <kendo-calendar-viewlist
1326
- [activeView]="activeViewEnum"
1327
- [allowReverse]="allowReverse"
1328
- [showOtherMonthDays]="showOtherMonthDays"
1329
- [activeRangeEnd]="activeRangeEnd"
1330
- [selectionRange]="selectionRange"
1331
- [size]="size"
1332
- [isActive]="isActive"
1333
- [id]="headerId"
1334
- [weekDaysFormat]="weekDaysFormat"
1335
- [cellTemplateRef]="activeCellTemplate()?.templateRef"
1336
- [headerTitleTemplateRef]="headerTitleTemplateRef?.templateRef"
1337
- [headerTemplateRef]="headerTemplateRef?.templateRef"
1338
- [showFooter]="footer"
1339
- [footerTemplateRef]="footerTemplateRef?.templateRef"
1340
- [weekNumberTemplateRef]="weekNumberTemplateRef?.templateRef"
1341
- [cellUID]="cellUID"
1342
- [min]="min"
1343
- [max]="max"
1344
- [focusedDate]="focusedDate"
1345
- [weekNumber]="weekNumber"
1346
- [selectedDates]="selectedDates"
1347
- [tabIndex]="tabIndex"
1348
- [disabled]="disabled"
1349
- (todayButtonClick)="handleDateChange({
1350
- selectedDates: [$event],
1351
- focusedDate: $event
1352
- })"
1353
- (cellClick)="handleCellClick($event)"
1354
- (weekNumberCellClick)="handleWeekNumberClick($event)"
1355
- (activeDateChange)="handleActiveDateChange($event)"
1356
- (pageChange)="onPageChange()"
1357
- (focusCalendar)="handleFocus()"
1358
- (blurCalendar)="handleBlur($event)"
1359
- (cellEnter)="onCellEnter($event)"
1360
- >
1361
- </kendo-calendar-viewlist>
1362
- <kendo-resize-sensor (resize)="onResize()"></kendo-resize-sensor>
1363
- }
1364
- @if (type === 'classic') {
1365
- <kendo-multiviewcalendar
1366
- #multiviewcalendar
1367
- [views]="1"
1368
- [min]="min"
1369
- [max]="max"
1370
- [size]="size"
1371
- [id]="id"
1372
- [activeRangeEnd]="activeRangeEnd"
1373
- [selectionRange]="selectionRange"
1374
- [allowReverse]="allowReverse"
1375
- [disabled]="disabled"
1376
- [isActive]="isActive"
1377
- [showOtherMonthDays]="showOtherMonthDays"
1378
- [tabIndex]="tabIndex"
1379
- [activeView]="activeView"
1380
- [bottomView]="bottomView"
1381
- [topView]="topView"
1382
- [weekDaysFormat]="weekDaysFormat"
1383
- [weekNumber]="weekNumber"
1384
- [animateNavigation]="animateNavigation"
1385
- [cellTemplate]="activeCellTemplate()"
1386
- [monthCellTemplate]="monthCellTemplateRef"
1387
- [yearCellTemplate]="yearCellTemplateRef"
1388
- [decadeCellTemplate]="decadeCellTemplateRef"
1389
- [centuryCellTemplate]="centuryCellTemplateRef"
1390
- [headerTitleTemplate]="headerTitleTemplateRef"
1391
- [headerTemplate]="headerTemplateRef"
1392
- [footerTemplate]="footerTemplateRef"
1393
- [footer]="footer"
1394
- [weekNumberTemplate]="weekNumberTemplateRef"
1395
- [focusedDate]="focusedDate"
1396
- [selection]="selection"
1397
- [value]="value"
1398
- [disabledDates]="disabledDates"
1399
- (onClosePopup)="closePopup.emit()"
1400
- (activeViewChange)="handleActiveViewChange($event)"
1401
- (navigate)="handleNavigate($event)"
1402
- (valueChange)="handleMultiViewCalendarValueChange($event, multiviewcalendar.focusedDate)"
1403
- (focusCalendar)="handleFocus()"
1404
- (blur)="handleBlur($event)"
1405
- (blurEvent)="handleBlur($event)"
1406
- (keydown)="handleMultiViewCalendarKeydown($event)"
1407
- >
1408
- <kendo-multiviewcalendar-messages
1409
- [today]="localization.get('today')"
1410
- [prevButtonTitle]="localization.get('prevButtonTitle')"
1411
- [nextButtonTitle]="localization.get('nextButtonTitle')"
1412
- [parentViewButtonTitle]="localization.get('parentViewButtonTitle')"
1413
- >
1414
- </kendo-multiviewcalendar-messages>
1415
- </kendo-multiviewcalendar>
1416
- }
1417
- `, isInline: true, dependencies: [{ kind: "directive", type: CalendarLocalizedMessagesDirective, selector: "[kendoCalendarLocalizedMessages]" }, { kind: "component", type: NavigationComponent, selector: "kendo-calendar-navigation", inputs: ["activeView", "min", "max", "focusedDate", "templateRef"], outputs: ["valueChange", "pageChange"] }, { kind: "component", type: ViewListComponent, selector: "kendo-calendar-viewlist", inputs: ["allowReverse", "cellTemplateRef", "weekNumberTemplateRef", "headerTitleTemplateRef", "headerTemplateRef", "footerTemplateRef", "showOtherMonthDays", "activeView", "cellUID", "focusedDate", "isActive", "min", "max", "selectedDates", "tabIndex", "disabled", "id", "showFooter", "weekDaysFormat", "activeRangeEnd", "selectionRange", "size", "weekNumber"], outputs: ["cellEnter", "cellClick", "weekNumberCellClick", "activeDateChange", "todayButtonClick", "pageChange", "focusCalendar", "blurCalendar", "focusedCellChange"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { kind: "component", type: MultiViewCalendarComponent, selector: "kendo-multiviewcalendar", inputs: ["showOtherMonthDays", "showCalendarHeader", "size", "id", "focusedDate", "footer", "min", "max", "rangeValidation", "disabledDatesRangeValidation", "selection", "allowReverse", "value", "disabled", "tabindex", "tabIndex", "weekDaysFormat", "isActive", "disabledDates", "activeView", "bottomView", "topView", "showViewHeader", "animateNavigation", "weekNumber", "activeRangeEnd", "selectionRange", "views", "orientation", "cellTemplate", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "footerTemplate", "headerTitleTemplate", "headerTemplate"], outputs: ["activeViewChange", "navigate", "cellEnter", "cellLeave", "valueChange", "rangeSelectionChange", "blur", "focus", "focusCalendar", "onClosePopup", "onTabPress", "onShiftTabPress"], exportAs: ["kendo-multiviewcalendar"] }, { kind: "component", type: MultiViewCalendarCustomMessagesComponent, selector: "kendo-multiviewcalendar-messages" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1418
- }
1419
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CalendarComponent, decorators: [{
1420
- type: Component,
1421
- args: [{
1422
- changeDetection: ChangeDetectionStrategy.OnPush,
1423
- exportAs: 'kendo-calendar',
1424
- providers: [
1425
- BusViewService,
1426
- CALENDAR_VALUE_ACCESSOR,
1427
- CALENDAR_RANGE_VALIDATORS,
1428
- KENDO_INPUT_PROVIDER,
1429
- LocalizationService,
1430
- DisabledDatesService,
1431
- {
1432
- provide: L10N_PREFIX,
1433
- useValue: 'kendo.calendar'
1434
- },
1435
- NavigationService,
1436
- ScrollSyncService,
1437
- SelectionService
1438
- ],
1439
- selector: 'kendo-calendar',
1440
- template: `
1441
- <ng-container kendoCalendarLocalizedMessages
1442
- i18n-today="kendo.calendar.today|The label for the today button in the calendar header"
1443
- today="Today"
1444
-
1445
- i18n-prevButtonTitle="kendo.calendar.prevButtonTitle|The title of the previous button in the Classic calendar"
1446
- prevButtonTitle="Navigate to previous view"
1447
-
1448
- i18n-nextButtonTitle="kendo.calendar.nextButtonTitle|The title of the next button in the Classic calendar"
1449
- nextButtonTitle="Navigate to next view"
1450
-
1451
- i18n-parentViewButtonTitle="kendo.calendar.parentViewButtonTitle|The title of the parent view button in the calendar header"
1452
- parentViewButtonTitle="Navigate to parent view"
1453
- >
1454
- </ng-container>
1455
- @if (type === 'infinite') {
1456
- @if (navigation) {
1457
- <kendo-calendar-navigation
1458
- [activeView]="activeViewEnum"
1459
- [focusedDate]="focusedDate"
1460
- [min]="min"
1461
- [max]="max"
1462
- [templateRef]="navigationItemTemplateRef?.templateRef"
1463
- (valueChange)="handleNavigation($event)"
1464
- (pageChange)="onPageChange()"
1465
- >
1466
- </kendo-calendar-navigation>
1467
- }
1468
- <kendo-calendar-viewlist
1469
- [activeView]="activeViewEnum"
1470
- [allowReverse]="allowReverse"
1471
- [showOtherMonthDays]="showOtherMonthDays"
1472
- [activeRangeEnd]="activeRangeEnd"
1473
- [selectionRange]="selectionRange"
1474
- [size]="size"
1475
- [isActive]="isActive"
1476
- [id]="headerId"
1477
- [weekDaysFormat]="weekDaysFormat"
1478
- [cellTemplateRef]="activeCellTemplate()?.templateRef"
1479
- [headerTitleTemplateRef]="headerTitleTemplateRef?.templateRef"
1480
- [headerTemplateRef]="headerTemplateRef?.templateRef"
1481
- [showFooter]="footer"
1482
- [footerTemplateRef]="footerTemplateRef?.templateRef"
1483
- [weekNumberTemplateRef]="weekNumberTemplateRef?.templateRef"
1484
- [cellUID]="cellUID"
1485
- [min]="min"
1486
- [max]="max"
1487
- [focusedDate]="focusedDate"
1488
- [weekNumber]="weekNumber"
1489
- [selectedDates]="selectedDates"
1490
- [tabIndex]="tabIndex"
1491
- [disabled]="disabled"
1492
- (todayButtonClick)="handleDateChange({
1493
- selectedDates: [$event],
1494
- focusedDate: $event
1495
- })"
1496
- (cellClick)="handleCellClick($event)"
1497
- (weekNumberCellClick)="handleWeekNumberClick($event)"
1498
- (activeDateChange)="handleActiveDateChange($event)"
1499
- (pageChange)="onPageChange()"
1500
- (focusCalendar)="handleFocus()"
1501
- (blurCalendar)="handleBlur($event)"
1502
- (cellEnter)="onCellEnter($event)"
1503
- >
1504
- </kendo-calendar-viewlist>
1505
- <kendo-resize-sensor (resize)="onResize()"></kendo-resize-sensor>
1506
- }
1507
- @if (type === 'classic') {
1508
- <kendo-multiviewcalendar
1509
- #multiviewcalendar
1510
- [views]="1"
1511
- [min]="min"
1512
- [max]="max"
1513
- [size]="size"
1514
- [id]="id"
1515
- [activeRangeEnd]="activeRangeEnd"
1516
- [selectionRange]="selectionRange"
1517
- [allowReverse]="allowReverse"
1518
- [disabled]="disabled"
1519
- [isActive]="isActive"
1520
- [showOtherMonthDays]="showOtherMonthDays"
1521
- [tabIndex]="tabIndex"
1522
- [activeView]="activeView"
1523
- [bottomView]="bottomView"
1524
- [topView]="topView"
1525
- [weekDaysFormat]="weekDaysFormat"
1526
- [weekNumber]="weekNumber"
1527
- [animateNavigation]="animateNavigation"
1528
- [cellTemplate]="activeCellTemplate()"
1529
- [monthCellTemplate]="monthCellTemplateRef"
1530
- [yearCellTemplate]="yearCellTemplateRef"
1531
- [decadeCellTemplate]="decadeCellTemplateRef"
1532
- [centuryCellTemplate]="centuryCellTemplateRef"
1533
- [headerTitleTemplate]="headerTitleTemplateRef"
1534
- [headerTemplate]="headerTemplateRef"
1535
- [footerTemplate]="footerTemplateRef"
1536
- [footer]="footer"
1537
- [weekNumberTemplate]="weekNumberTemplateRef"
1538
- [focusedDate]="focusedDate"
1539
- [selection]="selection"
1540
- [value]="value"
1541
- [disabledDates]="disabledDates"
1542
- (onClosePopup)="closePopup.emit()"
1543
- (activeViewChange)="handleActiveViewChange($event)"
1544
- (navigate)="handleNavigate($event)"
1545
- (valueChange)="handleMultiViewCalendarValueChange($event, multiviewcalendar.focusedDate)"
1546
- (focusCalendar)="handleFocus()"
1547
- (blur)="handleBlur($event)"
1548
- (blurEvent)="handleBlur($event)"
1549
- (keydown)="handleMultiViewCalendarKeydown($event)"
1550
- >
1551
- <kendo-multiviewcalendar-messages
1552
- [today]="localization.get('today')"
1553
- [prevButtonTitle]="localization.get('prevButtonTitle')"
1554
- [nextButtonTitle]="localization.get('nextButtonTitle')"
1555
- [parentViewButtonTitle]="localization.get('parentViewButtonTitle')"
1556
- >
1557
- </kendo-multiviewcalendar-messages>
1558
- </kendo-multiviewcalendar>
1559
- }
1560
- `,
1561
- standalone: true,
1562
- imports: [CalendarLocalizedMessagesDirective, NavigationComponent, ViewListComponent, ResizeSensorComponent, MultiViewCalendarComponent, MultiViewCalendarCustomMessagesComponent]
1563
- }]
1564
- }], ctorParameters: () => [{ type: i1.BusViewService }, { type: i2.CalendarDOMService }, { type: i0.ElementRef }, { type: i3.NavigationService }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i4.ScrollSyncService }, { type: i5.DisabledDatesService }, { type: i6.LocalizationService }, { type: i7.SelectionService }, { type: i8.PickerService, decorators: [{
1565
- type: Optional
1566
- }] }], propDecorators: { showOtherMonthDays: [{
1567
- type: Input
1568
- }], id: [{
1569
- type: Input
1570
- }], focusedDate: [{
1571
- type: Input
1572
- }], min: [{
1573
- type: Input
1574
- }], max: [{
1575
- type: Input
1576
- }], rangeValidation: [{
1577
- type: Input
1578
- }], weekDaysFormat: [{
1579
- type: Input
1580
- }], footer: [{
1581
- type: Input
1582
- }], selection: [{
1583
- type: Input
1584
- }], allowReverse: [{
1585
- type: Input
1586
- }], value: [{
1587
- type: Input
1588
- }], disabled: [{
1589
- type: Input
1590
- }], tabindex: [{
1591
- type: Input
1592
- }], tabIndex: [{
1593
- type: Input
1594
- }], disabledDates: [{
1595
- type: Input
1596
- }], navigation: [{
1597
- type: Input
1598
- }], activeView: [{
1599
- type: Input
1600
- }], bottomView: [{
1601
- type: Input
1602
- }], topView: [{
1603
- type: Input
1604
- }], type: [{
1605
- type: Input
1606
- }], animateNavigation: [{
1607
- type: Input
1608
- }], weekNumber: [{
1609
- type: Input
1610
- }, {
1611
- type: HostBinding,
1612
- args: ['class.k-week-number']
1613
- }], closePopup: [{
1614
- type: Output
1615
- }], activeViewChange: [{
1616
- type: Output
1617
- }], navigate: [{
1618
- type: Output
1619
- }], activeViewDateChange: [{
1620
- type: Output
1621
- }], onBlur: [{
1622
- type: Output,
1623
- args: ['blur']
1624
- }], onFocus: [{
1625
- type: Output,
1626
- args: ['focus']
1627
- }], valueChange: [{
1628
- type: Output
1629
- }], cellTemplate: [{
1630
- type: ContentChild,
1631
- args: [CellTemplateDirective, { static: false }]
1632
- }], cellTemplateRef: [{
1633
- type: Input,
1634
- args: ['cellTemplate']
1635
- }], monthCellTemplate: [{
1636
- type: ContentChild,
1637
- args: [MonthCellTemplateDirective, { static: false }]
1638
- }], monthCellTemplateRef: [{
1639
- type: Input,
1640
- args: ['monthCellTemplate']
1641
- }], yearCellTemplate: [{
1642
- type: ContentChild,
1643
- args: [YearCellTemplateDirective, { static: false }]
1644
- }], yearCellTemplateRef: [{
1645
- type: Input,
1646
- args: ['yearCellTemplate']
1647
- }], decadeCellTemplate: [{
1648
- type: ContentChild,
1649
- args: [DecadeCellTemplateDirective, { static: false }]
1650
- }], decadeCellTemplateRef: [{
1651
- type: Input,
1652
- args: ['decadeCellTemplate']
1653
- }], centuryCellTemplate: [{
1654
- type: ContentChild,
1655
- args: [CenturyCellTemplateDirective, { static: false }]
1656
- }], centuryCellTemplateRef: [{
1657
- type: Input,
1658
- args: ['centuryCellTemplate']
1659
- }], weekNumberTemplate: [{
1660
- type: ContentChild,
1661
- args: [WeekNumberCellTemplateDirective, { static: false }]
1662
- }], weekNumberTemplateRef: [{
1663
- type: Input,
1664
- args: ['weekNumberTemplate']
1665
- }], headerTitleTemplate: [{
1666
- type: ContentChild,
1667
- args: [HeaderTitleTemplateDirective, { static: false }]
1668
- }], headerTemplate: [{
1669
- type: ContentChild,
1670
- args: [HeaderTemplateDirective]
1671
- }], footerTemplate: [{
1672
- type: ContentChild,
1673
- args: [FooterTemplateDirective]
1674
- }], headerTitleTemplateRef: [{
1675
- type: Input,
1676
- args: ['headerTitleTemplate']
1677
- }], headerTemplateRef: [{
1678
- type: Input,
1679
- args: ['headerTemplate']
1680
- }], footerTemplateRef: [{
1681
- type: Input,
1682
- args: ['footerTemplate']
1683
- }], navigationItemTemplate: [{
1684
- type: ContentChild,
1685
- args: [NavigationItemTemplateDirective, { static: false }]
1686
- }], navigationItemTemplateRef: [{
1687
- type: Input,
1688
- args: ['navigationItemTemplate']
1689
- }], size: [{
1690
- type: Input
1691
- }], activeRangeEnd: [{
1692
- type: Input
1693
- }], navigationView: [{
1694
- type: ViewChild,
1695
- args: [NavigationComponent, { static: false }]
1696
- }], monthView: [{
1697
- type: ViewChild,
1698
- args: [ViewListComponent, { static: false }]
1699
- }], multiViewCalendar: [{
1700
- type: ViewChild,
1701
- args: [MultiViewCalendarComponent, { static: false }]
1702
- }], widgetId: [{
1703
- type: HostBinding,
1704
- args: ['attr.id']
1705
- }], ariaDisabled: [{
1706
- type: HostBinding,
1707
- args: ['attr.aria-disabled']
1708
- }, {
1709
- type: HostBinding,
1710
- args: ['class.k-disabled']
1711
- }] } });