소스 검색

Fixed bug 2049

bugfix/2049
jovan.cirkovic 3 년 전
부모
커밋
459f942f58

+ 6
- 5
src/components/TextFields/AutoSuggestTextField/AutoSuggestTextField.js 파일 보기

if (suggestions[0].isAddNew) return true; if (suggestions[0].isAddNew) return true;
} }
return false; return false;
})
});


const getSuggestions = (value) => { const getSuggestions = (value) => {
const escapedValue = escapeRegexCharacters(value.trim()); const escapedValue = escapeRegexCharacters(value.trim());


if (escapedValue === "") {
return [];
}
// if (escapedValue === "") {
// return [];
// }


const regex = new RegExp("^" + escapedValue, "i"); const regex = new RegExp("^" + escapedValue, "i");
const suggestions = data.filter((dataItem) => regex.test(dataItem.name)); const suggestions = data.filter((dataItem) => regex.test(dataItem.name));
getSuggestionValue={getSuggestionValue} getSuggestionValue={getSuggestionValue}
renderSuggestion={renderSuggestion} renderSuggestion={renderSuggestion}
inputProps={inputProps} inputProps={inputProps}
shouldRenderSuggestions={() => true}
/> />
</AutoSuggestTextFieldContainer> </AutoSuggestTextFieldContainer>
); );
AutoSuggestTextField.defaultProps = { AutoSuggestTextField.defaultProps = {
error: false, error: false,
editLocation: false, editLocation: false,
}
};


export default AutoSuggestTextField; export default AutoSuggestTextField;

+ 10
- 1
src/components/TextFields/AutoSuggestTextField/AutoSuggestTextField.styled.js 파일 보기

} }


& div ul { & div ul {
max-height: 220px;
border: 1px solid black; border: 1px solid black;
border-radius: 4px; border-radius: 4px;
display: ${(props) => props.hideSuggestions && "none"}; display: ${(props) => props.hideSuggestions && "none"};

padding: 10px; padding: 10px;
overflow: auto;

::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-thumb {
background: #c4c4c4;
border-radius: 3px;
}
} }


& div ul li { & div ul li {

Loading…
취소
저장