MCPcopy Index your code
hub / github.com/angular/components / _getOverlayWidth

Method _getOverlayWidth

src/material/select/select.ts:1139–1151  ·  view source on GitHub ↗

Gets how wide the overlay panel should be.

(
    preferredOrigin: ElementRef<ElementRef> | CdkOverlayOrigin | undefined,
  )

Source from the content-addressed store, hash-verified

1137
1138 /** Gets how wide the overlay panel should be. */
1139 private _getOverlayWidth(
1140 preferredOrigin: ElementRef<ElementRef> | CdkOverlayOrigin | undefined,
1141 ): string | number {
1142 if (this.panelWidth === 'auto') {
1143 const refToMeasure =
1144 preferredOrigin instanceof CdkOverlayOrigin
1145 ? preferredOrigin.elementRef
1146 : preferredOrigin || this._elementRef;
1147 return refToMeasure.nativeElement.getBoundingClientRect().width;
1148 }
1149
1150 return this.panelWidth === null ? '' : this.panelWidth;
1151 }
1152 /** Syncs the parent state with the individual options. */
1153 _syncParentProperties(): void {
1154 if (this.options) {

Callers 2

ngOnInitMethod · 0.95
openMethod · 0.95

Calls 1

getBoundingClientRectMethod · 0.80

Tested by

no test coverage detected