primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 4.31 kB
JavaScript
this.primevue=this.primevue||{},this.primevue.confirmdialog=function(e,o,t,i){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=n(e),s=n(o),a={name:"ConfirmDialog",props:{group:String,breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0}},confirmListener:null,closeListener:null,data:()=>({visible:!1,confirmation:null}),mounted(){this.confirmListener=e=>{e&&e.group===this.group&&(this.confirmation=e,this.confirmation.onShow&&this.confirmation.onShow(),this.visible=!0)},this.closeListener=()=>{this.visible=!1,this.confirmation=null},s.default.on("confirm",this.confirmListener),s.default.on("close",this.closeListener)},beforeUnmount(){s.default.off("confirm",this.confirmListener),s.default.off("close",this.closeListener)},methods:{accept(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1}},computed:{header(){return this.confirmation?this.confirmation.header:null},message(){return this.confirmation?this.confirmation.message:null},blockScroll(){return!this.confirmation||this.confirmation.blockScroll},position(){return this.confirmation?this.confirmation.position:null},iconClass(){return["p-confirm-dialog-icon",this.confirmation?this.confirmation.icon:null]},acceptLabel(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon(){return this.confirmation?this.confirmation.rejectIcon:null},acceptClass(){return["p-confirm-dialog-accept",this.confirmation?this.confirmation.acceptClass:null]},rejectClass(){return["p-confirm-dialog-reject",this.confirmation?this.confirmation.rejectClass||"p-button-text":null]},autoFocusAccept(){return void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus},autoFocusReject(){return"reject"===this.confirmation.defaultFocus},closeOnEscape(){return!this.confirmation||this.confirmation.closeOnEscape}},components:{CDialog:n(t).default,CDButton:c.default}};const l={class:"p-confirm-dialog-message"};return a.render=function(e,o,t,n,c,s){const a=i.resolveComponent("CDButton"),r=i.resolveComponent("CDialog");return i.openBlock(),i.createBlock(r,{visible:c.visible,"onUpdate:visible":[o[2]||(o[2]=e=>c.visible=e),s.onHide],role:"alertdialog",class:"p-confirm-dialog",modal:!0,header:s.header,blockScroll:s.blockScroll,position:s.position,breakpoints:t.breakpoints,closeOnEscape:s.closeOnEscape,draggable:t.draggable},{footer:i.withCtx((()=>[i.createVNode(a,{label:s.rejectLabel,class:i.normalizeClass(s.rejectClass),iconPos:"left",onClick:o[0]||(o[0]=e=>s.reject()),autofocus:s.autoFocusReject},{icon:i.withCtx((o=>[i.renderSlot(e.$slots,"rejecticon",{},(()=>[i.createElementVNode("span",{class:i.normalizeClass([s.rejectIcon,o.class])},null,2)]))])),_:3},8,["label","class","autofocus"]),i.createVNode(a,{label:s.acceptLabel,class:i.normalizeClass(s.acceptClass),iconPos:"left",onClick:o[1]||(o[1]=e=>s.accept()),autofocus:s.autoFocusAccept},{icon:i.withCtx((o=>[i.renderSlot(e.$slots,"accepticon",{},(()=>[i.createElementVNode("span",{class:i.normalizeClass([s.acceptIcon,o.class])},null,2)]))])),_:3},8,["label","class","autofocus"])])),default:i.withCtx((()=>[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",{class:"p-confirm-dialog-icon"},(()=>[e.$slots.icon?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e.$slots.icon),{key:0,class:"p-confirm-dialog-icon"})):c.confirmation.icon?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass(s.iconClass)},null,2)):i.createCommentVNode("",!0)])),i.createElementVNode("span",l,i.toDisplayString(s.message),1)],64))])),_:3},8,["visible","header","blockScroll","position","breakpoints","closeOnEscape","draggable","onUpdate:visible"])},a}(primevue.button,primevue.confirmationeventbus,primevue.dialog,Vue);