@funidata/ngx-fudis
Version:
Funidata Design System.
75 lines (74 loc) • 3.56 kB
TypeScript
import { OnChanges, OnInit, AfterViewInit } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { FudisLocalizedTextGroupFormGroup, FudisSelectOption, FudisLocalizedTextGroupFormGroupOptions, FudisInputSize } from '../../../types/forms';
import { FudisIdService } from '../../../services/id/id.service';
import { FudisTranslationService } from '../../../services/translation/translation.service';
import { FudisComponentChanges } from '../../../types/miscellaneous';
import { BehaviorSubject } from 'rxjs';
import { GroupComponentBaseDirective } from '../../../directives/form/group-component-base/group-component-base.directive';
import { FudisFocusService } from '../../../services/focus/focus.service';
import * as i0 from "@angular/core";
export declare class LocalizedTextGroupComponent<T extends FudisLocalizedTextGroupFormGroup<T>> extends GroupComponentBaseDirective implements OnInit, OnChanges, AfterViewInit {
private _translationService;
constructor(_translationService: FudisTranslationService, _idService: FudisIdService, _focusService: FudisFocusService);
/**
* FormGroup including controls.
*/
formGroup: FormGroup<T>;
/**
* Option list for language Selection. To pair controls with corresponding Select option,
* FormControl's name must match with the controlName defined here. E.g. by default "{controlName:
* 'en', label: 'EN'}" pairs with Form Group's "en: new FormControl('')"
*/
options: FudisLocalizedTextGroupFormGroupOptions[];
/**
* Available sizes for the input - defaults to large.
*/
size: FudisInputSize;
/**
* Form element to display. Defaults to text-input
*/
variant: 'text-input' | 'text-area';
/**
* Min length for HTML attribute and for character indicator in guidance
*/
protected _minLength: BehaviorSubject<number | null>;
/**
* Max length for HTML attribute and for character indicator in guidance
*/
protected _maxLength: BehaviorSubject<number | null>;
/**
* Control for language option Select
*/
protected _selectControl: FormControl<FudisSelectOption<object> | null>;
/**
* Updated options list after changes
*/
protected _selectOptions: FudisSelectOption<object>[];
/**
* Fudis translation
*/
protected _missingLanguage: string;
/**
* Subscription for handling the valueChanges observable
*/
private _subscription;
/**
* Fudis translation
*/
protected _languageLabel: BehaviorSubject<string>;
/**
* When Form Control value changes, update Select Options accordingly with or without Missing text
*/
protected _updateSelectOptions(): void;
/**
* On init and when Select option changes, check if now visible input should be marked as
* required.
*/
private _isInputRequired;
protected _checkHtmlAttributes(controlName: string): void;
ngOnInit(): void;
ngOnChanges(changes: FudisComponentChanges<LocalizedTextGroupComponent<T>>): void;
static ɵfac: i0.ɵɵFactoryDeclaration<LocalizedTextGroupComponent<any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LocalizedTextGroupComponent<any>, "fudis-localized-text-group", never, { "formGroup": { "alias": "formGroup"; "required": true; }; "options": { "alias": "options"; "required": false; }; "size": { "alias": "size"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; }, {}, never, ["fudis-error-message"], false, never>;
}