diff --git a/src/components/mui/__tests__/mui-table-editable.test.js b/src/components/mui/__tests__/mui-table-editable.test.js index 87da923..d76a0ab 100644 --- a/src/components/mui/__tests__/mui-table-editable.test.js +++ b/src/components/mui/__tests__/mui-table-editable.test.js @@ -359,22 +359,4 @@ describe("MuiTableEditable", () => { expect(sx.color).toBe("text.disabled"); }); }); - - test("does not apply archived styles to archive/unarchive action cell", () => { - setup({ - options: { sortCol: "name", sortDir: -1, disableProp: "is_archived" }, - data: [{ id: 1, name: "Alice", role: "Dev", age: 35, is_archived: true }], - onArchive: jest.fn() - }); - - const unarchiveButton = screen.getByRole("button", { - name: "general.unarchive" - }); - const actionCell = unarchiveButton.closest("td"); - const sx = getCellSx(actionCell); - - expect(sx.width).toBe(80); - expect(sx.backgroundColor).toBeUndefined(); - expect(sx.color).toBeUndefined(); - }); }); diff --git a/src/components/mui/editable-table/mui-table-editable.js b/src/components/mui/editable-table/mui-table-editable.js index 9a0cf55..3a9e75c 100644 --- a/src/components/mui/editable-table/mui-table-editable.js +++ b/src/components/mui/editable-table/mui-table-editable.js @@ -28,6 +28,7 @@ import { IconButton, TextField } from "@mui/material"; import EditIcon from "@mui/icons-material/Edit"; import DeleteIcon from "@mui/icons-material/Delete"; import { visuallyHidden } from "@mui/utils"; +import styles from "./mui-table-editable.module.less"; import { DEFAULT_PER_PAGE, @@ -123,7 +124,7 @@ const EditableCell = ({ value, isEditing, onBlur, validation }) => { onMouseEnter={() => setIsHovering(true)} onMouseLeave={() => setIsHovering(false)} > - {value} + {value} {isHovering && ( @@ -256,6 +258,7 @@ const MuiTableEditable = ({ : "asc" } onClick={() => onSort(col.columnKey, sortDir * -1)} + sx={{ fontWeight: "normal" }} > {col.header} {sortCol === col.columnKey ? ( @@ -267,13 +270,19 @@ const MuiTableEditable = ({ ) : null} ) : ( - col.header + {col.header} )} ))} - {onEdit && } - {onArchive && } - {onDelete && } + {onEdit && ( + + )} + {onArchive && ( + + )} + {onDelete && ( + + )} {/* TABLE BODY */} @@ -286,7 +295,8 @@ const MuiTableEditable = ({ onClick={() => handleCellClick(row, col.columnKey)} sx={getCellSx(row, { cursor: isEditable(col, row) ? "pointer" : "default", - padding: isEditable(col, row) ? "8px 16px" : undefined // Ensure enough space for the edit icon + padding: isEditable(col, row) ? "8px 16px" : undefined, + fontWeight: "normal" })} > {isEditable(col, row) ? ( @@ -310,12 +320,17 @@ const MuiTableEditable = ({ ) : col.render ? ( col.render(row) ) : ( - row[col.columnKey] + + {row[col.columnKey]} + )} ))} {onEdit && ( - + onEdit(row)} size="small" @@ -326,7 +341,13 @@ const MuiTableEditable = ({ )} {onArchive && ( - +