mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-27 18:24:11 +00:00
[Refactor] Extract 'FormItem' and 'SettingItem' (#1619)
* Extract SettingItem component * Extract GeneralSettingItem * Rename to FormItem * nit * nit
This commit is contained in:
@@ -29,15 +29,10 @@ export interface Setting {
|
||||
render: () => HTMLElement
|
||||
}
|
||||
|
||||
export interface SettingParams {
|
||||
export interface SettingParams extends FormItem {
|
||||
id: keyof Settings
|
||||
name: string
|
||||
type: SettingInputType | SettingCustomRenderer
|
||||
defaultValue: any
|
||||
onChange?: (newValue: any, oldValue?: any) => void
|
||||
attrs?: any
|
||||
tooltip?: string
|
||||
options?: Array<string | SettingOption> | ((value: any) => SettingOption[])
|
||||
// By default category is id.split('.'). However, changing id to assign
|
||||
// new category has poor backward compatibility. Use this field to overwrite
|
||||
// default category from id.
|
||||
@@ -52,3 +47,14 @@ export interface SettingParams {
|
||||
// Version of the setting when it was last modified
|
||||
versionModified?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* The base form item for rendering in a form.
|
||||
*/
|
||||
export interface FormItem {
|
||||
name: string
|
||||
type: SettingInputType | SettingCustomRenderer
|
||||
tooltip?: string
|
||||
attrs?: Record<string, any>
|
||||
options?: Array<string | SettingOption> | ((value: any) => SettingOption[])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user