added default for customizeTableRowProps

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann committed 2021-02-23 15:56:54 -05:00
1 parent ec1573dc4c
commit 31dfe20d54
1 file changed
+4 -5
@@ -89,7 +89,8 @@ const defaultProps: Partial<ItemListLayoutProps> = {
filterItems: [], filterItems: [],
hasDetailsView: true, hasDetailsView: true,
onDetails: noop, onDetails: noop,
virtual: true virtual: true,
customizeTableRowProps: () => ({} as TableRowProps),
}; };
interface ItemListLayoutUserSettings { interface ItemListLayoutUserSettings {
@@ -241,7 +242,7 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
sortItem={item} sortItem={item}
selected={detailsItem && detailsItem.getId() === itemId} selected={detailsItem && detailsItem.getId() === itemId}
onClick={hasDetailsView ? prevDefault(() => onDetails(item)) : undefined} onClick={hasDetailsView ? prevDefault(() => onDetails(item)) : undefined}
{...(customizeTableRowProps ? customizeTableRowProps(item) : {})} {...customizeTableRowProps(item)}
> >
{isSelectable && ( {isSelectable && (
<TableCell <TableCell
@@ -398,9 +399,7 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
return; return;
} }
const enabledItems = customizeTableRowProps const enabledItems = this.items.filter(item => !customizeTableRowProps(item).disabled);
? this.items.filter(item => !customizeTableRowProps(item).disabled)
: this.items;
return ( return (
<TableHead showTopLine nowrap> <TableHead showTopLine nowrap>