Socket
Socket
Sign inDemoInstall

rc-animate

Package Overview
Dependencies
6
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.3 to 1.2.4

29

lib/Animate.js

@@ -9,4 +9,2 @@ 'use strict';

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _react = require('react');

@@ -110,18 +108,11 @@

var currentChildren = this.state.children;
var newChildren = _ChildrenUtils2['default'].mergeChildren(currentChildren, nextChildren);
var newChildren = undefined;
if (showProp && !exclusive) {
newChildren = newChildren.map(function (c) {
var ret = c;
if (!c.props[showProp] && (0, _ChildrenUtils.isShownInChildren)(currentChildren, c, showProp)) {
ret = _react2['default'].cloneElement(c, _defineProperty({}, showProp, true));
}
return ret;
if (!showProp) {
newChildren = _ChildrenUtils2['default'].mergeChildren(currentChildren, nextChildren);
this.setState({
children: newChildren
});
}
this.setState({
children: newChildren
});
// exclusive needs immediate response

@@ -143,3 +134,3 @@ if (exclusive) {

if (hasPrev) {
var showInNow = (0, _ChildrenUtils.isShownInChildren)(currentChildren, c, showProp);
var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
var showInNext = c.props[showProp];

@@ -163,3 +154,3 @@ if (!showInNow && showInNext) {

if (hasNext) {
var showInNext = (0, _ChildrenUtils.isShownInChildren)(nextChildren, c, showProp);
var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);
var showInNow = c.props[showProp];

@@ -249,3 +240,3 @@ if (!showInNext && showInNow) {

}
if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren)) {
if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
this.setState({

@@ -278,3 +269,3 @@ children: currentChildren

}
if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren)) {
if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
this.setState({

@@ -290,3 +281,3 @@ children: currentChildren

if (showProp) {
return (0, _ChildrenUtils.isShownInChildrenByKey)(currentChildren, key, showProp);
return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
}

@@ -293,0 +284,0 @@ return (0, _ChildrenUtils.inChildrenByKey)(currentChildren, key);

@@ -35,13 +35,2 @@ 'use strict';

isShownInChildren: function isShownInChildren(children, child, showProp) {
var found = 0;
children.forEach(function (c) {
if (found) {
return;
}
found = c.key === child.key && c.props[showProp];
});
return found;
},
inChildrenByKey: function inChildrenByKey(children, key) {

@@ -60,3 +49,18 @@ var found = 0;

isShownInChildrenByKey: function isShownInChildrenByKey(children, key, showProp) {
findShownChildInChildrenByKey: function findShownChildInChildrenByKey(children, key, showProp) {
var ret = null;
if (children) {
children.forEach(function (c) {
if (c.key === key && c.props[showProp]) {
if (ret) {
throw new Error('two child with same key for <rc-animate> children');
}
ret = c;
}
});
}
return ret;
},
findHiddenChildInChildrenByKey: function findHiddenChildInChildrenByKey(children, key, showProp) {
var found = 0;

@@ -68,3 +72,3 @@ if (children) {

}
found = c.key === key && c.props[showProp];
found = c.key === key && !c.props[showProp];
});

@@ -75,8 +79,11 @@ }

isSameChildren: function isSameChildren(c1, c2) {
isSameChildren: function isSameChildren(c1, c2, showProp) {
var same = c1.length === c2.length;
if (same) {
c1.forEach(function (c, i) {
if (c !== c2[i]) {
c1.forEach(function (child, i) {
var child2 = c2[i];
if (child.key !== child2.key) {
same = false;
} else if (showProp && child.props[showProp] !== child2.props[showProp]) {
same = false;
}

@@ -83,0 +90,0 @@ });

{
"name": "rc-animate",
"version": "1.2.3",
"version": "1.2.4",
"description": "css-transition ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

@@ -13,2 +13,6 @@ # rc-animate

[![Sauce Test Status](https://saucelabs.com/buildstatus/rc_animate)](https://saucelabs.com/u/rc_animate)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/rc_animate.svg)](https://saucelabs.com/u/rc_animate)
[npm-image]: http://img.shields.io/npm/v/rc-animate.svg?style=flat-square

@@ -15,0 +19,0 @@ [npm-url]: http://npmjs.org/package/rc-animate

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc