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)

2 lines (1 loc) 2.29 kB
import{DomHandler as e}from"primevue/utils";import{openBlock as t,createBlock as o,renderSlot as n}from"vue";var i={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.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.addClass(this.mask,"p-component-overlay")}),1),this.autoZIndex&&(this.mask.style.zIndex=String(this.baseZIndex+e.generateZIndex())),this.$emit("block")},unblock(){e.addClass(this.mask,"p-blockui-leave"),this.mask.addEventListener("transitionend",(()=>{this.removeMask()}))},removeMask(){this.fullScreen?(document.body.removeChild(this.mask),e.removeClass(document.body,"p-overflow-hidden")):this.$refs.container.removeChild(this.mask),this.$emit("unblock")}}};const s={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],i=document.createElement("style");i.type="text/css","top"===o&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.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"),i.render=function(e,i,a,l,d,r){return t(),o("div",s,[n(e.$slots,"default")],512)};export default i;