Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Major Refactor] Use TreeExplorer on nodeLibrarySidebarTab #699

Merged
merged 26 commits into from
Sep 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sort bookmarks alphabetically default
  • Loading branch information
huchenlei committed Sep 1, 2024
commit a53939a746e8c524acc577f965b1770e3db6984d
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ const renderedBookmarkedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(
): TreeExplorerNode<ComfyNodeDefImpl> => {
const children = node.children?.map(fillNodeInfo)

// Sort children: non-leaf nodes first, then leaf nodes, both alphabetically
const sortedChildren = children?.sort((a, b) => {
if (a.leaf === b.leaf) {
return a.label.localeCompare(b.label)
}
return a.leaf ? 1 : -1
})

return {
key: node.key,
label: node.label,
Expand All @@ -79,7 +87,7 @@ const renderedBookmarkedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(
? 'pi ' + customization.icon
: 'pi pi-bookmark-fill'
},
children,
children: sortedChildren,
draggable: node.leaf,
droppable: !node.leaf,
handleDrop: (
Expand Down