@funidata/ngx-fudis
Version:
Funidata Design System.
69 lines (68 loc) • 2.6 kB
TypeScript
import { FudisInternalErrorSummaryService } from './internal-error-summary.service';
import { FudisErrorSummaryAllErrors, FudisFormErrorSummaryUpdateStrategy } from '../../../types/errorSummary';
import { BehaviorSubject, Observable } from 'rxjs';
import * as i0 from "@angular/core";
/**
* Error Summary Service public methods and tools
*/
export declare class FudisErrorSummaryService {
private _errorSummaryService;
constructor(_errorSummaryService: FudisInternalErrorSummaryService);
private _destroyRef;
/**
* To store Subscriptions for each sent Observable, so it can be unsubscribed on removeError()
*/
private _subscriptions;
/**
* To define ID for each subscription
*
* @param error With required properties
* @returns Generated id
*/
private _getSubscriptionId;
/**
* Get current updateStrategy of Error Summary. By default 'reloadOnly'.
*/
get updateStrategy(): FudisFormErrorSummaryUpdateStrategy;
/**
* Set updateStrategy of Error Summary
*/
setUpdateStrategy(value: FudisFormErrorSummaryUpdateStrategy): void;
/**
* Reloads all Forms with Error Summary
*/
reloadAllErrors(): void;
/**
* Reload a spesific Form Id
*
* @param id Form Id
* @param focus Focus to Error Summary
*/
reloadFormErrors(id: string, focus?: boolean): void;
/**
* Returns an observable of all errors sent to Error Summary. Note, that Observable is updated
* only when ReloadErrors is called.
*/
getErrorsObservable(): BehaviorSubject<FudisErrorSummaryAllErrors>;
/**
* To add message to spesific Form's Error Summary.
*
* @param id Identifier of the message, eg. 'app-custom-error-abc123'
* @param formId Id of Form component
* @param focusId HTML element's id, where user focus should be moved when user clicks the
* message.
* @param message Visible message to the user
*/
addError(id: string, formId: string, focusId: string, message: string | Observable<string>): void;
/**
* To remove messages from Form's Error Summary
*
* @param id Identifier of provided message in 'addError()'
* @param formId Id of Form component
* @param focusId HTML element's id, where user focus should be moved when user clicks the
* message.
*/
removeError(id: string, formId: string, focusId: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<FudisErrorSummaryService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<FudisErrorSummaryService>;
}