react-autocompleter
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -153,2 +153,13 @@ 'use strict'; | ||
_createClass(AutoCompleter, [{ | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
// update itemList if itemList prop changed, and clear the input field | ||
if (nextProps.data !== this.props.data) { | ||
this.setState({ | ||
itemList: nextProps.data, | ||
inputValue: '' | ||
}); | ||
} | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -155,0 +166,0 @@ value: function render() { |
@@ -11,2 +11,4 @@ 'use strict'; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -26,2 +28,6 @@ | ||
var _lodash = require('lodash'); | ||
var _ = _interopRequireWildcard(_lodash); | ||
var ListContainer = (function (_Component) { | ||
@@ -54,3 +60,3 @@ _inherits(ListContainer, _Component); | ||
_get(Object.getPrototypeOf(ListContainer.prototype), 'constructor', this).call(this); | ||
var styles = JSON.parse(JSON.stringify(props.itemStyles)); | ||
var styles = _.cloneDeep(props.itemStyles); | ||
@@ -76,6 +82,7 @@ if (styles['.active']) { | ||
var styles = _props.styles; | ||
var itemStyles = _props.itemStyles; | ||
var navigate = _props.navigate; | ||
var activeStyle = this.state.activeStyle; | ||
// lodash cloneDeep prevents data mutation | ||
var itemStyles = _.cloneDeep(this.props.itemStyles); | ||
if (itemStyles['.active']) { | ||
@@ -89,7 +96,3 @@ delete itemStyles['.active']; | ||
data.map(function (item, index) { | ||
if (navigate === index) { | ||
return _react2['default'].createElement(_ListItem2['default'], { onSelect: onSelect, content: item, key: item, className: itemClassName, styles: activeStyle, active: navigate === index }); | ||
} | ||
return _react2['default'].createElement(_ListItem2['default'], { onSelect: onSelect, content: item, key: item, className: itemClassName, styles: itemStyles, active: navigate === index }); | ||
return _react2['default'].createElement(_ListItem2['default'], { onSelect: onSelect, content: item, key: item, className: itemClassName, styles: navigate === index ? activeStyle : itemStyles, active: navigate === index }); | ||
}) | ||
@@ -96,0 +99,0 @@ ); |
{ | ||
"name": "react-autocompleter", | ||
"author": "Invertase", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "A simple, configurable, styleable ReactJS component which completes your phrase with keyboard navigation support.", | ||
@@ -43,3 +43,6 @@ "main": "./dist/AutoCompleter.js", | ||
"playground": "webpack-dev-server --config ./playground/webpack.config.js --colors --inline --port 3000" | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.5.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26326
398
2
+ Addedlodash@^4.5.1
+ Addedlodash@4.17.21(transitive)