Skip to content

Commit

Permalink
feat: Table add rowHoverable to disable hover interaction (#48112)
Browse files Browse the repository at this point in the history
  • Loading branch information
madocto committed Mar 29, 2024
1 parent 8cc1d30 commit fe83792
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
24 changes: 24 additions & 0 deletions components/table/__tests__/Table.test.tsx
Expand Up @@ -473,4 +473,28 @@ describe('Table', () => {
container.querySelectorAll('.ant-table-thead tr')[1].querySelectorAll('th'),
).toHaveLength(1);
});

it('support disable row hover', () => {
const { container } = render(
<Table
columns={[
{
title: 'Name',
key: 'name',
dataIndex: 'name',
},
]}
dataSource={[
{
name: 'name1',
},
]}
rowHoverable={false}
/>,
);
const cell = container.querySelector('.ant-table-row .ant-table-cell')!;

fireEvent.mouseEnter(cell);
expect(container.querySelectorAll('.ant-table-cell-row-hover')).toHaveLength(0);
});
});
1 change: 1 addition & 0 deletions components/table/index.en-US.md
Expand Up @@ -129,6 +129,7 @@ Common props ref:[Common props](/docs/react/common-props)
| rowClassName | Row's className | function(record, index): string | - | |
| rowKey | Row's unique key, could be a string or function that returns a string | string \| function(record): string | `key` | |
| rowSelection | Row selection [config](#rowselection) | object | - | |
| rowHoverable | Row hover | boolean | true | 5.16.0 |
| scroll | Whether the table can be scrollable, [config](#scroll) | object | - | |
| showHeader | Whether to show table header | boolean | true | |
| showSorterTooltip | The header show next sorter direction tooltip. It will be set as the property of Tooltip if its type is object | boolean \| [Tooltip props](/components/tooltip/#api) & `{target?: 'full-header' \| 'sorter-icon' }` | { target: 'full-header' } | 5.16.0 |
Expand Down
1 change: 1 addition & 0 deletions components/table/index.zh-CN.md
Expand Up @@ -130,6 +130,7 @@ const columns = [
| rowClassName | 表格行的类名 | function(record, index): string | - | |
| rowKey | 表格行 key 的取值,可以是字符串或一个函数 | string \| function(record): string | `key` | |
| rowSelection | 表格行是否可选择,[配置项](#rowselection) | object | - | |
| rowHoverable | 表格行是否开启 hover 交互 | boolean | true | 5.16.0 |
| scroll | 表格是否可滚动,也可以指定滚动区域的宽、高,[配置项](#scroll) | object | - | |
| showHeader | 是否显示表头 | boolean | true | |
| showSorterTooltip | 表头是否显示下一次排序的 tooltip 提示。当参数类型为对象时,将被设置为 Tooltip 的属性 | boolean \| [Tooltip props](/components/tooltip-cn) & `{target?: 'full-header' \| 'sorter-icon' }` | { target: 'full-header' } | 5.16.0 |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -153,7 +153,7 @@
"rc-slider": "~10.5.0",
"rc-steps": "~6.0.1",
"rc-switch": "~4.1.0",
"rc-table": "~7.43.0",
"rc-table": "~7.44.0",
"rc-tabs": "~14.1.1",
"rc-textarea": "~1.6.3",
"rc-tooltip": "~6.2.0",
Expand Down

0 comments on commit fe83792

Please sign in to comment.