@progress/kendo-angular-toolbar 6.1.0 → 6.1.1-dev.202210270918

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.
@@ -3,6 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Component, HostBinding, ViewChild, ContentChildren, Input, ViewChildren, HostListener, Output, EventEmitter, ViewContainerRef } from '@angular/core';
6
+ import { guid } from '@progress/kendo-angular-common';
6
7
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
7
8
  import { validatePackage } from '@progress/kendo-licensing';
8
9
  import { packageMetadata } from './package-metadata';
@@ -64,6 +65,15 @@ export class ToolBarComponent {
64
65
  this.cancelRenderedToolsSubscription$ = new Subject();
65
66
  this.subscriptions = new Subscription();
66
67
  this.popupSubs = new Subscription();
68
+ this.role = 'toolbar';
69
+ /**
70
+ * @hidden
71
+ */
72
+ this.overflowBtnId = guid();
73
+ /**
74
+ * @hidden
75
+ */
76
+ this.popupId = guid();
67
77
  validatePackage(packageMetadata);
68
78
  this.direction = localization.rtl ? 'rtl' : 'ltr';
69
79
  }
@@ -144,9 +154,6 @@ export class ToolBarComponent {
144
154
  }
145
155
  this.element.nativeElement.setAttribute('tabindex', this.tabindex.toString());
146
156
  }
147
- get getRole() {
148
- return 'toolbar';
149
- }
150
157
  get getDir() {
151
158
  return this.direction;
152
159
  }
@@ -193,6 +200,12 @@ export class ToolBarComponent {
193
200
  case Keys.Escape:
194
201
  this.zone.run(() => this.toggle(false));
195
202
  break;
203
+ case Keys.Home:
204
+ this.zone.run(() => this.navigationService.focusFirst(ev));
205
+ break;
206
+ case Keys.End:
207
+ this.zone.run(() => this.navigationService.focusLast(ev));
208
+ break;
196
209
  default:
197
210
  break;
198
211
  }
@@ -336,6 +349,7 @@ export class ToolBarComponent {
336
349
  this.overflowRenderedTools.changes
337
350
  .pipe(takeUntil(this.cancelRenderedToolsSubscription$))
338
351
  .subscribe((rts) => this.navigationService.setRenderedTools(rts.toArray()));
352
+ this.renderer.setAttribute(this.overflowButton.nativeElement, 'aria-controls', this.popupId);
339
353
  }
