windly
Version:
34 lines (33 loc) • 947 B
TypeScript
import { FormInstance } from 'antd';
type FormFieldType = 'text' | 'number' | 'password' | 'dropdown' | 'date';
interface FormFieldOption {
label: string;
value: string | number;
}
interface FormField {
name: string;
label: string;
type: FormFieldType;
required?: boolean;
disabled?: boolean;
defaultValue?: any;
rules?: any[];
options?: FormFieldOption[];
maxvalue?: number;
minDate?: string;
}
interface ReusableFormProps {
title: string;
open: boolean;
setOpen: (open: boolean) => void;
formConfig?: FormField[];
onSubmit: (values: any) => void;
record?: Record<string, any> | null;
loading?: boolean;
size?: number;
twoColumns?: boolean;
handleFieldChange?: (changedValues: Record<string, any>, allValues: Record<string, any>, form: FormInstance) => void;
buttonText?: string;
}
declare const RForm: React.FC<ReusableFormProps>;
export default RForm;