ng-virtual-list 14.7.0 → 14.7.2

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.
Files changed (65) hide show
  1. package/README.md +19 -16
  2. package/esm2020/lib/components/ng-virtual-list-item.component.mjs +18 -4
  3. package/esm2020/lib/const/index.mjs +2 -1
  4. package/esm2020/lib/models/index.mjs +1 -1
  5. package/esm2020/lib/models/item-config-map.model.mjs +2 -0
  6. package/esm2020/lib/models/render-item-config.model.mjs +1 -1
  7. package/esm2020/lib/ng-virtual-list.component.mjs +58 -26
  8. package/esm2020/lib/ng-virtual-list.service.mjs +46 -9
  9. package/esm2020/lib/utils/trackBox.mjs +22 -19
  10. package/fesm2015/ng-virtual-list.mjs +145 -59
  11. package/fesm2015/ng-virtual-list.mjs.map +1 -1
  12. package/fesm2020/ng-virtual-list.mjs +139 -53
  13. package/fesm2020/ng-virtual-list.mjs.map +1 -1
  14. package/lib/components/ng-virtual-list-item.component.d.ts +22 -4
  15. package/lib/const/index.d.ts +1 -0
  16. package/lib/models/index.d.ts +2 -2
  17. package/lib/models/item-config-map.model.d.ts +23 -0
  18. package/lib/models/render-item-config.model.d.ts +5 -1
  19. package/lib/ng-virtual-list.component.d.ts +25 -8
  20. package/lib/ng-virtual-list.service.d.ts +7 -0
  21. package/lib/utils/trackBox.d.ts +4 -4
  22. package/package.json +1 -1
  23. package/esm2020/lib/models/sticky-map.model.mjs +0 -2
  24. package/esm2022/lib/components/ng-virtual-list-item.component.mjs +0 -158
  25. package/esm2022/lib/const/index.mjs +0 -49
  26. package/esm2022/lib/enums/direction.mjs +0 -2
  27. package/esm2022/lib/enums/directions.mjs +0 -18
  28. package/esm2022/lib/enums/index.mjs +0 -4
  29. package/esm2022/lib/enums/snapping-method.mjs +0 -2
  30. package/esm2022/lib/enums/snapping-methods.mjs +0 -18
  31. package/esm2022/lib/models/base-virtual-list-item-component.mjs +0 -9
  32. package/esm2022/lib/models/collection.model.mjs +0 -3
  33. package/esm2022/lib/models/component.model.mjs +0 -2
  34. package/esm2022/lib/models/index.mjs +0 -2
  35. package/esm2022/lib/models/item.model.mjs +0 -2
  36. package/esm2022/lib/models/render-collection.model.mjs +0 -3
  37. package/esm2022/lib/models/render-item-config.model.mjs +0 -2
  38. package/esm2022/lib/models/render-item.model.mjs +0 -3
  39. package/esm2022/lib/models/scroll-direction.model.mjs +0 -2
  40. package/esm2022/lib/models/scroll-event.model.mjs +0 -2
  41. package/esm2022/lib/models/sticky-map.model.mjs +0 -2
  42. package/esm2022/lib/ng-virtual-list.component.mjs +0 -555
  43. package/esm2022/lib/ng-virtual-list.module.mjs +0 -20
  44. package/esm2022/lib/ng-virtual-list.service.mjs +0 -29
  45. package/esm2022/lib/types/id.mjs +0 -2
  46. package/esm2022/lib/types/index.mjs +0 -2
  47. package/esm2022/lib/types/rect.mjs +0 -2
  48. package/esm2022/lib/types/size.mjs +0 -2
  49. package/esm2022/lib/utils/browser.mjs +0 -3
  50. package/esm2022/lib/utils/buffer-interpolation.mjs +0 -27
  51. package/esm2022/lib/utils/cacheMap.mjs +0 -168
  52. package/esm2022/lib/utils/debounce.mjs +0 -31
  53. package/esm2022/lib/utils/eventEmitter.mjs +0 -105
  54. package/esm2022/lib/utils/index.mjs +0 -5
  55. package/esm2022/lib/utils/isDirection.mjs +0 -15
  56. package/esm2022/lib/utils/scrollEvent.mjs +0 -42
  57. package/esm2022/lib/utils/snapping-method.mjs +0 -9
  58. package/esm2022/lib/utils/toggleClassName.mjs +0 -15
  59. package/esm2022/lib/utils/trackBox.mjs +0 -768
  60. package/esm2022/lib/utils/tracker.mjs +0 -144
  61. package/esm2022/ng-virtual-list.mjs +0 -5
  62. package/esm2022/public-api.mjs +0 -11
  63. package/fesm2022/ng-virtual-list.mjs +0 -2359
  64. package/fesm2022/ng-virtual-list.mjs.map +0 -1
  65. package/lib/models/sticky-map.model.d.ts +0 -14
@@ -69,6 +69,7 @@ const DEFAULT_BUFFER_SIZE = 2;
69
69
  const DEFAULT_MAX_BUFFER_SIZE = 100;
70
70
  const DEFAULT_LIST_SIZE = 400;
71
71
  const DEFAULT_SNAP = false;
72
+ const DEFAULT_SELECT_BY_CLICK = true;
72
73
  const DEFAULT_ENABLED_BUFFER_OPTIMIZATION = false;
73
74
  const DEFAULT_DYNAMIC_SIZE = false;
74
75
  const TRACK_BY_PROPERTY_NAME = 'id';
