UNPKG

digitaform-preview-react

Version:

A comprehensive React form preview component library with form controls,responsive design

61 lines 2.26 kB
import { TFormComponent, TFormComponentName } from '../types/form-builder-schema.model'; interface IFormDataValue { value: string | number | string[] | boolean; label: string; type: string; children?: TFormComponent[]; } interface IFormData { [componentId: string]: IFormDataValue; } interface IFormMetadata { exportedAt: string; version: string; componentCount: number; } interface IFormExport { components: TFormComponent[]; metadata: IFormMetadata; } export declare class FormService { private static instance; private components; private constructor(); static getInstance(): FormService; getComponents(): TFormComponent[]; getComponentById(id: string): TFormComponent | undefined; addComponent(componentType: TFormComponentName): TFormComponent; updateComponent(id: string, updates: Partial<TFormComponent>): TFormComponent | null; updateComponentProperty(id: string, section: 'basic' | 'validation' | 'styles' | 'conditional', key: string, value: string | number | boolean | string[] | object): TFormComponent | null; updateComponentOptions(id: string, options: Array<{ label: string; value: string; }>): TFormComponent | null; removeComponent(id: string): boolean; duplicateComponent(id: string): TFormComponent | null; reorderComponents(componentIds: string[]): void; validateComponent(component: TFormComponent): { isValid: boolean; errors: string[]; }; getFormData(): IFormData; validateForm(): { isValid: boolean; errors: Record<string, string[]>; }; exportForm(): IFormExport; importForm(config: { components: TFormComponent[]; }): void; clearForm(): void; private generateId; private listeners; subscribe(listener: (components: TFormComponent[]) => void): () => void; private notifyListeners; updateComponentWithNotification(id: string, updates: Partial<TFormComponent>): TFormComponent | null; addComponentWithNotification(componentType: TFormComponentName): TFormComponent; removeComponentWithNotification(id: string): boolean; } export declare const formService: FormService; export {}; //# sourceMappingURL=formService.d.ts.map