Merge pull request #546 from mgcrea/patch-feat-name-prop

feat(datepicker,timepicker): add support for `name` prop
old
Javi Velasco 2016-06-07 07:53:10 +02:00
commit 0b6e8ca2e4
5 changed files with 13 additions and 3 deletions

View File

@ -23,6 +23,7 @@ const factory = (Input, DatePickerDialog) => {
]), ]),
inputClassName: PropTypes.string, inputClassName: PropTypes.string,
inputFormat: PropTypes.func, inputFormat: PropTypes.func,
name: PropTypes.string,
label: PropTypes.string, label: PropTypes.string,
maxDate: PropTypes.object, maxDate: PropTypes.object,
minDate: PropTypes.object, minDate: PropTypes.object,
@ -66,6 +67,7 @@ const factory = (Input, DatePickerDialog) => {
className={classnames(this.props.theme.input, {[inputClassName]: inputClassName })} className={classnames(this.props.theme.input, {[inputClassName]: inputClassName })}
error={this.props.error} error={this.props.error}
onMouseDown={this.handleInputMouseDown} onMouseDown={this.handleInputMouseDown}
name={this.props.name}
label={this.props.label} label={this.props.label}
readOnly readOnly
type='text' type='text'
@ -76,6 +78,7 @@ const factory = (Input, DatePickerDialog) => {
autoOk={this.props.autoOk} autoOk={this.props.autoOk}
active={this.state.active} active={this.state.active}
className={this.props.className} className={this.props.className}
name={this.props.name}
maxDate={this.props.maxDate} maxDate={this.props.maxDate}
minDate={this.props.minDate} minDate={this.props.minDate}
onDismiss={this.handleDismiss} onDismiss={this.handleDismiss}

View File

@ -10,6 +10,7 @@ const factory = (Dialog, Calendar) => {
className: PropTypes.string, className: PropTypes.string,
maxDate: PropTypes.object, maxDate: PropTypes.object,
minDate: PropTypes.object, minDate: PropTypes.object,
name: PropTypes.string,
onDismiss: PropTypes.func, onDismiss: PropTypes.func,
onSelect: PropTypes.func, onSelect: PropTypes.func,
theme: PropTypes.shape({ theme: PropTypes.shape({
@ -74,7 +75,7 @@ const factory = (Dialog, Calendar) => {
actions = [ actions = [
{ label: 'Cancel', className: this.props.theme.button, onClick: this.props.onDismiss }, { label: 'Cancel', className: this.props.theme.button, onClick: this.props.onDismiss },
{ label: 'Ok', className: this.props.theme.button, onClick: this.handleSelect } { label: 'Ok', className: this.props.theme.button, name: this.props.name, onClick: this.handleSelect }
]; ];
render () { render () {

View File

@ -17,6 +17,7 @@ const factory = (FontIcon) => {
React.PropTypes.string, React.PropTypes.string,
React.PropTypes.element React.PropTypes.element
]), ]),
name: React.PropTypes.string,
label: React.PropTypes.string, label: React.PropTypes.string,
maxLength: React.PropTypes.number, maxLength: React.PropTypes.number,
multiline: React.PropTypes.bool, multiline: React.PropTypes.bool,
@ -67,7 +68,7 @@ const factory = (FontIcon) => {
render () { render () {
const { children, disabled, error, floating, hint, icon, const { children, disabled, error, floating, hint, icon,
label: labelText, maxLength, multiline, required, name, label: labelText, maxLength, multiline, required,
theme, type, value, ...others} = this.props; theme, type, value, ...others} = this.props;
const length = maxLength && value ? value.length : 0; const length = maxLength && value ? value.length : 0;
const labelClassName = classnames(theme.label, {[theme.fixed]: !floating}); const labelClassName = classnames(theme.label, {[theme.fixed]: !floating});
@ -87,6 +88,7 @@ const factory = (FontIcon) => {
onChange: this.handleChange, onChange: this.handleChange,
ref: 'input', ref: 'input',
role: 'input', role: 'input',
name,
disabled, disabled,
required, required,
type, type,

View File

@ -15,6 +15,7 @@ const factory = (TimePickerDialog, Input) => {
error: PropTypes.string, error: PropTypes.string,
format: PropTypes.oneOf(['24hr', 'ampm']), format: PropTypes.oneOf(['24hr', 'ampm']),
inputClassName: PropTypes.string, inputClassName: PropTypes.string,
name: PropTypes.string,
label: PropTypes.string, label: PropTypes.string,
onChange: PropTypes.func, onChange: PropTypes.func,
theme: PropTypes.shape({ theme: PropTypes.shape({
@ -54,6 +55,7 @@ const factory = (TimePickerDialog, Input) => {
<Input <Input
className={classnames(theme.input, {[inputClassName]: inputClassName })} className={classnames(theme.input, {[inputClassName]: inputClassName })}
error={this.props.error} error={this.props.error}
name={this.props.name}
label={this.props.label} label={this.props.label}
onMouseDown={this.handleInputMouseDown} onMouseDown={this.handleInputMouseDown}
readOnly readOnly
@ -63,6 +65,7 @@ const factory = (TimePickerDialog, Input) => {
<TimePickerDialog <TimePickerDialog
active={this.state.active} active={this.state.active}
className={this.props.className} className={this.props.className}
name={this.props.name}
format={format} format={format}
onDismiss={this.handleDismiss} onDismiss={this.handleDismiss}
onSelect={this.handleSelect} onSelect={this.handleSelect}

View File

@ -9,6 +9,7 @@ const factory = (Dialog) => {
active: PropTypes.bool, active: PropTypes.bool,
className: PropTypes.string, className: PropTypes.string,
format: PropTypes.oneOf(['24hr', 'ampm']), format: PropTypes.oneOf(['24hr', 'ampm']),
name: PropTypes.string,
onDismiss: PropTypes.func, onDismiss: PropTypes.func,
onSelect: PropTypes.func, onSelect: PropTypes.func,
theme: PropTypes.shape({ theme: PropTypes.shape({
@ -68,7 +69,7 @@ const factory = (Dialog) => {
actions = [ actions = [
{ label: 'Cancel', className: this.props.theme.button, onClick: this.props.onDismiss }, { label: 'Cancel', className: this.props.theme.button, onClick: this.props.onDismiss },
{ label: 'Ok', className: this.props.theme.button, onClick: this.handleSelect } { label: 'Ok', className: this.props.theme.button, name: this.props.name, onClick: this.handleSelect }
]; ];
formatHours () { formatHours () {