import _Drawer from "antd/es/drawer";
import _extends from "@babel/runtime/helpers/extends";
import _Space from "antd/es/space";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["style", "autoFocus", "closable", "closeIcon", "mask", "maskClosable", "maskStyle", "placement", "size", "title", "open", "zIndex", "width", "height", "extra", "footer", "destroyOnClose", "footerqx", "footerSubmit", "fontColor", "banColor", "colosColor", "contentColor", "footerFlex", "onCancel", "onSubit", "qxleft", "qxright", "footerbgColor", "subright", "titleSize", "titleWeight", "titleStyle"];
import * as React from 'react';
import { useEffect } from 'react';
// import {
//     AppstoreOutlined,
//     MailOutlined,
//     SettingOutlined,
//     StepBackwardOutlined,
//     StepForwardOutlined,
//     FastBackwardOutlined,
//     FastForwardOutlined,
//     HomeOutlined,
// } from '@ant-design/icons/es/index';
// import * as Icons from '@ant-design/icons/es/index';
// import './index.css';

import "./index.scss";
var antDrawer = function antDrawer(_ref) {
  var _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    autoFocus = _ref.autoFocus,
    closable = _ref.closable,
    closeIcon = _ref.closeIcon,
    mask = _ref.mask,
    maskClosable = _ref.maskClosable,
    maskStyle = _ref.maskStyle,
    placement = _ref.placement,
    size = _ref.size,
    title = _ref.title,
    open = _ref.open,
    zIndex = _ref.zIndex,
    width = _ref.width,
    height = _ref.height,
    extra = _ref.extra,
    footer = _ref.footer,
    destroyOnClose = _ref.destroyOnClose,
    footerqx = _ref.footerqx,
    footerSubmit = _ref.footerSubmit,
    fontColor = _ref.fontColor,
    banColor = _ref.banColor,
    colosColor = _ref.colosColor,
    contentColor = _ref.contentColor,
    footerFlex = _ref.footerFlex,
    onCancel = _ref.onCancel,
    onSubit = _ref.onSubit,
    qxleft = _ref.qxleft,
    qxright = _ref.qxright,
    footerbgColor = _ref.footerbgColor,
    subright = _ref.subright,
    titleSize = _ref.titleSize,
    titleWeight = _ref.titleWeight,
    titleStyle = _ref.titleStyle,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  // 处理Icon图标
  // const Iconfont = (props: { icon: string }) => {
  //     const { icon } = props
  //     const antIcon: { [key: string]: any } = Icons
  //     return React.createElement(antIcon[icon])
  // }
  console.log(_otherProps.style, 111111);
  var contentfn = function contentfn() {
    var _ref2, _ref3;
    var drawerElems = (_ref2 = document.getElementById('drawerID') || document) === null || _ref2 === void 0 ? void 0 : _ref2.querySelectorAll('.ant-drawer-header');
    if (drawerElems[0]) {
      // let img =`url(${require('../../assets/21050Q05319-1-1200.jpg').default.default})`
      // drawerElems[0].style.backgroundImage = img //背景图片
      drawerElems[0].style.backgroundColor = banColor; //标题背景颜色
      drawerElems[0].querySelector('.ant-drawer-title').style.color = fontColor; //标题字体颜色
      drawerElems[0].querySelector('.ant-drawer-title').style.fontSize = titleSize + 'px'; //标题字体大小
      drawerElems[0].querySelector('.ant-drawer-title').style.fontFamily = titleStyle; //标题字体大小
      drawerElems[0].querySelector('.ant-drawer-title').style.fontWeight = titleWeight; //标题字重
      if (drawerElems[0].querySelector('.ant-drawer-close')) {
        drawerElems[0].querySelector('.ant-drawer-close').style.color = colosColor; //关闭按钮颜色
      }
    }

    var drawerContentElems = (_ref3 = document.getElementById('drawerID') || document) === null || _ref3 === void 0 ? void 0 : _ref3.querySelectorAll('.ant-drawer-body');
    if (drawerContentElems[0]) {
      drawerContentElems[0].style.backgroundColor = contentColor; //高度
    }
  };

  var FooterContent = function FooterContent() {
    var _ref4;
    var str = '';
    if (footerFlex == '左对齐') {
      str = 'left';
    }
    if (footerFlex == '居中对齐') {
      str = 'center';
    }
    if (footerFlex == '右对齐') {
      str = 'right';
    }
    var drawerfooterElems = (_ref4 = document.getElementById('drawerID') || document) === null || _ref4 === void 0 ? void 0 : _ref4.querySelectorAll('.ant-drawer-footer');
    if (drawerfooterElems[0]) {
      drawerfooterElems[0].style.textAlign = str;
      drawerfooterElems[0].style.backgroundColor = footerbgColor;
    }
    return footer ? /*#__PURE__*/React.createElement(_Space, null, footerqx) : '';
  };
  if (open) {
    setTimeout(function () {
      FooterContent();
      contentfn();
    }, 0);
  }
  useEffect(function () {
    setTimeout(function () {
      contentfn();
      FooterContent();
    }, 0);
  }, []);
  // let drawerElemsFont = (document.getElementById('drawerID') || document)?.querySelectorAll(
  //     '.ant-drawer-title'
  // );
  // if (drawerElemsFont[0]) {
  //     drawerElems[0].style.color =fontColor //背景图片
  //     // drawerElems[0].style.backgroundColor = "#ffff00"; //高度
  // }
  return /*#__PURE__*/React.createElement(_Drawer, _extends({
    title: title,
    id: "drawerID",
    placement: placement,
    visible: open,
    size: size,
    zIndex: zIndex,
    className: "drawerStyle",
    mask: mask,
    maskClosable: maskClosable,
    closable: closable,
    width: width,
    height: height
    // destroyOnClose={destroyOnClose}
    // extra={extra ?
    //     <Space>
    //         <Button onClick={subitBtn} type='text'>关闭</Button>
    //     </Space> : ''
    // }
    ,
    footer: FooterContent()
  }, _otherProps));
};
antDrawer.displayName = 'antDrawer';
export default antDrawer;