import { InjectionToken } from '@angular/core'; import { Schema, Storage, ValidationIssues, ValidationIssuesMap, ValidationMode } from '@lightweightform/storage'; import * as i0 from "@angular/core"; /** * Injection token used to specify the schema of an LF application. */ export declare const LF_APP_SCHEMA: InjectionToken>; /** * Injection token used to specify the initial validation mode of the * `LfStorage`. */ export declare const LF_APP_INITIAL_VALIDATION_MODE: InjectionToken; /** * Injectable storage to be used as the LF application's storage. It extends the * base storage class by providing utility methods to manage the "touched", * "untouched", "dirty", and "pristine" state properties of values as well as * knowing when to show values as [valid|invalid|with warnings|pending|needing * recomputation of their validations] based on such state properties. */ export declare class LfStorage extends Storage { constructor(schema: Schema, validationMode: ValidationMode | null); relativeStorage(relativePath: string, readOnly?: boolean): LfStorage; /** * Returns validation errors for the value at the given path (validation * issues without `isWarning` set). If the validation is asynchronous and * still pending, `undefined` is returned. * @param relativePath Path of the value from which to fetch the validation * errors (relative to the current working path). Defaults to `'.'`. * @returns Validation errors associated with the given path or `undefined` * when the validation is in pending state. */ validationErrors(relativePath?: string): ValidationIssuesMap | undefined; /** * Returns local validation errors for the value at the given path (validation * issues without `isWarning` set that belong to the value at the given path * and not to one of its children). If the validation is asynchronous and * still pending, `undefined` is returned. * @param relativePath Path of the value from which to fetch the local * validation errors (relative to the current working path). Defaults to * `'.'`. * @returns Validation errors local to the given path (ignoring children * errors) or `undefined` when the validation is in pending state. */ localValidationErrors(relativePath?: string): ValidationIssues | undefined; /** * Whether the value at the given path has at least one validation error (a * validation issue without `isWarning` set). * @param relativePath Path on which to check if the value contains a * validation error (relative to the current working path). Defaults to `'.'`. * @returns Whether the value at the given path contains at least one * validation error. */ hasErrors(relativePath?: string): boolean | undefined; /** * Returns validation warnings for the value at the given path (validation * issues with `isWarning` set). If the validation is asynchronous and still * pending, `undefined` is returned. * @param relativePath Path of the value from which to fetch the validation * warnings (relative to the current working path). Defaults to `'.'`. * @returns Validation warnings associated with the given path or `undefined` * when the validation is in pending state. */ validationWarnings(relativePath?: string): ValidationIssuesMap | undefined; /** * Returns local validation warnings for the value at the given path * (validation issues with `isWarning` set that belong to the value at the * given path and not to one of its children). If the validation is * asynchronous and still pending, `undefined` is returned. * @param relativePath Path of the value from which to fetch the local * validation warnings (relative to the current working path). Defaults to * `'.'`. * @returns Validation warnings local to the given path (ignoring children * warnings) or `undefined` when the validation is in pending state. */ localValidationWarnings(relativePath?: string): ValidationIssues | undefined; /** * Whether the value at the given path has at least one validation warning (a * validation issue with `isWarning` set). * @param relativePath Path on which to check if the value contains a * validation warning (relative to the current working path). Defaults to * `'.'`. * @returns Whether the value at the given path contains at least one * validation warning. */ hasWarnings(relativePath?: string): boolean | undefined; /** * Whether a given value has been "touched" (somehow unfocused by the user). * @param relativePath Path on which to check if the value has been touched * (relative to the current working path). Defaults to `'.'`. * @returns Whether the value at the given path has been touched. */ isTouched(relativePath?: string): boolean; /** * Whether a given value is "untouched" (hasn't been unfocused by the user). * @param relativePath Path on which to check if the value is untouched * (relative to the current working path). Defaults to `'.'`. * @returns Whether the value at the given path is untouched. */ isUntouched(relativePath?: string): boolean; /** * Whether a given value is "dirty" (if it has somehow been changed by user * interaction). * @param relativePath Path on which to check if the value is dirty (relative * to the current working path). Defaults to `'.'`. * @returns Whether the value at the given path is dirty. */ isDirty(relativePath?: string): boolean; /** * Whether a given value is "pristine" (if it hasn't been changed by user * interaction). * @param relativePath Path on which to check if the value is pristine * (relative to the current working path). Defaults to `'.'`. * @returns Whether the value at the given path is pristine. */ isPristine(relativePath?: string): boolean; /** * Set the value at the given path and all of its ancestors as "touched". * Possibly cascades the "touched" state to all descendants. * @param relativePath Path on which to set the value as touched (relative to * the current working path). Defaults to `'.'`. * @param cascade Whether to cascade the touched state to all descendants of * the value. */ setTouched(relativePath?: string, cascade?: boolean): void; /** * Set the value at the given path and all of its descendants as "untouched". * @param relativePath Path on which to set the value as untouched (relative * to the current working path). Defaults to `'.'`. */ setUntouched(relativePath?: string): void; /** * Set the value at the given path and all of its ancestors as "dirty". * Possibly cascades the "dirty" state to all descendants. * @param relativePath Path on which to set the value as dirty (relative to * the current working path). Defaults to `'.'`. * @param cascade Whether to cascade the dirty state to all descendants of the * value. */ setDirty(relativePath?: string, cascade?: boolean): void; /** * Set the value at the given path and all of its descendants as "pristine". * @param relativePath Path on which to set the value as pristine (relative to * the current working path). Defaults to `'.'`. */ setPristine(relativePath?: string): void; /** * Whether a given value should show as valid: that is, if its validation * issues are still being computed or if all of its issues come from * non-computed "untouched" values. * @param relativePath Path on which to check if the value should show as * valid (relative to the current working path). Defaults to `'.'`. * @returns Whether the value should show as valid. */ shouldShowValid(relativePath?: string): boolean; /** * Whether a given value should show as having an error: that is, if its * validations issues have been computed and it has at least one issue that * isn't a warning and comes from a computed or "touched" value. * @param relativePath Path on which to check if the value should show as * having an error (relative to the current working path). Defaults to `'.'`. * @returns Whether the value should show as having an error. */ shouldShowError(relativePath?: string): boolean; /** * Whether a given value should show as having a warning: that is, if its * validations issues have been computed and it has issues coming from * computed or "touched" values, all of them being warnings. * @param relativePath Path on which to check if the value should show as * having a warning (relative to the current working path). Defaults to `'.'`. * @returns Whether the value should show as having a warning. */ shouldShowWarning(relativePath?: string): boolean; /** * Whether a given value should show indication that its validations are being * computed: that is, if its validation issues are still being computed and * the value is computed or has been "touched". * @param relativePath Path on which to check if the value should show * indication that its validations are being computed. Defaults to `'.'`. * @returns Whether the value should show indication that its validations are * being computed. */ shouldShowPending(relativePath?: string): boolean; /** * Whether a given value should show indication that its validation has been * rejected: that is, if its validations issues have been computed and it has * issues caused by rejected promises coming from computed or "touched" * values. * @param relativePath Path on which to check if the value should show * indication that its validation needs to be recomputed (relative to the * current working path). Defaults to `'.'`. * @returns Whether the value should show indication that its validation needs * to be recomputed. */ shouldShowRejected(relativePath?: string): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }