[59329aa] | 1 | {"version":3,"file":"primeng-blockui.mjs","sources":["../../src/app/components/blockui/blockui.ts","../../src/app/components/blockui/primeng-blockui.ts"],"sourcesContent":["import {NgModule,Component,Input,AfterViewInit,OnDestroy,ElementRef,ViewChild,ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, ContentChildren, QueryList, TemplateRef} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {PrimeNGConfig, PrimeTemplate} from 'primeng/api';\nimport {ZIndexUtils} from 'primeng/utils';\nimport { DomHandler } from 'primeng/dom';\n\n@Component({\n selector: 'p-blockUI',\n template: `\n <div #mask [class]=\"styleClass\" [ngClass]=\"{'p-blockui-document':!target, 'p-blockui p-component-overlay p-component-overlay-enter': true}\" [ngStyle]=\"{display: blocked ? 'flex' : 'none'}\">\n <ng-content></ng-content>\n <ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container>\n </div>\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\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<any>;\n\n @ViewChild('mask') mask: ElementRef;\n\n _blocked: boolean;\n\n animationEndListener: any;\n\n contentTemplate: TemplateRef<any>;\n\n constructor(public el: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig) {}\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)\n this.block();\n else\n this.unblock();\n }\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\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 }\n else {\n document.body.appendChild(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 this.animationEndListener = this.destroyModal.bind(this);\n this.mask.nativeElement.addEventListener('animationend', this.animationEndListener);\n DomHandler.addClass(this.mask.nativeElement, 'p-component-overlay-leave')\n }\n\n destroyModal() {\n this._blocked = false;\n DomHandler.removeClass(this.mask.nativeElement, 'p-component-overlay-leave');\n ZIndexUtils.clear(this.mask.nativeElement);\n this.el.nativeElement.appendChild(this.mask.nativeElement);\n this.unbindAnimationEndListener();\n this.cd.markForCheck();\n }\n\n unbindAnimationEndListener() {\n if (this.animationEndListener && this.mask) {\n this.mask.nativeElement.removeEventListener('animationend', 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;IAoBhB,YAAmB,EAAc,EAAS,EAAqB,EAAS,MAAqB;QAA1E,OAAE,GAAF,EAAE,CAAY;QAAS,OAAE,GAAF,EAAE,CAAmB;QAAS,WAAM,GAAN,MAAM,CAAe;QAhBpF,eAAU,GAAY,IAAI,CAAC;QAE3B,eAAU,GAAW,CAAC,CAAC;KAciE;IAEjG,IAAa,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;KACxB;IAED,IAAI,OAAO,CAAC,GAAY;QACpB,IAAI,IAAI,CAA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