formsy-semantic-ui-react
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -12,3 +12,3 @@ 'use strict'; | ||
var _dec, _class, _class2, _temp; | ||
var _dec, _class, _class2, _temp2; | ||
@@ -37,9 +37,22 @@ var _react = require('react'); | ||
var FormsyCheckbox = (_dec = (0, _formsyReact.Decorator)(), _dec(_class = (_temp = _class2 = function (_Component) { | ||
var FormsyCheckbox = (_dec = (0, _formsyReact.Decorator)(), _dec(_class = (_temp2 = _class2 = function (_Component) { | ||
_inherits(FormsyCheckbox, _Component); | ||
function FormsyCheckbox() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, FormsyCheckbox); | ||
return _possibleConstructorReturn(this, (FormsyCheckbox.__proto__ || Object.getPrototypeOf(FormsyCheckbox)).apply(this, arguments)); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = FormsyCheckbox.__proto__ || Object.getPrototypeOf(FormsyCheckbox)).call.apply(_ref, [this].concat(args))), _this), _this.handleChange = function (e, _ref2) { | ||
var checked = _ref2.checked; | ||
_this.props.setValue(checked); | ||
if (_this.props.onChange) _this.props.onChange(); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
@@ -61,13 +74,2 @@ | ||
}, { | ||
key: 'handleChange', | ||
value: function () { | ||
function handleChange(e, _ref) { | ||
var checked = _ref.checked; | ||
this.props.setValue(checked); | ||
} | ||
return handleChange; | ||
}() | ||
}, { | ||
key: 'render', | ||
@@ -88,6 +90,6 @@ value: function () { | ||
var checkboxProps = _extends({ | ||
var checkboxProps = _extends({}, (0, _utils.filterSuirElementProps)(this.props), { | ||
checked: getValue(), | ||
onChange: this.handleChange.bind(this) | ||
}, (0, _utils.filterSuirElementProps)(this.props)); | ||
}); | ||
@@ -119,6 +121,7 @@ if (as === _semanticUiReact.Checkbox || as === _semanticUiReact.Radio) delete checkboxProps.error; | ||
getErrorMessage: _propTypes2['default'].func.isRequired, | ||
errorLabel: _propTypes2['default'].element | ||
errorLabel: _propTypes2['default'].element, | ||
onChange: _propTypes2['default'].func | ||
}, _class2.defaultProps = { | ||
as: _semanticUiReact.Checkbox | ||
}, _temp)) || _class); | ||
}, _temp2)) || _class); | ||
exports['default'] = FormsyCheckbox; |
@@ -55,6 +55,8 @@ 'use strict'; | ||
getValue = _this$props.getValue, | ||
setValue = _this$props.setValue; | ||
setValue = _this$props.setValue, | ||
onChange = _this$props.onChange; | ||
if (multiple && getValue() && getValue().length > value.length) _this.showError(); | ||
setValue(value); | ||
if (onChange) onChange(); | ||
}, _this.showError = function () { | ||
@@ -109,3 +111,3 @@ return _this.setState({ allowError: true }); | ||
var dropdownProps = _extends({ | ||
var dropdownProps = _extends({}, (0, _utils.filterSuirElementProps)(this.props), { | ||
onChange: this.handleChange, | ||
@@ -116,3 +118,3 @@ onBlur: this.handleBlur, | ||
error: error | ||
}, (0, _utils.filterSuirElementProps)(this.props)); | ||
}); | ||
@@ -156,2 +158,3 @@ var dropdownNode = shortHandMode ? (0, _react.createElement)(as).props.control : as; | ||
getErrorMessage: _propTypes2['default'].func.isRequired, | ||
onChange: _propTypes2['default'].func, | ||
validationError: _propTypes2['default'].string, | ||
@@ -158,0 +161,0 @@ validationErrors: _propTypes2['default'].object, |
@@ -61,2 +61,3 @@ 'use strict'; | ||
_this.setInputValue(value); | ||
if (_this.props.onChange) _this.props.onChange(); | ||
if (_this.props.instantValidation) _this.showError(); | ||
@@ -113,3 +114,3 @@ }, _this.handleBlur = function () { | ||
var inputProps = _extends({ | ||
var inputProps = _extends({}, (0, _utils.filterSuirElementProps)(this.props), { | ||
value: value || isPristine() && defaultValue || '', | ||
@@ -120,3 +121,3 @@ onChange: this.handleChange, | ||
label: label | ||
}, (0, _utils.filterSuirElementProps)(this.props)); | ||
}); | ||
@@ -163,2 +164,3 @@ var shortHandMode = as === _semanticUiReact.Form.Input || as === _semanticUiReact.Form.TextArea; | ||
getValue: _propTypes2['default'].func.isRequired, | ||
onChange: _propTypes2['default'].func, | ||
isPristine: _propTypes2['default'].func.isRequired, | ||
@@ -165,0 +167,0 @@ getErrorMessage: _propTypes2['default'].func.isRequired, |
@@ -50,2 +50,3 @@ 'use strict'; | ||
_this.props.setValue(input.value); | ||
if (_this.props.onChange) _this.props.onChange(); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -117,2 +118,3 @@ } | ||
isPristine: _propTypes2['default'].func.isRequired, | ||
onChange: _propTypes2['default'].func, | ||
defaultSelected: _propTypes2['default'].string, | ||
@@ -119,0 +121,0 @@ errorLabel: _propTypes2['default'].element, |
{ | ||
"name": "formsy-semantic-ui-react", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"description": "Formsy-React wrappers for Semantic-Ui-React's form Components", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -20,2 +20,3 @@ import React, { Component, createElement, cloneElement } from 'react'; | ||
errorLabel: PropTypes.element, | ||
onChange: PropTypes.func, | ||
} | ||
@@ -32,4 +33,5 @@ | ||
handleChange(e, { checked }) { | ||
handleChange = (e, { checked }) => { | ||
this.props.setValue(checked); | ||
if (this.props.onChange) this.props.onChange(); | ||
} | ||
@@ -51,5 +53,5 @@ | ||
const checkboxProps = { | ||
...filterSuirElementProps(this.props), | ||
checked: getValue(), | ||
onChange: ::this.handleChange, | ||
...filterSuirElementProps(this.props), | ||
}; | ||
@@ -56,0 +58,0 @@ |
@@ -33,2 +33,3 @@ import React, { Component, createElement, cloneElement } from 'react'; | ||
getErrorMessage: PropTypes.func.isRequired, | ||
onChange: PropTypes.func, | ||
validationError: PropTypes.string, | ||
@@ -58,5 +59,6 @@ validationErrors: PropTypes.object, | ||
handleChange = (e, { value }) => { | ||
const { multiple, getValue, setValue } = this.props; | ||
const { multiple, getValue, setValue, onChange } = this.props; | ||
if (multiple && getValue() && getValue().length > value.length) this.showError(); | ||
setValue(value); | ||
if (onChange) onChange(); | ||
} | ||
@@ -85,2 +87,3 @@ | ||
const dropdownProps = { | ||
...filterSuirElementProps(this.props), | ||
onChange: this.handleChange, | ||
@@ -91,3 +94,2 @@ onBlur: this.handleBlur, | ||
error, | ||
...filterSuirElementProps(this.props), | ||
}; | ||
@@ -94,0 +96,0 @@ |
@@ -24,2 +24,3 @@ import React, { Component, createElement, cloneElement } from 'react'; | ||
getValue: PropTypes.func.isRequired, | ||
onChange: PropTypes.func, | ||
isPristine: PropTypes.func.isRequired, | ||
@@ -53,2 +54,3 @@ getErrorMessage: PropTypes.func.isRequired, | ||
this.setInputValue(value); | ||
if (this.props.onChange) this.props.onChange(); | ||
if (this.props.instantValidation) this.showError(); | ||
@@ -80,2 +82,3 @@ } | ||
const inputProps = { | ||
...filterSuirElementProps(this.props), | ||
value: value || isPristine() && defaultValue || '', | ||
@@ -86,3 +89,2 @@ onChange: this.handleChange, | ||
label, | ||
...filterSuirElementProps(this.props), | ||
}; | ||
@@ -89,0 +91,0 @@ |
@@ -17,2 +17,3 @@ import React, { Component, Children, cloneElement } from 'react'; | ||
isPristine: PropTypes.func.isRequired, | ||
onChange: PropTypes.func, | ||
defaultSelected: PropTypes.string, | ||
@@ -40,2 +41,3 @@ errorLabel: PropTypes.element, | ||
this.props.setValue(input.value); | ||
if (this.props.onChange) this.props.onChange(); | ||
} | ||
@@ -42,0 +44,0 @@ |
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
247091
2206