340
354
  /**
341
355
  * @hidden
@@ -350,6 +364,7 @@ export class ToolBarComponent {
350
364
  if (this.overflowKeydownListener) {
351
365
  this.overflowKeydownListener();
352
366
  }
367
+ this.renderer.removeAttribute(this.overflowButton.nativeElement, 'aria-controls');
353
368
  }
354
369
  displayAnchor() {
355
370
  const visibility = this.allTools.filter(t => t.overflows && t.responsive).length > 0 ? 'visible' : 'hidden';
@@ -467,7 +482,7 @@ export class ToolBarComponent {
467
482
  }
468
483
  }
469
484
  ToolBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ToolBarComponent, deps: [{ token: i1.LocalizationService }, { token: i2.PopupService }, { token: i3.RefreshService }, { token: i4.NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
470
- ToolBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ToolBarComponent, selector: "kendo-toolbar", inputs: { overflow: "overflow", resizable: "resizable", popupSettings: "popupSettings", tabindex: "tabindex", tabIndex: "tabIndex" }, outputs: { open: "open", close: "close" }, host: { listeners: { "focus": "onFocus($event)", "focusout": "onFocusOut($event)" }, properties: { "class.k-widget": "this.hostClasses", "class.k-toolbar": "this.hostClasses", "attr.role": "this.getRole", "attr.dir": "this.getDir", "class.k-toolbar-resizable": "this.resizableClass" } }, providers: [
485
+ ToolBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ToolBarComponent, selector: "kendo-toolbar", inputs: { overflow: "overflow", resizable: "resizable", popupSettings: "popupSettings", tabindex: "tabindex", tabIndex: "tabIndex" }, outputs: { open: "open", close: "close" }, host: { listeners: { "focus": "onFocus($event)", "focusout": "onFocusOut($event)" }, properties: { "class.k-widget": "this.hostClasses", "class.k-toolbar": "this.hostClasses", "attr.role": "this.role", "attr.dir": "this.getDir", "class.k-toolbar-resizable": "this.resizableClass" } }, providers: [
471
486
  RefreshService,
472
487
  NavigationService,
473
488
  LocalizationService,
@@ -496,19 +511,26 @@ ToolBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
496
511
  tabindex="-1"
497
512
  [title]="moreToolsTitle"
498
513
  [attr.aria-label]="moreToolsTitle"
514
+ [attr.aria-expanded]="popupOpen"
515
+ [id]="overflowBtnId"
516
+ aria-haspopup="menu"
499
517
  *ngIf="overflow"
500
518
  [style.visibility]="'hidden'"
501
519
  [style.position]="'relative'"
502
520
  [style.margin-inline-start]="'auto'"
503
- class="k-overflow-anchor k-button"
521
+ class="k-overflow-anchor k-button k-button-flat"
504
522
  (click)="showPopup()"
505
523
  >
506
524
  <span class="k-icon k-i-more-vertical"></span>
507
525
  </button>
508
526
  <ng-template #popupTemplate>
509
- <ul class="k-overflow-container k-list-container k-reset">
527
+ <ul
528
+ class="k-overflow-container k-list-container k-reset"
529
+ role="menu"
530
+ [id]="popupId"
531
+ [attr.aria-labelledby]="overflowBtnId">
510
532
  <ng-container *ngFor="let tool of allTools; let index = index">
511
- <li class="k-item">
533
+ <li class="k-item" role="menuitem">
512
534
  <kendo-toolbar-renderer
513
535
  #overflowRenderer
514
536
  (rendererClick)="onRendererClick($event)"
@@ -558,19 +580,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
558
580
  tabindex="-1"
559
581
  [title]="moreToolsTitle"
560
582
  [attr.aria-label]="moreToolsTitle"
583
+ [attr.aria-expanded]="popupOpen"
584
+ [id]="overflowBtnId"
585
+ aria-haspopup="menu"
561
586
  *ngIf="overflow"
562
587
  [style.visibility]="'hidden'"
563
588
  [style.position]="'relative'"
564
589
  [style.margin-inline-start]="'auto'"
565
- class="k-overflow-anchor k-button"
590
+ class="k-overflow-anchor k-button k-button-flat"
566
591
  (click)="showPopup()"
567
592
  >
568
593
  <span class="k-icon k-i-more-vertical"></span>
569
594
  </button>
570
595
  <ng-template #popupTemplate>
571
- <ul class="k-overflow-container k-list-container k-reset">
596
+ <ul
597
+ class="k-overflow-container k-list-container k-reset"
598
+ role="menu"
599
+ [id]="popupId"
600
+ [attr.aria-labelledby]="overflowBtnId">
572
601
  <ng-container *ngFor="let tool of allTools; let index = index">
573
- <li class="k-item">
602
+ <li class="k-item" role="menuitem">
574
603
  <kendo-toolbar-renderer
575
604
  #overflowRenderer
576
605
  (rendererClick)="onRendererClick($event)"
@@ -634,7 +663,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
634
663
  }], onFocusOut: [{
635
664
  type: HostListener,
636
665
  args: ['focusout', ['$event']]
637
- }], getRole: [{
666
+ }], role: [{
638
667
  type: HostBinding,
639
668
  args: ['attr.role']
640
669
  }], getDir: [{
@@ -97,9 +97,10 @@ export class ToolBarButtonGroupComponent extends ToolBarToolComponent {
97
97
  return this.overflows ? this.overflowButtonGroup : this.toolbarButtonGroup;
98
98
  }
99
99
  focusButton(index, ev) {
100
+ var _a;
100
101
  // Guard against focusing twice on mousedown.
101
102
  if (!ev.type || ev.type === 'focus' || ev.type === 'keydown') {
102
- this.buttonElements[index].focus();
103
+ (_a = this.buttonElements[index]) === null || _a === void 0 ? void 0 : _a.focus();
103
104
  }
104
105
  }
105
106
  }
@@ -168,7 +169,7 @@ ToolBarButtonGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.
168
169
  </span>
169
170
  </kendo-buttongroup>
170
171
  </ng-template>
171
- `, isInline: true, components: [{ type: i2.ButtonGroupComponent, selector: "kendo-buttongroup", inputs: ["disabled", "selection", "width", "tabIndex"], outputs: ["navigate"], exportAs: ["kendoButtonGroup"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
172
+ `, isInline: true, components: [{ type: i2.ButtonGroupComponent, selector: "kendo-buttongroup", inputs: ["disabled", "selection", "width", "tabIndex", "navigable"], outputs: ["navigate"], exportAs: ["kendoButtonGroup"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
172
173
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ToolBarButtonGroupComponent, decorators: [{
173
174
  type: Component,
174
175
  args: [{
@@ -16,11 +16,6 @@ import * as i3 from "@angular/common";
16
16
  export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
17
17
  constructor() {
18
18
  super();
19
- // showText and showIcon showIcon should be declared first
20
- /**
21
- * Defines the location of the button text that will be displayed.
22
- */
23
- this.showText = 'both';
24
19
  /**
25
20
  * Defines the location of the button icon that will be displayed.
26
21
  */
