@progress/kendo-angular-listbox 12.0.1-develop.3 → 12.0.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 +1 -2
- package/esm2020/keyboard-navigation.service.mjs +69 -51
- package/esm2020/listbox.component.mjs +32 -45
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/selection.service.mjs +2 -2
- package/fesm2015/progress-kendo-angular-listbox.mjs +112 -102
- package/fesm2020/progress-kendo-angular-listbox.mjs +106 -102
- package/keyboard-navigation.service.d.ts +3 -4
- package/listbox.component.d.ts +5 -9
- package/package.json +5 -5
- package/schematics/ngAdd/index.js +4 -4
- package/selection.service.d.ts +1 -1
|
@@ -101,9 +101,8 @@ export class DataBindingDirective {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
const newIndex = dir === 'up' ? index - 1 : index + 1;
|
|
104
|
-
// ES6 Destructuring swap
|
|
105
104
|
[this.selectedBox.data[newIndex], this.selectedBox.data[index]] = [this.selectedBox.data[index], this.selectedBox.data[newIndex]];
|
|
106
|
-
this.selectedBox.selectionService.select(newIndex
|
|
105
|
+
this.selectedBox.selectionService.select(newIndex);
|
|
107
106
|
}
|
|
108
107
|
removeItem() {
|
|
109
108
|
const index = this.selectedBox.selectedIndex;
|
|
@@ -24,7 +24,7 @@ export class KeyboardNavigationService {
|
|
|
24
24
|
this.onTransferAllEvent = new EventEmitter();
|
|
25
25
|
this.onShiftSelectedItem = new EventEmitter();
|
|
26
26
|
}
|
|
27
|
-
onKeyDown(event, toolsRef, toolbar, childListbox, parentListbox) {
|
|
27
|
+
onKeyDown(event, toolsRef, toolbar, childListbox, parentListbox, listboxItems) {
|
|
28
28
|
const target = event.target;
|
|
29
29
|
const keyCode = event.keyCode;
|
|
30
30
|
const ctrlOrMetaKey = event.ctrlKey || event.metaKey;
|
|
@@ -46,29 +46,24 @@ export class KeyboardNavigationService {
|
|
|
46
46
|
this.onDeleteEvent.emit(this.selectedListboxItemIndex);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
const isTargetListboxItem =
|
|
49
|
+
const isTargetListboxItem = listboxItems.find(elem => elem.nativeElement === target);
|
|
50
50
|
if (isTargetListboxItem) {
|
|
51
51
|
let isTransferToolVisible;
|
|
52
52
|
if (activeToolbar) {
|
|
53
53
|
isTransferToolVisible = activeToolbar.some(tool => tool.name.startsWith('transfer'));
|
|
54
54
|
}
|
|
55
55
|
if ((keyCode === Keys.ArrowRight || keyCode === Keys.ArrowLeft) && ctrlOrMetaKey && isTransferToolVisible) {
|
|
56
|
-
this.onArrowLeftOrRight(keyCode, parentListbox, childListbox, event);
|
|
56
|
+
this.onArrowLeftOrRight(keyCode, parentListbox, childListbox, event, listboxItems);
|
|
57
57
|
}
|
|
58
58
|
else if ((keyCode === Keys.ArrowUp || keyCode === Keys.ArrowDown)) {
|
|
59
|
-
this.onArrowUpOrDown(keyCode, ctrlOrMetaKey, event, activeToolbar);
|
|
59
|
+
this.onArrowUpOrDown(keyCode, ctrlOrMetaKey, event, activeToolbar, listboxItems);
|
|
60
60
|
}
|
|
61
61
|
else if ((event.metaKey && keyCode === Keys.Enter) || (event.ctrlKey && keyCode === Keys.Space)) {
|
|
62
|
-
|
|
63
|
-
event.preventDefault();
|
|
64
|
-
this.onSelectChange();
|
|
62
|
+
this.onSelectChange(event, listboxItems);
|
|
65
63
|
}
|
|
66
64
|
else if (keyCode === Keys.Space) {
|
|
67
65
|
if (this.selectedListboxItemIndex !== this.focusedListboxItemIndex) {
|
|
68
|
-
|
|
69
|
-
this.changeTabindex(items[this.selectedListboxItemIndex], items[this.focusedListboxItemIndex]);
|
|
70
|
-
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
71
|
-
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
66
|
+
this.onSpaceKey(event, listboxItems);
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
}
|
|
@@ -84,9 +79,6 @@ export class KeyboardNavigationService {
|
|
|
84
79
|
currentItem.focus();
|
|
85
80
|
}
|
|
86
81
|
}
|
|
87
|
-
onFocusIn() {
|
|
88
|
-
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
89
|
-
}
|
|
90
82
|
handleToolbarArrows(toolsRef, dir) {
|
|
91
83
|
const topReached = dir === 'up' && this.focusedToolIndex <= 0;
|
|
92
84
|
const bottomReached = dir === 'down' && this.focusedToolIndex >= toolsRef.length - 1;
|
|
@@ -99,7 +91,16 @@ export class KeyboardNavigationService {
|
|
|
99
91
|
const currentItem = toolsRef[this.focusedToolIndex].element;
|
|
100
92
|
this.changeTabindex(prevItem, currentItem);
|
|
101
93
|
}
|
|
102
|
-
|
|
94
|
+
onSpaceKey(event, listboxItems) {
|
|
95
|
+
event.stopImmediatePropagation();
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
const previousItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
98
|
+
const currentItem = listboxItems[this.focusedListboxItemIndex]?.nativeElement;
|
|
99
|
+
this.changeTabindex(previousItem, currentItem);
|
|
100
|
+
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
101
|
+
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
102
|
+
}
|
|
103
|
+
onArrowUpOrDown(keyCode, ctrlOrMetaKey, event, activeToolbar, listboxItems) {
|
|
103
104
|
event.preventDefault();
|
|
104
105
|
const dir = keyCode === Keys.ArrowUp ? 'moveUp' : 'moveDown';
|
|
105
106
|
if (ctrlOrMetaKey) {
|
|
@@ -111,31 +112,35 @@ export class KeyboardNavigationService {
|
|
|
111
112
|
this.onMoveSelectedItem.emit(dir);
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
114
|
-
this.changeFocusedItem(dir);
|
|
115
|
+
this.changeFocusedItem(dir, listboxItems);
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
117
|
-
dir === 'moveUp' ? this.onArrowUp() : this.onArrowDown();
|
|
118
|
+
dir === 'moveUp' ? this.onArrowUp(listboxItems) : this.onArrowDown(listboxItems);
|
|
118
119
|
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
119
120
|
this.focusedListboxItemIndex = this.selectedListboxItemIndex;
|
|
120
121
|
}
|
|
121
|
-
onArrowLeftOrRight(keyCode, parentListbox, childListbox, event) {
|
|
122
|
+
onArrowLeftOrRight(keyCode, parentListbox, childListbox, event, listboxItems) {
|
|
122
123
|
event.preventDefault();
|
|
123
124
|
if (event.shiftKey) {
|
|
124
125
|
this.transferAllItems(keyCode, childListbox, parentListbox);
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
128
|
if (this.selectedListboxItemIndex >= 0) {
|
|
128
|
-
this.transferItem(keyCode, childListbox, parentListbox);
|
|
129
|
+
this.transferItem(keyCode, childListbox, parentListbox, listboxItems);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
|
-
onSelectChange() {
|
|
132
|
-
|
|
132
|
+
onSelectChange(event, listboxItems) {
|
|
133
|
+
event.stopImmediatePropagation();
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
const areIndexesEqual = this.selectedListboxItemIndex === this.focusedListboxItemIndex;
|
|
136
|
+
const canDeslect = (this.selectedListboxItemIndex || this.selectedListboxItemIndex === 0) && areIndexesEqual;
|
|
133
137
|
if (canDeslect) {
|
|
134
138
|
this.selectedListboxItemIndex = null;
|
|
135
139
|
}
|
|
136
140
|
else {
|
|
137
|
-
const
|
|
138
|
-
|
|
141
|
+
const previousItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
142
|
+
const currentItem = listboxItems[this.focusedListboxItemIndex]?.nativeElement;
|
|
143
|
+
this.changeTabindex(previousItem, currentItem);
|
|
139
144
|
this.selectedListboxItemIndex = this.focusedListboxItemIndex;
|
|
140
145
|
}
|
|
141
146
|
this.onSelectionChange.emit(this.selectedListboxItemIndex);
|
|
@@ -150,48 +155,59 @@ export class KeyboardNavigationService {
|
|
|
150
155
|
}
|
|
151
156
|
}
|
|
152
157
|
else {
|
|
153
|
-
tools[0]
|
|
158
|
+
tools[0]?.element.focus();
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
161
|
transferAllItems(keyCode, childListbox, parentListbox) {
|
|
157
162
|
const isArrowRight = keyCode === Keys.ArrowRight;
|
|
158
163
|
const actionToPerform = isArrowRight ? 'transferAllTo' : 'transferAllFrom';
|
|
159
164
|
this.onTransferAllEvent.emit(actionToPerform);
|
|
165
|
+
const adjustTabindex = (items) => {
|
|
166
|
+
items.forEach(item => {
|
|
167
|
+
if (item.nativeElement.getAttribute('tabindex') === '0') {
|
|
168
|
+
this.changeTabindex(item.nativeElement, null);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
160
172
|
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
161
173
|
const childListboxNav = childListbox?.keyboardNavigationService || parentListbox?.childListbox.keyboardNavigationService;
|
|
162
174
|
let currentItem;
|
|
163
175
|
if (isArrowRight) {
|
|
164
176
|
if (childListbox) {
|
|
165
|
-
const
|
|
166
|
-
|
|
177
|
+
const childListBoxItems = childListbox.listboxItems.toArray();
|
|
178
|
+
const childListboxItemsLength = childListBoxItems.length - 1;
|
|
179
|
+
currentItem = childListBoxItems[childListboxItemsLength].nativeElement;
|
|
167
180
|
childListboxNav.focusedListboxItemIndex = childListboxItemsLength;
|
|
168
181
|
childListboxNav.selectedListboxItemIndex = childListboxItemsLength;
|
|
169
182
|
this.focusedListboxItemIndex = 0;
|
|
170
183
|
this.selectedListboxItemIndex = 0;
|
|
184
|
+
adjustTabindex(childListBoxItems);
|
|
171
185
|
}
|
|
172
186
|
}
|
|
173
187
|
else {
|
|
174
188
|
if (parentListbox) {
|
|
175
189
|
const parentListboxNav = parentListbox.keyboardNavigationService;
|
|
176
|
-
const
|
|
177
|
-
|
|
190
|
+
const parentListBoxItems = parentListbox.listboxItems.toArray();
|
|
191
|
+
const parentListboxItemsLength = parentListBoxItems.length - 1;
|
|
192
|
+
currentItem = parentListBoxItems[parentListboxItemsLength].nativeElement;
|
|
178
193
|
parentListboxNav.focusedListboxItemIndex = parentListboxItemsLength;
|
|
179
194
|
parentListboxNav.selectedListboxItemIndex = parentListboxItemsLength;
|
|
180
195
|
childListboxNav.focusedListboxItemIndex = 0;
|
|
181
196
|
childListboxNav.selectedListboxItemIndex = 0;
|
|
197
|
+
adjustTabindex(parentListBoxItems);
|
|
182
198
|
}
|
|
183
199
|
}
|
|
184
200
|
this.changeTabindex(null, currentItem);
|
|
185
201
|
});
|
|
186
202
|
}
|
|
187
|
-
transferItem(keyCode, childListbox, parentListbox) {
|
|
203
|
+
transferItem(keyCode, childListbox, parentListbox, listboxItems) {
|
|
188
204
|
const isArrowRight = keyCode === Keys.ArrowRight;
|
|
189
205
|
const actionToPerform = isArrowRight ? 'transferFrom' : 'transferTo';
|
|
190
206
|
this.onShiftSelectedItem.emit(actionToPerform);
|
|
191
207
|
const adjustTabindex = (items, firstItem, currentItem) => {
|
|
192
|
-
items.
|
|
193
|
-
if (item.getAttribute('tabindex') === '0') {
|
|
194
|
-
this.changeTabindex(item, firstItem);
|
|
208
|
+
items.forEach(item => {
|
|
209
|
+
if (item.nativeElement.getAttribute('tabindex') === '0') {
|
|
210
|
+
this.changeTabindex(item.nativeElement, firstItem);
|
|
195
211
|
}
|
|
196
212
|
});
|
|
197
213
|
this.changeTabindex(null, currentItem);
|
|
@@ -199,58 +215,60 @@ export class KeyboardNavigationService {
|
|
|
199
215
|
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
200
216
|
if (isArrowRight) {
|
|
201
217
|
if (childListbox) {
|
|
218
|
+
const childListBoxItems = childListbox.listboxItems.toArray();
|
|
202
219
|
const childListboxNav = childListbox.keyboardNavigationService;
|
|
203
|
-
const childListboxItemsLength =
|
|
204
|
-
const
|
|
205
|
-
const
|
|
220
|
+
const childListboxItemsLength = childListbox.listboxItems.length - 1;
|
|
221
|
+
const parentListboxFirstItem = listboxItems[0].nativeElement;
|
|
222
|
+
const currentItem = childListBoxItems[childListboxItemsLength].nativeElement;
|
|
206
223
|
childListboxNav.focusedListboxItemIndex = childListboxItemsLength;
|
|
207
224
|
childListboxNav.selectedListboxItemIndex = childListboxItemsLength;
|
|
208
225
|
this.focusedListboxItemIndex = 0;
|
|
209
226
|
this.selectedListboxItemIndex = 0;
|
|
210
|
-
adjustTabindex(
|
|
227
|
+
adjustTabindex(childListBoxItems, parentListboxFirstItem, currentItem);
|
|
211
228
|
}
|
|
212
229
|
}
|
|
213
230
|
else {
|
|
214
231
|
if (parentListbox) {
|
|
232
|
+
const parentListBoxItems = parentListbox.listboxItems.toArray();
|
|
215
233
|
const childListboxNav = parentListbox.childListbox.keyboardNavigationService;
|
|
216
234
|
const parentListboxNav = parentListbox.keyboardNavigationService;
|
|
217
|
-
const parentListboxItemsLength =
|
|
218
|
-
const
|
|
219
|
-
const
|
|
235
|
+
const parentListboxItemsLength = parentListbox.listboxItems.length - 1;
|
|
236
|
+
const childListboxFirstItem = listboxItems[0].nativeElement;
|
|
237
|
+
const currentItem = parentListBoxItems[parentListboxItemsLength].nativeElement;
|
|
220
238
|
parentListboxNav.focusedListboxItemIndex = parentListboxItemsLength;
|
|
221
239
|
parentListboxNav.selectedListboxItemIndex = parentListboxItemsLength;
|
|
222
240
|
childListboxNav.focusedListboxItemIndex = 0;
|
|
223
241
|
childListboxNav.selectedListboxItemIndex = 0;
|
|
224
|
-
adjustTabindex(
|
|
242
|
+
adjustTabindex(parentListBoxItems, childListboxFirstItem, currentItem);
|
|
225
243
|
}
|
|
226
244
|
}
|
|
227
245
|
});
|
|
228
246
|
}
|
|
229
|
-
changeFocusedItem(dir) {
|
|
230
|
-
|
|
247
|
+
changeFocusedItem(dir, listboxItems) {
|
|
248
|
+
listboxItems[this.focusedListboxItemIndex].nativeElement.blur();
|
|
231
249
|
if (this.focusedListboxItemIndex > 0 && dir === 'moveUp') {
|
|
232
250
|
this.focusedListboxItemIndex -= 1;
|
|
233
251
|
}
|
|
234
|
-
else if (this.focusedListboxItemIndex <
|
|
252
|
+
else if (this.focusedListboxItemIndex < listboxItems.length - 1 && dir === 'moveDown') {
|
|
235
253
|
this.focusedListboxItemIndex += 1;
|
|
236
254
|
}
|
|
237
|
-
|
|
255
|
+
listboxItems[this.focusedListboxItemIndex].nativeElement.focus();
|
|
238
256
|
}
|
|
239
|
-
onArrowDown() {
|
|
240
|
-
if (this.selectedListboxItemIndex <
|
|
257
|
+
onArrowDown(listboxItems) {
|
|
258
|
+
if (this.selectedListboxItemIndex < listboxItems.length - 1) {
|
|
241
259
|
const offset = this.selectedListboxItemIndex ? this.selectedListboxItemIndex : this.focusedListboxItemIndex;
|
|
242
260
|
this.selectedListboxItemIndex = offset + 1;
|
|
243
|
-
const previousItem =
|
|
244
|
-
const currentItem =
|
|
261
|
+
const previousItem = listboxItems[this.selectedListboxItemIndex - 1]?.nativeElement;
|
|
262
|
+
const currentItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
245
263
|
this.changeTabindex(previousItem, currentItem);
|
|
246
264
|
}
|
|
247
265
|
}
|
|
248
|
-
onArrowUp() {
|
|
266
|
+
onArrowUp(listboxItems) {
|
|
249
267
|
if (this.selectedListboxItemIndex > 0 || this.focusedListboxItemIndex > 0) {
|
|
250
268
|
const offset = this.selectedListboxItemIndex ? this.selectedListboxItemIndex : this.focusedListboxItemIndex;
|
|
251
269
|
this.selectedListboxItemIndex = offset - 1;
|
|
252
|
-
const previousItem =
|
|
253
|
-
const currentItem =
|
|
270
|
+
const previousItem = listboxItems[this.selectedListboxItemIndex + 1]?.nativeElement;
|
|
271
|
+
const currentItem = listboxItems[this.selectedListboxItemIndex]?.nativeElement;
|
|
254
272
|
this.changeTabindex(previousItem, currentItem);
|
|
255
273
|
}
|
|
256
274
|
}
|
|
@@ -143,7 +143,6 @@ export class ListBoxComponent {
|
|
|
143
143
|
const toolsRef = this.tools.toArray();
|
|
144
144
|
const hostEl = this.hostElement.nativeElement;
|
|
145
145
|
const navService = this.keyboardNavigationService;
|
|
146
|
-
navService.listboxItems = Array.from(this.listboxElement.nativeElement.querySelectorAll('li.k-list-item'));
|
|
147
146
|
this.setIds();
|
|
148
147
|
this.initSubscriptions(navService, hostEl, toolsRef);
|
|
149
148
|
}
|
|
@@ -210,58 +209,41 @@ export class ListBoxComponent {
|
|
|
210
209
|
}
|
|
211
210
|
return fieldAccessor(dataItem, this.textField);
|
|
212
211
|
}
|
|
213
|
-
|
|
214
|
-
* @hidden
|
|
215
|
-
*/
|
|
216
|
-
updateListboxItems() {
|
|
217
|
-
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
218
|
-
this.keyboardNavigationService.listboxItems = Array.from(this.listboxElement.nativeElement.querySelectorAll('li.k-list-item'));
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* @hidden
|
|
223
|
-
*/
|
|
224
|
-
swapItems(firstItemIndex, secondItemIndex) {
|
|
225
|
-
const listboxItems = this.keyboardNavigationService.listboxItems;
|
|
226
|
-
[listboxItems[firstItemIndex], listboxItems[secondItemIndex]] = [
|
|
227
|
-
listboxItems[secondItemIndex],
|
|
228
|
-
listboxItems[firstItemIndex],
|
|
229
|
-
];
|
|
230
|
-
}
|
|
231
|
-
onClickEvent(listboxItems, prevIndex, currentIndex, dir) {
|
|
232
|
-
this.selectionChange.next(currentIndex);
|
|
212
|
+
onClickEvent(prevIndex, currentIndex) {
|
|
233
213
|
this.keyboardNavigationService.selectedListboxItemIndex = currentIndex;
|
|
234
214
|
this.keyboardNavigationService.focusedListboxItemIndex = currentIndex;
|
|
215
|
+
this.selectionChange.next(currentIndex);
|
|
235
216
|
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
const currentItem = listboxItems[currentIndex];
|
|
217
|
+
const listboxItems = this.listboxItems.toArray();
|
|
218
|
+
const previousItem = prevIndex ? listboxItems[prevIndex].nativeElement : listboxItems[0].nativeElement;
|
|
219
|
+
const currentItem = listboxItems[currentIndex].nativeElement;
|
|
240
220
|
this.keyboardNavigationService.changeTabindex(previousItem, currentItem);
|
|
241
221
|
});
|
|
242
222
|
}
|
|
243
223
|
initSubscriptions(navService, hostEl, toolsRef) {
|
|
224
|
+
this.subs.add(navService.onShiftSelectedItem.subscribe((actionToPerform) => this.performAction(actionToPerform)));
|
|
225
|
+
this.subs.add(navService.onTransferAllEvent.subscribe((actionToPerform) => this.performAction(actionToPerform)));
|
|
226
|
+
this.subs.add(this.renderer.listen(this.listboxElement.nativeElement, 'focusin', (event) => this.onFocusIn(event)));
|
|
227
|
+
this.subs.add(this.selectionService.onSelect.subscribe((e) => this.onClickEvent(e.prevIndex, e.index)));
|
|
244
228
|
this.subs.add(navService.onDeleteEvent.subscribe((index) => this.onDeleteEvent(index, navService)));
|
|
245
|
-
this.subs.add(this.renderer.listen(hostEl, 'keydown', (event) => navService.onKeyDown(event, toolsRef, this.selectedTools, this.childListbox, this.parentListbox)));
|
|
246
|
-
this.subs.add(this.renderer.listen(this.listboxElement.nativeElement, 'focusin', () => navService.onFocusIn()));
|
|
247
|
-
this.subs.add(navService.onShiftSelectedItem.subscribe((actionToPerform) => this.onShiftItems(actionToPerform)));
|
|
248
|
-
this.subs.add(navService.onTransferAllEvent.subscribe((actionToPerform) => this.onShiftItems(actionToPerform)));
|
|
249
229
|
this.subs.add(navService.onMoveSelectedItem.subscribe((dir) => this.performAction(dir)));
|
|
250
|
-
this.subs.add(this.
|
|
230
|
+
this.subs.add(this.renderer.listen(hostEl, 'keydown', (event) => navService.onKeyDown(event, toolsRef, this.selectedTools, this.childListbox, this.parentListbox, this.listboxItems.toArray())));
|
|
251
231
|
this.subs.add(navService.onSelectionChange.subscribe((index) => {
|
|
252
232
|
this.selectionService.selectedIndex = index;
|
|
253
233
|
this.selectionChange.next({ index, prevIndex: null });
|
|
254
234
|
}));
|
|
255
235
|
}
|
|
256
|
-
|
|
257
|
-
this.
|
|
258
|
-
if (
|
|
259
|
-
this.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
236
|
+
onFocusIn(event) {
|
|
237
|
+
const navService = this.keyboardNavigationService;
|
|
238
|
+
if (navService.focusedListboxItemIndex === navService.selectedListboxItemIndex) {
|
|
239
|
+
const items = this.listboxItems.toArray();
|
|
240
|
+
const index = items.findIndex(elem => elem.nativeElement === event.target);
|
|
241
|
+
this.selectionService.selectedIndex = index;
|
|
242
|
+
this.selectionChange.next({ index, prevIndex: null });
|
|
243
|
+
const previousItem = items[navService.selectedListboxItemIndex]?.nativeElement;
|
|
244
|
+
const currentItem = items[index]?.nativeElement;
|
|
245
|
+
this.renderer.setAttribute(previousItem, 'tabindex', '-1');
|
|
246
|
+
this.renderer.setAttribute(currentItem, 'tabindex', '0');
|
|
265
247
|
}
|
|
266
248
|
}
|
|
267
249
|
setIds() {
|
|
@@ -298,13 +280,13 @@ export class ListBoxComponent {
|
|
|
298
280
|
onDeleteEvent(index, navService) {
|
|
299
281
|
this.selectionService.selectedIndex = index;
|
|
300
282
|
this.performAction('remove');
|
|
301
|
-
this.
|
|
302
|
-
const setIndex = index + 1 ===
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
navService.changeTabindex(null, navService.listboxItems[setIndex['tabindex']]);
|
|
283
|
+
const listboxItems = this.listboxItems.toArray();
|
|
284
|
+
const setIndex = index + 1 === listboxItems.length ?
|
|
285
|
+
{ index: index - 1, tabindex: index - 1 } : { index, tabindex: index + 1 };
|
|
286
|
+
navService.changeTabindex(null, listboxItems[setIndex['tabindex']]?.nativeElement);
|
|
306
287
|
this.selectionChange.next({ index: setIndex['index'], prevIndex: null });
|
|
307
288
|
navService.selectedListboxItemIndex = setIndex['index'];
|
|
289
|
+
navService.focusedListboxItemIndex = setIndex['index'];
|
|
308
290
|
navService.focusedListboxItem = setIndex['index'];
|
|
309
291
|
this.selectionService.selectedIndex = setIndex['index'];
|
|
310
292
|
}
|
|
@@ -331,7 +313,7 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
|
|
|
331
313
|
provide: L10N_PREFIX,
|
|
332
314
|
useValue: 'kendo.listbox'
|
|
333
315
|
},
|
|
334
|
-
], queries: [{ propertyName: "itemTemplate", first: true, predicate: ItemTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "listboxElement", first: true, predicate: ["listbox"], descendants: true }, { propertyName: "toolbarElement", first: true, predicate: ["toolbar"], descendants: true }, { propertyName: "tools", predicate: ["tools"], descendants: true }], ngImport: i0, template: `
|
|
316
|
+
], queries: [{ propertyName: "itemTemplate", first: true, predicate: ItemTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "listboxElement", first: true, predicate: ["listbox"], descendants: true }, { propertyName: "toolbarElement", first: true, predicate: ["toolbar"], descendants: true }, { propertyName: "listboxItems", predicate: ["listboxItems"], descendants: true }, { propertyName: "tools", predicate: ["tools"], descendants: true }], ngImport: i0, template: `
|
|
335
317
|
<ng-container kendoListBoxLocalizedMessages
|
|
336
318
|
i18n-moveUp="kendo.listbox.moveUp|The title of the Move Up button"
|
|
337
319
|
moveUp="Move Up"
|
|
@@ -387,6 +369,7 @@ ListBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
|
|
|
387
369
|
[attr.aria-multiselectable]="false"
|
|
388
370
|
>
|
|
389
371
|
<li
|
|
372
|
+
#listboxItems
|
|
390
373
|
*ngFor="let item of data; let i = index"
|
|
391
374
|
kendoListBoxItemSelectable
|
|
392
375
|
class="k-list-item"
|
|
@@ -482,6 +465,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
482
465
|
[attr.aria-multiselectable]="false"
|
|
483
466
|
>
|
|
484
467
|
<li
|
|
468
|
+
#listboxItems
|
|
485
469
|
*ngFor="let item of data; let i = index"
|
|
486
470
|
kendoListBoxItemSelectable
|
|
487
471
|
class="k-list-item"
|
|
@@ -521,6 +505,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
521
505
|
}], listboxElement: [{
|
|
522
506
|
type: ViewChild,
|
|
523
507
|
args: ['listbox']
|
|
508
|
+
}], listboxItems: [{
|
|
509
|
+
type: ViewChildren,
|
|
510
|
+
args: ['listboxItems']
|
|
524
511
|
}], toolbarElement: [{
|
|
525
512
|
type: ViewChild,
|
|
526
513
|
args: ['toolbar']
|
|
@@ -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: '12.0.1
|
|
12
|
+
publishDate: 1683189408,
|
|
13
|
+
version: '12.0.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
|
};
|
|
@@ -12,8 +12,8 @@ export class ListBoxSelectionService {
|
|
|
12
12
|
this.onSelect = new EventEmitter();
|
|
13
13
|
this.selectedIndex = null;
|
|
14
14
|
}
|
|
15
|
-
select(index
|
|
16
|
-
this.onSelect.next({ index: index, prevIndex: this.selectedIndex
|
|
15
|
+
select(index) {
|
|
16
|
+
this.onSelect.next({ index: index, prevIndex: this.selectedIndex });
|
|
17
17
|
this.selectedIndex = index;
|
|
18
18
|
}
|
|
19
19
|
isSelected(index) {
|