import React__default from 'react';
import { Button, Table } from 'antd';
import IconFont from '../IconFont/index.js';
import SearchInput from '../SearchInput/index.js';
import BetweenBox from '../BetweenBox/index.js';
import AuthComponent from '../AuthComponent/index.js';
import TableLayout from '../TableLayout/index.js';
import '../_rollupPluginBabelHelpers-736b301a.js';
import '@zenview/micro-utils';
import 'lodash';
import '@zenview/micro-basic-library';

function TableBetweenBox(props) {
  const {
    onClick,
    btnIcon,
    btnText,
    onChange,
    inputDefaultValue,
    placeholder,
    renderLeft = null,
    renderRight = null,
    hasSearch = true,
    actionName,
    SearchStyle
  } = props;
  const AuthView = ({
    children
  }) => {
    return actionName ? /*#__PURE__*/React__default.createElement(AuthComponent, {
      actionName: actionName
    }, children) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
  };
  return /*#__PURE__*/React__default.createElement(BetweenBox, {
    left: /*#__PURE__*/React__default.createElement("div", null, btnText && /*#__PURE__*/React__default.createElement(AuthView, null, /*#__PURE__*/React__default.createElement(Button, {
      type: "primary",
      onClick: onClick
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: btnIcon
    }), btnText)), renderLeft),
    right: /*#__PURE__*/React__default.createElement("div", null, renderRight, hasSearch && /*#__PURE__*/React__default.createElement(SearchInput, {
      style: Object.assign({
        width: 252,
        marginRight: 2
      }, SearchStyle),
      onChange: onChange,
      isEnterKey: true,
      value: inputDefaultValue,
      placeholder: placeholder
    }))
  });
}

function TableWithoutTitle(props) {
  const {
    btnText,
    btnIcon = 'icon-S_Edit_LinePlus',
    placeholder,
    onClick,
    onChange,
    inputDefaultValue,
    renderLeft,
    renderRight,
    hasSearch,
    className = '',
    actionName,
    cutNum = 140,
    layoutClass = '',
    SearchStyle = '',
    ...params
  } = props;
  params.pagination = params.pagination && Object.assign({}, {
    showQuickJumper: true,
    showSizeChanger: true,
    pageSizeOptions: ['10', '20', '50', '100', '200'],
    showTotal: function (total) {
      const totalPage = Math.ceil(total / params.pagination.pageSize);
      return `共${totalPage}页 / 共${total}条记录`;
    }
  }, params.pagination);
  return /*#__PURE__*/React__default.createElement("div", {
    className: `lm-c-table-widthout-title ${className}`
  }, /*#__PURE__*/React__default.createElement(TableBetweenBox, {
    inputDefaultValue: inputDefaultValue,
    onClick: onClick,
    btnIcon: btnIcon,
    btnText: btnText,
    onChange: onChange,
    placeholder: placeholder,
    renderLeft: renderLeft,
    renderRight: renderRight,
    hasSearch: hasSearch,
    actionName: actionName,
    SearchStyle: SearchStyle
  }), /*#__PURE__*/React__default.createElement(TableLayout, {
    cutNum: cutNum,
    className: layoutClass
  }, /*#__PURE__*/React__default.createElement(Table, params)));
}

export { TableWithoutTitle as default };
//# sourceMappingURL=index.js.map
