ng-virtual-list 19.9.3 → 19.9.4

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.
@@ -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) {
@@ -4750,6 +4749,7 @@ class NgVirtualListComponent {
4750
4749
  if (roundedMaxPositionAfterUpdate > 0) {
4751
4750
  const diff = roundedMaxPositionAfterUpdate - roundedScrollPositionAfterUpdate, snapToEndTransitionInstantOffset = this.snapToEndTransitionInstantOffset() || viewportSize, animated = prepared && readyToStart && diff >= 0 && diff <= snapToEndTransitionInstantOffset, params = {
4752
4751
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
4752
+ fireUpdate: false,
4753
4753
  behavior: (animated ?
4754
4754
  BEHAVIOR_SMOOTH : BEHAVIOR_INSTANT),
4755
4755
  blending: true,
@@ -4759,8 +4759,8 @@ class NgVirtualListComponent {
4759
4759
  }
4760
4760
  else if (roundedActualScrollSize !== roundedScrollPositionAfterUpdate && scrollPositionAfterUpdate > 0) {
4761
4761
  const params = {
4762
- [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate,
4763
- behavior: BEHAVIOR_INSTANT,
4762
+ [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true,
4763
+ fireUpdate: false, behavior: BEHAVIOR_INSTANT,
4764
4764
  };
4765
4765
  scroller.scrollTo(params);
4766
4766
  }
@@ -4769,25 +4769,10 @@ class NgVirtualListComponent {
4769
4769
  combineLatest([$snapScrollToBottom, $bounds, $listBounds, $scrollEndOffset, $actualItems, $itemConfigMap, $scrollSize, $itemSize,
4770
4770
  $bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion, this.$userScroll,
4771
4771
  ]).pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(([snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
4772
- const updateId = this._updateId;
4773
- if (updateId !== undefined) {
4774
- cancelAnimationFrame(updateId);
4775
- this._updateId = undefined;
4776
- }
4777
- if (!prepared || !isResetedReachStart) {
4778
- update({
4779
- snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
4780
- bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
4781
- });
4782
- }
4783
- else {
4784
- this._updateId = requestAnimationFrame((time) => {
4785
- update({
4786
- snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
4787
- bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
4788
- });
4789
- });
4790
- }
4772
+ update({
4773
+ snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
4774
+ bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
4775
+ });
4791
4776
  })).subscribe();
4792
4777
  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));
4793
4778
  $scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
@@ -4927,6 +4912,7 @@ class NgVirtualListComponent {
4927
4912
  snap: this.snap(), fromItemId: id, enabledBufferOptimization: this.enabledBufferOptimization(),
4928
4913
  }, scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, opts), params = {
4929
4914
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior: BEHAVIOR_INSTANT,
4915
+ fireUpdate: false,
4930
4916
  blending: true,
4931
4917
  };
4932
4918
  if (scrollSize === -1) {
@@ -4953,7 +4939,7 @@ class NgVirtualListComponent {
4953
4939
  if ((!notChanged && iteration < MAX_SCROLL_TO_ITERATIONS) || iteration < MAX_SCROLL_TO_ITERATIONS) {
4954
4940
  this._$scrollTo.next(params);
4955
4941
  return of([false, {
4956
- id, behavior: BEHAVIOR_INSTANT, scroller: scrollerComponent, iteration: iteration + 1, blending: true,
4942
+ id, scroller: scrollerComponent, iteration: iteration + 1,
4957
4943
  isLastIteration: notChanged, scrollCalled: true, cb
4958
4944
  }]).pipe(delay(1));
4959
4945
  }