@progress/kendo-angular-dropdowns 7.1.0-dev.202208301423 → 7.2.0-dev.202209131018

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.
@@ -29,7 +29,7 @@ const packageMetadata = {
29
29
  name: '@progress/kendo-angular-dropdowns',
30
30
  productName: 'Kendo UI for Angular',
31
31
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
32
- publishDate: 1661869333,
32
+ publishDate: 1663064236,
33
33
  version: '',
34
34
  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'
35
35
  };
@@ -354,6 +354,10 @@ const getFillModeClass = (component, fillMode) => {
354
354
  };
355
355
  return FILLMODE_CLASSES[fillMode];
356
356
  };
357
+ /**
358
+ * @hidden
359
+ */
360
+ const filterAndMap = (arr, predicate, mapper) => arr.reduce((acc, curr) => predicate(curr) ? [...acc, mapper(curr)] : acc, []);
357
361
 
358
362
  /**
359
363
  * @hidden
@@ -870,123 +874,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
870
874
  }]
871
875
  }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
872
876
 
873
- /**
874
- * @hidden
875
- */
876
- class SelectionService {
877
- constructor() {
878
- this.onSelect = new EventEmitter();
879
- this.onChange = new EventEmitter();
880
- this.onFocus = new EventEmitter();
881
- this.total = 0;
882
- this.selectedIndices = [];
883
- }
884
- getTotal() {
885
- return this.total;
886
- }
887
- isSelected(index) {
888
- return isPresent(this.selectedIndices.find(current => current === index));
889
- }
890
- isFocused(index) {
891
- return index === this.focused;
892
- }
893
- focus(index) {
894
- if (this.isFocused(index)) {
895
- return;
896
- }
897
- this.focused = index;
898
- this.onFocus.emit(index);
899
- }
900
- select(index) {
901
- if (this.isSelected(index)) {
902
- return;
903
- }
904
- this.selectedIndices = [index];
905
- this.focused = index;
906
- this.onSelect.emit({
907
- indices: [index],
908
- newSelection: isPresent(index)
909
- });
910
- }
911
- add(index) {
912
- if (this.isSelected(index)) {
913
- return;
914
- }
915
- this.selectedIndices.push(index);
916
- this.focused = index;
917
- this.onChange.emit({
918
- added: index,
919
- indices: this.selectedIndices.slice()
920
- });
921
- }
922
- unselect(index) {
923
- if (!this.isSelected(index)) {
924
- return;
925
- }
926
- const position = this.selectedIndices.indexOf(index);
927
- this.selectedIndices.splice(position, 1);
928
- this.focused = index;
929
- this.onChange.emit({
930
- indices: this.selectedIndices.slice(),
931
- removed: index
932
- });
933
- }
934
- change(index) {
935
- const newSelection = isPresent(index) && !this.isSelected(index);
936
- this.selectedIndices = [index];
937
- this.focused = index;
938
- this.onChange.emit({
939
- indices: [index],
940
- newSelection: newSelection
941
- });
942
- }
943
- resetSelection(index) {
944
- this.selectedIndices = index instanceof Array ? index : [index];
945
- this.focused = this.selectedIndices[this.selectedIndices.length - 1];
946
- }
947
- get selected() {
948
- return this.selectedIndices.slice();
949
- }
950
- get focused() {
951
- return this.focusedIndex;
952
- }
953
- set focused(index) {
954
- if (this.focusedIndex !== index) {
955
- this.focusedIndex = index;
956
- this.onFocus.emit(index);
957
- }
958
- }
959
- }
960
- SelectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
961
- SelectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectionService });
962
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectionService, decorators: [{
963
- type: Injectable
964
- }] });
965
-
966
- /**
967
- * @hidden
968
- */
969
- var NavigationAction;
970
- (function (NavigationAction) {
971
- // eslint-disable-next-line id-denylist
972
- NavigationAction[NavigationAction["Undefined"] = 0] = "Undefined";
973
- NavigationAction[NavigationAction["Open"] = 1] = "Open";
974
- NavigationAction[NavigationAction["Close"] = 2] = "Close";
975
- NavigationAction[NavigationAction["Enter"] = 3] = "Enter";
976
- NavigationAction[NavigationAction["Tab"] = 4] = "Tab";
977
- NavigationAction[NavigationAction["Esc"] = 5] = "Esc";
978
- NavigationAction[NavigationAction["Delete"] = 6] = "Delete";
979
- NavigationAction[NavigationAction["Backspace"] = 7] = "Backspace";
980
- NavigationAction[NavigationAction["Home"] = 8] = "Home";
981
- NavigationAction[NavigationAction["End"] = 9] = "End";
982
- NavigationAction[NavigationAction["Up"] = 10] = "Up";
983
- NavigationAction[NavigationAction["Down"] = 11] = "Down";
984
- NavigationAction[NavigationAction["Left"] = 12] = "Left";
985
- NavigationAction[NavigationAction["Right"] = 13] = "Right";
986
- NavigationAction[NavigationAction["PageDown"] = 14] = "PageDown";
987
- NavigationAction[NavigationAction["PageUp"] = 15] = "PageUp";
988
- })(NavigationAction || (NavigationAction = {}));
989
-
990
877
  /**
991
878
  * @hidden
992
879
  */
