ng-virtual-list 18.9.2 → 18.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.
@@ -345,8 +345,8 @@ class NgVirtualListService {
345
345
  this.select(data);
346
346
  }
347
347
  }
348
- update() {
349
- this._trackBox?.changes();
348
+ update(immediately = false) {
349
+ this._trackBox?.changes(immediately);
350
350
  }
351
351
  /**
352
352
  * Selects a list item
@@ -600,7 +600,6 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
600
600
  config = signal({});
601
601
  measures = signal(undefined);
602
602
  focused = signal(false);
603
- reseted = signal(false);
604
603
  part = signal(PART_DEFAULT_ITEM);
605
604
  maxClickDistance = signal(DEFAULT_CLICK_DISTANCE);
606
605
  data = signal(undefined);
@@ -695,7 +694,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
695
694
  const data = this.data(), measures = this.measures(), config = this.config();
696
695
  return {
697
696
  data: data?.data, prevData: data?.previouseData, nextData: data?.nextData, measures,
698
- config, reseted: this.reseted(), index: data?.index ?? -1
697
+ config, reseted: false, index: data?.index ?? -1
699
698
  };
700
699
  });
701
700
  const $data = toObservable(this.data), $focused = toObservable(this.focused);
@@ -878,7 +877,6 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
878
877
  return { width: width > 0 ? width : 1, height: height > 0 ? height : 1, };
879
878
  }
880
879
  show() {
881
- this.reseted.set(false);
882
880
  const el = this._elementRef.nativeElement, styles = el.style;
883
881
  styles.zIndex = this._data?.config?.zIndex ?? DEFAULT_ZINDEX;
884
882
  if (this.regular) {
@@ -895,7 +893,6 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
895
893
  }
896
894
  }
897
895
  hide() {
898
- this.reseted.set(true);
899
896
  const el = this._elementRef.nativeElement, styles = el.style;
900
897
  styles.position = POSITION_ABSOLUTE;
901
898
  styles.transform = `${TRANSLATE_3D$1}(${this._data?.config?.isVertical ? 0 : ZEROS_POSITION},${this._data?.config?.isVertical ? 0 : ZEROS_POSITION},0)`;
@@ -1206,14 +1203,14 @@ class CacheMap extends EventEmitter {
1206
1203
  }
1207
1204
  stopLifeCircle() {
1208
1205
  if (this._lifeCircleId !== undefined) {
1209
- cancelAnimationFrame(this._lifeCircleId);
1206
+ clearTimeout(this._lifeCircleId);
1210
1207
  }
1211
1208
  }
1212
1209
  nextTick(cb) {
1213
1210
  if (this._disposed) {
1214
1211
  return;
1215
1212
  }
1216
- this._lifeCircleId = requestAnimationFrame(() => {
1213
+ this._lifeCircleId = setTimeout(() => {
1217
1214
  cb();
1218
1215
  });
1219
1216
  return this._lifeCircleId;
@@ -1906,7 +1903,7 @@ class TrackBox extends CacheMap {
1906
1903
  * Calculates list metrics
1907
1904
  */
1908
1905
  recalculateMetrics(options) {
1909
- const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, reversed, bufferSize: minBufferSize, scrollSize, snap, itemConfigMap, enabledBufferOptimization, previousTotalSize, crudDetected, deletedItemsMap } = options, roundedScrollSize = Math.round(scrollSize);
1906
+ const { fromItemId, bounds, collection, dynamicSize, isVertical, itemSize, bufferSize: minBufferSize, scrollSize, snap, itemConfigMap, enabledBufferOptimization, previousTotalSize, crudDetected, deletedItemsMap } = options, roundedScrollSize = Math.round(scrollSize);
1910
1907
  const trackBy = this._trackingPropertyName, bufferSize = Math.max(minBufferSize, this._bufferSize), { width, height } = bounds, sizeProperty = isVertical ? HEIGHT_PROP_NAME : WIDTH_PROP_NAME, size = isVertical ? height : width, totalLength = collection.length, typicalItemSize = itemSize, w = isVertical ? width : typicalItemSize, h = isVertical ? typicalItemSize : height, map = this._map, snapshot = this._snapshot, checkOverscrollItemsLimit = Math.ceil(typicalItemSize !== 0 ? size / typicalItemSize : 0), snippedPos = Math.floor(scrollSize) + this._scrollStartOffset, leftItemsWeights = [], isFromId = fromItemId !== undefined && (typeof fromItemId === 'number' && fromItemId > -1)
1911
1908
  || (typeof fromItemId === 'string' && fromItemId > '-1');
1912
1909
  let leftItemsOffset = 0, rightItemsOffset = 0;
@@ -2177,7 +2174,6 @@ class TrackBox extends CacheMap {
2177
2174
  totalSize,
2178
2175
  typicalItemSize,
2179
2176
  isFromItemIdFound,
2180
- reversed: options.reversed,
2181
2177
  isUpdating,
2182
2178
  };
2183
2179
  return metrics;
@@ -2191,11 +2187,18 @@ class TrackBox extends CacheMap {
2191
2187
  this.clearScrollDirectionCache();
2192
2188
  }
2193
2189
  }
