x-ui-design 0.4.51 → 0.4.52
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/dist/index.esm.js +12 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/lib/components/Select/Select.tsx +19 -19
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3264,26 +3264,25 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3264
3264
|
inputContainer.innerText = '';
|
|
3265
3265
|
}
|
|
3266
3266
|
}, [autoClearSearchValue, prefixCls]);
|
|
3267
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3268
|
-
const handleClickOutside = event => {
|
|
3269
|
-
if (!selectRef.current) return;
|
|
3270
|
-
const dropdown = document.querySelector(`.${prefixCls}-dropdown`);
|
|
3271
|
-
const clickedInside = event?.target && (selectRef.current.contains(event.target) || dropdown && dropdown.contains(event.target));
|
|
3272
|
-
if (!clickedInside) {
|
|
3273
|
-
setIsOpen(false);
|
|
3274
|
-
handleClearInputValue();
|
|
3275
|
-
onClose?.();
|
|
3276
|
-
}
|
|
3277
|
-
};
|
|
3278
3267
|
useEffect(() => {
|
|
3279
3268
|
setSelected(hasMode ? checkModeInitialValue : initialValue);
|
|
3280
3269
|
}, [checkModeInitialValue, hasMode, initialValue]);
|
|
3281
3270
|
useEffect(() => {
|
|
3271
|
+
const handleClickOutside = event => {
|
|
3272
|
+
if (!selectRef.current) return;
|
|
3273
|
+
const dropdown = document.querySelector(`.${prefixCls}-dropdown`);
|
|
3274
|
+
const clickedInside = selectRef.current.contains(event.target) || dropdown && dropdown.contains(event.target);
|
|
3275
|
+
if (!clickedInside) {
|
|
3276
|
+
setIsOpen(false);
|
|
3277
|
+
handleClearInputValue();
|
|
3278
|
+
onClose?.();
|
|
3279
|
+
}
|
|
3280
|
+
};
|
|
3282
3281
|
document.addEventListener('mousedown', handleClickOutside);
|
|
3283
3282
|
return () => {
|
|
3284
3283
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
3285
3284
|
};
|
|
3286
|
-
}, [
|
|
3285
|
+
}, [handleClearInputValue, defaultOpen, hasMode, prefixCls]);
|
|
3287
3286
|
const updateDropdownPosition = useCallback(searchQueryUpdated => {
|
|
3288
3287
|
if (!selectRef.current) {
|
|
3289
3288
|
return;
|
|
@@ -3397,6 +3396,7 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3397
3396
|
const newSelection = selected.includes(optionValue) ? selected.filter(item => item !== optionValue) : [...selected, optionValue];
|
|
3398
3397
|
setSelected(newSelection);
|
|
3399
3398
|
onChange?.(newSelection, option);
|
|
3399
|
+
// onSelect?.(newSelection, option);
|
|
3400
3400
|
if (selected.includes(optionValue)) {
|
|
3401
3401
|
onDeselect?.(optionValue, option);
|
|
3402
3402
|
} else {
|