|
@@ -26,6 +26,7 @@ interface BaseColumn<T extends ResultWithId> { |
|
|
label: string; |
|
|
label: string; |
|
|
type: string; |
|
|
type: string; |
|
|
options: T[]; |
|
|
options: T[]; |
|
|
|
|
|
renderCell? : (T) => void; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
interface ColumnWithAction<T extends ResultWithId> extends BaseColumn<T> { |
|
|
interface ColumnWithAction<T extends ResultWithId> extends BaseColumn<T> { |
|
@@ -148,6 +149,7 @@ function EditableSearchResults<T extends ResultWithId>({ |
|
|
case 'input': |
|
|
case 'input': |
|
|
return ( |
|
|
return ( |
|
|
<TextField |
|
|
<TextField |
|
|
|
|
|
hiddenLabel={true} |
|
|
fullWidth |
|
|
fullWidth |
|
|
defaultValue={item[columnName] as string} |
|
|
defaultValue={item[columnName] as string} |
|
|
onChange={(e) => handleInputChange(item.id as number, columnName, e.target.value)} |
|
|
onChange={(e) => handleInputChange(item.id as number, columnName, e.target.value)} |
|
@@ -167,9 +169,12 @@ function EditableSearchResults<T extends ResultWithId>({ |
|
|
} |
|
|
} |
|
|
})() |
|
|
})() |
|
|
) : ( |
|
|
) : ( |
|
|
<span onDoubleClick={() => handleEditClick(item.id as number)}> |
|
|
|
|
|
{item[columnName] as string} |
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
column.renderCell ? |
|
|
|
|
|
column.renderCell(item) |
|
|
|
|
|
: |
|
|
|
|
|
<span onDoubleClick={() => handleEditClick(item.id as number)}> |
|
|
|
|
|
{item[columnName] as string} |
|
|
|
|
|
</span> |
|
|
)} |
|
|
)} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
); |
|
|
); |
|
|