@progress/kendo-angular-listbox 13.0.0-develop.9 → 13.0.1-develop.1
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/esm2020/data-binding.directive.mjs +2 -0
- package/esm2020/item-selectable.directive.mjs +2 -2
- package/esm2020/keyboard-navigation.service.mjs +18 -11
- package/esm2020/listbox.component.mjs +14 -8
- package/esm2020/package-metadata.mjs +2 -2
- package/fesm2015/progress-kendo-angular-listbox.mjs +39 -24
- package/fesm2020/progress-kendo-angular-listbox.mjs +38 -23
- package/keyboard-navigation.service.d.ts +3 -2
- package/listbox.component.d.ts +1 -0
- package/package.json +5 -5
- package/schematics/ngAdd/index.js +4 -4
|
@@ -101,6 +101,8 @@ export class DataBindingDirective {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
const newIndex = dir === 'up' ? index - 1 : index + 1;
|
|
104
|
+
const navigation = this.selectedBox.keyboardNavigationService;
|
|
105
|
+
navigation.focusedListboxItemIndex = navigation.selectedListboxItemIndex = newIndex;
|
|
104
106
|
[this.selectedBox.data[newIndex], this.selectedBox.data[index]] = [this.selectedBox.data[index], this.selectedBox.data[newIndex]];
|
|
105
107
|
this.selectedBox.selectionService.select(newIndex);
|
|
106
108
|
}
|
|
@@ -22,7 +22,7 @@ export class ItemSelectableDirective {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
ItemSelectableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ItemSelectableDirective, deps: [{ token: i1.ListBoxSelectionService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
25
|
-
ItemSelectableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: { index: "index" }, host: { listeners: { "
|
|
25
|
+
ItemSelectableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: { index: "index" }, host: { listeners: { "mousedown": "onClick($event)" }, properties: { "class.k-selected": "this.selectedClassName" } }, ngImport: i0 });
|
|
26
26
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ItemSelectableDirective, decorators: [{
|
|
27
27
|
type: Directive,
|
|
28
28
|
args: [{
|
|
@@ -35,5 +35,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
35
35
|
args: ['class.k-selected']
|
|
36
36
|
}], onClick: [{
|
|
37
37
|
type: HostListener,
|
|
38
|
-
args: ['
|
|
38
|
+
args: ['mousedown', ['$event']]
|
|
39
39
|
}] } });
|
|
@@ -19,10 +19,10 @@ export class KeyboardNavigationService {
|
|
|
19
19
|
this.focusedListboxItemIndex = 0;
|
|
20
20
|
this.focusedToolIndex = 0;
|
|
21
21
|
this.onDeleteEvent = new EventEmitter();
|
|
22
|
-
this.onSelectionChange = new EventEmitter();
|
|
23
22
|
this.onMoveSelectedItem = new EventEmitter();
|
|
24
23
|
this.onTransferAllEvent = new EventEmitter();
|
|
25
24
|
this.onShiftSelectedItem = new EventEmitter();
|
|
25
|
+
this.onSelectionChange = new EventEmitter();
|
|
26
26
|
}
|
|
27
27
|
onKeyDown(event, toolsRef, toolbar, childListbox, parentListbox, listboxItems) {
|
|
28
28
|
const target = event.target;
|
|
@@ -68,10 +68,12 @@ export class KeyboardNavigationService {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
changeTabindex(previousItem, currentItem) {
|
|
71
|
+
changeTabindex(previousItem, currentItem, shouldBlur = true) {
|
|
72
72
|
if (previousItem) {
|
|
73
73
|
this.renderer.setAttribute(previousItem, 'tabindex', '-1');
|
|
74
|
-
|
|
74
|
+
if (shouldBlur) {
|
|
75
|
+
previousItem.blur();
|
|
76
|
+
}
|
|
75
77
|
}
|
|
76
78
|
;
|
|
77
79
|
if (currentItem) {
|
|
@@ -97,8 +99,8 @@ export class KeyboardNavigationService {
|
|
|
97
99
|
const previousItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
98
100
|
const currentItem = listboxItems[this.focusedListboxItemIndex]?.nativeElement;
|
|
99
101
|
this.changeTabindex(previousItem, currentItem);
|
|
102
|
+
this.onSelectionChange.emit({ index: this.focusedListboxItemIndex, prevIndex: this.selectedListboxItemIndex });
|
|
100
103
|
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
101
|
-
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
102
104
|
}
|
|
103
105
|
onArrowUpOrDown(keyCode, ctrlOrMetaKey, event, activeToolbar, listboxItems) {
|
|
104
106
|
event.preventDefault();
|
|
@@ -116,7 +118,7 @@ export class KeyboardNavigationService {
|
|
|
116
118
|
return;
|
|
117
119
|
}
|
|
118
120
|
dir === 'moveUp' ? this.onArrowUp(listboxItems) : this.onArrowDown(listboxItems);
|
|
119
|
-
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
121
|
+
this.onSelectionChange.emit({ index: this.selectedListboxItemIndex, prevIndex: this.focusedListboxItemIndex });
|
|
120
122
|
this.focusedListboxItemIndex = this.selectedListboxItemIndex;
|
|
121
123
|
}
|
|
122
124
|
onArrowLeftOrRight(keyCode, parentListbox, childListbox, event, listboxItems) {
|
|
@@ -133,17 +135,22 @@ export class KeyboardNavigationService {
|
|
|
133
135
|
event.stopImmediatePropagation();
|
|
134
136
|
event.preventDefault();
|
|
135
137
|
const areIndexesEqual = this.selectedListboxItemIndex === this.focusedListboxItemIndex;
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
+
const canDeselect = (this.selectedListboxItemIndex || this.selectedListboxItemIndex === 0) && areIndexesEqual;
|
|
139
|
+
let previousItem;
|
|
140
|
+
let currentItem;
|
|
141
|
+
let prevIndex;
|
|
142
|
+
if (canDeselect) {
|
|
143
|
+
previousItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
138
144
|
this.selectedListboxItemIndex = null;
|
|
139
145
|
}
|
|
140
146
|
else {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.
|
|
147
|
+
previousItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
148
|
+
currentItem = listboxItems[this.focusedListboxItemIndex]?.nativeElement;
|
|
149
|
+
prevIndex = this.selectedListboxItemIndex;
|
|
144
150
|
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
145
151
|
}
|
|
146
|
-
this.
|
|
152
|
+
this.changeTabindex(previousItem, currentItem, !!currentItem);
|
|
153
|
+
this.onSelectionChange.emit({ index: this.selectedListboxItemIndex, prevIndex });
|
|
147
154
|
}
|
|
148
155
|
onF10Key(tools) {
|
|
149
156
|
if (this.focusedToolIndex && this.focusedToolIndex > -1) {
|
|
@@ -83,6 +83,7 @@ export class ListBoxComponent {
|
|
|
83
83
|
this.caretAltRightIcon = caretAltRightIcon;
|
|
84
84
|
this._size = DEFAULT_SIZE;
|
|
85
85
|
this.subs = new Subscription();
|
|
86
|
+
this.shouldFireFocusIn = true;
|
|
86
87
|
validatePackage(packageMetadata);
|
|
87
88
|
this.setToolbarClass(DEFAULT_TOOLBAR_POSITION);
|
|
88
89
|
this.setSizingClass(this.size);
|
|
@@ -242,16 +243,20 @@ export class ListBoxComponent {
|
|
|
242
243
|
this.caretAltLeftIcon :
|
|
243
244
|
icon;
|
|
244
245
|
}
|
|
245
|
-
onClickEvent(prevIndex,
|
|
246
|
-
this.
|
|
247
|
-
this.keyboardNavigationService.
|
|
248
|
-
this.
|
|
246
|
+
onClickEvent(prevIndex, index) {
|
|
247
|
+
this.shouldFireFocusIn = false;
|
|
248
|
+
this.selectionChange.next({ index, prevIndex: this.keyboardNavigationService.selectedListboxItemIndex });
|
|
249
|
+
this.keyboardNavigationService.selectedListboxItemIndex = index;
|
|
250
|
+
this.keyboardNavigationService.focusedListboxItemIndex = index;
|
|
249
251
|
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
250
252
|
const listboxItems = this.listboxItems.toArray();
|
|
251
253
|
const previousItem = prevIndex ? listboxItems[prevIndex].nativeElement : listboxItems[0].nativeElement;
|
|
252
|
-
const currentItem = listboxItems[
|
|
254
|
+
const currentItem = listboxItems[index].nativeElement;
|
|
253
255
|
this.keyboardNavigationService.changeTabindex(previousItem, currentItem);
|
|
254
256
|
});
|
|
257
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
258
|
+
this.shouldFireFocusIn = true;
|
|
259
|
+
});
|
|
255
260
|
}
|
|
256
261
|
initSubscriptions(navService, hostEl, toolsRef) {
|
|
257
262
|
this.subs.add(navService.onShiftSelectedItem.subscribe((actionToPerform) => this.performAction(actionToPerform)));
|
|
@@ -261,14 +266,15 @@ export class ListBoxComponent {
|
|
|
261
266
|
this.subs.add(navService.onDeleteEvent.subscribe((index) => this.onDeleteEvent(index, navService)));
|
|
262
267
|
this.subs.add(navService.onMoveSelectedItem.subscribe((dir) => this.performAction(dir)));
|
|
263
268
|
this.subs.add(this.renderer.listen(hostEl, 'keydown', (event) => navService.onKeyDown(event, toolsRef, this.selectedTools, this.childListbox, this.parentListbox, this.listboxItems.toArray())));
|
|
264
|
-
this.subs.add(navService.onSelectionChange.subscribe((
|
|
269
|
+
this.subs.add(navService.onSelectionChange.subscribe((indexes) => {
|
|
270
|
+
const { prevIndex, index } = indexes;
|
|
265
271
|
this.selectionService.selectedIndex = index;
|
|
266
|
-
this.selectionChange.next({ index, prevIndex
|
|
272
|
+
this.selectionChange.next({ index, prevIndex });
|
|
267
273
|
}));
|
|
268
274
|
}
|
|
269
275
|
onFocusIn(event) {
|
|
270
276
|
const navService = this.keyboardNavigationService;
|
|
271
|
-
if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex) {
|
|
277
|
+
if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex && this.shouldFireFocusIn) {
|
|
272
278
|
const items = this.listboxItems.toArray();
|
|
273
279
|
const index = items.findIndex(elem => elem.nativeElement === event.target);
|
|
274
280
|
this.selectionService.selectedIndex = index;
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-listbox',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
13
|
-
version: '13.0.
|
|
12
|
+
publishDate: 1686070584,
|
|
13
|
+
version: '13.0.1-develop.1',
|
|
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
|
};
|
|
@@ -24,8 +24,8 @@ const packageMetadata = {
|
|
|
24
24
|
name: '@progress/kendo-angular-listbox',
|
|
25
25
|
productName: 'Kendo UI for Angular',
|
|
26
26
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
27
|
-
publishDate:
|
|
28
|
-
version: '13.0.
|
|
27
|
+
publishDate: 1686070584,
|
|
28
|
+
version: '13.0.1-develop.1',
|
|
29
29
|
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'
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -201,10 +201,10 @@ class KeyboardNavigationService {
|
|
|
201
201
|
this.focusedListboxItemIndex = 0;
|
|
202
202
|
this.focusedToolIndex = 0;
|
|
203
203
|
this.onDeleteEvent = new EventEmitter();
|
|
204
|
-
this.onSelectionChange = new EventEmitter();
|
|
205
204
|
this.onMoveSelectedItem = new EventEmitter();
|
|
206
205
|
this.onTransferAllEvent = new EventEmitter();
|
|
207
206
|
this.onShiftSelectedItem = new EventEmitter();
|
|
207
|
+
this.onSelectionChange = new EventEmitter();
|
|
208
208
|
}
|
|
209
209
|
onKeyDown(event, toolsRef, toolbar, childListbox, parentListbox, listboxItems) {
|
|
210
210
|
const target = event.target;
|
|
@@ -250,10 +250,12 @@ class KeyboardNavigationService {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
-
changeTabindex(previousItem, currentItem) {
|
|
253
|
+
changeTabindex(previousItem, currentItem, shouldBlur = true) {
|
|
254
254
|
if (previousItem) {
|
|
255
255
|
this.renderer.setAttribute(previousItem, 'tabindex', '-1');
|
|
256
|
-
|
|
256
|
+
if (shouldBlur) {
|
|
257
|
+
previousItem.blur();
|
|
258
|
+
}
|
|
257
259
|
}
|
|
258
260
|
;
|
|
259
261
|
if (currentItem) {
|
|
@@ -280,8 +282,8 @@ class KeyboardNavigationService {
|
|
|
280
282
|
const previousItem = (_a = listboxItems[this.selectedListboxItemIndex]) === null || _a === void 0 ? void 0 : _a.nativeElement;
|
|
281
283
|
const currentItem = (_b = listboxItems[this.focusedListboxItemIndex]) === null || _b === void 0 ? void 0 : _b.nativeElement;
|
|
282
284
|
this.changeTabindex(previousItem, currentItem);
|
|
285
|
+
this.onSelectionChange.emit({ index: this.focusedListboxItemIndex, prevIndex: this.selectedListboxItemIndex });
|
|
283
286
|
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
284
|
-
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
285
287
|
}
|
|
286
288
|
onArrowUpOrDown(keyCode, ctrlOrMetaKey, event, activeToolbar, listboxItems) {
|
|
287
289
|
event.preventDefault();
|
|
@@ -299,7 +301,7 @@ class KeyboardNavigationService {
|
|
|
299
301
|
return;
|
|
300
302
|
}
|
|
301
303
|
dir === 'moveUp' ? this.onArrowUp(listboxItems) : this.onArrowDown(listboxItems);
|
|
302
|
-
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
304
|
+
this.onSelectionChange.emit({ index: this.selectedListboxItemIndex, prevIndex: this.focusedListboxItemIndex });
|
|
303
305
|
this.focusedListboxItemIndex = this.selectedListboxItemIndex;
|
|
304
306
|
}
|
|
305
307
|
onArrowLeftOrRight(keyCode, parentListbox, childListbox, event, listboxItems) {
|
|
@@ -313,21 +315,26 @@ class KeyboardNavigationService {
|
|
|
313
315
|
}
|
|
314
316
|
}
|
|
315
317
|
onSelectChange(event, listboxItems) {
|
|
316
|
-
var _a, _b;
|
|
318
|
+
var _a, _b, _c;
|
|
317
319
|
event.stopImmediatePropagation();
|
|
318
320
|
event.preventDefault();
|
|
319
321
|
const areIndexesEqual = this.selectedListboxItemIndex === this.focusedListboxItemIndex;
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
+
const canDeselect = (this.selectedListboxItemIndex || this.selectedListboxItemIndex === 0) && areIndexesEqual;
|
|
323
|
+
let previousItem;
|
|
324
|
+
let currentItem;
|
|
325
|
+
let prevIndex;
|
|
326
|
+
if (canDeselect) {
|
|
327
|
+
previousItem = (_a = listboxItems[this.selectedListboxItemIndex]) === null || _a === void 0 ? void 0 : _a.nativeElement;
|
|
322
328
|
this.selectedListboxItemIndex = null;
|
|
323
329
|
}
|
|
324
330
|
else {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
this.
|
|
331
|
+
previousItem = (_b = listboxItems[this.selectedListboxItemIndex]) === null || _b === void 0 ? void 0 : _b.nativeElement;
|
|
332
|
+
currentItem = (_c = listboxItems[this.focusedListboxItemIndex]) === null || _c === void 0 ? void 0 : _c.nativeElement;
|
|
333
|
+
prevIndex = this.selectedListboxItemIndex;
|
|
328
334
|
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
329
335
|
}
|
|
330
|
-
this.
|
|
336
|
+
this.changeTabindex(previousItem, currentItem, !!currentItem);
|
|
337
|
+
this.onSelectionChange.emit({ index: this.selectedListboxItemIndex, prevIndex });
|
|
331
338
|
}
|
|
332
339
|
onF10Key(tools) {
|
|
333
340
|
var _a;
|
|
@@ -536,7 +543,7 @@ class ItemSelectableDirective {
|
|
|
536
543
|
}
|
|
537
544
|
}
|
|
538
545
|
ItemSelectableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ItemSelectableDirective, deps: [{ token: ListBoxSelectionService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
539
|
-
ItemSelectableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: { index: "index" }, host: { listeners: { "
|
|
546
|
+
ItemSelectableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: { index: "index" }, host: { listeners: { "mousedown": "onClick($event)" }, properties: { "class.k-selected": "this.selectedClassName" } }, ngImport: i0 });
|
|
540
547
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ItemSelectableDirective, decorators: [{
|
|
541
548
|
type: Directive,
|
|
542
549
|
args: [{
|
|
@@ -549,7 +556,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
549
556
|
args: ['class.k-selected']
|
|
550
557
|
}], onClick: [{
|
|
551
558
|
type: HostListener,
|
|
552
|
-
args: ['
|
|
559
|
+
args: ['mousedown', ['$event']]
|
|
553
560
|
}] } });
|
|
554
561
|
|
|
555
562
|
/* eslint-disable @typescript-eslint/no-inferrable-types */
|
|
@@ -612,6 +619,7 @@ class ListBoxComponent {
|
|
|
612
619
|
this.caretAltRightIcon = caretAltRightIcon;
|
|
613
620
|
this._size = DEFAULT_SIZE;
|
|
614
621
|
this.subs = new Subscription();
|
|
622
|
+
this.shouldFireFocusIn = true;
|
|
615
623
|
validatePackage(packageMetadata);
|
|
616
624
|
this.setToolbarClass(DEFAULT_TOOLBAR_POSITION);
|
|
617
625
|
this.setSizingClass(this.size);
|
|
@@ -772,16 +780,20 @@ class ListBoxComponent {
|
|
|
772
780
|
this.caretAltLeftIcon :
|
|
773
781
|
icon;
|
|
774
782
|
}
|
|
775
|
-
onClickEvent(prevIndex,
|
|
776
|
-
this.
|
|
777
|
-
this.keyboardNavigationService.
|
|
778
|
-
this.
|
|
783
|
+
onClickEvent(prevIndex, index) {
|
|
784
|
+
this.shouldFireFocusIn = false;
|
|
785
|
+
this.selectionChange.next({ index, prevIndex: this.keyboardNavigationService.selectedListboxItemIndex });
|
|
786
|
+
this.keyboardNavigationService.selectedListboxItemIndex = index;
|
|
787
|
+
this.keyboardNavigationService.focusedListboxItemIndex = index;
|
|
779
788
|
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
780
789
|
const listboxItems = this.listboxItems.toArray();
|
|
781
790
|
const previousItem = prevIndex ? listboxItems[prevIndex].nativeElement : listboxItems[0].nativeElement;
|
|
782
|
-
const currentItem = listboxItems[
|
|
791
|
+
const currentItem = listboxItems[index].nativeElement;
|
|
783
792
|
this.keyboardNavigationService.changeTabindex(previousItem, currentItem);
|
|
784
793
|
});
|
|
794
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
795
|
+
this.shouldFireFocusIn = true;
|
|
796
|
+
});
|
|
785
797
|
}
|
|
786
798
|
initSubscriptions(navService, hostEl, toolsRef) {
|
|
787
799
|
this.subs.add(navService.onShiftSelectedItem.subscribe((actionToPerform) => this.performAction(actionToPerform)));
|
|
@@ -791,15 +803,16 @@ class ListBoxComponent {
|
|
|
791
803
|
this.subs.add(navService.onDeleteEvent.subscribe((index) => this.onDeleteEvent(index, navService)));
|
|
792
804
|
this.subs.add(navService.onMoveSelectedItem.subscribe((dir) => this.performAction(dir)));
|
|
793
805
|
this.subs.add(this.renderer.listen(hostEl, 'keydown', (event) => navService.onKeyDown(event, toolsRef, this.selectedTools, this.childListbox, this.parentListbox, this.listboxItems.toArray())));
|
|
794
|
-
this.subs.add(navService.onSelectionChange.subscribe((
|
|
806
|
+
this.subs.add(navService.onSelectionChange.subscribe((indexes) => {
|
|
807
|
+
const { prevIndex, index } = indexes;
|
|
795
808
|
this.selectionService.selectedIndex = index;
|
|
796
|
-
this.selectionChange.next({ index, prevIndex
|
|
809
|
+
this.selectionChange.next({ index, prevIndex });
|
|
797
810
|
}));
|
|
798
811
|
}
|
|
799
812
|
onFocusIn(event) {
|
|
800
813
|
var _a, _b;
|
|
801
814
|
const navService = this.keyboardNavigationService;
|
|
802
|
-
if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex) {
|
|
815
|
+
if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex && this.shouldFireFocusIn) {
|
|
803
816
|
const items = this.listboxItems.toArray();
|
|
804
817
|
const index = items.findIndex(elem => elem.nativeElement === event.target);
|
|
805
818
|
this.selectionService.selectedIndex = index;
|
|
@@ -1194,6 +1207,8 @@ class DataBindingDirective {
|
|
|
1194
1207
|
return;
|
|
1195
1208
|
}
|
|
1196
1209
|
const newIndex = dir === 'up' ? index - 1 : index + 1;
|
|
1210
|
+
const navigation = this.selectedBox.keyboardNavigationService;
|
|
1211
|
+
navigation.focusedListboxItemIndex = navigation.selectedListboxItemIndex = newIndex;
|
|
1197
1212
|
[this.selectedBox.data[newIndex], this.selectedBox.data[index]] = [this.selectedBox.data[index], this.selectedBox.data[newIndex]];
|
|
1198
1213
|
this.selectedBox.selectionService.select(newIndex);
|
|
1199
1214
|
}
|
|
@@ -24,8 +24,8 @@ const packageMetadata = {
|
|
|
24
24
|
name: '@progress/kendo-angular-listbox',
|
|
25
25
|
productName: 'Kendo UI for Angular',
|
|
26
26
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
27
|
-
publishDate:
|
|
28
|
-
version: '13.0.
|
|
27
|
+
publishDate: 1686070584,
|
|
28
|
+
version: '13.0.1-develop.1',
|
|
29
29
|
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'
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -201,10 +201,10 @@ class KeyboardNavigationService {
|
|
|
201
201
|
this.focusedListboxItemIndex = 0;
|
|
202
202
|
this.focusedToolIndex = 0;
|
|
203
203
|
this.onDeleteEvent = new EventEmitter();
|
|
204
|
-
this.onSelectionChange = new EventEmitter();
|
|
205
204
|
this.onMoveSelectedItem = new EventEmitter();
|
|
206
205
|
this.onTransferAllEvent = new EventEmitter();
|
|
207
206
|
this.onShiftSelectedItem = new EventEmitter();
|
|
207
|
+
this.onSelectionChange = new EventEmitter();
|
|
208
208
|
}
|
|
209
209
|
onKeyDown(event, toolsRef, toolbar, childListbox, parentListbox, listboxItems) {
|
|
210
210
|
const target = event.target;
|
|
@@ -250,10 +250,12 @@ class KeyboardNavigationService {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
-
changeTabindex(previousItem, currentItem) {
|
|
253
|
+
changeTabindex(previousItem, currentItem, shouldBlur = true) {
|
|
254
254
|
if (previousItem) {
|
|
255
255
|
this.renderer.setAttribute(previousItem, 'tabindex', '-1');
|
|
256
|
-
|
|
256
|
+
if (shouldBlur) {
|
|
257
|
+
previousItem.blur();
|
|
258
|
+
}
|
|
257
259
|
}
|
|
258
260
|
;
|
|
259
261
|
if (currentItem) {
|
|
@@ -279,8 +281,8 @@ class KeyboardNavigationService {
|
|
|
279
281
|
const previousItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
280
282
|
const currentItem = listboxItems[this.focusedListboxItemIndex]?.nativeElement;
|
|
281
283
|
this.changeTabindex(previousItem, currentItem);
|
|
284
|
+
this.onSelectionChange.emit({ index: this.focusedListboxItemIndex, prevIndex: this.selectedListboxItemIndex });
|
|
282
285
|
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
283
|
-
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
284
286
|
}
|
|
285
287
|
onArrowUpOrDown(keyCode, ctrlOrMetaKey, event, activeToolbar, listboxItems) {
|
|
286
288
|
event.preventDefault();
|
|
@@ -298,7 +300,7 @@ class KeyboardNavigationService {
|
|
|
298
300
|
return;
|
|
299
301
|
}
|
|
300
302
|
dir === 'moveUp' ? this.onArrowUp(listboxItems) : this.onArrowDown(listboxItems);
|
|
301
|
-
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
303
|
+
this.onSelectionChange.emit({ index: this.selectedListboxItemIndex, prevIndex: this.focusedListboxItemIndex });
|
|
302
304
|
this.focusedListboxItemIndex = this.selectedListboxItemIndex;
|
|
303
305
|
}
|
|
304
306
|
onArrowLeftOrRight(keyCode, parentListbox, childListbox, event, listboxItems) {
|
|
@@ -315,17 +317,22 @@ class KeyboardNavigationService {
|
|
|
315
317
|
event.stopImmediatePropagation();
|
|
316
318
|
event.preventDefault();
|
|
317
319
|
const areIndexesEqual = this.selectedListboxItemIndex === this.focusedListboxItemIndex;
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
+
const canDeselect = (this.selectedListboxItemIndex || this.selectedListboxItemIndex === 0) && areIndexesEqual;
|
|
321
|
+
let previousItem;
|
|
322
|
+
let currentItem;
|
|
323
|
+
let prevIndex;
|
|
324
|
+
if (canDeselect) {
|
|
325
|
+
previousItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
320
326
|
this.selectedListboxItemIndex = null;
|
|
321
327
|
}
|
|
322
328
|
else {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
this.
|
|
329
|
+
previousItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
330
|
+
currentItem = listboxItems[this.focusedListboxItemIndex]?.nativeElement;
|
|
331
|
+
prevIndex = this.selectedListboxItemIndex;
|
|
326
332
|
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
327
333
|
}
|
|
328
|
-
this.
|
|
334
|
+
this.changeTabindex(previousItem, currentItem, !!currentItem);
|
|
335
|
+
this.onSelectionChange.emit({ index: this.selectedListboxItemIndex, prevIndex });
|
|
329
336
|
}
|
|
330
337
|
onF10Key(tools) {
|
|
331
338
|
if (this.focusedToolIndex && this.focusedToolIndex > -1) {
|
|
@@ -531,7 +538,7 @@ class ItemSelectableDirective {
|
|
|
531
538
|
}
|
|
532
539
|
}
|
|
533
540
|
ItemSelectableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ItemSelectableDirective, deps: [{ token: ListBoxSelectionService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
534
|
-
ItemSelectableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: { index: "index" }, host: { listeners: { "
|
|
541
|
+
ItemSelectableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: ItemSelectableDirective, selector: "[kendoListBoxItemSelectable]", inputs: { index: "index" }, host: { listeners: { "mousedown": "onClick($event)" }, properties: { "class.k-selected": "this.selectedClassName" } }, ngImport: i0 });
|
|
535
542
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ItemSelectableDirective, decorators: [{
|
|
536
543
|
type: Directive,
|
|
537
544
|
args: [{
|
|
@@ -544,7 +551,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
544
551
|
args: ['class.k-selected']
|
|
545
552
|
}], onClick: [{
|
|
546
553
|
type: HostListener,
|
|
547
|
-
args: ['
|
|
554
|
+
args: ['mousedown', ['$event']]
|
|
548
555
|
}] } });
|
|
549
556
|
|
|
550
557
|
/* eslint-disable @typescript-eslint/no-inferrable-types */
|
|
@@ -607,6 +614,7 @@ class ListBoxComponent {
|
|
|
607
614
|
this.caretAltRightIcon = caretAltRightIcon;
|
|
608
615
|
this._size = DEFAULT_SIZE;
|
|
609
616
|
this.subs = new Subscription();
|
|
617
|
+
this.shouldFireFocusIn = true;
|
|
610
618
|
validatePackage(packageMetadata);
|
|
611
619
|
this.setToolbarClass(DEFAULT_TOOLBAR_POSITION);
|
|
612
620
|
this.setSizingClass(this.size);
|
|
@@ -766,16 +774,20 @@ class ListBoxComponent {
|
|
|
766
774
|
this.caretAltLeftIcon :
|
|
767
775
|
icon;
|
|
768
776
|
}
|
|
769
|
-
onClickEvent(prevIndex,
|
|
770
|
-
this.
|
|
771
|
-
this.keyboardNavigationService.
|
|
772
|
-
this.
|
|
777
|
+
onClickEvent(prevIndex, index) {
|
|
778
|
+
this.shouldFireFocusIn = false;
|
|
779
|
+
this.selectionChange.next({ index, prevIndex: this.keyboardNavigationService.selectedListboxItemIndex });
|
|
780
|
+
this.keyboardNavigationService.selectedListboxItemIndex = index;
|
|
781
|
+
this.keyboardNavigationService.focusedListboxItemIndex = index;
|
|
773
782
|
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
774
783
|
const listboxItems = this.listboxItems.toArray();
|
|
775
784
|
const previousItem = prevIndex ? listboxItems[prevIndex].nativeElement : listboxItems[0].nativeElement;
|
|
776
|
-
const currentItem = listboxItems[
|
|
785
|
+
const currentItem = listboxItems[index].nativeElement;
|
|
777
786
|
this.keyboardNavigationService.changeTabindex(previousItem, currentItem);
|
|
778
787
|
});
|
|
788
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
789
|
+
this.shouldFireFocusIn = true;
|
|
790
|
+
});
|
|
779
791
|
}
|
|
780
792
|
initSubscriptions(navService, hostEl, toolsRef) {
|
|
781
793
|
this.subs.add(navService.onShiftSelectedItem.subscribe((actionToPerform) => this.performAction(actionToPerform)));
|
|
@@ -785,14 +797,15 @@ class ListBoxComponent {
|
|
|
785
797
|
this.subs.add(navService.onDeleteEvent.subscribe((index) => this.onDeleteEvent(index, navService)));
|
|
786
798
|
this.subs.add(navService.onMoveSelectedItem.subscribe((dir) => this.performAction(dir)));
|
|
787
799
|
this.subs.add(this.renderer.listen(hostEl, 'keydown', (event) => navService.onKeyDown(event, toolsRef, this.selectedTools, this.childListbox, this.parentListbox, this.listboxItems.toArray())));
|
|
788
|
-
this.subs.add(navService.onSelectionChange.subscribe((
|
|
800
|
+
this.subs.add(navService.onSelectionChange.subscribe((indexes) => {
|
|
801
|
+
const { prevIndex, index } = indexes;
|
|
789
802
|
this.selectionService.selectedIndex = index;
|
|
790
|
-
this.selectionChange.next({ index, prevIndex
|
|
803
|
+
this.selectionChange.next({ index, prevIndex });
|
|
791
804
|
}));
|
|
792
805
|
}
|
|
793
806
|
onFocusIn(event) {
|
|
794
807
|
const navService = this.keyboardNavigationService;
|
|
795
|
-
if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex) {
|
|
808
|
+
if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex && this.shouldFireFocusIn) {
|
|
796
809
|
const items = this.listboxItems.toArray();
|
|
797
810
|
const index = items.findIndex(elem => elem.nativeElement === event.target);
|
|
798
811
|
this.selectionService.selectedIndex = index;
|
|
@@ -1185,6 +1198,8 @@ class DataBindingDirective {
|
|
|
1185
1198
|
return;
|
|
1186
1199
|
}
|
|
1187
1200
|
const newIndex = dir === 'up' ? index - 1 : index + 1;
|
|
1201
|
+
const navigation = this.selectedBox.keyboardNavigationService;
|
|
1202
|
+
navigation.focusedListboxItemIndex = navigation.selectedListboxItemIndex = newIndex;
|
|
1188
1203
|
[this.selectedBox.data[newIndex], this.selectedBox.data[index]] = [this.selectedBox.data[index], this.selectedBox.data[newIndex]];
|
|
1189
1204
|
this.selectedBox.selectionService.select(newIndex);
|
|
1190
1205
|
}
|
|
@@ -6,6 +6,7 @@ import { ElementRef, EventEmitter, NgZone, Renderer2 } from "@angular/core";
|
|
|
6
6
|
import { Button } from "@progress/kendo-angular-buttons";
|
|
7
7
|
import { ListBoxComponent } from "./listbox.component";
|
|
8
8
|
import { ActionName, Tool } from "./toolbar";
|
|
9
|
+
import { ListBoxSelectionEvent } from "./selection.service";
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
/**
|
|
11
12
|
* @hidden
|
|
@@ -17,13 +18,13 @@ export declare class KeyboardNavigationService {
|
|
|
17
18
|
focusedListboxItemIndex: number;
|
|
18
19
|
focusedToolIndex: number;
|
|
19
20
|
onDeleteEvent: EventEmitter<number>;
|
|
20
|
-
onSelectionChange: EventEmitter<number>;
|
|
21
21
|
onMoveSelectedItem: EventEmitter<string>;
|
|
22
22
|
onTransferAllEvent: EventEmitter<ActionName>;
|
|
23
23
|
onShiftSelectedItem: EventEmitter<ActionName>;
|
|
24
|
+
onSelectionChange: EventEmitter<ListBoxSelectionEvent>;
|
|
24
25
|
constructor(renderer: Renderer2, zone: NgZone);
|
|
25
26
|
onKeyDown(event: any, toolsRef: Array<Button>, toolbar: Tool[], childListbox: ListBoxComponent, parentListbox: ListBoxComponent, listboxItems: Array<ElementRef>): void;
|
|
26
|
-
changeTabindex(previousItem: HTMLElement, currentItem: HTMLElement): void;
|
|
27
|
+
changeTabindex(previousItem: HTMLElement, currentItem: HTMLElement, shouldBlur?: boolean): void;
|
|
27
28
|
private handleToolbarArrows;
|
|
28
29
|
private onSpaceKey;
|
|
29
30
|
private onArrowUpOrDown;
|
package/listbox.component.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ export declare class ListBoxComponent implements OnInit, AfterViewInit, OnDestro
|
|
|
136
136
|
private localizationSubscription;
|
|
137
137
|
private _size;
|
|
138
138
|
private subs;
|
|
139
|
+
private shouldFireFocusIn;
|
|
139
140
|
constructor(keyboardNavigationService: KeyboardNavigationService, selectionService: ListBoxSelectionService, hostElement: ElementRef, renderer: Renderer2, zone: NgZone, localization: LocalizationService);
|
|
140
141
|
ngOnInit(): void;
|
|
141
142
|
ngAfterViewInit(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-angular-listbox",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.1-develop.1",
|
|
4
4
|
"description": "Kendo UI for Angular ListBox",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Progress",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"@angular/core": "13 - 16",
|
|
24
24
|
"@angular/platform-browser": "13 - 16",
|
|
25
25
|
"@progress/kendo-licensing": "^1.0.2",
|
|
26
|
-
"@progress/kendo-angular-buttons": "13.0.
|
|
27
|
-
"@progress/kendo-angular-common": "13.0.
|
|
28
|
-
"@progress/kendo-angular-popup": "13.0.
|
|
26
|
+
"@progress/kendo-angular-buttons": "13.0.1-develop.1",
|
|
27
|
+
"@progress/kendo-angular-common": "13.0.1-develop.1",
|
|
28
|
+
"@progress/kendo-angular-popup": "13.0.1-develop.1",
|
|
29
29
|
"rxjs": "^6.5.3 || ^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"tslib": "^2.3.1",
|
|
33
|
-
"@progress/kendo-angular-schematics": "13.0.
|
|
33
|
+
"@progress/kendo-angular-schematics": "13.0.1-develop.1",
|
|
34
34
|
"@progress/kendo-common": "^0.2.2"
|
|
35
35
|
},
|
|
36
36
|
"schematics": "./schematics/collection.json",
|
|
@@ -6,11 +6,11 @@ function default_1(options) {
|
|
|
6
6
|
// Additional dependencies to install.
|
|
7
7
|
// See https://github.com/telerik/kendo-schematics/issues/28
|
|
8
8
|
peerDependencies: {
|
|
9
|
-
'@progress/kendo-angular-buttons': '13.0.
|
|
10
|
-
'@progress/kendo-angular-common': '13.0.
|
|
11
|
-
'@progress/kendo-angular-l10n': '13.0.
|
|
9
|
+
'@progress/kendo-angular-buttons': '13.0.1-develop.1',
|
|
10
|
+
'@progress/kendo-angular-common': '13.0.1-develop.1',
|
|
11
|
+
'@progress/kendo-angular-l10n': '13.0.1-develop.1',
|
|
12
12
|
// Peer of kendo-angular-buttons
|
|
13
|
-
'@progress/kendo-angular-popup': '13.0.
|
|
13
|
+
'@progress/kendo-angular-popup': '13.0.1-develop.1'
|
|
14
14
|
} });
|
|
15
15
|
return (0, schematics_1.externalSchematic)('@progress/kendo-angular-schematics', 'ng-add', finalOptions);
|
|
16
16
|
}
|