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
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
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/main/projects/ng-virtual-list/src/lib/models/sticky-map.model.ts
|
|
4
|
+
* @author Evgenii Grebennikov
|
|
5
|
+
* @email djonnyx@gmail.com
|
|
6
|
+
*/
|
|
7
|
+
export interface IVirtualListStickyMap {
|
|
8
|
+
/**
|
|
9
|
+
* Sets zIndex for the element ID. If zIndex is greater than 0, then sticky position is applied.
|
|
10
|
+
*/
|
|
11
|
+
[id: string]: number;
|
|
12
|
+
}
|
|
@@ -1,110 +1,151 @@
|
|
|
1
|
-
import { AfterViewInit, ComponentRef, ElementRef, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Direction } from './enums';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
items
|
|
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
|
-
private
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
private
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
import { AfterViewInit, ChangeDetectorRef, ComponentRef, ElementRef, EventEmitter, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
+
import { NgVirtualListItemComponent } from './components/ng-virtual-list-item.component';
|
|
4
|
+
import { IVirtualListCollection, IVirtualListStickyMap } from './models';
|
|
5
|
+
import { Id } from './types';
|
|
6
|
+
import { Direction } from './enums';
|
|
7
|
+
import { DisposableComponent } from './utils';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* Virtual list component.
|
|
11
|
+
* Maximum performance for extremely large lists.
|
|
12
|
+
* It is based on algorithms for virtualization of screen objects.
|
|
13
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/ng-virtual-list.component.ts
|
|
14
|
+
* @author Evgenii Grebennikov
|
|
15
|
+
* @email djonnyx@gmail.com
|
|
16
|
+
*/
|
|
17
|
+
export declare class NgVirtualListComponent extends DisposableComponent implements AfterViewInit, OnDestroy {
|
|
18
|
+
private _cdr;
|
|
19
|
+
private _elementRef;
|
|
20
|
+
private static __nextId;
|
|
21
|
+
private _id;
|
|
22
|
+
/**
|
|
23
|
+
* Readonly. Returns the unique identifier of the component.
|
|
24
|
+
*/
|
|
25
|
+
get id(): number;
|
|
26
|
+
protected _listContainerRef: ViewContainerRef | undefined;
|
|
27
|
+
protected _container: ElementRef<HTMLDivElement> | undefined;
|
|
28
|
+
protected _list: ElementRef<HTMLUListElement> | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Fires when the list has been scrolled.
|
|
31
|
+
*/
|
|
32
|
+
onScroll: EventEmitter<number>;
|
|
33
|
+
/**
|
|
34
|
+
* Fires when the list has completed scrolling.
|
|
35
|
+
*/
|
|
36
|
+
onScrollEnd: EventEmitter<number>;
|
|
37
|
+
private _$items;
|
|
38
|
+
readonly $items: Observable<IVirtualListCollection | undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* Collection of list items.
|
|
41
|
+
*/
|
|
42
|
+
set items(v: IVirtualListCollection);
|
|
43
|
+
get items(): IVirtualListCollection;
|
|
44
|
+
private _$snap;
|
|
45
|
+
readonly $snap: Observable<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Determines whether elements will snap. Default value is "true".
|
|
48
|
+
*/
|
|
49
|
+
set snap(v: boolean);
|
|
50
|
+
get snap(): boolean;
|
|
51
|
+
private _$snapToItem;
|
|
52
|
+
readonly $snapToItem: Observable<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Determines whether scroll positions will be snapped to the element. Default value is "false".
|
|
55
|
+
*/
|
|
56
|
+
set snapToItem(v: boolean);
|
|
57
|
+
get snapToItem(): boolean;
|
|
58
|
+
private _$itemRenderer;
|
|
59
|
+
readonly $itemRenderer: Observable<TemplateRef<any> | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Rendering element template.
|
|
62
|
+
*/
|
|
63
|
+
set itemRenderer(v: TemplateRef<any>);
|
|
64
|
+
get itemRenderer(): TemplateRef<any>;
|
|
65
|
+
private _$stickyMap;
|
|
66
|
+
readonly $stickyMap: Observable<IVirtualListStickyMap>;
|
|
67
|
+
/**
|
|
68
|
+
* Dictionary zIndex by id of the list element. If the value is not set or equal to 0,
|
|
69
|
+
* then a simple element is displayed, if the value is greater than 0, then the sticky position mode is enabled for the element.
|
|
70
|
+
*/
|
|
71
|
+
set stickyMap(v: IVirtualListStickyMap);
|
|
72
|
+
get stickyMap(): IVirtualListStickyMap;
|
|
73
|
+
private _itemSizeOptions;
|
|
74
|
+
private _$itemSize;
|
|
75
|
+
readonly $itemSize: Observable<number>;
|
|
76
|
+
/**
|
|
77
|
+
* If direction = 'vertical', then the height of a typical element. If direction = 'horizontal', then the width of a typical element.
|
|
78
|
+
* Ignored if the dynamicSize property is true.
|
|
79
|
+
*/
|
|
80
|
+
set itemSize(v: number);
|
|
81
|
+
get itemSize(): number;
|
|
82
|
+
private _$dynamicSize;
|
|
83
|
+
readonly $dynamicSize: Observable<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* If true then the items in the list can have different sizes and the itemSize property is ignored.
|
|
86
|
+
* If false then the items in the list have a fixed size specified by the itemSize property. The default value is false.
|
|
87
|
+
*/
|
|
88
|
+
set dynamicSize(v: boolean);
|
|
89
|
+
get dynamicSize(): boolean;
|
|
90
|
+
private _$direction;
|
|
91
|
+
readonly $direction: Observable<Direction>;
|
|
92
|
+
/**
|
|
93
|
+
* Determines the direction in which elements are placed. Default value is "vertical".
|
|
94
|
+
*/
|
|
95
|
+
set direction(v: Direction);
|
|
96
|
+
get direction(): Direction;
|
|
97
|
+
private _$itemsOffset;
|
|
98
|
+
readonly $itemsOffset: Observable<number>;
|
|
99
|
+
/**
|
|
100
|
+
* Number of elements outside the scope of visibility. Default value is 2.
|
|
101
|
+
*/
|
|
102
|
+
set itemsOffset(v: number);
|
|
103
|
+
get itemsOffset(): number;
|
|
104
|
+
private _scrollToTimeout;
|
|
105
|
+
private _isVertical;
|
|
106
|
+
protected _displayComponents: Array<ComponentRef<NgVirtualListItemComponent>>;
|
|
107
|
+
protected _$bounds: BehaviorSubject<DOMRect | null>;
|
|
108
|
+
protected _$scrollSize: BehaviorSubject<number>;
|
|
109
|
+
private _resizeObserver;
|
|
110
|
+
/**
|
|
111
|
+
* only dynamic
|
|
112
|
+
*/
|
|
113
|
+
private _$scrolledItemId;
|
|
114
|
+
private _onResizeHandler;
|
|
115
|
+
private _scrollDirection;
|
|
116
|
+
private _onScrollHandler;
|
|
117
|
+
private scrollImmediately;
|
|
118
|
+
private _scrollImmediatelyHandler;
|
|
119
|
+
private clearScrollImmediately;
|
|
120
|
+
private _onScrollEndHandler;
|
|
121
|
+
private _$initialized;
|
|
122
|
+
readonly $initialized: Observable<boolean>;
|
|
123
|
+
/**
|
|
124
|
+
* Dictionary of element sizes by their id
|
|
125
|
+
*/
|
|
126
|
+
private _trackBox;
|
|
127
|
+
private _onTrackBoxChangeHandler;
|
|
128
|
+
private _$cacheVersion;
|
|
129
|
+
get $cacheVersion(): Observable<number>;
|
|
130
|
+
constructor(_cdr: ChangeDetectorRef, _elementRef: ElementRef<HTMLDivElement>);
|
|
131
|
+
ngOnInit(): void;
|
|
132
|
+
private listenCacheChangesIfNeed;
|
|
133
|
+
private getIsVertical;
|
|
134
|
+
private createDisplayComponentsIfNeed;
|
|
135
|
+
private resetRenderers;
|
|
136
|
+
/**
|
|
137
|
+
* Tracking by id
|
|
138
|
+
*/
|
|
139
|
+
protected tracking(): void;
|
|
140
|
+
private resetBoundsSize;
|
|
141
|
+
/**
|
|
142
|
+
* The method scrolls the list to the element with the given id and returns the value of the scrolled area.
|
|
143
|
+
* Behavior accepts the values "auto", "instant" and "smooth".
|
|
144
|
+
*/
|
|
145
|
+
scrollTo(id: Id, behavior?: ScrollBehavior): void;
|
|
146
|
+
scrollToEnd(behavior?: ScrollBehavior): void;
|
|
147
|
+
ngAfterViewInit(): void;
|
|
148
|
+
ngOnDestroy(): void;
|
|
149
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListComponent, never>;
|
|
150
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": "items"; "snap": "snap"; "snapToItem": "snapToItem"; "itemRenderer": "itemRenderer"; "stickyMap": "stickyMap"; "itemSize": "itemSize"; "dynamicSize": "dynamicSize"; "direction": "direction"; "itemsOffset": "itemsOffset"; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; }, never, never, false>;
|
|
151
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ng-virtual-list.component";
|
|
3
|
+
import * as i2 from "./components/ng-virtual-list-item.component";
|
|
4
|
+
import * as i3 from "@angular/common";
|
|
5
|
+
export declare class NgVirtualListModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgVirtualListModule, [typeof i1.NgVirtualListComponent, typeof i2.NgVirtualListItemComponent], [typeof i3.CommonModule], [typeof i1.NgVirtualListComponent]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgVirtualListModule>;
|
|
9
|
+
}
|
package/lib/types/id.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Identifier type
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/types/id.ts
|
|
4
|
+
* @author Evgenii Grebennikov
|
|
5
|
+
* @email djonnyx@gmail.com
|
|
6
|
+
*/
|
|
7
|
+
export declare type Id = string | number;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Id } from './id';
|
|
2
|
-
import { ISize } from './size';
|
|
3
|
-
import { IRect } from './rect';
|
|
4
|
-
export type { Id, ISize, IRect, };
|
|
1
|
+
import { Id } from './id';
|
|
2
|
+
import { ISize } from './size';
|
|
3
|
+
import { IRect } from './rect';
|
|
4
|
+
export type { Id, ISize, IRect, };
|
package/lib/types/rect.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import { ISize } from "./size";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ISize } from "./size";
|
|
2
|
+
/**
|
|
3
|
+
* Rectangular area interface
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/types/rect.ts
|
|
5
|
+
* @author Evgenii Grebennikov
|
|
6
|
+
* @email djonnyx@gmail.com
|
|
7
|
+
*/
|
|
8
|
+
export interface IRect extends ISize {
|
|
9
|
+
/**
|
|
10
|
+
* X coordinate.
|
|
11
|
+
*/
|
|
12
|
+
x: number;
|
|
13
|
+
/**
|
|
14
|
+
* Y coordinate.
|
|
15
|
+
*/
|
|
16
|
+
y: number;
|
|
17
|
+
}
|
package/lib/types/size.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Area area Interface
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/types/size.ts
|
|
4
|
+
* @author Evgenii Grebennikov
|
|
5
|
+
* @email djonnyx@gmail.com
|
|
6
|
+
*/
|
|
7
|
+
export interface ISize {
|
|
8
|
+
/**
|
|
9
|
+
* Width value.
|
|
10
|
+
*/
|
|
11
|
+
width: number;
|
|
12
|
+
/**
|
|
13
|
+
* Height value.
|
|
14
|
+
*/
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
package/lib/utils/cacheMap.d.ts
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import { EventEmitter } from "./eventEmitter";
|
|
2
|
-
export interface ICacheMap<I = any, B = any> {
|
|
3
|
-
set: (id: I, bounds: B) => Map<I, B>;
|
|
4
|
-
has: (id: I) => boolean;
|
|
5
|
-
get: (id: I) => B | undefined;
|
|
6
|
-
forEach: (callbackfn: (value: B, key: I, map: Map<I, B>) => void, thisArg?: any) => void;
|
|
7
|
-
}
|
|
8
|
-
type CacheMapEvents = 'change';
|
|
9
|
-
type OnChangeEventListener = (version: number) => void;
|
|
10
|
-
type CacheMapListeners = OnChangeEventListener;
|
|
11
|
-
/**
|
|
12
|
-
* Cache map.
|
|
13
|
-
* Emits a change event on each mutation.
|
|
14
|
-
* @
|
|
15
|
-
* @author Evgenii Grebennikov
|
|
16
|
-
* @email djonnyx@gmail.com
|
|
17
|
-
*/
|
|
18
|
-
export declare class CacheMap<I = string | number, B = any, E = CacheMapEvents, L = CacheMapListeners> extends EventEmitter<E, L> implements ICacheMap {
|
|
19
|
-
protected _map: Map<I, B>;
|
|
20
|
-
protected _version: number;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import { EventEmitter, TEventHandler } from "./eventEmitter";
|
|
2
|
+
export interface ICacheMap<I = any, B = any> {
|
|
3
|
+
set: (id: I, bounds: B) => Map<I, B>;
|
|
4
|
+
has: (id: I) => boolean;
|
|
5
|
+
get: (id: I) => B | undefined;
|
|
6
|
+
forEach: (callbackfn: (value: B, key: I, map: Map<I, B>) => void, thisArg?: any) => void;
|
|
7
|
+
}
|
|
8
|
+
declare type CacheMapEvents = 'change';
|
|
9
|
+
declare type OnChangeEventListener = (version: number) => void;
|
|
10
|
+
declare type CacheMapListeners = OnChangeEventListener;
|
|
11
|
+
/**
|
|
12
|
+
* Cache map.
|
|
13
|
+
* Emits a change event on each mutation.
|
|
14
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/utils/cacheMap.ts
|
|
15
|
+
* @author Evgenii Grebennikov
|
|
16
|
+
* @email djonnyx@gmail.com
|
|
17
|
+
*/
|
|
18
|
+
export declare class CacheMap<I = string | number, B = any, E extends string = CacheMapEvents, L extends TEventHandler = CacheMapListeners> extends EventEmitter<E, L> implements ICacheMap {
|
|
19
|
+
protected _map: Map<I, B>;
|
|
20
|
+
protected _version: number;
|
|
21
|
+
protected _previouseFullHeigh: number;
|
|
22
|
+
protected _delta: number;
|
|
23
|
+
get delta(): number;
|
|
24
|
+
get version(): number;
|
|
25
|
+
constructor();
|
|
26
|
+
protected bumpVersion(): void;
|
|
27
|
+
protected fireChange(): void;
|
|
28
|
+
set(id: I, bounds: B): Map<I, B>;
|
|
29
|
+
has(id: I): boolean;
|
|
30
|
+
get(id: I): B | undefined;
|
|
31
|
+
forEach(callbackfn: (value: B, key: I, map: Map<I, B>) => void, thisArg?: any): void;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
package/lib/utils/debounce.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple debounce function.
|
|
3
|
-
* @
|
|
4
|
-
* @author Evgenii Grebennikov
|
|
5
|
-
* @email djonnyx@gmail.com
|
|
6
|
-
*/
|
|
7
|
-
export declare const debounce: (cb: (...args: Array<any>) => void, debounceTime?: number) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Simple debounce function.
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/utils/debounce.ts
|
|
4
|
+
* @author Evgenii Grebennikov
|
|
5
|
+
* @email djonnyx@gmail.com
|
|
6
|
+
*/
|
|
7
|
+
export declare const debounce: (cb: (...args: Array<any>) => void, debounceTime?: number) => {
|
|
8
|
+
/**
|
|
9
|
+
* Call handling method
|
|
10
|
+
*/
|
|
11
|
+
execute: (...args: Array<any>) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Method of destroying handlers
|
|
14
|
+
*/
|
|
15
|
+
dispose: () => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Base disposable component
|
|
6
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/utils/disposableComponent.ts
|
|
7
|
+
* @author Evgenii Grebennikov
|
|
8
|
+
* @email djonnyx@gmail.com
|
|
9
|
+
*/
|
|
10
|
+
export declare class DisposableComponent implements OnDestroy {
|
|
11
|
+
protected _$unsubscribe: Subject<void>;
|
|
12
|
+
ngOnDestroy(): void;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DisposableComponent, never>;
|
|
14
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DisposableComponent, "ng-component", never, {}, {}, never, never, false>;
|
|
15
|
+
}
|
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
export type TEventHandler = (...args: Array<any>) => void;
|
|
2
|
-
/**
|
|
3
|
-
* Simple event emitter
|
|
4
|
-
* @
|
|
5
|
-
* @author Evgenii Grebennikov
|
|
6
|
-
* @email djonnyx@gmail.com
|
|
7
|
-
*/
|
|
8
|
-
export declare class EventEmitter<E =
|
|
9
|
-
private _listeners;
|
|
10
|
-
protected _disposed: boolean;
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* Emits the event
|
|
14
|
-
*/
|
|
15
|
-
dispatch(event: E, ...args: Array<any>): void;
|
|
16
|
-
/**
|
|
17
|
-
* Emits the event async
|
|
18
|
-
*/
|
|
19
|
-
dispatchAsync(event: E, ...args: Array<any>): void;
|
|
20
|
-
/**
|
|
21
|
-
* Returns true if the event listener is already subscribed.
|
|
22
|
-
*/
|
|
23
|
-
hasEventListener(eventName: E, handler: H): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Add event listener
|
|
26
|
-
*/
|
|
27
|
-
addEventListener(eventName: E, handler: H): void;
|
|
28
|
-
/**
|
|
29
|
-
* Remove event listener
|
|
30
|
-
*/
|
|
31
|
-
removeEventListener(eventName: E, handler: H): void;
|
|
32
|
-
/**
|
|
33
|
-
* Remove all listeners
|
|
34
|
-
*/
|
|
35
|
-
removeAllListeners(): void;
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
export declare type TEventHandler = (...args: Array<any>) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Simple event emitter
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/utils/eventEmitter.ts
|
|
5
|
+
* @author Evgenii Grebennikov
|
|
6
|
+
* @email djonnyx@gmail.com
|
|
7
|
+
*/
|
|
8
|
+
export declare class EventEmitter<E extends string = any, H extends TEventHandler = any> {
|
|
9
|
+
private _listeners;
|
|
10
|
+
protected _disposed: boolean;
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Emits the event
|
|
14
|
+
*/
|
|
15
|
+
dispatch(event: E, ...args: Array<any>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Emits the event async
|
|
18
|
+
*/
|
|
19
|
+
dispatchAsync(event: E, ...args: Array<any>): void;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if the event listener is already subscribed.
|
|
22
|
+
*/
|
|
23
|
+
hasEventListener(eventName: E, handler: H): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Add event listener
|
|
26
|
+
*/
|
|
27
|
+
addEventListener(eventName: E, handler: H): void;
|
|
28
|
+
/**
|
|
29
|
+
* Remove event listener
|
|
30
|
+
*/
|
|
31
|
+
removeEventListener(eventName: E, handler: H): void;
|
|
32
|
+
/**
|
|
33
|
+
* Remove all listeners
|
|
34
|
+
*/
|
|
35
|
+
removeAllListeners(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Method of destroying handlers
|
|
38
|
+
*/
|
|
39
|
+
dispose(): void;
|
|
40
|
+
}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { isDirection } from "./isDirection";
|
|
2
|
-
import { debounce } from "./debounce";
|
|
3
|
-
import { toggleClassName } from './toggleClassName';
|
|
4
|
-
import { Tracker } from "./tracker";
|
|
5
|
-
import { TrackBox } from "./trackBox";
|
|
6
|
-
|
|
1
|
+
import { isDirection } from "./isDirection";
|
|
2
|
+
import { debounce } from "./debounce";
|
|
3
|
+
import { toggleClassName } from './toggleClassName';
|
|
4
|
+
import { Tracker } from "./tracker";
|
|
5
|
+
import { TrackBox } from "./trackBox";
|
|
6
|
+
import { DisposableComponent } from './disposableComponent';
|
|
7
|
+
export { DisposableComponent, debounce, isDirection, toggleClassName, TrackBox, Tracker, };
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import { Direction } from "../enums";
|
|
2
|
-
|
|
1
|
+
import { Direction } from "../enums";
|
|
2
|
+
/**
|
|
3
|
+
* Determines the axis membership of a virtual list
|
|
4
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/utils/isDirection.ts
|
|
5
|
+
* @author Evgenii Grebennikov
|
|
6
|
+
* @email djonnyx@gmail.com
|
|
7
|
+
*/
|
|
8
|
+
export declare const isDirection: (src: Direction, expected: Direction) => boolean;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Switch css classes
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/utils/toggleClassName.ts
|
|
4
|
+
* @author Evgenii Grebennikov
|
|
5
|
+
* @email djonnyx@gmail.com
|
|
6
|
+
*/
|
|
7
|
+
export declare const toggleClassName: (el: HTMLElement, className: string, remove?: boolean) => void;
|