More scrollbar fixes

This commit is contained in:
Adina Țeudan 2021-11-19 18:13:37 +02:00
parent 1835df954b
commit 6d9d4f4b24

View File

@ -1,6 +1,6 @@
import { AfterViewInit, ChangeDetectionStrategy, Component, forwardRef, Inject, Input, OnDestroy, ViewChild } from '@angular/core'; import { AfterViewInit, ChangeDetectionStrategy, Component, forwardRef, Inject, Input, OnDestroy, ViewChild } from '@angular/core';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import { tap } from 'rxjs/operators'; import { delay, tap } from 'rxjs/operators';
import { AutoUnsubscribe, trackBy } from '../../utils'; import { AutoUnsubscribe, trackBy } from '../../utils';
import { IListable } from '../models'; import { IListable } from '../models';
import { ListingComponent, ListingService } from '../index'; import { ListingComponent, ListingService } from '../index';
@ -39,11 +39,12 @@ export class TableContentComponent<T extends IListable> extends AutoUnsubscribe
ngAfterViewInit(): void { ngAfterViewInit(): void {
this.addSubscription = this.scrollViewport.scrolledIndexChange.pipe(tap(index => (this._lastScrolledIndex = index))).subscribe(); this.addSubscription = this.scrollViewport.scrolledIndexChange.pipe(tap(index => (this._lastScrolledIndex = index))).subscribe();
this.addSubscription = this.listingService.displayedLength$.subscribe(() => { this.addSubscription = this.listingService.displayedLength$
setTimeout(() => { .pipe(
this.hasScrollbarDirective.process(); delay(100),
}, 0); tap(() => this.hasScrollbarDirective.process()),
}); )
.subscribe();
} }
scrollToLastIndex(): void { scrollToLastIndex(): void {