|
|
|
@@ -16,14 +16,14 @@ const AutoSuggestTextField = (props) => { |
|
|
|
if (suggestions[0].isAddNew) return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
const getSuggestions = (value) => { |
|
|
|
const escapedValue = escapeRegexCharacters(value.trim()); |
|
|
|
|
|
|
|
if (escapedValue === "") { |
|
|
|
return []; |
|
|
|
} |
|
|
|
// if (escapedValue === "") { |
|
|
|
// return []; |
|
|
|
// } |
|
|
|
|
|
|
|
const regex = new RegExp("^" + escapedValue, "i"); |
|
|
|
const suggestions = data.filter((dataItem) => regex.test(dataItem.name)); |
|
|
|
@@ -69,6 +69,7 @@ const AutoSuggestTextField = (props) => { |
|
|
|
getSuggestionValue={getSuggestionValue} |
|
|
|
renderSuggestion={renderSuggestion} |
|
|
|
inputProps={inputProps} |
|
|
|
shouldRenderSuggestions={() => true} |
|
|
|
/> |
|
|
|
</AutoSuggestTextFieldContainer> |
|
|
|
); |
|
|
|
@@ -86,6 +87,6 @@ AutoSuggestTextField.propTypes = { |
|
|
|
AutoSuggestTextField.defaultProps = { |
|
|
|
error: false, |
|
|
|
editLocation: false, |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
export default AutoSuggestTextField; |