ng-virtual-list 21.9.1 → 21.9.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.
package/README.md CHANGED
@@ -776,13 +776,13 @@ Properties
776
776
 
777
777
  | Angular version | ng-virtual-list version | git | npm |
778
778
  |--|--|--|--|
779
- | 20.x | 20.9.1 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/20.x) | [20.9.1](https://www.npmjs.com/package/ng-virtual-list/v/20.9.1) |
780
- | 19.x | 19.9.3 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.9.3](https://www.npmjs.com/package/ng-virtual-list/v/19.9.3) |
781
- | 18.x | 18.9.1 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.9.1](https://www.npmjs.com/package/ng-virtual-list/v/18.9.1) |
782
- | 17.x | 17.9.1 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.9.1](https://www.npmjs.com/package/ng-virtual-list/v/17.9.1) |
783
- | 16.x | 16.9.1 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.9.1](https://www.npmjs.com/package/ng-virtual-list/v/16.9.1) |
784
- | 15.x | 15.9.1 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.9.1](https://www.npmjs.com/package/ng-virtual-list/v/15.9.1) |
785
- | 14.x | 14.9.1 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.9.1](https://www.npmjs.com/package/ng-virtual-list/v/14.9.1) |
779
+ | 20.x | 20.9.2 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/20.x) | [20.9.2](https://www.npmjs.com/package/ng-virtual-list/v/20.9.2) |
780
+ | 19.x | 19.9.4 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.9.4](https://www.npmjs.com/package/ng-virtual-list/v/19.9.4) |
781
+ | 18.x | 18.9.2 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.9.2](https://www.npmjs.com/package/ng-virtual-list/v/18.9.2) |
782
+ | 17.x | 17.9.2 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.9.2](https://www.npmjs.com/package/ng-virtual-list/v/17.9.2) |
783
+ | 16.x | 16.9.2 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.9.2](https://www.npmjs.com/package/ng-virtual-list/v/16.9.2) |
784
+ | 15.x | 15.9.2 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.9.2](https://www.npmjs.com/package/ng-virtual-list/v/15.9.2) |
785
+ | 14.x | 14.9.2 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.9.2](https://www.npmjs.com/package/ng-virtual-list/v/14.9.2) |
786
786
 
787
787
  <br/>
788
788
 
@@ -3486,7 +3486,6 @@ class NgScrollerComponent {
3486
3486
  }
3487
3487
  stopScrolling() {
3488
3488
  cancelAnimationFrame(this._animationId);
3489
- cancelAnimationFrame(this._animationId1);
3490
3489
  }
3491
3490
  move(isVertical, position, blending = false, userAction = false) {
3492
3491
  this.scrollTo({ [isVertical ? TOP : LEFT]: position, behavior: INSTANT, blending, userAction });
@@ -3538,7 +3537,6 @@ class NgScrollerComponent {
3538
3537
  prevPos = currentValue;
3539
3538
  const scrollContent = this.scrollContent()?.nativeElement;
3540
3539
  if (scrollContent) {
3541
- cancelAnimationFrame(this._animationId1);
3542
3540
  if (isVertical) {
3543
3541
  this.y = currentValue;
3544
3542
  scrollContent.style.transform = `translate3d(0, ${-currentValue}px, 0)`;
@@ -3570,7 +3568,7 @@ class NgScrollerComponent {
3570
3568
  this._$updateScrollBar.next();
3571
3569
  }
3572
3570
  scrollTo(params) {
3573
- const posX = params.x || params.left || 0, posY = params.y || params.top || 0, userAction = params.userAction ?? false, x = posX, y = posY, behavior = params.behavior ?? INSTANT, blending = params.blending ?? true, scrollContent = this.scrollContent()?.nativeElement, isVertical = this.direction() === ScrollerDirection.VERTICAL;
3571
+ const posX = params.x || params.left || 0, posY = params.y || params.top || 0, userAction = params.userAction ?? false, x = posX, y = posY, fireUpdate = params.fireUpdate ?? true, behavior = params.behavior ?? INSTANT, blending = params.blending ?? true, scrollContent = this.scrollContent()?.nativeElement, isVertical = this.direction() === ScrollerDirection.VERTICAL;
3574
3572
  if (this._isMoving) {
3575
3573
  if (isVertical) {
3576
3574
  if (y < 0 || y > this.scrollHeight) {
@@ -3608,7 +3606,9 @@ class NgScrollerComponent {
3608
3606
  if (this.cdkScrollable) {
3609
3607
  this.cdkScrollable.getElementRef().nativeElement.dispatchEvent(SCROLL_EVENT);
3610
3608
  }
3611
- this.fireScrollEvent(userAction);
3609
+ if (fireUpdate) {
3610
+ this.fireScrollEvent(userAction);
3611
+ }
3612
3612
  }
3613
3613
  }
3614
3614
  else {
@@ -3620,16 +3620,15 @@ class NgScrollerComponent {
3620
3620
  if (this.cdkScrollable) {
3621
3621
  this.cdkScrollable.getElementRef().nativeElement.dispatchEvent(SCROLL_EVENT);
3622
3622
  }
3623
- this.fireScrollEvent(userAction);
3623
+ if (fireUpdate) {
3624
+ this.fireScrollEvent(userAction);
3625
+ }
3624
3626
  }
3625
3627
  }
3626
3628
  }
3627
3629
  }
3628
3630
  fireScrollEvent(userAction) {
3629
- cancelAnimationFrame(this._animationId1);
3630
- this._animationId1 = requestAnimationFrame(() => {
3631
- this._$scroll.next(userAction);
3632
- });
3631
+ this._$scroll.next(userAction);
3633
3632
  }
3634
3633
  reset() {
3635
3634
  if (this.scrollBar) {
@@ -4748,6 +4747,7 @@ class NgVirtualListComponent {
4748
4747
  if (roundedMaxPositionAfterUpdate > 0) {
4749
4748
  const diff = roundedMaxPositionAfterUpdate - roundedScrollPositionAfterUpdate, snapToEndTransitionInstantOffset = this.snapToEndTransitionInstantOffset() || viewportSize, animated = prepared && readyToStart && diff >= 0 && diff <= snapToEndTransitionInstantOffset, params = {
4750
4749
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
4750
+ fireUpdate: false,
4751
4751
  behavior: (animated ?
4752
4752
  BEHAVIOR_SMOOTH : BEHAVIOR_INSTANT),
4753
4753
  blending: true,
@@ -4757,8 +4757,8 @@ class NgVirtualListComponent {
4757
4757
  }
4758
4758
  else if (roundedActualScrollSize !== roundedScrollPositionAfterUpdate && scrollPositionAfterUpdate > 0) {
4759
4759
  const params = {
4760
- [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate,
4761
- behavior: BEHAVIOR_INSTANT,
4760
+ [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true,
4761
+ fireUpdate: false, behavior: BEHAVIOR_INSTANT,
4762
4762
  };
4763
4763
  scroller.scrollTo(params);
4764
4764
  }
@@ -4767,25 +4767,10 @@ class NgVirtualListComponent {
4767
4767
  combineLatest([$snapScrollToBottom, $bounds, $listBounds, $scrollEndOffset, $actualItems, $itemConfigMap, $scrollSize, $itemSize,
4768
4768
  $bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion, this.$userScroll,
4769
4769
  ]).pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(([snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
4770
- const updateId = this._updateId;
4771
- if (updateId !== undefined) {
4772
- cancelAnimationFrame(updateId);
4773
- this._updateId = undefined;
4774
- }
4775
- if (!prepared || !isResetedReachStart) {
4776
- update({
4777
- snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
4778
- bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
4779
- });
4780
- }
4781
- else {
4782
- this._updateId = requestAnimationFrame((time) => {
4783
- update({
4784
- snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
4785
- bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
4786
- });
4787
- });
4788
- }
4770
+ update({
4771
+ snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
4772
+ bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
4773
+ });
4789
4774
  })).subscribe();
4790
4775
  const $scroller = toObservable(this._scroller).pipe(takeUntilDestroyed(), filter$1(v => !!v), map(v => v.nativeElement), take(1)), $scrollerScroll = toObservable(this._scrollerComponent).pipe(takeUntilDestroyed(), filter$1(v => !!v), take(1), switchMap$1(scroller => scroller.$scroll)), $scrollerScrollEnd = toObservable(this._scrollerComponent).pipe(takeUntilDestroyed(), filter$1(v => !!v), take(1), switchMap$1(scroller => scroller.$scrollEnd)), $list = toObservable(this._list).pipe(takeUntilDestroyed(), filter$1(v => !!v), map(v => v.nativeElement), take(1));
4791
4776
  $scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
@@ -4925,6 +4910,7 @@ class NgVirtualListComponent {
4925
4910
  snap: this.snap(), fromItemId: id, enabledBufferOptimization: this.enabledBufferOptimization(),
4926
4911
  }, scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, opts), params = {
4927
4912
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior: BEHAVIOR_INSTANT,
4913
+ fireUpdate: false,
4928
4914
  blending: true,
4929
4915
  };
4930
4916
  if (scrollSize === -1) {
@@ -4951,7 +4937,7 @@ class NgVirtualListComponent {
4951
4937
  if ((!notChanged && iteration < MAX_SCROLL_TO_ITERATIONS) || iteration < MAX_SCROLL_TO_ITERATIONS) {
4952
4938
  this._$scrollTo.next(params);
4953
4939
  return of([false, {
4954
- id, behavior: BEHAVIOR_INSTANT, scroller: scrollerComponent, iteration: iteration + 1, blending: true,
4940
+ id, scroller: scrollerComponent, iteration: iteration + 1,
4955
4941
  isLastIteration: notChanged, scrollCalled: true, cb
4956
4942
  }]).pipe(delay(1));
4957
4943
  }