diff --git a/CHANGELOG.md b/CHANGELOG.md index 99aa64a2d..fd0944dc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Changed +- [#695](https://github.com/plotly/dash-core-components/pull/695) Improvements to Slider and RangeSlider + - Marks outside of the range specified by `min` and `max` are now omitted when the slider renders. + - Padding is now dependent on the orientation (vertical or horizontal), and whether or not tooltips are always displayed. + - The whitespace is now preserved for `marks` labels. + +### Added +- [#695](https://github.com/plotly/dash-core-components/pull/695) Added new property `verticalHeight` to Slider and RangeSlider, to allow the user to specify the height (in px) of vertical sliders. This defaults to `400`. + ## [1.5.1] - 2019-11-14 ### Fixed - [#696](https://github.com/plotly/dash-core-components/pull/696) Fix IE11 compatibility issues and ES5 compatibility and validation diff --git a/src/components/RangeSlider.react.js b/src/components/RangeSlider.react.js index 6d90b77a6..f06973f3b 100644 --- a/src/components/RangeSlider.react.js +++ b/src/components/RangeSlider.react.js @@ -1,7 +1,8 @@ import React, {Component} from 'react'; import PropTypes from 'prop-types'; -import {assoc, omit} from 'ramda'; +import {assoc, omit, pickBy} from 'ramda'; import {Range, createSliderWithTooltip} from 'rc-slider'; +import computeSliderStyle from '../utils/computeSliderStyle'; /** * A double slider with two handles. @@ -14,6 +15,7 @@ export default class RangeSlider extends Component { this.DashSlider = props.tooltip ? createSliderWithTooltip(Range) : Range; + this._computeStyle = computeSliderStyle(); } propsToState(newProps) { @@ -42,6 +44,7 @@ export default class RangeSlider extends Component { tooltip, updatemode, vertical, + verticalHeight, } = this.props; const value = this.state.value; @@ -58,6 +61,13 @@ export default class RangeSlider extends Component { tipProps = tooltip; } + const truncatedMarks = + this.props.marks && + pickBy( + (k, mark) => mark >= this.props.min && mark <= this.props.max, + this.props.marks + ); + return (