Implement HideChildrenInTreeview
This commit is contained in:
parent
e2da3142b5
commit
3e6204e917
6 changed files with 15 additions and 2 deletions
|
@ -3,7 +3,7 @@ import { IContainerModel } from '../Interfaces/IContainerModel';
|
|||
/**
|
||||
* Returns a Generator iterating of over the children depth-first
|
||||
*/
|
||||
export function * MakeIterator(root: IContainerModel): Generator<IContainerModel, void, unknown> {
|
||||
export function * MakeIterator(root: IContainerModel, enableHideChildrenInTreeview = false): Generator<IContainerModel, void, unknown> {
|
||||
const queue: IContainerModel[] = [root];
|
||||
const visited = new Set<IContainerModel>(queue);
|
||||
while (queue.length > 0) {
|
||||
|
@ -11,6 +11,10 @@ export function * MakeIterator(root: IContainerModel): Generator<IContainerModel
|
|||
|
||||
yield container;
|
||||
|
||||
if (enableHideChildrenInTreeview && container.properties.hideChildrenInTreeview) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (let i = container.children.length - 1; i >= 0; i--) {
|
||||
const child = container.children[i];
|
||||
if (visited.has(child)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue