ng-virtual-list 14.2.0 → 14.3.0
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 +2 -2
- package/esm2020/lib/utils/tracker.mjs +1 -1
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/ng-virtual-list.mjs +41 -9
- package/fesm2015/ng-virtual-list.mjs.map +1 -1
- package/fesm2020/ng-virtual-list.mjs +41 -9
- package/fesm2020/ng-virtual-list.mjs.map +1 -1
- package/lib/components/ng-virtual-list-item.component.d.ts +2 -1
- 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
|
@@ -81,14 +81,24 @@ const SCROLL_END = 'scrollend';
|
|
|
81
81
|
const CLASS_LIST_VERTICAL = 'vertical';
|
|
82
82
|
const CLASS_LIST_HORIZONTAL = 'horizontal';
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Virtual List Item Interface
|
|
86
|
+
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/models/base-virtual-list-item-component.ts
|
|
87
|
+
* @author Evgenii Grebennikov
|
|
88
|
+
* @email djonnyx@gmail.com
|
|
89
|
+
*/
|
|
90
|
+
class BaseVirtualListItemComponent {
|
|
91
|
+
}
|
|
92
|
+
|
|
84
93
|
/**
|
|
85
94
|
* Virtual list item component
|
|
86
95
|
* @link https://github.com/DjonnyX/ng-virtual-list/blob/14.x/projects/ng-virtual-list/src/lib/components/ng-virtual-list-item.component.ts
|
|
87
96
|
* @author Evgenii Grebennikov
|
|
88
97
|
* @email djonnyx@gmail.com
|
|
89
98
|
*/
|
|
90
|
-
class NgVirtualListItemComponent {
|
|
99
|
+
class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
|
|
91
100
|
constructor(_cdr, _elementRef) {
|
|
101
|
+
super();
|
|
92
102
|
this._cdr = _cdr;
|
|
93
103
|
this._elementRef = _elementRef;
|
|
94
104
|
this.regular = false;
|
|
@@ -200,7 +210,7 @@ class NgVirtualListItemComponent {
|
|
|
200
210
|
}
|
|
201
211
|
NgVirtualListItemComponent.__nextId = 0;
|
|
202
212
|
NgVirtualListItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListItemComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
203
|
-
NgVirtualListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", 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}\"></ng-container>\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;will-change:scroll-position}.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 });
|
|
213
|
+
NgVirtualListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: NgVirtualListItemComponent, selector: "ng-virtual-list-item", host: { classAttribute: "ngvl__item" }, usesInheritance: true, 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}\"></ng-container>\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;will-change:scroll-position}.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 });
|
|
204
214
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
|
|
205
215
|
type: Component,
|
|
206
216
|
args: [{ selector: 'ng-virtual-list-item', host: {
|
|
@@ -1476,6 +1486,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1476
1486
|
this.$enabledBufferOptimization = this._$enabledBufferOptimization.asObservable();
|
|
1477
1487
|
this._$itemRenderer = new BehaviorSubject(undefined);
|
|
1478
1488
|
this.$itemRenderer = this._$itemRenderer.asObservable();
|
|
1489
|
+
this._$renderer = new BehaviorSubject(undefined);
|
|
1479
1490
|
this._$stickyMap = new BehaviorSubject({});
|
|
1480
1491
|
this.$stickyMap = this._$stickyMap.asObservable();
|
|
1481
1492
|
this._itemSizeOptions = (v) => {
|
|
@@ -1560,10 +1571,18 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1560
1571
|
}
|
|
1561
1572
|
};
|
|
1562
1573
|
this._$initialized = new BehaviorSubject(false);
|
|
1574
|
+
/**
|
|
1575
|
+
* Base class of the element component
|
|
1576
|
+
*/
|
|
1577
|
+
this._itemComponentClass = NgVirtualListItemComponent;
|
|
1578
|
+
/**
|
|
1579
|
+
* Base class trackBox
|
|
1580
|
+
*/
|
|
1581
|
+
this._trackBoxClass = TrackBox;
|
|
1563
1582
|
/**
|
|
1564
1583
|
* Dictionary of element sizes by their id
|
|
1565
1584
|
*/
|
|
1566
|
-
this._trackBox = new
|
|
1585
|
+
this._trackBox = new this._trackBoxClass(this.trackBy);
|
|
1567
1586
|
this._onTrackBoxChangeHandler = (v) => {
|
|
1568
1587
|
this._$cacheVersion.next(v);
|
|
1569
1588
|
};
|
|
@@ -1649,9 +1668,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1649
1668
|
}
|
|
1650
1669
|
return of(displayItems);
|
|
1651
1670
|
})).subscribe();
|
|
1652
|
-
|
|
1653
|
-
this.resetRenderers(itemRenderer);
|
|
1654
|
-
}));
|
|
1671
|
+
this.setupRenderer();
|
|
1655
1672
|
}
|
|
1656
1673
|
/**
|
|
1657
1674
|
* Readonly. Returns the unique identifier of the component.
|
|
@@ -1797,8 +1814,17 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1797
1814
|
get snappingMethod() { return this._$snappingMethod.getValue(); }
|
|
1798
1815
|
get isSnappingMethodAdvanced() { return this._isSnappingMethodAdvanced; }
|
|
1799
1816
|
get $cacheVersion() { return this._$cacheVersion.asObservable(); }
|
|
1817
|
+
setupRenderer() {
|
|
1818
|
+
const $itemRenderer = this.$itemRenderer;
|
|
1819
|
+
$itemRenderer.pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), filter(v => !!v), tap(v => {
|
|
1820
|
+
this._$renderer.next(v);
|
|
1821
|
+
})).subscribe();
|
|
1822
|
+
}
|
|
1800
1823
|
/** @internal */
|
|
1801
1824
|
ngOnInit() {
|
|
1825
|
+
this.onInit();
|
|
1826
|
+
}
|
|
1827
|
+
onInit() {
|
|
1802
1828
|
this._$initialized.next(true);
|
|
1803
1829
|
}
|
|
1804
1830
|
listenCacheChangesIfNeed(value) {
|
|
@@ -1828,7 +1854,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1828
1854
|
}
|
|
1829
1855
|
if (this._isSnappingMethodAdvanced && this.snap) {
|
|
1830
1856
|
if (!this._snapedDisplayComponent && this._snapContainerRef) {
|
|
1831
|
-
const comp = this._snapContainerRef.createComponent(
|
|
1857
|
+
const comp = this._snapContainerRef.createComponent(this._itemComponentClass);
|
|
1832
1858
|
comp.instance.regular = true;
|
|
1833
1859
|
this._snapedDisplayComponent = comp;
|
|
1834
1860
|
this._trackBox.snapedDisplayComponent = this._snapedDisplayComponent;
|
|
@@ -1841,7 +1867,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1841
1867
|
const maxLength = displayItems.length, components = this._displayComponents;
|
|
1842
1868
|
while (components.length < maxLength) {
|
|
1843
1869
|
if (_listContainerRef) {
|
|
1844
|
-
const comp = _listContainerRef.createComponent(
|
|
1870
|
+
const comp = _listContainerRef.createComponent(this._itemComponentClass);
|
|
1845
1871
|
components.push(comp);
|
|
1846
1872
|
this._componentsResizeObserver.observe(comp.instance.element);
|
|
1847
1873
|
}
|
|
@@ -1949,6 +1975,9 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1949
1975
|
}
|
|
1950
1976
|
/** @internal */
|
|
1951
1977
|
ngAfterViewInit() {
|
|
1978
|
+
this.afterViewInit();
|
|
1979
|
+
}
|
|
1980
|
+
afterViewInit() {
|
|
1952
1981
|
const containerEl = this._container;
|
|
1953
1982
|
if (containerEl) {
|
|
1954
1983
|
// for direction calculation
|
|
@@ -1963,6 +1992,9 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1963
1992
|
/** @internal */
|
|
1964
1993
|
ngOnDestroy() {
|
|
1965
1994
|
super.ngOnDestroy();
|
|
1995
|
+
this.dispose();
|
|
1996
|
+
}
|
|
1997
|
+
dispose() {
|
|
1966
1998
|
this.clearScrollToRepeatExecutionTimeout();
|
|
1967
1999
|
if (this._trackBox) {
|
|
1968
2000
|
this._trackBox.dispose();
|
|
@@ -2065,5 +2097,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2065
2097
|
* Generated bundle index. Do not edit.
|
|
2066
2098
|
*/
|
|
2067
2099
|
|
|
2068
|
-
export { Directions, NgVirtualListComponent, NgVirtualListModule, SnappingMethods };
|
|
2100
|
+
export { BaseVirtualListItemComponent, Directions, NgVirtualListComponent, NgVirtualListItemComponent, NgVirtualListModule, SnappingMethods };
|
|
2069
2101
|
//# sourceMappingURL=ng-virtual-list.mjs.map
|