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

Method _getOverlayWidth

src/material/select/select.ts:1141–1153  ·  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

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

Callers 2

ngOnInitMethod · 0.95
openMethod · 0.95

Calls 1

getBoundingClientRectMethod · 0.80

Tested by

no test coverage detected