UNPKG

8.18 kBJavaScriptView Raw
1module.exports=function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.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=277)}({0:function(t,e){t.exports=function(t,e,n,i,o,a){var r,s=t=t||{},u=typeof t.default;"object"!==u&&"function"!==u||(r=t,s=t.default);var d="function"==typeof s?s.options:s;e&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0),n&&(d.functional=!0),o&&(d._scopeId=o);var h;if(a?(h=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(a)},d._ssrRegister=h):i&&(h=i),h){var l=d.functional,c=l?d.render:d.beforeCreate;l?(d._injectStyles=h,d.render=function(t,e){return h.call(e),c(t,e)}):d.beforeCreate=c?[].concat(c,h):[h]}return{esModule:r,exports:s,options:d}}},1:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return o}),n.d(e,"d",function(){return a}),n.d(e,"b",function(){return r});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}}},o={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)}}},a={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"}}},r={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}}}},127:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(70),o=n(128),a=n(0),r=a(i.a,o.a,!1,null,null,null);e.default=r.exports},128: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-range--wrapper",{"is-disabled":t.disabled}]},[n("div",{staticClass:"vx-range--mask"}),n("div",{staticClass:"vx-range--value"}),n("div",{staticClass:"vx-range--button",on:{mousedown:t.handleTouchStart,touchstart:t.handleTouchStart}},[n("div",{staticClass:"vx-range--tips"},[t._v("0")])])])},o=[],a={render:i,staticRenderFns:o};e.a=a},18:function(t,e){t.exports=require("babel-runtime/core-js/object/assign")},2:function(t,e){t.exports=require("babel-runtime/helpers/extends")},277:function(t,e,n){t.exports=n(127)},70:function(t,e,n){"use strict";var i=n(18),o=n.n(i),a=n(2),r=n.n(a),s=n(1);e.a={name:"Range",componentName:"Range",mixins:[s.c],props:r()({},s.c.props,{min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},value:{type:Number,default:0},disabled:{type:Boolean,default:!1},unit:{type:[String,Function]}}),computed:{offsetWidth:function(){return{width:this.value/this.max*this.$el.offsetWidth+"px"}},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},range:function(){return this.max-this.min},stepRate:function(){return 1/this.step}},watch:{value:function(){this.renderRange()}},mounted:function(){this.$nextTick(this.getRangeInitData),this.$nextTick(this.renderRange),window.addEventListener("resize",this.handleResize,!1)},beforeDestroy:function(){window.removeEventListener("resize",this.handleResize)},methods:{getRangeInitData:function(){var t=this.$el.querySelector(".vx-range--button"),e=this.$el.querySelector(".vx-range--value"),n=this.$el.querySelector(".vx-range--tips"),i=this.$el.querySelector(".vx-range--mask");this.$$range={maxLeft:i.offsetWidth-t.offsetWidth,controlNode:t,valueNode:e,tipsNode:n}},renderRange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.myValue,e=Math.round((t-this.min)/this.range*this.$$range.maxLeft)+"px";this.$$range.controlNode.style.left=this.$$range.valueNode.style.width=e,this.$$range.tipsNode.innerHTML=this.getTipsText(this.myValue)},getTipsText:function(t){return""+t+(this.unit?"function"==typeof this.unit?this.unit(t):this.unit:"")},handleChange:function(t){this.$emit("input",t).$emit("change",t),this.eDispatch("ElFormItem","el.form.blur",[t]),this.eDispatch("ElFormItem","el.form.change",[t])},handleResize:function(){this.getRangeInitData(),this.renderRange()},handleTouchStart:function(t){var e=this;if(t.preventDefault(),!this.disabled){this.getRangeInitData();var n=this.getPosition(t),i=!0,a=this.$$range.controlNode.style.left,r=o()({left:a?parseFloat(a):0},n);this.$$range.tipsNode.style.display="block";var s=this,u=this.myValue,d=function(t){if(i){var o=s.getPosition(t),d=o.pageX-n.pageX+r.left;d=d<0?0:d,d=d>e.$$range.maxLeft?e.$$range.maxLeft:d,a=d,e.$$range.controlNode.style.left=e.$$range.valueNode.style.width=d+"px",u=Math.round((a/e.$$range.maxLeft*e.range+e.min)*e.stepRate)/e.stepRate,e.$$range.tipsNode.innerHTML=e.getTipsText(u),t.preventDefault()}},h=function t(){document.removeEventListener(void 0!==document.ontouchmove?"touchmove":"mousemove",d),document.removeEventListener(void 0!==document.ontouchend?"touchend":"mouseup",t),i=!1,e.$$range.tipsNode.style.display="none",s.handleChange(u)};document.addEventListener(void 0!==document.ontouchmove?"touchmove":"mousemove",d,!1),document.addEventListener(void 0!==document.ontouchend?"touchend":"mouseup",h,!1)}},getPosition:function(t){return{pageX:t.changedTouches?t.changedTouches[0].pageX:t.pageX,pageY:t.changedTouches?t.changedTouches[0].pageY:t.pageY}}}}}});
\No newline at end of file