@megha-ui/react 1.2.349 → 1.2.351
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.
|
@@ -571,35 +571,35 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
571
571
|
const groupByMultipleKeys = (data, groupByKeys) => {
|
|
572
572
|
// Backward compatibility: if compositeGroupBy is true and no '+' is used,
|
|
573
573
|
// and more than one key is provided, group all keys into a single composite bucket.
|
|
574
|
-
const hasPlus = groupByKeys.some((k) => k
|
|
575
|
-
if (groupByKeys.length > 1 && !hasPlus) {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
}
|
|
574
|
+
// const hasPlus = groupByKeys.some((k) => k?.includes("+"));
|
|
575
|
+
// if (groupByKeys.length > 1 && !hasPlus) {
|
|
576
|
+
// const groupsMap = new Map<string, any>();
|
|
577
|
+
// const allKeys = groupByKeys.filter((k) => k);
|
|
578
|
+
// const lastKey = allKeys[allKeys.length - 1];
|
|
579
|
+
// data.forEach((item) => {
|
|
580
|
+
// const values = allKeys.map((k) => item[k]?.value ?? "");
|
|
581
|
+
// const compositeValue = values.join("+");
|
|
582
|
+
// const key = compositeValue;
|
|
583
|
+
// if (!groupsMap.has(key)) {
|
|
584
|
+
// groupsMap.set(key, {
|
|
585
|
+
// key: lastKey,
|
|
586
|
+
// value: compositeValue,
|
|
587
|
+
// count: 0,
|
|
588
|
+
// subGroups: [],
|
|
589
|
+
// values: [] as any[],
|
|
590
|
+
// allKeys: allKeys,
|
|
591
|
+
// });
|
|
592
|
+
// }
|
|
593
|
+
// const group = groupsMap.get(key);
|
|
594
|
+
// group.values.push(item);
|
|
595
|
+
// });
|
|
596
|
+
// const groupedResult = Array.from(groupsMap.values());
|
|
597
|
+
// groupedResult.forEach((group) => {
|
|
598
|
+
// group.count = group.values.length;
|
|
599
|
+
// group.subGroups = group.values;
|
|
600
|
+
// });
|
|
601
|
+
// return groupedResult;
|
|
602
|
+
// }
|
|
603
603
|
// Parse keys into levels, where each level can be a composite (split by '+')
|
|
604
604
|
const parsedKeys = groupByKeys
|
|
605
605
|
.map((k) => (k !== null && k !== void 0 ? k : "").trim())
|
|
@@ -44,7 +44,6 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
44
44
|
})
|
|
45
45
|
.map((item, gIndex) => {
|
|
46
46
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
47
|
-
console.log({ item });
|
|
48
47
|
if (gIndex >= startIndex && gIndex <= endIndex)
|
|
49
48
|
return item.type === "main" ? (_jsxs("div", { style: {
|
|
50
49
|
width: "100%",
|
|
@@ -103,7 +102,6 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
103
102
|
: compositeIndex > -1
|
|
104
103
|
? compositeValues[compositeIndex]
|
|
105
104
|
: "";
|
|
106
|
-
console.log({ compositeIndex, idx, columnKey });
|
|
107
105
|
if (display && idx === keys.length - 1) {
|
|
108
106
|
return `${display} (${item === null || item === void 0 ? void 0 : item.count})`;
|
|
109
107
|
}
|
package/package.json
CHANGED