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.77 kB
this.primevue=this.primevue||{},this.primevue.dynamicdialog=function(e,n,t,o,i){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(e),l=r(n),a=r(t),c={name:"DynamicDialog",extends:s.default,inheritAttrs:!1,data:function(){return{instanceMap:{}}},openListener:null,closeListener:null,currentInstance:null,mounted:function(){var e=this;this.openListener=function(n){var t=n.instance,i=o.UniqueComponentId()+"_dynamic_dialog";t.visible=!0,t.key=i,e.instanceMap[i]=t},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)},a.default.on("open",this.openListener),a.default.on("close",this.closeListener)},beforeUnmount:function(){a.default.off("open",this.openListener),a.default.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:l.default}};return c.render=function(e,n,t,o,r,s){var l=i.resolveComponent("DDialog");return i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.instanceMap,(function(n,t){return i.openBlock(),i.createBlock(l,i.mergeProps({key:t,visible:n.visible,"onUpdate:visible":function(e){return n.visible=e},_instance:n},n.options.props,{pt:e.pt,unstyled:e.unstyled,onHide:function(e){return s.onDialogHide(n)},onAfterHide:s.onDialogAfterHide}),i.createSlots({default:i.withCtx((function(){return[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(n.content),i.normalizeProps(i.guardReactiveProps(n.options.emits)),null,16))]})),_:2},[n.options.templates&&n.options.templates.header?{name:"header",fn:i.withCtx((function(){return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.getTemplateItems(n.options.templates.header),(function(e,t){return i.openBlock(),i.createBlock(i.resolveDynamicComponent(e),i.mergeProps({key:t+"_header"},n.options.emits),null,16)})),128))]})),key:"0"}:void 0,n.options.templates&&n.options.templates.footer?{name:"footer",fn:i.withCtx((function(){return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.getTemplateItems(n.options.templates.footer),(function(e,t){return i.openBlock(),i.createBlock(i.resolveDynamicComponent(e),i.mergeProps({key:t+"_footer"},n.options.emits),null,16)})),128))]})),key:"1"}:void 0]),1040,["visible","onUpdate:visible","_instance","pt","unstyled","onHide","onAfterHide"])})),128)},c}(primevue.basecomponent,primevue.dialog,primevue.dynamicdialogeventbus,primevue.utils,Vue);