@megha-ui/react 1.2.257 → 1.2.258

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,43 +353,26 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
353
353
  }
354
354
  const _groupedKeys = groupedKeys.length > 0
355
355
  ? groupedKeys
356
- : [
357
- {
358
- groupedKey: "",
359
- groupedValue: columnKey,
360
- groupedColumns: columnKey,
361
- },
362
- ];
356
+ : [{ groupedKey: "", groupedValue: columnKey }];
363
357
  _groupedKeys.forEach((grouped) => {
364
- const { groupedValue, groupedColumns } = grouped;
358
+ const { groupedKey, groupedValue } = grouped;
365
359
  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
- : [];
372
360
  const filteredValues = filteredData
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
- })
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)
393
376
  .map((item) => {
394
377
  var _a;
395
378
  return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
@@ -636,13 +619,12 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
636
619
  const _groupedValues = [...groupedValues, group.value].map((item) => item ? item : "row");
637
620
  const currentKeys = (group.allKeys ? group.allKeys : [...parentKeys, group.key]).filter((item) => item);
638
621
  const groupedValue = _groupedValues.join(">");
639
- const groupedColumns = currentKeys.join(">");
622
+ const groupedKey = currentKeys.join(">");
640
623
  if (group.values) {
641
624
  flatArray.push({
642
625
  type: "main",
643
626
  key: group.key || "",
644
- groupedKey: groupedValue,
645
- groupedColumns,
627
+ groupedKey: groupedKey,
646
628
  level,
647
629
  value: group.value || "",
648
630
  groupedValue,
@@ -711,6 +693,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
711
693
  .map((k) => k.trim())
712
694
  .filter((k) => k));
713
695
  const groupedArray = sets.length ? groupBySets(sortedData, sets) : [];
696
+ console.log(groupedArray);
714
697
  const flatGroupedArray = flattenGroupedData(groupedArray, 1);
715
698
  setGroupedData(flatGroupedArray);
716
699
  const grouped = flatGroupedArray
@@ -718,7 +701,6 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
718
701
  .map((item) => ({
719
702
  groupedKey: item.groupedKey,
720
703
  groupedValue: item.groupedValue,
721
- groupedColumns: item.groupedColumns || "",
722
704
  }));
723
705
  setGroupedKeys(grouped);
724
706
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.257",
3
+ "version": "1.2.258",
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",