UNPKG

@kintobrasil/kinto-brasil-checklist-sinistro-components

Version:
55 lines (54 loc) 1.23 kB
import { type FormInstance, type FormProps, type SelectProps } from 'antd'; import { type Rule } from 'antd/es/form'; import React from 'react'; import { type SelectBadgesItem } from './SelectBadges'; interface Condition { field: string; operation: string; comparison: string; } type Field = { type: string; name: string; label: string; required?: boolean; condition?: Condition; errorMessage?: string; customRules?: Rule[]; colon?: boolean; } & ({ type: 'document'; size: number; optional?: number; } | { type: 'input'; mask?: (value: string) => string; onBlur?: () => void; max?: number; min?: number; } | { type: 'switch'; } | { type: 'date'; } | { type: 'textarea'; min: number; max: number; } | { type: 'selectbadges'; items: SelectBadgesItem[]; groups?: string[]; } | { type: 'select'; options: SelectProps['options']; } | { type: 'signature'; }); interface OwnProps<T = unknown> { onSendForm?: (payload: T) => void; formConfig?: FormProps; formRef: FormInstance; fields: Field[]; } declare const FormFactory: <T>(props: OwnProps<T>) => React.ReactElement; export default FormFactory;