"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _button = _interopRequireDefault(require("antd/lib/button"));
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"));
require("./index.scss");
var _excluded = ["style", "mode", "title", "disabled", "size", "block", "block1", "ghost", "href", "danger", "loading", "shape", "btnSyle", "iconFlag", "btncolor", "btnFlag", "btnBgcolor", "btnBrcolor", "icon"];
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 antButton = function antButton(_ref) {
  var _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    mode = _ref.mode,
    title = _ref.title,
    disabled = _ref.disabled,
    size = _ref.size,
    block = _ref.block,
    block1 = _ref.block1,
    ghost = _ref.ghost,
    href = _ref.href,
    danger = _ref.danger,
    loading = _ref.loading,
    shape = _ref.shape,
    btnSyle = _ref.btnSyle,
    iconFlag = _ref.iconFlag,
    btncolor = _ref.btncolor,
    btnFlag = _ref.btnFlag,
    btnBgcolor = _ref.btnBgcolor,
    btnBrcolor = _ref.btnBrcolor,
    icon = _ref.icon,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  var _style = style || {};
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  // 处理Icon图标
  var Iconfont = function Iconfont(props) {
    var icon = props.icon;
    var antIcon = Icons;
    return /*#__PURE__*/React.createElement(antIcon[icon]);
  };
  // useEffect(() => {
  //     let elems = (document.getElementById(btnSyle) || document)?.querySelectorAll(
  //         '.ant-btn.ant-btn-primary'
  //     );
  //     elems[0].style.color = _otherProps.style.color + ' !important'//高度
  //     elems[0].style.backgroundColor = _otherProps.style.backgroundColor + ' !important'
  //     elems[0].style.fontSize = _otherProps.style.fontSize + ' !important' //高度
  //     // elems[0].onmouseenter = function () {
  //     //  };
  //     // elems[0].onmouseleave = function () { };
  // }, [otherProps.style])
  if (iconFlag) {
    return block ? /*#__PURE__*/React.createElement(_button["default"], (0, _extends2["default"])({
      className: "btnstyle",
      type: mode,
      size: size,
      disabled: disabled,
      block: block1,
      ghost: ghost,
      shape: shape,
      loading: loading,
      icon: /*#__PURE__*/React.createElement(Iconfont, {
        icon: icon
      }),
      danger: danger,
      href: href
    }, _otherProps), title) : '';
  } else {
    return block ? /*#__PURE__*/React.createElement(_button["default"], (0, _extends2["default"])({
      type: mode,
      size: size,
      disabled: disabled,
      ghost: ghost,
      block: block1,
      shape: shape,
      loading: loading,
      danger: danger,
      href: href
    }, _otherProps), title) : '';
  }
};
antButton.displayName = 'antButton';
var _default = antButton;
exports["default"] = _default;