1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix scrolling to top when selecting all items in item list layout

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2022-02-02 08:27:32 +02:00
parent 63ea9d49ac
commit b781fc4ce0
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A

View File

@ -203,31 +203,43 @@ export class ItemListLayoutContent<I extends ItemObject> extends React.Component
} }
renderTableHeader() { renderTableHeader() {
const { customizeTableRowProps, renderTableHeader, isSelectable, isConfigurable, store } = this.props; const { renderTableHeader } = this.props;
if (!renderTableHeader) { if (!renderTableHeader) {
return null; return null;
} }
const enabledItems = this.props.getItems().filter(item => !customizeTableRowProps(item).disabled);
return ( return (
<TableHead showTopLine nowrap> <TableHead showTopLine nowrap>
{isSelectable && ( <Observer>
<TableCell {() => {
checkbox const { store, isConfigurable, isSelectable, customizeTableRowProps } = this.props;
isChecked={store.isSelectedAll(enabledItems)} const enabledItems = this.props.getItems().filter(item => !customizeTableRowProps(item).disabled);
onClick={prevDefault(() => store.toggleSelectionAll(enabledItems))}
/> return (
)} <>
{renderTableHeader.map((cellProps, index) => ( {isSelectable && (
this.showColumn(cellProps) && ( <TableCell
<TableCell key={cellProps.id ?? index} {...cellProps} /> checkbox
) isChecked={store.isSelectedAll(enabledItems)}
))} onClick={prevDefault(() =>
<TableCell className="menu"> store.toggleSelectionAll(enabledItems),
{isConfigurable && this.renderColumnVisibilityMenu()} )}
</TableCell> />
)}
{renderTableHeader.map(
(cellProps, index) =>
this.showColumn(cellProps) && (
<TableCell key={cellProps.id ?? index} {...cellProps} />
),
)}
<TableCell className="menu">
{isConfigurable && this.renderColumnVisibilityMenu()}
</TableCell>
</>
);
}}
</Observer>
</TableHead> </TableHead>
); );
} }