@megha-ui/react 1.2.795 → 1.2.796
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.
|
@@ -44,10 +44,8 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
44
44
|
const parentRect = parent.getBoundingClientRect();
|
|
45
45
|
const elementRect = element.getBoundingClientRect();
|
|
46
46
|
const searchOptionRect = (_a = searchOptionRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
47
|
-
console.log(searchOptionRect);
|
|
48
47
|
return parentRect.height - elementRect.height - 4 - ((_b = searchOptionRect === null || searchOptionRect === void 0 ? void 0 : searchOptionRect.height) !== null && _b !== void 0 ? _b : 0);
|
|
49
48
|
}
|
|
50
|
-
console.log({ parent });
|
|
51
49
|
parent = parent.parentElement;
|
|
52
50
|
console.log({ parent });
|
|
53
51
|
}
|
|
@@ -73,9 +71,13 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
73
71
|
setIntermediateValues(selectedValues);
|
|
74
72
|
}, [selectedValues]);
|
|
75
73
|
useEffect(() => {
|
|
76
|
-
var _a;
|
|
74
|
+
var _a, _b, _c;
|
|
77
75
|
if (isOpen && searchEnabled) {
|
|
78
76
|
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
77
|
+
const rect = (_b = wrapperRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
78
|
+
const viewportSpace = document.body.clientHeight - ((_c = rect === null || rect === void 0 ? void 0 : rect.bottom) !== null && _c !== void 0 ? _c : 0);
|
|
79
|
+
const overflowSpace = getOverflowParentHeight(wrapperRef.current, viewportSpace);
|
|
80
|
+
setHeight(overflowSpace);
|
|
79
81
|
}
|
|
80
82
|
if (isOpen) {
|
|
81
83
|
setHighlightIndex(0);
|
|
@@ -324,12 +326,6 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
324
326
|
};
|
|
325
327
|
const handleClick = (e) => {
|
|
326
328
|
const clearEle = document.getElementById(clearId || "");
|
|
327
|
-
setTimeout(() => {
|
|
328
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
329
|
-
const viewportSpace = document.body.clientHeight - rect.bottom;
|
|
330
|
-
const overflowSpace = getOverflowParentHeight(wrapperRef.current, viewportSpace);
|
|
331
|
-
setHeight(overflowSpace);
|
|
332
|
-
}, 500);
|
|
333
329
|
if (clearEle === e.target) {
|
|
334
330
|
e.preventDefault();
|
|
335
331
|
}
|
package/package.json
CHANGED