@@ -1160,6 +1047,16 @@ class DataService {
1160
1047
  }
1161
1048
  return this._flatData.find((item) => item.header && item.index === index);
1162
1049
  }
1050
+ /**
1051
+ * @hidden
1052
+ * Used to get all group items indices.
1053
+ */
1054
+ groupItemsIndices() {
1055
+ if (this.isGrouped) {
1056
+ return filterAndMap(this.data, item => item.header, mappedItem => mappedItem.index);
1057
+ }
1058
+ return [];
1059
+ }
1163
1060
  /**
1164
1061
  * @hidden
1165
1062
  * Used to get the field by which the data is grouped.
@@ -1255,6 +1152,190 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1255
1152
  type: Injectable
1256
1153
  }], ctorParameters: function () { return [{ type: DataService }]; } });
1257
1154
 
1155
+ /**
1156
+ * @hidden
1157
+ */
1158
+ class SelectionService {
1159
+ constructor(disabledItemsService) {
1160
+ this.disabledItemsService = disabledItemsService;
1161
+ this.onSelect = new EventEmitter();
1162
+ this.onChange = new EventEmitter();
1163
+ this.onFocus = new EventEmitter();
1164
+ this.total = 0;
1165
+ this.selectedIndices = [];
1166
+ this.indicesToBeRemoved = [];
1167
+ this.indicesToBeAdded = [];
1168
+ }
1169
+ getTotal() {
1170
+ return this.total;
1171
+ }
1172
+ isSelected(index) {
1173
+ return isPresent(this.selectedIndices.find(current => current === index));
1174
+ }
1175
+ isFocused(index) {
1176
+ return index === this.focused;
1177
+ }
1178
+ focus(index) {
1179
+ if (this.isFocused(index)) {
1180
+ return;
1181
+ }
1182
+ this.focused = index;
1183
+ this.onFocus.emit(index);
1184
+ }
1185
+ select(index) {
1186
+ if (this.isSelected(index)) {
1187
+ return;
1188
+ }
1189
+ this.selectedIndices = [index];
1190
+ this.focused = index;
1191
+ this.onSelect.emit({
1192
+ indices: [index],
1193
+ newSelection: isPresent(index)
1194
+ });
1195
+ }
1196
+ add(index, preventClosingPopup) {
1197
+ if (this.isSelected(index)) {
1198
+ return;
1199
+ }
1200
+ this.selectedIndices.push(index);
1201
+ this.focused = index;
1202
+ this.onChange.emit({
1203
+ added: index,
1204
+ indices: this.selectedIndices.slice(),
1205
+ preventClosingPopup: preventClosingPopup
1206
+ });
1207
+ }
1208
+ emitMultipleAddedRemoved() {
1209
+ this.onChange.emit({
1210
+ added: this.indicesToBeAdded,
1211
+ removed: this.indicesToBeRemoved,
1212
+ indices: this.selectedIndices.slice(),
1213
+ preventClosingPopup: true,
1214
+ isMultipleSelection: true
1215
+ });
1216
+ this.indicesToBeAdded = [];
1217
+ this.indicesToBeRemoved = [];
1218
+ }
1219
+ addMultiple(indices) {
1220
+ this.indicesToBeAdded = indices.slice();
1221
+ this.selectedIndices.push(...indices);
1222
+ }
1223
+ deselect(index, preventClosingPopup) {
1224
+ if (!this.isSelected(index)) {
1225
+ return;
1226
+ }
1227
+ const position = this.selectedIndices.indexOf(index);
1228
+ this.selectedIndices.splice(position, 1);
1229
+ this.focused = index;
1230
+ if (this.selected.length === 0) {
1231
+ this.lastClickedIndex = null;
1232
+ }
1233
+ this.onChange.emit({
1234
+ indices: this.selectedIndices.slice(),
1235
+ removed: index,
1236
+ preventClosingPopup: preventClosingPopup
1237
+ });
1238
+ }
1239
+ unselectMultiple(indices) {
1240
+ indices.forEach((index) => {
1241
+ const position = this.selectedIndices.indexOf(index);
1242
+ this.selectedIndices.splice(position, 1);
1243
+ });
1244
+ this.indicesToBeRemoved = indices.slice();
1245
+ }
1246
+ change(index) {
1247
+ const newSelection = isPresent(index) && !this.isSelected(index);
1248
+ this.selectedIndices = [index];
1249
+ this.focused = index;
1250
+ this.onChange.emit({
1251
+ indices: [index],
1252
+ newSelection: newSelection
1253
+ });
1254
+ }
1255
+ resetSelection(index) {
1256
+ this.selectedIndices = index instanceof Array ? index : [index];
1257
+ this.focused = this.selectedIndices[this.selectedIndices.length - 1];
1258
+ }
1259
+ get selected() {
1260
+ return this.selectedIndices.slice();
1261
+ }
1262
+ get focused() {
1263
+ return this.focusedIndex;
1264
+ }
1265
+ set focused(index) {
1266
+ if (this.focusedIndex !== index) {
1267
+ this.focusedIndex = index;
1268
+ this.onFocus.emit(index);
1269
+ }
1270
+ }
1271
+ selectFromTo(from, to) {
1272
+ let addedIndices = [];
1273
+ for (let i = from; i <= to; i++) {
1274
+ if (!this.isSelected(i) && !this.disabledItemsService.isIndexDisabled(i)) {
1275
+ addedIndices.push(i);
1276
+ }
1277
+ }
1278
+ this.addMultiple(addedIndices);
1279
+ }
1280
+ unselectFromTo(from, to) {
1281
+ let indicesToBeUnselected = [];
1282
+ for (let i = from; i >= to; i--) {
1283
+ if (this.isSelected(i) && !this.disabledItemsService.isIndexDisabled(i)) {
1284
+ indicesToBeUnselected.push(i);
1285
+ }
1286
+ }
1287
+ this.unselectMultiple(indicesToBeUnselected);
1288
+ }
1289
+ unselectNotNeededIndices(startOfSelection, endOfSelection, totalItems) {
1290
+ let indicesToBeUnselected = [];
1291
+ for (let i = 0; i < startOfSelection; i++) {
1292
+ if (this.isSelected(i)) {
1293
+ indicesToBeUnselected.push(i);
1294
+ }
1295
+ }
1296
+ for (let i = endOfSelection + 1; i < totalItems; i++) {
1297
+ if (this.isSelected(i)) {
1298
+ indicesToBeUnselected.push(i);
1299
+ }
1300
+ }
1301
+ this.unselectMultiple(indicesToBeUnselected);
1302
+ }
1303
+ }
1304
+ SelectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectionService, deps: [{ token: DisabledItemsService }], target: i0.ɵɵFactoryTarget.Injectable });
1305
+ SelectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectionService });
1306
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SelectionService, decorators: [{
1307
+ type: Injectable
1308
+ }], ctorParameters: function () { return [{ type: DisabledItemsService }]; } });
1309
+
1310
+ /**
1311
+ * @hidden
1312
+ */
1313
+ var NavigationAction;
1314
+ (function (NavigationAction) {
1315
+ // eslint-disable-next-line id-denylist
1316
+ NavigationAction[NavigationAction["Undefined"] = 0] = "Undefined";
1317
+ NavigationAction[NavigationAction["Open"] = 1] = "Open";
1318
+ NavigationAction[NavigationAction["Close"] = 2] = "Close";
1319
+ NavigationAction[NavigationAction["Enter"] = 3] = "Enter";
1320
+ NavigationAction[NavigationAction["Tab"] = 4] = "Tab";
1321
+ NavigationAction[NavigationAction["Esc"] = 5] = "Esc";
1322
+ NavigationAction[NavigationAction["Delete"] = 6] = "Delete";
1323
+ NavigationAction[NavigationAction["Backspace"] = 7] = "Backspace";
1324
+ NavigationAction[NavigationAction["Home"] = 8] = "Home";
1325
+ NavigationAction[NavigationAction["End"] = 9] = "End";
1326
+ NavigationAction[NavigationAction["Up"] = 10] = "Up";
1327
+ NavigationAction[NavigationAction["Down"] = 11] = "Down";
1328
+ NavigationAction[NavigationAction["Left"] = 12] = "Left";
1329
+ NavigationAction[NavigationAction["Right"] = 13] = "Right";
1330
+ NavigationAction[NavigationAction["PageDown"] = 14] = "PageDown";
1331
+ NavigationAction[NavigationAction["PageUp"] = 15] = "PageUp";
1332
+ NavigationAction[NavigationAction["SelectPrevious"] = 16] = "SelectPrevious";
1333
+ NavigationAction[NavigationAction["SelectNext"] = 17] = "SelectNext";
1334
+ NavigationAction[NavigationAction["SelectAll"] = 18] = "SelectAll";
1335
+ NavigationAction[NavigationAction["SelectAllToBeginning"] = 19] = "SelectAllToBeginning";
1336
+ NavigationAction[NavigationAction["SelectAllToEnd"] = 20] = "SelectAllToEnd";
1337
+ })(NavigationAction || (NavigationAction = {}));
1338
+
1258
1339
  const MIN_INDEX = 0;
