UNPKG

primevue

Version:

PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBloc

2 lines (1 loc) 2.06 kB
import{DomHandler as e,ZIndexUtils as t}from"primevue/utils";import o from"primevue/basecomponent";import s from"primevue/blockui/style";import{openBlock as i,createElementBlock as n,mergeProps as a,renderSlot as l}from"vue";var c={name:"BlockUI",extends:{name:"BaseBlockUI",extends:o,props:{blocked:{type:Boolean,default:!1},fullScreen:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0}},style:s,provide:function(){return{$parentInstance:this}}},emits:["block","unblock"],mask:null,data:function(){return{isBlocked:!1}},watch:{blocked:function(e){!0===e?this.block():this.unblock()}},mounted:function(){this.blocked&&this.block()},methods:{block:function(){var o="p-blockui p-component-overlay p-component-overlay-enter";this.fullScreen?(o+=" p-blockui-document",this.mask=e.createElement("div",{"data-pc-section":"mask",style:{position:"fixed",top:"0",left:"0",width:"100%",height:"100%"},class:!this.isUnstyled&&o,"p-bind":this.ptm("mask")}),document.body.appendChild(this.mask),e.blockBodyScroll(),document.activeElement.blur()):(this.mask=e.createElement("div",{"data-pc-section":"mask",style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},class:!this.isUnstyled&&o,"p-bind":this.ptm("mask")}),this.$refs.container.appendChild(this.mask)),this.autoZIndex&&t.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal),this.isBlocked=!0,this.$emit("block")},unblock:function(){var t=this;!this.isUnstyled&&e.addClass(this.mask,"p-component-overlay-leave"),e.hasCSSAnimation(this.mask)>0?this.mask.addEventListener("animationend",(function(){t.removeMask()})):this.removeMask()},removeMask:function(){t.clear(this.mask),this.fullScreen?(document.body.removeChild(this.mask),e.unblockBodyScroll()):this.$refs.container.removeChild(this.mask),this.isBlocked=!1,this.$emit("unblock")}}},d=["aria-busy"];c.render=function(e,t,o,s,c,m){return i(),n("div",a({ref:"container",class:e.cx("root"),"aria-busy":c.isBlocked},e.ptm("root")),[l(e.$slots,"default")],16,d)};export{c as default};