react-tag-input
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -64,6 +64,5 @@ 'use strict'; | ||
var moveTag = handleDrag ? _this.moveTag : null; | ||
return tags.map(function (tag, index) { | ||
return _react2.default.createElement(_Tag2.default, { | ||
key: tag.text + '-index', | ||
key: tag.id, | ||
index: index, | ||
@@ -137,3 +136,3 @@ tag: tag, | ||
return suggestions.filter(function (item) { | ||
return item.toLowerCase().indexOf(query.toLowerCase()) === 0; | ||
return item.text.toLowerCase().indexOf(query.toLowerCase()) === 0; | ||
}); | ||
@@ -242,3 +241,3 @@ } | ||
var selectedQuery = selectionMode && selectedIndex !== -1 ? suggestions[selectedIndex] : query; | ||
var selectedQuery = selectionMode && selectedIndex !== -1 ? suggestions[selectedIndex] : { id: query, text: query }; | ||
@@ -306,10 +305,12 @@ if (selectedQuery !== '') { | ||
value: function addTag(tag) { | ||
if (!tag.id && !tag.text) { | ||
return; | ||
} | ||
var tags = this.props.tags; | ||
var existingTags = tags.map(function (tag) { | ||
return tag.text.toLowerCase(); | ||
var existingKeys = tags.map(function (tag) { | ||
return tag.id.toLowerCase(); | ||
}); | ||
// Return if tag has been already added | ||
if (existingTags.indexOf(tag.toLowerCase()) >= 0) { | ||
if (existingKeys.indexOf(tag.id.toLowerCase()) >= 0) { | ||
return; | ||
@@ -434,3 +435,6 @@ } | ||
labelField: _propTypes2.default.string, | ||
suggestions: _propTypes2.default.array, | ||
suggestions: _propTypes2.default.arrayOf(_propTypes2.default.shape({ | ||
id: _propTypes2.default.string.isRequired, | ||
text: _propTypes2.default.string.isRequired | ||
})), | ||
delimiters: _propTypes2.default.array, | ||
@@ -459,3 +463,7 @@ autofocus: _propTypes2.default.bool, | ||
maxLength: _propTypes2.default.string, | ||
inputValue: _propTypes2.default.string | ||
inputValue: _propTypes2.default.string, | ||
tags: _propTypes2.default.arrayOf(_propTypes2.default.shape({ | ||
id: _propTypes2.default.string.isRequired, | ||
text: _propTypes2.default.any.isRequired | ||
})) | ||
}; | ||
@@ -465,3 +473,2 @@ | ||
placeholder: _constants.DEFAULT_PLACEHOLDER, | ||
tags: [], | ||
suggestions: [], | ||
@@ -468,0 +475,0 @@ delimiters: [_constants.KEYS.ENTER, _constants.KEYS.TAB], |
@@ -65,3 +65,3 @@ 'use strict'; | ||
return { | ||
__html: input.replace(RegExp(escapedRegex, 'gi'), '<mark>$&</mark>') | ||
__html: input.text.replace(RegExp(escapedRegex, 'gi'), '<mark>$&</mark>') | ||
}; | ||
@@ -68,0 +68,0 @@ }, _this.shouldRenderSuggestions = function (query) { |
{ | ||
"name": "react-tag-input", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "React tags is a fantastically simple tagging component for your React projects", | ||
@@ -5,0 +5,0 @@ "main": "dist-modules/ReactTags.js", |
Sorry, the diff of this file is too big to display
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
1964137
24364