"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = _default;

var _react = _interopRequireDefault(require("react"));

var _classnames2 = _interopRequireDefault(require("classnames"));

var _rcPagination = _interopRequireDefault(require("@titaui/rc-pagination2"));

var _rcSelect = _interopRequireDefault(require("rc-select"));

require("@titaui/rc-pagination2/assets/index.css");

require("./index.css");

require("./select.css");

var _getLocale = require("../../utils/getLocale");

var _zh_CN = _interopRequireDefault(require("./locale/zh_CN"));

var _en_US = _interopRequireDefault(require("./locale/en_US"));

var _excluded = ["className", "size", "selectProps"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(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 _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 _default(props) {
  var className = props.className,
      _props$size = props.size,
      size = _props$size === void 0 ? 'md' : _props$size,
      selectProps = props.selectProps,
      restProps = _objectWithoutProperties(props, _excluded);

  var itemRender = function itemRender(current, type, element) {
    if (type === 'page') {
      return /*#__PURE__*/_react["default"].createElement("a", {
        className: "titaui-pagination-item_text"
      }, current);
    }

    if (type === 'prev') {
      return /*#__PURE__*/_react["default"].createElement("a", {
        className: "titaui-pagination-item_text tu-icon tu-icon-left"
      });
    }

    if (type === 'next') {
      return /*#__PURE__*/_react["default"].createElement("a", {
        className: "titaui-pagination-item_text tu-icon tu-icon-APP-xi"
      });
    }

    if (type === 'jump-prev') {
      return /*#__PURE__*/_react["default"].createElement("a", {
        className: "titaui-pagination-jump-icon"
      }, /*#__PURE__*/_react["default"].createElement("span", {
        className: "tu-icons tu-icon-double-left"
      }), /*#__PURE__*/_react["default"].createElement("span", {
        className: "tu-icon-more1"
      }));
    }

    if (type === 'jump-next') {
      return /*#__PURE__*/_react["default"].createElement("a", {
        className: "titaui-pagination-jump-icon"
      }, /*#__PURE__*/_react["default"].createElement("span", {
        className: "tu-icons tu-icon-double-right"
      }), /*#__PURE__*/_react["default"].createElement("span", {
        className: "tu-icon-more1"
      }));
    }

    return element;
  };

  var classNames = (0, _classnames2["default"])(className, _defineProperty({}, "titaui-pagination__size--".concat(size), size));
  return /*#__PURE__*/_react["default"].createElement(_rcPagination["default"], _extends({
    className: classNames,
    itemRender: itemRender,
    prefixCls: "titaui-pagination",
    selectComponentClass: _rcSelect["default"],
    selectPrefixCls: "titaui-pagination__select",
    showLessItems: false,
    showQuickJumper: true,
    showSizeChanger: true,
    showTitle: false,
    locale: _getLocale.isEn ? _en_US["default"] : _zh_CN["default"],
    selectProps: _objectSpread({
      dropdownAlign: {
        offset: [-25, 0]
      }
    }, selectProps)
  }, restProps));
}