vue-range-slider
Advanced tools
Comparing version 0.2.2 to 0.2.3
/*! | ||
* vue-range-slider v0.2.2 | ||
* vue-range-slider v0.2.3 | ||
* https://github.com/ktsn/vue-range-slider | ||
@@ -150,9 +150,5 @@ * | ||
with(this) { | ||
return _h('span', { staticClass: "range-slider" }, [_h('drag-helper', { attrs: { "target-selector": ".range-slider-knob", "disabled": disabled }, on: { "drag": drag, "dragend": dragEnd } }, [_h('span', { ref: "inner", staticClass: "range-slider-inner" }, [_h('input', { staticClass: "range-slider-hidden", attrs: { "type": "text", "name": name }, domProps: { "value": actualValue } }), " ", _m(0), " ", _h('span', { staticClass: "range-slider-fill", style: { width: valuePercent + '%' } }), " ", _h('span', { staticClass: "range-slider-knob", style: { left: valuePercent + '%' } })])])]); | ||
return _h('span', { staticClass: "range-slider" }, [_h('drag-helper', { attrs: { "target-selector": ".range-slider-knob", "disabled": disabled }, on: { "drag": drag, "dragend": dragEnd } }, [_h('span', { ref: "inner", staticClass: "range-slider-inner" }, [_h('input', { staticClass: "range-slider-hidden", attrs: { "type": "text", "name": name }, domProps: { "value": actualValue } }), " ", _h('span', { staticClass: "range-slider-rail" }), " ", _h('span', { staticClass: "range-slider-fill", style: { width: valuePercent + '%' } }), " ", _h('span', { staticClass: "range-slider-knob", style: { left: valuePercent + '%' } })])])]); | ||
} | ||
}, staticRenderFns: [function () { | ||
with(this) { | ||
return _h('span', { staticClass: "range-slider-rail" }); | ||
} | ||
}], | ||
}, staticRenderFns: [], | ||
props: { | ||
@@ -185,4 +181,4 @@ name: String, | ||
created: function created() { | ||
var min = this._min; | ||
var max = this._max; | ||
var min = this._min, | ||
max = this._max; | ||
@@ -189,0 +185,0 @@ var defaultValue = Number(this.value); |
/*! | ||
* vue-range-slider v0.2.2 | ||
* vue-range-slider v0.2.3 | ||
* https://github.com/ktsn/vue-range-slider | ||
@@ -156,9 +156,5 @@ * | ||
with(this) { | ||
return _h('span', { staticClass: "range-slider" }, [_h('drag-helper', { attrs: { "target-selector": ".range-slider-knob", "disabled": disabled }, on: { "drag": drag, "dragend": dragEnd } }, [_h('span', { ref: "inner", staticClass: "range-slider-inner" }, [_h('input', { staticClass: "range-slider-hidden", attrs: { "type": "text", "name": name }, domProps: { "value": actualValue } }), " ", _m(0), " ", _h('span', { staticClass: "range-slider-fill", style: { width: valuePercent + '%' } }), " ", _h('span', { staticClass: "range-slider-knob", style: { left: valuePercent + '%' } })])])]); | ||
return _h('span', { staticClass: "range-slider" }, [_h('drag-helper', { attrs: { "target-selector": ".range-slider-knob", "disabled": disabled }, on: { "drag": drag, "dragend": dragEnd } }, [_h('span', { ref: "inner", staticClass: "range-slider-inner" }, [_h('input', { staticClass: "range-slider-hidden", attrs: { "type": "text", "name": name }, domProps: { "value": actualValue } }), " ", _h('span', { staticClass: "range-slider-rail" }), " ", _h('span', { staticClass: "range-slider-fill", style: { width: valuePercent + '%' } }), " ", _h('span', { staticClass: "range-slider-knob", style: { left: valuePercent + '%' } })])])]); | ||
} | ||
}, staticRenderFns: [function () { | ||
with(this) { | ||
return _h('span', { staticClass: "range-slider-rail" }); | ||
} | ||
}], | ||
}, staticRenderFns: [], | ||
props: { | ||
@@ -191,4 +187,4 @@ name: String, | ||
created: function created() { | ||
var min = this._min; | ||
var max = this._max; | ||
var min = this._min, | ||
max = this._max; | ||
@@ -195,0 +191,0 @@ var defaultValue = Number(this.value); |
/*! | ||
* vue-range-slider v0.2.2 | ||
* vue-range-slider v0.2.3 | ||
* https://github.com/ktsn/vue-range-slider | ||
@@ -10,2 +10,2 @@ * | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRangeSlider=e()}(this,function(){function forEachListener(t,e){var n=t.$options.events;Object.keys(n).forEach(function(i){e(i,function(e){return n[i].call(t,e)})})}function relativeMouseOffset(t,e){var n=e.getBoundingClientRect();return{left:t.clientX-n.left,top:t.clientY-n.top}}function round$1(t,e,n,i){if(e>=t)return e;var r=Math.floor((n-e)/i)*i+e;if(t>=r)return r;var s=(t-e)/i,a=Math.floor(s),u=s-a;return 0===u?t:.5>u?i*a+e:i*(a+1)+e}var DocumentEventHelper={created:function(){forEachListener(this,function(t,e){document.addEventListener(t,e)})},beforeDestroy:function(){forEachListener(this,function(t,e){document.removeEventListener(t,e)})}},DragHelper={mixins:[DocumentEventHelper],props:{targetSelector:String,disabled:Boolean},data:function(){return{isDrag:!1}},watch:{target:"bindTarget"},mounted:function(){this.bindTarget()},events:{mousedown:function(t){return this.dragStart(t,this.offsetByMouse)},mousemove:function(t){return this.dragMove(t,this.offsetByMouse)},mouseup:function(t){return this.dragEnd(t,this.offsetByMouse)},touchstart:function(t){return this.dragStart(t,this.offsetByTouch)},touchmove:function(t){return this.dragMove(t,this.offsetByTouch)},touchend:function(t){return this.dragEnd(t,this.offsetByTouch)},touchcancel:function(t){return this.dragEnd(t,this.offsetByTouch)}},methods:{bindTarget:function(){this.target=this.$el.querySelector(this.targetSelector)||this.$el},offsetByMouse:function(t){return relativeMouseOffset(t,this.$el)},offsetByTouch:function(t){var e=0===t.touches.length?t.changedTouches[0]:t.touches[0];return relativeMouseOffset(e,this.$el)},dragStart:function(t,e){this.disabled||this.target!==t.target||(t.preventDefault(),this.isDrag=!0,this.$emit("dragstart",t,e(t),this.target))},dragMove:function(t,e){this.isDrag&&(t.preventDefault(),this.$emit("drag",t,e(t),this.target))},dragEnd:function(t,e){this.isDrag&&(t.preventDefault(),this.isDrag=!1,this.$emit("dragend",t,e(t),this.target))}},render:function(){return this.$slots["default"]&&this.$slots["default"][0]}},RangeSlider={render:function render(){with(this)return _h("span",{staticClass:"range-slider"},[_h("drag-helper",{attrs:{"target-selector":".range-slider-knob",disabled:disabled},on:{drag:drag,dragend:dragEnd}},[_h("span",{ref:"inner",staticClass:"range-slider-inner"},[_h("input",{staticClass:"range-slider-hidden",attrs:{type:"text",name:name},domProps:{value:actualValue}})," ",_m(0)," ",_h("span",{staticClass:"range-slider-fill",style:{width:valuePercent+"%"}})," ",_h("span",{staticClass:"range-slider-knob",style:{left:valuePercent+"%"}})])])])},staticRenderFns:[function(){with(this)return _h("span",{staticClass:"range-slider-rail"})}],props:{name:String,value:[String,Number],disabled:{type:Boolean,"default":!1},min:{type:[String,Number],"default":0},max:{type:[String,Number],"default":100},step:{type:[String,Number],"default":1}},data:function(){return{actualValue:null}},created:function(){var t=this._min,e=this._max,n=Number(this.value);(null==this.value||isNaN(n))&&(n=t>e?t:(t+e)/2),this.actualValue=this.round(n)},computed:{_min:function(){return Number(this.min)},_max:function(){return Number(this.max)},_step:function(){return Number(this.step)},valuePercent:function(){return(this.actualValue-this._min)/(this._max-this._min)*100}},watch:{value:function t(e){var t=Number(e);null==e||isNaN(t)||(this.actualValue=this.round(t))},min:function(){this.actualValue=this.round(this.actualValue)},max:function(){this.actualValue=this.round(this.actualValue)}},methods:{drag:function(t,e){var n=this.$refs.inner.offsetWidth;this.actualValue=this.round(this.valueFromBounds(e.left,n)),this.emitEvent(this.actualValue)},dragEnd:function(t,e){var n=this.$refs.inner.offsetWidth;this.actualValue=this.round(this.valueFromBounds(e.left,n)),this.emitEvent(this.actualValue,!0)},emitEvent:function(t,e){this.$emit("input",t),e&&this.$emit("change",t)},valueFromBounds:function(t,e){return t/e*(this._max-this._min)+this._min},round:function(t){return round$1(t,this._min,this._max,this._step)}},components:{DragHelper:DragHelper}};return RangeSlider}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRangeSlider=e()}(this,function(){function forEachListener(t,e){var n=t.$options.events;Object.keys(n).forEach(function(i){e(i,function(e){return n[i].call(t,e)})})}function relativeMouseOffset(t,e){var n=e.getBoundingClientRect();return{left:t.clientX-n.left,top:t.clientY-n.top}}function round$1(t,e,n,i){if(e>=t)return e;var r=Math.floor((n-e)/i)*i+e;if(t>=r)return r;var s=(t-e)/i,a=Math.floor(s),u=s-a;return 0===u?t:.5>u?i*a+e:i*(a+1)+e}var DocumentEventHelper={created:function(){forEachListener(this,function(t,e){document.addEventListener(t,e)})},beforeDestroy:function(){forEachListener(this,function(t,e){document.removeEventListener(t,e)})}},DragHelper={mixins:[DocumentEventHelper],props:{targetSelector:String,disabled:Boolean},data:function(){return{isDrag:!1}},watch:{target:"bindTarget"},mounted:function(){this.bindTarget()},events:{mousedown:function(t){return this.dragStart(t,this.offsetByMouse)},mousemove:function(t){return this.dragMove(t,this.offsetByMouse)},mouseup:function(t){return this.dragEnd(t,this.offsetByMouse)},touchstart:function(t){return this.dragStart(t,this.offsetByTouch)},touchmove:function(t){return this.dragMove(t,this.offsetByTouch)},touchend:function(t){return this.dragEnd(t,this.offsetByTouch)},touchcancel:function(t){return this.dragEnd(t,this.offsetByTouch)}},methods:{bindTarget:function(){this.target=this.$el.querySelector(this.targetSelector)||this.$el},offsetByMouse:function(t){return relativeMouseOffset(t,this.$el)},offsetByTouch:function(t){var e=0===t.touches.length?t.changedTouches[0]:t.touches[0];return relativeMouseOffset(e,this.$el)},dragStart:function(t,e){this.disabled||this.target!==t.target||(t.preventDefault(),this.isDrag=!0,this.$emit("dragstart",t,e(t),this.target))},dragMove:function(t,e){this.isDrag&&(t.preventDefault(),this.$emit("drag",t,e(t),this.target))},dragEnd:function(t,e){this.isDrag&&(t.preventDefault(),this.isDrag=!1,this.$emit("dragend",t,e(t),this.target))}},render:function(){return this.$slots["default"]&&this.$slots["default"][0]}},RangeSlider={render:function render(){with(this)return _h("span",{staticClass:"range-slider"},[_h("drag-helper",{attrs:{"target-selector":".range-slider-knob",disabled:disabled},on:{drag:drag,dragend:dragEnd}},[_h("span",{ref:"inner",staticClass:"range-slider-inner"},[_h("input",{staticClass:"range-slider-hidden",attrs:{type:"text",name:name},domProps:{value:actualValue}})," ",_h("span",{staticClass:"range-slider-rail"})," ",_h("span",{staticClass:"range-slider-fill",style:{width:valuePercent+"%"}})," ",_h("span",{staticClass:"range-slider-knob",style:{left:valuePercent+"%"}})])])])},staticRenderFns:[],props:{name:String,value:[String,Number],disabled:{type:Boolean,"default":!1},min:{type:[String,Number],"default":0},max:{type:[String,Number],"default":100},step:{type:[String,Number],"default":1}},data:function(){return{actualValue:null}},created:function(){var t=this._min,e=this._max,n=Number(this.value);(null==this.value||isNaN(n))&&(n=t>e?t:(t+e)/2),this.actualValue=this.round(n)},computed:{_min:function(){return Number(this.min)},_max:function(){return Number(this.max)},_step:function(){return Number(this.step)},valuePercent:function(){return(this.actualValue-this._min)/(this._max-this._min)*100}},watch:{value:function t(e){var t=Number(e);null==e||isNaN(t)||(this.actualValue=this.round(t))},min:function(){this.actualValue=this.round(this.actualValue)},max:function(){this.actualValue=this.round(this.actualValue)}},methods:{drag:function(t,e){var n=this.$refs.inner.offsetWidth;this.actualValue=this.round(this.valueFromBounds(e.left,n)),this.emitEvent(this.actualValue)},dragEnd:function(t,e){var n=this.$refs.inner.offsetWidth;this.actualValue=this.round(this.valueFromBounds(e.left,n)),this.emitEvent(this.actualValue,!0)},emitEvent:function(t,e){this.$emit("input",t),e&&this.$emit("change",t)},valueFromBounds:function(t,e){return t/e*(this._max-this._min)+this._min},round:function(t){return round$1(t,this._min,this._max,this._step)}},components:{DragHelper:DragHelper}};return RangeSlider}); |
{ | ||
"name": "vue-range-slider", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": "katashin", | ||
@@ -25,3 +25,2 @@ "description": "Simple slider component of Vue.js", | ||
"prepublish": "npm run release", | ||
"start": "run-s build:cjs watch:example", | ||
"clean": "rm -rf dist .tmp", | ||
@@ -43,6 +42,6 @@ "dev": "run-p watch:cjs watch:example", | ||
"testem:ci": "testem ci --launch PhantomJS", | ||
"test": "run-s test:*", | ||
"test": "run-s lint flow test:*", | ||
"test:unit": "run-s build:test testem:ci", | ||
"test:e2e": "mocha --compilers js:babel-register test/e2e/example.js", | ||
"release": "run-s lint flow test clean build" | ||
"test:e2e": "npm run build:cjs && node test/e2e/runner.js", | ||
"release": "run-s test clean build" | ||
}, | ||
@@ -59,3 +58,2 @@ "devDependencies": { | ||
"babel-preset-power-assert": "^1.0.0", | ||
"babel-register": "^6.14.0", | ||
"cross-env": "^2.0.0", | ||
@@ -67,6 +65,7 @@ "css-loader": "^0.25.0", | ||
"flow-bin": "^0.32.0", | ||
"mocha": "^3.0.2", | ||
"glob": "^7.1.1", | ||
"node-sass": "^3.10.0", | ||
"npm-run-all": "^3.0.0", | ||
"postcss": "^5.2.4", | ||
"postcss-loader": "^1.1.1", | ||
"power-assert": "^1.3.1", | ||
@@ -82,14 +81,15 @@ "rollup": "^0.36.0", | ||
"rollup-plugin-replace": "^1.1.1", | ||
"rollup-plugin-vue": "^2.2.3", | ||
"rollup-plugin-vue": "2.2.8", | ||
"rollup-watch": "^2.5.0", | ||
"sass-loader": "^4.0.2", | ||
"style-loader": "^0.13.1", | ||
"testcafe": "^0.10.0", | ||
"testcafe-browser-provider-phantomjs": "^1.0.0", | ||
"testem": "^1.6.0", | ||
"testium-driver-sync": "^2.3.0", | ||
"testium-mocha": "^1.1.0", | ||
"uglifyjs": "^2.4.10", | ||
"vue": "^2.0.0-rc.6", | ||
"vue-loader": "^9.5.0", | ||
"webpack": "^2.1.0-beta.23", | ||
"webpack-dev-server": "^2.1.0-beta.4" | ||
"vue": "^2.1.3", | ||
"vue-loader": "^10.0.1", | ||
"webpack": "^2.1.0-beta.27", | ||
"webpack-dev-server": "^2.1.0-beta.11" | ||
} | ||
} |
25213
8
42
526