@megha-ui/react 1.2.72 → 1.2.73

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.
@@ -262,8 +262,6 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
262
262
  };
263
263
  const handleClick = (e) => {
264
264
  const clearEle = document.getElementById(clearId || "");
265
- console.log("clearEle", clearEle);
266
- console.log("e.target", e.target, clearEle === e.target);
267
265
  if (clearEle === e.target) {
268
266
  e.preventDefault();
269
267
  }
@@ -46,7 +46,6 @@ const useSort = (data, columns, uniqueSearch, multiSorting, withAscii) => {
46
46
  return false;
47
47
  });
48
48
  });
49
- console.log(returnData);
50
49
  return returnData;
51
50
  }, [data, sortQueries, uniqueSearch]);
52
51
  const handleSort = (column, order) => {
@@ -62,7 +62,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
62
62
  borderLeft: "0.5rem solid #d9d9d9",
63
63
  }, defaultSort, noKeyEvents = true, customOperation, hasCustomOperation, globalSearch, headerDropdownIndex, draggable = false, resizable = false, updateGridData, widthUnits, checkboxWrapper, ignoreHugContent = false, setRendered, isSummarise = true, fullScreenAvailable = true, defaultGroupOpen, alternateRowColor = true, activeCalculateColor = "#2377BA", calculatetextColor = "#fff", actionsKey = "actions", saveAsNewView = false, handleSaveAsView, saveAsViewIcon, filterData, chipColor = "#ccc", withAscii = false, propSummariseKeys, SummariseIcon, summarizeColor = "black", isExpandable = false, expandedRow, extraRow, selectedCheckBox, setSelectedCheckbox, ignoreRowSelect, setOpenedRows, openedRows, getLoadingState, globalSearchOpen = false, updateFixedFilterValues = (fixedFilterValues) => {
64
64
  console.log("Update fixed filter values not implemented", fixedFilterValues);
65
- }, }) => {
65
+ }, locale, formatOptions }) => {
66
66
  var _a, _b, _c, _d;
67
67
  const [searchQueries, setSearchQueries] = (0, react_1.useState)({});
68
68
  const [chips, setChips] = (0, react_1.useState)([]);
@@ -1392,10 +1392,10 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
1392
1392
  }, children: (0, jsx_runtime_1.jsx)(loader_1.default, { size: 32 }) })), (0, jsx_runtime_1.jsx)("div", { id: "table-body", children: gridGroupBy !== "" ? ((0, jsx_runtime_1.jsx)(groupedGridDetails_1.default, { groupedData: groupedData, rowOpened: rowOpened, startIndex: startIndex, endIndex: endIndex, alternateRowColor: alternateRowColor, updateRowOpened: updateRowOpened, columnWidths: columnWidths, columnHeights: columnHeights, groupBy: groupBy, widthMode: widthMode, rowKey: rowKey, rowHeight: rowHeight, headerBackground: headerBackground, isSummarise: summariseAvailable, gridGroupBy: gridGroupBy, rowStyle: rowStyle, sortable: sortable, cellStyle: cellStyle, summariseKeys: summariseKeys, summariseDetails: summariseDetails, activeCalculateColor: activeCalculateColor, gridRef: gridRef, setCalculatePosition: setCalculatePosition, calculatePosition: calculatePosition, calculatetextColor: calculatetextColor, setCalculateVisible: setCalculateVisible, calculateVisible: calculateVisible, summariseDisplay: summariseDisplay, recalculate: recalculate, selectedRowStyle: selectedRowStyle, isLoading: isLoading, selectedRow: selectedRow, onRowClick: onRowClick, gridColumns: gridColumns, bulkSelect: bulkSelect, selectedRows: selectedRows, toggleRowSelection: toggleRowSelection, hasVerticalScroll: hasVerticalScroll, setColumnWidths: setColumnWidths, setColumnHeights: setColumnHeights, actionsKey: actionsKey })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(paginate ? paginatedData : sortedData).map((item, index) => {
1393
1393
  var _a, _b, _c, _d;
1394
1394
  if (paginate) {
1395
- return ((0, jsx_runtime_1.jsx)(gridRow_1.default, { item: item, index: index, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === index ? selectedRowStyle : {})), handleDragStart: handleDragStart, handleDragOver: handleDragOver, handleDrop: handleDrop, draggable: draggable, cellStyle: cellStyle, rowHeight: rowHeight, alternateRowColor: alternateRowColor, bulkSelect: bulkSelect, selectedRows: selectedRows ? selectedRows : new Set([""]), ignoreRowSelect: ignoreRowSelect ? ignoreRowSelect : new Set([""]), toggleRowSelection: toggleRowSelection, columns: gridColumns, widthMode: widthMode, hasVerticalScroll: hasVerticalScroll, onRowClick: onRowClick, loading: isLoading, groupBy: gridGroupBy, rowKey: rowKey, rowIndex: rowIndex, columnIndex: columnIndex, hlBorderColor: hlBorderColor, hugColumnWidths: columnWidths, hugColumnHeights: columnHeights, expandedRow: expandedRow, isExpandable: isExpandable, checkboxWrapper: checkboxWrapper }, String((_b = (_a = item.id) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : index)));
1395
+ return ((0, jsx_runtime_1.jsx)(gridRow_1.default, { item: item, index: index, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === index ? selectedRowStyle : {})), handleDragStart: handleDragStart, handleDragOver: handleDragOver, handleDrop: handleDrop, draggable: draggable, cellStyle: cellStyle, rowHeight: rowHeight, alternateRowColor: alternateRowColor, bulkSelect: bulkSelect, selectedRows: selectedRows ? selectedRows : new Set([""]), ignoreRowSelect: ignoreRowSelect ? ignoreRowSelect : new Set([""]), toggleRowSelection: toggleRowSelection, columns: gridColumns, widthMode: widthMode, hasVerticalScroll: hasVerticalScroll, onRowClick: onRowClick, loading: isLoading, groupBy: gridGroupBy, rowKey: rowKey, rowIndex: rowIndex, columnIndex: columnIndex, hlBorderColor: hlBorderColor, hugColumnWidths: columnWidths, hugColumnHeights: columnHeights, expandedRow: expandedRow, isExpandable: isExpandable, checkboxWrapper: checkboxWrapper, locale: locale, formatOptions: formatOptions }, String((_b = (_a = item.id) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : index)));
1396
1396
  }
1397
1397
  else if (index >= startIndex && index <= endIndex) {
1398
- return ((0, jsx_runtime_1.jsx)(gridRow_1.default, { item: item, index: index, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === index ? selectedRowStyle : {})), handleDragStart: handleDragStart, handleDragOver: handleDragOver, handleDrop: handleDrop, draggable: draggable, cellStyle: cellStyle, rowHeight: rowHeight, alternateRowColor: alternateRowColor, bulkSelect: bulkSelect, selectedRows: selectedRows ? selectedRows : new Set([""]), ignoreRowSelect: ignoreRowSelect ? ignoreRowSelect : new Set([""]), toggleRowSelection: toggleRowSelection, columns: gridColumns, widthMode: widthMode, hasVerticalScroll: hasVerticalScroll, onRowClick: onRowClick, loading: isLoading, groupBy: gridGroupBy, rowKey: rowKey, rowIndex: rowIndex, columnIndex: columnIndex, hlBorderColor: hlBorderColor, hugColumnWidths: columnWidths, hugColumnHeights: columnHeights, expandedRow: expandedRow, isExpandable: isExpandable, checkboxWrapper: checkboxWrapper }, String((_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : index)));
1398
+ return ((0, jsx_runtime_1.jsx)(gridRow_1.default, { item: item, index: index, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === index ? selectedRowStyle : {})), handleDragStart: handleDragStart, handleDragOver: handleDragOver, handleDrop: handleDrop, draggable: draggable, cellStyle: cellStyle, rowHeight: rowHeight, alternateRowColor: alternateRowColor, bulkSelect: bulkSelect, selectedRows: selectedRows ? selectedRows : new Set([""]), ignoreRowSelect: ignoreRowSelect ? ignoreRowSelect : new Set([""]), toggleRowSelection: toggleRowSelection, columns: gridColumns, widthMode: widthMode, hasVerticalScroll: hasVerticalScroll, onRowClick: onRowClick, loading: isLoading, groupBy: gridGroupBy, rowKey: rowKey, rowIndex: rowIndex, columnIndex: columnIndex, hlBorderColor: hlBorderColor, hugColumnWidths: columnWidths, hugColumnHeights: columnHeights, expandedRow: expandedRow, isExpandable: isExpandable, checkboxWrapper: checkboxWrapper, locale: locale, formatOptions: formatOptions }, String((_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : index)));
1399
1399
  }
1400
1400
  }), extraRow && extraRow, (paginate ? paginatedData : sortedData).length === 0 &&
