import * as i0 from '@angular/core'; import { TemplateRef, EventEmitter, ElementRef, OnDestroy, AfterViewInit, QueryList, OnInit } from '@angular/core'; import * as i7 from '@angular/cdk/overlay'; import { OverlayRef, Overlay, ScrollStrategyOptions } from '@angular/cdk/overlay'; import { FocusableOption, FocusOrigin } from '@angular/cdk/a11y'; import * as i6 from '@angular/common'; declare class ContextMenuItemDirective { #private; template: TemplateRef<{ $implicit?: T; }>; /** * Optional subMenu component ref */ subMenu?: ContextMenuComponent; /** * True to make this menu item a divider */ divider: boolean; /** * Is this menu item disabled */ set disabled(disabled: boolean | ((value?: T) => boolean)); get disabled(): boolean; /** * Is this menu item passive (for title) */ passive: boolean; /** * Is this menu item visible */ visible: boolean | ((value?: T) => boolean); /** * Emits event and item */ execute: EventEmitter<{ event: MouseEvent | KeyboardEvent; value?: T; }>; /** * @internal */ value?: T; constructor(template: TemplateRef<{ $implicit?: T; }>); /** * @internal */ triggerExecute(event: MouseEvent | KeyboardEvent, value?: T): void; static ɵfac: i0.ɵɵFactoryDeclaration, [{ optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[contextMenuItem]", never, { "subMenu": { "alias": "subMenu"; "required": false; }; "divider": { "alias": "divider"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "passive": { "alias": "passive"; "required": false; }; "visible": { "alias": "visible"; "required": false; }; }, { "execute": "execute"; }, never, never, false, never>; } declare class ContextMenuOverlaysService { /** * Emits when all context menus are closed */ allClosed: EventEmitter; private stack; /** * Add an item to the stack */ push(value: OverlayRef): void; /** * Clear the whole stack */ closeAll(): void; isEmpty(): boolean; private dispose; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ContextMenuContentItemDirective implements FocusableOption { private elementRef; contextMenuContentItem?: ContextMenuItemDirective; get nativeElement(): HTMLElement; constructor(elementRef: ElementRef); /** * @implements FocusableOption */ focus(origin?: FocusOrigin | undefined): void; /** * @implements FocusableOption */ get disabled(): boolean | undefined; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[contextMenuContentItem]", ["contextMenuContentItem"], { "contextMenuContentItem": { "alias": "contextMenuContentItem"; "required": false; }; }, {}, never, never, false, never>; } declare class ContextMenuContentComponent implements OnDestroy, AfterViewInit { private elementRef; document: Document; private contextMenuOverlaysService; /** * The list of `IContextMenuItemDirective` that represent each menu items */ menuDirectives: ContextMenuItemDirective[]; /** * The item on which the menu act */ value?: T; /** * The orientation of the component * @see https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/dir */ dir: 'ltr' | 'rtl' | undefined; /** * The parent menu of the instance */ parentContextMenu: ContextMenuContentComponent; /** * A CSS class to apply a theme to the the menu */ menuClass: string; /** * Emit when a menu item is selected */ execute: EventEmitter<{ event: MouseEvent | KeyboardEvent; value?: T; menuDirective: ContextMenuItemDirective; }>; /** * Emit when all menus is closed */ close: EventEmitter; /** * @internal */ contextMenuContentItems: QueryList>; /** * Accessibility * * @internal */ role: string; /** * Accessibility * * @internal */ ariaOrientation: string; private focusKeyManager?; private subscription; private activeElement?; constructor(elementRef: ElementRef, document: Document, contextMenuOverlaysService: ContextMenuOverlaysService); /** * @internal */ ngAfterViewInit(): void; /** * @internal */ ngOnDestroy(): void; /** * @internal */ onKeyArrowDownOrUp(event: KeyboardEvent): void; /** * @internal */ onKeyArrowRight(event: KeyboardEvent): void; /** * @internal */ onKeyArrowLeft(event: KeyboardEvent): void; /** * @internal */ onKeyEnterOrSpace(event: KeyboardEvent): void; /** * @internal */ onClickOrRightClick(event: MouseEvent): void; /** * @internal */ hideSubMenus(): void; /** * @internal */ stopEvent(event: MouseEvent): void; /** * @internal */ isMenuItemDisabled(menuItem: ContextMenuItemDirective): boolean; /** * @internal */ isMenuItemVisible(menuItem: ContextMenuContentItemDirective): boolean; /** * @internal */ openSubMenu(subMenu: ContextMenuComponent | undefined, event: MouseEvent | KeyboardEvent): void; /** * @internal */ onMenuItemSelect(menuContentItem: ContextMenuContentItemDirective, event: MouseEvent | KeyboardEvent): void; private triggerExecute; private setupDirectives; private openCloseActiveItemSubMenu; private openActiveItemSubMenu; private closeActiveItemSubMenu; private cancelEvent; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "context-menu-content", never, { "menuDirectives": { "alias": "menuDirectives"; "required": false; }; "value": { "alias": "value"; "required": false; }; "dir": { "alias": "dir"; "required": false; }; "parentContextMenu": { "alias": "parentContextMenu"; "required": false; }; "menuClass": { "alias": "menuClass"; "required": false; }; }, { "execute": "execute"; "close": "close"; }, never, never, false, never>; } interface ContextMenuBaseEvent { anchoredTo: 'position' | 'element'; /** * Optional associated data to the context menu, will be emitted when a menu item is selected */ value?: T; } interface ContextMenuAnchoredToPositionEvent extends ContextMenuBaseEvent { /** * Open the menu to an x/y position */ anchoredTo: 'position'; /** * The horizontal position of the menu */ x: number; /** * The vertical position of the menu */ y: number; } interface ContextMenuAnchoredToElementEvent extends ContextMenuBaseEvent { /** * Open the menu anchored to a DOM element */ anchoredTo: 'element'; /** * The anchor element to display the menu next to */ anchorElement: Element | EventTarget; /** * The parent context menu from which this menu will be displayed */ parentContextMenu: ContextMenuContentComponent; } type ContextMenuOpenEvent = ContextMenuAnchoredToPositionEvent | ContextMenuAnchoredToElementEvent; type IContextMenuContext = ContextMenuOpenEvent & { menuItemDirectives: ContextMenuItemDirective[]; menuClass: string; dir: 'ltr' | 'rtl' | undefined; }; declare class ContextMenuComponent implements OnInit, OnDestroy { #private; private overlay; private scrollStrategy; private contextMenuOverlaysService; /** * A CSS class to apply to the context menu overlay, ideal for theming and custom styling */ menuClass: string; /** * Disable the whole context menu */ disabled: boolean; /** * Whether the menu is oriented to the right (default: `ltr`) or to the right (`rtl`) */ dir: 'ltr' | 'rtl' | undefined; /** * Emit when the menu is opened */ open: EventEmitter>; /** * Emit when the menu is closed */ close: EventEmitter; /** * The menu item directives defined inside the component */ menuItems?: QueryList>; /** * Returns true if the context menu is opened, false otherwise */ get isOpen(): boolean; /** * @internal */ visibleMenuItems: ContextMenuItemDirective[]; /** * @internal */ value?: T; private subscriptions; private overlayRef?; private contextMenuContentComponent?; constructor(overlay: Overlay, scrollStrategy: ScrollStrategyOptions, contextMenuOverlaysService: ContextMenuOverlaysService); /** * @internal */ ngOnInit(): void; /** * @internal */ ngOnDestroy(): void; /** * @internal */ show(event: ContextMenuOpenEvent): void; /** * @internal */ hide(): void; /** * @internal */ openContextMenu(context: IContextMenuContext): void; private attachContextMenu; private getMenuClass; private getDir; private isMenuItemVisible; private setVisibleMenuItems; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "context-menu", never, { "menuClass": { "alias": "menuClass"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "dir": { "alias": "dir"; "required": false; }; }, { "open": "open"; "close": "close"; }, ["menuItems"], never, false, never>; } declare class ContextMenuDirective { private elementRef; private contextMenuOverlaysService; /** * The value related to the context menu */ contextMenuValue: T; /** * The component holding the menu item directive templates */ contextMenu?: ContextMenuComponent; /** * The directive must have a tabindex for being accessible */ tabindex: string | number; /** * Return true if the context menu is opened, false otherwise */ get isOpen(): boolean; constructor(elementRef: ElementRef, contextMenuOverlaysService: ContextMenuOverlaysService); /** * @internal */ onContextMenu(event: MouseEvent): void; /** * @internal */ onKeyArrowEscape(): void; /** * Programmatically open the context menu */ open(event?: MouseEvent): void; /** * Programmatically close the context menu */ close(): void; private closeAll; private canOpen; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[contextMenu]", ["ngxContextMenu"], { "contextMenuValue": { "alias": "contextMenuValue"; "required": false; }; "contextMenu": { "alias": "contextMenu"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; }, {}, never, never, false, never>; } declare class ContextMenuModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } interface ContextMenuOpenAtPositionOptions { /** * Optional associated data to the context menu, will be emitted when a menu item is selected */ value?: T; /** * The horizontal position of the menu */ x: number; /** * The vertical position of the menu */ y: number; } /** * Programmatically open a ContextMenuComponent to a X/Y position */ declare class ContextMenuService { private contextMenuOverlaysService; constructor(contextMenuOverlaysService: ContextMenuOverlaysService); /** * Show the given `ContextMenuComponent` at a specified X/Y position */ show(contextMenu: ContextMenuComponent, options?: ContextMenuOpenAtPositionOptions): void; /** * Close all open `ContextMenuComponent` */ closeAll(): void; /** * Return true if any `ContextMenuComponent` is open */ hasOpenMenu(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; } export { ContextMenuComponent, ContextMenuDirective, ContextMenuItemDirective, ContextMenuModule, ContextMenuService }; export type { ContextMenuOpenEvent };