Socket
Socket
Sign inDemoInstall

vue-range-slider

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0 to 0.3.1

4

dist/vue-range-slider.cjs.js
/*!
* vue-range-slider v0.3.0
* vue-range-slider v0.3.1
* https://github.com/ktsn/vue-range-slider

@@ -16,2 +16,3 @@ *

created: function created() {
if (typeof document === 'undefined') return;
forEachListener(this, function (key, listener) {

@@ -22,2 +23,3 @@ document.addEventListener(key, listener);

beforeDestroy: function beforeDestroy() {
if (typeof document === 'undefined') return;
forEachListener(this, function (key, listener) {

@@ -24,0 +26,0 @@ document.removeEventListener(key, listener);

/*!
* vue-range-slider v0.3.0
* vue-range-slider v0.3.1
* https://github.com/ktsn/vue-range-slider

@@ -20,2 +20,3 @@ *

created: function created() {
if (typeof document === 'undefined') return;
forEachListener(this, function (key, listener) {

@@ -26,2 +27,3 @@ document.addEventListener(key, listener);

beforeDestroy: function beforeDestroy() {
if (typeof document === 'undefined') return;
forEachListener(this, function (key, listener) {

@@ -28,0 +30,0 @@ document.removeEventListener(key, listener);

/*!
* vue-range-slider v0.3.0
* vue-range-slider v0.3.1
* 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(){"use strict";function t(t,e){var n=t.$options.events;Object.keys(n).forEach(function(i){e(i,function(e){return n[i].call(t,e)})})}function e(t,e){var n=e.getBoundingClientRect();return{left:t.clientX-n.left,top:t.clientY-n.top}}var n={mixins:[{created:function(){t(this,function(t,e){document.addEventListener(t,e)})},beforeDestroy:function(){t(this,function(t,e){document.removeEventListener(t,e)})}}],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 e(t,this.$el)},offsetByTouch:function(t){return e(0===t.touches.length?t.changedTouches[0]:t.touches[0],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]}};return{render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("span",{staticClass:"range-slider"},[n("drag-helper",{attrs:{"target-selector":".range-slider-knob",disabled:t.disabled},on:{drag:t.drag,dragend:t.dragEnd}},[n("span",{ref:"inner",staticClass:"range-slider-inner"},[n("input",{staticClass:"range-slider-hidden",attrs:{type:"text",name:t.name},domProps:{value:t.actualValue}}),t._v(" "),n("span",{staticClass:"range-slider-rail"}),t._v(" "),n("span",{staticClass:"range-slider-fill",style:{width:t.valuePercent+"%"}}),t._v(" "),n("span",{staticClass:"range-slider-knob",style:{left:t.valuePercent+"%"}},[t._t("knob")],2)])])],1)},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){var e=Number(t);null==t||isNaN(e)||(this.actualValue=this.round(e))},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 function(t,e,n,i){if(t<=e)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:u<.5?i*a+e:i*(a+1)+e}(t,this._min,this._max,this._step)}},components:{DragHelper:n}}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRangeSlider=e()}(this,function(){"use strict";function t(t,e){var n=t.$options.events;Object.keys(n).forEach(function(i){e(i,function(e){return n[i].call(t,e)})})}function e(t,e){var n=e.getBoundingClientRect();return{left:t.clientX-n.left,top:t.clientY-n.top}}var n={mixins:[{created:function(){"undefined"!=typeof document&&t(this,function(t,e){document.addEventListener(t,e)})},beforeDestroy:function(){"undefined"!=typeof document&&t(this,function(t,e){document.removeEventListener(t,e)})}}],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 e(t,this.$el)},offsetByTouch:function(t){return e(0===t.touches.length?t.changedTouches[0]:t.touches[0],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]}};return{render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("span",{staticClass:"range-slider"},[n("drag-helper",{attrs:{"target-selector":".range-slider-knob",disabled:t.disabled},on:{drag:t.drag,dragend:t.dragEnd}},[n("span",{ref:"inner",staticClass:"range-slider-inner"},[n("input",{staticClass:"range-slider-hidden",attrs:{type:"text",name:t.name},domProps:{value:t.actualValue}}),t._v(" "),n("span",{staticClass:"range-slider-rail"}),t._v(" "),n("span",{staticClass:"range-slider-fill",style:{width:t.valuePercent+"%"}}),t._v(" "),n("span",{staticClass:"range-slider-knob",style:{left:t.valuePercent+"%"}},[t._t("knob")],2)])])],1)},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){var e=Number(t);null==t||isNaN(e)||(this.actualValue=this.round(e))},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 function(t,e,n,i){if(t<=e)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:u<.5?i*a+e:i*(a+1)+e}(t,this._min,this._max,this._step)}},components:{DragHelper:n}}});
{
"name": "vue-range-slider",
"version": "0.3.0",
"version": "0.3.1",
"author": "katashin",

@@ -5,0 +5,0 @@ "description": "Simple slider component of Vue.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc