UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Discord Chat](https://img.shields.io/discord/55794023

2 lines (1 loc) 2.38 kB
"use strict";var e=require("primevue/utils"),t=require("vue"),o={name:"BlockUI",emits:["block","unblock"],props:{blocked:{type:Boolean,default:!1},fullScreen:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0}},mask:null,mounted(){this.blocked&&this.block()},watch:{blocked(e){!0===e?this.block():this.unblock()}},methods:{block(){this.fullScreen?(this.mask=document.createElement("div"),this.mask.setAttribute("class","p-blockui p-blockui-document"),document.body.appendChild(this.mask),e.DomHandler.addClass(document.body,"p-overflow-hidden"),document.activeElement.blur()):(this.mask=document.createElement("div"),this.mask.setAttribute("class","p-blockui"),this.$refs.container.appendChild(this.mask)),this.mask&&setTimeout((()=>{e.DomHandler.addClass(this.mask,"p-component-overlay")}),1),this.autoZIndex&&e.ZIndexUtils.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal),this.$emit("block")},unblock(){e.DomHandler.addClass(this.mask,"p-blockui-leave"),this.mask.addEventListener("transitionend",(()=>{this.removeMask()}))},removeMask(){e.ZIndexUtils.clear(this.mask),this.fullScreen?(document.body.removeChild(this.mask),e.DomHandler.removeClass(document.body,"p-overflow-hidden")):this.$refs.container.removeChild(this.mask),this.$emit("unblock")}}};const n={ref:"container",class:"p-blockui-container"};!function(e,t){void 0===t&&(t={});var o=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===o&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n.p-blockui-container {\n position: relative;\n}\n.p-blockui {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: transparent;\n -webkit-transition-property: background-color;\n transition-property: background-color;\n}\n.p-blockui.p-component-overlay {\n position: absolute;\n}\n.p-blockui-document.p-component-overlay {\n position: fixed;\n}\n.p-blockui.p-blockui-leave.p-component-overlay {\n background-color: transparent;\n}\n"),o.render=function(e,o,s,i,l,a){return t.openBlock(),t.createBlock("div",n,[t.renderSlot(e.$slots,"default")],512)},module.exports=o;