@megha-ui/react 1.2.353 → 1.2.355

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,33 @@ 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
  : [];
376
+ console.log({ filterTokens, expandedColumnTokens });
372
377
  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;
378
+ .filter((row) => {
379
+ var _a, _b, _c, _d;
380
+ if (!filterValue)
381
+ return true;
382
+ const n = Math.min(expandedColumnTokens.length, filterTokens.length);
383
+ for (let i = 0; i < n; i++) {
384
+ const col = expandedColumnTokens[i];
385
+ 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 : "";
386
+ const expected = (_d = filterTokens[i]) !== null && _d !== void 0 ? _d : "";
387
+ if (value !== expected)
388
+ return false;
389
+ }
390
+ return true;
395
391
  })
396
- .map((item) => {
397
- var _a;
398
- return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
399
- });
392
+ .map((row) => { var _a; return ((_a = row[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || ""; });
400
393
  let value = "";
401
394
  const column = gridColumns.find((item) => item.key === columnKey);
402
395
  const nonEmptyValues = filteredValues
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.353",
3
+ "version": "1.2.355",
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",