index.jsx 17.1 KB
Newer Older
A
afc163 已提交
1 2
import React from 'react';
import Table from 'rc-table';
A
afc163 已提交
3
import Checkbox from '../checkbox';
R
RaoHai 已提交
4
import Radio from '../radio';
A
afc163 已提交
5
import FilterDropdown from './filterDropdown';
6
import Pagination from '../pagination';
A
afc163 已提交
7
import Icon from '../icon';
A
afc163 已提交
8
import objectAssign from 'object-assign';
K
KgTong 已提交
9
import Spin from '../spin';
A
afc163 已提交
10
import classNames from 'classnames';
A
afc163 已提交
11

Y
yiminghe 已提交
12 13
function noop() {
}
14

B
Benjy Cui 已提交
15 16 17 18 19 20
const defaultLocale = {
  filterTitle: '筛选',
  filterConfirm: '确定',
  filterReset: '重置'
};

A
afc163 已提交
21
let AntTable = React.createClass({
Y
yiminghe 已提交
22
  getInitialState() {
A
afc163 已提交
23
    return {
Y
yiminghe 已提交
24
      // 减少状态
A
afc163 已提交
25
      selectedRowKeys: [],
Y
yiminghe 已提交
26
      filters: {},
A
afc163 已提交
27
      selectionDirty: false,
Y
yiminghe 已提交
28 29 30
      sortColumn: '',
      sortOrder: '',
      sorter: null,
R
RaoHai 已提交
31
      radioIndex: null,
Y
yiminghe 已提交
32
      pagination: this.hasPagination() ? objectAssign({
A
afc163 已提交
33 34
        pageSize: 10,
        current: 1
Y
yiminghe 已提交
35
      }, this.props.pagination) : {}
A
afc163 已提交
36 37
    };
  },
Y
yiminghe 已提交
38

A
afc163 已提交
39 40
  getDefaultProps() {
    return {
A
afc163 已提交
41
      dataSource: [],
A
afc163 已提交
42
      prefixCls: 'ant-table',
A
afc163 已提交
43
      useFixedHeader: false,
A
afc163 已提交
44
      rowSelection: null,
Y
yiminghe 已提交
45
      className: '',
A
afc163 已提交
46
      size: 'large',
A
afc163 已提交
47
      loading: false,
A
afc163 已提交
48
      bordered: false,
B
Benjy Cui 已提交
49 50
      onChange: noop,
      locale: {}
A
afc163 已提交
51 52
    };
  },
Y
yiminghe 已提交
53

A
afc163 已提交
54
  propTypes: {
A
afc163 已提交
55
    dataSource: React.PropTypes.array,
A
afc163 已提交
56 57 58 59 60 61 62 63 64
    prefixCls: React.PropTypes.string,
    useFixedHeader: React.PropTypes.bool,
    rowSelection: React.PropTypes.object,
    className: React.PropTypes.string,
    size: React.PropTypes.string,
    loading: React.PropTypes.bool,
    bordered: React.PropTypes.bool,
    onChange: React.PropTypes.func,
    locale: React.PropTypes.object,
A
afc163 已提交
65 66
  },

R
RaoHai 已提交
67 68 69 70 71 72
  getDefaultSelection() {
    let selectedRowKeys = [];
    if (this.props.rowSelection && this.props.rowSelection.getCheckboxProps) {
      let data = this.getCurrentPageData();
      data.filter((item) => {
        if (this.props.rowSelection.getCheckboxProps) {
73
          return this.props.rowSelection.getCheckboxProps(item).defaultChecked;
R
RaoHai 已提交
74 75 76 77 78 79 80 81 82
        }
        return true;
      }).map((record, rowIndex) => {
        selectedRowKeys.push(this.getRecordKey(record, rowIndex));
      });
    }
    return selectedRowKeys;
  },

A
afc163 已提交
83
  componentWillReceiveProps(nextProps) {
Y
yiminghe 已提交
84
    if (('pagination' in nextProps) && nextProps.pagination !== false) {
85 86 87
      this.setState({
        pagination: objectAssign({}, this.state.pagination, nextProps.pagination)
      });
A
afc163 已提交
88
    }
89 90
    // 外界只有 dataSource 的变化会触发新请求
    if ('dataSource' in nextProps &&
A
afc163 已提交
91 92 93
        nextProps.dataSource !== this.props.dataSource) {
      let selectedRowKeys = this.state.selectedRowKeys;
      // 把不在当前页的选中项去掉
A
afc163 已提交
94 95 96 97 98 99 100
      let currentPageRowKeys =
        this.getCurrentPageData(nextProps.dataSource).map(
          (record, i) => this.getRecordKey(record, i)
        );
      selectedRowKeys = selectedRowKeys.filter((key) => {
        return currentPageRowKeys.indexOf(key) >= 0;
      });
101
      this.setState({
A
afc163 已提交
102
        selectionDirty: false,
A
afc163 已提交
103
        selectedRowKeys,
A
afc163 已提交
104 105
      });
    }
A
afc163 已提交
106
  },
A
afc163 已提交
107 108

  hasPagination(pagination) {
A
afc163 已提交
109
    return this.props.pagination !== false;
A
afc163 已提交
110
  },
A
afc163 已提交
111

A
afc163 已提交
112
  toggleSortOrder(order, column) {
113 114
    let sortColumn = this.state.sortColumn;
    let sortOrder = this.state.sortOrder;
J
jljsj 已提交
115
    let sorter;
A
afc163 已提交
116 117 118 119 120 121 122 123 124 125 126 127 128
    // 只同时允许一列进行排序,否则会导致排序顺序的逻辑问题
    let isSortColumn = this.isSortColumn(column);
    if (!isSortColumn) {  // 当前列未排序
      sortOrder = order;
      sortColumn = column;
    } else {                      // 当前列已排序
      if (sortOrder === order) {  // 切换为未排序状态
        sortOrder = '';
        sortColumn = null;
      } else {                    // 切换为排序状态
        sortOrder = order;
      }
    }
A
afc163 已提交
129
    if (typeof column.sorter === 'function') {
Y
yiminghe 已提交
130
      sorter = function () {
131
        let result = column.sorter.apply(this, arguments);
132
        if (sortOrder === 'ascend') {
133
          return result;
134
        } else if (sortOrder === 'descend') {
135 136 137
          return -result;
        }
      };
A
afc163 已提交
138
    }
A
afc163 已提交
139 140 141 142 143
    const newState = {
      sortOrder,
      sortColumn,
      sorter
    };
A
afc163 已提交
144
    this.setState(newState);
A
afc163 已提交
145
    this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
A
afc163 已提交
146
  },
A
afc163 已提交
147

Y
yiminghe 已提交
148 149 150 151
  handleFilter(column, filters) {
    filters = objectAssign({}, this.state.filters, {
      [this.getColumnKey(column)]: filters
    });
152 153 154 155 156 157 158
    // Remove filters not in current columns
    const currentColumnKeys = this.props.columns.map(c => this.getColumnKey(c));
    Object.keys(filters).forEach((columnKey) => {
      if (currentColumnKeys.indexOf(columnKey) < 0) {
        delete filters[columnKey];
      }
    });
A
afc163 已提交
159
    const newState = {
Y
yiminghe 已提交
160
      selectedRowKeys: [],
A
afc163 已提交
161
      selectionDirty: false,
A
afc163 已提交
162 163
      filters
    };
A
afc163 已提交
164
    this.setState(newState);
A
afc163 已提交
165
    this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
A
afc163 已提交
166
  },
A
afc163 已提交
167

Y
yiminghe 已提交
168
  handleSelect(record, rowIndex, e) {
A
afc163 已提交
169
    let checked = e.target.checked;
R
RaoHai 已提交
170
    let defaultSelection = [];
A
afc163 已提交
171
    if (!this.state.selectionDirty) {
R
RaoHai 已提交
172 173 174
      defaultSelection = this.getDefaultSelection();
    }
    let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection);
Y
yiminghe 已提交
175
    let key = this.getRecordKey(record, rowIndex);
176
    if (checked) {
Y
yiminghe 已提交
177
      selectedRowKeys.push(this.getRecordKey(record, rowIndex));
178
    } else {
Y
yiminghe 已提交
179 180
      selectedRowKeys = selectedRowKeys.filter((i) => {
        return key !== i;
181 182 183
      });
    }
    this.setState({
R
RaoHai 已提交
184
      selectedRowKeys: selectedRowKeys,
A
afc163 已提交
185
      selectionDirty: true
R
RaoHai 已提交
186 187 188 189 190 191 192 193 194 195 196 197 198
    });
    if (this.props.rowSelection.onSelect) {
      let data = this.getCurrentPageData();
      let selectedRows = data.filter((row, i) => {
        return selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0;
      });
      this.props.rowSelection.onSelect(record, checked, selectedRows);
    }
  },

  handleRadioSelect: function (record, rowIndex, e) {
    let checked = e.target.checked;
    let defaultSelection = [];
A
afc163 已提交
199
    if (!this.state.selectionDirty) {
R
RaoHai 已提交
200 201 202 203 204 205 206 207
      defaultSelection = this.getDefaultSelection();
    }
    let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection);
    let key = this.getRecordKey(record, rowIndex);
    selectedRowKeys = [key];
    this.setState({
      selectedRowKeys: selectedRowKeys,
      radioIndex: record.key,
A
afc163 已提交
208
      selectionDirty: true
209 210
    });
    if (this.props.rowSelection.onSelect) {
Y
yiminghe 已提交
211 212 213
      let data = this.getCurrentPageData();
      let selectedRows = data.filter((row, i) => {
        return selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0;
A
afc163 已提交
214
      });
Y
yiminghe 已提交
215
      this.props.rowSelection.onSelect(record, checked, selectedRows);
216 217
    }
  },
