text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  
  var _react = require('react');
  
  var _react2 = _interopRequireDefault(_react);
  
  var _propTypes = require('prop-types');
  
  var _propTypes2 = _interopRequireDefault(_propTypes);
  
  var _classnames = require('classnames');
  
  var _classnames2 = _interopRequireDefault(_classnames);
  
  var _header = require('./header');
  
  var _header2 = _interopRequireDefault(_header);
  
  var _caption = require('./caption');
  
  var _caption2 = _interopRequireDefault(_caption);
  
  var _body = require('./body');
  
  var _body2 = _interopRequireDefault(_body);
  
  var _propsResolver = require('./props-resolver');
  
  var _propsResolver2 = _interopRequireDefault(_propsResolver);
  
  var _const = require('./const');
  
  var _const2 = _interopRequireDefault(_const);
  
  var _selection = require('./store/selection');
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint arrow-body-style: 0 */
  
  var BootstrapTable = function (_PropsBaseResolver) {
    _inherits(BootstrapTable, _PropsBaseResolver);
  
    function BootstrapTable(props) {
      _classCallCheck(this, BootstrapTable);
  
      var _this = _possibleConstructorReturn(this, (BootstrapTable.__proto__ || Object.getPrototypeOf(BootstrapTable)).call(this, props));
  
      _this.validateProps();
  
      _this.state = {
        data: props.data
      };
      return _this;
    }
  
    _createClass(BootstrapTable, [{
      key: 'componentWillReceiveProps',
      value: function componentWillReceiveProps(nextProps) {
        this.setState({
          data: nextProps.data
        });
      }
    }, {
      key: 'render',
      value: function render() {
        var _props = this.props,
            loading = _props.loading,
            overlay = _props.overlay;
  
        var table = this.renderTable();
        if (loading && overlay) {
          var LoadingOverlay = overlay(table, loading);
          return _react2.default.createElement(LoadingOverlay, null);
        }
        return table;
      }
    }, {
      key: 'renderTable',
      value: function renderTable() {
        var _props2 = this.props,
            store = _props2.store,
            columns = _props2.columns,
            keyField = _props2.keyField,
            id = _props2.id,
            classes = _props2.classes,
            striped = _props2.striped,
            hover = _props2.hover,
            bordered = _props2.bordered,
            condensed = _props2.condensed,
            noDataIndication = _props2.noDataIndication,
            caption = _props2.caption,
            rowStyle = _props2.rowStyle,
            rowClasses = _props2.rowClasses,
            rowEvents = _props2.rowEvents;
  
  
        var tableClass = (0, _classnames2.default)('table', {
          'table-striped': striped,
          'table-hover': hover,
          'table-bordered': bordered,
          'table-condensed': condensed
        }, classes);
  
        var cellSelectionInfo = this.resolveSelectRowProps({
          onRowSelect: this.props.onRowSelect
        });
  
        var headerCellSelectionInfo = this.resolveSelectRowPropsForHeader({
          onAllRowsSelect: this.props.onAllRowsSelect,
          selected: store.selected,
          allRowsSelected: (0, _selection.isSelectedAll)(store)
        });
  
        var tableCaption = caption && _react2.default.createElement(
          _caption2.default,
          null,
          caption
        );
  
        return _react2.default.createElement(
          'div',
          { className: 'react-bootstrap-table' },
          _react2.default.createElement(
            'table',
            { id: id, className: tableClass },
            tableCaption,
            _react2.default.createElement(_header2.default, {
              columns: columns,
              sortField: store.sortField,
              sortOrder: store.sortOrder,
              onSort: this.props.onSort,
              onFilter: this.props.onFilter,
              selectRow: headerCellSelectionInfo
            }),
            _react2.default.createElement(_body2.default, {
              data: this.state.data,
              keyField: keyField,
              columns: columns,
              isEmpty: this.isEmpty(),
              visibleColumnSize: this.visibleColumnSize(),
              noDataIndication: noDataIndication,
              cellEdit: this.props.cellEdit || {},
              selectRow: cellSelectionInfo,
              selectedRowKeys: store.selected,
              rowStyle: rowStyle,
              rowClasses: rowClasses,
              rowEvents: rowEvents
            })
          )
        );
      }
    }]);
  
    return BootstrapTable;
  }((0, _propsResolver2.default)(_react.Component));
  
  BootstrapTable.propTypes = {
    keyField: _propTypes2.default.string.isRequired,
    data: _propTypes2.default.array.isRequired,
    columns: _propTypes2.default.array.isRequired,
    remote: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.shape({
      pagination: _propTypes2.default.bool
    })]),
    store: _propTypes2.default.object,
    noDataIndication: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
    striped: _propTypes2.default.bool,
    bordered: _propTypes2.default.bool,
    hover: _propTypes2.default.bool,
    id: _propTypes2.default.string,
    classes: _propTypes2.default.string,
    condensed: _propTypes2.default.bool,
    caption: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.string]),
    pagination: _propTypes2.default.object,
    filter: _propTypes2.default.object,
    cellEdit: _propTypes2.default.object,
    selectRow: _propTypes2.default.shape({
      mode: _propTypes2.default.oneOf([_const2.default.ROW_SELECT_SINGLE, _const2.default.ROW_SELECT_MULTIPLE]).isRequired,
      clickToSelect: _propTypes2.default.bool,
      clickToEdit: _propTypes2.default.bool,
      onSelect: _propTypes2.default.func,
      onSelectAll: _propTypes2.default.func,
      style: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]),
      classes: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
      nonSelectable: _propTypes2.default.array,
      bgColor: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
      hideSelectColumn: _propTypes2.default.bool
    }),
    onRowSelect: _propTypes2.default.func,
    onAllRowsSelect: _propTypes2.default.func,
    rowStyle: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]),
    rowEvents: _propTypes2.default.object,
    rowClasses: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]),
    defaultSorted: _propTypes2.default.arrayOf(_propTypes2.default.shape({
      dataField: _propTypes2.default.string.isRequired,
      order: _propTypes2.default.oneOf([_const2.default.SORT_DESC, _const2.default.SORT_ASC]).isRequired
    })),
    defaultSortDirection: _propTypes2.default.oneOf([_const2.default.SORT_DESC, _const2.default.SORT_ASC]),
    overlay: _propTypes2.default.func,
    onTableChange: _propTypes2.default.func,
    onSort: _propTypes2.default.func,
    onFilter: _propTypes2.default.func
  };
  
  BootstrapTable.defaultProps = {
    remote: false,
    striped: false,
    bordered: true,
    hover: false,
    condensed: false,
    noDataIndication: null
  };
  
  exports.default = BootstrapTable;