function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React, { forwardRef, useMemo } from 'react';
import { Button as OriginalButton } from 'antd';
var Button = /*#__PURE__*/forwardRef(function (props, ref) {
  var _props$href;
  var innerProps = {};
  if (!((_props$href = props.href) !== null && _props$href !== void 0 && _props$href.trim()) || props.__designMode === 'design') {
    // 解决低代码编辑器中按钮设置 href 属性造成按钮点击重定向问题
    innerProps.href = undefined;
  }
  var _children = useMemo(function () {
    if (props.rightIcon) {
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
        style: {
          marginRight: 8
        }
      }, " ", props.children), props.rightIcon);
    }
    return props.children;
  }, [props.children, props.rightIcon]);
  return /*#__PURE__*/React.createElement(OriginalButton, _extends({}, props, innerProps, {
    ref: ref,
    children: _children
  }));
});
export default Button;