fix: support cellformatter in ListView table (#17590)

This commit is contained in:
markkaylor 2023-08-07 12:32:11 +02:00 committed by GitHub
parent 234b3cc739
commit f45ae5443e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -575,7 +575,7 @@ function ListView({
{/* Bulk action row checkbox */}
<Body.CheckboxDataCell rowId={rowData.id} index={index} />
{/* Field data */}
{tableHeaders.map(({ key, name, ...rest }) => {
{tableHeaders.map(({ key, name, cellFormatter, ...rest }) => {
if (hasDraftAndPublish && name === 'publishedAt') {
return (
<Td key={key}>
@ -622,6 +622,12 @@ function ListView({
);
}
if (typeof cellFormatter === 'function') {
return (
<Td key={key}>{cellFormatter(rowData, { key, name, ...rest })}</Td>
);
}
return (
<Td key={key}>
<CellContent