simplify
This commit is contained in:
parent
509e3b1d09
commit
9b96459d8a
|
|
@ -319,8 +319,8 @@ function indexTree<T extends TreeItem>(
|
||||||
selectedItem: T | undefined,
|
selectedItem: T | undefined,
|
||||||
expandedItems: Map<string, boolean | undefined>,
|
expandedItems: Map<string, boolean | undefined>,
|
||||||
autoExpandDepth: number,
|
autoExpandDepth: number,
|
||||||
isVisible?: (item: T) => boolean): Map<T, TreeItemData> {
|
isVisible: (item: T) => boolean = () => true): Map<T, TreeItemData> {
|
||||||
if (isVisible && !isVisible(rootItem))
|
if (!isVisible(rootItem))
|
||||||
return new Map();
|
return new Map();
|
||||||
|
|
||||||
const result = new Map<T, TreeItemData>();
|
const result = new Map<T, TreeItemData>();
|
||||||
|
|
@ -331,7 +331,7 @@ function indexTree<T extends TreeItem>(
|
||||||
|
|
||||||
const appendChildren = (parent: T, depth: number) => {
|
const appendChildren = (parent: T, depth: number) => {
|
||||||
for (const item of parent.children as T[]) {
|
for (const item of parent.children as T[]) {
|
||||||
if (isVisible && !isVisible(item))
|
if (!isVisible(item))
|
||||||
continue;
|
continue;
|
||||||
const expandState = temporaryExpanded.has(item.id) || expandedItems.get(item.id);
|
const expandState = temporaryExpanded.has(item.id) || expandedItems.get(item.id);
|
||||||
const autoExpandMatches = autoExpandDepth > depth && result.size < 25 && expandState !== false;
|
const autoExpandMatches = autoExpandDepth > depth && result.size < 25 && expandState !== false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue