@megha-ui/react 1.2.414 → 1.2.416

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,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useCallback, useEffect, useMemo, 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";
@@ -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, _m, _o, _p;
22
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
23
23
  const [itemsAlign, setItemsAlign] = useState("stretch");
24
24
  const [draggableIndex, setDraggableIndex] = useState(0);
25
25
  const groupByKeys = useMemo(() => (groupBy || "")
@@ -51,16 +51,17 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
51
51
  }
52
52
  setDraggableIndex(_dragIndex);
53
53
  }, [columns]);
54
- return isExpandable && ((_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.value) &&
54
+ return isExpandable &&
55
+ ((_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.value) &&
55
56
  expandedRow === ((_b = item === null || item === void 0 ? void 0 : item.id) === null || _b === void 0 ? void 0 : _b.value) &&
56
- 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
57
+ item.expandedDetails ? (_jsxs("div", { children: [_jsxs("div", { id: String((_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 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
57
58
  ? "var(--row-bg)"
58
59
  : "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 &&
59
- 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: {
60
+ ignoreRowSelect.has((_e = item["id"].value) === null || _e === void 0 ? void 0 : _e.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: {
60
61
  width: widthMode === "auto"
61
62
  ? "auto"
62
- : ((_d = columns.find((column) => column.key === groupBy)) === null || _d === void 0 ? void 0 : _d.width)
63
- ? (_e = columns.find((column) => column.key === groupBy)) === null || _e === void 0 ? void 0 : _e.width
63
+ : ((_f = columns.find((column) => column.key === groupBy)) === null || _f === void 0 ? void 0 : _f.width)
64
+ ? (_g = columns.find((column) => column.key === groupBy)) === null || _g === void 0 ? void 0 : _g.width
64
65
  : (hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${groupBy}`])
65
66
  ? hugColumnWidths === null || hugColumnWidths === void 0 ? void 0 : hugColumnWidths[`column-${groupBy}`]
66
67
  : "fit-content",
@@ -69,7 +70,7 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
69
70
  backgroundColor: alternateRowColor && (index + 1) % 2 === 0
70
71
  ? "var(--row-bg)"
71
72
  : "var(--row-bg-even)",
72
- }, 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) => {
73
+ }, className: `column index-${groupBy}`, children: _jsx("div", { children: ((_h = item[groupBy]) === null || _h === void 0 ? void 0 : _h.html) || ((_j = item[groupBy]) === null || _j === void 0 ? void 0 : _j.value) }) })), columns.map((column, colIndex) => {
73
74
  var _a, _b, _c, _d;
74
75
  const cellData = item[column.key];
75
76
  const cellValue = cellData && Object.keys(cellData).includes("html")
@@ -113,13 +114,14 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
113
114
  }, 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}`));
114
115
  }
115
116
  return null;
116
- })] }), isExpandable && ((_h = item === null || item === void 0 ? void 0 : item.id) === null || _h === void 0 ? void 0 : _h.value) &&
117
- expandedRow === ((_j = item === null || item === void 0 ? void 0 : item.id) === null || _j === void 0 ? void 0 : _j.value) &&
117
+ })] }), isExpandable &&
118
+ ((_k = item === null || item === void 0 ? void 0 : item.id) === null || _k === void 0 ? void 0 : _k.value) &&
119
+ expandedRow === ((_l = item === null || item === void 0 ? void 0 : item.id) === null || _l === void 0 ? void 0 : _l.value) &&
118
120
  item.expandedDetails &&
119
- 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
121
+ item.expandedDetails.html] }, String((_o = (_m = item.id) === null || _m === void 0 ? void 0 : _m.value) !== null && _o !== void 0 ? _o : 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
120
122
  ? "var(--row-bg)"
121
123
  : "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 &&
122
- 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) => {
124
+ ignoreRowSelect.has((_p = item["id"].value) === null || _p === void 0 ? void 0 : _p.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) => {
123
125
  var _a, _b, _c;
124
126
  const cellData = item[column.key];
125
127
  const cellValue = cellData && Object.keys(cellData).includes("html")
@@ -162,6 +164,6 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
162
164
  }, 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}`));
163
165
  }
164
166
  return null;
165
- })] }, String((_p = (_o = item.id) === null || _o === void 0 ? void 0 : _o.value) !== null && _p !== void 0 ? _p : index)));
167
+ })] }, String((_r = (_q = item.id) === null || _q === void 0 ? void 0 : _q.value) !== null && _r !== void 0 ? _r : index)));
166
168
  };
167
169
  export default memo(GridRow);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.414",
3
+ "version": "1.2.416",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",