@@ -28,6 +28,7 @@ var Datetime = React.createClass({
28
28
onChange : TYPES . func ,
29
29
locale : TYPES . string ,
30
30
input : TYPES . bool ,
31
+ inputComponent : TYPES . element ,
31
32
// dateFormat: TYPES.string | TYPES.bool,
32
33
// timeFormat: TYPES.string | TYPES.bool,
33
34
inputProps : TYPES . object ,
@@ -46,6 +47,7 @@ var Datetime = React.createClass({
46
47
className : '' ,
47
48
defaultValue : '' ,
48
49
inputProps : { } ,
50
+ inputComponent : null ,
49
51
input : true ,
50
52
onFocus : nof ,
51
53
onBlur : nof ,
@@ -376,7 +378,7 @@ var Datetime = React.createClass({
376
378
children = [ ]
377
379
;
378
380
379
- if ( this . props . input ) {
381
+ if ( this . props . input && ! this . props . inputComponent ) {
380
382
children = [ DOM . input ( assign ( {
381
383
key : 'i' ,
382
384
type :'text' ,
@@ -386,6 +388,15 @@ var Datetime = React.createClass({
386
388
onKeyDown : this . onInputKey ,
387
389
value : this . state . inputValue
388
390
} , this . props . inputProps ) ) ] ;
391
+ } else if ( this . props . inputComponent ) {
392
+ children = [
393
+ React . cloneElement ( this . props . inputComponent , assign ( {
394
+ key : 'i' ,
395
+ onFocus : this . openCalendar ,
396
+ onChange : this . onInputChange ,
397
+ onKeyDown : this . onInputKey ,
398
+ value : this . state . inputValue
399
+ } , this . props . inputProps ) ) ] ;
389
400
} else {
390
401
className += ' rdtStatic' ;
391
402
}
0 commit comments