fix(Table): apply props.style to container div (#18494)

* fix(Table): apply props.style to container div

* fix: ci
This commit is contained in:
paranoidjk 2019-08-27 16:44:53 +08:00 committed by 偏右
parent dba3ea8721
commit f3244d6ae0
2 changed files with 7 additions and 3 deletions

View File

@ -466,6 +466,7 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
</h3>
<div
class="ant-table-wrapper"
style="margin-top:8px"
>
<div
class="ant-spin-nested-loading"
@ -475,7 +476,6 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
>
<div
class="ant-table ant-table-default ant-table-empty ant-table-scroll-position-left"
style="margin-top:8px"
>
<div
class="ant-table-content"

View File

@ -1,6 +1,7 @@
/* eslint-disable prefer-spread */
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import omit from 'omit.js';
import RcTable, { INTERNAL_COL_DEFINE } from 'rc-table';
import * as PropTypes from 'prop-types';
import classNames from 'classnames';
@ -1214,7 +1215,9 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
contextLocale: TableLocale;
getPopupContainer: TableProps<T>['getPopupContainer'];
}) => {
const { showHeader, locale, getPopupContainer, ...restProps } = this.props;
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']);
const data = this.getCurrentPageData();
const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
@ -1279,6 +1282,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
const {
prefixCls: customizePrefixCls,
dropdownPrefixCls: customizeDropdownPrefixCls,
style,
className,
} = this.props;
const data = this.getCurrentPageData();
@ -1314,7 +1318,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
: `${prefixCls}-without-pagination`;
return (
<div className={classNames(`${prefixCls}-wrapper`, className)}>
<div className={classNames(`${prefixCls}-wrapper`, className)} style={style}>
<Spin
{...loading}
className={loading.spinning ? `${paginationPatchClass} ${prefixCls}-spin-holder` : ''}