UNPKG

6.46 kBJavaScriptView Raw
1module.exports=function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=275)}({0:function(t,e){t.exports=function(t,e,n,i,r,o){var a,s=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(a=t,s=t.default);var p="function"==typeof s?s.options:s;e&&(p.render=e.render,p.staticRenderFns=e.staticRenderFns,p._compiled=!0),n&&(p.functional=!0),r&&(p._scopeId=r);var l;if(o?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},p._ssrRegister=l):i&&(l=i),l){var d=p.functional,h=d?p.render:p.beforeCreate;d?(p._injectStyles=l,p.render=function(t,e){return l.call(e),h(t,e)}):p.beforeCreate=h?[].concat(h,l):[l]}return{esModule:a,exports:s,options:p}}},1:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return r}),n.d(e,"d",function(){return o}),n.d(e,"b",function(){return a});var i={props:{disabled:{type:Boolean},type:{type:String,default:"default"},size:{type:String,default:"default"},nativeType:{type:String,default:"button"},plain:{type:Boolean},loadingColor:{type:Object,default:function(){return{default:"#d6d6d6",danger:"#e04b00",warning:"#ff9900"}}},loading:{type:Boolean},ripple:{type:Boolean}}},r={inject:{vxFormItem:{default:"vxFormItem"}},props:{disabled:{type:Boolean},clearable:{type:Boolean,default:!0},nativeType:{type:String,default:"text"},readonly:{type:Boolean},value:{type:[String,Number]},placeholder:{type:String},autocomplete:{type:String},autofocus:{type:String},maxlength:{type:Number},name:{type:String,default:function(){return Math.random().toString(36).substr(2)}},checked:{type:Boolean},validateEvent:{type:Boolean,default:!0},arrow:{type:Boolean,default:!1},arrowProps:{type:Object},border:{type:Boolean,default:!0},autoIntoView:{type:Boolean,default:!0},size:{type:String,default:"default"}},data:function(){return{isFocus:!1}},methods:{handleFocusIn:function(t){this.isFocus=!0;var e=t.target;this.autoIntoView&&void 0!==e.ontouchstart&&window.addEventListener("resize",function(){e.scrollIntoView&&e.scrollIntoView()},{once:!0})},handleFocusOut:function(t){this.isFocus=!1,this.eDispatch("ElFormItem","el.form.blur",[t.target.value])},handleChange:function(t){this.$emit("change",t.target.value)},handleInput:function(t){var e=t.target?t.target.value:t;this.$emit("input",e),this.eDispatch("ElFormItem","el.form.change",[e])},eDispatch:function(){this.validateEvent&&this.dispatch&&this.dispatch.apply(this,arguments)}}},o={methods:{change:function(t){this.active!==t&&this.$emit("update:active",t).$emit("change",t)}},props:{active:{type:[Number,String,Object],required:!0},layout:{type:String,default:"default"}}},a={props:{history:{type:Boolean,default:!0}},methods:{getPushURL:function(){var t=window.location.hash;this.pushString="popup="+Math.random().toString(36).substr(2);var e=[window.location.href.split("#")[0],t];return e.push(t?-1===t.indexOf("?")&&-1===t.indexOf("=")?"?":"&":"#"),e.push(this.pushString),e.join("")},pushState:function(){var t=this;this.history&&(this.pushString&&this.isCurrentPopup()&&window.history.back(),setTimeout(function(){window.history.pushState({},"",t.getPushURL()),window.addEventListener("popstate",t.handlePopstate)},16))},handlePopstate:function(){-1===window.location.href.indexOf(this.pushString)&&(this.$emit("update:open",!1).$emit("close"),this.popStateBack&&this.popStateBack(),window.removeEventListener("popstate",this.handlePopstate))},goBack:function(){this.history&&this.isCurrentPopup()&&(window.removeEventListener("popstate",this.handlePopstate),history.back())},isCurrentPopup:function(){return window.location.href.indexOf(this.pushString)===window.location.href.length-this.pushString.length}}}},125:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(68),r=n(126),o=n(0),a=o(i.a,r.a,!1,null,null,null);e.default=a.exports},126:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:["vx-input-number","vx-input-number--size-"+t.size,{"is-disabled":t.disabled}]},[n("div",{staticClass:"vx-input-number--inner"},[n("button",{staticClass:"vx-input-number--reduce",attrs:{disabled:void 0!==t.min&&t.value<=t.min,type:"button"},on:{click:function(e){t.handleChange(t.value-t.buttonStep)}}}),n("input",t._g(t._b({attrs:{type:"number"},domProps:{value:t.myValue}},"input",t.$$props,!1),t.$$listeners)),n("button",{staticClass:"vx-input-number--add",attrs:{disabled:void 0!==t.max&&t.max>=t.value,type:"button"},on:{click:function(e){t.handleChange(t.value+t.buttonStep)}}})])])},r=[],o={render:i,staticRenderFns:r};e.a=o},2:function(t,e){t.exports=require("babel-runtime/helpers/extends")},275:function(t,e,n){t.exports=n(125)},68:function(t,e,n){"use strict";var i=n(2),r=n.n(i),o=n(1);e.a={name:"InputNumber",componentName:"InputNumber",mixins:[o.c],props:r()({},o.c.props,{value:{type:Number,default:0},min:{type:Number},max:{type:Number},step:{type:Number,default:1},buttonStep:{type:Number,default:1},size:{type:String,default:"default"}}),computed:{myValue:function(){return this.value<this.min?Math.round(this.min*this.stepRate)/this.stepRate:this.value>this.max?Math.round(this.max*this.stepRate)/this.stepRate:Math.round(this.value*this.stepRate)/this.stepRate},stepRate:function(){return 1/this.step},$$props:function(){return r()({},this.$props,this.$attrs)},$$listeners:function(){return r()({},this.$listeners,{input:this.handleChange})}},methods:{handleChange:function(t){var e=Number(t.target?t.target.value:t),n=this.$el.querySelector("input");isNaN(e)?n&&(n.value=this.value):("number"==typeof this.max&&e>this.max&&(e=this.max),"number"==typeof this.min&&e<this.min&&(e=this.min),e=Math.round(e*this.stepRate)/this.stepRate,n&&(n.value=e),this.$emit("input",e).$emit("change",e).$emit("blur"),this.eDispatch("ElFormItem","el.form.blur",[e]),this.eDispatch("ElFormItem","el.form.change",[e]))}}}}});
\No newline at end of file