import { ElementRef, EventEmitter, OnChanges, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { MatMenuTrigger } from '@angular/material/menu'; import { StringLiteral } from '@dasch-swiss/dsp-js'; import { SessionService } from '../../../core/session.service'; export declare class StringLiteralInputComponent implements OnInit, OnChanges { private _fb; private _sessionService; languages: string[]; /** * Optional placeholder for the input field e.g. Label * * @param {string} [placeholder='Label'] */ placeholder: string; /** * Optional predefined (selected) language: en, de, it, fr, etc. * * @param {string} language */ language: string; /** * Optional form field input type: textarea? set to true for textarea * otherwise it's a simple (short) input field * * @param {boolean} [textarea=false] */ textarea: boolean; /** * Optional form field value of type StringLiteral[] * * @param {StringLiteral[]} value */ value: StringLiteral[]; /** * Optional disable the input field in case of no right to edit the field/value * * @param {boolean}: [disabled=false] */ disabled: boolean; /** * The readonly attribute specifies whether the control may be modified by the user. * * @param {boolean}: [readonly=false] */ readonly: boolean; /** * Returns (output) an array of StringLiteral on any change on the input field. * * @emits {StringLiteral[]} dataChanged */ dataChanged: EventEmitter; /** * Returns (output) true when the field was touched. This can be used to validate data, e.g. in case a value is required * * @emits {boolean} touched */ touched: EventEmitter; /** * Returns true when a user press ENTER. This can be used to submit data in the parent component. * * * @emits {boolean} enter */ enter: EventEmitter; textInput: ElementRef; btnToSelectLanguage: MatMenuTrigger; form: FormGroup; constructor(_fb: FormBuilder, _sessionService: SessionService); ngOnInit(): void; ngOnChanges(): void; /** * @ignore * * emit data to parent on any change on the input field */ onValueChanged(): void; toggleAll(): void; /** * @ignore * * Set the language after selecting; * This updates the array of StringLiterals: adds item with the selected language if it doesn't exist */ setLanguage(lang: string): void; /** * @ignore * * Switch focus to input field after selecting a language */ switchFocus(): void; /** * @ignore * * Switch focus to input field after closing the menu by clicking anywhere outside of it */ menuClosed(): void; /** * @ignore * * Set the value in the input field */ updateFormField(value: string): void; /** * @ignore * * Update the array of StringLiterals depending on value / empty value add or remove item from array. */ updateStringLiterals(lang: string, value?: string): void; /** * @ignore * * In case of strange array of StringLiterals, this method will reset to a API-conform array. This means an array without empty values. */ resetValues(): void; /** * @ignore * * Get the value from array of StringLiterals for the selected language */ getValueFromStringLiteral(lang: string): string; }