primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue)
2 lines (1 loc) • 2.57 kB
JavaScript
var confirmdialog=function(i,t,o,e){"use strict";function n(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var c=n(i),l=n(t),r=n(o),a={props:{group:String},data:()=>({visible:!1,confirmation:null}),mounted(){c.default.on("confirm",(i=>{i&&i.group===this.group&&(this.confirmation=i,this.visible=!0)})),c.default.on("close",(()=>{this.visible=!1,this.confirmation=null}))},beforeUnmount(){c.default.off("confirm"),c.default.off("close")},methods:{accept(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject(){this.confirmation.reject&&this.confirmation.reject(),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]}},components:{CDialog:l.default,CDButton:r.default}};const s={class:"p-confirm-dialog-message"};return a.render=function(i,t,o,n,c,l){const r=e.resolveComponent("CDButton"),a=e.resolveComponent("CDialog");return e.openBlock(),e.createBlock(a,{visible:c.visible,"onUpdate:visible":t[3]||(t[3]=i=>c.visible=i),modal:!0,header:l.header,blockScroll:l.blockScroll,position:l.position,class:"p-confirm-dialog"},{footer:e.withCtx((()=>[e.createVNode(r,{label:l.rejectLabel,icon:l.rejectIcon,class:l.rejectClass,onClick:t[1]||(t[1]=i=>l.reject())},null,8,["label","icon","class"]),e.createVNode(r,{label:l.acceptLabel,icon:l.acceptIcon,class:l.acceptClass,onClick:t[2]||(t[2]=i=>l.accept()),autofocus:""},null,8,["label","icon","class"])])),default:e.withCtx((()=>[e.createVNode("i",{class:l.iconClass},null,2),e.createVNode("span",s,e.toDisplayString(l.message),1)])),_:1},8,["visible","header","blockScroll","position"])},a}(primevue.confirmationeventbus,primevue.dialog,primevue.button,Vue);