diff --git a/src/lib/listing/table-content/table-content.component.html b/src/lib/listing/table-content/table-content.component.html index ea8775c..f8ace0a 100644 --- a/src/lib/listing/table-content/table-content.component.html +++ b/src/lib/listing/table-content/table-content.component.html @@ -17,7 +17,7 @@ [class.help-mode-active]="helpModeService?.isHelpModeActive$ | async" [id]="'item-' + entity.id" [ngClass]="getTableItemClasses(entity)" - [routerLink]="entity.routerLink | tenant" + (click)="initiateNavigation(entity.routerLink)" > , PrimaryK private _lastScrolledIndex = 0; private _multiSelectActive$ = new BehaviorSubject(false); + readonly #navigationEvents = new BehaviorSubject(''); + readonly #tenantsService = inject(TenantsService); + readonly #router = inject(Router); constructor( @Inject(forwardRef(() => ListingComponent)) readonly listingComponent: ListingComponent, @@ -42,6 +48,16 @@ export class TableContentComponent, PrimaryK this.scrollViewport?.checkViewportSize(); }, 0); }); + this.#navigationEvents + .asObservable() + .pipe( + filter(Boolean), + throttleTime(1000), + switchMap(route => this.#router.navigateByUrl(route)), + takeUntilDestroyed(), + ) + // eslint-disable-next-line rxjs/no-ignored-subscription + .subscribe(); } multiSelect(entity: Class, $event: MouseEvent): void { @@ -93,4 +109,9 @@ export class TableContentComponent, PrimaryK private _disableMultiSelect() { this._multiSelectActive$.next(false); } + + initiateNavigation(routerLink: string | undefined) { + if (!routerLink) return; + this.#navigationEvents.next('/' + this.#tenantsService.activeTenantId + routerLink); + } }