Skip to content

Commit 43598a2

Browse files
authored
fix: decimal exception in inputNumber (#7981)
1 parent e516b9c commit 43598a2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

components/lib/inputnumber/InputNumber.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ export const InputNumber = React.memo(
687687
let inputValue = inputRef.current.value.trim();
688688
const { decimalCharIndex, minusCharIndex, suffixCharIndex, currencyCharIndex } = getCharIndexes(inputValue);
689689
const maxFractionDigits = numberFormat.current.resolvedOptions().maximumFractionDigits;
690+
const hasBoundOrAffix = props.min || props.max || props.suffix || props.prefix; //only exception
690691
let newValueStr;
691692

692693
if (sign.isMinusSign) {
@@ -709,7 +710,7 @@ export const InputNumber = React.memo(
709710
newValueStr = insertText(inputValue, text, selectionStart, selectionEnd);
710711
updateValue(event, newValueStr, text, 'insert');
711712
} else if (decimalCharIndex === -1 && (maxFractionDigits || props.maxFractionDigits)) {
712-
const allowedDecimal = inputMode !== 'numeric' || (inputMode === 'numeric' && (props.min || props.max));
713+
const allowedDecimal = inputMode !== 'numeric' || (inputMode === 'numeric' && hasBoundOrAffix);
713714

714715
if (allowedDecimal) {
715716
newValueStr = insertText(inputValue, text, selectionStart, selectionEnd);

0 commit comments

Comments
 (0)