{"version":3,"file":"primeng-blockui.mjs","sources":["../../src/app/components/blockui/blockui.ts","../../src/app/components/blockui/primeng-blockui.ts"],"sourcesContent":["import { CommonModule, DOCUMENT } from '@angular/common';\nimport { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, Inject, Input, NgModule, OnDestroy, QueryList, Renderer2, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core';\nimport { LicenseManager, PrimeNGConfig, PrimeTemplate } from 'primeng/api';\nimport { DomHandler } from 'primeng/dom';\nimport { ZIndexUtils } from 'primeng/utils';\n\n@Component({\n selector: 'p-blockUI',\n template: `\n
\n \n \n
\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./blockui.css'],\n host: {\n class: 'p-element'\n }\n})\nexport class BlockUI implements AfterViewInit, OnDestroy {\n @Input() target: any;\n\n @Input() autoZIndex: boolean = true;\n\n @Input() baseZIndex: number = 0;\n\n @Input() styleClass: string;\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n @ViewChild('mask') mask: ElementRef;\n\n _blocked: boolean;\n\n animationEndListener: VoidFunction | null;\n\n contentTemplate: TemplateRef;\n\n constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig, private renderer: Renderer2) {}\n\n @Input() get blocked(): boolean {\n return this._blocked;\n }\n\n set blocked(val: boolean) {\n if (this.mask && this.mask.nativeElement) {\n if (val) this.block();\n else this.unblock();\n } else {\n this._blocked = val;\n }\n }\n\n ngAfterViewInit() {\n if (this.target && !this.target.getBlockableElement) {\n throw 'Target of BlockUI must implement BlockableUI interface';\n }\n\n LicenseManager.check();\n }\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch (item.getType()) {\n case 'content':\n this.contentTemplate = item.template;\n break;\n\n default:\n this.contentTemplate = item.template;\n break;\n }\n });\n }\n\n block() {\n this._blocked = true;\n\n if (this.target) {\n this.target.getBlockableElement().appendChild(this.mask.nativeElement);\n this.target.getBlockableElement().style.position = 'relative';\n } else {\n this.renderer.appendChild(this.document.body, this.mask.nativeElement);\n }\n\n if (this.autoZIndex) {\n ZIndexUtils.set('modal', this.mask.nativeElement, this.baseZIndex + this.config.zIndex.modal);\n }\n }\n\n unblock() {\n if (this.mask) {\n this.animationEndListener = this.renderer.listen(this.mask.nativeElement, 'animationend', this.destroyModal.bind(this));\n DomHandler.addClass(this.mask.nativeElement, 'p-component-overlay-leave');\n }\n }\n\n destroyModal() {\n this._blocked = false;\n if (this.mask) {\n DomHandler.removeClass(this.mask.nativeElement, 'p-component-overlay-leave');\n ZIndexUtils.clear(this.mask.nativeElement);\n this.renderer.appendChild(this.el.nativeElement, this.mask.nativeElement);\n }\n this.unbindAnimationEndListener();\n this.cd.markForCheck();\n }\n\n unbindAnimationEndListener() {\n if (this.animationEndListener && this.mask) {\n this.animationEndListener();\n this.animationEndListener = null;\n }\n }\n\n ngOnDestroy() {\n this.unblock();\n this.destroyModal();\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [BlockUI],\n declarations: [BlockUI]\n})\nexport class BlockUIModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;MAqBa,OAAO,CAAA;IAmBhB,WAAsC,CAAA,QAAkB,EAAS,EAAc,EAAS,EAAqB,EAAS,MAAqB,EAAU,QAAmB,EAAA;AAAlI,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;AAAS,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;AAAS,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAmB;AAAS,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;AAAU,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAW;AAhB/J,QAAA,IAAU,CAAA,UAAA,GAAY,IAAI,CAAC;AAE3B,QAAA,IAAU,CAAA,UAAA,GAAW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