/*
 * @Author: zhoux zhouxia@supervision.ltd
 * @Date: 2023-11-01 13:56:33
 * @LastEditors: zhoux zhouxia@supervision.ltd
 * @LastEditTime: 2023-11-22 14:54:56
 * @FilePath: \general-ai-platform-web\src\pages\System\RoleList\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.Api>[];
  currentRow: API.Api | undefined;
};


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

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

