Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added blur event to having input in query section #5684

Merged
merged 8 commits into from
Sep 26, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ export function HavingFilter({
resetChanges();
};

const handleBlur = useCallback((): void => {
if (searchText) {
const isValidSearch = isValidHavingValue(searchText);
rahulkeswani101 marked this conversation as resolved.
Show resolved Hide resolved
if (isValidSearch) {
const updatedLocalValues = [...localValues, searchText];
setLocalValues(updatedLocalValues);
onChange(updatedLocalValues.map(transformFromStringToHaving));
setSearchText('');
}
}
}, [searchText, localValues, onChange]);

useEffect(() => {
parseSearchText(searchText);
}, [searchText, parseSearchText]);
Expand Down Expand Up @@ -225,6 +237,7 @@ export function HavingFilter({
onDeselect={handleDeselect}
onChange={handleChange}
onSelect={handleSelect}
onBlur={handleBlur}
>
{options.map((opt) => (
<Select.Option key={opt.value} value={opt.value} title="havingOption">
Expand Down
Loading