ng-virtual-list 21.10.9 → 21.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.
|
@@ -1714,6 +1714,7 @@ const bufferInterpolation = (currentBufferValue, array, value, extra) => {
|
|
|
1714
1714
|
var TrackBoxEvents;
|
|
1715
1715
|
(function (TrackBoxEvents) {
|
|
1716
1716
|
TrackBoxEvents["CHANGE"] = "change";
|
|
1717
|
+
TrackBoxEvents["TICK"] = "tick";
|
|
1717
1718
|
})(TrackBoxEvents || (TrackBoxEvents = {}));
|
|
1718
1719
|
var ItemDisplayMethods;
|
|
1719
1720
|
(function (ItemDisplayMethods) {
|
|
@@ -1725,7 +1726,7 @@ var ItemDisplayMethods;
|
|
|
1725
1726
|
const DEFAULT_BUFFER_EXTREMUM_THRESHOLD = 15, DEFAULT_MAX_BUFFER_SEQUENCE_LENGTH = 30, DEFAULT_RESET_BUFFER_SIZE_TIMEOUT = 10000, IS_NEW = 'n';
|
|
1726
1727
|
/**
|
|
1727
1728
|
* An object that performs tracking, calculations and caching.
|
|
1728
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
1729
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/20.x/projects/ng-virtual-list/src/lib/core/track-box.ts
|
|
1729
1730
|
* @author Evgenii Alexandrovich Grebennikov
|
|
1730
1731
|
* @email djonnyx@gmail.com
|
|
1731
1732
|
*/
|
|
@@ -1837,6 +1838,9 @@ class TrackBox extends CacheMap {
|
|
|
1837
1838
|
this.dispatch(TrackBoxEvents.CHANGE, this._version);
|
|
1838
1839
|
}
|
|
1839
1840
|
}
|
|
1841
|
+
fireTick() {
|
|
1842
|
+
this.dispatch(TrackBoxEvents.TICK);
|
|
1843
|
+
}
|
|
1840
1844
|
_previousTotalSize = 0;
|
|
1841
1845
|
_deltaOfNewItems = 0;
|
|
1842
1846
|
get deltaOfNewItems() { return this._deltaOfNewItems; }
|
|
@@ -1854,6 +1858,7 @@ class TrackBox extends CacheMap {
|
|
|
1854
1858
|
_prerenderedCache = null;
|
|
1855
1859
|
lifeCircle() {
|
|
1856
1860
|
this.fireChangeIfNeed();
|
|
1861
|
+
this.fireTick();
|
|
1857
1862
|
this.lifeCircleDo();
|
|
1858
1863
|
}
|
|
1859
1864
|
/**
|
|
@@ -5511,8 +5516,6 @@ class NgVirtualListComponent {
|
|
|
5511
5516
|
_scrollSize = signal(0, ...(ngDevMode ? [{ debugName: "_scrollSize" }] : []));
|
|
5512
5517
|
_isScrollStart = signal(true, ...(ngDevMode ? [{ debugName: "_isScrollStart" }] : []));
|
|
5513
5518
|
_isScrollEnd = signal(false, ...(ngDevMode ? [{ debugName: "_isScrollEnd" }] : []));
|
|
5514
|
-
_resizeObserver = null;
|
|
5515
|
-
_listResizeObserver = null;
|
|
5516
5519
|
_resizeSnappedComponentHandler = () => {
|
|
5517
5520
|
const list = this._list(), scroller = this._scroller(), bounds = this._bounds(), snappedComponents = this._snappedDisplayComponents;
|
|
5518
5521
|
if (list && scroller && snappedComponents.length > 0) {
|
|
@@ -5558,8 +5561,11 @@ class NgVirtualListComponent {
|
|
|
5558
5561
|
this._trackBox.changes();
|
|
5559
5562
|
});
|
|
5560
5563
|
_onResizeHandler = () => {
|
|
5561
|
-
const bounds = this._scroller()?.nativeElement?.getBoundingClientRect();
|
|
5562
|
-
if (bounds) {
|
|
5564
|
+
const bounds = this._scroller()?.nativeElement?.getBoundingClientRect(), last = this._bounds();
|
|
5565
|
+
if (bounds?.width === last?.width && bounds?.height === last?.height) {
|
|
5566
|
+
return;
|
|
5567
|
+
}
|
|
5568
|
+
if (!!bounds) {
|
|
5563
5569
|
this._bounds.set({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height });
|
|
5564
5570
|
}
|
|
5565
5571
|
else {
|
|
@@ -5575,8 +5581,11 @@ class NgVirtualListComponent {
|
|
|
5575
5581
|
}
|
|
5576
5582
|
};
|
|
5577
5583
|
_onListResizeHandler = () => {
|
|
5578
|
-
const bounds = this._list()?.nativeElement?.getBoundingClientRect();
|
|
5579
|
-
if (bounds) {
|
|
5584
|
+
const bounds = this._list()?.nativeElement?.getBoundingClientRect(), last = this._listBounds();
|
|
5585
|
+
if (bounds?.width === last?.width && bounds?.height === last?.height) {
|
|
5586
|
+
return;
|
|
5587
|
+
}
|
|
5588
|
+
if (!!bounds) {
|
|
5580
5589
|
this._listBounds.set({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height });
|
|
5581
5590
|
}
|
|
5582
5591
|
else {
|
|
@@ -5654,6 +5663,10 @@ class NgVirtualListComponent {
|
|
|
5654
5663
|
_onTrackBoxChangeHandler = (v) => {
|
|
5655
5664
|
this._cacheVersion.set(v);
|
|
5656
5665
|
};
|
|
5666
|
+
_onTickHandler = () => {
|
|
5667
|
+
this._onListResizeHandler();
|
|
5668
|
+
this._onResizeHandler();
|
|
5669
|
+
};
|
|
5657
5670
|
_cacheVersion = signal(-1, ...(ngDevMode ? [{ debugName: "_cacheVersion" }] : []));
|
|
5658
5671
|
_$update = new Subject();
|
|
5659
5672
|
$update = this._$update.asObservable();
|
|
@@ -5664,6 +5677,8 @@ class NgVirtualListComponent {
|
|
|
5664
5677
|
_$scrollingTo = new BehaviorSubject$1(false);
|
|
5665
5678
|
_$scroll = new Subject();
|
|
5666
5679
|
$scroll = this._$scroll.asObservable();
|
|
5680
|
+
_$tick = new Subject();
|
|
5681
|
+
$tick = this._$tick.asObservable();
|
|
5667
5682
|
_$fireUpdate = new Subject();
|
|
5668
5683
|
$fireUpdate = this._$fireUpdate.asObservable();
|
|
5669
5684
|
_$fireUpdateNextFrame = new Subject();
|
|
@@ -5701,6 +5716,7 @@ class NgVirtualListComponent {
|
|
|
5701
5716
|
this._id = NgVirtualListComponent.__nextId;
|
|
5702
5717
|
this._service.initialize(this._id, this._trackBox);
|
|
5703
5718
|
this._service.animationParams = this.animationParams();
|
|
5719
|
+
this._trackBox.addEventListener(TrackBoxEvents.TICK, this._onTickHandler);
|
|
5704
5720
|
this._trackBox.displayComponents = this._displayComponents;
|
|
5705
5721
|
let hasUserAction = false, hasScrollbarUserAction = false;
|
|
5706
5722
|
this._scroller = computed(() => {
|
|
@@ -6345,22 +6361,6 @@ class NgVirtualListComponent {
|
|
|
6345
6361
|
}
|
|
6346
6362
|
scrollHandler(userAction);
|
|
6347
6363
|
})).subscribe();
|
|
6348
|
-
$scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(scroller => {
|
|
6349
|
-
if (!!this._resizeObserver) {
|
|
6350
|
-
this._resizeObserver.disconnect();
|
|
6351
|
-
}
|
|
6352
|
-
this._resizeObserver = new ResizeObserver(this._onResizeHandler);
|
|
6353
|
-
this._resizeObserver.observe(scroller);
|
|
6354
|
-
this._onResizeHandler();
|
|
6355
|
-
})).subscribe();
|
|
6356
|
-
$list.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(list => {
|
|
6357
|
-
if (!!this._listResizeObserver) {
|
|
6358
|
-
this._listResizeObserver.disconnect();
|
|
6359
|
-
}
|
|
6360
|
-
this._listResizeObserver = new ResizeObserver(this._onListResizeHandler);
|
|
6361
|
-
this._listResizeObserver.observe(list);
|
|
6362
|
-
this._onResizeHandler();
|
|
6363
|
-
})).subscribe();
|
|
6364
6364
|
const $scrollTo = this.$scrollTo, $scrollToExecutor = this.$scrollToExecutor;
|
|
6365
6365
|
combineLatest([$scroller, $trackBy, $scrollTo]).pipe(filter$1(([scroller]) => scroller !== undefined), map(([scroller, trackBy, event]) => ({ scroller: scroller, trackBy, event })), tap(({ event }) => {
|
|
6366
6366
|
this._$scrollingTo.next(true);
|
|
@@ -6821,12 +6821,6 @@ class NgVirtualListComponent {
|
|
|
6821
6821
|
if (!!this._resizeSnappedObserver) {
|
|
6822
6822
|
this._resizeSnappedObserver.disconnect();
|
|
6823
6823
|
}
|
|
6824
|
-
if (!!this._resizeObserver) {
|
|
6825
|
-
this._resizeObserver.disconnect();
|
|
6826
|
-
}
|
|
6827
|
-
if (!!this._listResizeObserver) {
|
|
6828
|
-
this._listResizeObserver.disconnect();
|
|
6829
|
-
}
|
|
6830
6824
|
if (!!this._snappedDisplayComponents) {
|
|
6831
6825
|
while (this._snappedDisplayComponents.length > 0) {
|
|
6832
6826
|
const comp = this._displayComponents.shift();
|