@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
@@ -40,7 +40,7 @@ export class DateRangeSelectionDirective {
40
40
  */
41
41
  this.selectionRangeChange = new EventEmitter();
42
42
  this.calendarSubscriptions = new Subscription();
43
- this.dateRangeService = this.dateRangeService || new DateRangeService();
43
+ this.dateRangeService = this.dateRangeService || new DateRangeService(renderer);
44
44
  renderer.setAttribute(element.nativeElement, 'aria-multiselectable', 'true');
45
45
  }
46
46
  /**
@@ -7,6 +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 { attributeNames } from '../common/utils';
10
11
  import * as i0 from "@angular/core";
11
12
  import * as i1 from "./date-range.service";
12
13
  import * as i2 from "../dateinput/dateinput.component";
@@ -20,6 +21,7 @@ export class DateRangeStartInputDirective extends DateRangeInput {
20
21
  super('start', rangeService, dateInput, element, renderer, zone);
21
22
  this.rangeService = rangeService;
22
23
  this.dateInput = dateInput;
24
+ this.renderer = renderer;
23
25
  /**
24
26
  * Specifies the navigation behavior of the calendar when the active end is changed on input focus.
25
27
  * When enabled, the calendar navigates to the value of the focused input. Otherwise, the calendar
@@ -51,6 +53,11 @@ export class DateRangeStartInputDirective extends DateRangeInput {
51
53
  this.rangeService.registerStartInput(this.dateInput);
52
54
  super.init();
53
55
  }
56
+ ngAfterViewInit() {
57
+ const inputElement = this.dateInput.inputElement;
58
+ this.renderer.setAttribute(inputElement, 'role', 'combobox');
59
+ this.renderer.setAttribute(inputElement, attributeNames.ariaHasPopup, 'true');
60
+ }
54
61
  ngOnDestroy() {
55
62
  super.destroy();
56
63
  }
@@ -2,14 +2,16 @@
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 { Component, ContentChildren, HostBinding } from '@angular/core';
5
+ import { Component, ContentChildren, HostBinding, HostListener } from '@angular/core';
6
6
  import { validatePackage } from '@progress/kendo-licensing';
7
7
  import { packageMetadata } from '../package-metadata';
8
8
  import { DateRangePopupComponent } from './date-range-popup.component';
9
9
  import { DateRangeService } from './date-range.service';
10
+ import { Keys } from '@progress/kendo-angular-common';
10
11
  import * as i0 from "@angular/core";
11
- import * as i1 from "./date-range-popup.component";
12
- import * as i2 from "@angular/common";
12
+ import * as i1 from "./date-range.service";
13
+ import * as i2 from "./date-range-popup.component";
14
+ import * as i3 from "@angular/common";
13
15
  /**
14
16
  * Represents the Kendo UI DateRange component for Angular.
15
17
  *
@@ -30,7 +32,8 @@ import * as i2 from "@angular/common";
30
32
  * ```
31
33
  */
