Comparing version 1.2.0 to 1.2.1
@@ -15,3 +15,3 @@ 'use strict'; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
@@ -59,11 +59,7 @@ var _react = require('react'); | ||
value: function componentDidMount() { | ||
var _this = this; | ||
var props = this.props; | ||
// parent ref not attached .... | ||
// if parent ref not attached .... use document.getElementById | ||
if (!props.disabled) { | ||
this.hackRefTimer = setTimeout(function () { | ||
var source = _react2['default'].findDOMNode(_this); | ||
props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); | ||
}, 0); | ||
var source = _react2['default'].findDOMNode(this); | ||
props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); | ||
if (props.monitorWindowResize) { | ||
@@ -75,7 +71,2 @@ this.startMonitorWindowResize(); | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() { | ||
this.clearHackRefTimer(); | ||
} | ||
}, { | ||
key: 'startMonitorWindowResize', | ||
@@ -96,10 +87,2 @@ value: function startMonitorWindowResize() { | ||
}, { | ||
key: 'clearHackRefTimer', | ||
value: function clearHackRefTimer() { | ||
if (this.hackRefTimer) { | ||
clearTimeout(this.hackRefTimer); | ||
this.hackRefTimer = null; | ||
} | ||
} | ||
}, { | ||
key: 'handleWindowResize', | ||
@@ -117,3 +100,2 @@ value: function handleWindowResize() { | ||
this.stopMonitorWindowResize(); | ||
this.clearHackRefTimer(); | ||
} | ||
@@ -123,4 +105,2 @@ }, { | ||
value: function componentDidUpdate(prevProps) { | ||
var _this2 = this; | ||
var reAlign = false; | ||
@@ -130,23 +110,21 @@ var props = this.props; | ||
this.hackRefTimer = setTimeout(function () { | ||
if (!props.disabled) { | ||
if (prevProps.disabled || prevProps.align !== props.align) { | ||
if (!props.disabled) { | ||
if (prevProps.disabled || prevProps.align !== props.align) { | ||
reAlign = true; | ||
currentTarget = props.target(); | ||
} else { | ||
var lastTarget = prevProps.target(); | ||
currentTarget = props.target(); | ||
if (isWindow(lastTarget) && isWindow(currentTarget)) { | ||
reAlign = false; | ||
} else if (lastTarget !== currentTarget) { | ||
reAlign = true; | ||
currentTarget = props.target(); | ||
} else { | ||
var lastTarget = prevProps.target(); | ||
currentTarget = props.target(); | ||
if (isWindow(lastTarget) && isWindow(currentTarget)) { | ||
reAlign = false; | ||
} else if (lastTarget !== currentTarget) { | ||
reAlign = true; | ||
} | ||
} | ||
} | ||
} | ||
if (reAlign) { | ||
var source = _react2['default'].findDOMNode(_this2); | ||
props.onAlign(source, (0, _domAlign2['default'])(source, currentTarget, props.align)); | ||
} | ||
}, 0); | ||
if (reAlign) { | ||
var source = _react2['default'].findDOMNode(this); | ||
props.onAlign(source, (0, _domAlign2['default'])(source, currentTarget, props.align)); | ||
} | ||
@@ -153,0 +131,0 @@ if (props.monitorWindowResize && !props.disabled) { |
{ | ||
"name": "rc-align", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "align ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
10587
147