fix: Table expanded logic (#22832)

* update rc-table deps

* fix style mapping

* snapshot
This commit is contained in:
二货机器人 2020-04-01 20:57:35 +08:00 committed by GitHub
parent c38324e863
commit f2a3ef5926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 141 additions and 49 deletions

View File

@ -429,6 +429,7 @@ describe('Table.rowSelection', () => {
const wrapper = render(
createTable({
rowSelection: { fixed: true },
scroll: { x: 903 },
}),
);
@ -444,6 +445,7 @@ describe('Table.rowSelection', () => {
},
},
rowSelection: { fixed: true },
scroll: { x: 903 },
}),
);
@ -461,6 +463,7 @@ describe('Table.rowSelection', () => {
fixed: 'left',
},
],
scroll: { x: 903 },
}),
);

View File

@ -11,16 +11,17 @@ exports[`Table.rowSelection fix expand on th left when selection column fixed on
class="ant-spin-container"
>
<div
class="ant-table ant-table-has-fix-left"
class="ant-table ant-table-fixed-column ant-table-scroll-horizontal ant-table-has-fix-left"
>
<div
class="ant-table-container"
>
<div
class="ant-table-content"
style="overflow-x:scroll;overflow-y:hidden"
>
<table
style="table-layout:fixed"
style="width:903px;min-width:100%;table-layout:fixed"
>
<colgroup>
<col
@ -72,6 +73,21 @@ exports[`Table.rowSelection fix expand on th left when selection column fixed on
<tbody
class="ant-table-tbody"
>
<tr
aria-hidden="true"
class="ant-table-measure-row"
style="height:0"
>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="0"
@ -329,16 +345,17 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
class="ant-spin-container"
>
<div
class="ant-table ant-table-has-fix-left"
class="ant-table ant-table-fixed-column ant-table-scroll-horizontal ant-table-has-fix-left"
>
<div
class="ant-table-container"
>
<div
class="ant-table-content"
style="overflow-x:scroll;overflow-y:hidden"
>
<table
style="table-layout:fixed"
style="width:903px;min-width:100%;table-layout:fixed"
>
<colgroup>
<col
@ -383,6 +400,18 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
<tbody
class="ant-table-tbody"
>
<tr
aria-hidden="true"
class="ant-table-measure-row"
style="height:0"
>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="0"
@ -600,16 +629,17 @@ exports[`Table.rowSelection fix selection column on the left when any other colu
class="ant-spin-container"
>
<div
class="ant-table ant-table-has-fix-left"
class="ant-table ant-table-fixed-column ant-table-scroll-horizontal ant-table-has-fix-left"
>
<div
class="ant-table-container"
>
<div
class="ant-table-content"
style="overflow-x:scroll;overflow-y:hidden"
>
<table
style="table-layout:fixed"
style="width:903px;min-width:100%;table-layout:fixed"
>
<colgroup>
<col
@ -655,6 +685,18 @@ exports[`Table.rowSelection fix selection column on the left when any other colu
<tbody
class="ant-table-tbody"
>
<tr
aria-hidden="true"
class="ant-table-measure-row"
style="height:0"
>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="0"

View File

@ -4903,7 +4903,7 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = `
class="ant-spin-container"
>
<div
class="ant-table ant-table-fixed-column ant-table-has-fix-left ant-table-has-fix-right"
class="ant-table ant-table-fixed-column ant-table-scroll-horizontal ant-table-has-fix-left ant-table-has-fix-right"
>
<div
class="ant-table-container"
@ -5267,7 +5267,7 @@ exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] =
class="ant-spin-container"
>
<div
class="ant-table ant-table-fixed-header ant-table-fixed-column ant-table-has-fix-left ant-table-has-fix-right"
class="ant-table ant-table-fixed-header ant-table-fixed-column ant-table-scroll-horizontal ant-table-has-fix-left ant-table-has-fix-right"
>
<div
class="ant-table-container"
@ -7556,7 +7556,7 @@ exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
class="ant-spin-container"
>
<div
class="ant-table ant-table-middle ant-table-bordered ant-table-fixed-header ant-table-fixed-column ant-table-has-fix-left ant-table-has-fix-right"
class="ant-table ant-table-middle ant-table-bordered ant-table-fixed-header ant-table-fixed-column ant-table-scroll-horizontal ant-table-has-fix-left ant-table-has-fix-right"
>
<div
class="ant-table-container"
@ -13886,7 +13886,7 @@ exports[`renders ./components/table/demo/virtual-list.md correctly 1`] = `
class="ant-spin-container"
>
<div
class="ant-table ant-table-fixed-header ant-table-fixed-column"
class="ant-table ant-table-fixed-header ant-table-scroll-horizontal"
>
<div
class="ant-table-container"

View File

@ -240,16 +240,17 @@ exports[`Table renders empty table with fixed columns 1`] = `
class="ant-spin-container"
>
<div
class="ant-table ant-table-has-fix-left ant-table-has-fix-right"
class="ant-table ant-table-fixed-column ant-table-scroll-horizontal ant-table-has-fix-left ant-table-has-fix-right"
>
<div
class="ant-table-container"
>
<div
class="ant-table-content"
style="overflow-x:scroll;overflow-y:hidden"
>
<table
style="table-layout:fixed"
style="width:1px;min-width:100%;table-layout:fixed"
>
<colgroup>
<col
@ -337,12 +338,55 @@ exports[`Table renders empty table with fixed columns 1`] = `
<tbody
class="ant-table-tbody"
>
<tr
aria-hidden="true"
class="ant-table-measure-row"
style="height:0"
>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
<td
style="padding:0;border:0;height:0"
/>
</tr>
<tr
class="ant-table-placeholder"
>
<td
class="ant-table-cell"
colspan="11"
>
<div
class="ant-table-expanded-row-fixed"
style="width:0;position:sticky;left:0;overflow:hidden"
>
<div
class="ant-empty ant-empty-normal"
@ -390,6 +434,7 @@ exports[`Table renders empty table with fixed columns 1`] = `
No Data
</p>
</div>
</div>
</td>
</tr>
</tbody>

View File

@ -51,7 +51,9 @@ describe('Table', () => {
});
it('renders empty table with fixed columns', () => {
const wrapper = render(<Table dataSource={[]} columns={columnsFixed} pagination={false} />);
const wrapper = render(
<Table dataSource={[]} columns={columnsFixed} pagination={false} scroll={{ x: 1 }} />,
);
expect(wrapper).toMatchSnapshot();
});

View File

@ -53,7 +53,7 @@
}
}
&.@{table-prefix-cls}-fixed-column {
&.@{table-prefix-cls}-scroll-horizontal {
tr.@{table-prefix-cls}-expanded-row,
tr.@{table-prefix-cls}-placeholder {
> td {

View File

@ -127,7 +127,7 @@
"rc-slider": "~9.2.3",
"rc-steps": "~3.5.0",
"rc-switch": "~1.9.0",
"rc-table": "~7.3.0",
"rc-table": "~7.4.2",
"rc-tabs": "~10.1.1",
"rc-tooltip": "~4.0.2",
"rc-tree": "~3.1.0",