ng-virtual-list 20.10.12 → 20.10.13

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.
@@ -3111,7 +3111,7 @@ class NgScrollView {
3111
3111
  set totalSize(v) {
3112
3112
  this._totalSize = v;
3113
3113
  }
3114
- _startPosition = this._totalSize;
3114
+ _startPosition = 0;
3115
3115
  get actualScrollHeight() {
3116
3116
  const { height: viewportHeight } = this.viewportBounds(), totalSize = this._totalSize;
3117
3117
  if (this._inversion) {
@@ -3929,7 +3929,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
3929
3929
  args: ['scrollBar', { read: NgScrollBarComponent }]
3930
3930
  }], scrollbarEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollbarEnabled", required: false }] }], scrollbarInteractive: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollbarInteractive", required: false }] }], focusedElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedElement", required: false }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], classes: [{ type: i0.Input, args: [{ isSignal: true, alias: "classes", required: false }] }], startOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "startOffset", required: false }] }], endOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "endOffset", required: false }] }], scrollbarTheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollbarTheme", required: false }] }], scrollbarMinSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollbarMinSize", required: false }] }] } });
3931
3931
 
3932
- const MIN_SCROLL_TO_START_PIXELS = 10, RANGE_DISPLAY_ITEMS_END_OFFSET = 20, MIN_PREPARE_ITERATIONS = 35, PREPARATION_REUPDATE_LENGTH = 15, RESET_CACHE_FRAME_NUMBER = 3, EMPTY_SCROLL_STATE_VERSION = '-1', ROLE_LIST = 'list', ROLE_LIST_BOX = 'listbox', ITEM_ID = 'item-id', ITEM_CONTAINER = 'ngvl-item__container', READY_TO_START = 'ready-to-start', WAIT_FOR_PREPARATION = 'wait-for-preparation';
3932
+ const MIN_SCROLL_TO_START_PIXELS = 10, RANGE_DISPLAY_ITEMS_END_OFFSET = 20, MIN_PREPARE_ITERATIONS = 5, PREPARATION_REUPDATE_LENGTH = 2, EMPTY_SCROLL_STATE_VERSION = '-1', ROLE_LIST = 'list', ROLE_LIST_BOX = 'listbox', ITEM_ID = 'item-id', ITEM_CONTAINER = 'ngvl-item__container', READY_TO_START = 'ready-to-start', WAIT_FOR_PREPARATION = 'wait-for-preparation';
3933
3933
  const validateScrollIteration = (value) => {
3934
3934
  return Number.isNaN(value) || (value < 0) ? 0 : value > MAX_SCROLL_TO_ITERATIONS ? MAX_SCROLL_TO_ITERATIONS : value;
3935
3935
  }, validateId = (id) => {
@@ -4856,9 +4856,6 @@ class NgVirtualListComponent {
4856
4856
  }
4857
4857
  if (this._prevScrollStateVersion === v) {
4858
4858
  this._trackBox.isScrollEnd = true;
4859
- if (this._updateIterations === RESET_CACHE_FRAME_NUMBER) {
4860
- this.refreshActualItemSize(true);
4861
- }
4862
4859
  if (this._updateIterations < PREPARATION_REUPDATE_LENGTH) {
4863
4860
  this._updateIterations++;
4864
4861
  this._trackBox.isScrollEnd = true;
@@ -4867,6 +4864,7 @@ class NgVirtualListComponent {
4867
4864
  }
4868
4865
  }
4869
4866
  this._prevScrollStateVersion = v;
4867
+ this.refreshActualItemSize(false);
4870
4868
  return of(true);
4871
4869
  }), filter$1(v => !!v), distinctUntilChanged()), $items = toObservable(this.items), $dynamicSize = toObservable(this.dynamicSize);
4872
4870
  const $viewInit = this.$viewInit, $snapScrollToBottom = toObservable(this.snapScrollToBottom), $waitForPreparation = toObservable(this.waitForPreparation);
@@ -4893,7 +4891,10 @@ class NgVirtualListComponent {
4893
4891
  scrollerComponent.stopScrolling();
4894
4892
  }
4895
4893
  this.classes.set({ prepared: false, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
4896
- return $items.pipe(takeUntilDestroyed(this._destroyRef), debounceTime(0), map(i => (i ?? []).length > 0), distinctUntilChanged(), switchMap$1(v => {
4894
+ return $items.pipe(takeUntilDestroyed(this._destroyRef), debounceTime(0), tap(items => {
4895
+ if (items && items.length > 0)
4896
+ this._trackBox.resetCollection(items, this.actualItemSize());
4897
+ }), map(i => (i ?? []).length > 0), distinctUntilChanged(), switchMap$1(v => {
4897
4898
  if (!v) {
4898
4899
  this.cacheClean();
4899
4900
  this._readyToShow = this._isUserScrolling = false;
@@ -5017,9 +5018,6 @@ class NgVirtualListComponent {
5017
5018
  $isLazy.pipe(takeUntilDestroyed(), tap(v => {
5018
5019
  this._trackBox.isLazy = v;
5019
5020
  })).subscribe();
5020
- $items.pipe(takeUntilDestroyed(), debounceTime(0), tap(items => {
5021
- this._trackBox.resetCollection(items, this.actualItemSize());
5022
- })).subscribe();
5023
5021
  combineLatest([$items, $collapsedItemIds, $itemConfigMap, $trackBy]).pipe(takeUntilDestroyed(), debounceTime(0), tap(([items, collapsedIds, itemConfigMap, trackBy]) => {
5024
5022
  const hiddenItems = new CMap();
5025
5023
  let isCollapsed = false;
@@ -5157,10 +5155,10 @@ class NgVirtualListComponent {
5157
5155
  if (emitable && this._readyToShow) {
5158
5156
  this.emitScrollEvent(true, false);
5159
5157
  }
5160
- if (!this._readyToShow || roundedMaxPositionAfterUpdate > 0) {
5158
+ if (roundedMaxPositionAfterUpdate >= 0 && this._scrollSize() !== roundedMaxPositionAfterUpdate) {
5161
5159
  const params = {
5162
5160
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
5163
- fireUpdate: false, behavior: BEHAVIOR_INSTANT,
5161
+ fireUpdate: this._readyToShow, behavior: BEHAVIOR_INSTANT,
5164
5162
  blending: false, duration: this.animationParams().scrollToItem,
5165
5163
  };
5166
5164
  scroller?.scrollTo?.(params);
@@ -5179,7 +5177,7 @@ class NgVirtualListComponent {
5179
5177
  if (this._scrollSize() !== scrollPositionAfterUpdate) {
5180
5178
  const params = {
5181
5179
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true,
5182
- fireUpdate: false, behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
5180
+ fireUpdate: this._readyToShow, behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
5183
5181
  };
5184
5182
  scroller.scrollTo(params);
5185
5183
  if (emitable && !this._readyToShow) {
@@ -5188,7 +5186,7 @@ class NgVirtualListComponent {
5188
5186
  return;
5189
5187
  }
5190
5188
  }
5191
- if (emitable && !this._readyToShow) {
5189
+ if (emitable || !this._readyToShow) {
5192
5190
  this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5193
5191
  }
5194
5192
  }