@megha-ui/react 1.2.43 → 1.2.45

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.
@@ -26,7 +26,7 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
26
26
  }
27
27
  }, []);
28
28
  (0, react_1.useEffect)(() => {
29
- if (typeof uniqueSearch[columnKey] === "undefined") {
29
+ if (typeof uniqueSearch[columnKey] === "undefined" && columnData.length > 0) {
30
30
  setUniqueSearch((prev) => (Object.assign(Object.assign({}, prev), { [columnKey]: columnData })));
31
31
  }
32
32
  setFilterColumnData(columnData);
@@ -67,25 +67,23 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
67
67
  maxHeight: 300,
68
68
  overflow: "auto",
69
69
  padding: "0.5rem 0.75rem",
70
- }, children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-2", children: (0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `filter`, onChange: (e) => setFilterSearch(e.target.value), value: filterSearch, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
71
- cursor: "pointer",
72
- display: "flex",
73
- alignItems: "center",
74
- }, onClick: () => handleSelect("all", columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (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
77
- .toString(), indeterminate: (uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) &&
78
- ((_b = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
79
- ((_c = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _c === void 0 ? void 0 : _c.sort().toString()) !==
80
- columnData
81
- .toString(), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: "All" })] }), filterColumnData.map((item) => {
82
- var _a;
83
- return ((0, jsx_runtime_1.jsxs)("div", { style: {
84
- cursor: "pointer",
85
- display: "flex",
86
- alignItems: "center",
87
- }, onClick: () => handleSelect(item, columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.includes(item), 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
70
+ }, children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-2", children: (0, jsx_runtime_1.jsx)(text_input_1.default, { placeholder: `filter`, onChange: (e) => setFilterSearch(e.target.value), value: filterSearch, height: 32, width: "100%", className: "w-full", backgroundColor: "#fff" }) }), columnData.length > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { style: {
71
+ cursor: "pointer",
72
+ display: "flex",
73
+ alignItems: "center",
74
+ }, onClick: () => handleSelect("all", columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (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]) &&
77
+ ((_b = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
78
+ ((_c = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _c === void 0 ? void 0 : _c.sort().toString()) !==
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
+ var _a;
81
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
82
+ cursor: "pointer",
83
+ display: "flex",
84
+ alignItems: "center",
85
+ }, onClick: () => handleSelect(item, columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.includes(item), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: item })] }, item));
86
+ })] }))] }), isOpen && ((0, jsx_runtime_1.jsx)(textFilterDropdown_1.default, { columnIndex: columnIndex, headerDropdownIndex: headerDropdownIndex || 1001, searchOptions: searchOptions, position: position
89
87
  ? {
90
88
  top: position.top,
91
89
  left: ((_d = headerDropdown === null || headerDropdown === void 0 ? void 0 : headerDropdown.current) === null || _d === void 0 ? void 0 : _d.clientWidth)
@@ -49,7 +49,7 @@ const checkbox_1 = __importDefault(require("../../checkbox"));
49
49
  const getColumnData = (columnKey, gridData, type) => {
50
50
  const returnedValue = [
51
51
  ...new Set(gridData
52
- .filter((item) => item[columnKey])
52
+ .filter((item) => item[columnKey] && item[columnKey].value)
53
53
  .map((data) => data[columnKey] &&
54
54
  data[columnKey].value &&
55
55
  typeof data[columnKey].value === "string"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.43",
3
+ "version": "1.2.45",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",