formsy-semantic-ui-react
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -56,2 +56,11 @@ 'use strict'; | ||
_createClass(FormsyInput, [{ | ||
key: 'componentDidMount', | ||
value: function () { | ||
function componentDidMount() { | ||
this.props.setValue(this.props.defaultValue); | ||
} | ||
return componentDidMount; | ||
}() | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
@@ -100,2 +109,4 @@ value: function () { | ||
getValue = _props.getValue, | ||
defaultValue = _props.defaultValue, | ||
isPristine = _props.isPristine, | ||
setValidations = _props.setValidations, | ||
@@ -107,3 +118,2 @@ setValue = _props.setValue, | ||
isFormDisabled = _props.isFormDisabled, | ||
isPristine = _props.isPristine, | ||
isFormSubmitted = _props.isFormSubmitted, | ||
@@ -117,3 +127,3 @@ isRequired = _props.isRequired, | ||
validationErrors = _props.validationErrors, | ||
otherProps = _objectWithoutProperties(_props, ['as', 'isValid', 'errorLabel', 'getErrorMessage', 'rootClassName', 'rootStyle', 'inputClassName', 'inputStyle', 'getValue', 'setValidations', 'setValue', 'resetValue', 'hasValue', 'getErrorMessages', 'isFormDisabled', 'isPristine', 'isFormSubmitted', 'isRequired', 'showRequired', 'showError', 'isValidValue', 'validations', 'validationError', 'validationErrors']); | ||
otherProps = _objectWithoutProperties(_props, ['as', 'isValid', 'errorLabel', 'getErrorMessage', 'rootClassName', 'rootStyle', 'inputClassName', 'inputStyle', 'getValue', 'defaultValue', 'isPristine', 'setValidations', 'setValue', 'resetValue', 'hasValue', 'getErrorMessages', 'isFormDisabled', 'isFormSubmitted', 'isRequired', 'showRequired', 'showError', 'isValidValue', 'validations', 'validationError', 'validationErrors']); | ||
@@ -129,3 +139,3 @@ var allowError = this.state.allowError; | ||
className: inputClassName, | ||
value: getValue() || '', | ||
value: getValue() || isPristine() && defaultValue || '', | ||
style: inputStyle | ||
@@ -153,2 +163,4 @@ }, otherProps); | ||
getValue: _react.PropTypes.func.isRequired, | ||
isPristine: _react.PropTypes.func.isRequired, | ||
defaultValue: _react.PropTypes.string, | ||
errorLabel: _react.PropTypes.element, | ||
@@ -165,4 +177,5 @@ onBlur: _react.PropTypes.func, | ||
}, _class2.defaultProps = { | ||
as: 'input' | ||
as: 'input', | ||
defaultValue: '' | ||
}, _temp2)) || _class); | ||
exports['default'] = FormsyInput; |
{ | ||
"name": "formsy-semantic-ui-react", | ||
"version" : "0.1.4", | ||
"version" : "0.1.5", | ||
"description": "Formsy wrappers for Semantic-Ui-React form elements", | ||
@@ -5,0 +5,0 @@ "repository" : { |
@@ -14,2 +14,4 @@ import React, { Component, PropTypes, cloneElement } from 'react'; | ||
getValue: PropTypes.func.isRequired, | ||
isPristine: PropTypes.func.isRequired, | ||
defaultValue: PropTypes.string, | ||
errorLabel: PropTypes.element, | ||
@@ -31,2 +33,3 @@ onBlur: PropTypes.func, | ||
as: 'input', | ||
defaultValue: '', | ||
} | ||
@@ -36,2 +39,6 @@ | ||
componentDidMount() { | ||
this.props.setValue(this.props.defaultValue); | ||
} | ||
componentWillReceiveProps(nextProps) { | ||
@@ -63,2 +70,4 @@ if (nextProps.isFormSubmitted()) this.setState({ allowError: true }); | ||
getValue, | ||
defaultValue, | ||
isPristine, | ||
setValidations, // eslint-disable-line | ||
@@ -70,3 +79,2 @@ setValue, // eslint-disable-line | ||
isFormDisabled, // eslint-disable-line | ||
isPristine, // eslint-disable-line | ||
isFormSubmitted, // eslint-disable-line | ||
@@ -91,3 +99,3 @@ isRequired, // eslint-disable-line | ||
className: inputClassName, | ||
value: getValue() || '', | ||
value: getValue() || isPristine() && defaultValue || '', | ||
style: inputStyle, | ||
@@ -94,0 +102,0 @@ ...otherProps, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1413347
1280