import { FocusMonitor } from '@angular/cdk/a11y'; import { BooleanInput } from '@angular/cdk/coercion'; 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 { MtnaPopoverConfig } from '@mtna/core-angular'; import { Variable } from '@mtna/pojo-consumer-ts'; import { VariableSummary } from '@mtna/variable-service-core-ts'; import { ReplaySubject } from 'rxjs'; import { RdsChip } from '../chips/index'; import * as i0 from "@angular/core"; /** 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; static ngAcceptInputType_disabled: BooleanInput; static ngAcceptInputType_multiSelect: BooleanInput; static ngAcceptInputType_options: Array | null | undefined; static ngAcceptInputType_disabledOptions: Array | null | undefined; /** Aria label for mat-chip-list, defaults to "Selected Variable" */ chipsAriaLabel: string | null | undefined; /** Popover configuration to describe the control */ config: MtnaPopoverConfig; /** Whether the control is disabled */ get disabled(): boolean; set disabled(value: boolean); private _disabled; /** Disabled select options */ set disabledOptions(options: Array); get disabledOptions(): Array; private _disabledOptions; /** Maximum number of selections */ maxSelection: number | null | undefined; /** Whether the user can make multiple selections. Default true */ get multiSelect(): boolean; set multiSelect(value: boolean); private _multiSelect; /** 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 "Variables" */ 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 | undefined); get value(): Array | undefined; private _value; /** Changed value of the form control */ readonly selectionChange: EventEmitter; /** Internal */ matSelect: MatSelect; /** Custom error state matcher */ _matcher: RdsVariableSelectErrorStateMatcher | undefined; /** Whether any search results were found */ _noSearchResults: boolean; /** A subset of all the variables, filtered by the search text */ _filteredVariables$: ReplaySubject; private _onDestroy; /** `View -> model callback called when value changes` */ _onChange: (value: unknown) => void; /** `View -> model callback called when select has been touched` */ _onTouched: () => void; 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; /** * Saves a callback function to be invoked when the select's value * changes from user input. Part of the ControlValueAccessor interface * required to integrate with Angular's core forms API. * * @param fn Callback to be triggered when the value changes. */ registerOnChange(fn: (value: unknown) => void): void; /** * Saves a callback function to be invoked when the select is blurred * by the user. Part of the ControlValueAccessor interface required * to integrate with Angular's core forms API. * * @param fn Callback to be triggered when the component has been touched. */ registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; writeValue(obj: Array | undefined): 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 | undefined): void; _reorderVariables(event: Array): void; _trackByVariable(_: number, variable: Variable): string | null | undefined; /** * 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; static ɵfac: i0.ɵɵFactoryDeclaration, [{ optional: true; self: true; }, null, null, null]>; static ɵcmp: i0.ɵɵComponentDeclaration, "rds-c-variable-select", never, { "chipsAriaLabel": "chipsAriaLabel"; "config": "config"; "disabled": "disabled"; "disabledOptions": "disabledOptions"; "maxSelection": "maxSelection"; "multiSelect": "multiSelect"; "options": "options"; "orderable": "orderable"; "required": "required"; "selectLabel": "selectLabel"; "selectPlaceholder": "selectPlaceholder"; "suffixIcon": "suffixIcon"; "value": "value"; }, { "selectionChange": "selectionChange"; }, never, never>; }