import { FocusMonitor } from '@angular/cdk/a11y'; import { ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnDestroy } from '@angular/core'; import { ControlValueAccessor, FormControl, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { ErrorStateMatcher, MatOptionSelectionChange } from '@angular/material/core'; import { MatDialog } from '@angular/material/dialog'; 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 { MeasureOptionType } from './measure-option.model'; import { MeasureSelection } from './measure-selection.model'; import * as i0 from "@angular/core"; /** Error when invalid control is dirty, touched, or submitted. */ export declare class RdsMeasureSelectErrorStateMatcher implements ErrorStateMatcher { private _control; constructor(_control: NgControl); isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean; } /** * Select control to select a measure, supports reactive forms. * @author Will Davis */ export declare class RdsMeasureSelectComponent implements ControlValueAccessor, DoCheck, OnDestroy { _control: NgControl; private _changeDetectorRef; private _dialog; private _focusMonitor; static ngAcceptInputType_variables: VariableSummary[] | Variable[] | null | undefined; DEFAULT_MEASURES: MeasureSelection[]; /** Popover configuration to describe the control */ config: MtnaPopoverConfig; /** Whether the control is disabled */ get disabled(): boolean | string; set disabled(value: boolean | string); private _disabled; /** * Whether multiple measures can be selected * TODO - implement multi selection */ multiple: boolean; /** Whether the control is required */ required: boolean; /** Label for mat-select, defaults to "Measure" */ selectLabel: string; /** Placeholder for mat-select, defaults to "Choose measure..." */ selectPlaceholder: string; /** Suffix icon for the select, defaults to null */ suffixIcon: string | null; /** Measure types to select from, defaults to all */ types: Array; /** The selected MeasureSelection and value for this control, if it exists */ set value(value: MeasureSelection[]); get value(): MeasureSelection[]; private _value; /** Variables to choose from if a measure requires it. */ get variables(): V[]; set variables(variables: V[]); private _variables; /** Changed value of the form control */ readonly selectionChange: EventEmitter[]>; /** Internal */ matSelect: MatSelect; /** Custom error state matcher */ _matcher: RdsMeasureSelectErrorStateMatcher | undefined; _measureOptions: Record<"PERCENT" | "COUNT" | "SUM" | "AVG" | "MIN" | "MAX", import("./measure-option.model").MeasureOption>; private _destroyed$; /** `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, _dialog: MatDialog, _focusMonitor: FocusMonitor); ngDoCheck(): void; ngOnDestroy(): 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: MeasureSelection[]): void; _emitChangeEvent(newValue: MeasureSelection[] | null | undefined): void; /** * Manually handle when options are selected/unselected. * @param event option selection event */ _handleOptionSelectionChange(type: MeasureOptionType): void; _unselect(event: MatOptionSelectionChange): void; static ɵfac: i0.ɵɵFactoryDeclaration, [{ optional: true; self: true; }, null, null, null, null]>; static ɵcmp: i0.ɵɵComponentDeclaration, "rds-c-measure-select", never, { "config": "config"; "disabled": "disabled"; "multiple": "multiple"; "required": "required"; "selectLabel": "selectLabel"; "selectPlaceholder": "selectPlaceholder"; "suffixIcon": "suffixIcon"; "types": "types"; "value": "value"; "variables": "variables"; }, { "selectionChange": "selectionChange"; }, never, never>; }