@uplink-protocol/form-controller
Version:
Reactive multi-step form controller with dynamic validation and state management
63 lines (62 loc) • 2.92 kB
TypeScript
import { FormConfig } from "./interfaces/form-config.interface";
import { BaseService, ConfigService, FieldService, FormService, InteractionService, StepperService, ValidatorService, FormManagerService, ConfigManagerService, NavigationManager, BindingManager } from "./services";
import { TypedController } from "@uplink-protocol/core";
/**
* FormControllerClass - A class for multi-step forms with dynamic configuration
*/
export declare class FormControllerClass implements TypedController {
protected configService: ConfigService;
protected stepperService: StepperService;
protected formService: FormService;
protected fieldService: FieldService;
protected interactionService: InteractionService;
protected validatorService: ValidatorService;
protected fieldErrorsService: BaseService<Record<string, Record<string, string>>>;
protected stepsValidityService: BaseService<Record<string, boolean>>;
protected formManagerService: FormManagerService;
protected configManagerService: ConfigManagerService;
protected navigationManager: NavigationManager;
protected bindingManager: BindingManager;
protected initialFormData: Record<string, Record<string, any>>;
protected stepValidationState: Record<string, boolean>;
bindings: any;
methods: any; /**
* Constructor for the FormControllerClass
* @param config - The form configuration with steps and field definitions
*/
constructor(config: FormConfig);
/**
* Set up initial form data and validation state
* This method can be overridden by subclasses to customize initial data setup
* @param config - The form configuration
*/
protected setupInitialFormData(config: FormConfig): void;
/**
* Initialize base services
* This method can be overridden by subclasses to customize service initialization
* @param config - The form configuration
*/
protected initializeServices(config: FormConfig): void;
/**
* Initialize manager services
* This method can be overridden by subclasses to customize manager service initialization
*/
protected initializeManagerServices(): void;
/**
* Initialize the methods object with all controller functions
* This method can be overridden by subclasses to customize controller functionality
*/
protected initializeMethods(): void;
/**
* Initialize step validation without showing error messages
* This method can be overridden by subclasses to customize validation behavior
*/
protected initializeStepValidation(): void;
}
/**
* FormController - Factory function that creates and returns a new FormControllerClass instance.
*
* @param config - The form configuration with steps and field definitions
* @returns A FormControllerClass instance
*/
export declare const FormController: (config: FormConfig) => FormControllerClass;