ng-virtual-list 18.0.22 → 18.0.24
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/LICENSE +21 -0
- package/ng-package.json +7 -0
- package/package.json +29 -42
- package/src/lib/components/ng-virtual-list-item.component.html +12 -0
- package/src/lib/components/ng-virtual-list-item.component.scss +17 -0
- package/src/lib/components/ng-virtual-list-item.component.spec.ts +23 -0
- package/src/lib/components/ng-virtual-list-item.component.ts +111 -0
- package/src/lib/const/index.ts +69 -0
- package/{lib/enums/direction.d.ts → src/lib/enums/direction.ts} +9 -8
- package/{lib/enums/directions.d.ts → src/lib/enums/directions.ts} +16 -16
- package/{lib/enums/index.d.ts → src/lib/enums/index.ts} +7 -4
- package/{lib/models/collection.model.d.ts → src/lib/models/collection.model.ts} +9 -9
- package/{lib/models/index.d.ts → src/lib/models/index.ts} +13 -6
- package/{lib/models/item.model.d.ts → src/lib/models/item.model.ts} +15 -14
- package/{lib/models/render-collection.model.d.ts → src/lib/models/render-collection.model.ts} +9 -9
- package/{lib/models/render-item-config.model.d.ts → src/lib/models/render-item-config.model.ts} +33 -33
- package/{lib/models/render-item.model.d.ts → src/lib/models/render-item.model.ts} +29 -28
- package/{lib/models/scroll-direction.model.d.ts → src/lib/models/scroll-direction.model.ts} +5 -5
- package/{lib/models/scroll-event.model.d.ts → src/lib/models/scroll-event.model.ts} +51 -50
- package/{lib/models/sticky-map.model.d.ts → src/lib/models/sticky-map.model.ts} +12 -12
- package/src/lib/ng-virtual-list.component.html +5 -0
- package/src/lib/ng-virtual-list.component.scss +28 -0
- package/src/lib/ng-virtual-list.component.spec.ts +23 -0
- package/src/lib/ng-virtual-list.component.ts +542 -0
- package/src/lib/ng-virtual-list.module.ts +12 -0
- package/{lib/types/id.d.ts → src/lib/types/id.ts} +7 -7
- package/{lib/types/index.d.ts → src/lib/types/index.ts} +9 -4
- package/{lib/types/rect.d.ts → src/lib/types/rect.ts} +18 -17
- package/{lib/types/size.d.ts → src/lib/types/size.ts} +16 -16
- package/src/lib/utils/cacheMap.ts +223 -0
- package/src/lib/utils/debounce.ts +31 -0
- package/src/lib/utils/eventEmitter.ts +119 -0
- package/{lib/utils/index.d.ts → src/lib/utils/index.ts} +15 -7
- package/src/lib/utils/isDirection.ts +17 -0
- package/src/lib/utils/scrollEvent.ts +62 -0
- package/src/lib/utils/toggleClassName.ts +14 -0
- package/src/lib/utils/trackBox.ts +839 -0
- package/src/lib/utils/tracker.ts +126 -0
- package/{public-api.d.ts → src/public-api.ts} +8 -4
- package/tsconfig.lib.json +16 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/esm2022/lib/components/ng-virtual-list-item.component.mjs +0 -88
- package/esm2022/lib/const/index.mjs +0 -36
- package/esm2022/lib/enums/direction.mjs +0 -2
- package/esm2022/lib/enums/directions.mjs +0 -18
- package/esm2022/lib/enums/index.mjs +0 -3
- package/esm2022/lib/models/collection.model.mjs +0 -3
- package/esm2022/lib/models/index.mjs +0 -2
- package/esm2022/lib/models/item.model.mjs +0 -3
- package/esm2022/lib/models/render-collection.model.mjs +0 -3
- package/esm2022/lib/models/render-item-config.model.mjs +0 -2
- package/esm2022/lib/models/render-item.model.mjs +0 -3
- package/esm2022/lib/models/scroll-direction.model.mjs +0 -2
- package/esm2022/lib/models/scroll-event.model.mjs +0 -2
- package/esm2022/lib/models/sticky-map.model.mjs +0 -2
- package/esm2022/lib/ng-virtual-list.component.mjs +0 -386
- package/esm2022/lib/ng-virtual-list.module.mjs +0 -20
- package/esm2022/lib/types/id.mjs +0 -2
- package/esm2022/lib/types/index.mjs +0 -2
- package/esm2022/lib/types/rect.mjs +0 -2
- package/esm2022/lib/types/size.mjs +0 -2
- package/esm2022/lib/utils/cacheMap.mjs +0 -168
- package/esm2022/lib/utils/debounce.mjs +0 -31
- package/esm2022/lib/utils/eventEmitter.mjs +0 -105
- package/esm2022/lib/utils/index.mjs +0 -8
- package/esm2022/lib/utils/isDirection.mjs +0 -15
- package/esm2022/lib/utils/scrollEvent.mjs +0 -42
- package/esm2022/lib/utils/toggleClassName.mjs +0 -15
- package/esm2022/lib/utils/trackBox.mjs +0 -627
- package/esm2022/lib/utils/tracker.mjs +0 -93
- package/esm2022/ng-virtual-list.mjs +0 -5
- package/esm2022/public-api.mjs +0 -8
- package/fesm2022/ng-virtual-list.mjs +0 -1636
- package/fesm2022/ng-virtual-list.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/components/ng-virtual-list-item.component.d.ts +0 -31
- package/lib/const/index.d.ts +0 -34
- package/lib/ng-virtual-list.component.d.ts +0 -132
- package/lib/ng-virtual-list.module.d.ts +0 -9
- package/lib/utils/cacheMap.d.ts +0 -60
- package/lib/utils/debounce.d.ts +0 -16
- package/lib/utils/eventEmitter.d.ts +0 -40
- package/lib/utils/isDirection.d.ts +0 -8
- package/lib/utils/scrollEvent.d.ts +0 -39
- package/lib/utils/toggleClassName.d.ts +0 -7
- package/lib/utils/trackBox.d.ts +0 -176
- package/lib/utils/tracker.d.ts +0 -44
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 djonnyx (Evgenii Grebennikov)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ng-virtual-list",
|
|
3
|
-
"version": "18.0.
|
|
4
|
-
"author": {
|
|
5
|
-
"name": "Evgenii Grebennikov",
|
|
6
|
-
"email": "djonnyx@gmail.com"
|
|
7
|
-
},
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"homepage": "https://github.com/djonnyx/ng-virtual-list/tree/main/projects/ng-virtual-list",
|
|
10
|
-
"keywords": [
|
|
11
|
-
"ng",
|
|
12
|
-
"angular",
|
|
13
|
-
"virtual",
|
|
14
|
-
"virtualized",
|
|
15
|
-
"list",
|
|
16
|
-
"group",
|
|
17
|
-
"grouped",
|
|
18
|
-
"scroll",
|
|
19
|
-
"scrolling",
|
|
20
|
-
"scroller"
|
|
21
|
-
],
|
|
22
|
-
"peerDependencies": {
|
|
23
|
-
"@angular/common": "^18.2.0",
|
|
24
|
-
"@angular/core": "^18.2.0"
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"tslib": "^2.3.0"
|
|
28
|
-
},
|
|
29
|
-
"sideEffects": false
|
|
30
|
-
"module": "fesm2022/ng-virtual-list.mjs",
|
|
31
|
-
"typings": "index.d.ts",
|
|
32
|
-
"exports": {
|
|
33
|
-
"./package.json": {
|
|
34
|
-
"default": "./package.json"
|
|
35
|
-
},
|
|
36
|
-
".": {
|
|
37
|
-
"types": "./index.d.ts",
|
|
38
|
-
"esm2022": "./esm2022/ng-virtual-list.mjs",
|
|
39
|
-
"esm": "./esm2022/ng-virtual-list.mjs",
|
|
40
|
-
"default": "./fesm2022/ng-virtual-list.mjs"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ng-virtual-list",
|
|
3
|
+
"version": "18.0.24",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Evgenii Grebennikov",
|
|
6
|
+
"email": "djonnyx@gmail.com"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/djonnyx/ng-virtual-list/tree/main/projects/ng-virtual-list",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"ng",
|
|
12
|
+
"angular",
|
|
13
|
+
"virtual",
|
|
14
|
+
"virtualized",
|
|
15
|
+
"list",
|
|
16
|
+
"group",
|
|
17
|
+
"grouped",
|
|
18
|
+
"scroll",
|
|
19
|
+
"scrolling",
|
|
20
|
+
"scroller"
|
|
21
|
+
],
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@angular/common": "^18.2.0",
|
|
24
|
+
"@angular/core": "^18.2.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"tslib": "^2.3.0"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false
|
|
43
30
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@let item = data();
|
|
2
|
+
@let renderer = itemRenderer();
|
|
3
|
+
|
|
4
|
+
@if (item) {
|
|
5
|
+
<li #listItem part="item" class="ngvl-item__container" [ngClass]="{'snapped': item.config.snapped,
|
|
6
|
+
'snapped-out': item.config.snappedOut}">
|
|
7
|
+
@if (renderer) {
|
|
8
|
+
<ng-container [ngTemplateOutlet]="renderer"
|
|
9
|
+
[ngTemplateOutletContext]="{data: item.data || {}, config: item.config}" />
|
|
10
|
+
}
|
|
11
|
+
</li>
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
position: absolute;
|
|
4
|
+
left: 0;
|
|
5
|
+
top: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ngvl-item__container {
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
background-color: #ffffff;
|
|
15
|
+
width: inherit;
|
|
16
|
+
height: inherit;
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { NgVirtualListItemComponent } from './ng-virtual-list-item.component';
|
|
4
|
+
|
|
5
|
+
describe('NgVirtualListItemComponent', () => {
|
|
6
|
+
let component: NgVirtualListItemComponent;
|
|
7
|
+
let fixture: ComponentFixture<NgVirtualListItemComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [NgVirtualListItemComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(NgVirtualListItemComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, inject, signal, TemplateRef } from '@angular/core';
|
|
2
|
+
import { IRenderVirtualListItem } from '../models/render-item.model';
|
|
3
|
+
import { ISize } from '../types';
|
|
4
|
+
import {
|
|
5
|
+
POSITION_ABSOLUTE, POSITION_STICKY, PX, SIZE_100_PERSENT, SIZE_AUTO, TRANSLATE_3D, VISIBILITY_HIDDEN,
|
|
6
|
+
VISIBILITY_VISIBLE, ZEROS_TRANSLATE_3D,
|
|
7
|
+
} from '../const';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Virtual list item component
|
|
11
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/components/ng-virtual-list-item.component.ts
|
|
12
|
+
* @author Evgenii Grebennikov
|
|
13
|
+
* @email djonnyx@gmail.com
|
|
14
|
+
*/
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'ng-virtual-list-item',
|
|
17
|
+
standalone: false,
|
|
18
|
+
templateUrl: './ng-virtual-list-item.component.html',
|
|
19
|
+
styleUrl: './ng-virtual-list-item.component.scss',
|
|
20
|
+
host: {
|
|
21
|
+
'class': 'ngvl__item',
|
|
22
|
+
},
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
})
|
|
25
|
+
export class NgVirtualListItemComponent {
|
|
26
|
+
private static __nextId: number = 0;
|
|
27
|
+
|
|
28
|
+
private _id!: number;
|
|
29
|
+
get id() {
|
|
30
|
+
return this._id;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private _cdr = inject(ChangeDetectorRef);
|
|
34
|
+
|
|
35
|
+
data = signal<IRenderVirtualListItem | undefined>(undefined);
|
|
36
|
+
private _data: IRenderVirtualListItem | undefined = undefined;
|
|
37
|
+
set item(v: IRenderVirtualListItem | undefined) {
|
|
38
|
+
if (this._data === v) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const data = this._data = v;
|
|
43
|
+
|
|
44
|
+
if (data) {
|
|
45
|
+
const styles = this._elementRef.nativeElement.style;
|
|
46
|
+
styles.zIndex = String(data.config.sticky);
|
|
47
|
+
if (data.config.snapped) {
|
|
48
|
+
styles.transform = ZEROS_TRANSLATE_3D;
|
|
49
|
+
styles.position = POSITION_STICKY;
|
|
50
|
+
} else {
|
|
51
|
+
styles.position = POSITION_ABSOLUTE;
|
|
52
|
+
styles.transform = `${TRANSLATE_3D}(${data.config.isVertical ? 0 : data.measures.x}${PX}, ${data.config.isVertical ? data.measures.y : 0}${PX} , 0)`;
|
|
53
|
+
}
|
|
54
|
+
styles.height = data.config.isVertical ? data.config.dynamic ? SIZE_AUTO : `${data.measures.height}${PX}` : SIZE_100_PERSENT;
|
|
55
|
+
styles.width = data.config.isVertical ? SIZE_100_PERSENT : data.config.dynamic ? SIZE_AUTO : `${data.measures.width}${PX}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.data.set(v);
|
|
59
|
+
|
|
60
|
+
this._cdr.markForCheck();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get item() {
|
|
64
|
+
return this._data;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get itemId() {
|
|
68
|
+
return this._data?.id;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
itemRenderer = signal<TemplateRef<any> | undefined>(undefined);
|
|
72
|
+
|
|
73
|
+
set renderer(v: TemplateRef<any> | undefined) {
|
|
74
|
+
this.itemRenderer.set(v);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private _elementRef: ElementRef<HTMLElement> = inject(ElementRef<HTMLElement>);
|
|
78
|
+
get element() {
|
|
79
|
+
return this._elementRef.nativeElement;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
constructor() {
|
|
83
|
+
this._id = NgVirtualListItemComponent.__nextId = NgVirtualListItemComponent.__nextId === Number.MAX_SAFE_INTEGER
|
|
84
|
+
? 0 : NgVirtualListItemComponent.__nextId + 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
getBounds(): ISize {
|
|
88
|
+
const el: HTMLElement = this._elementRef.nativeElement,
|
|
89
|
+
{ width, height } = el.getBoundingClientRect();
|
|
90
|
+
return { width, height };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
show() {
|
|
94
|
+
const styles = this._elementRef.nativeElement.style;
|
|
95
|
+
if (styles.visibility === VISIBILITY_VISIBLE) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
styles.visibility = VISIBILITY_VISIBLE;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
hide() {
|
|
103
|
+
const styles = this._elementRef.nativeElement.style;
|
|
104
|
+
if (styles.visibility === VISIBILITY_HIDDEN) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
styles.visibility = VISIBILITY_HIDDEN;
|
|
109
|
+
styles.transform = ZEROS_TRANSLATE_3D;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Directions } from "../enums/directions";
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_ITEM_SIZE = 24;
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_ITEMS_OFFSET = 2;
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_LIST_SIZE = 400;
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_SNAP = false;
|
|
10
|
+
|
|
11
|
+
export const DEFAULT_ENABLED_BUFFER_OPTIMIZATION = false;
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_SNAP_TO_ITEM = false;
|
|
14
|
+
|
|
15
|
+
export const DEFAULT_DYNAMIC_SIZE = false;
|
|
16
|
+
|
|
17
|
+
export const TRACK_BY_PROPERTY_NAME = 'id';
|
|
18
|
+
|
|
19
|
+
export const DEFAULT_DIRECTION = Directions.VERTICAL;
|
|
20
|
+
|
|
21
|
+
export const DISPLAY_OBJECTS_LENGTH_MESUREMENT_ERROR = 1;
|
|
22
|
+
|
|
23
|
+
export const MAX_SCROLL_TO_ITERATIONS = 5;
|
|
24
|
+
|
|
25
|
+
// presets
|
|
26
|
+
|
|
27
|
+
export const BEHAVIOR_AUTO = 'auto';
|
|
28
|
+
|
|
29
|
+
export const BEHAVIOR_INSTANT = 'instant';
|
|
30
|
+
|
|
31
|
+
export const BEHAVIOR_SMOOTH = 'smooth';
|
|
32
|
+
|
|
33
|
+
export const VISIBILITY_VISIBLE = 'visible';
|
|
34
|
+
|
|
35
|
+
export const VISIBILITY_HIDDEN = 'hidden';
|
|
36
|
+
|
|
37
|
+
export const SIZE_100_PERSENT = '100%';
|
|
38
|
+
|
|
39
|
+
export const SIZE_AUTO = 'auto';
|
|
40
|
+
|
|
41
|
+
export const POSITION_ABSOLUTE = 'absolute';
|
|
42
|
+
|
|
43
|
+
export const POSITION_STICKY = 'sticky';
|
|
44
|
+
|
|
45
|
+
export const TRANSLATE_3D = 'translate3d';
|
|
46
|
+
|
|
47
|
+
export const ZEROS_TRANSLATE_3D = `${TRANSLATE_3D}(0,0,0)`;
|
|
48
|
+
|
|
49
|
+
export const TOP_PROP_NAME = 'top';
|
|
50
|
+
|
|
51
|
+
export const LEFT_PROP_NAME = 'left';
|
|
52
|
+
|
|
53
|
+
export const X_PROP_NAME = 'x';
|
|
54
|
+
|
|
55
|
+
export const Y_PROP_NAME = 'y';
|
|
56
|
+
|
|
57
|
+
export const WIDTH_PROP_NAME = 'width';
|
|
58
|
+
|
|
59
|
+
export const HEIGHT_PROP_NAME = 'height';
|
|
60
|
+
|
|
61
|
+
export const PX = 'px';
|
|
62
|
+
|
|
63
|
+
export const SCROLL = 'scroll';
|
|
64
|
+
|
|
65
|
+
export const SCROLL_END = 'scrollend';
|
|
66
|
+
|
|
67
|
+
export const CLASS_LIST_VERTICAL = 'vertical';
|
|
68
|
+
|
|
69
|
+
export const CLASS_LIST_HORIZONTAL = 'horizontal';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Directions } from "./directions";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Directions } from "./directions";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Axis of the arrangement of virtual list elements.
|
|
5
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/enums/direction.ts
|
|
6
|
+
* @author Evgenii Grebennikov
|
|
7
|
+
* @email djonnyx@gmail.com
|
|
8
|
+
*/
|
|
9
|
+
export type Direction = Directions | 'hotizontal' | 'vertical';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Axis of the arrangement of virtual list elements.
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/enums/directions.ts
|
|
4
|
-
* @author Evgenii Grebennikov
|
|
5
|
-
* @email djonnyx@gmail.com
|
|
6
|
-
*/
|
|
7
|
-
export
|
|
8
|
-
/**
|
|
9
|
-
* Horizontal axis.
|
|
10
|
-
*/
|
|
11
|
-
HORIZONTAL =
|
|
12
|
-
/**
|
|
13
|
-
* Vertical axis.
|
|
14
|
-
*/
|
|
15
|
-
VERTICAL =
|
|
16
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Axis of the arrangement of virtual list elements.
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/enums/directions.ts
|
|
4
|
+
* @author Evgenii Grebennikov
|
|
5
|
+
* @email djonnyx@gmail.com
|
|
6
|
+
*/
|
|
7
|
+
export enum Directions {
|
|
8
|
+
/**
|
|
9
|
+
* Horizontal axis.
|
|
10
|
+
*/
|
|
11
|
+
HORIZONTAL = 'horizontal',
|
|
12
|
+
/**
|
|
13
|
+
* Vertical axis.
|
|
14
|
+
*/
|
|
15
|
+
VERTICAL = 'vertical',
|
|
16
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { Directions } from "./directions";
|
|
2
|
-
import { Direction } from "./direction";
|
|
3
|
-
|
|
4
|
-
export
|
|
1
|
+
import { Directions } from "./directions";
|
|
2
|
+
import { Direction } from "./direction";
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
Directions
|
|
6
|
+
};
|
|
7
|
+
export type { Direction };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IVirtualListItem } from "./item.model";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
import { IVirtualListItem } from "./item.model";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Virtual list elements collection interface
|
|
5
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/models/collection.model.ts
|
|
6
|
+
* @author Evgenii Grebennikov
|
|
7
|
+
* @email djonnyx@gmail.com
|
|
8
|
+
*/
|
|
9
|
+
export interface IVirtualListCollection extends Array<IVirtualListItem> { };
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { ScrollDirection } from './scroll-direction.model';
|
|
2
|
-
import { IScrollEvent } from './scroll-event.model';
|
|
3
|
-
import { IVirtualListItem } from './item.model';
|
|
4
|
-
import { IVirtualListStickyMap } from './sticky-map.model';
|
|
5
|
-
import { IVirtualListCollection } from './collection.model';
|
|
6
|
-
|
|
1
|
+
import { ScrollDirection } from './scroll-direction.model';
|
|
2
|
+
import { IScrollEvent } from './scroll-event.model';
|
|
3
|
+
import { IVirtualListItem } from './item.model';
|
|
4
|
+
import { IVirtualListStickyMap } from './sticky-map.model';
|
|
5
|
+
import { IVirtualListCollection } from './collection.model';
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
ScrollDirection,
|
|
9
|
+
IScrollEvent,
|
|
10
|
+
IVirtualListItem,
|
|
11
|
+
IVirtualListStickyMap,
|
|
12
|
+
IVirtualListCollection,
|
|
13
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { Id } from "../types/id";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { Id } from "../types/id";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Virtual list element model
|
|
5
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/models/item.model.ts
|
|
6
|
+
* @author Evgenii Grebennikov
|
|
7
|
+
* @email djonnyx@gmail.com
|
|
8
|
+
*/
|
|
9
|
+
export interface IVirtualListItem {
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier of the element.
|
|
12
|
+
*/
|
|
13
|
+
id: Id;
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
};
|
package/{lib/models/render-collection.model.d.ts → src/lib/models/render-collection.model.ts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IRenderVirtualListItem } from "./render-item.model";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
import { IRenderVirtualListItem } from "./render-item.model";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Virtual list screen elements collection interface
|
|
5
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/models/render-collection.model.ts
|
|
6
|
+
* @author Evgenii Grebennikov
|
|
7
|
+
* @email djonnyx@gmail.com
|
|
8
|
+
*/
|
|
9
|
+
export interface IRenderVirtualListCollection extends Array<IRenderVirtualListItem> { };
|
package/{lib/models/render-item-config.model.d.ts → src/lib/models/render-item-config.model.ts}
RENAMED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Object with configuration parameters for IRenderVirtualListItem
|
|
3
|
-
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/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
|
+
/**
|
|
2
|
+
* Object with configuration parameters for IRenderVirtualListItem
|
|
3
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/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 +1,29 @@
|
|
|
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
|
-
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
+
/**
|
|
7
|
+
* List screen element model
|
|
8
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/models/render-item.model.ts
|
|
9
|
+
* @author Evgenii Grebennikov
|
|
10
|
+
* @email djonnyx@gmail.com
|
|
11
|
+
*/
|
|
12
|
+
export interface IRenderVirtualListItem {
|
|
13
|
+
/**
|
|
14
|
+
* Unique identifier of the element.
|
|
15
|
+
*/
|
|
16
|
+
id: Id;
|
|
17
|
+
/**
|
|
18
|
+
* Element metrics.
|
|
19
|
+
*/
|
|
20
|
+
measures: IRect;
|
|
21
|
+
/**
|
|
22
|
+
* Element data.
|
|
23
|
+
*/
|
|
24
|
+
data: IVirtualListItem;
|
|
25
|
+
/**
|
|
26
|
+
* Object with configuration parameters for IRenderVirtualListItem.
|
|
27
|
+
*/
|
|
28
|
+
config: IRenderVirtualListItemConfig;
|
|
29
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A value of -1 indicates the direction is up or left (if the list direction is horizontal).
|
|
3
|
-
* A value of 1 indicates the direction is down or right (if the list direction is horizontal).
|
|
4
|
-
*/
|
|
5
|
-
export type ScrollDirection = -1 | 1 | 0;
|
|
1
|
+
/**
|
|
2
|
+
* A value of -1 indicates the direction is up or left (if the list direction is horizontal).
|
|
3
|
+
* A value of 1 indicates the direction is down or right (if the list direction is horizontal).
|
|
4
|
+
*/
|
|
5
|
+
export type ScrollDirection = -1 | 1 | 0;
|