@megha-ui/react 1.2.724 → 1.2.726

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.
@@ -384,7 +384,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
384
384
  searchOp,
385
385
  ]);
386
386
  const recalculate = (_summariseKeys) => {
387
- const filteredData = (paginate && gridGroupBy === "") ? paginatedData : sortedData;
387
+ const filteredData = paginate && gridGroupBy === "" ? paginatedData : sortedData;
388
388
  let newSummariseDetails = summariseDetails;
389
389
  Object.keys(_summariseKeys).forEach((_columnKey) => {
390
390
  const type = _summariseKeys[_columnKey];
@@ -721,7 +721,26 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
721
721
  useEffect(() => {
722
722
  getLoadingState && getLoadingState(hugLoading);
723
723
  }, [hugLoading]);
724
- const tableData = paginate ? paginatedData : sortedData;
724
+ const tableData = useMemo(() => {
725
+ const records = paginate ? paginatedData : sortedData;
726
+ const splitColumns = gridColumns.filter((col) => col.splitRows);
727
+ if (splitColumns.length > 0) {
728
+ let modifiedRecords = records.length > 0 ? [] : records;
729
+ records.forEach((row) => {
730
+ splitColumns.forEach((col) => {
731
+ var _a, _b, _c;
732
+ const cellValue = (_c = (_b = (_a = row[col.key]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "";
733
+ const splits = cellValue.split(">>");
734
+ splits.forEach((split) => {
735
+ var _a;
736
+ modifiedRecords.push(Object.assign(Object.assign({}, row), { id: Object.assign(Object.assign({}, row.id), { value: `${(_a = row.id) === null || _a === void 0 ? void 0 : _a.value}-${split}` }), [col.key]: Object.assign(Object.assign({}, row[col.key]), { value: split.trim() }) }));
737
+ });
738
+ });
739
+ });
740
+ return modifiedRecords;
741
+ }
742
+ return records;
743
+ }, [sortedData, paginatedData, gridColumns]);
725
744
  useEffect(() => {
726
745
  const hasNoWidths = gridColumns.every((column) => {
727
746
  if (typeof column.width === "undefined") {
@@ -1456,7 +1475,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1456
1475
  // setChanged((prev) => [...prev, "groupBy"]);
1457
1476
  setGridGroupBy("");
1458
1477
  }, style: { cursor: "pointer", marginRight: "0.5rem" }, children: _jsx(MdGroupOff, { size: 18 }) }), gridGroupBy.split(",").map((chip) => {
1459
- const column = columns.find(item => item.key === chip);
1478
+ const column = columns.find((item) => item.key === chip);
1460
1479
  return (_jsxs("div", { style: {
1461
1480
  display: "inline-flex",
1462
1481
  alignItems: "center",
@@ -25,6 +25,7 @@ export interface Column {
25
25
  }>;
26
26
  renderer?: (item: any) => JSX.Element;
27
27
  isArrayString?: boolean;
28
+ splitRows?: boolean;
28
29
  }
29
30
  export interface DataRow {
30
31
  [key: string]: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.724",
3
+ "version": "1.2.726",
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",