@megha-ui/react 1.2.259 → 1.2.260
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,46 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
353
353
|
}
|
|
354
354
|
const _groupedKeys = groupedKeys.length > 0
|
|
355
355
|
? groupedKeys
|
|
356
|
-
: [
|
|
356
|
+
: [
|
|
357
|
+
{
|
|
358
|
+
groupedKey: "",
|
|
359
|
+
groupedValue: columnKey,
|
|
360
|
+
groupedColumns: columnKey,
|
|
361
|
+
},
|
|
362
|
+
];
|
|
357
363
|
_groupedKeys.forEach((grouped) => {
|
|
358
|
-
const {
|
|
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) =>
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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;
|
|
395
|
+
})
|
|
376
396
|
.map((item) => {
|
|
377
397
|
var _a;
|
|
378
398
|
return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
|
|
@@ -618,12 +638,13 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
618
638
|
const _groupedValues = [...groupedValues, group.value].map((item) => item ? item : "row");
|
|
619
639
|
const currentKeys = (group.allKeys ? group.allKeys : [...parentKeys, group.key]).filter((item) => item);
|
|
620
640
|
const groupedValue = _groupedValues.join(">");
|
|
621
|
-
const
|
|
641
|
+
const groupedColumns = currentKeys.join(">");
|
|
622
642
|
if (group.values) {
|
|
623
643
|
flatArray.push({
|
|
624
644
|
type: "main",
|
|
625
645
|
key: group.key || "",
|
|
626
|
-
groupedKey:
|
|
646
|
+
groupedKey: groupedValue,
|
|
647
|
+
groupedColumns,
|
|
627
648
|
level,
|
|
628
649
|
value: group.value || "",
|
|
629
650
|
groupedValue,
|
|
@@ -635,9 +656,11 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
635
656
|
flatArray.push({
|
|
636
657
|
type: "grouped",
|
|
637
658
|
key: group.key || "",
|
|
659
|
+
groupedKey: groupedValue,
|
|
638
660
|
level,
|
|
639
661
|
value: group.value || "",
|
|
640
662
|
groupedValue,
|
|
663
|
+
groupedColumns,
|
|
641
664
|
rowData: group,
|
|
642
665
|
});
|
|
643
666
|
}
|
|
@@ -692,7 +715,6 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
692
715
|
.map((k) => k.trim())
|
|
693
716
|
.filter((k) => k));
|
|
694
717
|
const groupedArray = sets.length ? groupBySets(sortedData, sets) : [];
|
|
695
|
-
console.log(groupedArray);
|
|
696
718
|
const flatGroupedArray = flattenGroupedData(groupedArray, 1);
|
|
697
719
|
setGroupedData(flatGroupedArray);
|
|
698
720
|
const grouped = flatGroupedArray
|
|
@@ -700,6 +722,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
700
722
|
.map((item) => ({
|
|
701
723
|
groupedKey: item.groupedKey,
|
|
702
724
|
groupedValue: item.groupedValue,
|
|
725
|
+
groupedColumns: item.groupedColumns || "",
|
|
703
726
|
}));
|
|
704
727
|
setGroupedKeys(grouped);
|
|
705
728
|
}
|
|
@@ -33,7 +33,6 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
33
33
|
.join(">"));
|
|
34
34
|
}),
|
|
35
35
|
]);
|
|
36
|
-
console.log(groupedData);
|
|
37
36
|
return (_jsx("div", { ref: groupedDiv, children: groupedData
|
|
38
37
|
.filter((item) => {
|
|
39
38
|
return item.type === "main" && item.level === 1
|
|
@@ -44,7 +43,7 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
44
43
|
.join(">"));
|
|
45
44
|
})
|
|
46
45
|
.map((item, gIndex) => {
|
|
47
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
48
47
|
if (gIndex >= startIndex && gIndex <= endIndex)
|
|
49
48
|
return item.type === "main" ? (_jsxs("div", { style: {
|
|
50
49
|
width: "100%",
|
|
@@ -54,7 +53,10 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
54
53
|
height: "max-content",
|
|
55
54
|
boxSizing: "border-box", // Include padding and borders in the element's total width and height
|
|
56
55
|
backgroundColor: "var(--summary-bg)",
|
|
57
|
-
}, children: [(
|
|
56
|
+
}, children: [(item.groupedColumns || "")
|
|
57
|
+
.split(">")
|
|
58
|
+
.filter((key) => key && key !== item.key)
|
|
59
|
+
.map((columnKey) => {
|
|
58
60
|
const column = gridColumns.find((column) => column.key === columnKey);
|
|
59
61
|
if (column) {
|
|
60
62
|
return (_jsx("div", { style: {
|
|
@@ -79,8 +81,8 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
79
81
|
fontSize: "inherit",
|
|
80
82
|
width: widthMode === "auto"
|
|
81
83
|
? "auto"
|
|
82
|
-
: ((
|
|
83
|
-
? `calc(${(
|
|
84
|
+
: ((_a = gridColumns.find((column) => column.key === item.key)) === null || _a === void 0 ? void 0 : _a.width)
|
|
85
|
+
? `calc(${(_b = gridColumns.find((column) => column.key === item.key)) === null || _b === void 0 ? void 0 : _b.width} + 25px)`
|
|
84
86
|
: columnWidths[`column-${item.key}`]
|
|
85
87
|
? `calc(${columnWidths[`column-${item.key}`]} + 25px)`
|
|
86
88
|
: "fit-content",
|
|
@@ -107,8 +109,10 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
107
109
|
alignItems: "center",
|
|
108
110
|
flexWrap: "wrap",
|
|
109
111
|
}, children: [_jsx("span", { style: { marginRight: "0.5rem" }, children: item.html ? _jsx(_Fragment, { children: item.html }) : item.value }), _jsx("span", { children: `(${item === null || item === void 0 ? void 0 : item.count})` })] })] }), isSummarise &&
|
|
110
|
-
parseInt(((
|
|
111
|
-
|
|
112
|
+
parseInt(((_c = item === null || item === void 0 ? void 0 : item.count) === null || _c === void 0 ? void 0 : _c.toString()) || "0") > 0 && (_jsx(SummariseDetails, { rowIndex: gIndex, removedKeys: (item.groupedColumns || "")
|
|
113
|
+
.split(">")
|
|
114
|
+
.filter((key) => key), columns: gridColumns, groupBy: gridGroupBy, sortable: sortable, cellStyle: cellStyle, columnWidths: columnWidths, widthMode: widthMode, summariseKeys: summariseKeys, summariseDetails: summariseDetails, activeCalculateColor: activeCalculateColor, gridRef: gridRef, setCalculatePosition: setCalculatePosition, calculatePosition: calculatePosition, calculatetextColor: calculatetextColor, setCalculateVisible: setCalculateVisible, calculateVisible: calculateVisible, summariseDisplay: summariseDisplay, recalculate: recalculate, groupedData: item.groupedValue, actionsKey: actionsKey }))] }, String((_d = item.groupedValue) !== null && _d !== void 0 ? _d : gIndex))) : (_jsx(GroupedRow, { item: item.rowData, index: gIndex, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === gIndex ? selectedRowStyle : {})), cellStyle: cellStyle, rowHeight: rowHeight, alternateRowColor: alternateRowColor, bulkSelect: bulkSelect, columns: gridColumns, widthMode: widthMode, rowKey: rowKey, onRowClick: onRowClick, loading: isLoading, groupBy: gridGroupBy, selectedRows: selectedRows, toggleRowSelection: toggleRowSelection, hasVerticalScroll: hasVerticalScroll, hugColumnWidths: columnWidths }, String(((_f = (_e = item.rowData) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.value)
|
|
115
|
+
? `${item.groupedValue}-${(_h = (_g = item.rowData) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.value}`
|
|
112
116
|
: gIndex)));
|
|
113
117
|
}) }));
|
|
114
118
|
};
|
package/package.json
CHANGED