A
afc163 已提交
218

A
afc163 已提交
219 220
  handleSelectAllRow(e) {
    let checked = e.target.checked;
Y
yiminghe 已提交
221
    let data = this.getCurrentPageData();
R
RaoHai 已提交
222 223 224 225 226 227
    let selectedRowKeys = checked ? data.filter((item) => {
      if (this.props.rowSelection.getCheckboxProps) {
        return !this.props.rowSelection.getCheckboxProps(item).disabled;
      }
      return true;
    }).map((item, i) => {
Y
yiminghe 已提交
228 229
      return this.getRecordKey(item, i);
    }) : [];
A
afc163 已提交
230
    this.setState({
R
RaoHai 已提交
231
      selectedRowKeys: selectedRowKeys,
A
afc163 已提交
232
      selectionDirty: true
233 234
    });
    if (this.props.rowSelection.onSelectAll) {
Y
yiminghe 已提交
235 236
      let selectedRows = data.filter((row, i) => {
        return selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0;
A
afc163 已提交
237 238
      });
      this.props.rowSelection.onSelectAll(checked, selectedRows);
A
afc163 已提交
239
    }
A
afc163 已提交
240
  },
A
afc163 已提交
241

242
  handlePageChange(current) {
Y
yiminghe 已提交
243
    let pagination = objectAssign({}, this.state.pagination);
244 245 246 247 248
    if (current) {
      pagination.current = current;
    } else {
      pagination.current = pagination.current || 1;
    }
A
afc163 已提交
249
    const newState = {
Y
yiminghe 已提交
250 251
      // 防止内存泄漏,只维持当页
      selectedRowKeys: [],
A
afc163 已提交
252
      selectionDirty: false,
A
afc163 已提交
253 254
      pagination
    };
A
afc163 已提交
255
    this.setState(newState);
A
afc163 已提交
256
    this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
257
  },
