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