Icard/angular-clarity-master(work.../node_modules/primeng/fesm2022/primeng-defer.mjs.map

1 line
6.5 KiB
Plaintext
Raw Permalink Normal View History

2024-07-16 15:23:22 +00:00
{"version":3,"file":"primeng-defer.mjs","sources":["../../src/app/components/defer/defer.ts","../../src/app/components/defer/primeng-defer.ts"],"sourcesContent":["import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { AfterViewInit, ChangeDetectorRef, ContentChild, Directive, ElementRef, EmbeddedViewRef, EventEmitter, Inject, NgModule, OnDestroy, Output, PLATFORM_ID, Renderer2, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { Nullable } from 'primeng/ts-helpers';\n/**\n * Defer postpones the loading the content that is initially not in the viewport until it becomes visible on scroll.\n * @group Components\n */\n@Directive({\n selector: '[pDefer]',\n host: {\n class: 'p-element'\n }\n})\nexport class DeferredLoader implements AfterViewInit, OnDestroy {\n /**\n * Callback to invoke when deferred content is loaded.\n * @param {Event} event - Browser event.\n * @group Emits\n */\n @Output() onLoad: EventEmitter<Event> = new EventEmitter<Event>();\n\n @ContentChild(TemplateRef) template: TemplateRef<any> | undefined;\n\n documentScrollListener: Nullable<Function>;\n\n view: Nullable<EmbeddedViewRef<any>>;\n\n window: Window;\n\n constructor(@Inject(DOCUMENT) private document: Document, @Inject(PLATFORM_ID) private platformId: any, public el: ElementRef, public renderer: Renderer2, public viewContainer: ViewContainerRef, private cd: ChangeDetectorRef) {\n this.window = this.document.defaultView as Window;\n }\n\n ngAfterViewInit() {\n if (isPlatformBrowser(this.platformId)) {\n if (this.shouldLoad()) {\n this.load();\n }\n\n if (!this.isLoaded()) {\n this.documentScrollListener = this.renderer.listen(this.window, 'scroll', () => {\n if (this.shouldLoad()) {\n this.load();\n this.documentScrollListener && this.documentScrollListener();\n this.documentScrollListener = null;\n }\n });\n }\n }\n }\n\n shouldLoad(): boolean {\n if (this.isLoaded()) {\n return false;\n } else {\n let rect = this.el.nativeElement.getBoundingClientRect();\n let docElement = this.document.documentElement;\n let winHeight = docElement.clientHeight;\n\n return winHeight >= rect.top;\n }\n }\n\n load(): void {\n this.view = this.viewContainer.createEmbeddedView(this.template as TemplateRef<any>);\n this.onLoad.emit();\n this.cd.detectChanges();\n }\n\n isLoaded() {\n return this.view != null && isPlatformBrowser(this.platformId);\n }\n\n ngOnDestroy() {\n this.view = null;\n\n if (this.documentScrollListener) {\n this.documentScrollListener();\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [DeferredLoader],\n declarations: [DeferredLoader]\n})\nexport class DeferModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;AAGA;;;AAGG;MAOU,cAAc,CAAA;AAgBe,IAAA,QAAA,CAAA;AAAiD,IAAA,UAAA,CAAA;AAAwB,IAAA,EAAA,CAAA;AAAuB,IAAA,QAAA,CAAA;AAA4B,IAAA,aAAA,CAAA;AAAyC,IAAA,EAAA,CAAA;AAf3M;;;;AAIG;AACO,IAAA,MAAM,GAAwB,IAAI,YAAY,EAAS,CAAC;AAEvC,IAAA,QAAQ,CAA+B;AAElE,IAAA,sBAAsB,CAAqB;AAE3C,IAAA,IAAI,CAAiC;AAErC,IAAA,MAAM,CAAS;IAEf,WAAsC,CAAA,QAAkB,EAA+B,UAAe,EAAS,EAAc,EAAS,QAAmB,EAAS,aAA+B,EAAU,EAAqB,EAAA;QAA1L,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;QAA+B,IAAU,CAAA,UAAA,GAAV,UAAU,CAAK;QAAS,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;QAAS,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAW;QAAS,IAAa,CAAA,aAAA,GAAb,aAAa,CAAkB;QAAU,IAAE,CAAA,EAAA,GAAF,EAAE,CAAmB;QAC5N,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAqB,CAAC;KACrD;IAED,eAAe,GAAA;AACX,QAAA,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;AACpC,YAAA,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;gBACnB,IAAI,CAAC,IAAI,EAAE,CAAC;AACf,aAAA;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;AAClB,gBAAA,IAAI,CAAC,sBAAsB,GA