@@ -5,7 +5,7 @@ import Icon from '../icon';
55import  Button  from  '../button' ; 
66import  Input  from  '../input' ; 
77import  ConfigProvider  from  '../config-provider' ; 
8- import  { func ,  obj }  from  '../util' ; 
8+ import  {   func ,  obj   }  from  '../util' ; 
99
1010/** NumberPicker */ 
1111class  NumberPicker  extends  React . Component  { 
@@ -259,7 +259,7 @@ class NumberPicker extends React.Component {
259259            } ) ; 
260260        } 
261261
262-         this . props . onChange ( isNaN ( v )  ||  v  ===  ''  ? undefined  : v ,  { ...e ,  triggerType} ) ; 
262+         this . props . onChange ( isNaN ( v )  ||  v  ===  ''  ? undefined  : v ,  {   ...e ,  triggerType  } ) ; 
263263    } 
264264
265265    setInputValue ( v ,  e )  { 
@@ -299,7 +299,7 @@ class NumberPicker extends React.Component {
299299    } 
300300
301301    upStep ( val )  { 
302-         const  { step,  min}  =  this . props ; 
302+         const  {   step,  min  }  =  this . props ; 
303303        const  precisionFactor  =  this . getPrecisionFactor ( ) ; 
304304        let  result ; 
305305        if  ( typeof  val  ===  'number' )  { 
@@ -313,7 +313,7 @@ class NumberPicker extends React.Component {
313313    } 
314314
315315    downStep ( val )  { 
316-         const  { step,  min}  =  this . props ; 
316+         const  {   step,  min  }  =  this . props ; 
317317        const  precisionFactor  =  this . getPrecisionFactor ( ) ; 
318318        let  result ; 
319319        if  ( typeof  val  ===  'number' )  { 
@@ -344,17 +344,23 @@ class NumberPicker extends React.Component {
344344        if  ( e )  { 
345345            e . preventDefault ( ) ; 
346346        } 
347-         const  { disabled,  min,  max}  =  this . props ; 
347+ 
348+         const  {  disabled,  min,  max }  =  this . props ; 
348349        if  ( disabled )  { 
349350            return ; 
350351        } 
352+ 
351353        const  value  =  this . state . value ; 
352354        if  ( isNaN ( value ) )  { 
353355            return ; 
354356        } 
355-         const  val  =  this [ `${ type }  ] ( value ) ; 
356-         if  ( val  >  max  ||  val  <  min )  { 
357-             return ; 
357+ 
358+         let  val  =  this [ `${ type }  ] ( value ) ; 
359+         if  ( val  >  max )  { 
360+             val  =  max ; 
361+         } 
362+         if  ( val  <  min )  { 
363+             val  =  min ; 
358364        } 
359365        this . setValue ( val ,  e ,  type ) ; 
360366    } 
@@ -382,7 +388,7 @@ class NumberPicker extends React.Component {
382388    } 
383389
384390    render ( )  { 
385-         const  { type,  prefix,  disabled,  style,  className,  size,  max,  min,  autoFocus,  editable,  state}  =  this . props ; 
391+         const  {   type,  prefix,  disabled,  style,  className,  size,  max,  min,  autoFocus,  editable,  state  }  =  this . props ; 
386392
387393        const  prefixCls  =  `${ prefix }  ; 
388394
@@ -410,22 +416,22 @@ class NumberPicker extends React.Component {
410416        if  ( type  ===  'normal' )  { 
411417            innerAfter  =  ( [ 
412418                < Button  disabled = { disabled  ||  upDisabled }  onClick = { this . up . bind ( this ) }  key = "0" > 
413-                     < Icon  size = "xxs"  type = "arrow-up" /> 
419+                     < Icon  size = "xxs"  type = "arrow-up"   /> 
414420                </ Button > , 
415421                < Button  disabled = { disabled  ||  downDisabled }  onClick = { this . down . bind ( this ) }  key = "1" > 
416-                     < Icon  size = "xxs"  type = "arrow-down" /> 
422+                     < Icon  size = "xxs"  type = "arrow-down"   /> 
417423                </ Button > 
418424            ] ) ; 
419425            innerAfterClassName  =  `${ prefixCls }  ; 
420426        }  else  { 
421427            addonBefore  =  ( 
422428                < Button  size = { size }  disabled = { disabled  ||  downDisabled }  onClick = { this . down . bind ( this ) } > 
423-                     < Icon  type = "minus"  size = "xs" /> 
429+                     < Icon  type = "minus"  size = "xs"   /> 
424430                </ Button > 
425431            ) ; 
426432            addonAfter  =  ( 
427433                < Button  size = { size }  disabled = { disabled  ||  upDisabled }  onClick = { this . up . bind ( this ) } > 
428-                     < Icon  type = "add"  size = "xs" /> 
434+                     < Icon  type = "add"  size = "xs"   /> 
429435                </ Button > 
430436            ) ; 
431437        } 
0 commit comments