diff --git a/packages/amis/src/renderers/Table/TableContent.tsx b/packages/amis/src/renderers/Table/TableContent.tsx index e62df16ab..c1455ab79 100644 --- a/packages/amis/src/renderers/Table/TableContent.tsx +++ b/packages/amis/src/renderers/Table/TableContent.tsx @@ -70,8 +70,18 @@ export interface TableContentProps extends LocaleProps { @observer export class TableContent extends React.Component { - 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 { className={cx('Table-content', className)} onScroll={onScroll} > - {store.hoverRow ? this.renderItemActions() : null} {columnsGroup.length ? ( diff --git a/packages/amis/src/renderers/Table/index.tsx b/packages/amis/src/renderers/Table/index.tsx index fae164942..0174d5a24 100644 --- a/packages/amis/src/renderers/Table/index.tsx +++ b/packages/amis/src/renderers/Table/index.tsx @@ -2805,6 +2805,12 @@ export default class Table extends React.Component { return ( <> + {TableContent.renderItemActions({ + store, + classnames: cx, + render, + itemActions + })}