ng-virtual-list 16.0.3 → 16.0.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.
- package/README.md +2 -2
- package/esm2022/lib/const/index.mjs +2 -1
- package/esm2022/lib/models/index.mjs +1 -1
- package/esm2022/lib/models/scroll-direction.model.mjs +2 -0
- package/esm2022/lib/models/scroll-event.model.mjs +2 -0
- package/esm2022/lib/ng-virtual-list.component.mjs +44 -47
- package/esm2022/lib/utils/cacheMap.mjs +42 -1
- package/esm2022/lib/utils/trackBox.mjs +49 -19
- package/fesm2022/ng-virtual-list.mjs +131 -63
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/const/index.d.ts +1 -0
- package/lib/models/index.d.ts +3 -1
- package/lib/models/scroll-direction.model.d.ts +5 -0
- package/lib/models/scroll-event.model.d.ts +18 -0
- package/lib/ng-virtual-list.component.d.ts +6 -9
- package/lib/utils/cacheMap.d.ts +10 -0
- package/lib/utils/trackBox.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AfterViewInit, ChangeDetectorRef, ComponentRef, ElementRef, EventEmitter, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
3
|
import { NgVirtualListItemComponent } from './components/ng-virtual-list-item.component';
|
|
4
|
-
import { IVirtualListCollection, IVirtualListStickyMap } from './models';
|
|
4
|
+
import { IScrollEvent, IVirtualListCollection, IVirtualListStickyMap } from './models';
|
|
5
5
|
import { Id } from './types';
|
|
6
6
|
import { Direction } from './enums';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
@@ -28,11 +28,11 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnDestroy
|
|
|
28
28
|
/**
|
|
29
29
|
* Fires when the list has been scrolled.
|
|
30
30
|
*/
|
|
31
|
-
onScroll: EventEmitter<
|
|
31
|
+
onScroll: EventEmitter<IScrollEvent>;
|
|
32
32
|
/**
|
|
33
33
|
* Fires when the list has completed scrolling.
|
|
34
34
|
*/
|
|
35
|
-
onScrollEnd: EventEmitter<
|
|
35
|
+
onScrollEnd: EventEmitter<IScrollEvent>;
|
|
36
36
|
private _$items;
|
|
37
37
|
readonly $items: Observable<IVirtualListCollection | undefined>;
|
|
38
38
|
/**
|
|
@@ -100,18 +100,12 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnDestroy
|
|
|
100
100
|
*/
|
|
101
101
|
set itemsOffset(v: number);
|
|
102
102
|
get itemsOffset(): number;
|
|
103
|
-
private _scrollToTimeout;
|
|
104
103
|
private _isVertical;
|
|
105
104
|
protected _displayComponents: Array<ComponentRef<NgVirtualListItemComponent>>;
|
|
106
105
|
protected _$bounds: BehaviorSubject<DOMRect | null>;
|
|
107
106
|
protected _$scrollSize: BehaviorSubject<number>;
|
|
108
107
|
private _resizeObserver;
|
|
109
|
-
/**
|
|
110
|
-
* only dynamic
|
|
111
|
-
*/
|
|
112
|
-
private _$scrolledItemId;
|
|
113
108
|
private _onResizeHandler;
|
|
114
|
-
private _scrollDirection;
|
|
115
109
|
private _onScrollHandler;
|
|
116
110
|
private scrollImmediately;
|
|
117
111
|
private _scrollImmediatelyHandler;
|
|
@@ -142,6 +136,9 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnDestroy
|
|
|
142
136
|
* Behavior accepts the values "auto", "instant" and "smooth".
|
|
143
137
|
*/
|
|
144
138
|
scrollTo(id: Id, behavior?: ScrollBehavior): void;
|
|
139
|
+
private _scrollToRepeatExecutionTimeout;
|
|
140
|
+
private clearScrollToRepeatExecutionTimeout;
|
|
141
|
+
protected scrollToExecutor(id: Id, behavior: ScrollBehavior, iteration?: number): void;
|
|
145
142
|
scrollToEnd(behavior?: ScrollBehavior): void;
|
|
146
143
|
ngAfterViewInit(): void;
|
|
147
144
|
ngOnDestroy(): void;
|
package/lib/utils/cacheMap.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScrollDirection } from "../models";
|
|
1
2
|
import { EventEmitter } from "./eventEmitter";
|
|
2
3
|
export interface ICacheMap<I = any, B = any> {
|
|
3
4
|
set: (id: I, bounds: B) => Map<I, B>;
|
|
@@ -21,8 +22,17 @@ export declare class CacheMap<I = string | number, B = any, E = CacheMapEvents,
|
|
|
21
22
|
protected _previouseFullHeigh: number;
|
|
22
23
|
protected _delta: number;
|
|
23
24
|
get delta(): number;
|
|
25
|
+
protected _deltaDirection: ScrollDirection;
|
|
26
|
+
set deltaDirection(v: ScrollDirection);
|
|
27
|
+
get deltaDirection(): ScrollDirection;
|
|
28
|
+
private _scrollDirectionCache;
|
|
29
|
+
private _scrollDirection;
|
|
30
|
+
get scrollDirection(): ScrollDirection;
|
|
24
31
|
get version(): number;
|
|
32
|
+
private _clearScrollDirectionDebounce;
|
|
25
33
|
constructor();
|
|
34
|
+
clearScrollDirectionCache(): void;
|
|
35
|
+
private calcScrollDirection;
|
|
26
36
|
protected bumpVersion(): void;
|
|
27
37
|
protected fireChange(): void;
|
|
28
38
|
set(id: I, bounds: B): Map<I, B>;
|
package/lib/utils/trackBox.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export interface IMetrics {
|
|
|
40
40
|
totalSize: number;
|
|
41
41
|
typicalItemSize: number;
|
|
42
42
|
}
|
|
43
|
-
export type ScrollDirection = -1 | 0 | 1;
|
|
44
43
|
export interface IRecalculateMetricsOptions<I extends {
|
|
45
44
|
id: Id;
|
|
46
45
|
}, C extends Array<I>> {
|
|
@@ -53,7 +52,6 @@ export interface IRecalculateMetricsOptions<I extends {
|
|
|
53
52
|
scrollSize: number;
|
|
54
53
|
snap: boolean;
|
|
55
54
|
fromItemId?: Id;
|
|
56
|
-
scrollDirection?: ScrollDirection;
|
|
57
55
|
}
|
|
58
56
|
type CacheMapEvents = typeof TRACK_BOX_CHANGE_EVENT_NAME;
|
|
59
57
|
type OnChangeEventListener = (version: number) => void;
|
|
@@ -85,13 +83,15 @@ export declare class TrackBox extends CacheMap<Id, IRect, CacheMapEvents, CacheM
|
|
|
85
83
|
totalSize: number;
|
|
86
84
|
delta: number;
|
|
87
85
|
};
|
|
86
|
+
private getElementNumToEnd;
|
|
88
87
|
/**
|
|
89
88
|
* Calculates list metrics
|
|
90
89
|
*/
|
|
91
90
|
protected recalculateMetrics<I extends {
|
|
92
91
|
id: Id;
|
|
93
92
|
}, C extends Array<I>>(options: IRecalculateMetricsOptions<I, C>): IMetrics;
|
|
94
|
-
|
|
93
|
+
clearDeltaDirection(): void;
|
|
94
|
+
clearDelta(clearDirectionDetector?: boolean): void;
|
|
95
95
|
protected generateDisplayCollection<I extends {
|
|
96
96
|
id: Id;
|
|
97
97
|
}, C extends Array<I>>(items: C, stickyMap: IVirtualListStickyMap, metrics: IMetrics): IRenderVirtualListCollection;
|