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 { Directionality } from '@angular/cdk/bidi';
|
---|
9 | import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
---|
10 | import { DOWN_ARROW, ENTER, ESCAPE, TAB, UP_ARROW, hasModifierKey } from '@angular/cdk/keycodes';
|
---|
11 | import { Overlay, OverlayConfig, } from '@angular/cdk/overlay';
|
---|
12 | import { _getEventTarget } from '@angular/cdk/platform';
|
---|
13 | import { TemplatePortal } from '@angular/cdk/portal';
|
---|
14 | import { ViewportRuler } from '@angular/cdk/scrolling';
|
---|
15 | import { DOCUMENT } from '@angular/common';
|
---|
16 | import { ChangeDetectorRef, Directive, ElementRef, forwardRef, Host, Inject, InjectionToken, Input, NgZone, Optional, ViewContainerRef, } from '@angular/core';
|
---|
17 | import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
---|
18 | import { _countGroupLabelsBeforeOption, _getOptionScrollPosition, MatOptionSelectionChange, } from '@angular/material/core';
|
---|
19 | import { MAT_FORM_FIELD, MatFormField } from '@angular/material/form-field';
|
---|
20 | import { defer, fromEvent, merge, of as observableOf, Subject, Subscription } from 'rxjs';
|
---|
21 | import { delay, filter, map, switchMap, take, tap } from 'rxjs/operators';
|
---|
22 | import { _MatAutocompleteBase, MAT_AUTOCOMPLETE_DEFAULT_OPTIONS } from './autocomplete';
|
---|
23 | import { _MatAutocompleteOriginBase } from './autocomplete-origin';
|
---|
24 | /** Injection token that determines the scroll handling while the autocomplete panel is open. */
|
---|
25 | export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY = new InjectionToken('mat-autocomplete-scroll-strategy');
|
---|
26 | /** @docs-private */
|
---|
27 | export function MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY(overlay) {
|
---|
28 | return () => overlay.scrollStrategies.reposition();
|
---|
29 | }
|
---|
30 | /** @docs-private */
|
---|
31 | export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
|
---|
32 | provide: MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
|
---|
33 | deps: [Overlay],
|
---|
34 | useFactory: MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY,
|
---|
35 | };
|
---|
36 | /**
|
---|
37 | * Provider that allows the autocomplete to register as a ControlValueAccessor.
|
---|
38 | * @docs-private
|
---|
39 | */
|
---|
40 | export const MAT_AUTOCOMPLETE_VALUE_ACCESSOR = {
|
---|
41 | provide: NG_VALUE_ACCESSOR,
|
---|
42 | useExisting: forwardRef(() => MatAutocompleteTrigger),
|
---|
43 | multi: true
|
---|
44 | };
|
---|
45 | /**
|
---|
46 | * Creates an error to be thrown when attempting to use an autocomplete trigger without a panel.
|
---|
47 | * @docs-private
|
---|
48 | */
|
---|
49 | export function getMatAutocompleteMissingPanelError() {
|
---|
50 | return Error('Attempting to open an undefined instance of `mat-autocomplete`. ' +
|
---|
51 | 'Make sure that the id passed to the `matAutocomplete` is correct and that ' +
|
---|
52 | 'you\'re attempting to open it after the ngAfterContentInit hook.');
|
---|
53 | }
|
---|
54 | /** Base class with all of the `MatAutocompleteTrigger` functionality. */
|
---|
55 | export class _MatAutocompleteTriggerBase {
|
---|
56 | constructor(_element, _overlay, _viewContainerRef, _zone, _changeDetectorRef, scrollStrategy, _dir, _formField, _document, _viewportRuler, _defaults) {
|
---|
57 | this._element = _element;
|
---|
58 | this._overlay = _overlay;
|
---|
59 | this._viewContainerRef = _viewContainerRef;
|
---|
60 | this._zone = _zone;
|
---|
61 | this._changeDetectorRef = _changeDetectorRef;
|
---|
62 | this._dir = _dir;
|
---|
63 | this._formField = _formField;
|
---|
64 | this._document = _document;
|
---|
65 | this._viewportRuler = _viewportRuler;
|
---|
66 | this._defaults = _defaults;
|
---|
67 | this._componentDestroyed = false;
|
---|
68 | this._autocompleteDisabled = false;
|
---|
69 | /** Whether or not the label state is being overridden. */
|
---|
70 | this._manuallyFloatingLabel = false;
|
---|
71 | /** Subscription to viewport size changes. */
|
---|
72 | this._viewportSubscription = Subscription.EMPTY;
|
---|
73 | /**
|
---|
74 | * Whether the autocomplete can open the next time it is focused. Used to prevent a focused,
|
---|
75 | * closed autocomplete from being reopened if the user switches to another browser tab and then
|
---|
76 | * comes back.
|
---|
77 | */
|
---|
78 | this._canOpenOnNextFocus = true;
|
---|
79 | /** Stream of keyboard events that can close the panel. */
|
---|
80 | this._closeKeyEventStream = new Subject();
|
---|
81 | /**
|
---|
82 | * Event handler for when the window is blurred. Needs to be an
|
---|
83 | * arrow function in order to preserve the context.
|
---|
84 | */
|
---|
85 | this._windowBlurHandler = () => {
|
---|
86 | // If the user blurred the window while the autocomplete is focused, it means that it'll be
|
---|
87 | // refocused when they come back. In this case we want to skip the first focus event, if the
|
---|
88 | // pane was closed, in order to avoid reopening it unintentionally.
|
---|
89 | this._canOpenOnNextFocus =
|
---|
90 | this._document.activeElement !== this._element.nativeElement || this.panelOpen;
|
---|
91 | };
|
---|
92 | /** `View -> model callback called when value changes` */
|
---|
93 | this._onChange = () => { };
|
---|
94 | /** `View -> model callback called when autocomplete has been touched` */
|
---|
95 | this._onTouched = () => { };
|
---|
96 | /**
|
---|
97 | * Position of the autocomplete panel relative to the trigger element. A position of `auto`
|
---|
98 | * will render the panel underneath the trigger if there is enough space for it to fit in
|
---|
99 | * the viewport, otherwise the panel will be shown above it. If the position is set to
|
---|
100 | * `above` or `below`, the panel will always be shown above or below the trigger. no matter
|
---|
101 | * whether it fits completely in the viewport.
|
---|
102 | */
|
---|
103 | this.position = 'auto';
|
---|
104 | /**
|
---|
105 | * `autocomplete` attribute to be set on the input element.
|
---|
106 | * @docs-private
|
---|
107 | */
|
---|
108 | this.autocompleteAttribute = 'off';
|
---|
109 | this._overlayAttached = false;
|
---|
110 | /** Stream of autocomplete option selections. */
|
---|
111 | this.optionSelections = defer(() => {
|
---|
112 | if (this.autocomplete && this.autocomplete.options) {
|
---|
113 | return merge(...this.autocomplete.options.map(option => option.onSelectionChange));
|
---|
114 | }
|
---|
115 | // If there are any subscribers before `ngAfterViewInit`, the `autocomplete` will be undefined.
|
---|
116 | // Return a stream that we'll replace with the real one once everything is in place.
|
---|
117 | return this._zone.onStable
|
---|
118 | .pipe(take(1), switchMap(() => this.optionSelections));
|
---|
119 | });
|
---|
120 | this._scrollStrategy = scrollStrategy;
|
---|
121 | }
|
---|
122 | /**
|
---|
123 | * Whether the autocomplete is disabled. When disabled, the element will
|
---|
124 | * act as a regular input and the user won't be able to open the panel.
|
---|
125 | */
|
---|
126 | get autocompleteDisabled() { return this._autocompleteDisabled; }
|
---|
127 | set autocompleteDisabled(value) {
|
---|
128 | this._autocompleteDisabled = coerceBooleanProperty(value);
|
---|
129 | }
|
---|
130 | ngAfterViewInit() {
|
---|
131 | const window = this._getWindow();
|
---|
132 | if (typeof window !== 'undefined') {
|
---|
133 | this._zone.runOutsideAngular(() => window.addEventListener('blur', this._windowBlurHandler));
|
---|
134 | }
|
---|
135 | }
|
---|
136 | ngOnChanges(changes) {
|
---|
137 | if (changes['position'] && this._positionStrategy) {
|
---|
138 | this._setStrategyPositions(this._positionStrategy);
|
---|
139 | if (this.panelOpen) {
|
---|
140 | this._overlayRef.updatePosition();
|
---|
141 | }
|
---|
142 | }
|
---|
143 | }
|
---|
144 | ngOnDestroy() {
|
---|
145 | const window = this._getWindow();
|
---|
146 | if (typeof window !== 'undefined') {
|
---|
147 | window.removeEventListener('blur', this._windowBlurHandler);
|
---|
148 | }
|
---|
149 | this._viewportSubscription.unsubscribe();
|
---|
150 | this._componentDestroyed = true;
|
---|
151 | this._destroyPanel();
|
---|
152 | this._closeKeyEventStream.complete();
|
---|
153 | }
|
---|
154 | /** Whether or not the autocomplete panel is open. */
|
---|
155 | get panelOpen() {
|
---|
156 | return this._overlayAttached && this.autocomplete.showPanel;
|
---|
157 | }
|
---|
158 | /** Opens the autocomplete suggestion panel. */
|
---|
159 | openPanel() {
|
---|
160 | this._attachOverlay();
|
---|
161 | this._floatLabel();
|
---|
162 | }
|
---|
163 | /** Closes the autocomplete suggestion panel. */
|
---|
164 | closePanel() {
|
---|
165 | this._resetLabel();
|
---|
166 | if (!this._overlayAttached) {
|
---|
167 | return;
|
---|
168 | }
|
---|
169 | if (this.panelOpen) {
|
---|
170 | // Only emit if the panel was visible.
|
---|
171 | this.autocomplete.closed.emit();
|
---|
172 | }
|
---|
173 | this.autocomplete._isOpen = this._overlayAttached = false;
|
---|
174 | if (this._overlayRef && this._overlayRef.hasAttached()) {
|
---|
175 | this._overlayRef.detach();
|
---|
176 | this._closingActionsSubscription.unsubscribe();
|
---|
177 | }
|
---|
178 | // Note that in some cases this can end up being called after the component is destroyed.
|
---|
179 | // Add a check to ensure that we don't try to run change detection on a destroyed view.
|
---|
180 | if (!this._componentDestroyed) {
|
---|
181 | // We need to trigger change detection manually, because
|
---|
182 | // `fromEvent` doesn't seem to do it at the proper time.
|
---|
183 | // This ensures that the label is reset when the
|
---|
184 | // user clicks outside.
|
---|
185 | this._changeDetectorRef.detectChanges();
|
---|
186 | }
|
---|
187 | }
|
---|
188 | /**
|
---|
189 | * Updates the position of the autocomplete suggestion panel to ensure that it fits all options
|
---|
190 | * within the viewport.
|
---|
191 | */
|
---|
192 | updatePosition() {
|
---|
193 | if (this._overlayAttached) {
|
---|
194 | this._overlayRef.updatePosition();
|
---|
195 | }
|
---|
196 | }
|
---|
197 | /**
|
---|
198 | * A stream of actions that should close the autocomplete panel, including
|
---|
199 | * when an option is selected, on blur, and when TAB is pressed.
|
---|
200 | */
|
---|
201 | get panelClosingActions() {
|
---|
202 | return merge(this.optionSelections, this.autocomplete._keyManager.tabOut.pipe(filter(() => this._overlayAttached)), this._closeKeyEventStream, this._getOutsideClickStream(), this._overlayRef ?
|
---|
203 | this._overlayRef.detachments().pipe(filter(() => this._overlayAttached)) :
|
---|
204 | observableOf()).pipe(
|
---|
205 | // Normalize the output so we return a consistent type.
|
---|
206 | map(event => event instanceof MatOptionSelectionChange ? event : null));
|
---|
207 | }
|
---|
208 | /** The currently active option, coerced to MatOption type. */
|
---|
209 | get activeOption() {
|
---|
210 | if (this.autocomplete && this.autocomplete._keyManager) {
|
---|
211 | return this.autocomplete._keyManager.activeItem;
|
---|
212 | }
|
---|
213 | return null;
|
---|
214 | }
|
---|
215 | /** Stream of clicks outside of the autocomplete panel. */
|
---|
216 | _getOutsideClickStream() {
|
---|
217 | return merge(fromEvent(this._document, 'click'), fromEvent(this._document, 'auxclick'), fromEvent(this._document, 'touchend'))
|
---|
218 | .pipe(filter(event => {
|
---|
219 | // If we're in the Shadow DOM, the event target will be the shadow root, so we have to
|
---|
220 | // fall back to check the first element in the path of the click event.
|
---|
221 | const clickTarget = _getEventTarget(event);
|
---|
222 | const formField = this._formField ? this._formField._elementRef.nativeElement : null;
|
---|
223 | const customOrigin = this.connectedTo ? this.connectedTo.elementRef.nativeElement : null;
|
---|
224 | return this._overlayAttached && clickTarget !== this._element.nativeElement &&
|
---|
225 | (!formField || !formField.contains(clickTarget)) &&
|
---|
226 | (!customOrigin || !customOrigin.contains(clickTarget)) &&
|
---|
227 | (!!this._overlayRef && !this._overlayRef.overlayElement.contains(clickTarget));
|
---|
228 | }));
|
---|
229 | }
|
---|
230 | // Implemented as part of ControlValueAccessor.
|
---|
231 | writeValue(value) {
|
---|
232 | Promise.resolve(null).then(() => this._setTriggerValue(value));
|
---|
233 | }
|
---|
234 | // Implemented as part of ControlValueAccessor.
|
---|
235 | registerOnChange(fn) {
|
---|
236 | this._onChange = fn;
|
---|
237 | }
|
---|
238 | // Implemented as part of ControlValueAccessor.
|
---|
239 | registerOnTouched(fn) {
|
---|
240 | this._onTouched = fn;
|
---|
241 | }
|
---|
242 | // Implemented as part of ControlValueAccessor.
|
---|
243 | setDisabledState(isDisabled) {
|
---|
244 | this._element.nativeElement.disabled = isDisabled;
|
---|
245 | }
|
---|
246 | _handleKeydown(event) {
|
---|
247 | const keyCode = event.keyCode;
|
---|
248 | // Prevent the default action on all escape key presses. This is here primarily to bring IE
|
---|
249 | // in line with other browsers. By default, pressing escape on IE will cause it to revert
|
---|
250 | // the input value to the one that it had on focus, however it won't dispatch any events
|
---|
251 | // which means that the model value will be out of sync with the view.
|
---|
252 | if (keyCode === ESCAPE && !hasModifierKey(event)) {
|
---|
253 | event.preventDefault();
|
---|
254 | }
|
---|
255 | if (this.activeOption && keyCode === ENTER && this.panelOpen) {
|
---|
256 | this.activeOption._selectViaInteraction();
|
---|
257 | this._resetActiveItem();
|
---|
258 | event.preventDefault();
|
---|
259 | }
|
---|
260 | else if (this.autocomplete) {
|
---|
261 | const prevActiveItem = this.autocomplete._keyManager.activeItem;
|
---|
262 | const isArrowKey = keyCode === UP_ARROW || keyCode === DOWN_ARROW;
|
---|
263 | if (this.panelOpen || keyCode === TAB) {
|
---|
264 | this.autocomplete._keyManager.onKeydown(event);
|
---|
265 | }
|
---|
266 | else if (isArrowKey && this._canOpen()) {
|
---|
267 | this.openPanel();
|
---|
268 | }
|
---|
269 | if (isArrowKey || this.autocomplete._keyManager.activeItem !== prevActiveItem) {
|
---|
270 | this._scrollToOption(this.autocomplete._keyManager.activeItemIndex || 0);
|
---|
271 | }
|
---|
272 | }
|
---|
273 | }
|
---|
274 | _handleInput(event) {
|
---|
275 | let target = event.target;
|
---|
276 | let value = target.value;
|
---|
277 | // Based on `NumberValueAccessor` from forms.
|
---|
278 | if (target.type === 'number') {
|
---|
279 | value = value == '' ? null : parseFloat(value);
|
---|
280 | }
|
---|
281 | // If the input has a placeholder, IE will fire the `input` event on page load,
|
---|
282 | // focus and blur, in addition to when the user actually changed the value. To
|
---|
283 | // filter out all of the extra events, we save the value on focus and between
|
---|
284 | // `input` events, and we check whether it changed.
|
---|
285 | // See: https://connect.microsoft.com/IE/feedback/details/885747/
|
---|
286 | if (this._previousValue !== value) {
|
---|
287 | this._previousValue = value;
|
---|
288 | this._onChange(value);
|
---|
289 | if (this._canOpen() && this._document.activeElement === event.target) {
|
---|
290 | this.openPanel();
|
---|
291 | }
|
---|
292 | }
|
---|
293 | }
|
---|
294 | _handleFocus() {
|
---|
295 | if (!this._canOpenOnNextFocus) {
|
---|
296 | this._canOpenOnNextFocus = true;
|
---|
297 | }
|
---|
298 | else if (this._canOpen()) {
|
---|
299 | this._previousValue = this._element.nativeElement.value;
|
---|
300 | this._attachOverlay();
|
---|
301 | this._floatLabel(true);
|
---|
302 | }
|
---|
303 | }
|
---|
304 | /**
|
---|
305 | * In "auto" mode, the label will animate down as soon as focus is lost.
|
---|
306 | * This causes the value to jump when selecting an option with the mouse.
|
---|
307 | * This method manually floats the label until the panel can be closed.
|
---|
308 | * @param shouldAnimate Whether the label should be animated when it is floated.
|
---|
309 | */
|
---|
310 | _floatLabel(shouldAnimate = false) {
|
---|
311 | if (this._formField && this._formField.floatLabel === 'auto') {
|
---|
312 | if (shouldAnimate) {
|
---|
313 | this._formField._animateAndLockLabel();
|
---|
314 | }
|
---|
315 | else {
|
---|
316 | this._formField.floatLabel = 'always';
|
---|
317 | }
|
---|
318 | this._manuallyFloatingLabel = true;
|
---|
319 | }
|
---|
320 | }
|
---|
321 | /** If the label has been manually elevated, return it to its normal state. */
|
---|
322 | _resetLabel() {
|
---|
323 | if (this._manuallyFloatingLabel) {
|
---|
324 | this._formField.floatLabel = 'auto';
|
---|
325 | this._manuallyFloatingLabel = false;
|
---|
326 | }
|
---|
327 | }
|
---|
328 | /**
|
---|
329 | * This method listens to a stream of panel closing actions and resets the
|
---|
330 | * stream every time the option list changes.
|
---|
331 | */
|
---|
332 | _subscribeToClosingActions() {
|
---|
333 | const firstStable = this._zone.onStable.pipe(take(1));
|
---|
334 | const optionChanges = this.autocomplete.options.changes.pipe(tap(() => this._positionStrategy.reapplyLastPosition()),
|
---|
335 | // Defer emitting to the stream until the next tick, because changing
|
---|
336 | // bindings in here will cause "changed after checked" errors.
|
---|
337 | delay(0));
|
---|
338 | // When the zone is stable initially, and when the option list changes...
|
---|
339 | return merge(firstStable, optionChanges)
|
---|
340 | .pipe(
|
---|
341 | // create a new stream of panelClosingActions, replacing any previous streams
|
---|
342 | // that were created, and flatten it so our stream only emits closing events...
|
---|
343 | switchMap(() => {
|
---|
344 | const wasOpen = this.panelOpen;
|
---|
345 | this._resetActiveItem();
|
---|
346 | this.autocomplete._setVisibility();
|
---|
347 | if (this.panelOpen) {
|
---|
348 | this._overlayRef.updatePosition();
|
---|
349 | // If the `panelOpen` state changed, we need to make sure to emit the `opened`
|
---|
350 | // event, because we may not have emitted it when the panel was attached. This
|
---|
351 | // can happen if the users opens the panel and there are no options, but the
|
---|
352 | // options come in slightly later or as a result of the value changing.
|
---|
353 | if (wasOpen !== this.panelOpen) {
|
---|
354 | this.autocomplete.opened.emit();
|
---|
355 | }
|
---|
356 | }
|
---|
357 | return this.panelClosingActions;
|
---|
358 | }),
|
---|
359 | // when the first closing event occurs...
|
---|
360 | take(1))
|
---|
361 | // set the value, close the panel, and complete.
|
---|
362 | .subscribe(event => this._setValueAndClose(event));
|
---|
363 | }
|
---|
364 | /** Destroys the autocomplete suggestion panel. */
|
---|
365 | _destroyPanel() {
|
---|
366 | if (this._overlayRef) {
|
---|
367 | this.closePanel();
|
---|
368 | this._overlayRef.dispose();
|
---|
369 | this._overlayRef = null;
|
---|
370 | }
|
---|
371 | }
|
---|
372 | _setTriggerValue(value) {
|
---|
373 | const toDisplay = this.autocomplete && this.autocomplete.displayWith ?
|
---|
374 | this.autocomplete.displayWith(value) :
|
---|
375 | value;
|
---|
376 | // Simply falling back to an empty string if the display value is falsy does not work properly.
|
---|
377 | // The display value can also be the number zero and shouldn't fall back to an empty string.
|
---|
378 | const inputValue = toDisplay != null ? toDisplay : '';
|
---|
379 | // If it's used within a `MatFormField`, we should set it through the property so it can go
|
---|
380 | // through change detection.
|
---|
381 | if (this._formField) {
|
---|
382 | this._formField._control.value = inputValue;
|
---|
383 | }
|
---|
384 | else {
|
---|
385 | this._element.nativeElement.value = inputValue;
|
---|
386 | }
|
---|
387 | this._previousValue = inputValue;
|
---|
388 | }
|
---|
389 | /**
|
---|
390 | * This method closes the panel, and if a value is specified, also sets the associated
|
---|
391 | * control to that value. It will also mark the control as dirty if this interaction
|
---|
392 | * stemmed from the user.
|
---|
393 | */
|
---|
394 | _setValueAndClose(event) {
|
---|
395 | if (event && event.source) {
|
---|
396 | this._clearPreviousSelectedOption(event.source);
|
---|
397 | this._setTriggerValue(event.source.value);
|
---|
398 | this._onChange(event.source.value);
|
---|
399 | this._element.nativeElement.focus();
|
---|
400 | this.autocomplete._emitSelectEvent(event.source);
|
---|
401 | }
|
---|
402 | this.closePanel();
|
---|
403 | }
|
---|
404 | /**
|
---|
405 | * Clear any previous selected option and emit a selection change event for this option
|
---|
406 | */
|
---|
407 | _clearPreviousSelectedOption(skip) {
|
---|
408 | this.autocomplete.options.forEach(option => {
|
---|
409 | if (option !== skip && option.selected) {
|
---|
410 | option.deselect();
|
---|
411 | }
|
---|
412 | });
|
---|
413 | }
|
---|
414 | _attachOverlay() {
|
---|
415 | var _a;
|
---|
416 | if (!this.autocomplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
---|
417 | throw getMatAutocompleteMissingPanelError();
|
---|
418 | }
|
---|
419 | let overlayRef = this._overlayRef;
|
---|
420 | if (!overlayRef) {
|
---|
421 | this._portal = new TemplatePortal(this.autocomplete.template, this._viewContainerRef, { id: (_a = this._formField) === null || _a === void 0 ? void 0 : _a.getLabelId() });
|
---|
422 | overlayRef = this._overlay.create(this._getOverlayConfig());
|
---|
423 | this._overlayRef = overlayRef;
|
---|
424 | // Use the `keydownEvents` in order to take advantage of
|
---|
425 | // the overlay event targeting provided by the CDK overlay.
|
---|
426 | overlayRef.keydownEvents().subscribe(event => {
|
---|
427 | // Close when pressing ESCAPE or ALT + UP_ARROW, based on the a11y guidelines.
|
---|
428 | // See: https://www.w3.org/TR/wai-aria-practices-1.1/#textbox-keyboard-interaction
|
---|
429 | if ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
|
---|
430 | (event.keyCode === UP_ARROW && hasModifierKey(event, 'altKey'))) {
|
---|
431 | this._closeKeyEventStream.next();
|
---|
432 | this._resetActiveItem();
|
---|
433 | // We need to stop propagation, otherwise the event will eventually
|
---|
434 | // reach the input itself and cause the overlay to be reopened.
|
---|
435 | event.stopPropagation();
|
---|
436 | event.preventDefault();
|
---|
437 | }
|
---|
438 | });
|
---|
439 | this._viewportSubscription = this._viewportRuler.change().subscribe(() => {
|
---|
440 | if (this.panelOpen && overlayRef) {
|
---|
441 | overlayRef.updateSize({ width: this._getPanelWidth() });
|
---|
442 | }
|
---|
443 | });
|
---|
444 | }
|
---|
445 | else {
|
---|
446 | // Update the trigger, panel width and direction, in case anything has changed.
|
---|
447 | this._positionStrategy.setOrigin(this._getConnectedElement());
|
---|
448 | overlayRef.updateSize({ width: this._getPanelWidth() });
|
---|
449 | }
|
---|
450 | if (overlayRef && !overlayRef.hasAttached()) {
|
---|
451 | overlayRef.attach(this._portal);
|
---|
452 | this._closingActionsSubscription = this._subscribeToClosingActions();
|
---|
453 | }
|
---|
454 | const wasOpen = this.panelOpen;
|
---|
455 | this.autocomplete._setVisibility();
|
---|
456 | this.autocomplete._isOpen = this._overlayAttached = true;
|
---|
457 | // We need to do an extra `panelOpen` check in here, because the
|
---|
458 | // autocomplete won't be shown if there are no options.
|
---|
459 | if (this.panelOpen && wasOpen !== this.panelOpen) {
|
---|
460 | this.autocomplete.opened.emit();
|
---|
461 | }
|
---|
462 | }
|
---|
463 | _getOverlayConfig() {
|
---|
464 | var _a;
|
---|
465 | return new OverlayConfig({
|
---|
466 | positionStrategy: this._getOverlayPosition(),
|
---|
467 | scrollStrategy: this._scrollStrategy(),
|
---|
468 | width: this._getPanelWidth(),
|
---|
469 | direction: this._dir,
|
---|
470 | panelClass: (_a = this._defaults) === null || _a === void 0 ? void 0 : _a.overlayPanelClass,
|
---|
471 | });
|
---|
472 | }
|
---|
473 | _getOverlayPosition() {
|
---|
474 | const strategy = this._overlay.position()
|
---|
475 | .flexibleConnectedTo(this._getConnectedElement())
|
---|
476 | .withFlexibleDimensions(false)
|
---|
477 | .withPush(false);
|
---|
478 | this._setStrategyPositions(strategy);
|
---|
479 | this._positionStrategy = strategy;
|
---|
480 | return strategy;
|
---|
481 | }
|
---|
482 | /** Sets the positions on a position strategy based on the directive's input state. */
|
---|
483 | _setStrategyPositions(positionStrategy) {
|
---|
484 | // Note that we provide horizontal fallback positions, even though by default the dropdown
|
---|
485 | // width matches the input, because consumers can override the width. See #18854.
|
---|
486 | const belowPositions = [
|
---|
487 | { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
|
---|
488 | { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' }
|
---|
489 | ];
|
---|
490 | // The overlay edge connected to the trigger should have squared corners, while
|
---|
491 | // the opposite end has rounded corners. We apply a CSS class to swap the
|
---|
492 | // border-radius based on the overlay position.
|
---|
493 | const panelClass = this._aboveClass;
|
---|
494 | const abovePositions = [
|
---|
495 | { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', panelClass },
|
---|
496 | { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', panelClass }
|
---|
497 | ];
|
---|
498 | let positions;
|
---|
499 | if (this.position === 'above') {
|
---|
500 | positions = abovePositions;
|
---|
501 | }
|
---|
502 | else if (this.position === 'below') {
|
---|
503 | positions = belowPositions;
|
---|
504 | }
|
---|
505 | else {
|
---|
506 | positions = [...belowPositions, ...abovePositions];
|
---|
507 | }
|
---|
508 | positionStrategy.withPositions(positions);
|
---|
509 | }
|
---|
510 | _getConnectedElement() {
|
---|
511 | if (this.connectedTo) {
|
---|
512 | return this.connectedTo.elementRef;
|
---|
513 | }
|
---|
514 | return this._formField ? this._formField.getConnectedOverlayOrigin() : this._element;
|
---|
515 | }
|
---|
516 | _getPanelWidth() {
|
---|
517 | return this.autocomplete.panelWidth || this._getHostWidth();
|
---|
518 | }
|
---|
519 | /** Returns the width of the input element, so the panel width can match it. */
|
---|
520 | _getHostWidth() {
|
---|
521 | return this._getConnectedElement().nativeElement.getBoundingClientRect().width;
|
---|
522 | }
|
---|
523 | /**
|
---|
524 | * Resets the active item to -1 so arrow events will activate the
|
---|
525 | * correct options, or to 0 if the consumer opted into it.
|
---|
526 | */
|
---|
527 | _resetActiveItem() {
|
---|
528 | const autocomplete = this.autocomplete;
|
---|
529 | if (autocomplete.autoActiveFirstOption) {
|
---|
530 | // Note that we go through `setFirstItemActive`, rather than `setActiveItem(0)`, because
|
---|
531 | // the former will find the next enabled option, if the first one is disabled.
|
---|
532 | autocomplete._keyManager.setFirstItemActive();
|
---|
533 | }
|
---|
534 | else {
|
---|
535 | autocomplete._keyManager.setActiveItem(-1);
|
---|
536 | }
|
---|
537 | }
|
---|
538 | /** Determines whether the panel can be opened. */
|
---|
539 | _canOpen() {
|
---|
540 | const element = this._element.nativeElement;
|
---|
541 | return !element.readOnly && !element.disabled && !this._autocompleteDisabled;
|
---|
542 | }
|
---|
543 | /** Use defaultView of injected document if available or fallback to global window reference */
|
---|
544 | _getWindow() {
|
---|
545 | var _a;
|
---|
546 | return ((_a = this._document) === null || _a === void 0 ? void 0 : _a.defaultView) || window;
|
---|
547 | }
|
---|
548 | /** Scrolls to a particular option in the list. */
|
---|
549 | _scrollToOption(index) {
|
---|
550 | // Given that we are not actually focusing active options, we must manually adjust scroll
|
---|
551 | // to reveal options below the fold. First, we find the offset of the option from the top
|
---|
552 | // of the panel. If that offset is below the fold, the new scrollTop will be the offset -
|
---|
553 | // the panel height + the option height, so the active option will be just visible at the
|
---|
554 | // bottom of the panel. If that offset is above the top of the visible panel, the new scrollTop
|
---|
555 | // will become the offset. If that offset is visible within the panel already, the scrollTop is
|
---|
556 | // not adjusted.
|
---|
557 | const autocomplete = this.autocomplete;
|
---|
558 | const labelCount = _countGroupLabelsBeforeOption(index, autocomplete.options, autocomplete.optionGroups);
|
---|
559 | if (index === 0 && labelCount === 1) {
|
---|
560 | // If we've got one group label before the option and we're at the top option,
|
---|
561 | // scroll the list to the top. This is better UX than scrolling the list to the
|
---|
562 | // top of the option, because it allows the user to read the top group's label.
|
---|
563 | autocomplete._setScrollTop(0);
|
---|
564 | }
|
---|
565 | else if (autocomplete.panel) {
|
---|
566 | const option = autocomplete.options.toArray()[index];
|
---|
567 | if (option) {
|
---|
568 | const element = option._getHostElement();
|
---|
569 | const newScrollPosition = _getOptionScrollPosition(element.offsetTop, element.offsetHeight, autocomplete._getScrollTop(), autocomplete.panel.nativeElement.offsetHeight);
|
---|
570 | autocomplete._setScrollTop(newScrollPosition);
|
---|
571 | }
|
---|
572 | }
|
---|
573 | }
|
---|
574 | }
|
---|
575 | _MatAutocompleteTriggerBase.decorators = [
|
---|
576 | { type: Directive }
|
---|
577 | ];
|
---|
578 | _MatAutocompleteTriggerBase.ctorParameters = () => [
|
---|
579 | { type: ElementRef },
|
---|
580 | { type: Overlay },
|
---|
581 | { type: ViewContainerRef },
|
---|
582 | { type: NgZone },
|
---|
583 | { type: ChangeDetectorRef },
|
---|
584 | { type: undefined, decorators: [{ type: Inject, args: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY,] }] },
|
---|
585 | { type: Directionality, decorators: [{ type: Optional }] },
|
---|
586 | { type: MatFormField, decorators: [{ type: Optional }, { type: Inject, args: [MAT_FORM_FIELD,] }, { type: Host }] },
|
---|
587 | { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
|
---|
588 | { type: ViewportRuler },
|
---|
589 | { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,] }] }
|
---|
590 | ];
|
---|
591 | _MatAutocompleteTriggerBase.propDecorators = {
|
---|
592 | autocomplete: [{ type: Input, args: ['matAutocomplete',] }],
|
---|
593 | position: [{ type: Input, args: ['matAutocompletePosition',] }],
|
---|
594 | connectedTo: [{ type: Input, args: ['matAutocompleteConnectedTo',] }],
|
---|
595 | autocompleteAttribute: [{ type: Input, args: ['autocomplete',] }],
|
---|
596 | autocompleteDisabled: [{ type: Input, args: ['matAutocompleteDisabled',] }]
|
---|
597 | };
|
---|
598 | export class MatAutocompleteTrigger extends _MatAutocompleteTriggerBase {
|
---|
599 | constructor() {
|
---|
600 | super(...arguments);
|
---|
601 | this._aboveClass = 'mat-autocomplete-panel-above';
|
---|
602 | }
|
---|
603 | }
|
---|
604 | MatAutocompleteTrigger.decorators = [
|
---|
605 | { type: Directive, args: [{
|
---|
606 | selector: `input[matAutocomplete], textarea[matAutocomplete]`,
|
---|
607 | host: {
|
---|
608 | 'class': 'mat-autocomplete-trigger',
|
---|
609 | '[attr.autocomplete]': 'autocompleteAttribute',
|
---|
610 | '[attr.role]': 'autocompleteDisabled ? null : "combobox"',
|
---|
611 | '[attr.aria-autocomplete]': 'autocompleteDisabled ? null : "list"',
|
---|
612 | '[attr.aria-activedescendant]': '(panelOpen && activeOption) ? activeOption.id : null',
|
---|
613 | '[attr.aria-expanded]': 'autocompleteDisabled ? null : panelOpen.toString()',
|
---|
614 | '[attr.aria-owns]': '(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id',
|
---|
615 | '[attr.aria-haspopup]': '!autocompleteDisabled',
|
---|
616 | // Note: we use `focusin`, as opposed to `focus`, in order to open the panel
|
---|
617 | // a little earlier. This avoids issues where IE delays the focusing of the input.
|
---|
618 | '(focusin)': '_handleFocus()',
|
---|
619 | '(blur)': '_onTouched()',
|
---|
620 | '(input)': '_handleInput($event)',
|
---|
621 | '(keydown)': '_handleKeydown($event)',
|
---|
622 | },
|
---|
623 | exportAs: 'matAutocompleteTrigger',
|
---|
624 | providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR]
|
---|
625 | },] }
|
---|
626 | ];
|
---|
627 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b2NvbXBsZXRlLXRyaWdnZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uL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