1 line
62 KiB
JSON
1 line
62 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"prefixCls\", \"className\", \"style\", \"min\", \"max\", \"step\", \"defaultValue\", \"value\", \"disabled\", \"readOnly\", \"upHandler\", \"downHandler\", \"keyboard\", \"changeOnWheel\", \"controls\", \"classNames\", \"stringMode\", \"parser\", \"formatter\", \"precision\", \"decimalSeparator\", \"onChange\", \"onInput\", \"onPressEnter\", \"onStep\", \"changeOnBlur\", \"domRef\"],\n _excluded2 = [\"disabled\", \"style\", \"prefixCls\", \"value\", \"prefix\", \"suffix\", \"addonBefore\", \"addonAfter\", \"className\", \"classNames\"];\nimport getMiniDecimal, { getNumberPrecision, num2str, toFixed, validateNumber } from '@rc-component/mini-decimal';\nimport clsx from 'classnames';\nimport { BaseInput } from 'rc-input';\nimport { useLayoutUpdateEffect } from \"rc-util/es/hooks/useLayoutEffect\";\nimport proxyObject from \"rc-util/es/proxyObject\";\nimport { composeRef } from \"rc-util/es/ref\";\nimport * as React from 'react';\nimport useCursor from \"./hooks/useCursor\";\nimport StepHandler from \"./StepHandler\";\nimport { getDecupleSteps } from \"./utils/numberUtil\";\nimport { triggerFocus } from \"rc-input/es/utils/commonUtils\";\nimport useFrame from \"./hooks/useFrame\";\n/**\n * We support `stringMode` which need handle correct type when user call in onChange\n * format max or min value\n * 1. if isInvalid return null\n * 2. if precision is undefined, return decimal\n * 3. format with precision\n * I. if max > 0, round down with precision. Example: max= 3.5, precision=0 afterFormat: 3\n * II. if max < 0, round up with precision. Example: max= -3.5, precision=0 afterFormat: -4\n * III. if min > 0, round up with precision. Example: min= 3.5, precision=0 afterFormat: 4\n * IV. if min < 0, round down with precision. Example: max= -3.5, precision=0 afterFormat: -3\n */\nvar getDecimalValue = function getDecimalValue(stringMode, decimalValue) {\n if (stringMode || decimalValue.isEmpty()) {\n return decimalValue.toString();\n }\n return decimalValue.toNumber();\n};\nvar getDecimalIfValidate = function getDecimalIfValidate(value) {\n var decimal = getMiniDecimal(value);\n return decimal.isInvalidate() ? null : decimal;\n};\nvar InternalInputNumber = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var prefixCls = props.prefixCls,\n className = props.className,\n style = props.style,\n min = props.min,\n max = props.max,\n _props$step = props.step,\n step = _props$step === void 0 ? 1 : _props$step,\n defaultValue = props.defaultValue,\n value = props.value,\n disabled = props.disabled,\n readOnly = props.readOnly,\n upHandler = props.upHandler,\n downHandler = props.downHandler,\n keyboard = props.keyboard,\n _props$changeOnWheel = props.changeOnWheel,\n changeOnWheel = _props$changeOnWheel === void 0 ? false : _props$changeOnWheel,\n _props$controls = props.controls,\n controls = _props$controls === void 0 ? true : _props$controls,\n classNames = props.classNames,\n stringMode = props.stringMode,\n parser = props.parser,\n formatter = props.formatter,\n precision = props.precision,\n decimalSeparator = props.decimalSeparator,\n onChange = props.onChange,\n onInput = props.onInput,\n onPressEnter = props.onPressEnter,\n onStep = props.onStep,\n _props$changeOnBlur = props.changeOnBlur,\n changeOnBlur = _props$changeOnBlur === void 0 ? true : _props$changeOnBlur,\n domRef = props.domRef,\n inputProps = _objectWithoutProperties(props, _excluded);\n var inputClassName = \"\".concat(prefixCls, \"-input\");\n var inputRef = React.useRef(null);\n var _React$useState = React.useState(false),\n _React$
|