function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

/* eslint-disable react/no-multi-comp */
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import shallowElementEquals from 'shallow-element-equals';
import Loading from '../loading';
import zhCN from '../locale/zh-cn';
import { log, obj } from '../util';
import BodyComponent from './base/body';
import HeaderComponent from './base/header';
import WrapperComponent from './base/wrapper';
import RowComponent from './base/row';
import CellComponent from './base/cell';
import FilterComponent from './base/filter';
import SortComponent from './base/sort';
import Column from './column';
import ColumnGroup from './column-group';
import guid from '../util/guid';
import AutoWidth from './base/auto-width';
var Children = React.Children;

var noop = function noop() {};

var ColGroup =
/*#__PURE__*/
function (_React$Component) {
  _inherits(ColGroup, _React$Component);

  function ColGroup() {
    _classCallCheck(this, ColGroup);

    return _possibleConstructorReturn(this, _getPrototypeOf(ColGroup).apply(this, arguments));
  }

  _createClass(ColGroup, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var table = this.props.table;
      table.AutoWidth.bindColGroup(this);
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      var table = this.props.table;
      table.AutoWidth.bindColGroup(this);
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props = this.props,
          flatChildren = _this$props.flatChildren,
          table = _this$props.table;
      var cols = flatChildren.map(function (col, index) {
        var width = col.width,
            columnId = col.columnId;
        var style = {};
        var w = width;

        if (width === 'auto' && table.AutoWidth.enable) {
          w = table.AutoWidth.getBestWidth(columnId);
        }

        if (w) {
          style = {
            width: w
          };
        }

        return React.createElement("col", {
          style: style,
          key: index
        });
      });
      return React.createElement("colgroup", {
        key: "table-colgroup"
      }, cols);
    }
  }]);

  return ColGroup;
}(React.Component);
/** Table */


