import React from 'react';
import { Table } from 'antd';
import '@platformuiserver/platformui.assets/css/index.less'

export default function DetialTable (props) {
  const {
    columns,
    data = [],
    rowKey = 'id',
    size = 'default',
    scroll,
    onChange,
    total = 0,
    curIndex,
    pageSize = 15,
    pagination = true,
    bordered = false,
    expandedRowRender = false,
    onExpand = false,
    ellipsis = false,
    rowClassName,
    onHeaderRow
  } = props
  return (
    <div>
      <Table
        className="detialTable"
        size={size}
        columns={columns}
        dataSource={data}
        rowKey={rowKey}
        bordered={bordered}
        rowClassName={rowClassName}
        onHeaderRow={onHeaderRow}
        pagination={pagination && {
          size: 'default',
          showQuickJumper: true,
          current: curIndex,
          // showSizeChanger: true,
          pageSize,
          total,
          showTotal: (total) => `共 ${total} 条`
        }}
        ellipsis={ellipsis}
        scroll={scroll}
        onExpand={onExpand}
        expandedRowRender={expandedRowRender}
        onChange={(pagination, filters, sorter, extra) => onChange(pagination, filters, sorter, extra)}
      />
    </div>
  );
}