A
afc163 已提交
258

R
RaoHai 已提交
259 260 261
  onRadioChange: function (ev) {
    this.setState({
      radioIndex: ev.target.value
Y
yiminghe 已提交
262
    });
263
  },
A
afc163 已提交
264

R
RaoHai 已提交
265 266 267 268 269 270
  renderSelectionRadio(value, record, index) {
    let rowIndex = this.getRecordKey(record, index); // 从 1 开始
    let props = {};
    if (this.props.rowSelection.getCheckboxProps) {
      props = this.props.rowSelection.getCheckboxProps.call(this, record);
    }
A
afc163 已提交
271 272 273 274 275 276 277
    let checked;
    if (this.state.selectionDirty) {
      checked = this.state.radioIndex === record.key;
    } else {
      checked = (this.state.radioIndex === record.key ||
                 this.getDefaultSelection().indexOf(rowIndex) >= 0);
    }
Y
yiminghe 已提交
278 279
    return <Radio disabled={props.disabled} onChange={this.handleRadioSelect.bind(this, record, rowIndex)}
                  value={record.key} checked={checked}/>;
R
RaoHai 已提交
280 281
  },

282
  renderSelectionCheckBox(value, record, index) {
Y
yiminghe 已提交
283
    let rowIndex = this.getRecordKey(record, index); // 从 1 开始
A
afc163 已提交
284 285 286 287 288 289 290
    let checked;
    if (this.state.selectionDirty) {
      checked = this.state.selectedRowKeys.indexOf(rowIndex) >= 0;
    } else {
      checked = (this.state.selectedRowKeys.indexOf(rowIndex) >= 0 ||
                 this.getDefaultSelection().indexOf(rowIndex) >= 0);
    }
R
RaoHai 已提交
291 292 293 294
    let props = {};
    if (this.props.rowSelection.getCheckboxProps) {
      props = this.props.rowSelection.getCheckboxProps.call(this, record);
    }
Y
yiminghe 已提交
295 296
    return <Checkbox checked={checked} disabled={props.disabled}
                     onChange={this.handleSelect.bind(this, record, rowIndex)}/>;
Y
yiminghe 已提交
297
  },
