feat: add millon js, add models picker dialog, update builder
This commit is contained in:
@@ -6,6 +6,8 @@ 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";
|
||||
|
||||
export const INPUT_COMPONENTS = {
|
||||
checkbox: AutoFormCheckbox,
|
||||
@@ -16,6 +18,10 @@ export const INPUT_COMPONENTS = {
|
||||
textarea: AutoFormTextarea,
|
||||
number: AutoFormNumber,
|
||||
fallback: AutoFormInput,
|
||||
|
||||
// Customs
|
||||
snapshot: AutoFormSnapshotPicker,
|
||||
models: AutoFormModelsPicker,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
FormMessage,
|
||||
} from "../../form";
|
||||
import { Input } from "../../input";
|
||||
import { AutoFormInputComponentProps } from "../types";
|
||||
import type { AutoFormInputComponentProps } from "../types";
|
||||
|
||||
export default function AutoFormInput({
|
||||
label,
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { FieldConfig } from "./types";
|
||||
import type { ZodObjectOrWrapped } from "./utils";
|
||||
import { getDefaultValues, getObjectFormSchema } from "./utils";
|
||||
import AutoFormObject from "@/components/ui/auto-form/fields/object";
|
||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import type { DefaultValues } from "react-hook-form";
|
||||
@@ -68,11 +69,15 @@ function AutoForm<SchemaType extends ZodObjectOrWrapped>({
|
||||
}}
|
||||
className={cn("space-y-5", className)}
|
||||
>
|
||||
<AutoFormObject
|
||||
schema={objectFormSchema}
|
||||
form={form}
|
||||
fieldConfig={fieldConfig}
|
||||
/>
|
||||
<ScrollArea>
|
||||
<div className="max-h-[400px] px-1 py-1 w-full">
|
||||
<AutoFormObject
|
||||
schema={objectFormSchema}
|
||||
form={form}
|
||||
fieldConfig={fieldConfig}
|
||||
/>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
|
||||
{children}
|
||||
</form>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ControllerRenderProps, FieldValues } from "react-hook-form";
|
||||
import * as z from "zod";
|
||||
import { INPUT_COMPONENTS } from "./config";
|
||||
import type { INPUT_COMPONENTS } from "./config";
|
||||
import type { ControllerRenderProps, FieldValues } from "react-hook-form";
|
||||
import type * as z from "zod";
|
||||
|
||||
export type FieldConfigItem = {
|
||||
description?: React.ReactNode;
|
||||
|
||||
Reference in New Issue
Block a user