source: trip-planner-front/node_modules/@angular/material/esm2015/menu/menu-item.js@ 59329aa

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

initial commit

  • Property mode set to 100644
File size: 20.5 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { FocusMonitor } from '@angular/cdk/a11y';
9import { ChangeDetectionStrategy, Component, ElementRef, ViewEncapsulation, Inject, Optional, Input, HostListener, ChangeDetectorRef, } from '@angular/core';
10import { mixinDisabled, mixinDisableRipple, } from '@angular/material/core';
11import { Subject } from 'rxjs';
12import { DOCUMENT } from '@angular/common';
13import { MAT_MENU_PANEL } from './menu-panel';
14// Boilerplate for applying mixins to MatMenuItem.
15/** @docs-private */
16const _MatMenuItemBase = mixinDisableRipple(mixinDisabled(class {
17}));
18/**
19 * Single item inside of a `mat-menu`. Provides the menu item styling and accessibility treatment.
20 */
21export class MatMenuItem extends _MatMenuItemBase {
22 constructor(_elementRef,
23 /**
24 * @deprecated `_document` parameter is no longer being used and will be removed.
25 * @breaking-change 12.0.0
26 */
27 _document, _focusMonitor, _parentMenu,
28 /**
29 * @deprecated `_changeDetectorRef` to become a required parameter.
30 * @breaking-change 14.0.0
31 */
32 _changeDetectorRef) {
33 // @breaking-change 8.0.0 make `_focusMonitor` and `document` required params.
34 super();
35 this._elementRef = _elementRef;
36 this._focusMonitor = _focusMonitor;
37 this._parentMenu = _parentMenu;
38 this._changeDetectorRef = _changeDetectorRef;
39 /** ARIA role for the menu item. */
40 this.role = 'menuitem';
41 /** Stream that emits when the menu item is hovered. */
42 this._hovered = new Subject();
43 /** Stream that emits when the menu item is focused. */
44 this._focused = new Subject();
45 /** Whether the menu item is highlighted. */
46 this._highlighted = false;
47 /** Whether the menu item acts as a trigger for a sub-menu. */
48 this._triggersSubmenu = false;
49 if (_parentMenu && _parentMenu.addItem) {
50 _parentMenu.addItem(this);
51 }
52 }
53 /** Focuses the menu item. */
54 focus(origin, options) {
55 if (this._focusMonitor && origin) {
56 this._focusMonitor.focusVia(this._getHostElement(), origin, options);
57 }
58 else {
59 this._getHostElement().focus(options);
60 }
61 this._focused.next(this);
62 }
63 ngAfterViewInit() {
64 if (this._focusMonitor) {
65 // Start monitoring the element so it gets the appropriate focused classes. We want
66 // to show the focus style for menu items only when the focus was not caused by a
67 // mouse or touch interaction.
68 this._focusMonitor.monitor(this._elementRef, false);
69 }
70 }
71 ngOnDestroy() {
72 if (this._focusMonitor) {
73 this._focusMonitor.stopMonitoring(this._elementRef);
74 }
75 if (this._parentMenu && this._parentMenu.removeItem) {
76 this._parentMenu.removeItem(this);
77 }
78 this._hovered.complete();
79 this._focused.complete();
80 }
81 /** Used to set the `tabindex`. */
82 _getTabIndex() {
83 return this.disabled ? '-1' : '0';
84 }
85 /** Returns the host DOM element. */
86 _getHostElement() {
87 return this._elementRef.nativeElement;
88 }
89 /** Prevents the default element actions if it is disabled. */
90 // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
91 // In Ivy the `host` bindings will be merged when this class is extended, whereas in
92 // ViewEngine they're overwritten.
93 // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
94 // tslint:disable-next-line:no-host-decorator-in-concrete
95 _checkDisabled(event) {
96 if (this.disabled) {
97 event.preventDefault();
98 event.stopPropagation();
99 }
100 }
101 /** Emits to the hover stream. */
102 // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
103 // In Ivy the `host` bindings will be merged when this class is extended, whereas in
104 // ViewEngine they're overwritten.
105 // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
106 // tslint:disable-next-line:no-host-decorator-in-concrete
107 _handleMouseEnter() {
108 this._hovered.next(this);
109 }
110 /** Gets the label to be used when determining whether the option should be focused. */
111 getLabel() {
112 var _a, _b;
113 const clone = this._elementRef.nativeElement.cloneNode(true);
114 const icons = clone.querySelectorAll('mat-icon, .material-icons');
115 // Strip away icons so they don't show up in the text.
116 for (let i = 0; i < icons.length; i++) {
117 const icon = icons[i];
118 (_a = icon.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(icon);
119 }
120 return ((_b = clone.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '';
121 }
122 _setHighlighted(isHighlighted) {
123 var _a;
124 // We need to mark this for check for the case where the content is coming from a
125 // `matMenuContent` whose change detection tree is at the declaration position,
126 // not the insertion position. See #23175.
127 // @breaking-change 14.0.0 Remove null check for `_changeDetectorRef`.
128 this._highlighted = isHighlighted;
129 (_a = this._changeDetectorRef) === null || _a === void 0 ? void 0 : _a.markForCheck();
130 }
131}
132MatMenuItem.decorators = [
133 { type: Component, args: [{
134 selector: '[mat-menu-item]',
135 exportAs: 'matMenuItem',
136 inputs: ['disabled', 'disableRipple'],
137 host: {
138 '[attr.role]': 'role',
139 '[class.mat-menu-item]': 'true',
140 '[class.mat-menu-item-highlighted]': '_highlighted',
141 '[class.mat-menu-item-submenu-trigger]': '_triggersSubmenu',
142 '[attr.tabindex]': '_getTabIndex()',
143 '[attr.aria-disabled]': 'disabled.toString()',
144 '[attr.disabled]': 'disabled || null',
145 'class': 'mat-focus-indicator',
146 },
147 changeDetection: ChangeDetectionStrategy.OnPush,
148 encapsulation: ViewEncapsulation.None,
149 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"
150 },] }
151];
152MatMenuItem.ctorParameters = () => [
153 { type: ElementRef },
154 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
155 { type: FocusMonitor },
156 { type: undefined, decorators: [{ type: Inject, args: [MAT_MENU_PANEL,] }, { type: Optional }] },
157 { type: ChangeDetectorRef }
158];
159MatMenuItem.propDecorators = {
160 role: [{ type: Input }],
161 _checkDisabled: [{ type: HostListener, args: ['click', ['$event'],] }],
162 _handleMouseEnter: [{ type: HostListener, args: ['mouseenter',] }]
163};
164//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVudS1pdGVtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL21lbnUvbWVudS1pdGVtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBa0IsWUFBWSxFQUFjLE1BQU0sbUJBQW1CLENBQUM7QUFFN0UsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixTQUFTLEVBQ1QsVUFBVSxFQUVWLGlCQUFpQixFQUNqQixNQUFNLEVBQ04sUUFBUSxFQUNSLEtBQUssRUFDTCxZQUFZLEVBRVosaUJBQWlCLEdBQ2xCLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFHTCxhQUFhLEVBQ2Isa0JBQWtCLEdBQ25CLE1BQU0sd0JBQXdCLENBQUM7QUFDaEMsT0FBTyxFQUFDLE9BQU8sRUFBQyxNQUFNLE1BQU0sQ0FBQztBQUM3QixPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFDekMsT0FBTyxFQUFDLGNBQWMsRUFBZSxNQUFNLGNBQWMsQ0FBQztBQUUxRCxrREFBa0Q7QUFDbEQsb0JBQW9CO0FBQ3BCLE1BQU0sZ0JBQWdCLEdBQUcsa0JBQWtCLENBQUMsYUFBYSxDQUFDO0NBQVEsQ0FBQyxDQUFDLENBQUM7QUFFckU7O0dBRUc7QUFtQkgsTUFBTSxPQUFPLFdBQVksU0FBUSxnQkFBZ0I7SUFrQi9DLFlBQ1UsV0FBb0M7SUFDNUM7OztPQUdHO0lBQ2UsU0FBZSxFQ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