UNPKG

accessibleprimevue

Version:

Note: This is the forked version of the Primefaces/PrimeVue repository. Since V3 has reached its EOL this is use to fix identified accessibility bugs in the v3 version of primevue. PrimeVue is an open source UI library for Vue featuring a rich set of 80+

2 lines (1 loc) 2.52 kB
import e from"primevue/dialog";import n from"primevue/dynamicdialogeventbus";import{UniqueComponentId as t}from"primevue/utils";import o from"primevue/basecomponent";import i from"primevue/dynamicdialog/style";import{resolveComponent as s,openBlock as r,createElementBlock as a,Fragment as l,renderList as p,createBlock as u,mergeProps as c,createSlots as m,withCtx as f,resolveDynamicComponent as d,normalizeProps as v,guardReactiveProps as h}from"vue";var y={name:"DynamicDialog",extends:{name:"BaseDynamicDialog",extends:o,props:{},style:i,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,data:function(){return{instanceMap:{}}},openListener:null,closeListener:null,currentInstance:null,mounted:function(){var e=this;this.openListener=function(n){var o=n.instance,i=t()+"_dynamic_dialog";o.visible=!0,o.key=i,e.instanceMap[i]=o},this.closeListener=function(n){var t=n.params,o=e.instanceMap[n.instance.key];o&&(o.visible=!1,o.options.onClose&&o.options.onClose({data:t,type:"config-close"}),e.currentInstance=o)},n.on("open",this.openListener),n.on("close",this.closeListener)},beforeUnmount:function(){n.off("open",this.openListener),n.off("close",this.closeListener)},methods:{onDialogHide:function(e){!this.currentInstance&&e.options.onClose&&e.options.onClose({type:"dialog-close"})},onDialogAfterHide:function(){this.currentInstance&&delete this.currentInstance,this.currentInstance=null},getTemplateItems:function(e){return Array.isArray(e)?e:[e]}},components:{DDialog:e}};y.render=function(e,n,t,o,i,y){var g=s("DDialog");return r(!0),a(l,null,p(i.instanceMap,(function(e,n){return r(),u(g,c({key:n,visible:e.visible,"onUpdate:visible":function(n){return e.visible=n},_instance:e},e.options.props,{onHide:function(n){return y.onDialogHide(e)},onAfterHide:y.onDialogAfterHide}),m({default:f((function(){return[(r(),u(d(e.content),v(h(e.options.emits)),null,16))]})),_:2},[e.options.templates&&e.options.templates.header?{name:"header",fn:f((function(){return[(r(!0),a(l,null,p(y.getTemplateItems(e.options.templates.header),(function(n,t){return r(),u(d(n),c({key:t+"_header"},e.options.emits),null,16)})),128))]})),key:"0"}:void 0,e.options.templates&&e.options.templates.footer?{name:"footer",fn:f((function(){return[(r(!0),a(l,null,p(y.getTemplateItems(e.options.templates.footer),(function(n,t){return r(),u(d(n),c({key:t+"_footer"},e.options.emits),null,16)})),128))]})),key:"1"}:void 0]),1040,["visible","onUpdate:visible","_instance","onHide","onAfterHide"])})),128)};export{y as default};