/*
 * @Author: your name
<<<<<<< HEAD
 * @Date: 2022-03-09 10:08:00
 * @LastEditTime: 2022-03-15 15:41:42
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
=======
 * @Date: 2021-09-14 11:14:06
 * @LastEditTime: 2022-03-07 11:00:11
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
>>>>>>> master
 * @FilePath: /MedicalWisdomCheckSys/src/components/MccsTable/index.tsx
 */

import React,{useImperativeHandle,useRef} from 'react'
import ProTable, {  } from '@ant-design/pro-table';
import type { ActionType } from '@ant-design/pro-table';
import type { ProFormInstance } from '@ant-design/pro-form';

import './index.less';




const MccsTable=React.forwardRef<MccsTable.MccsTableRef,MccsTable.MccsTable>((props,ref)=>{

    const {columns=[],serach,request,searchNode,...rest} = props;
    const formRef = useRef<ProFormInstance>();
    const tableRef =useRef<ActionType>(); 

    const processColumns = (colums: MccsTable.Columns[])=>{
         return colums.map((item,index)=>{
                return {
                     ...item,
                    //  ellipsis:true
                }
         })
    }

    useImperativeHandle(ref,()=>{
        // getFormRef 就是暴露给父组件的方法
        const getFormRef = ()=>{
            return formRef;
        }
        const getTableRef = ()=>{
            return tableRef;
        }
        return {getFormRef,getTableRef}
    });

    return (
        <React.Fragment >
            <div className='container'>
            <ProTable
                  className='MccsTable'
                  columns={processColumns(columns)}
                  toolBarRender={false}
                  formRef={formRef}
                  actionRef={tableRef}
                  request={request}
                  pagination={{ defaultPageSize: 10 }}
                  {...rest}
            />
            </div>
        </React.Fragment>
    )
})

export default MccsTable

