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) 5.61 kB
"use strict";var e=require("primevue/button"),t=require("primevue/confirmationeventbus"),n=require("primevue/dialog"),o=require("primevue/basecomponent"),c=require("primevue/confirmdialog/style"),i=require("vue");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(e),s=r(t),l=r(n),u={name:"ConfirmDialog",extends:{name:"BaseConfirmDialog",extends:r(o).default,props:{group:String,breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0}},style:r(c).default,provide:function(){return{$parentInstance:this}}},confirmListener:null,closeListener:null,data:function(){return{visible:!1,confirmation:null}},mounted:function(){var e=this;this.confirmListener=function(t){t&&t.group===e.group&&(e.confirmation=t,e.confirmation.onShow&&e.confirmation.onShow(),e.visible=!0)},this.closeListener=function(){e.visible=!1,e.confirmation=null},s.default.on("confirm",this.confirmListener),s.default.on("close",this.closeListener)},beforeUnmount:function(){s.default.off("confirm",this.confirmListener),s.default.off("close",this.closeListener)},methods:{accept:function(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject:function(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide:function(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},getCXOptions:function(e,t){return{contenxt:{icon:e,iconClass:t.class}}}},computed:{header:function(){return this.confirmation?this.confirmation.header:null},message:function(){return this.confirmation?this.confirmation.message:null},blockScroll:function(){return!this.confirmation||this.confirmation.blockScroll},position:function(){return this.confirmation?this.confirmation.position:null},acceptLabel:function(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel:function(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon:function(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon:function(){return this.confirmation?this.confirmation.rejectIcon:null},autoFocusAccept:function(){return void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus},autoFocusReject:function(){return"reject"===this.confirmation.defaultFocus},closeOnEscape:function(){return!this.confirmation||this.confirmation.closeOnEscape}},components:{CDialog:l.default,CDButton:a.default}};u.render=function(e,t,n,o,c,r){var a=i.resolveComponent("CDButton"),s=i.resolveComponent("CDialog");return i.openBlock(),i.createBlock(s,{visible:c.visible,"onUpdate:visible":[t[2]||(t[2]=function(e){return c.visible=e}),r.onHide],role:"alertdialog",class:i.normalizeClass(e.cx("root")),modal:!0,header:r.header,blockScroll:r.blockScroll,position:r.position,breakpoints:e.breakpoints,closeOnEscape:r.closeOnEscape,draggable:e.draggable,pt:e.pt,unstyled:e.unstyled},i.createSlots({default:i.withCtx((function(){return[e.$slots.container?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[e.$slots.message?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e.$slots.message),{key:1,message:c.confirmation},null,8,["message"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.renderSlot(e.$slots,"icon",{},(function(){return[e.$slots.icon?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e.$slots.icon),{key:0,class:i.normalizeClass(e.cx("icon"))},null,8,["class"])):c.confirmation.icon?(i.openBlock(),i.createElementBlock("span",i.mergeProps({key:1,class:e.cx("icon")},e.ptm("icon")),null,16)):i.createCommentVNode("",!0)]})),i.createElementVNode("span",i.mergeProps({class:e.cx("message")},e.ptm("message")),i.toDisplayString(r.message),17)],64))],64))]})),_:2},[e.$slots.container?{name:"container",fn:i.withCtx((function(t){return[i.renderSlot(e.$slots,"container",{message:c.confirmation,onClose:t.onClose,onAccept:r.accept,onReject:r.reject,closeCallback:t.onclose,acceptCallback:r.accept,rejectCallback:r.reject})]})),key:"0"}:void 0,e.$slots.container?void 0:{name:"footer",fn:i.withCtx((function(){return[i.createVNode(a,{label:r.rejectLabel,class:i.normalizeClass([e.cx("rejectButton"),c.confirmation.rejectClass]),onClick:t[0]||(t[0]=function(e){return r.reject()}),autofocus:r.autoFocusReject,unstyled:e.unstyled,pt:e.ptm("rejectButton"),"data-pc-name":"rejectbutton"},i.createSlots({_:2},[r.rejectIcon||e.$slots.rejecticon?{name:"icon",fn:i.withCtx((function(t){return[i.renderSlot(e.$slots,"rejecticon",{},(function(){return[i.createElementVNode("span",i.mergeProps({class:[r.rejectIcon,t.class]},e.ptm("rejectButton").icon,{"data-pc-name":"rejectbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","class","autofocus","unstyled","pt"]),i.createVNode(a,{label:r.acceptLabel,class:i.normalizeClass([e.cx("acceptButton"),c.confirmation.acceptClass]),onClick:t[1]||(t[1]=function(e){return r.accept()}),autofocus:r.autoFocusAccept,unstyled:e.unstyled,pt:e.ptm("acceptButton"),"data-pc-name":"acceptbutton"},i.createSlots({_:2},[r.acceptIcon||e.$slots.accepticon?{name:"icon",fn:i.withCtx((function(t){return[i.renderSlot(e.$slots,"accepticon",{},(function(){return[i.createElementVNode("span",i.mergeProps({class:[r.acceptIcon,t.class]},e.ptm("acceptButton").icon,{"data-pc-name":"acceptbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","class","autofocus","unstyled","pt"])]})),key:"1"}]),1032,["visible","class","header","blockScroll","position","breakpoints","closeOnEscape","draggable","onUpdate:visible","pt","unstyled"])},module.exports=u;