react-bsonschema-form
Advanced tools
Comparing version 0.42.27 to 0.42.28
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -11,10 +11,6 @@ Object.defineProperty(exports, "__esModule", { | ||
var _react = require("react"); | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _lodash = require("lodash"); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -30,5 +26,5 @@ | ||
var debouncedHandleFormOnChange = _lodash2.default.debounce(function (self, value) { | ||
self.props.onChange(value); | ||
}, 500); | ||
function trim(value) { | ||
return typeof value === 'string' ? value.trim() : value; | ||
} | ||
@@ -43,5 +39,3 @@ var BaseInput = function (_React$Component) { | ||
_this.state = { | ||
delayedValue: _this.props.value | ||
}; | ||
_this.state = { value: _this.props.value }; | ||
return _this; | ||
@@ -51,20 +45,10 @@ } | ||
_createClass(BaseInput, [{ | ||
key: "componentWillReceiveProps", | ||
value: function componentWillReceiveProps(nextProps) { | ||
var value = nextProps.value; | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(_ref) { | ||
var value = _ref.value; | ||
this.setState({ delayedValue: value }); | ||
this.setState({ value: value }); | ||
} | ||
}, { | ||
key: "handleOnChange", | ||
value: function handleOnChange(e) { | ||
var value = e.target.value; | ||
if (typeof value === 'string') { | ||
value = value.trim(); | ||
} | ||
this.setState({ delayedValue: value }); | ||
debouncedHandleFormOnChange(this, value); | ||
} | ||
}, { | ||
key: "render", | ||
key: 'render', | ||
value: function render() { | ||
@@ -82,14 +66,18 @@ var _this2 = this; | ||
className = _props$className === undefined ? 'form-control' : _props$className, | ||
inputProps = _objectWithoutProperties(_props, ["readonly", "autofocus", "options", "schema", "formContext", "registry", "className"]); | ||
inputProps = _objectWithoutProperties(_props, ['readonly', 'autofocus', 'options', 'schema', 'formContext', 'registry', 'className']); | ||
var delayedValue = this.state.delayedValue; | ||
var value = this.state.value; | ||
return _react2.default.createElement("input", _extends({}, inputProps, { | ||
return _react2.default.createElement('input', _extends({}, inputProps, { | ||
className: className, | ||
readOnly: readonly, | ||
autoFocus: autofocus, | ||
value: typeof delayedValue === "undefined" ? "" : delayedValue, | ||
onChange: function onChange(e) { | ||
return _this2.handleOnChange(e); | ||
value: typeof value === "undefined" ? "" : value, | ||
onBlur: function onBlur() { | ||
return _this2.props.onChange(trim(value)); | ||
}, | ||
onChange: function onChange(_ref2) { | ||
var value = _ref2.target.value; | ||
return _this2.setState({ value: value }); | ||
} })); | ||
@@ -96,0 +84,0 @@ } |
{ | ||
"name": "react-bsonschema-form", | ||
"version": "0.42.27", | ||
"version": "0.42.28", | ||
"description": "A simple React component capable of building HTML forms out of a JSON schema.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
3887695
5140