Skip to content

Commit

Permalink
Fix list overflow when refreshing the page
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Feb 13, 2020
1 parent 72ab1bc commit 68ca619
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions client/src/app/shared/misc/list-overflow.component.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -26,7 +27,7 @@ export interface ListOverflowItem {
styleUrls: [ './list-overflow.component.scss' ],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ListOverflowComponent<T extends ListOverflowItem> {
export class ListOverflowComponent<T extends ListOverflowItem> implements AfterViewInit {
@ViewChild('modal', { static: true }) modal: ElementRef
@ViewChild('itemsParent', { static: true }) parent: ElementRef<HTMLDivElement>
@ViewChildren('itemsRendered') itemsRendered: QueryList<ElementRef>
Expand All @@ -46,6 +47,10 @@ export class ListOverflowComponent<T extends ListOverflowItem> {
private screenService: ScreenService
) {}

ngAfterViewInit () {
setTimeout(() => this.onWindowResize(), 0)
}

isMenuDisplayed () {
return !!this.showItemsUntilIndexExcluded
}
Expand Down

0 comments on commit 68ca619

Please sign in to comment.