|
|
@@ -209,7 +209,24 @@ function SearchResults<T extends ResultWithId>({ |
|
|
|
}; |
|
|
|
|
|
|
|
// checkbox |
|
|
|
const handleRowClick = useCallback((event: MouseEvent<unknown>, id: string | number) => { |
|
|
|
const handleRowClick = useCallback((event: MouseEvent<unknown>, item: T, columns: Column<T>[]) => { |
|
|
|
// check is disabled or not |
|
|
|
var disabled = false |
|
|
|
columns.forEach((col) => { |
|
|
|
if (isCheckboxColumn(col) && col.disabled) { |
|
|
|
disabled = col.disabled(item) |
|
|
|
if (disabled) { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (disabled) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// set id |
|
|
|
const id = item.id |
|
|
|
if (setCheckboxIds) { |
|
|
|
const selectedIndex = checkboxIds.indexOf(id); |
|
|
|
let newSelected: (string | number)[] = []; |
|
|
@@ -257,7 +274,7 @@ function SearchResults<T extends ResultWithId>({ |
|
|
|
hover |
|
|
|
tabIndex={-1} |
|
|
|
key={item.id} |
|
|
|
onClick={setCheckboxIds ? (event) => handleRowClick(event, item.id) : undefined} |
|
|
|
onClick={setCheckboxIds? (event) => handleRowClick(event, item, columns) : undefined} |
|
|
|
role={setCheckboxIds ? "checkbox" : undefined} |
|
|
|
> |
|
|
|
{columns.map((column, idx) => { |
|
|
|