@megha-ui/react 1.2.56 → 1.2.57
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.
|
@@ -29,7 +29,8 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
|
|
|
29
29
|
if (typeof uniqueSearch[columnKey] === "undefined") {
|
|
30
30
|
setUniqueSearch((prev) => (Object.assign(Object.assign({}, prev), { [columnKey]: columnData })));
|
|
31
31
|
}
|
|
32
|
-
setFilterColumnData(columnData.filter((item) => typeof item !== "undefined" &&
|
|
32
|
+
setFilterColumnData(columnData.filter((item) => typeof item !== "undefined" &&
|
|
33
|
+
item !== "" &&
|
|
33
34
|
`${item}`.toLowerCase().includes(filterSearch.toLowerCase())));
|
|
34
35
|
}, [columnData, filterSearch]);
|
|
35
36
|
const handleSelect = (value, columnKey) => {
|
|
@@ -60,7 +61,7 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
|
|
|
60
61
|
display: "flex",
|
|
61
62
|
alignItems: "center",
|
|
62
63
|
justifyContent: "space-between",
|
|
63
|
-
}, onClick: () => setIsOpen((prev) => !prev), children: [(0, jsx_runtime_1.jsx)("span", { children: textFilterLabel }), (0, jsx_runtime_1.jsx)(fi_1.FiChevronRight, {})] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
64
|
+
}, onClick: () => setIsOpen((prev) => !prev), children: [(0, jsx_runtime_1.jsx)("span", { children: textFilterLabel }), (0, jsx_runtime_1.jsx)(fi_1.FiChevronRight, {})] }), columnData.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
64
65
|
width: "100%",
|
|
65
66
|
maxHeight: 300,
|
|
66
67
|
overflow: "auto",
|
|
@@ -69,9 +70,10 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
|
|
|
69
70
|
cursor: "pointer",
|
|
70
71
|
display: "flex",
|
|
71
72
|
alignItems: "center",
|
|
72
|
-
}, onClick: () => handleSelect("all", columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: typeof (uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === "undefined" ||
|
|
73
|
-
((
|
|
74
|
-
|
|
73
|
+
}, onClick: () => handleSelect("all", columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: typeof (uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === "undefined" ||
|
|
74
|
+
((uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) &&
|
|
75
|
+
((_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.sort().toString()) ===
|
|
76
|
+
columnData.toString()), indeterminate: (uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) &&
|
|
75
77
|
((_b = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
76
78
|
((_c = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _c === void 0 ? void 0 : _c.sort().toString()) !==
|
|
77
79
|
columnData.toString(), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: "All" })] }), filterColumnData.map((item) => {
|
|
@@ -80,8 +82,10 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
|
|
|
80
82
|
cursor: "pointer",
|
|
81
83
|
display: "flex",
|
|
82
84
|
alignItems: "center",
|
|
83
|
-
}, onClick: () => handleSelect(item, columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey])
|
|
84
|
-
|
|
85
|
+
}, onClick: () => handleSelect(item, columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey])
|
|
86
|
+
? (_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.includes(item)
|
|
87
|
+
: true, onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: item })] }, item));
|
|
88
|
+
})] }))] })), isOpen && ((0, jsx_runtime_1.jsx)(textFilterDropdown_1.default, { columnIndex: columnIndex, headerDropdownIndex: headerDropdownIndex || 1001, searchOptions: searchOptions, position: position
|
|
85
89
|
? {
|
|
86
90
|
top: position.top,
|
|
87
91
|
left: ((_d = headerDropdown === null || headerDropdown === void 0 ? void 0 : headerDropdown.current) === null || _d === void 0 ? void 0 : _d.clientWidth)
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const dropdown_1 = __importDefault(require("../../dropdown"));
|
|
9
|
-
const TextFilterDropdown = ({ headerDropdownIndex, searchOptions, position, columnKey, searchElement, activeSearchType, sortingOps, searchable, searchInput, }) => {
|
|
9
|
+
const TextFilterDropdown = ({ headerDropdownIndex, searchOptions, position, columnKey, searchElement, activeSearchType, sortingOps, searchable, searchInput, columnIndex }) => {
|
|
10
10
|
(0, react_1.useEffect)(() => {
|
|
11
11
|
var _a;
|
|
12
12
|
if (searchElement) {
|
|
@@ -21,19 +21,7 @@ const TextFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
|
|
|
21
21
|
const clickedOption = searchOptions.find((item) => selected === item.value);
|
|
22
22
|
clickedOption === null || clickedOption === void 0 ? void 0 : clickedOption.action(columnKey, selected);
|
|
23
23
|
};
|
|
24
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
25
|
-
position: "absolute",
|
|
26
|
-
top: 0,
|
|
27
|
-
left: "100%",
|
|
28
|
-
zIndex: headerDropdownIndex ? headerDropdownIndex : 1000,
|
|
29
|
-
backgroundColor: "white",
|
|
30
|
-
boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)",
|
|
31
|
-
listStyleType: "none",
|
|
32
|
-
padding: "0.25rem 0",
|
|
33
|
-
width: 230,
|
|
34
|
-
borderRadius: "0.5rem",
|
|
35
|
-
margin: 0,
|
|
36
|
-
}, id: "grid-dropdown", onClick: (e) => e.stopPropagation(), children: [searchInput && searchInput, sortingOps && sortingOps, (0, jsx_runtime_1.jsx)("div", { style: {
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: Object.assign(Object.assign({ position: "absolute", top: "calc(100% + 5px)" }, (columnIndex > 1 ? { right: 0 } : { left: 0 })), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "white", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", listStyleType: "none", padding: "0.25rem 0", width: 230, borderRadius: "0.5rem", margin: 0 }), id: "grid-dropdown", onClick: (e) => e.stopPropagation(), children: [searchInput && searchInput, sortingOps && sortingOps, (0, jsx_runtime_1.jsx)("div", { style: {
|
|
37
25
|
padding: "0.5rem 0.75rem",
|
|
38
26
|
}, children: (0, jsx_runtime_1.jsx)(dropdown_1.default, { options: searchOptions, selectedValues: [activeSearchType], onChange: (selected) => handleDropdownChange(selected[0].toString(), columnKey), searchEnabled: false, maxDropdownHeight: 350 }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
39
27
|
padding: "0.5rem 0.75rem",
|
package/package.json
CHANGED