@@ -139,6 +139,8 @@ const InputNumber = React.forwardRef(
139139
140140 const [ focus , setFocus ] = React . useState ( false ) ;
141141
142+ const [ illegalData , setIllegalData ] = React . useState ( false ) ;
143+
142144 const userTypingRef = React . useRef ( false ) ;
143145 const compositionRef = React . useRef ( false ) ;
144146
@@ -399,8 +401,13 @@ const InputNumber = React.forwardRef(
399401 collectInputValue ( inputRef . current . value ) ;
400402 } ;
401403
404+ const judgeData = ( inputNumberValue : string ) => {
405+ return ( isNaN ( Number ( inputNumberValue ) ) && inputNumberValue !== '-' ) || ( max && inputNumberValue > max ) || ( min && inputNumberValue < min )
406+ }
407+
402408 // >>> Input
403409 const onInternalInput : React . ChangeEventHandler < HTMLInputElement > = ( e ) => {
410+ setIllegalData ( judgeData ( e . target . value ) )
404411 collectInputValue ( e . target . value ) ;
405412 } ;
406413
@@ -487,6 +494,8 @@ const InputNumber = React.forwardRef(
487494 // >>> Focus & Blur
488495 const onBlur = ( ) => {
489496 flushInputValue ( false ) ;
497+
498+ setIllegalData ( false )
490499
491500 setFocus ( false ) ;
492501
@@ -531,7 +540,7 @@ const InputNumber = React.forwardRef(
531540 [ `${ prefixCls } -disabled` ] : disabled ,
532541 [ `${ prefixCls } -readonly` ] : readOnly ,
533542 [ `${ prefixCls } -not-a-number` ] : decimalValue . isNaN ( ) ,
534- [ `${ prefixCls } -out-of-range` ] : ! decimalValue . isInvalidate ( ) && ! isInRange ( decimalValue ) ,
543+ [ `${ prefixCls } -out-of-range` ] : ( ! decimalValue . isInvalidate ( ) && ! isInRange ( decimalValue ) ) || illegalData ,
535544 } ) }
536545 style = { style }
537546 onFocus = { ( ) => {
0 commit comments