multi-range-slider-react
Advanced tools
@@ -14,2 +14,3 @@ import React from 'react'; | ||
disabled?: boolean; | ||
canMinMaxValueSame?: boolean; | ||
style?: React.CSSProperties; | ||
@@ -16,0 +17,0 @@ ruler?: boolean | string; |
@@ -39,2 +39,3 @@ "use strict"; | ||
let disabled = !!props.disabled; | ||
let stepValue = props.canMinMaxValueSame ? 0 : step; | ||
let stepCount = Math.floor((+max - +min) / +step); | ||
@@ -107,4 +108,4 @@ let labels = props.labels || []; | ||
let _minValue = parseFloat(e.target.value); | ||
if (_minValue > maxValue - step) { | ||
_minValue = maxValue - step; | ||
if (_minValue > maxValue - stepValue) { | ||
_minValue = maxValue - stepValue; | ||
} | ||
@@ -135,4 +136,4 @@ set_minValue(_minValue); | ||
} | ||
else if (val > maxValue - step) { | ||
val = maxValue - step; | ||
else if (val > maxValue - stepValue) { | ||
val = maxValue - stepValue; | ||
} | ||
@@ -170,4 +171,4 @@ set_minValue(val); | ||
} | ||
else if (val > maxValue - step) { | ||
val = maxValue - step; | ||
else if (val > maxValue - stepValue) { | ||
val = maxValue - stepValue; | ||
} | ||
@@ -188,4 +189,4 @@ set_minValue(val); | ||
let _minValue = minValue + step; | ||
if (_minValue > maxValue - step) { | ||
_minValue = maxValue - step; | ||
if (_minValue > maxValue - stepValue) { | ||
_minValue = maxValue - stepValue; | ||
} | ||
@@ -198,4 +199,4 @@ set_minValue(_minValue); | ||
let _maxValue = maxValue - step; | ||
if (_maxValue < minValue + step) { | ||
_maxValue = minValue + step; | ||
if (_maxValue < minValue + stepValue) { | ||
_maxValue = minValue + stepValue; | ||
} | ||
@@ -208,4 +209,4 @@ set_maxValue(_maxValue); | ||
let _maxValue = parseFloat(e.target.value); | ||
if (_maxValue < minValue + step) { | ||
_maxValue = minValue + step; | ||
if (_maxValue < minValue + stepValue) { | ||
_maxValue = minValue + stepValue; | ||
} | ||
@@ -233,4 +234,4 @@ set_maxValue(_maxValue); | ||
val = parseFloat(val.toFixed(fixed)); | ||
if (val < minValue + step) { | ||
val = minValue + step; | ||
if (val < minValue + stepValue) { | ||
val = minValue + stepValue; | ||
} | ||
@@ -268,4 +269,4 @@ else if (val > max) { | ||
val = parseFloat(val.toFixed(fixed)); | ||
if (val < minValue + step) { | ||
val = minValue + step; | ||
if (val < minValue + stepValue) { | ||
val = minValue + stepValue; | ||
} | ||
@@ -320,4 +321,4 @@ else if (val > max) { | ||
val = _maxValue + val; | ||
if (val < _minValue + step) { | ||
val = _minValue + step; | ||
if (val < _minValue + stepValue) { | ||
val = _minValue + stepValue; | ||
} | ||
@@ -334,4 +335,4 @@ else if (val > max) { | ||
} | ||
else if (val > _maxValue - step) { | ||
val = _maxValue - step; | ||
else if (val > _maxValue - stepValue) { | ||
val = _maxValue - stepValue; | ||
} | ||
@@ -338,0 +339,0 @@ _minValue = val; |
{ | ||
"name": "multi-range-slider-react", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "Simple component to select range values from slider. React component that return two value minValue and maxValue by event onInput/onChange. ", | ||
@@ -5,0 +5,0 @@ "main": "lib/multirangeslider.js", |
@@ -54,2 +54,3 @@ # multi-range-slider-react | ||
| stepOnly | Boolean | false | specify user to select only values in round of step only | | ||
| canMinMaxValueSame | Boolean | false | If true then user can select both min and max same value otherwise have difference of step value | | ||
| preventWheel | Boolean | false | true then it not accept mouse wheel to change its value. false then (shift + wheel) change minValue (ctrl+wheel) change maxValue, (ctrl+shift+wheel) change both values | | ||
@@ -56,0 +57,0 @@ | disabled | Boolean | false | true then user can not change its value by mouse/keyboard. Only can change by update props/state value | |
139363
0.24%944
0.21%227
0.44%