react-virtualized-sticky-tree
Advanced tools
Comparing version 2.1.14 to 2.1.15
@@ -89,2 +89,5 @@ 'use strict'; | ||
var isLastChild = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; | ||
var _this2 = this; | ||
var parentIndex = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined; | ||
@@ -125,5 +128,16 @@ var context = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : { totalHeight: 0 }; | ||
// itself has changed. | ||
if (children === undefined || this.getChildrenCache[node.id] !== children) { | ||
var oldChildren = this.getChildrenCache[node.id]; | ||
if (children === undefined || oldChildren !== children) { | ||
delete this.rowRenderCache[node.id]; | ||
this.getChildrenCache[node.id] = children; | ||
// Check for structure changes... | ||
if (children && oldChildren && (children.length !== oldChildren.length || !children.every(function (child, i) { | ||
return child.id === oldChildren[i].id; | ||
}))) { | ||
// We need to update the entire branch if the structure has changed. | ||
this.getBranchChildrenIds(children).forEach(function (id) { | ||
return delete _this2.rowRenderCache[id]; | ||
}); | ||
} | ||
} | ||
@@ -149,2 +163,22 @@ } | ||
}, { | ||
key: 'getBranchChildrenIds', | ||
value: function () { | ||
function getBranchChildrenIds(children) { | ||
var _this3 = this; | ||
var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
if (!children) { | ||
return arr; | ||
} | ||
children.forEach(function (child) { | ||
arr.push(child.id); | ||
_this3.getBranchChildrenIds(_this3.getChildrenCache[child.id], arr); | ||
}); | ||
return arr; | ||
} | ||
return getBranchChildrenIds; | ||
}() | ||
}, { | ||
key: 'componentWillMount', | ||
@@ -684,3 +718,3 @@ value: function () { | ||
function renderChildren(props, state, parent, indexesToRender) { | ||
var _this2 = this; | ||
var _this4 = this; | ||
@@ -690,7 +724,7 @@ var nodes = []; | ||
parent.children.forEach(function (index) { | ||
var child = _this2.nodes[index]; | ||
var child = _this4.nodes[index]; | ||
if (indexesToRender.has(index)) { | ||
if (child.children && child.children.length > 0) { | ||
nodes.push(_this2.renderChildWithChildren(props, state, child, top, indexesToRender)); | ||
nodes.push(_this4.renderChildWithChildren(props, state, child, top, indexesToRender)); | ||
} else { | ||
@@ -705,7 +739,7 @@ // Sticky nodes will need a container so that their top is correct. The sticky node itself will have a top | ||
key: 'rv-node-' + child.id, | ||
style: _this2.getChildContainerStyle(child, top) }, | ||
_this2.renderNode(props, state, child, _this2.getClientNodeStyle(child)) | ||
style: _this4.getChildContainerStyle(child, top) }, | ||
_this4.renderNode(props, state, child, _this4.getClientNodeStyle(child)) | ||
)); | ||
} else { | ||
nodes.push(_this2.renderNode(props, state, child, _this2.getClientLeafNodeStyle(child, top))); | ||
nodes.push(_this4.renderNode(props, state, child, _this4.getClientLeafNodeStyle(child, top))); | ||
} | ||
@@ -895,3 +929,3 @@ } | ||
function render() { | ||
var _this3 = this; | ||
var _this5 = this; | ||
@@ -910,3 +944,3 @@ var style = { overflow: 'auto', position: 'relative' }; | ||
function ref(elem) { | ||
return _this3.elem = elem; | ||
return _this5.elem = elem; | ||
} | ||
@@ -913,0 +947,0 @@ |
@@ -89,2 +89,5 @@ 'use strict'; | ||
var isLastChild = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; | ||
var _this2 = this; | ||
var parentIndex = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined; | ||
@@ -125,5 +128,16 @@ var context = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : { totalHeight: 0 }; | ||
// itself has changed. | ||
if (children === undefined || this.getChildrenCache[node.id] !== children) { | ||
var oldChildren = this.getChildrenCache[node.id]; | ||
if (children === undefined || oldChildren !== children) { | ||
delete this.rowRenderCache[node.id]; | ||
this.getChildrenCache[node.id] = children; | ||
// Check for structure changes... | ||
if (children && oldChildren && (children.length !== oldChildren.length || !children.every(function (child, i) { | ||
return child.id === oldChildren[i].id; | ||
}))) { | ||
// We need to update the entire branch if the structure has changed. | ||
this.getBranchChildrenIds(children).forEach(function (id) { | ||
return delete _this2.rowRenderCache[id]; | ||
}); | ||
} | ||
} | ||
@@ -149,2 +163,22 @@ } | ||
}, { | ||
key: 'getBranchChildrenIds', | ||
value: function () { | ||
function getBranchChildrenIds(children) { | ||
var _this3 = this; | ||
var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
if (!children) { | ||
return arr; | ||
} | ||
children.forEach(function (child) { | ||
arr.push(child.id); | ||
_this3.getBranchChildrenIds(_this3.getChildrenCache[child.id], arr); | ||
}); | ||
return arr; | ||
} | ||
return getBranchChildrenIds; | ||
}() | ||
}, { | ||
key: 'componentWillMount', | ||
@@ -684,3 +718,3 @@ value: function () { | ||
function renderChildren(props, state, parent, indexesToRender) { | ||
var _this2 = this; | ||
var _this4 = this; | ||
@@ -690,7 +724,7 @@ var nodes = []; | ||
parent.children.forEach(function (index) { | ||
var child = _this2.nodes[index]; | ||
var child = _this4.nodes[index]; | ||
if (indexesToRender.has(index)) { | ||
if (child.children && child.children.length > 0) { | ||
nodes.push(_this2.renderChildWithChildren(props, state, child, top, indexesToRender)); | ||
nodes.push(_this4.renderChildWithChildren(props, state, child, top, indexesToRender)); | ||
} else { | ||
@@ -705,7 +739,7 @@ // Sticky nodes will need a container so that their top is correct. The sticky node itself will have a top | ||
key: 'rv-node-' + child.id, | ||
style: _this2.getChildContainerStyle(child, top) }, | ||
_this2.renderNode(props, state, child, _this2.getClientNodeStyle(child)) | ||
style: _this4.getChildContainerStyle(child, top) }, | ||
_this4.renderNode(props, state, child, _this4.getClientNodeStyle(child)) | ||
)); | ||
} else { | ||
nodes.push(_this2.renderNode(props, state, child, _this2.getClientLeafNodeStyle(child, top))); | ||
nodes.push(_this4.renderNode(props, state, child, _this4.getClientLeafNodeStyle(child, top))); | ||
} | ||
@@ -895,3 +929,3 @@ } | ||
function render() { | ||
var _this3 = this; | ||
var _this5 = this; | ||
@@ -910,3 +944,3 @@ var style = { overflow: 'auto', position: 'relative' }; | ||
function ref(elem) { | ||
return _this3.elem = elem; | ||
return _this5.elem = elem; | ||
} | ||
@@ -913,0 +947,0 @@ |
{ | ||
"name": "react-virtualized-sticky-tree", | ||
"description": "A React component for efficiently rendering tree like structures with support for position: sticky", | ||
"version": "2.1.14", | ||
"version": "2.1.15", | ||
"author": "Marc McIntyre <marchaos@gmail.com>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
99187
1976