LCOV - code coverage report
Current view: top level - src/renderer/extensions/propertiesPanel/parameters - TabNodes.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 81.8 % 22 18
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : <script setup lang="ts">
       2              : import { computed, reactive, ref, shallowRef } from 'vue'
       3              : 
       4              : import CollapseToggleButton from '@comfyorg/design-system/accordion/CollapseToggleButton'
       5              : 
       6              : import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
       7              : import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
       8              : import type { NodeId } from '@comfyorg/graph-model/nodeId'
       9              : 
      10              : import { computedSectionDataList } from './widgetSections'
      11              : import type { NodeWidgetsListList } from './widgetSections'
      12              : import { searchWidgetsAndNodes } from './widgetSearch'
      13              : import PanelSearchHeader from './PanelSearchHeader.vue'
      14              : import SectionWidgets from './SectionWidgets.vue'
      15              : 
      16         2355 : const canvasStore = useCanvasStore()
      17              : 
      18            2 : const nodes = computed(
      19              :   (): LGraphNode[] => (canvasStore.canvas?.graph?.nodes ?? []) as LGraphNode[]
      20              : )
      21              : 
      22            2 : const searchQuery = ref('')
      23              : 
      24            2 : const { widgetsSectionDataList } = computedSectionDataList(nodes)
      25              : 
      26            2 : const searchedWidgetsSectionDataList = shallowRef<NodeWidgetsListList>(
      27              :   widgetsSectionDataList.value
      28              : )
      29            2 : const isSearching = ref(false)
      30              : 
      31            2 : const collapseMap = reactive<Record<string, boolean>>({})
      32              : 
      33           28 : function isSectionCollapsed(nodeId: NodeId): boolean {
      34              :   // Defaults to collapsed when not explicitly set by the user
      35           28 :   return collapseMap[nodeId] ?? true
      36              : }
      37              : 
      38            0 : function setSectionCollapsed(nodeId: NodeId, collapsed: boolean) {
      39            0 :   collapseMap[nodeId] = collapsed
      40              : }
      41              : 
      42            2 : const isAllCollapsed = computed({
      43              :   get() {
      44            2 :     return searchedWidgetsSectionDataList.value.every(({ node }) =>
      45              :       isSectionCollapsed(node.id)
      46              :     )
      47              :   },
      48              :   set(collapse: boolean) {
      49            0 :     for (const { node } of widgetsSectionDataList.value) {
      50            0 :       setSectionCollapsed(node.id, collapse)
      51              :     }
      52              :   }
      53              : })
      54              : 
      55            2 : async function searcher(query: string) {
      56            2 :   const list = widgetsSectionDataList.value
      57            2 :   const target = searchedWidgetsSectionDataList
      58            2 :   isSearching.value = query.trim() !== ''
      59            2 :   target.value = searchWidgetsAndNodes(list, query)
      60              : }
      61            2 : </script>
      62              : 
      63              : <template>
      64              :   <PanelSearchHeader
      65              :     v-model="searchQuery"
      66              :     :searcher
      67              :     :update-key="widgetsSectionDataList"
      68              :   >
      69              :     <CollapseToggleButton
      70              :       v-model="isAllCollapsed"
      71              :       :expand-label="$t('g.expandAll')"
      72              :       :collapse-label="$t('g.collapseAll')"
      73              :       :show="!isSearching && widgetsSectionDataList.length > 1"
      74              :     />
      75              :   </PanelSearchHeader>
      76              :   <TransitionGroup tag="div" name="list-scale" class="relative">
      77              :     <div
      78              :       v-if="isSearching && searchedWidgetsSectionDataList.length === 0"
      79              :       class="px-4 pt-5 pb-15 text-center text-sm text-muted-foreground"
      80              :     >
      81              :       {{ $t('rightSidePanel.noneSearchDesc') }}
      82              :     </div>
      83           14 :     <SectionWidgets
      84              :       v-for="{ node, widgets } in searchedWidgetsSectionDataList"
      85              :       :key="node.id"
      86              :       :node
      87              :       :widgets
      88              :       :collapse="isSectionCollapsed(node.id) && !isSearching"
      89              :       :tooltip="
      90              :         isSearching || widgets.length
      91              :           ? ''
      92              :           : $t('rightSidePanel.inputsNoneTooltip')
      93              :       "
      94              :       show-locate-button
      95              :       class="border-b"
      96              :       @update:collapse="setSectionCollapsed(node.id, $event)"
      97              :     />
      98              :   </TransitionGroup>
      99              : </template>
        

Generated by: LCOV version 2.0-1