|
|
|
@@ -139,7 +139,6 @@ function isCheckboxColumn<T extends ResultWithId>( |
|
|
|
return column.type === "checkbox"; |
|
|
|
} |
|
|
|
|
|
|
|
// Icon Component Functions |
|
|
|
function convertObjectKeysToLowercase<T extends object>( |
|
|
|
obj: T, |
|
|
|
): object | undefined { |
|
|
|
@@ -207,7 +206,6 @@ function EquipmentSearchResults<T extends ResultWithId>({ |
|
|
|
const [page, setPage] = React.useState(0); |
|
|
|
const [rowsPerPage, setRowsPerPage] = React.useState(10); |
|
|
|
|
|
|
|
/// this |
|
|
|
const handleChangePage: TablePaginationProps["onPageChange"] = ( |
|
|
|
_event, |
|
|
|
newPage, |
|
|
|
@@ -238,7 +236,6 @@ function EquipmentSearchResults<T extends ResultWithId>({ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
// checkbox |
|
|
|
const currItems = useMemo(() => { |
|
|
|
return items.length > 10 ? items |
|
|
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) |
|
|
|
@@ -254,7 +251,6 @@ function EquipmentSearchResults<T extends ResultWithId>({ |
|
|
|
|
|
|
|
const handleRowClick = useCallback( |
|
|
|
(event: MouseEvent<unknown>, item: T, columns: Column<T>[]) => { |
|
|
|
// check is disabled or not |
|
|
|
let disabled = false; |
|
|
|
columns.forEach((col) => { |
|
|
|
if (isCheckboxColumn(col) && col.disabled) { |
|
|
|
@@ -269,7 +265,6 @@ function EquipmentSearchResults<T extends ResultWithId>({ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// set id |
|
|
|
const id = item.id; |
|
|
|
if (setCheckboxIds) { |
|
|
|
const selectedIndex = checkboxIds.indexOf(id); |
|
|
|
@@ -335,7 +330,7 @@ function EquipmentSearchResults<T extends ResultWithId>({ |
|
|
|
column.renderHeader() |
|
|
|
) : ( |
|
|
|
column.label.split('\n').map((line, index) => ( |
|
|
|
<div key={index}>{line}</div> // Render each line in a div |
|
|
|
<div key={index}>{line}</div> |
|
|
|
)) |
|
|
|
)} |
|
|
|
</TableCell> |
|
|
|
@@ -442,7 +437,6 @@ function EquipmentSearchResults<T extends ResultWithId>({ |
|
|
|
return noWrapper ? table : <Paper sx={{ overflow: "hidden" }}>{table}</Paper>; |
|
|
|
} |
|
|
|
|
|
|
|
// Table cells |
|
|
|
interface TableCellsProps<T extends ResultWithId> { |
|
|
|
column: Column<T>; |
|
|
|
columnName: keyof T; |
|
|
|
|