ng-virtual-list 16.12.0 → 16.12.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 (38) hide show
  1. package/README.md +1 -11
  2. package/esm2022/lib/components/ng-list-item/ng-virtual-list-item.component.mjs +3 -3
  3. package/esm2022/lib/components/ng-prerender-container/components/ng-prerender-list-item/ng-prerender-list-item.component.mjs +3 -3
  4. package/esm2022/lib/components/ng-scroll-bar/ng-scroll-bar.component.mjs +6 -6
  5. package/esm2022/lib/components/ng-scroll-view/const/index.mjs +2 -2
  6. package/esm2022/lib/components/ng-scroll-view/ng-scroll-view.component.mjs +9 -11
  7. package/esm2022/lib/components/ng-scroller/utils/interfaces/calculate-scroll-metrics.mjs +2 -0
  8. package/esm2022/lib/components/ng-scroller/utils/interfaces/calculate-scroll-params.mjs +2 -0
  9. package/esm2022/lib/components/ng-scroller/utils/interfaces/calculate-scroll-position-params.mjs +2 -0
  10. package/esm2022/lib/components/ng-scroller/utils/interfaces/index.mjs +2 -0
  11. package/esm2022/lib/components/ng-scroller/utils/scroll-box.mjs +1 -1
  12. package/esm2022/lib/core/interfaces/recalculate-metrics-options.mjs +1 -1
  13. package/esm2022/lib/core/track-box.mjs +24 -19
  14. package/esm2022/lib/core/tracker.mjs +12 -9
  15. package/esm2022/lib/ng-virtual-list.component.mjs +49 -35
  16. package/esm2022/lib/utils/animator/animator.mjs +2 -2
  17. package/esm2022/lib/utils/animator/interfaces/animator-params.mjs +1 -1
  18. package/esm2022/lib/utils/animator/interfaces/animator-update-data.mjs +1 -1
  19. package/esm2022/lib/utils/animator/types/easing.mjs +1 -1
  20. package/esm2022/lib/utils/event-emitter/event-emitter.mjs +2 -2
  21. package/esm2022/lib/utils/event-emitter/interfaces/event-emitter.mjs +1 -1
  22. package/fesm2022/ng-virtual-list.mjs +100 -81
  23. package/fesm2022/ng-virtual-list.mjs.map +1 -1
  24. package/lib/components/ng-scroll-view/const/index.d.ts +1 -1
  25. package/lib/components/ng-scroller/utils/interfaces/calculate-scroll-metrics.d.ts +11 -0
  26. package/lib/components/ng-scroller/utils/interfaces/calculate-scroll-params.d.ts +19 -0
  27. package/lib/components/ng-scroller/utils/interfaces/calculate-scroll-position-params.d.ts +10 -0
  28. package/lib/components/ng-scroller/utils/interfaces/index.d.ts +4 -0
  29. package/lib/components/ng-scroller/utils/scroll-box.d.ts +1 -18
  30. package/lib/core/interfaces/recalculate-metrics-options.d.ts +2 -1
  31. package/lib/ng-virtual-list.component.d.ts +1 -0
  32. package/lib/utils/animator/animator.d.ts +1 -1
  33. package/lib/utils/animator/interfaces/animator-params.d.ts +1 -1
  34. package/lib/utils/animator/interfaces/animator-update-data.d.ts +1 -1
  35. package/lib/utils/animator/types/easing.d.ts +1 -1
  36. package/lib/utils/event-emitter/event-emitter.d.ts +1 -1
  37. package/lib/utils/event-emitter/interfaces/event-emitter.d.ts +1 -1
  38. package/package.json +1 -1
@@ -1725,14 +1725,14 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
1725
1725
  this._service.virtualClick(this._data);
1726
1726
  }
1727
1727
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1728
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"($data | async) as data\">\r\n <div #item class=\"ngvl-item\" [ngClass]=\"$classes | async\" [part]=\"$part | async\" [attr.ngvl-index]=\"$index | async\"\r\n [attr.ngvl-visibility]=\"visibility\" tabindex=\"-1\">\r\n <div *ngIf=\"_blendColor\" class=\"ngvl-item__blend-color\" [style.--blend-color]=\"_blendColor\"></div>\r\n <div #container virtualClick [part]=\"$fxPart | async\" [maxClickDistance]=\"$maxClickDistance | async\"\r\n class=\"ngvl-item__container\" [ngClass]=\"$classes | async\" (onVirtualClick)=\"onClickHandler()\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer ?? null\"\r\n [ngTemplateOutletContext]=\"$templateContext | async\"></ng-container>\r\n </div>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;text-rendering:optimizeSpeed;image-rendering:auto}.ngvl-item{position:relative;margin:0;padding:0;overflow:hidden;outline:none;width:inherit;height:inherit;box-sizing:border-box}.ngvl-item__blend-color{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--blend-color);z-index:-1}.ngvl-item__container{margin:0;padding:0;width:100%;height:100%;box-sizing:border-box}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: VirtualClickDirective, selector: "[virtualClick]", inputs: ["maxClickDistance"], outputs: ["onVirtualClick"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1728
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"($data | async) as data\">\r\n <div #item class=\"ngvl-item\" [ngClass]=\"($classes | async)!\" [part]=\"($part | async)!\" [attr.ngvl-index]=\"($index | async)!\"\r\n [attr.ngvl-visibility]=\"visibility\" tabindex=\"-1\">\r\n <div *ngIf=\"_blendColor\" class=\"ngvl-item__blend-color\" [style.--blend-color]=\"_blendColor\"></div>\r\n <div #container virtualClick [part]=\"$fxPart | async\" [maxClickDistance]=\"$maxClickDistance | async\"\r\n class=\"ngvl-item__container\" [ngClass]=\"($classes | async)!\" (onVirtualClick)=\"onClickHandler()\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer ?? null\"\r\n [ngTemplateOutletContext]=\"$templateContext | async\"></ng-container>\r\n </div>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;text-rendering:optimizeSpeed;image-rendering:auto}.ngvl-item{position:relative;margin:0;padding:0;overflow:hidden;outline:none;width:inherit;height:inherit;box-sizing:border-box}.ngvl-item__blend-color{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--blend-color);z-index:-1}.ngvl-item__container{margin:0;padding:0;width:100%;height:100%;box-sizing:border-box}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: VirtualClickDirective, selector: "[virtualClick]", inputs: ["maxClickDistance"], outputs: ["onVirtualClick"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1729
1729
  }
1730
1730
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
1731
1731
  type: Component,
