@megha-ui/react 1.2.240 → 1.2.242
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,6 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import CalculateDropdown from "./calculatedropdown";
|
|
3
4
|
const SummariseDetails = ({ columns, rowIndex, groupBy, sortable, cellStyle, columnWidths, widthMode, summariseDetails, summariseKeys, activeCalculateColor, gridRef, setCalculatePosition, calculatePosition, calculatetextColor = "#aaa", setCalculateVisible, calculateVisible, summariseDisplay, recalculate, groupedData, removedKeys = [], actionsKey, }) => {
|
|
5
|
+
const groupByKeys = React.useMemo(() => (groupBy || "")
|
|
6
|
+
.split(",")
|
|
7
|
+
.filter((g) => g)
|
|
8
|
+
.flatMap((g) => g.split("+").filter((k) => k)), [groupBy]);
|
|
4
9
|
const handleCalculateSelect = (_columnKey, type) => {
|
|
5
10
|
let columnKey = _columnKey;
|
|
6
11
|
if (columnKey.includes("-")) {
|
|
@@ -161,7 +166,7 @@ const SummariseDetails = ({ columns, rowIndex, groupBy, sortable, cellStyle, col
|
|
|
161
166
|
? dateTypeCalcOps.includes(item.value)
|
|
162
167
|
: textTypeCalcOps.includes(item.value)), onClose: () => setCalculateVisible(""), columnKey: columnKey || "" }))] }, `${groupedData}-${_groupBy}`));
|
|
163
168
|
}), columns
|
|
164
|
-
.filter((column) => !
|
|
169
|
+
.filter((column) => !groupByKeys.includes(column.key))
|
|
165
170
|
.map((column) => {
|
|
166
171
|
var _a;
|
|
167
172
|
const columnKey = groupedData
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import Shimmer from "./shimmer";
|
|
4
4
|
import Checkbox from "../../checkbox";
|
|
5
5
|
import { formatValue } from "../../../services/commonService";
|
|
@@ -22,6 +22,10 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
22
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
23
23
|
const [itemsAlign, setItemsAlign] = useState("stretch");
|
|
24
24
|
const [draggableIndex, setDraggableIndex] = useState(0);
|
|
25
|
+
const groupByKeys = useMemo(() => (groupBy || "")
|
|
26
|
+
.split(",")
|
|
27
|
+
.filter((g) => g)
|
|
28
|
+
.flatMap((g) => g.split("+").filter((k) => k)), [groupBy]);
|
|
25
29
|
const handleRowClick = useCallback(() => {
|
|
26
30
|
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(item);
|
|
27
31
|
}, [onRowClick, item]);
|
|
@@ -77,7 +81,7 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
77
81
|
: "";
|
|
78
82
|
const cellUrl = cellData === null || cellData === void 0 ? void 0 : cellData.url;
|
|
79
83
|
const isHidden = column.overflowHidden;
|
|
80
|
-
if (!column.hidden &&
|
|
84
|
+
if (!column.hidden && !groupByKeys.includes(column.key)) {
|
|
81
85
|
return (_jsxs("div", { id: `column-${index}-${colIndex}`, className: `column index-${column.key}`, style: Object.assign(Object.assign({}, cellStyle), { padding: "0.5rem", display: "flex", alignItems: "center", justifyContent: "flex-start", overflow: isHidden ? "hidden" : "visible", textOverflow: isHidden ? "ellipsis" : "clip", whiteSpace: isHidden ? "nowrap" : "normal", width: widthMode === "auto"
|
|
82
86
|
? "auto"
|
|
83
87
|
: (column === null || column === void 0 ? void 0 : column.width)
|
|
@@ -127,7 +131,7 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
127
131
|
: "";
|
|
128
132
|
const cellUrl = cellData === null || cellData === void 0 ? void 0 : cellData.url;
|
|
129
133
|
const isHidden = column.overflowHidden;
|
|
130
|
-
if (!column.hidden &&
|
|
134
|
+
if (!column.hidden && !groupByKeys.includes(column.key)) {
|
|
131
135
|
return (_jsxs("div", { id: `column-${index}-${colIndex}`, className: `column index-${column.key}`, style: Object.assign(Object.assign({}, cellStyle), { padding: "0.5rem", display: "flex", alignItems: "center", justifyContent: "flex-start", overflow: isHidden ? "hidden" : "visible", textOverflow: isHidden ? "ellipsis" : "clip", whiteSpace: isHidden ? "nowrap" : "normal", width: widthMode === "auto"
|
|
132
136
|
? "auto"
|
|
133
137
|
: (column === null || column === void 0 ? void 0 : column.width)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback } from "react";
|
|
2
|
+
import { memo, useCallback, useMemo } from "react";
|
|
3
3
|
import Shimmer from "./shimmer";
|
|
4
4
|
const isUrl = (value) => {
|
|
5
5
|
if (value) {
|
|
@@ -25,12 +25,13 @@ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode,
|
|
|
25
25
|
classNames.push("cursor-pointer");
|
|
26
26
|
return classNames.join(" ");
|
|
27
27
|
}, [onRowClick]);
|
|
28
|
+
const groupByKeys = useMemo(() => (groupBy || "")
|
|
29
|
+
.split(",")
|
|
30
|
+
.filter((g) => g)
|
|
31
|
+
.flatMap((g) => g.split("+").filter((k) => k)), [groupBy]);
|
|
28
32
|
return (_jsxs("div", { id: `${index}`, className: getRowClassNames(), style: Object.assign(Object.assign({}, rowStyle), { position: "relative", display: "flex", alignItems: "center", fontSize: "inherit", minHeight: rowHeight, height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
29
33
|
? "var(--row-bg)"
|
|
30
|
-
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [
|
|
31
|
-
.split(",")
|
|
32
|
-
.filter((item) => item)
|
|
33
|
-
.map((_groupBy) => {
|
|
34
|
+
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [groupByKeys.map((_groupBy) => {
|
|
34
35
|
var _a, _b;
|
|
35
36
|
return (_jsx("div", { style: {
|
|
36
37
|
width: widthMode === "auto"
|
|
@@ -47,9 +48,9 @@ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode,
|
|
|
47
48
|
flex: widthMode === "auto" ? 1 : undefined,
|
|
48
49
|
flexGrow: widthMode === "auto" ? 1 : 0,
|
|
49
50
|
flexShrink: widthMode === "auto" ? 1 : 0,
|
|
50
|
-
}, className: `column index-${
|
|
51
|
+
}, className: `column index-${_groupBy}`, children: _jsx("div", {}) }));
|
|
51
52
|
}), columns
|
|
52
|
-
.filter((column) => !
|
|
53
|
+
.filter((column) => !groupByKeys.includes(column.key))
|
|
53
54
|
.map((column, colIndex) => {
|
|
54
55
|
var _a, _b;
|
|
55
56
|
const cellData = item[column.key];
|
package/package.json
CHANGED