import { ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnChanges, OnInit, QueryList, Renderer2, SimpleChanges } from '@angular/core'; import { AbstractControl, ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { SelectionModel } from '@angular/cdk/collections'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { BooleanInput } from '@angular/cdk/coercion'; import { MatFormField, MatFormFieldControl } from '@angular/material/form-field'; import { MatOption, MatOptionSelectionChange, CanDisable, ErrorStateMatcher, HasTabIndex, CanUpdateErrorState, CanDisableRipple } from '@angular/material/core'; import { Observable, Subject } from 'rxjs'; import { NgxMatSelectPanelComponent } from './component/panel/ngx-mat-select-panel.component'; import { NgxMatSelectSearchBoxComponent } from './component/search-box/ngx-mat-select-search-box.component'; import { NgxMatSelectOptionContentDirective } from './template/ngx-mat-select-option-content.directive'; import { NgxMatSelectTriggerDirective } from './template/ngx-mat-select-trigger.directive'; import { NgxMatSelectConfig, NgxMatSelectionChangeEvent, NgxMatSelectMultipleDisplay, NgxMatSelectValue, NgxMatSelectViewType } from './select-model'; import { NgxMatSelectFetchOptions } from './component/fetch-options/ngx-mat-select-fetch-options'; import * as i0 from "@angular/core"; /** @docs-private */ declare const _MatSelectMixinBase: import("@angular/material/core")._Constructor & import("@angular/material/core")._AbstractConstructor & import("@angular/material/core")._Constructor & import("@angular/material/core")._AbstractConstructor & import("@angular/material/core")._Constructor & import("@angular/material/core")._AbstractConstructor & import("@angular/material/core")._Constructor & import("@angular/material/core")._AbstractConstructor & { new (_elementRef: ElementRef, _defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl): { /** * Emits whenever the component state changes and should cause the parent * form-field to update. Implemented as part of `MatFormFieldControl`. * @docs-private */ readonly stateChanges: Subject; _elementRef: ElementRef; _defaultErrorStateMatcher: ErrorStateMatcher; _parentForm: NgForm; _parentFormGroup: FormGroupDirective; /** * Form control bound to the component. * Implemented as part of `MatFormFieldControl`. * @docs-private */ ngControl: NgControl; }; }; export declare class NgxMatSelectComponent extends _MatSelectMixinBase implements ControlValueAccessor, NgxMatSelectConfig, NgxMatSelectFetchOptions, DoCheck, CanDisable, HasTabIndex, MatFormFieldControl, CanUpdateErrorState, CanDisableRipple, OnChanges, OnInit { _changeDetectorRef: ChangeDetectorRef; private renderer; protected _parentFormField: MatFormField; protected defaultOptions: NgxMatSelectConfig; /** * the options which are visible in the panel */ visibleOptions: QueryList; /** * the custom content of the form-field to show */ triggerContent?: NgxMatSelectTriggerDirective; /** * a template which carries the content of an option */ selectOptionContent?: NgxMatSelectOptionContentDirective | null; /** * the search box that we also use it for initializing the filtered options */ searchBoxComponent?: NgxMatSelectSearchBoxComponent; /** * the cdk virtual scroll viewport */ virtualScroll: CdkVirtualScrollViewport; /** * the panel which is connected to the form-field */ panel: NgxMatSelectPanelComponent; /** Event emitted when the select panel has been toggled. */ readonly openedChange: EventEmitter; /** * to emits a new event, whenever the client select or deselect that item */ selectionChange: EventEmitter; /** Event emitted when the select has been opened. */ readonly opened: Observable; /** Event emitted when the select has been closed. */ readonly closed: Observable; /** * Event that emits whenever the raw value of the select changes. This is here primarily * to facilitate the two-way binding for the `value` input. * @docs-private */ readonly valueChange: EventEmitter; /** * if it's false we can just select one item from the options */ get multiple(): boolean; set multiple(value: boolean); private _multiple; /** Aria label of the select. */ ariaLabel: string; /** * to show a button next to the search-box to close the panel */ hasBackButton?: boolean; /** * recommended to use dataKey instead of compareWith, * Function to compare the option values with the selected values. The first argument is a value from an option. * The second is a value from the selection. A boolean should be returned. */ compareWith?: (o1: any, o2: any) => boolean; /** * the height of an option, it's really important to handle the virtual scroll * the default value is 48 */ optionHeight?: number; /** * the height of the panel of the options * the default value is 350 */ panelHeight?: number | null | undefined; /** * it can be 'Default', 'FullScreen' or 'BottomSheet' * 'Default' means the panel will be showed connected to the form-filed * 'FullScreen' means the panel will be opened in full-screen mode * 'BottomSheet' means the panel will be opened from bottom to semi top */ viewType?: NgxMatSelectViewType; /** * Width of the panel. If set to `auto`, the panel will match the trigger width. * If set to null or an empty string, the panel will grow to match the longest option's text. * the default value is 'auto' */ panelWidth: string | number | null | undefined; /** Classes to be passed to the select panel. Supports the same syntax as `ngClass`. */ panelClass: string | string[] | Set | { [key: string]: any; }; /** * Name of the label field of an option * it can be undefined, when options are simple primitive values such as a string array */ optionLabel?: string; /** * Name of the value field of an option. * If optionValue is omitted and the object has no value property, the object itself becomes the value of an option. Note that, * when options are simple primitive values such as a string array, no optionLabel and optionValue would be necessary */ optionValue: string | undefined; /** * A property to uniquely identify a value in options. * it would use to compare option with value */ dataKey?: string; /** * how to show the selected options inside the form-field when the multiple value it's true * the default value is 'text' */ multipleDisplay?: NgxMatSelectMultipleDisplay; /** Placeholder to be shown if no value has been selected. */ get placeholder(): string; set placeholder(value: string | undefined | null); private _placeholder; /** Unique id of the element. */ get id(): string; set id(value: string); private _id; /** Whether the component is required. */ get required(): boolean; set required(value: BooleanInput); private _required; /** * Implemented as part of MatFormFieldControl. * @docs-private */ userAriaDescribedBy?: string; /** Value of the select control. */ get value(): any; set value(newValue: any); /** * if it's true the search box will be showed, the default value is false */ hasSearchBox: boolean; /** * a placeholder for the search-box to be shown if nothing is written in the search-box */ searchBoxPlaceholder: string; /** Ideal origin for the overlay panel. */ preferredOverlayOrigin?: ElementRef; /** * the selection model which enhances the selecting actions like deselect and select and so on */ selectionModel?: SelectionModel; /** * the options that will be appeared in the screens */ filteredOptions$: Observable; /** * a loading flag at button of the panel list when we are using the server-side fetching data */ loading$: Observable; /** * an observable carries the value, storing the latest value of the select-box. * the value always is an array, and when we have no value the value * would be an empty array * the select search directive would subscribe this value to update the selected items */ value$: Observable; /** * to set the active option */ activeItemIndex?: string; /** A name for this control that can be used by `mat-form-field`. */ controlType: string; /** * Keeps track of the previous form control assigned to the select. * Used to detect if it has changed. */ _previousControl: AbstractControl | null | undefined; /** Class or list of classes to be applied to the menu's overlay panel. */ _overlayPanelClass: string | string[]; /** Whether the select has a value. */ get empty(): boolean; /** Whether the select is focused. */ get focused(): boolean; private _focused; /** * Implemented as part of MatFormFieldControl. * @docs-private */ get shouldLabelFloat(): boolean; /** * to store the scroll-top of the virtual scroll * and apply it to the virtual scroll container whenever it gets open * @private */ private scrollTop; /** Unique id for this input. */ private _uid; /** * a type of subject to get the control of the value observable, storing the latest value of the form * @private */ private value$$; constructor(_changeDetectorRef: ChangeDetectorRef, renderer: Renderer2, _defaultErrorStateMatcher: ErrorStateMatcher, elementRef: ElementRef, tabIndex: string, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _parentFormField: MatFormField, ngControl: NgControl, defaultOptions: NgxMatSelectConfig); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngDoCheck(): void; /** `View -> model callback called when value changes` */ _onChange: (value: any) => void; /** `View -> model callback called when select has been touched` */ _onTouched: () => void; /** * whenever the form-control gets updated from outside we can use * this function to write the latest value in the local state * @param value */ writeValue(value: unknown[] | unknown): void; /** * to store the local onChange function * @param fn */ registerOnChange(fn: any): void; /** * to store the local onTouch function * @param fn */ registerOnTouched(fn: any): void; /** * to manage being disabled * @param isDisabled */ setDisabledState(isDisabled: boolean): void; /** * to remove an item from the selected options * @param option */ onDeselect(option: unknown): void; /** * to select or deselect an item from selected options * @param event */ onSelectionChange(event: MatOptionSelectionChange): void; /** * Implemented as part of MatFormFieldControl. * @docs-private */ onContainerClick(event: MouseEvent): void; /** * Implemented as part of MatFormFieldControl. * @docs-private */ setDescribedByIds(ids: string[]): void; /** * we get a hook before the panel gets open */ onBeforePanelOpen(): void; /** * we get a hook after the panel gets open */ onAfterPanelOpen(): void; /** * we get a hook before the panel gets close */ onBeforePanelClose(): void; /** * we get a hook after the panel gets close */ onAfterPanelClose(): void; blur(): void; focus(): void; /** * to get the value of the specific property (optionValue) from the option * @param option */ getOptionValue(option: any): any; /** * to check if an options is selected or not */ isSelected(option: unknown): boolean; /** The currently selected option. */ get selected(): any | any[]; /** * to get the latest value of the select-box * the value for multiple and single selection is an array, * but for single selection the first row is assumed as the value */ getValue(): unknown[]; /** * to set the value of the select-box, * @param value {unknown} - the value of the form-control * @param shouldBeSyncedWithSelection {boolean} - if it's true the selection model will be synced with the value * @param emitsValue - to emit and call valueChange and _onChange functions together */ setValue(value: unknown[] | unknown, shouldBeSyncedWithSelection: boolean, emitsValue?: boolean): void; /** Toggles the overlay panel open or closed. */ toggle(): void; get panelOpen(): boolean; /** Returns the theme to be used on the panel. */ _getPanelTheme(): string; _onFocus(): void; /** * Calls the touched callback only if the panel is closed. Otherwise, the trigger will * "blur" to the panel when it opens, causing a false positive. */ _onBlur(): void; /** * to handle some keyboard event when the caret is on the input * @param event */ _handleKeydown(event: KeyboardEvent): void; /** * to get the appropriate value according to the being multiple or single selection * @param object */ _toFlat(object: unknown[] | undefined | null): unknown | unknown[]; /** * to get an array from an object or an array * @param object */ _toArray(object: unknown[] | unknown): any[]; /** * to get a function which compares the options with values to detect the selected item */ _getCompareWithFn(): (o1: any, o2: any) => boolean; /** * according to using multiple or single selection, whenever we want to update the form-control value from here we need to get the * appropriate value for the form. * @private */ private getFlatValueFromSelection; /** * to get the value of the key property of an object safely * @param object -the object that we want to get the value of the key property * @param key - the one of the property of the object * @private */ private getObjectValue; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export {};