import { Overlay, ScrollStrategyOptions, OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { EventEmitter, Directive, TemplateRef, ElementRef, Input, Output, InjectionToken, QueryList, Component, ChangeDetectorRef, Optional, Inject, ViewChild, ViewChildren, HostListener, Injectable, ViewEncapsulation, ContentChildren, NgModule } from '@angular/core'; import { Subscription, Subject } from 'rxjs'; import { first } from 'rxjs/operators'; import { ComponentPortal } from '@angular/cdk/portal'; import { ActiveDescendantKeyManager } from '@angular/cdk/a11y'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class ContextMenuItemDirective { /** * @param {?} template * @param {?} elementRef */ constructor(template, elementRef) { this.template = template; this.elementRef = elementRef; this.divider = false; this.enabled = true; this.passive = false; this.visible = true; this.execute = new EventEmitter(); this.isActive = false; } /** * @return {?} */ get disabled() { return this.passive || this.divider || !this.evaluateIfFunction(this.enabled, this.currentItem); } /** * @param {?} value * @param {?} item * @return {?} */ evaluateIfFunction(value, item) { if (value instanceof Function) { return value(item); } return value; } /** * @return {?} */ setActiveStyles() { this.isActive = true; } /** * @return {?} */ setInactiveStyles() { this.isActive = false; } /** * @param {?} item * @param {?=} $event * @return {?} */ triggerExecute(item, $event) { if (!this.evaluateIfFunction(this.enabled, item)) { return; } this.execute.emit({ event: $event, item }); } } ContextMenuItemDirective.decorators = [ { type: Directive, args: [{ /* tslint:disable:directive-selector-type */ selector: '[contextMenuItem]', },] } ]; /** @nocollapse */ ContextMenuItemDirective.ctorParameters = () => [ { type: TemplateRef }, { type: ElementRef } ]; ContextMenuItemDirective.propDecorators = { subMenu: [{ type: Input }], divider: [{ type: Input }], enabled: [{ type: Input }], passive: [{ type: Input }], visible: [{ type: Input }], execute: [{ type: Output }] }; if (false) { /** @type {?} */ ContextMenuItemDirective.prototype.subMenu; /** @type {?} */ ContextMenuItemDirective.prototype.divider; /** @type {?} */ ContextMenuItemDirective.prototype.enabled; /** @type {?} */ ContextMenuItemDirective.prototype.passive; /** @type {?} */ ContextMenuItemDirective.prototype.visible; /** @type {?} */ ContextMenuItemDirective.prototype.execute; /** @type {?} */ ContextMenuItemDirective.prototype.currentItem; /** @type {?} */ ContextMenuItemDirective.prototype.isActive; /** @type {?} */ ContextMenuItemDirective.prototype.template; /** @type {?} */ ContextMenuItemDirective.prototype.elementRef; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const CONTEXT_MENU_OPTIONS = new InjectionToken('CONTEXT_MENU_OPTIONS'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function ILinkConfig() { } if (false) { /** @type {?} */ ILinkConfig.prototype.click; /** @type {?|undefined} */ ILinkConfig.prototype.enabled; /** @type {?} */ ILinkConfig.prototype.html; } /** @type {?} */ const ARROW_LEFT_KEYCODE = 37; class ContextMenuContentComponent { /** * @param {?} changeDetector * @param {?} elementRef * @param {?} options */ constructor(changeDetector, elementRef, options) { this.changeDetector = changeDetector; this.elementRef = elementRef; this.options = options; this.menuItems = []; this.isLeaf = false; this.execute = new EventEmitter(); this.openSubMenu = new EventEmitter(); this.closeLeafMenu = new EventEmitter(); this.closeAllMenus = new EventEmitter(); this.autoFocus = false; this.useBootstrap4 = false; this.subscription = new Subscription(); if (options) { this.autoFocus = options.autoFocus; this.useBootstrap4 = options.useBootstrap4; } } /** * @return {?} */ ngOnInit() { this.menuItems.forEach((/** * @param {?} menuItem * @return {?} */ menuItem => { menuItem.currentItem = this.item; this.subscription.add(menuItem.execute.subscribe((/** * @param {?} event * @return {?} */ event => this.execute.emit(Object.assign({}, event, { menuItem }))))); })); /** @type {?} */ const queryList = new QueryList(); queryList.reset(this.menuItems); this._keyManager = new ActiveDescendantKeyManager(queryList).withWrap(); } /** * @return {?} */ ngAfterViewInit() { if (this.autoFocus) { setTimeout((/** * @return {?} */ () => this.focus())); } this.overlay.updatePosition(); } /** * @return {?} */ ngOnDestroy() { this.subscription.unsubscribe(); } /** * @return {?} */ focus() { if (this.autoFocus) { this.menuElement.nativeElement.focus(); } } /** * @param {?} $event * @return {?} */ stopEvent($event) { $event.stopPropagation(); } /** * @param {?} menuItem * @return {?} */ isMenuItemEnabled(menuItem) { return this.evaluateIfFunction(menuItem && menuItem.enabled); } /** * @param {?} menuItem * @return {?} */ isMenuItemVisible(menuItem) { return this.evaluateIfFunction(menuItem && menuItem.visible); } /** * @param {?} value * @return {?} */ evaluateIfFunction(value) { if (value instanceof Function) { return value(this.item); } return value; } /** * @param {?} link * @return {?} */ isDisabled(link) { return link.enabled && !link.enabled(this.item); } /** * @param {?} event * @return {?} */ onKeyEvent(event) { if (!this.isLeaf) { return; } this._keyManager.onKeydown(event); } /** * @param {?=} event * @return {?} */ keyboardOpenSubMenu(event) { if (!this.isLeaf) { return; } this.cancelEvent(event); /** @type {?} */ const menuItem = this.menuItems[this._keyManager.activeItemIndex]; if (menuItem) { this.onOpenSubMenu(menuItem); } } /** * @param {?=} event * @return {?} */ keyboardMenuItemSelect(event) { if (!this.isLeaf) { return; } this.cancelEvent(event); /** @type {?} */ const menuItem = this.menuItems[this._keyManager.activeItemIndex]; if (menuItem) { this.onMenuItemSelect(menuItem, event); } } /** * @param {?} event * @return {?} */ onCloseLeafMenu(event) { if (!this.isLeaf) { return; } this.cancelEvent(event); this.closeLeafMenu.emit({ exceptRootMenu: event.keyCode === ARROW_LEFT_KEYCODE, event }); } /** * @param {?} event * @return {?} */ closeMenu(event) { if (event.type === 'click' && event.button === 2) { return; } this.closeAllMenus.emit({ event }); } /** * @param {?} menuItem * @param {?=} event * @return {?} */ onOpenSubMenu(menuItem, event) { /** @type {?} */ const anchorElementRef = this.menuItemElements.toArray()[this._keyManager.activeItemIndex]; /** @type {?} */ const anchorElement = anchorElementRef && anchorElementRef.nativeElement; this.openSubMenu.emit({ anchorElement, contextMenu: menuItem.subMenu, event, item: this.item, parentContextMenu: this }); } /** * @param {?} menuItem * @param {?} event * @return {?} */ onMenuItemSelect(menuItem, event) { event.preventDefault(); event.stopPropagation(); this.onOpenSubMenu(menuItem, event); if (!menuItem.subMenu) { menuItem.triggerExecute(this.item, event); } } /** * @private * @param {?} event * @return {?} */ cancelEvent(event) { if (!event) { return; } /** @type {?} */ const target = event.target; if (['INPUT', 'TEXTAREA', 'SELECT'].indexOf(target.tagName) > -1 || target.isContentEditable) { return; } event.preventDefault(); event.stopPropagation(); } } ContextMenuContentComponent.decorators = [ { type: Component, args: [{ selector: 'context-menu-content', template: ` `, styles: [` .passive { display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: @line-height-base; white-space: nowrap; } .hasSubMenu:before { content: '\u25B6'; float: right; } `] }] } ]; /** @nocollapse */ ContextMenuContentComponent.ctorParameters = () => [ { type: ChangeDetectorRef }, { type: ElementRef }, { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [CONTEXT_MENU_OPTIONS,] }] } ]; ContextMenuContentComponent.propDecorators = { menuItems: [{ type: Input }], item: [{ type: Input }], event: [{ type: Input }], parentContextMenu: [{ type: Input }], menuClass: [{ type: Input }], overlay: [{ type: Input }], isLeaf: [{ type: Input }], execute: [{ type: Output }], openSubMenu: [{ type: Output }], closeLeafMenu: [{ type: Output }], closeAllMenus: [{ type: Output }], menuElement: [{ type: ViewChild, args: ['menu', { static: true },] }], menuItemElements: [{ type: ViewChildren, args: ['li',] }], onKeyEvent: [{ type: HostListener, args: ['window:keydown.ArrowDown', ['$event'],] }, { type: HostListener, args: ['window:keydown.ArrowUp', ['$event'],] }], keyboardOpenSubMenu: [{ type: HostListener, args: ['window:keydown.ArrowRight', ['$event'],] }], keyboardMenuItemSelect: [{ type: HostListener, args: ['window:keydown.Enter', ['$event'],] }, { type: HostListener, args: ['window:keydown.Space', ['$event'],] }], onCloseLeafMenu: [{ type: HostListener, args: ['window:keydown.Escape', ['$event'],] }, { type: HostListener, args: ['window:keydown.ArrowLeft', ['$event'],] }], closeMenu: [{ type: HostListener, args: ['document:click', ['$event'],] }, { type: HostListener, args: ['document:contextmenu', ['$event'],] }] }; if (false) { /** @type {?} */ ContextMenuContentComponent.prototype.menuItems; /** @type {?} */ ContextMenuContentComponent.prototype.item; /** @type {?} */ ContextMenuContentComponent.prototype.event; /** @type {?} */ ContextMenuContentComponent.prototype.parentContextMenu; /** @type {?} */ ContextMenuContentComponent.prototype.menuClass; /** @type {?} */ ContextMenuContentComponent.prototype.overlay; /** @type {?} */ ContextMenuContentComponent.prototype.isLeaf; /** @type {?} */ ContextMenuContentComponent.prototype.execute; /** @type {?} */ ContextMenuContentComponent.prototype.openSubMenu; /** @type {?} */ ContextMenuContentComponent.prototype.closeLeafMenu; /** @type {?} */ ContextMenuContentComponent.prototype.closeAllMenus; /** @type {?} */ ContextMenuContentComponent.prototype.menuElement; /** @type {?} */ ContextMenuContentComponent.prototype.menuItemElements; /** @type {?} */ ContextMenuContentComponent.prototype.autoFocus; /** @type {?} */ ContextMenuContentComponent.prototype.useBootstrap4; /** * @type {?} * @private */ ContextMenuContentComponent.prototype._keyManager; /** * @type {?} * @private */ ContextMenuContentComponent.prototype.subscription; /** * @type {?} * @private */ ContextMenuContentComponent.prototype.changeDetector; /** * @type {?} * @private */ ContextMenuContentComponent.prototype.elementRef; /** * @type {?} * @private */ ContextMenuContentComponent.prototype.options; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function IContextMenuClickEvent() { } if (false) { /** @type {?|undefined} */ IContextMenuClickEvent.prototype.anchorElement; /** @type {?|undefined} */ IContextMenuClickEvent.prototype.contextMenu; /** @type {?|undefined} */ IContextMenuClickEvent.prototype.event; /** @type {?|undefined} */ IContextMenuClickEvent.prototype.parentContextMenu; /** @type {?} */ IContextMenuClickEvent.prototype.item; /** @type {?|undefined} */ IContextMenuClickEvent.prototype.activeMenuItemIndex; } /** * @record */ function IContextMenuContext() { } if (false) { /** @type {?} */ IContextMenuContext.prototype.menuItems; /** @type {?} */ IContextMenuContext.prototype.menuClass; } /** * @record */ function CloseLeafMenuEvent() { } if (false) { /** @type {?|undefined} */ CloseLeafMenuEvent.prototype.exceptRootMenu; /** @type {?|undefined} */ CloseLeafMenuEvent.prototype.event; } /** * @record */ function OverlayRefWithContextMenu() { } if (false) { /** @type {?|undefined} */ OverlayRefWithContextMenu.prototype.contextMenu; } /** * @record */ function CancelContextMenuEvent() { } if (false) { /** @type {?} */ CancelContextMenuEvent.prototype.eventType; /** @type {?|undefined} */ CancelContextMenuEvent.prototype.event; } /** * @record */ function ExecuteContextMenuEvent() { } if (false) { /** @type {?} */ ExecuteContextMenuEvent.prototype.eventType; /** @type {?|undefined} */ ExecuteContextMenuEvent.prototype.event; /** @type {?} */ ExecuteContextMenuEvent.prototype.item; /** @type {?} */ ExecuteContextMenuEvent.prototype.menuItem; } class ContextMenuService { /** * @param {?} overlay * @param {?} scrollStrategy */ constructor(overlay, scrollStrategy) { this.overlay = overlay; this.scrollStrategy = scrollStrategy; this.isDestroyingLeafMenu = false; this.show = new Subject(); this.triggerClose = new Subject(); this.close = new Subject(); this.overlays = []; this.fakeElement = { getBoundingClientRect: (/** * @return {?} */ () => ({ bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, })) }; } /** * @param {?} context * @return {?} */ openContextMenu(context) { const { anchorElement, event, parentContextMenu } = context; if (!parentContextMenu) { /** @type {?} */ const mouseEvent = (/** @type {?} */ (event)); this.fakeElement.getBoundingClientRect = (/** * @return {?} */ () => ({ bottom: mouseEvent.clientY, height: 0, left: mouseEvent.clientX, right: mouseEvent.clientX, top: mouseEvent.clientY, width: 0, })); this.closeAllContextMenus({ eventType: 'cancel', event }); /** @type {?} */ const positionStrategy = this.overlay.position().connectedTo(new ElementRef(anchorElement || this.fakeElement), { originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'top' }) .withFallbackPosition({ originX: 'start', originY: 'top' }, { overlayX: 'start', overlayY: 'bottom' }) .withFallbackPosition({ originX: 'end', originY: 'top' }, { overlayX: 'start', overlayY: 'top' }) .withFallbackPosition({ originX: 'start', originY: 'top' }, { overlayX: 'end', overlayY: 'top' }) .withFallbackPosition({ originX: 'end', originY: 'center' }, { overlayX: 'start', overlayY: 'center' }) .withFallbackPosition({ originX: 'start', originY: 'center' }, { overlayX: 'end', overlayY: 'center' }); this.overlays = [this.overlay.create({ positionStrategy, panelClass: 'ngx-contextmenu', scrollStrategy: this.scrollStrategy.close(), })]; this.attachContextMenu(this.overlays[0], context); } else { /** @type {?} */ const positionStrategy = this.overlay.position().connectedTo(new ElementRef(event ? event.target : anchorElement), { originX: 'end', originY: 'top' }, { overlayX: 'start', overlayY: 'top' }) .withFallbackPosition({ originX: 'start', originY: 'top' }, { overlayX: 'end', overlayY: 'top' }) .withFallbackPosition({ originX: 'end', originY: 'bottom' }, { overlayX: 'start', overlayY: 'bottom' }) .withFallbackPosition({ originX: 'start', originY: 'bottom' }, { overlayX: 'end', overlayY: 'bottom' }); /** @type {?} */ const newOverlay = this.overlay.create({ positionStrategy, panelClass: 'ngx-contextmenu', scrollStrategy: this.scrollStrategy.close(), }); this.destroySubMenus(parentContextMenu); this.overlays = this.overlays.concat(newOverlay); this.attachContextMenu(newOverlay, context); } } /** * @param {?} overlay * @param {?} context * @return {?} */ attachContextMenu(overlay, context) { const { event, item, menuItems, menuClass } = context; /** @type {?} */ const contextMenuContent = overlay.attach(new ComponentPortal(ContextMenuContentComponent)); contextMenuContent.instance.event = event; contextMenuContent.instance.item = item; contextMenuContent.instance.menuItems = menuItems; contextMenuContent.instance.overlay = overlay; contextMenuContent.instance.isLeaf = true; contextMenuContent.instance.menuClass = menuClass; ((/** @type {?} */ (overlay))).contextMenu = contextMenuContent.instance; /** @type {?} */ const subscriptions = new Subscription(); subscriptions.add(contextMenuContent.instance.execute.asObservable() .subscribe((/** * @param {?} executeEvent * @return {?} */ (executeEvent) => this.closeAllContextMenus(Object.assign({ eventType: 'execute' }, executeEvent))))); subscriptions.add(contextMenuContent.instance.closeAllMenus.asObservable() .subscribe((/** * @param {?} closeAllEvent * @return {?} */ (closeAllEvent) => this.closeAllContextMenus(Object.assign({ eventType: 'cancel' }, closeAllEvent))))); subscriptions.add(contextMenuContent.instance.closeLeafMenu.asObservable() .subscribe((/** * @param {?} closeLeafMenuEvent * @return {?} */ closeLeafMenuEvent => this.destroyLeafMenu(closeLeafMenuEvent)))); subscriptions.add(contextMenuContent.instance.openSubMenu.asObservable() .subscribe((/** * @param {?} subMenuEvent * @return {?} */ (subMenuEvent) => { this.destroySubMenus(contextMenuContent.instance); if (!subMenuEvent.contextMenu) { contextMenuContent.instance.isLeaf = true; return; } contextMenuContent.instance.isLeaf = false; this.show.next(subMenuEvent); }))); contextMenuContent.onDestroy((/** * @return {?} */ () => { menuItems.forEach((/** * @param {?} menuItem * @return {?} */ menuItem => menuItem.isActive = false)); subscriptions.unsubscribe(); })); contextMenuContent.changeDetectorRef.detectChanges(); } /** * @param {?} closeEvent * @return {?} */ closeAllContextMenus(closeEvent) { if (this.overlays) { this.close.next(closeEvent); this.overlays.forEach((/** * @param {?} overlay * @param {?} index * @return {?} */ (overlay, index) => { overlay.detach(); overlay.dispose(); })); } this.overlays = []; } /** * @return {?} */ getLastAttachedOverlay() { /** @type {?} */ let overlay = this.overlays[this.overlays.length - 1]; while (this.overlays.length > 1 && overlay && !overlay.hasAttached()) { overlay.detach(); overlay.dispose(); this.overlays = this.overlays.slice(0, -1); overlay = this.overlays[this.overlays.length - 1]; } return overlay; } /** * @param {?=} __0 * @return {?} */ destroyLeafMenu({ exceptRootMenu, event } = {}) { if (this.isDestroyingLeafMenu) { return; } this.isDestroyingLeafMenu = true; setTimeout((/** * @return {?} */ () => { /** @type {?} */ const overlay = this.getLastAttachedOverlay(); if (this.overlays.length > 1 && overlay) { overlay.detach(); overlay.dispose(); } if (!exceptRootMenu && this.overlays.length > 0 && overlay) { this.close.next({ eventType: 'cancel', event }); overlay.detach(); overlay.dispose(); } /** @type {?} */ const newLeaf = this.getLastAttachedOverlay(); if (newLeaf) { newLeaf.contextMenu.isLeaf = true; } this.isDestroyingLeafMenu = false; })); } /** * @param {?} contextMenu * @return {?} */ destroySubMenus(contextMenu) { /** @type {?} */ const overlay = contextMenu.overlay; /** @type {?} */ const index = this.overlays.indexOf(overlay); this.overlays.slice(index + 1).forEach((/** * @param {?} subMenuOverlay * @return {?} */ subMenuOverlay => { subMenuOverlay.detach(); subMenuOverlay.dispose(); })); } /** * @param {?} contextMenuContent * @return {?} */ isLeafMenu(contextMenuContent) { /** @type {?} */ const overlay = this.getLastAttachedOverlay(); return contextMenuContent.overlay === overlay; } } ContextMenuService.decorators = [ { type: Injectable } ]; /** @nocollapse */ ContextMenuService.ctorParameters = () => [ { type: Overlay }, { type: ScrollStrategyOptions } ]; if (false) { /** @type {?} */ ContextMenuService.prototype.isDestroyingLeafMenu; /** @type {?} */ ContextMenuService.prototype.show; /** @type {?} */ ContextMenuService.prototype.triggerClose; /** @type {?} */ ContextMenuService.prototype.close; /** * @type {?} * @private */ ContextMenuService.prototype.contextMenuContent; /** * @type {?} * @private */ ContextMenuService.prototype.overlays; /** * @type {?} * @private */ ContextMenuService.prototype.fakeElement; /** * @type {?} * @private */ ContextMenuService.prototype.overlay; /** * @type {?} * @private */ ContextMenuService.prototype.scrollStrategy; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function ILinkConfig$1() { } if (false) { /** @type {?} */ ILinkConfig$1.prototype.click; /** @type {?|undefined} */ ILinkConfig$1.prototype.enabled; /** @type {?} */ ILinkConfig$1.prototype.html; } /** * @record */ function MouseLocation() { } if (false) { /** @type {?|undefined} */ MouseLocation.prototype.left; /** @type {?|undefined} */ MouseLocation.prototype.marginLeft; /** @type {?|undefined} */ MouseLocation.prototype.marginTop; /** @type {?|undefined} */ MouseLocation.prototype.top; } class ContextMenuComponent { /** * @param {?} _contextMenuService * @param {?} changeDetector * @param {?} elementRef * @param {?} options */ constructor(_contextMenuService, changeDetector, elementRef, options) { this._contextMenuService = _contextMenuService; this.changeDetector = changeDetector; this.elementRef = elementRef; this.options = options; this.menuClass = ""; this.autoFocus = false; this.useBootstrap4 = false; this.disabled = false; this.close = new EventEmitter(); this.open = new EventEmitter(); this.visibleMenuItems = []; this.links = []; this.subscription = new Subscription(); if (options) { this.autoFocus = options.autoFocus; this.useBootstrap4 = options.useBootstrap4; } this.subscription.add(_contextMenuService.show.subscribe((/** * @param {?} menuEvent * @return {?} */ menuEvent => { this.onMenuEvent(menuEvent); }))); } /** * @return {?} */ ngOnDestroy() { this.subscription.unsubscribe(); } /** * @param {?} menuEvent * @return {?} */ onMenuEvent(menuEvent) { if (this.disabled) { return; } const { contextMenu, event, item } = menuEvent; if (contextMenu && contextMenu !== this) { return; } this.event = event; this.item = item; this.setVisibleMenuItems(); this._contextMenuService.openContextMenu(Object.assign({}, menuEvent, { menuItems: this.visibleMenuItems, menuClass: this.menuClass })); this._contextMenuService.close.asObservable().pipe(first()).subscribe((/** * @param {?} closeEvent * @return {?} */ closeEvent => this.close.emit(closeEvent))); this.open.next(menuEvent); } /** * @param {?} menuItem * @return {?} */ isMenuItemVisible(menuItem) { return this.evaluateIfFunction(menuItem.visible); } /** * @return {?} */ setVisibleMenuItems() { this.visibleMenuItems = this.menuItems.filter((/** * @param {?} menuItem * @return {?} */ menuItem => this.isMenuItemVisible(menuItem))); } /** * @param {?} value * @return {?} */ evaluateIfFunction(value) { if (value instanceof Function) { return value(this.item); } return value; } } ContextMenuComponent.decorators = [ { type: Component, args: [{ encapsulation: ViewEncapsulation.None, selector: 'context-menu', template: ` `, styles: [` .cdk-overlay-container { position: fixed; z-index: 1000; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; } .ngx-contextmenu.cdk-overlay-pane { position: absolute; pointer-events: auto; box-sizing: border-box; } `] }] } ]; /** @nocollapse */ ContextMenuComponent.ctorParameters = () => [ { type: ContextMenuService }, { type: ChangeDetectorRef }, { type: ElementRef }, { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [CONTEXT_MENU_OPTIONS,] }] } ]; ContextMenuComponent.propDecorators = { menuClass: [{ type: Input }], autoFocus: [{ type: Input }], useBootstrap4: [{ type: Input }], disabled: [{ type: Input }], close: [{ type: Output }], open: [{ type: Output }], menuItems: [{ type: ContentChildren, args: [ContextMenuItemDirective,] }], menuElement: [{ type: ViewChild, args: ['menu', { static: false },] }] }; if (false) { /** @type {?} */ ContextMenuComponent.prototype.menuClass; /** @type {?} */ ContextMenuComponent.prototype.autoFocus; /** @type {?} */ ContextMenuComponent.prototype.useBootstrap4; /** @type {?} */ ContextMenuComponent.prototype.disabled; /** @type {?} */ ContextMenuComponent.prototype.close; /** @type {?} */ ContextMenuComponent.prototype.open; /** @type {?} */ ContextMenuComponent.prototype.menuItems; /** @type {?} */ ContextMenuComponent.prototype.menuElement; /** @type {?} */ ContextMenuComponent.prototype.visibleMenuItems; /** @type {?} */ ContextMenuComponent.prototype.links; /** @type {?} */ ContextMenuComponent.prototype.item; /** @type {?} */ ContextMenuComponent.prototype.event; /** * @type {?} * @private */ ContextMenuComponent.prototype.subscription; /** * @type {?} * @private */ ContextMenuComponent.prototype._contextMenuService; /** * @type {?} * @private */ ContextMenuComponent.prototype.changeDetector; /** * @type {?} * @private */ ContextMenuComponent.prototype.elementRef; /** * @type {?} * @private */ ContextMenuComponent.prototype.options; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class ContextMenuAttachDirective { /** * @param {?} contextMenuService */ constructor(contextMenuService) { this.contextMenuService = contextMenuService; } /** * @param {?} event * @return {?} */ onContextMenu(event) { if (!this.contextMenu.disabled) { this.contextMenuService.show.next({ contextMenu: this.contextMenu, event, item: this.contextMenuSubject, }); event.preventDefault(); event.stopPropagation(); } } } ContextMenuAttachDirective.decorators = [ { type: Directive, args: [{ selector: '[contextMenu]', },] } ]; /** @nocollapse */ ContextMenuAttachDirective.ctorParameters = () => [ { type: ContextMenuService } ]; ContextMenuAttachDirective.propDecorators = { contextMenuSubject: [{ type: Input }], contextMenu: [{ type: Input }], onContextMenu: [{ type: HostListener, args: ['contextmenu', ['$event'],] }] }; if (false) { /** @type {?} */ ContextMenuAttachDirective.prototype.contextMenuSubject; /** @type {?} */ ContextMenuAttachDirective.prototype.contextMenu; /** * @type {?} * @private */ ContextMenuAttachDirective.prototype.contextMenuService; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class ContextMenuModule { /** * @param {?=} options * @return {?} */ static forRoot(options) { return { ngModule: ContextMenuModule, providers: [ ContextMenuService, { provide: CONTEXT_MENU_OPTIONS, useValue: options, }, ], }; } } ContextMenuModule.decorators = [ { type: NgModule, args: [{ declarations: [ ContextMenuAttachDirective, ContextMenuComponent, ContextMenuContentComponent, ContextMenuItemDirective, ], entryComponents: [ ContextMenuContentComponent, ], exports: [ ContextMenuAttachDirective, ContextMenuComponent, ContextMenuItemDirective, ], imports: [ CommonModule, OverlayModule, ], },] } ]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function IContextMenuOptions() { } if (false) { /** @type {?|undefined} */ IContextMenuOptions.prototype.useBootstrap4; /** @type {?|undefined} */ IContextMenuOptions.prototype.autoFocus; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { ContextMenuComponent, ContextMenuModule, ContextMenuService, ContextMenuAttachDirective as ɵa, ContextMenuItemDirective as ɵb, CONTEXT_MENU_OPTIONS as ɵc, ContextMenuContentComponent as ɵd }; //# sourceMappingURL=ngx-contextmenu.js.map