dtable-ui-component 7.0.5-pal.10 → 7.0.5-pal.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AsyncUserSelect/index.js +10 -4
- package/package.json +1 -1
|
@@ -71,21 +71,27 @@ const AsyncUserSelect = _ref => {
|
|
|
71
71
|
setSearchValue('');
|
|
72
72
|
setHighlightIndex(-1);
|
|
73
73
|
}, []);
|
|
74
|
+
const isEventInsideComponent = (0, _react.useCallback)(target => {
|
|
75
|
+
if (!target) return false;
|
|
76
|
+
if (selectorRef.current && selectorRef.current.contains(target)) return true;
|
|
77
|
+
if (userSelectContainerRef.current && userSelectContainerRef.current.contains(target)) return true;
|
|
78
|
+
return false;
|
|
79
|
+
}, []);
|
|
74
80
|
const onClickOutside = (0, _react.useCallback)(e => {
|
|
75
|
-
if (isPopoverOpen &&
|
|
81
|
+
if (isPopoverOpen && !isEventInsideComponent(e.target)) {
|
|
76
82
|
setIsPopoverOpen(false);
|
|
77
83
|
clearStatus();
|
|
78
84
|
}
|
|
79
|
-
}, [isPopoverOpen, clearStatus]);
|
|
85
|
+
}, [isPopoverOpen, clearStatus, isEventInsideComponent]);
|
|
80
86
|
const onClickOutsideMenu = (0, _react.useCallback)(event => {
|
|
81
87
|
if (isPopoverOpen && (0, _utils.getEventClassName)(event).includes('icon-fork-number')) {
|
|
82
88
|
return;
|
|
83
89
|
}
|
|
84
|
-
if (!
|
|
90
|
+
if (!isEventInsideComponent(event.target)) {
|
|
85
91
|
setIsPopoverOpen(false);
|
|
86
92
|
clearStatus();
|
|
87
93
|
}
|
|
88
|
-
}, [isPopoverOpen, clearStatus]);
|
|
94
|
+
}, [isPopoverOpen, clearStatus, isEventInsideComponent]);
|
|
89
95
|
const searchUsers = (0, _react.useCallback)(function () {
|
|
90
96
|
let searchValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
91
97
|
const trimmedSearchValue = (searchValue === null || searchValue === void 0 ? void 0 : searchValue.trim()) || '';
|