@megha-ui/react 1.2.347 → 1.2.348
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.
|
@@ -570,6 +570,8 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
570
570
|
}
|
|
571
571
|
}, [gridColumns, groupBy]);
|
|
572
572
|
const groupByMultipleKeys = (data, groupByKeys) => {
|
|
573
|
+
// Backward compatibility: if compositeGroupBy is true and no '+' is used,
|
|
574
|
+
// and more than one key is provided, group all keys into a single composite bucket.
|
|
573
575
|
const hasPlus = groupByKeys.some((k) => k === null || k === void 0 ? void 0 : k.includes("+"));
|
|
574
576
|
if (groupByKeys.length > 1 && !hasPlus) {
|
|
575
577
|
const groupsMap = new Map();
|
|
@@ -599,6 +601,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
599
601
|
});
|
|
600
602
|
return groupedResult;
|
|
601
603
|
}
|
|
604
|
+
// Parse keys into levels, where each level can be a composite (split by '+')
|
|
602
605
|
const parsedKeys = groupByKeys
|
|
603
606
|
.map((k) => (k !== null && k !== void 0 ? k : "").trim())
|
|
604
607
|
.filter((k) => k)
|
|
@@ -651,7 +654,6 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
651
654
|
});
|
|
652
655
|
return groupedResult;
|
|
653
656
|
};
|
|
654
|
-
console.log({ parsedKeys });
|
|
655
657
|
return groupData(data, parsedKeys);
|
|
656
658
|
};
|
|
657
659
|
const flattenGroupedData = (groupedData, level, groupedValues = [], parentKeys = []) => {
|
|
@@ -660,7 +662,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
660
662
|
groupedData.forEach((group) => {
|
|
661
663
|
const _groupedValues = [...groupedValues, group.value].map((item) => item ? item : "row");
|
|
662
664
|
const currentKeys = (group.allKeys
|
|
663
|
-
? [...parentKeys, group.allKeys.join("
|
|
665
|
+
? [...parentKeys, group.allKeys.join("+")]
|
|
664
666
|
: [...parentKeys, group.key]).filter((item) => item);
|
|
665
667
|
const groupedValue = _groupedValues.join(">");
|
|
666
668
|
const groupedColumns = currentKeys.join(">");
|
package/package.json
CHANGED