mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-09 07:00:06 +00:00
feat: add collapse/expand all toggle to right panel tabs (#9333)
## Summary Adds a collapse/expand all toggle button to all parameter and error tabs in the right side panel, letting users quickly collapse or expand all accordion sections at once. ## Changes - **New component**: `CollapseToggleButton.vue` — a reusable icon button (list-collapse / list-tree icon) with tooltip, bound via `v-model` - **Error tab**: Toggle collapses/expands all error groups; per-group state is now managed through `isSectionCollapsed` / `setSectionCollapsed` helpers - **Nodes tab** (`TabNodes.vue`): Per-node `collapseMap`; toggle overrides per-section state; defaults to collapsed (nodes tab default was already collapsed) - **Normal inputs tab** (`TabNormalInputs.vue`): Per-node `collapseMap` + `advancedCollapsed`; toggle covers both normal and advanced sections; defaults to collapsed when multiple nodes selected - **Subgraph inputs tab** (`TabSubgraphInputs.vue`): Toggle covers both main and advanced inputs sections - **Global parameters tab** (`TabGlobalParameters.vue`): Toggle bound to single `SectionWidgets` - **i18n**: Added `g.collapseAll` and `g.expandAll` keys ## Review Focus - `isAllCollapsed` getter in each tab: reads from the same per-section state so the toggle accurately reflects current state rather than being independently tracked - `TabNormalInputs`: multi-node selection default collapse behaviour is preserved through `isSectionCollapsed` fallback logic ## Screenshots <img width="778" height="643" alt="image" src="https://github.com/user-attachments/assets/04d07f32-5135-47f9-b029-78ca78a996fb" /> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9333-feat-add-collapse-expand-all-toggle-to-right-panel-tabs-3176d73d36508123ba22d6e81983bb1b) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -17,6 +17,7 @@ import { isPromotedWidgetView } from '@/core/graph/subgraph/promotedWidgetTypes'
|
||||
import type { SubgraphNode } from '@/lib/litegraph/src/subgraph/SubgraphNode'
|
||||
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
||||
import FormSearchInput from '@/renderer/extensions/vueNodes/widgets/components/form/FormSearchInput.vue'
|
||||
import CollapseToggleButton from '@/components/rightSidePanel/layout/CollapseToggleButton.vue'
|
||||
import { DraggableList } from '@/scripts/ui/draggableList'
|
||||
import { usePromotionStore } from '@/stores/promotionStore'
|
||||
import { useRightSidePanelStore } from '@/stores/workspace/rightSidePanelStore'
|
||||
@@ -36,6 +37,19 @@ const rightSidePanelStore = useRightSidePanelStore()
|
||||
const { focusedSection, searchQuery } = storeToRefs(rightSidePanelStore)
|
||||
|
||||
const advancedInputsCollapsed = ref(true)
|
||||
const firstSectionCollapsed = ref(false)
|
||||
const isAllCollapsed = computed({
|
||||
get() {
|
||||
const hasAdvanced = advancedInputsWidgets.value.length > 0
|
||||
return hasAdvanced
|
||||
? firstSectionCollapsed.value && advancedInputsCollapsed.value
|
||||
: firstSectionCollapsed.value
|
||||
},
|
||||
set(collapse: boolean) {
|
||||
firstSectionCollapsed.value = collapse
|
||||
advancedInputsCollapsed.value = collapse
|
||||
}
|
||||
})
|
||||
const draggableList = ref<DraggableList | undefined>(undefined)
|
||||
const sectionWidgetsRef = useTemplateRef('sectionWidgetsRef')
|
||||
const advancedInputsSectionRef = useTemplateRef('advancedInputsSectionRef')
|
||||
@@ -186,15 +200,23 @@ const label = computed(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="px-4 pt-1 pb-4 flex gap-2 border-b border-interface-stroke">
|
||||
<div
|
||||
class="px-4 pt-1 pb-4 flex items-center border-b border-interface-stroke"
|
||||
>
|
||||
<FormSearchInput
|
||||
v-model="searchQuery"
|
||||
:searcher
|
||||
:update-key="widgetsList"
|
||||
class="flex-1"
|
||||
/>
|
||||
<CollapseToggleButton
|
||||
v-model="isAllCollapsed"
|
||||
:show="!isSearching && advancedInputsWidgets.length > 0"
|
||||
/>
|
||||
</div>
|
||||
<SectionWidgets
|
||||
ref="sectionWidgetsRef"
|
||||
:collapse="firstSectionCollapsed && !isSearching"
|
||||
:node
|
||||
:label
|
||||
:parents
|
||||
@@ -207,7 +229,12 @@ const label = computed(() => {
|
||||
: t('rightSidePanel.inputsNoneTooltip')
|
||||
"
|
||||
class="border-b border-interface-stroke"
|
||||
@update:collapse="nextTick(setDraggableState)"
|
||||
@update:collapse="
|
||||
(v) => {
|
||||
firstSectionCollapsed = v
|
||||
nextTick(setDraggableState)
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #empty>
|
||||
<div class="text-sm text-muted-foreground px-4 text-center pt-5 pb-15">
|
||||
|
||||
Reference in New Issue
Block a user