UNPKG

codetrix

Version:

A lightweight lodash-style utility library

44 lines (43 loc) 1.36 kB
/** * Checks if any field in the form has been modified (dirty). * * @param form - The form object with fields containing `dirty` property. * @returns `true` if at least one field is dirty; otherwise, `false`. */ export declare function isFormDirty(form: { [key: string]: any; }): boolean; /** * Checks if all fields in the form are valid. * * @param form - The form object with fields containing `valid` property. * @returns `true` if all fields are valid; otherwise, `false`. */ export declare function isFormValid(form: { [key: string]: any; }): boolean; /** * Resets all fields in the form by clearing the value * and marking them as untouched and not dirty. * * @param form - The form object where each field has `value`, `touched`, and `dirty` properties. */ export declare function resetFormFields(form: { [key: string]: any; }): void; /** * Marks all fields in the form as touched (used for triggering validation). * * @param form - The form object where each field has a `touched` property. */ export declare function touchAllFields(form: { [key: string]: any; }): void; /** * Marks all fields in the form as untouched (used to reset validation state). * * @param form - The form object where each field has a `touched` property. */ export declare function untouchAllFields(form: { [key: string]: any; }): void;