@megha-ui/react 1.2.255 → 1.2.257

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.
@@ -353,26 +353,43 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
353
353
  }
354
354
  const _groupedKeys = groupedKeys.length > 0
355
355
  ? groupedKeys
356
- : [{ groupedKey: "", groupedValue: columnKey }];
356
+ : [
357
+ {
358
+ groupedKey: "",
359
+ groupedValue: columnKey,
360
+ groupedColumns: columnKey,
361
+ },
362
+ ];
357
363
  _groupedKeys.forEach((grouped) => {
358
- const { groupedKey, groupedValue } = grouped;
364
+ const { groupedValue, groupedColumns } = grouped;
359
365
  const filterValue = _groupedKeys.length > 1 ? groupedValue : "";
366
+ const columnTokens = groupedColumns
367
+ ? groupedColumns.split(">").filter((item) => item)
368
+ : [];
369
+ const filterTokens = filterValue
370
+ ? filterValue.split(">").filter((item) => item)
371
+ : [];
360
372
  const filteredValues = filteredData
361
- .filter((item) => filterValue
362
- ? filterValue.split(">").length > 1
363
- ? groupedKey.split(">").every((group) => {
364
- var _a;
365
- return filterValue
366
- .split(">")
367
- .includes((_a = item[group].value) === null || _a === void 0 ? void 0 : _a.toString());
368
- })
369
- : groupedKey.split(">").some((group) => {
370
- var _a;
371
- return filterValue
372
- .split(">")
373
- .includes((_a = item[group].value) === null || _a === void 0 ? void 0 : _a.toString());
374
- })
375
- : true)
373
+ .filter((item) => {
374
+ var _a, _b, _c;
375
+ return filterValue
376
+ ? columnTokens.length > 1
377
+ ? columnTokens.every((group) => {
378
+ var _a, _b;
379
+ const value = (_b = (_a = item[group]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString();
380
+ return value ? filterTokens.includes(value) : false;
381
+ })
382
+ : columnTokens.length === 1
383
+ ? columnTokens.some((group) => {
384
+ var _a, _b;
385
+ const value = (_b = (_a = item[group]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString();
386
+ return value ? filterTokens.includes(value) : false;
387
+ })
388
+ : filterTokens.length
389
+ ? 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 : "")
390
+ : true
391
+ : true;
392
+ })
376
393
  .map((item) => {
377
394
  var _a;
378
395
  return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
@@ -619,12 +636,13 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
619
636
  const _groupedValues = [...groupedValues, group.value].map((item) => item ? item : "row");
620
637
  const currentKeys = (group.allKeys ? group.allKeys : [...parentKeys, group.key]).filter((item) => item);
621
638
  const groupedValue = _groupedValues.join(">");
622
- const groupedKey = currentKeys.join(">");
639
+ const groupedColumns = currentKeys.join(">");
623
640
  if (group.values) {
624
641
  flatArray.push({
625
642
  type: "main",
626
643
  key: group.key || "",
627
- groupedKey: groupedKey,
644
+ groupedKey: groupedValue,
645
+ groupedColumns,
628
646
  level,
629
647
  value: group.value || "",
630
648
  groupedValue,
@@ -700,6 +718,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
700
718
  .map((item) => ({
701
719
  groupedKey: item.groupedKey,
702
720
  groupedValue: item.groupedValue,
721
+ groupedColumns: item.groupedColumns || "",
703
722
  }));
704
723
  setGroupedKeys(grouped);
705
724
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.255",
3
+ "version": "1.2.257",
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",