Merge branch 'develop' into feat-12909
This commit is contained in:
commit
99feef3fe6
|
@ -3,7 +3,11 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type EnumItem = string | {label: string; value: string;};
|
type EnumItem = string | {
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type FormItem = {
|
export type FormItem = {
|
||||||
label?: string;
|
label?: string;
|
||||||
type: 'string';
|
type: 'string';
|
||||||
|
@ -36,16 +40,23 @@ export type FormItem = {
|
||||||
label: string;
|
label: string;
|
||||||
value: unknown;
|
value: unknown;
|
||||||
}[];
|
}[];
|
||||||
|
} | {
|
||||||
|
label?: string;
|
||||||
|
type: 'range';
|
||||||
|
default: number | null;
|
||||||
|
step: number;
|
||||||
|
min: number;
|
||||||
|
max: number;
|
||||||
} | {
|
} | {
|
||||||
label?: string;
|
label?: string;
|
||||||
type: 'object';
|
type: 'object';
|
||||||
default: Record<string, unknown> | null;
|
default: Record<string, unknown> | null;
|
||||||
hidden: true;
|
hidden: boolean;
|
||||||
} | {
|
} | {
|
||||||
label?: string;
|
label?: string;
|
||||||
type: 'array';
|
type: 'array';
|
||||||
default: unknown[] | null;
|
default: unknown[] | null;
|
||||||
hidden: true;
|
hidden: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Form = Record<string, FormItem>;
|
export type Form = Record<string, FormItem>;
|
||||||
|
@ -55,6 +66,7 @@ type GetItemType<Item extends FormItem> =
|
||||||
Item['type'] extends 'number' ? number :
|
Item['type'] extends 'number' ? number :
|
||||||
Item['type'] extends 'boolean' ? boolean :
|
Item['type'] extends 'boolean' ? boolean :
|
||||||
Item['type'] extends 'radio' ? unknown :
|
Item['type'] extends 'radio' ? unknown :
|
||||||
|
Item['type'] extends 'range' ? number :
|
||||||
Item['type'] extends 'enum' ? string :
|
Item['type'] extends 'enum' ? string :
|
||||||
Item['type'] extends 'array' ? unknown[] :
|
Item['type'] extends 'array' ? unknown[] :
|
||||||
Item['type'] extends 'object' ? Record<string, unknown>
|
Item['type'] extends 'object' ? Record<string, unknown>
|
||||||
|
|
Loading…
Reference in New Issue