ng-virtual-list 19.10.4 → 19.10.6

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.
@@ -142,7 +142,7 @@ const TRACK_BY_PROPERTY_NAME = 'id';
142
142
  const DEFAULT_DIRECTION = Directions.VERTICAL;
143
143
  const DEFAULT_COLLECTION_MODE = CollectionModes.NORMAL;
144
144
  const DISPLAY_OBJECTS_LENGTH_MESUREMENT_ERROR = 1;
145
- const MAX_SCROLL_TO_ITERATIONS = 5;
145
+ const MAX_SCROLL_TO_ITERATIONS = 7;
146
146
  const DEFAULT_SNAPPING_METHOD = SnappingMethods.NORMAL;
147
147
  const DEFAULT_SELECT_METHOD = MethodsForSelecting.NONE;
148
148
  const DEFAULT_SCREEN_READER_MESSAGE = 'Showing items $1 to $2';
@@ -3829,10 +3829,10 @@ class NgScrollerComponent extends NgScrollView {
3829
3829
  if (update) {
3830
3830
  this.scrollBar?.scroll({
3831
3831
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: thumbPosition, fireUpdate: false, behavior: BEHAVIOR_INSTANT,
3832
- userAction: false, blending: false,
3832
+ userAction: false, blending: true,
3833
3833
  });
3834
3834
  }
3835
- this.scrollbarShow.set(isVertical ? this.scrollHeight > 0 : this.scrollWidth > 0);
3835
+ this.scrollbarShow.set(this.scrollable);
3836
3836
  }
3837
3837
  ;
3838
3838
  ngAfterViewInit() {
@@ -3843,18 +3843,14 @@ class NgScrollerComponent extends NgScrollView {
3843
3843
  }
3844
3844
  onDragStart() {
3845
3845
  super.onDragStart();
3846
- if (!!this.scrollBar) {
3847
- this.scrollBar.stopScrolling();
3848
- }
3846
+ this.stopScrollbar();
3849
3847
  this._isScrollbarUserAction = false;
3850
3848
  this.updateScrollBar();
3851
3849
  }
3852
3850
  reset() {
3853
3851
  super.reset(this.startOffset());
3854
3852
  this.totalSize = 0;
3855
- if (this.scrollBar) {
3856
- this.scrollBar.stopScrolling();
3857
- }
3853
+ this.stopScrollbar();
3858
3854
  this.refresh(true, true);
3859
3855
  this.prepared = false;
3860
3856
  }
@@ -3880,13 +3876,16 @@ class NgScrollerComponent extends NgScrollView {
3880
3876
  scrollTo(params) {
3881
3877
  const userAction = params.userAction ?? true, blending = params.blending ?? true, fireUpdate = params.fireUpdate ?? false;
3882
3878
  if (userAction && (!blending && !this._isMoving) && !fireUpdate) {
3883
- if (this.scrollBar) {
3884
- this.scrollBar.stopScrolling();
3885
- }
3879
+ this.stopScrollbar();
3886
3880
  this._isScrollbarUserAction = false;
3887
3881
  }
3888
3882
  this.scroll(params);
3889
3883
  }
3884
+ stopScrollbar() {
3885
+ if (!!this.scrollBar) {
3886
+ this.scrollBar.stopScrolling();
3887
+ }
3888
+ }
3890
3889
  onScrollBarDragHandler(event) {
3891
3890
  const { animation, position, min, max, userAction } = event;
3892
3891
  this._isScrollbarUserAction = userAction;
@@ -3929,7 +3928,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
3929
3928
  args: ['scrollBar', { read: NgScrollBarComponent }]
3930
3929
  }] } });
3931
3930
 