@@ -154,6 +155,7 @@ class NgVirtualListService {
154
155
  this.$selectedIds = this._$selectedIds.asObservable();
155
156
  this._$methodOfSelecting = new BehaviorSubject(0);
156
157
  this.$methodOfSelecting = this._$methodOfSelecting.asObservable();
158
+ this.selectByClick = DEFAULT_SELECT_BY_CLICK;
157
159
  this._$methodOfSelecting.pipe(takeUntil(this._$unsubscribe), tap(v => {
158
160
  switch (v) {
159
161
  case MethodsForSelectingTypes.SELECT: {
@@ -181,25 +183,60 @@ class NgVirtualListService {
181
183
  this._$methodOfSelecting.next(v);
182
184
  }
183
185
  setSelectedIds(ids) {
184
- this._$selectedIds.next(ids);
186
+ if (JSON.stringify(this._$selectedIds.getValue()) !== JSON.stringify(ids)) {
187
+ this._$selectedIds.next(ids);
188
+ }
185
189
  }
186
190
  itemClick(data) {
187
- this._$itemClick.next(data);
188
- if (data) {
191
+ if (this.selectByClick) {
192
+ this.select(data);
193
+ }
194
+ }
195
+ /**
196
+ * Selects a list item
197
+ * @param data
198
+ * @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
199
+ */
200
+ select(data, selected = undefined) {
201
+ if (data && data.config.selectable) {
189
202
  switch (this._$methodOfSelecting.getValue()) {
190
203
  case MethodsForSelectingTypes.SELECT: {
191
204
  const curr = this._$selectedIds.getValue();
192
- this._$selectedIds.next(curr !== (data === null || data === void 0 ? void 0 : data.id) ? data === null || data === void 0 ? void 0 : data.id : undefined);
205
+ if (selected === undefined) {
206
+ this._$selectedIds.next(curr !== (data === null || data === void 0 ? void 0 : data.id) ? data === null || data === void 0 ? void 0 : data.id : undefined);
207
+ }
208
+ else {
209
+ this._$selectedIds.next(selected ? data === null || data === void 0 ? void 0 : data.id : undefined);
210
+ }
193
211
  break;
194
212
  }
195
213
  case MethodsForSelectingTypes.MULTI_SELECT: {
196
214
  const curr = [...(this._$selectedIds.getValue() || [])], index = curr.indexOf(data.id);
197
- if (index > -1) {
198
- curr.splice(index, 1);
199
- this._$selectedIds.next(curr);
215
+ if (selected === undefined) {
216
+ if (index > -1) {
217
+ curr.splice(index, 1);
218
+ this._$selectedIds.next(curr);
219
+ }
220
+ else {
221
+ this._$selectedIds.next([...curr, data.id]);
222
+ }
223
+ }
224
+ else if (selected) {
225
+ if (index > -1) {
226
+ this._$selectedIds.next(curr);
227
+ }
228
+ else {
229
+ this._$selectedIds.next([...curr, data.id]);
230
+ }
200
231
  }
201
232
  else {
202
- this._$selectedIds.next([...curr, data.id]);
233
+ if (index > -1) {
234
+ curr.splice(index, 1);
235
+ this._$selectedIds.next(curr);
236
+ }
237
+ else {
238
+ this._$selectedIds.next(curr);
239
+ }
203
240
  }
204
241
  break;
205
242
  }
@@ -250,10 +287,19 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
250
287
  this._part = PART_DEFAULT_ITEM;
251
288
  this._isSelected = false;
252
289
  this.config = new BehaviorSubject$1({});
290
+ this.measures = new BehaviorSubject$1(undefined);
253
291
  this.regular = false;
254
292
  this._$data = new BehaviorSubject$1(this.data);
255
293
  this.$data = this._$data.asObservable();
256
294
  this._regularLength = SIZE_100_PERSENT;
295
+ this._selectHandler = (data) =>
296
+ /**
297
+ * Selects a list item
298
+ * @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
299
+ */
300
+ (selected = undefined) => {
301
+ this._service.select(data, selected);
302
+ };
257
303
  this._id = this._service.generateComponentId();
258
304
  const $data = this.$data;
259
305
  combineLatest([$data, this._service.$methodOfSelecting, this._service.$selectedIds]).pipe(takeUntil$1(this._$unsubscribe), map(([, m, ids]) => ({ method: m, ids })), tap$1(({ method, ids }) => {
@@ -279,6 +325,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
279
325
  }
280
326
  this.updatePartStr(this.data, this._isSelected);
281
327
  this.updateConfig(this.data);
328
+ this.updateMeasures(this.data);
282
329
  })).subscribe();
283
330
  }
284
331
  get id() {
@@ -292,6 +339,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
292
339
  this.data = v;
293
340
  this.updatePartStr(v, this._isSelected);
294
341
  this.updateConfig(v);
342
+ this.updateMeasures(v);
295
343
  this.update();
296
344
  this._$data.next(v);
297
345
  this._cdr.detectChanges();
@@ -321,8 +369,11 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
321
369
  get element() {
322
370
  return this._elementRef.nativeElement;
323
371
  }
372
+ updateMeasures(v) {
373
+ this.measures.next((v === null || v === void 0 ? void 0 : v.measures) ? Object.assign({}, v.measures) : undefined);
374
+ }
324
375
  updateConfig(v) {
325
- this.config.next(Object.assign(Object.assign({}, (v === null || v === void 0 ? void 0 : v.config) || {}), { selected: this._isSelected }));
376
+ this.config.next(Object.assign(Object.assign({}, (v === null || v === void 0 ? void 0 : v.config) || {}), { selected: this._isSelected, select: this._selectHandler(v) }));
326
377
  }
327
378
  update() {
328
379
  const data = this.data, regular = this.regular, length = this._regularLength;
@@ -415,13 +466,13 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
415
466
  }
416
467
  }
417
468
  NgVirtualListItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListItemComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: NgVirtualListService }], target: i0.ɵɵFactoryTarget.Component });
418
- NgVirtualListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"data\">\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, config: config | async}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
469
+ NgVirtualListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"data\">\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, measures: measures | async, config: config | async}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
419
470
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
420
471
  type: Component,
421
472
  args: [{ selector: 'ng-virtual-list-item', host: {
422
473
  'class': 'ngvl__item',
423
474
  'role': 'listitem',
424
- }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"data\">\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, config: config | async}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"] }]
475
+ }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"data\">\r\n <div #listItem [part]=\"part\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\" (click)=\"onClickHandler()\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, measures: measures | async, config: config | async}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"] }]
425
476
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: NgVirtualListService }]; } });
426
477
 
