-
Notifications
You must be signed in to change notification settings - Fork 0
/
xbs-confirm.min.js
1 lines (1 loc) · 23.3 KB
/
xbs-confirm.min.js
1
var XbsConfirm=function(t){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;var s=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var n={},e=0;e<10;e++)n["_"+String.fromCharCode(e)]=e;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(t){return n[t]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}()?Object.assign:function(t,n){for(var s,a,l=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),r=1;r<arguments.length;r++){for(var d in s=Object(arguments[r]))o.call(s,d)&&(l[d]=s[d]);if(e){a=e(s);for(var A=0;A<a.length;A++)i.call(s,a[A])&&(l[a[A]]=s[a[A]])}}return l},a=function(t,n){var e={};for(var o in t.$options.props)"value"!==o&&(e[o]=t.$options.props[o].default);var i=s({},e,n);for(var a in i)t[a]=i[a]},l={hasClass:function(t,n){return new RegExp("(\\s|^)"+n+"(\\s|$)").test(t.className)},addClass:function(t,n){t&&(t.classList?t.classList.add(n):this.hasClass(t,n)||(t.className+=""+n))},removeClass:function(t,n){t&&(t.classList?t.classList.remove(n):this.hasClass(t,n)&&(t.className=t.className.replace(new RegExp("(\\s|^)"+n+"(\\s|$)")," ").replace(/^\s+|\s+$/g,"")))}},r={mixins:[{methods:{getLayout:function(){return"undefined"!=typeof window&&window.LBS_CONFIG&&"VIEW_BOX"===window.LBS_CONFIG.$layout?"VIEW_BOX":""},addModalClassName:function(){"function"==typeof this.shouldPreventScroll&&this.shouldPreventScroll()||"VIEW_BOX"===this.getLayout()&&(l.addClass(document.body,"xbs-modal-open"),l.addClass(document.querySelector("#xbs_view_box_body"),"xbs-modal-open-for-container"))},removeModalClassName:function(){"VIEW_BOX"===this.getLayout()&&(l.removeClass(document.body,"xbs-modal-open"),l.removeClass(document.querySelector("#xbs_view_box_body"),"xbs-modal-open-for-container"))}},beforeDestroy:function(){this.removeModalClassName()},deactivated:function(){this.removeModalClassName()}}],name:"xbs-dialog",model:{prop:"show",event:"change"},props:{show:{type:Boolean,default:!1},maskTransition:{type:String,default:"xbs-mask"},maskZIndex:[String,Number],dialogTransition:{type:String,default:"t-xbs-dialog"},dialogClass:{type:String,default:"xbs-dialog"},hideOnBlur:Boolean,dialogStyle:Object,scroll:{type:Boolean,default:!0}},computed:{maskStyle:function(){if(void 0!==this.maskZIndex)return{zIndex:this.maskZIndex}}},mounted:function(){"undefined"!=typeof window&&window.XBS_CONFIG&&"VIEW_BOX"===window.XBS_CONFIG.$layout&&(this.layout="VIEW_BOX")},watch:{show:function(t){this.$emit("update:show",t),this.$emit(t?"on-show":"on-hide"),t?this.addModalClassName():this.removeModalClassName()}},methods:{shouldPreventScroll:function(){var t=/iPad|iPhone|iPod/i.test(window.navigator.userAgent),n=this.$el.querySelector("input")||this.$el.querySelector("textarea");if(t&&n)return!0},hide:function(){this.hideOnBlur&&(this.$emit("update:show",!1),this.$emit("change",!1),this.$emit("on-click-mask"))}},data:function(){return{layout:""}}};var d=function(t,n,e,o,i,s,a,l,r,d){"boolean"!=typeof a&&(r=l,l=a,a=!1);var A,c="function"==typeof e?e.options:e;if(t&&t.render&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,i&&(c.functional=!0)),o&&(c._scopeId=o),s?(A=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,r(t)),t&&t._registeredComponents&&t._registeredComponents.add(s)},c._ssrRegister=A):n&&(A=a?function(){n.call(this,d(this.$root.$options.shadowRoot))}:function(t){n.call(this,l(t))}),A)if(c.functional){var p=c.render;c.render=function(t,n){return A.call(n),p(t,n)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,A):[A]}return e},A="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var c=document.head||document.getElementsByTagName("head")[0],p={};var u=function(t){return function(t,n){return function(t,n){var e=A?n.media||"default":t,o=p[e]||(p[e]={ids:new Set,styles:[]});if(!o.ids.has(t)){o.ids.add(t);var i=n.source;if(n.map&&(i+="\n/*# sourceURL="+n.map.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",n.media&&o.element.setAttribute("media",n.media),c.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(i),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{var s=o.ids.size-1,a=document.createTextNode(i),l=o.element.childNodes;l[s]&&o.element.removeChild(l[s]),l.length?o.element.insertBefore(a,l[s]):o.element.appendChild(a)}}}(t,n)}};const b=r;var m=function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{staticClass:"xbs-dialog",class:{"xbs-dialog-absolute":"VIEW_BOX"===t.layout}},[e("transition",{attrs:{name:t.maskTransition}},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"xbs-mask",style:t.maskStyle,on:{click:t.hide}})]),t._v(" "),e("transition",{attrs:{name:t.dialogTransition}},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],class:t.dialogClass,style:t.dialogStyle},[t._t("default")],2)])],1)};m._withStripped=!0;const f={name:"confirm",components:{XbsDialog:d({render:m,staticRenderFns:[]},function(t){t&&t("data-v-f522f54e_0",{source:".xbs-dialog-absolute .t-xbs-dialog {\n position: absolute;\n}\n",map:{version:3,sources:["xbs-dialog.vue"],names:[],mappings:"AAAA;EACE,kBAAkB;AACpB",file:"xbs-dialog.vue",sourcesContent:[".xbs-dialog-absolute .t-xbs-dialog {\n position: absolute;\n}\n"]},media:void 0})},b,void 0,!1,void 0,u,void 0)},props:{value:{type:Boolean,default:!1},showInput:{type:Boolean,default:!1},placeholder:{type:String,default:""},hideOnBlur:{type:Boolean,default:!1},title:String,confirmText:String,cancelText:String,maskTransition:{type:String,default:"xbs-fade"},maskZIndex:[String,Number],dialogTransition:{type:String,default:"xbs-dialog"},content:String,closeOnConfirm:{type:Boolean,default:!0},inputAttrs:Object,showContent:{type:Boolean,default:!0},confirmType:{type:String,default:"primary"},showCancelButton:{type:Boolean,default:!0},showConfirmButton:{type:Boolean,default:!0}},created:function(){this.showValue=this.show,this.value&&(this.showValue=this.value)},watch:{value:function(t){this.showValue=t},showValue:function(t){var n=this;this.$emit("input",t),t&&(this.showInput&&(this.msg="",setTimeout(function(){n.$refs.input&&n.setInputFocus()},300)),this.$emit("on-show"))}},data:function(){return{msg:"",showValue:!1}},methods:{getInputAttrs:function(){return this.inputAttrs||{type:"text"}},setInputValue:function(t){this.msg=t},setInputFocus:function(t){t&&t.preventDefault(),this.$refs.input.focus()},_onConfirm:function(){this.showValue&&(this.closeOnConfirm&&(this.showValue=!1),this.$emit("on-confirm",this.msg))},_onCancel:function(){this.showValue&&(this.showValue=!1,this.$emit("on-cancel"))}}};var g=function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{staticClass:"xbs-confirm"},[e("xbs-dialog",{attrs:{"dialog-class":"xbs-dialog","mask-transition":t.maskTransition,"dialog-transition":"xbs-fade","hide-on-blur":t.hideOnBlur,"mask-z-index":t.maskZIndex},on:{"on-hide":function(n){return t.$emit("on-hide")}},model:{value:t.showValue,callback:function(n){t.showValue=n},expression:"showValue"}},[t.title?e("div",{staticClass:"xbs-dialog__hd",class:{"with-no-content":!t.showContent}},[e("strong",{staticClass:"xbs-dialog__title"},[t._v(t._s(t.title))])]):t._e(),t._v(" "),t.showContent?[t.showInput?e("div",{staticClass:"xbs-prompt"},["checkbox"===t.getInputAttrs().type?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.msg,expression:"msg"}],ref:"input",staticClass:"xbs-prompt-msgbox",attrs:{placeholder:t.placeholder,type:"checkbox"},domProps:{checked:Array.isArray(t.msg)?t._i(t.msg,null)>-1:t.msg},on:{touchend:t.setInputFocus,change:function(n){var e=t.msg,o=n.target,i=!!o.checked;if(Array.isArray(e)){var s=t._i(e,null);o.checked?s<0&&(t.msg=e.concat([null])):s>-1&&(t.msg=e.slice(0,s).concat(e.slice(s+1)))}else t.msg=i}}},"input",t.getInputAttrs(),!1)):"radio"===t.getInputAttrs().type?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.msg,expression:"msg"}],ref:"input",staticClass:"xbs-prompt-msgbox",attrs:{placeholder:t.placeholder,type:"radio"},domProps:{checked:t._q(t.msg,null)},on:{touchend:t.setInputFocus,change:function(n){t.msg=null}}},"input",t.getInputAttrs(),!1)):e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.msg,expression:"msg"}],ref:"input",staticClass:"xbs-prompt-msgbox",attrs:{placeholder:t.placeholder,type:t.getInputAttrs().type},domProps:{value:t.msg},on:{touchend:t.setInputFocus,input:function(n){n.target.composing||(t.msg=n.target.value)}}},"input",t.getInputAttrs(),!1))]):e("div",{staticClass:"xbs-dialog__bd"},[t._t("default",[e("div",{domProps:{innerHTML:t._s(t.content)}})])],2),t._v(" "),e("div",{staticClass:"xbs-dialog__ft"},[t.showCancelButton?e("a",{staticClass:"xbs-dialog__btn xbs-dialog__btn_default",attrs:{href:"javascript:;"},on:{click:t._onCancel}},[t._v(t._s(t.cancelText||"取消"))]):t._e(),t._v(" "),t.showConfirmButton?e("a",{staticClass:"xbs-dialog__btn",class:"xbs-dialog__btn_"+t.confirmType,attrs:{href:"javascript:;"},on:{click:t._onConfirm}},[t._v(t._s(t.confirmText||"确定"))]):t._e()])]:t._e()],2)],1)};g._withStripped=!0;var h,x=d({render:g,staticRenderFns:[]},function(t){t&&t("data-v-83ccc2c6_0",{source:'.xbs-mask {\n position: fixed;\n z-index: 1000;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.6);\n}\n.xbs-mask_transparent {\n position: fixed;\n z-index: 1000;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n}\n/**\n* dialog\n*/\n.xbs-dialog {\n position: fixed;\n display: table;\n z-index: 5000;\n width: 80%;\n max-width: 300px;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n margin: auto;\n background-color: #FFFFFF;\n text-align: center;\n border-radius: 3px;\n overflow: hidden;\n}\n.xbs-dialog__hd {\n padding: 1.3em 1.6em 0.5em;\n}\n.xbs-dialog__hd.with-no-content {\n padding: 1.7em 1.6em;\n}\n.xbs-dialog__title {\n font-weight: 400;\n font-size: 18px;\n}\n.xbs-dialog__bd {\n padding: 0 1.6em 0.8em;\n min-height: 40px;\n font-size: 15px;\n line-height: 1.3;\n word-wrap: break-word;\n word-break: break-all;\n color: #999999;\n}\n.xbs-dialog__bd:first-child {\n padding: 2.7em 20px 1.7em;\n color: #353535;\n}\n.xbs-dialog__ft {\n position: relative;\n line-height: 48px;\n font-size: 18px;\n display: flex;\n}\n.xbs-dialog__ft:after {\n content: " ";\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n height: 1px;\n border-top: 1px solid #D5D5D6;\n color: #D5D5D6;\n transform-origin: 0 0;\n transform: scaleY(0.5);\n}\n.xbs-dialog__btn {\n display: block;\n flex: 1;\n color: #3CC51F;\n text-decoration: none;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n position: relative;\n}\n.xbs-dialog__btn:active {\n background-color: #EEEEEE;\n}\n.xbs-dialog__btn:after {\n content: " ";\n position: absolute;\n left: 0;\n top: 0;\n width: 1px;\n bottom: 0;\n border-left: 1px solid #D5D5D6;\n color: #D5D5D6;\n transform-origin: 0 0;\n transform: scaleX(0.5);\n}\n.xbs-dialog__btn:first-child:after {\n display: none;\n}\n.xbs-dialog__btn_default {\n color: #353535;\n}\n.xbs-dialog__btn_primary {\n color: #0BB20C;\n}\n.xbs-dialog__btn_warn {\n color: #E64340;\n}\n.xbs-skin_android .xbs-dialog {\n text-align: left;\n box-shadow: 0 6px 30px 0 rgba(0, 0, 0, 0.1);\n}\n.xbs-skin_android .xbs-dialog__title {\n font-size: 21px;\n}\n.xbs-skin_android .xbs-dialog__hd {\n text-align: left;\n}\n.xbs-skin_android .xbs-dialog__bd {\n color: #999999;\n padding: 0.25em 1.6em 2em;\n font-size: 17px;\n text-align: left;\n}\n.xbs-skin_android .xbs-dialog__bd:first-child {\n padding: 1.6em 1.6em 2em;\n color: #353535;\n}\n.xbs-skin_android .xbs-dialog__ft {\n display: block;\n text-align: right;\n line-height: 42px;\n font-size: 16px;\n padding: 0 1.6em 0.7em;\n}\n.xbs-skin_android .xbs-dialog__ft:after {\n display: none;\n}\n.xbs-skin_android .xbs-dialog__btn {\n display: inline-block;\n vertical-align: top;\n padding: 0 0.8em;\n}\n.xbs-skin_android .xbs-dialog__btn:after {\n display: none;\n}\n.xbs-skin_android .xbs-dialog__btn:active {\n background-color: rgba(0, 0, 0, 0.06);\n}\n.xbs-skin_android .xbs-dialog__btn:visited {\n background-color: rgba(0, 0, 0, 0.06);\n}\n.xbs-skin_android .xbs-dialog__btn:last-child {\n margin-right: -0.8em;\n}\n.xbs-skin_android .xbs-dialog__btn_default {\n color: #808080;\n}\n@media screen and (min-width: 1024px) {\n.xbs-dialog {\n width: 35%;\n}\n}\n.xbs-prompt {\n padding-bottom: 1.6rem;\n}\n.xbs-prompt-msgbox {\n width: 80%;\n border: 1px solid #dedede;\n border-radius: 5px;\n padding: 4px 5px;\n appearance: none;\n outline: none;\n font-size: 16px;\n}\n',map:{version:3,sources:["xbs-confirm.vue","/Users/ppd-03020174/workspace/components/vue/xbs-confirm/src/xbs-confirm.vue"],names:[],mappings:"AAAA;EACE,eAAe;EACf,aAAa;EACb,MAAM;EACN,QAAQ;EACR,OAAO;EACP,SAAS;EACT,8BAA8B;AAChC;AACA;EACE,eAAe;EACf,aAAa;EACb,MAAM;EACN,QAAQ;EACR,OAAO;EACP,SAAS;AACX;AACA;;CAEC;AACD;EACE,eAAe;EACf,cAAc;EACd,aAAa;EACb,UAAU;EACV,gBAAgB;EAChB,MAAM;EACN,QAAQ;EACR,SAAS;EACT,OAAO;EACP,YAAY;EACZ,yBAAyB;EACzB,kBAAkB;EAClB,kBAAkB;EAClB,gBAAgB;AAClB;AACA;EACE,0BAA0B;AAC5B;AACA;EACE,oBAAoB;AACtB;AACA;EACE,gBAAgB;EAChB,eAAe;AACjB;AACA;EACE,sBAAsB;EACtB,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,qBAAqB;EACrB,qBAAqB;EACrB,cAAc;AAChB;AACA;EACE,yBAAyB;EACzB,cAAc;AAChB;AACA;EACE,kBAAkB;EAClB,iBAAiB;EACjB,eAAe;EACf,aAAa;AACf;AACA;EACE,YAAY;EACZ,kBAAkB;EAClB,OAAO;EACP,MAAM;EACN,QAAQ;EACR,WAAW;EACX,6BAA6B;EAC7B,cAAc;EACd,qBAAqB;EACrB,sBAAsB;AACxB;AACA;EACE,cAAc;EACd,OAAO;EACP,cAAc;EACd,qBAAqB;EACrB,6CAA6C;EAC7C,kBAAkB;AACpB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,YAAY;EACZ,kBAAkB;EAClB,OAAO;EACP,MAAM;EACN,UAAU;EACV,SAAS;EACT,8BAA8B;EAC9B,cAAc;EACd,qBAAqB;EACrB,sBAAsB;AACxB;AACA;EACE,aAAa;AACf;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,gBAAgB;EAChB,2CAA2C;AAC7C;AACA;EACE,eAAe;AACjB;AACA;EACE,gBAAgB;AAClB;AACA;EACE,cAAc;EACd,yBAAyB;EACzB,eAAe;EACf,gBAAgB;AAClB;AACA;EACE,wBAAwB;EACxB,cAAc;AAChB;AACA;EACE,cAAc;EACd,iBAAiB;EACjB,iBAAiB;EACjB,eAAe;EACf,sBAAsB;AACxB;AACA;EACE,aAAa;AACf;AACA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,aAAa;AACf;AACA;EACE,qCAAqC;AACvC;AACA;EACE,qCAAqC;AACvC;AACA;EACE,oBAAoB;AACtB;AACA;EACE,cAAc;AAChB;AACA;AACE;IACE,UAAU;ACCd;AACA;AACA;EDCE,sBAAsB;ACCxB;AACA;EACA,UAAA;EDCE,yBAAyB;ECC3B,kBAAA;EACA,gBAAA;EACA,gBAAA;EACA,aAAA;EACA,eAAA;AACA",file:"xbs-confirm.vue",sourcesContent:['.xbs-mask {\n position: fixed;\n z-index: 1000;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.6);\n}\n.xbs-mask_transparent {\n position: fixed;\n z-index: 1000;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n}\n/**\n* dialog\n*/\n.xbs-dialog {\n position: fixed;\n display: table;\n z-index: 5000;\n width: 80%;\n max-width: 300px;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n margin: auto;\n background-color: #FFFFFF;\n text-align: center;\n border-radius: 3px;\n overflow: hidden;\n}\n.xbs-dialog__hd {\n padding: 1.3em 1.6em 0.5em;\n}\n.xbs-dialog__hd.with-no-content {\n padding: 1.7em 1.6em;\n}\n.xbs-dialog__title {\n font-weight: 400;\n font-size: 18px;\n}\n.xbs-dialog__bd {\n padding: 0 1.6em 0.8em;\n min-height: 40px;\n font-size: 15px;\n line-height: 1.3;\n word-wrap: break-word;\n word-break: break-all;\n color: #999999;\n}\n.xbs-dialog__bd:first-child {\n padding: 2.7em 20px 1.7em;\n color: #353535;\n}\n.xbs-dialog__ft {\n position: relative;\n line-height: 48px;\n font-size: 18px;\n display: flex;\n}\n.xbs-dialog__ft:after {\n content: " ";\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n height: 1px;\n border-top: 1px solid #D5D5D6;\n color: #D5D5D6;\n transform-origin: 0 0;\n transform: scaleY(0.5);\n}\n.xbs-dialog__btn {\n display: block;\n flex: 1;\n color: #3CC51F;\n text-decoration: none;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n position: relative;\n}\n.xbs-dialog__btn:active {\n background-color: #EEEEEE;\n}\n.xbs-dialog__btn:after {\n content: " ";\n position: absolute;\n left: 0;\n top: 0;\n width: 1px;\n bottom: 0;\n border-left: 1px solid #D5D5D6;\n color: #D5D5D6;\n transform-origin: 0 0;\n transform: scaleX(0.5);\n}\n.xbs-dialog__btn:first-child:after {\n display: none;\n}\n.xbs-dialog__btn_default {\n color: #353535;\n}\n.xbs-dialog__btn_primary {\n color: #0BB20C;\n}\n.xbs-dialog__btn_warn {\n color: #E64340;\n}\n.xbs-skin_android .xbs-dialog {\n text-align: left;\n box-shadow: 0 6px 30px 0 rgba(0, 0, 0, 0.1);\n}\n.xbs-skin_android .xbs-dialog__title {\n font-size: 21px;\n}\n.xbs-skin_android .xbs-dialog__hd {\n text-align: left;\n}\n.xbs-skin_android .xbs-dialog__bd {\n color: #999999;\n padding: 0.25em 1.6em 2em;\n font-size: 17px;\n text-align: left;\n}\n.xbs-skin_android .xbs-dialog__bd:first-child {\n padding: 1.6em 1.6em 2em;\n color: #353535;\n}\n.xbs-skin_android .xbs-dialog__ft {\n display: block;\n text-align: right;\n line-height: 42px;\n font-size: 16px;\n padding: 0 1.6em 0.7em;\n}\n.xbs-skin_android .xbs-dialog__ft:after {\n display: none;\n}\n.xbs-skin_android .xbs-dialog__btn {\n display: inline-block;\n vertical-align: top;\n padding: 0 0.8em;\n}\n.xbs-skin_android .xbs-dialog__btn:after {\n display: none;\n}\n.xbs-skin_android .xbs-dialog__btn:active {\n background-color: rgba(0, 0, 0, 0.06);\n}\n.xbs-skin_android .xbs-dialog__btn:visited {\n background-color: rgba(0, 0, 0, 0.06);\n}\n.xbs-skin_android .xbs-dialog__btn:last-child {\n margin-right: -0.8em;\n}\n.xbs-skin_android .xbs-dialog__btn_default {\n color: #808080;\n}\n@media screen and (min-width: 1024px) {\n .xbs-dialog {\n width: 35%;\n }\n}\n.xbs-prompt {\n padding-bottom: 1.6rem;\n}\n.xbs-prompt-msgbox {\n width: 80%;\n border: 1px solid #dedede;\n border-radius: 5px;\n padding: 4px 5px;\n appearance: none;\n outline: none;\n font-size: 16px;\n}\n','<template>\n<div class="xbs-confirm">\n\t<xbs-dialog\n\t\tv-model="showValue"\n\t\t:dialog-class="\'xbs-dialog\'"\n\t\t:mask-transition="maskTransition"\n\t\t:dialog-transition="\'xbs-fade\'"\n\t\t:hide-on-blur="hideOnBlur"\n\t\t:mask-z-index="maskZIndex"\n\t\t@on-hide="$emit(\'on-hide\')">\n\t\t<div class="xbs-dialog__hd" v-if="!!title" :class="{\n\t\t\t\'with-no-content\': !showContent\n\t\t}">\n\t\t\t<strong class="xbs-dialog__title">{{ title }}</strong>\n\t\t</div>\n\n\t\t<template v-if="showContent">\n\t\t\t<div class="xbs-dialog__bd" v-if="!showInput">\n\t\t\t\t<slot><div v-html="content"></div></slot>\n\t\t\t</div>\n\t\t\t<div v-else class="xbs-prompt">\n\t\t\t\t<input\n\t\t\t\t\tclass="xbs-prompt-msgbox"\n\t\t\t\t\tv-bind="getInputAttrs()"\n\t\t\t\t\tv-model="msg"\n\t\t\t\t\t:placeholder="placeholder"\n\t\t\t\t\t@touchend="setInputFocus"\n\t\t\t\t\tref="input" />\n\t\t\t</div>\n\t\t\t<div class="xbs-dialog__ft">\n <a v-if="showCancelButton" href="javascript:;" class="xbs-dialog__btn xbs-dialog__btn_default" @click="_onCancel">{{cancelText || \'取消\' }}</a>\n <a v-if="showConfirmButton" href="javascript:;" class="xbs-dialog__btn" :class="`xbs-dialog__btn_${confirmType}`" @click="_onConfirm">{{confirmText || \'确定\' }}</a>\n </div>\n\t\t</template>\n\n\t</xbs-dialog>\n</div>\n</template>\n\n<script>\nimport XbsDialog from \'./xbs-dialog.vue\'\nexport default {\n\tname: \'confirm\',\n\tcomponents: {\n\t\tXbsDialog\n\t},\n\tprops: {\n\t\tvalue: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t\tshowInput: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: \'\'\n\t\t},\n\t\thideOnBlur: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t\ttitle: String,\n\t\tconfirmText: String,\n\t\tcancelText: String,\n\t\tmaskTransition: {\n\t\t\ttype: String,\n\t\t\tdefault: \'xbs-fade\'\n\t\t},\n\t\tmaskZIndex: [String, Number],\n\t\tdialogTransition: {\n\t\t\ttype: String,\n\t\t\tdefault: \'xbs-dialog\'\n\t\t},\n\t\tcontent: String,\n\t\tcloseOnConfirm: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true\n\t\t},\n\t\tinputAttrs: Object,\n\t\tshowContent: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true\n\t\t},\n\t\tconfirmType: {\n\t\t\ttype: String,\n\t\t\tdefault: \'primary\'\n\t\t},\n\t\tshowCancelButton: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true\n\t\t},\n\t\tshowConfirmButton: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true\n\t\t}\n\t},\n\tcreated () {\n\t\tthis.showValue = this.show\n\t\tif (this.value) {\n\t\t\tthis.showValue = this.value\n\t\t}\n\t},\n\twatch: {\n\t\tvalue (val) {\n\t\t\tthis.showValue = val\n\t\t},\n\t\tshowValue (val) {\n\t\t\tthis.$emit(\'input\', val)\n\t\t\tif (val) {\n\t\t\t\tif (this.showInput) {\n\t\t\t\t\tthis.msg = \'\'\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (this.$refs.input) {\n\t\t\t\t\t\t\tthis.setInputFocus()\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 300)\n\t\t\t\t}\n\t\t\t\tthis.$emit(\'on-show\') // emit\n\t\t\t}\n\t\t}\n\t},\n\tdata () {\n\t\treturn {\n\t\t\tmsg: \'\',\n\t\t\tshowValue: false\n\t\t}\n\t},\n\tmethods: {\n\t\tgetInputAttrs () {\n\t\t\treturn this.inputAttrs || {\n\t\t\t\ttype: \'text\'\n\t\t\t}\n\t\t},\n\t\tsetInputValue (val) {\n\t\t\tthis.msg = val\n\t\t},\n\t\tsetInputFocus (evt) {\n\t\t\tif (evt) {\n\t\t\t\tevt.preventDefault()\n\t\t\t}\n\t\t\tthis.$refs.input.focus()\n\t\t},\n\t\t_onConfirm () {\n\t\t\tif (!this.showValue) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.closeOnConfirm) {\n\t\t\t\tthis.showValue = false\n\t\t\t}\n\t\t\tthis.$emit(\'on-confirm\', this.msg)\n\t\t},\n\t\t_onCancel () {\n\t\t\tif (!this.showValue) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.showValue = false\n\t\t\tthis.$emit(\'on-cancel\')\n\t\t}\n\t}\n}\n<\/script>\n\n<style lang="less">\n@import \'./transition.less\';\n@import \'./mask.less\';\n@import \'./dialog.less\';\n\n.xbs-prompt {\n\tpadding-bottom: 1.6rem;\n}\n\n.xbs-prompt-msgbox {\n\twidth: 80%;\n\tborder: 1px solid #dedede;\n\tborder-radius: 5px;\n\tpadding: 4px 5px;\n\tappearance: none;\n\toutline: none;\n\tfont-size: 16px;\n}\n\n</style>\n']},media:void 0})},f,void 0,!1,void 0,u,void 0);function C(t){if(!C.installed){C.installed=!0;var e=t.extend(x);h||(h=new e({el:document.createElement("div"),propsData:{title:""}}),document.body.appendChild(h.$el));var o={show:function(t){"object"===n(t)&&a(h,t),"object"===n(t)&&t.onShow&&t.onShow(),this.$watcher&&this.$watcher(),this.$watcher=h.$watch("showValue",function(n){!n&&t&&t.onHide&&t.onHide()}),h.$off("on-cancel"),h.$off("on-confirm"),h.$on("on-cancel",function(){t&&t.onCancel&&t.onCancel()}),h.$on("on-confirm",function(n){t&&t.onConfirm&&t.onConfirm(n)}),h.showValue=!0},hide:function(){h.showValue=!1},isVisible:function(){return h.showValue}};t.$xbs?t.$xbs.confirm=o:t.$xbs={confirm:o},t.mixin({created:function(){this.$xbs=t.$xbs}})}}var _={install:C,get enabled(){return state.enabled},set enabled(t){state.enabled=t}},B=null;return"undefined"!=typeof window?B=window.Vue:"undefined"!=typeof global&&(B=global.Vue),B&&B.use(_),t.default=_,t.install=C,t}({});