Line data Source code
1 : <template>
2 6770 : <div
3 : class="option-container flex w-full items-center justify-between overflow-hidden px-2 py-0"
4 : >
5 : <div class="option-display-name flex flex-col font-semibold">
6 : <div>
7 : <span v-if="isBookmarked">
8 : <i class="pi pi-bookmark-fill mr-1 text-sm" />
9 : </span>
10 : <span>
11 : <HighlightedText
12 : :text="nodeDef.display_name"
13 : :query="currentQuery"
14 : highlight-class="-my-0.5 mx-0.5 rounded-sm bg-primary px-0.5 font-bold text-foreground"
15 : />
16 : </span>
17 : <span> </span>
18 : <Badge v-if="showIdName" severity="secondary">
19 : <span>
20 : <HighlightedText
21 : :text="nodeDef.name"
22 : :query="currentQuery"
23 : highlight-class="-my-0.5 mx-0.5 rounded-sm bg-primary px-0.5 font-bold text-foreground"
24 : />
25 : </span>
26 : </Badge>
27 : </div>
28 : <div
29 : v-if="showCategory"
30 : class="option-category truncate font-light text-muted-foreground"
31 : >
32 : {{ nodeDef.category.replaceAll('/', ' > ') }}
33 : </div>
34 : </div>
35 : <div class="option-badges">
36 : <Badge v-if="nodeDef.deprecated" severity="danger">
37 : {{ $t('g.deprecated') }}
38 : </Badge>
39 : <Badge v-if="nodeDef.experimental" severity="primary">
40 : {{ $t('g.experimental') }}
41 : </Badge>
42 : <Badge v-if="nodeDef.dev_only" severity="info">
43 : {{ $t('g.devOnly') }}
44 : </Badge>
45 : <Badge v-if="showNodeFrequency && nodeFrequency > 0" severity="secondary">
46 : {{ formatNumberWithSuffix(nodeFrequency, { roundToInt: true }) }}
47 : </Badge>
48 : <Badge
49 : v-if="nodeDef.nodeSource.type !== NodeSourceType.Unknown"
50 : variant="chip"
51 : class="font-light"
52 : >
53 : {{ nodeDef.nodeSource.displayText }}
54 : </Badge>
55 : </div>
56 : </div>
57 : </template>
58 :
59 : <script setup lang="ts">
60 : import { computed } from 'vue'
61 :
62 : import HighlightedText from '@comfyorg/design-system/common/HighlightedText'
63 : import Badge from '@comfyorg/design-system/badge/Badge'
64 : import { useSettingStore } from '@/platform/settings/settingStore'
65 : import { useNodeBookmarkStore } from '@/stores/nodeBookmarkStore'
66 : import type { ComfyNodeDefImpl } from '@/core/graph/nodeDef/ComfyNodeDefImpl'
67 : import { useNodeFrequencyStore } from '@/stores/nodeFrequencyStore'
68 : import { NodeSourceType } from '@/types/nodeSource'
69 : import { formatNumberWithSuffix } from '@/utils/formatUtil'
70 :
71 3528 : const settingStore = useSettingStore()
72 3528 : const showCategory = computed(() =>
73 : settingStore.get('Comfy.NodeSearchBoxImpl.ShowCategory')
74 : )
75 3528 : const showIdName = computed(() =>
76 : settingStore.get('Comfy.NodeSearchBoxImpl.ShowIdName')
77 : )
78 3528 : const showNodeFrequency = computed(() =>
79 : settingStore.get('Comfy.NodeSearchBoxImpl.ShowNodeFrequency')
80 : )
81 3528 : const nodeFrequencyStore = useNodeFrequencyStore()
82 3528 : const nodeFrequency = computed(() =>
83 : nodeFrequencyStore.getNodeFrequency(props.nodeDef)
84 : )
85 :
86 3528 : const nodeBookmarkStore = useNodeBookmarkStore()
87 3528 : const isBookmarked = computed(() =>
88 : nodeBookmarkStore.isBookmarked(props.nodeDef)
89 : )
90 :
91 3528 : const props = defineProps<{
92 : nodeDef: ComfyNodeDefImpl
93 : currentQuery: string
94 : }>()
95 : </script>
|