@megha-ui/react 1.2.827 → 1.2.830
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import ReactDOM from "react-dom";
|
|
3
4
|
import { FiChevronRight } from "react-icons/fi";
|
|
4
5
|
import TextFilterDropdown from "./textFilterDropdown";
|
|
5
6
|
import TextInput from "../../text-input";
|
|
@@ -52,7 +53,12 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
|
|
|
52
53
|
}
|
|
53
54
|
onFilter(_uniqueSeach, columnKey);
|
|
54
55
|
};
|
|
55
|
-
|
|
56
|
+
const dropdownContent = (_jsxs("div", { style: Object.assign(Object.assign({ position: position ? "absolute" : "absolute" }, (position
|
|
57
|
+
? {
|
|
58
|
+
top: position.top,
|
|
59
|
+
left: position.left,
|
|
60
|
+
}
|
|
61
|
+
: Object.assign({ top: "calc(100% + 5px)" }, (columnIndex > 1 ? { right: 0 } : { left: 0 })))), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "var(--background)", color: "var(--foreground)", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", listStyleType: "none", padding: "0.35rem 0", width: "max-content", maxWidth: "500px", borderRadius: "0.5rem", margin: 0 }), ref: headerDropdown, onClick: (e) => e.stopPropagation(), children: [searchInput && searchInput, sortingOps, _jsxs("div", { style: {
|
|
56
62
|
padding: "0.5rem 0.75rem",
|
|
57
63
|
cursor: "pointer",
|
|
58
64
|
display: "flex",
|
|
@@ -89,5 +95,8 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
|
|
|
89
95
|
: position.left,
|
|
90
96
|
}
|
|
91
97
|
: { top: 0, left: 0 }, columnKey: columnKey, searchElement: searchElement, activeSearchType: activeSearchType, searchable: searchable }))] }));
|
|
98
|
+
// Render in a portal so the dropdown is not occluded
|
|
99
|
+
// by sticky header cells or other stacking contexts.
|
|
100
|
+
return ReactDOM.createPortal(dropdownContent, document.body);
|
|
92
101
|
};
|
|
93
102
|
export default GridFilterDropdown;
|
|
@@ -498,9 +498,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
|
|
|
498
498
|
}
|
|
499
499
|
}, onChange: (e) => {
|
|
500
500
|
var _a, _b, _c;
|
|
501
|
-
let searchType = ((_b = searchQueries[((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || ""]) === null || _b === void 0 ? void 0 : _b.type) ||
|
|
502
|
-
defaultSearchOperation ||
|
|
503
|
-
"contains";
|
|
501
|
+
let searchType = ((_b = searchQueries[((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || ""]) === null || _b === void 0 ? void 0 : _b.type) || "contains";
|
|
504
502
|
if (e.target.value.includes("to")) {
|
|
505
503
|
searchType = "between";
|
|
506
504
|
}
|
|
@@ -748,9 +746,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
|
|
|
748
746
|
cursor: search && column.search ? "default" : "not-allowed",
|
|
749
747
|
}, children: _jsx(TextInput, { onChange: (e) => {
|
|
750
748
|
var _a;
|
|
751
|
-
let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
|
|
752
|
-
defaultSearchOperation ||
|
|
753
|
-
"contains";
|
|
749
|
+
let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) || "contains";
|
|
754
750
|
if (e.target.value.includes("to")) {
|
|
755
751
|
searchType = "between";
|
|
756
752
|
}
|
package/package.json
CHANGED