| 120 | providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR], |
| 121 | }) |
| 122 | export class MatAutocompleteTrigger |
| 123 | implements ControlValueAccessor, AfterViewInit, OnChanges, OnDestroy |
| 124 | { |
| 125 | private _environmentInjector = inject(EnvironmentInjector); |
| 126 | private _element = inject<ElementRef<HTMLInputElement>>(ElementRef); |
| 127 | private _injector = inject(Injector); |
| 128 | private _viewContainerRef = inject(ViewContainerRef); |
| 129 | private _zone = inject(NgZone); |
| 130 | private _changeDetectorRef = inject(ChangeDetectorRef); |
| 131 | private _dir = inject(Directionality, {optional: true}); |
| 132 | private _formField = inject<MatFormField | null>(MAT_FORM_FIELD, {optional: true, host: true}); |
| 133 | private _viewportRuler = inject(ViewportRuler); |
| 134 | private _scrollStrategy = inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY); |
| 135 | private _renderer = inject(Renderer2); |
| 136 | private _animationsDisabled = _animationsDisabled(); |
| 137 | private _defaults = inject<MatAutocompleteDefaultOptions | null>( |
| 138 | MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, |
| 139 | {optional: true}, |
| 140 | ); |
| 141 | |
| 142 | private _overlayRef: OverlayRef | null = null; |
| 143 | private _portal!: TemplatePortal; |
| 144 | private _componentDestroyed = false; |
| 145 | private _initialized = new Subject(); |
| 146 | private _keydownSubscription: Subscription | undefined; |
| 147 | private _outsideClickSubscription: Subscription | undefined; |
| 148 | private _cleanupWindowBlur: (() => void) | undefined; |
| 149 | |
| 150 | /** Old value of the native input. Used to work around issues with the `input` event on IE. */ |
| 151 | private _previousValue: string | number | null = null; |
| 152 | |
| 153 | /** Value of the input element when the panel was attached (even if there are no options). */ |
| 154 | private _valueOnAttach: string | number | null = null; |
| 155 | |
| 156 | /** Value on the previous keydown event. */ |
| 157 | private _valueOnLastKeydown: string | null = null; |
| 158 | |
| 159 | /** Strategy that is used to position the panel. */ |
| 160 | private _positionStrategy!: FlexibleConnectedPositionStrategy; |
| 161 | |
| 162 | /** Whether or not the label state is being overridden. */ |
| 163 | private _manuallyFloatingLabel = false; |
| 164 | |
| 165 | /** The subscription for closing actions (some are bound to document). */ |
| 166 | private _closingActionsSubscription!: Subscription; |
| 167 | |
| 168 | /** Subscription to viewport size changes. */ |
| 169 | private _viewportSubscription = Subscription.EMPTY; |
| 170 | |
| 171 | /** Implements BreakpointObserver to be used to detect handset landscape */ |
| 172 | private _breakpointObserver = inject(BreakpointObserver); |
| 173 | private _handsetLandscapeSubscription = Subscription.EMPTY; |
| 174 | |
| 175 | /** |
| 176 | * Whether the autocomplete can open the next time it is focused. Used to prevent a focused, |
| 177 | * closed autocomplete from being reopened if the user switches to another browser tab and then |
| 178 | * comes back. |
| 179 | */ |
nothing calls this directly
no test coverage detected
searching dependent graphs…