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