@progress/kendo-angular-dateinputs 21.4.1 → 22.0.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 (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,217 +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 { Injectable } from '@angular/core';
6
- import { addDecades, addYears, cloneDate, durationInDecades, firstYearOfDecade, lastYearOfDecade, createDate, lastMonthOfYear, lastDayOfMonth } from '@progress/kendo-date-math';
7
- import { Action } from '../models/navigation-action.enum';
8
- import { EMPTY_SELECTIONRANGE } from '../models/selection-range.interface';
9
- import { getToday, isInSelectionRange, range } from '../../util';
10
- import { isPresent } from '../../common/utils';
11
- import * as i0 from "@angular/core";
12
- const EMPTY_DATA = [[]];
13
- const CELLS_LENGTH = 4;
14
- const ROWS_LENGTH = 3;
15
- const upStep = (year) => {
16
- const yearOfDecade = Number(year.toString().slice(-1));
17
- if (yearOfDecade < 2) {
18
- return -2;
19
- }
20
- if (yearOfDecade < 4) {
21
- return -6;
22
- }
23
- return -4;
24
- };
25
- const downStep = (year) => {
26
- const yearOfDecade = Number(year.toString().slice(-1));
27
- if (yearOfDecade > 7) {
28
- return 2;
29
- }
30
- if (yearOfDecade > 5) {
31
- return 6;
32
- }
33
- return 4;
34
- };
35
- const ACTIONS = {
36
- [Action.Left]: (date) => addYears(date, -1),
37
- [Action.Up]: (date) => addYears(date, upStep(date.getFullYear())),
38
- [Action.Right]: (date) => addYears(date, 1),
39
- [Action.Down]: (date) => addYears(date, downStep(date.getFullYear())),
40
- [Action.PrevView]: (date) => addDecades(date, -1),
41
- [Action.NextView]: (date) => addDecades(date, 1),
42
- [Action.FirstInView]: (date) => firstYearOfDecade(date),
43
- [Action.LastInView]: (date) => lastYearOfDecade(date)
44
- };
45
- /**
46
- * @hidden
47
- */
48
- export class DecadeViewService {
49
- addToDate(min, skip) {
50
- return addDecades(min, skip);
51
- }
52
- datesList(start, count) {
53
- return range(0, count).map(i => addDecades(start, i));
54
- }
55
- data(options) {
56
- const { cellUID, focusedDate, isActiveView, max, min, selectedDates, selectionRange = EMPTY_SELECTIONRANGE, viewDate, allowReverse } = options;
57
- if (!viewDate) {
58
- return EMPTY_DATA;
59
- }
60
- const cells = range(0, CELLS_LENGTH);
61
- const firstDate = firstYearOfDecade(viewDate);
62
- const lastDate = lastYearOfDecade(viewDate);
63
- const today = getToday();
64
- return range(0, ROWS_LENGTH).map(rowOffset => {
65
- const baseDate = addYears(firstDate, rowOffset * CELLS_LENGTH);
66
- return cells.map(cellOffset => {
67
- const cellDate = this.normalize(addYears(baseDate, cellOffset), min, max);
68
- const nextDecade = cellDate.getFullYear() > lastDate.getFullYear();
69
- if (!this.isInRange(cellDate, min, max) || nextDecade) {
70
- return null;
71
- }
72
- let isRangeStart = false;
73
- let isRangeEnd = false;
74
- if (allowReverse) {
75
- if ((this.isEqual(cellDate, selectionRange.start) && selectionRange.start <= selectionRange.end) ||
76
- (this.isEqual(cellDate, selectionRange.end) && selectionRange.end <= selectionRange.start)) {
77
- isRangeStart = true;
78
- }
79
- if ((this.isEqual(cellDate, selectionRange.start) && selectionRange.start >= selectionRange.end) ||
80
- (this.isEqual(cellDate, selectionRange.end) && selectionRange.end >= selectionRange.start)) {
81
- isRangeEnd = true;
82
- }
83
- }
84
- else {
85
- isRangeStart = this.isEqual(cellDate, selectionRange.start);
86
- isRangeEnd = this.isEqual(cellDate, selectionRange.end);
87
- }
88
- const isInMiddle = !isRangeStart && !isRangeEnd;
89
- let isRangeMid;
90
- if (allowReverse) {
91
- isRangeMid = isInMiddle && (isInSelectionRange(cellDate, selectionRange) || isInSelectionRange(cellDate, { start: selectionRange.end, end: selectionRange.start }));
92
- }
93
- else {
94
- isRangeMid = isInMiddle && isInSelectionRange(cellDate, selectionRange);
95
- }
96
- return {
97
- formattedValue: this.value(cellDate),
98
- id: `${cellUID}${cellDate.getTime()}`,
99
- isFocused: this.isEqual(cellDate, focusedDate),
100
- isSelected: isActiveView && selectedDates.some(date => this.isEqual(cellDate, date)),
101
- isWeekend: false,
102
- isRangeStart: isRangeStart,
103
- isRangeMid: isRangeMid,
104
- isRangeEnd: isRangeEnd,
105
- isRangeSplitEnd: isRangeMid && this.isEqual(cellDate, lastDate),
106
- isRangeSplitStart: isRangeMid && this.isEqual(cellDate, firstDate),
107
- isToday: this.isEqual(cellDate, today),
108
- title: this.cellTitle(cellDate),
109
- value: cellDate,
110
- allowReverse: allowReverse
111
- };
112
- });
113
- });
114
- }
115
- isEqual(candidate, expected) {
116
- if (!candidate || !expected) {
117
- return false;
118
- }
119
- return candidate.getFullYear() === expected.getFullYear();
120
- }
121
- isInArray(date, dates) {
122
- if (!dates.length) {
123
- return false;
124
- }
125
- const year = date.getFullYear();
126
- return dates[0].getFullYear() <= year && year <= (dates[dates.length - 1].getFullYear() + 9);
127
- }
128
- isInRange(candidate, min, max) {
129
- const year = candidate.getFullYear();
130
- const aboveMin = !min || min.getFullYear() <= year;
131
- const belowMax = !max || year <= max.getFullYear();
132
- return aboveMin && belowMax;
133
- }
134
- beginningOfPeriod(date) {
135
- if (!date) {
136
- return date;
137
- }
138
- const firstYear = firstYearOfDecade(date);
139
- return createDate(firstYear.getFullYear(), 0, 1);
140
- }
141
- lastDayOfPeriod(date) {
142
- const year = lastYearOfDecade(date);
143
- const month = lastMonthOfYear(year);
144
- return lastDayOfMonth(month);
145
- }
146
- isRangeStart(value) {
147
- return value.getFullYear() % 100 === 0;
148
- }
149
- move(value, action) {
150
- const modifier = ACTIONS[action];
151
- if (!modifier) {
152
- return value;
153
- }
154
- return modifier(value);
155
- }
156
- cellTitle(value) {
157
- return value.getFullYear().toString();
158
- }
159
- navigationTitle(value) {
160
- return value ? firstYearOfDecade(value).getFullYear().toString() : '';
161
- }
162
- title(value) {
163
- if (!value) {
164
- return '';
165
- }
166
- return `${firstYearOfDecade(value).getFullYear()} - ${lastYearOfDecade(value).getFullYear()}`;
167
- }
168
- rowLength() {
169
- return CELLS_LENGTH;
170
- }
171
- skip(value, min) {
172
- return durationInDecades(min, value);
173
- }
174
- total(min, max) {
175
- return durationInDecades(min, max) + 1;
176
- }
177
- value(current) {
178
- return current ? current.getFullYear().toString() : '';
179
- }
180
- viewDate(date, max, viewsCount = 1) {
181
- const viewsInRange = this.total(date, max);
182
- if (viewsInRange < viewsCount) {
183
- const decadesToSubtract = viewsCount - viewsInRange;
184
- return addDecades(date, -1 * decadesToSubtract);
185
- }
186
- return date;
187
- }
188
- dateRange = (start, end) => {
189
- if (!isPresent(start) || !isPresent(end)) {
190
- return [];
191
- }
192
- const result = [];
193
- let current = start;
194
- while (current <= end) {
195
- result.push(current);
196
- current = addYears(current, 1);
197
- }
198
- return result;
199
- };
200
- normalize(cellDate, min, max) {
201
- if (cellDate < min && this.isEqual(cellDate, min)) {
202
- return cloneDate(min);
203
- }
204
- if (cellDate > max && this.isEqual(cellDate, max)) {
205
- return cloneDate(max);
206
- }
207
- return cellDate;
208
- }
209
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DecadeViewService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
210
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DecadeViewService, providedIn: 'root' });
211
- }
212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DecadeViewService, decorators: [{
213
- type: Injectable,
214
- args: [{
215
- providedIn: 'root'
216
- }]
217
- }] });
@@ -1,66 +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 { Injectable, isDevMode } from '@angular/core';
6
- import { getDate } from '@progress/kendo-date-math';
7
- import { Subject } from 'rxjs';
8
- import { isNumberArray, isDateArray, isPresent } from '../../common/utils';
9
- import * as i0 from "@angular/core";
10
- const noop = () => false;
11
- const DISABLED_DATES_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/dateinputs/calendar/disabled-dates/';
12
- /**
13
- * @hidden
14
- */
15
- export class DisabledDatesService {
16
- /**
17
- * Emits every time the `isDateDisabled` method changes.
18
- */
19
- changes = new Subject();
20
- /**
21
- * Based on the user-defined `disabledDates` input evaluates if the date is disabled.
22
- * If not set, returns `false`.
23
- */
24
- isDateDisabled = noop;
25
- /**
26
- * Configures the `isDateDisabled` function.
27
- *
28
- * * If a function is provided, uses it as-is and passes each date to it for evaluation.
29
- * The time part is set to `midnight`.
30
- * * If a `Date[]` is provided, creates a function that checks the targeted date against
31
- * the listed dates and, if the targeted date is listed, marks it as disabled.
32
- * * If a `Day[]` is provided, creates a function that evaluates the provided days of the
33
- * week as disabled.
34
- */
35
- initialize(disabledDates) {
36
- if (typeof disabledDates === 'function') {
37
- this.isDateDisabled = (date) => disabledDates(getDate(date));
38
- }
39
- else if (isNumberArray(disabledDates)) {
40
- const disabledWeekDays = new Set(disabledDates);
41
- this.isDateDisabled = (date) => disabledWeekDays.has(date.getDay());
42
- }
43
- else if (isDateArray(disabledDates)) {
44
- const normalizedDisabledDates = new Set(disabledDates.map(date => getDate(date).getTime()));
45
- this.isDateDisabled = (date) => normalizedDisabledDates.has(getDate(date).getTime());
46
- }
47
- else {
48
- this.isDateDisabled = noop;
49
- this.notifyInvalidInput(disabledDates);
50
- }
51
- this.notifyServiceChange();
52
- }
53
- notifyInvalidInput(disabledDates) {
54
- if (isPresent(disabledDates) && isDevMode()) {
55
- throw new Error(`The 'disabledDates' value should be a function, a Day array or a Date array. Check ${DISABLED_DATES_DOC_LINK} for more information.`);
56
- }
57
- }
58
- notifyServiceChange() {
59
- this.changes.next();
60
- }
61
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DisabledDatesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
62
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DisabledDatesService });
63
- }
64
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DisabledDatesService, decorators: [{
65
- type: Injectable
66
- }] });
@@ -1,203 +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 { Injectable } from '@angular/core';
6
- import { CalendarViewEnum } from '../models/view.enum';
7
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
8
- import { domContainerFactory as containerFactory } from '../../util';
9
- import { isPresent } from '../../common/utils';
10
- import * as i0 from "@angular/core";
11
- const div = containerFactory('div');
12
- const ul = containerFactory('ul');
13
- const li = containerFactory('li');
14
- const td = containerFactory('td');
15
- const th = containerFactory('th');
16
- const tr = containerFactory('tr');
17
- const tbody = containerFactory('tbody');
18
- const thead = containerFactory('thead');
19
- const table = containerFactory('table');
20
- const monthHeader = () => (div(`
21
- <span class="k-button k-button-md k-rounded-md k-button-flat k-button-flat-base k-calendar-title">March 2017</span>
22
- <span class="k-spacer"></span>
23
- <span class="k-calendar-nav">
24
- <button class="k-calendar-nav-today k-button k-button-md k-button-flat k-button-flat-base k-rounded-md">TODAY</button>
25
- </span>
26
- `, 'k-calendar-header'));
27
- const monthWeekHeader = () => (table([
28
- thead([
29
- tr([th('MO', 'k-calendar-th')], 'k-calendar-tr')
30
- ], 'k-calendar-thead')
31
- ], 'k-calendar-weekdays k-calendar-table'));
32
- const repeat = (count, mapper) => new Array(count).fill('1').map(mapper);
33
- const content = (rows, cells = 1) => (table([
34
- tbody([tr([th('1', 'k-calendar-th')], 'k-calendar-tr')].concat(repeat(rows, () => tr(repeat(cells, c => td(`<span class="k-link">${c}</span>`, 'k-calendar-td')), 'k-calendar-tr'))), 'k-calendar-tbody')
35
- ], 'k-calendar-table'));
36
- const scrollable = (children) => div(children, 'k-flex k-content k-scrollable');
37
- const view = (contentElement, className, renderWeekHeader) => (div([
38
- monthHeader(),
39
- renderWeekHeader ? monthWeekHeader() : null,
40
- scrollable([contentElement, contentElement])
41
- ], className, { left: '-10000px', position: 'absolute' }));
42
- const navigationList = (() => {
43
- let navElement;
44
- return () => {
45
- if (!isDocumentAvailable()) {
46
- return null;
47
- }
48
- if (!navElement) {
49
- navElement = div([scrollable([ul([li('<span>FEB</span>')])])], 'k-calendar-navigation', { left: '0px', position: 'absolute' });
50
- }
51
- return navElement;
52
- };
53
- })();
54
- const viewFactory = ({ cells, rows }, className, renderWeekHeader) => {
55
- let viewElement;
56
- return () => {
57
- if (!isDocumentAvailable()) {
58
- return null;
59
- }
60
- if (!viewElement) {
61
- viewElement = view(content(rows, cells), className, renderWeekHeader);
62
- }
63
- return viewElement;
64
- };
65
- };
66
- const getScrollable = (element) => element.querySelector('.k-scrollable');
67
- const horizontal = element => {
68
- const scrollableElement = getScrollable(element);
69
- scrollableElement.classList.add('k-scrollable-horizontal');
70
- return element;
71
- };
72
- const monthView = viewFactory({ cells: 7, rows: 6 }, 'k-vstack k-calendar-view k-calendar-monthview', true);
73
- const yearView = viewFactory({ cells: 4, rows: 3 }, 'k-vstack k-calendar-view k-calendar-yearview', false);
74
- const decadeView = viewFactory({ cells: 4, rows: 3 }, 'k-vstack k-calendar-view k-calendar-decadeview', false);
75
- const horzMonthView = () => horizontal(monthView());
76
- const horzYearView = () => horizontal(yearView());
77
- const horzDecadeView = () => horizontal(decadeView());
78
- const height = (element) => {
79
- if (!isDocumentAvailable()) {
80
- return element.offsetHeight || 0;
81
- }
82
- return parseFloat(window.getComputedStyle(element).height) || element.offsetHeight;
83
- };
84
- const width = (element) => {
85
- if (!isDocumentAvailable()) {
86
- return element.offsetWidth || 0;
87
- }
88
- const styles = window.getComputedStyle(element);
89
- const computed = parseFloat(styles.width)
90
- + parseFloat(styles.paddingLeft)
91
- + parseFloat(styles.paddingRight);
92
- return computed || element.offsetWidth;
93
- };
94
- const getBody = (element) => element.querySelector('tbody');
95
- /**
96
- * @hidden
97
- */
98
- export class CalendarDOMService {
99
- //heights
100
- calendarHeight;
101
- headerHeight;
102
- monthViewHeight;
103
- yearViewHeight;
104
- decadeViewHeight;
105
- centuryViewHeight;
106
- navigationItemHeight;
107
- scrollableContentHeight;
108
- scrollableYearContentHeight;
109
- //widths
110
- calendarWidth;
111
- monthViewWidth;
112
- yearViewWidth;
113
- decadeViewWidth;
114
- centuryViewWidth;
115
- scrollableContentWidth;
116
- hostContainer;
117
- ensureHeights() {
118
- if (this.calendarHeight !== undefined) {
119
- return;
120
- }
121
- this.calculateHeights();
122
- }
123
- calculateHeights(container) {
124
- if (!isDocumentAvailable()) {
125
- return;
126
- }
127
- this.hostContainer = container;
128
- this.batch(monthView(), (contentElement) => {
129
- const viewElement = getBody(contentElement);
130
- this.calendarHeight = height(contentElement);
131
- this.monthViewHeight = height(viewElement);
132
- this.headerHeight = height(viewElement.children[0]);
133
- this.scrollableContentHeight = height(getScrollable(contentElement));
134
- });
135
- this.batch(horzMonthView(), (contentElement) => {
136
- const viewElement = getBody(contentElement);
137
- this.calendarWidth = width(contentElement);
138
- this.monthViewWidth = width(viewElement);
139
- this.scrollableContentWidth = width(getScrollable(contentElement));
140
- });
141
- this.batch(yearView(), (contentElement) => {
142
- this.yearViewHeight = height(getBody(contentElement));
143
- this.scrollableYearContentHeight = height(getScrollable(contentElement));
144
- });
145
- this.batch(horzYearView(), (contentElement) => {
146
- this.yearViewWidth = width(getBody(contentElement));
147
- });
148
- this.batch(decadeView(), (contentElement) => {
149
- this.decadeViewHeight = height(getBody(contentElement));
150
- this.centuryViewHeight = this.decadeViewHeight;
151
- });
152
- this.batch(horzDecadeView(), (contentElement) => {
153
- this.decadeViewWidth = width(getBody(contentElement));
154
- this.centuryViewWidth = this.decadeViewWidth;
155
- });
156
- this.batch(navigationList(), (contentElement) => {
157
- this.navigationItemHeight = height(contentElement.querySelector('li'));
158
- });
159
- }
160
- viewHeight(viewType) {
161
- return this.viewDimension(viewType, 'height');
162
- }
163
- viewWidth(viewType) {
164
- return this.viewDimension(viewType, 'width');
165
- }
166
- viewDimension(viewType, dimension) {
167
- const viewProp = dimension === 'height' ? 'ViewHeight' : 'ViewWidth';
168
- switch (viewType) {
169
- case CalendarViewEnum.month:
170
- return this[`month${viewProp}`];
171
- case CalendarViewEnum.year:
172
- return this[`year${viewProp}`];
173
- case CalendarViewEnum.decade:
174
- return this[`decade${viewProp}`];
175
- case CalendarViewEnum.century:
176
- return this[`century${viewProp}`];
177
- default:
178
- return 1;
179
- }
180
- }
181
- batch(contentElement, action) {
182
- if (!isPresent(this.hostContainer)) {
183
- return;
184
- }
185
- const hostClone = this.hostContainer.cloneNode();
186
- document.body.appendChild(hostClone);
187
- try {
188
- const appendedContent = hostClone.appendChild(contentElement);
189
- action(appendedContent);
190
- }
191
- finally {
192
- document.body.removeChild(hostClone);
193
- }
194
- }
195
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CalendarDOMService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
196
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CalendarDOMService, providedIn: 'root' });
197
- }
198
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CalendarDOMService, decorators: [{
199
- type: Injectable,
200
- args: [{
201
- providedIn: 'root'
202
- }]
203
- }] });