@megha-ui/react 1.2.352 → 1.2.354

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.
@@ -363,40 +363,32 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
363
363
  _groupedKeys.forEach((grouped) => {
364
364
  const { groupedValue, groupedColumns } = grouped;
365
365
  const filterValue = _groupedKeys.length > 1 ? groupedValue : "";
366
- const columnTokens = groupedColumns
367
- ? groupedColumns.split(">").filter((item) => item)
366
+ // Expand groupedColumns to handle composite levels like "col1+col2>col3"
367
+ const columnLevelTokens = groupedColumns
368
+ ? groupedColumns.split(">").filter(Boolean)
368
369
  : [];
370
+ const expandedColumnTokens = columnLevelTokens
371
+ .flatMap((tok) => tok.split("+").map((s) => s.trim()).filter(Boolean));
372
+ // Values are always flattened and separated by '>'
369
373
  const filterTokens = filterValue
370
- ? filterValue.split(">").filter((item) => item)
374
+ ? filterValue.split(">").filter(Boolean)
371
375
  : [];
372
376
  const filteredValues = filteredData
373
- .filter((item) => {
374
- var _a, _b, _c;
375
- return filterValue
376
- ? columnTokens.length > 1
377
- ? columnTokens.every((columnKey, index) => {
378
- var _a, _b, _c, _d;
379
- const value = (_c = (_b = (_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "";
380
- const expectedValue = (_d = filterTokens[index]) !== null && _d !== void 0 ? _d : "";
381
- return value === expectedValue;
382
- })
383
- : columnTokens.length === 1
384
- ? (() => {
385
- var _a, _b, _c, _d, _e;
386
- const columnKey = columnTokens[0];
387
- const value = (_c = (_b = (_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "";
388
- const expectedValue = (_e = (_d = filterTokens[0]) !== null && _d !== void 0 ? _d : filterValue) !== null && _e !== void 0 ? _e : "";
389
- return value === expectedValue;
390
- })()
391
- : filterTokens.length
392
- ? filterTokens.includes((_c = (_b = (_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "")
393
- : true
394
- : true;
377
+ .filter((row) => {
378
+ var _a, _b, _c, _d;
379
+ if (!filterValue)
380
+ return true;
381
+ const n = Math.min(expandedColumnTokens.length, filterTokens.length);
382
+ for (let i = 0; i < n; i++) {
383
+ const col = expandedColumnTokens[i];
384
+ const value = (_c = (_b = (_a = row[col]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "";
385
+ const expected = (_d = filterTokens[i]) !== null && _d !== void 0 ? _d : "";
386
+ if (value !== expected)
387
+ return false;
388
+ }
389
+ return true;
395
390
  })
396
- .map((item) => {
397
- var _a;
398
- return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
399
- });
391
+ .map((row) => { var _a; return ((_a = row[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || ""; });
400
392
  let value = "";
401
393
  const column = gridColumns.find((item) => item.key === columnKey);
402
394
  const nonEmptyValues = filteredValues
@@ -67,6 +67,8 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
67
67
  flex: widthMode === "auto" ? 1 : undefined,
68
68
  flexGrow: widthMode === "auto" ? 1 : 0,
69
69
  flexShrink: widthMode === "auto" ? 1 : 0,
70
+ display: "flex",
71
+ alignItems: "center",
70
72
  padding: "0.5rem",
71
73
  }, className: `column index-${columnKey}`, children: [index === 0 && (_jsx("span", { style: {
72
74
  fontSize: "inherit",
@@ -108,7 +110,8 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
108
110
  else if (display &&
109
111
  compositeIndex === compositeKeys.length - 1 &&
110
112
  index ===
111
- ((_a = item.groupedKey) === null || _a === void 0 ? void 0 : _a.split(">").flatMap((item) => item.split("+")).length) - 1) {
113
+ ((_a = item.groupedKey) === null || _a === void 0 ? void 0 : _a.split(">").flatMap((item) => item.split("+")).length) -
114
+ 1) {
112
115
  return `${display} (${item === null || item === void 0 ? void 0 : item.count})`;
113
116
  }
114
117
  if (compositeKeys.includes(item.key) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.352",
3
+ "version": "1.2.354",
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.js",