mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-08 06:30:04 +00:00
Add support for growable inputs (#6830)
 Also fixes connections to widget inputs created by a dynamic combo breaking on reload. Performs some refactoring to group the prior dynamic inputs code. See also, the overarching frontend PR: comfyanonymous/ComfyUI#10832 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6830-Add-support-for-growable-inputs-2b36d73d365081c484ebc251a10aa6dd) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -14,10 +14,6 @@ const zRemoteWidgetConfig = z.object({
|
||||
timeout: z.number().gte(0).optional(),
|
||||
max_retries: z.number().gte(0).optional()
|
||||
})
|
||||
const zWidgetTemplate = z.object({
|
||||
template_id: z.string(),
|
||||
allowed_types: z.string().optional()
|
||||
})
|
||||
const zMultiSelectOption = z.object({
|
||||
placeholder: z.string().optional(),
|
||||
chip: z.boolean().optional()
|
||||
@@ -34,7 +30,6 @@ export const zBaseInputOptions = z
|
||||
hidden: z.boolean().optional(),
|
||||
advanced: z.boolean().optional(),
|
||||
widgetType: z.string().optional(),
|
||||
template: zWidgetTemplate.optional(),
|
||||
/** Backend-only properties. */
|
||||
rawLink: z.boolean().optional(),
|
||||
lazy: z.boolean().optional()
|
||||
@@ -232,9 +227,21 @@ export const zComfyNodeDef = z.object({
|
||||
input_order: z.record(z.array(z.string())).optional()
|
||||
})
|
||||
|
||||
export const zAutogrowOptions = z.object({
|
||||
...zBaseInputOptions.shape,
|
||||
template: z.object({
|
||||
input: zComfyInputsSpec,
|
||||
names: z.array(z.string()).optional(),
|
||||
max: z.number().optional(),
|
||||
//Backend defines as mandatory with min 1, Frontend is more forgiving
|
||||
min: z.number().optional(),
|
||||
prefix: z.string().optional()
|
||||
})
|
||||
})
|
||||
|
||||
export const zDynamicComboInputSpec = z.tuple([
|
||||
z.literal('COMFY_DYNAMICCOMBO_V3'),
|
||||
zComboInputOptions.extend({
|
||||
zBaseInputOptions.extend({
|
||||
options: z.array(
|
||||
z.object({
|
||||
inputs: zComfyInputsSpec,
|
||||
|
||||
Reference in New Issue
Block a user