@megha-ui/react 1.3.23 → 1.3.25

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.
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- import { useState, useEffect, useRef, useMemo, } from "react";
13
+ import { useState, useEffect, useRef, useMemo } from "react";
14
14
  import * as XLSX from "xlsx";
15
15
  import { saveAs } from "file-saver";
16
16
  import Pagination from "./utils/pagination";
@@ -1516,11 +1516,12 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1516
1516
  }, children: "\u00D7" })] }, chip));
1517
1517
  })] }))] }), _jsxs("div", { id: `grid-content`, onScroll: onScroll, ref: gridRef, style: {
1518
1518
  display: "grid",
1519
- gridTemplateColumns: gridColumns
1520
- .map((_, index) => index > gridColumns.length - 2
1521
- ? "minmax(max-content, 1fr)"
1522
- : "max-content")
1523
- .join(" "),
1519
+ gridTemplateColumns: [
1520
+ ...(bulkSelect ? ["max-content"] : []),
1521
+ ...gridColumns.map((_, index) => index < gridColumns.length - 1
1522
+ ? "max-content"
1523
+ : "minmax(max-content, 1fr)"),
1524
+ ].join(" "),
1524
1525
  gridAutoRows: "max-content",
1525
1526
  height: `calc(100% - ${removalHeight})`,
1526
1527
  border: gridBorder ? "1px solid #f0f0f0" : "none",
@@ -1549,7 +1550,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1549
1550
  alignItems: "center",
1550
1551
  padding: "1rem 0",
1551
1552
  justifyContent: "center",
1552
- gridColumn: "1 / -1"
1553
+ gridColumn: "1 / -1",
1553
1554
  }, children: "No Data available" })), summariseAvailable &&
1554
1555
  filteredData.length > 0 &&
1555
1556
  gridGroupBy === "" && (_jsx(NewSummariseDetails, { summariseKeys: summariseKeys, columns: gridColumns, groupBy: gridGroupBy, sortable: sortable, cellStyle: cellStyle, columnWidths: columnWidths, widthMode: widthMode, summariseDetails: summariseDetails, activeCalculateColor: activeCalculateColor, gridRef: gridRef, setCalculatePosition: setCalculatePosition, calculatePosition: calculatePosition, calculatetextColor: calculatetextColor, setCalculateVisible: setCalculateVisible, calculateVisible: calculateVisible, summariseDisplay: summariseDisplay, recalculate: recalculate, actionsKey: actionsKey }))] }), paginate && gridGroupBy === "" && (_jsxs("div", { id: "pagination", style: {
@@ -246,7 +246,10 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
246
246
  setIsResizing(false);
247
247
  setResizeIndex(-1);
248
248
  };
249
- return (_jsxs(_Fragment, { children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign({}, cellStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis", position: "sticky", top: 0, zIndex: 1 }), children: _jsx(Checkbox, { selected: allRowsSelected, onChange: () => toggleSelectAll(), noLabel: true, wrapperClass: checkboxWrapper }) })), groupByKeys.map((_groupBy) => {
249
+ return (_jsxs(_Fragment, { children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign({}, cellStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis", position: "sticky", top: 0, zIndex: 1, backgroundColor: "var(--row-header-bg)" }), children: _jsx("div", { style: {
250
+ display: "flex",
251
+ alignItems: "center"
252
+ }, children: _jsx(Checkbox, { selected: allRowsSelected, onChange: () => toggleSelectAll(), noLabel: true, wrapperClass: checkboxWrapper }) }) })), groupByKeys.map((_groupBy) => {
250
253
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58;
251
254
  return (_jsx(_Fragment, { children: headerColumns.find((column) => column.key === _groupBy) && (_jsxs("div", { className: `${sortable &&
252
255
  ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.sortable)
@@ -93,10 +93,15 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
93
93
  return isExpandable &&
94
94
  ((_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.value) &&
95
95
  expandedRow === ((_b = item === null || item === void 0 ? void 0 : item.id) === null || _b === void 0 ? void 0 : _b.value) &&
96
- 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), 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", height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
96
+ item.expandedDetails ? (_jsxs("div", { style: { display: "contents" }, children: [_jsxs("div", { id: String((_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 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", height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
97
97
  ? "var(--row-bg)"
98
- : "var(--row-bg-even)" }), children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign(Object.assign({}, cellStyle), dragHighlightStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis" }), children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
99
- 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: {
98
+ : "var(--row-bg-even)" }), children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign(Object.assign({}, cellStyle), dragHighlightStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
99
+ ? "var(--row-bg)"
100
+ : "var(--row-bg-even)" }), children: _jsx("div", { style: {
101
+ display: "flex",
102
+ alignItems: "center",
103
+ }, children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
104
+ 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: {
100
105
  wordBreak: widthMode === "auto" ? "break-all" : "unset",
101
106
  padding: groupBy ? "0.25rem" : 0,
102
107
  backgroundColor: alternateRowColor && (index + 1) % 2 === 0
@@ -142,8 +147,13 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
142
147
  ((_h = item === null || item === void 0 ? void 0 : item.id) === null || _h === void 0 ? void 0 : _h.value) &&
143
148
  expandedRow === ((_j = item === null || item === void 0 ? void 0 : item.id) === null || _j === void 0 ? void 0 : _j.value) &&
144
149
  item.expandedDetails &&
145
- 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}`, className: getRowClassNames(), onDragOver: (e) => handleDragOver && handleDragOver(e), onDrop: (e) => handleDrop && handleDrop(e, index), style: { display: "contents" }, children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign(Object.assign(Object.assign({}, cellStyle), rowStyle), dragHighlightStyle), { textTransform: "uppercase", padding: "0.25rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis" }), children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
146
- 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) => {
150
+ 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}`, className: getRowClassNames(), onDragOver: (e) => handleDragOver && handleDragOver(e), onDrop: (e) => handleDrop && handleDrop(e, index), style: { display: "contents" }, children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign(Object.assign(Object.assign({}, cellStyle), rowStyle), dragHighlightStyle), { textTransform: "uppercase", padding: "0.25rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
151
+ ? "var(--row-bg)"
152
+ : "var(--row-bg-even)" }), children: _jsx("div", { style: {
153
+ display: "flex",
154
+ alignItems: "center",
155
+ }, children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
156
+ 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) => {
147
157
  var _a, _b, _c, _d, _e, _f, _g;
148
158
  const cellData = item[column.key];
149
159
  const cellValue = cellData && cellData.isArrayString ? (_jsx("div", { children: cellData.value.toString().split(">>").length > 1 ? (_jsx(_Fragment, { children: column.isArrayString ? (_jsxs("div", { className: "flex items-center gap-2", children: [cellData.value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.23",
3
+ "version": "1.3.25",
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",