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