소스 검색

Fixed bug 2049

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

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

@@ -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;

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

@@ -44,11 +44,20 @@ export const AutoSuggestTextFieldContainer = styled(Box)`
}

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

padding: 10px;
overflow: auto;

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

& div ul li {

Loading…
취소
저장