availity-reactstrap-validation
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
@@ -0,1 +1,11 @@ | ||
<a name="2.0.0-beta.2"></a> | ||
# [2.0.0-beta.2](https://github.com/Availity/availity-reactstrap-validation/compare/v2.0.0-beta.1...v2.0.0-beta.2) (2018-03-22) | ||
### Bug Fixes | ||
* **AvField:** trigger updates for middle components ([9e49d5e](https://github.com/Availity/availity-reactstrap-validation/commit/9e49d5e)) | ||
<a name="2.0.0-beta.1"></a> | ||
@@ -2,0 +12,0 @@ # [2.0.0-beta.1](https://github.com/Availity/availity-reactstrap-validation/compare/v2.0.0-beta...v2.0.0-beta.1) (2018-03-22) |
@@ -9,2 +9,6 @@ 'use strict'; | ||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); | ||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
@@ -14,6 +18,2 @@ | ||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); | ||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
@@ -65,2 +65,20 @@ | ||
AvField.prototype.getChildContext = function getChildContext() { | ||
var _this2 = this; | ||
this.FormCtrl = (0, _extends3.default)({}, this.context.FormCtrl); | ||
var registerValidator = this.FormCtrl.register; | ||
this.FormCtrl.register = function (input) { | ||
var updater = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : input && input.forceUpdate; | ||
registerValidator(input, function () { | ||
_this2.forceUpdate(); | ||
if (updater) updater(); | ||
}); | ||
}; | ||
return { | ||
FormCtrl: this.FormCtrl | ||
}; | ||
}; | ||
AvField.prototype.render = function render() { | ||
@@ -169,2 +187,5 @@ var row = false; | ||
}; | ||
AvField.childContextTypes = { | ||
FormCtrl: _propTypes2.default.object.isRequired | ||
}; | ||
exports.default = AvField; |
@@ -276,4 +276,4 @@ 'use strict'; | ||
// this is just until a more intelligent way to determine which inputs need updated is implemented in v3 | ||
(0, _keys2.default)(this._inputs).forEach(function (inputName) { | ||
return _this6._inputs[inputName] && _this6._inputs[inputName].forceUpdate(); | ||
(0, _keys2.default)(this._updaters).forEach(function (inputName) { | ||
return _this6._updaters[inputName] && _this6._inputs[inputName] && _this6._updaters[inputName].call(_this6._inputs[inputName]); | ||
}); | ||
@@ -280,0 +280,0 @@ }; |
@@ -60,3 +60,3 @@ 'use strict'; | ||
_this2.setState({ input: input }); | ||
registerValidator(input); | ||
registerValidator(input, _this2.update.bind(_this2, input)); | ||
}; | ||
@@ -78,2 +78,7 @@ return { | ||
AvGroup.prototype.update = function update(input) { | ||
if (input && input.forceUpdate) input.forceUpdate(); | ||
this.forceUpdate(); | ||
}; | ||
AvGroup.prototype.render = function render() { | ||
@@ -80,0 +85,0 @@ var validation = this.getInputState(); |
@@ -22,3 +22,2 @@ 'use strict'; | ||
function validComponent(input) { | ||
var type = input && input.props ? input.props.type : undefined; | ||
var name = input && input.props ? input.props.name : undefined; | ||
@@ -30,3 +29,3 @@ | ||
return { type: type, name: name }; | ||
return { name: name }; | ||
} | ||
@@ -43,2 +42,3 @@ | ||
InputContainer.prototype.componentWillMount = function componentWillMount() { | ||
this._updaters = {}; | ||
this._inputs = {}; | ||
@@ -48,14 +48,9 @@ }; | ||
InputContainer.prototype.registerInput = function registerInput(input) { | ||
var _validComponent = validComponent(input), | ||
type = _validComponent.type, | ||
var updater = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : input && input.forceUpdate; | ||
var _validComponent = validComponent(input, updater), | ||
name = _validComponent.name; | ||
if (type === 'radio') { | ||
this._inputs[name] = this._inputs[name] || []; | ||
if (this._inputs[name].indexOf(input) < 0) { | ||
this._inputs[name].push(input); | ||
} | ||
} else { | ||
this._inputs[name] = input; | ||
} | ||
this._updaters[name] = updater; | ||
this._inputs[name] = input; | ||
}; | ||
@@ -65,12 +60,6 @@ | ||
var _validComponent2 = validComponent(input), | ||
type = _validComponent2.type, | ||
name = _validComponent2.name; | ||
if (type === 'radio') { | ||
this._inputs[name] = this._inputs[name].filter(function (ipt) { | ||
return ipt !== input; | ||
}); | ||
} else { | ||
delete this._inputs[name]; | ||
} | ||
delete this._updaters[name]; | ||
delete this._inputs[name]; | ||
}; | ||
@@ -77,0 +66,0 @@ |
@@ -211,2 +211,7 @@ 'use strict'; | ||
AvRadioGroup.prototype.update = function update() { | ||
this.forceUpdate(); | ||
this.updateInputs(); | ||
}; | ||
AvRadioGroup.prototype.updateValidations = function updateValidations() { | ||
@@ -231,3 +236,3 @@ var _this3 = this; | ||
this.context.FormCtrl.register(this); | ||
this.context.FormCtrl.register(this, this.update.bind(this)); | ||
this.validate(); | ||
@@ -290,3 +295,3 @@ }; | ||
_reactstrap.FormGroup, | ||
(0, _extends3.default)({ tag: 'fieldset' }, attributes, { color: validation.color }), | ||
(0, _extends3.default)({ tag: 'fieldset' }, attributes), | ||
legend, | ||
@@ -293,0 +298,0 @@ _react2.default.createElement( |
{ | ||
"name": "availity-reactstrap-validation", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"author": "Evan Sharp <evan.sharp@availity.com>", | ||
@@ -5,0 +5,0 @@ "description": "Form validation helpers for reactstrap", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
5824485
34388