Skip to content

Commit

Permalink
Disabled node expanding #121
Browse files Browse the repository at this point in the history
  • Loading branch information
amsik committed Oct 16, 2019
1 parent bf104ad commit 3c34f49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "liquor-tree",
"description": "A Vue.js tree component.",
"version": "0.2.65",
"version": "0.2.66",
"author": "Kostiantyn <[email protected]>",
"library": "LiquorTree",
"homepage": "https://amsik.github.io/liquor-tree/",
Expand Down
10 changes: 8 additions & 2 deletions src/lib/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,20 @@ export default class Node {
}

canExpand () {
if (this.disabled() || !this.hasChildren()) {
return false
}

return this.collapsed() &&
this.hasChildren() &&
(!this.tree.autoDisableChildren || this.disabled())
}

canCollapse () {
if (this.disabled() || !this.hasChildren()) {
return false
}

return this.expanded() &&
this.hasChildren() &&
(!this.tree.autoDisableChildren || this.disabled())
}

Expand Down

0 comments on commit 3c34f49

Please sign in to comment.