ng-virtual-list 14.0.0 → 14.0.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 +7 -7
- package/esm2020/lib/components/ng-virtual-list-item.component.mjs +2 -2
- package/esm2020/lib/const/index.mjs +2 -1
- package/esm2020/lib/enums/direction.mjs +1 -1
- package/esm2020/lib/enums/directions.mjs +2 -2
- package/esm2020/lib/models/collection.model.mjs +1 -1
- package/esm2020/lib/models/index.mjs +1 -1
- package/esm2020/lib/models/item.model.mjs +1 -1
- package/esm2020/lib/models/render-collection.model.mjs +1 -1
- package/esm2020/lib/models/render-item-config.model.mjs +1 -1
- package/esm2020/lib/models/render-item.model.mjs +1 -1
- package/esm2020/lib/models/scroll-direction.model.mjs +2 -0
- package/esm2020/lib/models/scroll-event.model.mjs +2 -0
- package/esm2020/lib/models/sticky-map.model.mjs +1 -1
- package/esm2020/lib/ng-virtual-list.component.mjs +43 -46
- package/esm2020/lib/types/id.mjs +1 -1
- package/esm2020/lib/types/rect.mjs +1 -1
- package/esm2020/lib/types/size.mjs +1 -1
- package/esm2020/lib/utils/cacheMap.mjs +43 -2
- package/esm2020/lib/utils/debounce.mjs +2 -2
- package/esm2020/lib/utils/disposableComponent.mjs +2 -2
- package/esm2020/lib/utils/eventEmitter.mjs +2 -2
- package/esm2020/lib/utils/isDirection.mjs +2 -2
- package/esm2020/lib/utils/toggleClassName.mjs +2 -2
- package/esm2020/lib/utils/trackBox.mjs +56 -22
- package/esm2020/lib/utils/tracker.mjs +2 -2
- package/fesm2015/ng-virtual-list.mjs +143 -73
- package/fesm2015/ng-virtual-list.mjs.map +1 -1
- package/fesm2020/ng-virtual-list.mjs +146 -74
- package/fesm2020/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +1 -1
- package/lib/const/index.d.ts +1 -0
- package/lib/enums/direction.d.ts +1 -1
- package/lib/enums/directions.d.ts +1 -1
- package/lib/models/collection.model.d.ts +1 -1
- package/lib/models/index.d.ts +3 -1
- package/lib/models/item.model.d.ts +1 -1
- package/lib/models/render-collection.model.d.ts +1 -1
- package/lib/models/render-item-config.model.d.ts +1 -1
- package/lib/models/render-item.model.d.ts +1 -1
- package/lib/models/scroll-direction.model.d.ts +5 -0
- package/lib/models/scroll-event.model.d.ts +18 -0
- package/lib/models/sticky-map.model.d.ts +1 -1
- package/lib/ng-virtual-list.component.d.ts +7 -9
- package/lib/types/id.d.ts +1 -1
- package/lib/types/rect.d.ts +1 -1
- package/lib/types/size.d.ts +1 -1
- package/lib/utils/cacheMap.d.ts +11 -1
- package/lib/utils/debounce.d.ts +1 -1
- package/lib/utils/disposableComponent.d.ts +1 -1
- package/lib/utils/eventEmitter.d.ts +1 -1
- package/lib/utils/isDirection.d.ts +1 -1
- package/lib/utils/toggleClassName.d.ts +1 -1
- package/lib/utils/trackBox.d.ts +4 -4
- package/lib/utils/tracker.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Axis of the arrangement of virtual list elements.
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/enums/directions.ts
|
|
4
4
|
* @author Evgenii Grebennikov
|
|
5
5
|
* @email djonnyx@gmail.com
|
|
6
6
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IVirtualListItem } from "./item.model";
|
|
2
2
|
/**
|
|
3
3
|
* Virtual list elements collection interface
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/collection.model.ts
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|
package/lib/models/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ScrollDirection } from './scroll-direction.model';
|
|
2
|
+
import { IScrollEvent } from './scroll-event.model';
|
|
1
3
|
import { IVirtualListItem } from './item.model';
|
|
2
4
|
import { IVirtualListStickyMap } from './sticky-map.model';
|
|
3
5
|
import { IVirtualListCollection } from './collection.model';
|
|
4
|
-
export type { IVirtualListItem, IVirtualListStickyMap, IVirtualListCollection, };
|
|
6
|
+
export type { ScrollDirection, IScrollEvent, IVirtualListItem, IVirtualListStickyMap, IVirtualListCollection, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Id } from "../types/id";
|
|
2
2
|
/**
|
|
3
3
|
* Virtual list element model
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/item.model.ts
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IRenderVirtualListItem } from "./render-item.model";
|
|
2
2
|
/**
|
|
3
3
|
* Virtual list screen elements collection interface
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/render-collection.model.ts
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Object with configuration parameters for IRenderVirtualListItem
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/render-item-config.model.ts
|
|
4
4
|
* @author Evgenii Grebennikov
|
|
5
5
|
* @email djonnyx@gmail.com
|
|
6
6
|
*
|
|
@@ -4,7 +4,7 @@ import { IVirtualListItem } from "./item.model";
|
|
|
4
4
|
import { IRenderVirtualListItemConfig } from "./render-item-config.model";
|
|
5
5
|
/**
|
|
6
6
|
* List screen element model
|
|
7
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
7
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/render-item.model.ts
|
|
8
8
|
* @author Evgenii Grebennikov
|
|
9
9
|
* @email djonnyx@gmail.com
|
|
10
10
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ScrollDirection } from "./scroll-direction.model";
|
|
2
|
+
/**
|
|
3
|
+
* Interface IScrollEvent.
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/scroll-event.model.ts
|
|
5
|
+
* @author Evgenii Grebennikov
|
|
6
|
+
* @email djonnyx@gmail.com
|
|
7
|
+
*/
|
|
8
|
+
export interface IScrollEvent {
|
|
9
|
+
/**
|
|
10
|
+
* Scroll area offset
|
|
11
|
+
*/
|
|
12
|
+
scrollSize: number;
|
|
13
|
+
/**
|
|
14
|
+
* A value of -1 indicates the direction is up or left (if the list direction is horizontal).
|
|
15
|
+
* A value of 1 indicates the direction is down or right (if the list direction is horizontal).
|
|
16
|
+
*/
|
|
17
|
+
direction: ScrollDirection;
|
|
18
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dictionary zIndex by id of the list element. If the value is not set or equal to 0, then a simple element is displayed, if the value is greater than 0, then the sticky position mode is enabled for the element.
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/sticky-map.model.ts
|
|
4
4
|
* @author Evgenii Grebennikov
|
|
5
5
|
* @email djonnyx@gmail.com
|
|
6
6
|
*/
|
|
@@ -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 { DisposableComponent } from './utils';
|
|
@@ -10,7 +10,7 @@ import * as i0 from "@angular/core";
|
|
|
10
10
|
* Virtual list component.
|
|
11
11
|
* Maximum performance for extremely large lists.
|
|
12
12
|
* It is based on algorithms for virtualization of screen objects.
|
|
13
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
13
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/ng-virtual-list.component.ts
|
|
14
14
|
* @author Evgenii Grebennikov
|
|
15
15
|
* @email djonnyx@gmail.com
|
|
16
16
|
*/
|
|
@@ -29,11 +29,11 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
29
29
|
/**
|
|
30
30
|
* Fires when the list has been scrolled.
|
|
31
31
|
*/
|
|
32
|
-
onScroll: EventEmitter<
|
|
32
|
+
onScroll: EventEmitter<IScrollEvent>;
|
|
33
33
|
/**
|
|
34
34
|
* Fires when the list has completed scrolling.
|
|
35
35
|
*/
|
|
36
|
-
onScrollEnd: EventEmitter<
|
|
36
|
+
onScrollEnd: EventEmitter<IScrollEvent>;
|
|
37
37
|
private _$items;
|
|
38
38
|
readonly $items: Observable<IVirtualListCollection | undefined>;
|
|
39
39
|
/**
|
|
@@ -107,12 +107,7 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
107
107
|
protected _$bounds: BehaviorSubject<DOMRect | null>;
|
|
108
108
|
protected _$scrollSize: BehaviorSubject<number>;
|
|
109
109
|
private _resizeObserver;
|
|
110
|
-
/**
|
|
111
|
-
* only dynamic
|
|
112
|
-
*/
|
|
113
|
-
private _$scrolledItemId;
|
|
114
110
|
private _onResizeHandler;
|
|
115
|
-
private _scrollDirection;
|
|
116
111
|
private _onScrollHandler;
|
|
117
112
|
private scrollImmediately;
|
|
118
113
|
private _scrollImmediatelyHandler;
|
|
@@ -143,6 +138,9 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
143
138
|
* Behavior accepts the values "auto", "instant" and "smooth".
|
|
144
139
|
*/
|
|
145
140
|
scrollTo(id: Id, behavior?: ScrollBehavior): void;
|
|
141
|
+
private _scrollToRepeatExecutionTimeout;
|
|
142
|
+
private clearScrollToRepeatExecutionTimeout;
|
|
143
|
+
protected scrollToExecutor(id: Id, behavior: ScrollBehavior, iteration?: number): void;
|
|
146
144
|
scrollToEnd(behavior?: ScrollBehavior): void;
|
|
147
145
|
ngAfterViewInit(): void;
|
|
148
146
|
ngOnDestroy(): void;
|
package/lib/types/id.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Identifier type
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/types/id.ts
|
|
4
4
|
* @author Evgenii Grebennikov
|
|
5
5
|
* @email djonnyx@gmail.com
|
|
6
6
|
*/
|
package/lib/types/rect.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ISize } from "./size";
|
|
2
2
|
/**
|
|
3
3
|
* Rectangular area interface
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/types/rect.ts
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|
package/lib/types/size.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Area area Interface
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/types/size.ts
|
|
4
4
|
* @author Evgenii Grebennikov
|
|
5
5
|
* @email djonnyx@gmail.com
|
|
6
6
|
*/
|
package/lib/utils/cacheMap.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScrollDirection } from "../models";
|
|
1
2
|
import { EventEmitter, TEventHandler } from "./eventEmitter";
|
|
2
3
|
export interface ICacheMap<I = any, B = any> {
|
|
3
4
|
set: (id: I, bounds: B) => Map<I, B>;
|
|
@@ -11,7 +12,7 @@ declare type CacheMapListeners = OnChangeEventListener;
|
|
|
11
12
|
/**
|
|
12
13
|
* Cache map.
|
|
13
14
|
* Emits a change event on each mutation.
|
|
14
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
15
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/cacheMap.ts
|
|
15
16
|
* @author Evgenii Grebennikov
|
|
16
17
|
* @email djonnyx@gmail.com
|
|
17
18
|
*/
|
|
@@ -21,8 +22,17 @@ export declare class CacheMap<I = string | number, B = any, E extends string = C
|
|
|
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/debounce.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Simple debounce function.
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/debounce.ts
|
|
4
4
|
* @author Evgenii Grebennikov
|
|
5
5
|
* @email djonnyx@gmail.com
|
|
6
6
|
*/
|
|
@@ -3,7 +3,7 @@ import { Subject } from 'rxjs';
|
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
5
5
|
* Base disposable component
|
|
6
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
6
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/disposableComponent.ts
|
|
7
7
|
* @author Evgenii Grebennikov
|
|
8
8
|
* @email djonnyx@gmail.com
|
|
9
9
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare type TEventHandler = (...args: Array<any>) => void;
|
|
2
2
|
/**
|
|
3
3
|
* Simple event emitter
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/eventEmitter.ts
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Direction } from "../enums";
|
|
2
2
|
/**
|
|
3
3
|
* Determines the axis membership of a virtual list
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/isDirection.ts
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Switch css classes
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/toggleClassName.ts
|
|
4
4
|
* @author Evgenii Grebennikov
|
|
5
5
|
* @email djonnyx@gmail.com
|
|
6
6
|
*/
|
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 declare type ScrollDirection = -1 | 0 | 1;
|
|
44
43
|
export interface IRecalculateMetricsOptions<I extends {
|
|
45
44
|
id: Id;
|
|
46
45
|
}, C extends Array<I>> {
|
|
@@ -53,14 +52,13 @@ export interface IRecalculateMetricsOptions<I extends {
|
|
|
53
52
|
scrollSize: number;
|
|
54
53
|
snap: boolean;
|
|
55
54
|
fromItemId?: Id;
|
|
56
|
-
scrollDirection?: ScrollDirection;
|
|
57
55
|
}
|
|
58
56
|
declare type CacheMapEvents = typeof TRACK_BOX_CHANGE_EVENT_NAME;
|
|
59
57
|
declare type OnChangeEventListener = (version: number) => void;
|
|
60
58
|
declare type CacheMapListeners = OnChangeEventListener;
|
|
61
59
|
/**
|
|
62
60
|
* An object that performs tracking, calculations and caching.
|
|
63
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
61
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/trackBox.ts
|
|
64
62
|
* @author Evgenii Grebennikov
|
|
65
63
|
* @email djonnyx@gmail.com
|
|
66
64
|
*/
|
|
@@ -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;
|
package/lib/utils/tracker.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentRef } from "@angular/core";
|
|
2
2
|
/**
|
|
3
3
|
* Tracks display items by property
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/utils/tracker.ts
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|