UNPKG

@funidata/ngx-fudis

Version:

Funidata Design System.

111 lines (110 loc) 5.27 kB
import { ElementRef, OnChanges, OnInit, AfterContentInit, AfterViewInit } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; import { FudisTranslationService } from '../../../services/translation/translation.service'; import { FudisIdService } from '../../../services/id/id.service'; import { FudisInternalErrorSummaryService } from '../../../services/form/error-summary/internal-error-summary.service'; import { BehaviorSubject } from 'rxjs'; import { FudisComponentChanges } from '../../../types/miscellaneous'; import { FudisErrorSummaryNewError } from '../../../types/errorSummary'; import * as i0 from "@angular/core"; export declare class GuidanceComponent implements OnChanges, OnInit, AfterContentInit, AfterViewInit { private _translationService; private _idService; private _errorSummaryService; private _elementRef; constructor(_translationService: FudisTranslationService, _idService: FudisIdService, _errorSummaryService: FudisInternalErrorSummaryService, _elementRef: ElementRef); /** * Id of input, fieldset or similar which Guidance is related to. Used in aria attributes and in * emit information for Error Summary Service. */ for: string; /** * Label text of input, fieldset or similar Guidance is related to. Used in emit information for * Error Summary service. */ inputLabel: string; /** * FormControl of related input. */ control: FormControl; /** * FormGroup of related FormGroup. E.g. LocalizedTextGroup with FormGroup */ formGroup: FormGroup; /** * Text displayed as guidance help text. */ helpText: string | undefined; /** * If there is no Fudis FieldSet and Error Summary associated with this input and its Guidance, * 'polite' can be considered so that screen reader will get notified if there are new errors * related to the input. */ ariaLive: 'off' | 'polite' | 'assertive'; /** * When set displays also a character count indicator. */ maxLength: number | null; /** * Used to match FormControl value for the Localized Text Group component so that the component * can display the length of the entered input for the connected language option. */ selectedOption: string; /** * Used with together with Checkbox Group component, to display errors only when focus has moved * outside of whole Checkbox Group. */ groupBlurredOut: boolean; /** * Hide visible helptext from screen readers when group components E.g. Radio Button Group and * Checkbox Group components are used. */ groupHelpTextHidden: boolean; /** * Assistive text of max character count for screen readers. E. g. "5/20 characters used" where * "characters used" is "maxLengthText". */ protected _maxLengthText: BehaviorSubject<string>; /** * Number of characters left when screen reader is alerted about input max length */ protected _maxLengthAlertThreshold: number; /** * The width of the character-limit-indicator, determined by how many digits are in the maxLength * input value */ protected _maxLengthWidth: 'sm' | 'md' | 'lg'; /** * Id from IdService */ protected _id: string; /** * Collection of validation errors */ protected _lazyLoadedErrors: string[]; protected _parentFormId: import("@angular/core").WritableSignal<string | null>; /** * Used prevent checks in HTML DOM before content has been loaded */ protected _afterViewInitDone: import("@angular/core").WritableSignal<boolean>; /** * To prevent Error Summary reloading after lazy load check */ private _reloadGuard; private _injector; ngOnInit(): void; ngOnChanges(changes: FudisComponentChanges<GuidanceComponent>): void; ngAfterContentInit(): void; ngAfterViewInit(): void; private _subscribeToErrors; private _setCharacterLimitIndicatorValues; /** * This function is triggered, if this component is loaded to the DOM after Error Summary has been * loaded and there are new validation errors which didn't exist at the time original reload * errors call was made. It should only trigger reload one time, when all errors of this Guidance * are registered. */ protected _reloadErrorSummaryOnLazyLoad(error: FudisErrorSummaryNewError): void; static ɵfac: i0.ɵɵFactoryDeclaration<GuidanceComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<GuidanceComponent, "fudis-guidance", never, { "for": { "alias": "for"; "required": true; }; "inputLabel": { "alias": "inputLabel"; "required": true; }; "control": { "alias": "control"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "helpText": { "alias": "helpText"; "required": false; }; "ariaLive": { "alias": "ariaLive"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "selectedOption": { "alias": "selectedOption"; "required": false; }; "groupBlurredOut": { "alias": "groupBlurredOut"; "required": false; }; "groupHelpTextHidden": { "alias": "groupHelpTextHidden"; "required": false; }; }, {}, never, ["*"], false, never>; }