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.4 kB
import{DomHandler as e,ZIndexUtils as t}from"primevue/utils";import o from"primevue/basecomponent";import{useStyle as n}from"primevue/usestyle";import{openBlock as i,createElementBlock as s,mergeProps as a,renderSlot as l}from"vue";var c=n("\n.p-blockui-container {\n position: relative;\n}\n\n.p-blockui.p-component-overlay {\n position: absolute;\n}\n\n.p-blockui-document.p-component-overlay {\n position: fixed;\n}\n",{name:"blockui",manual:!0}),d={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}},css:{classes:{root:"p-blockui-container"},loadStyle:c.load},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.addClass(document.body,"p-overflow-hidden"),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.removeClass(document.body,"p-overflow-hidden")):this.$refs.container.removeChild(this.mask),this.isBlocked=!1,this.$emit("unblock")}}},m=["aria-busy"];d.render=function(e,t,o,n,c,d){return i(),s("div",a({ref:"container",class:e.cx("root"),"aria-busy":c.isBlocked},e.ptm("root")),[l(e.$slots,"default")],16,m)};export{d as default};