1 line
12 KiB
Plaintext
1 line
12 KiB
Plaintext
{"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 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 booleanAttribute,\n numberAttribute\n} from '@angular/core';\nimport { BlockableUI, Footer, Header, PrimeTemplate, ScrollerOptions, SharedModule } from 'primeng/api';\nimport { Scroller, ScrollerModule } from 'primeng/scroller';\nimport { Nullable } from 'primeng/ts-helpers';\nimport { VirtualScrollerLazyLoadEvent } from './virtualscroller.interface';\n/**\n * VirtualScroller is a performant approach to handle huge data efficiently.\n * @group Components\n */\n@Component({\n selector: 'p-virtualScroller',\n template: `\n <div [ngClass]=\"'p-virtualscroller p-component'\" [ngStyle]=\"style\" [class]=\"styleClass\" [attr.data-pc-name]=\"'virtualscroller'\" [attr.data-pc-section]=\"'root'\">\n <div class=\"p-virtualscroller-header\" *ngIf=\"header || headerTemplate\">\n <ng-content select=\"p-header\"></ng-content>\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </div>\n <div #content class=\"p-virtualscroller-content\" [attr.data-pc-section]=\"'content'\">\n <p-scroller #scroller [items]=\"value\" styleClass=\"p-virtualscroller-list\" [style]=\"{ height: scrollHeight }\" [itemSize]=\"itemSize\" [lazy]=\"lazy\" (onLazyLoad)=\"onLazyItemLoad($event)\" [options]=\"options\">\n <ng-template pTemplate=\"item\" let-item let-scrollerOptions=\"options\">\n <div [ngStyle]=\"{ height: itemSize + 'px' }\" class=\"p-virtualscroller-item\">\n <ng-container *ngTemplateOutlet=\"item ? itemTemplate : loadingItemTemplate; context: { $implicit: item, options: scrollerOptions }\"></ng-container>\n </div>\n </ng-template>\n </p-scroller>\n </div>\n <div class=\"p-virtualscroller-footer\" *ngIf=\"footer || footerTemplate\" [attr.data-pc-section]=\"'footer'\">\n <ng-content select=\"p-footer\"></ng-content>\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.Default,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'p-element'\n }\n})\nexport class VirtualScroller implements AfterContentInit, BlockableUI {\n /**\n * An array of objects to display.\n * @group Props\n */\n @Input() value: any[] | undefined;\n /**\n * Height of an item in the list.\n * @group Props\n */\n @Input({ transform: numberAttribute }) itemSize: number | undefined;\n /**\n * Inline style of the component.\n * @group Props\n */\n @Input() style: { [klass: string]: any } | null | undefined;\n /**\n * Style class of the component.\n * @group Props\n */\n @Input() styleClass: string | undefined;\n /**\n * Max height of the content area in inline mode.\n * @group Props\n */\n @Input() scrollHeight: any;\n /**\n * Defines if data is loaded and interacted with in lazy manner.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) lazy: boolean | undefined;\n /**\n * Whether to use the scroller feature. The properties of scroller component can be used like an object in it.\n * @group Props\n */\n @Input() options: ScrollerOptions | undefined;\n /**\n * Threshold in milliseconds to delay lazy loading during scrolling.\n * @group Props\n */\n @Input({ transform: numberAttribute }) delay: number = 250;\n /**\n * Callback to invoke in lazy mode to load new data.\n * @param {VirtualScrollerLazyLoadEvent} event - custom lazy load event.\n * @group Emits\n */\n @Output() onLazyLoad: EventEmitter<VirtualScrollerLazyLoadEvent> = new EventEmitter<VirtualScrollerLazyLoadEvent>();\n\n @ContentChild(Header) header: Header | undefined;\n\n @ContentChild(Footer) footer: Footer | undefined;\n\n @ContentChildren(PrimeTemplate) templates: Nullable<QueryList<PrimeTemplate>>;\n\n @ViewChild('scroller') scroller: Nullable<Scroller>;\n\n itemTemplate: Nullable<TemplateRef<any>>;\n\n headerTemplate: Nullable<TemplateRef<any>>;\n\n footerTemplate: Nullable<TemplateRef<any>>;\n\n loadingItemTemplate: Nullable<TemplateRef<any>>;\n\n virtualScrollTimeout: any;\n\n constructor(public el: ElementRef, public cd: ChangeDetectorRef) {}\n\n ngAfterContentInit() {\n (this.templates as QueryList<PrimeTemplate>).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: VirtualScrollerLazyLoadEvent) {\n if (this.virtualScrollTimeout) {\n clearTimeout(this.virtualScrollTimeout);\n }\n\n this.virtualScrollTimeout = setTimeout(() => {\n this.onLazyLoad.emit({\n ...event,\n rows: <number>event.last - <number>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":";;;;;;;;;AAwBA;;;AAGG;MA8BU,eAAe,CAAA;AAkEL,IAAA,EAAA,CAAA;AAAuB,IAAA,EAAA,CAAA;AAjE1C;;;AAGG;AACM,IAAA,KAAK,CAAoB;AAClC;;;AAGG;AACoC,IAAA,QAAQ,CAAqB;AACpE;;;AAGG;AACM,IAAA,KAAK,CAA8C;AAC5D;;;AAGG;AACM,IAAA,UAAU,CAAqB;AACxC;;;AAGG;AACM,IAAA,YAAY,CAAM;AAC3B;;;AAGG;AACqC,IAAA,IAAI,CAAsB;AAClE;;;AAGG;AACM,IAA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