@progress/kendo-angular-dateinputs 7.1.3-dev.202210121001 → 7.1.3-dev.202210260703

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 (56) 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 +22 -8
  15. package/datepicker/datepicker.component.d.ts +2 -10
  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 +6 -9
  22. package/esm2015/calendar/calendar.component.js +88 -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 +91 -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 +68 -34
  36. package/esm2015/datepicker/datepicker.component.js +27 -20
  37. package/esm2015/daterange/date-range-end-input.directive.js +6 -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 +9 -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 +38 -20
  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 +75 -32
  49. package/esm2015/util.js +2 -2
  50. package/esm2015/virtualization/virtualization.component.js +7 -5
  51. package/fesm2015/kendo-angular-dateinputs.js +811 -320
  52. package/package.json +1 -1
  53. package/timepicker/localization/messages.d.ts +21 -1
  54. package/timepicker/timelist.component.d.ts +10 -1
  55. package/timepicker/timepicker.component.d.ts +7 -13
  56. package/virtualization/virtualization.component.d.ts +3 -1
@@ -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: 'aria-valuenow',
67
+ valuetext: 'aria-valuetext',
68
+ ariaInvalid: 'aria-invalid'
69
+ };
@@ -11,11 +11,12 @@ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
11
11
  import { validatePackage } from '@progress/kendo-licensing';
12
12
  import { packageMetadata } from '../package-metadata';
13
13
  import { addMonths, cloneDate, createDate, getDate, isEqual, lastDayOfMonth } from '@progress/kendo-date-math';
14
- import { isDocumentAvailable, hasObservers, KendoInput, Keys, guid } from '@progress/kendo-angular-common';
14
+ import { isDocumentAvailable, hasObservers, KendoInput, Keys } from '@progress/kendo-angular-common';
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";
@@ -23,6 +24,7 @@ import * as i3 from "../common/picker.service";
23
24
  import * as i4 from "./localization/dateinput-localized-messages.directive";
24
25
  import * as i5 from "@progress/kendo-angular-common";
25
26
  import * as i6 from "@angular/common";
27
+ let nextId = 0;
26
28
  const MIN_DOC_LINK = 'http://www.telerik.com/kendo-angular-ui/components/dateinputs/api/DateInputComponent/#toc-min';
27
29
  const MAX_DOC_LINK = 'http://www.telerik.com/kendo-angular-ui/components/dateinputs/api/DateInputComponent/#toc-max';
28
30
  const VALUE_DOC_LINK = 'http://www.telerik.com/kendo-angular-ui/components/dateinputs/dateinput/#toc-using-with-json';