1732
1732
  args: [{ selector: 'ng-virtual-list-item', host: {
1733
1733
  'class': 'ngvl__item',
1734
1734
  'role': 'listitem',
1735
- }, standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"($data | async) as data\">\r\n <div #item class=\"ngvl-item\" [ngClass]=\"$classes | async\" [part]=\"$part | async\" [attr.ngvl-index]=\"$index | async\"\r\n [attr.ngvl-visibility]=\"visibility\" tabindex=\"-1\">\r\n <div *ngIf=\"_blendColor\" class=\"ngvl-item__blend-color\" [style.--blend-color]=\"_blendColor\"></div>\r\n <div #container virtualClick [part]=\"$fxPart | async\" [maxClickDistance]=\"$maxClickDistance | async\"\r\n class=\"ngvl-item__container\" [ngClass]=\"$classes | async\" (onVirtualClick)=\"onClickHandler()\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer ?? null\"\r\n [ngTemplateOutletContext]=\"$templateContext | async\"></ng-container>\r\n </div>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;text-rendering:optimizeSpeed;image-rendering:auto}.ngvl-item{position:relative;margin:0;padding:0;overflow:hidden;outline:none;width:inherit;height:inherit;box-sizing:border-box}.ngvl-item__blend-color{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--blend-color);z-index:-1}.ngvl-item__container{margin:0;padding:0;width:100%;height:100%;box-sizing:border-box}\n"] }]
1735
+ }, standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"($data | async) as data\">\r\n <div #item class=\"ngvl-item\" [ngClass]=\"($classes | async)!\" [part]=\"($part | async)!\" [attr.ngvl-index]=\"($index | async)!\"\r\n [attr.ngvl-visibility]=\"visibility\" tabindex=\"-1\">\r\n <div *ngIf=\"_blendColor\" class=\"ngvl-item__blend-color\" [style.--blend-color]=\"_blendColor\"></div>\r\n <div #container virtualClick [part]=\"$fxPart | async\" [maxClickDistance]=\"$maxClickDistance | async\"\r\n class=\"ngvl-item__container\" [ngClass]=\"($classes | async)!\" (onVirtualClick)=\"onClickHandler()\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer ?? null\"\r\n [ngTemplateOutletContext]=\"$templateContext | async\"></ng-container>\r\n </div>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;text-rendering:optimizeSpeed;image-rendering:auto}.ngvl-item{position:relative;margin:0;padding:0;overflow:hidden;outline:none;width:inherit;height:inherit;box-sizing:border-box}.ngvl-item__blend-color{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--blend-color);z-index:-1}.ngvl-item__container{margin:0;padding:0;width:100%;height:100%;box-sizing:border-box}\n"] }]
1736
1736
  }], ctorParameters: function () { return []; } });
1737
1737
 
1738
1738
  /**
@@ -1861,7 +1861,7 @@ class ScrollEvent {
1861
1861
 
1862
1862
  /**
1863
1863
  * Event emitter
1864
- * @link https://github.com/DjonnyX/data-channel-router/blob/main/library/src/utils/event-emitter/event-emitter.ts
1864
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/main/library/src/utils/event-emitter/event-emitter.ts
1865
1865
  * @author Evgenii Alexandrovich Grebennikov
1866
1866
  * @email djonnyx@gmail.com
1867
1867
  */
@@ -2164,7 +2164,7 @@ class Tracker {
2164
2164
  }
2165
2165
  const untrackedItems = [...components], newTrackItems = [], untrackedComponentsByTypeMap = {}, isDown = direction === 0 || direction === 1, snapped = !!snappedComponents ? [...snappedComponents] : [];
2166
2166
  let isRegularSnapped = false;
2167
- const serviceIdProp = getServiceIdProp(trackBy);
2167
+ const serviceIdProp = getServiceIdProp(trackBy), snappedItems = new Array();
2168
2168
  for (let i = isDown ? 0 : items.length - 1, l = isDown ? items.length : 0; isDown ? i < l : i >= l; isDown ? i++ : i--) {
2169
2169
  const item = items[i], isDummy = item?.data?.[SERVICE_PROP_DUMMY] && (item?.data?.[SERVICE_PROP_DUMMY] === SERVICE_PROP_DUMMY_ENABLED);
2170
2170
  if (isDummy) {
@@ -2187,6 +2187,7 @@ class Tracker {
2187
2187
  isRegularSnapped = true;
2188
2188
  snappedComponent.instance.item = item;
2189
2189
  snappedComponent.instance.show();
2190
+ snappedItems.push(snappedComponent);
2190
2191
  }
2191
2192
  }
2192
2193
  }
@@ -2252,6 +2253,7 @@ class Tracker {
2252
2253
  if (!!snappedComponent) {
2253
2254
  snappedComponent.instance.item = item;
2254
2255
  snappedComponent.instance.show();
2256
+ snappedItems.push(snappedComponent);
2255
2257
  }
2256
2258
  }
2257
2259
  }
@@ -2282,13 +2284,14 @@ class Tracker {
2282
2284
  comp.instance.hide();
2283
2285
  }
2284
2286
  }
