import { FocusMonitor } from '@angular/cdk/a11y'; import { ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core'; import { ControlValueAccessor, FormControl, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { ErrorStateMatcher, MatOptionSelectionChange } from '@angular/material/core'; import { MatSelect } from '@angular/material/select'; import { ReplaySubject } from 'rxjs'; import { MtnaPopoverConfig } from '@mtna/lib-ui'; import { Variable, VariableSummary } from '@mtna/pojo-consumer-ui'; import { RdsChip } from '../chips/index'; /** Error when invalid control is dirty, touched, or submitted. */ export declare class RdsVariableSelectErrorStateMatcher implements ErrorStateMatcher { private _control; constructor(_control: NgControl); isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean; } /** * Select control to select variables, uses a virtual scroll, search, and supports reactive forms. * @author Will Davis */ export declare class RdsVariableSelectComponent implements ControlValueAccessor, DoCheck, OnDestroy, OnInit { _control: NgControl; private _changeDetectorRef; private _focusMonitor; /** Popover configuration to describe the control */ config: MtnaPopoverConfig; /** Whether the control is disabled */ get disabled(): any; set disabled(value: any); private _disabled; /** Disabled select options */ set disabledOptions(options: Array); get disabledOptions(): Array; private _disabledOptions; /** Maximum number of selections */ maxSelection: number | null; /** Whether the user can make multiple selections. Default true */ multiSelect: boolean; /** All the variables to choose from in the select */ set options(options: Array); get options(): Array; private _options; /** Whether the variables can be reorderd in the chip list */ orderable: boolean; /** Whether the control is required */ required: boolean; /** Label for mat-select, defaults to "Variable(s)" */ selectLabel: string; /** Placeholder for mat-select, defaults to "Choose variables..." */ selectPlaceholder: string; /** Suffix icon for the select, defaults to null */ suffixIcon: string | null; /** The selected variables and value for this control, if it exists */ set value(value: Array); get value(): Array; private _value; /** Changed value of the form control */ readonly selectionChange: EventEmitter; /** Internal */ matSelect: MatSelect; /** Custom error state matcher */ _matcher: RdsVariableSelectErrorStateMatcher; /** Whether any search results were found */ _noSearchResults: boolean; /** A subset of all the variables, filtered by the search text */ _filteredVariables$: ReplaySubject; private _onDestroy; _onTouched: () => any; private _controlValueAccessorChangeFn; constructor(_control: NgControl, elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _focusMonitor: FocusMonitor); /** * When the mtna-select-search emits search text, filter the visible variables in the select. * * @param text search text to filter the variables */ filterVariables(text: string): void; /** * When the select panel is opened or closed, manipulate the options visible. * When the panel is opened, show the full list of variables. * When the panel is closed, set the selected value on the filtered subject so it will work with the MatSelect's internal selection model. * * @param opened Whether the panel is being opened */ handleOpenedChange(opened: boolean): void; ngDoCheck(): void; ngOnDestroy(): void; ngOnInit(): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; writeValue(obj: any): void; /** * Comparison function for use with `compareWith` */ _compareVariable(v1: T, v2: T): boolean; _emitChangeEvent(newValue: Array): void; /** * Manually handle when options are selected/unselected. * @param event option selection event */ _handleOptionSelectionChange(event: MatOptionSelectionChange): void; /** * Removes a variable from the array of selected variables; * @param id the variable identifier */ _removeVariable(id: string): void; _reorderVariables(event: Array): void; _trackByVariable(_: number, variable: Variable): string; /** * Manually handle when options are selected/unselected in a multi select * @param event option selection event */ private _handleMultiOptionSelectionChange; /** * Manually handle when options are selected/unselected in a single select * @param event option selection event */ private _handleSingleOptionSelectionChange; }