[MNT-25681] Content node selector panel filtering fixed (#12032)

* [MNT-25681] Content node selector panel filtering fixed

* [MNT-25681] Small cleanup

* [MNT-25681] CR fix
This commit is contained in:
Michal Kinas
2026-07-03 16:41:39 +02:00
committed by GitHub
parent 18e602aa85
commit 448e667c52
5 changed files with 106 additions and 27 deletions
@@ -38,8 +38,12 @@ export class InfiniteSelectScrollDirective implements AfterViewInit {
ngAfterViewInit() {
this.matSelect.openedChange.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((opened: boolean) => {
if (opened) {
this.itemHeightToWaitBeforeLoadNext = this.getItemHeight() * (InfiniteSelectScrollDirective.MAX_ITEMS / 2);
this.matSelect.panel.nativeElement.addEventListener('scroll', (event: Event) => this.handleScrollEvent(event));
setTimeout(() => {
if (this.matSelect.panel?.nativeElement) {
this.itemHeightToWaitBeforeLoadNext = this.getItemHeight() * (InfiniteSelectScrollDirective.MAX_ITEMS / 2);
this.matSelect.panel.nativeElement.addEventListener('scroll', (event: Event) => this.handleScrollEvent(event));
}
});
}
});
}
@@ -56,6 +60,7 @@ export class InfiniteSelectScrollDirective implements AfterViewInit {
}
private getItemHeight(): number {
return parseFloat(getComputedStyle(this.matSelect.panel.nativeElement).fontSize || '0') * SELECT_ITEM_HEIGHT_EM;
const panelElement = this.matSelect.panel?.nativeElement;
return panelElement ? parseFloat(getComputedStyle(panelElement).fontSize || '0') * SELECT_ITEM_HEIGHT_EM : 0;
}
}