UNPKG

extended-dynamic-forms

Version:

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

45 lines (43 loc) 2.11 kB
import { FormEventHandlers, FieldEventHandlers, WebhookConfig } from '../types'; export declare class FormEventHub { private formHandlers; private fieldHandlers; private webhooks; private debounceTimers; private webhookQueue; private isProcessingQueue; private webhookCallbacks?; constructor(formHandlers: FormEventHandlers, fieldHandlers?: FieldEventHandlers, webhooks?: WebhookConfig[], webhookCallbacks?: { onWebhookStart?: (webhook: WebhookConfig, event: any) => void; onWebhookComplete?: (webhook: WebhookConfig, event: any, response: any) => void; onWebhookError?: (webhook: WebhookConfig, event: any, error: Error) => void; }); updateWebhooks(webhooks: WebhookConfig[]): void; updateCallbacks(callbacks: { onWebhookStart?: (webhook: WebhookConfig, event: any) => void; onWebhookComplete?: (webhook: WebhookConfig, event: any, response: any) => void; onWebhookError?: (webhook: WebhookConfig, event: any, error: Error) => void; }): void; handleBeforeSubmit(data: any): Promise<any>; handleAfterSubmit(data: any): Promise<void>; handleBeforeValidation(data: any): Promise<any>; handleAfterValidation(validationErrors: any, formData: any): Promise<void>; handleStepChange(fromStep: number, toStep: number, formData: any): Promise<void>; handleFieldEvent(eventType: 'focus' | 'blur' | 'change', fieldId: string, fieldValue: any, schema?: any, formData?: any, fieldPath?: string[]): Promise<void>; private processWebhooks; private debounceWebhook; private queueWebhook; private processWebhookQueue; private cleanEventForWebhook; private deepCleanObject; private callWebhook; createFieldEventHandlers(fieldId: string, schema?: any, formData?: any, fieldPath?: string[]): { onFocus: (value: any) => Promise<void>; onBlur: (value: any) => Promise<void>; onChange: (value: any) => Promise<void>; }; cleanup(): void; private formatValidationErrors; private generateDebounceKey; private createStandardizedPayload; }