primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 5.49 kB
JavaScript
this.primevue=this.primevue||{},this.primevue.confirmdialog=function(t,n,e,o,c){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=i(t),a=i(n),s=i(e),l={name:"ConfirmDialog",extends:{name:"BaseConfirmDialog",extends:i(o).default,props:{group:String,breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0}},css:{classes:{root:"p-confirm-dialog",icon:function(t){var n=t.instance;return["p-confirm-dialog-icon",n.confirmation?n.confirmation.icon:null]},message:"p-confirm-dialog-message",rejectButton:function(t){var n=t.instance;return["p-confirm-dialog-reject",n.confirmation?n.confirmation.rejectClass||"p-button-text":null]},acceptButton:function(t){var n=t.instance;return["p-confirm-dialog-accept",n.confirmation?n.confirmation.acceptClass:null]}}},provide:function(){return{$parentInstance:this}}},confirmListener:null,closeListener:null,data:function(){return{visible:!1,confirmation:null}},mounted:function(){var t=this;this.confirmListener=function(n){n&&n.group===t.group&&(t.confirmation=n,t.confirmation.onShow&&t.confirmation.onShow(),t.visible=!0)},this.closeListener=function(){t.visible=!1,t.confirmation=null},a.default.on("confirm",this.confirmListener),a.default.on("close",this.closeListener)},beforeUnmount:function(){a.default.off("confirm",this.confirmListener),a.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(t,n){return{contenxt:{icon:t,iconClass:n.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:s.default,CDButton:r.default}};return l.render=function(t,n,e,o,i,r){var a=c.resolveComponent("CDButton"),s=c.resolveComponent("CDialog");return c.openBlock(),c.createBlock(s,{visible:i.visible,"onUpdate:visible":[n[2]||(n[2]=function(t){return i.visible=t}),r.onHide],role:"alertdialog",class:c.normalizeClass(t.cx("root")),modal:!0,header:r.header,blockScroll:r.blockScroll,position:r.position,breakpoints:t.breakpoints,closeOnEscape:r.closeOnEscape,draggable:t.draggable,pt:t.pt,unstyled:t.unstyled},{footer:c.withCtx((function(){return[c.createVNode(a,{label:r.rejectLabel,class:c.normalizeClass(t.cx("rejectButton")),onClick:n[0]||(n[0]=function(t){return r.reject()}),autofocus:r.autoFocusReject,unstyled:t.unstyled,pt:t.ptm("rejectButton"),"data-pc-name":"rejectbutton"},c.createSlots({_:2},[r.rejectIcon||t.$slots.rejecticon?{name:"icon",fn:c.withCtx((function(n){return[c.renderSlot(t.$slots,"rejecticon",{},(function(){return[c.createElementVNode("span",c.mergeProps({class:[r.rejectIcon,n.class]},t.ptm("rejectButton").icon,{"data-pc-name":"rejectbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","class","autofocus","unstyled","pt"]),c.createVNode(a,{label:r.acceptLabel,class:c.normalizeClass(t.cx("acceptButton")),onClick:n[1]||(n[1]=function(t){return r.accept()}),autofocus:r.autoFocusAccept,unstyled:t.unstyled,pt:t.ptm("acceptButton"),"data-pc-name":"acceptbutton"},c.createSlots({_:2},[r.acceptIcon||t.$slots.accepticon?{name:"icon",fn:c.withCtx((function(n){return[c.renderSlot(t.$slots,"accepticon",{},(function(){return[c.createElementVNode("span",c.mergeProps({class:[r.acceptIcon,n.class]},t.ptm("acceptButton").icon,{"data-pc-name":"acceptbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","class","autofocus","unstyled","pt"])]})),default:c.withCtx((function(){return[t.$slots.message?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(t.$slots.message),{key:1,message:i.confirmation},null,8,["message"])):(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.renderSlot(t.$slots,"icon",{},(function(){return[t.$slots.icon?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(t.$slots.icon),{key:0,class:c.normalizeClass(t.cx("icon"))},null,8,["class"])):i.confirmation.icon?(c.openBlock(),c.createElementBlock("span",c.mergeProps({key:1,class:t.cx("icon")},t.ptm("icon")),null,16)):c.createCommentVNode("",!0)]})),c.createElementVNode("span",c.mergeProps({class:t.cx("message")},t.ptm("message")),c.toDisplayString(r.message),17)],64))]})),_:3},8,["visible","class","header","blockScroll","position","breakpoints","closeOnEscape","draggable","onUpdate:visible","pt","unstyled"])},l}(primevue.button,primevue.confirmationeventbus,primevue.dialog,primevue.basecomponent,Vue);