HEL-430: replace directory search picker with collapsible tree

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
美术师
2026-09-03 08:40:53 +08:00
co-authored by Cursor multica-agent
parent 8ceafe70b1
commit fbafb8015d
4 changed files with 219 additions and 131 deletions
+2 -7
View File
@@ -167,13 +167,8 @@ function directoryPickerItems(array $dirs): array
}
unset($children);
$pathMap = dirPathMap($dirs);
$nameCounts = [];
foreach ($dirs as $d) {
$n = (string) $d['name'];
$nameCounts[$n] = ($nameCounts[$n] ?? 0) + 1;
}
$out = [];
$walk = static function (int $parent) use (&$walk, $byParent, $pathMap, $nameCounts, &$out): void {
$walk = static function (int $parent) use (&$walk, $byParent, $pathMap, &$out): void {
foreach ($byParent[$parent] ?? [] as $d) {
$id = (int) $d['id'];
$name = (string) $d['name'];
@@ -182,7 +177,7 @@ function directoryPickerItems(array $dirs): array
'name' => $name,
'path' => (string) ($pathMap[$id] ?? $name),
'level' => (int) ($d['level'] ?? 1),
'dup' => ($nameCounts[$name] ?? 0) > 1,
'parent_id' => $parent,
];
$walk($id);
}