ng-virtual-list 20.0.0 → 20.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 +10 -0
- package/package.json +3 -2
- package/lib/components/ng-virtual-list-item.component.d.ts +0 -28
- package/lib/const/index.d.ts +0 -32
- package/lib/enums/direction.d.ts +0 -8
- package/lib/enums/directions.d.ts +0 -16
- package/lib/enums/index.d.ts +0 -4
- package/lib/models/collection.model.d.ts +0 -9
- package/lib/models/index.d.ts +0 -4
- package/lib/models/item.model.d.ts +0 -14
- package/lib/models/render-collection.model.d.ts +0 -9
- package/lib/models/render-item-config.model.d.ts +0 -33
- package/lib/models/render-item.model.d.ts +0 -28
- package/lib/models/sticky-map.model.d.ts +0 -12
- package/lib/ng-virtual-list.component.d.ts +0 -122
- package/lib/types/id.d.ts +0 -7
- package/lib/types/index.d.ts +0 -4
- package/lib/types/rect.d.ts +0 -17
- package/lib/types/size.d.ts +0 -16
- package/lib/utils/cacheMap.d.ts +0 -34
- package/lib/utils/debounce.d.ts +0 -16
- package/lib/utils/eventEmitter.d.ts +0 -40
- package/lib/utils/index.d.ts +0 -6
- package/lib/utils/isDirection.d.ts +0 -8
- package/lib/utils/toggleClassName.d.ts +0 -7
- package/lib/utils/trackBox.d.ts +0 -113
- package/lib/utils/tracker.d.ts +0 -38
- package/public-api.d.ts +0 -3
package/README.md
CHANGED
|
@@ -468,3 +468,13 @@ Methods
|
|
|
468
468
|
| Method | Type | Description |
|
|
469
469
|
|--|--|--|
|
|
470
470
|
| scrollTo | (id: [Id](https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/types/id.ts), behavior: ScrollBehavior = 'auto') => number | The method scrolls the list to the element with the given id and returns the value of the scrolled area. Behavior accepts the values "auto", "instant" and "smooth". |
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
## Latest versions
|
|
474
|
+
|
|
475
|
+
| Angular version | ng-virtual-list version | git | npm |
|
|
476
|
+
|--|--|--|--|
|
|
477
|
+
| 19.x | 19.1.1 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.1.11](https://www.npmjs.com/package/ng-virtual-list/v/19.1.11) |
|
|
478
|
+
| 18.x | 18.0.3 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.0.3](https://www.npmjs.com/package/ng-virtual-list/v/18.0.3) |
|
|
479
|
+
| 17.x | 17.0.0 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.0.0](https://www.npmjs.com/package/ng-virtual-list/v/17.0.0) |
|
|
480
|
+
| 16.x | 16.0.1 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.0.1](https://www.npmjs.com/package/ng-virtual-list/v/16.0.1) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-virtual-list",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Evgenii Grebennikov",
|
|
6
6
|
"email": "djonnyx@gmail.com"
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"group",
|
|
17
17
|
"grouped",
|
|
18
18
|
"scroll",
|
|
19
|
-
"scrolling"
|
|
19
|
+
"scrolling",
|
|
20
|
+
"scroller"
|
|
20
21
|
],
|
|
21
22
|
"peerDependencies": {
|
|
22
23
|
"@angular/common": "^20.0.4",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { TemplateRef } from '@angular/core';
|
|
2
|
-
import { IRenderVirtualListItem } from '../models/render-item.model';
|
|
3
|
-
import { IRect } from '../types';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
/**
|
|
6
|
-
* Virtual list item component
|
|
7
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/components/ng-virtual-list-item.component.ts
|
|
8
|
-
* @author Evgenii Grebennikov
|
|
9
|
-
* @email djonnyx@gmail.com
|
|
10
|
-
*/
|
|
11
|
-
export declare class NgVirtualListItemComponent {
|
|
12
|
-
private static __nextId;
|
|
13
|
-
private _id;
|
|
14
|
-
get id(): number;
|
|
15
|
-
data: import("@angular/core").WritableSignal<IRenderVirtualListItem | undefined>;
|
|
16
|
-
private _data;
|
|
17
|
-
set item(v: IRenderVirtualListItem | undefined);
|
|
18
|
-
get itemId(): import("ng-virtual-list").Id | undefined;
|
|
19
|
-
itemRenderer: import("@angular/core").WritableSignal<TemplateRef<any> | undefined>;
|
|
20
|
-
set renderer(v: TemplateRef<any> | undefined);
|
|
21
|
-
private _elementRef;
|
|
22
|
-
constructor();
|
|
23
|
-
getBounds(): IRect;
|
|
24
|
-
showIfNeed(): void;
|
|
25
|
-
hide(): void;
|
|
26
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListItemComponent, never>;
|
|
27
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListItemComponent, "ng-virtual-list-item", never, {}, {}, never, never, true, never>;
|
|
28
|
-
}
|
package/lib/const/index.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Directions } from "../enums/directions";
|
|
2
|
-
export declare const DEFAULT_ITEM_SIZE = 24;
|
|
3
|
-
export declare const DEFAULT_ITEMS_OFFSET = 2;
|
|
4
|
-
export declare const DEFAULT_LIST_SIZE = 400;
|
|
5
|
-
export declare const DEFAULT_SNAP = false;
|
|
6
|
-
export declare const DEFAULT_SNAP_TO_ITEM = false;
|
|
7
|
-
export declare const DEFAULT_DYNAMIC_SIZE = false;
|
|
8
|
-
export declare const TRACK_BY_PROPERTY_NAME = "id";
|
|
9
|
-
export declare const DEFAULT_DIRECTION = Directions.VERTICAL;
|
|
10
|
-
export declare const DISPLAY_OBJECTS_LENGTH_MESUREMENT_ERROR = 1;
|
|
11
|
-
export declare const BEHAVIOR_AUTO = "auto";
|
|
12
|
-
export declare const BEHAVIOR_INSTANT = "instant";
|
|
13
|
-
export declare const BEHAVIOR_SMOOTH = "smooth";
|
|
14
|
-
export declare const VISIBILITY_VISIBLE = "visible";
|
|
15
|
-
export declare const VISIBILITY_HIDDEN = "hidden";
|
|
16
|
-
export declare const SIZE_100_PERSENT = "100%";
|
|
17
|
-
export declare const SIZE_AUTO = "auto";
|
|
18
|
-
export declare const POSITION_ABSOLUTE = "absolute";
|
|
19
|
-
export declare const POSITION_STICKY = "sticky";
|
|
20
|
-
export declare const TRANSLATE_3D = "translate3d";
|
|
21
|
-
export declare const ZEROS_TRANSLATE_3D = "translate3d(0,0,0)";
|
|
22
|
-
export declare const TOP_PROP_NAME = "top";
|
|
23
|
-
export declare const LEFT_PROP_NAME = "left";
|
|
24
|
-
export declare const X_PROP_NAME = "x";
|
|
25
|
-
export declare const Y_PROP_NAME = "y";
|
|
26
|
-
export declare const WIDTH_PROP_NAME = "width";
|
|
27
|
-
export declare const HEIGHT_PROP_NAME = "height";
|
|
28
|
-
export declare const PX = "px";
|
|
29
|
-
export declare const SCROLL = "scroll";
|
|
30
|
-
export declare const SCROLL_END = "scrollend";
|
|
31
|
-
export declare const CLASS_LIST_VERTICAL = "vertical";
|
|
32
|
-
export declare const CLASS_LIST_HORIZONTAL = "horizontal";
|
package/lib/enums/direction.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Directions } from "./directions";
|
|
2
|
-
/**
|
|
3
|
-
* Axis of the arrangement of virtual list elements.
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/enums/direction.ts
|
|
5
|
-
* @author Evgenii Grebennikov
|
|
6
|
-
* @email djonnyx@gmail.com
|
|
7
|
-
*/
|
|
8
|
-
export type Direction = Directions | 'hotizontal' | 'vertical';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Axis of the arrangement of virtual list elements.
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/enums/directions.ts
|
|
4
|
-
* @author Evgenii Grebennikov
|
|
5
|
-
* @email djonnyx@gmail.com
|
|
6
|
-
*/
|
|
7
|
-
export declare enum Directions {
|
|
8
|
-
/**
|
|
9
|
-
* Horizontal axis.
|
|
10
|
-
*/
|
|
11
|
-
HORIZONTAL = "horizontal",
|
|
12
|
-
/**
|
|
13
|
-
* Vertical axis.
|
|
14
|
-
*/
|
|
15
|
-
VERTICAL = "vertical"
|
|
16
|
-
}
|
package/lib/enums/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IVirtualListItem } from "./item.model";
|
|
2
|
-
/**
|
|
3
|
-
* Virtual list elements collection interface
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/models/collection.model.ts
|
|
5
|
-
* @author Evgenii Grebennikov
|
|
6
|
-
* @email djonnyx@gmail.com
|
|
7
|
-
*/
|
|
8
|
-
export interface IVirtualListCollection extends Array<IVirtualListItem> {
|
|
9
|
-
}
|
package/lib/models/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Id } from "../types/id";
|
|
2
|
-
/**
|
|
3
|
-
* Virtual list element model
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/models/item.model.ts
|
|
5
|
-
* @author Evgenii Grebennikov
|
|
6
|
-
* @email djonnyx@gmail.com
|
|
7
|
-
*/
|
|
8
|
-
export interface IVirtualListItem {
|
|
9
|
-
/**
|
|
10
|
-
* Unique identifier of the element.
|
|
11
|
-
*/
|
|
12
|
-
id: Id;
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IRenderVirtualListItem } from "./render-item.model";
|
|
2
|
-
/**
|
|
3
|
-
* Virtual list screen elements collection interface
|
|
4
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/models/render-collection.model.ts
|
|
5
|
-
* @author Evgenii Grebennikov
|
|
6
|
-
* @email djonnyx@gmail.com
|
|
7
|
-
*/
|
|
8
|
-
export interface IRenderVirtualListCollection extends Array<IRenderVirtualListItem> {
|
|
9
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Object with configuration parameters for IRenderVirtualListItem
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/models/render-item-config.model.ts
|
|
4
|
-
* @author Evgenii Grebennikov
|
|
5
|
-
* @email djonnyx@gmail.com
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export interface IRenderVirtualListItemConfig {
|
|
9
|
-
/**
|
|
10
|
-
* If greater than 0, the element will have a sticky position with the given zIndex.
|
|
11
|
-
*/
|
|
12
|
-
sticky: number;
|
|
13
|
-
/**
|
|
14
|
-
* Specifies whether the element will snap.
|
|
15
|
-
*/
|
|
16
|
-
snap: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Indicates that the element is snapped.
|
|
19
|
-
*/
|
|
20
|
-
snapped: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Indicates that the element is being shifted by another snap element.
|
|
23
|
-
*/
|
|
24
|
-
snappedOut: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Indicates that the element is a vertical list item.
|
|
27
|
-
*/
|
|
28
|
-
isVertical: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Specifies that the element adapts to the size of its content.
|
|
31
|
-
*/
|
|
32
|
-
dynamic: boolean;
|
|
33
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { IRect } from "../types";
|
|
2
|
-
import { Id } from "../types/id";
|
|
3
|
-
import { IVirtualListItem } from "./item.model";
|
|
4
|
-
import { IRenderVirtualListItemConfig } from "./render-item-config.model";
|
|
5
|
-
/**
|
|
6
|
-
* List screen element model
|
|
7
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/models/render-item.model.ts
|
|
8
|
-
* @author Evgenii Grebennikov
|
|
9
|
-
* @email djonnyx@gmail.com
|
|
10
|
-
*/
|
|
11
|
-
export interface IRenderVirtualListItem {
|
|
12
|
-
/**
|
|
13
|
-
* Unique identifier of the element.
|
|
14
|
-
*/
|
|
15
|
-
id: Id;
|
|
16
|
-
/**
|
|
17
|
-
* Element metrics.
|
|
18
|
-
*/
|
|
19
|
-
measures: IRect;
|
|
20
|
-
/**
|
|
21
|
-
* Element data.
|
|
22
|
-
*/
|
|
23
|
-
data: IVirtualListItem;
|
|
24
|
-
/**
|
|
25
|
-
* Object with configuration parameters for IRenderVirtualListItem.
|
|
26
|
-
*/
|
|
27
|
-
config: IRenderVirtualListItemConfig;
|
|
28
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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,122 +0,0 @@
|
|
|
1
|
-
import { AfterViewInit, ComponentRef, ElementRef, OnDestroy, TemplateRef, ViewContainerRef, WritableSignal } from '@angular/core';
|
|
2
|
-
import { 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 * as i0 from "@angular/core";
|
|
8
|
-
/**
|
|
9
|
-
* Virtual list component.
|
|
10
|
-
* Maximum performance for extremely large lists.
|
|
11
|
-
* It is based on algorithms for virtualization of screen objects.
|
|
12
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/main/projects/ng-virtual-list/src/lib/ng-virtual-list.component.ts
|
|
13
|
-
* @author Evgenii Grebennikov
|
|
14
|
-
* @email djonnyx@gmail.com
|
|
15
|
-
*/
|
|
16
|
-
export declare class NgVirtualListComponent implements AfterViewInit, OnDestroy {
|
|
17
|
-
private static __nextId;
|
|
18
|
-
private _id;
|
|
19
|
-
/**
|
|
20
|
-
* Readonly. Returns the unique identifier of the component.
|
|
21
|
-
*/
|
|
22
|
-
get id(): number;
|
|
23
|
-
protected _listContainerRef: ViewContainerRef | undefined;
|
|
24
|
-
protected _container: import("@angular/core").Signal<ElementRef<HTMLDivElement> | undefined>;
|
|
25
|
-
protected _list: import("@angular/core").Signal<ElementRef<HTMLUListElement> | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* Fires when the list has been scrolled.
|
|
28
|
-
*/
|
|
29
|
-
onScroll: import("@angular/core").OutputEmitterRef<number>;
|
|
30
|
-
/**
|
|
31
|
-
* Fires when the list has completed scrolling.
|
|
32
|
-
*/
|
|
33
|
-
onScrollEnd: import("@angular/core").OutputEmitterRef<number>;
|
|
34
|
-
/**
|
|
35
|
-
* Collection of list items.
|
|
36
|
-
*/
|
|
37
|
-
items: import("@angular/core").InputSignal<IVirtualListCollection>;
|
|
38
|
-
/**
|
|
39
|
-
* Determines whether elements will snap. Default value is "true".
|
|
40
|
-
*/
|
|
41
|
-
snap: import("@angular/core").InputSignal<boolean>;
|
|
42
|
-
/**
|
|
43
|
-
* Determines whether scroll positions will be snapped to the element. Default value is "false".
|
|
44
|
-
*/
|
|
45
|
-
snapToItem: import("@angular/core").InputSignal<boolean>;
|
|
46
|
-
/**
|
|
47
|
-
* Rendering element template.
|
|
48
|
-
*/
|
|
49
|
-
itemRenderer: import("@angular/core").InputSignal<TemplateRef<any>>;
|
|
50
|
-
/**
|
|
51
|
-
* Dictionary zIndex by id of the list element. If the value is not set or equal to 0,
|
|
52
|
-
* then a simple element is displayed, if the value is greater than 0, then the sticky position mode is enabled for the element.
|
|
53
|
-
*/
|
|
54
|
-
stickyMap: import("@angular/core").InputSignal<IVirtualListStickyMap>;
|
|
55
|
-
private _itemSizeOptions;
|
|
56
|
-
/**
|
|
57
|
-
* If direction = 'vertical', then the height of a typical element. If direction = 'horizontal', then the width of a typical element.
|
|
58
|
-
* Ignored if the dynamicSize property is true.
|
|
59
|
-
*/
|
|
60
|
-
itemSize: import("@angular/core").InputSignal<number>;
|
|
61
|
-
/**
|
|
62
|
-
* If true then the items in the list can have different sizes and the itemSize property is ignored.
|
|
63
|
-
* If false then the items in the list have a fixed size specified by the itemSize property. The default value is false.
|
|
64
|
-
*/
|
|
65
|
-
dynamicSize: import("@angular/core").InputSignal<boolean>;
|
|
66
|
-
/**
|
|
67
|
-
* Determines the direction in which elements are placed. Default value is "vertical".
|
|
68
|
-
*/
|
|
69
|
-
direction: import("@angular/core").InputSignal<Direction>;
|
|
70
|
-
/**
|
|
71
|
-
* Number of elements outside the scope of visibility. Default value is 2.
|
|
72
|
-
*/
|
|
73
|
-
itemsOffset: import("@angular/core").InputSignal<number>;
|
|
74
|
-
private _scrollToTimeout;
|
|
75
|
-
private _isVertical;
|
|
76
|
-
protected _displayComponents: Array<ComponentRef<NgVirtualListItemComponent>>;
|
|
77
|
-
protected _bounds: WritableSignal<DOMRect | null>;
|
|
78
|
-
protected _scrollSize: WritableSignal<number>;
|
|
79
|
-
private _resizeObserver;
|
|
80
|
-
/**
|
|
81
|
-
* only dynamic
|
|
82
|
-
*/
|
|
83
|
-
private _scrolledItemId;
|
|
84
|
-
private _onResizeHandler;
|
|
85
|
-
private _scrollDirection;
|
|
86
|
-
private _onScrollHandler;
|
|
87
|
-
private scrollImmediately;
|
|
88
|
-
private _scrollImmediatelyHandler;
|
|
89
|
-
private clearScrollImmediately;
|
|
90
|
-
private _onScrollEndHandler;
|
|
91
|
-
private _elementRef;
|
|
92
|
-
private _initialized;
|
|
93
|
-
readonly $initialized: Observable<boolean>;
|
|
94
|
-
/**
|
|
95
|
-
* Dictionary of element sizes by their id
|
|
96
|
-
*/
|
|
97
|
-
private _trackBox;
|
|
98
|
-
private _onTrackBoxChangeHandler;
|
|
99
|
-
private _$cacheVersion;
|
|
100
|
-
get $cacheVersion(): Observable<number>;
|
|
101
|
-
constructor();
|
|
102
|
-
ngOnInit(): void;
|
|
103
|
-
private listenCacheChangesIfNeed;
|
|
104
|
-
private getIsVertical;
|
|
105
|
-
private createDisplayComponentsIfNeed;
|
|
106
|
-
private resetRenderers;
|
|
107
|
-
/**
|
|
108
|
-
* Tracking by id
|
|
109
|
-
*/
|
|
110
|
-
protected tracking(): void;
|
|
111
|
-
private resetBoundsSize;
|
|
112
|
-
/**
|
|
113
|
-
* The method scrolls the list to the element with the given id and returns the value of the scrolled area.
|
|
114
|
-
* Behavior accepts the values "auto", "instant" and "smooth".
|
|
115
|
-
*/
|
|
116
|
-
scrollTo(id: Id, behavior?: ScrollBehavior): void;
|
|
117
|
-
scrollToEnd(behavior?: ScrollBehavior): void;
|
|
118
|
-
ngAfterViewInit(): void;
|
|
119
|
-
ngOnDestroy(): void;
|
|
120
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListComponent, never>;
|
|
121
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": { "alias": "items"; "required": true; "isSignal": true; }; "snap": { "alias": "snap"; "required": false; "isSignal": true; }; "snapToItem": { "alias": "snapToItem"; "required": false; "isSignal": true; }; "itemRenderer": { "alias": "itemRenderer"; "required": true; "isSignal": true; }; "stickyMap": { "alias": "stickyMap"; "required": false; "isSignal": true; }; "itemSize": { "alias": "itemSize"; "required": false; "isSignal": true; }; "dynamicSize": { "alias": "dynamicSize"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "itemsOffset": { "alias": "itemsOffset"; "required": false; "isSignal": true; }; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; }, never, never, true, never>;
|
|
122
|
-
}
|
package/lib/types/id.d.ts
DELETED
package/lib/types/index.d.ts
DELETED
package/lib/types/rect.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
* @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 = CacheMapEvents, L = 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
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export 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 = string, H = TEventHandler> {
|
|
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
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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
|
-
export { isDirection, debounce, toggleClassName, TrackBox, Tracker, };
|
|
@@ -1,8 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
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;
|
package/lib/utils/trackBox.d.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
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 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
|
-
type CacheMapEvents = typeof TRACK_BOX_CHANGE_EVENT_NAME;
|
|
59
|
-
type OnChangeEventListener = (version: number) => void;
|
|
60
|
-
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
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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/public-api.d.ts
DELETED