/*
 * @Author: zhoux zhouxia@supervision.ltd
 * @Date: 2023-11-01 13:56:33
 * @LastEditors: zhoux zhouxia@supervision.ltd
 * @LastEditTime: 2023-11-02 15:19:11
 * @FilePath: \general-ai-platform-web\src\pages\Resource\AlgorithmModelList\components\ColumnDrawer.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%
 */
import React from "react";
import {Drawer} from "antd";
import {ProColumns, ProDescriptions, ProDescriptionsItemProps} from "@ant-design/pro-components";

export type ColumnDrawProps = {
  handleDrawer: (id?: any)=>void;
  isShowDetail: boolean;
  columns: ProColumns<API.AlgorithmModel>[];
  currentRow: API.AlgorithmModel | undefined;
};

/**
 * @表格列信息展示
 * @param props 
 * @returns 
 */
const ColumnDrawer: React.FC<ColumnDrawProps> = (props) => {

  return (
    <Drawer
      width={500}
      open={props.isShowDetail}
      onClose={() => {
        props.handleDrawer();
      }}
      closable={true}
      extra={
        <>123</>
      }
    >
      {props.currentRow?.id && (
        <ProDescriptions<API.AlgorithmModel>
          column={2}
          title={props.currentRow?.id}
          request={async () => ({
            data: props.currentRow || {},
          })}
          params={{
            id: props.currentRow?.id,
          }}
          columns={props.columns as ProDescriptionsItemProps<API.AlgorithmModel>[]}
        />
      )}
    </Drawer>
  )
}
export {ColumnDrawer}

