@megha-ui/react 1.2.466 → 1.2.467

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.
@@ -193,6 +193,7 @@ export interface GroupedRowProps {
193
193
  alternateRowColor?: boolean;
194
194
  locale?: string;
195
195
  formatOptions?: any;
196
+ actionsKey?: string;
196
197
  }
197
198
  export interface GroupedData {
198
199
  type: string;
@@ -122,7 +122,7 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
122
122
  }
123
123
  return null;
124
124
  }), isSummarise &&
125
- 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: (_c = item.groupedKey) === null || _c === void 0 ? void 0 : _c.split(">").flatMap((ele) => ele.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((_d = item.groupedValue) !== null && _d !== void 0 ? _d : 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(((_f = (_e = item.rowData) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.value)
125
+ 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: (_c = item.groupedKey) === null || _c === void 0 ? void 0 : _c.split(">").flatMap((ele) => ele.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((_d = item.groupedValue) !== null && _d !== void 0 ? _d : 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, actionsKey: actionsKey }, String(((_f = (_e = item.rowData) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.value)
126
126
  ? `${item.groupedValue}-${(_h = (_g = item.rowData) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.value}`
127
127
  : gIndex)));
128
128
  }) }));
@@ -15,8 +15,10 @@ const isUrl = (value) => {
15
15
  }
16
16
  return false;
17
17
  };
18
- const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode, index, rowKey, onRowClick, loading, groupBy, hugColumnWidths, alternateRowColor, }) => {
19
- const handleRowClick = useCallback(() => {
18
+ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode, index, rowKey, onRowClick, loading, groupBy, hugColumnWidths, alternateRowColor, actionsKey, }) => {
19
+ const handleRowClick = useCallback((column) => {
20
+ if (actionsKey === null || actionsKey === void 0 ? void 0 : actionsKey.split(",").includes(column.key))
21
+ return;
20
22
  onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(item);
21
23
  }, [onRowClick, item]);
22
24
  const getRowClassNames = useCallback(() => {
@@ -31,7 +33,7 @@ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode,
31
33
  .flatMap((g) => g.split("+").filter((k) => k)), [groupBy]);
32
34
  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
33
35
  ? "var(--row-bg)"
34
- : "var(--row-bg-even)" }), onClick: handleRowClick, children: [groupByKeys.map((_groupBy) => {
36
+ : "var(--row-bg-even)" }), children: [groupByKeys.map((_groupBy) => {
35
37
  var _a, _b;
36
38
  return (_jsx("div", { style: {
37
39
  width: widthMode === "auto"
@@ -77,7 +79,7 @@ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode,
77
79
  // : "",
78
80
  backgroundColor: alternateRowColor && (index + 1) % 2 === 0
79
81
  ? "var(--row-bg)"
80
- : "var(--row-bg-even)" }), children: loading ? (_jsx("div", { style: { width: column.width, height: rowHeight }, children: _jsx(Shimmer, { height: 32, width: column.width }) })) : (_jsx("div", { className: (cellData === null || cellData === void 0 ? void 0 : cellData.className) || "", style: {
82
+ : "var(--row-bg-even)" }), onClick: () => handleRowClick(column), children: loading ? (_jsx("div", { style: { width: column.width, height: rowHeight }, children: _jsx(Shimmer, { height: 32, width: column.width }) })) : (_jsx("div", { className: (cellData === null || cellData === void 0 ? void 0 : cellData.className) || "", style: {
81
83
  display: "flex",
82
84
  alignItems: "center", // Vertically center content within the cell
83
85
  width: "100%",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.466",
3
+ "version": "1.2.467",
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",