1
1
/*
2
- react-datetime v2.10.3
2
+ react-datetime v2.11.0
3
3
https://github.com/YouCanBookMe/react-datetime
4
4
MIT: https://github.com/YouCanBookMe/react-datetime/raw/master/LICENSE
5
5
*/
@@ -412,10 +412,10 @@ return /******/ (function(modules) { // webpackBootstrap
412
412
this . props . onChange ( date ) ;
413
413
} ,
414
414
415
- openCalendar : function ( ) {
416
- if ( ! this . state . open ) {
415
+ openCalendar : function ( e ) {
416
+ if ( ! this . state . open ) {
417
417
this . setState ( { open : true } , function ( ) {
418
- this . props . onFocus ( ) ;
418
+ this . props . onFocus ( e ) ;
419
419
} ) ;
420
420
}
421
421
} ,
@@ -477,26 +477,31 @@ return /******/ (function(modules) { // webpackBootstrap
477
477
children = [ ] ;
478
478
479
479
if ( this . props . input ) {
480
- children = [ React . createElement ( 'input' , assign ( {
481
- key : 'i' ,
480
+ var finalInputProps = assign ( {
482
481
type : 'text' ,
483
482
className : 'form-control' ,
483
+ onClick : this . openCalendar ,
484
484
onFocus : this . openCalendar ,
485
485
onChange : this . onInputChange ,
486
486
onKeyDown : this . onInputKey ,
487
- value : this . state . inputValue
488
- } , this . props . inputProps ) ) ] ;
487
+ value : this . state . inputValue ,
488
+ } , this . props . inputProps ) ;
489
+ if ( this . props . renderInput ) {
490
+ children = [ React . createElement ( 'div' , { key : 'i' } , this . props . renderInput ( finalInputProps , this . openCalendar ) ) ] ;
491
+ } else {
492
+ children = [ React . createElement ( 'input' , assign ( { key : 'i' } , finalInputProps ) ) ] ;
493
+ }
489
494
} else {
490
495
className += ' rdtStatic' ;
491
496
}
492
497
493
498
if ( this . state . open )
494
499
className += ' rdtOpen' ;
495
500
496
- return React . createElement ( 'div' , { className : className } , children . concat (
497
- React . createElement ( 'div' ,
501
+ return React . createElement ( 'div' , { className : className } , children . concat (
502
+ React . createElement ( 'div' ,
498
503
{ key : 'dt' , className : 'rdtPicker' } ,
499
- React . createElement ( CalendarContainer , { view : this . state . currentView , viewProps : this . getComponentProps ( ) , onClickOutside : this . handleClickOutside } )
504
+ React . createElement ( CalendarContainer , { view : this . state . currentView , viewProps : this . getComponentProps ( ) , onClickOutside : this . handleClickOutside } )
500
505
)
501
506
) ) ;
502
507
}
@@ -3455,17 +3460,19 @@ return /******/ (function(modules) { // webpackBootstrap
3455
3460
}
3456
3461
}
3457
3462
3463
+ var hours = date . format ( 'H' ) ;
3464
+
3458
3465
var daypart = false ;
3459
3466
if ( this . state !== null && this . props . timeFormat . toLowerCase ( ) . indexOf ( ' a' ) !== - 1 ) {
3460
3467
if ( this . props . timeFormat . indexOf ( ' A' ) !== - 1 ) {
3461
- daypart = ( this . state . hours >= 12 ) ? 'PM' : 'AM' ;
3468
+ daypart = ( hours >= 12 ) ? 'PM' : 'AM' ;
3462
3469
} else {
3463
- daypart = ( this . state . hours >= 12 ) ? 'pm' : 'am' ;
3470
+ daypart = ( hours >= 12 ) ? 'pm' : 'am' ;
3464
3471
}
3465
3472
}
3466
3473
3467
3474
return {
3468
- hours : date . format ( 'H' ) ,
3475
+ hours : hours ,
3469
3476
minutes : date . format ( 'mm' ) ,
3470
3477
seconds : date . format ( 'ss' ) ,
3471
3478
milliseconds : date . format ( 'SSS' ) ,
@@ -3485,19 +3492,19 @@ return /******/ (function(modules) { // webpackBootstrap
3485
3492
}
3486
3493
}
3487
3494
return React . createElement ( 'div' , { key : type , className : 'rdtCounter' } , [
3488
- React . createElement ( 'span' , { key : 'up' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'increase' , type ) } , '▲' ) ,
3495
+ React . createElement ( 'span' , { key : 'up' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'increase' , type ) , onContextMenu : this . disableContextMenu } , '▲' ) ,
3489
3496
React . createElement ( 'div' , { key : 'c' , className : 'rdtCount' } , value ) ,
3490
- React . createElement ( 'span' , { key : 'do' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'decrease' , type ) } , '▼' )
3497
+ React . createElement ( 'span' , { key : 'do' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'decrease' , type ) , onContextMenu : this . disableContextMenu } , '▼' )
3491
3498
] ) ;
3492
3499
}
3493
3500
return '' ;
3494
3501
} ,
3495
3502
3496
3503
renderDayPart : function ( ) {
3497
3504
return React . createElement ( 'div' , { key : 'dayPart' , className : 'rdtCounter' } , [
3498
- React . createElement ( 'span' , { key : 'up' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'toggleDayPart' , 'hours' ) } , '▲' ) ,
3505
+ React . createElement ( 'span' , { key : 'up' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'toggleDayPart' , 'hours' ) , onContextMenu : this . disableContextMenu } , '▲' ) ,
3499
3506
React . createElement ( 'div' , { key : this . state . daypart , className : 'rdtCount' } , this . state . daypart ) ,
3500
- React . createElement ( 'span' , { key : 'do' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'toggleDayPart' , 'hours' ) } , '▼' )
3507
+ React . createElement ( 'span' , { key : 'do' , className : 'rdtBtn' , onMouseDown : this . onStartClicking ( 'toggleDayPart' , 'hours' ) , onContextMenu : this . disableContextMenu } , '▼' )
3501
3508
] ) ;
3502
3509
} ,
3503
3510
@@ -3613,6 +3620,11 @@ return /******/ (function(modules) { // webpackBootstrap
3613
3620
} ;
3614
3621
} ,
3615
3622
3623
+ disableContextMenu : function ( event ) {
3624
+ event . preventDefault ( ) ;
3625
+ return false ;
3626
+ } ,
3627
+
3616
3628
padValues : {
3617
3629
hours : 1 ,
3618
3630
minutes : 2 ,
0 commit comments