blob: b6c9f1c9b1aad415dcec70a5fc245c0be1630150 [file] [log] [blame]
{"version":3,"file":"menu.js","sources":["../../../../../../src/material/menu/menu-animations.ts","../../../../../../src/material/menu/menu-content.ts","../../../../../../src/material/menu/menu-errors.ts","../../../../../../src/material/menu/menu-panel.ts","../../../../../../src/material/menu/menu-item.ts","../../../../../../src/material/menu/menu.ts","../../../../../../src/material/menu/menu-trigger.ts","../../../../../../src/material/menu/menu-module.ts","../../../../../../src/material/menu/menu-positions.ts","../../../../../../src/material/menu/public-api.ts","../../../../../../src/material/menu/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport{\n trigger,\n state,\n style,\n animate,\n transition,\n AnimationTriggerMetadata,\n} from '@angular/animations';\n\n/**\n * Animations used by the mat-menu component.\n * Animation duration and timing values are based on:\n * https://material.io/guidelines/components/menus.html#menus-usage\n * @docs-private\n */\nexport const matMenuAnimations: {\n readonly transformMenu: AnimationTriggerMetadata;\n readonly fadeInItems: AnimationTriggerMetadata;\n} = {\n /**\n * This animation controls the menu panel's entry and exit from the page.\n *\n * When the menu panel is added to the DOM, it scales in and fades in its border.\n *\n * When the menu panel is removed from the DOM, it simply fades out after a brief\n * delay to display the ripple.\n */\n transformMenu: trigger('transformMenu', [\n state('void', style({\n opacity: 0,\n transform: 'scale(0.8)'\n })),\n transition('void => enter', animate('120ms cubic-bezier(0, 0, 0.2, 1)', style({\n opacity: 1,\n transform: 'scale(1)'\n }))),\n transition('* => void', animate('100ms 25ms linear', style({opacity: 0})))\n ]),\n\n\n /**\n * This animation fades in the background color and content of the menu panel\n * after its containing element is scaled in.\n */\n fadeInItems: trigger('fadeInItems', [\n // TODO(crisbeto): this is inside the `transformMenu`\n // now. Remove next time we do breaking changes.\n state('showing', style({opacity: 1})),\n transition('void => *', [\n style({opacity: 0}),\n animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')\n ])\n ])\n};\n\n/**\n * @deprecated\n * @breaking-change 8.0.0\n * @docs-private\n */\nexport const fadeInItems = matMenuAnimations.fadeInItems;\n\n/**\n * @deprecated\n * @breaking-change 8.0.0\n * @docs-private\n */\nexport const transformMenu = matMenuAnimations.transformMenu;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {DomPortalOutlet, TemplatePortal} from '@angular/cdk/portal';\nimport {DOCUMENT} from '@angular/common';\nimport {\n ApplicationRef,\n ChangeDetectorRef,\n ComponentFactoryResolver,\n Directive,\n Inject,\n InjectionToken,\n Injector,\n OnDestroy,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport {Subject} from 'rxjs';\n\n/**\n * Injection token that can be used to reference instances of `MatMenuContent`. It serves\n * as alternative token to the actual `MatMenuContent` class which could cause unnecessary\n * retention of the class and its directive metadata.\n */\nexport const MAT_MENU_CONTENT = new InjectionToken<MatMenuContent>('MatMenuContent');\n\n/**\n * Menu content that will be rendered lazily once the menu is opened.\n */\n@Directive({\n selector: 'ng-template[matMenuContent]',\n providers: [{provide: MAT_MENU_CONTENT, useExisting: MatMenuContent}],\n})\nexport class MatMenuContent implements OnDestroy {\n private _portal: TemplatePortal<any>;\n private _outlet: DomPortalOutlet;\n\n /** Emits when the menu content has been attached. */\n _attached = new Subject<void>();\n\n constructor(\n private _template: TemplateRef<any>,\n private _componentFactoryResolver: ComponentFactoryResolver,\n private _appRef: ApplicationRef,\n private _injector: Injector,\n private _viewContainerRef: ViewContainerRef,\n @Inject(DOCUMENT) private _document: any,\n private _changeDetectorRef?: ChangeDetectorRef) {}\n\n /**\n * Attaches the content with a particular context.\n * @docs-private\n */\n attach(context: any = {}) {\n if (!this._portal) {\n this._portal = new TemplatePortal(this._template, this._viewContainerRef);\n }\n\n this.detach();\n\n if (!this._outlet) {\n this._outlet = new DomPortalOutlet(this._document.createElement('div'),\n this._componentFactoryResolver, this._appRef, this._injector);\n }\n\n const element: HTMLElement = this._template.elementRef.nativeElement;\n\n // Because we support opening the same menu from different triggers (which in turn have their\n // own `OverlayRef` panel), we have to re-insert the host element every time, otherwise we\n // risk it staying attached to a pane that's no longer in the DOM.\n element.parentNode!.insertBefore(this._outlet.outletElement, element);\n\n // When `MatMenuContent` is used in an `OnPush` component, the insertion of the menu\n // content via `createEmbeddedView` does not cause the content to be seen as \"dirty\"\n // by Angular. This causes the `@ContentChildren` for menu items within the menu to\n // not be updated by Angular. By explicitly marking for check here, we tell Angular that\n // it needs to check for new menu items and update the `@ContentChild` in `MatMenu`.\n // @breaking-change 9.0.0 Make change detector ref required\n if (this._changeDetectorRef) {\n this._changeDetectorRef.markForCheck();\n }\n\n this._portal.attach(this._outlet, context);\n this._attached.next();\n }\n\n /**\n * Detaches the content.\n * @docs-private\n */\n detach() {\n if (this._portal.isAttached) {\n this._portal.detach();\n }\n }\n\n ngOnDestroy() {\n if (this._outlet) {\n this._outlet.dispose();\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * Throws an exception for the case when menu trigger doesn't have a valid mat-menu instance\n * @docs-private\n */\nexport function throwMatMenuMissingError() {\n throw Error(`matMenuTriggerFor: must pass in an mat-menu instance.\n\n Example:\n <mat-menu #menu=\"matMenu\"></mat-menu>\n <button [matMenuTriggerFor]=\"menu\"></button>`);\n}\n\n/**\n * Throws an exception for the case when menu's x-position value isn't valid.\n * In other words, it doesn't match 'before' or 'after'.\n * @docs-private\n */\nexport function throwMatMenuInvalidPositionX() {\n throw Error(`xPosition value must be either 'before' or after'.\n Example: <mat-menu xPosition=\"before\" #menu=\"matMenu\"></mat-menu>`);\n}\n\n/**\n * Throws an exception for the case when menu's y-position value isn't valid.\n * In other words, it doesn't match 'above' or 'below'.\n * @docs-private\n */\nexport function throwMatMenuInvalidPositionY() {\n throw Error(`yPosition value must be either 'above' or below'.\n Example: <mat-menu yPosition=\"above\" #menu=\"matMenu\"></mat-menu>`);\n}\n\n\n/**\n * Throws an exception for the case when a menu is assigned\n * to a trigger that is placed inside the same menu.\n * @docs-private\n */\nexport function throwMatMenuRecursiveError() {\n throw Error(`matMenuTriggerFor: menu cannot contain its own trigger. Assign a menu that is ` +\n `not a parent of the trigger or move the trigger outside of the menu.`);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {EventEmitter, TemplateRef, InjectionToken} from '@angular/core';\nimport {MenuPositionX, MenuPositionY} from './menu-positions';\nimport {Direction} from '@angular/cdk/bidi';\nimport {FocusOrigin} from '@angular/cdk/a11y';\nimport {MatMenuContent} from './menu-content';\n\n/**\n * Injection token used to provide the parent menu to menu-specific components.\n * @docs-private\n */\nexport const MAT_MENU_PANEL = new InjectionToken<MatMenuPanel>('MAT_MENU_PANEL');\n\n/**\n * Interface for a custom menu panel that can be used with `matMenuTriggerFor`.\n * @docs-private\n */\nexport interface MatMenuPanel<T = any> {\n xPosition: MenuPositionX;\n yPosition: MenuPositionY;\n overlapTrigger: boolean;\n templateRef: TemplateRef<any>;\n close: EventEmitter<void | 'click' | 'keydown' | 'tab'>;\n parentMenu?: MatMenuPanel | undefined;\n direction?: Direction;\n focusFirstItem: (origin?: FocusOrigin) => void;\n resetActiveItem: () => void;\n setPositionClasses?: (x: MenuPositionX, y: MenuPositionY) => void;\n setElevation?(depth: number): void;\n lazyContent?: MatMenuContent;\n backdropClass?: string;\n overlayPanelClass?: string|string[];\n hasBackdrop?: boolean;\n readonly panelId?: string;\n\n /**\n * @deprecated To be removed.\n * @breaking-change 8.0.0\n */\n addItem?: (item: T) => void;\n\n /**\n * @deprecated To be removed.\n * @breaking-change 8.0.0\n */\n removeItem?: (item: T) => void;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {FocusableOption, FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';\nimport {BooleanInput} from '@angular/cdk/coercion';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n ViewEncapsulation,\n Inject,\n Optional,\n Input,\n HostListener,\n AfterViewInit,\n} from '@angular/core';\nimport {\n CanDisable, CanDisableCtor,\n CanDisableRipple, CanDisableRippleCtor,\n mixinDisabled,\n mixinDisableRipple,\n} from '@angular/material/core';\nimport {Subject} from 'rxjs';\nimport {DOCUMENT} from '@angular/common';\nimport {MAT_MENU_PANEL, MatMenuPanel} from './menu-panel';\n\n// Boilerplate for applying mixins to MatMenuItem.\n/** @docs-private */\nclass MatMenuItemBase {}\nconst _MatMenuItemMixinBase: CanDisableRippleCtor & CanDisableCtor & typeof MatMenuItemBase =\n mixinDisableRipple(mixinDisabled(MatMenuItemBase));\n\n/**\n * Single item inside of a `mat-menu`. Provides the menu item styling and accessibility treatment.\n */\n@Component({\n selector: '[mat-menu-item]',\n exportAs: 'matMenuItem',\n inputs: ['disabled', 'disableRipple'],\n host: {\n '[attr.role]': 'role',\n '[class.mat-menu-item]': 'true',\n '[class.mat-menu-item-highlighted]': '_highlighted',\n '[class.mat-menu-item-submenu-trigger]': '_triggersSubmenu',\n '[attr.tabindex]': '_getTabIndex()',\n '[attr.aria-disabled]': 'disabled.toString()',\n '[attr.disabled]': 'disabled || null',\n 'class': 'mat-focus-indicator',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: 'menu-item.html',\n})\nexport class MatMenuItem extends _MatMenuItemMixinBase\n implements FocusableOption, CanDisable, CanDisableRipple, AfterViewInit, OnDestroy {\n\n /** ARIA role for the menu item. */\n @Input() role: 'menuitem' | 'menuitemradio' | 'menuitemcheckbox' = 'menuitem';\n\n /** Stream that emits when the menu item is hovered. */\n readonly _hovered: Subject<MatMenuItem> = new Subject<MatMenuItem>();\n\n /** Stream that emits when the menu item is focused. */\n readonly _focused = new Subject<MatMenuItem>();\n\n /** Whether the menu item is highlighted. */\n _highlighted: boolean = false;\n\n /** Whether the menu item acts as a trigger for a sub-menu. */\n _triggersSubmenu: boolean = false;\n\n constructor(\n private _elementRef: ElementRef<HTMLElement>,\n /**\n * @deprecated `_document` parameter is no longer being used and will be removed.\n * @breaking-change 12.0.0\n */\n @Inject(DOCUMENT) _document?: any,\n private _focusMonitor?: FocusMonitor,\n @Inject(MAT_MENU_PANEL) @Optional() public _parentMenu?: MatMenuPanel<MatMenuItem>) {\n\n // @breaking-change 8.0.0 make `_focusMonitor` and `document` required params.\n super();\n\n if (_parentMenu && _parentMenu.addItem) {\n _parentMenu.addItem(this);\n }\n }\n\n /** Focuses the menu item. */\n focus(origin?: FocusOrigin, options?: FocusOptions): void {\n if (this._focusMonitor && origin) {\n this._focusMonitor.focusVia(this._getHostElement(), origin, options);\n } else {\n this._getHostElement().focus(options);\n }\n\n this._focused.next(this);\n }\n\n ngAfterViewInit() {\n if (this._focusMonitor) {\n // Start monitoring the element so it gets the appropriate focused classes. We want\n // to show the focus style for menu items only when the focus was not caused by a\n // mouse or touch interaction.\n this._focusMonitor.monitor(this._elementRef, false);\n }\n }\n\n ngOnDestroy() {\n if (this._focusMonitor) {\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n if (this._parentMenu && this._parentMenu.removeItem) {\n this._parentMenu.removeItem(this);\n }\n\n this._hovered.complete();\n this._focused.complete();\n }\n\n /** Used to set the `tabindex`. */\n _getTabIndex(): string {\n return this.disabled ? '-1' : '0';\n }\n\n /** Returns the host DOM element. */\n _getHostElement(): HTMLElement {\n return this._elementRef.nativeElement;\n }\n\n /** Prevents the default element actions if it is disabled. */\n // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.\n // In Ivy the `host` bindings will be merged when this class is extended, whereas in\n // ViewEngine they're overwritten.\n // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.\n // tslint:disable-next-line:no-host-decorator-in-concrete\n @HostListener('click', ['$event'])\n _checkDisabled(event: Event): void {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /** Emits to the hover stream. */\n // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.\n // In Ivy the `host` bindings will be merged when this class is extended, whereas in\n // ViewEngine they're overwritten.\n // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.\n // tslint:disable-next-line:no-host-decorator-in-concrete\n @HostListener('mouseenter')\n _handleMouseEnter() {\n this._hovered.next(this);\n }\n\n /** Gets the label to be used when determining whether the option should be focused. */\n getLabel(): string {\n const clone = this._elementRef.nativeElement.cloneNode(true) as HTMLElement;\n const icons = clone.querySelectorAll('mat-icon, .material-icons');\n\n // Strip away icons so they don't show up in the text.\n for (let i = 0; i < icons.length; i++) {\n const icon = icons[i];\n icon.parentNode?.removeChild(icon);\n }\n\n return clone.textContent?.trim() || '';\n }\n\n static ngAcceptInputType_disabled: BooleanInput;\n static ngAcceptInputType_disableRipple: BooleanInput;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {FocusKeyManager, FocusOrigin} from '@angular/cdk/a11y';\nimport {Direction} from '@angular/cdk/bidi';\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n ESCAPE,\n LEFT_ARROW,\n RIGHT_ARROW,\n DOWN_ARROW,\n UP_ARROW,\n hasModifierKey,\n} from '@angular/cdk/keycodes';\nimport {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n ContentChildren,\n Directive,\n ElementRef,\n EventEmitter,\n Inject,\n InjectionToken,\n Input,\n NgZone,\n OnDestroy,\n Output,\n TemplateRef,\n QueryList,\n ViewChild,\n ViewEncapsulation,\n OnInit,\n} from '@angular/core';\nimport {merge, Observable, Subject, Subscription} from 'rxjs';\nimport {startWith, switchMap, take} from 'rxjs/operators';\nimport {matMenuAnimations} from './menu-animations';\nimport {MAT_MENU_CONTENT, MatMenuContent} from './menu-content';\nimport {MenuPositionX, MenuPositionY} from './menu-positions';\nimport {throwMatMenuInvalidPositionX, throwMatMenuInvalidPositionY} from './menu-errors';\nimport {MatMenuItem} from './menu-item';\nimport {MAT_MENU_PANEL, MatMenuPanel} from './menu-panel';\nimport {AnimationEvent} from '@angular/animations';\n\n/** Default `mat-menu` options that can be overridden. */\nexport interface MatMenuDefaultOptions {\n /** The x-axis position of the menu. */\n xPosition: MenuPositionX;\n\n /** The y-axis position of the menu. */\n yPosition: MenuPositionY;\n\n /** Whether the menu should overlap the menu trigger. */\n overlapTrigger: boolean;\n\n /** Class to be applied to the menu's backdrop. */\n backdropClass: string;\n\n /** Class or list of classes to be applied to the menu's overlay panel. */\n overlayPanelClass?: string | string[];\n\n /** Whether the menu has a backdrop. */\n hasBackdrop?: boolean;\n}\n\n/** Injection token to be used to override the default options for `mat-menu`. */\nexport const MAT_MENU_DEFAULT_OPTIONS =\n new InjectionToken<MatMenuDefaultOptions>('mat-menu-default-options', {\n providedIn: 'root',\n factory: MAT_MENU_DEFAULT_OPTIONS_FACTORY\n });\n\n/** @docs-private */\nexport function MAT_MENU_DEFAULT_OPTIONS_FACTORY(): MatMenuDefaultOptions {\n return {\n overlapTrigger: false,\n xPosition: 'after',\n yPosition: 'below',\n backdropClass: 'cdk-overlay-transparent-backdrop',\n };\n}\n/**\n * Start elevation for the menu panel.\n * @docs-private\n */\nconst MAT_MENU_BASE_ELEVATION = 4;\n\nlet menuPanelUid = 0;\n\n\n/** Reason why the menu was closed. */\nexport type MenuCloseReason = void | 'click' | 'keydown' | 'tab';\n\n\n/** Base class with all of the `MatMenu` functionality. */\n@Directive()\nexport class _MatMenuBase implements AfterContentInit, MatMenuPanel<MatMenuItem>, OnInit,\n OnDestroy {\n private _keyManager: FocusKeyManager<MatMenuItem>;\n private _xPosition: MenuPositionX = this._defaultOptions.xPosition;\n private _yPosition: MenuPositionY = this._defaultOptions.yPosition;\n private _previousElevation: string;\n\n /** All items inside the menu. Includes items nested inside another menu. */\n @ContentChildren(MatMenuItem, {descendants: true}) _allItems: QueryList<MatMenuItem>;\n\n /** Only the direct descendant menu items. */\n private _directDescendantItems = new QueryList<MatMenuItem>();\n\n /** Subscription to tab events on the menu panel */\n private _tabSubscription = Subscription.EMPTY;\n\n /** Config object to be passed into the menu's ngClass */\n _classList: {[key: string]: boolean} = {};\n\n /** Current state of the panel animation. */\n _panelAnimationState: 'void' | 'enter' = 'void';\n\n /** Emits whenever an animation on the menu completes. */\n _animationDone = new Subject<AnimationEvent>();\n\n /** Whether the menu is animating. */\n _isAnimating: boolean;\n\n /** Parent menu of the current menu panel. */\n parentMenu: MatMenuPanel | undefined;\n\n /** Layout direction of the menu. */\n direction: Direction;\n\n /** Class or list of classes to be added to the overlay panel. */\n overlayPanelClass: string|string[] = this._defaultOptions.overlayPanelClass || '';\n\n /** Class to be added to the backdrop element. */\n @Input() backdropClass: string = this._defaultOptions.backdropClass;\n\n /** aria-label for the menu panel. */\n @Input('aria-label') ariaLabel: string;\n\n /** aria-labelledby for the menu panel. */\n @Input('aria-labelledby') ariaLabelledby: string;\n\n /** aria-describedby for the menu panel. */\n @Input('aria-describedby') ariaDescribedby: string;\n\n /** Position of the menu in the X axis. */\n @Input()\n get xPosition(): MenuPositionX { return this._xPosition; }\n set xPosition(value: MenuPositionX) {\n if (value !== 'before' && value !== 'after' &&\n (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throwMatMenuInvalidPositionX();\n }\n this._xPosition = value;\n this.setPositionClasses();\n }\n\n /** Position of the menu in the Y axis. */\n @Input()\n get yPosition(): MenuPositionY { return this._yPosition; }\n set yPosition(value: MenuPositionY) {\n if (value !== 'above' && value !== 'below' && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throwMatMenuInvalidPositionY();\n }\n this._yPosition = value;\n this.setPositionClasses();\n }\n\n /** @docs-private */\n @ViewChild(TemplateRef) templateRef: TemplateRef<any>;\n\n /**\n * List of the items inside of a menu.\n * @deprecated\n * @breaking-change 8.0.0\n */\n @ContentChildren(MatMenuItem, {descendants: false}) items: QueryList<MatMenuItem>;\n\n /**\n * Menu content that will be rendered lazily.\n * @docs-private\n */\n @ContentChild(MAT_MENU_CONTENT) lazyContent: MatMenuContent;\n\n /** Whether the menu should overlap its trigger. */\n @Input()\n get overlapTrigger(): boolean { return this._overlapTrigger; }\n set overlapTrigger(value: boolean) {\n this._overlapTrigger = coerceBooleanProperty(value);\n }\n private _overlapTrigger: boolean = this._defaultOptions.overlapTrigger;\n\n /** Whether the menu has a backdrop. */\n @Input()\n get hasBackdrop(): boolean | undefined { return this._hasBackdrop; }\n set hasBackdrop(value: boolean | undefined) {\n this._hasBackdrop = coerceBooleanProperty(value);\n }\n private _hasBackdrop: boolean | undefined = this._defaultOptions.hasBackdrop;\n\n /**\n * This method takes classes set on the host mat-menu element and applies them on the\n * menu template that displays in the overlay container. Otherwise, it's difficult\n * to style the containing menu from outside the component.\n * @param classes list of class names\n */\n @Input('class')\n set panelClass(classes: string) {\n const previousPanelClass = this._previousPanelClass;\n\n if (previousPanelClass && previousPanelClass.length) {\n previousPanelClass.split(' ').forEach((className: string) => {\n this._classList[className] = false;\n });\n }\n\n this._previousPanelClass = classes;\n\n if (classes && classes.length) {\n classes.split(' ').forEach((className: string) => {\n this._classList[className] = true;\n });\n\n this._elementRef.nativeElement.className = '';\n }\n }\n private _previousPanelClass: string;\n\n /**\n * This method takes classes set on the host mat-menu element and applies them on the\n * menu template that displays in the overlay container. Otherwise, it's difficult\n * to style the containing menu from outside the component.\n * @deprecated Use `panelClass` instead.\n * @breaking-change 8.0.0\n */\n @Input()\n get classList(): string { return this.panelClass; }\n set classList(classes: string) { this.panelClass = classes; }\n\n /** Event emitted when the menu is closed. */\n @Output() readonly closed: EventEmitter<MenuCloseReason> = new EventEmitter<MenuCloseReason>();\n\n /**\n * Event emitted when the menu is closed.\n * @deprecated Switch to `closed` instead\n * @breaking-change 8.0.0\n */\n @Output() close: EventEmitter<MenuCloseReason> = this.closed;\n\n readonly panelId = `mat-menu-panel-${menuPanelUid++}`;\n\n constructor(\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone,\n @Inject(MAT_MENU_DEFAULT_OPTIONS) private _defaultOptions: MatMenuDefaultOptions) { }\n\n ngOnInit() {\n this.setPositionClasses();\n }\n\n ngAfterContentInit() {\n this._updateDirectDescendants();\n this._keyManager = new FocusKeyManager(this._directDescendantItems)\n .withWrap()\n .withTypeAhead()\n .withHomeAndEnd();\n this._tabSubscription = this._keyManager.tabOut.subscribe(() => this.closed.emit('tab'));\n\n // If a user manually (programmatically) focuses a menu item, we need to reflect that focus\n // change back to the key manager. Note that we don't need to unsubscribe here because _focused\n // is internal and we know that it gets completed on destroy.\n this._directDescendantItems.changes.pipe(\n startWith(this._directDescendantItems),\n switchMap(items => merge<MatMenuItem>(...items.map((item: MatMenuItem) => item._focused)))\n ).subscribe(focusedItem => this._keyManager.updateActiveItem(focusedItem));\n }\n\n ngOnDestroy() {\n this._directDescendantItems.destroy();\n this._tabSubscription.unsubscribe();\n this.closed.complete();\n }\n\n /** Stream that emits whenever the hovered menu item changes. */\n _hovered(): Observable<MatMenuItem> {\n // Coerce the `changes` property because Angular types it as `Observable<any>`\n const itemChanges = this._directDescendantItems.changes as Observable<QueryList<MatMenuItem>>;\n return itemChanges.pipe(\n startWith(this._directDescendantItems),\n switchMap(items => merge(...items.map((item: MatMenuItem) => item._hovered)))\n ) as Observable<MatMenuItem>;\n }\n\n /*\n * Registers a menu item with the menu.\n * @docs-private\n * @deprecated No longer being used. To be removed.\n * @breaking-change 9.0.0\n */\n addItem(_item: MatMenuItem) {}\n\n /**\n * Removes an item from the menu.\n * @docs-private\n * @deprecated No longer being used. To be removed.\n * @breaking-change 9.0.0\n */\n removeItem(_item: MatMenuItem) {}\n\n /** Handle a keyboard event from the menu, delegating to the appropriate action. */\n _handleKeydown(event: KeyboardEvent) {\n const keyCode = event.keyCode;\n const manager = this._keyManager;\n\n switch (keyCode) {\n case ESCAPE:\n if (!hasModifierKey(event)) {\n event.preventDefault();\n this.closed.emit('keydown');\n }\n break;\n case LEFT_ARROW:\n if (this.parentMenu && this.direction === 'ltr') {\n this.closed.emit('keydown');\n }\n break;\n case RIGHT_ARROW:\n if (this.parentMenu && this.direction === 'rtl') {\n this.closed.emit('keydown');\n }\n break;\n default:\n if (keyCode === UP_ARROW || keyCode === DOWN_ARROW) {\n manager.setFocusOrigin('keyboard');\n }\n\n manager.onKeydown(event);\n }\n }\n\n /**\n * Focus the first item in the menu.\n * @param origin Action from which the focus originated. Used to set the correct styling.\n */\n focusFirstItem(origin: FocusOrigin = 'program'): void {\n // When the content is rendered lazily, it takes a bit before the items are inside the DOM.\n if (this.lazyContent) {\n this._ngZone.onStable\n .pipe(take(1))\n .subscribe(() => this._focusFirstItem(origin));\n } else {\n this._focusFirstItem(origin);\n }\n }\n\n /**\n * Actual implementation that focuses the first item. Needs to be separated\n * out so we don't repeat the same logic in the public `focusFirstItem` method.\n */\n private _focusFirstItem(origin: FocusOrigin) {\n const manager = this._keyManager;\n\n manager.setFocusOrigin(origin).setFirstItemActive();\n\n // If there's no active item at this point, it means that all the items are disabled.\n // Move focus to the menu panel so keyboard events like Escape still work. Also this will\n // give _some_ feedback to screen readers.\n if (!manager.activeItem && this._directDescendantItems.length) {\n let element = this._directDescendantItems.first._getHostElement().parentElement;\n\n // Because the `mat-menu` is at the DOM insertion point, not inside the overlay, we don't\n // have a nice way of getting a hold of the menu panel. We can't use a `ViewChild` either\n // because the panel is inside an `ng-template`. We work around it by starting from one of\n // the items and walking up the DOM.\n while (element) {\n if (element.getAttribute('role') === 'menu') {\n element.focus();\n break;\n } else {\n element = element.parentElement;\n }\n }\n }\n }\n\n /**\n * Resets the active item in the menu. This is used when the menu is opened, allowing\n * the user to start from the first option when pressing the down arrow.\n */\n resetActiveItem() {\n this._keyManager.setActiveItem(-1);\n }\n\n /**\n * Sets the menu panel elevation.\n * @param depth Number of parent menus that come before the menu.\n */\n setElevation(depth: number): void {\n // The elevation starts at the base and increases by one for each level.\n // Capped at 24 because that's the maximum elevation defined in the Material design spec.\n const elevation = Math.min(MAT_MENU_BASE_ELEVATION + depth, 24);\n const newElevation = `mat-elevation-z${elevation}`;\n const customElevation = Object.keys(this._classList).find(c => c.startsWith('mat-elevation-z'));\n\n if (!customElevation || customElevation === this._previousElevation) {\n if (this._previousElevation) {\n this._classList[this._previousElevation] = false;\n }\n\n this._classList[newElevation] = true;\n this._previousElevation = newElevation;\n }\n }\n\n /**\n * Adds classes to the menu panel based on its position. Can be used by\n * consumers to add specific styling based on the position.\n * @param posX Position of the menu along the x axis.\n * @param posY Position of the menu along the y axis.\n * @docs-private\n */\n setPositionClasses(posX: MenuPositionX = this.xPosition, posY: MenuPositionY = this.yPosition) {\n const classes = this._classList;\n classes['mat-menu-before'] = posX === 'before';\n classes['mat-menu-after'] = posX === 'after';\n classes['mat-menu-above'] = posY === 'above';\n classes['mat-menu-below'] = posY === 'below';\n }\n\n /** Starts the enter animation. */\n _startAnimation() {\n // @breaking-change 8.0.0 Combine with _resetAnimation.\n this._panelAnimationState = 'enter';\n }\n\n /** Resets the panel animation to its initial state. */\n _resetAnimation() {\n // @breaking-change 8.0.0 Combine with _startAnimation.\n this._panelAnimationState = 'void';\n }\n\n /** Callback that is invoked when the panel animation completes. */\n _onAnimationDone(event: AnimationEvent) {\n this._animationDone.next(event);\n this._isAnimating = false;\n }\n\n _onAnimationStart(event: AnimationEvent) {\n this._isAnimating = true;\n\n // Scroll the content element to the top as soon as the animation starts. This is necessary,\n // because we move focus to the first item while it's still being animated, which can throw\n // the browser off when it determines the scroll position. Alternatively we can move focus\n // when the animation is done, however moving focus asynchronously will interrupt screen\n // readers which are in the process of reading out the menu already. We take the `element`\n // from the `event` since we can't use a `ViewChild` to access the pane.\n if (event.toState === 'enter' && this._keyManager.activeItemIndex === 0) {\n event.element.scrollTop = 0;\n }\n }\n\n /**\n * Sets up a stream that will keep track of any newly-added menu items and will update the list\n * of direct descendants. We collect the descendants this way, because `_allItems` can include\n * items that are part of child menus, and using a custom way of registering items is unreliable\n * when it comes to maintaining the item order.\n */\n private _updateDirectDescendants() {\n this._allItems.changes\n .pipe(startWith(this._allItems))\n .subscribe((items: QueryList<MatMenuItem>) => {\n this._directDescendantItems.reset(items.filter(item => item._parentMenu === this));\n this._directDescendantItems.notifyOnChanges();\n });\n }\n\n static ngAcceptInputType_overlapTrigger: BooleanInput;\n static ngAcceptInputType_hasBackdrop: BooleanInput;\n}\n\n/** @docs-public MatMenu */\n@Component({\n selector: 'mat-menu',\n templateUrl: 'menu.html',\n styleUrls: ['menu.css'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n exportAs: 'matMenu',\n host: {\n '[attr.aria-label]': 'null',\n '[attr.aria-labelledby]': 'null',\n '[attr.aria-describedby]': 'null',\n },\n animations: [\n matMenuAnimations.transformMenu,\n matMenuAnimations.fadeInItems\n ],\n providers: [\n {provide: MAT_MENU_PANEL, useExisting: MatMenu},\n ]\n})\nexport class MatMenu extends _MatMenuBase {\n constructor(elementRef: ElementRef<HTMLElement>, ngZone: NgZone,\n @Inject(MAT_MENU_DEFAULT_OPTIONS) defaultOptions: MatMenuDefaultOptions) {\n super(elementRef, ngZone, defaultOptions);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n FocusMonitor,\n FocusOrigin,\n isFakeMousedownFromScreenReader,\n isFakeTouchstartFromScreenReader,\n} from '@angular/cdk/a11y';\nimport {Direction, Directionality} from '@angular/cdk/bidi';\nimport {ENTER, LEFT_ARROW, RIGHT_ARROW, SPACE} from '@angular/cdk/keycodes';\nimport {\n FlexibleConnectedPositionStrategy,\n HorizontalConnectionPos,\n Overlay,\n OverlayConfig,\n OverlayRef,\n VerticalConnectionPos,\n ScrollStrategy,\n} from '@angular/cdk/overlay';\nimport {TemplatePortal} from '@angular/cdk/portal';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Inject,\n InjectionToken,\n Input,\n OnDestroy,\n Optional,\n Output,\n Self,\n ViewContainerRef,\n} from '@angular/core';\nimport {normalizePassiveListenerOptions} from '@angular/cdk/platform';\nimport {asapScheduler, merge, of as observableOf, Subscription} from 'rxjs';\nimport {delay, filter, take, takeUntil} from 'rxjs/operators';\nimport {MenuCloseReason, _MatMenuBase} from './menu';\nimport {throwMatMenuMissingError, throwMatMenuRecursiveError} from './menu-errors';\nimport {MatMenuItem} from './menu-item';\nimport {MatMenuPanel, MAT_MENU_PANEL} from './menu-panel';\nimport {MenuPositionX, MenuPositionY} from './menu-positions';\n\n/** Injection token that determines the scroll handling while the menu is open. */\nexport const MAT_MENU_SCROLL_STRATEGY =\n new InjectionToken<() => ScrollStrategy>('mat-menu-scroll-strategy');\n\n/** @docs-private */\nexport function MAT_MENU_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy {\n return () => overlay.scrollStrategies.reposition();\n}\n\n/** @docs-private */\nexport const MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER = {\n provide: MAT_MENU_SCROLL_STRATEGY,\n deps: [Overlay],\n useFactory: MAT_MENU_SCROLL_STRATEGY_FACTORY,\n};\n\n/** Default top padding of the menu panel. */\nexport const MENU_PANEL_TOP_PADDING = 8;\n\n/** Options for binding a passive event listener. */\nconst passiveEventListenerOptions = normalizePassiveListenerOptions({passive: true});\n\n// TODO(andrewseguin): Remove the kebab versions in favor of camelCased attribute selectors\n\n/** Directive applied to an element that should trigger a `mat-menu`. */\n@Directive({\n selector: `[mat-menu-trigger-for], [matMenuTriggerFor]`,\n host: {\n 'class': 'mat-menu-trigger',\n 'aria-haspopup': 'true',\n '[attr.aria-expanded]': 'menuOpen || null',\n '[attr.aria-controls]': 'menuOpen ? menu.panelId : null',\n '(mousedown)': '_handleMousedown($event)',\n '(keydown)': '_handleKeydown($event)',\n '(click)': '_handleClick($event)',\n },\n exportAs: 'matMenuTrigger'\n})\nexport class MatMenuTrigger implements AfterContentInit, OnDestroy {\n private _portal: TemplatePortal;\n private _overlayRef: OverlayRef | null = null;\n private _menuOpen: boolean = false;\n private _closingActionsSubscription = Subscription.EMPTY;\n private _hoverSubscription = Subscription.EMPTY;\n private _menuCloseSubscription = Subscription.EMPTY;\n private _scrollStrategy: () => ScrollStrategy;\n\n /**\n * We're specifically looking for a `MatMenu` here since the generic `MatMenuPanel`\n * interface lacks some functionality around nested menus and animations.\n */\n private _parentMaterialMenu: _MatMenuBase | undefined;\n\n /**\n * Handles touch start events on the trigger.\n * Needs to be an arrow function so we can easily use addEventListener and removeEventListener.\n */\n private _handleTouchStart = (event: TouchEvent) => {\n if (!isFakeTouchstartFromScreenReader(event)) {\n this._openedBy = 'touch';\n }\n }\n\n // Tracking input type is necessary so it's possible to only auto-focus\n // the first item of the list when the menu is opened via the keyboard\n _openedBy: Exclude<FocusOrigin, 'program' | null> | undefined = undefined;\n\n /**\n * @deprecated\n * @breaking-change 8.0.0\n */\n @Input('mat-menu-trigger-for')\n get _deprecatedMatMenuTriggerFor(): MatMenuPanel { return this.menu; }\n set _deprecatedMatMenuTriggerFor(v: MatMenuPanel) {\n this.menu = v;\n }\n\n /** References the menu instance that the trigger is associated with. */\n @Input('matMenuTriggerFor')\n get menu() { return this._menu; }\n set menu(menu: MatMenuPanel) {\n if (menu === this._menu) {\n return;\n }\n\n this._menu = menu;\n this._menuCloseSubscription.unsubscribe();\n\n if (menu) {\n if (menu === this._parentMaterialMenu && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throwMatMenuRecursiveError();\n }\n\n this._menuCloseSubscription = menu.close.subscribe((reason: MenuCloseReason) => {\n this._destroyMenu(reason);\n\n // If a click closed the menu, we should close the entire chain of nested menus.\n if ((reason === 'click' || reason === 'tab') && this._parentMaterialMenu) {\n this._parentMaterialMenu.closed.emit(reason);\n }\n });\n }\n }\n private _menu: MatMenuPanel;\n\n /** Data to be passed along to any lazily-rendered content. */\n @Input('matMenuTriggerData') menuData: any;\n\n /**\n * Whether focus should be restored when the menu is closed.\n * Note that disabling this option can have accessibility implications\n * and it's up to you to manage focus, if you decide to turn it off.\n */\n @Input('matMenuTriggerRestoreFocus') restoreFocus: boolean = true;\n\n /** Event emitted when the associated menu is opened. */\n @Output() readonly menuOpened: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Event emitted when the associated menu is opened.\n * @deprecated Switch to `menuOpened` instead\n * @breaking-change 8.0.0\n */\n // tslint:disable-next-line:no-output-on-prefix\n @Output() readonly onMenuOpen: EventEmitter<void> = this.menuOpened;\n\n /** Event emitted when the associated menu is closed. */\n @Output() readonly menuClosed: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Event emitted when the associated menu is closed.\n * @deprecated Switch to `menuClosed` instead\n * @breaking-change 8.0.0\n */\n // tslint:disable-next-line:no-output-on-prefix\n @Output() readonly onMenuClose: EventEmitter<void> = this.menuClosed;\n\n constructor(private _overlay: Overlay,\n private _element: ElementRef<HTMLElement>,\n private _viewContainerRef: ViewContainerRef,\n @Inject(MAT_MENU_SCROLL_STRATEGY) scrollStrategy: any,\n @Inject(MAT_MENU_PANEL) @Optional() parentMenu: MatMenuPanel,\n // `MatMenuTrigger` is commonly used in combination with a `MatMenuItem`.\n // tslint:disable-next-line: lightweight-tokens\n @Optional() @Self() private _menuItemInstance: MatMenuItem,\n @Optional() private _dir: Directionality,\n // TODO(crisbeto): make the _focusMonitor required when doing breaking changes.\n // @breaking-change 8.0.0\n private _focusMonitor?: FocusMonitor) {\n this._scrollStrategy = scrollStrategy;\n this._parentMaterialMenu = parentMenu instanceof _MatMenuBase ? parentMenu : undefined;\n\n _element.nativeElement.addEventListener('touchstart', this._handleTouchStart,\n passiveEventListenerOptions);\n\n if (_menuItemInstance) {\n _menuItemInstance._triggersSubmenu = this.triggersSubmenu();\n }\n }\n\n ngAfterContentInit() {\n this._checkMenu();\n this._handleHover();\n }\n\n ngOnDestroy() {\n if (this._overlayRef) {\n this._overlayRef.dispose();\n this._overlayRef = null;\n }\n\n this._element.nativeElement.removeEventListener('touchstart', this._handleTouchStart,\n passiveEventListenerOptions);\n\n this._menuCloseSubscription.unsubscribe();\n this._closingActionsSubscription.unsubscribe();\n this._hoverSubscription.unsubscribe();\n }\n\n /** Whether the menu is open. */\n get menuOpen(): boolean {\n return this._menuOpen;\n }\n\n /** The text direction of the containing app. */\n get dir(): Direction {\n return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';\n }\n\n /** Whether the menu triggers a sub-menu or a top-level one. */\n triggersSubmenu(): boolean {\n return !!(this._menuItemInstance && this._parentMaterialMenu);\n }\n\n /** Toggles the menu between the open and closed states. */\n toggleMenu(): void {\n return this._menuOpen ? this.closeMenu() : this.openMenu();\n }\n\n /** Opens the menu. */\n openMenu(): void {\n if (this._menuOpen) {\n return;\n }\n\n this._checkMenu();\n\n const overlayRef = this._createOverlay();\n const overlayConfig = overlayRef.getConfig();\n\n this._setPosition(overlayConfig.positionStrategy as FlexibleConnectedPositionStrategy);\n overlayConfig.hasBackdrop = this.menu.hasBackdrop == null ? !this.triggersSubmenu() :\n this.menu.hasBackdrop;\n overlayRef.attach(this._getPortal());\n\n if (this.menu.lazyContent) {\n this.menu.lazyContent.attach(this.menuData);\n }\n\n this._closingActionsSubscription = this._menuClosingActions().subscribe(() => this.closeMenu());\n this._initMenu();\n\n if (this.menu instanceof _MatMenuBase) {\n this.menu._startAnimation();\n }\n }\n\n /** Closes the menu. */\n closeMenu(): void {\n this.menu.close.emit();\n }\n\n /**\n * Focuses the menu trigger.\n * @param origin Source of the menu trigger's focus.\n */\n focus(origin?: FocusOrigin, options?: FocusOptions) {\n if (this._focusMonitor && origin) {\n this._focusMonitor.focusVia(this._element, origin, options);\n } else {\n this._element.nativeElement.focus(options);\n }\n }\n\n /** Closes the menu and does the necessary cleanup. */\n private _destroyMenu(reason: MenuCloseReason) {\n if (!this._overlayRef || !this.menuOpen) {\n return;\n }\n\n const menu = this.menu;\n this._closingActionsSubscription.unsubscribe();\n this._overlayRef.detach();\n\n // Always restore focus if the user is navigating using the keyboard or the menu was opened\n // programmatically. We don't restore for non-root triggers, because it can prevent focus\n // from making it back to the root trigger when closing a long chain of menus by clicking\n // on the backdrop.\n if (this.restoreFocus && (reason === 'keydown' || !this._openedBy || !this.triggersSubmenu())) {\n this.focus(this._openedBy);\n }\n\n this._openedBy = undefined;\n\n if (menu instanceof _MatMenuBase) {\n menu._resetAnimation();\n\n if (menu.lazyContent) {\n // Wait for the exit animation to finish before detaching the content.\n menu._animationDone\n .pipe(\n filter(event => event.toState === 'void'),\n take(1),\n // Interrupt if the content got re-attached.\n takeUntil(menu.lazyContent._attached)\n )\n .subscribe({\n next: () => menu.lazyContent!.detach(),\n // No matter whether the content got re-attached, reset the menu.\n complete: () => this._setIsMenuOpen(false)\n });\n } else {\n this._setIsMenuOpen(false);\n }\n } else {\n this._setIsMenuOpen(false);\n\n if (menu.lazyContent) {\n menu.lazyContent.detach();\n }\n }\n }\n\n /**\n * This method sets the menu state to open and focuses the first item if\n * the menu was opened via the keyboard.\n */\n private _initMenu(): void {\n this.menu.parentMenu = this.triggersSubmenu() ? this._parentMaterialMenu : undefined;\n this.menu.direction = this.dir;\n this._setMenuElevation();\n this.menu.focusFirstItem(this._openedBy || 'program');\n this._setIsMenuOpen(true);\n }\n\n /** Updates the menu elevation based on the amount of parent menus that it has. */\n private _setMenuElevation(): void {\n if (this.menu.setElevation) {\n let depth = 0;\n let parentMenu = this.menu.parentMenu;\n\n while (parentMenu) {\n depth++;\n parentMenu = parentMenu.parentMenu;\n }\n\n this.menu.setElevation(depth);\n }\n }\n\n // set state rather than toggle to support triggers sharing a menu\n private _setIsMenuOpen(isOpen: boolean): void {\n this._menuOpen = isOpen;\n this._menuOpen ? this.menuOpened.emit() : this.menuClosed.emit();\n\n if (this.triggersSubmenu()) {\n this._menuItemInstance._highlighted = isOpen;\n }\n }\n\n /**\n * This method checks that a valid instance of MatMenu has been passed into\n * matMenuTriggerFor. If not, an exception is thrown.\n */\n private _checkMenu() {\n if (!this.menu && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throwMatMenuMissingError();\n }\n }\n\n /**\n * This method creates the overlay from the provided menu's template and saves its\n * OverlayRef so that it can be attached to the DOM when openMenu is called.\n */\n private _createOverlay(): OverlayRef {\n if (!this._overlayRef) {\n const config = this._getOverlayConfig();\n this._subscribeToPositions(config.positionStrategy as FlexibleConnectedPositionStrategy);\n this._overlayRef = this._overlay.create(config);\n\n // Consume the `keydownEvents` in order to prevent them from going to another overlay.\n // Ideally we'd also have our keyboard event logic in here, however doing so will\n // break anybody that may have implemented the `MatMenuPanel` themselves.\n this._overlayRef.keydownEvents().subscribe();\n }\n\n return this._overlayRef;\n }\n\n /**\n * This method builds the configuration object needed to create the overlay, the OverlayState.\n * @returns OverlayConfig\n */\n private _getOverlayConfig(): OverlayConfig {\n return new OverlayConfig({\n positionStrategy: this._overlay.position()\n .flexibleConnectedTo(this._element)\n .withLockedPosition()\n .withGrowAfterOpen()\n .withTransformOriginOn('.mat-menu-panel, .mat-mdc-menu-panel'),\n backdropClass: this.menu.backdropClass || 'cdk-overlay-transparent-backdrop',\n panelClass: this.menu.overlayPanelClass,\n scrollStrategy: this._scrollStrategy(),\n direction: this._dir\n });\n }\n\n /**\n * Listens to changes in the position of the overlay and sets the correct classes\n * on the menu based on the new position. This ensures the animation origin is always\n * correct, even if a fallback position is used for the overlay.\n */\n private _subscribeToPositions(position: FlexibleConnectedPositionStrategy): void {\n if (this.menu.setPositionClasses) {\n position.positionChanges.subscribe(change => {\n const posX: MenuPositionX = change.connectionPair.overlayX === 'start' ? 'after' : 'before';\n const posY: MenuPositionY = change.connectionPair.overlayY === 'top' ? 'below' : 'above';\n\n this.menu.setPositionClasses!(posX, posY);\n });\n }\n }\n\n /**\n * Sets the appropriate positions on a position strategy\n * so the overlay connects with the trigger correctly.\n * @param positionStrategy Strategy whose position to update.\n */\n private _setPosition(positionStrategy: FlexibleConnectedPositionStrategy) {\n let [originX, originFallbackX]: HorizontalConnectionPos[] =\n this.menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'];\n\n let [overlayY, overlayFallbackY]: VerticalConnectionPos[] =\n this.menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'];\n\n let [originY, originFallbackY] = [overlayY, overlayFallbackY];\n let [overlayX, overlayFallbackX] = [originX, originFallbackX];\n let offsetY = 0;\n\n if (this.triggersSubmenu()) {\n // When the menu is a sub-menu, it should always align itself\n // to the edges of the trigger, instead of overlapping it.\n overlayFallbackX = originX = this.menu.xPosition === 'before' ? 'start' : 'end';\n originFallbackX = overlayX = originX === 'end' ? 'start' : 'end';\n offsetY = overlayY === 'bottom' ? MENU_PANEL_TOP_PADDING : -MENU_PANEL_TOP_PADDING;\n } else if (!this.menu.overlapTrigger) {\n originY = overlayY === 'top' ? 'bottom' : 'top';\n originFallbackY = overlayFallbackY === 'top' ? 'bottom' : 'top';\n }\n\n positionStrategy.withPositions([\n {originX, originY, overlayX, overlayY, offsetY},\n {originX: originFallbackX, originY, overlayX: overlayFallbackX, overlayY, offsetY},\n {\n originX,\n originY: originFallbackY,\n overlayX,\n overlayY: overlayFallbackY,\n offsetY: -offsetY\n },\n {\n originX: originFallbackX,\n originY: originFallbackY,\n overlayX: overlayFallbackX,\n overlayY: overlayFallbackY,\n offsetY: -offsetY\n }\n ]);\n }\n\n /** Returns a stream that emits whenever an action that should close the menu occurs. */\n private _menuClosingActions() {\n const backdrop = this._overlayRef!.backdropClick();\n const detachments = this._overlayRef!.detachments();\n const parentClose = this._parentMaterialMenu ? this._parentMaterialMenu.closed : observableOf();\n const hover = this._parentMaterialMenu ? this._parentMaterialMenu._hovered().pipe(\n filter(active => active !== this._menuItemInstance),\n filter(() => this._menuOpen)\n ) : observableOf();\n\n return merge(backdrop, parentClose, hover, detachments);\n }\n\n /** Handles mouse presses on the trigger. */\n _handleMousedown(event: MouseEvent): void {\n if (!isFakeMousedownFromScreenReader(event)) {\n // Since right or middle button clicks won't trigger the `click` event,\n // we shouldn't consider the menu as opened by mouse in those cases.\n this._openedBy = event.button === 0 ? 'mouse' : undefined;\n\n // Since clicking on the trigger won't close the menu if it opens a sub-menu,\n // we should prevent focus from moving onto it via click to avoid the\n // highlight from lingering on the menu item.\n if (this.triggersSubmenu()) {\n event.preventDefault();\n }\n }\n }\n\n /** Handles key presses on the trigger. */\n _handleKeydown(event: KeyboardEvent): void {\n const keyCode = event.keyCode;\n\n // Pressing enter on the trigger will trigger the click handler later.\n if (keyCode === ENTER || keyCode === SPACE) {\n this._openedBy = 'keyboard';\n }\n\n if (this.triggersSubmenu() && (\n (keyCode === RIGHT_ARROW && this.dir === 'ltr') ||\n (keyCode === LEFT_ARROW && this.dir === 'rtl'))) {\n this._openedBy = 'keyboard';\n this.openMenu();\n }\n }\n\n /** Handles click events on the trigger. */\n _handleClick(event: MouseEvent): void {\n if (this.triggersSubmenu()) {\n // Stop event propagation to avoid closing the parent menu.\n event.stopPropagation();\n this.openMenu();\n } else {\n this.toggleMenu();\n }\n }\n\n /** Handles the cases where the user hovers over the trigger. */\n private _handleHover() {\n // Subscribe to changes in the hovered item in order to toggle the panel.\n if (!this.triggersSubmenu() || !this._parentMaterialMenu) {\n return;\n }\n\n this._hoverSubscription = this._parentMaterialMenu._hovered()\n // Since we might have multiple competing triggers for the same menu (e.g. a sub-menu\n // with different data and triggers), we have to delay it by a tick to ensure that\n // it won't be closed immediately after it is opened.\n .pipe(\n filter(active => active === this._menuItemInstance && !active.disabled),\n delay(0, asapScheduler)\n )\n .subscribe(() => {\n this._openedBy = 'mouse';\n\n // If the same menu is used between multiple triggers, it might still be animating\n // while the new trigger tries to re-open it. Wait for the animation to finish\n // before doing so. Also interrupt if the user moves to another item.\n if (this.menu instanceof _MatMenuBase && this.menu._isAnimating) {\n // We need the `delay(0)` here in order to avoid\n // 'changed after checked' errors in some cases. See #12194.\n this.menu._animationDone\n .pipe(take(1), delay(0, asapScheduler), takeUntil(this._parentMaterialMenu!._hovered()))\n .subscribe(() => this.openMenu());\n } else {\n this.openMenu();\n }\n });\n }\n\n /** Gets the portal that should be attached to the overlay. */\n private _getPortal(): TemplatePortal {\n // Note that we can avoid this check by keeping the portal on the menu panel.\n // While it would be cleaner, we'd have to introduce another required method on\n // `MatMenuPanel`, making it harder to consume.\n if (!this._portal || this._portal.templateRef !== this.menu.templateRef) {\n this._portal = new TemplatePortal(this.menu.templateRef, this._viewContainerRef);\n }\n\n return this._portal;\n }\n\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {OverlayModule} from '@angular/cdk/overlay';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {MatCommonModule, MatRippleModule} from '@angular/material/core';\nimport {CdkScrollableModule} from '@angular/cdk/scrolling';\nimport {MatMenu} from './menu';\nimport {MatMenuContent} from './menu-content';\nimport {MatMenuItem} from './menu-item';\nimport {MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER, MatMenuTrigger} from './menu-trigger';\n\n/**\n * Used by both the current `MatMenuModule` and the MDC `MatMenuModule`\n * to declare the menu-related directives.\n */\n@NgModule({\n exports: [MatMenuTrigger, MatMenuContent, MatCommonModule],\n declarations: [\n MatMenuTrigger,\n MatMenuContent,\n ],\n providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER]\n})\nexport class _MatMenuDirectivesModule {}\n\n@NgModule({\n imports: [\n CommonModule,\n MatCommonModule,\n MatRippleModule,\n OverlayModule,\n _MatMenuDirectivesModule,\n ],\n exports: [CdkScrollableModule, MatCommonModule, MatMenu, MatMenuItem, _MatMenuDirectivesModule],\n declarations: [MatMenu, MatMenuItem],\n providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER]\n})\nexport class MatMenuModule {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport type MenuPositionX = 'before' | 'after';\n\nexport type MenuPositionY = 'above' | 'below';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport {\n MatMenuDefaultOptions,\n MAT_MENU_DEFAULT_OPTIONS,\n MatMenu,\n _MatMenuBase,\n} from './menu';\nexport {MatMenuItem} from './menu-item';\nexport {MatMenuTrigger, MAT_MENU_SCROLL_STRATEGY} from './menu-trigger';\nexport {MatMenuPanel, MAT_MENU_PANEL} from './menu-panel';\nexport * from './menu-module';\nexport * from './menu-animations';\nexport * from './menu-content';\nexport * from './menu-positions';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {MAT_MENU_DEFAULT_OPTIONS_FACTORY as ɵangular_material_src_material_menu_menu_a} from './menu';\nexport {MAT_MENU_SCROLL_STRATEGY_FACTORY as ɵangular_material_src_material_menu_menu_b,MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER as ɵangular_material_src_material_menu_menu_c} from './menu-trigger';"],"names":["observableOf"],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;AAQA,AASA;;;;;;AAMA,MAAa,iBAAiB,GAG1B;;;;;;;;;IASF,aAAa,EAAE,OAAO,CAAC,eAAe,EAAE;QACtC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,YAAY;SACxB,CAAC,CAAC;QACH,UAAU,CAAC,eAAe,EAAE,OAAO,CAAC,kCAAkC,EAAE,KAAK,CAAC;YAC5E,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,UAAU;SACtB,CAAC,CAAC,CAAC;QACJ,UAAU,C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