import _Modal from "antd/es/modal";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["open", "style", "children", "maskColor", "titleColor", "titleLeft", "fontColor", "fontSize", "icon", "footer", "footerColor", "footerBcolor", "footerFamily", "footerSize", "footerWeight", "fontFamily", "fontWeight", "titleHeight", "title", "needTitle", "footerAuto"];
import * as React from 'react';
import * as icons from '@ant-design/icons/es/index';
var antModal = function antModal(_ref) {
  var open = _ref.open,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    children = _ref.children,
    maskColor = _ref.maskColor,
    titleColor = _ref.titleColor,
    titleLeft = _ref.titleLeft,
    fontColor = _ref.fontColor,
    fontSize = _ref.fontSize,
    icon = _ref.icon,
    footer = _ref.footer,
    footerColor = _ref.footerColor,
    footerBcolor = _ref.footerBcolor,
    footerFamily = _ref.footerFamily,
    footerSize = _ref.footerSize,
    footerWeight = _ref.footerWeight,
    fontFamily = _ref.fontFamily,
    fontWeight = _ref.fontWeight,
    titleHeight = _ref.titleHeight,
    title = _ref.title,
    needTitle = _ref.needTitle,
    footerAuto = _ref.footerAuto,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  if (!style.padding) {
    _style.padding = '0';
  }
  var _otherProps = otherProps || {};
  var width = _style.width ? style.width : '400px';
  // 标题的样式
  var titleStyle = {
    height: titleHeight + "px",
    display: 'flex',
    alignItems: 'center',
    paddingLeft: titleLeft + "px",
    backgroundColor: titleColor,
    fontSize: fontSize + "px",
    fontFamily: fontFamily,
    color: fontColor,
    fontWeight: fontWeight
  };
  // 底部的样式
  var footerStyle = {
    background: footerBcolor,
    fontFamily: footerFamily,
    color: footerColor,
    fontSize: footerSize,
    fontWeight: footerWeight
  };
  // 遮罩的样式
  if (maskColor) {
    _otherProps.maskStyle = {
      background: maskColor
    };
  }
  if (!footer) {
    _otherProps.footer = null;
  }
  if (footer && footerAuto) {
    _otherProps.footer = null;
  }
  var IconComp = (icons || {})[icon || 'AccountBookFilled'];
  return /*#__PURE__*/React.createElement(_Modal, _extends({
    title: undefined,
    visible: open,
    width: width,
    bodyStyle: _style,
    closeIcon: /*#__PURE__*/React.createElement(IconComp, null)
  }, _otherProps), needTitle && /*#__PURE__*/React.createElement("div", {
    style: titleStyle
  }, title), children, footer && footerAuto && /*#__PURE__*/React.createElement("div", {
    style: footerStyle
  }, footerAuto));
};
antModal.displayName = 'antModal';
export default antModal;