/*
 * @Author: wuhao930406 1148547900@qq.com
 * @Date: 2023-08-14 15:27:40
 * @LastEditors: wuhao930406 1148547900@qq.com
 * @LastEditTime: 2023-08-14 15:43:08
 * @FilePath: /wms/src/components/DrawInitForm/index.jsx
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 */
import InitForm from "../InitForm";
import { Drawer } from "antd";
import React, { useState, memo } from "react";
import Details from "../Details/detail";
// title="Basic Drawer"
// placement="right"
// closable={false}
// onClose={this.onClose}
// visible={this.state.visible}
// getContainer={false}
// style={{ position: 'absolute' }}

// drawer props + initform props + detial props



function DrawInitForm(props) {
  let newProps = { ...props };
  delete newProps.children;

  const detailprops = {
    totalPath: props.totalPath,
    dataSource: props.detaildataSource,
    totalCard: props.totalCard,
    totalParams: props.totalParams,
    col: props.col,
    bottomNode: props.bottomNode,
    topNode: props.topNode,
    printRef: props.printRef,
    onloadeddata: props.onloadeddata,
    expandkeys: props.expandkeys,
    reload:props.reload
  }
  return (
    <Drawer
      maskClosable={false}
      placement="right"
      closable={true}
      getContainer={false}
      style={{ position: "absolute", transform: "translateX(0)",maxWidth:"100%" }}
      {...props}
      width={props.val == "detail" ? "80vw" : props.width}
      destroyOnClose={true}
      
    >
      {props.val == "only" && props.children}
      {props.val == "only" ? null : props.val == "detail" ? <Details {...detailprops}></Details> : <InitForm {...newProps}></InitForm>}
    </Drawer>
  );
}

export default DrawInitForm;
