@progress/kendo-angular-dateinputs 7.1.2 → 7.1.3-dev.202210211241

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 (54) hide show
  1. package/bundles/kendo-angular-dateinputs.umd.js +1 -1
  2. package/calendar/calendar.component.d.ts +7 -2
  3. package/calendar/header.component.d.ts +4 -1
  4. package/calendar/horizontal-view-list.component.d.ts +17 -1
  5. package/calendar/localization/calendar-messages.d.ts +5 -1
  6. package/calendar/localization/multiview-calendar-messages.d.ts +5 -1
  7. package/calendar/multiview-calendar.component.d.ts +21 -11
  8. package/calendar/services/bus-view.service.d.ts +1 -0
  9. package/calendar/services/selection.service.d.ts +2 -0
  10. package/calendar/services/weeknames.service.d.ts +1 -1
  11. package/calendar/view-list.component.d.ts +9 -1
  12. package/calendar/view.component.d.ts +3 -1
  13. package/common/utils.d.ts +33 -0
  14. package/dateinput/dateinput.component.d.ts +16 -6
  15. package/datepicker/datepicker.component.d.ts +1 -5
  16. package/daterange/date-range-end-input.directive.d.ts +1 -0
  17. package/daterange/date-range-input.d.ts +4 -1
  18. package/daterange/date-range-start-input.directive.d.ts +2 -0
  19. package/daterange/date-range.component.d.ts +7 -1
  20. package/daterange/date-range.service.d.ts +6 -2
  21. package/datetimepicker/datetimepicker.component.d.ts +5 -4
  22. package/esm2015/calendar/calendar.component.js +85 -48
  23. package/esm2015/calendar/header.component.js +30 -3
  24. package/esm2015/calendar/horizontal-view-list.component.js +83 -11
  25. package/esm2015/calendar/localization/calendar-messages.js +3 -1
  26. package/esm2015/calendar/localization/multiview-calendar-messages.js +3 -1
  27. package/esm2015/calendar/multiview-calendar.component.js +87 -45
  28. package/esm2015/calendar/services/bus-view.service.js +2 -0
  29. package/esm2015/calendar/services/month-view.service.js +1 -1
  30. package/esm2015/calendar/services/selection.service.js +4 -0
  31. package/esm2015/calendar/services/weeknames.service.js +2 -2
  32. package/esm2015/calendar/view-list.component.js +45 -9
  33. package/esm2015/calendar/view.component.js +16 -3
  34. package/esm2015/common/utils.js +34 -0
  35. package/esm2015/dateinput/dateinput.component.js +52 -23
  36. package/esm2015/datepicker/datepicker.component.js +25 -11
  37. package/esm2015/daterange/date-range-end-input.directive.js +5 -1
  38. package/esm2015/daterange/date-range-input.js +10 -0
  39. package/esm2015/daterange/date-range-popup.component.js +4 -4
  40. package/esm2015/daterange/date-range-selection.directive.js +1 -1
  41. package/esm2015/daterange/date-range-start-input.directive.js +7 -0
  42. package/esm2015/daterange/date-range.component.js +29 -11
  43. package/esm2015/daterange/date-range.service.js +28 -4
  44. package/esm2015/datetimepicker/datetimepicker.component.js +36 -11
  45. package/esm2015/package-metadata.js +1 -1
  46. package/esm2015/timepicker/localization/messages.js +11 -1
  47. package/esm2015/timepicker/timelist.component.js +57 -10
  48. package/esm2015/timepicker/timepicker.component.js +71 -24
  49. package/esm2015/util.js +2 -2
  50. package/fesm2015/kendo-angular-dateinputs.js +773 -280
  51. package/package.json +1 -1
  52. package/timepicker/localization/messages.d.ts +21 -1
  53. package/timepicker/timelist.component.d.ts +10 -1
  54. package/timepicker/timepicker.component.d.ts +5 -7
@@ -31,6 +31,10 @@ export class SelectionService {
31
31
  const [start, end] = sortDates([rangePivot || date, date]);
32
32
  selectedDates = this.bus.service(activeViewEnum).dateRange(start, end);
33
33
  rangePivot = date > selectedDates[0] ? selectedDates[0] : last(selectedDates);
34
+ if (modifiers.anyArrow) {
35
+ const [start, end] = sortDates([this.lastClicked || date, date]);
36
+ selectedDates = this.bus.service(0).dateRange(start, end);
37
+ }
34
38
  }
