ng-virtual-list 0.7.2 → 14.0.0
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 +44 -71
- package/esm2020/lib/components/ng-virtual-list-item.component.mjs +80 -0
- package/esm2020/lib/const/index.mjs +34 -0
- package/esm2020/lib/enums/direction.mjs +2 -0
- package/esm2020/lib/enums/directions.mjs +18 -0
- package/esm2020/lib/enums/index.mjs +3 -0
- package/esm2020/lib/models/collection.model.mjs +3 -0
- package/esm2020/lib/models/index.mjs +2 -0
- package/esm2020/lib/models/item.model.mjs +3 -0
- package/esm2020/lib/models/render-collection.model.mjs +3 -0
- package/esm2020/lib/models/render-item-config.model.mjs +2 -0
- package/esm2020/lib/models/render-item.model.mjs +3 -0
- package/esm2020/lib/models/sticky-map.model.mjs +2 -0
- package/esm2020/lib/ng-virtual-list.component.mjs +510 -0
- package/esm2020/lib/ng-virtual-list.module.mjs +20 -0
- package/esm2020/lib/types/id.mjs +2 -0
- package/esm2020/lib/types/index.mjs +2 -0
- package/esm2020/lib/types/rect.mjs +2 -0
- package/esm2020/lib/types/size.mjs +2 -0
- package/esm2020/lib/utils/cacheMap.mjs +52 -0
- package/esm2020/lib/utils/debounce.mjs +31 -0
- package/esm2020/lib/utils/disposableComponent.mjs +29 -0
- package/esm2020/lib/utils/eventEmitter.mjs +106 -0
- package/esm2020/lib/utils/index.mjs +8 -0
- package/esm2020/lib/utils/isDirection.mjs +15 -0
- package/esm2020/lib/utils/toggleClassName.mjs +15 -0
- package/esm2020/lib/utils/trackBox.mjs +352 -0
- package/esm2020/lib/utils/tracker.mjs +108 -0
- package/esm2020/ng-virtual-list.mjs +5 -0
- package/esm2020/public-api.mjs +8 -0
- package/fesm2015/ng-virtual-list.mjs +1360 -0
- package/fesm2015/ng-virtual-list.mjs.map +1 -0
- package/fesm2020/ng-virtual-list.mjs +1359 -0
- package/fesm2020/ng-virtual-list.mjs.map +1 -0
- package/index.d.ts +5 -5
- package/lib/components/ng-virtual-list-item.component.d.ts +28 -35
- package/lib/const/index.d.ts +32 -31
- package/lib/enums/direction.d.ts +8 -2
- package/lib/enums/directions.d.ts +16 -4
- package/lib/enums/index.d.ts +4 -4
- package/lib/models/collection.model.d.ts +9 -3
- package/lib/models/index.d.ts +4 -4
- package/lib/models/item.model.d.ts +14 -5
- package/lib/models/render-collection.model.d.ts +9 -3
- package/lib/models/render-item-config.model.d.ts +33 -7
- package/lib/models/render-item.model.d.ts +28 -10
- package/lib/models/sticky-map.model.d.ts +12 -6
- package/lib/ng-virtual-list.component.d.ts +151 -110
- package/lib/ng-virtual-list.module.d.ts +9 -0
- package/lib/types/id.d.ts +7 -1
- package/lib/types/index.d.ts +4 -4
- package/lib/types/rect.d.ts +17 -5
- package/lib/types/size.d.ts +16 -4
- package/lib/utils/cacheMap.d.ts +34 -31
- package/lib/utils/debounce.d.ts +16 -10
- package/lib/utils/disposableComponent.d.ts +15 -0
- package/lib/utils/eventEmitter.d.ts +40 -37
- package/lib/utils/index.d.ts +7 -6
- package/lib/utils/isDirection.d.ts +8 -2
- package/lib/utils/toggleClassName.d.ts +7 -1
- package/lib/utils/trackBox.d.ts +113 -73
- package/lib/utils/tracker.d.ts +38 -38
- package/package.json +18 -6
- package/public-api.d.ts +4 -3
- package/fesm2022/ng-virtual-list.mjs +0 -942
- package/fesm2022/ng-virtual-list.mjs.map +0 -1
package/lib/utils/trackBox.d.ts
CHANGED
|
@@ -1,73 +1,113 @@
|
|
|
1
|
-
import { ComponentRef } from "@angular/core";
|
|
2
|
-
import { NgVirtualListItemComponent } from "../components/ng-virtual-list-item.component";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
import { ComponentRef } from "@angular/core";
|
|
2
|
+
import { NgVirtualListItemComponent } from "../components/ng-virtual-list-item.component";
|
|
3
|
+
import { IRenderVirtualListCollection } from "../models/render-collection.model";
|
|
4
|
+
import { IRenderVirtualListItem } from "../models/render-item.model";
|
|
5
|
+
import { Id } from "../types/id";
|
|
6
|
+
import { IRect } from "../types/rect";
|
|
7
|
+
import { CacheMap } from "./cacheMap";
|
|
8
|
+
import { Tracker } from "./tracker";
|
|
9
|
+
import { ISize } from "../types";
|
|
10
|
+
import { HEIGHT_PROP_NAME, WIDTH_PROP_NAME } from "../const";
|
|
11
|
+
import { IVirtualListStickyMap } from "../models";
|
|
12
|
+
export declare const TRACK_BOX_CHANGE_EVENT_NAME = "change";
|
|
13
|
+
export interface IMetrics {
|
|
14
|
+
delta: number;
|
|
15
|
+
normalizedItemWidth: number;
|
|
16
|
+
normalizedItemHeight: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
dynamicSize: boolean;
|
|
20
|
+
itemSize: number;
|
|
21
|
+
itemsFromStartToScrollEnd: number;
|
|
22
|
+
itemsFromStartToDisplayEnd: number;
|
|
23
|
+
itemsOnDisplay: number;
|
|
24
|
+
itemsOnDisplayLength: number;
|
|
25
|
+
isVertical: boolean;
|
|
26
|
+
leftHiddenItemsWeight: number;
|
|
27
|
+
leftItemLength: number;
|
|
28
|
+
leftItemsWeight: number;
|
|
29
|
+
renderItems: number;
|
|
30
|
+
rightItemLength: number;
|
|
31
|
+
rightItemsWeight: number;
|
|
32
|
+
scrollSize: number;
|
|
33
|
+
sizeProperty: typeof HEIGHT_PROP_NAME | typeof WIDTH_PROP_NAME;
|
|
34
|
+
snap: boolean;
|
|
35
|
+
snippedPos: number;
|
|
36
|
+
startIndex: number;
|
|
37
|
+
startPosition: number;
|
|
38
|
+
totalItemsToDisplayEndWeight: number;
|
|
39
|
+
totalLength: number;
|
|
40
|
+
totalSize: number;
|
|
41
|
+
typicalItemSize: number;
|
|
42
|
+
}
|
|
43
|
+
export declare type ScrollDirection = -1 | 0 | 1;
|
|
44
|
+
export interface IRecalculateMetricsOptions<I extends {
|
|
45
|
+
id: Id;
|
|
46
|
+
}, C extends Array<I>> {
|
|
47
|
+
bounds: ISize;
|
|
48
|
+
collection: C;
|
|
49
|
+
isVertical: boolean;
|
|
50
|
+
itemSize: number;
|
|
51
|
+
itemsOffset: number;
|
|
52
|
+
dynamicSize: boolean;
|
|
53
|
+
scrollSize: number;
|
|
54
|
+
snap: boolean;
|
|
55
|
+
fromItemId?: Id;
|
|
56
|
+
scrollDirection?: ScrollDirection;
|
|
57
|
+
}
|
|
58
|
+
declare type CacheMapEvents = typeof TRACK_BOX_CHANGE_EVENT_NAME;
|
|
59
|
+
declare type OnChangeEventListener = (version: number) => void;
|
|
60
|
+
declare type CacheMapListeners = OnChangeEventListener;
|
|
61
|
+
/**
|
|
62
|
+
* An object that performs tracking, calculations and caching.
|
|
63
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/utils/trackBox.ts
|
|
64
|
+
* @author Evgenii Grebennikov
|
|
65
|
+
* @email djonnyx@gmail.com
|
|
66
|
+
*/
|
|
67
|
+
export declare class TrackBox extends CacheMap<Id, IRect, CacheMapEvents, CacheMapListeners> {
|
|
68
|
+
protected _tracker: Tracker<IRenderVirtualListItem, NgVirtualListItemComponent>;
|
|
69
|
+
protected _items: IRenderVirtualListCollection | null | undefined;
|
|
70
|
+
set items(v: IRenderVirtualListCollection | null | undefined);
|
|
71
|
+
protected _displayComponents: Array<ComponentRef<NgVirtualListItemComponent>> | null | undefined;
|
|
72
|
+
set displayComponents(v: Array<ComponentRef<NgVirtualListItemComponent>> | null | undefined);
|
|
73
|
+
constructor(trackingPropertyName: string);
|
|
74
|
+
set(id: Id, bounds: IRect): Map<Id, IRect>;
|
|
75
|
+
private _fireChanges;
|
|
76
|
+
private _debounceChanges;
|
|
77
|
+
protected fireChange(): void;
|
|
78
|
+
getItemPosition<I extends {
|
|
79
|
+
id: Id;
|
|
80
|
+
}, C extends Array<I>>(id: Id, stickyMap: IVirtualListStickyMap, options: IRecalculateMetricsOptions<I, C>): number;
|
|
81
|
+
updateCollection<I extends {
|
|
82
|
+
id: Id;
|
|
83
|
+
}, C extends Array<I>>(items: C, stickyMap: IVirtualListStickyMap, options: Omit<IRecalculateMetricsOptions<I, C>, 'collection'>): {
|
|
84
|
+
displayItems: IRenderVirtualListCollection;
|
|
85
|
+
totalSize: number;
|
|
86
|
+
delta: number;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Calculates list metrics
|
|
90
|
+
*/
|
|
91
|
+
protected recalculateMetrics<I extends {
|
|
92
|
+
id: Id;
|
|
93
|
+
}, C extends Array<I>>(options: IRecalculateMetricsOptions<I, C>): IMetrics;
|
|
94
|
+
clearDelta(): void;
|
|
95
|
+
protected generateDisplayCollection<I extends {
|
|
96
|
+
id: Id;
|
|
97
|
+
}, C extends Array<I>>(items: C, stickyMap: IVirtualListStickyMap, metrics: IMetrics): IRenderVirtualListCollection;
|
|
98
|
+
/**
|
|
99
|
+
* tracking by propName
|
|
100
|
+
*/
|
|
101
|
+
track(): void;
|
|
102
|
+
setDisplayObjectIndexMapById(v: {
|
|
103
|
+
[id: number]: number;
|
|
104
|
+
}): void;
|
|
105
|
+
untrackComponentByIdProperty(component?: NgVirtualListItemComponent | undefined): void;
|
|
106
|
+
protected cacheElements(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Returns calculated bounds from cache
|
|
109
|
+
*/
|
|
110
|
+
private getBoundsFromCache;
|
|
111
|
+
dispose(): void;
|
|
112
|
+
}
|
|
113
|
+
export {};
|
package/lib/utils/tracker.d.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { ComponentRef } from "@angular/core";
|
|
2
|
-
/**
|
|
3
|
-
* Tracks display items by property
|
|
4
|
-
* @
|
|
5
|
-
* @author Evgenii Grebennikov
|
|
6
|
-
* @email djonnyx@gmail.com
|
|
7
|
-
*/
|
|
8
|
-
export declare class Tracker<I = any, C = {
|
|
9
|
-
[prop: string]: any;
|
|
10
|
-
}> {
|
|
11
|
-
/**
|
|
12
|
-
* display objects dictionary of indexes by id
|
|
13
|
-
*/
|
|
14
|
-
private _displayObjectIndexMapById;
|
|
15
|
-
set displayObjectIndexMapById(v: {
|
|
16
|
-
[id: number]: number;
|
|
17
|
-
});
|
|
18
|
-
get displayObjectIndexMapById(): {
|
|
19
|
-
[id: number]: number;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Dictionary displayItems propertyNameId by items propertyNameId
|
|
23
|
-
*/
|
|
24
|
-
private _trackMap;
|
|
25
|
-
get trackMap(): {
|
|
26
|
-
[id: string]: number;
|
|
27
|
-
[id: number]: number;
|
|
28
|
-
} | null;
|
|
29
|
-
private _trackingPropertyName;
|
|
30
|
-
constructor(trackingPropertyName: string);
|
|
31
|
-
/**
|
|
32
|
-
* tracking by propName
|
|
33
|
-
*/
|
|
34
|
-
track(items: Array<any>, components: Array<ComponentRef<any>>, afterComponentSetup?: (component: C, item: I) => void): void;
|
|
35
|
-
untrackComponentByIdProperty(component?: C): void;
|
|
36
|
-
private _checkComponentProperty;
|
|
37
|
-
dispose(): void;
|
|
38
|
-
}
|
|
1
|
+
import { ComponentRef } from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* Tracks display items by property
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/utils/tracker.ts
|
|
5
|
+
* @author Evgenii Grebennikov
|
|
6
|
+
* @email djonnyx@gmail.com
|
|
7
|
+
*/
|
|
8
|
+
export declare class Tracker<I = any, C = {
|
|
9
|
+
[prop: string]: any;
|
|
10
|
+
}> {
|
|
11
|
+
/**
|
|
12
|
+
* display objects dictionary of indexes by id
|
|
13
|
+
*/
|
|
14
|
+
private _displayObjectIndexMapById;
|
|
15
|
+
set displayObjectIndexMapById(v: {
|
|
16
|
+
[id: number]: number;
|
|
17
|
+
});
|
|
18
|
+
get displayObjectIndexMapById(): {
|
|
19
|
+
[id: number]: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Dictionary displayItems propertyNameId by items propertyNameId
|
|
23
|
+
*/
|
|
24
|
+
private _trackMap;
|
|
25
|
+
get trackMap(): {
|
|
26
|
+
[id: string]: number;
|
|
27
|
+
[id: number]: number;
|
|
28
|
+
} | null;
|
|
29
|
+
private _trackingPropertyName;
|
|
30
|
+
constructor(trackingPropertyName: string);
|
|
31
|
+
/**
|
|
32
|
+
* tracking by propName
|
|
33
|
+
*/
|
|
34
|
+
track(items: Array<any>, components: Array<ComponentRef<any>>, afterComponentSetup?: (component: C, item: I) => void): void;
|
|
35
|
+
untrackComponentByIdProperty(component?: C): void;
|
|
36
|
+
private _checkComponentProperty;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-virtual-list",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Evgenii Grebennikov",
|
|
6
6
|
"email": "djonnyx@gmail.com"
|
|
@@ -13,17 +13,25 @@
|
|
|
13
13
|
"virtual",
|
|
14
14
|
"virtualized",
|
|
15
15
|
"list",
|
|
16
|
-
"
|
|
16
|
+
"group",
|
|
17
|
+
"grouped",
|
|
18
|
+
"scroll",
|
|
19
|
+
"scrolling",
|
|
20
|
+
"scroller"
|
|
17
21
|
],
|
|
18
22
|
"peerDependencies": {
|
|
19
|
-
"@angular/common": "^
|
|
20
|
-
"@angular/core": "^
|
|
23
|
+
"@angular/common": "^14.2.0",
|
|
24
|
+
"@angular/core": "^14.2.0"
|
|
21
25
|
},
|
|
22
26
|
"dependencies": {
|
|
23
27
|
"tslib": "^2.3.0"
|
|
24
28
|
},
|
|
25
29
|
"sideEffects": false,
|
|
26
|
-
"module": "
|
|
30
|
+
"module": "fesm2015/ng-virtual-list.mjs",
|
|
31
|
+
"es2020": "fesm2020/ng-virtual-list.mjs",
|
|
32
|
+
"esm2020": "esm2020/ng-virtual-list.mjs",
|
|
33
|
+
"fesm2020": "fesm2020/ng-virtual-list.mjs",
|
|
34
|
+
"fesm2015": "fesm2015/ng-virtual-list.mjs",
|
|
27
35
|
"typings": "index.d.ts",
|
|
28
36
|
"exports": {
|
|
29
37
|
"./package.json": {
|
|
@@ -31,7 +39,11 @@
|
|
|
31
39
|
},
|
|
32
40
|
".": {
|
|
33
41
|
"types": "./index.d.ts",
|
|
34
|
-
"
|
|
42
|
+
"esm2020": "./esm2020/ng-virtual-list.mjs",
|
|
43
|
+
"es2020": "./fesm2020/ng-virtual-list.mjs",
|
|
44
|
+
"es2015": "./fesm2015/ng-virtual-list.mjs",
|
|
45
|
+
"node": "./fesm2015/ng-virtual-list.mjs",
|
|
46
|
+
"default": "./fesm2020/ng-virtual-list.mjs"
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
49
|
}
|
package/public-api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from './lib/ng-virtual-list.
|
|
2
|
-
export * from './lib/
|
|
3
|
-
export * from './lib/
|
|
1
|
+
export * from './lib/ng-virtual-list.module';
|
|
2
|
+
export * from './lib/ng-virtual-list.component';
|
|
3
|
+
export * from './lib/models';
|
|
4
|
+
export * from './lib/types';
|