Add new database column type - link to other page
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
0378522e9a
commit
7cb5745dc4
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,14 @@
|
|||||||
|
<ionic-selectable
|
||||||
|
#selectable
|
||||||
|
[items]="pages"
|
||||||
|
itemTextField="name"
|
||||||
|
itemValueField="id"
|
||||||
|
[canSearch]="true"
|
||||||
|
[title]="'Select a page'"
|
||||||
|
[(ngModel)]="value"
|
||||||
|
(onClose)="finishEdit()"
|
||||||
|
>
|
||||||
|
<ng-template ionicSelectableItemTemplate let-port="item" let-isPortSelected="itemIsSelected">
|
||||||
|
<div [ngStyle]="{ marginLeft: (20 * port.level) + 'px' }">{{ port.name }}</div>
|
||||||
|
</ng-template>
|
||||||
|
</ionic-selectable>
|
@ -0,0 +1,44 @@
|
|||||||
|
import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
|
||||||
|
import {ICellEditorParams} from 'ag-grid-community';
|
||||||
|
import {ApiService} from '../../../../../service/api.service';
|
||||||
|
import {IonicSelectableComponent} from "ionic-selectable";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'editor-cel-page-link',
|
||||||
|
templateUrl: './page-link-editor.component.html',
|
||||||
|
styleUrls: ['./page-link-editor.component.scss'],
|
||||||
|
})
|
||||||
|
export class PageLinkEditorComponent implements OnInit {
|
||||||
|
@ViewChild('selectable') selectable: IonicSelectableComponent;
|
||||||
|
public params: ICellEditorParams;
|
||||||
|
public value: any;
|
||||||
|
public pages: any[] = [];
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
public readonly api: ApiService,
|
||||||
|
) { }
|
||||||
|
|
||||||
|
agInit(params: ICellEditorParams): void {
|
||||||
|
this.params = params;
|
||||||
|
this.value = { id: this.params.value };
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
this.pages = params._pagesData || [];
|
||||||
|
|
||||||
|
console.log('page link editor comp', this);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.selectable.open();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue(): any {
|
||||||
|
return this.value.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
async ngOnInit() {}
|
||||||
|
|
||||||
|
finishEdit() {
|
||||||
|
this.params.stopEditing();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue