[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
---|
| 9 | import { BooleanInput } from '@angular/cdk/coercion';
|
---|
| 10 | import { Platform } from '@angular/cdk/platform';
|
---|
| 11 | import { AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, QueryList, TemplateRef, OnDestroy } from '@angular/core';
|
---|
| 12 | import { CanDisableRipple, _MatOptgroupBase, _MatOptionBase, MatOption, MatOptgroup } from '@angular/material/core';
|
---|
| 13 | /** Event object that is emitted when an autocomplete option is selected. */
|
---|
| 14 | export declare class MatAutocompleteSelectedEvent {
|
---|
| 15 | /** Reference to the autocomplete panel that emitted the event. */
|
---|
| 16 | source: _MatAutocompleteBase;
|
---|
| 17 | /** Option that was selected. */
|
---|
| 18 | option: _MatOptionBase;
|
---|
| 19 | constructor(
|
---|
| 20 | /** Reference to the autocomplete panel that emitted the event. */
|
---|
| 21 | source: _MatAutocompleteBase,
|
---|
| 22 | /** Option that was selected. */
|
---|
| 23 | option: _MatOptionBase);
|
---|
| 24 | }
|
---|
| 25 | /** Event object that is emitted when an autocomplete option is activated. */
|
---|
| 26 | export interface MatAutocompleteActivatedEvent {
|
---|
| 27 | /** Reference to the autocomplete panel that emitted the event. */
|
---|
| 28 | source: _MatAutocompleteBase;
|
---|
| 29 | /** Option that was selected. */
|
---|
| 30 | option: _MatOptionBase | null;
|
---|
| 31 | }
|
---|
| 32 | /** @docs-private */
|
---|
| 33 | declare const _MatAutocompleteMixinBase: import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisableRipple> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisableRipple> & {
|
---|
| 34 | new (): {};
|
---|
| 35 | };
|
---|
| 36 | /** Default `mat-autocomplete` options that can be overridden. */
|
---|
| 37 | export interface MatAutocompleteDefaultOptions {
|
---|
| 38 | /** Whether the first option should be highlighted when an autocomplete panel is opened. */
|
---|
| 39 | autoActiveFirstOption?: boolean;
|
---|
| 40 | /** Class or list of classes to be applied to the autocomplete's overlay panel. */
|
---|
| 41 | overlayPanelClass?: string | string[];
|
---|
| 42 | }
|
---|
| 43 | /** Injection token to be used to override the default options for `mat-autocomplete`. */
|
---|
| 44 | export declare const MAT_AUTOCOMPLETE_DEFAULT_OPTIONS: InjectionToken<MatAutocompleteDefaultOptions>;
|
---|
| 45 | /** @docs-private */
|
---|
| 46 | export declare function MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY(): MatAutocompleteDefaultOptions;
|
---|
| 47 | /** Base class with all of the `MatAutocomplete` functionality. */
|
---|
| 48 | export declare abstract class _MatAutocompleteBase extends _MatAutocompleteMixinBase implements AfterContentInit, CanDisableRipple, OnDestroy {
|
---|
| 49 | private _changeDetectorRef;
|
---|
| 50 | private _elementRef;
|
---|
| 51 | private _activeOptionChanges;
|
---|
| 52 | /** Class to apply to the panel when it's visible. */
|
---|
| 53 | protected abstract _visibleClass: string;
|
---|
| 54 | /** Class to apply to the panel when it's hidden. */
|
---|
| 55 | protected abstract _hiddenClass: string;
|
---|
| 56 | /** Manages active item in option list based on key events. */
|
---|
| 57 | _keyManager: ActiveDescendantKeyManager<_MatOptionBase>;
|
---|
| 58 | /** Whether the autocomplete panel should be visible, depending on option length. */
|
---|
| 59 | showPanel: boolean;
|
---|
| 60 | /** Whether the autocomplete panel is open. */
|
---|
| 61 | get isOpen(): boolean;
|
---|
| 62 | _isOpen: boolean;
|
---|
| 63 | /** @docs-private */
|
---|
| 64 | template: TemplateRef<any>;
|
---|
| 65 | /** Element for the panel containing the autocomplete options. */
|
---|
| 66 | panel: ElementRef;
|
---|
| 67 | /** Reference to all options within the autocomplete. */
|
---|
| 68 | abstract options: QueryList<_MatOptionBase>;
|
---|
| 69 | /** Reference to all option groups within the autocomplete. */
|
---|
| 70 | abstract optionGroups: QueryList<_MatOptgroupBase>;
|
---|
| 71 | /** Aria label of the autocomplete. */
|
---|
| 72 | ariaLabel: string;
|
---|
| 73 | /** Input that can be used to specify the `aria-labelledby` attribute. */
|
---|
| 74 | ariaLabelledby: string;
|
---|
| 75 | /** Function that maps an option's control value to its display value in the trigger. */
|
---|
| 76 | displayWith: ((value: any) => string) | null;
|
---|
| 77 | /**
|
---|
| 78 | * Whether the first option should be highlighted when the autocomplete panel is opened.
|
---|
| 79 | * Can be configured globally through the `MAT_AUTOCOMPLETE_DEFAULT_OPTIONS` token.
|
---|
| 80 | */
|
---|
| 81 | get autoActiveFirstOption(): boolean;
|
---|
| 82 | set autoActiveFirstOption(value: boolean);
|
---|
| 83 | private _autoActiveFirstOption;
|
---|
| 84 | /**
|
---|
| 85 | * Specify the width of the autocomplete panel. Can be any CSS sizing value, otherwise it will
|
---|
| 86 | * match the width of its host.
|
---|
| 87 | */
|
---|
| 88 | panelWidth: string | number;
|
---|
| 89 | /** Event that is emitted whenever an option from the list is selected. */
|
---|
| 90 | readonly optionSelected: EventEmitter<MatAutocompleteSelectedEvent>;
|
---|
| 91 | /** Event that is emitted when the autocomplete panel is opened. */
|
---|
| 92 | readonly opened: EventEmitter<void>;
|
---|
| 93 | /** Event that is emitted when the autocomplete panel is closed. */
|
---|
| 94 | readonly closed: EventEmitter<void>;
|
---|
| 95 | /** Emits whenever an option is activated using the keyboard. */
|
---|
| 96 | readonly optionActivated: EventEmitter<MatAutocompleteActivatedEvent>;
|
---|
| 97 | /**
|
---|
| 98 | * Takes classes set on the host mat-autocomplete element and applies them to the panel
|
---|
| 99 | * inside the overlay container to allow for easy styling.
|
---|
| 100 | */
|
---|
| 101 | set classList(value: string | string[]);
|
---|
| 102 | _classList: {
|
---|
| 103 | [key: string]: boolean;
|
---|
| 104 | };
|
---|
| 105 | /** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
|
---|
| 106 | id: string;
|
---|
| 107 | /**
|
---|
| 108 | * Tells any descendant `mat-optgroup` to use the inert a11y pattern.
|
---|
| 109 | * @docs-private
|
---|
| 110 | */
|
---|
| 111 | readonly inertGroups: boolean;
|
---|
| 112 | constructor(_changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef<HTMLElement>, defaults: MatAutocompleteDefaultOptions, platform?: Platform);
|
---|
| 113 | ngAfterContentInit(): void;
|
---|
| 114 | ngOnDestroy(): void;
|
---|
| 115 | /**
|
---|
| 116 | * Sets the panel scrollTop. This allows us to manually scroll to display options
|
---|
| 117 | * above or below the fold, as they are not actually being focused when active.
|
---|
| 118 | */
|
---|
| 119 | _setScrollTop(scrollTop: number): void;
|
---|
| 120 | /** Returns the panel's scrollTop. */
|
---|
| 121 | _getScrollTop(): number;
|
---|
| 122 | /** Panel should hide itself when the option list is empty. */
|
---|
| 123 | _setVisibility(): void;
|
---|
| 124 | /** Emits the `select` event. */
|
---|
| 125 | _emitSelectEvent(option: _MatOptionBase): void;
|
---|
| 126 | /** Gets the aria-labelledby for the autocomplete panel. */
|
---|
| 127 | _getPanelAriaLabelledby(labelId: string | null): string | null;
|
---|
| 128 | /** Sets the autocomplete visibility classes on a classlist based on the panel is visible. */
|
---|
| 129 | private _setVisibilityClasses;
|
---|
| 130 | static ngAcceptInputType_autoActiveFirstOption: BooleanInput;
|
---|
| 131 | static ngAcceptInputType_disableRipple: BooleanInput;
|
---|
| 132 | }
|
---|
| 133 | export declare class MatAutocomplete extends _MatAutocompleteBase {
|
---|
| 134 | /** Reference to all option groups within the autocomplete. */
|
---|
| 135 | optionGroups: QueryList<MatOptgroup>;
|
---|
| 136 | /** Reference to all options within the autocomplete. */
|
---|
| 137 | options: QueryList<MatOption>;
|
---|
| 138 | protected _visibleClass: string;
|
---|
| 139 | protected _hiddenClass: string;
|
---|
| 140 | }
|
---|
| 141 | export {};
|
---|