2194
- changes() {
2190
+ changes(immediately = false) {
2191
+ if (this.changesDetected()) {
2192
+ return;
2193
+ }
2195
2194
  this.bumpVersion();
2195
+ if (immediately) {
2196
+ this._previousVersion = this._version;
2197
+ this.dispatch(CACHE_BOX_CHANGE_EVENT_NAME, this.version);
2198
+ }
2196
2199
  }
2197
2200
  generateDisplayCollection(items, itemConfigMap, metrics) {
2198
- const { offsetY, offsetX, width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, reversed, } = metrics, displayItems = [];
2201
+ const { offsetY, offsetX, width, height, normalizedItemWidth, normalizedItemHeight, dynamicSize, itemsOnDisplayLength, itemsFromStartToScrollEnd, isVertical, renderItems: renderItemsLength, scrollSize, sizeProperty, snap, snippedPos, startPosition, totalLength, startIndex, typicalItemSize, } = metrics, displayItems = [];
2199
2202
  if (items.length) {
2200
2203
  const trackBy = this._trackingPropertyName, actualSnippedPosition = snippedPos, isSnappingMethodAdvanced = this.isSnappingMethodAdvanced, boundsSize = isVertical ? height : width, actualEndSnippedPosition = scrollSize + boundsSize - this._scrollEndOffset, positionOffset = isVertical ? offsetY : offsetX;
2201
2204
  let pos = startPosition, renderItems = renderItemsLength, stickyItem, nextSticky, stickyItemIndex = -1, stickyItemSize = 0, endStickyItem, nextEndSticky, endStickyItemIndex = -1, endStickyItemSize = 0, count = 1;
@@ -2311,7 +2314,7 @@ class TrackBox extends CacheMap {
2311
2314
  if (iterations > totalLength || i >= totalLength) {
2312
2315
  break;
2313
2316
  }
2314
- const collectionItem = items[reversed ? (items.length - i + 1) : i];
2317
+ const collectionItem = items[i];
2315
2318
  if (!collectionItem) {
2316
2319
  continue;
2317
2320
  }
@@ -3665,11 +3668,11 @@ class NgScrollerComponent {
3665
3668
  }
3666
3669
  }
3667
3670
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NgScrollerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3668
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.14", type: NgScrollerComponent, selector: "ng-scroller", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, startOffset: { classPropertyName: "startOffset", publicName: "startOffset", isSignal: true, isRequired: false, transformFunction: null }, endOffset: { classPropertyName: "endOffset", publicName: "endOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollbarTheme: { classPropertyName: "scrollbarTheme", publicName: "scrollbarTheme", isSignal: true, isRequired: false, transformFunction: null }, scrollbarMinSize: { classPropertyName: "scrollbarMinSize", publicName: "scrollbarMinSize", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "scrollContent", first: true, predicate: ["scrollContent"], descendants: true, isSignal: true }, { propertyName: "scrollViewport", first: true, predicate: ["scrollViewport"], descendants: true, isSignal: true }, { propertyName: "cdkScrollable", first: true, predicate: ["scrollViewport"], descendants: true, read: CdkScrollable }, { propertyName: "scrollBar", first: true, predicate: ["scrollBar"], descendants: true, read: NgScrollBarComponent }], ngImport: i0, template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\" [ngClass]=\"containerClasses()\">\r\n <div #scrollViewport cdkScrollable part=\"scroller\" class=\"ngvl__scroller\">\r\n <div #scrollContent [attr.aria-orientation]=\"direction()\" [attr.aria-activedescendant]=\"focusedElement()\"\r\n tabindex=\"0\" part=\"list\" class=\"ngvl__list\" [ngClass]=\"actualClasses()\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <ng-scroll-bar #scrollBar [isVertical]=\"isVertical()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\" [position]=\"thumbPosition()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"preparedSignal()\" [show]=\"thumbShow()\"\r\n (onDrag)=\"onScrollBarDragHandler($event)\"></ng-scroll-bar>\r\n</div>", styles: [":host{position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}.ngvl__container{position:relative;overflow:hidden;display:grid;width:100%;height:100%;cursor:grab}.ngvl__container.grabbing{cursor:grabbing}.ngvl__container.horizontal{grid-template-rows:1fr auto}.ngvl__container.horizontal .ngvl__list{display:inline-flex}.ngvl__container.horizontal .ngvl__scroller{overflow:hidden}.ngvl__container.vertical{grid-template-columns:1fr auto}.ngvl__container.vertical .ngvl__scroller{overflow:hidden}.ngvl__scroller{display:block;position:relative;overflow:hidden;width:100%;height:100%}.ngvl__list{position:absolute;list-style:none;padding:0;margin:0;width:100%;height:100%;opacity:0}.ngvl__list.prepared{opacity:1;overflow:hidden}.ngvl__list.prepared.wait-for-preparation{transition:opacity .15s ease-out .1s}.ngvl__list.ready-to-start{transition:height .15s ease-out}.ngvl__list.ready-to-start.wait-for-preparation{transition:height .15s ease-out,opacity .15s ease-out .1s}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: NgScrollBarComponent, selector: "ng-scroll-bar", inputs: ["loading", "isVertical", "position", "thumbGradientPositions", "size", "theme", "prepared", "show"], outputs: ["onDrag"] }, { kind: "directive", type: LocaleSensitiveDirective, selector: "[localeSensitive]", inputs: ["langTextDir", "listDir"] }] });
3671
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.14", type: NgScrollerComponent, selector: "ng-scroller", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, startOffset: { classPropertyName: "startOffset", publicName: "startOffset", isSignal: true, isRequired: false, transformFunction: null }, endOffset: { classPropertyName: "endOffset", publicName: "endOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollbarTheme: { classPropertyName: "scrollbarTheme", publicName: "scrollbarTheme", isSignal: true, isRequired: false, transformFunction: null }, scrollbarMinSize: { classPropertyName: "scrollbarMinSize", publicName: "scrollbarMinSize", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "scrollContent", first: true, predicate: ["scrollContent"], descendants: true, isSignal: true }, { propertyName: "scrollViewport", first: true, predicate: ["scrollViewport"], descendants: true, isSignal: true }, { propertyName: "cdkScrollable", first: true, predicate: ["scrollViewport"], descendants: true, read: CdkScrollable }, { propertyName: "scrollBar", first: true, predicate: ["scrollBar"], descendants: true, read: NgScrollBarComponent }], ngImport: i0, template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\" [ngClass]=\"containerClasses()\">\r\n <div #scrollViewport cdkScrollable part=\"scroller\" class=\"ngvl__scroller\">\r\n <div #scrollContent [attr.aria-orientation]=\"direction()\" [attr.aria-activedescendant]=\"focusedElement()\"\r\n tabindex=\"0\" part=\"list\" class=\"ngvl__list\" [ngClass]=\"actualClasses()\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <ng-scroll-bar #scrollBar [isVertical]=\"isVertical()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\" [position]=\"thumbPosition()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"preparedSignal()\" [show]=\"thumbShow()\"\r\n (onDrag)=\"onScrollBarDragHandler($event)\"></ng-scroll-bar>\r\n</div>", styles: [":host{position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}.ngvl__container{position:relative;overflow:hidden;display:grid;width:100%;height:100%;cursor:grab}.ngvl__container.grabbing{cursor:grabbing}.ngvl__container.horizontal{grid-template-rows:1fr auto}.ngvl__container.horizontal .ngvl__list{display:inline-flex}.ngvl__container.horizontal .ngvl__scroller{overflow:hidden}.ngvl__container.vertical{grid-template-columns:1fr auto}.ngvl__container.vertical .ngvl__scroller{overflow:hidden}.ngvl__scroller{display:block;position:relative;overflow:hidden;width:100%;height:100%}.ngvl__list{position:absolute;list-style:none;padding:0;margin:0;width:100%;height:100%}.ngvl__list.prepared{overflow:hidden}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: NgScrollBarComponent, selector: "ng-scroll-bar", inputs: ["loading", "isVertical", "position", "thumbGradientPositions", "size", "theme", "prepared", "show"], outputs: ["onDrag"] }, { kind: "directive", type: LocaleSensitiveDirective, selector: "[localeSensitive]", inputs: ["langTextDir", "listDir"] }] });
3669
3672
  }
3670
3673
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NgScrollerComponent, decorators: [{
3671
3674
  type: Component,
3672
- args: [{ selector: 'ng-scroller', standalone: false, template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\" [ngClass]=\"containerClasses()\">\r\n <div #scrollViewport cdkScrollable part=\"scroller\" class=\"ngvl__scroller\">\r\n <div #scrollContent [attr.aria-orientation]=\"direction()\" [attr.aria-activedescendant]=\"focusedElement()\"\r\n tabindex=\"0\" part=\"list\" class=\"ngvl__list\" [ngClass]=\"actualClasses()\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <ng-scroll-bar #scrollBar [isVertical]=\"isVertical()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\" [position]=\"thumbPosition()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"preparedSignal()\" [show]=\"thumbShow()\"\r\n (onDrag)=\"onScrollBarDragHandler($event)\"></ng-scroll-bar>\r\n</div>", styles: [":host{position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}.ngvl__container{position:relative;overflow:hidden;display:grid;width:100%;height:100%;cursor:grab}.ngvl__container.grabbing{cursor:grabbing}.ngvl__container.horizontal{grid-template-rows:1fr auto}.ngvl__container.horizontal .ngvl__list{display:inline-flex}.ngvl__container.horizontal .ngvl__scroller{overflow:hidden}.ngvl__container.vertical{grid-template-columns:1fr auto}.ngvl__container.vertical .ngvl__scroller{overflow:hidden}.ngvl__scroller{display:block;position:relative;overflow:hidden;width:100%;height:100%}.ngvl__list{position:absolute;list-style:none;padding:0;margin:0;width:100%;height:100%;opacity:0}.ngvl__list.prepared{opacity:1;overflow:hidden}.ngvl__list.prepared.wait-for-preparation{transition:opacity .15s ease-out .1s}.ngvl__list.ready-to-start{transition:height .15s ease-out}.ngvl__list.ready-to-start.wait-for-preparation{transition:height .15s ease-out,opacity .15s ease-out .1s}\n"] }]
3675
+ args: [{ selector: 'ng-scroller', standalone: false, template: "<div localeSensitive [langTextDir]=\"langTextDir()\" [listDir]=\"direction()\" class=\"ngvl__container\" [ngClass]=\"containerClasses()\">\r\n <div #scrollViewport cdkScrollable part=\"scroller\" class=\"ngvl__scroller\">\r\n <div #scrollContent [attr.aria-orientation]=\"direction()\" [attr.aria-activedescendant]=\"focusedElement()\"\r\n tabindex=\"0\" part=\"list\" class=\"ngvl__list\" [ngClass]=\"actualClasses()\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <ng-scroll-bar #scrollBar [isVertical]=\"isVertical()\" [size]=\"thumbSize()\" [theme]=\"scrollbarTheme()\" [position]=\"thumbPosition()\"\r\n [thumbGradientPositions]=\"thumbGradientPositions()\" [loading]=\"loading()\" [prepared]=\"preparedSignal()\" [show]=\"thumbShow()\"\r\n (onDrag)=\"onScrollBarDragHandler($event)\"></ng-scroll-bar>\r\n</div>", styles: [":host{position:relative;overflow:hidden;-webkit-user-select:none;user-select:none}.ngvl__container{position:relative;overflow:hidden;display:grid;width:100%;height:100%;cursor:grab}.ngvl__container.grabbing{cursor:grabbing}.ngvl__container.horizontal{grid-template-rows:1fr auto}.ngvl__container.horizontal .ngvl__list{display:inline-flex}.ngvl__container.horizontal .ngvl__scroller{overflow:hidden}.ngvl__container.vertical{grid-template-columns:1fr auto}.ngvl__container.vertical .ngvl__scroller{overflow:hidden}.ngvl__scroller{display:block;position:relative;overflow:hidden;width:100%;height:100%}.ngvl__list{position:absolute;list-style:none;padding:0;margin:0;width:100%;height:100%}.ngvl__list.prepared{overflow:hidden}\n"] }]
3673
3676
  }], ctorParameters: () => [], propDecorators: { cdkScrollable: [{
3674
3677
  type: ViewChild,
3675
3678
  args: ['scrollViewport', { read: CdkScrollable }]
@@ -4518,38 +4521,42 @@ class NgVirtualListComponent {
4518
4521
  });
4519
4522
  let prepared = false, readyToStart = false, isUserScrolling = false;
4520
4523
  this.$prepared.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(v => {
4521
- const waitForPreparation = this.waitForPreparation();
4522
- if (waitForPreparation) {
4523
- if (!v) {
4524
- prepared = readyToStart = v;
4524
+ if (!v) {
4525
+ this.cacheClean();
4526
+ readyToStart = isUserScrolling = false;
4527
+ prepared = readyToStart = v;
4528
+ const waitForPreparation = this.waitForPreparation();
4529
+ if (waitForPreparation) {
4525
4530
  const scrollerComponent = this._scrollerComponent();
4526
4531
  if (scrollerComponent) {
4527
4532
  scrollerComponent.prepared = v;
4528
4533
  }
4529
4534
  this.classes.set({ prepared: v, [WAIT_FOR_PREPARATION]: waitForPreparation });
4530
- this.cacheClean();
4531
4535
  }
4532
- }
4533
- else {
4534
- prepared = readyToStart = true;
4535
- const scrollerComponent = this._scrollerComponent();
4536
- if (scrollerComponent) {
4537
- scrollerComponent.prepared = true;
4536
+ else {
4537
+ const scrollerComponent = this._scrollerComponent();
4538
+ if (scrollerComponent) {
4539
+ scrollerComponent.prepared = true;
4540
+ }
4541
+ this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
4542
+ this.updateImmediately();
4538
4543
  }
4539
- this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
4540
4544
  }
4541
- }), filter$1(v => !!v), debounceTime(0), takeUntilDestroyed(this._destroyRef), tap(v => {
4545
+ }), filter$1(v => !!v), delay(0), takeUntilDestroyed(this._destroyRef), tap(v => {
4542
4546
  prepared = v;
4547
+ this.updateImmediately();
4543
4548
  }), delay(0), takeUntilDestroyed(this._destroyRef), tap(v => {
4544
4549
  const waitForPreparation = this.waitForPreparation(), scrollerComponent = this._scrollerComponent(), val = v || !waitForPreparation;
4545
4550
  if (scrollerComponent) {
4546
4551
  scrollerComponent.prepared = val;
4547
4552
  }
4548
4553
  this.classes.set({ prepared: val, [WAIT_FOR_PREPARATION]: waitForPreparation });
4554
+ this.updateImmediately();
4549
4555
  }), delay(1000), takeUntilDestroyed(this._destroyRef), tap(v => {
4550
4556
  const waitForPreparation = this.waitForPreparation();
4551
4557
  readyToStart = v;
4552
4558
  this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
4559
+ this.updateImmediately();
4553
4560
  })).subscribe();
4554
4561
  this._service.$focusedId.pipe(takeUntilDestroyed(), tap(v => {
4555
4562
  this.focusedElement.set(v ?? undefined);
@@ -4697,14 +4704,12 @@ class NgVirtualListComponent {
4697
4704
  const { width, height, x, y } = bounds, viewportSize = (isVertical ? height : width);
4698
4705
  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);
4699
4706
  const opts = {
4700
- bounds: { width, height, x, y }, dynamicSize, isVertical, itemSize, reversed: false,
4707
+ bounds: { width, height, x, y }, dynamicSize, isVertical, itemSize,
4701
4708
  bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
4702
4709
  };
4703
- if (snapScrollToBottom && scrollLength > viewportSize && !prepared) {
4704
- const { totalSize: calculatedTotalSize } = this._trackBox.getMetrics(items, itemConfigMap, { ...opts, reversed: true });
4705
- totalSize = calculatedTotalSize;
4710
+ if (snapScrollToBottom && !prepared) {
4706
4711
  actualScrollSize = (totalSize > viewportSize ? totalSize - viewportSize : 0);
4707
- const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts, reversed: true, scrollSize: actualScrollSize });
4712
+ const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts, scrollSize: actualScrollSize });
4708
4713
  displayItems = calculatedDisplayItems;
4709
4714
  totalSize = calculatedTotalSize1;
4710
4715
  scrollLength = Math.round(totalSize) ?? 0;
@@ -4751,10 +4756,10 @@ class NgVirtualListComponent {
4751
4756
  if (roundedMaxPositionAfterUpdate > 0) {
4752
4757
  const diff = roundedMaxPositionAfterUpdate - roundedScrollPositionAfterUpdate, snapToEndTransitionInstantOffset = this.snapToEndTransitionInstantOffset() || viewportSize, animated = prepared && readyToStart && diff >= 0 && diff <= snapToEndTransitionInstantOffset, params = {
4753
4758
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
4759
+ fireUpdate: false,
4754
4760
  behavior: (animated ?
4755
4761
  BEHAVIOR_SMOOTH : BEHAVIOR_INSTANT),
4756
4762
  blending: true,
4757
- fireUpdate: false,
4758
4763
  };
4759
4764
  scroller?.scrollTo?.(params);
4760
4765
  }
@@ -4909,13 +4914,12 @@ class NgVirtualListComponent {
4909
4914
  if (dynamicSize) {
4910
4915
  const { width, height, x, y } = this._bounds() || { x: 0, y: 0, width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, itemConfigMap = this.itemConfigMap(), items = this._actualItems(), isVertical = this._isVertical, currentScollSize = (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft), delta = this._trackBox.delta, opts = {
4911
4916
  bounds: { width, height, x, y }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize,
4912
- bufferSize: this.bufferSize(), maxBufferSize: this.maxBufferSize(), reversed: false,
4917
+ bufferSize: this.bufferSize(), maxBufferSize: this.maxBufferSize(),
4913
4918
  scrollSize: (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft) + delta,
4914
4919
  snap: this.snap(), fromItemId: id, enabledBufferOptimization: this.enabledBufferOptimization(),
4915
4920
  }, scrollSize = this._trackBox.getItemPosition(id, itemConfigMap, opts), params = {
4916
4921
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize, behavior: BEHAVIOR_INSTANT,
4917
- fireUpdate: false,
4918
- blending: true,
4922
+ fireUpdate: false, blending: false,
4919
4923
  };
4920
4924
  if (scrollSize === -1) {
4921
4925
  return of([true, { id, scroller: scrollerComponent, scrollCalled, cb }]);
@@ -4958,7 +4962,7 @@ class NgVirtualListComponent {
4958
4962
  _$scrollToEndDuringUpdateCanceller.next(1);
4959
4963
  const params = {
4960
4964
  [this._isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize,
4961
- behavior: BEHAVIOR_INSTANT, blending: true,
4965
+ behavior: BEHAVIOR_INSTANT, blending: false,
4962
4966
  };
4963
4967
  scrollerComponent?.scrollTo?.(params);
4964
4968
  return of([true, { id, scroller: scrollerComponent, cb }]).pipe(delay(1));
@@ -5198,6 +5202,9 @@ class NgVirtualListComponent {
5198
5202
  this._trackBox.changes();
5199
5203
  }
5200
5204
  }
5205
+ /**
5206
+ * Force clearing the cache.
5207
+ */
5201
5208
  cacheClean() {
5202
5209
  this._trackBox.cacheClean();
5203
5210
  this._collapsedItemIds.set([]);
@@ -5209,7 +5216,11 @@ class NgVirtualListComponent {
5209
5216
  if (scrollerComponent) {
5210
5217
  scrollerComponent.reset();
5211
5218
  }
5219
+ this._$prepared.next(false);
5212
5220
  }
5221
+ /**
5222
+ * Stops the list from snapping to the bottom edge.
5223
+ */
5213
5224
  stopSnappingScrollToEnd() {
5214
5225
  const scroller = this._scrollerComponent();
5215
5226
  this._isScrollFinished.set(false);
@@ -5218,6 +5229,18 @@ class NgVirtualListComponent {
5218
5229
  scroller.stopScrolling();
5219
5230
  }
5220
5231
  }
5232
+ /**
5233
+ * Instantly refreshes the list.
5234
+ */
5235
+ updateImmediately() {
5236
+ this._service.update(true);
5237
+ }
5238
+ /**
5239
+ * Marks the list for an update that will trigger on the next tick.
5240
+ */
5241
+ markForUpdate() {
5242
+ this._service.update();
5243
+ }
5221
5244
  ngOnDestroy() {
5222
5245
  this.dispose();
5223
5246
  }