32
34
  export class DateRangeComponent {
33
- constructor() {
35
+ constructor(dateRangeService) {
36
+ this.dateRangeService = dateRangeService;
34
37
  this.wrapperClass = true;
35
38
  /**
36
39
  * @hidden
@@ -38,6 +41,19 @@ export class DateRangeComponent {
38
41
  this.showDefault = false;
39
42
  validatePackage(packageMetadata);
40
43
  }
44
+ /**
45
+ * @hidden
46
+ */
47
+ keydown(event) {
48
+ const shouldOpenPopup = event.keyCode === Keys.ArrowDown && event.altKey;
49
+ if (shouldOpenPopup) {
50
+ this.dateRangeService.activatePopup();
51
+ }
52
+ const shouldClosePopup = (event.keyCode === Keys.ArrowUp && event.altKey) || event.keyCode === Keys.Escape;
53
+ if (shouldClosePopup) {
54
+ this.dateRangeService.deactivatePopup();
55
+ }
56
+ }
41
57
  get hasContentPopup() {
42
58
  return this.contentPopup.length > 0;
43
59
  }
@@ -48,16 +64,15 @@ export class DateRangeComponent {
48
64
  });
49
65
  }
50
66
  ngOnDestroy() {
51
- if (this.subscription) {
52
- this.subscription.unsubscribe();
53
- }
67
+ var _a;
68
+ (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
54
69
  }
55
70
  }
56
- DateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
57
- DateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DateRangeComponent, selector: "kendo-daterange", host: { properties: { "class.k-daterangepicker": "this.wrapperClass" } }, providers: [DateRangeService], queries: [{ propertyName: "contentPopup", predicate: DateRangePopupComponent }], ngImport: i0, template: `
71
+ DateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeComponent, deps: [{ token: i1.DateRangeService }], target: i0.ɵɵFactoryTarget.Component });
72
+ DateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DateRangeComponent, selector: "kendo-daterange", host: { listeners: { "keydown": "keydown($event)" }, properties: { "class.k-daterangepicker": "this.wrapperClass" } }, providers: [DateRangeService], queries: [{ propertyName: "contentPopup", predicate: DateRangePopupComponent }], ngImport: i0, template: `
58
73
  <ng-content></ng-content>
59
74
  <kendo-daterange-popup *ngIf="showDefault"></kendo-daterange-popup>
60
- `, isInline: true, components: [{ type: i1.DateRangePopupComponent, selector: "kendo-daterange-popup", inputs: ["animate", "anchor", "anchorAlign", "appendTo", "collision", "popupAlign", "margin"], outputs: ["open", "close", "blur", "focus", "cancel"], exportAs: ["kendo-daterange-popup"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
75
+ `, isInline: true, components: [{ type: i2.DateRangePopupComponent, selector: "kendo-daterange-popup", inputs: ["animate", "anchor", "anchorAlign", "appendTo", "collision", "popupAlign", "margin"], outputs: ["open", "close", "blur", "focus", "cancel"], exportAs: ["kendo-daterange-popup"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
61
76
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeComponent, decorators: [{
62
77
  type: Component,
63
78
  args: [{
@@ -68,7 +83,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
68
83
  <kendo-daterange-popup *ngIf="showDefault"></kendo-daterange-popup>
69
84
  `
70
85
  }]
71
- }], ctorParameters: function () { return []; }, propDecorators: { wrapperClass: [{
86
+ }], ctorParameters: function () { return [{ type: i1.DateRangeService }]; }, propDecorators: { keydown: [{
87
+ type: HostListener,
88
+ args: ['keydown', ['$event']]
89
+ }], wrapperClass: [{
72
90
  type: HostBinding,
73
91
  args: ['class.k-daterangepicker']
74
92
  }], contentPopup: [{
@@ -2,10 +2,12 @@
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 { Injectable } from '@angular/core';
5
+ import { Injectable, Optional } from '@angular/core';
6
6
  import { BehaviorSubject } from 'rxjs';
7
7
  import { EMPTY_SELECTIONRANGE } from '../calendar/models/selection-range.interface';
8
8
  import { isEqual } from '@progress/kendo-date-math';
9
+ import { Subscription } from 'rxjs';
10
+ import { attributeNames } from '../common/utils';
9
11
  import * as i0 from "@angular/core";
10
12
  const isActive = (cmp) => (cmp && cmp.isActive) || false;
11
13
  const hasActiveContent = (popup) => popup && popup.hasActiveContent();
@@ -15,7 +17,10 @@ const hasActiveContent = (popup) => popup && popup.hasActiveContent();
15
17
  */
16
18
  export class DateRangeService {
17
19
  /** @hidden */
18
- constructor() {
20
+ constructor(renderer) {
21
+ this.renderer = renderer;
22
+ /** @hidden */
23
+ this.focusedCellChange = new Subscription();
19
24
  /**
20
25
  * An Observable instance that notifies when the `activeRangeEnd` state is changed.
21
26
  */
@@ -80,10 +85,19 @@ export class DateRangeService {
80
85
  * The method opens the popup and focuses the calendar.
81
86
  */
82
87
  activatePopup() {
88
+ var _a;
83
89
  const dateRangePopup = this.dateRangePopup$.value;
84
90
  if (!dateRangePopup) {
85
91
  return;
86
92
  }
93
+ if (this.startInput$.value) {
94
+ const inputElement = this.startInput$.value.dateInput.nativeElement;
95
+ this.renderer.setAttribute(inputElement, attributeNames.ariaControls, dateRangePopup.popupUID);
96
+ this.renderer.setAttribute(inputElement, attributeNames.ariaExpanded, 'true');
97
+ this.focusedCellChange = (_a = dateRangePopup.viewCalendar.first) === null || _a === void 0 ? void 0 : _a.viewList.focusedCellChange.subscribe((id) => {
98
+ this.renderer.setAttribute(inputElement, attributeNames.ariaActiveDescendant, id);
99
+ });
100
+ }
87
101
  dateRangePopup.activate();
88
102
  }
89
103
  /**
@@ -91,10 +105,18 @@ export class DateRangeService {
91
105
  * The method closes the popup.
92
106
  */
93
107
  deactivatePopup() {
108
+ var _a;
94
109
  const dateRangePopup = this.dateRangePopup$.value;
95
110
  if (!(dateRangePopup && dateRangePopup.show)) {
96
111
  return;
97
112
  }
113
+ if (this.startInput$.value) {
114
+ const inputElement = this.startInput$.value.dateInput.nativeElement;
115
+ this.renderer.removeAttribute(inputElement, attributeNames.ariaControls);
116
+ this.renderer.setAttribute(inputElement, attributeNames.ariaExpanded, 'false');
117
+ (_a = this.focusedCellChange) === null || _a === void 0 ? void 0 : _a.unsubscribe();
118
+ this.renderer.removeAttribute(inputElement, attributeNames.ariaActiveDescendant);
119
+ }
98
120
  dateRangePopup.show = false;
99
121
  }
100
122
  /**
@@ -178,8 +200,10 @@ export class DateRangeService {
178
200
  this.range$.next(range);
179
201
  }
180
202
  }
181
- DateRangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
203
+ DateRangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeService, deps: [{ token: i0.Renderer2, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
182
204
  DateRangeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeService });
183
205
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DateRangeService, decorators: [{
184
206
  type: Injectable
185
- }], ctorParameters: function () { return []; } });
207
+ }], ctorParameters: function () { return [{ type: i0.Renderer2, decorators: [{
208
+ type: Optional
209
+ }] }]; } });
@@ -7,13 +7,13 @@ import { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
7
7
  import { Subscription, fromEvent } from 'rxjs';
8
8
  import { tap } from 'rxjs/operators';
9
9
  import { cloneDate, isEqual, getDate } from '@progress/kendo-date-math';
10
- import { hasObservers, KendoInput, Keys, guid } from '@progress/kendo-angular-common';
10
+ import { hasObservers, KendoInput, Keys } from '@progress/kendo-angular-common';
11
11
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
12
12
  import { validatePackage } from '@progress/kendo-licensing';
13
13
  import { packageMetadata } from '../package-metadata';
14
14
  import { PickerService } from '../common/picker.service';
15
15
  import { DisabledDatesService } from '../calendar/services/disabled-dates.service';
16
- import { isPresent } from '../common/utils';
16
+ import { attributeNames, isPresent } from '../common/utils';
17
17
  import { mergeDateAndTime, noop, lastMillisecondOfDate, isInRange, isValidRange, isWindowAvailable, getFillModeClass, getRoundedClass, getSizeClass, DEFAULT_FILL_MODE, DEFAULT_ROUNDED, DEFAULT_SIZE } from '../util';
18
18
  import { PreventableEvent } from '../preventable-event';
19
19
  import { minValidator } from '../validators/min.validator';
@@ -56,6 +56,7 @@ const TWO_DIGIT_YEAR_MAX = 68;
56
56
  */
57
57
  export class DateTimePickerComponent {
58
58
  constructor(popupService, intl, cdr, pickerService, ngZone, wrapper, touchEnabled, localization, disabledDatesService, renderer) {
59
+ var _a;
59
60
  this.popupService = popupService;
60
61
  this.intl = intl;
61
62
  this.cdr = cdr;
@@ -81,7 +82,7 @@ export class DateTimePickerComponent {
81
82
  /**
82
83
  * @hidden
83
84
  */
84
- this.focusableId = `k-${guid()}`;
85
+ this.focusableId = `k-datetimepicker-${(_a = this.calendar) === null || _a === void 0 ? void 0 : _a.id}-`;
85
86
  /**
86
87
  * Sets the title of the input element of the DateTimePicker.
87
88
  */
@@ -245,6 +246,12 @@ export class DateTimePickerComponent {
245
246
  get input() {
246
247
  return this.pickerService.input;
247
248
  }
249
+ /**
250
+ * @hidden
251
+ */
252
+ get inputElement() {
253
+ return this.wrapper.nativeElement.querySelector('input');
254
+ }
248
255
  /**
249
256
  * @hidden
250
257
  */
@@ -483,12 +490,6 @@ export class DateTimePickerComponent {
483
490
  get disableCalendar() {
484
491
  return this.activeTab !== 'date' && !this.calendar.isActive;
485
492
  }
486
- /**
487
- * @hidden
488
- */
489
- get inputRole() {
490
- return this.readOnlyInput ? 'listbox' : 'spinbutton';
491
- }
492
493
  /**
493
494
  * @hidden
494
495
  *
@@ -514,6 +515,11 @@ export class DateTimePickerComponent {
514
515
  }
515
516
  return appendTo === 'component' ? this.container : appendTo;
516
517
  }
518
+ get popupUID() {
519
+ var _a;
520
+ return (_a = this.calendar) === null || _a === void 0 ? void 0 : _a.id;
521
+ }
522
+ ;
517
523
  ngOnInit() {
518
524
  this.subscriptions.add(this.pickerService.onFocus
519
525
  // detect popup changes to disable the inactive view mark-up when the popup is open
@@ -713,6 +719,9 @@ export class DateTimePickerComponent {
713
719
  if (event.target !== dateTimeSelector) {
714
720
  return;
715
721
  }
722
+ if (this.activeTab === 'time') {
723
+ this.renderer.removeAttribute(this.inputElement, attributeNames.ariaActiveDescendant);
724
+ }
716
725
  this.activeTabComponent.focus();
717
726
  }
718
727
  /**
@@ -922,12 +931,28 @@ export class DateTimePickerComponent {
922
931
  anchorAlign: { vertical: 'bottom', horizontal: direction },
923
932
  popupAlign: { vertical: 'top', horizontal: direction }
924
933
  });
934
+ this.popupRef.popupElement.setAttribute('id', this.popupUID);
935
+ this.renderer.setAttribute(this.inputElement, attributeNames.ariaControls, this.popupUID);
936
+ if (this.activeTab === 'date') {
937
+ if (this.calendar.type === 'infinite') {
938
+ this.subscriptions.add(this.calendar.monthView.focusedCellChange.subscribe((id) => {
939
+ this.renderer.setAttribute(this.inputElement, attributeNames.ariaActiveDescendant, id);
940
+ }));
941
+ }
942
+ else {
943
+ this.subscriptions.add(this.calendar.multiViewCalendar.viewList.focusedCellChange.subscribe((id) => {
944
+ this.renderer.setAttribute(this.inputElement, attributeNames.ariaActiveDescendant, id);
945
+ }));
946
+ }
947
+ }
925
948
  this.popupRef.popupAnchorViewportLeave.subscribe(() => this.handleCancel());
926
949
  }
927
950
  closePopup() {
928
951
  if (!this.isOpen) {
929
952
  return;
930
953
  }
954
+ this.renderer.removeAttribute(this.inputElement, attributeNames.ariaControls);
955
+ this.renderer.removeAttribute(this.inputElement, attributeNames.ariaActiveDescendant);
931
956
  this.popupRef.close();
932
957
  this.popupRef = null;
933
958
  }
@@ -1070,7 +1095,7 @@ DateTimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
1070
1095
  [placeholder]="placeholder"
1071
1096
  [disabled]="disabled"
1072
1097
  [readonly]="readonly || readOnlyInput"
1073
- [role]="inputRole"
1098
+ [role]="'combobox'"
1074
1099
  [ariaReadOnly]="readonly"
1075
1100
  [steps]="steps"
1076
1101
  [tabindex]="tabindex"
@@ -1329,7 +1354,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1329
1354
  [placeholder]="placeholder"
1330
1355
  [disabled]="disabled"
1331
1356
  [readonly]="readonly || readOnlyInput"
1332
- [role]="inputRole"
1357
+ [role]="'combobox'"
1333
1358
  [ariaReadOnly]="readonly"
1334
1359
  [steps]="steps"
1335
1360
  [tabindex]="tabindex"
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-dateinputs',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1663071420,
12
+ publishDate: 1666356015,
13
13
  version: '',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
15
15
  };
@@ -11,7 +11,7 @@ import * as i0 from "@angular/core";
11
11
  export class TimePickerMessages extends ComponentMessages {
12
12
  }
13
13
  TimePickerMessages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TimePickerMessages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
14
- TimePickerMessages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: TimePickerMessages, selector: "kendo-timepicker-messages-base", inputs: { accept: "accept", acceptLabel: "acceptLabel", cancel: "cancel", cancelLabel: "cancelLabel", now: "now", nowLabel: "nowLabel", toggle: "toggle" }, usesInheritance: true, ngImport: i0 });
14
+ TimePickerMessages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: TimePickerMessages, selector: "kendo-timepicker-messages-base", inputs: { accept: "accept", acceptLabel: "acceptLabel", cancel: "cancel", cancelLabel: "cancelLabel", now: "now", nowLabel: "nowLabel", toggle: "toggle", hour: "hour", minute: "minute", second: "second", millisecond: "millisecond", dayperiod: "dayperiod" }, usesInheritance: true, ngImport: i0 });
15
15
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TimePickerMessages, decorators: [{
16
16
  type: Directive,
17
17
  args: [{
@@ -32,4 +32,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
32
32
  type: Input
33
33
  }], toggle: [{
34
34
  type: Input
35
+ }], hour: [{
36
+ type: Input
37
+ }], minute: [{
38
+ type: Input
39
+ }], second: [{
40
+ type: Input
41
+ }], millisecond: [{
42
+ type: Input
43
+ }], dayperiod: [{
44
+ type: Input
35
45
  }] } });
@@ -15,11 +15,13 @@ import { SecondsService } from './services/seconds.service';
15
15
  import { MillisecondsService } from './services/milliseconds.service';
16
16
  import { DayPeriodService } from './services/dayperiod.service';
17
17
  import { closestInScope } from '../common/dom-queries';
18
+ import { attributeNames } from '../common/utils';
18
19
  import * as i0 from "@angular/core";
19
20
  import * as i1 from "./services/dom.service";
20
- import * as i2 from "../virtualization/virtualization.component";
21
- import * as i3 from "@angular/common";
22
- import * as i4 from "@progress/kendo-angular-common";
21
+ import * as i2 from "@progress/kendo-angular-l10n";
22
+ import * as i3 from "../virtualization/virtualization.component";
23
+ import * as i4 from "@angular/common";
24
+ import * as i5 from "@progress/kendo-angular-common";
23
25
  const SNAP_THRESHOLD = 0.05; //% of the item height
24
26
  const SCROLL_THRESHOLD = 2; //< 2px threshold
25
27
  const nil = () => (null);
@@ -40,12 +42,13 @@ const services = {
40
42
  * @hidden
41
43
  */
42
44
  export class TimeListComponent {
43
- constructor(element, injector, dom, renderer, zone) {
45
+ constructor(element, injector, dom, renderer, zone, localization) {
44
46
  this.element = element;
45
47
  this.injector = injector;
46
48
  this.dom = dom;
47
49
  this.renderer = renderer;
48
50
  this.zone = zone;
51
+ this.localization = localization;
49
52
  this.min = cloneDate(MIDNIGHT_DATE);
50
53
  this.max = cloneDate(MAX_TIME);
51
54
  this.step = 1;
@@ -59,11 +62,32 @@ export class TimeListComponent {
59
62
  this.data = [];
60
63
  this.indexToScroll = -1;
61
64
  this.domEvents = [];
65
+ this.hostElement = this.element.nativeElement;
66
+ }
67
+ get roleAttribute() {
68
+ return this.isDayPeriod ? 'listbox' : 'spinbutton';
69
+ }
70
+ get ariaLabel() {
71
+ var _a;
72
+ return this.localization.get((_a = this.part) === null || _a === void 0 ? void 0 : _a.type);
73
+ }
74
+ get valueMin() {
75
+ var _a;
76
+ return (_a = this.data[0]) === null || _a === void 0 ? void 0 : _a.text;
77
+ }
78
+ get valueMax() {
79
+ var _a;
80
+ return (_a = this.data[this.data.length - 1]) === null || _a === void 0 ? void 0 : _a.text;
62
81
  }
63
82
  get tabIndex() {
64
83
  return this.disabled ? undefined : 0;
65
84
  }
85
+ get isDayPeriod() {
86
+ var _a;
87
+ return ((_a = this.part) === null || _a === void 0 ? void 0 : _a.type) === 'dayperiod';
88
+ }
66
89
  ngOnChanges(changes) {
90
+ var _a, _b;
67
91
  if (changes.part) {
68
92
  this.service = this.injector.get(services[this.part.type]);
69
93
  this.service.configure(this.serviceSettings());
@@ -83,6 +107,8 @@ export class TimeListComponent {
83
107
  this.animateToIndex = this.animateToIndex && this.textHasChanged(valueChanges);
84
108
  this.total = this.service.total(value);
85
109
  this.indexToScroll = this.selectedIndex(value);
110
+ this.renderer.setAttribute(this.hostElement, attributeNames.valueNow, (_a = this.getCurrentItem()) === null || _a === void 0 ? void 0 : _a.value.toString());
111
+ this.renderer.setAttribute(this.hostElement, attributeNames.valuetext, (_b = this.getCurrentItem()) === null || _b === void 0 ? void 0 : _b.text);
86
112
  }
87
113
  ngOnInit() {
88
114
  this.animateToIndex = true;
@@ -115,6 +141,9 @@ export class TimeListComponent {
115
141
  this.animateToIndex = true;
116
142
  });
117
143
  }
144
+ getCurrentItem() {
145
+ return this.indexToScroll >= 0 ? this.data[this.indexToScroll] : null;
146
+ }
118
147
  handleChange(dataItem) {
119
148
  const candidate = this.service.apply(this.value, dataItem.value);
120
149
  if (this.value.getTime() === candidate.getTime()) {
@@ -231,8 +260,8 @@ export class TimeListComponent {
231
260
  this.domEvents.push(this.renderer.listen(element, 'mouseover', () => !this.isActive && this.focus()), this.renderer.listen(element, 'click', () => this.focus()), this.renderer.listen(element, 'blur', () => this.isActive = false), this.renderer.listen(element, 'focus', () => this.isActive = true), this.renderer.listen(element, 'keydown', this.handleKeyDown.bind(this)));
232
261
  }
233
262
  }
234
- TimeListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TimeListComponent, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1.TimePickerDOMService }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
235
- TimeListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TimeListComponent, selector: "kendo-timelist", inputs: { min: "min", max: "max", part: "part", step: "step", disabled: "disabled", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "attr.tabindex": "this.tabIndex", "class.k-time-list": "this.componentClass" } }, viewQueries: [{ propertyName: "virtualization", first: true, predicate: VirtualizationComponent, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
263
+ TimeListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TimeListComponent, deps: [{ token: i0.ElementRef }, { token: i0.Injector }, { token: i1.TimePickerDOMService }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
264
+ TimeListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TimeListComponent, selector: "kendo-timelist", inputs: { min: "min", max: "max", part: "part", step: "step", disabled: "disabled", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "attr.role": "this.roleAttribute", "attr.aria-label": "this.ariaLabel", "attr.valuemin": "this.valueMin", "attr.valuemax": "this.valueMax", "attr.tabindex": "this.tabIndex", "class.k-time-list": "this.componentClass" } }, viewQueries: [{ propertyName: "virtualization", first: true, predicate: VirtualizationComponent, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
236
265
  <kendo-virtualization
237
266
  [skip]="skip"
238
267
  [take]="total"
@@ -250,14 +279,17 @@ TimeListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
250
279
  click: handleItemClick
251
280
  }"
252
281
  [scope]="this"
282
+ [attr.role]="isDayPeriod ? 'presentation' : null"
253
283
  >
254
284
  <li *ngFor="let item of data; let index = index;" class="k-item"
255
- [attr.data-timelist-item-index]="index">
285
+ [attr.data-timelist-item-index]="index"
286
+ [attr.role]="isDayPeriod ? 'option' : null"
287
+ >
256
288
  <span>{{item.text}}</span>
257
289
  </li>
258
290
  </ul>
259
291
  </kendo-virtualization>
260
- `, isInline: true, components: [{ type: i2.VirtualizationComponent, selector: "kendo-virtualization", inputs: ["direction", "itemHeight", "itemWidth", "topOffset", "bottomOffset", "maxScrollDifference", "scrollOffsetSize", "scrollDuration", "skip", "take", "total"], outputs: ["activeIndexChange", "pageChange", "scrollChange"] }], directives: [{ type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
292
+ `, isInline: true, components: [{ type: i3.VirtualizationComponent, selector: "kendo-virtualization", inputs: ["direction", "itemHeight", "itemWidth", "topOffset", "bottomOffset", "maxScrollDifference", "scrollOffsetSize", "scrollDuration", "skip", "take", "total"], outputs: ["activeIndexChange", "pageChange", "scrollChange"] }], directives: [{ type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
261
293
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TimeListComponent, decorators: [{
262
294
  type: Component,
263
295
  args: [{
@@ -280,16 +312,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
280
312
  click: handleItemClick
281
313
  }"
282
314
  [scope]="this"
315
+ [attr.role]="isDayPeriod ? 'presentation' : null"
283
316
  >
284
317
  <li *ngFor="let item of data; let index = index;" class="k-item"
285
- [attr.data-timelist-item-index]="index">
318
+ [attr.data-timelist-item-index]="index"
319
+ [attr.role]="isDayPeriod ? 'option' : null"
320
+ >
286
321
  <span>{{item.text}}</span>
287
322
  </li>
288
323
  </ul>
289
324
  </kendo-virtualization>
290
325
  `
291
326
  }]
292
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1.TimePickerDOMService }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, propDecorators: { min: [{
327
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Injector }, { type: i1.TimePickerDOMService }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i2.LocalizationService }]; }, propDecorators: { min: [{
293
328
  type: Input
294
329
  }], max: [{
295
330
  type: Input
@@ -306,6 +341,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
306
341
  }], virtualization: [{
307
342
  type: ViewChild,
308
343
  args: [VirtualizationComponent, { static: true }]
344
+ }], roleAttribute: [{
345
+ type: HostBinding,
346
+ args: ["attr.role"]
347
+ }], ariaLabel: [{
348
+ type: HostBinding,
349
+ args: ["attr.aria-label"]
350
+ }], valueMin: [{
351
+ type: HostBinding,
352
+ args: ['attr.valuemin']
353
+ }], valueMax: [{
354
+ type: HostBinding,
355
+ args: ["attr.valuemax"]
309
356
  }], tabIndex: [{
310
357
  type: HostBinding,
311
358
  args: ["attr.tabindex"]