Revert "feat: 树状视图路径压缩 - 单子节点文件夹自动合并"

This reverts commit ccb91731fc.
This commit is contained in:
2026-07-11 15:37:33 +08:00
parent ccb91731fc
commit a782180dd3
+1 -21
View File
@@ -452,27 +452,7 @@ const treeData = computed<TreeNode[]>(() => {
updateCounts(node) updateCounts(node)
} }
// Compress: merge folders that have exactly 1 child into a single node return root
// e.g. a > b > c (single key "a:b:c") becomes one leaf "a:b:c"
function compress(nodes: TreeNode[]): TreeNode[] {
return nodes.map(node => {
if (node.isLeaf) return node
const children = compress(node.children)
if (children.length === 1) {
const child = children[0]
return {
name: node.name + separator + child.name,
fullPath: child.fullPath,
isLeaf: child.isLeaf,
children: child.children,
count: child.count,
}
}
return { ...node, children }
})
}
return compress(root)
}) })
function isFolderExpanded(path: string): boolean { function isFolderExpanded(path: string): boolean {