You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
import {ICellRendererAngularComp} from 'ag-grid-angular';
|
|
import {Component, HostListener} from '@angular/core';
|
|
import {ICellRendererParams} from 'ag-grid-community';
|
|
import {NavigationService} from '../../../../service/navigation.service';
|
|
|
|
@Component({
|
|
selector: 'editor-page-link-renderer',
|
|
template: `
|
|
<div title="Control-click to open this page" (click)="onClick($event)">
|
|
<i class="fa fa-sticky-note" style="margin-right: 5px; color: var(--noded-background-note);"></i> {{ pageTitle }}
|
|
</div>`,
|
|
})
|
|
export class PageLinkRendererComponent implements ICellRendererAngularComp {
|
|
public params: ICellRendererParams;
|
|
public pageId?: string;
|
|
public pageTitle?: string;
|
|
|
|
constructor(
|
|
protected readonly nav: NavigationService,
|
|
) { }
|
|
|
|
agInit(params: ICellRendererParams): void {
|
|
this.params = params;
|
|
this.pageId = params.value;
|
|
|
|
// @ts-ignore
|
|
const page = params._pagesData.find(x => x.id === this.pageId);
|
|
if ( page ) {
|
|
this.pageTitle = page.name;
|
|
}
|
|
}
|
|
|
|
// @HostListener('click', ['@event.target'])
|
|
onClick(event) {
|
|
if ( event.ctrlKey ) {
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
this.nav.requestNavigation(this.pageId);
|
|
}
|
|
}
|
|
|
|
refresh(params: any): boolean {
|
|
return false;
|
|
}
|
|
}
|