1259
1340
  /**
1260
1341
  * @hidden
@@ -1290,10 +1371,17 @@ class NavigationService {
1290
1371
  this.end = new EventEmitter();
1291
1372
  this.pagedown = new EventEmitter();
1292
1373
  this.pageup = new EventEmitter();
1374
+ this.selectnext = new EventEmitter();
1375
+ this.selectprevious = new EventEmitter();
1376
+ this.selectall = new EventEmitter();
1377
+ this.selectalltobeginning = new EventEmitter();
1378
+ this.selectalltoend = new EventEmitter();
1293
1379
  }
1294
1380
  process(args) {
1295
1381
  const keyCode = args.originalEvent.keyCode;
1296
1382
  const altKey = args.originalEvent.altKey;
1383
+ const shiftKey = args.originalEvent.shiftKey;
1384
+ const ctrlKey = args.originalEvent.ctrlKey;
1297
1385
  let index;
1298
1386
  let action = NavigationAction.Undefined;
1299
1387
  if (altKey && keyCode === Keys.ArrowDown) {
@@ -1302,6 +1390,21 @@ class NavigationService {
1302
1390
  else if (altKey && keyCode === Keys.ArrowUp) {
1303
1391
  action = NavigationAction.Close;
1304
1392
  }
1393
+ else if (shiftKey && keyCode === Keys.ArrowUp) {
1394
+ action = NavigationAction.SelectPrevious;
1395
+ }
1396
+ else if (shiftKey && keyCode === Keys.ArrowDown) {
1397
+ action = NavigationAction.SelectNext;
1398
+ }
1399
+ else if (ctrlKey && keyCode === Keys.KeyA) {
1400
+ action = NavigationAction.SelectAll;
1401
+ }
1402
+ else if (ctrlKey && shiftKey && keyCode === Keys.Home) {
1403
+ action = NavigationAction.SelectAllToBeginning;
1404
+ }
1405
+ else if (ctrlKey && shiftKey && keyCode === Keys.End) {
1406
+ action = NavigationAction.SelectAllToEnd;
1407
+ }
1305
1408
  else if (keyCode === Keys.Enter) {
1306
1409
  action = NavigationAction.Enter;
1307
1410
  }
@@ -1562,12 +1665,13 @@ class SelectableDirective {
1562
1665
  }
1563
1666
  onClick(event) {
1564
1667
  event.stopPropagation();
1668
+ this.selectionService.lastClickedIndex = this.index;
1565
1669
  if (this.checkboxes.enabled && !this.checkboxes.checkOnClick) {
1566
1670
  return;
1567
1671
  }
1568
1672
  if (this.multipleSelection) {
1569
1673
  if (this.selectionService.isSelected(this.index)) {
1570
- this.selectionService.unselect(this.index);
1674
+ this.selectionService.deselect(this.index);
1571
1675
  }
1572
1676
  else {
1573
1677
  this.selectionService.add(this.index);
@@ -1737,7 +1841,7 @@ class ListComponent {
1737
1841
  this.selectionService.add(index);
1738
1842
  }
1739
1843
  if (!isChecked && this.selectionService.isSelected(index)) {
1740
- this.selectionService.unselect(index);
1844
+ this.selectionService.deselect(index);
1741
1845
  }
1742
1846
  }
1743
1847
  prepareClasses() {
@@ -3049,6 +3153,7 @@ class AutoCompleteComponent {
3049
3153
  this.escSubscription = this.navigationService.esc.subscribe(this.handleEscape.bind(this));
3050
3154
  this.scrollSubscription = merge(this.navigationService.pagedown, this.navigationService.pageup).subscribe((event) => {
3051
3155
  if (this.isOpen) {
3156
+ event.originalEvent.preventDefault();
3052
3157
  this.optionsList.scrollWithOnePage(NavigationAction[event.originalEvent.code]);
3053
3158
  }
3054
3159
  });
@@ -4172,6 +4277,7 @@ class ComboBoxComponent {
4172
4277
  this.subs.add(this.navigationService.close.subscribe(() => this.togglePopup(false)));
4173
4278
  this.subs.add(merge(this.navigationService.pagedown, this.navigationService.pageup).subscribe((event) => {
4174
4279
  if (this.isOpen) {
4280
+ event.originalEvent.preventDefault();
4175
4281
  this.optionsList.scrollWithOnePage(NavigationAction[event.originalEvent.code]);
4176
4282
  }
4177
4283
  }));
@@ -6139,6 +6245,7 @@ class DropDownListComponent {
6139
6245
  .subscribe((event) => this.selectionService.select(event.index)));
6140
6246
  this.subs.add(merge(this.navigationService.pagedown, this.navigationService.pageup).subscribe((event) => {
6141
6247
  if (this.isOpen) {
6248
+ event.originalEvent.preventDefault();
6142
6249
  this.optionsList.scrollWithOnePage(NavigationAction[event.originalEvent.code]);
6143
6250
  }
6144
6251
  }));
@@ -7852,6 +7959,16 @@ class MultiSelectComponent {
7852
7959
  get isLoading() {
7853
7960
  return this.loading;
7854
7961
  }
7962
+ /**
7963
+ * @hidden
7964
+ */
7965
+ handleKeyboardEvent(event) {
7966
+ if (event.ctrlKey && event.keyCode === Keys.KeyA) {
7967
+ event.preventDefault();
7968
+ event.stopImmediatePropagation();
7969
+ this.handleSelectAll();
7970
+ }
7971
+ }
7855
7972
  /**
7856
7973
  * @hidden
7857
7974
  */
