@ngspot/ngx-errors
Version:
<p align="center"> <img width="20%" height="20%" src="https://github.com/DmitryEfimenko/ngspot/blob/main/packages/ngx-errors/package/assets/logo.png?raw=true"> </p>
58 lines (57 loc) • 2.27 kB
TypeScript
import { AfterViewInit, OnDestroy } from '@angular/core';
import { ShowErrorWhen } from './errors-configuration';
import * as i0 from "@angular/core";
/**
* Directive to provide a validation error for a specific error name.
* Used as a child of ngxErrors directive.
*
* Example:
* ```html
* <div [ngxErrors]="control">
* <div ngxError="required">This input is required</div>
* </div>
* ```
*/
export declare class ErrorDirective implements AfterViewInit, OnDestroy {
private subs;
private config;
private errorStateMatchers;
private errorsDirective;
private templateRef;
private viewContainerRef;
private cdr;
private view;
private errorDirectiveId;
errorName: import("@angular/core").InputSignal<string>;
showWhen: import("@angular/core").InputSignal<ShowErrorWhen>;
private computedShowWhen;
private errorStateMatcher;
private controlState$;
/**
* Calculates whether the error could be shown based on the result of
* ErrorStateMatcher and whether there is an error for this particular errorName
* The calculation does not take into account config.showMaxErrors
*
* In addition, it observable produces a side-effect of updating NgxErrorsStateService
* with the information of whether this directive could be shown and a side-effect
* of updating err object in case it was mutated
*/
private couldBeShown$;
private subscribeToCouldBeShown;
/**
* Determines whether the error is shown to the user based on
* the value of couldBeShown and the config.showMaxErrors.
* In addition, this reacts to the changes in visibility for all
* errors associated with the control
*/
private isShown;
private isShownEffect;
hidden: boolean;
err: any;
ngAfterViewInit(): void;
ngOnDestroy(): void;
private toggleVisibility;
private validateDirective;
static ɵfac: i0.ɵɵFactoryDeclaration<ErrorDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<ErrorDirective, "[ngxError]", ["ngxError"], { "errorName": { "alias": "ngxError"; "required": true; "isSignal": true; }; "showWhen": { "alias": "ngxErrorShowWhen"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}