Skip to content

Commit

Permalink
fix: RowSelection fixed should work (#20735)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Jan 7, 2020
1 parent 5c8cec5 commit 4068f3d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions components/table/hooks/useSelection.tsx
Expand Up @@ -75,6 +75,7 @@ export default function useSelection<RecordType>(
columnWidth: selectionColWidth = 60,
type: selectionType,
selections,
fixed,
} = rowSelection || {};

const { locale = defaultLocale } = React.useContext(ConfigContext);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4068f3d

Please sign in to comment.