@@ -7943,23 +8060,45 @@ class MultiSelectComponent {
7943
8060
  * @hidden
7944
8061
  */
7945
8062
  change(event) {
7946
- const isCustomItem = (isPresent(event.added) || isPresent(event.removed)) && (event.added === -1 || event.removed === -1);
7947
- if (isCustomItem) {
7948
- this.addCustomValue(this.text);
7949
- return; // The change is emited asynchronosly.
7950
- }
7951
- // Existing items.
7952
- if (isPresent(event.added)) {
7953
- const dataItem = this.dataService.itemAt(event.added);
7954
- const newItem = (this.valuePrimitive && isPresent(dataItem) && isPresent(dataItem[this.valueField])) ? dataItem[this.valueField] : dataItem;
7955
- this.value = [...this.value, newItem];
7956
- }
7957
- if (isPresent(event.removed)) {
7958
- const dataItem = this.dataService.itemAt(event.removed);
7959
- const filter = (item) => getter(item, this.valueField) !== getter(dataItem, this.valueField);
7960
- this.value = this.value.filter(filter);
7961
- this.selectionService.focused = event.removed;
7962
- this.cdr.detectChanges();
8063
+ if (event.isMultipleSelection) {
8064
+ // Existing items.
8065
+ if (isPresent(event.added) && event.added.length > 0) {
8066
+ event.added.forEach((itemIndex) => {
8067
+ const dataItem = this.dataService.itemAt(itemIndex);
8068
+ const newItem = (this.valuePrimitive && isPresent(dataItem) && isPresent(dataItem[this.valueField])) ? dataItem[this.valueField] : dataItem;
8069
+ if (newItem) {
8070
+ this.value = [...this.value, newItem];
8071
+ }
8072
+ });
8073
+ }
8074
+ if (isPresent(event.removed) && event.removed.length > 0) {
8075
+ event.removed.forEach((itemIndex) => {
8076
+ const dataItem = this.dataService.itemAt(itemIndex);
8077
+ const filter = (item) => getter(item, this.valueField) !== getter(dataItem, this.valueField);
8078
+ this.value = this.value.filter(filter);
8079
+ });
8080
+ this.cdr.detectChanges();
8081
+ }
8082
+ }
8083
+ else {
8084
+ const isCustomItem = (isPresent(event.added) || isPresent(event.removed)) && (event.added === -1 || event.removed === -1);
8085
+ if (isCustomItem) {
8086
+ this.addCustomValue(this.text);
8087
+ return; // The change is emited asynchronosly.
8088
+ }
8089
+ // Existing items.
8090
+ if (isPresent(event.added)) {
8091
+ const dataItem = this.dataService.itemAt(event.added);
8092
+ const newItem = (this.valuePrimitive && isPresent(dataItem) && isPresent(dataItem[this.valueField])) ? dataItem[this.valueField] : dataItem;
8093
+ this.value = [...this.value, newItem];
8094
+ }
8095
+ if (isPresent(event.removed)) {
8096
+ const dataItem = this.dataService.itemAt(event.removed);
8097
+ const filter = (item) => getter(item, this.valueField) !== getter(dataItem, this.valueField);
8098
+ this.value = this.value.filter(filter);
8099
+ this.selectionService.focused = event.removed;
8100
+ this.cdr.detectChanges();
8101
+ }
7963
8102
  }
7964
8103
  this.emitValueChange();
7965
8104
  }
@@ -8092,10 +8231,11 @@ class MultiSelectComponent {
8092
8231
  * @hidden
8093
8232
  */
8094
8233
  clearAll(event) {
8095
- event.stopImmediatePropagation();
8096
- event.preventDefault();
8234
+ event === null || event === void 0 ? void 0 : event.stopImmediatePropagation();
8235
+ event === null || event === void 0 ? void 0 : event.preventDefault();
8097
8236
  this.focus();
8098
8237
  this.clearFilter();
8238
+ this.selectionService.lastClickedIndex = null;
8099
8239
  const selected = this.selectionService.selected;
8100
8240
  this.value = this.value.filter((_item, index) => this.disabledItemsService.isIndexDisabled(selected[index]));
8101
8241
  this.emitValueChange();
@@ -8244,7 +8384,17 @@ class MultiSelectComponent {
8244
8384
  this.navigationService.delete.pipe(filter(isTagFocused)).subscribe(this.handleDelete.bind(this)),
8245
8385
  this.navigationService.left.subscribe(this.direction === 'rtl' ? this.handleRightKey.bind(this) : this.handleLeftKey.bind(this)),
8246
8386
  this.navigationService.right.subscribe(this.direction === 'rtl' ? this.handleLeftKey.bind(this) : this.handleRightKey.bind(this)),
8247
- this.navigationService.down.subscribe((event) => this.handleDownKey(event.index))
8387
+ this.navigationService.down.subscribe((event) => this.handleDownKey(event.index)),
8388
+ this.navigationService.selectprevious.pipe(filter(isOpen)).subscribe((event) => this.handleSelectUpDown(event)),
8389
+ this.navigationService.selectnext.pipe(filter(isOpen)).subscribe((event) => this.handleSelectUpDown(event)),
8390
+ this.navigationService.selectalltobeginning.pipe(filter(isOpen)).subscribe(() => this.handleSelectAllToBeginning()),
8391
+ this.navigationService.selectalltoend.pipe(filter(isOpen)).subscribe(() => this.handleSelectAllToEnd()),
8392
+ merge(this.navigationService.pagedown, this.navigationService.pageup).subscribe((event) => {
8393
+ if (this.isOpen) {
8394
+ event.originalEvent.preventDefault();
8395
+ this.optionsList.scrollWithOnePage(NavigationAction[event.originalEvent.code]);
8396
+ }
8397
+ })
8248
8398
  ].forEach(s => this.observableSubscriptions.add(s));
8249
8399
  }
8250
8400
  subscribeTouchEvents() {
@@ -8303,7 +8453,7 @@ class MultiSelectComponent {
8303
8453
  return;
8304
8454
  }
8305
8455
  if (isNumber(index)) {
8306
- this.selectionService.unselect(index);
8456
+ this.selectionService.deselect(index);
8307
8457
  this.selectionService.focused = index;
8308
8458
  this.togglePopup(false);
8309
8459
  }
@@ -8368,7 +8518,7 @@ class MultiSelectComponent {
8368
8518
  }
8369
8519
  else {
8370
8520
  if (!customItem && this.selectionService.isSelected(itemIndex)) {
8371
- this.selectionService.unselect(itemIndex);
8521
+ this.selectionService.deselect(itemIndex);
8372
8522
  this.selectionService.focused = itemIndex;
8373
8523
  }
8374
8524
  else {
@@ -8390,7 +8540,7 @@ class MultiSelectComponent {
8390
8540
  }
8391
8541
  handleItemChange(event) {
8392
8542
  this.change(event);
8393
- if (this.autoClose) {
8543
+ if (this.autoClose && !event.preventClosingPopup) {
8394
8544
  this.togglePopup(false);
8395
8545
  }
8396
8546
  if (this.autoClose || !this.filterable) {
@@ -8400,6 +8550,7 @@ class MultiSelectComponent {
8400
8550
  handleEnter(event) {
8401
8551
  const service = this.selectionService;
8402
8552
  const focusedIndex = this.selectionService.focused;
8553
+ this.selectionService.lastClickedIndex = focusedIndex;
8403
8554
  if (this.isOpen) {
8404
8555
  event.originalEvent.preventDefault();
8405
8556
  }
@@ -8410,7 +8561,7 @@ class MultiSelectComponent {
8410
8561
  return; // Clear filter & close are done at customValueSubscription due to race conditions.
8411
8562
  }
8412
8563
  if (service.isSelected(focusedIndex)) {
8413
- service.unselect(focusedIndex);
8564
+ service.deselect(focusedIndex);
8414
8565
  service.focused = focusedIndex;
8415
8566
  }
8416
8567
  else {
@@ -8433,6 +8584,85 @@ class MultiSelectComponent {
8433
8584
  handleHome() {
8434
8585
  this.focusedTagIndex = 0;
8435
8586
  }
8587
+ sortSelectionAscending() {
8588
+ return this.selectionService.selected.sort((a, b) => a - b);
8589
+ }
8590
+ handleSelectAll() {
8591
+ const selectedItemsCount = this.selectionService.selected.length;
8592
+ const dataItemsCount = this.dataService.data.length;
8593
+ const dataItemsWithoutHeadersCount = this.dataService.data.filter(i => !i.header).length;
8594
+ if ((!this.dataService.grouped && selectedItemsCount === dataItemsCount) ||
8595
+ (this.dataService.grouped && selectedItemsCount === dataItemsWithoutHeadersCount)) {
8596
+ this.clearAll();
8597
+ }
8598
+ else {
8599
+ this.selectionService.selectFromTo(0, dataItemsCount - 1);
8600
+ this.selectionService.emitMultipleAddedRemoved();
8601
+ }
8602
+ }
8603
+ handleSelectAllToBeginning() {
8604
+ const selectedItemsCount = this.selectionService.selected.length;
8605
+ const dataItemsCount = this.dataService.data.length;
8606
+ const focusedItem = this.selectionService.focused;
8607
+ const largestIndex = this.sortSelectionAscending()[selectedItemsCount - 1];
8608
+ if (selectedItemsCount !== dataItemsCount) {
8609
+ this.selectionService.unselectFromTo(largestIndex, focusedItem + 1);
8610
+ this.selectionService.selectFromTo(0, focusedItem);
8611
+ }
8612
+ this.nextTick(() => this.selectionService.focus(0));
8613
+ this.selectionService.emitMultipleAddedRemoved();
8614
+ }
8615
+ handleSelectAllToEnd() {
8616
+ const selectedItemsCount = this.selectionService.selected.length;
8617
+ const dataItemsCount = this.dataService.data.length;
8618
+ const focusedItem = this.selectionService.focused;
8619
+ if (selectedItemsCount !== dataItemsCount) {
8620
+ this.selectionService.unselectFromTo(focusedItem - 1, 0);
8621
+ this.selectionService.selectFromTo(focusedItem, dataItemsCount - 1);
8622
+ }
8623
+ if (this.dataService.grouped) {
8624
+ const lastItemIndex = this.dataService.groupIndices[this.dataService.groupIndices.length - 1] - 1;
8625
+ this.nextTick(() => this.selectionService.focus(lastItemIndex));
8626
+ }
8627
+ else {
8628
+ this.nextTick(() => this.selectionService.focus(dataItemsCount - 1));
8629
+ }
8630
+ this.selectionService.emitMultipleAddedRemoved();
8631
+ }
8632
+ handleSelectUpDown(event) {
8633
+ const focusedIndex = this.selectionService.focused;
8634
+ if (!isPresent(focusedIndex)) {
8635
+ return;
8636
+ }
8637
+ let indexToSelect;
8638
+ if (event.originalEvent.key === 'ArrowUp') {
8639
+ indexToSelect = focusedIndex > 0 ? focusedIndex - 1 : focusedIndex;
8640
+ }
8641
+ else {
8642
+ indexToSelect = focusedIndex < this.dataService.data.length - 1 ? focusedIndex + 1 : focusedIndex;
8643
+ }
8644
+ if (!isPresent(this.selectionService.lastClickedIndex)) {
8645
+ this.selectionService.lastClickedIndex = focusedIndex;
8646
+ }
8647
+ this.selectRangeFromTo(indexToSelect);
8648
+ }
8649
+ /**
8650
+ * Selects all items between the focused item and the last clicked item (index). Also removes all other selected items.
8651
+ */
8652
+ selectRangeFromTo(indexToSelect) {
8653
+ const lastClickedIndex = this.selectionService.lastClickedIndex;
8654
+ if (lastClickedIndex > indexToSelect) {
8655
+ this.selectionService.unselectNotNeededIndices(indexToSelect, lastClickedIndex, this.dataService.data.length);
8656
+ this.selectionService.selectFromTo(indexToSelect, this.selectionService.lastClickedIndex);
8657
+ this.selectionService.emitMultipleAddedRemoved();
8658
+ }
8659
+ else {
8660
+ this.selectionService.unselectNotNeededIndices(lastClickedIndex, indexToSelect, this.dataService.data.length);
8661
+ this.selectionService.selectFromTo(lastClickedIndex, indexToSelect);
8662
+ this.selectionService.emitMultipleAddedRemoved();
8663
+ }
8664
+ this.nextTick(() => this.selectionService.focus(indexToSelect));
8665
+ }
8436
8666
  handleUp(index) {
8437
8667
  this.selectionService.focused = index;
8438
8668
  }
@@ -8631,7 +8861,7 @@ class MultiSelectComponent {
8631
8861
  }
8632
8862
  }
8633
8863
  MultiSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MultiSelectComponent, deps: [{ token: i0.ElementRef }, { token: i1.LocalizationService }, { token: i2.PopupService }, { token: DataService }, { token: SelectionService }, { token: NavigationService }, { token: DisabledItemsService }, { token: i0.ChangeDetectorRef }, { token: i0.KeyValueDiffers }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: TOUCH_ENABLED, optional: true }], target: i0.ɵɵFactoryTarget.Component });
8634
- MultiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MultiSelectComponent, selector: "kendo-multiselect", inputs: { focusableId: "focusableId", autoClose: "autoClose", loading: "loading", data: "data", value: "value", valueField: "valueField", textField: "textField", tabindex: "tabindex", tabIndex: "tabIndex", size: "size", rounded: "rounded", fillMode: "fillMode", placeholder: "placeholder", disabled: "disabled", itemDisabled: "itemDisabled", checkboxes: "checkboxes", readonly: "readonly", filterable: "filterable", virtual: "virtual", popupSettings: "popupSettings", listHeight: "listHeight", valuePrimitive: "valuePrimitive", clearButton: "clearButton", tagMapper: "tagMapper", allowCustom: "allowCustom", valueNormalizer: "valueNormalizer" }, outputs: { filterChange: "filterChange", valueChange: "valueChange", open: "open", opened: "opened", close: "close", closed: "closed", onFocus: "focus", onBlur: "blur", removeTag: "removeTag" }, host: { listeners: { "mousedown": "hostMousedown($event)" }, properties: { "class.k-multiselect": "this.hostClasses", "class.k-input": "this.hostClasses", "attr.dir": "this.dir", "class.k-disabled": "this.disabledClass", "class.k-loading": "this.isLoading" } }, providers: [
8864
+ MultiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MultiSelectComponent, selector: "kendo-multiselect", inputs: { focusableId: "focusableId", autoClose: "autoClose", loading: "loading", data: "data", value: "value", valueField: "valueField", textField: "textField", tabindex: "tabindex", tabIndex: "tabIndex", size: "size", rounded: "rounded", fillMode: "fillMode", placeholder: "placeholder", disabled: "disabled", itemDisabled: "itemDisabled", checkboxes: "checkboxes", readonly: "readonly", filterable: "filterable", virtual: "virtual", popupSettings: "popupSettings", listHeight: "listHeight", valuePrimitive: "valuePrimitive", clearButton: "clearButton", tagMapper: "tagMapper", allowCustom: "allowCustom", valueNormalizer: "valueNormalizer" }, outputs: { filterChange: "filterChange", valueChange: "valueChange", open: "open", opened: "opened", close: "close", closed: "closed", onFocus: "focus", onBlur: "blur", removeTag: "removeTag" }, host: { listeners: { "document:keydown": "handleKeyboardEvent($event)", "mousedown": "hostMousedown($event)" }, properties: { "class.k-multiselect": "this.hostClasses", "class.k-input": "this.hostClasses", "attr.dir": "this.dir", "class.k-disabled": "this.disabledClass", "class.k-loading": "this.isLoading" } }, providers: [
8635
8865
  MULTISELECT_VALUE_ACCESSOR,
8636
8866
  DataService,
8637
8867
  SelectionService,
@@ -9070,6 +9300,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
9070
9300
  }], isLoading: [{
9071
9301
  type: HostBinding,
9072
9302
  args: ['class.k-loading']
9303
+ }], handleKeyboardEvent: [{
9304
+ type: HostListener,
9305
+ args: ['document:keydown', ['$event']]
9073
9306
  }], hostMousedown: [{
9074
9307
  type: HostListener,
9075
9308
  args: ['mousedown', ['$event']]