A
afc163 已提交
298 299

  getRecordKey(record, index) {
300 301 302
    if (this.props.rowKey) {
      return this.props.rowKey(record, index);
    }
Y
yiminghe 已提交
303
    return record.key || index;
304
  },
A
afc163 已提交
305

306
  renderRowSelection() {
Y
yiminghe 已提交
307
    let columns = this.props.columns.concat();
308
    if (this.props.rowSelection) {
309 310 311 312 313 314
      let data = this.getCurrentPageData().filter((item) => {
        if (this.props.rowSelection.getCheckboxProps) {
          return !this.props.rowSelection.getCheckboxProps(item).disabled;
        }
        return true;
      });
Y
yiminghe 已提交
315 316 317 318
      let checked;
      if (!data.length) {
        checked = false;
      } else {
A
afc163 已提交
319 320 321 322 323 324
        checked = this.state.selectionDirty
          ? data.every((item, i) =>
              this.state.selectedRowKeys.indexOf(this.getRecordKey(item, i)) >= 0)
          : data.every((item, i) =>
              this.props.rowSelection.getCheckboxProps &&
              this.props.rowSelection.getCheckboxProps(item).defaultChecked);
Y
yiminghe 已提交
325
      }
R
RaoHai 已提交
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
      let selectionColumn;
      if (this.props.rowSelection.type === 'radio') {
        selectionColumn = {
          key: 'selection-column',
          render: this.renderSelectionRadio,
          className: 'ant-table-selection-column'
        };
      } else {
        let checkboxAll = <Checkbox checked={checked} onChange={this.handleSelectAllRow}/>;
        selectionColumn = {
          key: 'selection-column',
          title: checkboxAll,
          render: this.renderSelectionCheckBox,
          className: 'ant-table-selection-column'
        };
      }
342
      if (columns[0] &&
Y
yiminghe 已提交
343
        columns[0].key === 'selection-column') {
344 345 346 347 348 349 350
        columns[0] = selectionColumn;
      } else {
        columns.unshift(selectionColumn);
      }
    }
    return columns;
  },
Y
yiminghe 已提交
351

