easy-react-form
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -173,2 +173,9 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'getNode', | ||
value: function getNode() { | ||
if (this.field.current) { | ||
return _reactDom2.default.findDOMNode(this.field.current); | ||
} | ||
} | ||
@@ -280,2 +287,4 @@ // Focuses on a field (can be called externally through a ref). | ||
this.focus = function () { | ||
// `.focus()` could theoretically maybe potentially be called in a timeout, | ||
// so check if the component is still mounted. | ||
if (!_this2.mounted) { | ||
@@ -294,9 +303,23 @@ return; | ||
// Generic DOM focusing. | ||
_reactDom2.default.findDOMNode(_this2.field.current).focus(); | ||
var node = _this2.getNode(); | ||
if (node) { | ||
node.focus(); | ||
} else { | ||
console.error('Couldn\'t focus on field "' + _this2.props.name + '": DOM Node not found. ' + STATELESS_COMPONENT_HINT); | ||
} | ||
}; | ||
this.scroll = function () { | ||
if (_this2.mounted) { | ||
(0, _utility.scrollTo)(_reactDom2.default.findDOMNode(_this2.field.current)); | ||
// `.scroll()` could theoretically maybe potentially be called in a timeout, | ||
// so check if the component is still mounted. | ||
if (!_this2.mounted) { | ||
return; | ||
} | ||
var node = _this2.getNode(); | ||
if (node) { | ||
(0, _utility.scrollTo)(node); | ||
} else { | ||
console.error('Couldn\'t scroll to field "' + _this2.props.name + '": DOM Node not found. ' + STATELESS_COMPONENT_HINT); | ||
} | ||
}; | ||
@@ -328,2 +351,4 @@ | ||
} | ||
var STATELESS_COMPONENT_HINT = 'For example, if it\'s a "stateless" component then rewrite it as a "React.Component" having a ".focus()" method.'; | ||
//# sourceMappingURL=field.js.map |
@@ -173,2 +173,9 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'getNode', | ||
value: function getNode() { | ||
if (this.field.current) { | ||
return _reactDom2.default.findDOMNode(this.field.current); | ||
} | ||
} | ||
@@ -280,2 +287,4 @@ // Focuses on a field (can be called externally through a ref). | ||
this.focus = function () { | ||
// `.focus()` could theoretically maybe potentially be called in a timeout, | ||
// so check if the component is still mounted. | ||
if (!_this2.mounted) { | ||
@@ -294,9 +303,23 @@ return; | ||
// Generic DOM focusing. | ||
_reactDom2.default.findDOMNode(_this2.field.current).focus(); | ||
var node = _this2.getNode(); | ||
if (node) { | ||
node.focus(); | ||
} else { | ||
console.error('Couldn\'t focus on field "' + _this2.props.name + '": DOM Node not found. ' + STATELESS_COMPONENT_HINT); | ||
} | ||
}; | ||
this.scroll = function () { | ||
if (_this2.mounted) { | ||
(0, _utility.scrollTo)(_reactDom2.default.findDOMNode(_this2.field.current)); | ||
// `.scroll()` could theoretically maybe potentially be called in a timeout, | ||
// so check if the component is still mounted. | ||
if (!_this2.mounted) { | ||
return; | ||
} | ||
var node = _this2.getNode(); | ||
if (node) { | ||
(0, _utility.scrollTo)(node); | ||
} else { | ||
console.error('Couldn\'t scroll to field "' + _this2.props.name + '": DOM Node not found. ' + STATELESS_COMPONENT_HINT); | ||
} | ||
}; | ||
@@ -328,2 +351,4 @@ | ||
} | ||
var STATELESS_COMPONENT_HINT = 'For example, if it\'s a "stateless" component then rewrite it as a "React.Component" having a ".focus()" method.'; | ||
//# sourceMappingURL=field.js.map |
{ | ||
"name": "easy-react-form", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Simple, fast and easy-to-use React Form.", | ||
@@ -5,0 +5,0 @@ "main": "index.commonjs.js", |
Sorry, the diff of this file is not supported yet
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
173585
1813