mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-28 02:34:10 +00:00
[feat] Add node library sorting and grouping controls (#4024)
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
44
src/types/nodeOrganizationTypes.ts
Normal file
44
src/types/nodeOrganizationTypes.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import type { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
|
||||
|
||||
export type GroupingStrategyId = 'category' | 'module' | 'source'
|
||||
export type SortingStrategyId = 'original' | 'alphabetical'
|
||||
|
||||
/**
|
||||
* Strategy for grouping nodes into tree structure
|
||||
*/
|
||||
export interface NodeGroupingStrategy {
|
||||
/** Unique identifier for the grouping strategy */
|
||||
id: string
|
||||
/** Display name for UI (i18n key) */
|
||||
label: string
|
||||
/** Icon class for the grouping option */
|
||||
icon: string
|
||||
/** Description for tooltips (i18n key) */
|
||||
description?: string
|
||||
/** Function to extract the tree path from a node definition */
|
||||
getNodePath: (nodeDef: ComfyNodeDefImpl) => string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Strategy for sorting nodes within groups
|
||||
*/
|
||||
export interface NodeSortStrategy {
|
||||
/** Unique identifier for the sort strategy */
|
||||
id: string
|
||||
/** Display name for UI (i18n key) */
|
||||
label: string
|
||||
/** Icon class for the sort option */
|
||||
icon: string
|
||||
/** Description for tooltips (i18n key) */
|
||||
description?: string
|
||||
/** Compare function for sorting nodes within the same group */
|
||||
compare: (a: ComfyNodeDefImpl, b: ComfyNodeDefImpl) => number
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for organizing nodes
|
||||
*/
|
||||
export interface NodeOrganizationOptions {
|
||||
groupBy?: string
|
||||
sortBy?: string
|
||||
}
|
||||
Reference in New Issue
Block a user