1401
1401
  typeof extraRow === "undefined" && ((0, jsx_runtime_1.jsx)("div", { style: {
@@ -153,6 +153,8 @@ export interface OjasGridProps {
153
153
  updateFixedFilterValues?: (fixedFilterValues: {
154
154
  [key: string]: string[];
155
155
  }) => void;
156
+ locale?: string;
157
+ formatOptions?: any;
156
158
  }
157
159
  export interface GroupedRowProps {
158
160
  item: any;
@@ -279,6 +281,8 @@ export interface GridRowProps {
279
281
  isExpandable: boolean;
280
282
  expandedRow?: string;
281
283
  ignoreRowSelect?: Set<string>;
284
+ locale?: string;
285
+ formatOptions?: any;
282
286
  }
283
287
  export interface SearchQuery {
284
288
  text: string;
@@ -111,7 +111,6 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
111
111
  };
112
112
  }, []);
113
113
  (0, react_1.useEffect)(() => {
114
- console.log({ columns });
115
114
  setHeaderColumns(columns);
116
115
  }, [columns]);
117
116
  const toggleDropdown = (columnKey) => {
@@ -7,6 +7,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
8
  const shimmer_1 = __importDefault(require("./shimmer"));
9
9
  const checkbox_1 = __importDefault(require("../../checkbox"));
10
+ const commonService_1 = require("../../../services/commonService");
10
11
  const isUrl = (value) => {
11
12
  if (value) {
12
13
  const urlPattern = new RegExp("^(https?:\\/\\/)?" +
@@ -21,7 +22,7 @@ const isUrl = (value) => {
21
22
  }
22
23
  return false;
23
24
  };
24
- 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, }) => {
25
+ 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 }) => {
25
26
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
26
27
  const [itemsAlign, setItemsAlign] = (0, react_1.useState)("stretch");
27
28
  const handleRowClick = (0, react_1.useCallback)(() => {
@@ -59,12 +60,12 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
59
60
  ? "var(--row-bg)"
60
61
  : "var(--row-bg-even)",
61
62
  }, className: `column index-${groupBy}`, children: (0, jsx_runtime_1.jsx)("div", { children: ((_d = item[groupBy]) === null || _d === void 0 ? void 0 : _d.html) || ((_e = item[groupBy]) === null || _e === void 0 ? void 0 : _e.value) }) })), columns.map((column, colIndex) => {
62
- var _a, _b;
63
+ var _a, _b, _c;
63
64
  const cellData = item[column.key];
64
65
  const cellValue = cellData && Object.keys(cellData).includes("html")
65
66
  ? cellData === null || cellData === void 0 ? void 0 : cellData.html
66
67
  : cellData && Object.keys(cellData).includes("value")
67
- ? cellData === null || cellData === void 0 ? void 0 : cellData.value
68
+ ? (0, commonService_1.formatValue)(cellData === null || cellData === void 0 ? void 0 : cellData.value, (_a = column.dataType) !== null && _a !== void 0 ? _a : "string", locale, formatOptions)
68
69
  : cellData
69
70
  ? cellData
70
71
  : "";
@@ -98,7 +99,7 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
98
99
  : column.dataType === "number"
99
100
  ? "end"
100
101
  : "start",
101
- }, children: isUrl(cellUrl) ? ((0, jsx_runtime_1.jsx)("a", { href: cellUrl, target: "_blank", rel: "noopener noreferrer", children: cellValue })) : column.render ? (column.render(cellValue)) : (cellValue) }))] }, `${column.key}-${(_b = (_a = item.id) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : index}`));
102
+ }, children: isUrl(cellUrl) ? ((0, jsx_runtime_1.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}`));
102
103
  }
103
104
  return null;
104
105
  })] }), isExpandable &&
@@ -38,17 +38,6 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
38
38
  .join(">"));
39
39
  }),
40
40
  ]);
41
- (0, react_1.useEffect)(() => {
42
- const evenOdd = {
43
- even: [],
44
- odd: []
45
- };
46
- groupedData.forEach((item, index) => {
47
- if (item.type !== "main") {
48
- console.log("Grouped Row", item);
49
- }
50
- });
51
- }, [groupedData]);
52
41
  return ((0, jsx_runtime_1.jsx)("div", { ref: groupedDiv, children: groupedData
53
42
  .filter((item) => {
54
43
  return item.type === "main" && item.level === 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.72",
3
+ "version": "1.2.73",
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.mjs",