ng-virtual-list 20.1.3 → 20.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +7 -7
  2. package/fesm2022/ng-virtual-list.mjs +113 -32
  3. package/fesm2022/ng-virtual-list.mjs.map +1 -1
  4. package/index.d.ts +3 -427
  5. package/lib/components/ng-virtual-list-item.component.d.ts +34 -0
  6. package/lib/const/index.d.ts +41 -0
  7. package/lib/enums/direction.d.ts +8 -0
  8. package/lib/enums/directions.d.ts +16 -0
  9. package/lib/enums/index.d.ts +7 -0
  10. package/lib/enums/snapping-method.d.ts +10 -0
  11. package/lib/enums/snapping-methods.d.ts +16 -0
  12. package/lib/models/collection.model.d.ts +9 -0
  13. package/lib/models/index.d.ts +6 -0
  14. package/lib/models/item.model.d.ts +14 -0
  15. package/lib/models/render-collection.model.d.ts +9 -0
  16. package/lib/models/render-item-config.model.d.ts +41 -0
  17. package/lib/models/render-item.model.d.ts +33 -0
  18. package/lib/models/scroll-direction.model.d.ts +5 -0
  19. package/lib/models/scroll-event.model.d.ts +50 -0
  20. package/lib/models/sticky-map.model.d.ts +14 -0
  21. package/lib/ng-virtual-list.component.d.ts +144 -0
  22. package/lib/types/id.d.ts +7 -0
  23. package/lib/types/index.d.ts +4 -0
  24. package/lib/types/rect.d.ts +17 -0
  25. package/lib/types/size.d.ts +16 -0
  26. package/lib/utils/browser.d.ts +2 -0
  27. package/lib/utils/cacheMap.d.ts +60 -0
  28. package/lib/utils/debounce.d.ts +16 -0
  29. package/lib/utils/eventEmitter.d.ts +40 -0
  30. package/lib/utils/index.d.ts +7 -0
  31. package/lib/utils/isDirection.d.ts +8 -0
  32. package/lib/utils/scrollEvent.d.ts +39 -0
  33. package/lib/utils/snapping-method.d.ts +3 -0
  34. package/lib/utils/toggleClassName.d.ts +7 -0
  35. package/lib/utils/trackBox.d.ts +180 -0
  36. package/lib/utils/tracker.d.ts +44 -0
  37. package/package.json +1 -1
  38. package/public-api.d.ts +4 -0
package/README.md CHANGED
@@ -455,7 +455,7 @@ Inputs
455
455
  | itemSize | number? = 24 | If direction = 'vertical', then the height of a typical element. If direction = 'horizontal', then the width of a typical element. Ignored if the dynamicSize property is true. |
456
456
  | itemsOffset | number? = 2 | Number of elements outside the scope of visibility. Default value is 2. |
457
457
  | itemRenderer | TemplateRef | Rendering element template. |
458
- | stickyMap | [IVirtualListStickyMap?](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/models/sticky-map.model.ts) | Dictionary zIndex by id of the list element. If the value is not set or equal to 0, then a simple element is displayed, if the value is greater than 0, then the sticky position mode is enabled for the element. |
458
+ | stickyMap | [IVirtualListStickyMap?](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/models/sticky-map.model.ts) | Dictionary zIndex by id of the list element. If the value is not set or equal to 0, then a simple element is displayed, if the value is greater than 0, then the sticky position mode is enabled for the element. 1 - position start, 2 - position end. |
459
459
  | snap | boolean? = false | Determines whether elements will snap. Default value is "false". |
460
460
  | snappingMethod | [SnappingMethod? = 'normal'](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/enums/snapping-method.ts) | Snapping method. 'normal' - Normal group rendering. 'advanced' - The group is rendered on a transparent background. List items below the group are not rendered. |
461
461
  | direction | [Direction? = 'vertical'](https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/enums/direction.ts) | Determines the direction in which elements are placed. Default value is "vertical". |
@@ -488,12 +488,12 @@ Methods
488
488
 
489
489
  | Angular version | ng-virtual-list version | git | npm |
490
490
  |--|--|--|--|
