fix: RowSelection fixed should work (#20735)

This commit is contained in:
二货机器人 2020-01-07 19:17:37 +08:00 committed by GitHub
parent 5c8cec5512
commit 4068f3d190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

View File

@ -11,7 +11,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
class="ant-spin-container"
>
<div
class="ant-table"
class="ant-table ant-table-has-fix-left"
>
<div
class="ant-table-container"
@ -31,7 +31,8 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
<thead>
<tr>
<th
class="ant-table-cell ant-table-selection-column"
class="ant-table-cell ant-table-selection-column ant-table-cell-fix-left ant-table-cell-fix-left-last"
style="position:sticky;left:0"
>
<div
class="ant-table-selection"
@ -67,7 +68,8 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
class="ant-table-row ant-table-row-level-0"
>
<td
class="ant-table-cell ant-table-selection-column"
class="ant-table-cell ant-table-selection-column ant-table-cell-fix-left ant-table-cell-fix-left-last"
style="position:sticky;left:0"
>
<label
class="ant-checkbox-wrapper"
@ -95,7 +97,8 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
class="ant-table-row ant-table-row-level-0"
>
<td
class="ant-table-cell ant-table-selection-column"
class="ant-table-cell ant-table-selection-column ant-table-cell-fix-left ant-table-cell-fix-left-last"
style="position:sticky;left:0"
>
<label
class="ant-checkbox-wrapper"
@ -123,7 +126,8 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
class="ant-table-row ant-table-row-level-0"
>
<td
class="ant-table-cell ant-table-selection-column"
class="ant-table-cell ant-table-selection-column ant-table-cell-fix-left ant-table-cell-fix-left-last"
style="position:sticky;left:0"
>
<label
class="ant-checkbox-wrapper"
@ -151,7 +155,8 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
class="ant-table-row ant-table-row-level-0"
>
<td
class="ant-table-cell ant-table-selection-column"
class="ant-table-cell ant-table-selection-column ant-table-cell-fix-left ant-table-cell-fix-left-last"
style="position:sticky;left:0"
>
<label
class="ant-checkbox-wrapper"

View File

@ -75,6 +75,7 @@ export default function useSelection<RecordType>(
columnWidth: selectionColWidth = 60,
type: selectionType,
selections,
fixed,
} = rowSelection || {};
const { locale = defaultLocale } = React.useContext(ConfigContext);
@ -416,11 +417,11 @@ export default function useSelection<RecordType>(
const [expandColumn, ...restColumns] = columns;
return [
expandColumn,
{ ...selectionColumn, fixed: getFixedType(restColumns[0]) },
{ ...selectionColumn, fixed: fixed || getFixedType(restColumns[0]) },
...restColumns,
];
}
return [{ ...selectionColumn, fixed: getFixedType(columns[0]) }, ...columns];
return [{ ...selectionColumn, fixed: fixed || getFixedType(columns[0]) }, ...columns];
},
[
getRowKey,