UNPKG

@funidata/ngx-fudis

Version:

Funidata Design System.

104 lines (103 loc) 4.66 kB
import { AfterViewInit, DestroyRef, ElementRef, EventEmitter } from '@angular/core'; import { BehaviorSubject, Subject } from 'rxjs'; import { PopoverApiDirective } from '../../popover/popover-api.directive'; import { FudisIdComponent, FudisIdParent } from '../../../types/id'; import { FudisIdService } from '../../../services/id/id.service'; import { FudisFocusService } from '../../../services/focus/focus.service'; import * as i0 from "@angular/core"; export declare class FormCommonApiDirective extends PopoverApiDirective implements AfterViewInit { protected _idService: FudisIdService; protected _focusService: FudisFocusService; constructor(_idService: FudisIdService, _focusService: FudisFocusService); /** * Template reference for input. Used in e. g. initialFocus */ protected _inputRef: ElementRef<HTMLInputElement>; /** * Label for the form component. */ label: string; /** * Provide additional information for screen reader users by extending text content of the label. * Used in e. g. Localized Text Group for providing info about currently selected language. */ ariaLabel: string; /** * Input id. If not provided when component is initialized, generated by Id Service */ id: string; /** * If component is a child of Form component, Form's Error Summary is visible, this component's * control has errors and when this component is loaded for the first time, it will by default * call Error Summary to reload itself again and mark control as touched. This is because if * component is lazy loaded to the DOM after the initial reload errors call was made, errors of * this component might not appear on the list. To disable this feature, set this to false. */ errorSummaryReloadOnInit: boolean; /** * Help text, aligned underneath the input. */ helpText: string | undefined; /** * Set browser focus to the input on the first load. */ initialFocus: boolean; /** * Preferred way to disable input is to set formControl as disabled. This Input property should be * used in edge cases only. */ disabled: boolean; /** * Disable guidance for this component instance. No help text or errors will be visible. */ disableGuidance: boolean; /** * To listen for component's blur event. */ handleBlur: EventEmitter<FocusEvent>; /** * To listen for component's focus event. */ handleFocus: EventEmitter<FocusEvent>; /** * To listen for input's key up event. */ handleKeyUp: EventEmitter<KeyboardEvent>; /** * Output emitted when component has finished AfterViewInit lifecycle hook */ handleViewInit: EventEmitter<void>; /** * Set requiredText based on this boolean value */ protected _required: BehaviorSubject<boolean>; protected _destroyRef: DestroyRef; /** * Trigger update when control validator is changed */ protected _updateValueAndValidityTrigger: Subject<void>; /** * Used prevent checks in HTML DOM before content has been loaded */ protected _afterViewInitDone: import("@angular/core").WritableSignal<boolean>; /** * Generate id for parent component */ protected _setParentComponentId(parentType: FudisIdParent): void; /** * Add given id to Id Service or generate unique id */ protected _setComponentId(componentType: FudisIdComponent): void; protected _afterViewInitCommon(): void; ngAfterViewInit(): void; /** * Set focus to the input element */ focusToInput(): void; /** * Executed when component's input is focused or when child input, e.g. Checkbox is focused */ onFocus(event: FocusEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration<FormCommonApiDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<FormCommonApiDirective, "[fudisFormCommonApi]", never, { "label": { "alias": "label"; "required": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "id": { "alias": "id"; "required": false; }; "errorSummaryReloadOnInit": { "alias": "errorSummaryReloadOnInit"; "required": false; }; "helpText": { "alias": "helpText"; "required": false; }; "initialFocus": { "alias": "initialFocus"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "disableGuidance": { "alias": "disableGuidance"; "required": false; }; }, { "handleBlur": "handleBlur"; "handleFocus": "handleFocus"; "handleKeyUp": "handleKeyUp"; "handleViewInit": "handleViewInit"; }, never, never, false, never>; }