"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _modal = _interopRequireDefault(require("antd/lib/modal"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var React = _interopRequireWildcard(require("react"));
var icons = _interopRequireWildcard(require("@ant-design/icons/es/index"));
var _excluded = ["open", "style", "children", "maskColor", "titleColor", "titleLeft", "fontColor", "fontSize", "icon", "footer", "footerColor", "footerBcolor", "footerFamily", "footerSize", "footerWeight", "fontFamily", "fontWeight", "titleHeight", "title", "needTitle", "footerAuto"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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 = (0, _objectWithoutPropertiesLoose2["default"])(_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["default"], (0, _extends2["default"])({
    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';
var _default = antModal;
exports["default"] = _default;