@dotglitch/ngx-ctx-menu
Version:
Angular context menu that works with templates
61 lines (60 loc) • 1.98 kB
TypeScript
import { ViewContainerRef, AfterViewInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ContextMenuItem } from './types';
import * as i0 from "@angular/core";
export type NgxAppMenuTriggers = "click" | "dblclick" | "hover" | "contextmenu";
export type NgxAppMenuOptions = Partial<{
/**
* Position relative to the element the menu pops-up at.
*/
position: "top" | "right" | "bottom" | "left";
/**
* How the popup is aligned relative to the element.
*/
alignment: "center" | "beforestart" | "start" | "end" | "afterend";
/**
* @hidden
* WIP:
* Show an error from the dialog pointing to the element.
*/
showArrow: boolean;
/**
* @hidden
* WIP:
* Size of the arrow.
*/
arrowSize: number;
/**
* How much padding to add near the edges of the screen.
*/
edgePadding: number;
/**
* Which event should trigger the app menu.
*/
trigger: NgxAppMenuTriggers | NgxAppMenuTriggers[];
/**
* A list of custom classes to add to the dialog popups.
*/
customClass: string[];
}>;
export declare class NgxAppMenuDirective implements AfterViewInit {
private dialog;
private viewContainer;
/**
* The items that will be bound to the menu.
*/
menuItems: ContextMenuItem[];
/**
* The data representing the item the context-menu was opened for.
*/
data: any;
/**
* Configuration for opening the app menu
*/
config: NgxAppMenuOptions;
constructor(dialog: MatDialog, viewContainer: ViewContainerRef);
ngAfterViewInit(): void;
private openDialog;
static ɵfac: i0.ɵɵFactoryDeclaration<NgxAppMenuDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxAppMenuDirective, "[ngx-app-menu]", never, { "menuItems": "ngx-app-menu"; "data": "ngx-app-menu-context"; "config": "ngx-app-menu-config"; }, {}, never, never, true, never>;
}