(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('primeng/dom'), require('primeng/api')) : typeof define === 'function' && define.amd ? define('primeng/blockui', ['exports', '@angular/core', '@angular/common', 'primeng/dom', 'primeng/api'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.primeng = global.primeng || {}, global.primeng.blockui = {}), global.ng.core, global.ng.common, global.primeng.dom, global.primeng.api)); }(this, (function (exports, core, common, dom, api) { 'use strict'; var BlockUI = /** @class */ (function () { function BlockUI(el, cd) { this.el = el; this.cd = cd; this.autoZIndex = true; this.baseZIndex = 0; } Object.defineProperty(BlockUI.prototype, "blocked", { get: function () { return this._blocked; }, set: function (val) { this._blocked = val; if (this.mask && this.mask.nativeElement) { if (this._blocked) this.block(); else this.unblock(); } }, enumerable: false, configurable: true }); BlockUI.prototype.ngAfterViewInit = function () { if (this.target && !this.target.getBlockableElement) { throw 'Target of BlockUI must implement BlockableUI interface'; } }; BlockUI.prototype.ngAfterContentInit = function () { var _this = this; this.templates.forEach(function (item) { switch (item.getType()) { case 'content': _this.contentTemplate = item.template; break; default: _this.contentTemplate = item.template; break; } }); }; BlockUI.prototype.block = function () { if (this.target) { this.target.getBlockableElement().appendChild(this.mask.nativeElement); this.target.getBlockableElement().style.position = 'relative'; } else { document.body.appendChild(this.mask.nativeElement); } if (this.autoZIndex) { this.mask.nativeElement.style.zIndex = String(this.baseZIndex + (++dom.DomHandler.zindex)); } }; BlockUI.prototype.unblock = function () { this.el.nativeElement.appendChild(this.mask.nativeElement); }; BlockUI.prototype.ngOnDestroy = function () { this.unblock(); }; return BlockUI; }()); BlockUI.decorators = [ { type: core.Component, args: [{ selector: 'p-blockUI', template: "\n