import _extends from "@babel/runtime/helpers/extends";
import _Tooltip from "antd/es/tooltip";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["textValue", "tipColor", "defaultShow", "placement", "style", "mouseEnterDelay", "mouseLeaveDelay", "triggerMethod", "tipTextColor", "fontSize", "fontFamily"];
import * as React from 'react';
import "./index.less";
var antTooltip = function antTooltip(_ref) {
  var textValue = _ref.textValue,
    tipColor = _ref.tipColor,
    defaultShow = _ref.defaultShow,
    placement = _ref.placement,
    style = _ref.style,
    mouseEnterDelay = _ref.mouseEnterDelay,
    mouseLeaveDelay = _ref.mouseLeaveDelay,
    triggerMethod = _ref.triggerMethod,
    tipTextColor = _ref.tipTextColor,
    fontSize = _ref.fontSize,
    fontFamily = _ref.fontFamily,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  if (_style['width'] == '100%' && _style['marginRight'] || _style['marginLeft']) {
    _style['width'] = "calc(" + _style['width'] + " - " + _style['marginRight'] + " - " + _style['marginLeft'] + ")";
  } else {
    _style['width'] = _style['width'];
  }
  _style['fontSize'] = _style['fontSize'] ? _style['fontSize'] : '18px';
  var _otherProps = otherProps || {};
  _otherProps.style = _style;

  // 改变内容的颜色
  var tip = /*#__PURE__*/React.createElement("span", {
    style: {
      color: tipTextColor,
      fontSize: fontSize,
      fontFamily: fontFamily
    }
  }, textValue);
  return /*#__PURE__*/React.createElement("div", _extends({
    className: "my-ant-tooptip"
  }, _otherProps), defaultShow ? /*#__PURE__*/React.createElement(_Tooltip, {
    zIndex: _style['zIndex'],
    trigger: triggerMethod,
    mouseEnterDelay: mouseEnterDelay,
    mouseLeaveDelay: mouseLeaveDelay,
    title: tip,
    placement: placement,
    color: tipColor,
    visible: defaultShow
  }, /*#__PURE__*/React.createElement("span", {
    className: "my-tooptip"
  }, textValue)) : /*#__PURE__*/React.createElement(_Tooltip, {
    zIndex: _style['zIndex'],
    trigger: triggerMethod,
    mouseEnterDelay: mouseEnterDelay,
    mouseLeaveDelay: mouseLeaveDelay,
    title: tip,
    placement: placement,
    color: tipColor
  }, /*#__PURE__*/React.createElement("span", {
    className: "my-tooptip"
  }, textValue)));
};
antTooltip.displayName = 'antTooltip';
export default antTooltip;