@progress/kendo-angular-buttons 8.0.1-dev.202208111121 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kendo-angular-buttons.umd.js +1 -1
- package/button/button.directive.d.ts +3 -3
- package/buttongroup/buttongroup.component.d.ts +17 -16
- package/dropdownbutton/dropdownbutton.component.d.ts +10 -93
- package/esm2015/button/button.directive.js +1 -2
- package/esm2015/buttongroup/buttongroup.component.js +82 -59
- package/esm2015/dropdownbutton/dropdownbutton.component.js +51 -255
- package/esm2015/floatingactionbutton/floatingactionbutton.component.js +1 -1
- package/esm2015/listbutton/container.service.js +16 -0
- package/esm2015/listbutton/list-button.js +239 -53
- package/esm2015/listbutton/list.component.js +6 -4
- package/esm2015/navigation/navigation.service.js +5 -10
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/splitbutton/splitbutton.component.js +53 -138
- package/fesm2015/kendo-angular-buttons.js +453 -530
- package/listbutton/container.service.d.ts +15 -0
- package/listbutton/list-button.d.ts +83 -10
- package/navigation/navigation.service.d.ts +1 -1
- package/package.json +1 -1
- package/splitbutton/splitbutton.component.d.ts +8 -31
|
@@ -2,7 +2,7 @@
|
|
|
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 { SimpleChanges, ElementRef, EventEmitter, Renderer2
|
|
5
|
+
import { SimpleChanges, ElementRef, EventEmitter, Renderer2, OnDestroy, NgZone, AfterViewInit } from '@angular/core';
|
|
6
6
|
import { KendoButtonService } from './button.service';
|
|
7
7
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
8
|
import { ButtonFillMode, ButtonRounded, ButtonSize, ButtonThemeColor } from '../common/models';
|
|
@@ -11,6 +11,7 @@ import * as i0 from "@angular/core";
|
|
|
11
11
|
* Represents the Kendo UI Button component for Angular.
|
|
12
12
|
*/
|
|
13
13
|
export declare class ButtonDirective implements OnDestroy, AfterViewInit {
|
|
14
|
+
renderer: Renderer2;
|
|
14
15
|
private service;
|
|
15
16
|
private ngZone;
|
|
16
17
|
/**
|
|
@@ -133,7 +134,6 @@ export declare class ButtonDirective implements OnDestroy, AfterViewInit {
|
|
|
133
134
|
*/
|
|
134
135
|
click: EventEmitter<any>;
|
|
135
136
|
element: HTMLElement;
|
|
136
|
-
renderer: Renderer;
|
|
137
137
|
isDisabled: boolean;
|
|
138
138
|
isIcon: boolean;
|
|
139
139
|
isIconClass: boolean;
|
|
@@ -173,7 +173,7 @@ export declare class ButtonDirective implements OnDestroy, AfterViewInit {
|
|
|
173
173
|
* @hidden
|
|
174
174
|
*/
|
|
175
175
|
set look(value: 'flat' | 'outline' | 'clear' | 'default');
|
|
176
|
-
constructor(element: ElementRef, renderer:
|
|
176
|
+
constructor(element: ElementRef, renderer: Renderer2, service: KendoButtonService, localization: LocalizationService, ngZone: NgZone);
|
|
177
177
|
ngOnInit(): void;
|
|
178
178
|
ngOnChanges(change: SimpleChanges): void;
|
|
179
179
|
ngAfterViewInit(): void;
|
|
@@ -29,7 +29,8 @@ export declare class ButtonGroupComponent implements OnInit, OnDestroy, AfterCon
|
|
|
29
29
|
*/
|
|
30
30
|
disabled: boolean;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* The selection mode of the ButtonGroup.
|
|
33
|
+
* @default 'multiple'
|
|
33
34
|
*/
|
|
34
35
|
selection: ButtonGroupSelection;
|
|
35
36
|
/**
|
|
@@ -44,6 +45,15 @@ export declare class ButtonGroupComponent implements OnInit, OnDestroy, AfterCon
|
|
|
44
45
|
*/
|
|
45
46
|
set tabIndex(value: number);
|
|
46
47
|
get tabIndex(): number;
|
|
48
|
+
/**
|
|
49
|
+
* When this option is set to `true` (default), the component is a single tab-stop,
|
|
50
|
+
* and focus is moved through the inner buttons via the arrow keys.
|
|
51
|
+
*
|
|
52
|
+
* When the option is set to `false`, the inner buttons are part of the natural tab sequence of the page.
|
|
53
|
+
*
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
navigable: boolean;
|
|
47
57
|
/**
|
|
48
58
|
* Fires every time keyboard navigation occurs.
|
|
49
59
|
*/
|
|
@@ -56,26 +66,14 @@ export declare class ButtonGroupComponent implements OnInit, OnDestroy, AfterCon
|
|
|
56
66
|
get wrapperClass(): boolean;
|
|
57
67
|
get disabledClass(): boolean;
|
|
58
68
|
get stretchedClass(): boolean;
|
|
59
|
-
|
|
69
|
+
role: string;
|
|
60
70
|
get dir(): string;
|
|
61
71
|
get ariaDisabled(): boolean;
|
|
62
72
|
get wrapperWidth(): string;
|
|
63
73
|
get wrapperTabIndex(): number;
|
|
64
|
-
/**
|
|
65
|
-
* @hidden
|
|
66
|
-
*/
|
|
67
|
-
keydown(event: any): void;
|
|
68
|
-
/**
|
|
69
|
-
* @hidden
|
|
70
|
-
*/
|
|
71
|
-
onFocus(): void;
|
|
72
|
-
/**
|
|
73
|
-
* @hidden
|
|
74
|
-
*/
|
|
75
|
-
focusout(event: any): void;
|
|
76
74
|
constructor(service: KendoButtonService, localization: LocalizationService, element: ElementRef);
|
|
77
75
|
ngOnInit(): void;
|
|
78
|
-
ngOnChanges(
|
|
76
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
79
77
|
ngAfterContentInit(): void;
|
|
80
78
|
ngAfterViewChecked(): void;
|
|
81
79
|
ngOnDestroy(): void;
|
|
@@ -87,6 +85,9 @@ export declare class ButtonGroupComponent implements OnInit, OnDestroy, AfterCon
|
|
|
87
85
|
protected focus(buttons: Array<ButtonDirective>): void;
|
|
88
86
|
private verifySettings;
|
|
89
87
|
private isSelectionSingle;
|
|
88
|
+
private setButtonsTabIndex;
|
|
89
|
+
private handleSubs;
|
|
90
|
+
private focusHandler;
|
|
90
91
|
static ɵfac: i0.ɵɵFactoryDeclaration<ButtonGroupComponent, never>;
|
|
91
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ButtonGroupComponent, "kendo-buttongroup", ["kendoButtonGroup"], { "disabled": "disabled"; "selection": "selection"; "width": "width"; "tabIndex": "tabIndex"; }, { "navigate": "navigate"; }, ["buttons"], ["[kendoButton]"]>;
|
|
92
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ButtonGroupComponent, "kendo-buttongroup", ["kendoButtonGroup"], { "disabled": "disabled"; "selection": "selection"; "width": "width"; "tabIndex": "tabIndex"; "navigable": "navigable"; }, { "navigate": "navigate"; }, ["buttons"], ["[kendoButton]"]>;
|
|
92
93
|
}
|
|
@@ -2,18 +2,17 @@
|
|
|
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 { TemplateRef, ViewContainerRef, ElementRef, EventEmitter, NgZone, ChangeDetectorRef,
|
|
5
|
+
import { TemplateRef, ViewContainerRef, ElementRef, EventEmitter, NgZone, ChangeDetectorRef, AfterViewInit } from '@angular/core';
|
|
6
6
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
-
import {
|
|
8
|
-
import { PopupSettings } from '../listbutton/popup-settings';
|
|
7
|
+
import { PopupService } from '@progress/kendo-angular-popup';
|
|
9
8
|
import { ButtonItemTemplateDirective } from '../listbutton/button-item-template.directive';
|
|
10
9
|
import { Direction } from '../direction';
|
|
11
10
|
import { ListButton } from '../listbutton/list-button';
|
|
12
11
|
import { ListComponent } from '../listbutton/list.component';
|
|
13
12
|
import { FocusService } from '../focusable/focus.service';
|
|
14
13
|
import { NavigationService } from '../navigation/navigation.service';
|
|
15
|
-
import { PreventableEvent } from '../preventable-event';
|
|
16
14
|
import { ButtonFillMode, ButtonRounded, ButtonSize, ButtonThemeColor } from '../common/models';
|
|
15
|
+
import { PopupContainerService } from '../listbutton/container.service';
|
|
17
16
|
import * as i0 from "@angular/core";
|
|
18
17
|
/**
|
|
19
18
|
* Represents the Kendo UI DropDownButton component for Angular.
|
|
@@ -43,9 +42,8 @@ import * as i0 from "@angular/core";
|
|
|
43
42
|
* }
|
|
44
43
|
* ```
|
|
45
44
|
*/
|
|
46
|
-
export declare class DropDownButtonComponent extends ListButton implements
|
|
47
|
-
|
|
48
|
-
private elRef;
|
|
45
|
+
export declare class DropDownButtonComponent extends ListButton implements AfterViewInit {
|
|
46
|
+
protected containerService: PopupContainerService;
|
|
49
47
|
/**
|
|
50
48
|
* Defines the name of an existing icon in a Kendo UI theme.
|
|
51
49
|
*/
|
|
@@ -58,27 +56,11 @@ export declare class DropDownButtonComponent extends ListButton implements OnCha
|
|
|
58
56
|
* Defines a URL for styling the button with a custom image.
|
|
59
57
|
*/
|
|
60
58
|
imageUrl: string;
|
|
61
|
-
/**
|
|
62
|
-
* Configures the popup of the DropDownButton.
|
|
63
|
-
*
|
|
64
|
-
* The available options are:
|
|
65
|
-
* - `animate: Boolean`—Controls the popup animation. By default, the open and close animations are enabled.
|
|
66
|
-
* - `popupClass: String`—Specifies a list of CSS classes that are used to style the popup.
|
|
67
|
-
* - `appendTo: "root" | "component" | ViewContainerRef`—Specifies the component to which the popup will be appended.
|
|
68
|
-
* - `align: "left" | "center" | "right"`—Specifies the alignment of the popup.
|
|
69
|
-
*/
|
|
70
|
-
set popupSettings(settings: PopupSettings);
|
|
71
|
-
get popupSettings(): PopupSettings;
|
|
72
59
|
/**
|
|
73
60
|
* Sets the data item field that represents the item text.
|
|
74
61
|
* If the data contains only primitive values, do not define it.
|
|
75
62
|
*/
|
|
76
63
|
textField: string;
|
|
77
|
-
/**
|
|
78
|
-
* Sets the disabled state of the DropDownButton.
|
|
79
|
-
*/
|
|
80
|
-
set disabled(value: boolean);
|
|
81
|
-
get disabled(): boolean;
|
|
82
64
|
/**
|
|
83
65
|
* Sets or gets the data of the DropDownButton.
|
|
84
66
|
*
|
|
@@ -142,42 +124,10 @@ export declare class DropDownButtonComponent extends ListButton implements OnCha
|
|
|
142
124
|
* * `none` —Removes the default CSS class (no class would be rendered).
|
|
143
125
|
*/
|
|
144
126
|
themeColor: ButtonThemeColor;
|
|
145
|
-
/**
|
|
146
|
-
* The CSS classes that will be rendered on the main button.
|
|
147
|
-
* Supports the type of values that are supported by [`ngClass`]({{ site.data.urls.angular['ngclassapi'] }}).
|
|
148
|
-
*/
|
|
149
|
-
buttonClass: any;
|
|
150
|
-
/**
|
|
151
|
-
* @hidden
|
|
152
|
-
*/
|
|
153
|
-
set openState(open: boolean);
|
|
154
|
-
/**
|
|
155
|
-
* @hidden
|
|
156
|
-
*/
|
|
157
|
-
get openState(): boolean;
|
|
158
|
-
/**
|
|
159
|
-
* @hidden
|
|
160
|
-
*/
|
|
161
|
-
get componentTabIndex(): number;
|
|
162
|
-
private get appendTo();
|
|
163
|
-
/**
|
|
164
|
-
* Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
165
|
-
*/
|
|
166
|
-
tabIndex: number;
|
|
167
127
|
/**
|
|
168
128
|
* Fires each time the user clicks on a drop-down list item. The event data contains the data item bound to the clicked list item.
|
|
169
129
|
*/
|
|
170
130
|
itemClick: EventEmitter<any>;
|
|
171
|
-
/**
|
|
172
|
-
* Fires each time the popup is about to open.
|
|
173
|
-
* This event is preventable. If you cancel the event, the popup will remain closed.
|
|
174
|
-
*/
|
|
175
|
-
open: EventEmitter<PreventableEvent>;
|
|
176
|
-
/**
|
|
177
|
-
* Fires each time the popup is about to close.
|
|
178
|
-
* This event is preventable. If you cancel the event, the popup will remain open.
|
|
179
|
-
*/
|
|
180
|
-
close: EventEmitter<PreventableEvent>;
|
|
181
131
|
/**
|
|
182
132
|
* Fires each time the DropDownButton gets focused.
|
|
183
133
|
*/
|
|
@@ -198,18 +148,13 @@ export declare class DropDownButtonComponent extends ListButton implements OnCha
|
|
|
198
148
|
buttonList: ListComponent;
|
|
199
149
|
popupTemplate: TemplateRef<any>;
|
|
200
150
|
container: ViewContainerRef;
|
|
201
|
-
popupRef: PopupRef;
|
|
202
151
|
listId: string;
|
|
152
|
+
buttonId: string;
|
|
203
153
|
private _fillMode;
|
|
204
|
-
private popupSubs;
|
|
205
154
|
/**
|
|
206
155
|
* @hidden
|
|
207
156
|
*/
|
|
208
157
|
keydown(event: any): void;
|
|
209
|
-
/**
|
|
210
|
-
* @hidden
|
|
211
|
-
*/
|
|
212
|
-
keypress(event: any): void;
|
|
213
158
|
/**
|
|
214
159
|
* @hidden
|
|
215
160
|
*/
|
|
@@ -230,14 +175,6 @@ export declare class DropDownButtonComponent extends ListButton implements OnCha
|
|
|
230
175
|
* @hidden
|
|
231
176
|
*/
|
|
232
177
|
onButtonBlur(): void;
|
|
233
|
-
/**
|
|
234
|
-
* @hidden
|
|
235
|
-
*/
|
|
236
|
-
get anchorAlign(): Align;
|
|
237
|
-
/**
|
|
238
|
-
* @hidden
|
|
239
|
-
*/
|
|
240
|
-
get popupAlign(): Align;
|
|
241
178
|
/**
|
|
242
179
|
* Focuses the DropDownButton component.
|
|
243
180
|
*/
|
|
@@ -246,36 +183,16 @@ export declare class DropDownButtonComponent extends ListButton implements OnCha
|
|
|
246
183
|
* Blurs the DropDownButton component.
|
|
247
184
|
*/
|
|
248
185
|
blur(): void;
|
|
249
|
-
constructor(focusService: FocusService, navigationService: NavigationService, wrapperRef: ElementRef, zone: NgZone, popupService: PopupService, elRef: ElementRef, localization: LocalizationService, cdr: ChangeDetectorRef);
|
|
250
|
-
|
|
251
|
-
ngOnDestroy(): void;
|
|
252
|
-
/**
|
|
253
|
-
* Toggles the visibility of the popup.
|
|
254
|
-
* If the `toggle` method is used to open or close the popup, the `open` and `close` events will not be fired.
|
|
255
|
-
*
|
|
256
|
-
* @param open - The state of the popup.
|
|
257
|
-
*/
|
|
258
|
-
toggle(open: boolean): void;
|
|
259
|
-
/**
|
|
260
|
-
* Returns the current open state of the popup.
|
|
261
|
-
*/
|
|
262
|
-
get isOpen(): boolean;
|
|
186
|
+
constructor(focusService: FocusService, navigationService: NavigationService, wrapperRef: ElementRef, zone: NgZone, popupService: PopupService, elRef: ElementRef, localization: LocalizationService, cdr: ChangeDetectorRef, containerService: PopupContainerService);
|
|
187
|
+
ngAfterViewInit(): void;
|
|
263
188
|
/**
|
|
264
189
|
* @hidden
|
|
265
190
|
*/
|
|
266
|
-
handleFocus(): void;
|
|
191
|
+
handleFocus(event: FocusEvent): void;
|
|
267
192
|
/**
|
|
268
193
|
* @hidden
|
|
269
194
|
*/
|
|
270
195
|
wrapperContains(element: any): boolean;
|
|
271
|
-
protected subscribeNavigationEvents(): void;
|
|
272
|
-
private onNavigationEnterUp;
|
|
273
|
-
private onNavigationOpen;
|
|
274
|
-
private onNavigationClose;
|
|
275
|
-
private onArrowKeyNavigate;
|
|
276
|
-
private _toggle;
|
|
277
|
-
private createPopup;
|
|
278
|
-
private destroyPopup;
|
|
279
196
|
static ɵfac: i0.ɵɵFactoryDeclaration<DropDownButtonComponent, never>;
|
|
280
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DropDownButtonComponent, "kendo-dropdownbutton", ["kendoDropDownButton"], { "icon": "icon"; "iconClass": "iconClass"; "imageUrl": "imageUrl"; "
|
|
197
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DropDownButtonComponent, "kendo-dropdownbutton", ["kendoDropDownButton"], { "icon": "icon"; "iconClass": "iconClass"; "imageUrl": "imageUrl"; "textField": "textField"; "data": "data"; "size": "size"; "rounded": "rounded"; "fillMode": "fillMode"; "themeColor": "themeColor"; }, { "itemClick": "itemClick"; "onFocus": "focus"; "onBlur": "blur"; }, ["itemTemplate"], ["*"]>;
|
|
281
198
|
}
|
|
@@ -23,6 +23,7 @@ const DEFAULT_FILL_MODE = 'solid';
|
|
|
23
23
|
*/
|
|
24
24
|
export class ButtonDirective {
|
|
25
25
|
constructor(element, renderer, service, localization, ngZone) {
|
|
26
|
+
this.renderer = renderer;
|
|
26
27
|
this.service = service;
|
|
27
28
|
this.ngZone = ngZone;
|
|
28
29
|
/**
|
|
@@ -57,7 +58,6 @@ export class ButtonDirective {
|
|
|
57
58
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
58
59
|
this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
|
|
59
60
|
this.element = element.nativeElement;
|
|
60
|
-
this.renderer = renderer;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Backwards-compatible alias
|
|
@@ -329,7 +329,6 @@ export class ButtonDirective {
|
|
|
329
329
|
this.imageNode = null;
|
|
330
330
|
this.iconNode = null;
|
|
331
331
|
this.iconSpanNode = null;
|
|
332
|
-
this.renderer = null;
|
|
333
332
|
this.subs.unsubscribe();
|
|
334
333
|
clearTimeout(this.deferTimeout);
|
|
335
334
|
}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { ButtonDirective } from '../button/button.directive';
|
|
6
|
-
import { Component, EventEmitter, Output, Input, ContentChildren, HostBinding,
|
|
6
|
+
import { Component, EventEmitter, Output, Input, ContentChildren, HostBinding, isDevMode } from '@angular/core';
|
|
7
7
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
8
8
|
import { isChanged, Keys } from '@progress/kendo-angular-common';
|
|
9
9
|
import { KendoButtonService } from '../button/button.service';
|
|
10
|
-
import { Subscription } from 'rxjs';
|
|
10
|
+
import { fromEvent, Subscription } from 'rxjs';
|
|
11
|
+
import { filter } from 'rxjs/operators';
|
|
11
12
|
import { isPresent } from '../util';
|
|
12
13
|
import { PreventableEvent } from '../preventable-event';
|
|
13
14
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -27,9 +28,19 @@ export class ButtonGroupComponent {
|
|
|
27
28
|
this.service = service;
|
|
28
29
|
this.element = element;
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
+
* The selection mode of the ButtonGroup.
|
|
32
|
+
* @default 'multiple'
|
|
31
33
|
*/
|
|
32
34
|
this.selection = 'multiple';
|
|
35
|
+
/**
|
|
36
|
+
* When this option is set to `true` (default), the component is a single tab-stop,
|
|
37
|
+
* and focus is moved through the inner buttons via the arrow keys.
|
|
38
|
+
*
|
|
39
|
+
* When the option is set to `false`, the inner buttons are part of the natural tab sequence of the page.
|
|
40
|
+
*
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
this.navigable = true;
|
|
33
44
|
/**
|
|
34
45
|
* Fires every time keyboard navigation occurs.
|
|
35
46
|
*/
|
|
@@ -37,6 +48,15 @@ export class ButtonGroupComponent {
|
|
|
37
48
|
this._tabIndex = 0;
|
|
38
49
|
this.currentTabIndex = 0;
|
|
39
50
|
this.subs = new Subscription();
|
|
51
|
+
this.role = 'group';
|
|
52
|
+
this.focusHandler = () => {
|
|
53
|
+
this.currentTabIndex = -1;
|
|
54
|
+
const focusedIndex = this.buttons.toArray().findIndex(current => current.element.tabIndex !== -1);
|
|
55
|
+
const index = focusedIndex === -1 ? 0 : focusedIndex;
|
|
56
|
+
this.focus(this.buttons.filter((_current, i) => {
|
|
57
|
+
return i === index;
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
40
60
|
validatePackage(packageMetadata);
|
|
41
61
|
this.subs.add(localization.changes.subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr'));
|
|
42
62
|
}
|
|
@@ -59,9 +79,6 @@ export class ButtonGroupComponent {
|
|
|
59
79
|
get stretchedClass() {
|
|
60
80
|
return !!this.width;
|
|
61
81
|
}
|
|
62
|
-
get getRole() {
|
|
63
|
-
return this.isSelectionSingle() ? 'radiogroup' : 'group';
|
|
64
|
-
}
|
|
65
82
|
get dir() {
|
|
66
83
|
return this.direction;
|
|
67
84
|
}
|
|
@@ -72,35 +89,7 @@ export class ButtonGroupComponent {
|
|
|
72
89
|
return this.width;
|
|
73
90
|
}
|
|
74
91
|
get wrapperTabIndex() {
|
|
75
|
-
return this.disabled ? undefined : this.currentTabIndex;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* @hidden
|
|
79
|
-
*/
|
|
80
|
-
keydown(event) {
|
|
81
|
-
if (!this.disabled) {
|
|
82
|
-
this.navigateFocus(event);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @hidden
|
|
87
|
-
*/
|
|
88
|
-
onFocus() {
|
|
89
|
-
this.currentTabIndex = -1;
|
|
90
|
-
const focusedIndex = this.buttons.toArray().findIndex(current => current.element.tabIndex !== -1);
|
|
91
|
-
const index = focusedIndex === -1 ? 0 : focusedIndex;
|
|
92
|
-
this.focus(this.buttons.filter((_current, i) => {
|
|
93
|
-
return i === index;
|
|
94
|
-
}));
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @hidden
|
|
98
|
-
*/
|
|
99
|
-
focusout(event) {
|
|
100
|
-
if (event.relatedTarget && event.relatedTarget.parentNode !== this.element.nativeElement) {
|
|
101
|
-
this.defocus(this.buttons.toArray());
|
|
102
|
-
this.currentTabIndex = this.tabIndex;
|
|
103
|
-
}
|
|
92
|
+
return this.disabled ? undefined : this.navigable ? this.currentTabIndex : undefined;
|
|
104
93
|
}
|
|
105
94
|
ngOnInit() {
|
|
106
95
|
this.subs.add(this.service.buttonClicked$.subscribe((button) => {
|
|
@@ -110,33 +99,55 @@ export class ButtonGroupComponent {
|
|
|
110
99
|
this.deactivate(this.buttons.filter(current => current !== button));
|
|
111
100
|
}
|
|
112
101
|
else {
|
|
113
|
-
|
|
102
|
+
if (this.navigable) {
|
|
103
|
+
this.defocus(this.buttons.toArray());
|
|
104
|
+
}
|
|
114
105
|
newSelectionValue = !button.selected;
|
|
115
106
|
}
|
|
116
107
|
if (button.togglable) {
|
|
117
108
|
button.setSelected(newSelectionValue);
|
|
118
109
|
}
|
|
119
|
-
|
|
110
|
+
if (this.navigable) {
|
|
111
|
+
button.setAttribute(tabindex, '0');
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
this.handleSubs('focus', () => this.navigable, this.focusHandler);
|
|
115
|
+
this.handleSubs('keydown', () => this.navigable && !this.disabled, (event) => this.navigateFocus(event));
|
|
116
|
+
this.handleSubs('focusout', (event) => this.navigable && event.relatedTarget && event.relatedTarget.parentNode !== this.element.nativeElement, () => {
|
|
117
|
+
this.defocus(this.buttons.toArray());
|
|
118
|
+
this.currentTabIndex = this.tabIndex;
|
|
119
|
+
});
|
|
120
|
+
this.subs.add(fromEvent(this.element.nativeElement, 'focusout')
|
|
121
|
+
.pipe(filter((event) => this.navigable && event.relatedTarget && event.relatedTarget.parentNode !== this.element.nativeElement))
|
|
122
|
+
.subscribe(() => {
|
|
123
|
+
this.defocus(this.buttons.toArray());
|
|
124
|
+
this.currentTabIndex = this.tabIndex;
|
|
120
125
|
}));
|
|
121
126
|
}
|
|
122
|
-
ngOnChanges(
|
|
123
|
-
if (isChanged('disabled',
|
|
127
|
+
ngOnChanges(changes) {
|
|
128
|
+
if (isChanged('disabled', changes)) {
|
|
124
129
|
this.buttons.forEach((button) => {
|
|
125
130
|
if (isPresent(this.disabled)) {
|
|
126
131
|
button.disabled = this.disabled;
|
|
127
132
|
}
|
|
128
133
|
});
|
|
129
134
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
button.setAttribute(tabindex, '0');
|
|
135
|
+
if (isChanged('navigable', changes)) {
|
|
136
|
+
if (changes.navigable.currentValue) {
|
|
137
|
+
this.setButtonsTabIndex();
|
|
138
|
+
this.currentTabIndex = 0;
|
|
135
139
|
}
|
|
136
140
|
else {
|
|
137
|
-
|
|
141
|
+
this.currentTabIndex = -1;
|
|
142
|
+
this.buttons.forEach((button) => button.setAttribute(tabindex, '0'));
|
|
138
143
|
}
|
|
139
|
-
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
ngAfterContentInit() {
|
|
147
|
+
if (!this.navigable) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.setButtonsTabIndex();
|
|
140
151
|
}
|
|
141
152
|
ngAfterViewChecked() {
|
|
142
153
|
if (this.buttons.length) {
|
|
@@ -177,13 +188,17 @@ export class ButtonGroupComponent {
|
|
|
177
188
|
deactivate(buttons) {
|
|
178
189
|
buttons.forEach((button) => {
|
|
179
190
|
button.setSelected(false);
|
|
180
|
-
|
|
191
|
+
if (this.navigable) {
|
|
192
|
+
button.setAttribute(tabindex, '-1');
|
|
193
|
+
}
|
|
181
194
|
});
|
|
182
195
|
}
|
|
183
196
|
activate(buttons) {
|
|
184
197
|
buttons.forEach((button) => {
|
|
185
198
|
button.setSelected(true);
|
|
186
|
-
|
|
199
|
+
if (this.navigable) {
|
|
200
|
+
button.setAttribute(tabindex, '0');
|
|
201
|
+
}
|
|
187
202
|
button.focus();
|
|
188
203
|
});
|
|
189
204
|
}
|
|
@@ -208,9 +223,24 @@ export class ButtonGroupComponent {
|
|
|
208
223
|
isSelectionSingle() {
|
|
209
224
|
return this.selection === 'single';
|
|
210
225
|
}
|
|
226
|
+
setButtonsTabIndex() {
|
|
227
|
+
this.buttons.forEach((button) => {
|
|
228
|
+
if (button.selected) {
|
|
229
|
+
button.setAttribute(tabindex, '0');
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
button.setAttribute(tabindex, '-1');
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
handleSubs(eventName, predicate, handler) {
|
|
237
|
+
this.subs.add(fromEvent(this.element.nativeElement, eventName)
|
|
238
|
+
.pipe(filter(predicate))
|
|
239
|
+
.subscribe(handler));
|
|
240
|
+
}
|
|
211
241
|
}
|
|
212
242
|
ButtonGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ButtonGroupComponent, deps: [{ token: i1.KendoButtonService }, { token: i2.LocalizationService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
213
|
-
ButtonGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ButtonGroupComponent, selector: "kendo-buttongroup", inputs: { disabled: "disabled", selection: "selection", width: "width", tabIndex: "tabIndex" }, outputs: { navigate: "navigate" }, host: {
|
|
243
|
+
ButtonGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ButtonGroupComponent, selector: "kendo-buttongroup", inputs: { disabled: "disabled", selection: "selection", width: "width", tabIndex: "tabIndex", navigable: "navigable" }, outputs: { navigate: "navigate" }, host: { properties: { "class.k-button-group": "this.wrapperClass", "class.k-disabled": "this.disabledClass", "class.k-button-group-stretched": "this.stretchedClass", "attr.role": "this.role", "attr.dir": "this.dir", "attr.aria-disabled": "this.ariaDisabled", "style.width": "this.wrapperWidth", "attr.tabindex": "this.wrapperTabIndex" } }, providers: [
|
|
214
244
|
KendoButtonService,
|
|
215
245
|
LocalizationService,
|
|
216
246
|
{
|
|
@@ -248,6 +278,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
248
278
|
args: ['width']
|
|
249
279
|
}], tabIndex: [{
|
|
250
280
|
type: Input
|
|
281
|
+
}], navigable: [{
|
|
282
|
+
type: Input
|
|
251
283
|
}], navigate: [{
|
|
252
284
|
type: Output
|
|
253
285
|
}], buttons: [{
|
|
@@ -262,7 +294,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
262
294
|
}], stretchedClass: [{
|
|
263
295
|
type: HostBinding,
|
|
264
296
|
args: ['class.k-button-group-stretched']
|
|
265
|
-
}],
|
|
297
|
+
}], role: [{
|
|
266
298
|
type: HostBinding,
|
|
267
299
|
args: ['attr.role']
|
|
268
300
|
}], dir: [{
|
|
@@ -277,13 +309,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
277
309
|
}], wrapperTabIndex: [{
|
|
278
310
|
type: HostBinding,
|
|
279
311
|
args: ['attr.tabindex']
|
|
280
|
-
}], keydown: [{
|
|
281
|
-
type: HostListener,
|
|
282
|
-
args: ['keydown', ['$event']]
|
|
283
|
-
}], onFocus: [{
|
|
284
|
-
type: HostListener,
|
|
285
|
-
args: ['focus']
|
|
286
|
-
}], focusout: [{
|
|
287
|
-
type: HostListener,
|
|
288
|
-
args: ['focusout', ['$event']]
|
|
289
312
|
}] } });
|