{"version":3,"file":"primeng-blockui.mjs","sources":["../../src/app/components/blockui/blockui.ts","../../src/app/components/blockui/primeng-blockui.ts"],"sourcesContent":["import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n ElementRef,\n Inject,\n Input,\n NgModule,\n OnDestroy,\n PLATFORM_ID,\n QueryList,\n Renderer2,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n booleanAttribute,\n numberAttribute\n} from '@angular/core';\nimport { PrimeNGConfig, PrimeTemplate } from 'primeng/api';\nimport { DomHandler } from 'primeng/dom';\nimport { ZIndexUtils } from 'primeng/utils';\n/**\n * BlockUI can either block other components or the whole page.\n * @group Components\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 /**\n * Name of the local ng-template variable referring to another component.\n * @group Props\n */\n @Input() target: any;\n /**\n * Whether to automatically manage layering.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) autoZIndex: boolean = true;\n /**\n * Base zIndex value to use in layering.\n * @group Props\n */\n @Input({ transform: numberAttribute }) baseZIndex: number = 0;\n /**\n * Class of the element.\n * @group Props\n */\n @Input() styleClass: string | undefined;\n /**\n * Current blocked state as a boolean.\n * @group Props\n */\n @Input() get blocked(): boolean {\n return this._blocked;\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 @ContentChildren(PrimeTemplate) templates: QueryList | undefined;\n\n @ViewChild('mask') mask: ElementRef | undefined;\n\n _blocked: boolean = false;\n\n animationEndListener: VoidFunction | null | undefined;\n\n contentTemplate: TemplateRef | undefined;\n\n constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig, private renderer: Renderer2, @Inject(PLATFORM_ID) public platformId: any) {}\n\n ngAfterViewInit() {\n if (this._blocked) this.block();\n\n if (this.target && !this.target.getBlockableElement) {\n throw 'Target of BlockUI must implement BlockableUI interface';\n }\n }\n\n ngAfterContentInit() {\n (this.templates as QueryList).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 (isPlatformBrowser(this.platformId)) {\n this._blocked = true;\n (this.mask as ElementRef).nativeElement.style.display = 'flex';\n\n if (this.target) {\n this.target.getBlockableElement().appendChild((this.mask as ElementRef).nativeElement);\n this.target.getBlockableElement().style.position = 'relative';\n } else {\n this.renderer.appendChild(this.document.body, (this.mask as ElementRef).nativeElement);\n DomHandler.blockBodyScroll();\n }\n\n if (this.autoZIndex) {\n ZIndexUtils.set('modal', (this.mask as ElementRef).nativeElement, this.baseZIndex + this.config.zIndex.modal);\n }\n }\n }\n\n unblock() {\n if (isPlatformBrowser(this.platformId) && this.mask && !this.animationEndListener) {\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 && isPlatformBrowser(this.platformId)) {\n ZIndexUtils.clear(this.mask.nativeElement);\n DomHandler.removeClass(this.mask.nativeElement, 'p-component-overlay-leave');\n this.renderer.removeChild(this.el.nativeElement, this.mask.nativeElement);\n DomHandler.unblockBodyScroll();\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":";;;;;;;;;AAwBA;;;AAGG;MAwBU,OAAO,CAAA;AA+CsB,IAAA,QAAA,CAAA;AAA2B,IAAA,EAAA,CAAA;AAAuB,IAAA,EAAA,CAAA;AAA8B,IAAA,MAAA,CAAA;AAA+B,IAAA,QAAA,CAAA;AAAiD,IAAA,UAAA,CAAA;AA9CtM;;;AAGG;AACM,IAAA,MAAM,CAAM;AACrB;;;AAGG;IACqC,UAAU,GAAY,IAAI,CAAC;AACnE;;;AAGG;IACoC,UAAU,GAAW,CAAC,CAAC;AAC9D;;;AAGG;AACM,IAAA,UAAU,CAAqB;AACxC;;;AAGG;AACH,IAAA,IAAa,OAAO,GAAA;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;KACxB;IACD,IAAI,OAAO,CAAC,GAAY,EAAA;QACpB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;AACtC,YAAA,IAAI,GAAG;gBAAE,IAAI,CAAC,KAAK,EAAE,CAAC;;gBACjB,IAAI,CAAC,OAAO,EAAE,CAAC;AACvB,SAAA;AAAM,aAAA;AACH,YAAA,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;AACvB,SAAA;KACJ;AAE+B,IAAA,SAAS,CAAuC;AAE7D,IAAA,IAAI,CAAyB;IAEhD,QAAQ,GAAY,KAAK,CAAC;AAE1B,IAAA,oBAAoB,CAAkC;AAEtD,IAAA,eAAe,CAA+B;IAE9C,WAAsC,CAAA,QAAkB,EAAS,EAAc,EAAS,EAAqB,EAAS,MAAqB,EAAU,QAAmB,EAA8B,UAAe,EAAA;QAA/K,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAU;QAAS,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;QAAS,IAAE,CAAA,EAAA,GAAF,EAAE,CAAmB;QAAS,I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