/*! * vue-range-slider v1.0.3 * (c) 2016-2018 xwpongithub * Released under the MIT License. */ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.VueRangeSlider=i()}(this,function(){"use strict";var i,o=(i="undefined"!=typeof window&&window.devicePixelRatio||1,function(t){return Math.round(t*i)/i}),t=function(){for(var t=navigator.userAgent.toLowerCase(),i=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"],e=!1,s=0;s=this.indexRange[0]&&s<=this.indexRange[1]})}return t},total:function(){return this.data?this.data.length-1:(Math.floor((this.maximum-this.minimum)*this.multiple)%(this.step*this.multiple)!=0&&this.printError("Prop[step] is illegal, Please make sure that the step can be divisible"),(this.maximum-this.minimum)/this.step)},piecewiseDotStyle:function(){return"vertical"===this.direction?{width:"".concat(this.width,"px"),height:"".concat(this.width,"px")}:{width:"".concat(this.height,"px"),height:"".concat(this.height,"px")}},dotStyles:function(){return"vertical"===this.direction?{width:"".concat(this.dotWidthVal,"px"),height:"".concat(this.dotHeightVal,"px"),left:"".concat(-(this.dotWidthVal-this.width)/2,"px")}:{width:"".concat(this.dotWidthVal,"px"),height:"".concat(this.dotHeightVal,"px"),top:"".concat(-(this.dotHeightVal-this.height)/2,"px")}},sliderStyles:function(){return s(this.sliderStyle)?this.isRange?this.sliderStyle:this.sliderStyle[1]:"function"==typeof this.sliderStyle?this.sliderStyle(this.val,this.currentIndex):this.isRange?[this.sliderStyle,this.sliderStyle]:this.sliderStyle},tooltipStyles:function(){return s(this.tooltipStyle)?this.isRange?this.tooltipStyle:this.tooltipStyle[1]:"function"==typeof this.tooltipStyle?this.tooltipStyle(this.val,this.currentIndex):this.isRange?[this.tooltipStyle,this.tooltipStyle]:this.tooltipStyle},focusStyles:function(){return s(this.focusStyle)?this.isRange?this.focusStyle:this.focusStyle[1]:"function"==typeof this.focusStyle?this.focusStyle(this.val,this.currentIndex):this.isRange?[this.focusStyle,this.focusStyle]:this.focusStyle},elemStyles:function(){return"vertical"===this.direction?{width:"".concat(this.width,"px"),height:"100%"}:{height:"".concat(this.height,"px")}},wrapStyles:function(){return"vertical"===this.direction?{height:"number"==typeof this.height?"".concat(this.height,"px"):this.height,padding:"".concat(this.dotHeightVal/2,"px ").concat(this.dotWidthVal/2,"px")}:{width:"number"==typeof this.width?"".concat(this.width,"px"):this.width,padding:"".concat(this.dotHeightVal/2,"px ").concat(this.dotWidthVal/2,"px")}},stateClass:function(){return{"slider-state-process-drag":this.processFlag,"slider-state-drag":this.flag&&!this.processFlag&&!this.keydownFlag,"slider-state-focus":this.focusFlag}},tooltipStatus:function(){return"hover"===this.tooltip&&this.flag?"slider-always":this.tooltip?"slider-".concat(this.tooltip):""},tooltipClass:function(){return["slider-tooltip-".concat(this.tooltipDirection),"slider-tooltip"]},minimum:function(){return this.data?0:this.min},maximum:function(){return this.data?this.data.length-1:this.max},multiple:function(){var t="".concat(this.step).split(".")[1];return t?Math.pow(10,t.length):1},indexRange:function(){return this.isRange?this.currentIndex:[0,this.currentIndex]},spacing:function(){return this.data?1:this.step},gap:function(){return this.size/this.total},dotWidthVal:function(){return"number"==typeof this.dotWidth?this.dotWidth:this.dotSize},dotHeightVal:function(){return"number"==typeof this.dotHeight?this.dotHeight:this.dotSize},disabledArray:function(){return s(this.disabled)?this.disabled:[this.disabled,this.disabled]},boolDisabled:function(){return this.disabledArray.every(function(t){return!0===t})},disabledClass:function(){return this.boolDisabled?"slider-disabled":""},flowDirection:function(){return"slider-".concat(this.direction+(this.reverse?"-reverse":""))},isRange:function(){return s(this.value)},isDisabled:function(){return"none"===this.eventType||this.boolDisabled},isFixed:function(){return this.fixed||this.minRange},position:function(){return this.isRange?[(this.currentValue[0]-this.minimum)/this.spacing*this.gap,(this.currentValue[1]-this.minimum)/this.spacing*this.gap]:(this.currentValue-this.minimum)/this.spacing*this.gap},limit:function(){return this.isRange?this.isFixed?[[0,(this.total-this.fixedValue)*this.gap],[this.fixedValue*this.gap,this.size]]:[[0,this.position[1]],[this.position[0],this.size]]:[0,this.size]},valueLimit:function(){return this.isRange?this.isFixed?[[this.minimum,this.maximum-this.fixedValue*(this.spacing*this.multiple)/this.multiple],[this.minimum+this.fixedValue*(this.spacing*this.multiple)/this.multiple,this.maximum]]:[[this.minimum,this.currentValue[1]],[this.currentValue[0],this.maximum]]:[this.minimum,this.maximum]},idleSlider:function(){return 0===this.currentSlider?1:0},slider:function(){return this.isRange?[this.$refs.dot0,this.$refs.dot1]:this.$refs.dot}},methods:{setValue:function(t,i,e){var s=this;if(n(this.val,t)){var r=this.limitValue(t);this.val=this.isRange?r.concat():r,this.computedFixedValue(),this.syncValue(i)}this.$nextTick(function(){return s.setPosition(e)})},setIndex:function(t){var i;s(t)&&this.isRange?(i=this.data?[this.data[t[0]],this.data[t[1]]]:[this.getValueByIndex(t[0]),this.getValueByIndex(t[1])],this.setValue(i)):(t=this.getValueByIndex(t),this.isRange&&(this.currentSlider=t>(this.currentValue[1]-this.currentValue[0])/2+this.currentValue[0]?1:0),this.setCurrentValue(t))},wrapClick:function(t){if(this.isDisabled||!this.clickable||this.processFlag||this.dragFlag)return!1;var i=this.getPos(t);if(this.isRange)if(this.disabledArray.every(function(t){return!1===t}))this.currentSlider=i>(this.position[1]-this.position[0])/2+this.position[0]?1:0;else if(this.disabledArray[0]){if(ithis.position[1])return!1;this.currentSlider=0}if(this.disabledArray[this.currentSlider])return!1;if(this.setValueOnPos(i),this.isRange&&this.tooltipMerge){var e=setInterval(this.handleOverlapTooltip,16.7);setTimeout(function(){return window.clearInterval(e)},1e3*this.speed)}},processClick:function(t){this.fixed&&t.stopPropagation()},syncValue:function(t){var i=this.isRange?this.val.concat():this.val;this.$emit("input",i),this.keydownFlag&&this.$emit("on-keypress",i),t||this.$emit("slide-end",i)},getPos:function(t){return this.realTime&&this.getStaticData(),"vertical"===this.direction?this.reverse?t.pageY-this.offset:this.size-(t.pageY-this.offset):this.reverse?this.size-(t.pageX-this.offset):t.pageX-this.offset},setValueOnPos:function(t,i){var e=this.isRange?this.limit[this.currentSlider]:this.limit,s=this.isRange?this.valueLimit[this.currentSlider]:this.valueLimit,r=Math.round(t/this.gap);if(t>=e[0]&&t<=e[1]){var n=this.getValueByIndex(r);this.setTransform(t),this.setCurrentValue(n,i),this.isRange&&(this.fixed||this.isLessRange(t,r))&&(this.setTransform(t+this.fixedValue*this.gap*(0===this.currentSlider?1:-1),!0),this.setCurrentValue((n*this.multiple+this.fixedValue*this.spacing*this.multiple*(0===this.currentSlider?1:-1))/this.multiple,i,!0))}else{var a=tthis.maximum)return!1;this.isRange?n(this.currentValue[s],t)&&(this.currentValue.splice(s,1,t),this.lazy&&this.flag||this.syncValue()):n(this.currentValue,t)&&(this.currentValue=t,this.lazy&&this.flag||this.syncValue()),i||this.setPosition()},setPosition:function(t){this.flag||this.setTransitionTime(void 0===t?this.speed:t),this.isRange?(this.setTransform(this.position[0],1===this.currentSlider),this.setTransform(this.position[1],0===this.currentSlider)):this.setTransform(this.position),this.flag||this.setTransitionTime(0)},setTransform:function(t,i){var e=i?this.idleSlider:this.currentSlider,s=o(("vertical"===this.direction?this.dotHeightVal/2-t:t-this.dotWidthVal/2)*(this.reverse?-1:1)),r="vertical"===this.direction?"translateY(".concat(s,"px)"):"translateX(".concat(s,"px)"),n=this.fixed?"".concat(this.fixedValue*this.gap,"px"):"".concat(0===e?this.position[1]-t:t-this.position[0],"px"),a=this.fixed?"".concat(0===e?t:t-this.fixedValue*this.gap,"px"):"".concat(0===e?t:this.position[0],"px");this.isRange?(this.slider[e].style[u]=r,"vertical"===this.direction?(this.$refs.process.style.height=n,this.$refs.process.style[this.reverse?"top":"bottom"]=a):(this.$refs.process.style.width=n,this.$refs.process.style[this.reverse?"right":"left"]=a)):(this.slider.style[u]=r,"vertical"===this.direction?(this.$refs.process.style.height="".concat(t,"px"),this.$refs.process.style[this.reverse?"top":"bottom"]=0):(this.$refs.process.style.width="".concat(t,"px"),this.$refs.process.style[this.reverse?"right":"left"]=0))},setTransitionTime:function(t){if(t||this.$refs.process.offsetWidth,this.isRange){for(var i=this.slider.length,e=0;ee.max?(e.printError("The value of the slider is ".concat(i,", the maximum value is ").concat(e.max,", the value of this slider can not be greater than the maximum value")),e.max):t};return this.isRange?i.map(function(t){return s(t)}):s(i)},getStaticData:function(){this.$refs.elem&&(this.size="vertical"===this.direction?this.$refs.elem.offsetHeight:this.$refs.elem.offsetWidth,this.offset="vertical"===this.direction?this.$refs.elem.getBoundingClientRect().top+window.pageYOffset||document.documentElement.scrollTop:this.$refs.elem.getBoundingClientRect().left)},handleOverlapTooltip:function(){var t=this.tooltipDirection[0]===this.tooltipDirection[1];if(this.isRange&&t){var i=this.reverse?this.$refs.tooltip1:this.$refs.tooltip0,e=this.reverse?this.$refs.tooltip0:this.$refs.tooltip1,s=i.getBoundingClientRect(),r=e.getBoundingClientRect(),n=s.right,a=r.left,o=s.top,h=r.top+r.height,l="horizontal"===this.direction&&a=this.maxRange?(this.fixedValue=this.maxRange,!0):(this.computedFixedValue(),!1)},getValueByIndex:function(t){return(this.spacing*this.multiple*t+this.minimum*this.multiple)/this.multiple},getIndexByValue:function(t){return Math.round((t-this.minimum)*this.multiple)/(this.spacing*this.multiple)},formatting:function(t){return"string"==typeof this.formatter?this.formatter.replace(/{value}/,t):this.formatter(t)},mergeFormatting:function(e,s){return"string"==typeof this.mergeFormatter?this.mergeFormatter.replace(/{(value1|value2)}/g,function(t,i){return"value1"===i?e:s}):this.mergeFormatter(e,s)},_start:function(t){var i=1=s[0])return e}return t});t[0]>t[1]&&(this.focusSlider=0===this.focusSlider?1:0,t=t.reverse()),this.setIndex(t)}else this.setIndex(r(this.currentIndex))},bindEvents:function(){var i=this;this.processStartFn=function(t){i._start(t,0,!0)},this.dot0StartFn=function(t){i._start(t,0)},this.dot1StartFn=function(t){i._start(t,1)},t?(h(this.$refs.process,f,this.processStartFn),h(document,p,this._move),h(document,g,this._end),h(document,m,this._end),this.isRange?(h(this.$refs.dot0,f,this.dot0StartFn),h(this.$refs.dot1,f,this.dot1StartFn)):h(this.$refs.dot,f,this._start)):(h(this.$refs.process,y,this.processStartFn),h(document,y,this.blurSlider),h(document,v,this._move),h(document,S,this._end),h(document,b,this._end),this.isRange?(h(this.$refs.dot0,y,this.dot0StartFn),h(this.$refs.dot1,y,this.dot1StartFn)):h(this.$refs.dot,y,this._start)),h(document,x,this.handleKeydown),h(document,w,this.handleKeyup),h(window,V,this.refresh),this.isRange&&this.tooltipMerge&&(h(this.$refs.dot0,c,this.handleOverlapTooltip),h(this.$refs.dot1,c,this.handleOverlapTooltip))},unbindEvents:function(){t?(l(this.$refs.process,f,this.processStartFn),l(document,p,this._move),l(document,g,this._end),l(document,m,this._end),this.isRange?(l(this.$refs.dot0,f,this.dot0StartFn),l(this.$refs.dot1,f,this.dot1StartFn)):l(this.$refs.dot,f,this._start)):(l(this.$refs.process,y,this.processStartFn),l(document,y,this.blurSlider),l(document,v,this._move),l(document,S,this._end),l(document,b,this._end),this.isRange?(l(this.$refs.dot0,y,this.dot0StartFn),l(this.$refs.dot1,y,this.dot1StartFn)):l(this.$refs.dot,y,this._start)),l(document,x,this.handleKeydown),l(document,w,this.handleKeyup),l(window,V,this.refresh),this.isRange&&this.tooltipMerge&&(l(this.$refs.dot0,c,this.handleOverlapTooltip),l(this.$refs.dot1,c,this.handleOverlapTooltip))},refresh:function(){this.$refs.elem&&(this.getStaticData(),this.computedFixedValue(),this.setPosition(),this.unbindEvents(),this.bindEvents())},printError:function(t){this.debug}},mounted:function(){var t=this;if(this.isComponentExists=!0,"undefined"==typeof window||"undefined"==typeof document)return this.printError("window or document is undefined, can not be initialization.");this.$nextTick(function(){t.getStaticData(),t.setValue(t.limitValue(t.value),!0,t.startAnimation?t.speed:0),t.bindEvents(),t.isRange&&t.tooltipMerge&&!t.startAnimation&&t.handleOverlapTooltip()}),this.isMounted=!0},watch:{value:function(t){this.flag||this.setValue(t,!0)},show:function(t){t&&!this.size&&this.$nextTick(this.refresh)},max:function(t){if(tthis.max)return this.printError("The minimum value can not be greater than the maximum value.");var i=this.limitValue(this.val);this.setValue(i),this.refresh()},fixed:function(){this.computedFixedValue()},minRange:function(){this.computedFixedValue()}},beforeDestroy:function(){this.isComponentExists=!1,this.unbindEvents(),this.refresh()},deactivated:function(){this.isComponentExists=!1,this.unbindEvents(),this.refresh()}};return R.version="1.0.3",R.install=function(t){t.component(R.name,R)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(R),R});