Skip to content

Commit eddda39

Browse files
committed
v1.16.1
1 parent 11f30fa commit eddda39

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

dist/infinite-tree.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! infinite-tree v1.16.0 | (c) 2018 Cheton Wu <cheton@gmail.com> | MIT | https://github.com/cheton/infinite-tree */
1+
/*! infinite-tree v1.16.1 | (c) 2018 Cheton Wu <cheton@gmail.com> | MIT | https://github.com/cheton/infinite-tree */
22
(function webpackUniversalModuleDefinition(root, factory) {
33
if(typeof exports === 'object' && typeof module === 'object')
44
module.exports = factory();
@@ -1546,6 +1546,12 @@ var InfiniteTree = function (_events$EventEmitter) {
15461546

15471547
this.emit('willCloseNode', node);
15481548

1549+
// Cannot close the root node
1550+
if (node === this.state.rootNode) {
1551+
error('Cannot close the root node');
1552+
return false;
1553+
}
1554+
15491555
// Retrieve node index
15501556
var nodeIndex = this.nodes.indexOf(node);
15511557
if (nodeIndex < 0) {
@@ -2232,7 +2238,9 @@ var InfiniteTree = function (_events$EventEmitter) {
22322238

22332239
// Update parent node
22342240
parentNode.children = [];
2235-
parentNode.state.open = parentNode.state.open && parentNode.children.length > 0;
2241+
if (parentNode !== this.state.rootNode) {
2242+
parentNode.state.open = parentNode.state.open && parentNode.children.length > 0;
2243+
}
22362244

22372245
if (parentNodeIndex >= 0) {
22382246
// Update nodes & rows
@@ -2321,7 +2329,9 @@ var InfiniteTree = function (_events$EventEmitter) {
23212329

23222330
// Update parent node
23232331
parentNode.children.splice(parentNode.children.indexOf(node), 1);
2324-
parentNode.state.open = parentNode.state.open && parentNode.children.length > 0;
2332+
if (parentNode !== this.state.rootNode) {
2333+
parentNode.state.open = parentNode.state.open && parentNode.children.length > 0;
2334+
}
23252335

23262336
if (nodeIndex >= 0) {
23272337
// Update nodes & rows

dist/infinite-tree.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/examples.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "infinite-tree",
3-
"version": "1.16.0",
3+
"version": "1.16.1",
44
"description": "A browser-ready tree library that can efficiently display a large amount of data using infinite scrolling.",
55
"homepage": "https://github.com/cheton/infinite-tree",
66
"main": "lib/index.js",

0 commit comments

Comments
 (0)