MCPcopy Create free account
hub / github.com/angular/components / MatSelect

Class MatSelect

src/material/select/select.ts:186–1436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184 imports: [CdkOverlayOrigin, CdkConnectedOverlay],
185})
186export class MatSelect
187 implements
188 AfterContentInit,
189 OnChanges,
190 OnDestroy,
191 OnInit,
192 DoCheck,
193 ControlValueAccessor,
194 MatFormFieldControl<any>
195{
196 protected _viewportRuler = inject(ViewportRuler);
197 protected _changeDetectorRef = inject(ChangeDetectorRef);
198 readonly _elementRef = inject(ElementRef);
199 private _dir = inject(Directionality, {optional: true});
200 private _idGenerator = inject(_IdGenerator);
201 private _renderer = inject(Renderer2);
202 protected _parentFormField = inject<MatFormField>(MAT_FORM_FIELD, {optional: true});
203 ngControl = inject(NgControl, {self: true, optional: true})!;
204 private _liveAnnouncer = inject(LiveAnnouncer);
205 protected _defaultOptions = inject(MAT_SELECT_CONFIG, {optional: true});
206 protected _animationsDisabled = _animationsDisabled();
207 protected _popoverLocation: FlexibleOverlayPopoverLocation | null;
208 private _initialized = new Subject();
209 private _cleanupDetach: (() => void) | undefined;
210
211 /** All of the defined select options. */
212 @ContentChildren(MatOption, {descendants: true}) options!: QueryList<MatOption>;
213
214 // TODO(crisbeto): this is only necessary for the non-MDC select, but it's technically a
215 // public API so we have to keep it. It should be deprecated and removed eventually.
216 /** All of the defined groups of options. */
217 @ContentChildren(MAT_OPTGROUP, {descendants: true}) optionGroups!: QueryList<MatOptgroup>;
218
219 /** User-supplied override of the trigger element. */
220 @ContentChild(MAT_SELECT_TRIGGER) customTrigger!: MatSelectTrigger;
221
222 /**
223 * This position config ensures that the top "start" corner of the overlay
224 * is aligned with with the top "start" of the origin by default (overlapping
225 * the trigger completely). If the panel cannot fit below the trigger, it
226 * will fall back to a position above the trigger.
227 */
228 _positions: ConnectedPosition[] = [
229 {
230 originX: 'start',
231 originY: 'bottom',
232 overlayX: 'start',
233 overlayY: 'top',
234 },
235 {
236 originX: 'end',
237 originY: 'bottom',
238 overlayX: 'end',
239 overlayY: 'top',
240 },
241 {
242 originX: 'start',
243 originY: 'top',

Callers

nothing calls this directly

Calls 3

_animationsDisabledFunction · 0.90
signalFunction · 0.85
getIdMethod · 0.45

Tested by

no test coverage detected