Add hyperlink database column type
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
859b571133
commit
d2bc04803d
@ -0,0 +1,55 @@
|
|||||||
|
import {ICellRendererAngularComp} from 'ag-grid-angular';
|
||||||
|
import {Component, HostListener} from '@angular/core';
|
||||||
|
import {ICellRendererParams} from 'ag-grid-community';
|
||||||
|
import {NavigationService} from '../../../../service/navigation.service';
|
||||||
|
import {NodeTypeIcons} from '../../../../structures/node-types';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'editor-link-renderer',
|
||||||
|
template: `
|
||||||
|
<div (click)="onClick($event)" *ngIf="href" style="display: flex">
|
||||||
|
<div class="text">{{ href }}</div>
|
||||||
|
<div class="btn" [title]="href" (click)="onClick($event, true)">
|
||||||
|
<i class="fa fa-external-link-alt" style="margin-right: 2px;"></i> Open
|
||||||
|
</div>
|
||||||
|
</div>`,
|
||||||
|
styles: [`
|
||||||
|
.text {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
padding-right: 5px;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
`]
|
||||||
|
})
|
||||||
|
export class LinkRendererComponent implements ICellRendererAngularComp {
|
||||||
|
public params: ICellRendererParams;
|
||||||
|
public href?: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
protected readonly nav: NavigationService,
|
||||||
|
) { }
|
||||||
|
|
||||||
|
agInit(params: ICellRendererParams): void {
|
||||||
|
this.params = params;
|
||||||
|
this.href = params.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
onClick(event, force = false) {
|
||||||
|
if ( event.ctrlKey || force ) {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
window.open(this.href, '_blank');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh(params: any): boolean {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue