"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
exports.uuid = uuid;
var _inputNumber = _interopRequireDefault(require("antd/lib/input-number"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var React = _interopRequireWildcard(require("react"));
var icons = _interopRequireWildcard(require("@ant-design/icons/es/index"));
require("./index.less");
var _excluded = ["bordered", "defaultValue", "prefixSuffix", "prefixType", "prefixWord", "prefixIcon", "suffixType", "suffixWord", "suffixIcon", "none", "perfixIconColor", "perfixIconSize", "suffixIconColor", "suffixIconSize", "style"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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 = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  var _style = {
    width: style === null || style === void 0 ? void 0 : style.width,
    marginTop: style === null || style === void 0 ? void 0 : style.marginTop,
    marginLeft: style === null || style === void 0 ? void 0 : style.marginLeft,
    marginRight: style === null || style === void 0 ? void 0 : style.marginRight,
    marginBottom: style === null || style === void 0 ? void 0 : style.marginBottom
  };
  var _useState = (0, React.useState)(''),
    ID = _useState[0],
    setID = _useState[1];
  (0, React.useEffect)(function () {
    setID("antTimePicker_" + uuid());
  }, []);
  (0, React.useEffect)(function () {
    var antPicker = document.getElementById(ID);
    if (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: (0, _extends2["default"])({
      display: none ? 'none' : 'inline-block'
    }, _style)
  }, /*#__PURE__*/React.createElement(_inputNumber["default"], (0, _extends2["default"])({
    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';
var _default = antInputNumber;
exports["default"] = _default;
function uuid() {
  return (Math.random() * 1e6 >> 0).toString(36);
}