491
- | 19.x | 19.2.6 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.2.6](https://www.npmjs.com/package/ng-virtual-list/v/19.2.6) |
492
- | 18.x | 18.1.3 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.1.3](https://www.npmjs.com/package/ng-virtual-list/v/18.1.3) |
493
- | 17.x | 17.1.3 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.1.3](https://www.npmjs.com/package/ng-virtual-list/v/17.1.3) |
494
- | 16.x | 16.1.4 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.1.4](https://www.npmjs.com/package/ng-virtual-list/v/16.1.4) |
495
- | 15.x | 15.1.3 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.1.3](https://www.npmjs.com/package/ng-virtual-list/v/15.1.3) |
496
- | 14.x | 14.1.3 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.1.3](https://www.npmjs.com/package/ng-virtual-list/v/14.1.3) |
491
+ | 19.x | 19.3.2 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.3.2](https://www.npmjs.com/package/ng-virtual-list/v/19.3.2) |
492
+ | 18.x | 18.2.0 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.2.0](https://www.npmjs.com/package/ng-virtual-list/v/18.2.0) |
493
+ | 17.x | 17.2.0 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.2.0](https://www.npmjs.com/package/ng-virtual-list/v/17.2.0) |
494
+ | 16.x | 16.2.0 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.2.0](https://www.npmjs.com/package/ng-virtual-list/v/16.2.0) |
495
+ | 15.x | 15.2.0 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.2.0](https://www.npmjs.com/package/ng-virtual-list/v/15.2.0) |
496
+ | 14.x | 14.2.0 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.2.0](https://www.npmjs.com/package/ng-virtual-list/v/14.2.0) |
497
497
 
498
498
  <br/>
499
499
 
@@ -135,9 +135,10 @@ class NgVirtualListItemComponent {
135
135
  const data = this._data, regular = this.regular, length = this._regularLength;
136
136
  if (data) {
137
137
  const styles = this._elementRef.nativeElement.style;
138
- styles.zIndex = String(data.config.sticky);
138
+ styles.zIndex = data.config.zIndex;
139
139
  if (data.config.snapped) {
140
- styles.transform = ZEROS_TRANSLATE_3D;
140
+ styles.transform = data.config.sticky === 1 ? ZEROS_TRANSLATE_3D : `${TRANSLATE_3D}(${data.config.isVertical ? 0 : data.measures.x}${PX}, ${data.config.isVertical ? data.measures.y : 0}${PX} , 0)`;
141
+ ;
141
142
  if (!data.config.isSnappingMethodAdvanced) {
142
143
  styles.position = POSITION_STICKY;
143
144
  }
@@ -173,7 +174,7 @@ class NgVirtualListItemComponent {
173
174
  }
174
175
  styles.visibility = VISIBILITY_VISIBLE;
175
176
  }
176
- styles.zIndex = String(this._data?.config?.sticky ?? DEFAULT_ZINDEX);
177
+ styles.zIndex = this._data?.config?.zIndex ?? DEFAULT_ZINDEX;
177
178
  }
178
179
  hide() {
179
180
  const styles = this._elementRef.nativeElement.style;
@@ -193,10 +194,10 @@ class NgVirtualListItemComponent {
193
194
  styles.transform = ZEROS_TRANSLATE_3D;
194
195
  styles.zIndex = HIDDEN_ZINDEX;
195
196
  }
196
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgVirtualListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
197
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: NgVirtualListItemComponent, isStandalone: true, selector: "ng-virtual-list-item", host: { classAttribute: "ngvl__item" }, ngImport: i0, template: "@let item = data();\r\n@let renderer = itemRenderer();\r\n\r\n@if (item) {\r\n <li #listItem part=\"item\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': item.config.snapped,\r\n 'snapped-out': item.config.snappedOut}\">\r\n @if (renderer) {\r\n <ng-container [ngTemplateOutlet]=\"renderer\"\r\n [ngTemplateOutletContext]=\"{data: item.data || {}, config: item.config}\" />\r\n }\r\n </li>\r\n}", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;will-change:scroll-position}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
197
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
198
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: NgVirtualListItemComponent, isStandalone: true, selector: "ng-virtual-list-item", host: { classAttribute: "ngvl__item" }, ngImport: i0, template: "@let item = data();\r\n@let renderer = itemRenderer();\r\n\r\n@if (item) {\r\n <li #listItem part=\"item\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': item.config.snapped,\r\n 'snapped-out': item.config.snappedOut}\">\r\n @if (renderer) {\r\n <ng-container [ngTemplateOutlet]=\"renderer\"\r\n [ngTemplateOutletContext]=\"{data: item.data || {}, config: item.config}\" />\r\n }\r\n </li>\r\n}", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;will-change:scroll-position}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
198
199
  }
