From 68ca61941e3a7ca4c018566d2c496afd27dbd76d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 13 Feb 2020 10:41:43 +0100 Subject: Fix list overflow when refreshing the page --- .../src/app/shared/misc/list-overflow.component.ts | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'client') diff --git a/client/src/app/shared/misc/list-overflow.component.ts b/client/src/app/shared/misc/list-overflow.component.ts index 4f92c0f7c..c493ab795 100644 --- a/client/src/app/shared/misc/list-overflow.component.ts +++ b/client/src/app/shared/misc/list-overflow.component.ts @@ -1,17 +1,18 @@ import { + AfterViewInit, + ChangeDetectionStrategy, + ChangeDetectorRef, Component, + ElementRef, + HostListener, Input, + QueryList, TemplateRef, - ViewChildren, ViewChild, - QueryList, - ChangeDetectionStrategy, - ElementRef, - ChangeDetectorRef, - HostListener + ViewChildren } from '@angular/core' -import { NgbModal, NgbDropdown } from '@ng-bootstrap/ng-bootstrap' -import { uniqueId, lowerFirst } from 'lodash-es' +import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { lowerFirst, uniqueId } from 'lodash-es' import { ScreenService } from './screen.service' import { take } from 'rxjs/operators' @@ -26,7 +27,7 @@ export interface ListOverflowItem { styleUrls: [ './list-overflow.component.scss' ], changeDetection: ChangeDetectionStrategy.OnPush }) -export class ListOverflowComponent { +export class ListOverflowComponent implements AfterViewInit { @ViewChild('modal', { static: true }) modal: ElementRef @ViewChild('itemsParent', { static: true }) parent: ElementRef @ViewChildren('itemsRendered') itemsRendered: QueryList @@ -46,6 +47,10 @@ export class ListOverflowComponent { private screenService: ScreenService ) {} + ngAfterViewInit () { + setTimeout(() => this.onWindowResize(), 0) + } + isMenuDisplayed () { return !!this.showItemsUntilIndexExcluded } -- cgit v1.2.3