Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-align

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-align - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

60

lib/Align.js

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc