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'
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>
private screenService: ScreenService
) {}
+ ngAfterViewInit () {
+ setTimeout(() => this.onWindowResize(), 0)
+ }
+
isMenuDisplayed () {
return !!this.showItemsUntilIndexExcluded
}