ng-virtual-list 20.10.9 → 20.10.10

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.
@@ -4844,104 +4844,6 @@ class NgVirtualListComponent {
4844
4844
  const dist = this.clickDistance();
4845
4845
  this._service.clickDistance = dist;
4846
4846
  });
4847
- const update = (params, emitable = true) => {
4848
- const { snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion, } = params;
4849
- const scroller = this._scrollerComponent();
4850
- if (scroller) {
4851
- let actualScrollSize = !this._readyToShow && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
4852
- (isVertical ? scroller.scrollTop ?? 0 : scroller.scrollLeft ?? 0), totalSize = 0, displayItems;
4853
- const { width, height, x, y } = bounds, viewportSize = (isVertical ? height : width);
4854
- let scrollLength = Math.round(this._totalSize()) ?? 0, actualScrollLength = Math.round(scrollLength === 0 ? 0 : scrollLength > viewportSize ? scrollLength - viewportSize : scrollLength), roundedMaxPosition = Math.round(actualScrollLength), scrollPosition = Math.round(actualScrollSize);
4855
- const opts = {
4856
- bounds: { width, height, x, y }, dynamicSize, isVertical, itemSize,
4857
- bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
4858
- };
4859
- if (snapScrollToBottom && !this._readyToShow) {
4860
- const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts, scrollSize: actualScrollSize });
4861
- displayItems = calculatedDisplayItems;
4862
- totalSize = calculatedTotalSize1;
4863
- scrollLength = Math.round(totalSize) ?? 0;
4864
- actualScrollLength = Math.round(scrollLength === 0 ? 0 : scrollLength > viewportSize ? scrollLength - viewportSize : scrollLength);
4865
- roundedMaxPosition = Math.round(actualScrollLength);
4866
- scrollPosition = Math.round(actualScrollSize);
4867
- }
4868
- else {
4869
- const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize } = this._trackBox.updateCollection(items, itemConfigMap, opts);
4870
- displayItems = calculatedDisplayItems;
4871
- totalSize = calculatedTotalSize;
4872
- }
4873
- scroller.totalSize = totalSize;
4874
- this._totalSize.set(totalSize);
4875
- this._service.collection = displayItems;
4876
- this.resetBoundsSize(isVertical, totalSize);
4877
- this.createDisplayComponentsIfNeed(displayItems);
4878
- this.tracking();
4879
- if (emitable && this._readyToShow && actualScrollLength > 0) {
4880
- const isScrollStart = this._isUserScrolling && scrollPosition < MIN_SCROLL_TO_START_PIXELS;
4881
- this._isScrollStart.set(isScrollStart);
4882
- if (isScrollStart) {
4883
- this._isScrollFinished.set(false);
4884
- }
4885
- else {
4886
- this._isScrollFinished.set(scrollPosition >= roundedMaxPosition);
4887
- }
4888
- }
4889
- actualScrollSize = !this._readyToShow && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
4890
- (isVertical ? scroller.scrollTop ?? 0 : scroller.scrollLeft ?? 0);
4891
- const delta = this._trackBox.delta, roundedActualScrollSize = Math.round(actualScrollSize), scrollPositionAfterUpdate = actualScrollSize + delta, roundedScrollPositionAfterUpdate = Math.round(scrollPositionAfterUpdate), roundedMaxPositionAfterUpdate = Math.round(totalSize - viewportSize);
4892
- if (this._isSnappingMethodAdvanced) {
4893
- this.updateRegularRenderer();
4894
- }
4895
- scroller.delta = delta;
4896
- this._trackBox.clearDelta();
4897
- if ((snapScrollToBottom && this._trackBox.isSnappedToEnd) ||
4898
- (snapScrollToBottom && actualScrollSize > 0 &&
4899
- ((roundedScrollPositionAfterUpdate >= scrollPosition) &&
4900
- (scrollPosition >= roundedMaxPosition) &&
4901
- (roundedMaxPositionAfterUpdate >= roundedMaxPosition)))) {
4902
- if (!this._trackBox.isSnappedToEnd) {
4903
- this._isScrollFinished.set(true);
4904
- }
4905
- this._trackBox.isScrollEnd = true;
4906
- if (emitable && this._readyToShow) {
4907
- this.emitScrollEvent(true, false);
4908
- }
4909
- if (!this._readyToShow || roundedMaxPositionAfterUpdate > 0) {
4910
- const params = {
4911
- [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
4912
- fireUpdate: false, behavior: BEHAVIOR_INSTANT,
4913
- blending: false, duration: this.animationParams().scrollToItem,
4914
- };
4915
- scroller?.scrollTo?.(params);
4916
- if (emitable && !this._readyToShow) {
4917
- this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
4918
- }
4919
- return;
4920
- }
4921
- }
4922
- else if (roundedActualScrollSize !== roundedScrollPositionAfterUpdate && scrollPositionAfterUpdate > 0) {
4923
- if (!snapScrollToBottom && scrollPositionAfterUpdate >= roundedMaxPosition) {
4924
- if (!this._trackBox.isSnappedToEnd) {
4925
- this._isScrollFinished.set(true);
4926
- }
4927
- }
4928
- if (this._scrollSize() !== scrollPositionAfterUpdate) {
4929
- const params = {
4930
- [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true,
4931
- fireUpdate: false, behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
4932
- };
4933
- scroller.scrollTo(params);
4934
- if (emitable && !this._readyToShow) {
4935
- this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
4936
- }
4937
- return;
4938
- }
4939
- }
4940
- if (emitable && !this._readyToShow) {
4941
- this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
4942
- }
4943
- }
4944
- };
4945
4847
  const $updateComplete = this.$update.pipe(takeUntilDestroyed(), switchMap$1((v) => {
4946
4848
  if (((this._prevScrollStateVersion === EMPTY_SCROLL_STATE_VERSION) || (this._prevScrollStateVersion !== v)) &&
4947
4849
  (this._updateIterations < MIN_PREPARE_ITERATIONS)) {
@@ -5206,6 +5108,104 @@ class NgVirtualListComponent {
5206
5108
  this._$snapScrollToEndCanceller.next(false);
5207
5109
  }
5208
5110
  })).subscribe();
5111
+ const update = (params, emitable = true) => {
5112
+ const { snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion, } = params;
5113
+ const scroller = this._scrollerComponent();
5114
+ if (scroller) {
5115
+ let actualScrollSize = !this._readyToShow && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
5116
+ (isVertical ? scroller.scrollTop ?? 0 : scroller.scrollLeft ?? 0), totalSize = 0, displayItems;
5117
+ const { width, height, x, y } = bounds, viewportSize = (isVertical ? height : width);
5118
+ let scrollLength = Math.round(this._totalSize()) ?? 0, actualScrollLength = Math.round(scrollLength === 0 ? 0 : scrollLength > viewportSize ? scrollLength - viewportSize : scrollLength), roundedMaxPosition = Math.round(actualScrollLength), scrollPosition = Math.round(actualScrollSize);
5119
+ const opts = {
5120
+ bounds: { width, height, x, y }, dynamicSize, isVertical, itemSize,
5121
+ bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
5122
+ };
5123
+ if (snapScrollToBottom && !this._readyToShow) {
5124
+ const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts, scrollSize: actualScrollSize });
5125
+ displayItems = calculatedDisplayItems;
5126
+ totalSize = calculatedTotalSize1;
5127
+ scrollLength = Math.round(totalSize) ?? 0;
5128
+ actualScrollLength = Math.round(scrollLength === 0 ? 0 : scrollLength > viewportSize ? scrollLength - viewportSize : scrollLength);
5129
+ roundedMaxPosition = Math.round(actualScrollLength);
5130
+ scrollPosition = Math.round(actualScrollSize);
5131
+ }
5132
+ else {
5133
+ const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize } = this._trackBox.updateCollection(items, itemConfigMap, opts);
5134
+ displayItems = calculatedDisplayItems;
5135
+ totalSize = calculatedTotalSize;
5136
+ }
5137
+ scroller.totalSize = totalSize;
5138
+ this._totalSize.set(totalSize);
5139
+ this._service.collection = displayItems;
5140
+ this.resetBoundsSize(isVertical, totalSize);
5141
+ this.createDisplayComponentsIfNeed(displayItems);
5142
+ this.tracking();
5143
+ if (emitable && this._readyToShow && actualScrollLength > 0) {
5144
+ const isScrollStart = this._isUserScrolling && scrollPosition < MIN_SCROLL_TO_START_PIXELS;
5145
+ this._isScrollStart.set(isScrollStart);
5146
+ if (isScrollStart) {
5147
+ this._isScrollFinished.set(false);
5148
+ }
5149
+ else {
5150
+ this._isScrollFinished.set(scrollPosition >= roundedMaxPosition);
5151
+ }
5152
+ }
5153
+ actualScrollSize = !this._readyToShow && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
5154
+ (isVertical ? scroller.scrollTop ?? 0 : scroller.scrollLeft ?? 0);
5155
+ const delta = this._trackBox.delta, roundedActualScrollSize = Math.round(actualScrollSize), scrollPositionAfterUpdate = actualScrollSize + delta, roundedScrollPositionAfterUpdate = Math.round(scrollPositionAfterUpdate), roundedMaxPositionAfterUpdate = Math.round(totalSize - viewportSize);
5156
+ if (this._isSnappingMethodAdvanced) {
5157
+ this.updateRegularRenderer();
5158
+ }
5159
+ scroller.delta = delta;
5160
+ this._trackBox.clearDelta();
5161
+ if ((snapScrollToBottom && this._trackBox.isSnappedToEnd) ||
5162
+ (snapScrollToBottom && actualScrollSize > 0 &&
5163
+ ((roundedScrollPositionAfterUpdate >= scrollPosition) &&
5164
+ (scrollPosition >= roundedMaxPosition) &&
5165
+ (roundedMaxPositionAfterUpdate >= roundedMaxPosition)))) {
5166
+ if (!this._trackBox.isSnappedToEnd) {
5167
+ this._isScrollFinished.set(true);
5168
+ }
5169
+ this._trackBox.isScrollEnd = true;
5170
+ if (emitable && this._readyToShow) {
5171
+ this.emitScrollEvent(true, false);
5172
+ }
5173
+ if (!this._readyToShow || roundedMaxPositionAfterUpdate > 0) {
5174
+ const params = {
5175
+ [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
5176
+ fireUpdate: false, behavior: BEHAVIOR_INSTANT,
5177
+ blending: false, duration: this.animationParams().scrollToItem,
5178
+ };
5179
+ scroller?.scrollTo?.(params);
5180
+ if (emitable && !this._readyToShow) {
5181
+ this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5182
+ }
5183
+ return;
5184
+ }
5185
+ }
5186
+ else if (roundedActualScrollSize !== roundedScrollPositionAfterUpdate && scrollPositionAfterUpdate > 0) {
5187
+ if (!snapScrollToBottom && scrollPositionAfterUpdate >= roundedMaxPosition) {
5188
+ if (!this._trackBox.isSnappedToEnd) {
5189
+ this._isScrollFinished.set(true);
5190
+ }
5191
+ }
5192
+ if (this._scrollSize() !== scrollPositionAfterUpdate) {
5193
+ const params = {
5194
+ [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true,
5195
+ fireUpdate: false, behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
5196
+ };
5197
+ scroller.scrollTo(params);
5198
+ if (emitable && !this._readyToShow) {
5199
+ this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5200
+ }
5201
+ return;
5202
+ }
5203
+ }
5204
+ if (emitable && !this._readyToShow) {
5205
+ this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5206
+ }
5207
+ }
5208
+ };
5209
5209
  $viewInit.pipe(takeUntilDestroyed(), filter$1(v => !!v), switchMap$1(() => {
5210
5210
  return combineLatest([$snapScrollToBottom, $bounds, $listBounds, $scrollEndOffset, $actualItems, $itemConfigMap, $scrollSize, $itemSize,
5211
5211
  $bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion, this.$fireUpdate,