@megha-ui/react 1.2.118 → 1.2.120

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.
@@ -10,7 +10,7 @@ const textFilterDropdown_1 = __importDefault(require("./textFilterDropdown"));
10
10
  const text_input_1 = __importDefault(require("../../text-input"));
11
11
  const checkbox_1 = __importDefault(require("../../checkbox"));
12
12
  const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, columnKey, searchElement, activeSearchType, textFilterLabel, columnData, checkboxWrapper, onFilter, setUniqueSearch, uniqueSearch, sortingOps, searchable, searchInput, columnIndex, }) => {
13
- var _a, _b, _c, _d, _e;
13
+ var _a, _b, _c;
14
14
  const [isOpen, setIsOpen] = (0, react_1.useState)(false);
15
15
  const [filterColumnData, setFilterColumnData] = (0, react_1.useState)([]);
16
16
  const [filterSearch, setFilterSearch] = (0, react_1.useState)("");
@@ -36,13 +36,14 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
36
36
  const handleSelect = (value, columnKey) => {
37
37
  let _uniqueSeach = {};
38
38
  if (value === "all") {
39
- if (uniqueSearch[columnKey].every(item => columnData.includes(item))) {
39
+ console.log({ uniqueSearch, columnKey, columnData, shouldALL: uniqueSearch[columnKey].every((item) => columnData.includes(item)) });
40
+ if (uniqueSearch[columnKey] && uniqueSearch[columnKey].every((item) => columnData.includes(item))) {
40
41
  _uniqueSeach = Object.assign(Object.assign({}, uniqueSearch), { [columnKey]: [] });
41
42
  }
42
43
  else {
43
- console.log(_uniqueSeach, columnKey, columnData);
44
44
  _uniqueSeach = Object.assign(Object.assign({}, uniqueSearch), { [columnKey]: columnData });
45
45
  }
46
+ console.log(_uniqueSeach);
46
47
  setUniqueSearch(_uniqueSeach);
47
48
  }
48
49
  else {
@@ -71,26 +72,20 @@ const GridFilterDropdown = ({ headerDropdownIndex, searchOptions, position, colu
71
72
  cursor: "pointer",
72
73
  display: "flex",
73
74
  alignItems: "center",
74
- }, 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" ||
75
- ((uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) &&
76
- ((_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.sort().toString()) ===
77
- columnData.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.toString(), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: "All" })] }), filterColumnData.map((item) => {
75
+ }, onClick: () => handleSelect("all", columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: uniqueSearch[columnKey] && uniqueSearch[columnKey].every((item) => columnData.includes(item)), indeterminate: (uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) &&
76
+ ((_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
77
+ !uniqueSearch[columnKey].every((item) => columnData.includes(item)), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: "All" })] }), filterColumnData.map((item) => {
81
78
  var _a;
82
79
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
83
80
  cursor: "pointer",
84
81
  display: "flex",
85
82
  alignItems: "center",
86
- }, onClick: () => handleSelect(item, columnKey), children: [(0, jsx_runtime_1.jsx)(checkbox_1.default, { selected: (uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey])
87
- ? (_a = uniqueSearch === null || uniqueSearch === void 0 ? void 0 : uniqueSearch[columnKey]) === null || _a === void 0 ? void 0 : _a.includes(item)
88
- : true, onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper }), (0, jsx_runtime_1.jsx)("span", { style: { marginLeft: "0.5rem" }, children: item })] }, item));
83
+ }, 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));
89
84
  })] }))] })), isOpen && ((0, jsx_runtime_1.jsx)(textFilterDropdown_1.default, { combined: true, columnIndex: columnIndex, headerDropdownIndex: headerDropdownIndex || 1001, searchOptions: searchOptions, position: position
90
85
  ? {
91
86
  top: position.top,
92
- left: ((_d = headerDropdown === null || headerDropdown === void 0 ? void 0 : headerDropdown.current) === null || _d === void 0 ? void 0 : _d.clientWidth)
93
- ? ((_e = headerDropdown === null || headerDropdown === void 0 ? void 0 : headerDropdown.current) === null || _e === void 0 ? void 0 : _e.clientWidth) + 2 + position.left
87
+ left: ((_b = headerDropdown === null || headerDropdown === void 0 ? void 0 : headerDropdown.current) === null || _b === void 0 ? void 0 : _b.clientWidth)
88
+ ? ((_c = headerDropdown === null || headerDropdown === void 0 ? void 0 : headerDropdown.current) === null || _c === void 0 ? void 0 : _c.clientWidth) + 2 + position.left
94
89
  : position.left,
95
90
  }
96
91
  : { top: 0, left: 0 }, columnKey: columnKey, searchElement: searchElement, activeSearchType: activeSearchType, searchable: searchable }))] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.118",
3
+ "version": "1.2.120",
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",