"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var Item_1 = require("./Item");
var cx = require("classnames");
var InputNumber = require("rc-input-number");
;
var NumberControl = /** @class */ (function (_super) {
    tslib_1.__extends(NumberControl, _super);
    function NumberControl(props) {
        var _this = _super.call(this, props) || this;
        _this.handleChange = _this.handleChange.bind(_this);
        return _this;
    }
    NumberControl.prototype.handleChange = function (inputValue) {
        var _a = this.props, ns = _a.classPrefix, onChange = _a.onChange, resetValue = _a.resetValue;
        onChange(typeof inputValue === 'undefined' ? (resetValue || '') : inputValue);
    };
    NumberControl.prototype.render = function () {
        var _a = this.props, className = _a.className, ns = _a.classPrefix, value = _a.value, step = _a.step, precision = _a.precision, max = _a.max, min = _a.min, disabled = _a.disabled, placeholder = _a.placeholder;
        var precisionProps = {};
        if (typeof precision === 'number') {
            precisionProps.precision = precision;
        }
        return (React.createElement("div", { className: cx(ns + "NumberControl", className) },
            React.createElement(InputNumber, tslib_1.__assign({ prefixCls: ns + "Number", value: value, step: step, max: max, min: min, onChange: this.handleChange, disabled: disabled, placeholder: placeholder }, precisionProps))));
    };
    NumberControl.defaultProps = {
        step: 1,
        resetValue: ''
    };
    return NumberControl;
}(React.Component));
exports.default = NumberControl;
var NumberControlRenderer = /** @class */ (function (_super) {
    tslib_1.__extends(NumberControlRenderer, _super);
    function NumberControlRenderer() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    NumberControlRenderer.defaultProps = {
        validations: 'isNumeric'
    };
    NumberControlRenderer = tslib_1.__decorate([
        Item_1.FormItem({
            type: 'number'
        })
    ], NumberControlRenderer);
    return NumberControlRenderer;
}(NumberControl));
exports.NumberControlRenderer = NumberControlRenderer;
;
//# sourceMappingURL=./renderers/Form/Number.js.map