427
478
  /**
@@ -1132,8 +1183,8 @@ class TrackBox extends CacheMap {
1132
1183
  /**
1133
1184
  * Finds the position of a collection element by the given Id
1134
1185
  */
1135
- getItemPosition(id, stickyMap, options) {
1136
- const opt = Object.assign({ fromItemId: id, stickyMap }, options);
1186
+ getItemPosition(id, itemConfigMap, options) {
1187
+ const opt = Object.assign({ fromItemId: id, itemConfigMap }, options);
1137
1188
  this._defaultBufferSize = opt.bufferSize;
1138
1189
  this._maxBufferSize = opt.maxBufferSize;
1139
1190
  const { scrollSize, isFromItemIdFound } = this.recalculateMetrics(Object.assign(Object.assign({}, opt), { dynamicSize: this._crudDetected || opt.dynamicSize, previousTotalSize: this._previousTotalSize, crudDetected: this._crudDetected, deletedItemsMap: this._deletedItemsMap }));
@@ -1142,8 +1193,8 @@ class TrackBox extends CacheMap {
1142
1193
  /**
1143
1194
  * Updates the collection of display objects
1144
1195
  */
1145
- updateCollection(items, stickyMap, options) {
1146
- const opt = Object.assign({ stickyMap }, options), crudDetected = this._crudDetected, deletedItemsMap = this._deletedItemsMap;
1196
+ updateCollection(items, itemConfigMap, options) {
1197
+ const opt = Object.assign({ itemConfigMap }, options), crudDetected = this._crudDetected, deletedItemsMap = this._deletedItemsMap;
1147
1198
  if (opt.dynamicSize) {
1148
1199
  this.cacheElements();
1149
1200
  }
@@ -1158,7 +1209,7 @@ class TrackBox extends CacheMap {
1158
1209
  if (opt.dynamicSize) {
1159
1210
  this.snapshot();
1160
1211
  }
1161
- const displayItems = this.generateDisplayCollection(items, stickyMap, Object.assign({}, metrics));
1212
+ const displayItems = this.generateDisplayCollection(items, itemConfigMap, Object.assign({}, metrics));
1162
1213
  return { displayItems, totalSize: metrics.totalSize, delta: metrics.delta, crudDetected };
1163
1214
  }
1164
1215
  /**
@@ -1238,8 +1289,8 @@ class TrackBox extends CacheMap {
1238
1289
  * Calculates list metrics
1239
1290
  */
1240
1291
  recalculateMetrics(options) {
1241
- var _a, _b, _c, _d;
1242
- const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap, stickyMap, enabledBufferOptimization, previousTotalSize, crudDetected, deletedItemsMap } = options;
1292
+ var _a, _b, _c, _d, _e;
1293
+ const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap, itemConfigMap, enabledBufferOptimization, previousTotalSize, crudDetected, deletedItemsMap } = options;
1243
1294
  const bufferSize = Math.max(minBufferSize, this._bufferSize), { width, height } = bounds, sizeProperty = isVertical ? HEIGHT_PROP_NAME : WIDTH_PROP_NAME, size = isVertical ? height : width, totalLength = collection.length, typicalItemSize = itemSize, w = isVertical ? width : typicalItemSize, h = isVertical ? typicalItemSize : height, map = this._map, snapshot = this._snapshot, checkOverscrollItemsLimit = Math.ceil(size / typicalItemSize), snippedPos = Math.floor(scrollSize), leftItemsWeights = [], isFromId = fromItemId !== undefined && (typeof fromItemId === 'number' && fromItemId > -1)
1244
1295
  || (typeof fromItemId === 'string' && fromItemId > '-1');
1245
1296
  let leftItemsOffset = 0, rightItemsOffset = 0;
@@ -1299,21 +1350,21 @@ class TrackBox extends CacheMap {
1299
1350
  totalSize += componentSize;
1300
1351
  if (isFromId) {
1301
1352
  if (itemById === undefined) {
1302
- if (id !== fromItemId && stickyMap && stickyMap[id] === 1) {
1353
+ if (id !== fromItemId && itemConfigMap && ((_c = itemConfigMap[id]) === null || _c === void 0 ? void 0 : _c.sticky) === 1) {
1303
1354
  stickyComponentSize = componentSize;
1304
1355
  stickyCollectionItem = collectionItem;
1305
1356
  }
1306
1357
  if (id === fromItemId) {
1307
1358
  isFromItemIdFound = true;
1308
1359
  targetDisplayItemIndex = i;
1309
- if (stickyCollectionItem && stickyMap) {
1360
+ if (stickyCollectionItem && itemConfigMap) {
1310
1361
  const { num } = this.getElementNumToEnd(i, collection, map, typicalItemSize, size, isVertical);
1311
1362
  if (num > 0) {
1312
1363
  isTargetInOverscroll = true;
1313
1364
  y -= size - componentSize;
1314
1365
  }
1315
1366
  else {
1316
- if (stickyMap && !stickyMap[collectionItem.id] && y >= scrollSize && y < scrollSize + stickyComponentSize) {
1367
+ if (itemConfigMap && !itemConfigMap[collectionItem.id] && y >= scrollSize && y < scrollSize + stickyComponentSize) {
1317
1368
  const snappedY = scrollSize - stickyComponentSize;
1318
1369
  leftHiddenItemsWeight -= (snappedY - y);
1319
1370
  y = snappedY;
@@ -1405,13 +1456,13 @@ class TrackBox extends CacheMap {
1405
1456
  let componentSize = typicalItemSize, itemDisplayMethod = ItemDisplayMethods.NOT_CHANGED;
1406
1457
  if (map.has(id)) {
1407
1458
  const bounds = map.get(id);
1408
- itemDisplayMethod = (_c = bounds === null || bounds === void 0 ? void 0 : bounds.method) !== null && _c !== void 0 ? _c : ItemDisplayMethods.UPDATE;
1459
+ itemDisplayMethod = (_d = bounds === null || bounds === void 0 ? void 0 : bounds.method) !== null && _d !== void 0 ? _d : ItemDisplayMethods.UPDATE;
1409
1460
  if (itemDisplayMethod === ItemDisplayMethods.CREATE) {
1410
1461
  map.set(id, Object.assign(Object.assign({}, bounds), { method: ItemDisplayMethods.NOT_CHANGED }));
1411
1462
  }
1412
1463
  }
1413
1464
  if (deletedItemsMap.hasOwnProperty(i)) {
1414
- const bounds = deletedItemsMap[i], size = (_d = bounds === null || bounds === void 0 ? void 0 : bounds[sizeProperty]) !== null && _d !== void 0 ? _d : typicalItemSize;
1465
+ const bounds = deletedItemsMap[i], size = (_e = bounds === null || bounds === void 0 ? void 0 : bounds[sizeProperty]) !== null && _e !== void 0 ? _e : typicalItemSize;
1415
1466
  if (y < scrollSize - size) {
1416
1467
  leftSizeOfDeletedItems += size;
1417
1468
  }
@@ -1496,8 +1547,8 @@ class TrackBox extends CacheMap {
1496
1547
  changes() {
1497
1548
  this.bumpVersion();
1498
1549
  }
1499
- generateDisplayCollection(items, stickyMap, metrics) {
1500
- var _a, _b, _c;
1550
+ generateDisplayCollection(items, itemConfigMap, metrics) {
1551
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1501
1552
  const { width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, } = metrics, displayItems = [];
1502
1553
  if (items.length) {
1503
1554
  const actualSnippedPosition = snippedPos, isSnappingMethodAdvanced = this.isSnappingMethodAdvanced, boundsSize = isVertical ? height : width, actualEndSnippedPosition = boundsSize;
@@ -1507,7 +1558,7 @@ class TrackBox extends CacheMap {
1507
1558
  if (!items[i]) {
1508
1559
  continue;
1509
1560
  }
1510
- const id = items[i].id, sticky = stickyMap[id], size = dynamicSize ? ((_a = this.get(id)) === null || _a === void 0 ? void 0 : _a[sizeProperty]) || typicalItemSize : typicalItemSize;
1561
+ const id = items[i].id, sticky = (_b = (_a = itemConfigMap[id]) === null || _a === void 0 ? void 0 : _a.sticky) !== null && _b !== void 0 ? _b : 0, selectable = (_d = (_c = itemConfigMap[id]) === null || _c === void 0 ? void 0 : _c.selectable) !== null && _d !== void 0 ? _d : true, size = dynamicSize ? ((_e = this.get(id)) === null || _e === void 0 ? void 0 : _e[sizeProperty]) || typicalItemSize : typicalItemSize;
1511
1562
  if (sticky === 1) {
1512
1563
  const isOdd = i % 2 != 0, measures = {
1513
1564
  x: isVertical ? 0 : actualSnippedPosition,
@@ -1519,6 +1570,7 @@ class TrackBox extends CacheMap {
1519
1570
  odd: isOdd,
1520
1571
  even: !isOdd,
1521
1572
  isVertical,
1573
+ selectable,
1522
1574
  sticky,
1523
1575
  snap,
1524
1576
  snapped: true,
@@ -1542,8 +1594,8 @@ class TrackBox extends CacheMap {
1542
1594
  if (!items[i]) {
1543
1595
  continue;
1544
1596
  }
1545
- const id = items[i].id, sticky = stickyMap[id], size = dynamicSize
1546
- ? ((_b = this.get(id)) === null || _b === void 0 ? void 0 : _b[sizeProperty]) || typicalItemSize
1597
+ const id = items[i].id, sticky = (_g = (_f = itemConfigMap[id]) === null || _f === void 0 ? void 0 : _f.sticky) !== null && _g !== void 0 ? _g : 0, selectable = (_j = (_h = itemConfigMap[id]) === null || _h === void 0 ? void 0 : _h.selectable) !== null && _j !== void 0 ? _j : true, size = dynamicSize
1598
+ ? ((_k = this.get(id)) === null || _k === void 0 ? void 0 : _k[sizeProperty]) || typicalItemSize
1547
1599
  : typicalItemSize;
1548
1600
  if (sticky === 2) {
1549
1601
  const isOdd = i % 2 != 0, w = isVertical ? normalizedItemWidth : size, h = isVertical ? size : normalizedItemHeight, measures = {
@@ -1556,6 +1608,7 @@ class TrackBox extends CacheMap {
1556
1608
  odd: isOdd,
1557
1609
  even: !isOdd,
1558
1610
  isVertical,
1611
+ selectable,
1559
1612
  sticky,
1560
1613
  snap,
1561
1614
  snapped: true,
@@ -1581,11 +1634,11 @@ class TrackBox extends CacheMap {
1581
1634
  if (!items[i]) {
1582
1635
  continue;
1583
1636
  }
1584
- const id = items[i].id, size = dynamicSize ? ((_c = this.get(id)) === null || _c === void 0 ? void 0 : _c[sizeProperty]) || typicalItemSize : typicalItemSize;
1637
+ const id = items[i].id, size = dynamicSize ? ((_l = this.get(id)) === null || _l === void 0 ? void 0 : _l[sizeProperty]) || typicalItemSize : typicalItemSize;
1585
1638
  if (id !== (stickyItem === null || stickyItem === void 0 ? void 0 : stickyItem.id) && id !== (endStickyItem === null || endStickyItem === void 0 ? void 0 : endStickyItem.id)) {
1586
- const isOdd = i % 2 != 0, snapped = snap && (stickyMap[id] === 1 && pos <= scrollSize || stickyMap[id] === 2 && pos >= scrollSize + boundsSize - size), measures = {
1587
- x: isVertical ? stickyMap[id] === 1 ? 0 : boundsSize - size : pos,
1588
- y: isVertical ? pos : stickyMap[id] === 2 ? boundsSize - size : 0,
1639
+ const isOdd = i % 2 != 0, sticky = (_o = (_m = itemConfigMap[id]) === null || _m === void 0 ? void 0 : _m.sticky) !== null && _o !== void 0 ? _o : 0, selectable = (_q = (_p = itemConfigMap[id]) === null || _p === void 0 ? void 0 : _p.selectable) !== null && _q !== void 0 ? _q : true, snapped = snap && (sticky === 1 && pos <= scrollSize || sticky === 2 && pos >= scrollSize + boundsSize - size), measures = {
1640
+ x: isVertical ? sticky === 1 ? 0 : boundsSize - size : pos,
1641
+ y: isVertical ? pos : sticky === 2 ? boundsSize - size : 0,
1589
1642
  width: isVertical ? normalizedItemWidth : size,
1590
1643
  height: isVertical ? size : normalizedItemHeight,
1591
1644
  delta: 0,
@@ -1593,7 +1646,8 @@ class TrackBox extends CacheMap {
1593
1646
  odd: isOdd,
1594
1647
  even: !isOdd,
1595
1648
  isVertical,
1596
- sticky: stickyMap[id],
1649
+ selectable,
1650
+ sticky: sticky,
1597
1651
  snap,
1598
1652
  snapped: false,
1599
1653
  snappedOut: false,
@@ -1606,7 +1660,7 @@ class TrackBox extends CacheMap {
1606
1660
  }
1607
1661
  const itemData = items[i];
1608
1662
  const item = { index: i, id, measures, data: itemData, config };
1609
- if (!nextSticky && stickyItemIndex < i && stickyMap[id] === 1 && (pos <= scrollSize + size + stickyItemSize)) {
1663
+ if (!nextSticky && stickyItemIndex < i && sticky === 1 && (pos <= scrollSize + size + stickyItemSize)) {
1610
1664
  item.measures.x = isVertical ? 0 : snapped ? actualSnippedPosition : pos;
1611
1665
  item.measures.y = isVertical ? snapped ? actualSnippedPosition : pos : 0;
1612
1666
  nextSticky = item;
@@ -1614,7 +1668,7 @@ class TrackBox extends CacheMap {
1614
1668
  nextSticky.measures.delta = isVertical ? (item.measures.y - scrollSize) : (item.measures.x - scrollSize);
1615
1669
  nextSticky.config.zIndex = '3';
1616
1670
  }
1617
- else if (!nextEndSticky && endStickyItemIndex > i && stickyMap[id] === 2 && (pos >= scrollSize + boundsSize - size - endStickyItemSize)) {
1671
+ else if (!nextEndSticky && endStickyItemIndex > i && sticky === 2 && (pos >= scrollSize + boundsSize - size - endStickyItemSize)) {
1618
1672
  item.measures.x = isVertical ? 0 : snapped ? actualEndSnippedPosition - size : pos;
1619
1673
  item.measures.y = isVertical ? snapped ? actualEndSnippedPosition - size : pos : 0;
1620
1674
  nextEndSticky = item;
@@ -1813,6 +1867,8 @@ class NgVirtualListComponent extends DisposableComponent {
1813
1867
  };
1814
1868
  this._$selectedIds = new BehaviorSubject$1(undefined);
1815
1869
  this.$selectedIds = this._$selectedIds.asObservable();
1870
+ this._$selectByClick = new BehaviorSubject$1(DEFAULT_SELECT_BY_CLICK);
1871
+ this.$selectByClick = this._$selectByClick.asObservable();
1816
1872
  this._$snap = new BehaviorSubject$1(DEFAULT_SNAP);
1817
1873
  this.$snap = this._$snap.asObservable();
1818
1874
  this._$enabledBufferOptimization = new BehaviorSubject$1(DEFAULT_ENABLED_BUFFER_OPTIMIZATION);
@@ -1820,8 +1876,8 @@ class NgVirtualListComponent extends DisposableComponent {
1820
1876
  this._$itemRenderer = new BehaviorSubject$1(undefined);
1821
1877
  this.$itemRenderer = this._$itemRenderer.asObservable();
1822
1878
  this._$renderer = new BehaviorSubject$1(undefined);
1823
- this._$stickyMap = new BehaviorSubject$1({});
1824
- this.$stickyMap = this._$stickyMap.asObservable();
1879
+ this._$itemConfigMap = new BehaviorSubject$1({});
1880
+ this.$itemConfigMap = this._$itemConfigMap.asObservable();
1825
1881
  this._itemSizeOptions = (v) => {
1826
1882
  if (v === undefined) {
1827
1883
  return DEFAULT_ITEM_SIZE;
@@ -1970,11 +2026,14 @@ class NgVirtualListComponent extends DisposableComponent {
1970
2026
  this._$initialized = new BehaviorSubject$1(false);
1971
2027
  this.$initialized = this._$initialized.asObservable();
1972
2028
  this._trackBox.displayComponents = this._displayComponents;
1973
- const $trackBy = this.$trackBy;
2029
+ const $trackBy = this.$trackBy, $selectByClick = this.$selectByClick;
2030
+ $selectByClick.pipe(takeUntil(this._$unsubscribe), tap(v => {
2031
+ this._service.selectByClick = v;
2032
+ })).subscribe();
1974
2033
  $trackBy.pipe(takeUntil(this._$unsubscribe), tap(v => {
1975
2034
  this._trackBox.trackingPropertyName = v;
1976
2035
  })).subscribe();
1977
- const $bounds = this._$bounds.asObservable().pipe(filter(b => !!b)), $items = this.$items.pipe(map$1(i => !i ? [] : i)), $scrollSize = this._$scrollSize.asObservable(), $itemSize = this.$itemSize.pipe(map$1(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = this.$bufferSize.pipe(map$1(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = this.$maxBufferSize.pipe(map$1(v => v < 0 ? DEFAULT_MAX_BUFFER_SIZE : v)), $stickyMap = this.$stickyMap.pipe(map$1(v => !v ? {} : v)), $snap = this.$snap, $isVertical = this.$direction.pipe(map$1(v => this.getIsVertical(v || DEFAULT_DIRECTION))), $dynamicSize = this.$dynamicSize, $enabledBufferOptimization = this.$enabledBufferOptimization, $snappingMethod = this.$snappingMethod.pipe(map$1(v => this.getIsSnappingMethodAdvanced(v || DEFAULT_SNAPPING_METHOD))), $methodForSelecting = this.$methodForSelecting, $selectedIds = this.$selectedIds, $cacheVersion = this.$cacheVersion;
2036
+ const $bounds = this._$bounds.asObservable().pipe(filter(b => !!b)), $items = this.$items.pipe(map$1(i => !i ? [] : i)), $scrollSize = this._$scrollSize.asObservable(), $itemSize = this.$itemSize.pipe(map$1(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = this.$bufferSize.pipe(map$1(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = this.$maxBufferSize.pipe(map$1(v => v < 0 ? DEFAULT_MAX_BUFFER_SIZE : v)), $itemConfigMap = this.$itemConfigMap.pipe(map$1(v => !v ? {} : v)), $snap = this.$snap, $isVertical = this.$direction.pipe(map$1(v => this.getIsVertical(v || DEFAULT_DIRECTION))), $dynamicSize = this.$dynamicSize, $enabledBufferOptimization = this.$enabledBufferOptimization, $snappingMethod = this.$snappingMethod.pipe(map$1(v => this.getIsSnappingMethodAdvanced(v || DEFAULT_SNAPPING_METHOD))), $methodForSelecting = this.$methodForSelecting, $selectedIds = this.$selectedIds, $cacheVersion = this.$cacheVersion;
1978
2037
  $isVertical.pipe(takeUntil(this._$unsubscribe), tap(v => {
1979
2038
  this._isVertical = v;
1980
2039
  const el = this._elementRef.nativeElement;
@@ -1990,7 +2049,6 @@ class NgVirtualListComponent extends DisposableComponent {
1990
2049
  this._isMultiSelecting = true;
1991
2050
  this._isNotSelecting = this._isSingleSelecting = false;
1992
2051
  if (el) {
1993
- console.log('set role', ROLE_LIST_BOX);
1994
2052
  el.setAttribute('role', ROLE_LIST_BOX);
1995
2053
  }
1996
2054
  this._service.methodOfSelecting = MethodsForSelectingTypes.MULTI_SELECT;
@@ -1999,7 +2057,6 @@ class NgVirtualListComponent extends DisposableComponent {
1999
2057
  this._isSingleSelecting = true;
2000
2058
  this._isNotSelecting = this._isMultiSelecting = false;
2001
2059
  if (el) {
2002
- console.log('set role', ROLE_LIST_BOX);
2003
2060
  el.setAttribute('role', ROLE_LIST_BOX);
2004
2061
  }
2005
2062
  this._service.methodOfSelecting = MethodsForSelectingTypes.SELECT;
@@ -2008,7 +2065,6 @@ class NgVirtualListComponent extends DisposableComponent {
2008
2065
  this._isNotSelecting = true;
2009
2066
  this._isSingleSelecting = this._isMultiSelecting = false;
2010
2067
  if (el) {
2011
- console.log('set role', ROLE_LIST);
2012
2068
  el.setAttribute('role', ROLE_LIST);
2013
2069
  }
2014
2070
  this._service.methodOfSelecting = MethodsForSelectingTypes.NONE;
@@ -2017,15 +2073,15 @@ class NgVirtualListComponent extends DisposableComponent {
2017
2073
  $dynamicSize.pipe(takeUntil(this._$unsubscribe), tap(dynamicSize => {
2018
2074
  this.listenCacheChangesIfNeed(dynamicSize);
2019
2075
  })).subscribe();
2020
- combineLatest([this.$initialized, $bounds, $items, $stickyMap, $scrollSize, $itemSize,
2076
+ combineLatest([this.$initialized, $bounds, $items, $itemConfigMap, $scrollSize, $itemSize,
2021
2077
  $bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion,
2022
- ]).pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), filter(([initialized]) => !!initialized), switchMap(([, bounds, items, stickyMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
2078
+ ]).pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), filter(([initialized]) => !!initialized), switchMap(([, bounds, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
2023
2079
  var _a, _b, _c, _d;
2024
2080
  let actualScrollSize = (_d = (this._isVertical ? (_b = (_a = this._container) === null || _a === void 0 ? void 0 : _a.nativeElement.scrollTop) !== null && _b !== void 0 ? _b : 0 : (_c = this._container) === null || _c === void 0 ? void 0 : _c.nativeElement.scrollLeft)) !== null && _d !== void 0 ? _d : 0;
2025
2081
  const { width, height } = bounds, opts = {
2026
2082
  bounds: { width, height }, dynamicSize, isVertical, itemSize,
2027
2083
  bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
2028
- }, { displayItems, totalSize } = this._trackBox.updateCollection(items, stickyMap, opts);
2084
+ }, { displayItems, totalSize } = this._trackBox.updateCollection(items, itemConfigMap, opts);
2029
2085
  this.resetBoundsSize(isVertical, totalSize);
2030
2086
  this.createDisplayComponentsIfNeed(displayItems);
2031
2087
  this.tracking();
@@ -2057,10 +2113,19 @@ class NgVirtualListComponent extends DisposableComponent {
2057
2113
  this._service.$itemClick.pipe(takeUntil(this._$unsubscribe), tap(v => {
2058
2114
  this.onItemClick.emit(v !== null && v !== void 0 ? v : undefined);
2059
2115
  })).subscribe();
2060
- this._service.$selectedIds.pipe(takeUntil(this._$unsubscribe), tap(v => {
2061
- this.onSelect.emit(v);
2116
+ let isSelectedIdsFirstEmit = 0;
2117
+ this._service.$selectedIds.pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), tap(v => {
2118
+ if (this.isSingleSelecting || (this.isMultiSelecting && isSelectedIdsFirstEmit >= 2)) {
2119
+ const curr = this._$selectedIds.getValue();
2120
+ if ((this.isSingleSelecting && JSON.stringify(v) !== JSON.stringify(curr)) || (isSelectedIdsFirstEmit === 2 && JSON.stringify(v) !== JSON.stringify(curr)) || isSelectedIdsFirstEmit > 2) {
2121
+ this.onSelect.emit(v);
2122
+ }
2123
+ }
2124
+ if (isSelectedIdsFirstEmit < 3) {
2125
+ isSelectedIdsFirstEmit++;
2126
+ }
2062
2127
  })).subscribe();
2063
- $selectedIds.pipe(takeUntil(this._$unsubscribe), tap(v => {
2128
+ $selectedIds.pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), tap(v => {
2064
2129
  this._service.setSelectedIds(v);
2065
2130
  })).subscribe();
2066
2131
  }
@@ -2093,6 +2158,19 @@ class NgVirtualListComponent extends DisposableComponent {
2093
2158
  }
2094
2159
  ;
2095
2160
  get selectedIds() { return this._$selectedIds.getValue(); }
2161
+ /**
2162
+ * If false, the element is selected using the config.select method passed to the template;
2163
+ * if true, the element is selected by clicking on it. The default value is true.
2164
+ */
2165
+ set selectByClick(v) {
2166
+ if (this._$selectByClick.getValue() === v) {
2167
+ return;
2168
+ }
2169
+ this._$selectByClick.next(v);
2170
+ this._cdr.markForCheck();
2171
+ }
2172
+ ;
2173
+ get selectByClick() { return this._$selectByClick.getValue(); }
2096
2174
  /**
2097
2175
  * Determines whether elements will snap. Default value is "true".
2098
2176
  */
@@ -2133,18 +2211,22 @@ class NgVirtualListComponent extends DisposableComponent {
2133
2211
  ;
2134
2212
  get itemRenderer() { return this._$itemRenderer.getValue(); }
2135
2213
  /**
2136
- * Dictionary zIndex by id of the list element. If the value is not set or equal to 0,
2137
- * then a simple element is displayed, if the value is greater than 0, then the sticky position mode is enabled for the element.
2214
+ * Sets sticky position and selectable for the list item element. If sticky position is greater than 0, then sticky position is applied.
2215
+ * If the sticky value is greater than `0`, then the sticky position mode is enabled for the element. `1` - position start, `2` - position end. Default value is `0`.
2216
+ * selectable determines whether an element can be selected or not. Default value is `true`.
2217
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/item-config-map.model.ts
2218
+ * @author Evgenii Grebennikov
2219
+ * @email djonnyx@gmail.com
2138
2220
  */
2139
- set stickyMap(v) {
2140
- if (this._$stickyMap.getValue() === v) {
2221
+ set itemConfigMap(v) {
2222
+ if (this._$itemConfigMap.getValue() === v) {
2141
2223
  return;
2142
2224
  }
2143
- this._$stickyMap.next(v);
2225
+ this._$itemConfigMap.next(v);
2144
2226
  this._cdr.markForCheck();
2145
2227
  }
2146
2228
  ;
2147
- get stickyMap() { return this._$stickyMap.getValue(); }
2229
+ get itemConfigMap() { return this._$itemConfigMap.getValue(); }
2148
2230
  /**
2149
2231
  * If direction = 'vertical', then the height of a typical element. If direction = 'horizontal', then the width of a typical element.
2150
2232
  * Ignored if the dynamicSize property is true.
@@ -2383,24 +2465,24 @@ class NgVirtualListComponent extends DisposableComponent {
2383
2465
  if (container) {
2384
2466
  container.nativeElement.removeEventListener(SCROLL, this._onScrollHandler);
2385
2467
  }
2386
- const { width, height } = this._$bounds.getValue() || { width: 0, height: 0 }, stickyMap = this.stickyMap, items = this.items, isVertical = this._isVertical, delta = this._trackBox.delta, opts = {
2468
+ const { width, height } = this._$bounds.getValue() || { width: 0, height: 0 }, itemConfigMap = this.itemConfigMap, items = this.items, isVertical = this._isVertical, delta = this._trackBox.delta, opts = {
2387
2469
  bounds: { width, height }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize,
2388
2470
  bufferSize: this.bufferSize, maxBufferSize: this.maxBufferSize, scrollSize: (isVertical ? container.nativeElement.scrollTop : container.nativeElement.scrollLeft) + delta,
2389
2471
  snap: this.snap, fromItemId: id, enabledBufferOptimization: this.enabledBufferOptimization,
2390
- }, scrollSize = this._trackBox.getItemPosition(id, stickyMap, opts), params = { [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior };
2472
+ }, scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, opts), params = { [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior };
2391
2473
  if (scrollSize === -1) {
2392
2474
  container.nativeElement.addEventListener(SCROLL, this._onScrollHandler);
2393
2475
  return;
2394
2476
  }
2395
2477
  this._trackBox.clearDelta();
2396
2478
  if (container) {
2397
- const { displayItems, totalSize } = this._trackBox.updateCollection(items, stickyMap, Object.assign(Object.assign({}, opts), { scrollSize, fromItemId: isLastIteration ? undefined : id })), delta = this._trackBox.delta;
2479
+ const { displayItems, totalSize } = this._trackBox.updateCollection(items, itemConfigMap, Object.assign(Object.assign({}, opts), { scrollSize, fromItemId: isLastIteration ? undefined : id })), delta = this._trackBox.delta;
2398
2480
  this._trackBox.clearDelta();
2399
2481
  let actualScrollSize = scrollSize + delta;
2400
2482
  this.resetBoundsSize(isVertical, totalSize);
2401
2483
  this.createDisplayComponentsIfNeed(displayItems);
2402
2484
  this.tracking();
2403
- const _scrollSize = this._trackBox.getItemPosition(id, stickyMap, Object.assign(Object.assign({}, opts), { scrollSize: actualScrollSize, fromItemId: id }));
2485
+ const _scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, Object.assign(Object.assign({}, opts), { scrollSize: actualScrollSize, fromItemId: id }));
2404
2486
  if (_scrollSize === -1) {
2405
2487
  container.nativeElement.addEventListener(SCROLL, this._onScrollHandler);
2406
2488
  return;
@@ -2494,7 +2576,7 @@ class NgVirtualListComponent extends DisposableComponent {
2494
2576
  }
2495
2577
  NgVirtualListComponent.__nextId = 0;
2496
2578
  NgVirtualListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: NgVirtualListService }], target: i0.ɵɵFactoryTarget.Component });
2497
- NgVirtualListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: NgVirtualListComponent, selector: "ng-virtual-list", inputs: { items: "items", selectedIds: "selectedIds", snap: "snap", enabledBufferOptimization: "enabledBufferOptimization", itemRenderer: "itemRenderer", stickyMap: "stickyMap", itemSize: "itemSize", dynamicSize: "dynamicSize", direction: "direction", itemsOffset: "itemsOffset", bufferSize: "bufferSize", maxBufferSize: "maxBufferSize", trackBy: "trackBy", snappingMethod: "snappingMethod", methodForSelecting: "methodForSelecting" }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, read: (ElementRef) }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, read: (ElementRef) }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snappedContainer", first: true, predicate: ["snapped"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"snap\" #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <div [attr.aria-orientation]=\"orientation\" #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </div>\r\n</div>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.horizontal) .ngvl__list{display:inline-flex}:host(.horizontal) .ngvl__scroller{overflow:auto hidden}:host(.vertical) .ngvl__scroller{overflow:hidden auto}:host(.vertical){height:320px}.ngvl__scroller{overflow:auto;width:100%;height:100%}.ngvl__list-snapper{pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list{position:relative;list-style:none;padding:0;margin:0;width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
2579
+ NgVirtualListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: NgVirtualListComponent, selector: "ng-virtual-list", inputs: { items: "items", selectedIds: "selectedIds", selectByClick: "selectByClick", snap: "snap", enabledBufferOptimization: "enabledBufferOptimization", itemRenderer: "itemRenderer", stickyMap: "stickyMap", itemConfigMap: "itemConfigMap", itemSize: "itemSize", dynamicSize: "dynamicSize", direction: "direction", itemsOffset: "itemsOffset", bufferSize: "bufferSize", maxBufferSize: "maxBufferSize", trackBy: "trackBy", snappingMethod: "snappingMethod", methodForSelecting: "methodForSelecting" }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, read: (ElementRef) }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, read: (ElementRef) }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snappedContainer", first: true, predicate: ["snapped"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"snap\" #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <div [attr.aria-orientation]=\"orientation\" #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </div>\r\n</div>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.horizontal) .ngvl__list{display:inline-flex}:host(.horizontal) .ngvl__scroller{overflow:auto hidden}:host(.vertical) .ngvl__scroller{overflow:hidden auto}:host(.vertical){height:320px}.ngvl__scroller{overflow:auto;width:100%;height:100%}.ngvl__list-snapper{pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list{position:relative;list-style:none;padding:0;margin:0;width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
2498
2580
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListComponent, decorators: [{
2499
2581
  type: Component,
2500
2582
  args: [{ selector: 'ng-virtual-list', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, providers: [NgVirtualListService], template: "<div *ngIf=\"snap\" #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <div [attr.aria-orientation]=\"orientation\" #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </div>\r\n</div>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.horizontal) .ngvl__list{display:inline-flex}:host(.horizontal) .ngvl__scroller{overflow:auto hidden}:host(.vertical) .ngvl__scroller{overflow:hidden auto}:host(.vertical){height:320px}.ngvl__scroller{overflow:auto;width:100%;height:100%}.ngvl__list-snapper{pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list{position:relative;list-style:none;padding:0;margin:0;width:100%;height:100%}\n"] }]
@@ -2527,6 +2609,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2527
2609
  type: Input
2528
2610
  }], selectedIds: [{
2529
2611
  type: Input
2612
+ }], selectByClick: [{
2613
+ type: Input
2530
2614
  }], snap: [{
2531
2615
  type: Input
2532
2616
  }], enabledBufferOptimization: [{
@@ -2535,6 +2619,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2535
2619
  type: Input
2536
2620
  }], stickyMap: [{
2537
2621
  type: Input
2622
+ }], itemConfigMap: [{
2623
+ type: Input
2538
2624
  }], itemSize: [{
2539
2625
  type: Input
2540
2626
  }], dynamicSize: [{