ng-virtual-list 16.0.11 → 16.0.13
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/esm2022/lib/const/index.mjs +1 -2
- package/esm2022/lib/models/scroll-direction.model.mjs +1 -1
- package/esm2022/lib/ng-virtual-list.component.mjs +43 -39
- package/esm2022/lib/utils/cacheMap.mjs +11 -18
- package/esm2022/lib/utils/collection.mjs +14 -9
- package/esm2022/lib/utils/trackBox.mjs +76 -95
- package/fesm2022/ng-virtual-list.mjs +138 -156
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/const/index.d.ts +0 -1
- package/lib/models/scroll-direction.model.d.ts +1 -1
- package/lib/ng-virtual-list.component.d.ts +4 -8
- package/lib/utils/cacheMap.d.ts +2 -3
- package/lib/utils/collection.d.ts +2 -1
- package/lib/utils/trackBox.d.ts +14 -13
- package/package.json +1 -1
package/lib/const/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare const DEFAULT_ITEMS_OFFSET = 2;
|
|
|
4
4
|
export declare const DEFAULT_LIST_SIZE = 400;
|
|
5
5
|
export declare const DEFAULT_SNAP = false;
|
|
6
6
|
export declare const DEFAULT_ENABLED_BUFFER_OPTIMIZATION = true;
|
|
7
|
-
export declare const DEFAULT_OPTIMIZE_FOR_END = false;
|
|
8
7
|
export declare const DEFAULT_SNAP_TO_ITEM = false;
|
|
9
8
|
export declare const DEFAULT_DYNAMIC_SIZE = false;
|
|
10
9
|
export declare const TRACK_BY_PROPERTY_NAME = "id";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* A value of -1 indicates the direction is up or left (if the list direction is horizontal).
|
|
3
3
|
* A value of 1 indicates the direction is down or right (if the list direction is horizontal).
|
|
4
4
|
*/
|
|
5
|
-
export type ScrollDirection = -1 | 1;
|
|
5
|
+
export type ScrollDirection = -1 | 1 | 0;
|
|
@@ -64,13 +64,6 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnDestroy
|
|
|
64
64
|
*/
|
|
65
65
|
set enabledBufferOptimization(v: boolean);
|
|
66
66
|
get enabledBufferOptimization(): boolean;
|
|
67
|
-
private _$likeAChat;
|
|
68
|
-
readonly $likeAChat: Observable<boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* If true, optimization for lists that start from the end is enabled (chat mode enabled).
|
|
71
|
-
*/
|
|
72
|
-
set likeAChat(v: boolean);
|
|
73
|
-
get likeAChat(): boolean;
|
|
74
67
|
private _$itemRenderer;
|
|
75
68
|
readonly $itemRenderer: Observable<TemplateRef<any> | undefined>;
|
|
76
69
|
/**
|
|
@@ -121,6 +114,9 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnDestroy
|
|
|
121
114
|
protected _displayComponents: Array<ComponentRef<NgVirtualListItemComponent>>;
|
|
122
115
|
protected _$bounds: BehaviorSubject<DOMRect | null>;
|
|
123
116
|
protected _$scrollSize: BehaviorSubject<number>;
|
|
117
|
+
private _isScrollingDebounces;
|
|
118
|
+
private _isScrolling;
|
|
119
|
+
get isScrolling(): boolean;
|
|
124
120
|
private _resizeObserver;
|
|
125
121
|
private _onResizeHandler;
|
|
126
122
|
private _onScrollHandler;
|
|
@@ -166,5 +162,5 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnDestroy
|
|
|
166
162
|
ngAfterViewInit(): void;
|
|
167
163
|
ngOnDestroy(): void;
|
|
168
164
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListComponent, never>;
|
|
169
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": { "alias": "items"; "required": false; }; "snap": { "alias": "snap"; "required": false; }; "snapToItem": { "alias": "snapToItem"; "required": false; }; "enabledBufferOptimization": { "alias": "enabledBufferOptimization"; "required": false; }; "
|
|
165
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": { "alias": "items"; "required": false; }; "snap": { "alias": "snap"; "required": false; }; "snapToItem": { "alias": "snapToItem"; "required": false; }; "enabledBufferOptimization": { "alias": "enabledBufferOptimization"; "required": false; }; "itemRenderer": { "alias": "itemRenderer"; "required": false; }; "stickyMap": { "alias": "stickyMap"; "required": false; }; "itemSize": { "alias": "itemSize"; "required": false; }; "dynamicSize": { "alias": "dynamicSize"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "itemsOffset": { "alias": "itemsOffset"; "required": false; }; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; }, never, never, false, never>;
|
|
170
166
|
}
|
package/lib/utils/cacheMap.d.ts
CHANGED
|
@@ -18,15 +18,13 @@ type CacheMapListeners = OnChangeEventListener;
|
|
|
18
18
|
*/
|
|
19
19
|
export declare class CacheMap<I = string | number, B = any, E extends string = CacheMapEvents, L extends TEventHandler = CacheMapListeners> extends EventEmitter<E, L> implements ICacheMap {
|
|
20
20
|
protected _map: Map<I, B>;
|
|
21
|
+
protected _snapshot: Map<I, B>;
|
|
21
22
|
protected _version: number;
|
|
22
|
-
protected _previouseFullSize: number;
|
|
23
23
|
protected _delta: number;
|
|
24
24
|
get delta(): number;
|
|
25
25
|
protected _deltaDirection: ScrollDirection;
|
|
26
26
|
set deltaDirection(v: ScrollDirection);
|
|
27
27
|
get deltaDirection(): ScrollDirection;
|
|
28
|
-
protected _likeAChat: boolean;
|
|
29
|
-
set likeAChat(v: boolean);
|
|
30
28
|
private _scrollDirectionCache;
|
|
31
29
|
private _scrollDirection;
|
|
32
30
|
get scrollDirection(): ScrollDirection;
|
|
@@ -41,6 +39,7 @@ export declare class CacheMap<I = string | number, B = any, E extends string = C
|
|
|
41
39
|
has(id: I): boolean;
|
|
42
40
|
get(id: I): B | undefined;
|
|
43
41
|
forEach(callbackfn: (value: B, key: I, map: Map<I, B>) => void, thisArg?: any): void;
|
|
42
|
+
snapshot(): void;
|
|
44
43
|
dispose(): void;
|
|
45
44
|
}
|
|
46
45
|
export {};
|
package/lib/utils/trackBox.d.ts
CHANGED
|
@@ -30,7 +30,8 @@ export interface IMetrics {
|
|
|
30
30
|
rightItemLength: number;
|
|
31
31
|
rightItemsWeight: number;
|
|
32
32
|
scrollSize: number;
|
|
33
|
-
|
|
33
|
+
leftSizeOfAddedItems: number;
|
|
34
|
+
rightSizeOfAddedItems: number;
|
|
34
35
|
sizeProperty: typeof HEIGHT_PROP_NAME | typeof WIDTH_PROP_NAME;
|
|
35
36
|
snap: boolean;
|
|
36
37
|
snippedPos: number;
|
|
@@ -52,29 +53,35 @@ export interface IRecalculateMetricsOptions<I extends {
|
|
|
52
53
|
dynamicSize: boolean;
|
|
53
54
|
scrollSize: number;
|
|
54
55
|
snap: boolean;
|
|
56
|
+
enabledBufferOptimization: boolean;
|
|
55
57
|
fromItemId?: Id;
|
|
56
58
|
}
|
|
57
59
|
type CacheMapEvents = typeof TRACK_BOX_CHANGE_EVENT_NAME;
|
|
58
60
|
type OnChangeEventListener = (version: number) => void;
|
|
59
61
|
type CacheMapListeners = OnChangeEventListener;
|
|
62
|
+
declare enum ItemDisplayMethods {
|
|
63
|
+
CREATE = 0,
|
|
64
|
+
UPDATE = 1,
|
|
65
|
+
DELETE = 2,
|
|
66
|
+
NOT_CHANGED = 3
|
|
67
|
+
}
|
|
60
68
|
/**
|
|
61
69
|
* An object that performs tracking, calculations and caching.
|
|
62
70
|
* @link https://github.com/DjonnyX/ng-virtual-list/blob/16.x/projects/ng-virtual-list/src/lib/utils/trackBox.ts
|
|
63
71
|
* @author Evgenii Grebennikov
|
|
64
72
|
* @email djonnyx@gmail.com
|
|
65
73
|
*/
|
|
66
|
-
export declare class TrackBox extends CacheMap<Id, IRect
|
|
74
|
+
export declare class TrackBox extends CacheMap<Id, IRect & {
|
|
75
|
+
method?: ItemDisplayMethods;
|
|
76
|
+
}, CacheMapEvents, CacheMapListeners> {
|
|
67
77
|
protected _tracker: Tracker<IRenderVirtualListItem, NgVirtualListItemComponent>;
|
|
68
78
|
protected _items: IRenderVirtualListCollection | null | undefined;
|
|
69
79
|
set items(v: IRenderVirtualListCollection | null | undefined);
|
|
70
80
|
protected _displayComponents: Array<ComponentRef<NgVirtualListItemComponent>> | null | undefined;
|
|
71
81
|
set displayComponents(v: Array<ComponentRef<NgVirtualListItemComponent>> | null | undefined);
|
|
72
|
-
enabledBufferOptimization: boolean;
|
|
73
82
|
constructor(trackingPropertyName: string);
|
|
74
83
|
set(id: Id, bounds: IRect): Map<Id, IRect>;
|
|
75
84
|
private _fireChanges;
|
|
76
|
-
private _isExistAddedItems;
|
|
77
|
-
private _addedItemsMap;
|
|
78
85
|
private _previousCollection;
|
|
79
86
|
private _debounceChanges;
|
|
80
87
|
protected fireChange(): void;
|
|
@@ -83,14 +90,13 @@ export declare class TrackBox extends CacheMap<Id, IRect, CacheMapEvents, CacheM
|
|
|
83
90
|
*/
|
|
84
91
|
resetCollection<I extends {
|
|
85
92
|
id: Id;
|
|
86
|
-
}, C extends Array<I>>(currentCollection: C | null | undefined): void;
|
|
87
|
-
private startScrollDeltaCalculationIfNeed;
|
|
93
|
+
}, C extends Array<I>>(currentCollection: C | null | undefined, itemSize: number): void;
|
|
88
94
|
/**
|
|
89
95
|
* Clears the cache of items from the list
|
|
90
96
|
*/
|
|
91
97
|
protected clearCache<I extends {
|
|
92
98
|
id: Id;
|
|
93
|
-
}, C extends Array<I>>(
|
|
99
|
+
}, C extends Array<I>>(deleted: C | null | undefined, updated: C | null | undefined, added: C | null | undefined, itemSize: number): void;
|
|
94
100
|
/**
|
|
95
101
|
* Finds the position of a collection element by the given Id
|
|
96
102
|
*/
|
|
@@ -131,7 +137,6 @@ export declare class TrackBox extends CacheMap<Id, IRect, CacheMapEvents, CacheM
|
|
|
131
137
|
get scrollDelta(): number;
|
|
132
138
|
clearDeltaDirection(): void;
|
|
133
139
|
clearDelta(clearDirectionDetector?: boolean): void;
|
|
134
|
-
protected stopScrollDeltaCalculation(): void;
|
|
135
140
|
protected generateDisplayCollection<I extends {
|
|
136
141
|
id: Id;
|
|
137
142
|
}, C extends Array<I>>(items: C, stickyMap: IVirtualListStickyMap, metrics: IMetrics): IRenderVirtualListCollection;
|
|
@@ -145,10 +150,6 @@ export declare class TrackBox extends CacheMap<Id, IRect, CacheMapEvents, CacheM
|
|
|
145
150
|
untrackComponentByIdProperty(component?: NgVirtualListItemComponent | undefined): void;
|
|
146
151
|
getItemBounds(id: Id): IRect | undefined;
|
|
147
152
|
protected cacheElements(): void;
|
|
148
|
-
/**
|
|
149
|
-
* Returns calculated bounds from cache
|
|
150
|
-
*/
|
|
151
|
-
private getBoundsFromCache;
|
|
152
153
|
dispose(): void;
|
|
153
154
|
}
|
|
154
155
|
export {};
|