From af235c8684eba57397c6155cf83dc3ab9a95f8db Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 1 Feb 2018 17:31:11 +0100 Subject: [PATCH] add isExpanded && updateNode function --- remix-debugger/src/ui/TreeView.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/remix-debugger/src/ui/TreeView.js b/remix-debugger/src/ui/TreeView.js index 92112840c6..bcca518b2e 100644 --- a/remix-debugger/src/ui/TreeView.js +++ b/remix-debugger/src/ui/TreeView.js @@ -105,6 +105,14 @@ class TreeView { return li } + isExpanded (path) { + var current = this.nodeAt(path) + if (current) { + return current.style.display !== 'none' + } + return false + } + expand (path) { if (this.labels[path]) { this.carets[path].className = this.carets[path].className === 'fa fa-caret-right' ? 'fa fa-caret-down' : 'fa fa-caret-right' @@ -117,6 +125,17 @@ class TreeView { return this.nodes[path] } + updateNode (path, newNode) { + var current = this.nodeAt(path) + if (current) { + var parent = current.parentNode + if (parent) { + parent.replaceChild(newNode, current) + this.nodes[path] = newNode + } + } + } + formatSelfDefault (key, data) { return yo`` }