primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 2.4 kB
JavaScript
"use strict";var e=require("primevue/basecomponent"),t=require("primevue/utils"),o=require("vue");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i={name:"BlockUI",extends:n(e).default,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,data:()=>({isBlocked:!1}),watch:{blocked(e){!0===e?this.block():this.unblock()}},mounted(){this.blocked&&this.block()},methods:{block(){let e="p-blockui p-component-overlay p-component-overlay-enter";this.fullScreen?(e+=" p-blockui-document",this.mask=document.createElement("div"),this.mask.setAttribute("class",e),document.body.appendChild(this.mask),t.DomHandler.addClass(document.body,"p-overflow-hidden"),document.activeElement.blur()):(this.mask=document.createElement("div"),this.mask.setAttribute("class",e),this.$refs.container.appendChild(this.mask)),this.autoZIndex&&t.ZIndexUtils.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal),this.isBlocked=!0,this.$emit("block")},unblock(){t.DomHandler.addClass(this.mask,"p-component-overlay-leave"),this.mask.addEventListener("animationend",(()=>{this.removeMask()}))},removeMask(){t.ZIndexUtils.clear(this.mask),this.fullScreen?(document.body.removeChild(this.mask),t.DomHandler.removeClass(document.body,"p-overflow-hidden")):this.$refs.container.removeChild(this.mask),this.isBlocked=!1,this.$emit("unblock")}}};const s=["aria-busy"];!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}\n.p-blockui.p-component-overlay {\n position: absolute;\n}\n.p-blockui-document.p-component-overlay {\n position: fixed;\n}\n"),i.render=function(e,t,n,i,l,a){return o.openBlock(),o.createElementBlock("div",o.mergeProps({ref:"container",class:"p-blockui-container","aria-busy":l.isBlocked},e.ptm("root")),[o.renderSlot(e.$slots,"default")],16,s)},module.exports=i;