@megha-ui/react 1.2.290 → 1.2.292
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useEffect, useRef, useState } from "react";
|
|
3
3
|
import GroupedRow from "./groupedRow";
|
|
4
4
|
import SummariseDetails from "./SummariseDetails";
|
|
@@ -43,7 +43,7 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
43
43
|
.join(">"));
|
|
44
44
|
})
|
|
45
45
|
.map((item, gIndex) => {
|
|
46
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
47
47
|
if (gIndex >= startIndex && gIndex <= endIndex)
|
|
48
48
|
return item.type === "main" ? (_jsxs("div", { style: {
|
|
49
49
|
width: "100%",
|
|
@@ -66,11 +66,14 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
66
66
|
display: "flex",
|
|
67
67
|
alignItems: "center",
|
|
68
68
|
justifyContent: "center",
|
|
69
|
-
}, children: rowOpened.includes(item.groupedValue || "") ? "-" : "+" }), (_a = item.groupedKey) === null || _a === void 0 ? void 0 : _a.split(">").filter((key) => key !== item.key).map((columnKey) => {
|
|
69
|
+
}, children: rowOpened.includes(item.groupedValue || "") ? "-" : "+" }), (_a = item.groupedKey) === null || _a === void 0 ? void 0 : _a.split(">").filter((key) => key !== item.key).map((columnKey, index) => {
|
|
70
|
+
var _a;
|
|
70
71
|
const column = gridColumns.find((column) => column.key === columnKey);
|
|
71
|
-
|
|
72
|
+
const showCount = ((_a = item.groupedKey) === null || _a === void 0 ? void 0 : _a.split(">").filter((key) => key !== item.key).length) -
|
|
73
|
+
1 ===
|
|
74
|
+
index;
|
|
72
75
|
if (column) {
|
|
73
|
-
return (
|
|
76
|
+
return (_jsxs("div", { style: {
|
|
74
77
|
width: widthMode === "auto"
|
|
75
78
|
? "auto"
|
|
76
79
|
: (column === null || column === void 0 ? void 0 : column.width)
|
|
@@ -82,38 +85,18 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
82
85
|
flexGrow: widthMode === "auto" ? 1 : 0,
|
|
83
86
|
flexShrink: widthMode === "auto" ? 1 : 0,
|
|
84
87
|
padding: "0.5rem",
|
|
85
|
-
}, className: `column index-${columnKey}`, children: (() => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
}, className: `column index-${columnKey}`, children: [(() => {
|
|
89
|
+
const keys = (item.groupedKey || "").split(">");
|
|
90
|
+
const vals = (item.groupedValue || "").split(">");
|
|
91
|
+
const idx = keys.indexOf(columnKey);
|
|
92
|
+
const display = idx > -1 ? vals[idx] : "";
|
|
93
|
+
return _jsx("div", { children: display });
|
|
94
|
+
})(), showCount && _jsx("span", { children: `(${item === null || item === void 0 ? void 0 : item.count})` })] }));
|
|
92
95
|
}
|
|
93
96
|
return null;
|
|
94
|
-
}),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
fontSize: "inherit",
|
|
98
|
-
width: widthMode === "auto"
|
|
99
|
-
? "auto"
|
|
100
|
-
: ((_b = gridColumns.find((column) => column.key === item.key)) === null || _b === void 0 ? void 0 : _b.width)
|
|
101
|
-
? `calc(${(_c = gridColumns.find((column) => column.key === item.key)) === null || _c === void 0 ? void 0 : _c.width} + 25px)`
|
|
102
|
-
: columnWidths[`column-${item.key}`]
|
|
103
|
-
? `calc(${columnWidths[`column-${item.key}`]} + 25px)`
|
|
104
|
-
: "fit-content",
|
|
105
|
-
background: "inherit",
|
|
106
|
-
flexShrink: 0,
|
|
107
|
-
flexGrow: 0,
|
|
108
|
-
cursor: "pointer",
|
|
109
|
-
padding: "0.5rem",
|
|
110
|
-
}, className: `group-column ${item.key}`, children: _jsxs("div", { style: {
|
|
111
|
-
display: "flex",
|
|
112
|
-
alignItems: "center",
|
|
113
|
-
flexWrap: "wrap",
|
|
114
|
-
}, 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 &&
|
|
115
|
-
parseInt(((_d = item === null || item === void 0 ? void 0 : item.count) === null || _d === void 0 ? void 0 : _d.toString()) || "0") > 0 && (_jsx(SummariseDetails, { rowIndex: gIndex, removedKeys: item.groupedKey.split(">"), 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((_e = item.groupedValue) !== null && _e !== void 0 ? _e : 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(((_g = (_f = item.rowData) === null || _f === void 0 ? void 0 : _f.id) === null || _g === void 0 ? void 0 : _g.value)
|
|
116
|
-
? `${item.groupedValue}-${(_j = (_h = item.rowData) === null || _h === void 0 ? void 0 : _h.id) === null || _j === void 0 ? void 0 : _j.value}`
|
|
97
|
+
}), isSummarise &&
|
|
98
|
+
parseInt(((_b = item === null || item === void 0 ? void 0 : item.count) === null || _b === void 0 ? void 0 : _b.toString()) || "0") > 0 && (_jsx(SummariseDetails, { rowIndex: gIndex, removedKeys: item.groupedKey.split(">"), 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((_c = item.groupedValue) !== null && _c !== void 0 ? _c : 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(((_e = (_d = item.rowData) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.value)
|
|
99
|
+
? `${item.groupedValue}-${(_g = (_f = item.rowData) === null || _f === void 0 ? void 0 : _f.id) === null || _g === void 0 ? void 0 : _g.value}`
|
|
117
100
|
: gIndex)));
|
|
118
101
|
}) }));
|
|
119
102
|
};
|
package/package.json
CHANGED