Skip to content

Commit ef362a8

Browse files
committed
style: Add minimum height for some widgets
1 parent 8e360d5 commit ef362a8

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

src/components/rightSidePanel/parameters/SectionWidgets.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<script setup lang="ts">
2+
import { cn } from '@comfyorg/tailwind-utils'
23
import { provide } from 'vue'
34
45
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
56
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
67
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
78
import WidgetLegacy from '@/renderer/extensions/vueNodes/widgets/components/WidgetLegacy.vue'
8-
import { getComponent } from '@/renderer/extensions/vueNodes/widgets/registry/widgetRegistry'
9+
import {
10+
getComponent,
11+
shouldExpand
12+
} from '@/renderer/extensions/vueNodes/widgets/registry/widgetRegistry'
913
1014
import PropertiesAccordionItem from '../layout/PropertiesAccordionItem.vue'
1115
@@ -58,7 +62,7 @@ function onWidgetValueChange(
5862
:model-value="widget.value"
5963
:node-id="String(node.id)"
6064
:node-type="node.type"
61-
class="col-span-1"
65+
:class="cn('col-span-1', shouldExpand(widget.type) && 'min-h-36')"
6266
@update:model-value="
6367
(value: string | number | boolean | object) =>
6468
onWidgetValueChange(widget, value)

src/renderer/extensions/vueNodes/components/NodeWidgets.vue

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ import WidgetDOM from '@/renderer/extensions/vueNodes/widgets/components/WidgetD
8383
import WidgetLegacy from '@/renderer/extensions/vueNodes/widgets/components/WidgetLegacy.vue'
8484
import {
8585
getComponent,
86+
shouldExpand,
8687
shouldRenderAsVue
8788
} from '@/renderer/extensions/vueNodes/widgets/registry/widgetRegistry'
8889
import type { SimplifiedWidget, WidgetValue } from '@/types/simplifiedWidget'
@@ -192,28 +193,11 @@ const processedWidgets = computed((): ProcessedWidget[] => {
192193
return result
193194
})
194195
195-
// TODO: Derive from types in widgetRegistry
196-
const EXPANDING_TYPES = [
197-
'textarea',
198-
'TEXTAREA',
199-
'multiline',
200-
'customtext',
201-
'markdown',
202-
'MARKDOWN',
203-
'progressText',
204-
'load3D',
205-
'LOAD_3D'
206-
] as const
207-
208196
const gridTemplateRows = computed((): string => {
209197
const widgets = toValue(processedWidgets)
210198
return widgets
211199
.filter((w) => !w.simplified.options?.hidden)
212-
.map((w) =>
213-
EXPANDING_TYPES.includes(w.type as (typeof EXPANDING_TYPES)[number])
214-
? 'auto'
215-
: 'min-content'
216-
)
200+
.map((w) => (shouldExpand(w.type) ? 'auto' : 'min-content'))
217201
.join(' ')
218202
})
219203
</script>

src/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,19 @@ export const isEssential = (type: string): boolean => {
197197
export const shouldRenderAsVue = (widget: Partial<SafeWidgetData>): boolean => {
198198
return !widget.options?.canvasOnly && !!widget.type
199199
}
200+
201+
const EXPANDING_TYPES = [
202+
'textarea',
203+
'TEXTAREA',
204+
'multiline',
205+
'customtext',
206+
'markdown',
207+
'MARKDOWN',
208+
'progressText',
209+
'load3D',
210+
'LOAD_3D'
211+
] as const
212+
213+
export function shouldExpand(type: string): boolean {
214+
return EXPANDING_TYPES.includes(type as (typeof EXPANDING_TYPES)[number])
215+
}

0 commit comments

Comments
 (0)