diff --git a/src/lib/listing/table-content/table-content.component.html b/src/lib/listing/table-content/table-content.component.html index 25772de..6185939 100644 --- a/src/lib/listing/table-content/table-content.component.html +++ b/src/lib/listing/table-content/table-content.component.html @@ -1,20 +1,20 @@ -
+
- +
void, - lastScrolledIndex: number, - hasScrollbarDirective: () => void, - noContent: boolean, - sortedDisplayedEntities: any[], - isHelpModeActive: boolean, -} - @Component({ selector: 'iqser-table-content', templateUrl: './table-content.component.html', styleUrls: ['./table-content.component.scss'], }) -export class TableContentComponent extends ContextComponent implements AfterViewInit { +export class TableContentComponent extends AutoUnsubscribe implements OnDestroy, AfterViewInit { @Input() itemSize!: number; @Input() itemMouseEnterFn?: (entity: T) => void; @Input() itemMouseLeaveFn?: (entity: T) => void; @@ -37,18 +28,17 @@ export class TableContentComponent extends ContextComponent private _lastScrolledIndex = 0; private _multiSelectActive$ = new BehaviorSubject(false); - readonly #checkViewportSize$ = this.listingComponent.noContent$.pipe(tap(() => { - setTimeout(() => { - this.scrollViewport?.checkViewportSize(); - }, 0); - })); - constructor( @Inject(forwardRef(() => ListingComponent)) readonly listingComponent: ListingComponent, readonly listingService: ListingService, readonly helpModeService: HelpModeService, ) { super(); + this.addSubscription = this.listingComponent.noContent$.subscribe(() => { + setTimeout(() => { + this.scrollViewport?.checkViewportSize(); + }, 0); + }); } multiSelect(entity: T, $event: MouseEvent): void { @@ -59,21 +49,13 @@ export class TableContentComponent extends ContextComponent } ngAfterViewInit(): void { - const lastScrolledIndex$ = this.scrollViewport.scrolledIndexChange.pipe(tap(index => (this._lastScrolledIndex = index))) - const hasScrollbarDirective$ = this.listingService.displayedLength$ + this.addSubscription = this.scrollViewport.scrolledIndexChange.pipe(tap(index => (this._lastScrolledIndex = index))).subscribe(); + this.addSubscription = this.listingService.displayedLength$ .pipe( delay(100), tap(() => this.hasScrollbarDirective.process()), ) - - super._initContext({ - checkViewportSize: this.#checkViewportSize$, - lastScrolledIndex: lastScrolledIndex$, - hasScrollbarDirective: hasScrollbarDirective$, - noContent: this.listingComponent.noContent$, - sortedDisplayedEntities: this.listingComponent.sortedDisplayedEntities$, - isHelpModeActive: this.helpModeService.isHelpModeActive$, - }) + .subscribe(); } scrollToLastIndex(): void {