vuetify-confirm
Version:
Extends vuetify with confirm dialog
3 lines (2 loc) • 3.23 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vuetify/lib")):"function"==typeof define&&define.amd?define(["vuetify/lib"],e):t.vuetifyConfirm=e(t.Vue.options.components)}(this,function(t){"use strict";var e={render:function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-dialog",{attrs:{eager:"",value:"true","max-width":t.width,persistent:t.persistent},on:{input:t.change,keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"esc",27,e.key,"Escape"))return null;t.choose(!1)}}},[o("v-card",{attrs:{tile:""}},[Boolean(t.title)?o("v-toolbar",{attrs:{dark:"",color:t.color,dense:"",flat:""}},[Boolean(t.icon)?o("v-icon",{attrs:{left:""}},[t._v(t._s(t.icon))]):t._e(),t._v(" "),o("v-toolbar-title",{staticClass:"white--text",domProps:{textContent:t._s(t.title)}})],1):t._e(),t._v(" "),o("v-card-text",{staticClass:"body-1 text-body-1 py-3",domProps:{innerHTML:t._s(t.message)}}),t._v(" "),o("v-card-actions",[o("v-spacer"),t._v(" "),Boolean(t.buttonFalseText)?o("v-btn",{attrs:{color:t.buttonFalseColor,text:t.buttonFalseFlat},on:{click:function(e){t.choose(!1)}}},[t._v(" "+t._s(t.buttonFalseText)+" ")]):t._e(),t._v(" "),Boolean(t.buttonTrueText)?o("v-btn",{attrs:{color:t.buttonTrueColor,text:t.buttonTrueFlat},on:{click:function(e){t.choose(!0)}}},[t._v(" "+t._s(t.buttonTrueText)+" ")]):t._e()],1)],1)],1)},staticRenderFns:[],components:{VCard:t.VCard,VCardActions:t.VCardActions,VCardText:t.VCardText,VDialog:t.VDialog,VIcon:t.VIcon,VToolbar:t.VToolbar,VToolbarTitle:t.VToolbarTitle,VSpacer:t.VSpacer,VBtn:t.VBtn},props:{buttonTrueText:{type:String,default:"Yes"},buttonFalseText:{type:String,default:"No"},buttonTrueColor:{type:String,default:"primary"},buttonFalseColor:{type:String,default:"grey"},buttonFalseFlat:{type:Boolean,default:!0},buttonTrueFlat:{type:Boolean,default:!0},color:{type:String,default:"warning"},icon:{type:String,default:function(){return this.$vuetify.icons.values.warning}},message:{type:String,required:!0},persistent:Boolean,title:{type:String},width:{type:Number,default:450}},data:function(){return{value:!1}},mounted:function(){document.addEventListener("keyup",this.onEnterPressed)},destroyed:function(){document.removeEventListener("keyup",this.onEnterPressed)},methods:{onEnterPressed:function(t){13===t.keyCode&&(t.stopPropagation(),this.choose(!0))},choose:function(t){this.$emit("result",t),this.value=t,this.$destroy()},change:function(t){this.$destroy()}}};function o(t,o){void 0===o&&(o={});var n=o.property||"$confirm";delete o.property;var r=o.vuetify;delete o.vuetify,r||console.warn("Module vuetify-confirm needs vuetify instance. Use Vue.use(VuetifyConfirm, { vuetify })");var i=t.extend(Object.assign({vuetify:r},e));t.prototype[n]=function(e,o){return void 0===o&&(o={}),o.message=e,function(e){var o=document.querySelector("[data-app=true]")||document.body;return new Promise(function(r){var s=new i(Object.assign({},{propsData:Object.assign({},t.prototype[n].options,e),destroyed:function(){o.removeChild(s.$el),r(s.value)}}));o.appendChild(s.$mount().$el)})}(o)},t.prototype[n].options=o||{}}return"undefined"!=typeof window&&window.Vue&&window.Vue.use(o),o});
//# sourceMappingURL=vuetify-confirm.min.js.map