import { NgModule, Component, Input, Output, ViewChild, EventEmitter, ContentChild, ContentChildren, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Header, Footer, PrimeTemplate, SharedModule } from 'primeng/api';
import { ScrollingModule, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import * as i0 from "@angular/core";
import * as i1 from "@angular/cdk/scrolling";
import * as i2 from "@angular/common";
export class VirtualScroller {
constructor(el) {
this.el = el;
this.delay = 250;
this.trackBy = (index, item) => item;
this.onLazyLoad = new EventEmitter();
this._totalRecords = 0;
this.page = 0;
this._first = 0;
}
get totalRecords() {
return this._totalRecords;
}
set totalRecords(val) {
this._totalRecords = val;
console.log("totalRecords is deprecated, provide a value with the length of virtual items instead.");
}
get first() {
return this._first;
}
set first(val) {
this._first = val;
console.log("first property is deprecated, use scrollToIndex function to scroll a specific item.");
}
get cache() {
return this._cache;
}
set cache(val) {
this._cache = val;
console.log("cache is deprecated as it is always on.");
}
ngAfterContentInit() {
this.templates.forEach((item) => {
switch (item.getType()) {
case 'item':
this.itemTemplate = item.template;
break;
case 'loadingItem':
this.loadingItemTemplate = item.template;
break;
case 'header':
this.headerTemplate = item.template;
break;
case 'footer':
this.footerTemplate = item.template;
break;
default:
this.itemTemplate = item.template;
break;
}
});
}
onScrollIndexChange(index) {
if (this.lazy) {
if (this.virtualScrollTimeout) {
clearTimeout(this.virtualScrollTimeout);
}
this.virtualScrollTimeout = setTimeout(() => {
let page = Math.floor(index / this.rows);
let virtualScrollOffset = page === 0 ? 0 : (page - 1) * this.rows;
let virtualScrollChunkSize = page === 0 ? this.rows * 2 : this.rows * 3;
if (page !== this.virtualPage) {
this.virtualPage = page;
this.onLazyLoad.emit({ first: virtualScrollOffset, rows: virtualScrollChunkSize });
}
}, this.delay);
}
}
getBlockableElement() {
return this.el.nativeElement.children[0];
}
//@deprecated
scrollTo(index, mode) {
this.scrollToIndex(index, mode);
}
scrollToIndex(index, mode) {
if (this.viewport) {
this.viewport.scrollToIndex(index, mode);
}
}
}
VirtualScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: VirtualScroller, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
VirtualScroller.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: VirtualScroller, selector: "p-virtualScroller", inputs: { value: "value", itemSize: "itemSize", style: "style", styleClass: "styleClass", scrollHeight: "scrollHeight", lazy: "lazy", rows: "rows", minBufferPx: "minBufferPx", maxBufferPx: "maxBufferPx", delay: "delay", trackBy: "trackBy", totalRecords: "totalRecords", first: "first", cache: "cache" }, outputs: { onLazyLoad: "onLazyLoad" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "header", first: true, predicate: Header, descendants: true }, { propertyName: "footer", first: true, predicate: Footer, descendants: true }, { propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], ngImport: i0, template: `
`, isInline: true, styles: ["cdk-virtual-scroll-viewport{outline:0 none}\n"], components: [{ type: i1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { type: i1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: VirtualScroller, decorators: [{
type: Component,
args: [{ selector: 'p-virtualScroller', template: `
`, changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None, host: {
'class': 'p-element'
}, styles: ["cdk-virtual-scroll-viewport{outline:0 none}\n"] }]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { value: [{
type: Input
}], itemSize: [{
type: Input
}], style: [{
type: Input
}], styleClass: [{
type: Input
}], scrollHeight: [{
type: Input
}], lazy: [{
type: Input
}], rows: [{
type: Input
}], minBufferPx: [{
type: Input
}], maxBufferPx: [{
type: Input
}], delay: [{
type: Input
}], trackBy: [{
type: Input
}], header: [{
type: ContentChild,
args: [Header]
}], footer: [{
type: ContentChild,
args: [Footer]
}], templates: [{
type: ContentChildren,
args: [PrimeTemplate]
}], viewport: [{
type: ViewChild,
args: [CdkVirtualScrollViewport]
}], onLazyLoad: [{
type: Output
}], totalRecords: [{
type: Input
}], first: [{
type: Input
}], cache: [{
type: Input
}] } });
export class VirtualScrollerModule {
}
VirtualScrollerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: VirtualScrollerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
VirtualScrollerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: VirtualScrollerModule, declarations: [VirtualScroller], imports: [CommonModule, ScrollingModule], exports: [VirtualScroller, SharedModule, ScrollingModule] });
VirtualScrollerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: VirtualScrollerModule, imports: [[CommonModule, ScrollingModule], SharedModule, ScrollingModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: VirtualScrollerModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule, ScrollingModule],
exports: [VirtualScroller, SharedModule, ScrollingModule],
declarations: [VirtualScroller]
}]
}] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmlydHVhbHNjcm9sbGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FwcC9jb21wb25lbnRzL3ZpcnR1YWxzY3JvbGxlci92aXJ0dWFsc2Nyb2xsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFFBQVEsRUFBQyxTQUFTLEVBQTZCLEtBQUssRUFBQyxNQUFNLEVBQUMsU0FBUyxFQUFDLFlBQVksRUFBQyxZQUFZLEVBQUMsZUFBZSxFQUF1Qix1QkFBdUIsRUFBRSxpQkFBaUIsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUMvTSxPQUFPLEVBQUMsWUFBWSxFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFDN0MsT0FBTyxFQUFDLE1BQU0sRUFBQyxNQUFNLEVBQUMsYUFBYSxFQUFDLFlBQVksRUFBQyxNQUFNLGFBQWEsQ0FBQztBQUNyRSxPQUFPLEVBQUMsZUFBZSxFQUFDLHdCQUF3QixFQUFDLE1BQU0sd0JBQXdCLENBQUM7Ozs7QUFtQ2hGLE1BQU0sT0FBTyxlQUFlO0lBc0R4QixZQUFtQixFQUFjO1FBQWQsT0FBRSxHQUFGLEVBQUUsQ0FBWTtRQWxDeEIsVUFBSyxHQUFXLEdBQUcsQ0FBQztRQUVwQixZQUFPLEdBQWEsQ0FBQyxLQUFhLEVBQUUsSUFBUyxFQUFFLEVBQUUsQ0FBQyxJQUFJLENBQUM7UUFVdEQsZUFBVSxHQUFzQixJQUFJLFlBQVksRUFBRSxDQUFDO1FBVTdELG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AgICAgICAgICAgICAgICAgIHRoaXMuZm9vdGVyVGVtcGxhdGUgPSBpdGVtLnRlbXBsYXRlO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5pdGVtVGVtcGxhdGUgPSBpdGVtLnRlbXBsYXRlO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBvblNjcm9sbEluZGV4Q2hhbmdlKGluZGV4OiBudW1iZXIpIHtcbiAgICAgICAgaWYgKHRoaXMubGF6eSkge1xuICAgICAgICAgICAgaWYgKHRoaXMudmlydHVhbFNjcm9sbFRpbWVvdXQpIHtcbiAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodGhpcy52aXJ0dWFsU2Nyb2xsVGltZW91dCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRoaXMudmlydHVhbFNjcm9sbFRpbWVvdXQgPSBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICBsZXQgcGFnZSA9IE1hdGguZmxvb3IoaW5kZXggLyB0aGlzLnJvd3MpO1xuICAgICAgICAgICAgICAgIGxldCB2aXJ0dWFsU2Nyb2xsT2Zmc2V0ID0gcGFnZSA9PT0gMCA/IDAgOiAocGFnZSAtIDEpICogdGhpcy5yb3dzO1xuICAgICAgICAgICAgICAgIGxldCB2aXJ0dWFsU2Nyb2xsQ2h1bmtTaXplID0gcGFnZSA9PT0gMCA/IHRoaXMucm93cyAqIDIgOiB0aGlzLnJvd3MgKiAzO1xuXG4gICAgICAgICAgICAgICAgaWYgKHBhZ2UgIT09IHRoaXMudmlydHVhbFBhZ2UpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy52aXJ0dWFsUGFnZSA9IHBhZ2U7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMub25MYXp5TG9hZC5lbWl0KHt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