{"version":3,"file":"primeng-virtualscroller.mjs","sources":["../../src/app/components/virtualscroller/virtualscroller.ts","../../src/app/components/virtualscroller/primeng-virtualscroller.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n AfterContentInit,\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChild,\n ContentChildren,\n ElementRef,\n EventEmitter,\n Input,\n NgModule,\n Output,\n QueryList,\n TemplateRef,\n ViewChild,\n ViewEncapsulation\n} from '@angular/core';\nimport { BlockableUI, Footer, Header, LicenseManager, PrimeTemplate, SharedModule } from 'primeng/api';\nimport { Scroller, ScrollerModule, ScrollerOptions } from 'primeng/scroller';\n\n@Component({\n selector: 'p-virtualScroller',\n template: `\n
\n
\n \n \n
\n
\n \n \n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n `,\n changeDetection: ChangeDetectionStrategy.Default,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'p-element'\n }\n})\nexport class VirtualScroller implements AfterContentInit, BlockableUI, AfterViewInit {\n @Input() value: any[];\n\n @Input() itemSize: number;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() scrollHeight: any;\n\n @Input() lazy: boolean;\n\n @Input() options: ScrollerOptions;\n\n @Input() delay: number = 250;\n\n @ContentChild(Header) header: Header;\n\n @ContentChild(Footer) footer: Footer;\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n @ViewChild('scroller') scroller: Scroller;\n\n @Output() onLazyLoad: EventEmitter = new EventEmitter();\n\n itemTemplate: TemplateRef;\n\n headerTemplate: TemplateRef;\n\n footerTemplate: TemplateRef;\n\n loadingItemTemplate: TemplateRef;\n\n virtualScrollTimeout: any;\n\n constructor(public el: ElementRef, public cd: ChangeDetectorRef) {}\n\n ngAfterViewInit() {\n LicenseManager.check();\n }\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch (item.getType()) {\n case 'item':\n this.itemTemplate = item.template;\n break;\n\n case 'loadingItem':\n this.loadingItemTemplate = item.template;\n break;\n\n case 'header':\n this.headerTemplate = item.template;\n break;\n\n case 'footer':\n this.footerTemplate = item.template;\n break;\n\n default:\n this.itemTemplate = item.template;\n break;\n }\n });\n }\n\n onLazyItemLoad(event) {\n if (this.virtualScrollTimeout) {\n clearTimeout(this.virtualScrollTimeout);\n }\n\n this.virtualScrollTimeout = setTimeout(() => {\n this.onLazyLoad.emit({\n ...event,\n rows: event.last - event.first,\n forceUpdate: () => this.cd.detectChanges()\n });\n }, this.delay);\n }\n\n getBlockableElement(): HTMLElement {\n return this.el.nativeElement.children[0];\n }\n\n scrollToIndex(index: number, mode?: ScrollBehavior): void {\n this.scroller?.scrollToIndex(index, mode);\n }\n}\n\n@NgModule({\n imports: [CommonModule, SharedModule, ScrollerModule],\n exports: [VirtualScroller, SharedModule, ScrollerModule],\n declarations: [VirtualScroller]\n})\nexport class VirtualScrollerModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;MAmDa,eAAe,CAAA;IAqCxB,WAAmB,CAAA,EAAc,EAAS,EAAqB,EAAA;AAA5C,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;AAAS,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAmB;AAtBtD,QAAA,IAAK,CAAA,KAAA,GAAW,GAAG,CAAC;AAUnB,QAAA,IAAA,CAAA,UAAU,GAAsB,IAAI,YAAY,EAAE,CAAC;KAYM;IAEnE,eAAe,GAAA;QACX,cAAc,CAAC,KAAK,EAAE,CAAC;KAC1B;IAED,kBAAkB,GAAA;QACd,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;AAC5B,YAAA,QAAQ,IAAI,CAAC,OAAO,EAAE;AAClB,gBAAA,KAAK,MAAM;AACP,oBAAA,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;oBAClC,MAAM;AAEV,gBAAA,KAAK,aAAa;AACd,oBA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