primeng
Version:
[](https://badge.fury.io/js/primeng) [](https://www.npmjs.com/package/primeng) [ • 6.34 kB
TypeScript
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, QueryList, Renderer2, TemplateRef } from '@angular/core';
import { ContextMenuService, MenuItem, PrimeNGConfig, PrimeTemplate } from 'primeng/api';
import { Subject, Subscription } from 'rxjs';
import { Nullable, VoidListener } from 'primeng/ts-helpers';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/router";
import * as i3 from "primeng/ripple";
import * as i4 from "primeng/tooltip";
import * as i5 from "primeng/api";
import * as i6 from "primeng/icons/angleright";
export declare class ContextMenuSub {
item: MenuItem | undefined;
root: boolean | undefined;
parentItemKey: any;
leafClick: EventEmitter<any>;
sublistViewChild: ElementRef | undefined;
menuitemViewChild: ElementRef | undefined;
contextMenu: ContextMenu;
activeItemKey: Nullable<string>;
hideTimeout: any;
activeItemKeyChangeSubscription: Subscription | undefined;
constructor(contextMenu: ContextMenu);
ngOnInit(): void;
onItemMouseEnter(event: Event, item: MenuItem, key: string): void;
onItemMouseLeave(event: MouseEvent, item: MenuItem): void;
onItemClick(event: MouseEvent, item: MenuItem, menuitem: Element, key: string): void;
onLeafClick(): void;
getKey(index: number): string;
isActive(key: string): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuSub, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuSub, "p-contextMenuSub", never, { "item": { "alias": "item"; "required": false; }; "root": { "alias": "root"; "required": false; }; "parentItemKey": { "alias": "parentItemKey"; "required": false; }; }, { "leafClick": "leafClick"; }, never, never, false, never>;
}
export declare class ContextMenu implements AfterViewInit, OnDestroy {
private document;
el: ElementRef;
renderer: Renderer2;
cd: ChangeDetectorRef;
zone: NgZone;
contextMenuService: ContextMenuService;
private config;
/**
* An array of menuitems.
* @group Props
*/
model: MenuItem[] | undefined;
/**
* Attaches the menu to document instead of a particular item.
* @group Props
*/
global: boolean | undefined;
/**
* Local template variable name of the element to attach the context menu.
* @group Props
*/
target: HTMLElement | string | undefined;
/**
* Inline style of the element.
* @group Props
*/
style: {
[klass: string]: any;
} | null | undefined;
/**
* Class of the element.
* @group Props
*/
styleClass: string | undefined;
/**
* Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
* @group Props
*/
appendTo: HTMLElement | ElementRef | TemplateRef<any> | string | null | undefined | any;
/**
* Whether to automatically manage layering.
* @group Props
*/
autoZIndex: boolean;
/**
* Base zIndex value to use in layering.
* @group Props
*/
baseZIndex: number;
/**
* Event for which the menu must be displayed.
* @group Props
*/
triggerEvent: string;
/**
* Displays the popup menu.
* @group Emits
*/
onShow: EventEmitter<any>;
/**
* Hides the popup menu.
* @group Emits
*/
onHide: EventEmitter<any>;
containerViewChild: ElementRef | undefined;
documentClickListener: VoidListener;
documentTriggerListener: VoidListener;
documentKeydownListener: VoidListener;
windowResizeListener: VoidListener;
triggerEventListener: VoidListener;
ngDestroy$: Subject<unknown>;
preventDocumentDefault: boolean;
private window;
templates: QueryList<PrimeTemplate> | undefined;
submenuIconTemplate: TemplateRef<any> | undefined;
constructor(document: Document, el: ElementRef, renderer: Renderer2, cd: ChangeDetectorRef, zone: NgZone, contextMenuService: ContextMenuService, config: PrimeNGConfig);
ngAfterViewInit(): void;
show(event?: MouseEvent): void;
hide(): void;
moveOnTop(): void;
toggle(event?: MouseEvent): void;
position(event?: MouseEvent): void;
positionSubmenu(sublist: HTMLElement): void;
isItemMatched(menuitem: Element): boolean;
findNextItem(menuitem: Element, isRepeated?: boolean): any;
findPrevItem(menuitem: Element, isRepeated?: boolean): any;
getActiveItem(): any;
clearActiveItem(): void;
removeActiveFromSubLists(el: Element): void;
removeActiveFromSublist(menuitem: MenuItem): void;
bindGlobalListeners(): void;
findModelItemFromKey(key: string): any;
handleItemClick(event: Event, item: any, menuitem: any): void;
unbindGlobalListeners(): void;
onWindowResize(): void;
isOutsideClicked(event: Event): boolean;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenu, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenu, "p-contextMenu", never, { "model": { "alias": "model"; "required": false; }; "global": { "alias": "global"; "required": false; }; "target": { "alias": "target"; "required": false; }; "style": { "alias": "style"; "required": false; }; "styleClass": { "alias": "styleClass"; "required": false; }; "appendTo": { "alias": "appendTo"; "required": false; }; "autoZIndex": { "alias": "autoZIndex"; "required": false; }; "baseZIndex": { "alias": "baseZIndex"; "required": false; }; "triggerEvent": { "alias": "triggerEvent"; "required": false; }; }, { "onShow": "onShow"; "onHide": "onHide"; }, ["templates"], never, false, never>;
}
export declare class ContextMenuModule {
static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<ContextMenuModule, [typeof ContextMenu, typeof ContextMenuSub], [typeof i1.CommonModule, typeof i2.RouterModule, typeof i3.RippleModule, typeof i4.TooltipModule, typeof i5.SharedModule, typeof i6.AngleRightIcon], [typeof ContextMenu, typeof i2.RouterModule, typeof i4.TooltipModule, typeof i5.SharedModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<ContextMenuModule>;
}