@megha-ui/react 1.3.87 → 1.3.89
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,38 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { memo
|
|
2
|
+
import React, { memo } from "react";
|
|
3
3
|
import NewSummariseDetails from "./newSummariseDetails";
|
|
4
4
|
import NewGroupedRow from "./newGroupedRow";
|
|
5
|
-
const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRowColor, updateRowOpened, columnWidths,
|
|
6
|
-
const groupedDiv = useRef(null);
|
|
7
|
-
const [renderedKeys, setRenderedKeys] = useState([]);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
var _a;
|
|
10
|
-
const groupedColumns = (_a = groupedDiv.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".group-column");
|
|
11
|
-
const _renderedKeys = [];
|
|
12
|
-
let newColumnWidths = columnWidths;
|
|
13
|
-
let newColumnHeights = columnHeights;
|
|
14
|
-
groupedColumns === null || groupedColumns === void 0 ? void 0 : groupedColumns.forEach((column) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const key = (_a = column.className.split(" ")) === null || _a === void 0 ? void 0 : _a[1];
|
|
17
|
-
_renderedKeys.push(key);
|
|
18
|
-
newColumnWidths = Object.assign(Object.assign({}, newColumnWidths), { [key]: `${column.clientWidth}px` });
|
|
19
|
-
newColumnHeights = Object.assign(Object.assign({}, newColumnHeights), { [key]: `${column.clientHeight}px` });
|
|
20
|
-
});
|
|
21
|
-
if (renderedKeys.sort().toString() !== _renderedKeys.sort().toString()) {
|
|
22
|
-
setColumnWidths((prev) => (Object.assign(Object.assign({}, prev), newColumnWidths)));
|
|
23
|
-
setColumnHeights((prev) => (Object.assign(Object.assign({}, prev), newColumnHeights)));
|
|
24
|
-
setRenderedKeys(_renderedKeys);
|
|
25
|
-
}
|
|
26
|
-
}, [
|
|
27
|
-
groupedData.filter((item) => {
|
|
28
|
-
return item.type === "main" && item.level === 1
|
|
29
|
-
? true
|
|
30
|
-
: rowOpened.includes(item.groupedValue
|
|
31
|
-
.split(">")
|
|
32
|
-
.filter((value, index) => index !== item.groupedValue.split(">").length - 1)
|
|
33
|
-
.join(">"));
|
|
34
|
-
}),
|
|
35
|
-
]);
|
|
5
|
+
const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRowColor, updateRowOpened, columnWidths, groupBy, widthMode, rowKey, rowHeight, headerBackground, isSummarise, gridGroupBy, rowStyle, sortable, cellStyle, summariseKeys, summariseDetails, activeCalculateColor, gridRef, setCalculatePosition, calculatePosition, calculatetextColor, setCalculateVisible, calculateVisible, summariseDisplay, recalculate, selectedRowStyle, isLoading, selectedRow, onRowClick, gridColumns, bulkSelect, selectedRows, toggleRowSelection, hasVerticalScroll, setColumnWidths, actionsKey, ignoreClickKeys, locale, formatOptions, }) => {
|
|
36
6
|
return (_jsx(_Fragment, { children: groupedData
|
|
37
7
|
.filter((item) => {
|
|
38
8
|
return item.type === "main" && item.level === 1
|
|
@@ -82,7 +52,11 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
82
52
|
alignItems: "center",
|
|
83
53
|
flexWrap: "wrap",
|
|
84
54
|
}, 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 &&
|
|
85
|
-
parseInt(((_b = item === null || item === void 0 ? void 0 : item.count) === null || _b === void 0 ? void 0 : _b.toString()) || "0") > 0 && (_jsx(NewSummariseDetails, { 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 }))
|
|
55
|
+
parseInt(((_b = item === null || item === void 0 ? void 0 : item.count) === null || _b === void 0 ? void 0 : _b.toString()) || "0") > 0 && (_jsx(NewSummariseDetails, { 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 })), !isSummarise && (_jsx("div", { className: "column group-summary-placeholder", style: {
|
|
56
|
+
gridColumn: "1 / -1",
|
|
57
|
+
padding: "0.5rem",
|
|
58
|
+
backgroundColor: "var(--summary-bg)",
|
|
59
|
+
} }))] }, String((_c = item.groupedValue) !== null && _c !== void 0 ? _c : gIndex))) : (_jsx(NewGroupedRow, { item: item.rowData, index: gIndex, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === ((_e = (_d = item.rowData) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.value)
|
|
86
60
|
? selectedRowStyle
|
|
87
61
|
: {})), 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, actionsKey: actionsKey, ignoreClickKeys: ignoreClickKeys }, String(((_g = (_f = item.rowData) === null || _f === void 0 ? void 0 : _f.id) === null || _g === void 0 ? void 0 : _g.value)
|
|
88
62
|
? `${item.groupedValue}-${(_j = (_h = item.rowData) === null || _h === void 0 ? void 0 : _h.id) === null || _j === void 0 ? void 0 : _j.value}`
|
package/package.json
CHANGED