parent
fd76f43c7e
commit
1eda3d0b30
@ -0,0 +1,6 @@
|
|||||||
|
<ion-list>
|
||||||
|
<ion-item *ngFor="let menuItem of menuItems; let i = index" button (click)="onSelect(menuItems[i].value)">
|
||||||
|
<ion-icon slot="start" [name]="menuItems[i].icon"></ion-icon>
|
||||||
|
<ion-label>{{ menuItems[i].name }}</ion-label>
|
||||||
|
</ion-item>
|
||||||
|
</ion-list>
|
@ -0,0 +1,43 @@
|
|||||||
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
|
import {PopoverController} from '@ionic/angular';
|
||||||
|
import {EditorPage} from '../../../pages/editor/editor.page';
|
||||||
|
import HostRecord from '../../../structures/HostRecord';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'editor-host-options',
|
||||||
|
templateUrl: './host-options.component.html',
|
||||||
|
styleUrls: ['./host-options.component.scss'],
|
||||||
|
})
|
||||||
|
export class HostOptionsComponent implements OnInit {
|
||||||
|
@Input() editor: EditorPage;
|
||||||
|
@Input() index: number;
|
||||||
|
@Input() event: Event;
|
||||||
|
@Input() hostRecord: HostRecord;
|
||||||
|
|
||||||
|
public menuItems: Array<{name: string, icon: string, value: string, type?: string}> = [];
|
||||||
|
protected possibleMenuItems: Array<{name: string, icon: string, value: string, type?: string}> = [
|
||||||
|
{
|
||||||
|
name: 'Delete Node',
|
||||||
|
icon: 'trash',
|
||||||
|
value: 'delete_node',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
protected popover: PopoverController,
|
||||||
|
) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
for ( const item of this.possibleMenuItems ) {
|
||||||
|
if ( !item.type ) {
|
||||||
|
this.menuItems.push(item);
|
||||||
|
} else if ( item.type === this.hostRecord.type ) {
|
||||||
|
this.menuItems.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async onSelect(value) {
|
||||||
|
await this.popover.dismiss(value);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
ion-icon {
|
||||||
|
transition: all 0.2s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
ion-icon.invisible {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
Loading…
Reference in new issue