New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-super-select

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-super-select - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

.npmignore

37

lib/react-super-select.js

@@ -222,4 +222,19 @@ // © Scotland Stephenson 2015

// If parent page updates the data source, reset the control with some defaults and the new dataSource.
// If parent page updates the data source, reset all control state values which are derived from props.
// Reset some state defaults and dataSource related fields if dataSource changed.
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var newState = {};
if (!_.isEqual(nextProps.initialValue, this.props.initialValue)) {
newState.value = this._buildInitialValue(nextProps);
}
if (!_.isUndefined(nextProps.optionLabelKey) && nextProps.optionLabelKey !== this.props.optionLabelKey) {
newState.labelKey = nextProps.optionLabelKey;
}
if (!_.isUndefined(nextProps.optionValueKey) && nextProps.optionValueKey !== this.props.optionValueKey) {
newState.valueKey = nextProps.optionValueKey;
}
if (!_.isEqual(this.props.dataSource, nextProps.dataSource)) {

@@ -229,11 +244,12 @@

this.setState({
newState = _.extend(newState, {
data: this._configureDataSource(nextProps.dataSource),
rawDataSource: nextProps.dataSource,
focusedId: undefined,
labelKey: nextProps.optionLabelKey || 'name',
lastOptionId: _.isArray(nextProps.dataSource) && nextProps.dataSource.length > 0 ? nextProps.dataSource.length - 1 : undefined,
valueKey: nextProps.optionValueKey || 'id'
});
lastOptionId: _.isArray(nextProps.dataSource) && nextProps.dataSource.length > 0 ? nextProps.dataSource.length - 1 : undefined });
}
if (!_.isEmpty(newState)) {
this.setState(newState);
}
},

@@ -324,8 +340,9 @@

// calculate the initial value for the control from props
_buildInitialValue: function _buildInitialValue() {
// calculate the initial value for the control from props, componentWillReceiveProps will call passing nextProps
_buildInitialValue: function _buildInitialValue(props) {
props = props || this.props;
var initialValue = [];
if (!_.isUndefined(this.props.initialValue)) {
initialValue = _.isArray(this.props.initialValue) ? this.props.initialValue : [this.props.initialValue];
if (!_.isUndefined(props.initialValue)) {
initialValue = _.isArray(props.initialValue) ? props.initialValue : [props.initialValue];

@@ -332,0 +349,0 @@ if (!this._isMultiSelect()) {

{
"name": "react-super-select",
"version": "0.1.15",
"version": "0.1.16",
"description": "A flexible replacement for the html select control built with React",

@@ -5,0 +5,0 @@ "main": "./lib/react-super-select.js",

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