@@ -85,16 +80,21 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
85
80
  };
86
81
  this._popupSettings = { animate: true, popupClass: '' };
87
82
  this.focusedIndex = -1;
83
+ this._showText = 'both';
88
84
  this.getNextKey = getNextKey();
89
85
  this.getPrevKey = getPrevKey();
90
86
  }
87
+ // showText and showIcon showIcon should be declared first
91
88
  /**
92
- * Sets the text of the DropDownButton
93
- * ([see example]({% slug controltypes_toolbar %}#toc-dropdownbuttons).
89
+ * Defines the location of the button text that will be displayed.
94
90
  */
95
- set text(text) {
96
- this.toolbarOptions.text = getValueForLocation(text, this.showText, false);
97
- this.overflowOptions.text = getValueForLocation(text, this.showText, true);
91
+ set showText(value) {
92
+ this._showText = value;
93
+ this.setTextDisplayMode();
94
+ }
95
+ ;
96
+ get showText() {
97
+ return this._showText;
98
98
  }
99
99
  /**
100
100
  * Defines an icon that will be rendered next to the button text.
@@ -159,6 +159,9 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
159
159
  }
160
160
  return this._data;
161
161
  }
162
+ ngOnInit() {
163
+ this.setTextDisplayMode();
164
+ }
162
165
  get overflowButtons() {
163
166
  return [...this.overflowDropDownButtonButtonList.buttons.toArray().filter(b => !b.nativeElement.disabled)];
164
167
  }
@@ -210,6 +213,10 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
210
213
  this.overflowButtons[index].nativeElement.focus();
211
214
  }
212
215
  }
216
+ setTextDisplayMode() {
217
+ this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
218
+ this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
219
+ }
213
220
  }
214
221
  ToolBarDropDownButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ToolBarDropDownButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
215
222
  ToolBarDropDownButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ToolBarDropDownButtonComponent, selector: "kendo-toolbar-dropdownbutton", inputs: { showText: "showText", showIcon: "showIcon", text: "text", icon: "icon", iconClass: "iconClass", imageUrl: "imageUrl", popupSettings: "popupSettings", look: "look", primary: "primary", fillMode: "fillMode", themeColor: "themeColor", buttonClass: "buttonClass", textField: "textField", disabled: "disabled", data: "data" }, outputs: { itemClick: "itemClick", open: "open", close: "close" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarDropDownButtonComponent) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "dropdownButton", first: true, predicate: ["dropdownButton"], descendants: true, read: ElementRef, static: true }, { propertyName: "dropDownButtonComponent", first: true, predicate: DropDownButtonComponent, descendants: true }, { propertyName: "toolbarDropDownButton", first: true, predicate: ["toolbarDropDownButton"], descendants: true }, { propertyName: "overflowDropDownButtonButtonList", first: true, predicate: ["overflowDropDownButtonButtonList"], descendants: true }], exportAs: ["kendoToolBarDropDownButton"], usesInheritance: true, ngImport: i0, template: `
@@ -259,7 +266,7 @@ ToolBarDropDownButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
259
266
  >
260
267
  </kendo-toolbar-buttonlist>
261
268
  </ng-template>
262
- `, isInline: true, components: [{ type: i1.DropDownButtonComponent, selector: "kendo-dropdownbutton", inputs: ["icon", "iconClass", "imageUrl", "popupSettings", "textField", "disabled", "data", "size", "rounded", "fillMode", "themeColor", "buttonClass", "tabIndex"], outputs: ["itemClick", "open", "close", "focus", "blur"], exportAs: ["kendoDropDownButton"] }, { type: i2.ToolBarButtonListComponent, selector: "kendo-toolbar-buttonlist", inputs: ["data", "textField", "disabled", "fillMode", "themeColor"], outputs: ["itemClick"] }], directives: [{ type: i1.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
269
+ `, isInline: true, components: [{ type: i1.DropDownButtonComponent, selector: "kendo-dropdownbutton", inputs: ["icon", "iconClass", "imageUrl", "textField", "data", "size", "rounded", "fillMode", "themeColor"], outputs: ["itemClick", "focus", "blur"], exportAs: ["kendoDropDownButton"] }, { type: i2.ToolBarButtonListComponent, selector: "kendo-toolbar-buttonlist", inputs: ["data", "textField", "disabled", "fillMode", "themeColor"], outputs: ["itemClick"] }], directives: [{ type: i1.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
263
270
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ToolBarDropDownButtonComponent, decorators: [{
264
271
  type: Component,
265
272
  args: [{
@@ -15,11 +15,6 @@ import * as i3 from "@angular/common";
15
15
  export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
16
16
  constructor() {
17
17
  super();
18
- // showText and showIcon showIcon should be declared first
19
- /**
20
- * Specifies where button text should be displayed
21
- */
22
- this.showText = 'both';
23
18
  /**
24
19
  * Specifies where button icon should be displayed
25
20
  */
@@ -96,15 +91,21 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
96
91
  };
