import React from 'react';
import { Table } from 'antd';
import TableBetweenBox from './TableBetweenBox';
import TableLayout from '../../components/TableLayout';
import './index.less';


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 (
    <div className={`lm-c-table-widthout-title ${className}`}>
      <TableBetweenBox
        inputDefaultValue={inputDefaultValue}
        onClick={onClick}
        btnIcon={btnIcon}
        btnText={btnText}
        onChange={onChange}
        placeholder={placeholder}
        renderLeft={renderLeft}
        renderRight={renderRight}
        hasSearch={hasSearch}
        actionName={actionName}
        SearchStyle={SearchStyle}
      />
      <TableLayout cutNum={cutNum} className={layoutClass}>
        <Table  {...params} />
      </TableLayout>
    </div>
  );
}
export default TableWithoutTitle;
