Socket
Socket
Sign inDemoInstall

rc-slider

Package Overview
Dependencies
Maintainers
3
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-slider - npm Package Compare versions

Comparing version 3.1.3 to 3.1.4

109

lib/Slider.js

@@ -29,2 +29,6 @@ 'use strict';

var _objectAssign2 = require('object-assign');
var _objectAssign3 = _interopRequireDefault(_objectAssign2);
var _Track = require('./Track');

@@ -114,14 +118,32 @@

value: function componentWillReceiveProps(nextProps) {
if (!('value' in nextProps || 'min' in nextProps || 'max' in nextProps)) return;
var _state = this.state;
var lowerBound = _state.lowerBound;
var upperBound = _state.upperBound;
if (nextProps.range) {
var value = nextProps.value;
if (value) {
this.setState({
upperBound: value[1],
lowerBound: value[0]
});
var nextUpperBound = this.trimAlignValue(value[1], nextProps);
var nextLowerBound = this.trimAlignValue(value[0], nextProps);
if (nextLowerBound === lowerBound && nextUpperBound === upperBound) return;
this.setState({
upperBound: nextUpperBound,
lowerBound: nextLowerBound
});
if (this.isValueOutOfBounds(upperBound, nextProps) || this.isValueOutOfBounds(lowerBound, nextProps)) {
this.props.onChange([nextLowerBound, nextUpperBound]);
}
} else if ('value' in nextProps) {
} else {
var nextValue = this.trimAlignValue(nextProps.value, nextProps);
if (nextValue === upperBound && lowerBound === nextProps.min) return;
this.setState({
upperBound: nextProps.value
upperBound: nextValue,
lowerBound: nextProps.min
});
if (this.isValueOutOfBounds(upperBound, nextProps)) {
this.props.onChange(nextValue);
}
}

@@ -242,5 +264,5 @@ }

value: function getValue() {
var _state = this.state;
var lowerBound = _state.lowerBound;
var upperBound = _state.upperBound;
var _state2 = this.state;
var lowerBound = _state2.lowerBound;
var upperBound = _state2.upperBound;

@@ -279,4 +301,9 @@ return this.props.range ? [lowerBound, upperBound] : upperBound;

}, {
key: 'isValueOutOfBounds',
value: function isValueOutOfBounds(value, props) {
return value < props.min || value > props.max;
}
}, {
key: 'trimAlignValue',
value: function trimAlignValue(v) {
value: function trimAlignValue(v, nextProps) {
var state = this.state || {};

@@ -286,8 +313,10 @@ var handle = state.handle;

var upperBound = state.upperBound;
var _props = this.props;
var marks = _props.marks;
var step = _props.step;
var min = _props.min;
var max = _props.max;
var _objectAssign = (0, _objectAssign3['default'])({}, this.props, nextProps || {});
var marks = _objectAssign.marks;
var step = _objectAssign.step;
var min = _objectAssign.min;
var max = _objectAssign.max;
var val = v;

@@ -323,5 +352,5 @@ if (val <= min) {

value: function calcOffset(value) {
var _props2 = this.props;
var min = _props2.min;
var max = _props2.max;
var _props = this.props;
var min = _props.min;
var max = _props.max;

@@ -334,5 +363,5 @@ var ratio = (value - min) / (max - min);

value: function calcValue(offset) {
var _props3 = this.props;
var min = _props3.min;
var max = _props3.max;
var _props2 = this.props;
var min = _props2.min;
var max = _props2.max;

@@ -384,20 +413,20 @@ var ratio = offset / this.getSliderLength();

var _state2 = this.state;
var handle = _state2.handle;
var upperBound = _state2.upperBound;
var lowerBound = _state2.lowerBound;
var _props4 = this.props;
var className = _props4.className;
var prefixCls = _props4.prefixCls;
var disabled = _props4.disabled;
var dots = _props4.dots;
var included = _props4.included;
var range = _props4.range;
var step = _props4.step;
var marks = _props4.marks;
var max = _props4.max;
var min = _props4.min;
var tipTransitionName = _props4.tipTransitionName;
var tipFormatter = _props4.tipFormatter;
var children = _props4.children;
var _state3 = this.state;
var handle = _state3.handle;
var upperBound = _state3.upperBound;
var lowerBound = _state3.lowerBound;
var _props3 = this.props;
var className = _props3.className;
var prefixCls = _props3.prefixCls;
var disabled = _props3.disabled;
var dots = _props3.dots;
var included = _props3.included;
var range = _props3.range;
var step = _props3.step;
var marks = _props3.marks;
var max = _props3.max;
var min = _props3.min;
var tipTransitionName = _props3.tipTransitionName;
var tipFormatter = _props3.tipFormatter;
var children = _props3.children;

@@ -404,0 +433,0 @@ var upperOffset = this.calcOffset(upperBound);

{
"name": "rc-slider",
"version": "3.1.3",
"version": "3.1.4",
"description": "slider ui component for react",

@@ -54,2 +54,3 @@ "keywords": [

"classnames": "^2.2.1",
"object-assign": "^4.0.1",
"rc-tooltip": "3.x",

@@ -56,0 +57,0 @@ "rc-util": "3.x"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc