UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

52 lines 1.66 kB
import { PipeTransform } from '@angular/core'; import { ValidationErrors } from '@angular/forms'; import { ArrayValidationErrors } from './validate-array-elements'; import * as i0 from "@angular/core"; /** * This pipe should be used in pair with validateArrayElements function - it allows to distribute * errors for each position in array, from the object prepared by validateArrayElements. * * ```ts * errors = { * "INNER_ARRAY_ERROR_minlength": { * isArrayError: true, * originalKey: "minlength", * entries: [ * { * index: 0, * errorData: { * requiredLength: 5, * actualLength: 4 * } * }, * { * index: 2, * errorData: { * requiredLength: 5, * actualLength: 3 * } * }, * ] * }, * "minlength": { * requiredLength: 5, * actualLength: 3 * } * } * ``` * * ```html * <small *ngFor="let error of errors | extractArrayValidationErrors:index | keyvalue"> * {{ error.key | humanizeValidationMessage | translate: error.value }} * </small> * ``` * * Above code renders only these error messages that are generated by Array entries. * */ export declare class ExtractArrayValidationErrorsPipe implements PipeTransform { transform(validationErrors: ArrayValidationErrors | ValidationErrors | null, index: number): ValidationErrors | null; static ɵfac: i0.ɵɵFactoryDeclaration<ExtractArrayValidationErrorsPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<ExtractArrayValidationErrorsPipe, "extractArrayValidationErrors", true>; } //# sourceMappingURL=extract-array-validation-errors.pipe.d.ts.map