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)

2 lines (1 loc) 2.67 kB
"use strict";var i=require("primevue/confirmationeventbus"),e=require("primevue/dialog"),t=require("primevue/button"),o=require("vue");function n(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var c=n(i),r=n(e),l=n(t),a={props:{group:String,breakpoints:{type:Object,default:null}},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:r.default,CDButton:l.default}};const s={class:"p-confirm-dialog-message"};a.render=function(i,e,t,n,c,r){const l=o.resolveComponent("CDButton"),a=o.resolveComponent("CDialog");return o.openBlock(),o.createBlock(a,{visible:c.visible,"onUpdate:visible":e[3]||(e[3]=i=>c.visible=i),modal:!0,header:r.header,blockScroll:r.blockScroll,position:r.position,class:"p-confirm-dialog",breakpoints:t.breakpoints},{footer:o.withCtx((()=>[o.createVNode(l,{label:r.rejectLabel,icon:r.rejectIcon,class:r.rejectClass,onClick:e[1]||(e[1]=i=>r.reject())},null,8,["label","icon","class"]),o.createVNode(l,{label:r.acceptLabel,icon:r.acceptIcon,class:r.acceptClass,onClick:e[2]||(e[2]=i=>r.accept()),autofocus:""},null,8,["label","icon","class"])])),default:o.withCtx((()=>[o.createVNode("i",{class:r.iconClass},null,2),o.createVNode("span",s,o.toDisplayString(r.message),1)])),_:1},8,["visible","header","blockScroll","position","breakpoints"])},module.exports=a;