Add range capability to the slider control
FabienLelaquais opened this issue · 0 comments
FabienLelaquais commented
Description
The MaterialUI Slider component accepts an array as its value property, to allow the selection of multiple values on a slider, including a range.
The value property of the slider
control should accept a tuple or an array to provide the range selection capability.
The documentation part is taken care of in this issue.
Implementaion notes
The value parsing is a bit more complex.
Instead of
try {
val = parseInt(defaultValue, 10);
} catch (e) {
}
we should have something like
val = parseInt(defaultValue, 10);
if (isNaN(val )) {
try {
val = JSON.parse(defaultValue)
if (!Array.isArray(val) || val.length === 0 || val.some((n) => isNaN(n))) {
console.log(`ERROR: Slider range value must a non-empty array of numbers: ${defaultValue}`)
val = 0
}
} catch(e) {
console.log(`ERROR: Invalid value in slider: ${defaultValue}`)
}
}
Acceptance Criteria
- Ensure new code is unit tested, and check code coverage is at least 90%
- Ensure there is no breaking change
- Ensure any change is well documented