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 { BooleanInput } from '@angular/cdk/coercion';
|
---|
9 | import { AfterViewChecked, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, QueryList } from '@angular/core';
|
---|
10 | import { FocusOptions, FocusableOption, FocusOrigin } from '@angular/cdk/a11y';
|
---|
11 | import { Subject } from 'rxjs';
|
---|
12 | import { MatOptgroup, _MatOptgroupBase } from './optgroup';
|
---|
13 | import { MatOptionParentComponent } from './option-parent';
|
---|
14 | /** Event object emitted by MatOption when selected or deselected. */
|
---|
15 | export declare class MatOptionSelectionChange {
|
---|
16 | /** Reference to the option that emitted the event. */
|
---|
17 | source: _MatOptionBase;
|
---|
18 | /** Whether the change in the option's value was a result of a user action. */
|
---|
19 | isUserInput: boolean;
|
---|
20 | constructor(
|
---|
21 | /** Reference to the option that emitted the event. */
|
---|
22 | source: _MatOptionBase,
|
---|
23 | /** Whether the change in the option's value was a result of a user action. */
|
---|
24 | isUserInput?: boolean);
|
---|
25 | }
|
---|
26 | export declare class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy {
|
---|
27 | private _element;
|
---|
28 | private _changeDetectorRef;
|
---|
29 | private _parent;
|
---|
30 | readonly group: _MatOptgroupBase;
|
---|
31 | private _selected;
|
---|
32 | private _active;
|
---|
33 | private _disabled;
|
---|
34 | private _mostRecentViewValue;
|
---|
35 | /** Whether the wrapping component is in multiple selection mode. */
|
---|
36 | get multiple(): boolean | undefined;
|
---|
37 | /** Whether or not the option is currently selected. */
|
---|
38 | get selected(): boolean;
|
---|
39 | /** The form value of the option. */
|
---|
40 | value: any;
|
---|
41 | /** The unique ID of the option. */
|
---|
42 | id: string;
|
---|
43 | /** Whether the option is disabled. */
|
---|
44 | get disabled(): any;
|
---|
45 | set disabled(value: any);
|
---|
46 | /** Whether ripples for the option are disabled. */
|
---|
47 | get disableRipple(): boolean | undefined;
|
---|
48 | /** Event emitted when the option is selected or deselected. */
|
---|
49 | readonly onSelectionChange: EventEmitter<MatOptionSelectionChange>;
|
---|
50 | /** Emits when the state of the option changes and any parents have to be notified. */
|
---|
51 | readonly _stateChanges: Subject<void>;
|
---|
52 | constructor(_element: ElementRef<HTMLElement>, _changeDetectorRef: ChangeDetectorRef, _parent: MatOptionParentComponent, group: _MatOptgroupBase);
|
---|
53 | /**
|
---|
54 | * Whether or not the option is currently active and ready to be selected.
|
---|
55 | * An active option displays styles as if it is focused, but the
|
---|
56 | * focus is actually retained somewhere else. This comes in handy
|
---|
57 | * for components like autocomplete where focus must remain on the input.
|
---|
58 | */
|
---|
59 | get active(): boolean;
|
---|
60 | /**
|
---|
61 | * The displayed value of the option. It is necessary to show the selected option in the
|
---|
62 | * select's trigger.
|
---|
63 | */
|
---|
64 | get viewValue(): string;
|
---|
65 | /** Selects the option. */
|
---|
66 | select(): void;
|
---|
67 | /** Deselects the option. */
|
---|
68 | deselect(): void;
|
---|
69 | /** Sets focus onto this option. */
|
---|
70 | focus(_origin?: FocusOrigin, options?: FocusOptions): void;
|
---|
71 | /**
|
---|
72 | * This method sets display styles on the option to make it appear
|
---|
73 | * active. This is used by the ActiveDescendantKeyManager so key
|
---|
74 | * events will display the proper options as active on arrow key events.
|
---|
75 | */
|
---|
76 | setActiveStyles(): void;
|
---|
77 | /**
|
---|
78 | * This method removes display styles on the option that made it appear
|
---|
79 | * active. This is used by the ActiveDescendantKeyManager so key
|
---|
80 | * events will display the proper options as active on arrow key events.
|
---|
81 | */
|
---|
82 | setInactiveStyles(): void;
|
---|
83 | /** Gets the label to be used when determining whether the option should be focused. */
|
---|
84 | getLabel(): string;
|
---|
85 | /** Ensures the option is selected when activated from the keyboard. */
|
---|
86 | _handleKeydown(event: KeyboardEvent): void;
|
---|
87 | /**
|
---|
88 | * `Selects the option while indicating the selection came from the user. Used to
|
---|
89 | * determine if the select's view -> model callback should be invoked.`
|
---|
90 | */
|
---|
91 | _selectViaInteraction(): void;
|
---|
92 | /**
|
---|
93 | * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
|
---|
94 | * attribute from single-selection, unselected options. Including the `aria-selected="false"`
|
---|
95 | * attributes adds a significant amount of noise to screen-reader users without providing useful
|
---|
96 | * information.
|
---|
97 | */
|
---|
98 | _getAriaSelected(): boolean | null;
|
---|
99 | /** Returns the correct tabindex for the option depending on disabled state. */
|
---|
100 | _getTabIndex(): string;
|
---|
101 | /** Gets the host DOM element. */
|
---|
102 | _getHostElement(): HTMLElement;
|
---|
103 | ngAfterViewChecked(): void;
|
---|
104 | ngOnDestroy(): void;
|
---|
105 | /** Emits the selection change event. */
|
---|
106 | private _emitSelectionChangeEvent;
|
---|
107 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
108 | }
|
---|
109 | /**
|
---|
110 | * Single option inside of a `<mat-select>` element.
|
---|
111 | */
|
---|
112 | export declare class MatOption extends _MatOptionBase {
|
---|
113 | constructor(element: ElementRef<HTMLElement>, changeDetectorRef: ChangeDetectorRef, parent: MatOptionParentComponent, group: MatOptgroup);
|
---|
114 | }
|
---|
115 | /**
|
---|
116 | * Counts the amount of option group labels that precede the specified option.
|
---|
117 | * @param optionIndex Index of the option at which to start counting.
|
---|
118 | * @param options Flat list of all of the options.
|
---|
119 | * @param optionGroups Flat list of all of the option groups.
|
---|
120 | * @docs-private
|
---|
121 | */
|
---|
122 | export declare function _countGroupLabelsBeforeOption(optionIndex: number, options: QueryList<MatOption>, optionGroups: QueryList<MatOptgroup>): number;
|
---|
123 | /**
|
---|
124 | * Determines the position to which to scroll a panel in order for an option to be into view.
|
---|
125 | * @param optionOffset Offset of the option from the top of the panel.
|
---|
126 | * @param optionHeight Height of the options.
|
---|
127 | * @param currentScrollPosition Current scroll position of the panel.
|
---|
128 | * @param panelHeight Height of the panel.
|
---|
129 | * @docs-private
|
---|
130 | */
|
---|
131 | export declare function _getOptionScrollPosition(optionOffset: number, optionHeight: number, currentScrollPosition: number, panelHeight: number): number;
|
---|