UNPKG

@angular/material

Version:
31 lines 26 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("@angular/cdk/a11y"),require("@angular/cdk/coercion"),require("@angular/cdk/keycodes"),require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/animations"),require("@angular/cdk/portal"),require("@angular/common"),require("@angular/material/core"),require("@angular/cdk/bidi"),require("@angular/cdk/overlay"),require("@angular/cdk/platform")):"function"==typeof define&&define.amd?define("@angular/material/menu",["exports","tslib","@angular/cdk/a11y","@angular/cdk/coercion","@angular/cdk/keycodes","@angular/core","rxjs","rxjs/operators","@angular/animations","@angular/cdk/portal","@angular/common","@angular/material/core","@angular/cdk/bidi","@angular/cdk/overlay","@angular/cdk/platform"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.menu={}),e.tslib,e.ng.cdk.a11y,e.ng.cdk.coercion,e.ng.cdk.keycodes,e.ng.core,e.rxjs,e.rxjs.operators,e.ng.animations,e.ng.cdk.portal,e.ng.common,e.ng.material.core,e.ng.cdk.bidi,e.ng.cdk.overlay,e.ng.cdk.platform)}(this,(function(e,t,n,i,o,r,s,a,u,c,p,l,m,h,d){"use strict"; /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */var _={transformMenu:u.trigger("transformMenu",[u.state("void",u.style({opacity:0,transform:"scale(0.8)"})),u.transition("void => enter",u.group([u.query(".mat-menu-content, .mat-mdc-menu-content",u.animate("100ms linear",u.style({opacity:1}))),u.animate("120ms cubic-bezier(0, 0, 0.2, 1)",u.style({transform:"scale(1)"}))])),u.transition("* => void",u.animate("100ms 25ms linear",u.style({opacity:0})))]),fadeInItems:u.trigger("fadeInItems",[u.state("showing",u.style({opacity:1})),u.transition("void => *",[u.style({opacity:0}),u.animate("400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)")])])},g=_.fadeInItems,f=_.transformMenu,y=function(){function e(e,t,n,i,o,r,a){this._template=e,this._componentFactoryResolver=t,this._appRef=n,this._injector=i,this._viewContainerRef=o,this._document=r,this._changeDetectorRef=a,this._attached=new s.Subject}return e.prototype.attach=function(e){void 0===e&&(e={}),this._portal||(this._portal=new c.TemplatePortal(this._template,this._viewContainerRef)),this.detach(),this._outlet||(this._outlet=new c.DomPortalOutlet(this._document.createElement("div"),this._componentFactoryResolver,this._appRef,this._injector));var t=this._template.elementRef.nativeElement;t.parentNode.insertBefore(this._outlet.outletElement,t),this._changeDetectorRef&&this._changeDetectorRef.markForCheck(),this._portal.attach(this._outlet,e),this._attached.next()},e.prototype.detach=function(){this._portal.isAttached&&this._portal.detach()},e.prototype.ngOnDestroy=function(){this._outlet&&this._outlet.dispose()},e.decorators=[{type:r.Directive,args:[{selector:"ng-template[matMenuContent]"}]}],e.ctorParameters=function(){return[{type:r.TemplateRef},{type:r.ComponentFactoryResolver},{type:r.ApplicationRef},{type:r.Injector},{type:r.ViewContainerRef},{type:void 0,decorators:[{type:r.Inject,args:[p.DOCUMENT]}]},{type:r.ChangeDetectorRef}]},e}(),b=new r.InjectionToken("MAT_MENU_PANEL"),v=function(e){function i(t,n,i,o){var r=e.call(this)||this;return r._elementRef=t,r._focusMonitor=i,r._parentMenu=o,r.role="menuitem",r._hovered=new s.Subject,r._focused=new s.Subject,r._highlighted=!1,r._triggersSubmenu=!1,i&&i.monitor(r._elementRef,!1),o&&o.addItem&&o.addItem(r),r._document=n,r}return t.__extends(i,e),i.prototype.focus=function(e,t){void 0===e&&(e="program"),this._focusMonitor?this._focusMonitor.focusVia(this._getHostElement(),e,t):this._getHostElement().focus(t),this._focused.next(this)},i.prototype.ngOnDestroy=function(){this._focusMonitor&&this._focusMonitor.stopMonitoring(this._elementRef),this._parentMenu&&this._parentMenu.removeItem&&this._parentMenu.removeItem(this),this._hovered.complete(),this._focused.complete()},i.prototype._getTabIndex=function(){return this.disabled?"-1":"0"},i.prototype._getHostElement=function(){return this._elementRef.nativeElement},i.prototype._checkDisabled=function(e){this.disabled&&(e.preventDefault(),e.stopPropagation())},i.prototype._handleMouseEnter=function(){this._hovered.next(this)},i.prototype.getLabel=function(){var e=this._elementRef.nativeElement,t=this._document?this._document.TEXT_NODE:3,n="";if(e.childNodes)for(var i=e.childNodes.length,o=0;o<i;o++)e.childNodes[o].nodeType===t&&(n+=e.childNodes[o].textContent);return n.trim()},i.decorators=[{type:r.Component,args:[{selector:"[mat-menu-item]",exportAs:"matMenuItem",inputs:["disabled","disableRipple"],host:{"[attr.role]":"role","[class.mat-menu-item]":"true","[class.mat-menu-item-highlighted]":"_highlighted","[class.mat-menu-item-submenu-trigger]":"_triggersSubmenu","[attr.tabindex]":"_getTabIndex()","[attr.aria-disabled]":"disabled.toString()","[attr.disabled]":"disabled || null"},changeDetection:r.ChangeDetectionStrategy.OnPush,encapsulation:r.ViewEncapsulation.None,template:'<ng-content></ng-content>\n<div class="mat-menu-ripple" matRipple\n [matRippleDisabled]="disableRipple || disabled"\n [matRippleTrigger]="_getHostElement()">\n</div>\n'}]}],i.ctorParameters=function(){return[{type:r.ElementRef},{type:void 0,decorators:[{type:r.Inject,args:[p.DOCUMENT]}]},{type:n.FocusMonitor},{type:void 0,decorators:[{type:r.Inject,args:[b]},{type:r.Optional}]}]},i.propDecorators={role:[{type:r.Input}],_checkDisabled:[{type:r.HostListener,args:["click",["$event"]]}],_handleMouseEnter:[{type:r.HostListener,args:["mouseenter"]}]},i}(l.mixinDisableRipple(l.mixinDisabled((function M(){})))),k=new r.InjectionToken("mat-menu-default-options",{providedIn:"root",factory:I});function I(){return{overlapTrigger:!1,xPosition:"after",yPosition:"below",backdropClass:"cdk-overlay-transparent-backdrop"}}var O=0,C=function(){function e(e,t,n){this._elementRef=e,this._ngZone=t,this._defaultOptions=n,this._xPosition=this._defaultOptions.xPosition,this._yPosition=this._defaultOptions.yPosition,this._directDescendantItems=new r.QueryList,this._tabSubscription=s.Subscription.EMPTY,this._classList={},this._panelAnimationState="void",this._animationDone=new s.Subject,this.backdropClass=this._defaultOptions.backdropClass,this._overlapTrigger=this._defaultOptions.overlapTrigger,this._hasBackdrop=this._defaultOptions.hasBackdrop,this.closed=new r.EventEmitter,this.close=this.closed,this.panelId="mat-menu-panel-"+O++}return Object.defineProperty(e.prototype,"xPosition",{get:function(){return this._xPosition},set:function(e){"before"!==e&&"after"!==e&&function t(){throw Error('xPosition value must be either \'before\' or after\'.\n Example: <mat-menu xPosition="before" #menu="matMenu"></mat-menu>')}(),this._xPosition=e,this.setPositionClasses()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"yPosition",{get:function(){return this._yPosition},set:function(e){"above"!==e&&"below"!==e&&function t(){throw Error('yPosition value must be either \'above\' or below\'.\n Example: <mat-menu yPosition="above" #menu="matMenu"></mat-menu>')} /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */(),this._yPosition=e,this.setPositionClasses()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"overlapTrigger",{get:function(){return this._overlapTrigger},set:function(e){this._overlapTrigger=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasBackdrop",{get:function(){return this._hasBackdrop},set:function(e){this._hasBackdrop=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"panelClass",{set:function(e){var t=this,n=this._previousPanelClass;n&&n.length&&n.split(" ").forEach((function(e){t._classList[e]=!1})),this._previousPanelClass=e,e&&e.length&&(e.split(" ").forEach((function(e){t._classList[e]=!0})),this._elementRef.nativeElement.className="")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"classList",{get:function(){return this.panelClass},set:function(e){this.panelClass=e},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.setPositionClasses()},e.prototype.ngAfterContentInit=function(){var e=this;this._updateDirectDescendants(),this._keyManager=new n.FocusKeyManager(this._directDescendantItems).withWrap().withTypeAhead(),this._tabSubscription=this._keyManager.tabOut.subscribe((function(){return e.closed.emit("tab")})),this._directDescendantItems.changes.pipe(a.startWith(this._directDescendantItems),a.switchMap((function(e){return s.merge.apply(void 0,t.__spread(e.map((function(e){return e._focused}))))}))).subscribe((function(t){return e._keyManager.updateActiveItem(t)}))},e.prototype.ngOnDestroy=function(){this._directDescendantItems.destroy(),this._tabSubscription.unsubscribe(),this.closed.complete()},e.prototype._hovered=function(){return this._directDescendantItems.changes.pipe(a.startWith(this._directDescendantItems),a.switchMap((function(e){return s.merge.apply(void 0,t.__spread(e.map((function(e){return e._hovered}))))})))},e.prototype.addItem=function(e){},e.prototype.removeItem=function(e){},e.prototype._handleKeydown=function(e){var t=e.keyCode,n=this._keyManager;switch(t){case o.ESCAPE:o.hasModifierKey(e)||(e.preventDefault(),this.closed.emit("keydown"));break;case o.LEFT_ARROW:this.parentMenu&&"ltr"===this.direction&&this.closed.emit("keydown");break;case o.RIGHT_ARROW:this.parentMenu&&"rtl"===this.direction&&this.closed.emit("keydown");break;case o.HOME:case o.END:o.hasModifierKey(e)||(t===o.HOME?n.setFirstItemActive():n.setLastItemActive(),e.preventDefault());break;default:t!==o.UP_ARROW&&t!==o.DOWN_ARROW||n.setFocusOrigin("keyboard"),n.onKeydown(e)}},e.prototype.focusFirstItem=function(e){var t=this;void 0===e&&(e="program"),this.lazyContent?this._ngZone.onStable.asObservable().pipe(a.take(1)).subscribe((function(){return t._focusFirstItem(e)})):this._focusFirstItem(e)},e.prototype._focusFirstItem=function(e){var t=this._keyManager;if(t.setFocusOrigin(e).setFirstItemActive(),!t.activeItem&&this._directDescendantItems.length)for(var n=this._directDescendantItems.first._getHostElement().parentElement;n;){if("menu"===n.getAttribute("role")){n.focus();break}n=n.parentElement}},e.prototype.resetActiveItem=function(){this._keyManager.setActiveItem(-1)},e.prototype.setElevation=function(e){var t="mat-elevation-z"+Math.min(4+e,24),n=Object.keys(this._classList).find((function(e){return e.startsWith("mat-elevation-z")}));n&&n!==this._previousElevation||(this._previousElevation&&(this._classList[this._previousElevation]=!1),this._classList[t]=!0,this._previousElevation=t)},e.prototype.setPositionClasses=function(e,t){void 0===e&&(e=this.xPosition),void 0===t&&(t=this.yPosition);var n=this._classList;n["mat-menu-before"]="before"===e,n["mat-menu-after"]="after"===e,n["mat-menu-above"]="above"===t,n["mat-menu-below"]="below"===t},e.prototype._startAnimation=function(){this._panelAnimationState="enter"},e.prototype._resetAnimation=function(){this._panelAnimationState="void"},e.prototype._onAnimationDone=function(e){this._animationDone.next(e),this._isAnimating=!1},e.prototype._onAnimationStart=function(e){this._isAnimating=!0,"enter"===e.toState&&0===this._keyManager.activeItemIndex&&(e.element.scrollTop=0)},e.prototype._updateDirectDescendants=function(){var e=this;this._allItems.changes.pipe(a.startWith(this._allItems)).subscribe((function(t){e._directDescendantItems.reset(t.filter((function(t){return t._parentMenu===e}))),e._directDescendantItems.notifyOnChanges()}))},e.decorators=[{type:r.Directive}],e.ctorParameters=function(){return[{type:r.ElementRef},{type:r.NgZone},{type:void 0,decorators:[{type:r.Inject,args:[k]}]}]},e.propDecorators={_allItems:[{type:r.ContentChildren,args:[v,{descendants:!0}]}],backdropClass:[{type:r.Input}],ariaLabel:[{type:r.Input,args:["aria-label"]}],ariaLabelledby:[{type:r.Input,args:["aria-labelledby"]}],ariaDescribedby:[{type:r.Input,args:["aria-describedby"]}],xPosition:[{type:r.Input}],yPosition:[{type:r.Input}],templateRef:[{type:r.ViewChild,args:[r.TemplateRef]}],items:[{type:r.ContentChildren,args:[v,{descendants:!1}]}],lazyContent:[{type:r.ContentChild,args:[y]}],overlapTrigger:[{type:r.Input}],hasBackdrop:[{type:r.Input}],panelClass:[{type:r.Input,args:["class"]}],classList:[{type:r.Input}],closed:[{type:r.Output}],close:[{type:r.Output}]},e}(),x=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(n,e),n.decorators=[{type:r.Directive}],n}(C),P=function(e){function n(t,n,i){return e.call(this,t,n,i)||this}return t.__extends(n,e),n.decorators=[{type:r.Component,args:[{selector:"mat-menu",template:'<ng-template>\n <div\n class="mat-menu-panel"\n [id]="panelId"\n [ngClass]="_classList"\n (keydown)="_handleKeydown($event)"\n (click)="closed.emit(\'click\')"\n [@transformMenu]="_panelAnimationState"\n (@transformMenu.start)="_onAnimationStart($event)"\n (@transformMenu.done)="_onAnimationDone($event)"\n tabindex="-1"\n role="menu"\n [attr.aria-label]="ariaLabel || null"\n [attr.aria-labelledby]="ariaLabelledby || null"\n [attr.aria-describedby]="ariaDescribedby || null">\n <div class="mat-menu-content">\n <ng-content></ng-content>\n </div>\n </div>\n</ng-template>\n',changeDetection:r.ChangeDetectionStrategy.OnPush,encapsulation:r.ViewEncapsulation.None,exportAs:"matMenu",animations:[_.transformMenu,_.fadeInItems],providers:[{provide:b,useExisting:x},{provide:x,useExisting:n}],styles:['.mat-menu-panel{min-width:112px;max-width:280px;overflow:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 48px);border-radius:4px;outline:0;min-height:64px}.mat-menu-panel.ng-animating{pointer-events:none}.cdk-high-contrast-active .mat-menu-panel{outline:solid 1px}.mat-menu-content:not(:empty){padding-top:8px;padding-bottom:8px}.mat-menu-item{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;position:relative}.mat-menu-item::-moz-focus-inner{border:0}.mat-menu-item[disabled]{cursor:default}[dir=rtl] .mat-menu-item{text-align:right}.mat-menu-item .mat-icon{margin-right:16px;vertical-align:middle}.mat-menu-item .mat-icon svg{vertical-align:top}[dir=rtl] .mat-menu-item .mat-icon{margin-left:16px;margin-right:0}.mat-menu-item[disabled]{pointer-events:none}.cdk-high-contrast-active .mat-menu-item.cdk-program-focused,.cdk-high-contrast-active .mat-menu-item.cdk-keyboard-focused,.cdk-high-contrast-active .mat-menu-item-highlighted{outline:dotted 1px}.mat-menu-item-submenu-trigger{padding-right:32px}.mat-menu-item-submenu-trigger::after{width:0;height:0;border-style:solid;border-width:5px 0 5px 5px;border-color:transparent transparent transparent currentColor;content:"";display:inline-block;position:absolute;top:50%;right:16px;transform:translateY(-50%)}[dir=rtl] .mat-menu-item-submenu-trigger{padding-right:16px;padding-left:32px}[dir=rtl] .mat-menu-item-submenu-trigger::after{right:auto;left:16px;transform:rotateY(180deg) translateY(-50%)}button.mat-menu-item{width:100%}.mat-menu-item .mat-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}\n']}]}],n.ctorParameters=function(){return[{type:r.ElementRef},{type:r.NgZone},{type:void 0,decorators:[{type:r.Inject,args:[k]}]}]},n}(x),E=new r.InjectionToken("mat-menu-scroll-strategy");function w(e){return function(){return e.scrollStrategies.reposition()}}var R={provide:E,deps:[h.Overlay],useFactory:w},S=d.normalizePassiveListenerOptions({passive:!0}),D=function(){function e(e,t,n,i,o,a,u,c){var p=this;this._overlay=e,this._element=t,this._viewContainerRef=n,this._parentMenu=o,this._menuItemInstance=a,this._dir=u,this._focusMonitor=c,this._overlayRef=null,this._menuOpen=!1,this._closingActionsSubscription=s.Subscription.EMPTY,this._hoverSubscription=s.Subscription.EMPTY,this._menuCloseSubscription=s.Subscription.EMPTY,this._handleTouchStart=function(){return p._openedBy="touch"},this._openedBy=null,this.restoreFocus=!0,this.menuOpened=new r.EventEmitter,this.onMenuOpen=this.menuOpened,this.menuClosed=new r.EventEmitter,this.onMenuClose=this.menuClosed,t.nativeElement.addEventListener("touchstart",this._handleTouchStart,S),a&&(a._triggersSubmenu=this.triggersSubmenu()),this._scrollStrategy=i}return Object.defineProperty(e.prototype,"_deprecatedMatMenuTriggerFor",{get:function(){return this.menu},set:function(e){this.menu=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"menu",{get:function(){return this._menu},set:function(e){var t=this;e!==this._menu&&(this._menu=e,this._menuCloseSubscription.unsubscribe(),e&&(this._menuCloseSubscription=e.close.asObservable().subscribe((function(e){t._destroyMenu(),"click"!==e&&"tab"!==e||!t._parentMenu||t._parentMenu.closed.emit(e)}))))},enumerable:!0,configurable:!0}),e.prototype.ngAfterContentInit=function(){this._checkMenu(),this._handleHover()},e.prototype.ngOnDestroy=function(){this._overlayRef&&(this._overlayRef.dispose(),this._overlayRef=null),this._element.nativeElement.removeEventListener("touchstart",this._handleTouchStart,S),this._menuCloseSubscription.unsubscribe(),this._closingActionsSubscription.unsubscribe(),this._hoverSubscription.unsubscribe()},Object.defineProperty(e.prototype,"menuOpen",{get:function(){return this._menuOpen},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this._dir&&"rtl"===this._dir.value?"rtl":"ltr"},enumerable:!0,configurable:!0}),e.prototype.triggersSubmenu=function(){return!(!this._menuItemInstance||!this._parentMenu)},e.prototype.toggleMenu=function(){return this._menuOpen?this.closeMenu():this.openMenu()},e.prototype.openMenu=function(){var e=this;if(!this._menuOpen){this._checkMenu();var t=this._createOverlay(),n=t.getConfig();this._setPosition(n.positionStrategy),n.hasBackdrop=null==this.menu.hasBackdrop?!this.triggersSubmenu():this.menu.hasBackdrop,t.attach(this._getPortal()),this.menu.lazyContent&&this.menu.lazyContent.attach(this.menuData),this._closingActionsSubscription=this._menuClosingActions().subscribe((function(){return e.closeMenu()})),this._initMenu(),this.menu instanceof x&&this.menu._startAnimation()}},e.prototype.closeMenu=function(){this.menu.close.emit()},e.prototype.focus=function(e,t){void 0===e&&(e="program"),this._focusMonitor?this._focusMonitor.focusVia(this._element,e,t):this._element.nativeElement.focus(t)},e.prototype._destroyMenu=function(){var e=this;if(this._overlayRef&&this.menuOpen){var t=this.menu;this._closingActionsSubscription.unsubscribe(),this._overlayRef.detach(),t instanceof x?(t._resetAnimation(),t.lazyContent?t._animationDone.pipe(a.filter((function(e){return"void"===e.toState})),a.take(1),a.takeUntil(t.lazyContent._attached)).subscribe({next:function(){return t.lazyContent.detach()},complete:function(){return e._setIsMenuOpen(!1)}}):this._setIsMenuOpen(!1)):(this._setIsMenuOpen(!1),t.lazyContent&&t.lazyContent.detach()),this._restoreFocus()}},e.prototype._initMenu=function(){this.menu.parentMenu=this.triggersSubmenu()?this._parentMenu:void 0,this.menu.direction=this.dir,this._setMenuElevation(),this._setIsMenuOpen(!0),this.menu.focusFirstItem(this._openedBy||"program")},e.prototype._setMenuElevation=function(){if(this.menu.setElevation){for(var e=0,t=this.menu.parentMenu;t;)e++,t=t.parentMenu;this.menu.setElevation(e)}},e.prototype._restoreFocus=function(){this.restoreFocus&&(this._openedBy?this.triggersSubmenu()||this.focus(this._openedBy):this.focus()),this._openedBy=null},e.prototype._setIsMenuOpen=function(e){this._menuOpen=e,this._menuOpen?this.menuOpened.emit():this.menuClosed.emit(),this.triggersSubmenu()&&(this._menuItemInstance._highlighted=e)},e.prototype._checkMenu=function(){this.menu|| /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ function e(){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>')}()},e.prototype._createOverlay=function(){if(!this._overlayRef){var e=this._getOverlayConfig();this._subscribeToPositions(e.positionStrategy),this._overlayRef=this._overlay.create(e),this._overlayRef.keydownEvents().subscribe()}return this._overlayRef},e.prototype._getOverlayConfig=function(){return new h.OverlayConfig({positionStrategy:this._overlay.position().flexibleConnectedTo(this._element).withLockedPosition().withTransformOriginOn(".mat-menu-panel, .mat-mdc-menu-panel"),backdropClass:this.menu.backdropClass||"cdk-overlay-transparent-backdrop",scrollStrategy:this._scrollStrategy(),direction:this._dir})},e.prototype._subscribeToPositions=function(e){var t=this;this.menu.setPositionClasses&&e.positionChanges.subscribe((function(e){t.menu.setPositionClasses("start"===e.connectionPair.overlayX?"after":"before","top"===e.connectionPair.overlayY?"below":"above")}))},e.prototype._setPosition=function(e){var n=t.__read("before"===this.menu.xPosition?["end","start"]:["start","end"],2),i=n[0],o=n[1],r=t.__read("above"===this.menu.yPosition?["bottom","top"]:["top","bottom"],2),s=r[0],a=r[1],u=t.__read([s,a],2),c=u[0],p=u[1],l=t.__read([i,o],2),m=l[0],h=l[1],d=0;this.triggersSubmenu()?(h=i="before"===this.menu.xPosition?"start":"end",o=m="end"===i?"start":"end",d="bottom"===s?8:-8):this.menu.overlapTrigger||(c="top"===s?"bottom":"top",p="top"===a?"bottom":"top"),e.withPositions([{originX:i,originY:c,overlayX:m,overlayY:s,offsetY:d},{originX:o,originY:c,overlayX:h,overlayY:s,offsetY:d},{originX:i,originY:p,overlayX:m,overlayY:a,offsetY:-d},{originX:o,originY:p,overlayX:h,overlayY:a,offsetY:-d}])},e.prototype._menuClosingActions=function(){var e=this,t=this._overlayRef.backdropClick(),n=this._overlayRef.detachments(),i=this._parentMenu?this._parentMenu.closed:s.of(),o=this._parentMenu?this._parentMenu._hovered().pipe(a.filter((function(t){return t!==e._menuItemInstance})),a.filter((function(){return e._menuOpen}))):s.of();return s.merge(t,i,o,n)},e.prototype._handleMousedown=function(e){n.isFakeMousedownFromScreenReader(e)||(this._openedBy=0===e.button?"mouse":null,this.triggersSubmenu()&&e.preventDefault())},e.prototype._handleKeydown=function(e){var t=e.keyCode;this.triggersSubmenu()&&(t===o.RIGHT_ARROW&&"ltr"===this.dir||t===o.LEFT_ARROW&&"rtl"===this.dir)&&this.openMenu()},e.prototype._handleClick=function(e){this.triggersSubmenu()?(e.stopPropagation(),this.openMenu()):this.toggleMenu()},e.prototype._handleHover=function(){var e=this;this.triggersSubmenu()&&(this._hoverSubscription=this._parentMenu._hovered().pipe(a.filter((function(t){return t===e._menuItemInstance&&!t.disabled})),a.delay(0,s.asapScheduler)).subscribe((function(){e._openedBy="mouse",e.menu instanceof x&&e.menu._isAnimating?e.menu._animationDone.pipe(a.take(1),a.delay(0,s.asapScheduler),a.takeUntil(e._parentMenu._hovered())).subscribe((function(){return e.openMenu()})):e.openMenu()})))},e.prototype._getPortal=function(){return this._portal&&this._portal.templateRef===this.menu.templateRef||(this._portal=new c.TemplatePortal(this.menu.templateRef,this._viewContainerRef)),this._portal},e.decorators=[{type:r.Directive,args:[{selector:"[mat-menu-trigger-for], [matMenuTriggerFor]",host:{class:"mat-menu-trigger","aria-haspopup":"true","[attr.aria-expanded]":"menuOpen || null","[attr.aria-controls]":"menuOpen ? menu.panelId : null","(mousedown)":"_handleMousedown($event)","(keydown)":"_handleKeydown($event)","(click)":"_handleClick($event)"},exportAs:"matMenuTrigger"}]}],e.ctorParameters=function(){return[{type:h.Overlay},{type:r.ElementRef},{type:r.ViewContainerRef},{type:void 0,decorators:[{type:r.Inject,args:[E]}]},{type:x,decorators:[{type:r.Optional}]},{type:v,decorators:[{type:r.Optional},{type:r.Self}]},{type:m.Directionality,decorators:[{type:r.Optional}]},{type:n.FocusMonitor}]},e.propDecorators={_deprecatedMatMenuTriggerFor:[{type:r.Input,args:["mat-menu-trigger-for"]}],menu:[{type:r.Input,args:["matMenuTriggerFor"]}],menuData:[{type:r.Input,args:["matMenuTriggerData"]}],restoreFocus:[{type:r.Input,args:["matMenuTriggerRestoreFocus"]}],menuOpened:[{type:r.Output}],onMenuOpen:[{type:r.Output}],menuClosed:[{type:r.Output}],onMenuClose:[{type:r.Output}]},e}(),T=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{exports:[D,y,l.MatCommonModule],declarations:[D,y],providers:[R]}]}],e}(),A=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{imports:[p.CommonModule,l.MatCommonModule,l.MatRippleModule,h.OverlayModule,T],exports:[P,v,T],declarations:[P,v],providers:[R]}]}],e}(); /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ e.MAT_MENU_DEFAULT_OPTIONS=k,e.MAT_MENU_PANEL=b,e.MAT_MENU_SCROLL_STRATEGY=E,e.MatMenu=x,e.MatMenuContent=y,e.MatMenuItem=v,e.MatMenuModule=A,e.MatMenuTrigger=D,e._MatMenu=P,e._MatMenuBase=C,e._MatMenuDirectivesModule=T,e.fadeInItems=g,e.matMenuAnimations=_,e.transformMenu=f,e.ɵangular_material_src_material_menu_menu_a=I,e.ɵangular_material_src_material_menu_menu_b=w,e.ɵangular_material_src_material_menu_menu_c=R,Object.defineProperty(e,"__esModule",{value:!0})}));