diff --git a/src/components/dialog/content/setting/CustomSettingValue.vue b/src/components/common/CustomFormValue.vue similarity index 100% rename from src/components/dialog/content/setting/CustomSettingValue.vue rename to src/components/common/CustomFormValue.vue diff --git a/src/components/common/FormItem.vue b/src/components/common/FormItem.vue new file mode 100644 index 000000000..cca3fe276 --- /dev/null +++ b/src/components/common/FormItem.vue @@ -0,0 +1,102 @@ + + + + + + diff --git a/src/components/dialog/content/setting/SettingGroup.vue b/src/components/dialog/content/setting/SettingGroup.vue index aeca73152..8f822fd96 100644 --- a/src/components/dialog/content/setting/SettingGroup.vue +++ b/src/components/dialog/content/setting/SettingGroup.vue @@ -7,45 +7,15 @@ :key="setting.id" class="setting-item flex items-center mb-4" > -
- - - - {{ setting.name }} - -
-
- -
+ - - diff --git a/src/components/dialog/content/setting/SettingItem.vue b/src/components/dialog/content/setting/SettingItem.vue new file mode 100644 index 000000000..83b4fcc0b --- /dev/null +++ b/src/components/dialog/content/setting/SettingItem.vue @@ -0,0 +1,35 @@ + + + diff --git a/src/types/settingTypes.ts b/src/types/settingTypes.ts index 879da016f..24ebb2ec6 100644 --- a/src/types/settingTypes.ts +++ b/src/types/settingTypes.ts @@ -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 | ((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 + options?: Array | ((value: any) => SettingOption[]) +}