ng-virtual-list 16.4.0 → 16.4.2
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 +9 -9
- package/esm2022/lib/components/ng-virtual-list-item.component.mjs +2 -2
- package/esm2022/lib/models/base-virtual-list-item-component.mjs +1 -1
- package/esm2022/lib/models/index.mjs +2 -3
- package/esm2022/lib/ng-virtual-list.component.mjs +4 -6
- package/esm2022/lib/utils/index.mjs +2 -6
- package/esm2022/lib/utils/trackBox.mjs +15 -4
- package/esm2022/lib/utils/tracker.mjs +1 -1
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/ng-virtual-list.mjs +198 -190
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +7 -7
- package/lib/models/base-virtual-list-item-component.d.ts +0 -1
- package/lib/models/index.d.ts +1 -4
- package/lib/ng-virtual-list.component.d.ts +61 -64
- package/lib/utils/index.d.ts +3 -6
- package/lib/utils/trackBox.d.ts +4 -1
- package/lib/utils/tracker.d.ts +11 -4
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChangeDetectorRef, ElementRef, TemplateRef } from '@angular/core';
|
|
2
2
|
import { IRenderVirtualListItem } from '../models/render-item.model';
|
|
3
3
|
import { ISize } from '../types';
|
|
4
|
-
import { BaseVirtualListItemComponent } from '../models';
|
|
4
|
+
import { BaseVirtualListItemComponent } from '../models/base-virtual-list-item-component';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
/**
|
|
7
7
|
* Virtual list item component
|
|
@@ -10,15 +10,15 @@ import * as i0 from "@angular/core";
|
|
|
10
10
|
* @email djonnyx@gmail.com
|
|
11
11
|
*/
|
|
12
12
|
export declare class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
private _cdr;
|
|
14
|
+
private _elementRef;
|
|
15
|
+
private static __nextId;
|
|
16
|
+
private _id;
|
|
17
17
|
get id(): number;
|
|
18
18
|
regular: boolean;
|
|
19
19
|
data: IRenderVirtualListItem | undefined;
|
|
20
20
|
set item(v: IRenderVirtualListItem | undefined);
|
|
21
|
-
|
|
21
|
+
private _regularLength;
|
|
22
22
|
set regularLength(v: string);
|
|
23
23
|
get item(): IRenderVirtualListItem | undefined;
|
|
24
24
|
get itemId(): import("../types").Id | undefined;
|
|
@@ -26,7 +26,7 @@ export declare class NgVirtualListItemComponent extends BaseVirtualListItemCompo
|
|
|
26
26
|
set renderer(v: TemplateRef<any> | undefined);
|
|
27
27
|
get element(): HTMLElement;
|
|
28
28
|
constructor(_cdr: ChangeDetectorRef, _elementRef: ElementRef<HTMLElement>);
|
|
29
|
-
|
|
29
|
+
private update;
|
|
30
30
|
getBounds(): ISize;
|
|
31
31
|
show(): void;
|
|
32
32
|
hide(): void;
|
|
@@ -18,7 +18,6 @@ export declare abstract class BaseVirtualListItemComponent {
|
|
|
18
18
|
abstract itemRenderer: TemplateRef<any> | undefined;
|
|
19
19
|
abstract set renderer(v: TemplateRef<any> | undefined);
|
|
20
20
|
abstract get element(): HTMLElement;
|
|
21
|
-
protected abstract update(): void;
|
|
22
21
|
abstract getBounds(): ISize;
|
|
23
22
|
abstract show(): void;
|
|
24
23
|
abstract hide(): void;
|
package/lib/models/index.d.ts
CHANGED
|
@@ -3,7 +3,4 @@ import { IScrollEvent } from './scroll-event.model';
|
|
|
3
3
|
import { IVirtualListItem } from './item.model';
|
|
4
4
|
import { IVirtualListStickyMap } from './sticky-map.model';
|
|
5
5
|
import { IVirtualListCollection } from './collection.model';
|
|
6
|
-
|
|
7
|
-
import { Component$1 } from './component.model';
|
|
8
|
-
export type { ScrollDirection, IScrollEvent, IVirtualListItem, IVirtualListStickyMap, IVirtualListCollection, Component$1, };
|
|
9
|
-
export { BaseVirtualListItemComponent, };
|
|
6
|
+
export type { ScrollDirection, IScrollEvent, IVirtualListItem, IVirtualListStickyMap, IVirtualListCollection, };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { AfterViewInit, ChangeDetectorRef,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { IScrollEvent, IVirtualListCollection, IVirtualListStickyMap } from './models';
|
|
4
4
|
import { Id, ISize } from './types';
|
|
5
|
-
import { IRenderVirtualListCollection } from './models/render-collection.model';
|
|
6
5
|
import { Direction, SnappingMethod } from './enums';
|
|
7
|
-
import { TrackBox } from './utils';
|
|
8
6
|
import * as i0 from "@angular/core";
|
|
9
7
|
/**
|
|
10
8
|
* Virtual list component.
|
|
@@ -15,19 +13,19 @@ import * as i0 from "@angular/core";
|
|
|
15
13
|
* @email djonnyx@gmail.com
|
|
16
14
|
*/
|
|
17
15
|
export declare class NgVirtualListComponent implements AfterViewInit, OnInit, OnDestroy {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
private _cdr;
|
|
17
|
+
private _elementRef;
|
|
18
|
+
private static __nextId;
|
|
19
|
+
private _id;
|
|
22
20
|
/**
|
|
23
21
|
* Readonly. Returns the unique identifier of the component.
|
|
24
22
|
*/
|
|
25
23
|
get id(): number;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
private _listContainerRef;
|
|
25
|
+
private _container;
|
|
26
|
+
private _list;
|
|
27
|
+
private _snapContainerRef;
|
|
28
|
+
private _snappedContainer;
|
|
31
29
|
/**
|
|
32
30
|
* Fires when the list has been scrolled.
|
|
33
31
|
*/
|
|
@@ -36,22 +34,22 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
36
34
|
* Fires when the list has completed scrolling.
|
|
37
35
|
*/
|
|
38
36
|
onScrollEnd: EventEmitter<IScrollEvent>;
|
|
39
|
-
|
|
37
|
+
private _$items;
|
|
40
38
|
readonly $items: Observable<IVirtualListCollection<Object> | undefined>;
|
|
41
|
-
|
|
39
|
+
private _itemsTransform;
|
|
42
40
|
/**
|
|
43
41
|
* Collection of list items.
|
|
44
42
|
*/
|
|
45
43
|
set items(v: IVirtualListCollection);
|
|
46
44
|
get items(): IVirtualListCollection;
|
|
47
|
-
|
|
45
|
+
private _$snap;
|
|
48
46
|
readonly $snap: Observable<boolean>;
|
|
49
47
|
/**
|
|
50
48
|
* Determines whether elements will snap. Default value is "true".
|
|
51
49
|
*/
|
|
52
50
|
set snap(v: boolean);
|
|
53
51
|
get snap(): boolean;
|
|
54
|
-
|
|
52
|
+
private _$enabledBufferOptimization;
|
|
55
53
|
readonly $enabledBufferOptimization: Observable<boolean>;
|
|
56
54
|
/**
|
|
57
55
|
* Experimental!
|
|
@@ -61,15 +59,15 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
61
59
|
*/
|
|
62
60
|
set enabledBufferOptimization(v: boolean);
|
|
63
61
|
get enabledBufferOptimization(): boolean;
|
|
64
|
-
|
|
62
|
+
private _$itemRenderer;
|
|
65
63
|
readonly $itemRenderer: Observable<TemplateRef<any> | undefined>;
|
|
66
|
-
|
|
64
|
+
private _$renderer;
|
|
67
65
|
/**
|
|
68
66
|
* Rendering element template.
|
|
69
67
|
*/
|
|
70
68
|
set itemRenderer(v: TemplateRef<any>);
|
|
71
69
|
get itemRenderer(): TemplateRef<any>;
|
|
72
|
-
|
|
70
|
+
private _$stickyMap;
|
|
73
71
|
readonly $stickyMap: Observable<IVirtualListStickyMap>;
|
|
74
72
|
/**
|
|
75
73
|
* Dictionary zIndex by id of the list element. If the value is not set or equal to 0,
|
|
@@ -77,8 +75,8 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
77
75
|
*/
|
|
78
76
|
set stickyMap(v: IVirtualListStickyMap);
|
|
79
77
|
get stickyMap(): IVirtualListStickyMap;
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
private _itemSizeOptions;
|
|
79
|
+
private _$itemSize;
|
|
82
80
|
readonly $itemSize: Observable<number>;
|
|
83
81
|
/**
|
|
84
82
|
* If direction = 'vertical', then the height of a typical element. If direction = 'horizontal', then the width of a typical element.
|
|
@@ -86,7 +84,7 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
86
84
|
*/
|
|
87
85
|
set itemSize(v: number);
|
|
88
86
|
get itemSize(): number;
|
|
89
|
-
|
|
87
|
+
private _$dynamicSize;
|
|
90
88
|
readonly $dynamicSize: Observable<boolean>;
|
|
91
89
|
/**
|
|
92
90
|
* If true then the items in the list can have different sizes and the itemSize property is ignored.
|
|
@@ -94,7 +92,7 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
94
92
|
*/
|
|
95
93
|
set dynamicSize(v: boolean);
|
|
96
94
|
get dynamicSize(): boolean;
|
|
97
|
-
|
|
95
|
+
private _$direction;
|
|
98
96
|
readonly $direction: Observable<Direction>;
|
|
99
97
|
/**
|
|
100
98
|
* Determines the direction in which elements are placed. Default value is "vertical".
|
|
@@ -105,7 +103,7 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
105
103
|
* @deprecated "itemOffset" parameter is deprecated. Use "bufferSize" and "maxBufferSize".
|
|
106
104
|
*/
|
|
107
105
|
set itemsOffset(v: number);
|
|
108
|
-
|
|
106
|
+
private _$bufferSize;
|
|
109
107
|
readonly $bufferSize: Observable<number>;
|
|
110
108
|
/**
|
|
111
109
|
* Number of elements outside the scope of visibility. Default value is 2.
|
|
@@ -113,7 +111,7 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
113
111
|
set bufferSize(v: number);
|
|
114
112
|
get bufferSize(): number;
|
|
115
113
|
private _maxBufferSizeTransform;
|
|
116
|
-
|
|
114
|
+
private _$maxBufferSize;
|
|
117
115
|
readonly $maxBufferSize: Observable<number>;
|
|
118
116
|
/**
|
|
119
117
|
* Maximum number of elements outside the scope of visibility. Default value is 100.
|
|
@@ -122,15 +120,15 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
122
120
|
*/
|
|
123
121
|
set maxBufferSize(v: number);
|
|
124
122
|
get maxBufferSize(): number;
|
|
125
|
-
|
|
123
|
+
private _$trackBy;
|
|
126
124
|
readonly $trackBy: Observable<string>;
|
|
127
125
|
/**
|
|
128
126
|
* The name of the property by which tracking is performed
|
|
129
127
|
*/
|
|
130
128
|
set trackBy(v: string);
|
|
131
129
|
get trackBy(): string;
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
private _isVertical;
|
|
131
|
+
private _$snappingMethod;
|
|
134
132
|
readonly $snappingMethod: Observable<SnappingMethod>;
|
|
135
133
|
/**
|
|
136
134
|
* Snapping method.
|
|
@@ -139,51 +137,50 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
139
137
|
*/
|
|
140
138
|
set snappingMethod(v: SnappingMethod);
|
|
141
139
|
get snappingMethod(): SnappingMethod;
|
|
142
|
-
|
|
140
|
+
private _isSnappingMethodAdvanced;
|
|
143
141
|
get isSnappingMethodAdvanced(): boolean;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
142
|
+
private _displayComponents;
|
|
143
|
+
private _snapedDisplayComponent;
|
|
144
|
+
private _$bounds;
|
|
145
|
+
private _$scrollSize;
|
|
146
|
+
private _resizeObserver;
|
|
147
|
+
private _resizeSnappedComponentHandler;
|
|
148
|
+
private _resizeSnappedObserver;
|
|
149
|
+
private _onResizeHandler;
|
|
150
|
+
private _onScrollHandler;
|
|
151
|
+
private _$initialized;
|
|
154
152
|
readonly $initialized: Observable<boolean>;
|
|
155
153
|
/**
|
|
156
154
|
* Base class of the element component
|
|
157
155
|
*/
|
|
158
|
-
|
|
156
|
+
private _itemComponentClass;
|
|
159
157
|
/**
|
|
160
158
|
* Base class trackBox
|
|
161
159
|
*/
|
|
162
|
-
|
|
160
|
+
private _trackBoxClass;
|
|
163
161
|
/**
|
|
164
162
|
* Dictionary of element sizes by their id
|
|
165
163
|
*/
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
private _trackBox;
|
|
165
|
+
private _onTrackBoxChangeHandler;
|
|
166
|
+
private _$cacheVersion;
|
|
169
167
|
get $cacheVersion(): Observable<number>;
|
|
170
168
|
constructor(_cdr: ChangeDetectorRef, _elementRef: ElementRef<HTMLDivElement>);
|
|
171
|
-
protected setupRenderer(): void;
|
|
172
169
|
/** @internal */
|
|
173
170
|
ngOnInit(): void;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
171
|
+
private onInit;
|
|
172
|
+
private listenCacheChangesIfNeed;
|
|
173
|
+
private getIsSnappingMethodAdvanced;
|
|
174
|
+
private getIsVertical;
|
|
175
|
+
private _componentsResizeObserver;
|
|
176
|
+
private createDisplayComponentsIfNeed;
|
|
177
|
+
private updateRegularRenderer;
|
|
178
|
+
private resetRenderers;
|
|
182
179
|
/**
|
|
183
180
|
* Tracking by id
|
|
184
181
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
private tracking;
|
|
183
|
+
private resetBoundsSize;
|
|
187
184
|
/**
|
|
188
185
|
* Returns the bounds of an element with a given id
|
|
189
186
|
*/
|
|
@@ -193,21 +190,21 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
|
|
|
193
190
|
* Behavior accepts the values "auto", "instant" and "smooth".
|
|
194
191
|
*/
|
|
195
192
|
scrollTo(id: Id, behavior?: ScrollBehavior): void;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
private _scrollToRepeatExecutionTimeout;
|
|
194
|
+
private clearScrollToRepeatExecutionTimeout;
|
|
195
|
+
private scrollToExecutor;
|
|
199
196
|
/**
|
|
200
197
|
* Scrolls the scroll area to the desired element with the specified ID.
|
|
201
198
|
*/
|
|
202
199
|
scrollToEnd(behavior?: ScrollBehavior): void;
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
private _onContainerScrollHandler;
|
|
201
|
+
private _onContainerScrollEndHandler;
|
|
205
202
|
/** @internal */
|
|
206
203
|
ngAfterViewInit(): void;
|
|
207
|
-
|
|
204
|
+
private afterViewInit;
|
|
208
205
|
/** @internal */
|
|
209
206
|
ngOnDestroy(): void;
|
|
210
|
-
|
|
207
|
+
private dispose;
|
|
211
208
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListComponent, never>;
|
|
212
209
|
static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": { "alias": "items"; "required": false; }; "snap": { "alias": "snap"; "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; }; "bufferSize": { "alias": "bufferSize"; "required": false; }; "maxBufferSize": { "alias": "maxBufferSize"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; "snappingMethod": { "alias": "snappingMethod"; "required": false; }; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; }, never, never, false, never>;
|
|
213
210
|
}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { isDirection } from "./isDirection";
|
|
2
1
|
import { debounce } from "./debounce";
|
|
3
2
|
import { toggleClassName } from './toggleClassName';
|
|
4
|
-
import {
|
|
5
|
-
import { TrackBox, IUpdateCollectionReturns, TRACK_BOX_CHANGE_EVENT_NAME, IMetrics, IRecalculateMetricsOptions, IGetItemPositionOptions, IUpdateCollectionOptions, CacheMapEvents, OnChangeEventListener, CacheMapListeners, ItemDisplayMethods } from "./trackBox";
|
|
6
|
-
import { CMap, ICacheMap, CACHE_BOX_CHANGE_EVENT_NAME } from './cacheMap';
|
|
3
|
+
import { IMetrics } from "./trackBox";
|
|
7
4
|
import { ScrollEvent } from "./scrollEvent";
|
|
8
|
-
export {
|
|
9
|
-
export type {
|
|
5
|
+
export { debounce, toggleClassName, ScrollEvent, };
|
|
6
|
+
export type { IMetrics, };
|
package/lib/utils/trackBox.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { CacheMap, CMap } from "./cacheMap";
|
|
|
5
5
|
import { Tracker } from "./tracker";
|
|
6
6
|
import { ISize } from "../types";
|
|
7
7
|
import { HEIGHT_PROP_NAME, WIDTH_PROP_NAME } from "../const";
|
|
8
|
-
import {
|
|
8
|
+
import { IVirtualListStickyMap } from "../models";
|
|
9
|
+
import { BaseVirtualListItemComponent } from "../models/base-virtual-list-item-component";
|
|
9
10
|
export declare const TRACK_BOX_CHANGE_EVENT_NAME = "change";
|
|
10
11
|
export interface IMetrics {
|
|
11
12
|
delta: number;
|
|
@@ -104,7 +105,9 @@ export declare class TrackBox<C extends BaseVirtualListItemComponent = any> exte
|
|
|
104
105
|
* Set the trackBy property
|
|
105
106
|
*/
|
|
106
107
|
set trackingPropertyName(v: string);
|
|
108
|
+
protected _trackingPropertyName: string;
|
|
107
109
|
constructor(trackingPropertyName: string);
|
|
110
|
+
protected initialize(): void;
|
|
108
111
|
set(id: Id, bounds: ISize): CMap<Id, ISize>;
|
|
109
112
|
protected _previousCollection: Array<{
|
|
110
113
|
id: Id;
|
package/lib/utils/tracker.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ComponentRef } from "@angular/core";
|
|
2
|
-
import {
|
|
2
|
+
import { ScrollDirection } from "../models";
|
|
3
3
|
import { Id, ISize } from "../types";
|
|
4
|
+
import { BaseVirtualListItemComponent } from "../models/base-virtual-list-item-component";
|
|
5
|
+
type TrackingPropertyId = string | number;
|
|
4
6
|
export interface IVirtualListItemComponent<I = any> {
|
|
5
7
|
getBounds(): ISize;
|
|
6
8
|
itemId: Id;
|
|
@@ -19,7 +21,9 @@ export declare class Tracker<C extends BaseVirtualListItemComponent = any> {
|
|
|
19
21
|
/**
|
|
20
22
|
* display objects dictionary of indexes by id
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
protected _displayObjectIndexMapById: {
|
|
25
|
+
[id: number]: number;
|
|
26
|
+
};
|
|
23
27
|
set displayObjectIndexMapById(v: {
|
|
24
28
|
[id: number]: number;
|
|
25
29
|
});
|
|
@@ -29,12 +33,14 @@ export declare class Tracker<C extends BaseVirtualListItemComponent = any> {
|
|
|
29
33
|
/**
|
|
30
34
|
* Dictionary displayItems propertyNameId by items propertyNameId
|
|
31
35
|
*/
|
|
32
|
-
|
|
36
|
+
protected _trackMap: {
|
|
37
|
+
[id: TrackingPropertyId]: number;
|
|
38
|
+
} | null;
|
|
33
39
|
get trackMap(): {
|
|
34
40
|
[id: string]: number;
|
|
35
41
|
[id: number]: number;
|
|
36
42
|
} | null;
|
|
37
|
-
|
|
43
|
+
protected _trackingPropertyName: string;
|
|
38
44
|
set trackingPropertyName(v: string);
|
|
39
45
|
constructor(trackingPropertyName: string);
|
|
40
46
|
/**
|
|
@@ -44,3 +50,4 @@ export declare class Tracker<C extends BaseVirtualListItemComponent = any> {
|
|
|
44
50
|
untrackComponentByIdProperty(component?: C): void;
|
|
45
51
|
dispose(): void;
|
|
46
52
|
}
|
|
53
|
+
export {};
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED