ng-virtual-list 16.0.0 → 16.0.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 +36 -66
- package/fesm2022/ng-virtual-list.mjs +13 -13
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +1 -1
- package/lib/const/index.d.ts +1 -1
- package/package.json +1 -3
- package/esm2022/lib/components/ng-virtual-list-item.component.mjs +0 -84
- package/esm2022/lib/const/index.mjs +0 -34
- 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/sticky-map.model.mjs +0 -2
- package/esm2022/lib/ng-virtual-list.component.mjs +0 -516
- 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 -52
- package/esm2022/lib/utils/debounce.mjs +0 -31
- package/esm2022/lib/utils/eventEmitter.mjs +0 -105
- package/esm2022/lib/utils/index.mjs +0 -7
- package/esm2022/lib/utils/isDirection.mjs +0 -15
- package/esm2022/lib/utils/toggleClassName.mjs +0 -15
- package/esm2022/lib/utils/trackBox.mjs +0 -355
- package/esm2022/lib/utils/tracker.mjs +0 -109
- package/esm2022/ng-virtual-list.mjs +0 -5
- package/esm2022/public-api.mjs +0 -8
package/README.md
CHANGED
|
@@ -27,11 +27,9 @@ Template:
|
|
|
27
27
|
[itemRenderer]="hotizontalItemRenderer" [itemSize]="64"></ng-virtual-list>
|
|
28
28
|
|
|
29
29
|
<ng-template #hotizontalItemRenderer let-data="data">
|
|
30
|
-
|
|
31
|
-
<div class="list__h-container" (click)="onItemClick(data)">
|
|
30
|
+
<div *ngIf="data" class="list__h-container" (click)="onItemClick(data)">
|
|
32
31
|
<span>{{data.name}}</span>
|
|
33
32
|
</div>
|
|
34
|
-
}
|
|
35
33
|
</ng-template>
|
|
36
34
|
```
|
|
37
35
|
|
|
@@ -65,20 +63,14 @@ Template:
|
|
|
65
63
|
[itemsOffset]="50" [stickyMap]="horizontalGroupItemsStickyMap" [itemSize]="54" [snap]="true"></ng-virtual-list>
|
|
66
64
|
|
|
67
65
|
<ng-template #horizontalGroupItemRenderer let-data="data">
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
</
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<div class="list__h-container" (click)="onItemClick(data)">
|
|
77
|
-
<span>{{data.name}}</span>
|
|
78
|
-
</div>
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
66
|
+
<ng-container *ngIf="data" [ngSwitch]="data.type">
|
|
67
|
+
<div *ngSwitchCase="'group-header'" class="list__h-group-container">
|
|
68
|
+
<span>{{data.name}}</span>
|
|
69
|
+
</div>
|
|
70
|
+
<div *ngSwitchCase="'item'" class="list__h-container" (click)="onItemClick(data)">
|
|
71
|
+
<span>{{data.name}}</span>
|
|
72
|
+
</div>
|
|
73
|
+
</ng-container>
|
|
82
74
|
</ng-template>
|
|
83
75
|
```
|
|
84
76
|
|
|
@@ -123,11 +115,9 @@ Template:
|
|
|
123
115
|
[itemSize]="40"></ng-virtual-list>
|
|
124
116
|
|
|
125
117
|
<ng-template #itemRenderer let-data="data">
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<p>{{data.name}}</p>
|
|
118
|
+
<div *ngIf="data" class="list__container">
|
|
119
|
+
<span>{{data.name}}</span>
|
|
129
120
|
</div>
|
|
130
|
-
}
|
|
131
121
|
</ng-template>
|
|
132
122
|
```
|
|
133
123
|
|
|
@@ -164,20 +154,14 @@ Template:
|
|
|
164
154
|
[stickyMap]="groupItemsStickyMap" [itemSize]="40" [snap]="false"></ng-virtual-list>
|
|
165
155
|
|
|
166
156
|
<ng-template #groupItemRenderer let-data="data">
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
</
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<div class="list__container">
|
|
176
|
-
<p>{{data.name}}</p>
|
|
177
|
-
</div>
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
157
|
+
<ng-container *ngIf="data" [ngSwitch]="data.type">
|
|
158
|
+
<div *ngSwitchCase="'group-header'" class="list__group-container">
|
|
159
|
+
<span>{{data.name}}</span>
|
|
160
|
+
</div>
|
|
161
|
+
<div *ngSwitchCase="'item'" class="list__container">
|
|
162
|
+
<span>{{data.name}}</span>
|
|
163
|
+
</div>
|
|
164
|
+
</ng-container>
|
|
181
165
|
</ng-template>
|
|
182
166
|
```
|
|
183
167
|
|
|
@@ -191,20 +175,14 @@ Template (with snapping):
|
|
|
191
175
|
[stickyMap]="groupItemsStickyMap" [itemSize]="40" [snap]="true"></ng-virtual-list>
|
|
192
176
|
|
|
193
177
|
<ng-template #groupItemRenderer let-data="data">
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
</
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<div class="list__container">
|
|
203
|
-
<p>{{data.name}}</p>
|
|
204
|
-
</div>
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
178
|
+
<ng-container *ngIf="data" [ngSwitch]="data.type">
|
|
179
|
+
<div *ngSwitchCase="'group-header'" class="list__group-container">
|
|
180
|
+
<span>{{data.name}}</span>
|
|
181
|
+
</div>
|
|
182
|
+
<div *ngSwitchCase="'item'" class="list__container">
|
|
183
|
+
<span>{{data.name}}</span>
|
|
184
|
+
</div>
|
|
185
|
+
</ng-container>
|
|
208
186
|
</ng-template>
|
|
209
187
|
```
|
|
210
188
|
|
|
@@ -256,11 +234,9 @@ Template
|
|
|
256
234
|
[itemSize]="40"></ng-virtual-list>
|
|
257
235
|
|
|
258
236
|
<ng-template #itemRenderer let-data="data">
|
|
259
|
-
|
|
260
|
-
<div class="list__container">
|
|
237
|
+
<div *ngIf="data" class="list__container">
|
|
261
238
|
<span>{{data.name}}</span>
|
|
262
239
|
</div>
|
|
263
|
-
}
|
|
264
240
|
</ng-template>
|
|
265
241
|
```
|
|
266
242
|
|
|
@@ -310,20 +286,14 @@ Template
|
|
|
310
286
|
[stickyMap]="groupDynamicItemsStickyMap" [dynamicSize]="true" [snap]="true"></ng-virtual-list>
|
|
311
287
|
|
|
312
288
|
<ng-template #groupItemRenderer let-data="data">
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
<div class="list__container">
|
|
322
|
-
<span>{{data.name}}</span>
|
|
323
|
-
</div>
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
289
|
+
<ng-container *ngIf="data" [ngSwitch]="data.type">
|
|
290
|
+
<div *ngSwitchCase="'group-header'" class="list__group-container">
|
|
291
|
+
<span>{{data.name}}</span>
|
|
292
|
+
</div>
|
|
293
|
+
<div *ngSwitchCase="'item'" class="list__container">
|
|
294
|
+
<span>{{data.name}}</span>
|
|
295
|
+
</div>
|
|
296
|
+
</ng-container>
|
|
327
297
|
</ng-template>
|
|
328
298
|
```
|
|
329
299
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef,
|
|
2
|
+
import { inject, ElementRef, ChangeDetectionStrategy, Component, EventEmitter as EventEmitter$1, ViewContainerRef, Input, Output, ViewChild, ViewEncapsulation, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -126,15 +126,15 @@ class NgVirtualListItemComponent {
|
|
|
126
126
|
}
|
|
127
127
|
styles.visibility = VISIBILITY_HIDDEN;
|
|
128
128
|
}
|
|
129
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
130
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
129
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListItemComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
130
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: NgVirtualListItemComponent, isStandalone: false, selector: "ng-virtual-list-item", host: { classAttribute: "ngvl__item" }, ngImport: i0, template: "<ng-container *ngIf=\"data\">\r\n <li #listItem part=\"item\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, config: data.config}\" />\r\n </ng-container>\r\n </li>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
131
131
|
}
|
|
132
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
|
|
133
133
|
type: Component,
|
|
134
134
|
args: [{ selector: 'ng-virtual-list-item', standalone: false, host: {
|
|
135
135
|
'class': 'ngvl__item',
|
|
136
136
|
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"data\">\r\n <li #listItem part=\"item\" class=\"ngvl-item__container\" [ngClass]=\"{'snapped': data.config.snapped,\r\n 'snapped-out': data.config.snappedOut}\">\r\n <ng-container *ngIf=\"itemRenderer\">\r\n <ng-container [ngTemplateOutlet]=\"itemRenderer\"\r\n [ngTemplateOutletContext]=\"{data: data.data || {}, config: data.config}\" />\r\n </ng-container>\r\n </li>\r\n</ng-container>", styles: [":host{display:block;position:absolute;left:0;top:0;box-sizing:border-box;overflow:hidden}.ngvl-item__container{margin:0;padding:0;overflow:hidden;background-color:#fff;width:inherit;height:inherit}\n"] }]
|
|
137
|
-
}], ctorParameters:
|
|
137
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
138
138
|
|
|
139
139
|
const HORIZONTAL_ALIASES = [Directions.HORIZONTAL, 'horizontal'], VERTICAL_ALIASES = [Directions.VERTICAL, 'vertical'];
|
|
140
140
|
/**
|
|
@@ -1280,13 +1280,13 @@ class NgVirtualListComponent {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1284
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1283
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1284
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: NgVirtualListComponent, isStandalone: false, selector: "ng-virtual-list", inputs: { items: "items", snap: "snap", snapToItem: "snapToItem", itemRenderer: "itemRenderer", stickyMap: "stickyMap", itemSize: "itemSize", dynamicSize: "dynamicSize", direction: "direction", itemsOffset: "itemsOffset" }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd" }, viewQueries: [{ propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_container", first: true, predicate: ["container"], descendants: true, read: (ElementRef) }, { propertyName: "_list", first: true, predicate: ["list"], descendants: true, read: (ElementRef) }], ngImport: i0, template: "<div #container part=\"scroller\" class=\"ngvl__container\">\r\n <ul #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </ul>\r\n</div>", styles: [":host{display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__container{overflow:auto;width:100%;height:100%}.ngvl__list{position:relative;list-style:none;padding:0;margin:0;width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
|
|
1285
1285
|
}
|
|
1286
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListComponent, decorators: [{
|
|
1287
1287
|
type: Component,
|
|
1288
1288
|
args: [{ selector: 'ng-virtual-list', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, template: "<div #container part=\"scroller\" class=\"ngvl__container\">\r\n <ul #list part=\"list\" class=\"ngvl__list\">\r\n <ng-container #renderersContainer></ng-container>\r\n </ul>\r\n</div>", styles: [":host{display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__container{overflow:auto;width:100%;height:100%}.ngvl__list{position:relative;list-style:none;padding:0;margin:0;width:100%;height:100%}\n"] }]
|
|
1289
|
-
}], ctorParameters:
|
|
1289
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { _listContainerRef: [{
|
|
1290
1290
|
type: ViewChild,
|
|
1291
1291
|
args: ['renderersContainer', { read: ViewContainerRef }]
|
|
1292
1292
|
}], _container: [{
|
|
@@ -1320,11 +1320,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1320
1320
|
}] } });
|
|
1321
1321
|
|
|
1322
1322
|
class NgVirtualListModule {
|
|
1323
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1324
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1325
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1323
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1324
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListModule, declarations: [NgVirtualListComponent, NgVirtualListItemComponent], imports: [CommonModule], exports: [NgVirtualListComponent] });
|
|
1325
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListModule, imports: [CommonModule] });
|
|
1326
1326
|
}
|
|
1327
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1327
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgVirtualListModule, decorators: [{
|
|
1328
1328
|
type: NgModule,
|
|
1329
1329
|
args: [{
|
|
1330
1330
|
declarations: [NgVirtualListComponent, NgVirtualListItemComponent],
|