File size: 1,118 Bytes
db242f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
export interface BaseSettingOptions {
label: string;
description?: string;
isOptional?: boolean;
value?: string | boolean | number;
}
export interface TypeSettingSchema extends BaseSettingOptions {
key: string;
type: 'switch' | 'input' | 'list';
items?: never;
}
export interface MultiInputSettingSchema extends BaseSettingOptions {
key: string;
keys: string[];
type: 'multi-input';
items?: never;
}
export interface SelectSettingSchema extends BaseSettingOptions {
key: string;
type: 'select';
items?: never;
selectOptions: string[];
}
export interface ItemsSettingSchema extends BaseSettingOptions {
key: string;
type?: never;
items: ISettingSchema[];
}
/* 渲染表单的结构 */
export type ISettingSchema =
| TypeSettingSchema
| ItemsSettingSchema
| SelectSettingSchema
| MultiInputSettingSchema;
export type ISettingResultValue =
| string
| boolean
| number
| string[]
| number[]
| Record<string, string | number | boolean>[]
| ISettingResult;
/* 回传表单的数据 */
export interface ISettingResult {
[key: string]: ISettingResultValue;
}
|