ng-virtual-list 16.0.1 → 16.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/esm2022/lib/components/ng-virtual-list-item.component.mjs +85 -0
- package/esm2022/lib/const/index.mjs +34 -0
- package/esm2022/lib/enums/direction.mjs +2 -0
- package/esm2022/lib/enums/directions.mjs +18 -0
- package/esm2022/lib/enums/index.mjs +3 -0
- package/esm2022/lib/models/collection.model.mjs +3 -0
- package/esm2022/lib/models/index.mjs +2 -0
- package/esm2022/lib/models/item.model.mjs +3 -0
- package/esm2022/lib/models/render-collection.model.mjs +3 -0
- package/esm2022/lib/models/render-item-config.model.mjs +2 -0
- package/esm2022/lib/models/render-item.model.mjs +3 -0
- package/esm2022/lib/models/sticky-map.model.mjs +2 -0
- package/esm2022/lib/ng-virtual-list.component.mjs +516 -0
- package/esm2022/lib/ng-virtual-list.module.mjs +20 -0
- package/esm2022/lib/types/id.mjs +2 -0
- package/esm2022/lib/types/index.mjs +2 -0
- package/esm2022/lib/types/rect.mjs +2 -0
- package/esm2022/lib/types/size.mjs +2 -0
- package/esm2022/lib/utils/cacheMap.mjs +52 -0
- package/esm2022/lib/utils/debounce.mjs +31 -0
- package/esm2022/lib/utils/eventEmitter.mjs +105 -0
- package/esm2022/lib/utils/index.mjs +7 -0
- package/esm2022/lib/utils/isDirection.mjs +15 -0
- package/esm2022/lib/utils/toggleClassName.mjs +15 -0
- package/esm2022/lib/utils/trackBox.mjs +355 -0
- package/esm2022/lib/utils/tracker.mjs +109 -0
- package/esm2022/ng-virtual-list.mjs +5 -0
- package/esm2022/public-api.mjs +8 -0
- package/fesm2022/ng-virtual-list.mjs +17 -16
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +4 -4
- package/lib/const/index.d.ts +1 -1
- package/package.json +3 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Component, ChangeDetectionStrategy, EventEmitter as EventEmitter$1, ViewContainerRef, ElementRef, ViewEncapsulation, ViewChild, Output, Input, NgModule, NO_ERRORS_SCHEMA } 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';
|
|
@@ -64,6 +64,7 @@ const CLASS_LIST_HORIZONTAL = 'horizontal';
|
|
|
64
64
|
*/
|
|
65
65
|
class NgVirtualListItemComponent {
|
|
66
66
|
_cdr;
|
|
67
|
+
_elementRef;
|
|
67
68
|
static __nextId = 0;
|
|
68
69
|
_id;
|
|
69
70
|
get id() {
|
|
@@ -77,7 +78,7 @@ class NgVirtualListItemComponent {
|
|
|
77
78
|
const data = this.data = v;
|
|
78
79
|
if (data) {
|
|
79
80
|
const styles = this._elementRef.nativeElement.style;
|
|
80
|
-
styles.zIndex = data.config.sticky;
|
|
81
|
+
styles.zIndex = String(data.config.sticky);
|
|
81
82
|
if (data.config.snapped) {
|
|
82
83
|
styles.transform = ZEROS_TRANSLATE_3D;
|
|
83
84
|
styles.position = POSITION_STICKY;
|
|
@@ -102,9 +103,9 @@ class NgVirtualListItemComponent {
|
|
|
102
103
|
this.itemRenderer = v;
|
|
103
104
|
this._cdr.markForCheck();
|
|
104
105
|
}
|
|
105
|
-
_elementRef
|
|
106
|
-
constructor(_cdr) {
|
|
106
|
+
constructor(_cdr, _elementRef) {
|
|
107
107
|
this._cdr = _cdr;
|
|
108
|
+
this._elementRef = _elementRef;
|
|
108
109
|
this._id = NgVirtualListItemComponent.__nextId = NgVirtualListItemComponent.__nextId === Number.MAX_SAFE_INTEGER
|
|
109
110
|
? 0 : NgVirtualListItemComponent.__nextId + 1;
|
|
110
111
|
}
|
|
@@ -126,15 +127,15 @@ class NgVirtualListItemComponent {
|
|
|
126
127
|
}
|
|
127
128
|
styles.visibility = VISIBILITY_HIDDEN;
|
|
128
129
|
}
|
|
129
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
130
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListItemComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
131
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgVirtualListItemComponent, 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
132
|
}
|
|
132
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
|
|
133
134
|
type: Component,
|
|
134
135
|
args: [{ selector: 'ng-virtual-list-item', standalone: false, host: {
|
|
135
136
|
'class': 'ngvl__item',
|
|
136
137
|
}, 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: ()
|
|
138
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; } });
|
|
138
139
|
|
|
139
140
|
const HORIZONTAL_ALIASES = [Directions.HORIZONTAL, 'horizontal'], VERTICAL_ALIASES = [Directions.VERTICAL, 'vertical'];
|
|
140
141
|
/**
|
|
@@ -1280,13 +1281,13 @@ class NgVirtualListComponent {
|
|
|
1280
1281
|
}
|
|
1281
1282
|
}
|
|
1282
1283
|
}
|
|
1283
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1284
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1284
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1285
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NgVirtualListComponent, 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
1286
|
}
|
|
1286
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListComponent, decorators: [{
|
|
1287
1288
|
type: Component,
|
|
1288
1289
|
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: ()
|
|
1290
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { _listContainerRef: [{
|
|
1290
1291
|
type: ViewChild,
|
|
1291
1292
|
args: ['renderersContainer', { read: ViewContainerRef }]
|
|
1292
1293
|
}], _container: [{
|
|
@@ -1320,11 +1321,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1320
1321
|
}] } });
|
|
1321
1322
|
|
|
1322
1323
|
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: "
|
|
1324
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1325
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListModule, declarations: [NgVirtualListComponent, NgVirtualListItemComponent], imports: [CommonModule], exports: [NgVirtualListComponent] });
|
|
1326
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListModule, imports: [CommonModule] });
|
|
1326
1327
|
}
|
|
1327
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgVirtualListModule, decorators: [{
|
|
1328
1329
|
type: NgModule,
|
|
1329
1330
|
args: [{
|
|
1330
1331
|
declarations: [NgVirtualListComponent, NgVirtualListItemComponent],
|