MCPcopy
hub / github.com/angular/components / MatSelect

Class MatSelect

src/material/select/select.ts:185–1434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

_animationsDisabledFunction · 0.90
signalFunction · 0.85
getIdMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…