feat(sidebar): 添加一键折叠所有节点功能
- 在侧边栏中添加了“折叠所有”按钮,用户可以一键折叠所有展开的节点。 - 更新了相关的国际化文本,支持多语言。 - 增加了 collapseAllGroups 和 collapseExpandedTreeNodes 函数以支持新功能。
This commit is contained in:
19 files changed
+191
-10
No files matched your search
@@ -9,11 +9,18 @@ export interface FlatTreeNode {
|
||||
depth: number;
|
||||
id: string;
|
||||
type: TreeNodeType;
|
||||
poolType: string;
|
||||
}
|
||||
|
||||
function walk(children: TreeNode[], depth: number, result: FlatTreeNode[]) {
|
||||
for (const node of children) {
|
||||
result.push({ node, depth, id: node.id, type: node.type });
|
||||
result.push({
|
||||
node,
|
||||
depth,
|
||||
id: node.id,
|
||||
type: node.type,
|
||||
poolType: node.type === "connection-group" ? `${node.type}:${node.id}` : node.type,
|
||||
});
|
||||
if (node.isExpanded && node.children) {
|
||||
walk(node.children, depth + 1, result);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user