source: trip-planner-front/node_modules/@angular/material/select/select.d.ts@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 22.1 KB
Line 
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 */
8import { ActiveDescendantKeyManager, LiveAnnouncer } from '@angular/cdk/a11y';
9import { Directionality } from '@angular/cdk/bidi';
10import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
11import { SelectionModel } from '@angular/cdk/collections';
12import { CdkConnectedOverlay, ConnectedPosition, Overlay, ScrollStrategy } from '@angular/cdk/overlay';
13import { ViewportRuler } from '@angular/cdk/scrolling';
14import { AfterContentInit, ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, InjectionToken, NgZone, OnChanges, OnDestroy, OnInit, QueryList, SimpleChanges } from '@angular/core';
15import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';
16import { CanDisable, CanDisableRipple, CanUpdateErrorState, ErrorStateMatcher, HasTabIndex, MatOptgroup, MatOption, MatOptionSelectionChange, _MatOptionBase } from '@angular/material/core';
17import { MatFormField, MatFormFieldControl } from '@angular/material/form-field';
18import { Observable, Subject } from 'rxjs';
19/**
20 * The following style constants are necessary to save here in order
21 * to properly calculate the alignment of the selected option over
22 * the trigger element.
23 */
24/** The max height of the select's overlay panel. */
25import * as ɵngcc0 from '@angular/core';
26export declare const SELECT_PANEL_MAX_HEIGHT = 256;
27/** The panel's padding on the x-axis. */
28export declare const SELECT_PANEL_PADDING_X = 16;
29/** The panel's x axis padding if it is indented (e.g. there is an option group). */
30export declare const SELECT_PANEL_INDENT_PADDING_X: number;
31/** The height of the select items in `em` units. */
32export declare const SELECT_ITEM_HEIGHT_EM = 3;
33/**
34 * Distance between the panel edge and the option text in
35 * multi-selection mode.
36 *
37 * Calculated as:
38 * (SELECT_PANEL_PADDING_X * 1.5) + 16 = 40
39 * The padding is multiplied by 1.5 because the checkbox's margin is half the padding.
40 * The checkbox width is 16px.
41 */
42export declare const SELECT_MULTIPLE_PANEL_PADDING_X: number;
43/**
44 * The select panel will only "fit" inside the viewport if it is positioned at
45 * this value or more away from the viewport boundary.
46 */
47export declare const SELECT_PANEL_VIEWPORT_PADDING = 8;
48/** Injection token that determines the scroll handling while a select is open. */
49export declare const MAT_SELECT_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
50/** @docs-private */
51export declare function MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => ScrollStrategy;
52/** Object that can be used to configure the default options for the select module. */
53export interface MatSelectConfig {
54 /** Whether option centering should be disabled. */
55 disableOptionCentering?: boolean;
56 /** Time to wait in milliseconds after the last keystroke before moving focus to an item. */
57 typeaheadDebounceInterval?: number;
58 /** Class or list of classes to be applied to the menu's overlay panel. */
59 overlayPanelClass?: string | string[];
60}
61/** Injection token that can be used to provide the default options the select module. */
62export declare const MAT_SELECT_CONFIG: InjectionToken<MatSelectConfig>;
63/** @docs-private */
64export declare const MAT_SELECT_SCROLL_STRATEGY_PROVIDER: {
65 provide: InjectionToken<() => ScrollStrategy>;
66 deps: (typeof Overlay)[];
67 useFactory: typeof MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY;
68};
69/** Change event object that is emitted when the select value has changed. */
70export declare class MatSelectChange {
71 /** Reference to the select that emitted the change event. */
72 source: MatSelect;
73 /** Current value of the select that emitted the event. */
74 value: any;
75 constructor(
76 /** Reference to the select that emitted the change event. */
77 source: MatSelect,
78 /** Current value of the select that emitted the event. */
79 value: any);
80}
81/** @docs-private */
82declare const _MatSelectMixinBase: import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisableRipple> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisableRipple> & import("@angular/material/core/common-behaviors/constructor").Constructor<HasTabIndex> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<HasTabIndex> & import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisable> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisable> & import("@angular/material/core/common-behaviors/constructor").Constructor<CanUpdateErrorState> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanUpdateErrorState> & {
83 new (_elementRef: ElementRef, _defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl): {
84 _elementRef: ElementRef;
85 _defaultErrorStateMatcher: ErrorStateMatcher;
86 _parentForm: NgForm;
87 _parentFormGroup: FormGroupDirective;
88 ngControl: NgControl;
89 };
90};
91/**
92 * Injection token that can be used to reference instances of `MatSelectTrigger`. It serves as
93 * alternative token to the actual `MatSelectTrigger` class which could cause unnecessary
94 * retention of the class and its directive metadata.
95 */
96export declare const MAT_SELECT_TRIGGER: InjectionToken<MatSelectTrigger>;
97/**
98 * Allows the user to customize the trigger that is displayed when the select has a value.
99 */
100export declare class MatSelectTrigger {
101 static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatSelectTrigger, never>;
102 static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatSelectTrigger, "mat-select-trigger", never, {}, {}, never>;
103}
104/** Base class with all of the `MatSelect` functionality. */
105export declare abstract class _MatSelectBase<C> extends _MatSelectMixinBase implements AfterContentInit, OnChanges, OnDestroy, OnInit, DoCheck, ControlValueAccessor, CanDisable, HasTabIndex, MatFormFieldControl<any>, CanUpdateErrorState, CanDisableRipple {
106 protected _viewportRuler: ViewportRuler;
107 protected _changeDetectorRef: ChangeDetectorRef;
108 protected _ngZone: NgZone;
109 private _dir;
110 protected _parentFormField: MatFormField;
111 private _liveAnnouncer;
112 private _defaultOptions?;
113 /** All of the defined select options. */
114 abstract options: QueryList<_MatOptionBase>;
115 /** All of the defined groups of options. */
116 abstract optionGroups: QueryList<MatOptgroup>;
117 /** User-supplied override of the trigger element. */
118 abstract customTrigger: {};
119 /**
120 * This position config ensures that the top "start" corner of the overlay
121 * is aligned with with the top "start" of the origin by default (overlapping
122 * the trigger completely). If the panel cannot fit below the trigger, it
123 * will fall back to a position above the trigger.
124 */
125 abstract _positions: ConnectedPosition[];
126 /** Scrolls a particular option into the view. */
127 protected abstract _scrollOptionIntoView(index: number): void;
128 /** Called when the panel has been opened and the overlay has settled on its final position. */
129 protected abstract _positioningSettled(): void;
130 /** Creates a change event object that should be emitted by the select. */
131 protected abstract _getChangeEvent(value: any): C;
132 /** Factory function used to create a scroll strategy for this select. */
133 private _scrollStrategyFactory;
134 /** Whether or not the overlay panel is open. */
135 private _panelOpen;
136 /** Comparison function to specify which option is displayed. Defaults to object equality. */
137 private _compareWith;
138 /** Unique id for this input. */
139 private _uid;
140 /** Current `ariar-labelledby` value for the select trigger. */
141 private _triggerAriaLabelledBy;
142 /** Emits whenever the component is destroyed. */
143 protected readonly _destroy: Subject<void>;
144 /** The aria-describedby attribute on the select for improved a11y. */
145 _ariaDescribedby: string;
146 /** Deals with the selection logic. */
147 _selectionModel: SelectionModel<MatOption>;
148 /** Manages keyboard events for options in the panel. */
149 _keyManager: ActiveDescendantKeyManager<MatOption>;
150 /** `View -> model callback called when value changes` */
151 _onChange: (value: any) => void;
152 /** `View -> model callback called when select has been touched` */
153 _onTouched: () => void;
154 /** ID for the DOM node containing the select's value. */
155 _valueId: string;
156 /** Emits when the panel element is finished transforming in. */
157 readonly _panelDoneAnimatingStream: Subject<string>;
158 /** Strategy that will be used to handle scrolling while the select panel is open. */
159 _scrollStrategy: ScrollStrategy;
160 _overlayPanelClass: string | string[];
161 /** Whether the select is focused. */
162 get focused(): boolean;
163 private _focused;
164 /** A name for this control that can be used by `mat-form-field`. */
165 controlType: string;
166 /** Trigger that opens the select. */
167 trigger: ElementRef;
168 /** Panel containing the select options. */
169 panel: ElementRef;
170 /** Overlay pane containing the options. */
171 protected _overlayDir: CdkConnectedOverlay;
172 /** Classes to be passed to the select panel. Supports the same syntax as `ngClass`. */
173 panelClass: string | string[] | Set<string> | {
174 [key: string]: any;
175 };
176 /** Placeholder to be shown if no value has been selected. */
177 get placeholder(): string;
178 set placeholder(value: string);
179 private _placeholder;
180 /** Whether the component is required. */
181 get required(): boolean;
182 set required(value: boolean);
183 private _required;
184 /** Whether the user should be allowed to select multiple options. */
185 get multiple(): boolean;
186 set multiple(value: boolean);
187 private _multiple;
188 /** Whether to center the active option over the trigger. */
189 get disableOptionCentering(): boolean;
190 set disableOptionCentering(value: boolean);
191 private _disableOptionCentering;
192 /**
193 * Function to compare the option values with the selected values. The first argument
194 * is a value from an option. The second is a value from the selection. A boolean
195 * should be returned.
196 */
197 get compareWith(): (o1: any, o2: any) => boolean;
198 set compareWith(fn: (o1: any, o2: any) => boolean);
199 /** Value of the select control. */
200 get value(): any;
201 set value(newValue: any);
202 private _value;
203 /** Aria label of the select. */
204 ariaLabel: string;
205 /** Input that can be used to specify the `aria-labelledby` attribute. */
206 ariaLabelledby: string;
207 /** Object used to control when error messages are shown. */
208 errorStateMatcher: ErrorStateMatcher;
209 /** Time to wait in milliseconds after the last keystroke before moving focus to an item. */
210 get typeaheadDebounceInterval(): number;
211 set typeaheadDebounceInterval(value: number);
212 private _typeaheadDebounceInterval;
213 /**
214 * Function used to sort the values in a select in multiple mode.
215 * Follows the same logic as `Array.prototype.sort`.
216 */
217 sortComparator: (a: MatOption, b: MatOption, options: MatOption[]) => number;
218 /** Unique id of the element. */
219 get id(): string;
220 set id(value: string);
221 private _id;
222 /** Combined stream of all of the child options' change events. */
223 readonly optionSelectionChanges: Observable<MatOptionSelectionChange>;
224 /** Event emitted when the select panel has been toggled. */
225 readonly openedChange: EventEmitter<boolean>;
226 /** Event emitted when the select has been opened. */
227 readonly _openedStream: Observable<void>;
228 /** Event emitted when the select has been closed. */
229 readonly _closedStream: Observable<void>;
230 /** Event emitted when the selected value has been changed by the user. */
231 readonly selectionChange: EventEmitter<C>;
232 /**
233 * Event that emits whenever the raw value of the select changes. This is here primarily
234 * to facilitate the two-way binding for the `value` input.
235 * @docs-private
236 */
237 readonly valueChange: EventEmitter<any>;
238 constructor(_viewportRuler: ViewportRuler, _changeDetectorRef: ChangeDetectorRef, _ngZone: NgZone, _defaultErrorStateMatcher: ErrorStateMatcher, elementRef: ElementRef, _dir: Directionality, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, _parentFormField: MatFormField, ngControl: NgControl, tabIndex: string, scrollStrategyFactory: any, _liveAnnouncer: LiveAnnouncer, _defaultOptions?: MatSelectConfig | undefined);
239 ngOnInit(): void;
240 ngAfterContentInit(): void;
241 ngDoCheck(): void;
242 ngOnChanges(changes: SimpleChanges): void;
243 ngOnDestroy(): void;
244 /** Toggles the overlay panel open or closed. */
245 toggle(): void;
246 /** Opens the overlay panel. */
247 open(): void;
248 /** Closes the overlay panel and focuses the host element. */
249 close(): void;
250 /**
251 * Sets the select's value. Part of the ControlValueAccessor interface
252 * required to integrate with Angular's core forms API.
253 *
254 * @param value New value to be written to the model.
255 */
256 writeValue(value: any): void;
257 /**
258 * Saves a callback function to be invoked when the select's value
259 * changes from user input. Part of the ControlValueAccessor interface
260 * required to integrate with Angular's core forms API.
261 *
262 * @param fn Callback to be triggered when the value changes.
263 */
264 registerOnChange(fn: (value: any) => void): void;
265 /**
266 * Saves a callback function to be invoked when the select is blurred
267 * by the user. Part of the ControlValueAccessor interface required
268 * to integrate with Angular's core forms API.
269 *
270 * @param fn Callback to be triggered when the component has been touched.
271 */
272 registerOnTouched(fn: () => {}): void;
273 /**
274 * Disables the select. Part of the ControlValueAccessor interface required
275 * to integrate with Angular's core forms API.
276 *
277 * @param isDisabled Sets whether the component is disabled.
278 */
279 setDisabledState(isDisabled: boolean): void;
280 /** Whether or not the overlay panel is open. */
281 get panelOpen(): boolean;
282 /** The currently selected option. */
283 get selected(): MatOption | MatOption[];
284 /** The value displayed in the trigger. */
285 get triggerValue(): string;
286 /** Whether the element is in RTL mode. */
287 _isRtl(): boolean;
288 /** Handles all keydown events on the select. */
289 _handleKeydown(event: KeyboardEvent): void;
290 /** Handles keyboard events while the select is closed. */
291 private _handleClosedKeydown;
292 /** Handles keyboard events when the selected is open. */
293 private _handleOpenKeydown;
294 _onFocus(): void;
295 /**
296 * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
297 * "blur" to the panel when it opens, causing a false positive.
298 */
299 _onBlur(): void;
300 /**
301 * Callback that is invoked when the overlay panel has been attached.
302 */
303 _onAttached(): void;
304 /** Returns the theme to be used on the panel. */
305 _getPanelTheme(): string;
306 /** Whether the select has a value. */
307 get empty(): boolean;
308 private _initializeSelection;
309 /**
310 * Sets the selected option based on a value. If no option can be
311 * found with the designated value, the select trigger is cleared.
312 */
313 private _setSelectionByValue;
314 /**
315 * Finds and selects and option based on its value.
316 * @returns Option that has the corresponding value.
317 */
318 private _selectValue;
319 /** Sets up a key manager to listen to keyboard events on the overlay panel. */
320 private _initKeyManager;
321 /** Drops current option subscriptions and IDs and resets from scratch. */
322 private _resetOptions;
323 /** Invoked when an option is clicked. */
324 private _onSelect;
325 /** Sorts the selected values in the selected based on their order in the panel. */
326 private _sortValues;
327 /** Emits change event to set the model value. */
328 private _propagateChanges;
329 /**
330 * Highlights the selected item. If no option is selected, it will highlight
331 * the first item instead.
332 */
333 private _highlightCorrectOption;
334 /** Whether the panel is allowed to open. */
335 protected _canOpen(): boolean;
336 /** Focuses the select element. */
337 focus(options?: FocusOptions): void;
338 /** Gets the aria-labelledby for the select panel. */
339 _getPanelAriaLabelledby(): string | null;
340 /** Determines the `aria-activedescendant` to be set on the host. */
341 _getAriaActiveDescendant(): string | null;
342 /** Gets the aria-labelledby of the select component trigger. */
343 private _getTriggerAriaLabelledby;
344 /** Called when the overlay panel is done animating. */
345 protected _panelDoneAnimating(isOpen: boolean): void;
346 /**
347 * Implemented as part of MatFormFieldControl.
348 * @docs-private
349 */
350 setDescribedByIds(ids: string[]): void;
351 /**
352 * Implemented as part of MatFormFieldControl.
353 * @docs-private
354 */
355 onContainerClick(): void;
356 /**
357 * Implemented as part of MatFormFieldControl.
358 * @docs-private
359 */
360 get shouldLabelFloat(): boolean;
361 static ngAcceptInputType_required: BooleanInput;
362 static ngAcceptInputType_multiple: BooleanInput;
363 static ngAcceptInputType_disableOptionCentering: BooleanInput;
364 static ngAcceptInputType_typeaheadDebounceInterval: NumberInput;
365 static ngAcceptInputType_disabled: BooleanInput;
366 static ngAcceptInputType_disableRipple: BooleanInput;
367 static ngAcceptInputType_tabIndex: NumberInput;
368 static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<_MatSelectBase<any>, [null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; self: true; }, { attribute: "tabindex"; }, null, null, { optional: true; }]>;
369 static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<_MatSelectBase<any>, never, never, { "ariaLabel": "aria-label"; "id": "id"; "placeholder": "placeholder"; "required": "required"; "multiple": "multiple"; "disableOptionCentering": "disableOptionCentering"; "compareWith": "compareWith"; "value": "value"; "typeaheadDebounceInterval": "typeaheadDebounceInterval"; "panelClass": "panelClass"; "ariaLabelledby": "aria-labelledby"; "errorStateMatcher": "errorStateMatcher"; "sortComparator": "sortComparator"; }, { "openedChange": "openedChange"; "_openedStream": "opened"; "_closedStream": "closed"; "selectionChange": "selectionChange"; "valueChange": "valueChange"; }, never>;
370}
371export declare class MatSelect extends _MatSelectBase<MatSelectChange> implements OnInit {
372 /** The scroll position of the overlay panel, calculated to center the selected option. */
373 private _scrollTop;
374 /** The last measured value for the trigger's client bounding rect. */
375 _triggerRect: ClientRect;
376 /** The cached font-size of the trigger element. */
377 _triggerFontSize: number;
378 /** The value of the select panel's transform-origin property. */
379 _transformOrigin: string;
380 /**
381 * The y-offset of the overlay panel in relation to the trigger's top start corner.
382 * This must be adjusted to align the selected option text over the trigger text.
383 * when the panel opens. Will change based on the y-position of the selected option.
384 */
385 _offsetY: number;
386 options: QueryList<MatOption>;
387 optionGroups: QueryList<MatOptgroup>;
388 customTrigger: MatSelectTrigger;
389 _positions: ConnectedPosition[];
390 /**
391 * Calculates the scroll position of the select's overlay panel.
392 *
393 * Attempts to center the selected option in the panel. If the option is
394 * too high or too low in the panel to be scrolled to the center, it clamps the
395 * scroll position to the min or max scroll positions respectively.
396 */
397 _calculateOverlayScroll(selectedIndex: number, scrollBuffer: number, maxScroll: number): number;
398 ngOnInit(): void;
399 open(): void;
400 /** Scrolls the active option into view. */
401 protected _scrollOptionIntoView(index: number): void;
402 protected _positioningSettled(): void;
403 protected _panelDoneAnimating(isOpen: boolean): void;
404 protected _getChangeEvent(value: any): MatSelectChange;
405 /**
406 * Sets the x-offset of the overlay panel in relation to the trigger's top start corner.
407 * This must be adjusted to align the selected option text over the trigger text when
408 * the panel opens. Will change based on LTR or RTL text direction. Note that the offset
409 * can't be calculated until the panel has been attached, because we need to know the
410 * content width in order to constrain the panel within the viewport.
411 */
412 private _calculateOverlayOffsetX;
413 /**
414 * Calculates the y-offset of the select's overlay panel in relation to the
415 * top start corner of the trigger. It has to be adjusted in order for the
416 * selected option to be aligned over the trigger when the panel opens.
417 */
418 private _calculateOverlayOffsetY;
419 /**
420 * Checks that the attempted overlay position will fit within the viewport.
421 * If it will not fit, tries to adjust the scroll position and the associated
422 * y-offset so the panel can open fully on-screen. If it still won't fit,
423 * sets the offset back to 0 to allow the fallback position to take over.
424 */
425 private _checkOverlayWithinViewport;
426 /** Adjusts the overlay panel up to fit in the viewport. */
427 private _adjustPanelUp;
428 /** Adjusts the overlay panel down to fit in the viewport. */
429 private _adjustPanelDown;
430 /** Calculates the scroll position and x- and y-offsets of the overlay panel. */
431 private _calculateOverlayPosition;
432 /** Sets the transform origin point based on the selected option. */
433 private _getOriginBasedOnOption;
434 /** Calculates the height of the select's options. */
435 private _getItemHeight;
436 /** Calculates the amount of items in the select. This includes options and group labels. */
437 private _getItemCount;
438 static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatSelect, never>;
439 static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<MatSelect, "mat-select", ["matSelect"], { "disabled": "disabled"; "disableRipple": "disableRipple"; "tabIndex": "tabIndex"; }, {}, ["customTrigger", "options", "optionGroups"], ["mat-select-trigger", "*"]>;
440}
441export {};
442
443//# sourceMappingURL=select.d.ts.map
Note: See TracBrowser for help on using the repository browser.