mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 12:39:01 +00:00
fix: close select dropdpwn when parent compoment is changed (#18950)
* fix: close select dropdpwn when parent compoment is changed * code fixes --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
parent
6ec5d0cbdd
commit
81635db28a
@ -286,6 +286,13 @@ const AsyncSelectList: FC<AsyncSelectListProps & SelectProps> = ({
|
||||
onChange?.(selectedValues);
|
||||
};
|
||||
|
||||
const handleDropdownChange = (open: boolean) => {
|
||||
if (!open) {
|
||||
// Close the form when the dropdown closes
|
||||
onCancel && onCancel();
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadOptions('');
|
||||
}, []);
|
||||
@ -314,6 +321,7 @@ const AsyncSelectList: FC<AsyncSelectListProps & SelectProps> = ({
|
||||
style={{ width: '100%' }}
|
||||
tagRender={customTagRender}
|
||||
onChange={handleChange}
|
||||
onDropdownVisibleChange={handleDropdownChange}
|
||||
onInputKeyDown={(event) => {
|
||||
if (event.key === 'Backspace') {
|
||||
return event.stopPropagation();
|
||||
|
@ -267,6 +267,13 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
|
||||
}
|
||||
}, 300);
|
||||
|
||||
const handleDropdownChange = (open: boolean) => {
|
||||
if (!open) {
|
||||
// Close the form when the dropdown closes
|
||||
onCancel && onCancel();
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (glossaries.length) {
|
||||
expandableKeys.current = glossaries.map((glossary) => glossary.id);
|
||||
@ -327,6 +334,7 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
|
||||
treeData={treeData}
|
||||
treeExpandedKeys={isEmpty(searchOptions) ? undefined : expandedRowKeys}
|
||||
onChange={handleChange}
|
||||
onDropdownVisibleChange={handleDropdownChange}
|
||||
onSearch={onSearch}
|
||||
onTreeExpand={setExpandedRowKeys}
|
||||
{...props}
|
||||
|
Loading…
x
Reference in New Issue
Block a user