import _Input from "antd/es/input";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["InputType", "groupAgeType", "groupLaterType", "maxLength", "showCount", "defaultValue", "defaultColor", "size", "status", "autoSize", "prefixType", "prefixWord", "prefixIcon", "suffixType", "suffixWord", "suffixIcon", "hasBorder", "placeholder", "allowClear", "visibilityToggle", "pullHeadData", "backHeadData", "pullHeadValue", "backHeadValue", "flag", "style"];
/* eslint-disable @typescript-eslint/no-shadow */
import * as React from 'react';
import "./index.less";
var antInput = function antInput(_ref) {
  var InputType = _ref.InputType,
    groupAgeType = _ref.groupAgeType,
    groupLaterType = _ref.groupLaterType,
    maxLength = _ref.maxLength,
    showCount = _ref.showCount,
    defaultValue = _ref.defaultValue,
    defaultColor = _ref.defaultColor,
    size = _ref.size,
    status = _ref.status,
    autoSize = _ref.autoSize,
    prefixType = _ref.prefixType,
    prefixWord = _ref.prefixWord,
    prefixIcon = _ref.prefixIcon,
    suffixType = _ref.suffixType,
    suffixWord = _ref.suffixWord,
    suffixIcon = _ref.suffixIcon,
    hasBorder = _ref.hasBorder,
    placeholder = _ref.placeholder,
    allowClear = _ref.allowClear,
    visibilityToggle = _ref.visibilityToggle,
    pullHeadData = _ref.pullHeadData,
    backHeadData = _ref.backHeadData,
    pullHeadValue = _ref.pullHeadValue,
    backHeadValue = _ref.backHeadValue,
    flag = _ref.flag,
    style = _ref.style,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  // _style['height'] = _style['height'] ? _style['height'] : '30px';
  _style['width'] = _style['width'] ? _style['width'] : '300px';
  _style['color'] = _style['color'] ? _style['color'] : defaultColor;
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  var Password = function Password() {
    return /*#__PURE__*/React.createElement(_Input.Password, _extends({
      // className={status === 'success' ? '' : (status === 'error' ? 'ant-input-status-error' : 'ant-input-status-warning')}
      className: flag ? "isflag" : status === 'success' ? '' : status === 'error' ? 'ant-input-status-error' : 'ant-input-status-warning',
      defaultValue: defaultValue,
      value: defaultValue,
      bordered: !hasBorder,
      visibilityToggle: visibilityToggle,
      size: size,
      placeholder: placeholder,
      allowClear: allowClear
    }, _otherProps));
  };
  var TextArea = function TextArea() {
    var TextArea = _Input.TextArea;
    return /*#__PURE__*/React.createElement(TextArea, _extends({
      className: flag ? "isflag" : "",
      defaultValue: defaultValue,
      value: defaultValue,
      bordered: !hasBorder,
      size: size,
      showCount: showCount,
      autoSize: autoSize,
      maxLength: maxLength,
      placeholder: placeholder,
      allowClear: allowClear
    }, _otherProps));
  };
  var InputD = function InputD() {
    return /*#__PURE__*/React.createElement(_Input, _extends({
      // className={status === 'success' ? '' : (status === 'error' ? 'ant-input-status-error' : 'ant-input-status-warning')}
      className: flag ? 'isflag' : status === 'success' ? '' : status === 'error' ? 'ant-input-status-error' : 'ant-input-status-warning',
      defaultValue: defaultValue,
      value: defaultValue,
      bordered: !hasBorder,
      size: size,
      prefix: prefixType === '空' ? '' : prefixType === '文本' ? prefixWord : prefixIcon,
      maxLength: maxLength,
      suffix: showCount ? /*#__PURE__*/React.createElement("span", null, defaultValue.length, "/", maxLength) : suffixType === '空' ? '' : suffixType === '文本' ? suffixWord : suffixIcon,
      placeholder: placeholder,
      allowClear: allowClear
    }, _otherProps));
  };
  return function () {
    switch (InputType) {
      case '普通':
        return InputD();
        break;
      case '文本':
        return TextArea();
        break;
      // case '组合':
      //   return Group()
      //   break
      case '密码':
        return Password();
        break;
      default:
        return false;
    }
  }();
};
antInput.displayName = 'antInput';
export default antInput;