fix: table itemActions 左右滚动位置问题修复 (#5746)

* fix: table itemActions 左右滚动位置问题修复

* 修改

* 修改
This commit is contained in:
sansiro 2022-11-18 13:05:26 +08:00 committed by GitHub
parent f8b53a715c
commit 34e7b3cd42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -70,8 +70,18 @@ export interface TableContentProps extends LocaleProps {
@observer
export class TableContent extends React.Component<TableContentProps> {
renderItemActions() {
const {itemActions, render, store, classnames: cx} = this.props;
static renderItemActions(
props: Pick<
TableContentProps,
'itemActions' | 'render' | 'store' | 'classnames'
>
) {
const {itemActions, render, store, classnames: cx} = props;
if (!store.hoverRow) {
return null;
}
const finalActions = Array.isArray(itemActions)
? itemActions.filter(action => !action.hiddenOnHover)
: [];
@ -149,7 +159,6 @@ export class TableContent extends React.Component<TableContentProps> {
className={cx('Table-content', className)}
onScroll={onScroll}
>
{store.hoverRow ? this.renderItemActions() : null}
<table ref={tableRef} className={tableClassName}>
<thead>
{columnsGroup.length ? (

View File

@ -2805,6 +2805,12 @@ export default class Table extends React.Component<TableProps, object> {
return (
<>
{TableContent.renderItemActions({
store,
classnames: cx,
render,
itemActions
})}
<TableContent
tableClassName={cx(
{