mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 23:50:08 +00:00
* refactor: Reorganize Vue nodes system to domain-driven design architecture Move Vue nodes code from scattered technical layers to domain-focused structure: - Widget system → src/renderer/extensions/vueNodes/widgets/ - LOD optimization → src/renderer/extensions/vueNodes/lod/ - Layout logic → src/renderer/extensions/vueNodes/layout/ - Node components → src/renderer/extensions/vueNodes/components/ - Test structure mirrors source organization Benefits: - Clear domain boundaries instead of technical layers - Everything Vue nodes related in renderer domain (not workbench) - camelCase naming (vueNodes vs vue-nodes) - Tests co-located with source domains - All imports updated to new DDD structure * fix: Skip spatial index performance test on CI to avoid flaky timing Performance tests are inherently flaky on CI due to variable system performance. This test should only run locally like the other performance tests.
25 lines
859 B
TypeScript
25 lines
859 B
TypeScript
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
|
import type { ITreeSelectWidget } from '@/lib/litegraph/src/types/widgets'
|
|
import type {
|
|
InputSpec as InputSpecV2,
|
|
TreeSelectInputSpec
|
|
} from '@/schemas/nodeDef/nodeDefSchemaV2'
|
|
import type { ComfyWidgetConstructorV2 } from '@/scripts/widgets'
|
|
|
|
export const useTreeSelectWidget = (): ComfyWidgetConstructorV2 => {
|
|
return (node: LGraphNode, inputSpec: InputSpecV2): ITreeSelectWidget => {
|
|
const { name, options = {} } = inputSpec as TreeSelectInputSpec
|
|
const isMultiple = options.multiple || false
|
|
const defaultValue = isMultiple ? [] : ''
|
|
|
|
const widget = node.addWidget('treeselect', name, defaultValue, () => {}, {
|
|
serialize: true,
|
|
values: options.values || [],
|
|
multiple: isMultiple,
|
|
...options
|
|
}) as ITreeSelectWidget
|
|
|
|
return widget
|
|
}
|
|
}
|