source: trip-planner-front/node_modules/@angular/material/select/select.d.ts.__ivy_ngcc_bak@ 188ee53

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

initial commit

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