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.18 kB
this.primevue=this.primevue||{},this.primevue.blockui=function(e,t){"use strict";var n={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(){let t="p-blockui p-component-overlay p-component-overlay-enter";this.fullScreen?(t+=" p-blockui-document",this.mask=document.createElement("div"),this.mask.setAttribute("class",t),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",t),this.$refs.container.appendChild(this.mask)),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-component-overlay-leave"),this.mask.addEventListener("animationend",(()=>{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")}}};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&o.firstChild?o.insertBefore(i,o.firstChild):o.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}\n.p-blockui.p-component-overlay {\n position: absolute;\n}\n.p-blockui-document.p-component-overlay {\n position: fixed;\n}\n"),n.render=function(e,n,o,i,s,l){return t.openBlock(),t.createBlock("div",t.mergeProps({ref:"container",class:"p-blockui-container"},e.$attrs),[t.renderSlot(e.$slots,"default")],16)},n}(primevue.utils,Vue);