Dan Forster
2017-03-08 b8a9a7fd9e22df06955bb76179e9ac5c0926e57c
Add optional renderInput prop
1 files modified
31 ■■■■■ changed files
DateTime.js 31 ●●●●● patch | view | raw | blame | history
DateTime.js
@@ -416,16 +416,27 @@
            children = [];
        if ( this.props.input ) {
            children = [ React.createElement( 'input', assign({
                key: 'i',
                type: 'text',
                className: 'form-control',
                onClick: this.openCalendar,
                onFocus: this.openCalendar,
                onChange: this.onInputChange,
                onKeyDown: this.onInputKey,
                value: this.state.inputValue
            }, this.props.inputProps ))];
            if ( this.props.renderInput ) {
                children = children.concat( this.props.renderInput({
                    onClick: this.openCalendar,
                    onFocus: this.openCalendar,
                    onChange: this.onInputChange,
                    onKeyDown: this.onInputKey,
                    value: this.state.inputValue,
                    openCalendar: this.openCalendar,
                }) );
            } else {
                children = [ DOM.input( assign({
                    key: 'i',
                    type: 'text',
                    className: 'form-control',
                    onClick: this.openCalendar,
                    onFocus: this.openCalendar,
                    onChange: this.onInputChange,
                    onKeyDown: this.onInputKey,
                    value: this.state.inputValue
                }, this.props.inputProps ))];
            }
        } else {
            className += ' rdtStatic';
        }