Added select create input element

This commit is contained in:
sianida26 2024-05-17 15:45:09 +07:00
parent 20dee90f75
commit 32d2b444bf

View File

@ -5,6 +5,8 @@ import {
NumberInputProps, NumberInputProps,
PasswordInput, PasswordInput,
PasswordInputProps, PasswordInputProps,
Select,
SelectProps,
TextInput, TextInput,
TextInputProps, TextInputProps,
} from "@mantine/core"; } from "@mantine/core";
@ -30,6 +32,10 @@ type NumberInputType = {
type: "number"; type: "number";
} & Omit<NumberInputProps, "type">; } & Omit<NumberInputProps, "type">;
type SelectType = {
type: "select";
} & SelectProps;
interface Options { interface Options {
disableAll?: boolean; disableAll?: boolean;
readonlyAll?: boolean; readonlyAll?: boolean;
@ -38,6 +44,7 @@ interface Options {
| MultiSelectInputType | MultiSelectInputType
| PasswordInputType | PasswordInputType
| NumberInputType | NumberInputType
| SelectType
) & ) &
GeneralInputProps)[]; GeneralInputProps)[];
} }
@ -86,6 +93,14 @@ function createInputComponents(options: Options) {
/> />
); );
break; break;
case "select":
components.push(
<Select
{...input}
readOnly={options.readonlyAll || input.readOnly}
disabled={options.disableAll || input.disabled}
/>
);
} }
} }