199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
200
201
  type: Component,
201
202
  args: [{ selector: 'ng-virtual-list-item', imports: [CommonModule], host: {
202
203
  'class': 'ngvl__item',
@@ -254,12 +255,12 @@ const debounce = (cb, debounceTime = 0) => {
254
255
  * @author Evgenii Grebennikov
255
256
  * @email djonnyx@gmail.com
256
257
  */
257
- const toggleClassName = (el, className, remove = false) => {
258
+ const toggleClassName = (el, className, removeClassName) => {
258
259
  if (!el.classList.contains(className)) {
259
260
  el.classList.add(className);
260
261
  }
261
- else if (remove) {
262
- el.classList.remove(className);
262
+ if (removeClassName) {
263
+ el.classList.remove(removeClassName);
263
264
  }
264
265
  };
265
266
 
@@ -325,7 +326,17 @@ class Tracker {
325
326
  }
326
327
  }
327
328
  comp.instance.item = item;
328
- comp.instance.show();
329
+ if (snapedComponent) {
330
+ if (item['config']['snapped'] || item['config']['snappedOut']) {
331
+ comp.instance.hide();
332
+ }
333
+ else {
334
+ comp.instance.show();
335
+ }
336
+ }
337
+ else {
338
+ comp.instance.show();
339
+ }
329
340
  untrackedItems.splice(indexByUntrackedItems, 1);
330
341
  continue;
331
342
  }
@@ -344,7 +355,17 @@ class Tracker {
344
355
  }
345
356
  }
346
357
  comp.instance.item = item;
347
- comp.instance.show();
358
+ if (snapedComponent) {
359
+ if (item['config']['snapped'] || item['config']['snappedOut']) {
360
+ comp.instance.hide();
361
+ }
362
+ else {
363
+ comp.instance.show();
364
+ }
365
+ }
366
+ else {
367
+ comp.instance.show();
368
+ }
348
369
  if (this._trackMap) {
349
370
  this._trackMap[itemTrackingProperty] = comp.instance.id;
350
371
  }
@@ -962,7 +983,7 @@ class TrackBox extends CacheMap {
962
983
  }
963
984
  }
964
985
  if (deletedItemsMap.hasOwnProperty(i)) {
965
- const bounds = deletedItemsMap[i], size = bounds[sizeProperty] ?? typicalItemSize;
986
+ const bounds = deletedItemsMap[i], size = bounds?.[sizeProperty] ?? typicalItemSize;
966
987
  if (y < scrollSize - size) {
967
988
  leftSizeOfDeletedItems += size;
968
989
  }
@@ -970,7 +991,7 @@ class TrackBox extends CacheMap {
970
991
  totalSize += componentSize;
971
992
  if (isFromId) {
972
993
  if (itemById === undefined) {
973
- if (id !== fromItemId && stickyMap && stickyMap[id] > 0) {
994
+ if (id !== fromItemId && stickyMap && stickyMap[id] === 1) {
974
995
  stickyComponentSize = componentSize;
975
996
  stickyCollectionItem = collectionItem;
976
997
  }
@@ -1166,19 +1187,19 @@ class TrackBox extends CacheMap {
1166
1187
  this.bumpVersion();
1167
1188
  }
1168
1189
  generateDisplayCollection(items, stickyMap, metrics) {
1169
- const { normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, } = metrics, displayItems = [];
1190
+ const { width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, } = metrics, displayItems = [];
1170
1191
  if (items.length) {
1171
- const actualSnippedPosition = snippedPos, isSnappingMethodAdvanced = this.isSnappingMethodAdvanced;
1172
- let pos = startPosition, renderItems = renderItemsLength, stickyItem, nextSticky, stickyItemIndex = -1, stickyItemSize = 0;
1192
+ const actualSnippedPosition = snippedPos, isSnappingMethodAdvanced = this.isSnappingMethodAdvanced, boundsSize = isVertical ? height : width, actualEndSnippedPosition = boundsSize;
1193
+ let pos = startPosition, renderItems = renderItemsLength, stickyItem, nextSticky, stickyItemIndex = -1, stickyItemSize = 0, endStickyItem, nextEndSticky, endStickyItemIndex = -1, endStickyItemSize = 0;
1173
1194
  if (snap) {
1174
1195
  for (let i = Math.min(itemsFromStartToScrollEnd > 0 ? itemsFromStartToScrollEnd : 0, totalLength - 1); i >= 0; i--) {
1175
1196
  const id = items[i].id, sticky = stickyMap[id], size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
1176
- if (sticky > 0) {
1197
+ if (sticky === 1) {
1177
1198
  const measures = {
1178
1199
  x: isVertical ? 0 : actualSnippedPosition,
1179
1200
  y: isVertical ? actualSnippedPosition : 0,
1180
- width: normalizedItemWidth,
1181
- height: normalizedItemHeight,
1201
+ width: isVertical ? normalizedItemWidth : size,
1202
+ height: isVertical ? size : normalizedItemHeight,
1182
1203
  delta: 0,
1183
1204
  }, config = {
1184
1205
  isVertical,
@@ -1188,6 +1209,7 @@ class TrackBox extends CacheMap {
1188
1209
  snappedOut: false,
1189
1210
  dynamic: dynamicSize,
1190
1211
  isSnappingMethodAdvanced,
1212
+ zIndex: '1',
1191
1213
  };
1192
1214
  const itemData = items[i];
1193
1215
  stickyItem = { id, measures, data: itemData, config };
@@ -1198,18 +1220,50 @@ class TrackBox extends CacheMap {
1198
1220
  }
1199
1221
  }
1200
1222
  }
1223
+ if (snap) {
1224
+ const startIndex = itemsFromStartToScrollEnd + itemsOnDisplayLength - 1;
1225
+ for (let i = Math.min(startIndex, totalLength > 0 ? totalLength - 1 : 0), l = totalLength; i < l; i++) {
1226
+ const id = items[i].id, sticky = stickyMap[id], size = dynamicSize
1227
+ ? this.get(id)?.[sizeProperty] || typicalItemSize
1228
+ : typicalItemSize;
1229
+ if (sticky === 2) {
1230
+ const w = isVertical ? normalizedItemWidth : size, h = isVertical ? size : normalizedItemHeight, measures = {
1231
+ x: isVertical ? 0 : actualEndSnippedPosition - w,
1232
+ y: isVertical ? actualEndSnippedPosition - h : 0,
1233
+ width: w,
1234
+ height: h,
1235
+ delta: 0,
1236
+ }, config = {
1237
+ isVertical,
1238
+ sticky,
1239
+ snap,
1240
+ snapped: true,
1241
+ snappedOut: false,
1242
+ dynamic: dynamicSize,
1243
+ isSnappingMethodAdvanced,
1244
+ zIndex: '1',
1245
+ };
1246
+ const itemData = items[i];
1247
+ endStickyItem = { id, measures, data: itemData, config };
1248
+ endStickyItemIndex = i;
1249
+ endStickyItemSize = size;
1250
+ displayItems.push(endStickyItem);
1251
+ break;
1252
+ }
1253
+ }
1254
+ }
1201
1255
  let i = startIndex;
1202
1256
  while (renderItems > 0) {
1203
1257
  if (i >= totalLength) {
1204
1258
  break;
1205
1259
  }
1206
1260
  const id = items[i].id, size = dynamicSize ? this.get(id)?.[sizeProperty] || typicalItemSize : typicalItemSize;
1207
- if (id !== stickyItem?.id) {
1208
- const snapped = snap && stickyMap[id] > 0 && pos <= scrollSize, measures = {
1209
- x: isVertical ? 0 : pos,
1210
- y: isVertical ? pos : 0,
1211
- width: normalizedItemWidth,
1212
- height: normalizedItemHeight,
1261
+ if (id !== stickyItem?.id && id !== endStickyItem?.id) {
1262
+ const snapped = snap && (stickyMap[id] === 1 && pos <= scrollSize || stickyMap[id] === 2 && pos >= scrollSize + boundsSize - size), measures = {
1263
+ x: isVertical ? stickyMap[id] === 1 ? 0 : boundsSize - size : pos,
1264
+ y: isVertical ? pos : stickyMap[id] === 2 ? boundsSize - size : 0,
1265
+ width: isVertical ? normalizedItemWidth : size,
1266
+ height: isVertical ? size : normalizedItemHeight,
1213
1267
  delta: 0,
1214
1268
  }, config = {
1215
1269
  isVertical,
@@ -1219,15 +1273,28 @@ class TrackBox extends CacheMap {
1219
1273
  snappedOut: false,
1220
1274
  dynamic: dynamicSize,
1221
1275
  isSnappingMethodAdvanced,
1276
+ zIndex: '0',
1222
1277
  };
1278
+ if (snapped) {
1279
+ config.zIndex = '2';
1280
+ }
1223
1281
  const itemData = items[i];
1224
1282
  const item = { id, measures, data: itemData, config };
1225
- if (!nextSticky && stickyItemIndex < i && stickyMap[id] > 0 && pos <= scrollSize + size + stickyItemSize) {
1283
+ if (!nextSticky && stickyItemIndex < i && stickyMap[id] === 1 && (pos <= scrollSize + size + stickyItemSize)) {
1226
1284
  item.measures.x = isVertical ? 0 : snapped ? actualSnippedPosition : pos;
1227
1285
  item.measures.y = isVertical ? snapped ? actualSnippedPosition : pos : 0;
1228
1286
  nextSticky = item;
1229
1287
  nextSticky.config.snapped = snapped;
1230
- nextSticky.measures.delta = isVertical ? item.measures.y - scrollSize : item.measures.x - scrollSize;
1288
+ nextSticky.measures.delta = isVertical ? (item.measures.y - scrollSize) : (item.measures.x - scrollSize);
1289
+ nextSticky.config.zIndex = '3';
1290
+ }
1291
+ else if (!nextEndSticky && endStickyItemIndex > i && stickyMap[id] === 2 && (pos >= scrollSize + boundsSize - size - endStickyItemSize)) {
1292
+ item.measures.x = isVertical ? 0 : snapped ? actualEndSnippedPosition - size : pos;
1293
+ item.measures.y = isVertical ? snapped ? actualEndSnippedPosition - size : pos : 0;
1294
+ nextEndSticky = item;
1295
+ nextEndSticky.config.zIndex = '3';
1296
+ nextEndSticky.config.snapped = snapped;
1297
+ nextEndSticky.measures.delta = isVertical ? (item.measures.y - scrollSize) : (item.measures.x - scrollSize);
1231
1298
  }
1232
1299
  displayItems.push(item);
1233
1300
  }
@@ -1249,6 +1316,19 @@ class TrackBox extends CacheMap {
1249
1316
  nextSticky.measures.delta = isVertical ? nextSticky.measures.y - scrollSize : nextSticky.measures.x - scrollSize;
1250
1317
  }
1251
1318
  }
1319
+ if (nextEndSticky && endStickyItem && nextEndSticky.measures[axis] >= scrollSize + boundsSize - endStickyItemSize - nextEndSticky.measures[sizeProperty]) {
1320
+ if (nextEndSticky.measures[axis] < scrollSize + boundsSize - endStickyItemSize) {
1321
+ endStickyItem.measures[axis] = nextEndSticky.measures[axis] + nextEndSticky.measures[sizeProperty];
1322
+ endStickyItem.config.snapped = nextEndSticky.config.snapped = false;
1323
+ endStickyItem.config.snappedOut = true;
1324
+ endStickyItem.config.sticky = 2;
1325
+ endStickyItem.measures.delta = isVertical ? endStickyItem.measures.y - scrollSize : endStickyItem.measures.x - scrollSize;
1326
+ }
1327
+ else {
1328
+ nextEndSticky.config.snapped = true;
1329
+ nextEndSticky.measures.delta = isVertical ? nextEndSticky.measures.y - scrollSize : nextEndSticky.measures.x - scrollSize;
1330
+ }
1331
+ }
1252
1332
  }
1253
1333
  return displayItems;
1254
1334
  }
@@ -1441,6 +1521,7 @@ class NgVirtualListComponent {
1441
1521
  */
1442
1522
  snappingMethod = input(DEFAULT_SNAPPING_METHOD);
1443
1523
  _isSnappingMethodAdvanced = this.getIsSnappingMethodAdvanced();
1524
+ get isSnappingMethodAdvanced() { return this._isSnappingMethodAdvanced; }
1444
1525
  _isVertical = this.getIsVertical();
1445
1526
  _displayComponents = [];
1446
1527
  _snapedDisplayComponent;
@@ -1532,7 +1613,7 @@ class NgVirtualListComponent {
1532
1613
  $isVertical.pipe(takeUntilDestroyed(), tap(v => {
1533
1614
  this._isVertical = v;
1534
1615
  const el = this._elementRef.nativeElement;
1535
- toggleClassName(el, v ? CLASS_LIST_VERTICAL : CLASS_LIST_HORIZONTAL, true);
1616
+ toggleClassName(el, v ? CLASS_LIST_VERTICAL : CLASS_LIST_HORIZONTAL, v ? CLASS_LIST_HORIZONTAL : CLASS_LIST_VERTICAL);
1536
1617
  })).subscribe();
1537
1618
  $snappingMethod.pipe(takeUntilDestroyed(), tap(v => {
1538
1619
  this._isSnappingMethodAdvanced = this._trackBox.isSnappingMethodAdvanced = v;
@@ -1799,12 +1880,12 @@ class NgVirtualListComponent {
1799
1880
  }
1800
1881
  }
1801
1882
  }
1802
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1803
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: NgVirtualListComponent, isStandalone: true, selector: "ng-virtual-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, snap: { classPropertyName: "snap", publicName: "snap", isSignal: true, isRequired: false, transformFunction: null }, enabledBufferOptimization: { classPropertyName: "enabledBufferOptimization", publicName: "enabledBufferOptimization", isSignal: true, isRequired: false, transformFunction: null }, itemRenderer: { classPropertyName: "itemRenderer", publicName: "itemRenderer", isSignal: true, isRequired: true, transformFunction: null }, stickyMap: { classPropertyName: "stickyMap", publicName: "stickyMap", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, dynamicSize: { classPropertyName: "dynamicSize", publicName: "dynamicSize", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, itemsOffset: { classPropertyName: "itemsOffset", publicName: "itemsOffset", isSignal: true, isRequired: false, transformFunction: null }, snappingMethod: { classPropertyName: "snappingMethod", publicName: "snappingMethod", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd" }, viewQueries: [{ propertyName: "_snappedContainer", first: true, predicate: ["snapped"], descendants: true, isSignal: true }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, isSignal: true }, { propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "@if (snap()) {\r\n<div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n}\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <ul #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </ul>\r\n</div>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}: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: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
1883
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1884
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: NgVirtualListComponent, isStandalone: true, selector: "ng-virtual-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, snap: { classPropertyName: "snap", publicName: "snap", isSignal: true, isRequired: false, transformFunction: null }, enabledBufferOptimization: { classPropertyName: "enabledBufferOptimization", publicName: "enabledBufferOptimization", isSignal: true, isRequired: false, transformFunction: null }, itemRenderer: { classPropertyName: "itemRenderer", publicName: "itemRenderer", isSignal: true, isRequired: true, transformFunction: null }, stickyMap: { classPropertyName: "stickyMap", publicName: "stickyMap", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, dynamicSize: { classPropertyName: "dynamicSize", publicName: "dynamicSize", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, itemsOffset: { classPropertyName: "itemsOffset", publicName: "itemsOffset", isSignal: true, isRequired: false, transformFunction: null }, snappingMethod: { classPropertyName: "snappingMethod", publicName: "snappingMethod", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd" }, viewQueries: [{ propertyName: "_snappedContainer", first: true, predicate: ["snapped"], descendants: true, isSignal: true }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, isSignal: true }, { propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "@if (snap()) {\r\n<div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n}\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <ul #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </ul>\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: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
1804
1885
  }
1805
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgVirtualListComponent, decorators: [{
1886
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListComponent, decorators: [{
1806
1887
  type: Component,
1807
- args: [{ selector: 'ng-virtual-list', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, template: "@if (snap()) {\r\n<div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n}\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <ul #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </ul>\r\n</div>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}: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"] }]
1888
+ args: [{ selector: 'ng-virtual-list', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, template: "@if (snap()) {\r\n<div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n</div>\r\n}\r\n<div #container part=\"scroller\" class=\"ngvl__scroller\">\r\n <ul #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </ul>\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"] }]
1808
1889
  }], ctorParameters: () => [], propDecorators: { _listContainerRef: [{
1809
1890
  type: ViewChild,
1810
1891
  args: ['renderersContainer', { read: ViewContainerRef }]