import { Validator } from '../validators'; import { ConditionDefinition } from '../condition'; import { DataType } from '../data-types'; import { AnyObject } from './any-object'; import { FieldInputProps } from 'react-final-form'; import { FormOptions } from '../renderer-context'; import { Meta } from '../use-field-api'; import ComponentMapper, { ComponentPropsMap } from './component-mapper'; export type FieldAction = [string, ...any[]]; export interface FieldActions { [key: string]: FieldAction; } export interface FieldApi { meta: Meta; input: FieldInputProps; } export type ResolvePropsFunction, FieldValue = FormValues[keyof FormValues]> = (props: AnyObject, fieldApi: FieldApi, formOptions: FormOptions) => AnyObject; export { BaseFieldProps } from '../use-field-api'; export interface StrictBaseFieldProps, FieldValue = FormValues[keyof FormValues]> { name: string; label?: string; helperText?: string; description?: string; isRequired?: boolean; isDisabled?: boolean; isReadOnly?: boolean; isVisible?: boolean; hideField?: boolean; validate?: Validator[]; condition?: ConditionDefinition | ConditionDefinition[]; initializeOnMount?: boolean; dataType?: DataType; initialValue?: FieldValue; clearedValue?: FieldValue; clearOnUnmount?: boolean; actions?: FieldActions; resolveProps?: ResolvePropsFunction; } export type TypedFieldProps

= StrictBaseFieldProps & P; export type Field, FieldValue = FormValues[keyof FormValues]> = StrictBaseFieldProps & { component: C; } & ComponentPropsMap[C]; interface LegacyField, FieldValue = FormValues[keyof FormValues]> extends AnyObject { name: string; component: string; validate?: Validator[]; condition?: ConditionDefinition | ConditionDefinition[]; initializeOnMount?: boolean; dataType?: DataType; initialValue?: FieldValue; clearedValue?: FieldValue; clearOnUnmount?: boolean; actions?: FieldActions; resolveProps?: ResolvePropsFunction; } export default LegacyField;