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;
|
|
@@ -198,7 +208,7 @@ class NgVirtualListItemComponent {
|
|
|
198
208
|
}
|
|
199
209
|
NgVirtualListItemComponent.__nextId = 0;
|
|
200
210
|
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 });
|
|
201
|
-
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 });
|
|
211
|
+
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 });
|
|
202
212
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NgVirtualListItemComponent, decorators: [{
|
|
203
213
|
type: Component,
|
|
204
214
|
args: [{ selector: 'ng-virtual-list-item', host: {
|
|
@@ -1483,6 +1493,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1483
1493
|
this.$enabledBufferOptimization = this._$enabledBufferOptimization.asObservable();
|
|
1484
1494
|
this._$itemRenderer = new BehaviorSubject(undefined);
|
|
1485
1495
|
this.$itemRenderer = this._$itemRenderer.asObservable();
|
|
1496
|
+
this._$renderer = new BehaviorSubject(undefined);
|
|
1486
1497
|
this._$stickyMap = new BehaviorSubject({});
|
|
1487
1498
|
this.$stickyMap = this._$stickyMap.asObservable();
|
|
1488
1499
|
this._itemSizeOptions = (v) => {
|
|
@@ -1564,10 +1575,18 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1564
1575
|
}
|
|
1565
1576
|
};
|
|
1566
1577
|
this._$initialized = new BehaviorSubject(false);
|
|
1578
|
+
/**
|
|
1579
|
+
* Base class of the element component
|
|
1580
|
+
*/
|
|
1581
|
+
this._itemComponentClass = NgVirtualListItemComponent;
|
|
1582
|
+
/**
|
|
1583
|
+
* Base class trackBox
|
|
1584
|
+
*/
|
|
1585
|
+
this._trackBoxClass = TrackBox;
|
|
1567
1586
|
/**
|
|
1568
1587
|
* Dictionary of element sizes by their id
|
|
1569
1588
|
*/
|
|
1570
|
-
this._trackBox = new
|
|
1589
|
+
this._trackBox = new this._trackBoxClass(this.trackBy);
|
|
1571
1590
|
this._onTrackBoxChangeHandler = (v) => {
|
|
1572
1591
|
this._$cacheVersion.next(v);
|
|
1573
1592
|
};
|
|
@@ -1652,9 +1671,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1652
1671
|
}
|
|
1653
1672
|
return of(displayItems);
|
|
1654
1673
|
})).subscribe();
|
|
1655
|
-
|
|
1656
|
-
this.resetRenderers(itemRenderer);
|
|
1657
|
-
}));
|
|
1674
|
+
this.setupRenderer();
|
|
1658
1675
|
}
|
|
1659
1676
|
/**
|
|
1660
1677
|
* Readonly. Returns the unique identifier of the component.
|
|
@@ -1800,8 +1817,17 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1800
1817
|
get snappingMethod() { return this._$snappingMethod.getValue(); }
|
|
1801
1818
|
get isSnappingMethodAdvanced() { return this._isSnappingMethodAdvanced; }
|
|
1802
1819
|
get $cacheVersion() { return this._$cacheVersion.asObservable(); }
|
|
1820
|
+
setupRenderer() {
|
|
1821
|
+
const $itemRenderer = this.$itemRenderer;
|
|
1822
|
+
$itemRenderer.pipe(takeUntil(this._$unsubscribe), distinctUntilChanged(), filter(v => !!v), tap(v => {
|
|
1823
|
+
this._$renderer.next(v);
|
|
1824
|
+
})).subscribe();
|
|
1825
|
+
}
|
|
1803
1826
|
/** @internal */
|
|
1804
1827
|
ngOnInit() {
|
|
1828
|
+
this.onInit();
|
|
1829
|
+
}
|
|
1830
|
+
onInit() {
|
|
1805
1831
|
this._$initialized.next(true);
|
|
1806
1832
|
}
|
|
1807
1833
|
listenCacheChangesIfNeed(value) {
|
|
@@ -1831,7 +1857,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1831
1857
|
}
|
|
1832
1858
|
if (this._isSnappingMethodAdvanced && this.snap) {
|
|
1833
1859
|
if (!this._snapedDisplayComponent && this._snapContainerRef) {
|
|
1834
|
-
const comp = this._snapContainerRef.createComponent(
|
|
1860
|
+
const comp = this._snapContainerRef.createComponent(this._itemComponentClass);
|
|
1835
1861
|
comp.instance.regular = true;
|
|
1836
1862
|
this._snapedDisplayComponent = comp;
|
|
1837
1863
|
this._trackBox.snapedDisplayComponent = this._snapedDisplayComponent;
|
|
@@ -1844,7 +1870,7 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1844
1870
|
const maxLength = displayItems.length, components = this._displayComponents;
|
|
1845
1871
|
while (components.length < maxLength) {
|
|
1846
1872
|
if (_listContainerRef) {
|
|
1847
|
-
const comp = _listContainerRef.createComponent(
|
|
1873
|
+
const comp = _listContainerRef.createComponent(this._itemComponentClass);
|
|
1848
1874
|
components.push(comp);
|
|
1849
1875
|
this._componentsResizeObserver.observe(comp.instance.element);
|
|
1850
1876
|
}
|
|
@@ -1954,6 +1980,9 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1954
1980
|
}
|
|
1955
1981
|
/** @internal */
|
|
1956
1982
|
ngAfterViewInit() {
|
|
1983
|
+
this.afterViewInit();
|
|
1984
|
+
}
|
|
1985
|
+
afterViewInit() {
|
|
1957
1986
|
const containerEl = this._container;
|
|
1958
1987
|
if (containerEl) {
|
|
1959
1988
|
// for direction calculation
|
|
@@ -1968,6 +1997,9 @@ class NgVirtualListComponent extends DisposableComponent {
|
|
|
1968
1997
|
/** @internal */
|
|
1969
1998
|
ngOnDestroy() {
|
|
1970
1999
|
super.ngOnDestroy();
|
|
2000
|
+
this.dispose();
|
|
2001
|
+
}
|
|
2002
|
+
dispose() {
|
|
1971
2003
|
this.clearScrollToRepeatExecutionTimeout();
|
|
1972
2004
|
if (this._trackBox) {
|
|
1973
2005
|
this._trackBox.dispose();
|
|
@@ -2070,5 +2102,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2070
2102
|
* Generated bundle index. Do not edit.
|
|
2071
2103
|
*/
|
|
2072
2104
|
|
|
2073
|
-
export { Directions, NgVirtualListComponent, NgVirtualListModule, SnappingMethods };
|
|
2105
|
+
export { BaseVirtualListItemComponent, Directions, NgVirtualListComponent, NgVirtualListItemComponent, NgVirtualListModule, SnappingMethods };
|
|
2074
2106
|
//# sourceMappingURL=ng-virtual-list.mjs.map
|