2285
- if (!isRegularSnapped) {
2286
- for (let i = 0, l = snapped.length; i < l; i++) {
2287
- const snappedComponent = snapped[i];
2288
- if (!!snappedComponent) {
2289
- snappedComponent.instance.item = null;
2290
- snappedComponent.instance.hide();
2291
- }
2287
+ for (let i = 0, l = snapped.length; i < l; i++) {
2288
+ const snappedComponent = snapped[i];
2289
+ if (snappedItems.indexOf(snappedComponent) > -1) {
2290
+ continue;
2291
+ }
2292
+ if (!!snappedComponent) {
2293
+ snappedComponent.instance.item = null;
2294
+ snappedComponent.instance.hide();
2292
2295
  }
2293
2296
  }
2294
2297
  }
@@ -2768,7 +2771,7 @@ class TrackBox extends CacheMap {
2768
2771
  * Calculates list metrics
2769
2772
  */
2770
2773
  recalculateMetrics(options) {
2771
- const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, minItemSize, maxItemSize, bufferSize: minBufferSize, scrollSize, stickyEnabled, itemConfigMap, enabledBufferOptimization, previousTotalSize, snapToItem, snapToItemAlign, deletedItemsMap, itemTransform } = options, roundedScrollSize = Math.round(scrollSize);
2774
+ const { alignment, fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, minItemSize, maxItemSize, bufferSize: minBufferSize, scrollSize, stickyEnabled, itemConfigMap, enabledBufferOptimization, previousTotalSize, snapToItem, snapToItemAlign, deletedItemsMap, itemTransform } = options, roundedScrollSize = Math.round(scrollSize);
2772
2775
  const trackBy = this._trackingPropertyName, 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, divides = this._divides, stickyPos = Math.floor(scrollSize) + this._scrollStartOffset, leftItemsOrRowsWeights = [], isFromId = fromItemId !== undefined && (typeof fromItemId === 'number' && fromItemId > -1)
2773
2776
  || (typeof fromItemId === 'string' && fromItemId > '-1');
2774
2777
  let leftItemsOffset = 0, rightItemsOffset = 0;
@@ -2908,15 +2911,17 @@ class TrackBox extends CacheMap {
2908
2911
  }
2909
2912
  if (id == fromItemId) {
2910
2913
  isFromItemIdFound = true;
2911
- const { num, offset } = this.getElementNumToEnd(i, collection, map, typicalItemSize, size, isVertical), leftViewportSize = size - offset;
2912
- if (leftViewportSize > 0) {
2913
- const { num: num1, offset: offset1 } = this.getElementNumToEnd(i + num, collection, map, typicalItemSize, size, isVertical, 0, true), deltaNum = (num1 - num), deltaOffset = (offset1 - offset);
2914
- totalItemsToDisplayEndWeight += offset;
2915
- itemsFromStartToScrollEnd -= deltaNum;
2916
- rightItemsWeight = rightItemLength = 0;
2917
- leftHiddenItemsWeight -= deltaOffset;
2918
- leftItemsOrRowsWeights.splice(leftItemsOrRowsWeights.length - deltaNum, deltaNum);
2919
- y -= deltaOffset;
2914
+ if (alignment !== Alignments.CENTER) {
2915
+ const { num, offset } = this.getElementNumToEnd(i, collection, map, typicalItemSize, size, isVertical), leftViewportSize = size - offset;
2916
+ if (leftViewportSize > 0) {
2917
+ const { num: num1, offset: offset1 } = this.getElementNumToEnd(i + num, collection, map, typicalItemSize, size, isVertical, 0, true), deltaNum = (num1 - num), deltaOffset = (offset1 - offset);
2918
+ totalItemsToDisplayEndWeight += offset;
2919
+ itemsFromStartToScrollEnd -= deltaNum;
2920
+ rightItemsWeight = rightItemLength = 0;
2921
+ leftHiddenItemsWeight -= deltaOffset;
2922
+ leftItemsOrRowsWeights.splice(leftItemsOrRowsWeights.length - deltaNum, deltaNum);
2923
+ y -= deltaOffset;
2924
+ }
2920
2925
  }
2921
2926
  itemById = collectionItem;
2922
2927
  itemByIdPos = y;
@@ -3103,7 +3108,7 @@ class TrackBox extends CacheMap {
3103
3108
  rightItemsWeight = Math.floor(rightItemLength * dividedTypicalItemSize / typicalItemSize) * typicalItemSize;
3104
3109
  leftHiddenItemsWeight = Math.floor(itemsFromStartToScrollEnd * dividedTypicalItemSize / typicalItemSize) * typicalItemSize;
3105
3110
  totalItemsToDisplayEndWeight = Math.floor(itemsFromStartToDisplayEnd * dividedTypicalItemSize / typicalItemSize) * typicalItemSize;
3106
- totalSize = (totalLength * dividedTypicalItemSize) + this._scrollStartOffset + this._scrollEndOffset;
3111
+ totalSize = (Math.ceil(totalLength / divides) * divides * dividedTypicalItemSize) + this._scrollStartOffset + this._scrollEndOffset;
3107
3112
  const k = totalSize !== 0 ? previousTotalSize / totalSize : 0;
3108
3113
  if (isFromId) {
3109
3114
  const index = collection.findIndex(item => item[trackBy] == fromItemId);
@@ -3479,7 +3484,7 @@ class TrackBox extends CacheMap {
3479
3484
  }
3480
3485
  if (!isDummy) {
3481
3486
  if ((isSnappingMethodAdvanced || id !== stickyItem?.id) && id !== endStickyItem?.id) {
3482
- const isOdd = (items.length - layoutIndexOffset + i) % 2 != 0, sticky = itemConfigMap[id]?.sticky ?? 0, fullSize = itemConfigMap[id]?.fullSize ?? false, selectable = itemConfigMap[id]?.selectable ?? true, collapsable = itemConfigMap[id]?.collapsable ?? false, snapped = stickyEnabled && (sticky === 1 && (pos <= scrollSize + this._scrollStartOffset) || sticky === 2 && (pos >= scrollSize + boundsSize - size)), absoluteStartPosition = pos - scrollSize, ratio = size !== 0 ? boundsSize / size : 0, absoluteStartPositionPercent = -(boundsSize !== 0 ? absoluteStartPosition / boundsSize : 0) * ratio, absoluteEndPosition = boundsSize - (absoluteStartPositionPercent + size), absoluteEndPositionPercent = (absoluteStartPositionPercent + (boundsSize !== 0 ? (absoluteEndPosition + size) / boundsSize : 0) * ratio), x = isVertical ? divSize * ((sticky || fullSize) ? 0 : ci) : pos, y = isVertical ? pos : divSize * ((sticky || fullSize) ? 0 : ci), measures = {
3487
+ const isOdd = (items.length - layoutIndexOffset + i) % 2 != 0, sticky = itemConfigMap[id]?.sticky ?? 0, fullSize = itemConfigMap[id]?.fullSize ?? false, selectable = itemConfigMap[id]?.selectable ?? true, collapsable = itemConfigMap[id]?.collapsable ?? false, snapped = stickyEnabled && ((sticky === 1 && (pos <= scrollSize + this._scrollStartOffset)) || (sticky === 2 && (pos >= scrollSize + boundsSize - size))), absoluteStartPosition = pos - scrollSize, ratio = size !== 0 ? boundsSize / size : 0, absoluteStartPositionPercent = -(boundsSize !== 0 ? absoluteStartPosition / boundsSize : 0) * ratio, absoluteEndPosition = boundsSize - (absoluteStartPositionPercent + size), absoluteEndPositionPercent = (absoluteStartPositionPercent + (boundsSize !== 0 ? (absoluteEndPosition + size) / boundsSize : 0) * ratio), x = isVertical ? divSize * ((sticky || fullSize) ? 0 : ci) : pos, y = isVertical ? pos : divSize * ((sticky || fullSize) ? 0 : ci), measures = {
3483
3488
  x,
3484
3489
  y,
3485
3490
  transformedX: x,
@@ -3507,7 +3512,7 @@ class TrackBox extends CacheMap {
3507
3512
  maxWidth: maxItemSize,
3508
3513
  maxHeight: maxItemSize,
3509
3514
  scrollDirection,
3510
- delta: sticky === 1 ? actualSnippedPosition : sticky === 2 ? actualEndSnippedPosition - deltaOffet - size : 0,
3515
+ delta: sticky === 1 ? actualSnippedPosition : (sticky === 2 ? (actualEndSnippedPosition - deltaOffet - size) : 0),
3511
3516
  }, config = {
3512
3517
  isFirst: i === layoutIndexOffset,
3513
3518
  isLast: i === li,
@@ -3517,7 +3522,7 @@ class TrackBox extends CacheMap {
3517
3522
  isVertical,
3518
3523
  collapsable,
3519
3524
  selectable,
3520
- sticky: sticky,
3525
+ sticky,
3521
3526
  snap: stickyEnabled,
3522
3527
  snapped: false,
3523
3528
  snappedOut: false,
@@ -3570,9 +3575,9 @@ class TrackBox extends CacheMap {
3570
3575
  i++;
3571
3576
  }
3572
3577
  const axis = isVertical ? Y_PROP_NAME : X_PROP_NAME;
3573
- if (!!nextSticky && !!stickyItem && nextSticky.measures[axis] <= actualSnippedPosition + stickyItemSize) {
3574
- if (nextSticky.measures[axis] > scrollSize - stickyItemSize) {
3575
- stickyItem.measures[axis] = nextSticky.measures[axis] - stickyItemSize;
3578
+ if (!!nextSticky && !!stickyItem && nextSticky.measures[axis] <= actualSnippedPosition + stickyItem.measures[sizeProperty]) {
3579
+ if (nextSticky.measures[axis] > actualSnippedPosition) {
3580
+ stickyItem.measures[axis] = nextSticky.measures[axis] - stickyItem.measures[sizeProperty];
3576
3581
  stickyItem.config.snapped = nextSticky.config.snapped = false;
3577
3582
  stickyItem.config.snappedOut = true;
3578
3583
  stickyItem.config.sticky = 1;
@@ -3581,7 +3586,8 @@ class TrackBox extends CacheMap {
3581
3586
  else {
3582
3587
  nextSticky.config.snapped = true;
3583
3588
  nextSticky.measures.delta = (isVertical ? nextSticky.measures.y : nextSticky.measures.x) - scrollSize;
3584
- stickyItem.measures[axis] = stickyItem.measures[axis] + stickyItem.measures[sizeProperty];
3589
+ stickyItem.measures[axis] = nextSticky.measures[axis] - stickyItem.measures[sizeProperty];
3590
+ stickyItem.measures.delta = (isVertical ? stickyItem.measures.y : stickyItem.measures.x) - scrollSize;
3585
3591
  }
3586
3592
  }
3587
3593
  if (!!nextEndSticky && !!endStickyItem &&
@@ -3598,6 +3604,7 @@ class TrackBox extends CacheMap {
3598
3604
  nextEndSticky.measures[axis] = actualEndSnippedPosition - nextEndSticky.measures[sizeProperty];
3599
3605
  nextEndSticky.measures.delta = (isVertical ? nextEndSticky.measures.y : nextEndSticky.measures.x) - scrollSize;
3600
3606
  endStickyItem.measures[axis] = nextEndSticky.measures[axis] + nextEndSticky.measures[sizeProperty];
3607
+ endStickyItem.measures.delta = (isVertical ? endStickyItem.measures.y : endStickyItem.measures.x) - scrollSize;
3601
3608
  }
3602
3609
  }
3603
3610
  if (itemTransform !== null) {
@@ -3865,7 +3872,7 @@ const easeLinear = (t) => {
3865
3872
 
3866
3873
  /**
3867
3874
  * Animator
3868
- * @link https://github.com/DjonnyX/data-channel-router/blob/main/library/src/utils/animator/animator.ts
3875
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/main/library/src/utils/animator/animator.ts
3869
3876
  * @author Evgenii Alexandrovich Grebennikov
3870
3877
  * @email djonnyx@gmail.com
3871
3878
  */
@@ -3942,7 +3949,7 @@ class Animator {
3942
3949
  const SCROLL_VIEW_INVERSION = new InjectionToken('ScrollViewInversion');
3943
3950
  const SCROLL_VIEW_OVERSCROLL_ENABLED = new InjectionToken('ScrollViewOverscrollEnabled');
3944
3951
  const SCROLL_VIEW_NORMALIZE_VALUE_FROM_ZERO = new InjectionToken('ScrollViewNormalizeValueFromZero');
3945
- const TOP$1 = 'top', LEFT$1 = 'left', INSTANT$1 = 'instant', AUTO = 'auto', SMOOTH = 'smooth', DURATION = 2000, FRICTION_FORCE = .035, MAX_DURATION = 4000, ANIMATION_DURATION = 50, MASS = .005, MAX_DIST = 12500, MAX_VELOCITY_TIMESTAMP = 100, SPEED_SCALE = 15, OVERSCROLL_START_ITERATION = 2, INTERSECTION_DISTANCE = 1;
3952
+ const TOP$1 = 'top', LEFT$1 = 'left', INSTANT$1 = 'instant', AUTO = 'auto', SMOOTH = 'smooth', DURATION = 2000, FRICTION_FORCE = .035, MAX_DURATION = 4000, ANIMATION_DURATION = 50, MASS = .005, ACCELERATION_SCALE = 40, MAX_DIST = 12500, MAX_VELOCITY_TIMESTAMP = 100, SPEED_SCALE = 15, OVERSCROLL_START_ITERATION = 2;
3946
3953
  const MAX_ITERATIONS_FOR_AVERAGE_CALCULATIONS = 5, INSTANT_VELOCITY_SCALE = 1000;
3947
3954
  const SCROLL_EVENT$1 = new Event(SCROLLER_SCROLL);
3948
3955
 
@@ -4851,8 +4858,8 @@ class NgScrollView extends BaseScrollView {
4851
4858
  continue;
4852
4859
  }
4853
4860
  if (v00) {
4854
- const a0 = timestamp < MAX_VELOCITY_TIMESTAMP ? (v00[1] !== 0 ? (lastVSign * Math.abs(Math.abs(v01[0]) - Math.abs(v00[0]))) / Math.abs(v00[1]) : 0) : 0.1;
4855
- aSum = (aSum * mass) + a0;
4861
+ const a0 = timestamp < MAX_VELOCITY_TIMESTAMP ? (v00[1] !== 0 ? (lastVSign * Math.abs(Math.abs(v01[0]) - Math.abs(v00[0]))) / Math.abs(v00[1]) : 0) : .1;
4862
+ aSum = Math.abs((aSum * mass)) + Math.abs(a0);
4856
4863
  prevV0 = v01;
4857
4864
  }
4858
4865
  prevV0 = v01;
@@ -4873,7 +4880,7 @@ class NgScrollView extends BaseScrollView {
4873
4880
  }
4874
4881
  moveWithAcceleration(isVertical, position, v0, v, a0, timestamp) {
4875
4882
  if (a0 !== 0 && timestamp < MAX_VELOCITY_TIMESTAMP) {
4876
- const dvSign = Math.sign(v), mass = this.scrollingSettings?.mass ?? MASS, duration = DURATION, maxDuration = this.scrollingSettings?.maxDuration ?? MAX_DURATION, maxDist = this.scrollingSettings?.maxDistance ?? MAX_DIST, maxDistance = dvSign * maxDist, s = (dvSign * Math.abs((a0 * Math.pow(duration, 2)) * .5) / 1000) / mass, distance = Math.abs(s) < maxDist ? s : maxDistance, positionWithVelocity = position + (this._inversion ? -1 : 1) * distance, vmax = Math.max(Math.abs(v0), Math.abs(v)), ad = Math.abs(vmax !== 0 ? Math.sqrt(vmax) : 0) * 10 / mass, aDuration = ad < maxDuration ? ad : maxDuration, startPosition = isVertical ? this.y : this.x;
4883
+ const dvSign = Math.sign(v), mass = this.scrollingSettings?.mass ?? MASS, duration = DURATION, maxDuration = this.scrollingSettings?.maxDuration ?? MAX_DURATION, maxDist = this.scrollingSettings?.maxDistance ?? MAX_DIST, maxDistance = dvSign * maxDist, s = (dvSign * Math.abs((a0 * Math.pow(duration, 2)) * .5) / 10000) / mass, distance = Math.abs(s) < maxDist ? s : maxDistance, positionWithVelocity = position + (this._inversion ? -1 : 1) * distance, ad = Math.abs(a0 !== 0 ? Math.sqrt(a0) : 0) * ACCELERATION_SCALE / mass, aDuration = ad < maxDuration ? ad : maxDuration, startPosition = isVertical ? this.y : this.x;
4877
4884
  this.animate(startPosition, Math.round(positionWithVelocity), aDuration, easeOutQuad, true);
4878
4885
  }
4879
4886
  else {
@@ -4889,7 +4896,7 @@ class NgScrollView extends BaseScrollView {
4889
4896
  }
4890
4897
  animate(startValue, endValue, duration = ANIMATION_DURATION, easingFunction = easeOutQuad, userAction = false, alignmentAtComplete = true, skipOverridedCoordinates = false) {
4891
4898
  const isVertical = this._$isVertical.getValue();
4892
- let iteration = 0, position = startValue;
4899
+ let position = startValue;
4893
4900
  this._isAlignmentAnimation = !alignmentAtComplete;
4894
4901
  this._animator.animate({
4895
4902
  withDelta: this._service.dynamic && !this.isInfinity,
@@ -4906,17 +4913,16 @@ class NgScrollView extends BaseScrollView {
4906
4913
  this.animate(currentCoordinate, currentCoordinate + delta, duration - elapsed, easingFunction, userAction, alignmentAtComplete);
4907
4914
  return;
4908
4915
  }
4909
- const v0 = calculateVelocity(position, value, timestamp) ?? this.averageVelocity;
4916
+ const v0 = calculateVelocity(position, value - this._delta, timestamp) ?? this.averageVelocity;
4910
4917
  position = value;
4911
4918
  if (alignmentAtComplete && !this._isAlignmentAnimation && !skipOverridedCoordinates) {
4912
- if (iteration < MAX_ITERATIONS_FOR_AVERAGE_CALCULATIONS || !this.snapIfNecessary(v0)) {
4919
+ if (!this.snapIfNecessary(v0)) {
4913
4920
  this.move(isVertical, value, false, userAction);
4914
4921
  }
4915
4922
  }
4916
4923
  else {
4917
4924
  this.move(isVertical, value, false, userAction);
4918
4925
  }
4919
- iteration++;
4920
4926
  this._service.update(true);
4921
4927
  }, onComplete: ({ value, timestamp }) => {
4922
4928
  this._isAlignmentAnimation = false;
@@ -4968,10 +4974,9 @@ class NgScrollView extends BaseScrollView {
4968
4974
  return size;
4969
4975
  }
4970
4976
  alignPosition(animated = true, force = false) {
4971
- if (!this.snapToItem || this._isAlignmentAnimation) {
4977
+ if (!this.snapToItem || (this._isAlignmentAnimation && !force)) {
4972
4978
  return false;
4973
4979
  }
4974
- this.stopScrolling(true);
4975
4980
  const scrollDirection = this._scrollDirection.get() || (force ? 1 : 0);
4976
4981
  if (scrollDirection === 0) {
4977
4982
  return false;
@@ -5455,13 +5460,13 @@ class NgScrollBarComponent extends NgScrollView {
5455
5460
  })).subscribe();
5456
5461
  }
5457
5462
  createDragEvent(userAction) {
5458
- const isVertical = this._$isVertical.getValue(), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, scrollContent = this.scrollContent?.nativeElement, scrollViewport = this.scrollViewport?.nativeElement;
5463
+ const isVertical = this._$isVertical.getValue(), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, scrollPosition = isVertical ? this.scrollTop : this.scrollLeft, startOffset = this.startOffset, endOffset = this.endOffset, scrollContent = this.scrollContent?.nativeElement, scrollViewport = this.scrollViewport?.nativeElement;
5459
5464
  if (!!scrollViewport && !!scrollContent) {
5460
- const contentSize = isVertical ? scrollContent.offsetHeight : scrollContent.offsetWidth, viewportSize = isVertical ? scrollViewport.offsetHeight : scrollViewport.offsetWidth;
5465
+ const contentSize = isVertical ? scrollContent.offsetHeight : scrollContent.offsetWidth, viewportSize = isVertical ? scrollViewport.offsetHeight : scrollViewport.offsetWidth, offsetSize = (scrollSize !== 0 ? (startOffset / scrollSize) : 0), positionSize = (scrollSize !== 0 ? (scrollPosition / scrollSize) : 0), maxSize = 1 - offsetSize, pos = (positionSize - offsetSize);
5461
5466
  const event = {
5462
- position: scrollSize !== 0 ? ((isVertical ? this._y : this._x) / scrollSize) : 0,
5463
- min: scrollSize !== 0 ? (this.startOffset / scrollSize) : 0,
5464
- max: scrollSize !== 0 ? ((viewportSize - this.endOffset - contentSize) / scrollSize) : 0,
5467
+ position: pos / maxSize,
5468
+ min: scrollSize !== 0 ? (startOffset / scrollSize) : 0,
5469
+ max: scrollSize !== 0 ? ((viewportSize - endOffset - contentSize) / scrollSize) : 0,
5465
5470
  animation: !this._isMoving,
5466
5471
  userAction,
5467
5472
  };
@@ -6384,14 +6389,14 @@ class NgPrerenderVirtualListItemComponent extends NgVirtualListItemComponent {
6384
6389
  }
6385
6390
  }
6386
6391
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgPrerenderVirtualListItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
6387
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgPrerenderVirtualListItemComponent, selector: "ng-prerender-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"($data | async) as data\">\r\n <div #item class=\"ngvl-item\" [ngClass]=\"$classes | async\" [part]=\"$part | async\" [attr.ngvl-index]=\"$index | async\"\r\n [attr.ngvl-visibility]=\"visibility\" tabindex=\"-1\">\r\n <div *ngIf=\"_blendColor\" class=\"ngvl-item__blend-color\" [style.--blend-color]=\"_blendColor\"></div>\r\n <div #container virtualClick [part]=\"$fxPart | async\" [maxClickDistance]=\"$maxClickDistance | async\"\r\n class=\"ngvl-item__container\" [ngClass]=\"$classes | async\" (onVirtualClick)=\"onClickHandler()\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer ?? null\"\r\n [ngTemplateOutletContext]=\"$templateContext | async\"></ng-container>\r\n </div>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;text-rendering:optimizeSpeed;image-rendering:auto}.ngvl-item{position:relative;margin:0;padding:0;overflow:hidden;outline:none;width:inherit;height:inherit;box-sizing:border-box}.ngvl-item__blend-color{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--blend-color);z-index:-1}.ngvl-item__container{margin:0;padding:0;width:100%;height:100%;box-sizing:border-box}\n", ":host{display:block;position:absolute!important;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;pointer-events:none;-webkit-user-select:none;user-select:none;text-rendering:optimizeSpeed;image-rendering:pixelated}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: VirtualClickDirective, selector: "[virtualClick]", inputs: ["maxClickDistance"], outputs: ["onVirtualClick"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6392
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgPrerenderVirtualListItemComponent, selector: "ng-prerender-virtual-list-item", host: { attributes: { "role": "listitem" }, classAttribute: "ngvl__item" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"($data | async) as data\">\r\n <div #item class=\"ngvl-item\" [ngClass]=\"($classes | async)!\" [part]=\"($part | async)!\" [attr.ngvl-index]=\"($index | async)!\"\r\n [attr.ngvl-visibility]=\"visibility\" tabindex=\"-1\">\r\n <div *ngIf=\"_blendColor\" class=\"ngvl-item__blend-color\" [style.--blend-color]=\"_blendColor\"></div>\r\n <div #container virtualClick [part]=\"$fxPart | async\" [maxClickDistance]=\"$maxClickDistance | async\"\r\n class=\"ngvl-item__container\" [ngClass]=\"($classes | async)!\" (onVirtualClick)=\"onClickHandler()\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer ?? null\"\r\n [ngTemplateOutletContext]=\"$templateContext | async\"></ng-container>\r\n </div>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;text-rendering:optimizeSpeed;image-rendering:auto}.ngvl-item{position:relative;margin:0;padding:0;overflow:hidden;outline:none;width:inherit;height:inherit;box-sizing:border-box}.ngvl-item__blend-color{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--blend-color);z-index:-1}.ngvl-item__container{margin:0;padding:0;width:100%;height:100%;box-sizing:border-box}\n", ":host{display:block;position:absolute!important;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;pointer-events:none;-webkit-user-select:none;user-select:none;text-rendering:optimizeSpeed;image-rendering:pixelated}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: VirtualClickDirective, selector: "[virtualClick]", inputs: ["maxClickDistance"], outputs: ["onVirtualClick"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6388
6393
  }
6389
6394
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgPrerenderVirtualListItemComponent, decorators: [{
6390
6395
  type: Component,
6391
6396
  args: [{ selector: 'ng-prerender-virtual-list-item', host: {
6392
6397
  'class': 'ngvl__item',
6393
6398
  'role': 'listitem',
6394
- }, standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"($data | async) as data\">\r\n <div #item class=\"ngvl-item\" [ngClass]=\"$classes | async\" [part]=\"$part | async\" [attr.ngvl-index]=\"$index | async\"\r\n [attr.ngvl-visibility]=\"visibility\" tabindex=\"-1\">\r\n <div *ngIf=\"_blendColor\" class=\"ngvl-item__blend-color\" [style.--blend-color]=\"_blendColor\"></div>\r\n <div #container virtualClick [part]=\"$fxPart | async\" [maxClickDistance]=\"$maxClickDistance | async\"\r\n class=\"ngvl-item__container\" [ngClass]=\"$classes | async\" (onVirtualClick)=\"onClickHandler()\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer ?? null\"\r\n [ngTemplateOutletContext]=\"$templateContext | async\"></ng-container>\r\n </div>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;text-rendering:optimizeSpeed;image-rendering:auto}.ngvl-item{position:relative;margin:0;padding:0;overflow:hidden;outline:none;width:inherit;height:inherit;box-sizing:border-box}.ngvl-item__blend-color{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--blend-color);z-index:-1}.ngvl-item__container{margin:0;padding:0;width:100%;height:100%;box-sizing:border-box}\n", ":host{display:block;position:absolute!important;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;pointer-events:none;-webkit-user-select:none;user-select:none;text-rendering:optimizeSpeed;image-rendering:pixelated}\n"] }]
6399
+ }, standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"($data | async) as data\">\r\n <div #item class=\"ngvl-item\" [ngClass]=\"($classes | async)!\" [part]=\"($part | async)!\" [attr.ngvl-index]=\"($index | async)!\"\r\n [attr.ngvl-visibility]=\"visibility\" tabindex=\"-1\">\r\n <div *ngIf=\"_blendColor\" class=\"ngvl-item__blend-color\" [style.--blend-color]=\"_blendColor\"></div>\r\n <div #container virtualClick [part]=\"$fxPart | async\" [maxClickDistance]=\"$maxClickDistance | async\"\r\n class=\"ngvl-item__container\" [ngClass]=\"($classes | async)!\" (onVirtualClick)=\"onClickHandler()\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer ?? null\"\r\n [ngTemplateOutletContext]=\"$templateContext | async\"></ng-container>\r\n </div>\r\n </div>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;text-rendering:optimizeSpeed;image-rendering:auto}.ngvl-item{position:relative;margin:0;padding:0;overflow:hidden;outline:none;width:inherit;height:inherit;box-sizing:border-box}.ngvl-item__blend-color{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--blend-color);z-index:-1}.ngvl-item__container{margin:0;padding:0;width:100%;height:100%;box-sizing:border-box}\n", ":host{display:block;position:absolute!important;left:0;top:0;box-sizing:border-box;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-drag:none;-moz-user-drag:none;pointer-events:none;-webkit-user-select:none;user-select:none;text-rendering:optimizeSpeed;image-rendering:pixelated}\n"] }]
6395
6400
  }] });
6396
6401
 
6397
6402
  /**
@@ -9279,7 +9284,7 @@ class NgVirtualListComponent extends DisposableComponent {
9279
9284
  this._isLoading = false;
9280
9285
  })).subscribe();
9281
9286
  const update = (params) => {
9282
- const { alignment, precalculatedScrollStartOffset, precalculatedScrollEndOffset, trackBy, isInfinity, snapScrollToStart, snapScrollToEnd, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, minItemSize, maxItemSize, divides, bufferSize, maxBufferSize, stickyEnabled, isVertical, dynamicSize, enabledBufferOptimization, snapToItem, snapToItemAlign, cacheVersion, userAction, collapsedIds, itemTransform, } = params;
9287
+ const { alignment, snapScrollToStart, snapScrollToEnd, bounds, items, itemConfigMap, scrollSize, itemSize, minItemSize, maxItemSize, bufferSize, maxBufferSize, stickyEnabled, isVertical, dynamicSize, enabledBufferOptimization, snapToItem, snapToItemAlign, userAction, collapsedIds, itemTransform, } = params;
9283
9288
  const scroller = this._scrollerComponent;
9284
9289
  let totalSize = 0;
9285
9290
  if (!!scroller) {
@@ -9289,7 +9294,7 @@ class NgVirtualListComponent extends DisposableComponent {
9289
9294
  let actualScrollSize = !this._readyForShow && snapScrollToEnd ? (isVertical ? scroller.scrollHeight : scroller.scrollWidth) :
9290
9295
  (isVertical ? scroller.scrollTop : scroller.scrollLeft), leftLayoutOffset = 0, displayItems;
9291
9296
  const { width, height } = bounds, viewportSize = (isVertical ? height : width), opts = {
9292
- bounds: { width, height }, dynamicSize, isVertical, itemSize, minItemSize, maxItemSize, bufferSize, maxBufferSize,
9297
+ alignment, bounds: { width, height }, dynamicSize, isVertical, itemSize, minItemSize, maxItemSize, bufferSize, maxBufferSize,
9293
9298
  scrollSize: actualScrollSize, stickyEnabled, enabledBufferOptimization, snapToItem, snapToItemAlign, itemTransform,
9294
9299
  };
9295
9300
  if (snapScrollToEnd && !this._readyForShow) {
@@ -9297,12 +9302,24 @@ class NgVirtualListComponent extends DisposableComponent {
9297
9302
  displayItems = calculatedDisplayItems;
9298
9303
  totalSize = calculatedTotalSize1;
9299
9304
  leftLayoutOffset = leftLayoutOffset1;
9305
+ if (!!itemTransform && dynamicSize && this._trackBox.delta !== 0) {
9306
+ const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize1, leftLayoutOffset: leftLayoutOffset1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts, scrollSize: actualScrollSize + this._trackBox.delta });
9307
+ displayItems = calculatedDisplayItems;
9308
+ totalSize = calculatedTotalSize1;
9309
+ leftLayoutOffset = leftLayoutOffset1;
9310
+ }
9300
9311
  }
9301
9312
  else {
9302
9313
  const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize, leftLayoutOffset: leftLayoutOffset1 } = this._trackBox.updateCollection(items, itemConfigMap, opts);
9303
9314
  displayItems = calculatedDisplayItems;
9304
9315
  totalSize = calculatedTotalSize;
9305
9316
  leftLayoutOffset = leftLayoutOffset1;
9317
+ if (!!itemTransform && dynamicSize && this._trackBox.delta !== 0) {
9318
+ const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize, leftLayoutOffset: leftLayoutOffset1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts, scrollSize: actualScrollSize + this._trackBox.delta });
9319
+ displayItems = calculatedDisplayItems;
9320
+ totalSize = calculatedTotalSize;
9321
+ leftLayoutOffset = leftLayoutOffset1;
9322
+ }
9306
9323
  }
9307
9324
  scroller.totalSize = totalSize;
9308
9325
  scroller.startLayoutOffset = leftLayoutOffset;
@@ -9319,23 +9336,7 @@ class NgVirtualListComponent extends DisposableComponent {
9319
9336
  if (this._isSnappingMethodAdvanced) {
9320
9337
  this.updateRegularRenderer();
9321
9338
  }
9322
- switch (alignment) {
9323
- case Alignments.NONE: {
9324
- this._$actualScrollStartOffset.next(precalculatedScrollStartOffset);
9325
- this._$actualScrollEndOffset.next(precalculatedScrollEndOffset);
9326
- break;
9327
- }
9328
- case Alignments.CENTER: {
9329
- const firstItemId = items.length > 0 ? (items[0]?.[trackBy] ?? null) : null, endItemId = items.length > 0 ? (items?.[items.length - 1]?.[trackBy] ?? null) : null, alignmentStartOffset = viewportSize * .5 - (firstItemId !== null ? (isVertical ? (this._service.getItemBounds(firstItemId)?.height ?? 0) :
9330
- (this._service.getItemBounds(firstItemId)?.width ?? 0)) : 0) * (isInfinity ? 0 : .5), alignmentEndOffset = viewportSize * .5 - (endItemId !== null ? (isVertical ? (this._service.getItemBounds(endItemId)?.height ?? 0) :
9331
- (this._service.getItemBounds(endItemId)?.width ?? 0)) : 0) * (isInfinity ? 0 : .5);
9332
- this._$alignmentScrollStartOffset.next(alignmentStartOffset);
9333
- this._$alignmentScrollEndOffset.next(alignmentEndOffset);
9334
- this._$actualScrollStartOffset.next(precalculatedScrollStartOffset + alignmentStartOffset);
9335
- this._$actualScrollEndOffset.next(precalculatedScrollEndOffset + alignmentEndOffset);
9336
- break;
9337
- }
9338
- }
9339
+ this.updateOffsetsByAllignment();
9339
9340
  scroller.delta = delta;
9340
9341
  if ((snapScrollToStart && this._trackBox.isSnappedToStart && scroller.scrollable) ||
9341
9342
  (snapScrollToStart && currentScrollSize <= MIN_PIXELS_FOR_PREVENT_SNAPPING)) {
@@ -9514,6 +9515,7 @@ class NgVirtualListComponent extends DisposableComponent {
9514
9515
  const dynamicSize = this.dynamicSize, itemSize = this.actualItemSize, minItemSize = this.actualMinItemSize, maxItemSize = this.actualMaxItemSize, snapScrollToEnd = this.snapScrollToEnd;
9515
9516
  if (dynamicSize) {
9516
9517
  const { width, height } = this._$bounds.getValue() || { width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, itemConfigMap = this.itemConfigMap, isVertical = this._isVertical, currentScrollSize = isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft, opts = {
9518
+ alignment: this._$actualAlignment.getValue(),
9517
9519
  bounds: { width, height }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize, minItemSize, maxItemSize,
9518
9520
  bufferSize: this.bufferSize, maxBufferSize: this.maxBufferSize, itemTransform: this.itemTransform,
9519
9521
  scrollSize: (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft),
@@ -9539,21 +9541,8 @@ class NgVirtualListComponent extends DisposableComponent {
9539
9541
  this.createDisplayComponentsIfNeed(displayItems);
9540
9542
  this.tracking();
9541
9543
  this.snappingHandler();
9544
+ this.updateOffsetsByAllignment();
9542
9545
  scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, { ...opts, scrollSize: actualScrollSize, fromItemId: id });
9543
- if (this.isInfinity) {
9544
- if (this.snapToItem) {
9545
- const itemBounds = this._trackBox.getItemBounds(id);
9546
- if (!!itemBounds) {
9547
- const itemSize = isVertical ? itemBounds.height : itemBounds.width;
9548
- switch (this.snapToItemAlign) {
9549
- case SnapToItemAligns.CENTER: {
9550
- scrollSize += itemSize * .5;
9551
- break;
9552
- }
9553
- }
9554
- }
9555
- }
9556
- }
9557
9546
  if (scrollSize === -1) {
9558
9547
  return of([finished, { id, blending, iteration: nextIteration, cb }]).pipe(delay(0));
9559
9548
  }
@@ -9591,6 +9580,7 @@ class NgVirtualListComponent extends DisposableComponent {
9591
9580
  }
9592
9581
  }
9593
9582
  const { width, height } = this._$bounds.getValue() || { width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, itemConfigMap = this.itemConfigMap, items = this._$actualItems.getValue(), opts = {
9583
+ alignment: this._$actualAlignment.getValue(),
9594
9584
  bounds: { width, height }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize, minItemSize, maxItemSize,
9595
9585
  bufferSize: this.bufferSize, maxBufferSize: this.maxBufferSize, itemTransform: this.itemTransform,
9596
9586
  scrollSize: (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft),
@@ -9610,6 +9600,7 @@ class NgVirtualListComponent extends DisposableComponent {
9610
9600
  this.createDisplayComponentsIfNeed(displayItems);
9611
9601
  this.tracking();
9612
9602
  this.snappingHandler();
9603
+ this.updateOffsetsByAllignment();
9613
9604
  this._$preventScrollSnapping.next(true);
9614
9605
  const params = {
9615
9606
  [this._isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, fireUpdate: false,
@@ -9636,7 +9627,7 @@ class NgVirtualListComponent extends DisposableComponent {
9636
9627
  this.emitScrollEvent(true, false, true);
9637
9628
  const scrollParams = params;
9638
9629
  scrollParams?.cb?.();
9639
- }), delay(100), tap(([finished]) => {
9630
+ }), delay(0), tap(([finished]) => {
9640
9631
  if (finished) {
9641
9632
  this._scrollerComponent?.snapIfNeed();
9642
9633
  }
@@ -9677,6 +9668,14 @@ class NgVirtualListComponent extends DisposableComponent {
9677
9668
  }
9678
9669
  }));
9679
9670
  })).subscribe();
9671
+ combineLatest([$itemConfigMap, $dynamicSize, $divides]).pipe(takeUntil(this._$unsubscribe), filter$1(([itemConfigMap, dynamicSize, divides]) => !!itemConfigMap && !dynamicSize && divides > 1), tap(([itemConfigMap]) => {
9672
+ for (const id in itemConfigMap) {
9673
+ const metaData = itemConfigMap[id];
9674
+ if (metaData?.fullSize || metaData?.sticky === 1 || metaData?.sticky === 2) {
9675
+ throw Error('The accelerated rendering algorithm `[dynamicSize]="false"` cannot correctly handle non-uniform lists (the itemConfigMap specifies full-size elements). For correct rendering, specify `[dynamicSize]="true"`.');
9676
+ }
9677
+ }
9678
+ })).subscribe();
9680
9679
  combineLatest([$collapsingMode, $items, $itemConfigMap, $trackBy]).pipe(takeUntil(this._$unsubscribe), tap(([collapsingMode, items, itemConfigMap, trackBy]) => {
9681
9680
  const isAccordion = isCollapseMode(collapsingMode, CollapsingModes.ACCORDION);
9682
9681
  if (isAccordion) {
@@ -9878,6 +9877,26 @@ class NgVirtualListComponent extends DisposableComponent {
9878
9877
  this._trackBox.setDisplayObjectIndexMapById(doMap);
9879
9878
  }
9880
9879
  }
9880
+ updateOffsetsByAllignment() {
9881
+ const alignment = this._$actualAlignment.getValue(), items = this._$actualItems.getValue(), trackBy = this.trackBy, isInfinity = this.isInfinity, isVertical = this._isVertical, { width, height } = this._$bounds.getValue() || { width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, viewportSize = isVertical ? height : width, precalculatedScrollStartOffset = this._$precalculatedScrollStartOffset.getValue(), precalculatedScrollEndOffset = this._$precalculatedScrollEndOffset.getValue();
9882
+ switch (alignment) {
9883
+ case Alignments.NONE: {
9884
+ this._$actualScrollStartOffset.next(precalculatedScrollStartOffset);
9885
+ this._$actualScrollEndOffset.next(precalculatedScrollEndOffset);
9886
+ break;
9887
+ }
9888
+ case Alignments.CENTER: {
9889
+ const firstItemId = items.length > 0 ? (items[0]?.[trackBy] ?? null) : null, endItemId = items.length > 0 ? (items?.[items.length - 1]?.[trackBy] ?? null) : null, alignmentStartOffset = viewportSize * .5 - (firstItemId !== null ? (isVertical ? (this._service.getItemBounds(firstItemId)?.height ?? 0) :
9890
+ (this._service.getItemBounds(firstItemId)?.width ?? 0)) : 0) * (isInfinity ? 0 : .5), alignmentEndOffset = viewportSize * .5 - (endItemId !== null ? (isVertical ? (this._service.getItemBounds(endItemId)?.height ?? 0) :
9891
+ (this._service.getItemBounds(endItemId)?.width ?? 0)) : 0) * (isInfinity ? 0 : .5);
9892
+ this._$alignmentScrollStartOffset.next(alignmentStartOffset);
9893
+ this._$alignmentScrollEndOffset.next(alignmentEndOffset);
9894
+ this._$actualScrollStartOffset.next(precalculatedScrollStartOffset + alignmentStartOffset);
9895
+ this._$actualScrollEndOffset.next(precalculatedScrollEndOffset + alignmentEndOffset);
9896
+ break;
9897
+ }
9898
+ }
9899
+ }
9881
9900
  updateRegularRenderer() {
9882
9901
  this._resizeSnappedComponentHandler();
9883
9902
  }