97
92
  this._popupSettings = { animate: true, popupClass: '' };
98
93
  this.focusedIndex = -1;
94
+ this._showText = 'both';
99
95
  this.getNextKey = getNextKey();
100
96
  this.getPrevKey = getPrevKey();
101
97
  }
98
+ // showText and showIcon showIcon should be declared first
102
99
  /**
103
- * Sets the text of the SplitButton ([see example]({% slug controltypes_toolbar %}#toc-splitbuttons).
100
+ * Specifies where button text should be displayed
104
101
  */
105
- set text(text) {
106
- this.toolbarOptions.text = getValueForLocation(text, this.showText, false);
107
- this.overflowOptions.text = getValueForLocation(text, this.showText, true);
102
+ set showText(value) {
103
+ this._showText = value;
104
+ this.setTextDisplayMode();
105
+ }
106
+ ;
107
+ get showText() {
108
+ return this._showText;
108
109
  }
109
110
  /**
110
111
  * Defines the icon that will be rendered next to the button text
@@ -166,6 +167,9 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
166
167
  }
167
168
  return this._data;
168
169
  }
170
+ ngOnInit() {
171
+ this.setTextDisplayMode();
172
+ }
169
173
  get overflowButtons() {
170
174
  return [this.overflowSplitButton, ...this.overflowSplitButtonButtonList.buttons.toArray().filter(b => !b.nativeElement.disabled)];
171
175
  }
@@ -222,6 +226,10 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
222
226
  this.overflowButtons[index].nativeElement.focus();
223
227
  }
224
228
  }
229
+ setTextDisplayMode() {
230
+ this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
231
+ this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
232
+ }
225
233
  }
226
234
  ToolBarSplitButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ToolBarSplitButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
227
235
  ToolBarSplitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ToolBarSplitButtonComponent, selector: "kendo-toolbar-splitbutton", inputs: { showText: "showText", showIcon: "showIcon", text: "text", icon: "icon", iconClass: "iconClass", imageUrl: "imageUrl", disabled: "disabled", popupSettings: "popupSettings", fillMode: "fillMode", themeColor: "themeColor", look: "look", buttonClass: "buttonClass", arrowButtonClass: "arrowButtonClass", arrowButtonIcon: "arrowButtonIcon", textField: "textField", data: "data" }, outputs: { buttonClick: "buttonClick", itemClick: "itemClick", open: "open", close: "close" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarSplitButtonComponent) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "toolbarSplitButton", first: true, predicate: ["toolbarSplitButton"], descendants: true }, { propertyName: "overflowSplitButton", first: true, predicate: ["overflowSplitButton"], descendants: true, read: ElementRef }, { propertyName: "overflowSplitButtonButtonList", first: true, predicate: ["overflowSplitButtonButtonList"], descendants: true }], exportAs: ["kendoToolBarSplitButton"], usesInheritance: true, ngImport: i0, template: `