42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import AutoFormCheckbox from "./fields/checkbox";
|
|
import AutoFormDate from "./fields/date";
|
|
import AutoFormEnum from "./fields/enum";
|
|
import AutoFormInput from "./fields/input";
|
|
import AutoFormNumber from "./fields/number";
|
|
import AutoFormRadioGroup from "./fields/radio-group";
|
|
import AutoFormSwitch from "./fields/switch";
|
|
import AutoFormTextarea from "./fields/textarea";
|
|
import AutoFormModelsPicker from "@/components/custom-form/model-picker";
|
|
import AutoFormSnapshotPicker from "@/components/custom-form/snapshot-picker";
|
|
import AutoFormCheckpointInput from "@/components/custom-form/checkpoint-input";
|
|
|
|
export const INPUT_COMPONENTS = {
|
|
checkbox: AutoFormCheckbox,
|
|
date: AutoFormDate,
|
|
select: AutoFormEnum,
|
|
radio: AutoFormRadioGroup,
|
|
switch: AutoFormSwitch,
|
|
textarea: AutoFormTextarea,
|
|
number: AutoFormNumber,
|
|
fallback: AutoFormInput,
|
|
|
|
// Customs
|
|
snapshot: AutoFormSnapshotPicker,
|
|
models: AutoFormModelsPicker,
|
|
checkpoints: AutoFormCheckpointInput,
|
|
};
|
|
|
|
/**
|
|
* Define handlers for specific Zod types.
|
|
* You can expand this object to support more types.
|
|
*/
|
|
export const DEFAULT_ZOD_HANDLERS: {
|
|
[key: string]: keyof typeof INPUT_COMPONENTS;
|
|
} = {
|
|
ZodBoolean: "checkbox",
|
|
ZodDate: "date",
|
|
ZodEnum: "select",
|
|
ZodNativeEnum: "select",
|
|
ZodNumber: "number",
|
|
};
|