UNPKG

extended-dynamic-forms

Version:

Extended React JSON Schema Form (RJSF) v6 with custom components, widgets, templates, layouts, and form events

38 lines (36 loc) 1.04 kB
import { ErrorSchema } from '@rjsf/utils'; export interface Rule<T> { name: string; condition: (formData: any) => boolean; effect: T; order?: number; } export interface EngineConfig<T, C = any> { applyEffects: (effects: T[], baseConfig: C, formData: any) => C; defaultConfig: () => C; } export type ConditionalEngineHook<T, C = any> = (rules: Rule<T>[], baseConfig: C, formData: any) => C; export interface UiEffect { op: 'add' | 'remove' | 'replace'; path: string; value?: any; } export interface SchemaEffect { op: 'add' | 'remove' | 'replace'; path: string; value?: any; } export interface ValidationEffect { /** * Name of the validation rule for debugging purposes */ name: string; /** * Determines if this validation should be applied based on current form data */ isActive: (formData: any) => boolean; /** * Applies validation logic and adds errors to the ErrorSchema */ validate: (errors: ErrorSchema, formData: any) => void; }