Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/components/common/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@click="$emit('showFilter', $event)"
/>
<InputText
ref="inputRef"
class="search-box-input w-full"
:model-value="modelValue"
:placeholder="placeholder"
Expand Down Expand Up @@ -48,6 +49,7 @@ import Button from 'primevue/button'
import IconField from 'primevue/iconfield'
import InputIcon from 'primevue/inputicon'
import InputText from 'primevue/inputtext'
import { ref } from 'vue'

import type { SearchFilter } from './SearchFilterChip.vue'
import SearchFilterChip from './SearchFilterChip.vue'
Expand Down Expand Up @@ -77,6 +79,14 @@ const emit = defineEmits<{
(e: 'removeFilter', filter: TFilter): void
}>()

const inputRef = ref()

defineExpose({
focus: () => {
inputRef.value?.$el?.focus()
}
})

const emitSearch = debounce((value: string) => {
emit('search', value, filters)
}, debounceTime)
Expand Down
3 changes: 3 additions & 0 deletions src/components/sidebar/tabs/ModelLibrarySidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</template>
<template #header>
<SearchBox
ref="searchBoxRef"
v-model:model-value="searchQuery"
class="model-lib-search-box p-2 2xl:p-4"
:placeholder="$t('g.searchModels') + '...'"
Expand Down Expand Up @@ -66,6 +67,7 @@ import { buildTree } from '@/utils/treeUtil'
const modelStore = useModelStore()
const modelToNodeStore = useModelToNodeStore()
const settingStore = useSettingStore()
const searchBoxRef = ref()
const searchQuery = ref<string>('')
const expandedKeys = ref<Record<string, boolean>>({})
const { expandNode, toggleNodeOnEvent } = useTreeExpansion(expandedKeys)
Expand Down Expand Up @@ -180,6 +182,7 @@ watch(
)

onMounted(async () => {
searchBoxRef.value?.focus()
if (settingStore.get('Comfy.ModelLibrary.AutoLoadAll')) {
await modelStore.loadModels()
}
Expand Down
9 changes: 8 additions & 1 deletion src/components/sidebar/tabs/NodeLibrarySidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<template #header>
<div>
<SearchBox
ref="searchBoxRef"
v-model:model-value="searchQuery"
class="node-lib-search-box p-2 2xl:p-4"
:placeholder="$t('g.searchNodes') + '...'"
Expand Down Expand Up @@ -130,7 +131,7 @@ import Button from 'primevue/button'
import Divider from 'primevue/divider'
import Popover from 'primevue/popover'
import type { Ref } from 'vue'
import { computed, h, nextTick, ref, render } from 'vue'
import { computed, h, nextTick, onMounted, ref, render } from 'vue'

import SearchBox from '@/components/common/SearchBox.vue'
import type { SearchFilter } from '@/components/common/SearchFilterChip.vue'
Expand Down Expand Up @@ -171,6 +172,12 @@ const { expandNode, toggleNodeOnEvent } = useTreeExpansion(expandedKeys)
const nodeBookmarkTreeExplorerRef = ref<InstanceType<
typeof NodeBookmarkTreeExplorer
> | null>(null)
const searchBoxRef = ref()

onMounted(() => {
searchBoxRef.value?.focus()
})

const searchFilter = ref<InstanceType<typeof Popover> | null>(null)
const groupingPopover = ref<InstanceType<typeof Popover> | null>(null)
const sortingPopover = ref<InstanceType<typeof Popover> | null>(null)
Expand Down
7 changes: 7 additions & 0 deletions src/components/sidebar/tabs/WorkflowsSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</template>
<template #header>
<SearchBox
ref="searchBoxRef"
v-model:model-value="searchQuery"
class="workflows-search-box p-2 2xl:p-4"
:placeholder="$t('g.searchWorkflows') + '...'"
Expand Down Expand Up @@ -158,6 +159,12 @@ const workflowTabsPosition = computed(() =>
settingStore.get('Comfy.Workflow.WorkflowTabsPosition')
)

const searchBoxRef = ref()

onMounted(() => {
searchBoxRef.value?.focus()
})

const searchQuery = ref('')
const isSearching = computed(() => searchQuery.value.length > 0)
const filteredWorkflows = ref<ComfyWorkflow[]>([])
Expand Down
Loading