mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 05:13:29 +00:00
collapse collections initially (#13646)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// FIXME: Update this file to be type safe and remove this and next line
|
// FIXME: Update this file to be type safe and remove this and next line
|
||||||
// @ts-strict-ignore
|
// @ts-strict-ignore
|
||||||
import { Directive, EventEmitter, Input, Output } from "@angular/core";
|
import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
||||||
|
|
||||||
import { CollectionView } from "@bitwarden/admin-console/common";
|
import { CollectionView } from "@bitwarden/admin-console/common";
|
||||||
import { ITreeNodeObject } from "@bitwarden/common/vault/models/domain/tree-node";
|
import { ITreeNodeObject } from "@bitwarden/common/vault/models/domain/tree-node";
|
||||||
@@ -10,7 +10,7 @@ import { TopLevelTreeNode } from "../models/top-level-tree-node.model";
|
|||||||
import { VaultFilter } from "../models/vault-filter.model";
|
import { VaultFilter } from "../models/vault-filter.model";
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
export class CollectionFilterComponent {
|
export class CollectionFilterComponent implements OnInit {
|
||||||
@Input() hide = false;
|
@Input() hide = false;
|
||||||
@Input() collapsedFilterNodes: Set<string>;
|
@Input() collapsedFilterNodes: Set<string>;
|
||||||
@Input() collectionNodes: DynamicTreeNode<CollectionView>;
|
@Input() collectionNodes: DynamicTreeNode<CollectionView>;
|
||||||
@@ -51,4 +51,13 @@ export class CollectionFilterComponent {
|
|||||||
async toggleCollapse(node: ITreeNodeObject) {
|
async toggleCollapse(node: ITreeNodeObject) {
|
||||||
this.onNodeCollapseStateChange.emit(node);
|
this.onNodeCollapseStateChange.emit(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
// Populate the set with all node IDs so all nodes are collapsed initially.
|
||||||
|
if (this.collectionNodes?.fullList) {
|
||||||
|
this.collectionNodes.fullList.forEach((node) => {
|
||||||
|
this.collapsedFilterNodes.add(node.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user