mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-02 11:40:00 +00:00
Add support for hidden & advanced widgets (#1389)
* Add support for hidden & advanced widgets * Fix * Update package * Remove ts-expect-error * Fix test, tidy
This commit is contained in:
@@ -57,6 +57,7 @@ import { useExtensionStore } from '@/stores/extensionStore'
|
||||
import { KeyComboImpl, useKeybindingStore } from '@/stores/keybindingStore'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { shallowReactive } from 'vue'
|
||||
import { type IBaseWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
|
||||
export const ANIM_PREVIEW_WIDGET = '$$comfy_animation_preview'
|
||||
|
||||
@@ -2013,7 +2014,11 @@ export class ComfyApp {
|
||||
nodeData['input']['optional']
|
||||
)
|
||||
}
|
||||
const config = { minWidth: 1, minHeight: 1 }
|
||||
const config: {
|
||||
minWidth: number
|
||||
minHeight: number
|
||||
widget?: IBaseWidget
|
||||
} = { minWidth: 1, minHeight: 1 }
|
||||
for (const inputName in inputs) {
|
||||
const inputData = inputs[inputName]
|
||||
const type = inputData[0]
|
||||
@@ -2042,27 +2047,23 @@ export class ComfyApp {
|
||||
widgetCreated = false
|
||||
}
|
||||
|
||||
// @ts-expect-error
|
||||
if (widgetCreated && !inputIsRequired && config?.widget) {
|
||||
// @ts-expect-error
|
||||
if (!config.widget.options) config.widget.options = {}
|
||||
// @ts-expect-error
|
||||
config.widget.options.inputIsOptional = true
|
||||
}
|
||||
|
||||
// @ts-expect-error
|
||||
if (widgetCreated && inputData[1]?.forceInput && config?.widget) {
|
||||
// @ts-expect-error
|
||||
if (!config.widget.options) config.widget.options = {}
|
||||
// @ts-expect-error
|
||||
config.widget.options.forceInput = inputData[1].forceInput
|
||||
}
|
||||
// @ts-expect-error
|
||||
if (widgetCreated && inputData[1]?.defaultInput && config?.widget) {
|
||||
// @ts-expect-error
|
||||
if (!config.widget.options) config.widget.options = {}
|
||||
// @ts-expect-error
|
||||
config.widget.options.defaultInput = inputData[1].defaultInput
|
||||
if (widgetCreated && config?.widget) {
|
||||
config.widget.options ??= {}
|
||||
if (!inputIsRequired) {
|
||||
config.widget.options.inputIsOptional = true
|
||||
}
|
||||
if (inputData[1]?.forceInput) {
|
||||
config.widget.options.forceInput = true
|
||||
}
|
||||
if (inputData[1]?.defaultInput) {
|
||||
config.widget.options.defaultInput = true
|
||||
}
|
||||
if (inputData[1]?.advanced) {
|
||||
config.widget.advanced = true
|
||||
}
|
||||
if (inputData[1]?.hidden) {
|
||||
config.widget.hidden = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user