ng-virtual-list 20.11.6 → 20.11.7
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.
- package/fesm2022/ng-virtual-list.mjs +24 -25
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/index.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1342,7 +1342,7 @@ class TrackBox extends CacheMap {
|
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
1345
|
-
let y = this._scrollStartOffset,
|
|
1345
|
+
let y = this._scrollStartOffset, stickyComponentSize = 0;
|
|
1346
1346
|
for (let i = 0, l = collection.length; i < l; i++) {
|
|
1347
1347
|
const ii = i + 1, collectionItem = collection[i], id = collectionItem[trackBy];
|
|
1348
1348
|
let componentSize = 0, componentSizeDelta = 0, itemDisplayMethod = ItemDisplayMethods.NOT_CHANGED;
|
|
@@ -1359,7 +1359,7 @@ class TrackBox extends CacheMap {
|
|
|
1359
1359
|
componentSizeDelta = componentSnapshotSize;
|
|
1360
1360
|
switch (itemDisplayMethod) {
|
|
1361
1361
|
case ItemDisplayMethods.UPDATE: {
|
|
1362
|
-
map.set(id, { ...cache, method: isNew ? ItemDisplayMethods.UPDATE : ItemDisplayMethods.NOT_CHANGED });
|
|
1362
|
+
map.set(id, { ...cache, method: isNew ? ItemDisplayMethods.UPDATE : ItemDisplayMethods.NOT_CHANGED, [IS_NEW]: isNew });
|
|
1363
1363
|
if (isNew && y <= (scrollSize + size + deltaFromStartCreation + componentSize)) {
|
|
1364
1364
|
deltaFromStartCreation += componentSizeDelta;
|
|
1365
1365
|
componentSizeDelta = 0;
|
|
@@ -1388,7 +1388,6 @@ class TrackBox extends CacheMap {
|
|
|
1388
1388
|
if (itemById === undefined) {
|
|
1389
1389
|
if (id !== fromItemId && id === stickyItemId && itemConfigMap?.[id]?.sticky === 1) {
|
|
1390
1390
|
stickyComponentSize = componentSize;
|
|
1391
|
-
stickyCollectionItem = collectionItem;
|
|
1392
1391
|
y -= stickyComponentSize;
|
|
1393
1392
|
}
|
|
1394
1393
|
if (id === fromItemId) {
|
|
@@ -1532,9 +1531,6 @@ class TrackBox extends CacheMap {
|
|
|
1532
1531
|
refreshCache(cache) {
|
|
1533
1532
|
this._prerenderedCache = cache;
|
|
1534
1533
|
}
|
|
1535
|
-
clearDeltaDirection() {
|
|
1536
|
-
this.clearScrollDirectionCache();
|
|
1537
|
-
}
|
|
1538
1534
|
clearDelta(clearDirectionDetector = false) {
|
|
1539
1535
|
this._delta = this._deltaOfNewItems = 0;
|
|
1540
1536
|
if (clearDirectionDetector) {
|
|
@@ -5742,8 +5738,8 @@ class NgVirtualListComponent {
|
|
|
5742
5738
|
$fireUpdate.pipe(takeUntilDestroyed(), tap(userAction => {
|
|
5743
5739
|
hasUserAction = userAction;
|
|
5744
5740
|
})).subscribe();
|
|
5745
|
-
let renderStabilizerPrevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION, renderStabilizerUpdateIterations = 0;
|
|
5746
5741
|
const $update = this.$update, renderStabilizer = (options) => {
|
|
5742
|
+
let renderStabilizerPrevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION, renderStabilizerUpdateIterations = 0;
|
|
5747
5743
|
const prepareIterations = options?.prepareIterations ?? PREPARE_ITERATIONS, prepareReupdateLength = options?.prepareReupdateLength ?? PREPARATION_REUPDATE_LENGTH;
|
|
5748
5744
|
return of(null).pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(() => {
|
|
5749
5745
|
renderStabilizerPrevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION;
|
|
@@ -6052,15 +6048,19 @@ class NgVirtualListComponent {
|
|
|
6052
6048
|
this._$fireUpdate.next(true);
|
|
6053
6049
|
}));
|
|
6054
6050
|
})).subscribe();
|
|
6051
|
+
let isChunkLoading = false;
|
|
6055
6052
|
const $loading = toObservable(this.loading);
|
|
6056
6053
|
$loading.pipe(takeUntilDestroyed(), distinctUntilChanged(), skip(1), filter$1(v => !v), switchMap$1(() => {
|
|
6054
|
+
isChunkLoading = true;
|
|
6057
6055
|
const scrollbar = this._scrollerComponent();
|
|
6058
6056
|
if (!!scrollbar) {
|
|
6059
6057
|
scrollbar.stopScrollbar();
|
|
6060
6058
|
scrollbar.refreshScrollbar();
|
|
6061
6059
|
}
|
|
6062
|
-
return $actualItems.pipe(takeUntilDestroyed(this._destroyRef), take(1),
|
|
6063
|
-
|
|
6060
|
+
return $actualItems.pipe(takeUntilDestroyed(this._destroyRef), take(1), tap(() => {
|
|
6061
|
+
this._$fireUpdateNextFrame.next(true);
|
|
6062
|
+
}), switchMap$1(() => $chunkLoadingRenderStabilizer.pipe(takeUntilDestroyed(this._destroyRef), take(1), tap(() => {
|
|
6063
|
+
isChunkLoading = false;
|
|
6064
6064
|
this._trackBox.resetCacheChunkInfo();
|
|
6065
6065
|
const scrollbar = this._scrollerComponent();
|
|
6066
6066
|
if (!!scrollbar) {
|
|
@@ -6085,7 +6085,7 @@ class NgVirtualListComponent {
|
|
|
6085
6085
|
const scroller = this._scrollerComponent();
|
|
6086
6086
|
let totalSize = 0;
|
|
6087
6087
|
if (scroller) {
|
|
6088
|
-
const collapsable = collapsedIds.length > 0, cachable = this.cachable, cached = this._cached, waitingCache = cachable && !cached, emitUpdate = !this._readyForShow || waitingCache || collapsable;
|
|
6088
|
+
const collapsable = collapsedIds.length > 0, cachable = this.cachable, cached = this._cached, waitingCache = cachable && !cached, emitUpdate = !this._readyForShow || waitingCache || collapsable || isChunkLoading;
|
|
6089
6089
|
if (this._readyForShow || (cachable && cached)) {
|
|
6090
6090
|
const currentScrollSize = (isVertical ? scroller.scrollTop ?? 0 : scroller.scrollLeft ?? 0), fireUpdate = emitUpdate || reupdate || (!optimization && !userAction) || this._$scrollingTo.getValue();
|
|
6091
6091
|
let actualScrollSize = !this._readyForShow && snapScrollToEnd ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
|
|
@@ -6159,23 +6159,22 @@ class NgVirtualListComponent {
|
|
|
6159
6159
|
this._trackBox.isScrollEnd;
|
|
6160
6160
|
return;
|
|
6161
6161
|
}
|
|
6162
|
-
if (scrollPositionAfterUpdate >= 0 && scrollPositionAfterUpdate < roundedMaxPositionAfterUpdate)
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
}
|
|
6162
|
+
if ((scrollPositionAfterUpdate >= 0 && scrollPositionAfterUpdate < roundedMaxPositionAfterUpdate) ||
|
|
6163
|
+
(scrollSize !== roundedMaxPositionAfterUpdate || currentScrollSize !== scrollPositionAfterUpdate)) {
|
|
6164
|
+
this._trackBox.clearDelta();
|
|
6165
|
+
if (this._readyForShow) {
|
|
6166
|
+
this.emitScrollEvent(true, false, userAction);
|
|
6167
|
+
}
|
|
6168
|
+
const params = {
|
|
6169
|
+
[isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true, userAction,
|
|
6170
|
+
fireUpdate, behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
|
|
6171
|
+
};
|
|
6172
|
+
scroller.scrollTo(params);
|
|
6173
|
+
if (emitUpdate) {
|
|
6174
|
+
this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
|
|
6176
6175
|
}
|
|
6177
|
-
return;
|
|
6178
6176
|
}
|
|
6177
|
+
return;
|
|
6179
6178
|
}
|
|
6180
6179
|
if (emitUpdate) {
|
|
6181
6180
|
this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
|