@@ -73,6 +75,7 @@ class KendoDate {
73
75
  validatePackage(packageMetadata);
74
76
  this.monthNames = this.allFormatedMonths();
75
77
  this.dayPeriods = this.allDayPeriods();
78
+ nextId++;
76
79
  if (!value) {
77
80
  this.value = getDate(new Date());
78
81
  const sampleFormat = this.dateFormatString(this.value, this.format).symbols;
@@ -459,10 +462,6 @@ export class DateInputComponent {
459
462
  this.injector = injector;
460
463
  this.localization = localization;
461
464
  this.pickerService = pickerService;
462
- /**
463
- * @hidden
464
- */
465
- this.focusableId = `k-${guid()}`;
466
465
  /**
467
466
  * Sets or gets the `disabled` property of the DateInput and
468
467
  * determines whether the component is active
@@ -486,7 +485,7 @@ export class DateInputComponent {
486
485
  /**
487
486
  * @hidden
488
487
  */
489
- this.role = 'spinbutton';
488
+ this.role = 'textbox';
490
489
  /**
491
490
  * @hidden
492
491
  */
@@ -563,10 +562,6 @@ export class DateInputComponent {
563
562
  * [spinner buttons]({% slug spinbuttons_dateinput %}).
564
563
  */
565
564
  this.spinners = false;
566
- /**
567
- * @hidden
568
- */
569
- this.isPopupOpen = false;
570
565
  /**
571
566
  * @hidden
572
567
  */
@@ -659,11 +654,26 @@ export class DateInputComponent {
659
654
  this._size = DEFAULT_SIZE;
660
655
  this._rounded = DEFAULT_ROUNDED;
661
656
  this._fillMode = DEFAULT_FILL_MODE;
657
+ this.subs = new Subscription();
662
658
  this.symbolsMap = this.dateSymbolMap();
663
659
  this.updateFormatSections();
664
660
  if (this.pickerService) {
665
661
  this.pickerService.input = this;
666
662
  }
663
+ else {
664
+ this.ariaReadOnly = null;
665
+ }
666
+ }
667
+ /**
668
+ * @hidden
669
+ */
670
+ get focusableId() {
671
+ if (this.pickerType) {
672
+ return `${this.pickerType}-${nextId}`;
673
+ }
674
+ else {
675
+ return `dateinput-${nextId}`;
676
+ }
667
677
  }
668
678
  /**
669
679
  * @hidden
@@ -788,6 +798,13 @@ export class DateInputComponent {
788
798
  }
789
799
  }
790
800
  }
801
+ /**
802
+ * @hidden
803
+ */
804
+ get formControl() {
805
+ const ngControl = this.injector.get(NgControl, null);
806
+ return (ngControl === null || ngControl === void 0 ? void 0 : ngControl.control) || null;
807
+ }
791
808
  get inputFormat() {
792
809
  if (!this.format) {
793
810
  return DEFAULT_FORMAT;
@@ -823,6 +840,21 @@ export class DateInputComponent {
823
840
  containsElement(element) {
824
841
  return Boolean(closest(element, node => node === this.wrapper.nativeElement));
825
842
  }
843
+ /**
844
+ * @hidden
845
+ */
846
+ ngOnInit() {
847
+ this.kendoDate = this.getKendoDate(this.value);
848
+ this.updateElementValue();
849
+ this.subs.add(this.intl.changes.subscribe(this.intlChange.bind(this)));
850
+ this.ngControl = this.injector.get(NgControl, null);
851
+ if (this.wrapper) {
852
+ this.renderer.removeAttribute(this.wrapper.nativeElement, 'tabindex');
853
+ this.ngZone.runOutsideAngular(() => {
854
+ this.bindEvents();
855
+ });
856
+ }
857
+ }
826
858
  /**
827
859
  * @hidden
828
860
  */
@@ -844,10 +876,16 @@ export class DateInputComponent {
844
876
  this.updateElementValue(this.isActive);
845
877
  }
846
878
  }
879
+ ngAfterViewInit() {
880
+ var _a, _b;
881
+ this.setComponentClasses();
882
+ const formControl = (_a = this.injector.get(NgControl, null)) === null || _a === void 0 ? void 0 : _a.control;
883
+ this.control = formControl;
884
+ this.subs.add((_b = this.formControl) === null || _b === void 0 ? void 0 : _b.statusChanges.subscribe(() => this.setAriaInvalid()));
885
+ this.setAriaInvalid();
886
+ }
847
887
  ngOnDestroy() {
848
- if (this.intlSubscription) {
849
- this.intlSubscription.unsubscribe();
850
- }
888
+ this.subs.unsubscribe();
851
889
  if (this.pickerService) {
852
890
  this.pickerService.input = null;
853
891
  }
@@ -856,32 +894,28 @@ export class DateInputComponent {
856
894
  /**
857
895
  * @hidden
858
896
  */
859
- validate(control) {
860
- return this.minValidator(control) || this.maxValidator(control) || this.incompleteValidator(control, this.isDateIncomplete);
897
+ setAriaInvalid() {
898
+ if (!this.control) {
899
+ return;
900
+ }
901
+ if (this.control.invalid) {
902
+ this.renderer.setAttribute(this.inputElement, attributeNames.ariaInvalid, 'true');
903
+ }
904
+ else {
905
+ this.renderer.setAttribute(this.inputElement, attributeNames.ariaInvalid, 'false');
906
+ }
861
907
  }
862
908
  /**
863
909
  * @hidden
864
910
  */
865
- registerOnValidatorChange(fn) {
866
- this.onValidatorChange = fn;
911
+ validate(control) {
912
+ return this.minValidator(control) || this.maxValidator(control) || this.incompleteValidator(control, this.isDateIncomplete);
867
913
  }
868
914
  /**
869
915
  * @hidden
870
916
  */
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();
917
+ registerOnValidatorChange(fn) {
918
+ this.onValidatorChange = fn;
885
919
  }
886
920
  /**
887
921
  * @hidden
@@ -1386,7 +1420,7 @@ export class DateInputComponent {
1386
1420
  }
1387
1421
  }
1388
1422
  DateInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateInputComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.IntlService }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i2.LocalizationService }, { token: i3.PickerService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1389
- DateInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DateInputComponent, selector: "kendo-dateinput", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", title: "title", tabindex: "tabindex", role: "role", ariaReadOnly: "ariaReadOnly", tabIndex: "tabIndex", format: "format", formatPlaceholder: "formatPlaceholder", placeholder: "placeholder", steps: "steps", max: "max", min: "min", rangeValidation: "rangeValidation", autoCorrect: "autoCorrect", incompleteDateValidation: "incompleteDateValidation", twoDigitYearMax: "twoDigitYearMax", value: "value", spinners: "spinners", isPopupOpen: "isPopupOpen", hasPopup: "hasPopup", size: "size", rounded: "rounded", fillMode: "fillMode" }, outputs: { valueChange: "valueChange", valueUpdate: "valueUpdate", onFocus: "focus", onBlur: "blur" }, host: { properties: { "class.k-input": "this.wrapperClass", "class.k-dateinput": "this.wrapperClass", "class.k-disabled": "this.disabledClass" } }, providers: [
1423
+ DateInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DateInputComponent, selector: "kendo-dateinput", inputs: { pickerType: "pickerType", disabled: "disabled", readonly: "readonly", title: "title", tabindex: "tabindex", role: "role", ariaReadOnly: "ariaReadOnly", tabIndex: "tabIndex", format: "format", formatPlaceholder: "formatPlaceholder", placeholder: "placeholder", steps: "steps", max: "max", min: "min", rangeValidation: "rangeValidation", autoCorrect: "autoCorrect", incompleteDateValidation: "incompleteDateValidation", twoDigitYearMax: "twoDigitYearMax", value: "value", spinners: "spinners", isPopupOpen: "isPopupOpen", hasPopup: "hasPopup", size: "size", rounded: "rounded", fillMode: "fillMode" }, outputs: { valueChange: "valueChange", valueUpdate: "valueUpdate", onFocus: "focus", onBlur: "blur" }, host: { properties: { "class.k-input": "this.wrapperClass", "class.k-dateinput": "this.wrapperClass", "class.k-disabled": "this.disabledClass" } }, providers: [
1390
1424
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DateInputComponent), multi: true },
1391
1425
  { provide: NG_VALIDATORS, useExisting: forwardRef(() => DateInputComponent), multi: true },
1392
1426
  { provide: L10N_PREFIX, useValue: 'kendo.dateinput' },
@@ -1536,7 +1570,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1536
1570
  }]
1537
1571
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.IntlService }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i2.LocalizationService }, { type: i3.PickerService, decorators: [{
1538
1572
  type: Optional
1539
- }] }]; }, propDecorators: { focusableId: [{
1573
+ }] }]; }, propDecorators: { pickerType: [{
1540
1574
  type: Input
1541
1575
  }], disabled: [{
1542
1576
  type: Input