Skip to content

Commit

Permalink
fix(module:datepicker): range-picker reposition browser compatibility (
Browse files Browse the repository at this point in the history
  • Loading branch information
hsuanxyz authored and vthinkxie committed Feb 22, 2018
1 parent 776a642 commit 6035c27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/datepicker/nz-rangepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,11 @@ export class NzRangePickerComponent implements ControlValueAccessor, OnInit {
if (typeof window !== 'undefined' && this._open && this._cdkOverlay && this._cdkOverlay.overlayRef) {
const originElement = this._cdkOverlay.origin.elementRef.nativeElement;
const overlayElement = this._cdkOverlay.overlayRef.overlayElement;
const originX = originElement.getBoundingClientRect().x;
const originX = originElement.getBoundingClientRect().left;
const overlayWidth = overlayElement.getBoundingClientRect().width;
const margin = window.innerWidth - originX - overlayWidth;
this._offsetX = margin > 0 ? 0 : margin - (measureScrollbar() || 15);
const offsetX = margin > 0 ? 0 : margin - (measureScrollbar() || 15);
this._offsetX = Number.isFinite(offsetX) ? offsetX : 0;
this._cdr.detectChanges();
}
}
Expand Down

0 comments on commit 6035c27

Please sign in to comment.