mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-01 03:31:58 +00:00
feat(canvas): hide widgets marked advanced unless node.showAdvanced is true (#8147)
Hides widgets marked with `options.advanced = true` on the Vue Node canvas unless `node.showAdvanced` is true. ## Changes - Updates `NodeWidgets.vue` template to check `widget.options.advanced` combined with `nodeData.showAdvanced` - Updates `gridTemplateRows` computed to exclude hidden advanced widgets - Adds `showAdvanced` to `VueNodeData` interface in `useGraphNodeManager.ts` ## Related - Backend PR that adds `advanced` flag: comfyanonymous/ComfyUI#11939 - Toggle button PR: feat/advanced-widgets-toggle-button ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8147-feat-canvas-hide-widgets-marked-advanced-unless-node-showAdvanced-is-true-2ec6d73d36508179931ce78a6ffd6b0a) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -77,6 +77,7 @@ export interface VueNodeData {
|
|||||||
outputs?: INodeOutputSlot[]
|
outputs?: INodeOutputSlot[]
|
||||||
resizable?: boolean
|
resizable?: boolean
|
||||||
shape?: number
|
shape?: number
|
||||||
|
showAdvanced?: boolean
|
||||||
subgraphId?: string | null
|
subgraphId?: string | null
|
||||||
titleMode?: TitleMode
|
titleMode?: TitleMode
|
||||||
widgets?: SafeWidgetData[]
|
widgets?: SafeWidgetData[]
|
||||||
@@ -314,7 +315,8 @@ export function extractVueNodeData(node: LGraphNode): VueNodeData {
|
|||||||
color: node.color || undefined,
|
color: node.color || undefined,
|
||||||
bgcolor: node.bgcolor || undefined,
|
bgcolor: node.bgcolor || undefined,
|
||||||
resizable: node.resizable,
|
resizable: node.resizable,
|
||||||
shape: node.shape
|
shape: node.shape,
|
||||||
|
showAdvanced: node.showAdvanced
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,6 +570,13 @@ export function useGraphNodeManager(graph: LGraph): GraphNodeManager {
|
|||||||
? propertyEvent.newValue
|
? propertyEvent.newValue
|
||||||
: undefined
|
: undefined
|
||||||
})
|
})
|
||||||
|
break
|
||||||
|
case 'showAdvanced':
|
||||||
|
vueNodeData.set(nodeId, {
|
||||||
|
...currentData,
|
||||||
|
showAdvanced: Boolean(propertyEvent.newValue)
|
||||||
|
})
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ const DEFAULT_TRACKED_PROPERTIES: string[] = [
|
|||||||
'flags.pinned',
|
'flags.pinned',
|
||||||
'mode',
|
'mode',
|
||||||
'color',
|
'color',
|
||||||
'bgcolor'
|
'bgcolor',
|
||||||
|
'shape',
|
||||||
|
'showAdvanced'
|
||||||
]
|
]
|
||||||
/**
|
/**
|
||||||
* Manages node properties with optional change tracking and instrumentation.
|
* Manages node properties with optional change tracking and instrumentation.
|
||||||
|
|||||||
@@ -25,7 +25,10 @@
|
|||||||
:key="`widget-${index}-${widget.name}`"
|
:key="`widget-${index}-${widget.name}`"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="!widget.simplified.options?.hidden"
|
v-if="
|
||||||
|
!widget.simplified.options?.hidden &&
|
||||||
|
(!widget.simplified.options?.advanced || nodeData?.showAdvanced)
|
||||||
|
"
|
||||||
class="lg-node-widget group col-span-full grid grid-cols-subgrid items-stretch"
|
class="lg-node-widget group col-span-full grid grid-cols-subgrid items-stretch"
|
||||||
>
|
>
|
||||||
<!-- Widget Input Slot Dot -->
|
<!-- Widget Input Slot Dot -->
|
||||||
@@ -206,7 +209,12 @@ const gridTemplateRows = computed((): string => {
|
|||||||
if (!nodeData?.widgets) return ''
|
if (!nodeData?.widgets) return ''
|
||||||
const processedNames = new Set(toValue(processedWidgets).map((w) => w.name))
|
const processedNames = new Set(toValue(processedWidgets).map((w) => w.name))
|
||||||
return nodeData.widgets
|
return nodeData.widgets
|
||||||
.filter((w) => processedNames.has(w.name) && !w.options?.hidden)
|
.filter(
|
||||||
|
(w) =>
|
||||||
|
processedNames.has(w.name) &&
|
||||||
|
!w.options?.hidden &&
|
||||||
|
(!w.options?.advanced || nodeData?.showAdvanced)
|
||||||
|
)
|
||||||
.map((w) =>
|
.map((w) =>
|
||||||
shouldExpand(w.type) || w.hasLayoutSize ? 'auto' : 'min-content'
|
shouldExpand(w.type) || w.hasLayoutSize ? 'auto' : 'min-content'
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user