🆙 upgrade rc-table

This commit is contained in:
afc163 2019-09-03 18:13:37 +08:00 committed by 偏右
parent d2aeaab486
commit 7c180a7f31
5 changed files with 8 additions and 29 deletions

View File

@ -867,26 +867,6 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
return getColumnKey(sortColumn) === getColumnKey(column);
}
isTableLayoutFixed() {
const { tableLayout, columns = [], rowSelection, useFixedHeader, scroll = {} } = this.props;
if (tableLayout === 'fixed') {
return true;
}
// if one column fixed, use fixed table layout to fix align issue
if (columns.some(({ fixed }) => !!fixed)) {
return true;
}
// if selection column fixed, use fixed table layout to fix align issue
if (rowSelection && rowSelection.fixed) {
return true;
}
// if header fixed, use fixed table layout to fix align issue
if (useFixedHeader || scroll.y) {
return true;
}
return false;
}
// Get pagination, filters, sorter
prepareParamsArguments(state: any): PrepareParamsArgumentsReturn<T> {
const pagination = { ...state.pagination };
@ -1238,7 +1218,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
}) => {
const { showHeader, locale, getPopupContainer, ...restTableProps } = this.props;
// do not pass prop.style to rc-table, since already apply it to container div
const restProps = omit(restTableProps, ['style', 'tableLayout']);
const restProps = omit(restTableProps, ['style']);
const data = this.getCurrentPageData();
const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
@ -1255,7 +1235,6 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
[`${prefixCls}-bordered`]: this.props.bordered,
[`${prefixCls}-empty`]: !data.length,
[`${prefixCls}-without-column-header`]: !showHeader,
[`${prefixCls}-layout-fixed`]: this.isTableLayoutFixed(),
});
const columnsWithRowSelection = this.renderRowSelection({

View File

@ -5000,7 +5000,7 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = `
class="ant-spin-container"
>
<div
class="ant-table ant-table-default ant-table-scroll-position-left"
class="ant-table ant-table-default ant-table-scroll-position-left ant-table-layout-fixed"
>
<div
class="ant-table-content"
@ -5636,7 +5636,7 @@ exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] =
class="ant-spin-container"
>
<div
class="ant-table ant-table-default ant-table-fixed-header ant-table-scroll-position-left"
class="ant-table ant-table-default ant-table-fixed-header ant-table-scroll-position-left ant-table-layout-fixed"
>
<div
class="ant-table-content"
@ -7155,7 +7155,7 @@ exports[`renders ./components/table/demo/fixed-header.md correctly 1`] = `
class="ant-spin-container"
>
<div
class="ant-table ant-table-default ant-table-fixed-header ant-table-scroll-position-left"
class="ant-table ant-table-default ant-table-fixed-header ant-table-scroll-position-left ant-table-layout-fixed"
>
<div
class="ant-table-content"
@ -8364,7 +8364,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-scroll-position-left"
class="ant-table ant-table-middle ant-table-bordered ant-table-fixed-header ant-table-scroll-position-left ant-table-layout-fixed"
>
<div
class="ant-table-content"

View File

@ -59,7 +59,7 @@ const columns = [
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| tableLayout | [table-layout](https://developer.mozilla.org/zh-CN/docs/Web/CSS/table-layout) attribute of table element | 'auto' \| 'fixed' | 'auto', `fixed` when header or columns are fixed` | 3.24.0 |
| tableLayout | [table-layout](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout) attribute of table element | 'auto' \| 'fixed' | 'auto', `fixed` when header or columns are fixed` | 3.24.0 |
| bordered | Whether to show all table borders | boolean | `false` | |
| childrenColumnName | The column contains children to display | string\[] | children | 3.4.2 |
| columns | Columns of table | [ColumnProps](https://git.io/vMMXC)\[] | - | |

View File

@ -64,7 +64,7 @@ const columns = [
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| tableLayout | 表格元素的 [table-layout](https://developer.mozilla.org/zh-CN/docs/Web/CSS/table-layout) 属性 | 'auto' \| 'fixed' | 'auto',当固定头或固定列时默认值为 `fixed` | 3.24.0 |
| tableLayout | 表格元素的 [table-layout](https://developer.mozilla.org/zh-CN/docs/Web/CSS/table-layout) 属性,设为 `fixed` 表示内容不会影响列的布局 | 'auto' \| 'fixed' | 'auto',当固定头或固定列时默认值为 `fixed` | 3.24.0 |
| bordered | 是否展示外边框和列边框 | boolean | false | |
| childrenColumnName | 指定树形结构的列名 | string\[] | children | 3.4.2 |
| columns | 表格列的配置描述,具体项见下表 | [ColumnProps](https://git.io/vMMXC)\[] | - | |

View File

@ -79,7 +79,7 @@
"rc-slider": "~8.6.11",
"rc-steps": "~3.5.0",
"rc-switch": "~1.9.0",
"rc-table": "~6.7.0",
"rc-table": "~6.8.1",
"rc-tabs": "~9.6.4",
"rc-time-picker": "~3.7.1",
"rc-tooltip": "~3.7.3",