var Table =
/*#__PURE__*/
function (_React$Component2) {
  _inherits(Table, _React$Component2);

  function Table(props, context) {
    var _this;

    _classCallCheck(this, Table);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(Table).call(this, props, context));

    _defineProperty(_assertThisInitialized(_this), "state", {
      sort: _this.props.sort || {}
    });

    _defineProperty(_assertThisInitialized(_this), "renderColGroup", function (flatChildren) {
      return React.createElement(ColGroup, {
        flatChildren: flatChildren,
        table: _assertThisInitialized(_this)
      });
    });

    _defineProperty(_assertThisInitialized(_this), "onSort", function (dataIndex, order, sort) {
      if (typeof _this.props.sort === 'undefined') {
        _this.setState({
          sort: sort
        }, function () {
          _this.props.onSort(dataIndex, order, sort);
        });
      } else {
        _this.props.onSort(dataIndex, order, sort);
      }
    });

    _defineProperty(_assertThisInitialized(_this), "onFilter", function (filterParams) {
      _this.props.onFilter(filterParams);
    });

    _defineProperty(_assertThisInitialized(_this), "onResizeChange", function (dataIndex, value) {
      _this.props.onResizeChange(dataIndex, value);
    });

    _defineProperty(_assertThisInitialized(_this), "getWrapperRef", function (wrapper) {
      if (!wrapper) {
        return _this.wrapper;
      }

      _this.wrapper = wrapper;
    });

    _defineProperty(_assertThisInitialized(_this), "getAffixRef", function (affixRef) {
      if (!affixRef) {
        return _this.affixRef;
      }

      _this.affixRef = affixRef;
    });

    _defineProperty(_assertThisInitialized(_this), "getHeaderCellRef", function (i, j, cell) {
      var cellRef = "header_cell_".concat(i, "_").concat(j);

      if (!cell) {
        return _this[cellRef];
      }

      _this[cellRef] = cell;
    });

    _defineProperty(_assertThisInitialized(_this), "getRowRef", function (i, row) {
      var rowRef = "row_".concat(i);

      if (!row) {
        return _this[rowRef];
      }

      _this[rowRef] = row;
    });

    _defineProperty(_assertThisInitialized(_this), "getCellRef", function (i, j, cell) {
      var cellRef = "cell_".concat(i, "_").concat(j);

      if (!cell) {
        return _this[cellRef];
      }

      _this[cellRef] = cell;
    });

    var _this$context = _this.context,
        getTableInstance = _this$context.getTableInstance,
        getTableInstanceForVirtual = _this$context.getTableInstanceForVirtual;
    getTableInstance && getTableInstance(props.lockType, _assertThisInitialized(_this));
    getTableInstanceForVirtual && getTableInstanceForVirtual(props.lockType, _assertThisInitialized(_this));
    _this.notRenderCellIndex = [];
    _this.refColGroup = null;
    _this.AutoWidth = new AutoWidth({
      padding: 15,
      table: _assertThisInitialized(_this)
    });
    return _this;
  }

  _createClass(Table, [{
    key: "getChildContext",
    value: function getChildContext() {
      return {
        notRenderCellIndex: this.notRenderCellIndex,
        lockType: this.props.lockType
      };
    }
  }, {
    key: "UNSAFE_componentWillReceiveProps",
    value: function UNSAFE_componentWillReceiveProps(nextProps) {
      if (typeof this.props.sort !== 'undefined') {
        this.setState({
          sort: nextProps.sort
        });
      }
    }
  }, {
    key: "shouldComponentUpdate",
    value: function shouldComponentUpdate(nextProps, nextState, nextContext) {
      if (nextProps.pure) {
        var isEqual = shallowElementEquals(nextProps, this.props) && obj.shallowEqual(nextState, this.state) && obj.shallowEqual(nextContext, this.context);
        return !isEqual;
      }

      return true;
    }
  }, {
    key: "UNSAFE_componentWillUpdate",
    value: function UNSAFE_componentWillUpdate() {
      this.notRenderCellIndex = [];
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      if (this.AutoWidth && this.AutoWidth.enable) {
        this.AutoWidth.calcAndUpdate();
      }
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      if (this.AutoWidth && this.AutoWidth.enable) {
        this.AutoWidth.calcAndUpdate();
      }
    }
  }, {
    key: "normalizeChildrenState",
    value: function normalizeChildrenState(props) {
      var columns = props.columns;

      if (props.children) {
        columns = this.normalizeChildren(props);
      }

      return this.fetchInfoFromBinaryChildren(columns);
    } // 将React结构化数据提取props转换成数组

  }, {
    key: "normalizeChildren",
    value: function normalizeChildren(props) {
      var columns = props.columns;

      var getChildren = function getChildren(children) {
        var ret = [];
        Children.forEach(children, function (child) {
          if (child) {
            var _props = _objectSpread({}, child.props);

            if (!(child && typeof child.type === 'function' && (child.type._typeMark === 'column' || child.type._typeMark === 'columnGroup'))) {
              log.warning('Use <Table.Column/>, <Table.ColumnGroup/> as child.');
            }

            ret.push(_props);

            if (child.props.children) {
              _props.children = getChildren(child.props.children);
            }
          }
        });
        return ret;
      };

      if (props.children) {
        columns = getChildren(props.children);
      }

      return columns;
    }
  }, {
    key: "fetchInfoFromBinaryChildren",
    value: function fetchInfoFromBinaryChildren(children) {
      var _this2 = this;

      var hasGroupHeader = false;
      var flatChildren = [];
      var groupChildren = [];

      var getChildren = function getChildren(propsChildren, level) {
        groupChildren[level] = groupChildren[level] || [];
        propsChildren.forEach(function (child) {
          if (child.children) {
            hasGroupHeader = true;
            getChildren(child.children, level + 1);
          } else {
            child.columnId = guid('cloumn-');

            if (_this2.AutoWidth.enable) {
              _this2.AutoWidth.analyzeColDefine(child);
            }

            flatChildren.push(child);
          }

          groupChildren[level].push(child);
        });
      };

      var getColSpan = function getColSpan(children, colSpan) {
        colSpan = colSpan || 0;
        children.forEach(function (child) {
          if (child.children) {
            colSpan = getColSpan(child.children, colSpan);
          } else {
            colSpan += 1;
          }
        });
        return colSpan;
      };

      getChildren(children, 0);
      groupChildren.forEach(function (groupChild, i) {
        groupChild.forEach(function (child, j) {
          var colSpan;
          var children = child.children;

          if (children) {
            colSpan = getColSpan(children);
            child.colSpan = colSpan;
            groupChildren[i][j] = child;
          }
        });
      });
      return {
        flatChildren: flatChildren,
        groupChildren: groupChildren,
        hasGroupHeader: hasGroupHeader
      };
    }
  }, {
    key: "renderTable",
    // 通过头部和扁平的结构渲染表格
    value: function renderTable(groupChildren, flatChildren) {
      if (flatChildren.length || !flatChildren.length && !this.props.lockType) {
        var _this$props2 = this.props,
            hasHeader = _this$props2.hasHeader,
            components = _this$props2.components,
            prefix = _this$props2.prefix,
            wrapperContent = _this$props2.wrapperContent,
            filterParams = _this$props2.filterParams,
            locale = _this$props2.locale,
            dataSource = _this$props2.dataSource,
            emptyContent = _this$props2.emptyContent,
            loading = _this$props2.loading,
            primaryKey = _this$props2.primaryKey,
            cellProps = _this$props2.cellProps,
            rowProps = _this$props2.rowProps,
            onRowClick = _this$props2.onRowClick,
            onRowMouseEnter = _this$props2.onRowMouseEnter,
            onRowMouseLeave = _this$props2.onRowMouseLeave,
            expandedIndexSimulate = _this$props2.expandedIndexSimulate,
            pure = _this$props2.pure,
            rtl = _this$props2.rtl,
            sortIcons = _this$props2.sortIcons;
        var sort = this.state.sort;
        var _components$Header = components.Header,
            Header = _components$Header === void 0 ? HeaderComponent : _components$Header,
            _components$Wrapper = components.Wrapper,
            Wrapper = _components$Wrapper === void 0 ? WrapperComponent : _components$Wrapper,
            _components$Body = components.Body,
            Body = _components$Body === void 0 ? BodyComponent : _components$Body;
        var colGroup = this.renderColGroup(flatChildren);
        return React.createElement(Wrapper, {
          colGroup: colGroup,
          ref: this.getWrapperRef,
          prefix: prefix
        }, hasHeader ? React.createElement(Header, {
          prefix: prefix,
          rtl: rtl,
          pure: pure,
          affixRef: this.getAffixRef,
          colGroup: colGroup,
          className: "".concat(prefix, "table-header"),
          filterParams: filterParams,
          columns: groupChildren,
          locale: locale,
          headerCellRef: this.getHeaderCellRef,
          components: components,
          onFilter: this.onFilter,
          sort: sort,
          onResizeChange: this.onResizeChange,
          onSort: this.onSort,
          sortIcons: sortIcons,
          table: this
        }) : null, React.createElement(Body, {
          prefix: prefix,
          rtl: rtl,
          pure: pure,
          colGroup: colGroup,
          className: "".concat(prefix, "table-body"),
          components: components,
          loading: loading,
          emptyContent: emptyContent,
          getCellProps: cellProps,
          primaryKey: primaryKey,
          getRowProps: rowProps,
          columns: flatChildren,
          rowRef: this.getRowRef,
          cellRef: this.getCellRef,
          onRowClick: onRowClick,
          expandedIndexSimulate: expandedIndexSimulate,
          onRowMouseEnter: onRowMouseEnter,
          onRowMouseLeave: onRowMouseLeave,
          dataSource: dataSource,
          locale: locale,
          table: this
        }), wrapperContent);
      } else {
        return null;
      }
    }
  }, {
    key: "render",
    value: function render() {
      var _classnames;

      if (this.AutoWidth && this.AutoWidth.enable) {
        this.AutoWidth.init();
      }

      var ret = this.normalizeChildrenState(this.props);
      this.groupChildren = ret.groupChildren;
      this.flatChildren = ret.flatChildren;
      /* eslint-disable no-unused-vars, prefer-const */

      var table = this.renderTable(ret.groupChildren, ret.flatChildren);

      var _this$props3 = this.props,
          className = _this$props3.className,
          hasBorder = _this$props3.hasBorder,
          isZebra = _this$props3.isZebra,
          loading = _this$props3.loading,
          hasHeader = _this$props3.hasHeader,
          prefix = _this$props3.prefix,
          dataSource = _this$props3.dataSource,
          entireDataSource = _this$props3.entireDataSource,
          onSort = _this$props3.onSort,
          onResizeChange = _this$props3.onResizeChange,
          onRowClick = _this$props3.onRowClick,
          onRowMouseEnter = _this$props3.onRowMouseEnter,
          onRowMouseLeave = _this$props3.onRowMouseLeave,
          onFilter = _this$props3.onFilter,
          rowProps = _this$props3.rowProps,
          cellProps = _this$props3.cellProps,
          primaryKey = _this$props3.primaryKey,
          components = _this$props3.components,
          wrapperContent = _this$props3.wrapperContent,
          lockType = _this$props3.lockType,
          locale = _this$props3.locale,
          expandedIndexSimulate = _this$props3.expandedIndexSimulate,
          refs = _this$props3.refs,
          pure = _this$props3.pure,
          rtl = _this$props3.rtl,
          emptyContent = _this$props3.emptyContent,
          filterParams = _this$props3.filterParams,
          columns = _this$props3.columns,
          sortIcons = _this$props3.sortIcons,
          _this$props3$loadingC = _this$props3.loadingComponent,
          LoadingComponent = _this$props3$loadingC === void 0 ? Loading : _this$props3$loadingC,
          others = _objectWithoutProperties(_this$props3, ["className", "hasBorder", "isZebra", "loading", "hasHeader", "prefix", "dataSource", "entireDataSource", "onSort", "onResizeChange", "onRowClick", "onRowMouseEnter", "onRowMouseLeave", "onFilter", "rowProps", "cellProps", "primaryKey", "components", "wrapperContent", "lockType", "locale", "expandedIndexSimulate", "refs", "pure", "rtl", "emptyContent", "filterParams", "columns", "sortIcons", "loadingComponent"]);

      var cls = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(prefix, "table"), true), _defineProperty(_classnames, 'only-bottom-border', !hasBorder), _defineProperty(_classnames, 'no-header', !hasHeader), _defineProperty(_classnames, "zebra", isZebra), _defineProperty(_classnames, className, className), _classnames));

      if (rtl) {
        others.dir = 'rtl';
      }

      var content = React.createElement("div", _extends({
        className: cls
      }, others), table);

      if (loading) {
        var loadingClassName = "".concat(prefix, "table-loading");
        return React.createElement(LoadingComponent, {
          className: loadingClassName
        }, content);
      }

      return content;
    }
  }]);

  return Table;
}(React.Component);

