import _extends from "@babel/runtime/helpers/extends";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import PropTypes from 'prop-types';
import { CommonListLayout } from '../common/CommonListLayout';
import { Pagination } from './Pagination';
import { StoreCounterText } from './StoreCounterText';
import { CounterText } from '../CounterText';
export var ListLayout =
/*#__PURE__*/
function (_React$Component) {
  _inheritsLoose(ListLayout, _React$Component);

  function ListLayout() {
    var _this;

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;

    _defineProperty(_assertThisInitialized(_this), "renderCounterText", function () {
      var _this$props = _this.props,
          hasStoreCounterText = _this$props.hasStoreCounterText,
          store = _this$props.store,
          storeCounterText = _this$props.storeCounterText;

      if (!hasStoreCounterText) {
        return null;
      }

      return React.createElement(StoreCounterText, {
        store: store,
        template: storeCounterText
      });
    });

    _defineProperty(_assertThisInitialized(_this), "renderPagination", function (showPageSizeSelector) {
      if (showPageSizeSelector === void 0) {
        showPageSizeSelector = true;
      }

      var _this$props2 = _this.props,
          paginationProps = _this$props2.paginationProps,
          PaginationComponent = _this$props2.paginationComponent,
          store = _this$props2.store;
      return React.createElement(PaginationComponent, _extends({
        store: store,
        showPageSizeSelector: showPageSizeSelector
      }, paginationProps));
    });

    return _this;
  }

  var _proto = ListLayout.prototype;

  _proto.render = function render() {
    return React.createElement(CommonListLayout, _extends({}, this.props, {
      renderCounterText: this.renderCounterText,
      renderPagination: this.renderPagination
    }));
  };

  return ListLayout;
}(React.Component);

_defineProperty(ListLayout, "propTypes", {
  store: PropTypes.object.isRequired,
  hasStoreCounterText: PropTypes.bool,
  storeCounterText: PropTypes.string,
  paginationProps: PropTypes.shape(Pagination.propTypes),
  paginationComponent: PropTypes.func
});

_defineProperty(ListLayout, "defaultProps", {
  hasStoreCounterText: true,
  storeCounterText: CounterText.defaultProps.template,
  paginationProps: Pagination.defaultProps,
  paginationComponent: Pagination
});

_defineProperty(ListLayout, "VIEW_MODE_DETAILS", CommonListLayout.VIEW_MODE_DETAILS);

_defineProperty(ListLayout, "VIEW_MODE_FULL", CommonListLayout.VIEW_MODE_FULL);