import { OnInit, OnDestroy } from '@angular/core'; import { Observable } from 'rxjs'; import { TooltipPosition } from '@angular/material/tooltip'; import { TranslateService } from '@ngx-translate/core'; import { InputControl, InputContent } from '../input.control'; /** * An interface that represents a selectable option. */ export interface SelectOption { /** * Returns the label that is showed. */ label: string; /** * Returns the value that is stored internally. */ value: any; } /** * An interface that represents the content of a select control. */ export interface SelectContent extends InputContent { /** * Returns the options list that can be selected. * This field can be set using three ways: * - Its value is `undefined`, then it takes the options from the `content.value` field. * - Its value is a `SelectOption[]`, then it already contains the options. * - Its value is an `Observable`, then it takes the options when the observable emits values. * By default, its value is `[]`. */ selectOptions?: SelectOption[] | Observable; /** * Returns true if the selection can be multiple; otherwise, false. * By default, its value is `false`. */ multiple?: boolean; /** * Returns true if the tooltip is showed; otherwise, false. * By default, its value is `false`. */ showTooltip?: boolean; /** * Returns a value that allows the user to define the position of the tooltip for the select control. * It is used if the `showTooltip` field value is `true`. * By default, its value is `'below'`. * Its value can be one of these values: 'left', 'right', 'above', 'below', 'after', 'before' */ selectTooltipPosition?: TooltipPosition; /** * Returns a value that allows the user to define the position of the tooltip for the select control's options. * It is used if the `showTooltip` field value is `true`. * By default, its value is `'right'`. * Its value can be one of these values: 'left', 'right', 'above', 'below', 'after', 'before' */ optionsTooltipPosition?: TooltipPosition; } /** * Represents a control that allows to select one value or multiple values. * Implementation notes: * The `extraContent` recibe una funcion llamada getOptions() que se encarga de contruir un SelectOption[]. * Si es multiple, entonces el `value` es un array de valores. */ export declare class InputSelectComponent extends InputControl implements OnInit, OnDestroy { private _transServ; /** * Input field that contains the content of this class. */ content: SelectContent; /** * Returns the current selected option tooltip. * If nothing is selected, then its value is `''`. */ selectTooltip: string; private _selectOptionsSubscription; constructor(_transServ: TranslateService); ngOnInit(): void; ngOnDestroy(): void; /** * Initializes the `content` input property. * @param label The default label to use. It is used if the `content.label` is not specified. * @param placeholder The default placeholder to use. It is used if the `content.placeholder` is not specified. * @param isAbbreviation If it is true then the `label` argument represents an abbreviation; otherwise, false. * @param alwaysHint If it is true then there is always at leat one hint start-aligned. */ protected init(label: string, placeholder: string, isAbbreviation: boolean, alwaysHint: boolean): void; private _selectOptions_Unsubscription; onSelectionChange(): void; /** * Does the translation for a key (or an array of keys). * @param key The key (or an array of keys) to translate. */ private _doTranslation; /** * Finds the label for a value (or an array of values). * @param value The value (or an array of values) to find the label. * @returns Returns a label (or an array of labels). */ private _findLabel; /** * Sets the `selectTooltip` field value. */ private _setSelectTooltip; }