@megha-ui/react 1.3.92 → 1.3.94
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/components/grid/utils/gridFilterDropdown.d.ts +24 -1
- package/dist/components/grid/utils/gridFilterDropdown.js +92 -16
- package/dist/components/grid/utils/newGridHeader.js +373 -460
- package/dist/components/grid/utils/textFilterDropdown.d.ts +17 -1
- package/dist/components/grid/utils/textFilterDropdown.js +29 -13
- package/package.json +1 -1
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
interface DropdownOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
action: (columnKey: string, optionValue: string) => void;
|
|
6
|
+
}
|
|
7
|
+
interface MenuPosition {
|
|
8
|
+
top: number;
|
|
9
|
+
left: number;
|
|
10
|
+
}
|
|
2
11
|
interface GridFilterDropdownProps {
|
|
12
|
+
searchOptions: DropdownOption[];
|
|
13
|
+
position: MenuPosition;
|
|
14
|
+
combined: boolean;
|
|
15
|
+
columnKey: string;
|
|
16
|
+
activeSearchType: string;
|
|
17
|
+
searchElement: any;
|
|
3
18
|
headerDropdownIndex?: number;
|
|
4
19
|
sortingOps?: any;
|
|
5
|
-
|
|
20
|
+
searchable: boolean;
|
|
21
|
+
searchInput?: any;
|
|
6
22
|
columnIndex: number;
|
|
7
23
|
}
|
|
8
24
|
declare const TextFilterDropdown: React.FC<GridFilterDropdownProps>;
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import Dropdown from "../../dropdown";
|
|
4
|
+
const TextFilterDropdown = ({ headerDropdownIndex, searchOptions, combined, position, columnKey, searchElement, activeSearchType, sortingOps, searchable, searchInput, columnIndex, }) => {
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
var _a;
|
|
7
|
+
if (searchElement) {
|
|
8
|
+
const _searchElement = document.getElementById("search-input");
|
|
9
|
+
if (_searchElement) {
|
|
10
|
+
const ele = _searchElement.getElementsByTagName("input");
|
|
11
|
+
(_a = ele.item(0)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}, []);
|
|
15
|
+
const handleDropdownChange = (selected, columnKey) => {
|
|
16
|
+
const clickedOption = searchOptions.find((item) => selected === item.value);
|
|
17
|
+
clickedOption === null || clickedOption === void 0 ? void 0 : clickedOption.action(columnKey, selected);
|
|
18
|
+
};
|
|
19
|
+
return (_jsxs("div", { style: Object.assign(Object.assign({ position: "absolute", top: combined ? 0 : "calc(100% + 5px)" }, (combined
|
|
20
|
+
? {
|
|
21
|
+
left: "100%",
|
|
22
|
+
}
|
|
23
|
+
: columnIndex > 1
|
|
24
|
+
? { right: 0 }
|
|
25
|
+
: { 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.25rem 0", width: 230, borderRadius: "0.5rem", margin: 0 }), id: "grid-dropdown", onClick: (e) => e.stopPropagation(), children: [searchInput && searchInput, sortingOps && sortingOps, _jsx("div", { style: {
|
|
26
|
+
padding: "0.5rem 0.75rem",
|
|
27
|
+
}, children: _jsx(Dropdown, { options: searchOptions, selectedValues: [activeSearchType], onChange: (selected) => { var _a; return handleDropdownChange((_a = selected[0].toString()) !== null && _a !== void 0 ? _a : "", columnKey); }, searchEnabled: false, maxDropdownHeight: 350 }) }), !["blank", "notblank"].includes(activeSearchType.toLowerCase()) && (_jsx("div", { style: {
|
|
28
|
+
padding: "0.5rem 0.75rem",
|
|
29
|
+
cursor: "pointer",
|
|
30
|
+
}, children: searchElement }))] }));
|
|
15
31
|
};
|
|
16
32
|
export default TextFilterDropdown;
|
package/package.json
CHANGED