mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 23:50:08 +00:00
Minimal subgraph widget ui framework
Displays all widgets poorly and allows re ordering
This commit is contained in:
42
src/components/selectionbar/SubgraphNode.vue
Normal file
42
src/components/selectionbar/SubgraphNode.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<SidebarTabTemplate
|
||||
:title="'Subgraph Node'"
|
||||
class="workflows-sidebar-tab bg-[var(--p-tree-background)]"
|
||||
>
|
||||
<template #body>
|
||||
<OrderList v-model="items" dataKey="id" breakpoint="575px" pt:pcListbox:root="w-full sm:w-56">
|
||||
<template #option="{ option }">
|
||||
{{ option }}
|
||||
</template>
|
||||
</OrderList>
|
||||
</template>
|
||||
</SidebarTabTemplate>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue';
|
||||
import OrderList from 'primevue/orderlist';
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import SidebarTabTemplate from '@/components/sidebar/tabs/SidebarTabTemplate.vue'
|
||||
import { useCanvasStore } from '@/stores/graphStore'
|
||||
const { t } = useI18n()
|
||||
|
||||
const canvasStore = useCanvasStore()
|
||||
|
||||
const items = ref(null)
|
||||
|
||||
watch(() => canvasStore.selectedItems,
|
||||
(selectedItems) => {
|
||||
const node = selectedItems[0] ?? {}
|
||||
const interiorNodes = node?.subgraph?.nodes ?? []
|
||||
if (!interiorNodes) {
|
||||
items.value = null
|
||||
return
|
||||
}
|
||||
const intn = interiorNodes.map((n) =>
|
||||
n.widgets.map((w) => [n.title, w.name])).flat(1)
|
||||
items.value = intn
|
||||
})
|
||||
</script>
|
||||
20
src/composables/sidebarTabs/useSubgraphNodeTab.ts
Normal file
20
src/composables/sidebarTabs/useSubgraphNodeTab.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
import { markRaw } from 'vue'
|
||||
|
||||
import SubgraphNode from '@/components/selectionbar/SubgraphNode.vue'
|
||||
import type { SidebarTabExtension } from '@/types/extensionTypes'
|
||||
|
||||
export const useSubgraphNodeTab = (): SidebarTabExtension => {
|
||||
return {
|
||||
id: 'sgn',
|
||||
icon: 'pi pi-history',
|
||||
iconBadge: () => {
|
||||
return null
|
||||
},
|
||||
title: 'sideToolbar.queue',
|
||||
tooltip: 'sideToolbar.queue',
|
||||
label: 'sideToolbar.labels.queue',
|
||||
component: markRaw(SubgraphNode),
|
||||
type: 'vue'
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { useModelLibrarySidebarTab } from '@/composables/sidebarTabs/useModelLib
|
||||
import { useNodeLibrarySidebarTab } from '@/composables/sidebarTabs/useNodeLibrarySidebarTab'
|
||||
import { useQueueSidebarTab } from '@/composables/sidebarTabs/useQueueSidebarTab'
|
||||
import { useWorkflowsSidebarTab } from '@/composables/sidebarTabs/useWorkflowsSidebarTab'
|
||||
import { useSubgraphNodeTab } from '@/composables/sidebarTabs/useSubgraphNodeTab'
|
||||
import { t, te } from '@/i18n'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { useMenuItemStore } from '@/stores/menuItemStore'
|
||||
@@ -92,6 +93,7 @@ export const useSidebarTabStore = defineStore('sidebarTab', () => {
|
||||
registerSidebarTab(useNodeLibrarySidebarTab())
|
||||
registerSidebarTab(useModelLibrarySidebarTab())
|
||||
registerSidebarTab(useWorkflowsSidebarTab())
|
||||
registerSidebarTab(useSubgraphNodeTab())
|
||||
|
||||
const menuStore = useMenuItemStore()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user