From 46f7a46f22a6031cd319fcea4ac90778f96f0505 Mon Sep 17 00:00:00 2001 From: lintsinghua Date: Thu, 18 Dec 2025 22:36:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86):=20=E6=B7=BB=E5=8A=A0=E5=B1=95?= =?UTF-8?q?=E5=BC=80/=E6=8A=98=E5=8F=A0=E5=85=A8=E9=83=A8=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 handleExpandAll 和 handleCollapseAll 回调函数实现批量展开/折叠功能 在树形视图模式下添加对应的操作按钮 --- .../components/audit/FileSelectionDialog.tsx | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/audit/FileSelectionDialog.tsx b/frontend/src/components/audit/FileSelectionDialog.tsx index 0a99204..9329261 100644 --- a/frontend/src/components/audit/FileSelectionDialog.tsx +++ b/frontend/src/components/audit/FileSelectionDialog.tsx @@ -31,6 +31,8 @@ import { RotateCcw, RefreshCw, Terminal, + ChevronsUpDown, + ChevronsDownUp, } from "lucide-react"; import { api } from "@/shared/config/database"; import { toast } from "sonner"; @@ -251,6 +253,21 @@ export default function FileSelectionDialog({ }); }, []); + const handleExpandAll = useCallback(() => { + const folders = new Set(); + filteredFiles.forEach((f) => { + const parts = f.path.split("/"); + for (let i = 1; i < parts.length; i++) { + folders.add(parts.slice(0, i).join("/")); + } + }); + setExpandedFolders(folders); + }, [filteredFiles]); + + const handleCollapseAll = useCallback(() => { + setExpandedFolders(new Set()); + }, []); + const handleSelectAll = () => { setSelectedFiles(new Set(filteredFiles.map((f) => f.path))); }; @@ -485,7 +502,7 @@ export default function FileSelectionDialog({