export interface ValidationProperty { name: string; value: any; } export interface TrKey { translationKey?: string; } export interface NumberOptions extends TrKey { min?: number; max?: number; isInteger?: boolean; } export interface StringOptions extends TrKey { minLength?: number; maxLength?: number; } export interface NumberValidator { type: "number"; options?: NumberOptions; } export interface StringValidator { type: "string"; options?: StringOptions; } export interface RequiredValidator { type: "required"; value: boolean; options?: TrKey; } export interface RegexValidator { type: "regex"; value: RegExp; options?: TrKey; } export interface EmailValidator { type: "email"; options?: TrKey; } export interface DateValidator { type: "date"; options?: TrKey; } export interface FunctionValidator { type: "function"; value: (param: any, options?: { isEdit?: boolean; }) => boolean; options?: { isEdit?: boolean; } & TrKey; } export declare type Validator = DateValidator | EmailValidator | FunctionValidator | NumberValidator | RegexValidator | RequiredValidator | StringValidator; /** * Vérifie que le texte est une date. * @param text Le texte. */ export declare function dateValidator(text: string): boolean; /** * Vérifie que le texte est un email. * @param text Le texte. */ export declare function emailValidator(text: string): boolean; /** * Vérifie que le texte est un nombre. * @param text Le texte. * @param options Les options du validateur. */ export declare function numberValidator(text: string, options?: NumberOptions): boolean; /** * Vérifie que le texte est un string valide. * @param text Le texte. * @param options Les options du validateur. */ export declare function stringValidator(text: string, options?: StringOptions): boolean; /** * Valide une propriété avec les validateurs fournis et retourne le status de validation. * @param property La propriété à valider. * @param validators Les validateurs. */ export declare function validate(property: ValidationProperty, validators?: Validator[]): { errors: string[]; isValid: boolean; name: string; value: any; };