import _InputNumber from "antd/es/input-number";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["bordered", "defaultValue", "prefixSuffix", "prefixType", "prefixWord", "prefixIcon", "suffixType", "suffixWord", "suffixIcon", "none", "perfixIconColor", "perfixIconSize", "suffixIconColor", "suffixIconSize", "style"];
import * as React from 'react';
import { useState, useEffect } from 'react';
import * as icons from '@ant-design/icons/es/index';
import "./index.less";
var antInputNumber = function antInputNumber(_ref) {
  var bordered = _ref.bordered,
    defaultValue = _ref.defaultValue,
    prefixSuffix = _ref.prefixSuffix,
    prefixType = _ref.prefixType,
    prefixWord = _ref.prefixWord,
    prefixIcon = _ref.prefixIcon,
    suffixType = _ref.suffixType,
    suffixWord = _ref.suffixWord,
    suffixIcon = _ref.suffixIcon,
    none = _ref.none,
    perfixIconColor = _ref.perfixIconColor,
    perfixIconSize = _ref.perfixIconSize,
    suffixIconColor = _ref.suffixIconColor,
    suffixIconSize = _ref.suffixIconSize,
    style = _ref.style,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _useState = useState(''),
    ID = _useState[0],
    setID = _useState[1];
  useEffect(function () {
    setID("antTimePicker_" + uuid());
  }, []);
  useEffect(function () {
    var antPicker = document.getElementById(ID);
    if (style) {
      console.log(style);
      if (style.width) {
        var _antPicker$getElement;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement === void 0 ? void 0 : _antPicker$getElement.style.setProperty('width', style.height, 'important');
      } else {
        var _antPicker$getElement2;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement2 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement2 === void 0 ? void 0 : _antPicker$getElement2.style.removeProperty('width');
      }
      if (style.height) {
        var _antPicker$getElement3;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement3 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement3 === void 0 ? void 0 : _antPicker$getElement3.style.setProperty('height', style.height, 'important');
      } else {
        var _antPicker$getElement4;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement4 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement4 === void 0 ? void 0 : _antPicker$getElement4.style.removeProperty('height');
      }
      if (style.color) {
        var _antPicker$getElement5, _antPicker$getElement6, _antPicker$getElement7;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement5 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement5 === void 0 ? void 0 : _antPicker$getElement5.style.setProperty('color', style.color, 'important');
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement6 = antPicker.getElementsByClassName('ant-input-number-group-addon')[0]) === null || _antPicker$getElement6 === void 0 ? void 0 : _antPicker$getElement6.style.setProperty('color', style.color, 'important');
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement7 = antPicker.getElementsByClassName('ant-input-number-group-addon')[1]) === null || _antPicker$getElement7 === void 0 ? void 0 : _antPicker$getElement7.style.setProperty('color', style.color, 'important');
      } else {
        var _antPicker$getElement8, _antPicker$getElement9, _antPicker$getElement10;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement8 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement8 === void 0 ? void 0 : _antPicker$getElement8.style.removeProperty('color');
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement9 = antPicker.getElementsByTagName('ant-input-number-group-addon')[0]) === null || _antPicker$getElement9 === void 0 ? void 0 : _antPicker$getElement9.style.removeProperty('color');
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement10 = antPicker.getElementsByTagName('ant-input-number-group-addon')[1]) === null || _antPicker$getElement10 === void 0 ? void 0 : _antPicker$getElement10.style.removeProperty('color');
      }
      if (style.fontSize) {
        var _antPicker$getElement11, _antPicker$getElement12, _antPicker$getElement13;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement11 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement11 === void 0 ? void 0 : _antPicker$getElement11.style.setProperty('font-size', style.fontSize, 'important');
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement12 = antPicker.getElementsByClassName('ant-input-number-group-addon')[0]) === null || _antPicker$getElement12 === void 0 ? void 0 : _antPicker$getElement12.style.setProperty('font-size', style.fontSize, 'important');
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement13 = antPicker.getElementsByClassName('ant-input-number-group-addon')[1]) === null || _antPicker$getElement13 === void 0 ? void 0 : _antPicker$getElement13.style.setProperty('font-size', style.fontSize, 'important');
      } else {
        var _antPicker$getElement14, _antPicker$getElement15, _antPicker$getElement16;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement14 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement14 === void 0 ? void 0 : _antPicker$getElement14.style.removeProperty('font-size');
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement15 = antPicker.getElementsByClassName('ant-input-number-group-addon')[0]) === null || _antPicker$getElement15 === void 0 ? void 0 : _antPicker$getElement15.style.removeProperty('font-size');
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement16 = antPicker.getElementsByClassName('ant-input-number-group-addon')[1]) === null || _antPicker$getElement16 === void 0 ? void 0 : _antPicker$getElement16.style.removeProperty('font-size');
      }
      if (style.fontWeight) {
        var _antPicker$getElement17;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement17 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement17 === void 0 ? void 0 : _antPicker$getElement17.style.setProperty('font-weight', style.fontWeight, 'important');
      } else {
        var _antPicker$getElement18;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement18 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement18 === void 0 ? void 0 : _antPicker$getElement18.style.removeProperty('font-weight');
      }
      if (style.lineHeight) {
        var _antPicker$getElement19;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement19 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement19 === void 0 ? void 0 : _antPicker$getElement19.style.setProperty('font-height', style.lineHeight, 'important');
      } else {
        var _antPicker$getElement20;
        antPicker === null || antPicker === void 0 ? void 0 : (_antPicker$getElement20 = antPicker.getElementsByTagName('input')[0]) === null || _antPicker$getElement20 === void 0 ? void 0 : _antPicker$getElement20.style.removeProperty('font-height');
      }
    }
  }, [style, ID]);
  var Box1 = (icons || {})[prefixIcon || 'MehOutlined'];
  var Box2 = (icons || {})[suffixIcon || 'MehOutlined'];
  return /*#__PURE__*/React.createElement("div", {
    id: ID,
    style: {
      display: none ? 'none' : 'inline-block',
      width: style === null || style === void 0 ? void 0 : style.width
    }
  }, /*#__PURE__*/React.createElement(_InputNumber, _extends({
    style: style,
    bordered: !bordered,
    defaultValue: defaultValue,
    value: defaultValue,
    addonBefore: prefixSuffix ? prefixType === '空' ? '' : prefixType === '文本' ? prefixWord : /*#__PURE__*/React.createElement(Box1, {
      style: {
        fontSize: perfixIconSize,
        color: perfixIconColor
      }
    }) : null,
    addonAfter: prefixSuffix ? suffixType === '空' ? '' : suffixType === '文本' ? suffixWord : /*#__PURE__*/React.createElement(Box2, {
      style: {
        fontSize: suffixIconSize,
        color: suffixIconColor
      }
    }) : null
  }, otherProps)));
};
antInputNumber.displayName = 'antInputNumber';
export default antInputNumber;
export function uuid() {
  return (Math.random() * 1e6 >> 0).toString(36);
}