import _Tag from "@alifd/next/es/tag";
import _extends from "@babel/runtime/helpers/extends";
import _Icon from "@alifd/next/es/icon";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["style", "type", "content", "disabled", "Adddel", "datas", "size"];
import * as React from 'react';
import "./index.scss";
var AdddelTag = function AdddelTag(_ref) {
  var _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    type = _ref.type,
    content = _ref.content,
    disabled = _ref.disabled,
    Adddel = _ref.Adddel,
    datas = _ref.datas,
    size = _ref.size,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  // _style.backgroundColor = '#E7E7E7'
  _style.border = 'none';
  var _otherProps = otherProps || {};
  if (type == '失效标签') {
    disabled = true;
  } else {
    disabled = false;
  }
  var addTag = function addTag(e) {
    window.tigAdd = '增加';
  };
  _otherProps.style = _style;
  // 处理字体省略号
  function fontSl(str) {
    if (str.length > 8) str = str.slice(0, 8) + '...';
    return str;
  }
  if (type == "关闭") {
    return /*#__PURE__*/React.createElement(_Tag.Closeable, _extends({
      prefix: "next-",
      disabled: disabled
    }, _otherProps, {
      size: size
    }), /*#__PURE__*/React.createElement(_Icon, {
      type: Adddel,
      className: "iconsty"
    }), " ", fontSl(content));
  }
  if (type == "增加") {
    return /*#__PURE__*/React.createElement(_Tag, _extends({
      prefix: "next-",
      disabled: disabled
    }, _otherProps, {
      size: size
    }), /*#__PURE__*/React.createElement(_Icon, {
      type: "add",
      size: "small",
      className: "iconsty"
    }), "  ", fontSl(content));
  }
  if (type == "失效态") {
    return /*#__PURE__*/React.createElement(_Tag.Closeable, _extends({
      prefix: "next-",
      disabled: disabled
    }, _otherProps, {
      size: size,
      className: "sxt"
    }), fontSl(content));
  }
  if (type == "错误态") {
    return /*#__PURE__*/React.createElement(_Tag.Closeable, _extends({
      prefix: "next-",
      disabled: disabled
    }, _otherProps, {
      size: size,
      className: "cwt"
    }), fontSl(content));
  }
};
AdddelTag.displayName = 'AdddelTag';
export default AdddelTag;