/*
 * @Author: zhoux zhouxia@supervision.ltd
 * @Date: 2023-11-01 13:56:33
 * @LastEditors: zhoux zhouxia@supervision.ltd
 * @LastEditTime: 2023-12-06 16:16:10
 * @FilePath: \general-ai-platform-web\src\pages\Resource\ModelCategoryList\components\ColumnDrawer.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
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.ModelCategory>[];
  currentRow: Record<string,any>;
};


const ColumnDrawer: React.FC<ColumnDrawProps> = (props) => {

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