_defineProperty(Table, "displayName", 'Table');

_defineProperty(Table, "Column", Column);

_defineProperty(Table, "ColumnGroup", ColumnGroup);

_defineProperty(Table, "Header", HeaderComponent);

_defineProperty(Table, "Body", BodyComponent);

_defineProperty(Table, "Wrapper", WrapperComponent);

_defineProperty(Table, "Row", RowComponent);

_defineProperty(Table, "Cell", CellComponent);

_defineProperty(Table, "Filter", FilterComponent);

_defineProperty(Table, "Sort", SortComponent);

_defineProperty(Table, "propTypes", {
  /**
   * 样式类名的品牌前缀
   */
  prefix: PropTypes.string,
  pure: PropTypes.bool,
  rtl: PropTypes.bool,

  /**
   * 自定义类名
   */
  className: PropTypes.string,

  /**
   * 自定义内联样式
   */
  style: PropTypes.object,

  /**
   * 表格展示的数据源
   */
  dataSource: PropTypes.array,
  entireDataSource: PropTypes.array,

  /**
   * 点击表格每一行触发的事件
   * @param {Object} record 该行所对应的数据
   * @param {Number} index 该行所对应的序列
   * @param {Event} e DOM事件对象
   */
  onRowClick: PropTypes.func,

  /**
   * 悬浮在表格每一行的时候触发的事件
   * @param {Object} record 该行所对应的数据
   * @param {Number} index 该行所对应的序列
   * @param {Event} e DOM事件对象
   */
  onRowMouseEnter: PropTypes.func,

  /**
   * 离开表格每一行的时候触发的事件
   * @param {Object} record 该行所对应的数据
   * @param {Number} index 该行所对应的序列
   * @param {Event} e DOM事件对象
   */
  onRowMouseLeave: PropTypes.func,

  /**
   * 点击列排序触发的事件
   * @param {String} dataIndex 指定的排序的字段
   * @param {String} order 排序对应的顺序, 有`desc`和`asc`两种
   */
  onSort: PropTypes.func,

  /**
   * 点击过滤确认按钮触发的事件
   * @param {Object} filterParams 过滤的字段信息
   */
  onFilter: PropTypes.func,

  /**
   * 重设列尺寸的时候触发的事件
   * @param {String} dataIndex 指定重设的字段
   * @param {Number} value 列宽变动的数值
   */
  onResizeChange: PropTypes.func,

  /**
   * 设置每一行的属性，如果返回值和其他针对行操作的属性冲突则无效。
   * @param {Object} record 该行所对应的数据
   * @param {Number} index 该行所对应的序列
   * @returns {Object} 需要设置的行属性
   */
  rowProps: PropTypes.func,

  /**
   * 设置单元格的属性，通过该属性可以进行合并单元格
   * @param {Number} rowIndex 该行所对应的序列
   * @param {Number} colIndex 该列所对应的序列
   * @param {String} dataIndex 该列所对应的字段名称
   * @param {Object} record 该行对应的记录
   * @returns {Object} 返回td元素的所支持的属性对象
   */
  cellProps: PropTypes.func,

  /**
   * 表格是否具有边框
   */
  hasBorder: PropTypes.bool,

  /**
   * 表格是否具有头部
   */
  hasHeader: PropTypes.bool,

  /**
   * 表格是否是斑马线
   */
  isZebra: PropTypes.bool,

  /**
   * 表格是否在加载中
   */
  loading: PropTypes.bool,

  /**
   * 自定义 Loading 组件
   * 请务必传递 props, 使用方式： loadingComponent={props => <Loading {...props}/>}
   * @param {Object} props 当前点击行的key
   */
  loadingComponent: PropTypes.func,

  /**
   * 当前过滤的的keys,使用此属性可以控制表格的头部的过滤选项中哪个菜单被选中,格式为 {dataIndex: {selectedKeys:[]}}
   * 示例:
   * 假设要控制dataIndex为id的列的过滤菜单中key为one的菜单项选中
   * `<Table filterParams={{id: {selectedKeys: ['one']}}}/>`
   */
  filterParams: PropTypes.object,

  /**
   * 当前排序的字段,使用此属性可以控制表格的字段的排序,格式为{dataIndex: 'asc'}
   */
  sort: PropTypes.object,

  /**
   * 自定义排序按钮，例如上下排布的: `{desc: <Icon style={{top: '6px', left: '4px'}} type={'chevron-down'} size="small" />, asc: <Icon style={{top: '-6px', left: '4px'}} type={'chevron-up'} size="small" />}`
   */
  sortIcons: PropTypes.object,

  /**
   * 自定义国际化文案对象
   * @property {String} ok 过滤器中确认按钮文案
   * @property {String} reset 过滤器中重置按钮文案
   * @property {String} empty 没有数据情况下 table内的文案
   * @property {String} asc 排序升序状态下的文案
   * @property {String} desc 排序将序状态下的文案
   * @property {String} expanded 可折叠行，展开状态下的文案
   * @property {String} folded 可折叠行，折叠状态下的文案
   * @property {String} filter 过滤器文案
   * @property {String} selectAll header里全选的按钮文案
   */
  locale: PropTypes.object,
  components: PropTypes.object,
  columns: PropTypes.array,

  /**
   * 设置数据为空的时候的表格内容展现
   */
  emptyContent: PropTypes.node,

  /**
   * dataSource当中数据的主键，如果给定的数据源中的属性不包含该主键，会造成选择状态全部选中
   */
  primaryKey: PropTypes.string,
  lockType: PropTypes.oneOf(['left', 'right']),
  wrapperContent: PropTypes.any,
  refs: PropTypes.object,

  /**
   * 额外渲染行的渲染函数
   * @param {Object} record 该行所对应的数据
   * @param {Number} index 该行所对应的序列
   * @returns {Element} 渲染内容
   */
  expandedRowRender: PropTypes.func,

  /**
   * 额外渲染行的缩进
   */
  expandedRowIndent: PropTypes.array,

  /**
   * 默认情况下展开的渲染行或者Tree, 传入此属性为受控状态
   */
  openRowKeys: PropTypes.array,

  /**
   * 是否显示点击展开额外渲染行的+号按钮
   */
  hasExpandedRowCtrl: PropTypes.bool,

  /**
   * 设置额外渲染行的属性
   */
  getExpandedColProps: PropTypes.func,

  /**
   * 在额外渲染行或者Tree展开或者收起的时候触发的事件
   * @param {Array} openRowKeys 展开的渲染行的key
   * @param {String} currentRowKey 当前点击的渲染行的key
   * @param {Boolean} expanded 当前点击是展开还是收起
   * @param {Object} currentRecord 当前点击额外渲染行的记录
   */
  onRowOpen: PropTypes.func,

  /**
   * 点击额外渲染行触发的事件
   * @param {Object} record 该行所对应的数据
   * @param {Number} index 该行所对应的序列
   * @param {Event} e DOM事件对象
   */
  onExpandedRowClick: PropTypes.func,

  /**
   * 表头是否固定，该属性配合maxBodyHeight使用，当内容区域的高度超过maxBodyHeight的时候，在内容区域会出现滚动条
   */
  fixedHeader: PropTypes.bool,

  /**
   * 最大内容区域的高度,在`fixedHeader`为`true`的时候,超过这个高度会出现滚动条
   */
  maxBodyHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),

  /**
   * 是否启用选择模式
   * @property {Function} getProps `Function(record, index)=>Object` 获取selection的默认属性
   * @property {Function} onChange `Function(selectedRowKeys:Array, records:Array)` 选择改变的时候触发的事件，**注意:** 其中records只会包含当前dataSource的数据，很可能会小于selectedRowKeys的长度。
   * @property {Function} onSelect `Function(selected:Boolean, record:Object, records:Array)` 用户手动选择/取消选择某行的回调
   * @property {Function} onSelectAll `Function(selected:Boolean, records:Array)` 用户手动选择/取消选择所有行的回调
   * @property {Array} selectedRowKeys 设置了此属性,将rowSelection变为受控状态,接收值为该行数据的primaryKey的值
   * @property {String} mode 选择selection的模式, 可选值为`single`, `multiple`，默认为`multiple`
   * @property {Function} columnProps `Function()=>Object` 选择列 的props，例如锁列、对齐等，可使用`Table.Column` 的所有参数
   * @property {Function} titleProps `Function()=>Object` 选择列 表头的props，仅在 `multiple` 模式下生效
   * @property {Function} titleAddons `Function()=>Node` 选择列 表头添加的元素，在`single` `multiple` 下都生效
   */
  rowSelection: PropTypes.object,

  /**
   * 表头是否是sticky
   */
  stickyHeader: PropTypes.bool,

  /**
   * 距离窗口顶部达到指定偏移量后触发
   */
  offsetTop: PropTypes.number,

  /**
   * affix组件的的属性
   */
  affixProps: PropTypes.object,

  /**
   * 在tree模式下的缩进尺寸， 仅在isTree为true时候有效
   */
  indent: PropTypes.number,

  /**
   * 开启Table的tree模式, 接收的数据格式中包含children则渲染成tree table
   */
  isTree: PropTypes.bool,

  /**
   * 是否开启虚拟滚动
   */
  useVirtual: PropTypes.bool,

  /**
   * 设置行高
   */
  rowHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),

  /**
   * 在内容区域滚动的时候触发的函数
   */
  onBodyScroll: PropTypes.func,

  /**
   * 开启时，getExpandedColProps() / rowProps() / expandedRowRender() 的第二个参数 index (该行所对应的序列) 将按照01,2,3,4...的顺序返回，否则返回真实index(0,2,4,6... / 1,3,5,7...)
   */
  expandedIndexSimulate: PropTypes.bool
});

_defineProperty(Table, "defaultProps", {
  dataSource: [],
  onRowClick: noop,
  onRowMouseEnter: noop,
  onRowMouseLeave: noop,
  onSort: noop,
  onFilter: noop,
  onResizeChange: noop,
  rowProps: noop,
  cellProps: noop,
  prefix: 'next-',
  hasBorder: true,
  hasHeader: true,
  isZebra: false,
  loading: false,
  expandedIndexSimulate: false,
  primaryKey: 'id',
  components: {},
  locale: zhCN.Table
});

_defineProperty(Table, "childContextTypes", {
  notRenderCellIndex: PropTypes.array,
  lockType: PropTypes.oneOf(['left', 'right'])
});

_defineProperty(Table, "contextTypes", {
  getTableInstance: PropTypes.func,
  getTableInstanceForVirtual: PropTypes.func
});

export { Table as default };