Files
privacy.sexy/tests/unit/shared/Stubs/HierarchyAccessStub.ts
undergroundwires bd2082e8c5 Fix slow appearance of nodes on tree view
The tree view rendering performance is optimized by improving the node
render queue ordering. The node rendering order is modified based on the
expansion state and the depth in the hierarchy, leading to faster
rendering of visible nodes. This optimization is applied when the tree
nodes are not expanded to improve the rendering speed.

This new ordering ensures that nodes are rendered more efficiently,
prioritizing nodes that are collapsed and are at a higher level in the
hierarchy.
2023-09-25 14:21:29 +02:00

48 lines
1.1 KiB
TypeScript

import { HierarchyAccess } from '@/presentation/components/Scripts/View/Tree/TreeView/Node/Hierarchy/HierarchyAccess';
import { TreeNode } from '@/presentation/components/Scripts/View/Tree/TreeView/Node/TreeNode';
export class HierarchyAccessStub implements HierarchyAccess {
public parent: TreeNode | undefined = undefined;
public children: readonly TreeNode[] = [];
public depthInTree = 0;
public isLeafNode = true;
public isBranchNode = false;
public setParent(parent: TreeNode): void {
this.parent = parent;
}
public setChildren(children: readonly TreeNode[]): void {
this.children = children;
}
public withParent(parent: TreeNode | undefined): this {
this.parent = parent;
return this;
}
public withDepthInTree(depthInTree: number): this {
this.depthInTree = depthInTree;
return this;
}
public withChildren(children: readonly TreeNode[]): this {
this.setChildren(children);
return this;
}
public withIsBranchNode(value: boolean): this {
this.isBranchNode = value;
return this;
}
public withIsLeafNode(value: boolean): this {
this.isLeafNode = value;
return this;
}
}