A
afc163 已提交
352 353 354 355 356 357 358 359 360 361 362
  getColumnKey(column, index) {
    return column.key || column.dataIndex || index;
  },

  isSortColumn(column) {
    if (!column || !this.state.sortColumn) {
      return false;
    }
    let colKey = this.getColumnKey(column);
    let isSortColumn = (this.getColumnKey(this.state.sortColumn) === colKey);
    return isSortColumn;
Y
yiminghe 已提交
363 364 365
  },

  renderColumnsDropdown(columns) {
B
Benjy Cui 已提交
366
    let locale = objectAssign({}, defaultLocale, this.props.locale);
Y
yiminghe 已提交
367
    return columns.map((column, i) => {
Y
yiminghe 已提交
368
      column = objectAssign({}, column);
A
afc163 已提交
369
      let key = this.getColumnKey(column, i);
A
afc163 已提交
370
      let filterDropdown, sortButton;
371
      if (column.filters && column.filters.length > 0) {
Y
yiminghe 已提交
372
        let colFilters = this.state.filters[key] || [];
A
afc163 已提交
373
        filterDropdown =
B
Benjy Cui 已提交
374
          <FilterDropdown locale={locale} column={column}
A
afc163 已提交
375
                          selectedKeys={colFilters}
Y
yiminghe 已提交
376
                          confirmFilter={this.handleFilter}/>;
A
afc163 已提交
377 378
      }
      if (column.sorter) {
A
afc163 已提交
379
        let isSortColumn = this.isSortColumn(column);
Y
yiminghe 已提交
380 381
        if (isSortColumn) {
          column.className = column.className || '';
A
afc163 已提交
382 383 384
          if (this.state.sortOrder) {
            column.className += ' ant-table-column-sort';
          }
Y
yiminghe 已提交
385
        }
B
Benjy Cui 已提交
386

A
afc163 已提交
387 388
        sortButton = <div className="ant-table-column-sorter">
          <span className={'ant-table-column-sorter-up ' +
389
                           ((isSortColumn && this.state.sortOrder === 'ascend') ? 'on' : 'off')}
A
afc163 已提交
390
                title="↑"
Y
yiminghe 已提交
391
                onClick={this.toggleSortOrder.bind(this, 'ascend', column)}>
Y
yiminghe 已提交
392
            <Icon type="caret-up"/>
A
afc163 已提交
393 394
          </span>
          <span className={'ant-table-column-sorter-down ' +
395
                           ((isSortColumn && this.state.sortOrder === 'descend') ? 'on' : 'off')}
A
afc163 已提交
396
                title="↓"
Y
yiminghe 已提交
397
                onClick={this.toggleSortOrder.bind(this, 'descend', column)}>
Y
yiminghe 已提交
398
            <Icon type="caret-down"/>
A
afc163 已提交
399 400 401
          </span>
        </div>;
      }
A
afc163 已提交
402 403 404 405 406
      column.title = <div>
        {column.title}
        {sortButton}
        {filterDropdown}
      </div>;
A
afc163 已提交
407
      return column;
A
afc163 已提交
408 409
    });
  },
A
afc163 已提交
410

411 412 413 414
  handleShowSizeChange(current, pageSize) {
    let pagination = objectAssign(this.state.pagination, {
      pageSize: pageSize
    });
A
afc163 已提交
415
    this.setState({ pagination });
416 417
  },

418 419
  renderPagination() {
    // 强制不需要分页
Y
yiminghe 已提交
420 421
    if (!this.hasPagination()) {
      return null;
A
afc163 已提交
422
    }
A
afc163 已提交
423 424 425 426
    let classString = classNames({
      'ant-table-pagination': true,
      'mini': this.props.size === 'middle' || this.props.size === 'small',
    });
A
afc163 已提交
427 428 429 430 431 432 433 434
    let total = this.state.pagination.total || this.getLocalData().length;
    return (total > 0) ?
      <Pagination className={classString}
                  onChange={this.handlePageChange}
                  total={total}
                  pageSize={10}
                  onShowSizeChange={this.handleShowSizeChange}
                  {...this.state.pagination} /> : null;
A
afc163 已提交
435
  },
A
afc163 已提交
436

Y
yiminghe 已提交
437
  prepareParamsArguments(state) {
438
    // 准备筛选、排序、分页的参数
439 440 441
    const pagination = state.pagination;
    const filters = state.filters;
    const sorter = {};
Y
yiminghe 已提交
442 443 444 445 446
    if (state.sortColumn &&
      state.sortOrder &&
      state.sortColumn.dataIndex) {
      sorter.field = state.sortColumn.dataIndex;
      sorter.order = state.sortOrder;
A
afc163 已提交
447 448
    }
    return [pagination, filters, sorter];
449
  },
Y
yiminghe 已提交
450

A
afc163 已提交
451
  findColumn(myKey) {
Y
yiminghe 已提交
452 453 454 455 456
    return this.props.columns.filter((c) => {
      return this.getColumnKey(c) === myKey;
    })[0];
  },

