mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-03 14:13:06 +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);
|
onChange?.(selectedValues);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDropdownChange = (open: boolean) => {
|
||||||
|
if (!open) {
|
||||||
|
// Close the form when the dropdown closes
|
||||||
|
onCancel && onCancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadOptions('');
|
loadOptions('');
|
||||||
}, []);
|
}, []);
|
||||||
@ -314,6 +321,7 @@ const AsyncSelectList: FC<AsyncSelectListProps & SelectProps> = ({
|
|||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
tagRender={customTagRender}
|
tagRender={customTagRender}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
onDropdownVisibleChange={handleDropdownChange}
|
||||||
onInputKeyDown={(event) => {
|
onInputKeyDown={(event) => {
|
||||||
if (event.key === 'Backspace') {
|
if (event.key === 'Backspace') {
|
||||||
return event.stopPropagation();
|
return event.stopPropagation();
|
||||||
|
@ -267,6 +267,13 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
|
|||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
|
const handleDropdownChange = (open: boolean) => {
|
||||||
|
if (!open) {
|
||||||
|
// Close the form when the dropdown closes
|
||||||
|
onCancel && onCancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (glossaries.length) {
|
if (glossaries.length) {
|
||||||
expandableKeys.current = glossaries.map((glossary) => glossary.id);
|
expandableKeys.current = glossaries.map((glossary) => glossary.id);
|
||||||
@ -327,6 +334,7 @@ const TreeAsyncSelectList: FC<Omit<AsyncSelectListProps, 'fetchOptions'>> = ({
|
|||||||
treeData={treeData}
|
treeData={treeData}
|
||||||
treeExpandedKeys={isEmpty(searchOptions) ? undefined : expandedRowKeys}
|
treeExpandedKeys={isEmpty(searchOptions) ? undefined : expandedRowKeys}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
onDropdownVisibleChange={handleDropdownChange}
|
||||||
onSearch={onSearch}
|
onSearch={onSearch}
|
||||||
onTreeExpand={setExpandedRowKeys}
|
onTreeExpand={setExpandedRowKeys}
|
||||||
{...props}
|
{...props}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user