{"version":3,"sources":["../../src/app/components/blockui/blockui.ts"],"names":["BlockUI","el","cd","this","autoZIndex","baseZIndex","Object","defineProperty","prototype","_blocked","val","mask","nativeElement","block","unblock","ngAfterViewInit","target","getBlockableElement","ngAfterContentInit","_this","templates","forEach","item","getType","contentTemplate","template","appendChild","style","position","document","body","zIndex","String","DomHandler","zindex","ngOnDestroy","Component","args","selector","changeDetection","ChangeDetectionStrategy","OnPush","encapsulation","ViewEncapsulation","None","ElementRef","ChangeDetectorRef","Input","ContentChildren","PrimeTemplate","ViewChild","NgModule","imports","CommonModule","exports","declarations"],"mappings":"8gBAmCI,SAAAA,EAAmBC,EAAuBC,GAAvBC,KAAAF,GAAAA,EAAuBE,KAAAD,GAAAA,EAdjCC,KAAAC,YAAsB,EAEtBD,KAAAE,WAAqB,SAc9BC,OAAAC,eAAaP,EAAAQ,UAAA,UAAO,KAApB,WACI,OAAOL,KAAKM,cAGhB,SAAYC,GACRP,KAAKM,SAAWC,EAEZP,KAAKQ,MAAQR,KAAKQ,KAAKC,gBACnBT,KAAKM,SACLN,KAAKU,QAELV,KAAKW,4CAIjBd,EAAAQ,UAAAO,gBAAA,WACI,GAAIZ,KAAKa,SAAWb,KAAKa,OAAOC,oBAC5B,KAAM,0DAIdjB,EAAAQ,UAAAU,mBAAA,WAAA,IAAAC,EAAAhB,KACIA,KAAKiB,UAAUC,SAAQ,SAACC,GACpB,OAAOA,EAAKC,WACR,IAAK,UAIL,QACIJ,EAAKK,gBAAkBF,EAAKG,cAM5CzB,EAAAQ,UAAAK,MAAA,WACQV,KAAKa,QACLb,KAAKa,OAAOC,sBAAsBS,YAAYvB,KAAKQ,KAAKC,eACxDT,KAAKa,OAAOC,sBAAsBU,MAAMC,SAAW,YAGnDC,SAASC,KAAKJ,YAAYvB,KAAKQ,KAAKC,eAGpCT,KAAKC,aACLD,KAAKQ,KAAKC,cAAce,MAAMI,OAASC,OAAO7B,KAAKE,cAAgB4B,EAAAA,WAAWC,UAItFlC,EAAAQ,UAAAM,QAAA,WACIX,KAAKF,GAAGW,cAAcc,YAAYvB,KAAKQ,KAAKC,gBAGhDZ,EAAAQ,UAAA2B,YAAA,WACIhC,KAAKW,oCAtFZsB,EAAAA,UAASC,KAAA,CAAC,CACPC,SAAU,YACVb,SAAU,oUAMVc,gBAAiBC,EAAAA,wBAAwBC,OACzCC,cAAeC,EAAAA,kBAAkBC,2ZAdoBC,EAAAA,kBAAiEC,EAAAA,qDAmBrHC,EAAAA,0BAEAA,EAAAA,0BAEAA,EAAAA,0BAEAA,EAAAA,yBAEAC,EAAAA,gBAAeX,KAAA,CAACY,EAAAA,6BAEhBC,EAAAA,UAASb,KAAA,CAAC,yBAQVU,EAAAA,eA+DL,iCALCI,EAAAA,SAAQd,KAAA,CAAC,CACNe,QAAS,CAACC,EAAAA,cACVC,QAAS,CAACtD,GACVuD,aAAc,CAACvD","sourcesContent":["import {NgModule,Component,Input,AfterViewInit,OnDestroy,ElementRef,ViewChild,ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, ContentChildren, QueryList, TemplateRef} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {DomHandler} from 'primeng/dom';\nimport {PrimeTemplate} from 'primeng/api';\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})\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;\n\n @ViewChild('mask') mask: ElementRef;\n \n _blocked: boolean;\n\n contentTemplate: TemplateRef;\n \n constructor(public el: ElementRef, public cd: ChangeDetectorRef) {}\n \n @Input() get blocked(): boolean {\n return this._blocked;\n }\n \n set blocked(val: boolean) {\n this._blocked = val;\n \n if (this.mask && this.mask.nativeElement) {\n if (this._blocked)\n this.block();\n else\n this.unblock();\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 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 this.mask.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex));\n }\n }\n \n unblock() {\n this.el.nativeElement.appendChild(this.mask.nativeElement);\n }\n \n ngOnDestroy() {\n this.unblock();\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [BlockUI],\n declarations: [BlockUI]\n})\nexport class BlockUIModule { }"]}