Comparing version 0.4.1 to 0.4.2
@@ -69,2 +69,7 @@ 'use strict'; | ||
_createClass(Form, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.componentDidUpdate(); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
@@ -86,11 +91,22 @@ value: function componentWillReceiveProps(nextProps) { | ||
var fieldsKeys = Object.keys(fields); | ||
var removeFields = {}; | ||
var changedFields = {}; | ||
fieldsKeys.forEach(function (s) { | ||
if (!fieldsMeta[s]) { | ||
delete fields[s]; | ||
removeFields[s] = undefined; | ||
changedFields[s] = undefined; | ||
} | ||
}); | ||
if (onFieldsChange && !(0, _utils.isEmptyObject)(removeFields)) { | ||
onFieldsChange(this.props, removeFields); | ||
if (onFieldsChange) { | ||
Object.keys(fieldsMeta).forEach(function (name) { | ||
var fieldMeta = fieldsMeta[name]; | ||
var field = fields[name] || {}; | ||
if ('initialValue' in fieldMeta && !('value' in field)) { | ||
changedFields[name] = { | ||
value: fieldMeta.initialValue | ||
}; | ||
} | ||
}); | ||
if (!(0, _utils.isEmptyObject)(changedFields)) { | ||
onFieldsChange(this.props, changedFields); | ||
} | ||
} | ||
@@ -205,5 +221,5 @@ } | ||
var fieldsMeta = this.fieldsMeta; | ||
return Object.keys(this.fieldsMeta).filter(function (name) { | ||
return fieldsMeta ? Object.keys(fieldsMeta).filter(function (name) { | ||
return !fieldsMeta[name].hidden; | ||
}); | ||
}) : []; | ||
} | ||
@@ -353,5 +369,3 @@ }, { | ||
var field = _this4.getField(name, true); | ||
if (!('value' in field) && 'initialValue' in fieldMeta) { | ||
field.value = fieldMeta.initialValue; | ||
} | ||
field.value = _this4.getFieldValue(name); | ||
return field; | ||
@@ -358,0 +372,0 @@ }).filter(function (f) { |
{ | ||
"name": "rc-form", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "React High Order Form Component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
246646
4594