formsy-material-ui
Advanced tools
Comparing version
## Changelog | ||
* 0.5.5 revert FormsyText internal value setting method | ||
* 0.5.4 use FormsyText internal _value to allow external setValue calls | ||
@@ -4,0 +5,0 @@ support requiredError on FormsyDate |
@@ -59,2 +59,6 @@ 'use strict'; | ||
getInitialState: function getInitialState() { | ||
var value = this.controlledValue(); | ||
return { value: value }; | ||
}, | ||
componentWillMount: function componentWillMount() { | ||
@@ -70,3 +74,3 @@ this.setValue(this.controlledValue()); | ||
if (isValueChanging || this.props.defaultValue === this.getValue()) { | ||
this.setState({ isValid: isValid }); | ||
this.setState({ value: value, isValid: isValid }); | ||
this.setValue(value); | ||
@@ -84,3 +88,3 @@ } | ||
this.setValue(value); | ||
this.setState({ isValid: isValid }); | ||
this.setState({ value: value, isValid: isValid }); | ||
} | ||
@@ -119,4 +123,2 @@ }, | ||
// If it becomes invalid, and there isn't an error message, invalidate without error. | ||
} else { | ||
this.setState({ _value: event.currentTarget.value, _isPristine: false }); | ||
} | ||
@@ -126,3 +128,4 @@ } | ||
this.setState({ isValid: this.isValidValue(event.currentTarget.value) }); | ||
// Controlled component | ||
this.setState({ value: event.currentTarget.value, isValid: this.isValidValue(event.currentTarget.value) }); | ||
if (this.props.onChange) this.props.onChange(event, event.currentTarget.value); | ||
@@ -167,3 +170,3 @@ }, | ||
ref: this.setMuiComponentAndMaybeFocus, | ||
value: this.getValue(), | ||
value: this.state.value, | ||
underlineStyle: this.state.isValid ? { color: this.validationColor() } : underlineStyle, | ||
@@ -170,0 +173,0 @@ underlineFocusStyle: this.state.isValid ? { color: this.validationColor() } : underlineFocusStyle |
{ | ||
"name": "formsy-material-ui", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "A formsy-react compatibility wrapper for Material-UI form components.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -33,2 +33,7 @@ import React from 'react'; | ||
getInitialState() { | ||
const value = this.controlledValue(); | ||
return { value }; | ||
}, | ||
componentWillMount() { | ||
@@ -45,3 +50,3 @@ this.setValue(this.controlledValue()); | ||
if (isValueChanging || this.props.defaultValue === this.getValue()) { | ||
this.setState({ isValid }); | ||
this.setState({ value, isValid }); | ||
this.setValue(value); | ||
@@ -59,3 +64,3 @@ } | ||
this.setValue(value); | ||
this.setState({ isValid }); | ||
this.setState({ value, isValid }); | ||
} | ||
@@ -94,4 +99,2 @@ }, | ||
// If it becomes invalid, and there isn't an error message, invalidate without error. | ||
} else { | ||
this.setState({ _value: event.currentTarget.value, _isPristine: false }); | ||
} | ||
@@ -101,3 +104,4 @@ } | ||
this.setState({ isValid: this.isValidValue(event.currentTarget.value) }); | ||
// Controlled component | ||
this.setState({ value: event.currentTarget.value, isValid: this.isValidValue(event.currentTarget.value) }); | ||
if (this.props.onChange) this.props.onChange(event, event.currentTarget.value); | ||
@@ -124,4 +128,3 @@ }, | ||
value, // eslint-disable-line no-unused-vars | ||
...rest, | ||
} = this.props; | ||
...rest } = this.props; | ||
@@ -141,3 +144,3 @@ const { isRequired, isPristine, isValid, isFormSubmitted } = this; | ||
ref={this.setMuiComponentAndMaybeFocus} | ||
value={this.getValue()} | ||
value={this.state.value} | ||
underlineStyle={this.state.isValid ? { color: this.validationColor() } : underlineStyle} | ||
@@ -144,0 +147,0 @@ underlineFocusStyle={this.state.isValid ? { color: this.validationColor() } : underlineFocusStyle} |
60603
0.38%1195
0.42%