@megha-ui/react 1.2.204 → 1.2.206
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.
|
@@ -19,7 +19,7 @@ const isUrl = (value) => {
|
|
|
19
19
|
return false;
|
|
20
20
|
};
|
|
21
21
|
const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRows, toggleRowSelection, columns, widthMode, index, rowKey, hasVerticalScroll, onRowClick, loading, groupBy, rowIndex, columnIndex, hlBorderColor, handleDragStart, handleDragOver, handleDrop, draggable, checkboxWrapper, hugColumnWidths, hugColumnHeights, alternateRowColor, isExpandable, expandedRow, ignoreRowSelect, locale, formatOptions, }) => {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
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
25
|
const handleRowClick = useCallback(() => {
|
|
@@ -47,16 +47,16 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
47
47
|
}
|
|
48
48
|
setDraggableIndex(_dragIndex);
|
|
49
49
|
}, [columns]);
|
|
50
|
-
return isExpandable && item.id.value &&
|
|
51
|
-
expandedRow === item.id.value &&
|
|
50
|
+
return isExpandable && ((_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.value) &&
|
|
51
|
+
expandedRow === ((_b = item === null || item === void 0 ? void 0 : item.id) === null || _b === void 0 ? void 0 : _b.value) &&
|
|
52
52
|
item.expandedDetails ? (_jsxs("div", { children: [_jsxs("div", { id: `${index}`, draggable: draggable, onDragStart: (e) => handleDragStart && handleDragStart(e, index), onDragOver: (e) => handleDragOver && handleDragOver(e), onDrop: (e) => handleDrop && handleDrop(e, index), className: getRowClassNames(), style: Object.assign(Object.assign({}, rowStyle), { position: "relative", display: "flex", alignItems: itemsAlign, fontSize: "inherit", minHeight: rowHeight, height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
53
53
|
? "var(--row-bg)"
|
|
54
54
|
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign({}, cellStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis" }), children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
|
|
55
|
-
ignoreRowSelect.has((
|
|
55
|
+
ignoreRowSelect.has((_c = item["id"].value) === null || _c === void 0 ? void 0 : _c.toString()), onChange: () => { var _a; return toggleRowSelection((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()); }, selected: item["id"] && selectedRows.has(item["id"].value), wrapperClass: checkboxWrapper }) })), item[groupBy] && (_jsx("div", { style: {
|
|
56
56
|
width: widthMode === "auto"
|
|
57
57
|
? "auto"
|
|
58
|
-
: ((
|
|
59
|
-
? (
|
|
58
|
+
: ((_d = columns.find((column) => column.key === groupBy)) === null || _d === void 0 ? void 0 : _d.width)
|
|
59
|
+
? (_e = columns.find((column) => column.key === groupBy)) === null || _e === void 0 ? void 0 : _e.width
|
|
60
60
|
: (hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${groupBy}`])
|
|
61
61
|
? hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${groupBy}`]
|
|
62
62
|
: "fit-content",
|
|
@@ -65,7 +65,7 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
65
65
|
backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
66
66
|
? "var(--row-bg)"
|
|
67
67
|
: "var(--row-bg-even)",
|
|
68
|
-
}, className: `column index-${groupBy}`, children: _jsx("div", { children: ((
|
|
68
|
+
}, className: `column index-${groupBy}`, children: _jsx("div", { children: ((_f = item[groupBy]) === null || _f === void 0 ? void 0 : _f.html) || ((_g = item[groupBy]) === null || _g === void 0 ? void 0 : _g.value) }) })), columns.map((column, colIndex) => {
|
|
69
69
|
var _a, _b, _c, _d;
|
|
70
70
|
const cellData = item[column.key];
|
|
71
71
|
const cellValue = cellData && Object.keys(cellData).includes("html")
|
|
@@ -109,13 +109,13 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
109
109
|
}, children: isUrl(cellUrl) ? (_jsx("a", { href: cellUrl, target: "_blank", rel: "noopener noreferrer", children: cellValue })) : column.render ? (column.render(cellValue)) : (cellValue) }))] }, `${column.key}-${(_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : index}`));
|
|
110
110
|
}
|
|
111
111
|
return null;
|
|
112
|
-
})] }), isExpandable && ((
|
|
113
|
-
expandedRow === item.id.value &&
|
|
112
|
+
})] }), isExpandable && ((_h = item === null || item === void 0 ? void 0 : item.id) === null || _h === void 0 ? void 0 : _h.value) &&
|
|
113
|
+
expandedRow === ((_j = item === null || item === void 0 ? void 0 : item.id) === null || _j === void 0 ? void 0 : _j.value) &&
|
|
114
114
|
item.expandedDetails &&
|
|
115
|
-
item.expandedDetails.html] }, String((
|
|
115
|
+
item.expandedDetails.html] }, String((_l = (_k = item.id) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : index))) : (_jsxs("div", { id: `${index}`, draggable: draggable, onDragStart: (e) => handleDragStart && handleDragStart(e, index), onDragOver: (e) => handleDragOver && handleDragOver(e), onDrop: (e) => handleDrop && handleDrop(e, index), className: getRowClassNames(), style: Object.assign(Object.assign({}, rowStyle), { position: "relative", display: "flex", alignItems: itemsAlign, fontSize: "inherit", minHeight: rowHeight, height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
116
116
|
? "var(--row-bg)"
|
|
117
117
|
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign({}, cellStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis" }), children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
|
|
118
|
-
ignoreRowSelect.has((
|
|
118
|
+
ignoreRowSelect.has((_m = item["id"].value) === null || _m === void 0 ? void 0 : _m.toString()), onChange: () => { var _a; return toggleRowSelection((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()); }, selected: item["id"] && selectedRows.has(item["id"].value), wrapperClass: checkboxWrapper }) })), columns.map((column, colIndex) => {
|
|
119
119
|
var _a, _b, _c;
|
|
120
120
|
const cellData = item[column.key];
|
|
121
121
|
const cellValue = cellData && Object.keys(cellData).includes("html")
|
|
@@ -158,6 +158,6 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
158
158
|
}, children: isUrl(cellUrl) ? (_jsx("a", { href: cellUrl, target: "_blank", rel: "noopener noreferrer", children: cellValue })) : column.render ? (column.render(cellValue)) : (cellValue) }))] }, `${column.key}-${(_c = (_b = item.id) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : index}`));
|
|
159
159
|
}
|
|
160
160
|
return null;
|
|
161
|
-
})] }, String((
|
|
161
|
+
})] }, String((_p = (_o = item.id) === null || _o === void 0 ? void 0 : _o.value) !== null && _p !== void 0 ? _p : index)));
|
|
162
162
|
};
|
|
163
163
|
export default memo(GridRow);
|
package/package.json
CHANGED