"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _antd = require("antd");

var _indexModule = _interopRequireDefault(require("./index.module.less"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var __extends = void 0 && (void 0).__extends || function () {
  var _extendStatics = function extendStatics(d, b) {
    _extendStatics = Object.setPrototypeOf || {
      __proto__: []
    } instanceof Array && function (d, b) {
      d.__proto__ = b;
    } || function (d, b) {
      for (var p in b) {
        if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
      }
    };

    return _extendStatics(d, b);
  };

  return function (d, b) {
    if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");

    _extendStatics(d, b);

    function __() {
      this.constructor = d;
    }

    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  };
}();

var NewInputNumber =
/** @class */
function (_super) {
  __extends(NewInputNumber, _super);

  function NewInputNumber() {
    return _super !== null && _super.apply(this, arguments) || this;
  }

  NewInputNumber.prototype.render = function () {
    var _a = this.props,
        value = _a.value,
        _onChange = _a.onChange,
        min = _a.min,
        max = _a.max,
        step = _a.step,
        unit = _a.unit;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: _indexModule["default"].inputNumberWrap
    }, /*#__PURE__*/_react["default"].createElement(_antd.InputNumber, {
      className: _indexModule["default"].input,
      controls: false,
      max: max,
      min: min,
      onChange: function onChange(v) {
        return _onChange(v);
      },
      step: step,
      style: {
        width: unit ? '30px' : '100%'
      },
      value: value
    }), unit && /*#__PURE__*/_react["default"].createElement("span", {
      className: _indexModule["default"].unit
    }, unit));
  };

  NewInputNumber.defaultProps = {
    value: '',
    onChange: function onChange() {},
    min: 1,
    max: 100,
    step: 0,
    unit: ''
  };
  return NewInputNumber;
}(_react["default"].Component);

var _default = NewInputNumber;
exports["default"] = _default;