fix: hide folder when searching
This commit is contained in:
1 parent
846a3e733d
commit
6e56594e2d
1 file changed
+6
-2
@@ -122,7 +122,7 @@ class FileDataNode implements DataNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeChilds(exclude:string){
|
removeChilds(exclude:string){
|
||||||
for (let i = 0;i < this.children.length;++i) {
|
for (let i = this.children.length-1;i >= 0;--i) {
|
||||||
const child = this.children[i];
|
const child = this.children[i];
|
||||||
if (child.isLeaf) {
|
if (child.isLeaf) {
|
||||||
const keyStr = child.key as string;
|
const keyStr = child.key as string;
|
||||||
@@ -130,10 +130,14 @@ class FileDataNode implements DataNode {
|
|||||||
this.children.splice(i,1);
|
this.children.splice(i,1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
child.removeChilds(exclude);
|
const childLen = child.removeChilds(exclude);
|
||||||
|
if(childLen==0){
|
||||||
|
this.children.splice(i,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return this.children.length;
|
||||||
|
}
|
||||||
|
|
||||||
// name:string;
|
// name:string;
|
||||||
// path: string;
|
// path: string;
|
||||||
|
|||||||
Reference in new issue
Block a user