feat(connection): 添加子组时支持定义组名称

- 在创建新子组时,自动展开其父组,支持自定义组名
This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-07-02 10:33:35 +08:00
1 parent 612c6397c5
commit 60f941aa27
4 files changed
+35 -3

No files matched your search

+3 -1
View File
@@ -248,11 +248,13 @@ export function createGroup(layout: SidebarLayout, name: string, parentGroupId?:
const group: ConnectionGroup = { id: groupId, name, collapsed: false };
const order = cloneEntries(layout.order);
const entry: SidebarOrderEntry = { type: "group", id: groupId, children: [] };
let parentFound = false;
if (parentGroupId) {
const parent = findGroupEntry(order, parentGroupId);
if (parent) {
parent.children = [...(parent.children ?? []), entry];
parentFound = true;
} else {
order.push(entry);
}
@@ -263,7 +265,7 @@ export function createGroup(layout: SidebarLayout, name: string, parentGroupId?:
return {
groupId,
layout: {
groups: [...layout.groups, group],
groups: [...layout.groups, group].map((current) => (parentFound && current.id === parentGroupId ? { ...current, collapsed: false } : current)),
order,
},
};