A
afc163 已提交
457
  getCurrentPageData(dataSource) {
A
afc163 已提交
458
    let data = this.getLocalData(dataSource);
Y
yiminghe 已提交
459 460 461 462 463 464
    let current, pageSize;
    let state = this.state;
    // 如果没有分页的话,默认全部展示
    if (!this.hasPagination()) {
      pageSize = Number.MAX_VALUE;
      current = 1;
465
    } else {
Y
yiminghe 已提交
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
      pageSize = state.pagination.pageSize;
      current = state.pagination.current;
    }
    // 分页
    // ---
    // 当数据量少于每页数量时,直接设置数据
    // 否则进行读取分页数据
    if (data.length > pageSize || pageSize === Number.MAX_VALUE) {
      data = data.filter((item, i) => {
        if (i >= (current - 1) * pageSize &&
          i < current * pageSize) {
          return item;
        }
      });
    }
    return data;
  },

A
afc163 已提交
484
  getLocalData(dataSource) {
Y
yiminghe 已提交
485
    let state = this.state;
A
afc163 已提交
486
    let data = dataSource || this.props.dataSource;
Y
yiminghe 已提交
487 488 489 490 491 492 493 494
    // 排序
    if (state.sortOrder && state.sorter) {
      data = data.sort(state.sorter);
    }
    // 筛选
    if (state.filters) {
      Object.keys(state.filters).forEach((columnKey) => {
        let col = this.findColumn(columnKey);
495 496 497
        if (!col) {
          return;
        }
Y
yiminghe 已提交
498
        let values = state.filters[columnKey] || [];
A
afc163 已提交
499 500 501
        if (values.length === 0) {
          return;
        }
A
afc163 已提交
502 503 504
        data = col.onFilter ? data.filter(record => {
          return values.some(v => col.onFilter(v, record));
        }) : data;
A
afc163 已提交
505
      });
A
afc163 已提交
506
    }
Y
yiminghe 已提交
507
    return data;
A
afc163 已提交
508
  },
Y
yiminghe 已提交
509 510 511 512

  render() {
    let data = this.getCurrentPageData();
    let columns = this.renderRowSelection();
Z
zhujun24 已提交
513
    let expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
A
afc163 已提交
514 515 516 517 518 519 520

    let classString = classNames({
      [`ant-table-${this.props.size}`]: true,
      'ant-table-bordered': this.props.bordered,
      [this.props.className]: !!this.props.className,
    });

Y
yiminghe 已提交
521
    columns = this.renderColumnsDropdown(columns);
A
afc163 已提交
522
    columns = columns.map((column, i) => {
A
afc163 已提交
523
      column.key = column.key || column.dataIndex || i;
A
afc163 已提交
524 525
      return column;
    });
A
afc163 已提交
526
    let emptyText;
527
    let emptyClass = '';
A
afc163 已提交
528
    if (!data || data.length === 0) {
529
      emptyText = <div className="ant-table-placeholder">
Y
yiminghe 已提交
530
        <Icon type="frown"/>暂无数据
A
afc163 已提交
531
      </div>;
532
      emptyClass = ' ant-table-empty';
A
afc163 已提交
533
    }
A
afc163 已提交
534

A
afc163 已提交
535
    let table = <div>
536 537 538 539 540
      <Table {...this.props}
        data={data}
        columns={columns}
        className={classString}
        expandIconAsCell={expandIconAsCell} />
A
afc163 已提交
541 542
      {emptyText}
    </div>;
A
afc163 已提交
543
    if (this.props.loading) {
K
KgTong 已提交
544 545 546 547
      // if there is no pagination or no data, the height of spin should decrease by half of pagination
      let paginationPatchClass = (this.hasPagination() && data && data.length !== 0)
              ? 'ant-table-with-pagination'
              : 'ant-table-without-pagination';
A
afc163 已提交
548
      let spinClassName = `${paginationPatchClass} ant-table-spin-holder`;
549
      table = <Spin className={spinClassName}>{table}</Spin>;
A
afc163 已提交
550
    }
551 552 553 554 555 556
    return (
      <div className={'clearfix' + emptyClass}>
        {table}
        {this.renderPagination()}
      </div>
    );
A
afc163 已提交
557 558
  }
});
559

dqaria's avatar
dqaria 已提交
560
export default AntTable;