import { ElementRef, EventEmitter, Injector, OnChanges, OnDestroy, OnInit, Renderer2, SimpleChanges } from "@angular/core"; import { StarkLoggingService } from "@nationalbankbelgium/stark-core"; import { AbstractStarkUiComponent } from "@nationalbankbelgium/stark-ui/src/internal-common"; import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator } from "@angular/forms"; import { Subject } from "rxjs"; import { MatLegacyFormField as MatFormField, MatLegacyFormFieldControl as MatFormFieldControl } from "@angular/material/legacy-form-field"; import { FocusMonitor } from "@angular/cdk/a11y"; import { MatLegacySelectChange as MatSelectChange } from "@angular/material/legacy-select"; import { BooleanInput } from "@angular/cdk/coercion"; import { TranslateService } from "@ngx-translate/core"; import * as i0 from "@angular/core"; /** * Component to display dropdown list based on the options passed as parameters. The dropdown component is based * on the Angular Material MatSelect. */ export declare class StarkDropdownComponent extends AbstractStarkUiComponent implements OnInit, OnChanges, OnInit, OnDestroy, ControlValueAccessor, MatFormFieldControl, Validator { logger: StarkLoggingService; private fm; private injector; private translateService; private formField?; /** * Variable that will be incremented automatically to serve as unique id for every new instance of this component */ static nextId: number; /** * HTML id of this component */ id: string; /** * ARIA `describedBy` attribute to be set to the DOM element where this component is attached to */ describedBy: string; /** * Whether the label should float above the field to let the user type a value */ get shouldLabelFloat(): boolean; /** * If the dropdown will contain a default blank (optional) */ defaultBlank?: boolean; /** * HTML "id" attribute of the element. */ dropdownId: string; /** * HTML "name" attribute of the element. */ dropdownName: string; /** * header Text to be displayed as the dropdown's header. Such header will be shown at the top of the * dropdown options list(dynamically translated via the $translate service if the provided text is defined in the translation keys). */ /** * Whether the dropdown is disabled */ disabled: boolean; /** * Allows multiple option selection. Setting the attribute to "true" or empty * will enable this feature. (optional) */ get multiSelect(): boolean; set multiSelect(value: boolean); static ngAcceptInputType_multiSelect: BooleanInput; /** * Array of options to be included in the dropdown list. This parameter is a one-way * binding (one-directional). */ options: any[]; /** * Property name to be used as id of the options defined. If this parameter as * well as the optionLabelProperty are omitted, then the options parameter is considered to be an array of simple types. (optional) */ optionIdProperty?: string; /** * Property name to be used as label of the options defined (dynamically translated via * the @ngx-translate service if the provided text is defined in the translation keys). If this parameter as well as the * optionIdProperty are omitted, then the options parameter is considered to be an array of simple types. (optional) */ optionLabelProperty?: string; /** * Text to be displayed as the dropdown's placeholder. * Dynamically translated via the @ngx-translate service if the provided text is defined in the translation keys. */ placeholder: string; /** * If the dropdown is required or not. by default, the dropdown is not required */ get required(): boolean; set required(value: boolean); static ngAcceptInputType_required: BooleanInput; /** * Source object to be bound to the dropdown ngModel. */ get value(): any | any[]; set value(value: any | any[]); /** * This will emit the newly selected value. */ readonly selectionChanged: EventEmitter; /** * Reference to the single MatSelect element embedded in this component */ private singleSelectElement?; /** * Reference to the multi MatSelect element embedded in this component */ private multiSelectElement?; /** * Variable to define to use MatFormFieldControl. * Stream that emits whenever the state of the control changes such that the parent `MatFormField` * needs to run change detection. */ stateChanges: Subject; /** * Variable to define to use MatFormFieldControl * Whether the control is in an error state. */ get errorState(): boolean; /** * Variable to define to use MatFormFieldControl * Whether the control is empty. */ get empty(): boolean; /** * Class constructor * @param logger - The `StarkLoggingService` instance of the application. * @param renderer - Angular `Renderer2` wrapper for DOM manipulations. * @param elementRef - Reference to the DOM element where this component is attached to. * @param fm - The Focus Monitor Service. * @param injector - The Injector of the application. * @param translateService - The `TranslateService` instance of the application. * @param formField - The MatFormField of this component (in case the component is used inside a `mat-form-field`). */ constructor(logger: StarkLoggingService, renderer: Renderer2, elementRef: ElementRef, fm: FocusMonitor, injector: Injector, translateService: TranslateService, formField?: MatFormField | undefined); /** * Component lifecycle hook */ ngOnInit(): void; /** * Component lifecycle hook * @param changes - Contains the changed properties */ ngOnChanges(changes: SimpleChanges): void; /** * Component lifecycle hook */ ngOnDestroy(): void; /** * Handled when a `change` event is fired on the `` element, then emits the value on `selectionChanged`. * @param change - The MatSelectChange to to handle */ onSelectionChange(change: MatSelectChange): void; /** * Trigger required methods `selectionChanged.emit`, `_onChange`, `_onValidatorChange` when `value´ is changed internally. * @param value - New value to assign */ onInternalValueChange(value: any | any[]): void; /** * Whether the type of the option elements is a primitive type (string, number, boolean...) * In case none of the optionId and optionLabel parameters are provided, then a simple data types array is assumed */ areSimpleTypes(): boolean; /** * set blank by default in the dropdown component */ setDefaultBlank(): void; /** * Return the id of the option or the option itself if it is a simple type. * @param option - The option which id we want to retrieve * @returns The value to return */ getOptionValue(option: any): any; /** * Return the label of the option or the option itself if it is a simple type. * @param option - The option which value we want to retrieve * @returns The value to return */ getOptionLabel(option: any): any; /** * @ignore */ trackItemFn(_index: number, item: any): string; /** * @ignore * The registered callback function called when an input event occurs on the input element. */ private _onChange; /** * @ignore * The registered callback function called when a blur event occurs on the input element. */ private _onTouched; /** * The registered callback function called when the validator inputs change. */ private _onValidatorChange; /** * Registers a function called when the control value changes. * * @param fn - The callback function */ registerOnChange(fn: (_: any) => void): void; /** * Registers a function called when the control is touched. * * @param fn - The callback function */ registerOnTouched(fn: () => void): void; /** * Sets the "disabled" property on the input element. * * @param isDisabled - The disabled value */ setDisabledState(isDisabled: boolean): void; /** * Sets the "value" property on the input element. * * @param obj - The checked value */ writeValue(obj: any): void; /** * Method implemented to use MatFormFieldControl * Sets the list of element IDs that currently describe this control. * @param ids - Ids describing the MatFormFieldControl */ setDescribedByIds(ids: string[]): void; /** * Method implemented to use MatFormFieldControl * It handles a click on the control's container. */ onContainerClick(): void; /** * Registers a callback function to call when the validator inputs change. * * @param fn - The callback function */ registerOnValidatorChange(fn: () => void): void; /** * Method that performs synchronous validation against the provided control. * * @param control - The control to validate against. * * @returns A map of validation errors if validation fails, otherwise null. */ validate(control: AbstractControl): ValidationErrors | null; /** * Method which set the MatFormField as touched once the mat-select has been clicked. */ onOpenedChange(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }