UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

108 lines (91 loc) 3.3 kB
import _extends from "@babel/runtime/helpers/extends"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; function _createSuper(Derived) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } return function () { var Super = _getPrototypeOf(Derived), result; if (isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } import React, { Component } from 'react'; import classNames from 'classnames'; import RcInputNumber from '../rc-components/input-number'; import { Size } from '../_util/enum'; import ConfigContext from '../config-provider/ConfigContext'; var InputNumber = /*#__PURE__*/ function (_Component) { _inherits(InputNumber, _Component); var _super = _createSuper(InputNumber); function InputNumber() { _classCallCheck(this, InputNumber); return _super.apply(this, arguments); } _createClass(InputNumber, [{ key: "render", value: function render() { var _classNames, _this = this; var _this$props = this.props, className = _this$props.className, size = _this$props.size, customizePrefixCls = _this$props.prefixCls, others = _objectWithoutProperties(_this$props, ["className", "size", "prefixCls"]); var getPrefixCls = this.context.getPrefixCls; var prefixCls = getPrefixCls('input-number', customizePrefixCls); var inputNumberClass = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-lg"), size === Size.large), _defineProperty(_classNames, "".concat(prefixCls, "-sm"), size === Size.small), _classNames), className); return React.createElement(RcInputNumber, _extends({ ref: function ref(c) { return _this.inputNumberRef = c; }, className: inputNumberClass, prefixCls: prefixCls }, others)); } }, { key: "focus", value: function focus() { this.inputNumberRef.focus(); } }, { key: "blur", value: function blur() { this.inputNumberRef.blur(); } }], [{ key: "contextType", get: function get() { return ConfigContext; } }]); return InputNumber; }(Component); export { InputNumber as default }; InputNumber.displayName = 'InputNumber'; InputNumber.defaultProps = { step: 1 }; //# sourceMappingURL=index.js.map