source: trip-planner-front/node_modules/@angular/material/bundles/material-menu.umd.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 82.0 KB
Line 
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, 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'), require('@angular/cdk/scrolling')) :
3 typeof define === 'function' && define.amd ? define('@angular/material/menu', ['exports', '@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', '@angular/cdk/scrolling'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.menu = {}), global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.cdk.keycodes, global.ng.core, global.rxjs, global.rxjs.operators, global.ng.animations, global.ng.cdk.portal, global.ng.common, global.ng.material.core, global.ng.cdk.bidi, global.ng.cdk.overlay, global.ng.cdk.platform, global.ng.cdk.scrolling));
5}(this, (function (exports, a11y, coercion, keycodes, core, rxjs, operators, animations, portal, common, core$1, bidi, overlay, platform, scrolling) { 'use strict';
6
7 /*! *****************************************************************************
8 Copyright (c) Microsoft Corporation.
9
10 Permission to use, copy, modify, and/or distribute this software for any
11 purpose with or without fee is hereby granted.
12
13 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 PERFORMANCE OF THIS SOFTWARE.
20 ***************************************************************************** */
21 /* global Reflect, Promise */
22 var extendStatics = function (d, b) {
23 extendStatics = Object.setPrototypeOf ||
24 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25 function (d, b) { for (var p in b)
26 if (Object.prototype.hasOwnProperty.call(b, p))
27 d[p] = b[p]; };
28 return extendStatics(d, b);
29 };
30 function __extends(d, b) {
31 if (typeof b !== "function" && b !== null)
32 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33 extendStatics(d, b);
34 function __() { this.constructor = d; }
35 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36 }
37 var __assign = function () {
38 __assign = Object.assign || function __assign(t) {
39 for (var s, i = 1, n = arguments.length; i < n; i++) {
40 s = arguments[i];
41 for (var p in s)
42 if (Object.prototype.hasOwnProperty.call(s, p))
43 t[p] = s[p];
44 }
45 return t;
46 };
47 return __assign.apply(this, arguments);
48 };
49 function __rest(s, e) {
50 var t = {};
51 for (var p in s)
52 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
53 t[p] = s[p];
54 if (s != null && typeof Object.getOwnPropertySymbols === "function")
55 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
56 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
57 t[p[i]] = s[p[i]];
58 }
59 return t;
60 }
61 function __decorate(decorators, target, key, desc) {
62 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
63 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
64 r = Reflect.decorate(decorators, target, key, desc);
65 else
66 for (var i = decorators.length - 1; i >= 0; i--)
67 if (d = decorators[i])
68 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
69 return c > 3 && r && Object.defineProperty(target, key, r), r;
70 }
71 function __param(paramIndex, decorator) {
72 return function (target, key) { decorator(target, key, paramIndex); };
73 }
74 function __metadata(metadataKey, metadataValue) {
75 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76 return Reflect.metadata(metadataKey, metadataValue);
77 }
78 function __awaiter(thisArg, _arguments, P, generator) {
79 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
80 return new (P || (P = Promise))(function (resolve, reject) {
81 function fulfilled(value) { try {
82 step(generator.next(value));
83 }
84 catch (e) {
85 reject(e);
86 } }
87 function rejected(value) { try {
88 step(generator["throw"](value));
89 }
90 catch (e) {
91 reject(e);
92 } }
93 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
94 step((generator = generator.apply(thisArg, _arguments || [])).next());
95 });
96 }
97 function __generator(thisArg, body) {
98 var _ = { label: 0, sent: function () { if (t[0] & 1)
99 throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
100 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
101 function verb(n) { return function (v) { return step([n, v]); }; }
102 function step(op) {
103 if (f)
104 throw new TypeError("Generator is already executing.");
105 while (_)
106 try {
107 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
108 return t;
109 if (y = 0, t)
110 op = [op[0] & 2, t.value];
111 switch (op[0]) {
112 case 0:
113 case 1:
114 t = op;
115 break;
116 case 4:
117 _.label++;
118 return { value: op[1], done: false };
119 case 5:
120 _.label++;
121 y = op[1];
122 op = [0];
123 continue;
124 case 7:
125 op = _.ops.pop();
126 _.trys.pop();
127 continue;
128 default:
129 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
130 _ = 0;
131 continue;
132 }
133 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
134 _.label = op[1];
135 break;
136 }
137 if (op[0] === 6 && _.label < t[1]) {
138 _.label = t[1];
139 t = op;
140 break;
141 }
142 if (t && _.label < t[2]) {
143 _.label = t[2];
144 _.ops.push(op);
145 break;
146 }
147 if (t[2])
148 _.ops.pop();
149 _.trys.pop();
150 continue;
151 }
152 op = body.call(thisArg, _);
153 }
154 catch (e) {
155 op = [6, e];
156 y = 0;
157 }
158 finally {
159 f = t = 0;
160 }
161 if (op[0] & 5)
162 throw op[1];
163 return { value: op[0] ? op[1] : void 0, done: true };
164 }
165 }
166 var __createBinding = Object.create ? (function (o, m, k, k2) {
167 if (k2 === undefined)
168 k2 = k;
169 Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
170 }) : (function (o, m, k, k2) {
171 if (k2 === undefined)
172 k2 = k;
173 o[k2] = m[k];
174 });
175 function __exportStar(m, o) {
176 for (var p in m)
177 if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
178 __createBinding(o, m, p);
179 }
180 function __values(o) {
181 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
182 if (m)
183 return m.call(o);
184 if (o && typeof o.length === "number")
185 return {
186 next: function () {
187 if (o && i >= o.length)
188 o = void 0;
189 return { value: o && o[i++], done: !o };
190 }
191 };
192 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
193 }
194 function __read(o, n) {
195 var m = typeof Symbol === "function" && o[Symbol.iterator];
196 if (!m)
197 return o;
198 var i = m.call(o), r, ar = [], e;
199 try {
200 while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
201 ar.push(r.value);
202 }
203 catch (error) {
204 e = { error: error };
205 }
206 finally {
207 try {
208 if (r && !r.done && (m = i["return"]))
209 m.call(i);
210 }
211 finally {
212 if (e)
213 throw e.error;
214 }
215 }
216 return ar;
217 }
218 /** @deprecated */
219 function __spread() {
220 for (var ar = [], i = 0; i < arguments.length; i++)
221 ar = ar.concat(__read(arguments[i]));
222 return ar;
223 }
224 /** @deprecated */
225 function __spreadArrays() {
226 for (var s = 0, i = 0, il = arguments.length; i < il; i++)
227 s += arguments[i].length;
228 for (var r = Array(s), k = 0, i = 0; i < il; i++)
229 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
230 r[k] = a[j];
231 return r;
232 }
233 function __spreadArray(to, from, pack) {
234 if (pack || arguments.length === 2)
235 for (var i = 0, l = from.length, ar; i < l; i++) {
236 if (ar || !(i in from)) {
237 if (!ar)
238 ar = Array.prototype.slice.call(from, 0, i);
239 ar[i] = from[i];
240 }
241 }
242 return to.concat(ar || from);
243 }
244 function __await(v) {
245 return this instanceof __await ? (this.v = v, this) : new __await(v);
246 }
247 function __asyncGenerator(thisArg, _arguments, generator) {
248 if (!Symbol.asyncIterator)
249 throw new TypeError("Symbol.asyncIterator is not defined.");
250 var g = generator.apply(thisArg, _arguments || []), i, q = [];
251 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
252 function verb(n) { if (g[n])
253 i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
254 function resume(n, v) { try {
255 step(g[n](v));
256 }
257 catch (e) {
258 settle(q[0][3], e);
259 } }
260 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
261 function fulfill(value) { resume("next", value); }
262 function reject(value) { resume("throw", value); }
263 function settle(f, v) { if (f(v), q.shift(), q.length)
264 resume(q[0][0], q[0][1]); }
265 }
266 function __asyncDelegator(o) {
267 var i, p;
268 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
269 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
270 }
271 function __asyncValues(o) {
272 if (!Symbol.asyncIterator)
273 throw new TypeError("Symbol.asyncIterator is not defined.");
274 var m = o[Symbol.asyncIterator], i;
275 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
276 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
277 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
278 }
279 function __makeTemplateObject(cooked, raw) {
280 if (Object.defineProperty) {
281 Object.defineProperty(cooked, "raw", { value: raw });
282 }
283 else {
284 cooked.raw = raw;
285 }
286 return cooked;
287 }
288 ;
289 var __setModuleDefault = Object.create ? (function (o, v) {
290 Object.defineProperty(o, "default", { enumerable: true, value: v });
291 }) : function (o, v) {
292 o["default"] = v;
293 };
294 function __importStar(mod) {
295 if (mod && mod.__esModule)
296 return mod;
297 var result = {};
298 if (mod != null)
299 for (var k in mod)
300 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
301 __createBinding(result, mod, k);
302 __setModuleDefault(result, mod);
303 return result;
304 }
305 function __importDefault(mod) {
306 return (mod && mod.__esModule) ? mod : { default: mod };
307 }
308 function __classPrivateFieldGet(receiver, state, kind, f) {
309 if (kind === "a" && !f)
310 throw new TypeError("Private accessor was defined without a getter");
311 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
312 throw new TypeError("Cannot read private member from an object whose class did not declare it");
313 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
314 }
315 function __classPrivateFieldSet(receiver, state, value, kind, f) {
316 if (kind === "m")
317 throw new TypeError("Private method is not writable");
318 if (kind === "a" && !f)
319 throw new TypeError("Private accessor was defined without a setter");
320 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
321 throw new TypeError("Cannot write private member to an object whose class did not declare it");
322 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
323 }
324
325 /**
326 * @license
327 * Copyright Google LLC All Rights Reserved.
328 *
329 * Use of this source code is governed by an MIT-style license that can be
330 * found in the LICENSE file at https://angular.io/license
331 */
332 /**
333 * Animations used by the mat-menu component.
334 * Animation duration and timing values are based on:
335 * https://material.io/guidelines/components/menus.html#menus-usage
336 * @docs-private
337 */
338 var matMenuAnimations = {
339 /**
340 * This animation controls the menu panel's entry and exit from the page.
341 *
342 * When the menu panel is added to the DOM, it scales in and fades in its border.
343 *
344 * When the menu panel is removed from the DOM, it simply fades out after a brief
345 * delay to display the ripple.
346 */
347 transformMenu: animations.trigger('transformMenu', [
348 animations.state('void', animations.style({
349 opacity: 0,
350 transform: 'scale(0.8)'
351 })),
352 animations.transition('void => enter', animations.animate('120ms cubic-bezier(0, 0, 0.2, 1)', animations.style({
353 opacity: 1,
354 transform: 'scale(1)'
355 }))),
356 animations.transition('* => void', animations.animate('100ms 25ms linear', animations.style({ opacity: 0 })))
357 ]),
358 /**
359 * This animation fades in the background color and content of the menu panel
360 * after its containing element is scaled in.
361 */
362 fadeInItems: animations.trigger('fadeInItems', [
363 // TODO(crisbeto): this is inside the `transformMenu`
364 // now. Remove next time we do breaking changes.
365 animations.state('showing', animations.style({ opacity: 1 })),
366 animations.transition('void => *', [
367 animations.style({ opacity: 0 }),
368 animations.animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')
369 ])
370 ])
371 };
372 /**
373 * @deprecated
374 * @breaking-change 8.0.0
375 * @docs-private
376 */
377 var fadeInItems = matMenuAnimations.fadeInItems;
378 /**
379 * @deprecated
380 * @breaking-change 8.0.0
381 * @docs-private
382 */
383 var transformMenu = matMenuAnimations.transformMenu;
384
385 /**
386 * Injection token that can be used to reference instances of `MatMenuContent`. It serves
387 * as alternative token to the actual `MatMenuContent` class which could cause unnecessary
388 * retention of the class and its directive metadata.
389 */
390 var MAT_MENU_CONTENT = new core.InjectionToken('MatMenuContent');
391 var _MatMenuContentBase = /** @class */ (function () {
392 function _MatMenuContentBase(_template, _componentFactoryResolver, _appRef, _injector, _viewContainerRef, _document, _changeDetectorRef) {
393 this._template = _template;
394 this._componentFactoryResolver = _componentFactoryResolver;
395 this._appRef = _appRef;
396 this._injector = _injector;
397 this._viewContainerRef = _viewContainerRef;
398 this._document = _document;
399 this._changeDetectorRef = _changeDetectorRef;
400 /** Emits when the menu content has been attached. */
401 this._attached = new rxjs.Subject();
402 }
403 /**
404 * Attaches the content with a particular context.
405 * @docs-private
406 */
407 _MatMenuContentBase.prototype.attach = function (context) {
408 if (context === void 0) { context = {}; }
409 if (!this._portal) {
410 this._portal = new portal.TemplatePortal(this._template, this._viewContainerRef);
411 }
412 this.detach();
413 if (!this._outlet) {
414 this._outlet = new portal.DomPortalOutlet(this._document.createElement('div'), this._componentFactoryResolver, this._appRef, this._injector);
415 }
416 var element = this._template.elementRef.nativeElement;
417 // Because we support opening the same menu from different triggers (which in turn have their
418 // own `OverlayRef` panel), we have to re-insert the host element every time, otherwise we
419 // risk it staying attached to a pane that's no longer in the DOM.
420 element.parentNode.insertBefore(this._outlet.outletElement, element);
421 // When `MatMenuContent` is used in an `OnPush` component, the insertion of the menu
422 // content via `createEmbeddedView` does not cause the content to be seen as "dirty"
423 // by Angular. This causes the `@ContentChildren` for menu items within the menu to
424 // not be updated by Angular. By explicitly marking for check here, we tell Angular that
425 // it needs to check for new menu items and update the `@ContentChild` in `MatMenu`.
426 // @breaking-change 9.0.0 Make change detector ref required
427 if (this._changeDetectorRef) {
428 this._changeDetectorRef.markForCheck();
429 }
430 this._portal.attach(this._outlet, context);
431 this._attached.next();
432 };
433 /**
434 * Detaches the content.
435 * @docs-private
436 */
437 _MatMenuContentBase.prototype.detach = function () {
438 if (this._portal.isAttached) {
439 this._portal.detach();
440 }
441 };
442 _MatMenuContentBase.prototype.ngOnDestroy = function () {
443 if (this._outlet) {
444 this._outlet.dispose();
445 }
446 };
447 return _MatMenuContentBase;
448 }());
449 _MatMenuContentBase.decorators = [
450 { type: core.Directive }
451 ];
452 _MatMenuContentBase.ctorParameters = function () { return [
453 { type: core.TemplateRef },
454 { type: core.ComponentFactoryResolver },
455 { type: core.ApplicationRef },
456 { type: core.Injector },
457 { type: core.ViewContainerRef },
458 { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
459 { type: core.ChangeDetectorRef }
460 ]; };
461 /**
462 * Menu content that will be rendered lazily once the menu is opened.
463 */
464 var MatMenuContent = /** @class */ (function (_super) {
465 __extends(MatMenuContent, _super);
466 function MatMenuContent() {
467 return _super !== null && _super.apply(this, arguments) || this;
468 }
469 return MatMenuContent;
470 }(_MatMenuContentBase));
471 MatMenuContent.decorators = [
472 { type: core.Directive, args: [{
473 selector: 'ng-template[matMenuContent]',
474 providers: [{ provide: MAT_MENU_CONTENT, useExisting: MatMenuContent }],
475 },] }
476 ];
477
478 /**
479 * @license
480 * Copyright Google LLC All Rights Reserved.
481 *
482 * Use of this source code is governed by an MIT-style license that can be
483 * found in the LICENSE file at https://angular.io/license
484 */
485 /**
486 * Throws an exception for the case when menu trigger doesn't have a valid mat-menu instance
487 * @docs-private
488 */
489 function throwMatMenuMissingError() {
490 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>");
491 }
492 /**
493 * Throws an exception for the case when menu's x-position value isn't valid.
494 * In other words, it doesn't match 'before' or 'after'.
495 * @docs-private
496 */
497 function throwMatMenuInvalidPositionX() {
498 throw Error("xPosition value must be either 'before' or after'.\n Example: <mat-menu xPosition=\"before\" #menu=\"matMenu\"></mat-menu>");
499 }
500 /**
501 * Throws an exception for the case when menu's y-position value isn't valid.
502 * In other words, it doesn't match 'above' or 'below'.
503 * @docs-private
504 */
505 function throwMatMenuInvalidPositionY() {
506 throw Error("yPosition value must be either 'above' or below'.\n Example: <mat-menu yPosition=\"above\" #menu=\"matMenu\"></mat-menu>");
507 }
508 /**
509 * Throws an exception for the case when a menu is assigned
510 * to a trigger that is placed inside the same menu.
511 * @docs-private
512 */
513 function throwMatMenuRecursiveError() {
514 throw Error("matMenuTriggerFor: menu cannot contain its own trigger. Assign a menu that is " +
515 "not a parent of the trigger or move the trigger outside of the menu.");
516 }
517
518 /**
519 * @license
520 * Copyright Google LLC All Rights Reserved.
521 *
522 * Use of this source code is governed by an MIT-style license that can be
523 * found in the LICENSE file at https://angular.io/license
524 */
525 /**
526 * Injection token used to provide the parent menu to menu-specific components.
527 * @docs-private
528 */
529 var MAT_MENU_PANEL = new core.InjectionToken('MAT_MENU_PANEL');
530
531 // Boilerplate for applying mixins to MatMenuItem.
532 /** @docs-private */
533 var _MatMenuItemBase = core$1.mixinDisableRipple(core$1.mixinDisabled(/** @class */ (function () {
534 function class_1() {
535 }
536 return class_1;
537 }())));
538 /**
539 * Single item inside of a `mat-menu`. Provides the menu item styling and accessibility treatment.
540 */
541 var MatMenuItem = /** @class */ (function (_super) {
542 __extends(MatMenuItem, _super);
543 function MatMenuItem(_elementRef,
544 /**
545 * @deprecated `_document` parameter is no longer being used and will be removed.
546 * @breaking-change 12.0.0
547 */
548 _document, _focusMonitor, _parentMenu,
549 /**
550 * @deprecated `_changeDetectorRef` to become a required parameter.
551 * @breaking-change 14.0.0
552 */
553 _changeDetectorRef) {
554 var _this =
555 // @breaking-change 8.0.0 make `_focusMonitor` and `document` required params.
556 _super.call(this) || this;
557 _this._elementRef = _elementRef;
558 _this._focusMonitor = _focusMonitor;
559 _this._parentMenu = _parentMenu;
560 _this._changeDetectorRef = _changeDetectorRef;
561 /** ARIA role for the menu item. */
562 _this.role = 'menuitem';
563 /** Stream that emits when the menu item is hovered. */
564 _this._hovered = new rxjs.Subject();
565 /** Stream that emits when the menu item is focused. */
566 _this._focused = new rxjs.Subject();
567 /** Whether the menu item is highlighted. */
568 _this._highlighted = false;
569 /** Whether the menu item acts as a trigger for a sub-menu. */
570 _this._triggersSubmenu = false;
571 if (_parentMenu && _parentMenu.addItem) {
572 _parentMenu.addItem(_this);
573 }
574 return _this;
575 }
576 /** Focuses the menu item. */
577 MatMenuItem.prototype.focus = function (origin, options) {
578 if (this._focusMonitor && origin) {
579 this._focusMonitor.focusVia(this._getHostElement(), origin, options);
580 }
581 else {
582 this._getHostElement().focus(options);
583 }
584 this._focused.next(this);
585 };
586 MatMenuItem.prototype.ngAfterViewInit = function () {
587 if (this._focusMonitor) {
588 // Start monitoring the element so it gets the appropriate focused classes. We want
589 // to show the focus style for menu items only when the focus was not caused by a
590 // mouse or touch interaction.
591 this._focusMonitor.monitor(this._elementRef, false);
592 }
593 };
594 MatMenuItem.prototype.ngOnDestroy = function () {
595 if (this._focusMonitor) {
596 this._focusMonitor.stopMonitoring(this._elementRef);
597 }
598 if (this._parentMenu && this._parentMenu.removeItem) {
599 this._parentMenu.removeItem(this);
600 }
601 this._hovered.complete();
602 this._focused.complete();
603 };
604 /** Used to set the `tabindex`. */
605 MatMenuItem.prototype._getTabIndex = function () {
606 return this.disabled ? '-1' : '0';
607 };
608 /** Returns the host DOM element. */
609 MatMenuItem.prototype._getHostElement = function () {
610 return this._elementRef.nativeElement;
611 };
612 /** Prevents the default element actions if it is disabled. */
613 // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
614 // In Ivy the `host` bindings will be merged when this class is extended, whereas in
615 // ViewEngine they're overwritten.
616 // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
617 // tslint:disable-next-line:no-host-decorator-in-concrete
618 MatMenuItem.prototype._checkDisabled = function (event) {
619 if (this.disabled) {
620 event.preventDefault();
621 event.stopPropagation();
622 }
623 };
624 /** Emits to the hover stream. */
625 // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
626 // In Ivy the `host` bindings will be merged when this class is extended, whereas in
627 // ViewEngine they're overwritten.
628 // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
629 // tslint:disable-next-line:no-host-decorator-in-concrete
630 MatMenuItem.prototype._handleMouseEnter = function () {
631 this._hovered.next(this);
632 };
633 /** Gets the label to be used when determining whether the option should be focused. */
634 MatMenuItem.prototype.getLabel = function () {
635 var _a, _b;
636 var clone = this._elementRef.nativeElement.cloneNode(true);
637 var icons = clone.querySelectorAll('mat-icon, .material-icons');
638 // Strip away icons so they don't show up in the text.
639 for (var i = 0; i < icons.length; i++) {
640 var icon = icons[i];
641 (_a = icon.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(icon);
642 }
643 return ((_b = clone.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '';
644 };
645 MatMenuItem.prototype._setHighlighted = function (isHighlighted) {
646 var _a;
647 // We need to mark this for check for the case where the content is coming from a
648 // `matMenuContent` whose change detection tree is at the declaration position,
649 // not the insertion position. See #23175.
650 // @breaking-change 14.0.0 Remove null check for `_changeDetectorRef`.
651 this._highlighted = isHighlighted;
652 (_a = this._changeDetectorRef) === null || _a === void 0 ? void 0 : _a.markForCheck();
653 };
654 return MatMenuItem;
655 }(_MatMenuItemBase));
656 MatMenuItem.decorators = [
657 { type: core.Component, args: [{
658 selector: '[mat-menu-item]',
659 exportAs: 'matMenuItem',
660 inputs: ['disabled', 'disableRipple'],
661 host: {
662 '[attr.role]': 'role',
663 '[class.mat-menu-item]': 'true',
664 '[class.mat-menu-item-highlighted]': '_highlighted',
665 '[class.mat-menu-item-submenu-trigger]': '_triggersSubmenu',
666 '[attr.tabindex]': '_getTabIndex()',
667 '[attr.aria-disabled]': 'disabled.toString()',
668 '[attr.disabled]': 'disabled || null',
669 'class': 'mat-focus-indicator',
670 },
671 changeDetection: core.ChangeDetectionStrategy.OnPush,
672 encapsulation: core.ViewEncapsulation.None,
673 template: "<ng-content></ng-content>\n<div class=\"mat-menu-ripple\" matRipple\n [matRippleDisabled]=\"disableRipple || disabled\"\n [matRippleTrigger]=\"_getHostElement()\">\n</div>\n\n<svg\n *ngIf=\"_triggersSubmenu\"\n class=\"mat-menu-submenu-icon\"\n viewBox=\"0 0 5 10\"\n focusable=\"false\"><polygon points=\"0,0 5,5 0,10\"/></svg>\n"
674 },] }
675 ];
676 MatMenuItem.ctorParameters = function () { return [
677 { type: core.ElementRef },
678 { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
679 { type: a11y.FocusMonitor },
680 { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_PANEL,] }, { type: core.Optional }] },
681 { type: core.ChangeDetectorRef }
682 ]; };
683 MatMenuItem.propDecorators = {
684 role: [{ type: core.Input }],
685 _checkDisabled: [{ type: core.HostListener, args: ['click', ['$event'],] }],
686 _handleMouseEnter: [{ type: core.HostListener, args: ['mouseenter',] }]
687 };
688
689 /** Injection token to be used to override the default options for `mat-menu`. */
690 var MAT_MENU_DEFAULT_OPTIONS = new core.InjectionToken('mat-menu-default-options', {
691 providedIn: 'root',
692 factory: MAT_MENU_DEFAULT_OPTIONS_FACTORY
693 });
694 /** @docs-private */
695 function MAT_MENU_DEFAULT_OPTIONS_FACTORY() {
696 return {
697 overlapTrigger: false,
698 xPosition: 'after',
699 yPosition: 'below',
700 backdropClass: 'cdk-overlay-transparent-backdrop',
701 };
702 }
703 var menuPanelUid = 0;
704 /** Base class with all of the `MatMenu` functionality. */
705 var _MatMenuBase = /** @class */ (function () {
706 function _MatMenuBase(_elementRef, _ngZone, _defaultOptions) {
707 this._elementRef = _elementRef;
708 this._ngZone = _ngZone;
709 this._defaultOptions = _defaultOptions;
710 this._xPosition = this._defaultOptions.xPosition;
711 this._yPosition = this._defaultOptions.yPosition;
712 /** Only the direct descendant menu items. */
713 this._directDescendantItems = new core.QueryList();
714 /** Subscription to tab events on the menu panel */
715 this._tabSubscription = rxjs.Subscription.EMPTY;
716 /** Config object to be passed into the menu's ngClass */
717 this._classList = {};
718 /** Current state of the panel animation. */
719 this._panelAnimationState = 'void';
720 /** Emits whenever an animation on the menu completes. */
721 this._animationDone = new rxjs.Subject();
722 /** Class or list of classes to be added to the overlay panel. */
723 this.overlayPanelClass = this._defaultOptions.overlayPanelClass || '';
724 /** Class to be added to the backdrop element. */
725 this.backdropClass = this._defaultOptions.backdropClass;
726 this._overlapTrigger = this._defaultOptions.overlapTrigger;
727 this._hasBackdrop = this._defaultOptions.hasBackdrop;
728 /** Event emitted when the menu is closed. */
729 this.closed = new core.EventEmitter();
730 /**
731 * Event emitted when the menu is closed.
732 * @deprecated Switch to `closed` instead
733 * @breaking-change 8.0.0
734 */
735 this.close = this.closed;
736 this.panelId = "mat-menu-panel-" + menuPanelUid++;
737 }
738 Object.defineProperty(_MatMenuBase.prototype, "xPosition", {
739 /** Position of the menu in the X axis. */
740 get: function () { return this._xPosition; },
741 set: function (value) {
742 if (value !== 'before' && value !== 'after' &&
743 (typeof ngDevMode === 'undefined' || ngDevMode)) {
744 throwMatMenuInvalidPositionX();
745 }
746 this._xPosition = value;
747 this.setPositionClasses();
748 },
749 enumerable: false,
750 configurable: true
751 });
752 Object.defineProperty(_MatMenuBase.prototype, "yPosition", {
753 /** Position of the menu in the Y axis. */
754 get: function () { return this._yPosition; },
755 set: function (value) {
756 if (value !== 'above' && value !== 'below' && (typeof ngDevMode === 'undefined' || ngDevMode)) {
757 throwMatMenuInvalidPositionY();
758 }
759 this._yPosition = value;
760 this.setPositionClasses();
761 },
762 enumerable: false,
763 configurable: true
764 });
765 Object.defineProperty(_MatMenuBase.prototype, "overlapTrigger", {
766 /** Whether the menu should overlap its trigger. */
767 get: function () { return this._overlapTrigger; },
768 set: function (value) {
769 this._overlapTrigger = coercion.coerceBooleanProperty(value);
770 },
771 enumerable: false,
772 configurable: true
773 });
774 Object.defineProperty(_MatMenuBase.prototype, "hasBackdrop", {
775 /** Whether the menu has a backdrop. */
776 get: function () { return this._hasBackdrop; },
777 set: function (value) {
778 this._hasBackdrop = coercion.coerceBooleanProperty(value);
779 },
780 enumerable: false,
781 configurable: true
782 });
783 Object.defineProperty(_MatMenuBase.prototype, "panelClass", {
784 /**
785 * This method takes classes set on the host mat-menu element and applies them on the
786 * menu template that displays in the overlay container. Otherwise, it's difficult
787 * to style the containing menu from outside the component.
788 * @param classes list of class names
789 */
790 set: function (classes) {
791 var _this = this;
792 var previousPanelClass = this._previousPanelClass;
793 if (previousPanelClass && previousPanelClass.length) {
794 previousPanelClass.split(' ').forEach(function (className) {
795 _this._classList[className] = false;
796 });
797 }
798 this._previousPanelClass = classes;
799 if (classes && classes.length) {
800 classes.split(' ').forEach(function (className) {
801 _this._classList[className] = true;
802 });
803 this._elementRef.nativeElement.className = '';
804 }
805 },
806 enumerable: false,
807 configurable: true
808 });
809 Object.defineProperty(_MatMenuBase.prototype, "classList", {
810 /**
811 * This method takes classes set on the host mat-menu element and applies them on the
812 * menu template that displays in the overlay container. Otherwise, it's difficult
813 * to style the containing menu from outside the component.
814 * @deprecated Use `panelClass` instead.
815 * @breaking-change 8.0.0
816 */
817 get: function () { return this.panelClass; },
818 set: function (classes) { this.panelClass = classes; },
819 enumerable: false,
820 configurable: true
821 });
822 _MatMenuBase.prototype.ngOnInit = function () {
823 this.setPositionClasses();
824 };
825 _MatMenuBase.prototype.ngAfterContentInit = function () {
826 var _this = this;
827 this._updateDirectDescendants();
828 this._keyManager = new a11y.FocusKeyManager(this._directDescendantItems)
829 .withWrap()
830 .withTypeAhead()
831 .withHomeAndEnd();
832 this._tabSubscription = this._keyManager.tabOut.subscribe(function () { return _this.closed.emit('tab'); });
833 // If a user manually (programmatically) focuses a menu item, we need to reflect that focus
834 // change back to the key manager. Note that we don't need to unsubscribe here because _focused
835 // is internal and we know that it gets completed on destroy.
836 this._directDescendantItems.changes.pipe(operators.startWith(this._directDescendantItems), operators.switchMap(function (items) { return rxjs.merge.apply(void 0, __spreadArray([], __read(items.map(function (item) { return item._focused; })))); })).subscribe(function (focusedItem) { return _this._keyManager.updateActiveItem(focusedItem); });
837 };
838 _MatMenuBase.prototype.ngOnDestroy = function () {
839 this._directDescendantItems.destroy();
840 this._tabSubscription.unsubscribe();
841 this.closed.complete();
842 };
843 /** Stream that emits whenever the hovered menu item changes. */
844 _MatMenuBase.prototype._hovered = function () {
845 // Coerce the `changes` property because Angular types it as `Observable<any>`
846 var itemChanges = this._directDescendantItems.changes;
847 return itemChanges.pipe(operators.startWith(this._directDescendantItems), operators.switchMap(function (items) { return rxjs.merge.apply(void 0, __spreadArray([], __read(items.map(function (item) { return item._hovered; })))); }));
848 };
849 /*
850 * Registers a menu item with the menu.
851 * @docs-private
852 * @deprecated No longer being used. To be removed.
853 * @breaking-change 9.0.0
854 */
855 _MatMenuBase.prototype.addItem = function (_item) { };
856 /**
857 * Removes an item from the menu.
858 * @docs-private
859 * @deprecated No longer being used. To be removed.
860 * @breaking-change 9.0.0
861 */
862 _MatMenuBase.prototype.removeItem = function (_item) { };
863 /** Handle a keyboard event from the menu, delegating to the appropriate action. */
864 _MatMenuBase.prototype._handleKeydown = function (event) {
865 var keyCode = event.keyCode;
866 var manager = this._keyManager;
867 switch (keyCode) {
868 case keycodes.ESCAPE:
869 if (!keycodes.hasModifierKey(event)) {
870 event.preventDefault();
871 this.closed.emit('keydown');
872 }
873 break;
874 case keycodes.LEFT_ARROW:
875 if (this.parentMenu && this.direction === 'ltr') {
876 this.closed.emit('keydown');
877 }
878 break;
879 case keycodes.RIGHT_ARROW:
880 if (this.parentMenu && this.direction === 'rtl') {
881 this.closed.emit('keydown');
882 }
883 break;
884 default:
885 if (keyCode === keycodes.UP_ARROW || keyCode === keycodes.DOWN_ARROW) {
886 manager.setFocusOrigin('keyboard');
887 }
888 manager.onKeydown(event);
889 }
890 };
891 /**
892 * Focus the first item in the menu.
893 * @param origin Action from which the focus originated. Used to set the correct styling.
894 */
895 _MatMenuBase.prototype.focusFirstItem = function (origin) {
896 var _this = this;
897 if (origin === void 0) { origin = 'program'; }
898 // When the content is rendered lazily, it takes a bit before the items are inside the DOM.
899 if (this.lazyContent) {
900 this._ngZone.onStable
901 .pipe(operators.take(1))
902 .subscribe(function () { return _this._focusFirstItem(origin); });
903 }
904 else {
905 this._focusFirstItem(origin);
906 }
907 };
908 /**
909 * Actual implementation that focuses the first item. Needs to be separated
910 * out so we don't repeat the same logic in the public `focusFirstItem` method.
911 */
912 _MatMenuBase.prototype._focusFirstItem = function (origin) {
913 var manager = this._keyManager;
914 manager.setFocusOrigin(origin).setFirstItemActive();
915 // If there's no active item at this point, it means that all the items are disabled.
916 // Move focus to the menu panel so keyboard events like Escape still work. Also this will
917 // give _some_ feedback to screen readers.
918 if (!manager.activeItem && this._directDescendantItems.length) {
919 var element = this._directDescendantItems.first._getHostElement().parentElement;
920 // Because the `mat-menu` is at the DOM insertion point, not inside the overlay, we don't
921 // have a nice way of getting a hold of the menu panel. We can't use a `ViewChild` either
922 // because the panel is inside an `ng-template`. We work around it by starting from one of
923 // the items and walking up the DOM.
924 while (element) {
925 if (element.getAttribute('role') === 'menu') {
926 element.focus();
927 break;
928 }
929 else {
930 element = element.parentElement;
931 }
932 }
933 }
934 };
935 /**
936 * Resets the active item in the menu. This is used when the menu is opened, allowing
937 * the user to start from the first option when pressing the down arrow.
938 */
939 _MatMenuBase.prototype.resetActiveItem = function () {
940 this._keyManager.setActiveItem(-1);
941 };
942 /**
943 * Sets the menu panel elevation.
944 * @param depth Number of parent menus that come before the menu.
945 */
946 _MatMenuBase.prototype.setElevation = function (depth) {
947 var _this = this;
948 // The elevation starts at the base and increases by one for each level.
949 // Capped at 24 because that's the maximum elevation defined in the Material design spec.
950 var elevation = Math.min(this._baseElevation + depth, 24);
951 var newElevation = "" + this._elevationPrefix + elevation;
952 var customElevation = Object.keys(this._classList).find(function (className) {
953 return className.startsWith(_this._elevationPrefix);
954 });
955 if (!customElevation || customElevation === this._previousElevation) {
956 if (this._previousElevation) {
957 this._classList[this._previousElevation] = false;
958 }
959 this._classList[newElevation] = true;
960 this._previousElevation = newElevation;
961 }
962 };
963 /**
964 * Adds classes to the menu panel based on its position. Can be used by
965 * consumers to add specific styling based on the position.
966 * @param posX Position of the menu along the x axis.
967 * @param posY Position of the menu along the y axis.
968 * @docs-private
969 */
970 _MatMenuBase.prototype.setPositionClasses = function (posX, posY) {
971 if (posX === void 0) { posX = this.xPosition; }
972 if (posY === void 0) { posY = this.yPosition; }
973 var classes = this._classList;
974 classes['mat-menu-before'] = posX === 'before';
975 classes['mat-menu-after'] = posX === 'after';
976 classes['mat-menu-above'] = posY === 'above';
977 classes['mat-menu-below'] = posY === 'below';
978 };
979 /** Starts the enter animation. */
980 _MatMenuBase.prototype._startAnimation = function () {
981 // @breaking-change 8.0.0 Combine with _resetAnimation.
982 this._panelAnimationState = 'enter';
983 };
984 /** Resets the panel animation to its initial state. */
985 _MatMenuBase.prototype._resetAnimation = function () {
986 // @breaking-change 8.0.0 Combine with _startAnimation.
987 this._panelAnimationState = 'void';
988 };
989 /** Callback that is invoked when the panel animation completes. */
990 _MatMenuBase.prototype._onAnimationDone = function (event) {
991 this._animationDone.next(event);
992 this._isAnimating = false;
993 };
994 _MatMenuBase.prototype._onAnimationStart = function (event) {
995 this._isAnimating = true;
996 // Scroll the content element to the top as soon as the animation starts. This is necessary,
997 // because we move focus to the first item while it's still being animated, which can throw
998 // the browser off when it determines the scroll position. Alternatively we can move focus
999 // when the animation is done, however moving focus asynchronously will interrupt screen
1000 // readers which are in the process of reading out the menu already. We take the `element`
1001 // from the `event` since we can't use a `ViewChild` to access the pane.
1002 if (event.toState === 'enter' && this._keyManager.activeItemIndex === 0) {
1003 event.element.scrollTop = 0;
1004 }
1005 };
1006 /**
1007 * Sets up a stream that will keep track of any newly-added menu items and will update the list
1008 * of direct descendants. We collect the descendants this way, because `_allItems` can include
1009 * items that are part of child menus, and using a custom way of registering items is unreliable
1010 * when it comes to maintaining the item order.
1011 */
1012 _MatMenuBase.prototype._updateDirectDescendants = function () {
1013 var _this = this;
1014 this._allItems.changes
1015 .pipe(operators.startWith(this._allItems))
1016 .subscribe(function (items) {
1017 _this._directDescendantItems.reset(items.filter(function (item) { return item._parentMenu === _this; }));
1018 _this._directDescendantItems.notifyOnChanges();
1019 });
1020 };
1021 return _MatMenuBase;
1022 }());
1023 _MatMenuBase.decorators = [
1024 { type: core.Directive }
1025 ];
1026 _MatMenuBase.ctorParameters = function () { return [
1027 { type: core.ElementRef },
1028 { type: core.NgZone },
1029 { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_DEFAULT_OPTIONS,] }] }
1030 ]; };
1031 _MatMenuBase.propDecorators = {
1032 _allItems: [{ type: core.ContentChildren, args: [MatMenuItem, { descendants: true },] }],
1033 backdropClass: [{ type: core.Input }],
1034 ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
1035 ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }],
1036 ariaDescribedby: [{ type: core.Input, args: ['aria-describedby',] }],
1037 xPosition: [{ type: core.Input }],
1038 yPosition: [{ type: core.Input }],
1039 templateRef: [{ type: core.ViewChild, args: [core.TemplateRef,] }],
1040 items: [{ type: core.ContentChildren, args: [MatMenuItem, { descendants: false },] }],
1041 lazyContent: [{ type: core.ContentChild, args: [MAT_MENU_CONTENT,] }],
1042 overlapTrigger: [{ type: core.Input }],
1043 hasBackdrop: [{ type: core.Input }],
1044 panelClass: [{ type: core.Input, args: ['class',] }],
1045 classList: [{ type: core.Input }],
1046 closed: [{ type: core.Output }],
1047 close: [{ type: core.Output }]
1048 };
1049 /** @docs-public MatMenu */
1050 var MatMenu = /** @class */ (function (_super) {
1051 __extends(MatMenu, _super);
1052 function MatMenu(elementRef, ngZone, defaultOptions) {
1053 var _this = _super.call(this, elementRef, ngZone, defaultOptions) || this;
1054 _this._elevationPrefix = 'mat-elevation-z';
1055 _this._baseElevation = 4;
1056 return _this;
1057 }
1058 return MatMenu;
1059 }(_MatMenuBase));
1060 MatMenu.decorators = [
1061 { type: core.Component, args: [{
1062 selector: 'mat-menu',
1063 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",
1064 changeDetection: core.ChangeDetectionStrategy.OnPush,
1065 encapsulation: core.ViewEncapsulation.None,
1066 exportAs: 'matMenu',
1067 host: {
1068 '[attr.aria-label]': 'null',
1069 '[attr.aria-labelledby]': 'null',
1070 '[attr.aria-describedby]': 'null',
1071 },
1072 animations: [
1073 matMenuAnimations.transformMenu,
1074 matMenuAnimations.fadeInItems
1075 ],
1076 providers: [
1077 { provide: MAT_MENU_PANEL, useExisting: MatMenu },
1078 ],
1079 styles: ["mat-menu{display:none}.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{margin-top:1px}.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}[dir=rtl] .mat-menu-item-submenu-trigger{padding-right:16px;padding-left:32px}.mat-menu-submenu-icon{position:absolute;top:50%;right:16px;transform:translateY(-50%);width:5px;height:10px;fill:currentColor}[dir=rtl] .mat-menu-submenu-icon{right:auto;left:16px;transform:translateY(-50%) scaleX(-1)}.cdk-high-contrast-active .mat-menu-submenu-icon{fill:CanvasText}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"]
1080 },] }
1081 ];
1082 MatMenu.ctorParameters = function () { return [
1083 { type: core.ElementRef },
1084 { type: core.NgZone },
1085 { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_DEFAULT_OPTIONS,] }] }
1086 ]; };
1087
1088 /** Injection token that determines the scroll handling while the menu is open. */
1089 var MAT_MENU_SCROLL_STRATEGY = new core.InjectionToken('mat-menu-scroll-strategy');
1090 /** @docs-private */
1091 function MAT_MENU_SCROLL_STRATEGY_FACTORY(overlay) {
1092 return function () { return overlay.scrollStrategies.reposition(); };
1093 }
1094 /** @docs-private */
1095 var MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER = {
1096 provide: MAT_MENU_SCROLL_STRATEGY,
1097 deps: [overlay.Overlay],
1098 useFactory: MAT_MENU_SCROLL_STRATEGY_FACTORY,
1099 };
1100 /** Default top padding of the menu panel. */
1101 var MENU_PANEL_TOP_PADDING = 8;
1102 /** Options for binding a passive event listener. */
1103 var passiveEventListenerOptions = platform.normalizePassiveListenerOptions({ passive: true });
1104 // TODO(andrewseguin): Remove the kebab versions in favor of camelCased attribute selectors
1105 var _MatMenuTriggerBase = /** @class */ (function () {
1106 function _MatMenuTriggerBase(_overlay, _element, _viewContainerRef, scrollStrategy, parentMenu,
1107 // `MatMenuTrigger` is commonly used in combination with a `MatMenuItem`.
1108 // tslint:disable-next-line: lightweight-tokens
1109 _menuItemInstance, _dir,
1110 // TODO(crisbeto): make the _focusMonitor required when doing breaking changes.
1111 // @breaking-change 8.0.0
1112 _focusMonitor) {
1113 var _this = this;
1114 this._overlay = _overlay;
1115 this._element = _element;
1116 this._viewContainerRef = _viewContainerRef;
1117 this._menuItemInstance = _menuItemInstance;
1118 this._dir = _dir;
1119 this._focusMonitor = _focusMonitor;
1120 this._overlayRef = null;
1121 this._menuOpen = false;
1122 this._closingActionsSubscription = rxjs.Subscription.EMPTY;
1123 this._hoverSubscription = rxjs.Subscription.EMPTY;
1124 this._menuCloseSubscription = rxjs.Subscription.EMPTY;
1125 /**
1126 * Handles touch start events on the trigger.
1127 * Needs to be an arrow function so we can easily use addEventListener and removeEventListener.
1128 */
1129 this._handleTouchStart = function (event) {
1130 if (!a11y.isFakeTouchstartFromScreenReader(event)) {
1131 _this._openedBy = 'touch';
1132 }
1133 };
1134 // Tracking input type is necessary so it's possible to only auto-focus
1135 // the first item of the list when the menu is opened via the keyboard
1136 this._openedBy = undefined;
1137 this._ariaHaspopup = true;
1138 /**
1139 * Whether focus should be restored when the menu is closed.
1140 * Note that disabling this option can have accessibility implications
1141 * and it's up to you to manage focus, if you decide to turn it off.
1142 */
1143 this.restoreFocus = true;
1144 /** Event emitted when the associated menu is opened. */
1145 this.menuOpened = new core.EventEmitter();
1146 /**
1147 * Event emitted when the associated menu is opened.
1148 * @deprecated Switch to `menuOpened` instead
1149 * @breaking-change 8.0.0
1150 */
1151 // tslint:disable-next-line:no-output-on-prefix
1152 this.onMenuOpen = this.menuOpened;
1153 /** Event emitted when the associated menu is closed. */
1154 this.menuClosed = new core.EventEmitter();
1155 /**
1156 * Event emitted when the associated menu is closed.
1157 * @deprecated Switch to `menuClosed` instead
1158 * @breaking-change 8.0.0
1159 */
1160 // tslint:disable-next-line:no-output-on-prefix
1161 this.onMenuClose = this.menuClosed;
1162 this._scrollStrategy = scrollStrategy;
1163 this._parentMaterialMenu = parentMenu instanceof _MatMenuBase ? parentMenu : undefined;
1164 _element.nativeElement.addEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
1165 if (_menuItemInstance) {
1166 _menuItemInstance._triggersSubmenu = this.triggersSubmenu();
1167 }
1168 }
1169 Object.defineProperty(_MatMenuTriggerBase.prototype, "_ariaExpanded", {
1170 get: function () {
1171 return this.menuOpen || null;
1172 },
1173 enumerable: false,
1174 configurable: true
1175 });
1176 Object.defineProperty(_MatMenuTriggerBase.prototype, "_ariaControl", {
1177 get: function () {
1178 return this.menuOpen ? this.menu.panelId : null;
1179 },
1180 enumerable: false,
1181 configurable: true
1182 });
1183 Object.defineProperty(_MatMenuTriggerBase.prototype, "_deprecatedMatMenuTriggerFor", {
1184 /**
1185 * @deprecated
1186 * @breaking-change 8.0.0
1187 */
1188 get: function () { return this.menu; },
1189 set: function (v) {
1190 this.menu = v;
1191 },
1192 enumerable: false,
1193 configurable: true
1194 });
1195 Object.defineProperty(_MatMenuTriggerBase.prototype, "menu", {
1196 /** References the menu instance that the trigger is associated with. */
1197 get: function () { return this._menu; },
1198 set: function (menu) {
1199 var _this = this;
1200 if (menu === this._menu) {
1201 return;
1202 }
1203 this._menu = menu;
1204 this._menuCloseSubscription.unsubscribe();
1205 if (menu) {
1206 if (menu === this._parentMaterialMenu && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1207 throwMatMenuRecursiveError();
1208 }
1209 this._menuCloseSubscription = menu.close.subscribe(function (reason) {
1210 _this._destroyMenu(reason);
1211 // If a click closed the menu, we should close the entire chain of nested menus.
1212 if ((reason === 'click' || reason === 'tab') && _this._parentMaterialMenu) {
1213 _this._parentMaterialMenu.closed.emit(reason);
1214 }
1215 });
1216 }
1217 },
1218 enumerable: false,
1219 configurable: true
1220 });
1221 _MatMenuTriggerBase.prototype.ngAfterContentInit = function () {
1222 this._checkMenu();
1223 this._handleHover();
1224 };
1225 _MatMenuTriggerBase.prototype.ngOnDestroy = function () {
1226 if (this._overlayRef) {
1227 this._overlayRef.dispose();
1228 this._overlayRef = null;
1229 }
1230 this._element.nativeElement.removeEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
1231 this._menuCloseSubscription.unsubscribe();
1232 this._closingActionsSubscription.unsubscribe();
1233 this._hoverSubscription.unsubscribe();
1234 };
1235 Object.defineProperty(_MatMenuTriggerBase.prototype, "menuOpen", {
1236 /** Whether the menu is open. */
1237 get: function () {
1238 return this._menuOpen;
1239 },
1240 enumerable: false,
1241 configurable: true
1242 });
1243 Object.defineProperty(_MatMenuTriggerBase.prototype, "dir", {
1244 /** The text direction of the containing app. */
1245 get: function () {
1246 return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
1247 },
1248 enumerable: false,
1249 configurable: true
1250 });
1251 /** Whether the menu triggers a sub-menu or a top-level one. */
1252 _MatMenuTriggerBase.prototype.triggersSubmenu = function () {
1253 return !!(this._menuItemInstance && this._parentMaterialMenu);
1254 };
1255 /** Toggles the menu between the open and closed states. */
1256 _MatMenuTriggerBase.prototype.toggleMenu = function () {
1257 return this._menuOpen ? this.closeMenu() : this.openMenu();
1258 };
1259 /** Opens the menu. */
1260 _MatMenuTriggerBase.prototype.openMenu = function () {
1261 var _this = this;
1262 if (this._menuOpen) {
1263 return;
1264 }
1265 this._checkMenu();
1266 var overlayRef = this._createOverlay();
1267 var overlayConfig = overlayRef.getConfig();
1268 this._setPosition(overlayConfig.positionStrategy);
1269 overlayConfig.hasBackdrop = this.menu.hasBackdrop == null ? !this.triggersSubmenu() :
1270 this.menu.hasBackdrop;
1271 overlayRef.attach(this._getPortal());
1272 if (this.menu.lazyContent) {
1273 this.menu.lazyContent.attach(this.menuData);
1274 }
1275 this._closingActionsSubscription = this._menuClosingActions().subscribe(function () { return _this.closeMenu(); });
1276 this._initMenu();
1277 if (this.menu instanceof _MatMenuBase) {
1278 this.menu._startAnimation();
1279 }
1280 };
1281 /** Closes the menu. */
1282 _MatMenuTriggerBase.prototype.closeMenu = function () {
1283 this.menu.close.emit();
1284 };
1285 /**
1286 * Focuses the menu trigger.
1287 * @param origin Source of the menu trigger's focus.
1288 */
1289 _MatMenuTriggerBase.prototype.focus = function (origin, options) {
1290 if (this._focusMonitor && origin) {
1291 this._focusMonitor.focusVia(this._element, origin, options);
1292 }
1293 else {
1294 this._element.nativeElement.focus(options);
1295 }
1296 };
1297 /**
1298 * Updates the position of the menu to ensure that it fits all options within the viewport.
1299 */
1300 _MatMenuTriggerBase.prototype.updatePosition = function () {
1301 var _a;
1302 (_a = this._overlayRef) === null || _a === void 0 ? void 0 : _a.updatePosition();
1303 };
1304 /** Closes the menu and does the necessary cleanup. */
1305 _MatMenuTriggerBase.prototype._destroyMenu = function (reason) {
1306 var _this = this;
1307 if (!this._overlayRef || !this.menuOpen) {
1308 return;
1309 }
1310 var menu = this.menu;
1311 this._closingActionsSubscription.unsubscribe();
1312 this._overlayRef.detach();
1313 // Always restore focus if the user is navigating using the keyboard or the menu was opened
1314 // programmatically. We don't restore for non-root triggers, because it can prevent focus
1315 // from making it back to the root trigger when closing a long chain of menus by clicking
1316 // on the backdrop.
1317 if (this.restoreFocus && (reason === 'keydown' || !this._openedBy || !this.triggersSubmenu())) {
1318 this.focus(this._openedBy);
1319 }
1320 this._openedBy = undefined;
1321 if (menu instanceof _MatMenuBase) {
1322 menu._resetAnimation();
1323 if (menu.lazyContent) {
1324 // Wait for the exit animation to finish before detaching the content.
1325 menu._animationDone
1326 .pipe(operators.filter(function (event) { return event.toState === 'void'; }), operators.take(1),
1327 // Interrupt if the content got re-attached.
1328 operators.takeUntil(menu.lazyContent._attached))
1329 .subscribe({
1330 next: function () { return menu.lazyContent.detach(); },
1331 // No matter whether the content got re-attached, reset the menu.
1332 complete: function () { return _this._setIsMenuOpen(false); }
1333 });
1334 }
1335 else {
1336 this._setIsMenuOpen(false);
1337 }
1338 }
1339 else {
1340 this._setIsMenuOpen(false);
1341 if (menu.lazyContent) {
1342 menu.lazyContent.detach();
1343 }
1344 }
1345 };
1346 /**
1347 * This method sets the menu state to open and focuses the first item if
1348 * the menu was opened via the keyboard.
1349 */
1350 _MatMenuTriggerBase.prototype._initMenu = function () {
1351 this.menu.parentMenu = this.triggersSubmenu() ? this._parentMaterialMenu : undefined;
1352 this.menu.direction = this.dir;
1353 this._setMenuElevation();
1354 this.menu.focusFirstItem(this._openedBy || 'program');
1355 this._setIsMenuOpen(true);
1356 };
1357 /** Updates the menu elevation based on the amount of parent menus that it has. */
1358 _MatMenuTriggerBase.prototype._setMenuElevation = function () {
1359 if (this.menu.setElevation) {
1360 var depth = 0;
1361 var parentMenu = this.menu.parentMenu;
1362 while (parentMenu) {
1363 depth++;
1364 parentMenu = parentMenu.parentMenu;
1365 }
1366 this.menu.setElevation(depth);
1367 }
1368 };
1369 // set state rather than toggle to support triggers sharing a menu
1370 _MatMenuTriggerBase.prototype._setIsMenuOpen = function (isOpen) {
1371 this._menuOpen = isOpen;
1372 this._menuOpen ? this.menuOpened.emit() : this.menuClosed.emit();
1373 if (this.triggersSubmenu()) {
1374 this._menuItemInstance._setHighlighted(isOpen);
1375 }
1376 };
1377 /**
1378 * This method checks that a valid instance of MatMenu has been passed into
1379 * matMenuTriggerFor. If not, an exception is thrown.
1380 */
1381 _MatMenuTriggerBase.prototype._checkMenu = function () {
1382 if (!this.menu && (typeof ngDevMode === 'undefined' || ngDevMode)) {
1383 throwMatMenuMissingError();
1384 }
1385 };
1386 /**
1387 * This method creates the overlay from the provided menu's template and saves its
1388 * OverlayRef so that it can be attached to the DOM when openMenu is called.
1389 */
1390 _MatMenuTriggerBase.prototype._createOverlay = function () {
1391 if (!this._overlayRef) {
1392 var config = this._getOverlayConfig();
1393 this._subscribeToPositions(config.positionStrategy);
1394 this._overlayRef = this._overlay.create(config);
1395 // Consume the `keydownEvents` in order to prevent them from going to another overlay.
1396 // Ideally we'd also have our keyboard event logic in here, however doing so will
1397 // break anybody that may have implemented the `MatMenuPanel` themselves.
1398 this._overlayRef.keydownEvents().subscribe();
1399 }
1400 return this._overlayRef;
1401 };
1402 /**
1403 * This method builds the configuration object needed to create the overlay, the OverlayState.
1404 * @returns OverlayConfig
1405 */
1406 _MatMenuTriggerBase.prototype._getOverlayConfig = function () {
1407 return new overlay.OverlayConfig({
1408 positionStrategy: this._overlay.position()
1409 .flexibleConnectedTo(this._element)
1410 .withLockedPosition()
1411 .withGrowAfterOpen()
1412 .withTransformOriginOn('.mat-menu-panel, .mat-mdc-menu-panel'),
1413 backdropClass: this.menu.backdropClass || 'cdk-overlay-transparent-backdrop',
1414 panelClass: this.menu.overlayPanelClass,
1415 scrollStrategy: this._scrollStrategy(),
1416 direction: this._dir
1417 });
1418 };
1419 /**
1420 * Listens to changes in the position of the overlay and sets the correct classes
1421 * on the menu based on the new position. This ensures the animation origin is always
1422 * correct, even if a fallback position is used for the overlay.
1423 */
1424 _MatMenuTriggerBase.prototype._subscribeToPositions = function (position) {
1425 var _this = this;
1426 if (this.menu.setPositionClasses) {
1427 position.positionChanges.subscribe(function (change) {
1428 var posX = change.connectionPair.overlayX === 'start' ? 'after' : 'before';
1429 var posY = change.connectionPair.overlayY === 'top' ? 'below' : 'above';
1430 _this.menu.setPositionClasses(posX, posY);
1431 });
1432 }
1433 };
1434 /**
1435 * Sets the appropriate positions on a position strategy
1436 * so the overlay connects with the trigger correctly.
1437 * @param positionStrategy Strategy whose position to update.
1438 */
1439 _MatMenuTriggerBase.prototype._setPosition = function (positionStrategy) {
1440 var _b = __read(this.menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'], 2), originX = _b[0], originFallbackX = _b[1];
1441 var _c = __read(this.menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'], 2), overlayY = _c[0], overlayFallbackY = _c[1];
1442 var _d = __read([overlayY, overlayFallbackY], 2), originY = _d[0], originFallbackY = _d[1];
1443 var _e = __read([originX, originFallbackX], 2), overlayX = _e[0], overlayFallbackX = _e[1];
1444 var offsetY = 0;
1445 if (this.triggersSubmenu()) {
1446 // When the menu is a sub-menu, it should always align itself
1447 // to the edges of the trigger, instead of overlapping it.
1448 overlayFallbackX = originX = this.menu.xPosition === 'before' ? 'start' : 'end';
1449 originFallbackX = overlayX = originX === 'end' ? 'start' : 'end';
1450 offsetY = overlayY === 'bottom' ? MENU_PANEL_TOP_PADDING : -MENU_PANEL_TOP_PADDING;
1451 }
1452 else if (!this.menu.overlapTrigger) {
1453 originY = overlayY === 'top' ? 'bottom' : 'top';
1454 originFallbackY = overlayFallbackY === 'top' ? 'bottom' : 'top';
1455 }
1456 positionStrategy.withPositions([
1457 { originX: originX, originY: originY, overlayX: overlayX, overlayY: overlayY, offsetY: offsetY },
1458 { originX: originFallbackX, originY: originY, overlayX: overlayFallbackX, overlayY: overlayY, offsetY: offsetY },
1459 {
1460 originX: originX,
1461 originY: originFallbackY,
1462 overlayX: overlayX,
1463 overlayY: overlayFallbackY,
1464 offsetY: -offsetY
1465 },
1466 {
1467 originX: originFallbackX,
1468 originY: originFallbackY,
1469 overlayX: overlayFallbackX,
1470 overlayY: overlayFallbackY,
1471 offsetY: -offsetY
1472 }
1473 ]);
1474 };
1475 /** Returns a stream that emits whenever an action that should close the menu occurs. */
1476 _MatMenuTriggerBase.prototype._menuClosingActions = function () {
1477 var _this = this;
1478 var backdrop = this._overlayRef.backdropClick();
1479 var detachments = this._overlayRef.detachments();
1480 var parentClose = this._parentMaterialMenu ? this._parentMaterialMenu.closed : rxjs.of();
1481 var hover = this._parentMaterialMenu ? this._parentMaterialMenu._hovered().pipe(operators.filter(function (active) { return active !== _this._menuItemInstance; }), operators.filter(function () { return _this._menuOpen; })) : rxjs.of();
1482 return rxjs.merge(backdrop, parentClose, hover, detachments);
1483 };
1484 /** Handles mouse presses on the trigger. */
1485 _MatMenuTriggerBase.prototype._handleMousedown = function (event) {
1486 if (!a11y.isFakeMousedownFromScreenReader(event)) {
1487 // Since right or middle button clicks won't trigger the `click` event,
1488 // we shouldn't consider the menu as opened by mouse in those cases.
1489 this._openedBy = event.button === 0 ? 'mouse' : undefined;
1490 // Since clicking on the trigger won't close the menu if it opens a sub-menu,
1491 // we should prevent focus from moving onto it via click to avoid the
1492 // highlight from lingering on the menu item.
1493 if (this.triggersSubmenu()) {
1494 event.preventDefault();
1495 }
1496 }
1497 };
1498 /** Handles key presses on the trigger. */
1499 _MatMenuTriggerBase.prototype._handleKeydown = function (event) {
1500 var keyCode = event.keyCode;
1501 // Pressing enter on the trigger will trigger the click handler later.
1502 if (keyCode === keycodes.ENTER || keyCode === keycodes.SPACE) {
1503 this._openedBy = 'keyboard';
1504 }
1505 if (this.triggersSubmenu() && ((keyCode === keycodes.RIGHT_ARROW && this.dir === 'ltr') ||
1506 (keyCode === keycodes.LEFT_ARROW && this.dir === 'rtl'))) {
1507 this._openedBy = 'keyboard';
1508 this.openMenu();
1509 }
1510 };
1511 /** Handles click events on the trigger. */
1512 _MatMenuTriggerBase.prototype._handleClick = function (event) {
1513 if (this.triggersSubmenu()) {
1514 // Stop event propagation to avoid closing the parent menu.
1515 event.stopPropagation();
1516 this.openMenu();
1517 }
1518 else {
1519 this.toggleMenu();
1520 }
1521 };
1522 /** Handles the cases where the user hovers over the trigger. */
1523 _MatMenuTriggerBase.prototype._handleHover = function () {
1524 var _this = this;
1525 // Subscribe to changes in the hovered item in order to toggle the panel.
1526 if (!this.triggersSubmenu() || !this._parentMaterialMenu) {
1527 return;
1528 }
1529 this._hoverSubscription = this._parentMaterialMenu._hovered()
1530 // Since we might have multiple competing triggers for the same menu (e.g. a sub-menu
1531 // with different data and triggers), we have to delay it by a tick to ensure that
1532 // it won't be closed immediately after it is opened.
1533 .pipe(operators.filter(function (active) { return active === _this._menuItemInstance && !active.disabled; }), operators.delay(0, rxjs.asapScheduler))
1534 .subscribe(function () {
1535 _this._openedBy = 'mouse';
1536 // If the same menu is used between multiple triggers, it might still be animating
1537 // while the new trigger tries to re-open it. Wait for the animation to finish
1538 // before doing so. Also interrupt if the user moves to another item.
1539 if (_this.menu instanceof _MatMenuBase && _this.menu._isAnimating) {
1540 // We need the `delay(0)` here in order to avoid
1541 // 'changed after checked' errors in some cases. See #12194.
1542 _this.menu._animationDone
1543 .pipe(operators.take(1), operators.delay(0, rxjs.asapScheduler), operators.takeUntil(_this._parentMaterialMenu._hovered()))
1544 .subscribe(function () { return _this.openMenu(); });
1545 }
1546 else {
1547 _this.openMenu();
1548 }
1549 });
1550 };
1551 /** Gets the portal that should be attached to the overlay. */
1552 _MatMenuTriggerBase.prototype._getPortal = function () {
1553 // Note that we can avoid this check by keeping the portal on the menu panel.
1554 // While it would be cleaner, we'd have to introduce another required method on
1555 // `MatMenuPanel`, making it harder to consume.
1556 if (!this._portal || this._portal.templateRef !== this.menu.templateRef) {
1557 this._portal = new portal.TemplatePortal(this.menu.templateRef, this._viewContainerRef);
1558 }
1559 return this._portal;
1560 };
1561 return _MatMenuTriggerBase;
1562 }());
1563 _MatMenuTriggerBase.decorators = [
1564 { type: core.Directive }
1565 ];
1566 _MatMenuTriggerBase.ctorParameters = function () { return [
1567 { type: overlay.Overlay },
1568 { type: core.ElementRef },
1569 { type: core.ViewContainerRef },
1570 { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_SCROLL_STRATEGY,] }] },
1571 { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_PANEL,] }, { type: core.Optional }] },
1572 { type: MatMenuItem, decorators: [{ type: core.Optional }, { type: core.Self }] },
1573 { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
1574 { type: a11y.FocusMonitor }
1575 ]; };
1576 _MatMenuTriggerBase.propDecorators = {
1577 _ariaExpanded: [{ type: core.HostBinding, args: ['attr.aria-expanded',] }],
1578 _ariaControl: [{ type: core.HostBinding, args: ['attr.aria-controls',] }],
1579 _ariaHaspopup: [{ type: core.HostBinding, args: ['attr.aria-haspopup',] }],
1580 _deprecatedMatMenuTriggerFor: [{ type: core.Input, args: ['mat-menu-trigger-for',] }],
1581 menu: [{ type: core.Input, args: ['matMenuTriggerFor',] }],
1582 menuData: [{ type: core.Input, args: ['matMenuTriggerData',] }],
1583 restoreFocus: [{ type: core.Input, args: ['matMenuTriggerRestoreFocus',] }],
1584 menuOpened: [{ type: core.Output }],
1585 onMenuOpen: [{ type: core.Output }],
1586 menuClosed: [{ type: core.Output }],
1587 onMenuClose: [{ type: core.Output }],
1588 _handleMousedown: [{ type: core.HostListener, args: ['mousedown', ['$event'],] }],
1589 _handleKeydown: [{ type: core.HostListener, args: ['keydown', ['$event'],] }],
1590 _handleClick: [{ type: core.HostListener, args: ['click', ['$event'],] }]
1591 };
1592 /** Directive applied to an element that should trigger a `mat-menu`. */
1593 var MatMenuTrigger = /** @class */ (function (_super) {
1594 __extends(MatMenuTrigger, _super);
1595 function MatMenuTrigger() {
1596 return _super !== null && _super.apply(this, arguments) || this;
1597 }
1598 return MatMenuTrigger;
1599 }(_MatMenuTriggerBase));
1600 MatMenuTrigger.decorators = [
1601 { type: core.Directive, args: [{
1602 selector: "[mat-menu-trigger-for], [matMenuTriggerFor]",
1603 host: {
1604 'class': 'mat-menu-trigger',
1605 },
1606 exportAs: 'matMenuTrigger'
1607 },] }
1608 ];
1609
1610 /**
1611 * @license
1612 * Copyright Google LLC All Rights Reserved.
1613 *
1614 * Use of this source code is governed by an MIT-style license that can be
1615 * found in the LICENSE file at https://angular.io/license
1616 */
1617 var MatMenuModule = /** @class */ (function () {
1618 function MatMenuModule() {
1619 }
1620 return MatMenuModule;
1621 }());
1622 MatMenuModule.decorators = [
1623 { type: core.NgModule, args: [{
1624 imports: [
1625 common.CommonModule,
1626 core$1.MatCommonModule,
1627 core$1.MatRippleModule,
1628 overlay.OverlayModule,
1629 ],
1630 exports: [
1631 scrolling.CdkScrollableModule,
1632 core$1.MatCommonModule,
1633 MatMenu,
1634 MatMenuItem,
1635 MatMenuTrigger,
1636 MatMenuContent
1637 ],
1638 declarations: [MatMenu, MatMenuItem, MatMenuTrigger, MatMenuContent],
1639 providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER]
1640 },] }
1641 ];
1642
1643 /**
1644 * @license
1645 * Copyright Google LLC All Rights Reserved.
1646 *
1647 * Use of this source code is governed by an MIT-style license that can be
1648 * found in the LICENSE file at https://angular.io/license
1649 */
1650
1651 /**
1652 * Generated bundle index. Do not edit.
1653 */
1654
1655 exports.MAT_MENU_CONTENT = MAT_MENU_CONTENT;
1656 exports.MAT_MENU_DEFAULT_OPTIONS = MAT_MENU_DEFAULT_OPTIONS;
1657 exports.MAT_MENU_PANEL = MAT_MENU_PANEL;
1658 exports.MAT_MENU_SCROLL_STRATEGY = MAT_MENU_SCROLL_STRATEGY;
1659 exports.MatMenu = MatMenu;
1660 exports.MatMenuContent = MatMenuContent;
1661 exports.MatMenuItem = MatMenuItem;
1662 exports.MatMenuModule = MatMenuModule;
1663 exports.MatMenuTrigger = MatMenuTrigger;
1664 exports._MatMenuBase = _MatMenuBase;
1665 exports._MatMenuContentBase = _MatMenuContentBase;
1666 exports._MatMenuTriggerBase = _MatMenuTriggerBase;
1667 exports.fadeInItems = fadeInItems;
1668 exports.matMenuAnimations = matMenuAnimations;
1669 exports.transformMenu = transformMenu;
1670 exports.ɵangular_material_src_material_menu_menu_a = MAT_MENU_DEFAULT_OPTIONS_FACTORY;
1671 exports.ɵangular_material_src_material_menu_menu_b = MAT_MENU_SCROLL_STRATEGY_FACTORY;
1672 exports.ɵangular_material_src_material_menu_menu_c = MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER;
1673
1674 Object.defineProperty(exports, '__esModule', { value: true });
1675
1676})));
1677//# sourceMappingURL=material-menu.umd.js.map
Note: See TracBrowser for help on using the repository browser.