ng-virtual-list 14.2.0 → 14.3.1
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 +4 -4
- package/esm2020/lib/components/ng-virtual-list-item.component.mjs +5 -3
- package/esm2020/lib/enums/direction.mjs +1 -1
- package/esm2020/lib/models/base-virtual-list-item-component.mjs +9 -0
- package/esm2020/lib/models/collection.model.mjs +1 -1
- package/esm2020/lib/models/component.model.mjs +2 -0
- package/esm2020/lib/models/index.mjs +3 -2
- package/esm2020/lib/models/item.model.mjs +1 -2
- package/esm2020/lib/ng-virtual-list.component.mjs +30 -8
- package/esm2020/lib/utils/index.mjs +4 -3
- package/esm2020/lib/utils/trackBox.mjs +6 -3
- package/esm2020/lib/utils/tracker.mjs +1 -1
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/ng-virtual-list.mjs +45 -10
- package/fesm2015/ng-virtual-list.mjs.map +1 -1
- package/fesm2020/ng-virtual-list.mjs +45 -10
- package/fesm2020/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +7 -6
- package/lib/enums/direction.d.ts +1 -1
- package/lib/models/base-virtual-list-item-component.d.ts +25 -0
- package/lib/models/collection.model.d.ts +1 -1
- package/lib/models/component.model.d.ts +3 -0
- package/lib/models/index.d.ts +4 -1
- package/lib/models/item.model.d.ts +2 -2
- package/lib/ng-virtual-list.component.d.ts +58 -44
- package/lib/utils/index.d.ts +4 -2
- package/lib/utils/trackBox.d.ts +30 -22
- package/lib/utils/tracker.d.ts +7 -5
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -1,6 +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
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
/**
|
|
6
7
|
* Virtual list item component
|
|
@@ -8,16 +9,16 @@ import * as i0 from "@angular/core";
|
|
|
8
9
|
* @author Evgenii Grebennikov
|
|
9
10
|
* @email djonnyx@gmail.com
|
|
10
11
|
*/
|
|
11
|
-
export declare class NgVirtualListItemComponent {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export declare class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
13
|
+
protected _cdr: ChangeDetectorRef;
|
|
14
|
+
protected _elementRef: ElementRef<HTMLElement>;
|
|
15
|
+
protected static __nextId: number;
|
|
16
|
+
protected _id: number;
|
|
16
17
|
get id(): number;
|
|
17
18
|
regular: boolean;
|
|
18
19
|
data: IRenderVirtualListItem | undefined;
|
|
19
20
|
set item(v: IRenderVirtualListItem | undefined);
|
|
20
|
-
|
|
21
|
+
protected _regularLength: string;
|
|
21
22
|
set regularLength(v: string);
|
|
22
23
|
get item(): IRenderVirtualListItem | undefined;
|
|
23
24
|
get itemId(): import("../types").Id | undefined;
|
package/lib/enums/direction.d.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import { Id, ISize } from '../types';
|
|
3
|
+
import { IRenderVirtualListItem } from './render-item.model';
|
|
4
|
+
/**
|
|
5
|
+
* Virtual List Item Interface
|
|
6
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/base-virtual-list-item-component.ts
|
|
7
|
+
* @author Evgenii Grebennikov
|
|
8
|
+
* @email djonnyx@gmail.com
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class BaseVirtualListItemComponent {
|
|
11
|
+
abstract get id(): number;
|
|
12
|
+
abstract data: IRenderVirtualListItem | undefined;
|
|
13
|
+
abstract regular: boolean;
|
|
14
|
+
abstract set regularLength(v: string);
|
|
15
|
+
abstract set item(v: IRenderVirtualListItem | null | undefined);
|
|
16
|
+
abstract get item(): IRenderVirtualListItem | null | undefined;
|
|
17
|
+
abstract get itemId(): Id | undefined;
|
|
18
|
+
abstract itemRenderer: TemplateRef<any> | undefined;
|
|
19
|
+
abstract set renderer(v: TemplateRef<any> | undefined);
|
|
20
|
+
abstract get element(): HTMLElement;
|
|
21
|
+
protected abstract update(): void;
|
|
22
|
+
abstract getBounds(): ISize;
|
|
23
|
+
abstract show(): void;
|
|
24
|
+
abstract hide(): void;
|
|
25
|
+
}
|
|
@@ -5,5 +5,5 @@ import { IVirtualListItem } from "./item.model";
|
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|
|
8
|
-
export interface IVirtualListCollection extends Array<IVirtualListItem
|
|
8
|
+
export interface IVirtualListCollection<E = Object> extends Array<IVirtualListItem<E>> {
|
|
9
9
|
}
|
package/lib/models/index.d.ts
CHANGED
|
@@ -3,4 +3,7 @@ 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
|
-
|
|
6
|
+
import { BaseVirtualListItemComponent } from './base-virtual-list-item-component';
|
|
7
|
+
import { Component$1 } from './component.model';
|
|
8
|
+
export type { ScrollDirection, IScrollEvent, IVirtualListItem, IVirtualListStickyMap, IVirtualListCollection, Component$1, };
|
|
9
|
+
export { BaseVirtualListItemComponent, };
|
|
@@ -5,10 +5,10 @@ import { Id } from "../types/id";
|
|
|
5
5
|
* @author Evgenii Grebennikov
|
|
6
6
|
* @email djonnyx@gmail.com
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare type IVirtualListItem<E = Object> = E & {
|
|
9
9
|
/**
|
|
10
10
|
* Unique identifier of the element.
|
|
11
11
|
*/
|
|
12
12
|
id: Id;
|
|
13
13
|
[x: string]: any;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AfterViewInit, ChangeDetectorRef, ComponentRef, ElementRef, EventEmitter, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
4
|
-
import { IScrollEvent, IVirtualListCollection, IVirtualListStickyMap } from './models';
|
|
3
|
+
import { BaseVirtualListItemComponent, Component$1, IScrollEvent, IVirtualListCollection, IVirtualListStickyMap } from './models';
|
|
5
4
|
import { Id, ISize } from './types';
|
|
5
|
+
import { IRenderVirtualListCollection } from './models/render-collection.model';
|
|
6
6
|
import { Direction, SnappingMethod } from './enums';
|
|
7
|
+
import { TrackBox } from './utils';
|
|
7
8
|
import { DisposableComponent } from './utils/disposableComponent';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
10
|
/**
|
|
@@ -15,10 +16,10 @@ import * as i0 from "@angular/core";
|
|
|
15
16
|
* @email djonnyx@gmail.com
|
|
16
17
|
*/
|
|
17
18
|
export declare class NgVirtualListComponent extends DisposableComponent implements AfterViewInit, OnInit, OnDestroy {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
protected _cdr: ChangeDetectorRef;
|
|
20
|
+
protected _elementRef: ElementRef<HTMLDivElement>;
|
|
21
|
+
protected static __nextId: number;
|
|
22
|
+
protected _id: number;
|
|
22
23
|
/**
|
|
23
24
|
* Readonly. Returns the unique identifier of the component.
|
|
24
25
|
*/
|
|
@@ -36,22 +37,22 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
36
37
|
* Fires when the list has completed scrolling.
|
|
37
38
|
*/
|
|
38
39
|
onScrollEnd: EventEmitter<IScrollEvent>;
|
|
39
|
-
|
|
40
|
-
readonly $items: Observable<IVirtualListCollection | undefined>;
|
|
41
|
-
|
|
40
|
+
protected _$items: BehaviorSubject<IVirtualListCollection<Object> | undefined>;
|
|
41
|
+
readonly $items: Observable<IVirtualListCollection<Object> | undefined>;
|
|
42
|
+
protected _itemsTransform: (v: IVirtualListCollection | undefined) => IVirtualListCollection<Object> | undefined;
|
|
42
43
|
/**
|
|
43
44
|
* Collection of list items.
|
|
44
45
|
*/
|
|
45
46
|
set items(v: IVirtualListCollection);
|
|
46
47
|
get items(): IVirtualListCollection;
|
|
47
|
-
|
|
48
|
+
protected _$snap: BehaviorSubject<boolean>;
|
|
48
49
|
readonly $snap: Observable<boolean>;
|
|
49
50
|
/**
|
|
50
51
|
* Determines whether elements will snap. Default value is "true".
|
|
51
52
|
*/
|
|
52
53
|
set snap(v: boolean);
|
|
53
54
|
get snap(): boolean;
|
|
54
|
-
|
|
55
|
+
protected _$enabledBufferOptimization: BehaviorSubject<boolean>;
|
|
55
56
|
readonly $enabledBufferOptimization: Observable<boolean>;
|
|
56
57
|
/**
|
|
57
58
|
* Experimental!
|
|
@@ -61,14 +62,15 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
61
62
|
*/
|
|
62
63
|
set enabledBufferOptimization(v: boolean);
|
|
63
64
|
get enabledBufferOptimization(): boolean;
|
|
64
|
-
|
|
65
|
+
protected _$itemRenderer: BehaviorSubject<TemplateRef<any> | undefined>;
|
|
65
66
|
readonly $itemRenderer: Observable<TemplateRef<any> | undefined>;
|
|
67
|
+
protected _$renderer: BehaviorSubject<TemplateRef<any> | undefined>;
|
|
66
68
|
/**
|
|
67
69
|
* Rendering element template.
|
|
68
70
|
*/
|
|
69
71
|
set itemRenderer(v: TemplateRef<any>);
|
|
70
72
|
get itemRenderer(): TemplateRef<any>;
|
|
71
|
-
|
|
73
|
+
protected _$stickyMap: BehaviorSubject<IVirtualListStickyMap>;
|
|
72
74
|
readonly $stickyMap: Observable<IVirtualListStickyMap>;
|
|
73
75
|
/**
|
|
74
76
|
* Dictionary zIndex by id of the list element. If the value is not set or equal to 0,
|
|
@@ -76,8 +78,8 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
76
78
|
*/
|
|
77
79
|
set stickyMap(v: IVirtualListStickyMap);
|
|
78
80
|
get stickyMap(): IVirtualListStickyMap;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
protected _itemSizeOptions: (v: number | undefined) => number;
|
|
82
|
+
protected _$itemSize: BehaviorSubject<number>;
|
|
81
83
|
readonly $itemSize: Observable<number>;
|
|
82
84
|
/**
|
|
83
85
|
* If direction = 'vertical', then the height of a typical element. If direction = 'horizontal', then the width of a typical element.
|
|
@@ -85,7 +87,7 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
85
87
|
*/
|
|
86
88
|
set itemSize(v: number);
|
|
87
89
|
get itemSize(): number;
|
|
88
|
-
|
|
90
|
+
protected _$dynamicSize: BehaviorSubject<boolean>;
|
|
89
91
|
readonly $dynamicSize: Observable<boolean>;
|
|
90
92
|
/**
|
|
91
93
|
* If true then the items in the list can have different sizes and the itemSize property is ignored.
|
|
@@ -93,29 +95,29 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
93
95
|
*/
|
|
94
96
|
set dynamicSize(v: boolean);
|
|
95
97
|
get dynamicSize(): boolean;
|
|
96
|
-
|
|
98
|
+
protected _$direction: BehaviorSubject<Direction>;
|
|
97
99
|
readonly $direction: Observable<Direction>;
|
|
98
100
|
/**
|
|
99
101
|
* Determines the direction in which elements are placed. Default value is "vertical".
|
|
100
102
|
*/
|
|
101
103
|
set direction(v: Direction);
|
|
102
104
|
get direction(): Direction;
|
|
103
|
-
|
|
105
|
+
protected _$itemsOffset: BehaviorSubject<number>;
|
|
104
106
|
readonly $itemsOffset: Observable<number>;
|
|
105
107
|
/**
|
|
106
108
|
* Number of elements outside the scope of visibility. Default value is 2.
|
|
107
109
|
*/
|
|
108
110
|
set itemsOffset(v: number);
|
|
109
111
|
get itemsOffset(): number;
|
|
110
|
-
|
|
112
|
+
protected _$trackBy: BehaviorSubject<string>;
|
|
111
113
|
readonly $trackBy: Observable<string>;
|
|
112
114
|
/**
|
|
113
115
|
* The name of the property by which tracking is performed
|
|
114
116
|
*/
|
|
115
117
|
set trackBy(v: string);
|
|
116
118
|
get trackBy(): string;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
protected _isVertical: boolean;
|
|
120
|
+
protected _$snappingMethod: BehaviorSubject<SnappingMethod>;
|
|
119
121
|
readonly $snappingMethod: Observable<SnappingMethod>;
|
|
120
122
|
/**
|
|
121
123
|
* Snapping method.
|
|
@@ -126,37 +128,47 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
126
128
|
get snappingMethod(): SnappingMethod;
|
|
127
129
|
protected _isSnappingMethodAdvanced: boolean;
|
|
128
130
|
get isSnappingMethodAdvanced(): boolean;
|
|
129
|
-
protected _displayComponents: Array<ComponentRef<
|
|
130
|
-
protected _snapedDisplayComponent: ComponentRef<
|
|
131
|
+
protected _displayComponents: Array<ComponentRef<BaseVirtualListItemComponent>>;
|
|
132
|
+
protected _snapedDisplayComponent: ComponentRef<BaseVirtualListItemComponent> | undefined;
|
|
131
133
|
protected _$bounds: BehaviorSubject<ISize | null>;
|
|
132
134
|
protected _$scrollSize: BehaviorSubject<number>;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
protected _resizeObserver: ResizeObserver | null;
|
|
136
|
+
protected _resizeSnappedComponentHandler: () => void;
|
|
137
|
+
protected _resizeSnappedObserver: ResizeObserver | null;
|
|
138
|
+
protected _onResizeHandler: () => void;
|
|
139
|
+
protected _onScrollHandler: (e?: Event) => void;
|
|
140
|
+
protected _$initialized: BehaviorSubject<boolean>;
|
|
139
141
|
readonly $initialized: Observable<boolean>;
|
|
142
|
+
/**
|
|
143
|
+
* Base class of the element component
|
|
144
|
+
*/
|
|
145
|
+
protected _itemComponentClass: Component$1<BaseVirtualListItemComponent>;
|
|
146
|
+
/**
|
|
147
|
+
* Base class trackBox
|
|
148
|
+
*/
|
|
149
|
+
protected _trackBoxClass: Component$1<TrackBox>;
|
|
140
150
|
/**
|
|
141
151
|
* Dictionary of element sizes by their id
|
|
142
152
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
153
|
+
protected _trackBox: TrackBox;
|
|
154
|
+
protected _onTrackBoxChangeHandler: (v: number) => void;
|
|
155
|
+
protected _$cacheVersion: BehaviorSubject<number>;
|
|
146
156
|
get $cacheVersion(): Observable<number>;
|
|
147
157
|
constructor(_cdr: ChangeDetectorRef, _elementRef: ElementRef<HTMLDivElement>);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
158
|
+
protected setupRenderer(): void;
|
|
159
|
+
protected onInit(): void;
|
|
160
|
+
protected listenCacheChangesIfNeed(value: boolean): void;
|
|
161
|
+
protected getIsSnappingMethodAdvanced(m?: SnappingMethod): boolean;
|
|
162
|
+
protected getIsVertical(d?: Direction): boolean;
|
|
163
|
+
protected _componentsResizeObserver: ResizeObserver;
|
|
164
|
+
protected createDisplayComponentsIfNeed(displayItems: IRenderVirtualListCollection | null): void;
|
|
165
|
+
protected updateRegularRenderer(): void;
|
|
166
|
+
protected resetRenderers(itemRenderer?: TemplateRef<HTMLElement>): void;
|
|
155
167
|
/**
|
|
156
168
|
* Tracking by id
|
|
157
169
|
*/
|
|
158
170
|
protected tracking(): void;
|
|
159
|
-
|
|
171
|
+
protected resetBoundsSize(isVertical: boolean, totalSize: number): void;
|
|
160
172
|
/**
|
|
161
173
|
* Returns the bounds of an element with a given id
|
|
162
174
|
*/
|
|
@@ -166,15 +178,17 @@ export declare class NgVirtualListComponent extends DisposableComponent implemen
|
|
|
166
178
|
* Behavior accepts the values "auto", "instant" and "smooth".
|
|
167
179
|
*/
|
|
168
180
|
scrollTo(id: Id, behavior?: ScrollBehavior): void;
|
|
169
|
-
|
|
170
|
-
|
|
181
|
+
protected _scrollToRepeatExecutionTimeout: any;
|
|
182
|
+
protected clearScrollToRepeatExecutionTimeout(): void;
|
|
171
183
|
protected scrollToExecutor(id: Id, behavior: ScrollBehavior, iteration?: number, isLastIteration?: boolean): void;
|
|
172
184
|
/**
|
|
173
185
|
* Scrolls the scroll area to the desired element with the specified ID.
|
|
174
186
|
*/
|
|
175
187
|
scrollToEnd(behavior?: ScrollBehavior): void;
|
|
176
|
-
|
|
177
|
-
|
|
188
|
+
protected _onContainerScrollHandler: (e: Event) => void;
|
|
189
|
+
protected _onContainerScrollEndHandler: (e: Event) => void;
|
|
190
|
+
protected afterViewInit(): void;
|
|
191
|
+
protected dispose(): void;
|
|
178
192
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListComponent, never>;
|
|
179
193
|
static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": "items"; "snap": "snap"; "enabledBufferOptimization": "enabledBufferOptimization"; "itemRenderer": "itemRenderer"; "stickyMap": "stickyMap"; "itemSize": "itemSize"; "dynamicSize": "dynamicSize"; "direction": "direction"; "itemsOffset": "itemsOffset"; "trackBy": "trackBy"; "snappingMethod": "snappingMethod"; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; }, never, never, false>;
|
|
180
194
|
}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { isDirection } from "./isDirection";
|
|
|
2
2
|
import { debounce } from "./debounce";
|
|
3
3
|
import { toggleClassName } from './toggleClassName';
|
|
4
4
|
import { Tracker } from "./tracker";
|
|
5
|
-
import { TrackBox } from "./trackBox";
|
|
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';
|
|
6
7
|
import { ScrollEvent } from "./scrollEvent";
|
|
7
|
-
export { isDirection, debounce, toggleClassName, ScrollEvent, TrackBox, Tracker, };
|
|
8
|
+
export { isDirection, debounce, toggleClassName, ScrollEvent, TrackBox, Tracker, TRACK_BOX_CHANGE_EVENT_NAME, CMap, CACHE_BOX_CHANGE_EVENT_NAME, };
|
|
9
|
+
export type { ICacheMap, IUpdateCollectionReturns, IMetrics, IRecalculateMetricsOptions, IGetItemPositionOptions, IUpdateCollectionOptions, CacheMapEvents, OnChangeEventListener, CacheMapListeners, ItemDisplayMethods, };
|
package/lib/utils/trackBox.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { ComponentRef } from "@angular/core";
|
|
2
|
-
import { NgVirtualListItemComponent } from "../components/ng-virtual-list-item.component";
|
|
3
2
|
import { IRenderVirtualListCollection } from "../models/render-collection.model";
|
|
4
|
-
import { IRenderVirtualListItem } from "../models/render-item.model";
|
|
5
3
|
import { Id } from "../types/id";
|
|
6
4
|
import { CacheMap, CMap } from "./cacheMap";
|
|
7
5
|
import { Tracker } from "./tracker";
|
|
8
6
|
import { ISize } from "../types";
|
|
9
7
|
import { HEIGHT_PROP_NAME, WIDTH_PROP_NAME } from "../const";
|
|
10
|
-
import { IVirtualListStickyMap } from "../models";
|
|
8
|
+
import { BaseVirtualListItemComponent, IVirtualListStickyMap } from "../models";
|
|
11
9
|
export declare const TRACK_BOX_CHANGE_EVENT_NAME = "change";
|
|
12
10
|
export interface IMetrics {
|
|
13
11
|
delta: number;
|
|
@@ -67,16 +65,16 @@ export interface IUpdateCollectionOptions<I extends {
|
|
|
67
65
|
id: Id;
|
|
68
66
|
}, C extends Array<I>> extends Omit<IRecalculateMetricsOptions<I, C>, 'collection' | 'previousTotalSize' | 'crudDetected' | 'deletedItemsMap'> {
|
|
69
67
|
}
|
|
70
|
-
declare type CacheMapEvents = typeof TRACK_BOX_CHANGE_EVENT_NAME;
|
|
71
|
-
declare type OnChangeEventListener = (version: number) => void;
|
|
72
|
-
declare type CacheMapListeners = OnChangeEventListener;
|
|
73
|
-
declare enum ItemDisplayMethods {
|
|
68
|
+
export declare type CacheMapEvents = typeof TRACK_BOX_CHANGE_EVENT_NAME;
|
|
69
|
+
export declare type OnChangeEventListener = (version: number) => void;
|
|
70
|
+
export declare type CacheMapListeners = OnChangeEventListener;
|
|
71
|
+
export declare enum ItemDisplayMethods {
|
|
74
72
|
CREATE = 0,
|
|
75
73
|
UPDATE = 1,
|
|
76
74
|
DELETE = 2,
|
|
77
75
|
NOT_CHANGED = 3
|
|
78
76
|
}
|
|
79
|
-
interface IUpdateCollectionReturns {
|
|
77
|
+
export interface IUpdateCollectionReturns {
|
|
80
78
|
displayItems: IRenderVirtualListCollection;
|
|
81
79
|
totalSize: number;
|
|
82
80
|
delta: number;
|
|
@@ -88,16 +86,16 @@ interface IUpdateCollectionReturns {
|
|
|
88
86
|
* @author Evgenii Grebennikov
|
|
89
87
|
* @email djonnyx@gmail.com
|
|
90
88
|
*/
|
|
91
|
-
export declare class TrackBox extends CacheMap<Id, ISize & {
|
|
89
|
+
export declare class TrackBox<C extends BaseVirtualListItemComponent = any> extends CacheMap<Id, ISize & {
|
|
92
90
|
method?: ItemDisplayMethods;
|
|
93
91
|
}, CacheMapEvents, CacheMapListeners> {
|
|
94
|
-
protected _tracker: Tracker<
|
|
92
|
+
protected _tracker: Tracker<C>;
|
|
95
93
|
protected _items: IRenderVirtualListCollection | null | undefined;
|
|
96
94
|
set items(v: IRenderVirtualListCollection | null | undefined);
|
|
97
|
-
protected _displayComponents: Array<ComponentRef<
|
|
98
|
-
set displayComponents(v: Array<ComponentRef<
|
|
99
|
-
protected _snapedDisplayComponent: ComponentRef<
|
|
100
|
-
set snapedDisplayComponent(v: ComponentRef<
|
|
95
|
+
protected _displayComponents: Array<ComponentRef<C>> | null | undefined;
|
|
96
|
+
set displayComponents(v: Array<ComponentRef<C>> | null | undefined);
|
|
97
|
+
protected _snapedDisplayComponent: ComponentRef<C> | null | undefined;
|
|
98
|
+
set snapedDisplayComponent(v: ComponentRef<C> | null | undefined);
|
|
101
99
|
protected _isSnappingMethodAdvanced: boolean;
|
|
102
100
|
set isSnappingMethodAdvanced(v: boolean);
|
|
103
101
|
/**
|
|
@@ -106,12 +104,16 @@ export declare class TrackBox extends CacheMap<Id, ISize & {
|
|
|
106
104
|
set trackingPropertyName(v: string);
|
|
107
105
|
constructor(trackingPropertyName: string);
|
|
108
106
|
set(id: Id, bounds: ISize): CMap<Id, ISize>;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
protected _previousCollection: Array<{
|
|
108
|
+
id: Id;
|
|
109
|
+
}> | null | undefined;
|
|
110
|
+
protected _deletedItemsMap: {
|
|
111
|
+
[index: number]: ISize;
|
|
112
|
+
};
|
|
113
|
+
protected _crudDetected: boolean;
|
|
112
114
|
get crudDetected(): boolean;
|
|
113
115
|
protected fireChangeIfNeed(): void;
|
|
114
|
-
|
|
116
|
+
protected _previousTotalSize: number;
|
|
115
117
|
protected _scrollDelta: number;
|
|
116
118
|
get scrollDelta(): number;
|
|
117
119
|
protected lifeCircle(): void;
|
|
@@ -148,11 +150,18 @@ export declare class TrackBox extends CacheMap<Id, ISize & {
|
|
|
148
150
|
/**
|
|
149
151
|
* Calculates the position of an element based on the given scrollSize
|
|
150
152
|
*/
|
|
151
|
-
|
|
153
|
+
protected getElementFromStart<I extends {
|
|
154
|
+
id: Id;
|
|
155
|
+
}, C extends Array<I>>(scrollSize: number, collection: C, map: CMap<Id, ISize>, typicalItemSize: number, isVertical: boolean): I | undefined;
|
|
152
156
|
/**
|
|
153
157
|
* Calculates the entry into the overscroll area and returns the number of overscroll elements
|
|
154
158
|
*/
|
|
155
|
-
|
|
159
|
+
protected getElementNumToEnd<I extends {
|
|
160
|
+
id: Id;
|
|
161
|
+
}, C extends Array<I>>(i: number, collection: C, map: CMap<Id, ISize>, typicalItemSize: number, size: number, isVertical: boolean, indexOffset?: number): {
|
|
162
|
+
num: number;
|
|
163
|
+
offset: number;
|
|
164
|
+
};
|
|
156
165
|
/**
|
|
157
166
|
* Calculates list metrics
|
|
158
167
|
*/
|
|
@@ -172,9 +181,8 @@ export declare class TrackBox extends CacheMap<Id, ISize & {
|
|
|
172
181
|
setDisplayObjectIndexMapById(v: {
|
|
173
182
|
[id: number]: number;
|
|
174
183
|
}): void;
|
|
175
|
-
untrackComponentByIdProperty(component?:
|
|
184
|
+
untrackComponentByIdProperty(component?: C | undefined): void;
|
|
176
185
|
getItemBounds(id: Id): ISize | undefined;
|
|
177
186
|
protected cacheElements(): void;
|
|
178
187
|
dispose(): void;
|
|
179
188
|
}
|
|
180
|
-
export {};
|
package/lib/utils/tracker.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ComponentRef } from "@angular/core";
|
|
2
|
-
import { ScrollDirection } from "../models";
|
|
3
|
-
|
|
2
|
+
import { BaseVirtualListItemComponent, ScrollDirection } from "../models";
|
|
3
|
+
import { Id, ISize } from "../types";
|
|
4
|
+
export interface IVirtualListItemComponent<I = any> {
|
|
5
|
+
getBounds(): ISize;
|
|
6
|
+
itemId: Id;
|
|
4
7
|
id: number;
|
|
5
|
-
item: I;
|
|
8
|
+
item: I | null;
|
|
6
9
|
show: () => void;
|
|
7
10
|
hide: () => void;
|
|
8
11
|
}
|
|
@@ -12,7 +15,7 @@ interface IVirtualListItemComponent<I = any> {
|
|
|
12
15
|
* @author Evgenii Grebennikov
|
|
13
16
|
* @email djonnyx@gmail.com
|
|
14
17
|
*/
|
|
15
|
-
export declare class Tracker<
|
|
18
|
+
export declare class Tracker<C extends BaseVirtualListItemComponent = any> {
|
|
16
19
|
/**
|
|
17
20
|
* display objects dictionary of indexes by id
|
|
18
21
|
*/
|
|
@@ -41,4 +44,3 @@ export declare class Tracker<I = any, C extends IVirtualListItemComponent = any>
|
|
|
41
44
|
untrackComponentByIdProperty(component?: C): void;
|
|
42
45
|
dispose(): void;
|
|
43
46
|
}
|
|
44
|
-
export {};
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED