availity-reactstrap-validation
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -69,7 +69,7 @@ 'use strict'; | ||
this.FormCtrl.register = function (input) { | ||
var updater = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : input && input.forceUpdate; | ||
var updater = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : input && input.setState && input.setState.bind(input); | ||
registerValidator(input, function () { | ||
_this2.forceUpdate(); | ||
if (updater) updater(); | ||
_this2.setState({}); | ||
if (updater) updater({}); | ||
}); | ||
@@ -139,6 +139,28 @@ }; | ||
) : null; | ||
var inputRow = row ? _react2.default.createElement( | ||
_reactstrap.Col, | ||
col, | ||
input, | ||
feedback, | ||
help | ||
) : input; | ||
var check = attributes.type === 'checkbox'; | ||
if ((check || attributes.type === 'radio') && attributes.tag === _reactstrap.CustomInput) { | ||
return _react2.default.createElement( | ||
_AvGroup2.default, | ||
{ className: 'mb-0' }, | ||
_react2.default.createElement( | ||
_AvInput2.default, | ||
this.props, | ||
feedback, | ||
help | ||
) | ||
); | ||
} | ||
return _react2.default.createElement( | ||
_AvGroup2.default, | ||
(0, _extends3.default)({ disabled: disabled, row: row }, groupAttrs), | ||
(0, _extends3.default)({ check: check, disabled: disabled, row: row }, groupAttrs), | ||
check && inputRow, | ||
label && _react2.default.createElement( | ||
@@ -154,9 +176,3 @@ _reactstrap.Label, | ||
), | ||
row ? _react2.default.createElement( | ||
_reactstrap.Col, | ||
col, | ||
input, | ||
feedback, | ||
help | ||
) : input, | ||
!check && inputRow, | ||
!row && feedback, | ||
@@ -163,0 +179,0 @@ !row && help |
@@ -307,3 +307,3 @@ 'use strict'; | ||
(0, _keys2.default)(_this6._updaters).forEach(function (inputName) { | ||
return _this6._updaters[inputName] && _this6._inputs[inputName] && _this6._updaters[inputName].call(_this6._inputs[inputName]); | ||
return _this6._updaters[inputName] && _this6._inputs[inputName] && _this6._updaters[inputName].call(_this6._inputs[inputName], {}); | ||
}); | ||
@@ -310,0 +310,0 @@ }, 250); |
@@ -78,4 +78,4 @@ 'use strict'; | ||
AvGroup.prototype.update = function update(input) { | ||
if (input && input.forceUpdate) input.forceUpdate(); | ||
this.forceUpdate(); | ||
if (input && input.setState) input.setState.call(input, {}); | ||
this.setState({}); | ||
}; | ||
@@ -82,0 +82,0 @@ |
@@ -74,3 +74,5 @@ 'use strict'; | ||
getRef = _props.getRef, | ||
attributes = (0, _objectWithoutProperties3.default)(_props, ['errorMessage', 'validate', 'validationEvent', 'state', 'trueValue', 'falseValue', 'valueParser', 'valueFormatter', 'className', 'tag', 'getRef']); | ||
_props$id = _props.id, | ||
id = _props$id === undefined ? this.props.name : _props$id, | ||
attributes = (0, _objectWithoutProperties3.default)(_props, ['errorMessage', 'validate', 'validationEvent', 'state', 'trueValue', 'falseValue', 'valueParser', 'valueFormatter', 'className', 'tag', 'getRef', 'id']); | ||
@@ -81,3 +83,3 @@ | ||
var classes = (0, _classnames2.default)(className, touched ? 'is-touched' : 'is-untouched', this.context.FormCtrl.isDirty(this.props.name) ? 'is-dirty' : 'is-pristine', this.context.FormCtrl.isBad(this.props.name) ? 'is-bad-input' : null, hasError ? 'av-invalid' : 'av-valid', touched && hasError && 'is-invalid'); | ||
var classes = (0, _classnames2.default)(className, touched ? 'is-touched' : 'is-untouched', this.context.FormCtrl.isDirty(this.props.name) ? 'is-dirty' : 'is-pristine', this.context.FormCtrl.isBad(this.props.name) ? 'is-bad-input' : null, hasError ? 'av-invalid' : 'av-valid', touched && hasError && 'is-invalid', attributes.type === 'checkbox' && touched && hasError && 'was-validated'); | ||
@@ -90,3 +92,4 @@ var value = this.getViewValue(); | ||
className: classes, | ||
value: value | ||
value: value, | ||
id: id | ||
})); | ||
@@ -93,0 +96,0 @@ }; |
@@ -53,3 +53,3 @@ 'use strict'; | ||
InputContainer.prototype.registerInput = function registerInput(input) { | ||
var updater = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : input && input.forceUpdate; | ||
var updater = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : input && input.setState && input.setState.bind(input); | ||
@@ -56,0 +56,0 @@ var _validComponent = validComponent(input, updater), |
@@ -49,3 +49,3 @@ 'use strict'; | ||
var radioPropTypes = (0, _assign2.default)({}, _AvInput2.default.propTypes); | ||
var radioPropTypes = (0, _assign2.default)({}, _AvInput2.default.propTypes, { customInput: _propTypes2.default.bool }); | ||
delete radioPropTypes.name; | ||
@@ -80,3 +80,4 @@ | ||
id = _props.id, | ||
attributes = (0, _objectWithoutProperties3.default)(_props, ['className', 'id']); | ||
customInput = _props.customInput, | ||
attributes = (0, _objectWithoutProperties3.default)(_props, ['className', 'id', 'customInput']); | ||
@@ -91,2 +92,18 @@ | ||
if (customInput) { | ||
return _react2.default.createElement(_reactstrap.CustomInput, (0, _extends3.default)({ name: groupProps.name, | ||
type: 'radio' | ||
}, attributes, { | ||
inline: groupProps.inline, | ||
disabled: this.props.disabled || this.context.FormCtrl.isDisabled(), | ||
id: id || 'radio-' + groupProps.name + '-' + this.props.value, | ||
className: classes, | ||
onChange: this.onChangeHandler, | ||
checked: this.props.value === groupProps.value, | ||
value: this.props.value && this.props.value.toString(), | ||
required: groupProps.required, | ||
label: this.props.label | ||
})); | ||
} | ||
return _react2.default.createElement( | ||
@@ -93,0 +110,0 @@ _reactstrap.FormGroup, |
@@ -217,3 +217,3 @@ 'use strict'; | ||
AvRadioGroup.prototype.update = function update() { | ||
this.forceUpdate(); | ||
this.setState({}); | ||
this.updateInputs(); | ||
@@ -247,4 +247,5 @@ }; | ||
this._inputs.forEach(function (input) { | ||
return input.forceUpdate(); | ||
return input.setState.call(input, {}); | ||
}); | ||
this.setState({}); | ||
}; | ||
@@ -298,5 +299,7 @@ | ||
var groupClass = (0, _classnames2.default)(attributes.className, touched && hasError && 'was-validated'); | ||
return _react2.default.createElement( | ||
_reactstrap.FormGroup, | ||
(0, _extends3.default)({ tag: 'fieldset' }, attributes), | ||
(0, _extends3.default)({ tag: 'fieldset' }, attributes, { className: groupClass }), | ||
legend, | ||
@@ -303,0 +306,0 @@ _react2.default.createElement( |
{ | ||
"name": "availity-reactstrap-validation", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"author": "Evan Sharp <evan.sharp@availity.com>", | ||
@@ -5,0 +5,0 @@ "description": "Form validation helpers for reactstrap", |
@@ -65,3 +65,2 @@ [![Build Status](https://travis-ci.org/Availity/availity-reactstrap-validation.svg?branch=master)](https://travis-ci.org/Availity/availity-reactstrap-validation) [![Coverage Status](https://coveralls.io/repos/github/Availity/availity-reactstrap-validation/badge.svg?branch=master)](https://coveralls.io/github/Availity/availity-reactstrap-validation?branch=master) | ||
## License | ||
Copyright (c) 2016 Availity, LLC | ||
## LICENSE [MIT](LICENSE) |
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
6317142
35958
66