@uplink-protocol/form-controller
Version:
Reactive multi-step form controller with dynamic validation and state management
56 lines (55 loc) • 1.75 kB
TypeScript
import { ConfigService } from './config.service';
import { FieldService } from './field.service';
/**
* Service for tracking user interactions with form fields
*/
export declare class InteractionService {
private touchedFields;
private configService;
private fieldService;
constructor(configService: ConfigService, fieldService: FieldService);
/**
* Initialize touch tracking for all steps and fields
*/
private initTouchTracking;
/**
* Mark a field as touched
* @param stepId Step ID
* @param fieldId Field ID
* @param touched Touch state (defaults to true)
*/
markFieldTouched(stepId: string, fieldId: string, touched?: boolean): void;
/**
* Mark all fields in a step as touched
* @param stepId Step ID
* @param touched Touch state (defaults to true)
*/
markAllFieldsInStepTouched(stepId: string, touched?: boolean): void;
/**
* Mark all fields in all steps as touched
* @param touched Touch state (defaults to true)
*/
markAllFieldsTouched(touched?: boolean): void;
/**
* Check if a field has been touched
* @param stepId Step ID
* @param fieldId Field ID
* @returns Whether the field has been touched
*/
isFieldTouched(stepId: string, fieldId: string): boolean;
/**
* Validate a step showing errors only for touched fields
* @param stepId Step ID
* @returns Validation result
*/
validateStepWithTouchedErrors(stepId: string): boolean;
/**
* Reset touch tracking state
*/
resetTouchTracking(): void;
/**
* Get touch state for all fields
* @returns Touch state
*/
getTouchState(): Record<string, Record<string, boolean>>;
}