35
39
  else {
36
40
  selectedDates = [date];
@@ -13,8 +13,8 @@ export class WeekNamesService {
13
13
  constructor(intl) {
14
14
  this.intl = intl;
15
15
  }
16
- getWeekNames(includeWeekNumber = false) {
17
- const weekNames = shiftWeekNames(this.intl.dateFormatNames({ nameType: 'short', type: 'days' }), this.intl.firstDay());
16
+ getWeekNames(includeWeekNumber = false, nameType) {
17
+ const weekNames = shiftWeekNames(this.intl.dateFormatNames({ nameType: nameType, type: 'days' }), this.intl.firstDay());
18
18
  return includeWeekNumber ? [''].concat(weekNames) : weekNames;
19
19
  }
20
20
  }
@@ -35,15 +35,21 @@ export class ViewListComponent {
35
35
  this.min = new Date(MIN_DATE);
36
36
  this.max = new Date(MAX_DATE);
37
37
  this.selectedDates = [];
38
+ this.tabIndex = 0;
39
+ this.disabled = false;
38
40
  this.cellClick = new EventEmitter();
39
41
  this.weekNumberCellClick = new EventEmitter();
40
42
  this.activeDateChange = new EventEmitter();
41
43
  this.todayButtonClick = new EventEmitter();
42
44
  this.pageChange = new EventEmitter();
45
+ this.focusCalendar = new EventEmitter();
46
+ this.blurCalendar = new EventEmitter();
47
+ this.focusedCellChange = new EventEmitter();
43
48
  this.getComponentClass = true;
44
49
  this.dates = [];
45
50
  this.cols = [];
46
51
  this.weekNames = [];
52
+ this.wideWeekNames = [];
47
53
  this.take = VIEWS_COUNT;
48
54
  this.animateToIndex = true;
49
55
  this.indexToScroll = -1;
@@ -68,7 +74,8 @@ export class ViewListComponent {
68
74
  return this.activeView === CalendarViewEnum.century;
69
75
  }
70
76
  ngOnInit() {
71
- this.weekNames = this.getWeekNames();
77
+ this.weekNames = this.getWeekNames('short');
78
+ this.wideWeekNames = this.getWeekNames('wide');
72
79
  this.bottomOffset = this.getBottomOffset();
73
80
  this.viewOffset = -1 * this.dom.headerHeight;
74
81
  this.viewHeight = this.dom.viewHeight(this.activeView);
@@ -80,7 +87,8 @@ export class ViewListComponent {
80
87
  return;
81
88
  }
82
89
  this.cols = new Array(this.service.rowLength({ prependCell: this.weekNumber })).fill('');
83
- this.weekNames = hasChange(changes, 'weekNumber') && this.weekNumber ? this.getWeekNames() : this.weekNames;
90
+ this.weekNames = hasChange(changes, 'weekNumber') && this.weekNumber ? this.getWeekNames('short') : this.weekNames;
91
+ this.wideWeekNames = hasChange(changes, 'weekNumber') && this.weekNumber ? this.getWeekNames('wide') : this.weekNames;
84
92
  const activeViewChanged = hasChange(changes, 'activeView');
85
93
  const focusedDate = this.focusedDate;
86
94
  const viewDate = dateInRange(this.service.viewDate(focusedDate, this.max, this.minViewsToRender), this.min, this.max);
@@ -145,6 +153,9 @@ export class ViewListComponent {
145
153
  isScrolled() {
146
154
  return this.virtualization.isListScrolled(this.service.skip(this.focusedDate, this.min));
147
155
  }
156
+ getTabIndex() {
157
+ return this.disabled ? null : this.tabIndex;
158
+ }
148
159
  getBottomOffset() {
149
160
  return this.getScrollableHeight() - this.dom.viewHeight(this.activeView);
150
161
  }
@@ -156,23 +167,25 @@ export class ViewListComponent {
156
167
  getTake(skip) {
157
168
  return Math.min(this.total - skip, this.take);
158
169
  }
159
- getWeekNames() {
160
- const weekNames = shiftWeekNames(this.intl.dateFormatNames({ nameType: 'short', type: 'days' }), this.intl.firstDay());
170
+ getWeekNames(nameType) {
171
+ const weekNames = shiftWeekNames(this.intl.dateFormatNames({ nameType: nameType, type: 'days' }), this.intl.firstDay());
161
172
  return this.weekNumber ? [''].concat(weekNames) : weekNames;
162
173
  }
163
174
  intlChange() {
164
- this.weekNames = this.getWeekNames();
175
+ this.weekNames = this.getWeekNames('short');
176
+ this.wideWeekNames = this.getWeekNames('wide');
165
177
  if (this.isMonthView()) {
166
178
  this.cdr.markForCheck();
167
179
  }
168
180
  }
169
181
  }
170
182
  ViewListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ViewListComponent, deps: [{ token: i1.BusViewService }, { token: i0.ChangeDetectorRef }, { token: i2.IntlService }, { token: i3.CalendarDOMService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
171
- ViewListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ViewListComponent, selector: "kendo-calendar-viewlist", inputs: { cellTemplateRef: "cellTemplateRef", weekNumberTemplateRef: "weekNumberTemplateRef", headerTitleTemplateRef: "headerTitleTemplateRef", activeView: "activeView", cellUID: "cellUID", focusedDate: "focusedDate", isActive: "isActive", min: "min", max: "max", selectedDates: "selectedDates", weekNumber: "weekNumber" }, outputs: { cellClick: "cellClick", weekNumberCellClick: "weekNumberCellClick", activeDateChange: "activeDateChange", todayButtonClick: "todayButtonClick", pageChange: "pageChange" }, host: { properties: { "class.k-vstack": "this.getComponentClass", "class.k-calendar-view": "this.getComponentClass", "class.k-calendar-monthview": "this.getComponentMonthClass", "class.k-calendar-yearview": "this.getComponentYearClass", "class.k-calendar-decadeview": "this.getComponentDecadeClass", "class.k-calendar-centuryview": "this.getComponentCenturyClass" } }, viewQueries: [{ propertyName: "virtualization", first: true, predicate: VirtualizationComponent, descendants: true }, { propertyName: "list", first: true, predicate: ["list"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
183
+ ViewListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ViewListComponent, selector: "kendo-calendar-viewlist", inputs: { cellTemplateRef: "cellTemplateRef", weekNumberTemplateRef: "weekNumberTemplateRef", headerTitleTemplateRef: "headerTitleTemplateRef", activeView: "activeView", cellUID: "cellUID", focusedDate: "focusedDate", isActive: "isActive", min: "min", max: "max", selectedDates: "selectedDates", tabIndex: "tabIndex", disabled: "disabled", id: "id", weekNumber: "weekNumber" }, outputs: { cellClick: "cellClick", weekNumberCellClick: "weekNumberCellClick", activeDateChange: "activeDateChange", todayButtonClick: "todayButtonClick", pageChange: "pageChange", focusCalendar: "focusCalendar", blurCalendar: "blurCalendar", focusedCellChange: "focusedCellChange" }, host: { properties: { "class.k-vstack": "this.getComponentClass", "class.k-calendar-view": "this.getComponentClass", "class.k-calendar-monthview": "this.getComponentMonthClass", "class.k-calendar-yearview": "this.getComponentYearClass", "class.k-calendar-decadeview": "this.getComponentDecadeClass", "class.k-calendar-centuryview": "this.getComponentCenturyClass" } }, viewQueries: [{ propertyName: "virtualization", first: true, predicate: VirtualizationComponent, descendants: true }, { propertyName: "list", first: true, predicate: ["list"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
172
184
  <kendo-calendar-header
173
185
  [currentDate]="activeDate"
174
186
  [min]="min"
175
187
  [max]="max"
188
+ [id]="id"
176
189
  [activeView]="activeView"
177
190
  [templateRef]="headerTitleTemplateRef"
178
191
  (todayButtonClick)="todayButtonClick.emit($event)"
@@ -181,7 +194,7 @@ ViewListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
181
194
  <table class="k-calendar-weekdays k-calendar-table" style="table-layout: auto;" *ngIf="isMonthView()">
182
195
  <thead class="k-calendar-thead">
183
196
  <tr class="k-calendar-tr">
184
- <th class="k-calendar-th" *ngFor="let name of weekNames">{{name}}</th>
197
+ <th class="k-calendar-th" *ngFor="let name of weekNames; let i = index;" scope="col" [attr.aria-label]="wideWeekNames[i]" role="columnheader">{{name}}</th>
185
198
  </tr>
186
199
  </thead>
187
200
  </table>
@@ -203,6 +216,10 @@ ViewListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
203
216
  #list
204
217
  role="grid"
205
218
  class="k-calendar-table"
219
+ [attr.tabindex]="getTabIndex()"
220
+ [attr.aria-labelledby]="id"
221
+ (focus)="focusCalendar.emit()"
222
+ (focusout)="blurCalendar.emit($event)"
206
223
  >
207
224
  <colgroup><col *ngFor="let _ of cols" /></colgroup>
208
225
 
@@ -222,10 +239,11 @@ ViewListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
222
239
  [viewDate]="date"
223
240
  (cellClick)="cellClick.emit($event)"
224
241
  (weekNumberCellClick)="weekNumberCellClick.emit($event)"
242
+ (focusedCellId)="focusedCellChange.emit($event)"
225
243
  ></tbody>
226
244
  </table>
227
245
  </kendo-virtualization>
228
- `, isInline: true, components: [{ type: i4.HeaderComponent, selector: "kendo-calendar-header", inputs: ["activeView", "currentDate", "min", "max", "rangeLength", "templateRef", "isPrevDisabled", "isNextDisabled", "showNavigationButtons", "orientation"], outputs: ["todayButtonClick", "prevButtonClick", "nextButtonClick"] }, { type: i5.VirtualizationComponent, selector: "kendo-virtualization", inputs: ["direction", "itemHeight", "itemWidth", "topOffset", "bottomOffset", "maxScrollDifference", "scrollOffsetSize", "scrollDuration", "skip", "take", "total"], outputs: ["activeIndexChange", "pageChange", "scrollChange"] }, { type: i6.ViewComponent, selector: "[kendoCalendarView]", inputs: ["direction", "isActive", "activeView", "cellUID", "focusedDate", "viewDate", "activeRangeEnd", "selectionRange", "min", "max", "selectedDates", "weekNumber", "viewIndex", "templateRef", "weekNumberTemplateRef"], outputs: ["cellClick", "weekNumberCellClick", "cellEnter", "cellLeave"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i8.KForOf, selector: "[kFor][kForOf]", inputs: ["kForOf", "kForTrackBy", "kForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
246
+ `, isInline: true, components: [{ type: i4.HeaderComponent, selector: "kendo-calendar-header", inputs: ["activeView", "currentDate", "min", "max", "rangeLength", "templateRef", "isPrevDisabled", "isNextDisabled", "showNavigationButtons", "orientation", "id"], outputs: ["todayButtonClick", "prevButtonClick", "nextButtonClick"] }, { type: i5.VirtualizationComponent, selector: "kendo-virtualization", inputs: ["direction", "itemHeight", "itemWidth", "topOffset", "bottomOffset", "maxScrollDifference", "scrollOffsetSize", "scrollDuration", "skip", "take", "total"], outputs: ["activeIndexChange", "pageChange", "scrollChange"] }, { type: i6.ViewComponent, selector: "[kendoCalendarView]", inputs: ["direction", "isActive", "activeView", "cellUID", "focusedDate", "viewDate", "activeRangeEnd", "selectionRange", "min", "max", "selectedDates", "weekNumber", "viewIndex", "templateRef", "weekNumberTemplateRef"], outputs: ["cellClick", "weekNumberCellClick", "cellEnter", "cellLeave", "focusedCellId"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i8.KForOf, selector: "[kFor][kForOf]", inputs: ["kForOf", "kForTrackBy", "kForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
229
247
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ViewListComponent, decorators: [{
230
248
  type: Component,
231
249
  args: [{
@@ -236,6 +254,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
236
254
  [currentDate]="activeDate"
237
255
  [min]="min"
238
256
  [max]="max"
257
+ [id]="id"
239
258
  [activeView]="activeView"
240
259
  [templateRef]="headerTitleTemplateRef"
241
260
  (todayButtonClick)="todayButtonClick.emit($event)"
@@ -244,7 +263,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
244
263
  <table class="k-calendar-weekdays k-calendar-table" style="table-layout: auto;" *ngIf="isMonthView()">
245
264
  <thead class="k-calendar-thead">
246
265
  <tr class="k-calendar-tr">
247
- <th class="k-calendar-th" *ngFor="let name of weekNames">{{name}}</th>
266
+ <th class="k-calendar-th" *ngFor="let name of weekNames; let i = index;" scope="col" [attr.aria-label]="wideWeekNames[i]" role="columnheader">{{name}}</th>
248
267
  </tr>
249
268
  </thead>
250
269
  </table>
@@ -266,6 +285,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
266
285
  #list
267
286
  role="grid"
268
287
  class="k-calendar-table"
288
+ [attr.tabindex]="getTabIndex()"
289
+ [attr.aria-labelledby]="id"
290
+ (focus)="focusCalendar.emit()"
291
+ (focusout)="blurCalendar.emit($event)"
269
292
  >
270
293
  <colgroup><col *ngFor="let _ of cols" /></colgroup>
271
294
 
@@ -285,6 +308,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
285
308
  [viewDate]="date"
286
309
  (cellClick)="cellClick.emit($event)"
287
310
  (weekNumberCellClick)="weekNumberCellClick.emit($event)"
311
+ (focusedCellId)="focusedCellChange.emit($event)"
288
312
  ></tbody>
289
313
  </table>
290
314
  </kendo-virtualization>
@@ -310,6 +334,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
310
334
  type: Input
311
335
  }], selectedDates: [{
312
336
  type: Input
337
+ }], tabIndex: [{
338
+ type: Input
339
+ }], disabled: [{
340
+ type: Input
341
+ }], id: [{
342
+ type: Input
313
343
  }], weekNumber: [{
314
344
  type: Input
315
345
  }], cellClick: [{
@@ -322,6 +352,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
322
352
  type: Output
323
353
  }], pageChange: [{
324
354
  type: Output
355
+ }], focusCalendar: [{
356
+ type: Output
357
+ }], blurCalendar: [{
358
+ type: Output
359
+ }], focusedCellChange: [{
360
+ type: Output
325
361
  }], virtualization: [{
326
362
  type: ViewChild,
327
363
  args: [VirtualizationComponent, { static: false }]
@@ -35,6 +35,7 @@ export class ViewComponent {
35
35
  this.weekNumberCellClick = new EventEmitter();
36
36
  this.cellEnter = new EventEmitter();
37
37
  this.cellLeave = new EventEmitter();
38
+ this.focusedCellId = new EventEmitter();
38
39
  this.colSpan = 0;
39
40
  this.subscriptions = new Subscription();
40
41
  this.domEvents = [];
@@ -106,6 +107,9 @@ export class ViewComponent {
106
107
  };
107
108
  }
108
109
  getStyles(context) {
110
+ if (!context.isOtherMonth && this.isActive && context.isFocused) {
111
+ this.focusedCellId.emit(context.id);
112
+ }
109
113
  const { isRangeEnd, isRangeStart } = context;
110
114
  const isEndActive = this.activeRangeEnd === 'end' && isRangeEnd;
111
115
  const isStartActive = this.activeRangeEnd === 'start' && isRangeStart;
@@ -131,6 +135,9 @@ export class ViewComponent {
131
135
  const availableDates = week.map(item => item.value).filter(date => !this.disabledDatesService.isDateDisabled(date));
132
136
  this.weekNumberCellClick.emit(availableDates);
133
137
  }
138
+ getMonthLabel(date) {
139
+ return this.activeView === 1 ? this.intl.formatDate(date, 'MMMM') : null;
140
+ }
134
141
  firstWeekDateContext(rowCtx) {
135
142
  if (!this.weekNumber) {
136
143
  return null;
@@ -222,13 +229,14 @@ export class ViewComponent {
222
229
  }
223
230
  }
224
231
  ViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ViewComponent, deps: [{ token: i1.BusViewService }, { token: i2.IntlService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i3.DisabledDatesService }], target: i0.ɵɵFactoryTarget.Component });
225
- ViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ViewComponent, selector: "[kendoCalendarView]", inputs: { direction: "direction", isActive: "isActive", activeView: "activeView", cellUID: "cellUID", focusedDate: "focusedDate", viewDate: "viewDate", activeRangeEnd: "activeRangeEnd", selectionRange: "selectionRange", min: "min", max: "max", selectedDates: "selectedDates", weekNumber: "weekNumber", viewIndex: "viewIndex", templateRef: "templateRef", weekNumberTemplateRef: "weekNumberTemplateRef" }, outputs: { cellClick: "cellClick", weekNumberCellClick: "weekNumberCellClick", cellEnter: "cellEnter", cellLeave: "cellLeave" }, usesOnChanges: true, ngImport: i0, template: `
226
- <ng-template #emptyCell><td class="k-empty k-calendar-td">&nbsp;</td></ng-template>
232
+ ViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ViewComponent, selector: "[kendoCalendarView]", inputs: { direction: "direction", isActive: "isActive", activeView: "activeView", cellUID: "cellUID", focusedDate: "focusedDate", viewDate: "viewDate", activeRangeEnd: "activeRangeEnd", selectionRange: "selectionRange", min: "min", max: "max", selectedDates: "selectedDates", weekNumber: "weekNumber", viewIndex: "viewIndex", templateRef: "templateRef", weekNumberTemplateRef: "weekNumberTemplateRef" }, outputs: { cellClick: "cellClick", weekNumberCellClick: "weekNumberCellClick", cellEnter: "cellEnter", cellLeave: "cellLeave", focusedCellId: "focusedCellId" }, usesOnChanges: true, ngImport: i0, template: `
233
+ <ng-template #emptyCell><td class="k-empty k-calendar-td" role="gridcell">&nbsp;</td></ng-template>
227
234
  <tr *ngIf="!isHorizontal()" class="k-calendar-tr" role="row"><th class="k-calendar-caption" scope="col" [colSpan]="colSpan">{{title}}</th></tr>
228
235
  <tr *kFor="let row of data; let rowIndex = index" class="k-calendar-tr" role="row">
229
236
  <ng-template [ngIf]="weekNumber">
230
237
  <td
231
238
  class="k-alt k-calendar-td"
239
+ role="gridcell"
232
240
  *ngIf="firstDate(row); else emptyCell"
233
241
  [kendoEventsOutsideAngular]="{
234
242
  click: handleWeekNumberClick.bind(this, row)
@@ -255,6 +263,7 @@ ViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version:
255
263
  [attr.data-cell-index]="tableCellIndex(rowIndex, cellIndex)"
256
264
  [attr.aria-selected]="cell.isSelected || cell.isRangeStart || cell.isRangeMid || cell.isRangeEnd"
257
265
  [attr.aria-disabled]="cell.isDisabled"
266
+ [attr.aria-label]="getMonthLabel(cell.value)"
258
267
  [ngClass]="getStyles(cell)"
259
268
  [title]="cell.title"
260
269
  >
@@ -276,12 +285,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
276
285
  // eslint-disable-next-line
277
286
  selector: '[kendoCalendarView]',
278
287
  template: `
279
- <ng-template #emptyCell><td class="k-empty k-calendar-td">&nbsp;</td></ng-template>
288
+ <ng-template #emptyCell><td class="k-empty k-calendar-td" role="gridcell">&nbsp;</td></ng-template>
280
289
  <tr *ngIf="!isHorizontal()" class="k-calendar-tr" role="row"><th class="k-calendar-caption" scope="col" [colSpan]="colSpan">{{title}}</th></tr>
281
290
  <tr *kFor="let row of data; let rowIndex = index" class="k-calendar-tr" role="row">
282
291
  <ng-template [ngIf]="weekNumber">
283
292
  <td
284
293
  class="k-alt k-calendar-td"
294
+ role="gridcell"
285
295
  *ngIf="firstDate(row); else emptyCell"
286
296
  [kendoEventsOutsideAngular]="{
287
297
  click: handleWeekNumberClick.bind(this, row)
@@ -308,6 +318,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
308
318
  [attr.data-cell-index]="tableCellIndex(rowIndex, cellIndex)"
309
319
  [attr.aria-selected]="cell.isSelected || cell.isRangeStart || cell.isRangeMid || cell.isRangeEnd"
310
320
  [attr.aria-disabled]="cell.isDisabled"
321
+ [attr.aria-label]="getMonthLabel(cell.value)"
311
322
  [ngClass]="getStyles(cell)"
312
323
  [title]="cell.title"
313
324
  >
@@ -362,4 +373,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
362
373
  type: Output
363
374
  }], cellLeave: [{
364
375
  type: Output
376
+ }], focusedCellId: [{
377
+ type: Output
365
378
  }] } });
@@ -33,3 +33,37 @@ export const isNumberArray = (value) => Array.isArray(value) && value.length > 0
33
33
  * and all items in the array are dates, returns `true`.
34
34
  */
35
35
  export const isDateArray = (value) => Array.isArray(value) && value.length > 0 && value.every(item => item instanceof Date);
36
+ /**
37
+ * @hidden
38
+ */
39
+ export const isArrowWithShiftPressed = (args) => args.shiftKey && (args.keyCode === Keys.ArrowRight || args.keyCode === Keys.ArrowLeft || args.keyCode === Keys.ArrowDown || args.keyCode === Keys.ArrowUp);
40
+ /**
41
+ * @hidden
42
+ * Enum with key codes.
43
+ */
44
+ export var Keys;
45
+ (function (Keys) {
46
+ Keys[Keys["ArrowDown"] = 40] = "ArrowDown";
47
+ Keys[Keys["ArrowLeft"] = 37] = "ArrowLeft";
48
+ Keys[Keys["ArrowRight"] = 39] = "ArrowRight";
49
+ Keys[Keys["ArrowUp"] = 38] = "ArrowUp";
50
+ })(Keys || (Keys = {}));
51
+ /**
52
+ * @hidden
53
+ */
54
+ export const selectors = {
55
+ infiniteCalendarTable: '.k-content .k-calendar-table',
56
+ multiViewCalendarTable: '.k-content.k-calendar-table'
57
+ };
58
+ /**
59
+ * @hidden
60
+ */
61
+ export const attributeNames = {
62
+ ariaActiveDescendant: 'aria-activedescendant',
63
+ ariaControls: 'aria-controls',
64
+ ariaExpanded: 'aria-expanded',
65
+ ariaHasPopup: 'aria-haspopup',
66
+ valueNow: 'valuenow',
67
+ valuetext: 'valuetext',
68
+ ariaInvalid: 'aria-invalid'
69
+ };
@@ -15,7 +15,8 @@ import { isDocumentAvailable, hasObservers, KendoInput, Keys, guid } from '@prog
15
15
  import { Arrow } from './arrow.enum';
16
16
  import { approximateStringMatching, noop, isInRange, dateInRange, isValidRange, setTime, cropTwoDigitYear, setYears, msPaddingFromFormat, millisecondDigitsInFormat, millisecondStepFor, getSizeClass, getRoundedClass, getFillModeClass, DEFAULT_FILL_MODE, DEFAULT_ROUNDED, DEFAULT_SIZE } from '../util';
17
17
  import { closest } from '../common/dom-queries';
18
- import { requiresZoneOnBlur, isPresent } from '../common/utils';
18
+ import { requiresZoneOnBlur, isPresent, attributeNames } from '../common/utils';
19
+ import { Subscription } from 'rxjs';
19
20
  import * as i0 from "@angular/core";
20
21
  import * as i1 from "@progress/kendo-angular-intl";
21
22
  import * as i2 from "@progress/kendo-angular-l10n";
@@ -486,7 +487,7 @@ export class DateInputComponent {
486
487
  /**
487
488
  * @hidden
488
489
  */
489
- this.role = 'spinbutton';
490
+ this.role = 'textbox';
490
491
  /**
491
492
  * @hidden
492
493
  */
@@ -659,11 +660,15 @@ export class DateInputComponent {
659
660
  this._size = DEFAULT_SIZE;
660
661
  this._rounded = DEFAULT_ROUNDED;
661
662
  this._fillMode = DEFAULT_FILL_MODE;
663
+ this.subs = new Subscription();
662
664
  this.symbolsMap = this.dateSymbolMap();
663
665
  this.updateFormatSections();
664
666
  if (this.pickerService) {
665
667
  this.pickerService.input = this;
666
668
  }
669
+ else {
670
+ this.ariaReadOnly = null;
671
+ }
667
672
  }
668
673
  /**
669
674
  * @hidden
@@ -788,6 +793,13 @@ export class DateInputComponent {
788
793
  }
789
794
  }
790
795
  }
796
+ /**
797
+ * @hidden
798
+ */
799
+ get formControl() {
800
+ const ngControl = this.injector.get(NgControl, null);
801
+ return (ngControl === null || ngControl === void 0 ? void 0 : ngControl.control) || null;
802
+ }
791
803
  get inputFormat() {
792
804
  if (!this.format) {
793
805
  return DEFAULT_FORMAT;
@@ -823,6 +835,21 @@ export class DateInputComponent {
823
835
  containsElement(element) {
824
836
  return Boolean(closest(element, node => node === this.wrapper.nativeElement));
825
837
  }
838
+ /**
839
+ * @hidden
840
+ */
841
+ ngOnInit() {
842
+ this.kendoDate = this.getKendoDate(this.value);
843
+ this.updateElementValue();
844
+ this.subs.add(this.intl.changes.subscribe(this.intlChange.bind(this)));
845
+ this.ngControl = this.injector.get(NgControl, null);
846
+ if (this.wrapper) {
847
+ this.renderer.removeAttribute(this.wrapper.nativeElement, 'tabindex');
848
+ this.ngZone.runOutsideAngular(() => {
849
+ this.bindEvents();
850
+ });
851
+ }
852
+ }
826
853
  /**
827
854
  * @hidden
828
855
  */
@@ -844,10 +871,16 @@ export class DateInputComponent {
844
871
  this.updateElementValue(this.isActive);
845
872
  }
846
873
  }
874
+ ngAfterViewInit() {
875
+ var _a, _b;
876
+ this.setComponentClasses();
877
+ const formControl = (_a = this.injector.get(NgControl, null)) === null || _a === void 0 ? void 0 : _a.control;
878
+ this.control = formControl;
879
+ this.subs.add((_b = this.formControl) === null || _b === void 0 ? void 0 : _b.statusChanges.subscribe(() => this.setAriaInvalid()));
880
+ this.setAriaInvalid();
881
+ }
847
882
  ngOnDestroy() {
848
- if (this.intlSubscription) {
849
- this.intlSubscription.unsubscribe();
850
- }
883
+ this.subs.unsubscribe();
851
884
  if (this.pickerService) {
852
885
  this.pickerService.input = null;
853
886
  }
@@ -856,32 +889,28 @@ export class DateInputComponent {
856
889
  /**
857
890
  * @hidden
858
891
  */
859
- validate(control) {
860
- return this.minValidator(control) || this.maxValidator(control) || this.incompleteValidator(control, this.isDateIncomplete);
892
+ setAriaInvalid() {
893
+ if (!this.control) {
894
+ return;
895
+ }
896
+ if (this.control.invalid) {
897
+ this.renderer.setAttribute(this.inputElement, attributeNames.ariaInvalid, 'true');
898
+ }
899
+ else {
900
+ this.renderer.setAttribute(this.inputElement, attributeNames.ariaInvalid, 'false');
901
+ }
861
902
  }
862
903
  /**
863
904
  * @hidden
864
905
  */
865
- registerOnValidatorChange(fn) {
866
- this.onValidatorChange = fn;
906
+ validate(control) {
907
+ return this.minValidator(control) || this.maxValidator(control) || this.incompleteValidator(control, this.isDateIncomplete);
867
908
  }
868
909
  /**
869
910
  * @hidden
870
911
  */
871
- ngOnInit() {
872
- this.kendoDate = this.getKendoDate(this.value);
873
- this.updateElementValue();
874
- this.intlSubscription = this.intl.changes.subscribe(this.intlChange.bind(this));
875
- this.ngControl = this.injector.get(NgControl, null);
876
- if (this.wrapper) {
877
- this.renderer.removeAttribute(this.wrapper.nativeElement, 'tabindex');
878
- this.ngZone.runOutsideAngular(() => {
879
- this.bindEvents();
880
- });
881
- }
882
- }
883
- ngAfterViewInit() {
884
- this.setComponentClasses();
912
+ registerOnValidatorChange(fn) {
913
+ this.onValidatorChange = fn;
885
914
  }
886
915
  /**
887
916
  * @hidden
@@ -6,7 +6,7 @@ import { Component, ChangeDetectionStrategy, EventEmitter, HostBinding, Input, O
6
6
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS, NgControl } from '@angular/forms';
7
7
  import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
8
8
  import { cloneDate } from '@progress/kendo-date-math';
9
- import { hasObservers, KendoInput, guid, Keys } from '@progress/kendo-angular-common';
9
+ import { hasObservers, KendoInput, Keys } from '@progress/kendo-angular-common';
10
10
  import { validatePackage } from '@progress/kendo-licensing';
11
11
  import { packageMetadata } from '../package-metadata';
12
12
  import { MIN_DATE, MAX_DATE } from '../defaults';
@@ -26,7 +26,7 @@ import { PickerService } from '../common/picker.service';
26
26
  import { DisabledDatesService } from '../calendar/services/disabled-dates.service';
27
27
  import { noop, isValidRange, setTime, isWindowAvailable, isTabExitingCalendar, getSizeClass, getRoundedClass, getFillModeClass, DEFAULT_FILL_MODE, DEFAULT_ROUNDED, DEFAULT_SIZE } from '../util';
28
28
  import { TOUCH_ENABLED } from '../touch-enabled';
29
- import { requiresZoneOnBlur, currentFocusTarget } from '../common/utils';
29
+ import { requiresZoneOnBlur, currentFocusTarget, attributeNames } from '../common/utils';
30
30
  import { fromEvent } from 'rxjs';
31
31
  import { incompleteDateValidator } from '../validators/incomplete-date.validator';
32
32
  import { disabledDatesValidator } from '../validators/disabled-date.validator';
@@ -50,6 +50,7 @@ const TWO_DIGIT_YEAR_MAX = 68;
50
50
  */
51
51
  export class DatePickerComponent {
52
52
  constructor(zone, localization, cdr, popupService, wrapper, renderer, injector, pickerService, disabledDatesService, touchEnabled) {
53
+ var _a;
53
54
  this.zone = zone;
54
55
  this.localization = localization;
55
56
  this.cdr = cdr;
@@ -63,7 +64,7 @@ export class DatePickerComponent {
63
64
  /**
64
65
  * @hidden
65
66
  */
66
- this.focusableId = `k-${guid()}`;
67
+ this.focusableId = `k-datepicker-${(_a = this.calendar) === null || _a === void 0 ? void 0 : _a.id}-`;
67
68
  /**
68
69
  * Defines the active view that the Calendar initially renders
69
70
  * ([see example]({% slug calendar_type_datepicker %}#toc-active-view)).
@@ -266,7 +267,6 @@ export class DatePickerComponent {
266
267
  * @hidden
267
268
  */
268
269
  this.wrapperClasses = true;
269
- this.popupUID = guid();
270
270
  this._popupSettings = { animate: true };
271
271
  this._show = false;
272
272
  this._value = null;
@@ -460,12 +460,11 @@ export class DatePickerComponent {
460
460
  get disabledClass() {
461
461
  return this.disabled;
462
462
  }
463
- /**
464
- * @hidden
465
- */
466
- get inputRole() {
467
- return this.readOnlyInput ? 'listbox' : 'spinbutton';
463
+ get popupUID() {
464
+ var _a;
465
+ return (_a = this.calendar) === null || _a === void 0 ? void 0 : _a.id;
468
466
  }
467
+ ;
469
468
  get isActive() {
470
469
  return this._active;
471
470
  }
@@ -749,6 +748,7 @@ export class DatePickerComponent {
749
748
  return;
750
749
  }
751
750
  this._show = show;
751
+ const inputElement = this.wrapper.nativeElement.querySelector('input');
752
752
  if (show) {
753
753
  const direction = this.localization.rtl ? 'right' : 'left';
754
754
  this.popupRef = this.popupService.open({
@@ -761,13 +761,27 @@ export class DatePickerComponent {
761
761
  popupClass: this.popupClasses,
762
762
  positionMode: 'absolute'
763
763
  });
764
+ if (this.calendar.type === 'infinite') {
765
+ this.pickerSubscriptions.add(this.calendar.monthView.focusedCellChange.subscribe((id) => {
766
+ this.renderer.setAttribute(inputElement, attributeNames.ariaActiveDescendant, id);
767
+ }));
768
+ }
769
+ else {
770
+ this.pickerSubscriptions.add(this.calendar.multiViewCalendar.viewList.focusedCellChange.subscribe((id) => {
771
+ this.renderer.setAttribute(inputElement, attributeNames.ariaActiveDescendant, id);
772
+ }));
773
+ }
764
774
  this.popupRef.popupElement.setAttribute('id', this.popupUID);
775
+ this.renderer.setAttribute(inputElement, attributeNames.ariaControls, this.popupUID);
765
776
  this.subscription = this.popupRef.popupAnchorViewportLeave.subscribe(() => this.show = false);
766
777
  }
767
778
  else {
768
779
  this.popupRef.close();
769
780
  this.popupRef = null;
770
781
  this.subscription.unsubscribe();
782
+ this.renderer.removeAttribute(inputElement, attributeNames.ariaControls);
783
+ this.renderer.removeAttribute(inputElement, attributeNames.ariaActiveDescendant);
784
+ this.cdr.detectChanges();
771
785
  }
772
786
  }
773
787
  focusInput() {
@@ -912,7 +926,7 @@ DatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
912
926
  </ng-container>
913
927
  <kendo-dateinput
914
928
  #input
915
- [role]="inputRole"
929
+ [role]="'combobox'"
916
930
  [focusableId]="focusableId"
917
931
  [hasPopup]="true"
918
932
  [isPopupOpen]="show"
@@ -1023,7 +1037,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1023
1037
  </ng-container>
1024
1038
  <kendo-dateinput
1025
1039
  #input
1026
- [role]="inputRole"
1040
+ [role]="'combobox'"
1027
1041
  [focusableId]="focusableId"
1028
1042
  [hasPopup]="true"
1029
1043
  [isPopupOpen]="show"
@@ -7,7 +7,7 @@ import { cloneDate, isEqual } from '@progress/kendo-date-math';
7
7
  import { DateRangeInput } from './date-range-input';
8
8
  import { EMPTY_SELECTIONRANGE } from '../calendar/models/selection-range.interface';
9
9
  import { clampRange, isInRange } from '../util';
10
- import { isPresent } from '../common/utils';
10
+ import { attributeNames, isPresent } from '../common/utils';
11
11
  import * as i0 from "@angular/core";
12
12
  import * as i1 from "./date-range.service";
13
13
  import * as i2 from "../dateinput/dateinput.component";
@@ -51,6 +51,10 @@ export class DateRangeEndInputDirective extends DateRangeInput {
51
51
  this.rangeService.registerEndInput(this.dateInput);
52
52
  super.init();
53
53
  }
54
+ ngAfterViewInit() {
55
+ const inputElement = this.dateInput.inputElement;
56
+ this.renderer.removeAttribute(inputElement, attributeNames.ariaExpanded);
57
+ }
54
58
  ngOnDestroy() {
55
59
  super.destroy();
56
60
  }
@@ -2,11 +2,15 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
+ import { Directive } from '@angular/core';
5
6
  import { cloneDate } from '@progress/kendo-date-math';
6
7
  import { Keys } from '@progress/kendo-angular-common';
7
8
  import { Subscription, fromEvent } from 'rxjs';
8
9
  import { filter } from 'rxjs/operators';
9
10
  import { isPresent } from '../common/utils';
11
+ import * as i0 from "@angular/core";
12
+ import * as i1 from "./date-range.service";
13
+ import * as i2 from "../dateinput/dateinput.component";
10
14
  /**
11
15
  * @hidden
12
16
  */
@@ -115,3 +119,9 @@ export class DateRangeInput {
115
119
  }
116
120
  }
117
121
  }
122
+ DateRangeInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeInput, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
123
+ DateRangeInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DateRangeInput, ngImport: i0 });
124
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeInput, decorators: [{
125
+ type: Directive,
126
+ args: [{}]
127
+ }], ctorParameters: function () { return [{ type: undefined }, { type: i1.DateRangeService }, { type: i2.DateInputComponent }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; } });
@@ -241,9 +241,9 @@ export class DateRangePopupComponent {
241
241
  if (!calendar) {
242
242
  return;
243
243
  }
244
- const nativeElement = calendar.element.nativeElement;
245
- this.blurSubscription = fromEvent(nativeElement, 'blur').subscribe(() => this.onBlur.emit());
246
- this.focusSubscription = fromEvent(nativeElement, 'focus').subscribe(() => this.onFocus.emit());
244
+ const calendarElement = calendar.element.nativeElement.querySelector('.k-calendar-view');
245
+ this.blurSubscription = fromEvent(calendarElement, 'blur').subscribe(() => this.onBlur.emit());
246
+ this.focusSubscription = fromEvent(calendarElement, 'focus').subscribe(() => this.onFocus.emit());
247
247
  }
248
248
  addPopupSubscriptions(...subscriptions) {
249
249
  if (!isPresent(this.popupSubscriptions)) {
@@ -297,7 +297,7 @@ DateRangePopupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
297
297
  <ng-template #defaultTemplate>
298
298
  <kendo-multiviewcalendar kendoDateRangeSelection></kendo-multiviewcalendar>
299
299
  </ng-template>
300
- `, isInline: true, components: [{ type: i3.MultiViewCalendarComponent, selector: "kendo-multiviewcalendar", inputs: ["id", "focusedDate", "min", "max", "rangeValidation", "disabledDatesRangeValidation", "selection", "value", "disabled", "tabindex", "tabIndex", "isActive", "disabledDates", "activeView", "bottomView", "topView", "showViewHeader", "animateNavigation", "weekNumber", "activeRangeEnd", "selectionRange", "views", "orientation", "cellTemplate", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate"], outputs: ["activeViewChange", "navigate", "cellEnter", "cellLeave", "valueChange", "blur"], exportAs: ["kendo-multiviewcalendar"] }], directives: [{ type: i4.DateRangeSelectionDirective, selector: "[kendoDateRangeSelection]", inputs: ["autoCorrectOn", "selectionRange", "activeRangeEnd"], outputs: ["activeRangeEndChange", "selectionRangeChange"] }] });
300
+ `, isInline: true, components: [{ type: i3.MultiViewCalendarComponent, selector: "kendo-multiviewcalendar", inputs: ["id", "focusedDate", "min", "max", "rangeValidation", "disabledDatesRangeValidation", "selection", "value", "disabled", "tabindex", "tabIndex", "isActive", "disabledDates", "activeView", "bottomView", "topView", "showViewHeader", "animateNavigation", "weekNumber", "activeRangeEnd", "selectionRange", "views", "orientation", "cellTemplate", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate"], outputs: ["activeViewChange", "navigate", "cellEnter", "cellLeave", "valueChange", "blur", "focusCalendar"], exportAs: ["kendo-multiviewcalendar"] }], directives: [{ type: i4.DateRangeSelectionDirective, selector: "[kendoDateRangeSelection]", inputs: ["autoCorrectOn", "selectionRange", "activeRangeEnd"], outputs: ["activeRangeEndChange", "selectionRangeChange"] }] });
301
301
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangePopupComponent, decorators: [{
302
302
  type: Component,
303
303
  args: [{