3932
- const MIN_SCROLL_TO_START_PIXELS = 10, RANGE_DISPLAY_ITEMS_END_OFFSET = 20, MIN_PREPARE_ITERATIONS = 10, 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';
3931
+ 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
3932
  const validateScrollIteration = (value) => {
3934
3933
  return Number.isNaN(value) || (value < 0) ? 0 : value > MAX_SCROLL_TO_ITERATIONS ? MAX_SCROLL_TO_ITERATIONS : value;
3935
3934
  }, validateId = (id) => {
@@ -4539,9 +4538,9 @@ class NgVirtualListComponent {
4539
4538
  maxBufferSize = input(DEFAULT_MAX_BUFFER_SIZE, { ...this._maxBufferSizeTransform });
4540
4539
  _snappingMethodOptions = {
4541
4540
  transform: (v) => {
4542
- const valid = validateString(v) && (v === 'normal' || v === 'advanced' || 'chat');
4541
+ const valid = validateString(v) && (v === SnappingMethods.NORMAL || v === SnappingMethods.ADVANCED || v === SnappingMethods.CHAT);
4543
4542
  if (!valid) {
4544
- console.error('The "snappingMethod" parameter must have the value `normal`, `advanced` or `chat`.');
4543
+ console.error(`The "snappingMethod" parameter must have the value '${SnappingMethods.NORMAL}', '${SnappingMethods.ADVANCED}' or '${SnappingMethods.CHAT}'.`);
4545
4544
  return DEFAULT_SNAPPING_METHOD;
4546
4545
  }
4547
4546
  return v;
@@ -4844,44 +4843,30 @@ class NgVirtualListComponent {
4844
4843
  const dist = this.clickDistance();
4845
4844
  this._service.clickDistance = dist;
4846
4845
  });
4847
- const $updateComplete = this.$update.pipe(takeUntilDestroyed(), switchMap$1((v) => {
4846
+ const $updateComplete = this.$update.pipe(takeUntilDestroyed(), debounceTime(0), switchMap$1((v) => {
4848
4847
  if (((this._prevScrollStateVersion === EMPTY_SCROLL_STATE_VERSION) || (this._prevScrollStateVersion !== v)) &&
4849
4848
  (this._updateIterations < MIN_PREPARE_ITERATIONS)) {
4850
4849
  if (v !== EMPTY_SCROLL_STATE_VERSION) {
4851
4850
  this._prevScrollStateVersion = v;
4852
4851
  }
4853
4852
  this._trackBox.isScrollEnd = true;
4854
- this._$fireUpdateNextFrame.next();
4853
+ this._$fireUpdate.next();
4855
4854
  return of(false);
4856
4855
  }
4857
4856
  if (this._prevScrollStateVersion === v) {
4858
4857
  this._trackBox.isScrollEnd = true;
4859
- if (this._updateIterations === RESET_CACHE_FRAME_NUMBER) {
4860
- this.refreshActualItemSize(true);
4861
- }
4862
4858
  if (this._updateIterations < PREPARATION_REUPDATE_LENGTH) {
4863
4859
  this._updateIterations++;
4864
- this._$fireUpdateNextFrame.next();
4860
+ this._$fireUpdate.next();
4865
4861
  return of(false);
4866
4862
  }
4867
4863
  }
4868
4864
  this._prevScrollStateVersion = v;
4865
+ this.refreshActualItemSize(false);
4869
4866
  return of(true);
4870
4867
  }), filter$1(v => !!v), distinctUntilChanged()), $items = toObservable(this.items), $dynamicSize = toObservable(this.dynamicSize);
4871
4868
  const $viewInit = this.$viewInit, $snapScrollToBottom = toObservable(this.snapScrollToBottom), $waitForPreparation = toObservable(this.waitForPreparation);
4872
- combineLatest([$dynamicSize, $snapScrollToBottom, $waitForPreparation]).pipe(takeUntilDestroyed(this._destroyRef), distinctUntilChanged(), switchMap$1(([dynamicSize, snapScrollToBottom, waitForPreparation]) => {
4873
- if (!dynamicSize || !snapScrollToBottom || !waitForPreparation) {
4874
- this._readyToShow = true;
4875
- this.refreshActualItemSize(true);
4876
- const scrollerComponent = this._scrollerComponent();
4877
- if (scrollerComponent) {
4878
- scrollerComponent.prepared = true;
4879
- }
4880
- this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: false });
4881
- this._service.update();
4882
- this._$show.next(true);
4883
- return of(false);
4884
- }
4869
+ combineLatest([$viewInit, $dynamicSize, $snapScrollToBottom, $waitForPreparation]).pipe(takeUntilDestroyed(this._destroyRef), distinctUntilChanged(), filter$1(([init]) => !!init), switchMap$1(([, dynamicSize, snapScrollToBottom, waitForPreparation]) => {
4885
4870
  if (!!dynamicSize && !!snapScrollToBottom && !!waitForPreparation) {
4886
4871
  this._$show.next(false);
4887
4872
  this.cacheClean();
@@ -4892,12 +4877,14 @@ class NgVirtualListComponent {
4892
4877
  scrollerComponent.stopScrolling();
4893
4878
  }
4894
4879
  this.classes.set({ prepared: false, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
4895
- return $items.pipe(takeUntilDestroyed(this._destroyRef), map(i => (i ?? []).length > 0), distinctUntilChanged(), switchMap$1(v => {
4896
- if (!v) {
4880
+ return $items.pipe(takeUntilDestroyed(this._destroyRef), debounceTime(0), tap(items => {
4881
+ if (!items || items.length === 0) {
4897
4882
  this.cacheClean();
4898
4883
  this._readyToShow = this._isUserScrolling = false;
4899
4884
  this.refreshActualItemSize(false);
4900
- this._trackBox.isScrollEnd = true;
4885
+ if (snapScrollToBottom) {
4886
+ this._trackBox.isScrollEnd = true;
4887
+ }
4901
4888
  this._updateIterations = 0;
4902
4889
  this._prevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION;
4903
4890
  const scrollerComponent = this._scrollerComponent();
@@ -4907,6 +4894,10 @@ class NgVirtualListComponent {
4907
4894
  }
4908
4895
  this.classes.set({ prepared: false, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
4909
4896
  this._$show.next(false);
4897
+ }
4898
+ this._trackBox.resetCollection(items, this.actualItemSize());
4899
+ }), map(i => (i ?? []).length > 0), distinctUntilChanged(), switchMap$1(v => {
4900
+ if (!v) {
4910
4901
  return of(false);
4911
4902
  }
4912
4903
  return of(true).pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(() => {
@@ -4940,18 +4931,33 @@ class NgVirtualListComponent {
4940
4931
  }));
4941
4932
  }
4942
4933
  else {
4943
- this._readyToShow = true;
4944
- this.refreshActualItemSize(true);
4945
- const scrollerComponent = this._scrollerComponent();
4946
- if (scrollerComponent) {
4947
- scrollerComponent.prepared = true;
4948
- scrollerComponent.stopScrolling();
4949
- }
4950
- this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: false });
4951
- this._service.update(true);
4952
- this._$show.next(true);
4953
- this._scrollerComponent()?.refresh(true, true);
4954
- return of(false);
4934
+ return $items.pipe(takeUntilDestroyed(this._destroyRef), debounceTime(0), tap(items => {
4935
+ if (!items || items.length === 0) {
4936
+ this.cacheClean();
4937
+ const scrollerComponent = this._scrollerComponent();
4938
+ if (scrollerComponent) {
4939
+ scrollerComponent.prepared = false;
4940
+ scrollerComponent.stopScrolling();
4941
+ }
4942
+ this.classes.set({ prepared: false, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
4943
+ this._$show.next(false);
4944
+ }
4945
+ this._trackBox.resetCollection(items, this.actualItemSize());
4946
+ }), map(i => (i ?? []).length > 0), distinctUntilChanged(), filter$1(v => !!v), tap(() => {
4947
+ this._readyToShow = true;
4948
+ this.refreshActualItemSize(false);
4949
+ if (snapScrollToBottom) {
4950
+ this._trackBox.isScrollEnd = true;
4951
+ }
4952
+ const scrollerComponent = this._scrollerComponent();
4953
+ if (scrollerComponent) {
4954
+ scrollerComponent.prepared = true;
4955
+ }
4956
+ this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: true });
4957
+ this._$show.next(true);
4958
+ this._$fireUpdate.next();
4959
+ }));
4960
+ ;
4955
4961
  }
4956
4962
  })).subscribe();
4957
4963
  this._service.$focusedId.pipe(takeUntilDestroyed(), tap(v => {
@@ -5009,30 +5015,16 @@ class NgVirtualListComponent {
5009
5015
  $trackBy.pipe(takeUntilDestroyed(), tap(v => {
5010
5016
  this._trackBox.trackingPropertyName = v;
5011
5017
  })).subscribe();
5012
- const $bounds = toObservable(this._bounds).pipe(filter$1(b => !!b)), $listBounds = toObservable(this._listBounds).pipe(filter$1(b => !!b)), $scrollSize = toObservable(this._scrollSize), $itemSize = toObservable(this.actualItemSize).pipe(map(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = toObservable(this.bufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = toObservable(this.maxBufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $itemConfigMap = toObservable(this.itemConfigMap).pipe(map(v => !v ? {} : v)), $snap = toObservable(this.snap), $isLazy = toObservable(this.collectionMode).pipe(map(v => this.getIsLazy(v || DEFAULT_COLLECTION_MODE))), $enabledBufferOptimization = toObservable(this.enabledBufferOptimization), $snappingMethod = toObservable(this.snappingMethod).pipe(map(v => this.getIsSnappingMethodAdvanced(v || DEFAULT_SNAPPING_METHOD))), $methodForSelecting = toObservable(this.methodForSelecting), $selectedIds = toObservable(this.selectedIds), $collapsedIds = toObservable(this.collapsedIds).pipe(map(v => Array.isArray(v) ? v : [])), $collapsedItemIds = toObservable(this._collapsedItemIds).pipe(map(v => Array.isArray(v) ? v : [])), $actualItems = toObservable(this._actualItems), $screenReaderMessage = toObservable(this.screenReaderMessage), $displayItems = this._service.$displayItems, $cacheVersion = toObservable(this._cacheVersion);
5018
+ const $bounds = toObservable(this._bounds).pipe(filter$1(b => !!b)), $listBounds = toObservable(this._listBounds).pipe(filter$1(b => !!b)), $scrollSize = toObservable(this._scrollSize), $itemSize = toObservable(this.itemSize).pipe(map(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $actualItemSize = toObservable(this.actualItemSize).pipe(map(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = toObservable(this.bufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = toObservable(this.maxBufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $itemConfigMap = toObservable(this.itemConfigMap).pipe(map(v => !v ? {} : v)), $snap = toObservable(this.snap), $isLazy = toObservable(this.collectionMode).pipe(map(v => this.getIsLazy(v || DEFAULT_COLLECTION_MODE))), $enabledBufferOptimization = toObservable(this.enabledBufferOptimization), $snappingMethod = toObservable(this.snappingMethod).pipe(map(v => this.getIsSnappingMethodAdvanced(v || DEFAULT_SNAPPING_METHOD))), $methodForSelecting = toObservable(this.methodForSelecting), $selectedIds = toObservable(this.selectedIds), $collapsedIds = toObservable(this.collapsedIds).pipe(map(v => Array.isArray(v) ? v : [])), $collapsedItemIds = toObservable(this._collapsedItemIds).pipe(map(v => Array.isArray(v) ? v : [])), $actualItems = toObservable(this._actualItems), $screenReaderMessage = toObservable(this.screenReaderMessage), $displayItems = this._service.$displayItems, $cacheVersion = toObservable(this._cacheVersion);
5019
+ $itemSize.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(size => {
5020
+ this.actualItemSize.set(size);
5021
+ })).subscribe();
5013
5022
  combineLatest([$displayItems, $screenReaderMessage, $isVertical, $scrollSize, $bounds]).pipe(takeUntilDestroyed(), distinctUntilChanged(), debounceTime(100), takeUntilDestroyed(), tap(([items, screenReaderMessage, isVertical, scrollSize, bounds]) => {
5014
5023
  this.screenReaderFormattedMessage.set(formatScreenReaderMessage(items, screenReaderMessage, scrollSize, isVertical, bounds));
5015
5024
  })).subscribe();
5016
5025
  $isLazy.pipe(takeUntilDestroyed(), tap(v => {
5017
5026
  this._trackBox.isLazy = v;
5018
5027
  })).subscribe();
5019
- $items.pipe(takeUntilDestroyed(), debounceTime(0), tap(items => {
5020
- this._trackBox.resetCollection(items, this.actualItemSize());
5021
- if (!this._readyToShow) {
5022
- this._readyToShow = this._isUserScrolling = false;
5023
- this.refreshActualItemSize(false);
5024
- this._trackBox.isScrollEnd = true;
5025
- this._updateIterations = 0;
5026
- this._prevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION;
5027
- const scrollerComponent = this._scrollerComponent();
5028
- if (scrollerComponent) {
5029
- scrollerComponent.prepared = false;
5030
- scrollerComponent.stopScrolling();
5031
- }
5032
- this.classes.set({ prepared: false, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
5033
- this._$show.next(false);
5034
- }
5035
- })).subscribe();
5036
5028
  combineLatest([$items, $collapsedItemIds, $itemConfigMap, $trackBy]).pipe(takeUntilDestroyed(), debounceTime(0), tap(([items, collapsedIds, itemConfigMap, trackBy]) => {
5037
5029
  const hiddenItems = new CMap();
5038
5030
  let isCollapsed = false;
@@ -5150,7 +5142,8 @@ class NgVirtualListComponent {
5150
5142
  this._isScrollFinished.set(scrollPosition >= roundedMaxPosition);
5151
5143
  }
5152
5144
  }
5153
- actualScrollSize = !this._readyToShow && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
5145
+ actualScrollSize = ((!this._readyToShow && snapScrollToBottom) || this._trackBox.isSnappedToEnd) ?
5146
+ (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
5154
5147
  (isVertical ? scroller.scrollTop ?? 0 : scroller.scrollLeft ?? 0);
5155
5148
  const delta = this._trackBox.delta, roundedActualScrollSize = Math.round(actualScrollSize), scrollPositionAfterUpdate = actualScrollSize + delta, roundedScrollPositionAfterUpdate = Math.round(scrollPositionAfterUpdate), roundedMaxPositionAfterUpdate = Math.round(totalSize - viewportSize);
5156
5149
  if (this._isSnappingMethodAdvanced) {
@@ -5170,10 +5163,11 @@ class NgVirtualListComponent {
5170
5163
  if (emitable && this._readyToShow) {
5171
5164
  this.emitScrollEvent(true, false);
5172
5165
  }
5173
- if (!this._readyToShow || roundedMaxPositionAfterUpdate > 0) {
5166
+ if ((this._readyToShow && roundedMaxPositionAfterUpdate > 0) ||
5167
+ (roundedMaxPositionAfterUpdate >= 0 && this._scrollSize() !== roundedMaxPositionAfterUpdate)) {
5174
5168
  const params = {
5175
5169
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
5176
- fireUpdate: false, behavior: BEHAVIOR_INSTANT,
5170
+ fireUpdate: !this._readyToShow, behavior: BEHAVIOR_INSTANT,
5177
5171
  blending: false, duration: this.animationParams().scrollToItem,
5178
5172
  };
5179
5173
  scroller?.scrollTo?.(params);
@@ -5192,7 +5186,7 @@ class NgVirtualListComponent {
5192
5186
  if (this._scrollSize() !== scrollPositionAfterUpdate) {
5193
5187
  const params = {
5194
5188
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true,
5195
- fireUpdate: false, behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
5189
+ fireUpdate: !this._readyToShow, behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
5196
5190
  };
5197
5191
  scroller.scrollTo(params);
5198
5192
  if (emitable && !this._readyToShow) {
@@ -5207,7 +5201,7 @@ class NgVirtualListComponent {
5207
5201
  }
5208
5202
  };
5209
5203
  $viewInit.pipe(takeUntilDestroyed(), filter$1(v => !!v), switchMap$1(() => {
5210
- return combineLatest([$snapScrollToBottom, $bounds, $listBounds, $scrollEndOffset, $actualItems, $itemConfigMap, $scrollSize, $itemSize,
5204
+ return combineLatest([$snapScrollToBottom, $bounds, $listBounds, $scrollEndOffset, $actualItems, $itemConfigMap, $scrollSize, $actualItemSize,
5211
5205
  $bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion, this.$fireUpdate,
5212
5206
  ]).pipe(takeUntilDestroyed(this._destroyRef), distinctUntilChanged(), tap(([snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
5213
5207
  update({
@@ -5216,9 +5210,6 @@ class NgVirtualListComponent {
5216
5210
  });
5217
5211
  }));
5218
5212
  })).subscribe();
5219
- combineLatest([$items, $dynamicSize]).pipe(takeUntilDestroyed(), debounceTime(0), filter$1(([, dynamic]) => !dynamic), delay(0), takeUntilDestroyed(), tap(() => {
5220
- this._scrollerComponent()?.refresh(true);
5221
- })).subscribe();
5222
5213
  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));
5223
5214
  $scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
5224
5215
  return fromEvent(scroller, SCROLLER_WHEEL, { passive: true }).pipe(takeUntilDestroyed(this._destroyRef), filter$1(() => {
@@ -5389,7 +5380,7 @@ class NgVirtualListComponent {
5389
5380
  return of([false, {
5390
5381
  id, scroller: scrollerComponent, iteration: iteration + 1, blending,
5391
5382
  isLastIteration: notChanged, scrollCalled: true, cb
5392
- }]).pipe(delay(1));
5383
+ }]).pipe(delay(0));
5393
5384
  }
5394
5385
  else {
5395
5386
  this._scrollSize.set(actualScrollSize);
@@ -5537,12 +5528,12 @@ class NgVirtualListComponent {
5537
5528
  }
5538
5529
  }
5539
5530
  refreshActualItemSize(value) {
5540
- if (!this.waitForPreparation()) {
5531
+ if (!this.waitForPreparation() || !this.dynamicSize()) {
5541
5532
  return;
5542
5533
  }
5543
5534
  let size;
5544
- const bounds = this._bounds();
5545
- if (value === false) {
5535
+ const bounds = this._bounds(), dynamicSize = this.dynamicSize();
5536
+ if (dynamicSize && value === false) {
5546
5537
  size = (this._isVertical ?
5547
5538
  bounds?.height || DEFAULT_LIST_SIZE :
5548
5539
  bounds?.width || DEFAULT_LIST_SIZE);
@@ -5721,7 +5712,9 @@ class NgVirtualListComponent {
5721
5712
  * Force clearing the cache.
5722
5713
  */
5723
5714
  cacheClean() {
5724
- this._trackBox.cacheClean();
5715
+ if (this.dynamicSize()) {
5716
+ this._trackBox.cacheClean();
5717
+ }
5725
5718
  this._collapsedItemIds.set([]);
5726
5719
  this._isScrollStart.set(true);
5727
5720
  this._isScrollFinished.set(false);
@@ -5781,13 +5774,13 @@ class NgVirtualListComponent {
5781
5774
  }
5782
5775
  }
5783
5776
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: NgVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5784
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: NgVirtualListComponent, isStandalone: false, selector: "ng-virtual-list", inputs: { scrollbarTheme: { classPropertyName: "scrollbarTheme", publicName: "scrollbarTheme", isSignal: true, isRequired: false, transformFunction: null }, scrollbarMinSize: { classPropertyName: "scrollbarMinSize", publicName: "scrollbarMinSize", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, waitForPreparation: { classPropertyName: "waitForPreparation", publicName: "waitForPreparation", isSignal: true, isRequired: false, transformFunction: null }, clickDistance: { classPropertyName: "clickDistance", publicName: "clickDistance", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, defaultItemValue: { classPropertyName: "defaultItemValue", publicName: "defaultItemValue", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, collapsedIds: { classPropertyName: "collapsedIds", publicName: "collapsedIds", isSignal: true, isRequired: false, transformFunction: null }, selectByClick: { classPropertyName: "selectByClick", publicName: "selectByClick", isSignal: true, isRequired: false, transformFunction: null }, collapseByClick: { classPropertyName: "collapseByClick", publicName: "collapseByClick", isSignal: true, isRequired: false, transformFunction: null }, snap: { classPropertyName: "snap", publicName: "snap", isSignal: true, isRequired: false, transformFunction: null }, snapToEndTransitionInstantOffset: { classPropertyName: "snapToEndTransitionInstantOffset", publicName: "snapToEndTransitionInstantOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollStartOffset: { classPropertyName: "scrollStartOffset", publicName: "scrollStartOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollEndOffset: { classPropertyName: "scrollEndOffset", publicName: "scrollEndOffset", isSignal: true, isRequired: false, transformFunction: null }, snapScrollToBottom: { classPropertyName: "snapScrollToBottom", publicName: "snapScrollToBottom", isSignal: true, isRequired: false, transformFunction: null }, scrollbarEnabled: { classPropertyName: "scrollbarEnabled", publicName: "scrollbarEnabled", isSignal: true, isRequired: false, transformFunction: null }, scrollbarInteractive: { classPropertyName: "scrollbarInteractive", publicName: "scrollbarInteractive", isSignal: true, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "scrollBehavior", isSignal: true, isRequired: false, transformFunction: null }, animationParams: { classPropertyName: "animationParams", publicName: "animationParams", isSignal: true, isRequired: false, transformFunction: null }, overscrollEnabled: { classPropertyName: "overscrollEnabled", publicName: "overscrollEnabled", isSignal: true, isRequired: false, transformFunction: null }, enabledBufferOptimization: { classPropertyName: "enabledBufferOptimization", publicName: "enabledBufferOptimization", isSignal: true, isRequired: false, transformFunction: null }, itemRenderer: { classPropertyName: "itemRenderer", publicName: "itemRenderer", isSignal: true, isRequired: true, transformFunction: null }, itemConfigMap: { classPropertyName: "itemConfigMap", publicName: "itemConfigMap", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, dynamicSize: { classPropertyName: "dynamicSize", publicName: "dynamicSize", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, collectionMode: { classPropertyName: "collectionMode", publicName: "collectionMode", isSignal: true, isRequired: false, transformFunction: null }, bufferSize: { classPropertyName: "bufferSize", publicName: "bufferSize", isSignal: true, isRequired: false, transformFunction: null }, maxBufferSize: { classPropertyName: "maxBufferSize", publicName: "maxBufferSize", isSignal: true, isRequired: false, transformFunction: null }, snappingMethod: { classPropertyName: "snappingMethod", publicName: "snappingMethod", isSignal: true, isRequired: false, transformFunction: null }, methodForSelecting: { classPropertyName: "methodForSelecting", publicName: "methodForSelecting", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, screenReaderMessage: { classPropertyName: "screenReaderMessage", publicName: "screenReaderMessage", isSignal: true, isRequired: false, transformFunction: null }, langTextDir: { classPropertyName: "langTextDir", publicName: "langTextDir", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect", onCollapse: "onCollapse", onScrollReachStart: "onScrollReachStart", onScrollReachEnd: "onScrollReachEnd" }, host: { styleAttribute: "position: relative;" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_scrollerComponent", first: true, predicate: ["scroller"], descendants: true, isSignal: true }, { propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ngvl__screen-reader\">\r\n {{ screenReaderFormattedMessage() }}\r\n</div>\r\n\r\n@if (snap()) {\r\n <div #snappedContainer class=\"ngvl__snapped-container\">\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n </div>\r\n}\r\n<ng-scroller #scroller class=\"ngvl__list-scroller\" [classes]=\"classes()\" [startOffset]=\"scrollStartOffset()\"\r\n [direction]=\"direction()\" [endOffset]=\"scrollEndOffset()\" [scrollbarTheme]=\"scrollbarTheme()\"\r\n [focusedElement]=\"focusedElement()\" [loading]=\"loading()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollbarEnabled]=\"scrollbarEnabled()\" [scrollbarInteractive]=\"scrollbarInteractive()\"\r\n [scrollbarMinSize]=\"scrollbarMinSize()\" [scrollBehavior]=\"scrollBehavior()\">\r\n <ng-container #renderersContainer></ng-container>\r\n</ng-scroller>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__snapped-container{position:relative;width:100%}.ngvl__list-snapper{-webkit-tap-highlight-color:transparent;pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list-scroller{-webkit-tap-highlight-color:transparent;position:absolute;left:0;top:0;width:100%;height:100%;z-index:0}.ngvl__screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "component", type: NgScrollerComponent, selector: "ng-scroller", inputs: ["scrollbarEnabled", "scrollbarInteractive", "focusedElement", "content", "loading", "classes", "startOffset", "endOffset", "scrollbarTheme", "scrollbarMinSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
5777
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: NgVirtualListComponent, isStandalone: false, selector: "ng-virtual-list", inputs: { scrollbarTheme: { classPropertyName: "scrollbarTheme", publicName: "scrollbarTheme", isSignal: true, isRequired: false, transformFunction: null }, scrollbarMinSize: { classPropertyName: "scrollbarMinSize", publicName: "scrollbarMinSize", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, waitForPreparation: { classPropertyName: "waitForPreparation", publicName: "waitForPreparation", isSignal: true, isRequired: false, transformFunction: null }, clickDistance: { classPropertyName: "clickDistance", publicName: "clickDistance", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, defaultItemValue: { classPropertyName: "defaultItemValue", publicName: "defaultItemValue", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, collapsedIds: { classPropertyName: "collapsedIds", publicName: "collapsedIds", isSignal: true, isRequired: false, transformFunction: null }, selectByClick: { classPropertyName: "selectByClick", publicName: "selectByClick", isSignal: true, isRequired: false, transformFunction: null }, collapseByClick: { classPropertyName: "collapseByClick", publicName: "collapseByClick", isSignal: true, isRequired: false, transformFunction: null }, snap: { classPropertyName: "snap", publicName: "snap", isSignal: true, isRequired: false, transformFunction: null }, snapToEndTransitionInstantOffset: { classPropertyName: "snapToEndTransitionInstantOffset", publicName: "snapToEndTransitionInstantOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollStartOffset: { classPropertyName: "scrollStartOffset", publicName: "scrollStartOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollEndOffset: { classPropertyName: "scrollEndOffset", publicName: "scrollEndOffset", isSignal: true, isRequired: false, transformFunction: null }, snapScrollToBottom: { classPropertyName: "snapScrollToBottom", publicName: "snapScrollToBottom", isSignal: true, isRequired: false, transformFunction: null }, scrollbarEnabled: { classPropertyName: "scrollbarEnabled", publicName: "scrollbarEnabled", isSignal: true, isRequired: false, transformFunction: null }, scrollbarInteractive: { classPropertyName: "scrollbarInteractive", publicName: "scrollbarInteractive", isSignal: true, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "scrollBehavior", isSignal: true, isRequired: false, transformFunction: null }, animationParams: { classPropertyName: "animationParams", publicName: "animationParams", isSignal: true, isRequired: false, transformFunction: null }, overscrollEnabled: { classPropertyName: "overscrollEnabled", publicName: "overscrollEnabled", isSignal: true, isRequired: false, transformFunction: null }, enabledBufferOptimization: { classPropertyName: "enabledBufferOptimization", publicName: "enabledBufferOptimization", isSignal: true, isRequired: false, transformFunction: null }, itemRenderer: { classPropertyName: "itemRenderer", publicName: "itemRenderer", isSignal: true, isRequired: true, transformFunction: null }, itemConfigMap: { classPropertyName: "itemConfigMap", publicName: "itemConfigMap", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, dynamicSize: { classPropertyName: "dynamicSize", publicName: "dynamicSize", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, collectionMode: { classPropertyName: "collectionMode", publicName: "collectionMode", isSignal: true, isRequired: false, transformFunction: null }, bufferSize: { classPropertyName: "bufferSize", publicName: "bufferSize", isSignal: true, isRequired: false, transformFunction: null }, maxBufferSize: { classPropertyName: "maxBufferSize", publicName: "maxBufferSize", isSignal: true, isRequired: false, transformFunction: null }, snappingMethod: { classPropertyName: "snappingMethod", publicName: "snappingMethod", isSignal: true, isRequired: false, transformFunction: null }, methodForSelecting: { classPropertyName: "methodForSelecting", publicName: "methodForSelecting", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, screenReaderMessage: { classPropertyName: "screenReaderMessage", publicName: "screenReaderMessage", isSignal: true, isRequired: false, transformFunction: null }, langTextDir: { classPropertyName: "langTextDir", publicName: "langTextDir", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect", onCollapse: "onCollapse", onScrollReachStart: "onScrollReachStart", onScrollReachEnd: "onScrollReachEnd" }, host: { styleAttribute: "position: relative;" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_scrollerComponent", first: true, predicate: ["scroller"], descendants: true, isSignal: true }, { propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ngvl__screen-reader\">\r\n {{ screenReaderFormattedMessage() }}\r\n</div>\r\n\r\n@if (snap()) {\r\n <div #snappedContainer class=\"ngvl__snapped-container\" [ngClass]=\"classes()\">\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n </div>\r\n}\r\n<ng-scroller #scroller class=\"ngvl__list-scroller\" [classes]=\"classes()\" [startOffset]=\"scrollStartOffset()\"\r\n [direction]=\"direction()\" [endOffset]=\"scrollEndOffset()\" [scrollbarTheme]=\"scrollbarTheme()\"\r\n [focusedElement]=\"focusedElement()\" [loading]=\"loading()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollbarEnabled]=\"scrollbarEnabled()\" [scrollbarInteractive]=\"scrollbarInteractive()\"\r\n [scrollbarMinSize]=\"scrollbarMinSize()\" [scrollBehavior]=\"scrollBehavior()\">\r\n <ng-container #renderersContainer></ng-container>\r\n</ng-scroller>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__snapped-container{position:relative;width:100%;opacity:0}.ngvl__snapped-container.prepared{opacity:1}.ngvl__list-snapper{-webkit-tap-highlight-color:transparent;pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list-scroller{-webkit-tap-highlight-color:transparent;position:absolute;left:0;top:0;width:100%;height:100%;z-index:0}.ngvl__screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: NgScrollerComponent, selector: "ng-scroller", inputs: ["scrollbarEnabled", "scrollbarInteractive", "focusedElement", "content", "loading", "classes", "startOffset", "endOffset", "scrollbarTheme", "scrollbarMinSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
5785
5778
  }
5786
5779
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: NgVirtualListComponent, decorators: [{
5787
5780
  type: Component,
5788
5781
  args: [{ selector: 'ng-virtual-list', host: {
5789
5782
  'style': 'position: relative;'
5790
- }, standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, providers: [NgVirtualListService], template: "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ngvl__screen-reader\">\r\n {{ screenReaderFormattedMessage() }}\r\n</div>\r\n\r\n@if (snap()) {\r\n <div #snappedContainer class=\"ngvl__snapped-container\">\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n </div>\r\n}\r\n<ng-scroller #scroller class=\"ngvl__list-scroller\" [classes]=\"classes()\" [startOffset]=\"scrollStartOffset()\"\r\n [direction]=\"direction()\" [endOffset]=\"scrollEndOffset()\" [scrollbarTheme]=\"scrollbarTheme()\"\r\n [focusedElement]=\"focusedElement()\" [loading]=\"loading()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollbarEnabled]=\"scrollbarEnabled()\" [scrollbarInteractive]=\"scrollbarInteractive()\"\r\n [scrollbarMinSize]=\"scrollbarMinSize()\" [scrollBehavior]=\"scrollBehavior()\">\r\n <ng-container #renderersContainer></ng-container>\r\n</ng-scroller>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__snapped-container{position:relative;width:100%}.ngvl__list-snapper{-webkit-tap-highlight-color:transparent;pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list-scroller{-webkit-tap-highlight-color:transparent;position:absolute;left:0;top:0;width:100%;height:100%;z-index:0}.ngvl__screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
5783
+ }, standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, providers: [NgVirtualListService], template: "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ngvl__screen-reader\">\r\n {{ screenReaderFormattedMessage() }}\r\n</div>\r\n\r\n@if (snap()) {\r\n <div #snappedContainer class=\"ngvl__snapped-container\" [ngClass]=\"classes()\">\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n </div>\r\n}\r\n<ng-scroller #scroller class=\"ngvl__list-scroller\" [classes]=\"classes()\" [startOffset]=\"scrollStartOffset()\"\r\n [direction]=\"direction()\" [endOffset]=\"scrollEndOffset()\" [scrollbarTheme]=\"scrollbarTheme()\"\r\n [focusedElement]=\"focusedElement()\" [loading]=\"loading()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollbarEnabled]=\"scrollbarEnabled()\" [scrollbarInteractive]=\"scrollbarInteractive()\"\r\n [scrollbarMinSize]=\"scrollbarMinSize()\" [scrollBehavior]=\"scrollBehavior()\">\r\n <ng-container #renderersContainer></ng-container>\r\n</ng-scroller>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__snapped-container{position:relative;width:100%;opacity:0}.ngvl__snapped-container.prepared{opacity:1}.ngvl__list-snapper{-webkit-tap-highlight-color:transparent;pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list-scroller{-webkit-tap-highlight-color:transparent;position:absolute;left:0;top:0;width:100%;height:100%;z-index:0}.ngvl__screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
5791
5784
  }], ctorParameters: () => [], propDecorators: { _listContainerRef: [{
5792
5785
  type: ViewChild,
5793
5786
  args: ['renderersContainer', { read: ViewContainerRef }]