@angular/material 21.0.0-next.8 → 21.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/tokens/_classes.scss +1 -1
- package/core/tokens/m2/_md-sys-color.scss +17 -17
- package/fesm2022/_animation-chunk.mjs +10 -16
- package/fesm2022/_animation-chunk.mjs.map +1 -1
- package/fesm2022/_date-formats-chunk.mjs +68 -164
- package/fesm2022/_date-formats-chunk.mjs.map +1 -1
- package/fesm2022/_date-range-input-harness-chunk.mjs +284 -463
- package/fesm2022/_date-range-input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_error-options-chunk.mjs +56 -19
- package/fesm2022/_error-options-chunk.mjs.map +1 -1
- package/fesm2022/_error-state-chunk.mjs +24 -31
- package/fesm2022/_error-state-chunk.mjs.map +1 -1
- package/fesm2022/_form-field-chunk.mjs +1224 -1017
- package/fesm2022/_form-field-chunk.mjs.map +1 -1
- package/fesm2022/_icon-button-chunk.mjs +243 -187
- package/fesm2022/_icon-button-chunk.mjs.map +1 -1
- package/fesm2022/_icon-registry-chunk.mjs +350 -575
- package/fesm2022/_icon-registry-chunk.mjs.map +1 -1
- package/fesm2022/_input-harness-chunk.mjs +56 -107
- package/fesm2022/_input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_input-value-accessor-chunk.mjs +0 -6
- package/fesm2022/_input-value-accessor-chunk.mjs.map +1 -1
- package/fesm2022/_internal-form-field-chunk.mjs +59 -19
- package/fesm2022/_internal-form-field-chunk.mjs.map +1 -1
- package/fesm2022/_line-chunk.mjs +83 -43
- package/fesm2022/_line-chunk.mjs.map +1 -1
- package/fesm2022/_option-chunk.mjs +348 -311
- package/fesm2022/_option-chunk.mjs.map +1 -1
- package/fesm2022/_option-harness-chunk.mjs +23 -39
- package/fesm2022/_option-harness-chunk.mjs.map +1 -1
- package/fesm2022/_option-module-chunk.mjs +36 -10
- package/fesm2022/_option-module-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-chunk.mjs +79 -44
- package/fesm2022/_pseudo-checkbox-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs +36 -10
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs.map +1 -1
- package/fesm2022/_public-api-chunk.mjs +71 -134
- package/fesm2022/_public-api-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-chunk.mjs +504 -600
- package/fesm2022/_ripple-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-loader-chunk.mjs +120 -138
- package/fesm2022/_ripple-loader-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-module-chunk.mjs +36 -10
- package/fesm2022/_ripple-module-chunk.mjs.map +1 -1
- package/fesm2022/_structural-styles-chunk.mjs +37 -10
- package/fesm2022/_structural-styles-chunk.mjs.map +1 -1
- package/fesm2022/_tooltip-chunk.mjs +810 -888
- package/fesm2022/_tooltip-chunk.mjs.map +1 -1
- package/fesm2022/autocomplete-testing.mjs +62 -86
- package/fesm2022/autocomplete-testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +965 -1126
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge-testing.mjs +38 -54
- package/fesm2022/badge-testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +321 -272
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet-testing.mjs +10 -24
- package/fesm2022/bottom-sheet-testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +349 -344
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-testing.mjs +60 -94
- package/fesm2022/button-testing.mjs.map +1 -1
- package/fesm2022/button-toggle-testing.mjs +76 -125
- package/fesm2022/button-toggle-testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +752 -662
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +263 -158
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card-testing.mjs +19 -33
- package/fesm2022/card-testing.mjs.map +1 -1
- package/fesm2022/card.mjs +576 -272
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox-testing.mjs +71 -123
- package/fesm2022/checkbox-testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +515 -477
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips-testing.mjs +201 -350
- package/fesm2022/chips-testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +2552 -2289
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core-testing.mjs +14 -28
- package/fesm2022/core-testing.mjs.map +1 -1
- package/fesm2022/core.mjs +357 -328
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker-testing.mjs +15 -25
- package/fesm2022/datepicker-testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +4826 -4563
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog-testing.mjs +93 -129
- package/fesm2022/dialog-testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +810 -829
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider-testing.mjs +10 -11
- package/fesm2022/divider-testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +119 -43
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion-testing.mjs +74 -130
- package/fesm2022/expansion-testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +703 -515
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field-testing-control.mjs +16 -33
- package/fesm2022/form-field-testing-control.mjs.map +1 -1
- package/fesm2022/form-field-testing.mjs +118 -179
- package/fesm2022/form-field-testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +36 -10
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list-testing.mjs +65 -113
- package/fesm2022/grid-list-testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +559 -494
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon-testing.mjs +148 -127
- package/fesm2022/icon-testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +325 -351
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input-testing.mjs +59 -99
- package/fesm2022/input-testing.mjs.map +1 -1
- package/fesm2022/input.mjs +457 -520
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list-testing.mjs +251 -434
- package/fesm2022/list-testing.mjs.map +1 -1
- package/fesm2022/list.mjs +1522 -1204
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/material.mjs +0 -5
- package/fesm2022/material.mjs.map +1 -1
- package/fesm2022/menu-testing.mjs +159 -228
- package/fesm2022/menu-testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +1338 -1343
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator-testing.mjs +55 -79
- package/fesm2022/paginator-testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +381 -309
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar-testing.mjs +12 -21
- package/fesm2022/progress-bar-testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +224 -169
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner-testing.mjs +13 -23
- package/fesm2022/progress-spinner-testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +235 -160
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio-testing.mjs +133 -208
- package/fesm2022/radio-testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +712 -679
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select-testing.mjs +83 -117
- package/fesm2022/select-testing.mjs.map +1 -1
- package/fesm2022/select.mjs +1116 -1246
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav-testing.mjs +54 -120
- package/fesm2022/sidenav-testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +1078 -995
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle-testing.mjs +57 -92
- package/fesm2022/slide-toggle-testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +369 -279
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider-testing.mjs +90 -138
- package/fesm2022/slider-testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +1651 -1716
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar-testing.mjs +40 -87
- package/fesm2022/snack-bar-testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +763 -714
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort-testing.mjs +45 -66
- package/fesm2022/sort-testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +419 -344
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper-testing.mjs +78 -154
- package/fesm2022/stepper-testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +790 -498
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table-testing.mjs +125 -186
- package/fesm2022/table-testing.mjs.map +1 -1
- package/fesm2022/table.mjs +1026 -684
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs-testing.mjs +125 -197
- package/fesm2022/tabs-testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +2351 -2028
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker-testing.mjs +113 -172
- package/fesm2022/timepicker-testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +1019 -826
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar-testing.mjs +16 -27
- package/fesm2022/toolbar-testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +163 -78
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip-testing.mjs +41 -52
- package/fesm2022/tooltip-testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +36 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree-testing.mjs +86 -162
- package/fesm2022/tree-testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +638 -466
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/types/expansion.d.ts +4 -2
- package/types/menu-testing.d.ts +2 -0
- package/types/select.d.ts +1 -1
- package/types/sort.d.ts +1 -1
- package/types/table-testing.d.ts +27 -1
- package/types/timepicker.d.ts +148 -128
package/fesm2022/menu.mjs
CHANGED
|
@@ -17,1404 +17,1399 @@ import { MatRippleModule } from './_ripple-module-chunk.mjs';
|
|
|
17
17
|
import '@angular/cdk/coercion';
|
|
18
18
|
import '@angular/cdk/layout';
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Injection token used to provide the parent menu to menu-specific components.
|
|
22
|
-
* @docs-private
|
|
23
|
-
*/
|
|
24
20
|
const MAT_MENU_PANEL = new InjectionToken('MAT_MENU_PANEL');
|
|
25
21
|
|
|
26
|
-
/**
|
|
27
|
-
* Single item inside a `mat-menu`. Provides the menu item styling and accessibility treatment.
|
|
28
|
-
*/
|
|
29
22
|
class MatMenuItem {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
23
|
+
_elementRef = inject(ElementRef);
|
|
24
|
+
_document = inject(DOCUMENT);
|
|
25
|
+
_focusMonitor = inject(FocusMonitor);
|
|
26
|
+
_parentMenu = inject(MAT_MENU_PANEL, {
|
|
27
|
+
optional: true
|
|
28
|
+
});
|
|
29
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
30
|
+
role = 'menuitem';
|
|
31
|
+
disabled = false;
|
|
32
|
+
disableRipple = false;
|
|
33
|
+
_hovered = new Subject();
|
|
34
|
+
_focused = new Subject();
|
|
35
|
+
_highlighted = false;
|
|
36
|
+
_triggersSubmenu = false;
|
|
37
|
+
constructor() {
|
|
38
|
+
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
|
|
39
|
+
this._parentMenu?.addItem?.(this);
|
|
40
|
+
}
|
|
41
|
+
focus(origin, options) {
|
|
42
|
+
if (this._focusMonitor && origin) {
|
|
43
|
+
this._focusMonitor.focusVia(this._getHostElement(), origin, options);
|
|
44
|
+
} else {
|
|
45
|
+
this._getHostElement().focus(options);
|
|
46
|
+
}
|
|
47
|
+
this._focused.next(this);
|
|
48
|
+
}
|
|
49
|
+
ngAfterViewInit() {
|
|
50
|
+
if (this._focusMonitor) {
|
|
51
|
+
this._focusMonitor.monitor(this._elementRef, false);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
ngOnDestroy() {
|
|
55
|
+
if (this._focusMonitor) {
|
|
56
|
+
this._focusMonitor.stopMonitoring(this._elementRef);
|
|
57
|
+
}
|
|
58
|
+
if (this._parentMenu && this._parentMenu.removeItem) {
|
|
59
|
+
this._parentMenu.removeItem(this);
|
|
60
|
+
}
|
|
61
|
+
this._hovered.complete();
|
|
62
|
+
this._focused.complete();
|
|
63
|
+
}
|
|
64
|
+
_getTabIndex() {
|
|
65
|
+
return this.disabled ? '-1' : '0';
|
|
66
|
+
}
|
|
67
|
+
_getHostElement() {
|
|
68
|
+
return this._elementRef.nativeElement;
|
|
69
|
+
}
|
|
70
|
+
_checkDisabled(event) {
|
|
71
|
+
if (this.disabled) {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
event.stopPropagation();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
_handleMouseEnter() {
|
|
77
|
+
this._hovered.next(this);
|
|
78
|
+
}
|
|
79
|
+
getLabel() {
|
|
80
|
+
const clone = this._elementRef.nativeElement.cloneNode(true);
|
|
81
|
+
const icons = clone.querySelectorAll('mat-icon, .material-icons');
|
|
82
|
+
for (let i = 0; i < icons.length; i++) {
|
|
83
|
+
icons[i].remove();
|
|
84
|
+
}
|
|
85
|
+
return clone.textContent?.trim() || '';
|
|
86
|
+
}
|
|
87
|
+
_setHighlighted(isHighlighted) {
|
|
88
|
+
this._highlighted = isHighlighted;
|
|
89
|
+
this._changeDetectorRef.markForCheck();
|
|
90
|
+
}
|
|
91
|
+
_setTriggersSubmenu(triggersSubmenu) {
|
|
92
|
+
this._triggersSubmenu = triggersSubmenu;
|
|
93
|
+
this._changeDetectorRef.markForCheck();
|
|
94
|
+
}
|
|
95
|
+
_hasFocus() {
|
|
96
|
+
return this._document && this._document.activeElement === this._getHostElement();
|
|
97
|
+
}
|
|
98
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
99
|
+
minVersion: "12.0.0",
|
|
100
|
+
version: "20.2.0-next.2",
|
|
101
|
+
ngImport: i0,
|
|
102
|
+
type: MatMenuItem,
|
|
103
|
+
deps: [],
|
|
104
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
105
|
+
});
|
|
106
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
107
|
+
minVersion: "17.0.0",
|
|
108
|
+
version: "20.2.0-next.2",
|
|
109
|
+
type: MatMenuItem,
|
|
110
|
+
isStandalone: true,
|
|
111
|
+
selector: "[mat-menu-item]",
|
|
112
|
+
inputs: {
|
|
113
|
+
role: "role",
|
|
114
|
+
disabled: ["disabled", "disabled", booleanAttribute],
|
|
115
|
+
disableRipple: ["disableRipple", "disableRipple", booleanAttribute]
|
|
116
|
+
},
|
|
117
|
+
host: {
|
|
118
|
+
listeners: {
|
|
119
|
+
"click": "_checkDisabled($event)",
|
|
120
|
+
"mouseenter": "_handleMouseEnter()"
|
|
121
|
+
},
|
|
122
|
+
properties: {
|
|
123
|
+
"attr.role": "role",
|
|
124
|
+
"class.mat-mdc-menu-item-highlighted": "_highlighted",
|
|
125
|
+
"class.mat-mdc-menu-item-submenu-trigger": "_triggersSubmenu",
|
|
126
|
+
"attr.tabindex": "_getTabIndex()",
|
|
127
|
+
"attr.aria-disabled": "disabled",
|
|
128
|
+
"attr.disabled": "disabled || null"
|
|
129
|
+
},
|
|
130
|
+
classAttribute: "mat-mdc-menu-item mat-focus-indicator"
|
|
131
|
+
},
|
|
132
|
+
exportAs: ["matMenuItem"],
|
|
133
|
+
ngImport: i0,
|
|
134
|
+
template: "<ng-content select=\"mat-icon, [matMenuItemIcon]\"></ng-content>\n<span class=\"mat-mdc-menu-item-text\"><ng-content></ng-content></span>\n<div class=\"mat-mdc-menu-ripple\" matRipple\n [matRippleDisabled]=\"disableRipple || disabled\"\n [matRippleTrigger]=\"_getHostElement()\">\n</div>\n\n@if (_triggersSubmenu) {\n <svg\n class=\"mat-mdc-menu-submenu-icon\"\n viewBox=\"0 0 5 10\"\n focusable=\"false\"\n aria-hidden=\"true\"><polygon points=\"0,0 5,5 0,10\"/></svg>\n}\n",
|
|
135
|
+
dependencies: [{
|
|
136
|
+
kind: "directive",
|
|
137
|
+
type: MatRipple,
|
|
138
|
+
selector: "[mat-ripple], [matRipple]",
|
|
139
|
+
inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"],
|
|
140
|
+
exportAs: ["matRipple"]
|
|
141
|
+
}],
|
|
142
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
143
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
144
|
+
});
|
|
126
145
|
}
|
|
127
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
147
|
+
minVersion: "12.0.0",
|
|
148
|
+
version: "20.2.0-next.2",
|
|
149
|
+
ngImport: i0,
|
|
150
|
+
type: MatMenuItem,
|
|
151
|
+
decorators: [{
|
|
152
|
+
type: Component,
|
|
153
|
+
args: [{
|
|
154
|
+
selector: '[mat-menu-item]',
|
|
155
|
+
exportAs: 'matMenuItem',
|
|
156
|
+
host: {
|
|
157
|
+
'[attr.role]': 'role',
|
|
158
|
+
'class': 'mat-mdc-menu-item mat-focus-indicator',
|
|
159
|
+
'[class.mat-mdc-menu-item-highlighted]': '_highlighted',
|
|
160
|
+
'[class.mat-mdc-menu-item-submenu-trigger]': '_triggersSubmenu',
|
|
161
|
+
'[attr.tabindex]': '_getTabIndex()',
|
|
162
|
+
'[attr.aria-disabled]': 'disabled',
|
|
163
|
+
'[attr.disabled]': 'disabled || null',
|
|
164
|
+
'(click)': '_checkDisabled($event)',
|
|
165
|
+
'(mouseenter)': '_handleMouseEnter()'
|
|
166
|
+
},
|
|
167
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
168
|
+
encapsulation: ViewEncapsulation.None,
|
|
169
|
+
imports: [MatRipple],
|
|
170
|
+
template: "<ng-content select=\"mat-icon, [matMenuItemIcon]\"></ng-content>\n<span class=\"mat-mdc-menu-item-text\"><ng-content></ng-content></span>\n<div class=\"mat-mdc-menu-ripple\" matRipple\n [matRippleDisabled]=\"disableRipple || disabled\"\n [matRippleTrigger]=\"_getHostElement()\">\n</div>\n\n@if (_triggersSubmenu) {\n <svg\n class=\"mat-mdc-menu-submenu-icon\"\n viewBox=\"0 0 5 10\"\n focusable=\"false\"\n aria-hidden=\"true\"><polygon points=\"0,0 5,5 0,10\"/></svg>\n}\n"
|
|
171
|
+
}]
|
|
172
|
+
}],
|
|
173
|
+
ctorParameters: () => [],
|
|
174
|
+
propDecorators: {
|
|
175
|
+
role: [{
|
|
176
|
+
type: Input
|
|
177
|
+
}],
|
|
178
|
+
disabled: [{
|
|
179
|
+
type: Input,
|
|
180
|
+
args: [{
|
|
181
|
+
transform: booleanAttribute
|
|
182
|
+
}]
|
|
183
|
+
}],
|
|
184
|
+
disableRipple: [{
|
|
185
|
+
type: Input,
|
|
186
|
+
args: [{
|
|
187
|
+
transform: booleanAttribute
|
|
188
|
+
}]
|
|
189
|
+
}]
|
|
190
|
+
}
|
|
191
|
+
});
|
|
149
192
|
|
|
150
|
-
/**
|
|
151
|
-
* Throws an exception for the case when menu's x-position value isn't valid.
|
|
152
|
-
* In other words, it doesn't match 'before' or 'after'.
|
|
153
|
-
* @docs-private
|
|
154
|
-
*/
|
|
155
193
|
function throwMatMenuInvalidPositionX() {
|
|
156
|
-
|
|
194
|
+
throw Error(`xPosition value must be either 'before' or after'.
|
|
157
195
|
Example: <mat-menu xPosition="before" #menu="matMenu"></mat-menu>`);
|
|
158
196
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Throws an exception for the case when menu's y-position value isn't valid.
|
|
161
|
-
* In other words, it doesn't match 'above' or 'below'.
|
|
162
|
-
* @docs-private
|
|
163
|
-
*/
|
|
164
197
|
function throwMatMenuInvalidPositionY() {
|
|
165
|
-
|
|
198
|
+
throw Error(`yPosition value must be either 'above' or below'.
|
|
166
199
|
Example: <mat-menu yPosition="above" #menu="matMenu"></mat-menu>`);
|
|
167
200
|
}
|
|
168
|
-
/**
|
|
169
|
-
* Throws an exception for the case when a menu is assigned
|
|
170
|
-
* to a trigger that is placed inside the same menu.
|
|
171
|
-
* @docs-private
|
|
172
|
-
*/
|
|
173
201
|
function throwMatMenuRecursiveError() {
|
|
174
|
-
|
|
175
|
-
`not a parent of the trigger or move the trigger outside of the menu.`);
|
|
202
|
+
throw Error(`matMenuTriggerFor: menu cannot contain its own trigger. Assign a menu that is ` + `not a parent of the trigger or move the trigger outside of the menu.`);
|
|
176
203
|
}
|
|
177
204
|
|
|
178
|
-
/**
|
|
179
|
-
* Injection token that can be used to reference instances of `MatMenuContent`. It serves
|
|
180
|
-
* as alternative token to the actual `MatMenuContent` class which could cause unnecessary
|
|
181
|
-
* retention of the class and its directive metadata.
|
|
182
|
-
*/
|
|
183
205
|
const MAT_MENU_CONTENT = new InjectionToken('MatMenuContent');
|
|
184
|
-
/** Menu content that will be rendered lazily once the menu is opened. */
|
|
185
206
|
class MatMenuContent {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
207
|
+
_template = inject(TemplateRef);
|
|
208
|
+
_appRef = inject(ApplicationRef);
|
|
209
|
+
_injector = inject(Injector);
|
|
210
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
211
|
+
_document = inject(DOCUMENT);
|
|
212
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
213
|
+
_portal;
|
|
214
|
+
_outlet;
|
|
215
|
+
_attached = new Subject();
|
|
216
|
+
constructor() {}
|
|
217
|
+
attach(context = {}) {
|
|
218
|
+
if (!this._portal) {
|
|
219
|
+
this._portal = new TemplatePortal(this._template, this._viewContainerRef);
|
|
220
|
+
}
|
|
221
|
+
this.detach();
|
|
222
|
+
if (!this._outlet) {
|
|
223
|
+
this._outlet = new DomPortalOutlet(this._document.createElement('div'), this._appRef, this._injector);
|
|
224
|
+
}
|
|
225
|
+
const element = this._template.elementRef.nativeElement;
|
|
226
|
+
element.parentNode.insertBefore(this._outlet.outletElement, element);
|
|
227
|
+
this._changeDetectorRef.markForCheck();
|
|
228
|
+
this._portal.attach(this._outlet, context);
|
|
229
|
+
this._attached.next();
|
|
230
|
+
}
|
|
231
|
+
detach() {
|
|
232
|
+
if (this._portal?.isAttached) {
|
|
233
|
+
this._portal.detach();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
ngOnDestroy() {
|
|
237
|
+
this.detach();
|
|
238
|
+
this._outlet?.dispose();
|
|
239
|
+
}
|
|
240
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
241
|
+
minVersion: "12.0.0",
|
|
242
|
+
version: "20.2.0-next.2",
|
|
243
|
+
ngImport: i0,
|
|
244
|
+
type: MatMenuContent,
|
|
245
|
+
deps: [],
|
|
246
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
247
|
+
});
|
|
248
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
249
|
+
minVersion: "14.0.0",
|
|
250
|
+
version: "20.2.0-next.2",
|
|
251
|
+
type: MatMenuContent,
|
|
252
|
+
isStandalone: true,
|
|
253
|
+
selector: "ng-template[matMenuContent]",
|
|
254
|
+
providers: [{
|
|
255
|
+
provide: MAT_MENU_CONTENT,
|
|
256
|
+
useExisting: MatMenuContent
|
|
257
|
+
}],
|
|
258
|
+
ngImport: i0
|
|
259
|
+
});
|
|
238
260
|
}
|
|
239
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
262
|
+
minVersion: "12.0.0",
|
|
263
|
+
version: "20.2.0-next.2",
|
|
264
|
+
ngImport: i0,
|
|
265
|
+
type: MatMenuContent,
|
|
266
|
+
decorators: [{
|
|
267
|
+
type: Directive,
|
|
268
|
+
args: [{
|
|
269
|
+
selector: 'ng-template[matMenuContent]',
|
|
270
|
+
providers: [{
|
|
271
|
+
provide: MAT_MENU_CONTENT,
|
|
272
|
+
useExisting: MatMenuContent
|
|
273
|
+
}]
|
|
274
|
+
}]
|
|
275
|
+
}],
|
|
276
|
+
ctorParameters: () => []
|
|
277
|
+
});
|
|
246
278
|
|
|
247
|
-
/** Injection token to be used to override the default options for `mat-menu`. */
|
|
248
279
|
const MAT_MENU_DEFAULT_OPTIONS = new InjectionToken('mat-menu-default-options', {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
280
|
+
providedIn: 'root',
|
|
281
|
+
factory: () => ({
|
|
282
|
+
overlapTrigger: false,
|
|
283
|
+
xPosition: 'after',
|
|
284
|
+
yPosition: 'below',
|
|
285
|
+
backdropClass: 'cdk-overlay-transparent-backdrop'
|
|
286
|
+
})
|
|
256
287
|
});
|
|
257
|
-
/** Name of the enter animation `@keyframes`. */
|
|
258
288
|
const ENTER_ANIMATION = '_mat-menu-enter';
|
|
259
|
-
/** Name of the exit animation `@keyframes`. */
|
|
260
289
|
const EXIT_ANIMATION = '_mat-menu-exit';
|
|
261
290
|
class MatMenu {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
* to style the containing menu from outside the component.
|
|
367
|
-
* @deprecated Use `panelClass` instead.
|
|
368
|
-
* @breaking-change 8.0.0
|
|
369
|
-
*/
|
|
370
|
-
get classList() {
|
|
371
|
-
return this.panelClass;
|
|
372
|
-
}
|
|
373
|
-
set classList(classes) {
|
|
374
|
-
this.panelClass = classes;
|
|
375
|
-
}
|
|
376
|
-
/** Event emitted when the menu is closed. */
|
|
377
|
-
closed = new EventEmitter();
|
|
378
|
-
/**
|
|
379
|
-
* Event emitted when the menu is closed.
|
|
380
|
-
* @deprecated Switch to `closed` instead
|
|
381
|
-
* @breaking-change 8.0.0
|
|
382
|
-
*/
|
|
383
|
-
close = this.closed;
|
|
384
|
-
panelId = inject(_IdGenerator).getId('mat-menu-panel-');
|
|
385
|
-
constructor() {
|
|
386
|
-
const defaultOptions = inject(MAT_MENU_DEFAULT_OPTIONS);
|
|
387
|
-
this.overlayPanelClass = defaultOptions.overlayPanelClass || '';
|
|
388
|
-
this._xPosition = defaultOptions.xPosition;
|
|
389
|
-
this._yPosition = defaultOptions.yPosition;
|
|
390
|
-
this.backdropClass = defaultOptions.backdropClass;
|
|
391
|
-
this.overlapTrigger = defaultOptions.overlapTrigger;
|
|
392
|
-
this.hasBackdrop = defaultOptions.hasBackdrop;
|
|
393
|
-
}
|
|
394
|
-
ngOnInit() {
|
|
395
|
-
this.setPositionClasses();
|
|
396
|
-
}
|
|
397
|
-
ngAfterContentInit() {
|
|
398
|
-
this._updateDirectDescendants();
|
|
399
|
-
this._keyManager = new FocusKeyManager(this._directDescendantItems)
|
|
400
|
-
.withWrap()
|
|
401
|
-
.withTypeAhead()
|
|
402
|
-
.withHomeAndEnd();
|
|
403
|
-
this._keyManager.tabOut.subscribe(() => this.closed.emit('tab'));
|
|
404
|
-
// If a user manually (programmatically) focuses a menu item, we need to reflect that focus
|
|
405
|
-
// change back to the key manager. Note that we don't need to unsubscribe here because _focused
|
|
406
|
-
// is internal and we know that it gets completed on destroy.
|
|
407
|
-
this._directDescendantItems.changes
|
|
408
|
-
.pipe(startWith(this._directDescendantItems), switchMap(items => merge(...items.map((item) => item._focused))))
|
|
409
|
-
.subscribe(focusedItem => this._keyManager.updateActiveItem(focusedItem));
|
|
410
|
-
this._directDescendantItems.changes.subscribe((itemsList) => {
|
|
411
|
-
// Move focus to another item, if the active item is removed from the list.
|
|
412
|
-
// We need to debounce the callback, because multiple items might be removed
|
|
413
|
-
// in quick succession.
|
|
414
|
-
const manager = this._keyManager;
|
|
415
|
-
if (this._panelAnimationState === 'enter' && manager.activeItem?._hasFocus()) {
|
|
416
|
-
const items = itemsList.toArray();
|
|
417
|
-
const index = Math.max(0, Math.min(items.length - 1, manager.activeItemIndex || 0));
|
|
418
|
-
if (items[index] && !items[index].disabled) {
|
|
419
|
-
manager.setActiveItem(index);
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
manager.setNextItemActive();
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
ngOnDestroy() {
|
|
428
|
-
this._keyManager?.destroy();
|
|
429
|
-
this._directDescendantItems.destroy();
|
|
430
|
-
this.closed.complete();
|
|
431
|
-
this._firstItemFocusRef?.destroy();
|
|
432
|
-
clearTimeout(this._exitFallbackTimeout);
|
|
433
|
-
}
|
|
434
|
-
/** Stream that emits whenever the hovered menu item changes. */
|
|
435
|
-
_hovered() {
|
|
436
|
-
// Coerce the `changes` property because Angular types it as `Observable<any>`
|
|
437
|
-
const itemChanges = this._directDescendantItems.changes;
|
|
438
|
-
return itemChanges.pipe(startWith(this._directDescendantItems), switchMap(items => merge(...items.map((item) => item._hovered))));
|
|
439
|
-
}
|
|
440
|
-
/*
|
|
441
|
-
* Registers a menu item with the menu.
|
|
442
|
-
* @docs-private
|
|
443
|
-
* @deprecated No longer being used. To be removed.
|
|
444
|
-
* @breaking-change 9.0.0
|
|
445
|
-
*/
|
|
446
|
-
addItem(_item) { }
|
|
447
|
-
/**
|
|
448
|
-
* Removes an item from the menu.
|
|
449
|
-
* @docs-private
|
|
450
|
-
* @deprecated No longer being used. To be removed.
|
|
451
|
-
* @breaking-change 9.0.0
|
|
452
|
-
*/
|
|
453
|
-
removeItem(_item) { }
|
|
454
|
-
/** Handle a keyboard event from the menu, delegating to the appropriate action. */
|
|
455
|
-
_handleKeydown(event) {
|
|
456
|
-
const keyCode = event.keyCode;
|
|
457
|
-
const manager = this._keyManager;
|
|
458
|
-
switch (keyCode) {
|
|
459
|
-
case ESCAPE:
|
|
460
|
-
if (!hasModifierKey(event)) {
|
|
461
|
-
event.preventDefault();
|
|
462
|
-
this.closed.emit('keydown');
|
|
463
|
-
}
|
|
464
|
-
break;
|
|
465
|
-
case LEFT_ARROW:
|
|
466
|
-
if (this.parentMenu && this.direction === 'ltr') {
|
|
467
|
-
this.closed.emit('keydown');
|
|
468
|
-
}
|
|
469
|
-
break;
|
|
470
|
-
case RIGHT_ARROW:
|
|
471
|
-
if (this.parentMenu && this.direction === 'rtl') {
|
|
472
|
-
this.closed.emit('keydown');
|
|
473
|
-
}
|
|
474
|
-
break;
|
|
475
|
-
default:
|
|
476
|
-
if (keyCode === UP_ARROW || keyCode === DOWN_ARROW) {
|
|
477
|
-
manager.setFocusOrigin('keyboard');
|
|
478
|
-
}
|
|
479
|
-
manager.onKeydown(event);
|
|
480
|
-
return;
|
|
291
|
+
_elementRef = inject(ElementRef);
|
|
292
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
293
|
+
_injector = inject(Injector);
|
|
294
|
+
_keyManager;
|
|
295
|
+
_xPosition;
|
|
296
|
+
_yPosition;
|
|
297
|
+
_firstItemFocusRef;
|
|
298
|
+
_exitFallbackTimeout;
|
|
299
|
+
_animationsDisabled = _animationsDisabled();
|
|
300
|
+
_allItems;
|
|
301
|
+
_directDescendantItems = new QueryList();
|
|
302
|
+
_classList = {};
|
|
303
|
+
_panelAnimationState = 'void';
|
|
304
|
+
_animationDone = new Subject();
|
|
305
|
+
_isAnimating = signal(false, ...(ngDevMode ? [{
|
|
306
|
+
debugName: "_isAnimating"
|
|
307
|
+
}] : []));
|
|
308
|
+
parentMenu;
|
|
309
|
+
direction;
|
|
310
|
+
overlayPanelClass;
|
|
311
|
+
backdropClass;
|
|
312
|
+
ariaLabel;
|
|
313
|
+
ariaLabelledby;
|
|
314
|
+
ariaDescribedby;
|
|
315
|
+
get xPosition() {
|
|
316
|
+
return this._xPosition;
|
|
317
|
+
}
|
|
318
|
+
set xPosition(value) {
|
|
319
|
+
if (value !== 'before' && value !== 'after' && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
320
|
+
throwMatMenuInvalidPositionX();
|
|
321
|
+
}
|
|
322
|
+
this._xPosition = value;
|
|
323
|
+
this.setPositionClasses();
|
|
324
|
+
}
|
|
325
|
+
get yPosition() {
|
|
326
|
+
return this._yPosition;
|
|
327
|
+
}
|
|
328
|
+
set yPosition(value) {
|
|
329
|
+
if (value !== 'above' && value !== 'below' && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
330
|
+
throwMatMenuInvalidPositionY();
|
|
331
|
+
}
|
|
332
|
+
this._yPosition = value;
|
|
333
|
+
this.setPositionClasses();
|
|
334
|
+
}
|
|
335
|
+
templateRef;
|
|
336
|
+
items;
|
|
337
|
+
lazyContent;
|
|
338
|
+
overlapTrigger;
|
|
339
|
+
hasBackdrop;
|
|
340
|
+
set panelClass(classes) {
|
|
341
|
+
const previousPanelClass = this._previousPanelClass;
|
|
342
|
+
const newClassList = {
|
|
343
|
+
...this._classList
|
|
344
|
+
};
|
|
345
|
+
if (previousPanelClass && previousPanelClass.length) {
|
|
346
|
+
previousPanelClass.split(' ').forEach(className => {
|
|
347
|
+
newClassList[className] = false;
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
this._previousPanelClass = classes;
|
|
351
|
+
if (classes && classes.length) {
|
|
352
|
+
classes.split(' ').forEach(className => {
|
|
353
|
+
newClassList[className] = true;
|
|
354
|
+
});
|
|
355
|
+
this._elementRef.nativeElement.className = '';
|
|
356
|
+
}
|
|
357
|
+
this._classList = newClassList;
|
|
358
|
+
}
|
|
359
|
+
_previousPanelClass;
|
|
360
|
+
get classList() {
|
|
361
|
+
return this.panelClass;
|
|
362
|
+
}
|
|
363
|
+
set classList(classes) {
|
|
364
|
+
this.panelClass = classes;
|
|
365
|
+
}
|
|
366
|
+
closed = new EventEmitter();
|
|
367
|
+
close = this.closed;
|
|
368
|
+
panelId = inject(_IdGenerator).getId('mat-menu-panel-');
|
|
369
|
+
constructor() {
|
|
370
|
+
const defaultOptions = inject(MAT_MENU_DEFAULT_OPTIONS);
|
|
371
|
+
this.overlayPanelClass = defaultOptions.overlayPanelClass || '';
|
|
372
|
+
this._xPosition = defaultOptions.xPosition;
|
|
373
|
+
this._yPosition = defaultOptions.yPosition;
|
|
374
|
+
this.backdropClass = defaultOptions.backdropClass;
|
|
375
|
+
this.overlapTrigger = defaultOptions.overlapTrigger;
|
|
376
|
+
this.hasBackdrop = defaultOptions.hasBackdrop;
|
|
377
|
+
}
|
|
378
|
+
ngOnInit() {
|
|
379
|
+
this.setPositionClasses();
|
|
380
|
+
}
|
|
381
|
+
ngAfterContentInit() {
|
|
382
|
+
this._updateDirectDescendants();
|
|
383
|
+
this._keyManager = new FocusKeyManager(this._directDescendantItems).withWrap().withTypeAhead().withHomeAndEnd();
|
|
384
|
+
this._keyManager.tabOut.subscribe(() => this.closed.emit('tab'));
|
|
385
|
+
this._directDescendantItems.changes.pipe(startWith(this._directDescendantItems), switchMap(items => merge(...items.map(item => item._focused)))).subscribe(focusedItem => this._keyManager.updateActiveItem(focusedItem));
|
|
386
|
+
this._directDescendantItems.changes.subscribe(itemsList => {
|
|
387
|
+
const manager = this._keyManager;
|
|
388
|
+
if (this._panelAnimationState === 'enter' && manager.activeItem?._hasFocus()) {
|
|
389
|
+
const items = itemsList.toArray();
|
|
390
|
+
const index = Math.max(0, Math.min(items.length - 1, manager.activeItemIndex || 0));
|
|
391
|
+
if (items[index] && !items[index].disabled) {
|
|
392
|
+
manager.setActiveItem(index);
|
|
393
|
+
} else {
|
|
394
|
+
manager.setNextItemActive();
|
|
481
395
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
* Resets the active item in the menu. This is used when the menu is opened, allowing
|
|
507
|
-
* the user to start from the first option when pressing the down arrow.
|
|
508
|
-
*/
|
|
509
|
-
resetActiveItem() {
|
|
510
|
-
this._keyManager.setActiveItem(-1);
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* @deprecated No longer used and will be removed.
|
|
514
|
-
* @breaking-change 21.0.0
|
|
515
|
-
*/
|
|
516
|
-
setElevation(_depth) { }
|
|
517
|
-
/**
|
|
518
|
-
* Adds classes to the menu panel based on its position. Can be used by
|
|
519
|
-
* consumers to add specific styling based on the position.
|
|
520
|
-
* @param posX Position of the menu along the x axis.
|
|
521
|
-
* @param posY Position of the menu along the y axis.
|
|
522
|
-
* @docs-private
|
|
523
|
-
*/
|
|
524
|
-
setPositionClasses(posX = this.xPosition, posY = this.yPosition) {
|
|
525
|
-
this._classList = {
|
|
526
|
-
...this._classList,
|
|
527
|
-
['mat-menu-before']: posX === 'before',
|
|
528
|
-
['mat-menu-after']: posX === 'after',
|
|
529
|
-
['mat-menu-above']: posY === 'above',
|
|
530
|
-
['mat-menu-below']: posY === 'below',
|
|
531
|
-
};
|
|
532
|
-
this._changeDetectorRef.markForCheck();
|
|
533
|
-
}
|
|
534
|
-
/** Callback that is invoked when the panel animation completes. */
|
|
535
|
-
_onAnimationDone(state) {
|
|
536
|
-
const isExit = state === EXIT_ANIMATION;
|
|
537
|
-
if (isExit || state === ENTER_ANIMATION) {
|
|
538
|
-
if (isExit) {
|
|
539
|
-
clearTimeout(this._exitFallbackTimeout);
|
|
540
|
-
this._exitFallbackTimeout = undefined;
|
|
541
|
-
}
|
|
542
|
-
this._animationDone.next(isExit ? 'void' : 'enter');
|
|
543
|
-
this._isAnimating.set(false);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
ngOnDestroy() {
|
|
400
|
+
this._keyManager?.destroy();
|
|
401
|
+
this._directDescendantItems.destroy();
|
|
402
|
+
this.closed.complete();
|
|
403
|
+
this._firstItemFocusRef?.destroy();
|
|
404
|
+
clearTimeout(this._exitFallbackTimeout);
|
|
405
|
+
}
|
|
406
|
+
_hovered() {
|
|
407
|
+
const itemChanges = this._directDescendantItems.changes;
|
|
408
|
+
return itemChanges.pipe(startWith(this._directDescendantItems), switchMap(items => merge(...items.map(item => item._hovered))));
|
|
409
|
+
}
|
|
410
|
+
addItem(_item) {}
|
|
411
|
+
removeItem(_item) {}
|
|
412
|
+
_handleKeydown(event) {
|
|
413
|
+
const keyCode = event.keyCode;
|
|
414
|
+
const manager = this._keyManager;
|
|
415
|
+
switch (keyCode) {
|
|
416
|
+
case ESCAPE:
|
|
417
|
+
if (!hasModifierKey(event)) {
|
|
418
|
+
event.preventDefault();
|
|
419
|
+
this.closed.emit('keydown');
|
|
544
420
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
if (
|
|
548
|
-
|
|
421
|
+
break;
|
|
422
|
+
case LEFT_ARROW:
|
|
423
|
+
if (this.parentMenu && this.direction === 'ltr') {
|
|
424
|
+
this.closed.emit('keydown');
|
|
549
425
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
this.
|
|
553
|
-
|
|
554
|
-
if (this._keyManager.activeItemIndex === 0) {
|
|
555
|
-
// Scroll the content element to the top as soon as the animation starts. This is necessary,
|
|
556
|
-
// because we move focus to the first item while it's still being animated, which can throw
|
|
557
|
-
// the browser off when it determines the scroll position. Alternatively we can move focus
|
|
558
|
-
// when the animation is done, however moving focus asynchronously will interrupt screen
|
|
559
|
-
// readers which are in the process of reading out the menu already. We take the `element`
|
|
560
|
-
// from the `event` since we can't use a `ViewChild` to access the pane.
|
|
561
|
-
const menuPanel = this._resolvePanel();
|
|
562
|
-
if (menuPanel) {
|
|
563
|
-
menuPanel.scrollTop = 0;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
426
|
+
break;
|
|
427
|
+
case RIGHT_ARROW:
|
|
428
|
+
if (this.parentMenu && this.direction === 'rtl') {
|
|
429
|
+
this.closed.emit('keydown');
|
|
566
430
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
this._exitFallbackTimeout = setTimeout(() => this._onAnimationDone(EXIT_ANIMATION), 200);
|
|
431
|
+
break;
|
|
432
|
+
default:
|
|
433
|
+
if (keyCode === UP_ARROW || keyCode === DOWN_ARROW) {
|
|
434
|
+
manager.setFocusOrigin('keyboard');
|
|
572
435
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
436
|
+
manager.onKeydown(event);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
focusFirstItem(origin = 'program') {
|
|
441
|
+
this._firstItemFocusRef?.destroy();
|
|
442
|
+
this._firstItemFocusRef = afterNextRender(() => {
|
|
443
|
+
const menuPanel = this._resolvePanel();
|
|
444
|
+
if (!menuPanel || !menuPanel.contains(document.activeElement)) {
|
|
445
|
+
const manager = this._keyManager;
|
|
446
|
+
manager.setFocusOrigin(origin).setFirstItemActive();
|
|
447
|
+
if (!manager.activeItem && menuPanel) {
|
|
448
|
+
menuPanel.focus();
|
|
578
449
|
}
|
|
579
|
-
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
450
|
+
}
|
|
451
|
+
}, {
|
|
452
|
+
injector: this._injector
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
resetActiveItem() {
|
|
456
|
+
this._keyManager.setActiveItem(-1);
|
|
457
|
+
}
|
|
458
|
+
setElevation(_depth) {}
|
|
459
|
+
setPositionClasses(posX = this.xPosition, posY = this.yPosition) {
|
|
460
|
+
this._classList = {
|
|
461
|
+
...this._classList,
|
|
462
|
+
['mat-menu-before']: posX === 'before',
|
|
463
|
+
['mat-menu-after']: posX === 'after',
|
|
464
|
+
['mat-menu-above']: posY === 'above',
|
|
465
|
+
['mat-menu-below']: posY === 'below'
|
|
466
|
+
};
|
|
467
|
+
this._changeDetectorRef.markForCheck();
|
|
468
|
+
}
|
|
469
|
+
_onAnimationDone(state) {
|
|
470
|
+
const isExit = state === EXIT_ANIMATION;
|
|
471
|
+
if (isExit || state === ENTER_ANIMATION) {
|
|
472
|
+
if (isExit) {
|
|
473
|
+
clearTimeout(this._exitFallbackTimeout);
|
|
474
|
+
this._exitFallbackTimeout = undefined;
|
|
475
|
+
}
|
|
476
|
+
this._animationDone.next(isExit ? 'void' : 'enter');
|
|
477
|
+
this._isAnimating.set(false);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
_onAnimationStart(state) {
|
|
481
|
+
if (state === ENTER_ANIMATION || state === EXIT_ANIMATION) {
|
|
482
|
+
this._isAnimating.set(true);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
_setIsOpen(isOpen) {
|
|
486
|
+
this._panelAnimationState = isOpen ? 'enter' : 'void';
|
|
487
|
+
if (isOpen) {
|
|
488
|
+
if (this._keyManager.activeItemIndex === 0) {
|
|
489
|
+
const menuPanel = this._resolvePanel();
|
|
490
|
+
if (menuPanel) {
|
|
491
|
+
menuPanel.scrollTop = 0;
|
|
604
492
|
}
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
|
|
493
|
+
}
|
|
494
|
+
} else if (!this._animationsDisabled) {
|
|
495
|
+
this._exitFallbackTimeout = setTimeout(() => this._onAnimationDone(EXIT_ANIMATION), 200);
|
|
496
|
+
}
|
|
497
|
+
if (this._animationsDisabled) {
|
|
498
|
+
setTimeout(() => {
|
|
499
|
+
this._onAnimationDone(isOpen ? ENTER_ANIMATION : EXIT_ANIMATION);
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
this._changeDetectorRef.markForCheck();
|
|
503
|
+
}
|
|
504
|
+
_updateDirectDescendants() {
|
|
505
|
+
this._allItems.changes.pipe(startWith(this._allItems)).subscribe(items => {
|
|
506
|
+
this._directDescendantItems.reset(items.filter(item => item._parentMenu === this));
|
|
507
|
+
this._directDescendantItems.notifyOnChanges();
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
_resolvePanel() {
|
|
511
|
+
let menuPanel = null;
|
|
512
|
+
if (this._directDescendantItems.length) {
|
|
513
|
+
menuPanel = this._directDescendantItems.first._getHostElement().closest('[role="menu"]');
|
|
514
|
+
}
|
|
515
|
+
return menuPanel;
|
|
516
|
+
}
|
|
517
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
518
|
+
minVersion: "12.0.0",
|
|
519
|
+
version: "20.2.0-next.2",
|
|
520
|
+
ngImport: i0,
|
|
521
|
+
type: MatMenu,
|
|
522
|
+
deps: [],
|
|
523
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
524
|
+
});
|
|
525
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
526
|
+
minVersion: "16.1.0",
|
|
527
|
+
version: "20.2.0-next.2",
|
|
528
|
+
type: MatMenu,
|
|
529
|
+
isStandalone: true,
|
|
530
|
+
selector: "mat-menu",
|
|
531
|
+
inputs: {
|
|
532
|
+
backdropClass: "backdropClass",
|
|
533
|
+
ariaLabel: ["aria-label", "ariaLabel"],
|
|
534
|
+
ariaLabelledby: ["aria-labelledby", "ariaLabelledby"],
|
|
535
|
+
ariaDescribedby: ["aria-describedby", "ariaDescribedby"],
|
|
536
|
+
xPosition: "xPosition",
|
|
537
|
+
yPosition: "yPosition",
|
|
538
|
+
overlapTrigger: ["overlapTrigger", "overlapTrigger", booleanAttribute],
|
|
539
|
+
hasBackdrop: ["hasBackdrop", "hasBackdrop", value => value == null ? null : booleanAttribute(value)],
|
|
540
|
+
panelClass: ["class", "panelClass"],
|
|
541
|
+
classList: "classList"
|
|
542
|
+
},
|
|
543
|
+
outputs: {
|
|
544
|
+
closed: "closed",
|
|
545
|
+
close: "close"
|
|
546
|
+
},
|
|
547
|
+
host: {
|
|
548
|
+
properties: {
|
|
549
|
+
"attr.aria-label": "null",
|
|
550
|
+
"attr.aria-labelledby": "null",
|
|
551
|
+
"attr.aria-describedby": "null"
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
providers: [{
|
|
555
|
+
provide: MAT_MENU_PANEL,
|
|
556
|
+
useExisting: MatMenu
|
|
557
|
+
}],
|
|
558
|
+
queries: [{
|
|
559
|
+
propertyName: "lazyContent",
|
|
560
|
+
first: true,
|
|
561
|
+
predicate: MAT_MENU_CONTENT,
|
|
562
|
+
descendants: true
|
|
563
|
+
}, {
|
|
564
|
+
propertyName: "_allItems",
|
|
565
|
+
predicate: MatMenuItem,
|
|
566
|
+
descendants: true
|
|
567
|
+
}, {
|
|
568
|
+
propertyName: "items",
|
|
569
|
+
predicate: MatMenuItem
|
|
570
|
+
}],
|
|
571
|
+
viewQueries: [{
|
|
572
|
+
propertyName: "templateRef",
|
|
573
|
+
first: true,
|
|
574
|
+
predicate: TemplateRef,
|
|
575
|
+
descendants: true
|
|
576
|
+
}],
|
|
577
|
+
exportAs: ["matMenu"],
|
|
578
|
+
ngImport: i0,
|
|
579
|
+
template: "<ng-template>\n <div\n class=\"mat-mdc-menu-panel\"\n [id]=\"panelId\"\n [class]=\"_classList\"\n [class.mat-menu-panel-animations-disabled]=\"_animationsDisabled\"\n [class.mat-menu-panel-exit-animation]=\"_panelAnimationState === 'void'\"\n [class.mat-menu-panel-animating]=\"_isAnimating()\"\n (click)=\"closed.emit('click')\"\n tabindex=\"-1\"\n role=\"menu\"\n (animationstart)=\"_onAnimationStart($event.animationName)\"\n (animationend)=\"_onAnimationDone($event.animationName)\"\n (animationcancel)=\"_onAnimationDone($event.animationName)\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [attr.aria-describedby]=\"ariaDescribedby || null\">\n <div class=\"mat-mdc-menu-content\">\n <ng-content></ng-content>\n </div>\n </div>\n</ng-template>\n",
|
|
580
|
+
styles: ["mat-menu{display:none}.mat-mdc-menu-content{margin:0;padding:8px 0;outline:0}.mat-mdc-menu-content,.mat-mdc-menu-content .mat-mdc-menu-item .mat-mdc-menu-item-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;flex:1;white-space:normal;font-family:var(--mat-menu-item-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-menu-item-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-menu-item-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-menu-item-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-menu-item-label-text-weight, var(--mat-sys-label-large-weight))}@keyframes _mat-menu-enter{from{opacity:0;transform:scale(0.8)}to{opacity:1;transform:none}}@keyframes _mat-menu-exit{from{opacity:1}to{opacity:0}}.mat-mdc-menu-panel{min-width:112px;max-width:280px;overflow:auto;box-sizing:border-box;outline:0;animation:_mat-menu-enter 120ms cubic-bezier(0, 0, 0.2, 1);border-radius:var(--mat-menu-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mat-menu-container-color, var(--mat-sys-surface-container));box-shadow:var(--mat-menu-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));will-change:transform,opacity}.mat-mdc-menu-panel.mat-menu-panel-exit-animation{animation:_mat-menu-exit 100ms 25ms linear forwards}.mat-mdc-menu-panel.mat-menu-panel-animations-disabled{animation:none}.mat-mdc-menu-panel.mat-menu-panel-animating{pointer-events:none}.mat-mdc-menu-panel.mat-menu-panel-animating:has(.mat-mdc-menu-content:empty){display:none}@media(forced-colors: active){.mat-mdc-menu-panel{outline:solid 1px}}.mat-mdc-menu-panel .mat-divider{border-top-color:var(--mat-menu-divider-color, var(--mat-sys-surface-variant));margin-bottom:var(--mat-menu-divider-bottom-spacing, 8px);margin-top:var(--mat-menu-divider-top-spacing, 8px)}.mat-mdc-menu-item{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;cursor:pointer;width:100%;text-align:left;box-sizing:border-box;color:inherit;font-size:inherit;background:none;text-decoration:none;margin:0;min-height:48px;padding-left:var(--mat-menu-item-leading-spacing, 12px);padding-right:var(--mat-menu-item-trailing-spacing, 12px);-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-menu-item::-moz-focus-inner{border:0}[dir=rtl] .mat-mdc-menu-item{padding-left:var(--mat-menu-item-trailing-spacing, 12px);padding-right:var(--mat-menu-item-leading-spacing, 12px)}.mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-leading-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-trailing-spacing, 12px)}[dir=rtl] .mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-trailing-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-leading-spacing, 12px)}.mat-mdc-menu-item,.mat-mdc-menu-item:visited,.mat-mdc-menu-item:link{color:var(--mat-menu-item-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-menu-item .mat-icon-no-color,.mat-mdc-menu-item .mat-mdc-menu-submenu-icon{color:var(--mat-menu-item-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-menu-item[disabled]{cursor:default;opacity:.38}.mat-mdc-menu-item[disabled]::after{display:block;position:absolute;content:\"\";top:0;left:0;bottom:0;right:0}.mat-mdc-menu-item:focus{outline:0}.mat-mdc-menu-item .mat-icon{flex-shrink:0;margin-right:var(--mat-menu-item-spacing, 12px);height:var(--mat-menu-item-icon-size, 24px);width:var(--mat-menu-item-icon-size, 24px)}[dir=rtl] .mat-mdc-menu-item{text-align:right}[dir=rtl] .mat-mdc-menu-item .mat-icon{margin-right:0;margin-left:var(--mat-menu-item-spacing, 12px)}.mat-mdc-menu-item:not([disabled]):hover{background-color:var(--mat-menu-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-menu-item:not([disabled]).cdk-program-focused,.mat-mdc-menu-item:not([disabled]).cdk-keyboard-focused,.mat-mdc-menu-item:not([disabled]).mat-mdc-menu-item-highlighted{background-color:var(--mat-menu-item-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}@media(forced-colors: active){.mat-mdc-menu-item{margin-top:1px}}.mat-mdc-menu-submenu-icon{width:var(--mat-menu-item-icon-size, 24px);height:10px;fill:currentColor;padding-left:var(--mat-menu-item-spacing, 12px)}[dir=rtl] .mat-mdc-menu-submenu-icon{padding-right:var(--mat-menu-item-spacing, 12px);padding-left:0}[dir=rtl] .mat-mdc-menu-submenu-icon polygon{transform:scaleX(-1);transform-origin:center}@media(forced-colors: active){.mat-mdc-menu-submenu-icon{fill:CanvasText}}.mat-mdc-menu-item .mat-mdc-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}\n"],
|
|
581
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
582
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
583
|
+
});
|
|
609
584
|
}
|
|
610
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
585
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
586
|
+
minVersion: "12.0.0",
|
|
587
|
+
version: "20.2.0-next.2",
|
|
588
|
+
ngImport: i0,
|
|
589
|
+
type: MatMenu,
|
|
590
|
+
decorators: [{
|
|
591
|
+
type: Component,
|
|
592
|
+
args: [{
|
|
593
|
+
selector: 'mat-menu',
|
|
594
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
595
|
+
encapsulation: ViewEncapsulation.None,
|
|
596
|
+
exportAs: 'matMenu',
|
|
597
|
+
host: {
|
|
598
|
+
'[attr.aria-label]': 'null',
|
|
599
|
+
'[attr.aria-labelledby]': 'null',
|
|
600
|
+
'[attr.aria-describedby]': 'null'
|
|
601
|
+
},
|
|
602
|
+
providers: [{
|
|
603
|
+
provide: MAT_MENU_PANEL,
|
|
604
|
+
useExisting: MatMenu
|
|
605
|
+
}],
|
|
606
|
+
template: "<ng-template>\n <div\n class=\"mat-mdc-menu-panel\"\n [id]=\"panelId\"\n [class]=\"_classList\"\n [class.mat-menu-panel-animations-disabled]=\"_animationsDisabled\"\n [class.mat-menu-panel-exit-animation]=\"_panelAnimationState === 'void'\"\n [class.mat-menu-panel-animating]=\"_isAnimating()\"\n (click)=\"closed.emit('click')\"\n tabindex=\"-1\"\n role=\"menu\"\n (animationstart)=\"_onAnimationStart($event.animationName)\"\n (animationend)=\"_onAnimationDone($event.animationName)\"\n (animationcancel)=\"_onAnimationDone($event.animationName)\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [attr.aria-describedby]=\"ariaDescribedby || null\">\n <div class=\"mat-mdc-menu-content\">\n <ng-content></ng-content>\n </div>\n </div>\n</ng-template>\n",
|
|
607
|
+
styles: ["mat-menu{display:none}.mat-mdc-menu-content{margin:0;padding:8px 0;outline:0}.mat-mdc-menu-content,.mat-mdc-menu-content .mat-mdc-menu-item .mat-mdc-menu-item-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;flex:1;white-space:normal;font-family:var(--mat-menu-item-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-menu-item-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-menu-item-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-menu-item-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-menu-item-label-text-weight, var(--mat-sys-label-large-weight))}@keyframes _mat-menu-enter{from{opacity:0;transform:scale(0.8)}to{opacity:1;transform:none}}@keyframes _mat-menu-exit{from{opacity:1}to{opacity:0}}.mat-mdc-menu-panel{min-width:112px;max-width:280px;overflow:auto;box-sizing:border-box;outline:0;animation:_mat-menu-enter 120ms cubic-bezier(0, 0, 0.2, 1);border-radius:var(--mat-menu-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mat-menu-container-color, var(--mat-sys-surface-container));box-shadow:var(--mat-menu-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));will-change:transform,opacity}.mat-mdc-menu-panel.mat-menu-panel-exit-animation{animation:_mat-menu-exit 100ms 25ms linear forwards}.mat-mdc-menu-panel.mat-menu-panel-animations-disabled{animation:none}.mat-mdc-menu-panel.mat-menu-panel-animating{pointer-events:none}.mat-mdc-menu-panel.mat-menu-panel-animating:has(.mat-mdc-menu-content:empty){display:none}@media(forced-colors: active){.mat-mdc-menu-panel{outline:solid 1px}}.mat-mdc-menu-panel .mat-divider{border-top-color:var(--mat-menu-divider-color, var(--mat-sys-surface-variant));margin-bottom:var(--mat-menu-divider-bottom-spacing, 8px);margin-top:var(--mat-menu-divider-top-spacing, 8px)}.mat-mdc-menu-item{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;cursor:pointer;width:100%;text-align:left;box-sizing:border-box;color:inherit;font-size:inherit;background:none;text-decoration:none;margin:0;min-height:48px;padding-left:var(--mat-menu-item-leading-spacing, 12px);padding-right:var(--mat-menu-item-trailing-spacing, 12px);-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-menu-item::-moz-focus-inner{border:0}[dir=rtl] .mat-mdc-menu-item{padding-left:var(--mat-menu-item-trailing-spacing, 12px);padding-right:var(--mat-menu-item-leading-spacing, 12px)}.mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-leading-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-trailing-spacing, 12px)}[dir=rtl] .mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-trailing-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-leading-spacing, 12px)}.mat-mdc-menu-item,.mat-mdc-menu-item:visited,.mat-mdc-menu-item:link{color:var(--mat-menu-item-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-menu-item .mat-icon-no-color,.mat-mdc-menu-item .mat-mdc-menu-submenu-icon{color:var(--mat-menu-item-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-menu-item[disabled]{cursor:default;opacity:.38}.mat-mdc-menu-item[disabled]::after{display:block;position:absolute;content:\"\";top:0;left:0;bottom:0;right:0}.mat-mdc-menu-item:focus{outline:0}.mat-mdc-menu-item .mat-icon{flex-shrink:0;margin-right:var(--mat-menu-item-spacing, 12px);height:var(--mat-menu-item-icon-size, 24px);width:var(--mat-menu-item-icon-size, 24px)}[dir=rtl] .mat-mdc-menu-item{text-align:right}[dir=rtl] .mat-mdc-menu-item .mat-icon{margin-right:0;margin-left:var(--mat-menu-item-spacing, 12px)}.mat-mdc-menu-item:not([disabled]):hover{background-color:var(--mat-menu-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-menu-item:not([disabled]).cdk-program-focused,.mat-mdc-menu-item:not([disabled]).cdk-keyboard-focused,.mat-mdc-menu-item:not([disabled]).mat-mdc-menu-item-highlighted{background-color:var(--mat-menu-item-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}@media(forced-colors: active){.mat-mdc-menu-item{margin-top:1px}}.mat-mdc-menu-submenu-icon{width:var(--mat-menu-item-icon-size, 24px);height:10px;fill:currentColor;padding-left:var(--mat-menu-item-spacing, 12px)}[dir=rtl] .mat-mdc-menu-submenu-icon{padding-right:var(--mat-menu-item-spacing, 12px);padding-left:0}[dir=rtl] .mat-mdc-menu-submenu-icon polygon{transform:scaleX(-1);transform-origin:center}@media(forced-colors: active){.mat-mdc-menu-submenu-icon{fill:CanvasText}}.mat-mdc-menu-item .mat-mdc-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}\n"]
|
|
608
|
+
}]
|
|
609
|
+
}],
|
|
610
|
+
ctorParameters: () => [],
|
|
611
|
+
propDecorators: {
|
|
612
|
+
_allItems: [{
|
|
613
|
+
type: ContentChildren,
|
|
614
|
+
args: [MatMenuItem, {
|
|
615
|
+
descendants: true
|
|
616
|
+
}]
|
|
617
|
+
}],
|
|
618
|
+
backdropClass: [{
|
|
619
|
+
type: Input
|
|
620
|
+
}],
|
|
621
|
+
ariaLabel: [{
|
|
622
|
+
type: Input,
|
|
623
|
+
args: ['aria-label']
|
|
624
|
+
}],
|
|
625
|
+
ariaLabelledby: [{
|
|
626
|
+
type: Input,
|
|
627
|
+
args: ['aria-labelledby']
|
|
628
|
+
}],
|
|
629
|
+
ariaDescribedby: [{
|
|
630
|
+
type: Input,
|
|
631
|
+
args: ['aria-describedby']
|
|
632
|
+
}],
|
|
633
|
+
xPosition: [{
|
|
634
|
+
type: Input
|
|
635
|
+
}],
|
|
636
|
+
yPosition: [{
|
|
637
|
+
type: Input
|
|
638
|
+
}],
|
|
639
|
+
templateRef: [{
|
|
640
|
+
type: ViewChild,
|
|
641
|
+
args: [TemplateRef]
|
|
642
|
+
}],
|
|
643
|
+
items: [{
|
|
644
|
+
type: ContentChildren,
|
|
645
|
+
args: [MatMenuItem, {
|
|
646
|
+
descendants: false
|
|
647
|
+
}]
|
|
648
|
+
}],
|
|
649
|
+
lazyContent: [{
|
|
650
|
+
type: ContentChild,
|
|
651
|
+
args: [MAT_MENU_CONTENT]
|
|
652
|
+
}],
|
|
653
|
+
overlapTrigger: [{
|
|
654
|
+
type: Input,
|
|
655
|
+
args: [{
|
|
656
|
+
transform: booleanAttribute
|
|
657
|
+
}]
|
|
658
|
+
}],
|
|
659
|
+
hasBackdrop: [{
|
|
660
|
+
type: Input,
|
|
661
|
+
args: [{
|
|
662
|
+
transform: value => value == null ? null : booleanAttribute(value)
|
|
663
|
+
}]
|
|
664
|
+
}],
|
|
665
|
+
panelClass: [{
|
|
666
|
+
type: Input,
|
|
667
|
+
args: ['class']
|
|
668
|
+
}],
|
|
669
|
+
classList: [{
|
|
670
|
+
type: Input
|
|
671
|
+
}],
|
|
672
|
+
closed: [{
|
|
673
|
+
type: Output
|
|
674
|
+
}],
|
|
675
|
+
close: [{
|
|
676
|
+
type: Output
|
|
677
|
+
}]
|
|
678
|
+
}
|
|
679
|
+
});
|
|
660
680
|
|
|
661
|
-
/** Injection token that determines the scroll handling while the menu is open. */
|
|
662
681
|
const MAT_MENU_SCROLL_STRATEGY = new InjectionToken('mat-menu-scroll-strategy', {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
682
|
+
providedIn: 'root',
|
|
683
|
+
factory: () => {
|
|
684
|
+
const injector = inject(Injector);
|
|
685
|
+
return () => createRepositionScrollStrategy(injector);
|
|
686
|
+
}
|
|
668
687
|
});
|
|
669
|
-
/**
|
|
670
|
-
* Default top padding of the menu panel.
|
|
671
|
-
* @deprecated No longer being used. Will be removed.
|
|
672
|
-
* @breaking-change 15.0.0
|
|
673
|
-
*/
|
|
674
688
|
const MENU_PANEL_TOP_PADDING = 8;
|
|
675
|
-
/** Mapping between menu panels and the last trigger that opened them. */
|
|
676
689
|
const PANELS_TO_TRIGGERS = new WeakMap();
|
|
677
|
-
/** Directive applied to an element that should trigger a `mat-menu`. */
|
|
678
690
|
class MatMenuTriggerBase {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
this.
|
|
719
|
-
if (
|
|
720
|
-
|
|
721
|
-
throwMatMenuRecursiveError();
|
|
722
|
-
}
|
|
723
|
-
this._menuCloseSubscription = menu.close.subscribe((reason) => {
|
|
724
|
-
this._destroyMenu(reason);
|
|
725
|
-
// If a click closed the menu, we should close the entire chain of nested menus.
|
|
726
|
-
if ((reason === 'click' || reason === 'tab') && this._parentMaterialMenu) {
|
|
727
|
-
this._parentMaterialMenu.closed.emit(reason);
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
this._menuItemInstance?._setTriggersSubmenu(this._triggersSubmenu());
|
|
732
|
-
}
|
|
733
|
-
_menuInternal;
|
|
734
|
-
constructor(_canHaveBackdrop) {
|
|
735
|
-
this._canHaveBackdrop = _canHaveBackdrop;
|
|
736
|
-
const parentMenu = inject(MAT_MENU_PANEL, { optional: true });
|
|
737
|
-
this._parentMaterialMenu = parentMenu instanceof MatMenu ? parentMenu : undefined;
|
|
738
|
-
}
|
|
739
|
-
ngOnDestroy() {
|
|
740
|
-
if (this._menu && this._ownsMenu(this._menu)) {
|
|
741
|
-
PANELS_TO_TRIGGERS.delete(this._menu);
|
|
742
|
-
}
|
|
743
|
-
this._pendingRemoval?.unsubscribe();
|
|
744
|
-
this._menuCloseSubscription.unsubscribe();
|
|
745
|
-
this._closingActionsSubscription.unsubscribe();
|
|
746
|
-
if (this._overlayRef) {
|
|
747
|
-
this._overlayRef.dispose();
|
|
748
|
-
this._overlayRef = null;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
/** Whether the menu is open. */
|
|
752
|
-
get menuOpen() {
|
|
753
|
-
return this._menuOpen;
|
|
754
|
-
}
|
|
755
|
-
/** The text direction of the containing app. */
|
|
756
|
-
get dir() {
|
|
757
|
-
return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
|
|
758
|
-
}
|
|
759
|
-
/** Whether the menu triggers a sub-menu or a top-level one. */
|
|
760
|
-
_triggersSubmenu() {
|
|
761
|
-
return !!(this._menuItemInstance && this._parentMaterialMenu && this._menu);
|
|
762
|
-
}
|
|
763
|
-
_closeMenu() {
|
|
764
|
-
this._menu?.close.emit();
|
|
765
|
-
}
|
|
766
|
-
/** Internal method to open menu providing option to auto focus on first item. */
|
|
767
|
-
_openMenu(autoFocus) {
|
|
768
|
-
const menu = this._menu;
|
|
769
|
-
if (this._menuOpen || !menu) {
|
|
770
|
-
return;
|
|
771
|
-
}
|
|
772
|
-
this._pendingRemoval?.unsubscribe();
|
|
773
|
-
const previousTrigger = PANELS_TO_TRIGGERS.get(menu);
|
|
774
|
-
PANELS_TO_TRIGGERS.set(menu, this);
|
|
775
|
-
// If the same menu is currently attached to another trigger,
|
|
776
|
-
// we need to close it so it doesn't end up in a broken state.
|
|
777
|
-
if (previousTrigger && previousTrigger !== this) {
|
|
778
|
-
previousTrigger._closeMenu();
|
|
691
|
+
_canHaveBackdrop;
|
|
692
|
+
_element = inject(ElementRef);
|
|
693
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
694
|
+
_menuItemInstance = inject(MatMenuItem, {
|
|
695
|
+
optional: true,
|
|
696
|
+
self: true
|
|
697
|
+
});
|
|
698
|
+
_dir = inject(Directionality, {
|
|
699
|
+
optional: true
|
|
700
|
+
});
|
|
701
|
+
_focusMonitor = inject(FocusMonitor);
|
|
702
|
+
_ngZone = inject(NgZone);
|
|
703
|
+
_injector = inject(Injector);
|
|
704
|
+
_scrollStrategy = inject(MAT_MENU_SCROLL_STRATEGY);
|
|
705
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
706
|
+
_animationsDisabled = _animationsDisabled();
|
|
707
|
+
_portal;
|
|
708
|
+
_overlayRef = null;
|
|
709
|
+
_menuOpen = false;
|
|
710
|
+
_closingActionsSubscription = Subscription.EMPTY;
|
|
711
|
+
_menuCloseSubscription = Subscription.EMPTY;
|
|
712
|
+
_pendingRemoval;
|
|
713
|
+
_parentMaterialMenu;
|
|
714
|
+
_parentInnerPadding;
|
|
715
|
+
_openedBy = undefined;
|
|
716
|
+
get _menu() {
|
|
717
|
+
return this._menuInternal;
|
|
718
|
+
}
|
|
719
|
+
set _menu(menu) {
|
|
720
|
+
if (menu === this._menuInternal) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
this._menuInternal = menu;
|
|
724
|
+
this._menuCloseSubscription.unsubscribe();
|
|
725
|
+
if (menu) {
|
|
726
|
+
if (menu === this._parentMaterialMenu && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
727
|
+
throwMatMenuRecursiveError();
|
|
728
|
+
}
|
|
729
|
+
this._menuCloseSubscription = menu.close.subscribe(reason => {
|
|
730
|
+
this._destroyMenu(reason);
|
|
731
|
+
if ((reason === 'click' || reason === 'tab') && this._parentMaterialMenu) {
|
|
732
|
+
this._parentMaterialMenu.closed.emit(reason);
|
|
779
733
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
this._menuItemInstance?._setTriggersSubmenu(this._triggersSubmenu());
|
|
737
|
+
}
|
|
738
|
+
_menuInternal;
|
|
739
|
+
constructor(_canHaveBackdrop) {
|
|
740
|
+
this._canHaveBackdrop = _canHaveBackdrop;
|
|
741
|
+
const parentMenu = inject(MAT_MENU_PANEL, {
|
|
742
|
+
optional: true
|
|
743
|
+
});
|
|
744
|
+
this._parentMaterialMenu = parentMenu instanceof MatMenu ? parentMenu : undefined;
|
|
745
|
+
}
|
|
746
|
+
ngOnDestroy() {
|
|
747
|
+
if (this._menu && this._ownsMenu(this._menu)) {
|
|
748
|
+
PANELS_TO_TRIGGERS.delete(this._menu);
|
|
749
|
+
}
|
|
750
|
+
this._pendingRemoval?.unsubscribe();
|
|
751
|
+
this._menuCloseSubscription.unsubscribe();
|
|
752
|
+
this._closingActionsSubscription.unsubscribe();
|
|
753
|
+
if (this._overlayRef) {
|
|
754
|
+
this._overlayRef.dispose();
|
|
755
|
+
this._overlayRef = null;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
get menuOpen() {
|
|
759
|
+
return this._menuOpen;
|
|
760
|
+
}
|
|
761
|
+
get dir() {
|
|
762
|
+
return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
|
|
763
|
+
}
|
|
764
|
+
_triggersSubmenu() {
|
|
765
|
+
return !!(this._menuItemInstance && this._parentMaterialMenu && this._menu);
|
|
766
|
+
}
|
|
767
|
+
_closeMenu() {
|
|
768
|
+
this._menu?.close.emit();
|
|
769
|
+
}
|
|
770
|
+
_openMenu(autoFocus) {
|
|
771
|
+
const menu = this._menu;
|
|
772
|
+
if (this._menuOpen || !menu) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
this._pendingRemoval?.unsubscribe();
|
|
776
|
+
const previousTrigger = PANELS_TO_TRIGGERS.get(menu);
|
|
777
|
+
PANELS_TO_TRIGGERS.set(menu, this);
|
|
778
|
+
if (previousTrigger && previousTrigger !== this) {
|
|
779
|
+
previousTrigger._closeMenu();
|
|
780
|
+
}
|
|
781
|
+
const overlayRef = this._createOverlay(menu);
|
|
782
|
+
const overlayConfig = overlayRef.getConfig();
|
|
783
|
+
const positionStrategy = overlayConfig.positionStrategy;
|
|
784
|
+
this._setPosition(menu, positionStrategy);
|
|
785
|
+
if (this._canHaveBackdrop) {
|
|
786
|
+
overlayConfig.hasBackdrop = menu.hasBackdrop == null ? !this._triggersSubmenu() : menu.hasBackdrop;
|
|
787
|
+
} else {
|
|
788
|
+
overlayConfig.hasBackdrop = false;
|
|
789
|
+
}
|
|
790
|
+
if (!overlayRef.hasAttached()) {
|
|
791
|
+
overlayRef.attach(this._getPortal(menu));
|
|
792
|
+
menu.lazyContent?.attach(this.menuData);
|
|
793
|
+
}
|
|
794
|
+
this._closingActionsSubscription = this._menuClosingActions().subscribe(() => this._closeMenu());
|
|
795
|
+
menu.parentMenu = this._triggersSubmenu() ? this._parentMaterialMenu : undefined;
|
|
796
|
+
menu.direction = this.dir;
|
|
797
|
+
if (autoFocus) {
|
|
798
|
+
menu.focusFirstItem(this._openedBy || 'program');
|
|
799
|
+
}
|
|
800
|
+
this._setIsMenuOpen(true);
|
|
801
|
+
if (menu instanceof MatMenu) {
|
|
802
|
+
menu._setIsOpen(true);
|
|
803
|
+
menu._directDescendantItems.changes.pipe(takeUntil(menu.close)).subscribe(() => {
|
|
804
|
+
positionStrategy.withLockedPosition(false).reapplyLastPosition();
|
|
805
|
+
positionStrategy.withLockedPosition(true);
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
focus(origin, options) {
|
|
810
|
+
if (this._focusMonitor && origin) {
|
|
811
|
+
this._focusMonitor.focusVia(this._element, origin, options);
|
|
812
|
+
} else {
|
|
813
|
+
this._element.nativeElement.focus(options);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
_destroyMenu(reason) {
|
|
817
|
+
const overlayRef = this._overlayRef;
|
|
818
|
+
const menu = this._menu;
|
|
819
|
+
if (!overlayRef || !this.menuOpen) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
this._closingActionsSubscription.unsubscribe();
|
|
823
|
+
this._pendingRemoval?.unsubscribe();
|
|
824
|
+
if (menu instanceof MatMenu && this._ownsMenu(menu)) {
|
|
825
|
+
this._pendingRemoval = menu._animationDone.pipe(take(1)).subscribe(() => {
|
|
826
|
+
overlayRef.detach();
|
|
827
|
+
if (!PANELS_TO_TRIGGERS.has(menu)) {
|
|
828
|
+
menu.lazyContent?.detach();
|
|
787
829
|
}
|
|
788
|
-
|
|
789
|
-
|
|
830
|
+
});
|
|
831
|
+
menu._setIsOpen(false);
|
|
832
|
+
} else {
|
|
833
|
+
overlayRef.detach();
|
|
834
|
+
menu?.lazyContent?.detach();
|
|
835
|
+
}
|
|
836
|
+
if (menu && this._ownsMenu(menu)) {
|
|
837
|
+
PANELS_TO_TRIGGERS.delete(menu);
|
|
838
|
+
}
|
|
839
|
+
if (this.restoreFocus && (reason === 'keydown' || !this._openedBy || !this._triggersSubmenu())) {
|
|
840
|
+
this.focus(this._openedBy);
|
|
841
|
+
}
|
|
842
|
+
this._openedBy = undefined;
|
|
843
|
+
this._setIsMenuOpen(false);
|
|
844
|
+
}
|
|
845
|
+
_setIsMenuOpen(isOpen) {
|
|
846
|
+
if (isOpen !== this._menuOpen) {
|
|
847
|
+
this._menuOpen = isOpen;
|
|
848
|
+
this._menuOpen ? this.menuOpened.emit() : this.menuClosed.emit();
|
|
849
|
+
if (this._triggersSubmenu()) {
|
|
850
|
+
this._menuItemInstance._setHighlighted(isOpen);
|
|
851
|
+
}
|
|
852
|
+
this._changeDetectorRef.markForCheck();
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
_createOverlay(menu) {
|
|
856
|
+
if (!this._overlayRef) {
|
|
857
|
+
const config = this._getOverlayConfig(menu);
|
|
858
|
+
this._subscribeToPositions(menu, config.positionStrategy);
|
|
859
|
+
this._overlayRef = createOverlayRef(this._injector, config);
|
|
860
|
+
this._overlayRef.keydownEvents().subscribe(event => {
|
|
861
|
+
if (this._menu instanceof MatMenu) {
|
|
862
|
+
this._menu._handleKeydown(event);
|
|
790
863
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
/**
|
|
815
|
-
* Focuses the menu trigger.
|
|
816
|
-
* @param origin Source of the menu trigger's focus.
|
|
817
|
-
*/
|
|
818
|
-
focus(origin, options) {
|
|
819
|
-
if (this._focusMonitor && origin) {
|
|
820
|
-
this._focusMonitor.focusVia(this._element, origin, options);
|
|
821
|
-
}
|
|
822
|
-
else {
|
|
823
|
-
this._element.nativeElement.focus(options);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
/** Closes the menu and does the necessary cleanup. */
|
|
827
|
-
_destroyMenu(reason) {
|
|
828
|
-
const overlayRef = this._overlayRef;
|
|
829
|
-
const menu = this._menu;
|
|
830
|
-
if (!overlayRef || !this.menuOpen) {
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
this._closingActionsSubscription.unsubscribe();
|
|
834
|
-
this._pendingRemoval?.unsubscribe();
|
|
835
|
-
// Note that we don't wait for the animation to finish if another trigger took
|
|
836
|
-
// over the menu, because the panel will end up empty which looks glitchy.
|
|
837
|
-
if (menu instanceof MatMenu && this._ownsMenu(menu)) {
|
|
838
|
-
this._pendingRemoval = menu._animationDone.pipe(take(1)).subscribe(() => {
|
|
839
|
-
overlayRef.detach();
|
|
840
|
-
// Only detach the lazy content if no other trigger took over the menu, otherwise we may
|
|
841
|
-
// detach something we no longer own. Note that we don't use `this._ownsMenu` here,
|
|
842
|
-
// because the current trigger relinquishes ownership as soon as the closing sequence
|
|
843
|
-
// is kicked off whereas the animation takes some time to play out.
|
|
844
|
-
if (!PANELS_TO_TRIGGERS.has(menu)) {
|
|
845
|
-
menu.lazyContent?.detach();
|
|
846
|
-
}
|
|
847
|
-
});
|
|
848
|
-
menu._setIsOpen(false);
|
|
849
|
-
}
|
|
850
|
-
else {
|
|
851
|
-
overlayRef.detach();
|
|
852
|
-
menu?.lazyContent?.detach();
|
|
853
|
-
}
|
|
854
|
-
if (menu && this._ownsMenu(menu)) {
|
|
855
|
-
PANELS_TO_TRIGGERS.delete(menu);
|
|
856
|
-
}
|
|
857
|
-
// Always restore focus if the user is navigating using the keyboard or the menu was opened
|
|
858
|
-
// programmatically. We don't restore for non-root triggers, because it can prevent focus
|
|
859
|
-
// from making it back to the root trigger when closing a long chain of menus by clicking
|
|
860
|
-
// on the backdrop.
|
|
861
|
-
if (this.restoreFocus &&
|
|
862
|
-
(reason === 'keydown' || !this._openedBy || !this._triggersSubmenu())) {
|
|
863
|
-
this.focus(this._openedBy);
|
|
864
|
-
}
|
|
865
|
-
this._openedBy = undefined;
|
|
866
|
-
this._setIsMenuOpen(false);
|
|
867
|
-
}
|
|
868
|
-
// set state rather than toggle to support triggers sharing a menu
|
|
869
|
-
_setIsMenuOpen(isOpen) {
|
|
870
|
-
if (isOpen !== this._menuOpen) {
|
|
871
|
-
this._menuOpen = isOpen;
|
|
872
|
-
this._menuOpen ? this.menuOpened.emit() : this.menuClosed.emit();
|
|
873
|
-
if (this._triggersSubmenu()) {
|
|
874
|
-
this._menuItemInstance._setHighlighted(isOpen);
|
|
875
|
-
}
|
|
876
|
-
this._changeDetectorRef.markForCheck();
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
/**
|
|
880
|
-
* This method creates the overlay from the provided menu's template and saves its
|
|
881
|
-
* OverlayRef so that it can be attached to the DOM when openMenu is called.
|
|
882
|
-
*/
|
|
883
|
-
_createOverlay(menu) {
|
|
884
|
-
if (!this._overlayRef) {
|
|
885
|
-
const config = this._getOverlayConfig(menu);
|
|
886
|
-
this._subscribeToPositions(menu, config.positionStrategy);
|
|
887
|
-
this._overlayRef = createOverlayRef(this._injector, config);
|
|
888
|
-
this._overlayRef.keydownEvents().subscribe(event => {
|
|
889
|
-
if (this._menu instanceof MatMenu) {
|
|
890
|
-
this._menu._handleKeydown(event);
|
|
891
|
-
}
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
return this._overlayRef;
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* This method builds the configuration object needed to create the overlay, the OverlayState.
|
|
898
|
-
* @returns OverlayConfig
|
|
899
|
-
*/
|
|
900
|
-
_getOverlayConfig(menu) {
|
|
901
|
-
return new OverlayConfig({
|
|
902
|
-
positionStrategy: createFlexibleConnectedPositionStrategy(this._injector, this._getOverlayOrigin())
|
|
903
|
-
.withLockedPosition()
|
|
904
|
-
.withGrowAfterOpen()
|
|
905
|
-
.withTransformOriginOn('.mat-menu-panel, .mat-mdc-menu-panel'),
|
|
906
|
-
backdropClass: menu.backdropClass || 'cdk-overlay-transparent-backdrop',
|
|
907
|
-
panelClass: menu.overlayPanelClass,
|
|
908
|
-
scrollStrategy: this._scrollStrategy(),
|
|
909
|
-
direction: this._dir || 'ltr',
|
|
910
|
-
disableAnimations: this._animationsDisabled,
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
return this._overlayRef;
|
|
867
|
+
}
|
|
868
|
+
_getOverlayConfig(menu) {
|
|
869
|
+
return new OverlayConfig({
|
|
870
|
+
positionStrategy: createFlexibleConnectedPositionStrategy(this._injector, this._getOverlayOrigin()).withLockedPosition().withGrowAfterOpen().withTransformOriginOn('.mat-menu-panel, .mat-mdc-menu-panel'),
|
|
871
|
+
backdropClass: menu.backdropClass || 'cdk-overlay-transparent-backdrop',
|
|
872
|
+
panelClass: menu.overlayPanelClass,
|
|
873
|
+
scrollStrategy: this._scrollStrategy(),
|
|
874
|
+
direction: this._dir || 'ltr',
|
|
875
|
+
disableAnimations: this._animationsDisabled
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
_subscribeToPositions(menu, position) {
|
|
879
|
+
if (menu.setPositionClasses) {
|
|
880
|
+
position.positionChanges.subscribe(change => {
|
|
881
|
+
this._ngZone.run(() => {
|
|
882
|
+
const posX = change.connectionPair.overlayX === 'start' ? 'after' : 'before';
|
|
883
|
+
const posY = change.connectionPair.overlayY === 'top' ? 'below' : 'above';
|
|
884
|
+
menu.setPositionClasses(posX, posY);
|
|
911
885
|
});
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
}
|
|
929
|
-
/**
|
|
930
|
-
* Sets the appropriate positions on a position strategy
|
|
931
|
-
* so the overlay connects with the trigger correctly.
|
|
932
|
-
* @param positionStrategy Strategy whose position to update.
|
|
933
|
-
*/
|
|
934
|
-
_setPosition(menu, positionStrategy) {
|
|
935
|
-
let [originX, originFallbackX] = menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'];
|
|
936
|
-
let [overlayY, overlayFallbackY] = menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'];
|
|
937
|
-
let [originY, originFallbackY] = [overlayY, overlayFallbackY];
|
|
938
|
-
let [overlayX, overlayFallbackX] = [originX, originFallbackX];
|
|
939
|
-
let offsetY = 0;
|
|
940
|
-
if (this._triggersSubmenu()) {
|
|
941
|
-
// When the menu is a sub-menu, it should always align itself
|
|
942
|
-
// to the edges of the trigger, instead of overlapping it.
|
|
943
|
-
overlayFallbackX = originX = menu.xPosition === 'before' ? 'start' : 'end';
|
|
944
|
-
originFallbackX = overlayX = originX === 'end' ? 'start' : 'end';
|
|
945
|
-
if (this._parentMaterialMenu) {
|
|
946
|
-
if (this._parentInnerPadding == null) {
|
|
947
|
-
const firstItem = this._parentMaterialMenu.items.first;
|
|
948
|
-
this._parentInnerPadding = firstItem ? firstItem._getHostElement().offsetTop : 0;
|
|
949
|
-
}
|
|
950
|
-
offsetY = overlayY === 'bottom' ? this._parentInnerPadding : -this._parentInnerPadding;
|
|
951
|
-
}
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
_setPosition(menu, positionStrategy) {
|
|
890
|
+
let [originX, originFallbackX] = menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'];
|
|
891
|
+
let [overlayY, overlayFallbackY] = menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'];
|
|
892
|
+
let [originY, originFallbackY] = [overlayY, overlayFallbackY];
|
|
893
|
+
let [overlayX, overlayFallbackX] = [originX, originFallbackX];
|
|
894
|
+
let offsetY = 0;
|
|
895
|
+
if (this._triggersSubmenu()) {
|
|
896
|
+
overlayFallbackX = originX = menu.xPosition === 'before' ? 'start' : 'end';
|
|
897
|
+
originFallbackX = overlayX = originX === 'end' ? 'start' : 'end';
|
|
898
|
+
if (this._parentMaterialMenu) {
|
|
899
|
+
if (this._parentInnerPadding == null) {
|
|
900
|
+
const firstItem = this._parentMaterialMenu.items.first;
|
|
901
|
+
this._parentInnerPadding = firstItem ? firstItem._getHostElement().offsetTop : 0;
|
|
952
902
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
903
|
+
offsetY = overlayY === 'bottom' ? this._parentInnerPadding : -this._parentInnerPadding;
|
|
904
|
+
}
|
|
905
|
+
} else if (!menu.overlapTrigger) {
|
|
906
|
+
originY = overlayY === 'top' ? 'bottom' : 'top';
|
|
907
|
+
originFallbackY = overlayFallbackY === 'top' ? 'bottom' : 'top';
|
|
908
|
+
}
|
|
909
|
+
positionStrategy.withPositions([{
|
|
910
|
+
originX,
|
|
911
|
+
originY,
|
|
912
|
+
overlayX,
|
|
913
|
+
overlayY,
|
|
914
|
+
offsetY
|
|
915
|
+
}, {
|
|
916
|
+
originX: originFallbackX,
|
|
917
|
+
originY,
|
|
918
|
+
overlayX: overlayFallbackX,
|
|
919
|
+
overlayY,
|
|
920
|
+
offsetY
|
|
921
|
+
}, {
|
|
922
|
+
originX,
|
|
923
|
+
originY: originFallbackY,
|
|
924
|
+
overlayX,
|
|
925
|
+
overlayY: overlayFallbackY,
|
|
926
|
+
offsetY: -offsetY
|
|
927
|
+
}, {
|
|
928
|
+
originX: originFallbackX,
|
|
929
|
+
originY: originFallbackY,
|
|
930
|
+
overlayX: overlayFallbackX,
|
|
931
|
+
overlayY: overlayFallbackY,
|
|
932
|
+
offsetY: -offsetY
|
|
933
|
+
}]);
|
|
934
|
+
}
|
|
935
|
+
_menuClosingActions() {
|
|
936
|
+
const outsideClicks = this._getOutsideClickStream(this._overlayRef);
|
|
937
|
+
const detachments = this._overlayRef.detachments();
|
|
938
|
+
const parentClose = this._parentMaterialMenu ? this._parentMaterialMenu.closed : of();
|
|
939
|
+
const hover = this._parentMaterialMenu ? this._parentMaterialMenu._hovered().pipe(filter(active => this._menuOpen && active !== this._menuItemInstance)) : of();
|
|
940
|
+
return merge(outsideClicks, parentClose, hover, detachments);
|
|
941
|
+
}
|
|
942
|
+
_getPortal(menu) {
|
|
943
|
+
if (!this._portal || this._portal.templateRef !== menu.templateRef) {
|
|
944
|
+
this._portal = new TemplatePortal(menu.templateRef, this._viewContainerRef);
|
|
945
|
+
}
|
|
946
|
+
return this._portal;
|
|
947
|
+
}
|
|
948
|
+
_ownsMenu(menu) {
|
|
949
|
+
return PANELS_TO_TRIGGERS.get(menu) === this;
|
|
950
|
+
}
|
|
951
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
952
|
+
minVersion: "12.0.0",
|
|
953
|
+
version: "20.2.0-next.2",
|
|
954
|
+
ngImport: i0,
|
|
955
|
+
type: MatMenuTriggerBase,
|
|
956
|
+
deps: "invalid",
|
|
957
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
958
|
+
});
|
|
959
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
960
|
+
minVersion: "14.0.0",
|
|
961
|
+
version: "20.2.0-next.2",
|
|
962
|
+
type: MatMenuTriggerBase,
|
|
963
|
+
isStandalone: true,
|
|
964
|
+
ngImport: i0
|
|
965
|
+
});
|
|
1008
966
|
}
|
|
1009
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1010
|
-
|
|
1011
|
-
|
|
967
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
968
|
+
minVersion: "12.0.0",
|
|
969
|
+
version: "20.2.0-next.2",
|
|
970
|
+
ngImport: i0,
|
|
971
|
+
type: MatMenuTriggerBase,
|
|
972
|
+
decorators: [{
|
|
973
|
+
type: Directive
|
|
974
|
+
}],
|
|
975
|
+
ctorParameters: () => [{
|
|
976
|
+
type: undefined
|
|
977
|
+
}]
|
|
978
|
+
});
|
|
1012
979
|
|
|
1013
|
-
/** Directive applied to an element that should trigger a `mat-menu`. */
|
|
1014
980
|
class MatMenuTrigger extends MatMenuTriggerBase {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
if (!isFakeMousedownFromScreenReader(event)) {
|
|
1108
|
-
// Since right or middle button clicks won't trigger the `click` event,
|
|
1109
|
-
// we shouldn't consider the menu as opened by mouse in those cases.
|
|
1110
|
-
this._openedBy = event.button === 0 ? 'mouse' : undefined;
|
|
1111
|
-
// Since clicking on the trigger won't close the menu if it opens a sub-menu,
|
|
1112
|
-
// we should prevent focus from moving onto it via click to avoid the
|
|
1113
|
-
// highlight from lingering on the menu item.
|
|
1114
|
-
if (this.triggersSubmenu()) {
|
|
1115
|
-
event.preventDefault();
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
/** Handles key presses on the trigger. */
|
|
1120
|
-
_handleKeydown(event) {
|
|
1121
|
-
const keyCode = event.keyCode;
|
|
1122
|
-
// Pressing enter on the trigger will trigger the click handler later.
|
|
1123
|
-
if (keyCode === ENTER || keyCode === SPACE) {
|
|
1124
|
-
this._openedBy = 'keyboard';
|
|
1125
|
-
}
|
|
1126
|
-
if (this.triggersSubmenu() &&
|
|
1127
|
-
((keyCode === RIGHT_ARROW && this.dir === 'ltr') ||
|
|
1128
|
-
(keyCode === LEFT_ARROW && this.dir === 'rtl'))) {
|
|
1129
|
-
this._openedBy = 'keyboard';
|
|
1130
|
-
this.openMenu();
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
/** Handles click events on the trigger. */
|
|
1134
|
-
_handleClick(event) {
|
|
1135
|
-
if (this.triggersSubmenu()) {
|
|
1136
|
-
// Stop event propagation to avoid closing the parent menu.
|
|
1137
|
-
event.stopPropagation();
|
|
1138
|
-
this.openMenu();
|
|
1139
|
-
}
|
|
1140
|
-
else {
|
|
1141
|
-
this.toggleMenu();
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
/** Handles the cases where the user hovers over the trigger. */
|
|
1145
|
-
_handleHover() {
|
|
1146
|
-
// Subscribe to changes in the hovered item in order to toggle the panel.
|
|
1147
|
-
if (this.triggersSubmenu() && this._parentMaterialMenu) {
|
|
1148
|
-
this._hoverSubscription = this._parentMaterialMenu._hovered().subscribe(active => {
|
|
1149
|
-
if (active === this._menuItemInstance &&
|
|
1150
|
-
!active.disabled &&
|
|
1151
|
-
// Ignore hover events if the parent menu is in the process of being closed (see #31956).
|
|
1152
|
-
this._parentMaterialMenu?._panelAnimationState !== 'void') {
|
|
1153
|
-
this._openedBy = 'mouse';
|
|
1154
|
-
// Open the menu, but do NOT auto-focus on first item when just hovering.
|
|
1155
|
-
// When VoiceOver is enabled, this is particularly confusing as the focus will
|
|
1156
|
-
// cause another hover event, and continue opening sub-menus without interaction.
|
|
1157
|
-
this._openMenu(false);
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
981
|
+
_cleanupTouchstart;
|
|
982
|
+
_hoverSubscription = Subscription.EMPTY;
|
|
983
|
+
get _deprecatedMatMenuTriggerFor() {
|
|
984
|
+
return this.menu;
|
|
985
|
+
}
|
|
986
|
+
set _deprecatedMatMenuTriggerFor(v) {
|
|
987
|
+
this.menu = v;
|
|
988
|
+
}
|
|
989
|
+
get menu() {
|
|
990
|
+
return this._menu;
|
|
991
|
+
}
|
|
992
|
+
set menu(menu) {
|
|
993
|
+
this._menu = menu;
|
|
994
|
+
}
|
|
995
|
+
menuData;
|
|
996
|
+
restoreFocus = true;
|
|
997
|
+
menuOpened = new EventEmitter();
|
|
998
|
+
onMenuOpen = this.menuOpened;
|
|
999
|
+
menuClosed = new EventEmitter();
|
|
1000
|
+
onMenuClose = this.menuClosed;
|
|
1001
|
+
constructor() {
|
|
1002
|
+
super(true);
|
|
1003
|
+
const renderer = inject(Renderer2);
|
|
1004
|
+
this._cleanupTouchstart = renderer.listen(this._element.nativeElement, 'touchstart', event => {
|
|
1005
|
+
if (!isFakeTouchstartFromScreenReader(event)) {
|
|
1006
|
+
this._openedBy = 'touch';
|
|
1007
|
+
}
|
|
1008
|
+
}, {
|
|
1009
|
+
passive: true
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
triggersSubmenu() {
|
|
1013
|
+
return super._triggersSubmenu();
|
|
1014
|
+
}
|
|
1015
|
+
toggleMenu() {
|
|
1016
|
+
return this.menuOpen ? this.closeMenu() : this.openMenu();
|
|
1017
|
+
}
|
|
1018
|
+
openMenu() {
|
|
1019
|
+
this._openMenu(true);
|
|
1020
|
+
}
|
|
1021
|
+
closeMenu() {
|
|
1022
|
+
this._closeMenu();
|
|
1023
|
+
}
|
|
1024
|
+
updatePosition() {
|
|
1025
|
+
this._overlayRef?.updatePosition();
|
|
1026
|
+
}
|
|
1027
|
+
ngAfterContentInit() {
|
|
1028
|
+
this._handleHover();
|
|
1029
|
+
}
|
|
1030
|
+
ngOnDestroy() {
|
|
1031
|
+
super.ngOnDestroy();
|
|
1032
|
+
this._cleanupTouchstart();
|
|
1033
|
+
this._hoverSubscription.unsubscribe();
|
|
1034
|
+
}
|
|
1035
|
+
_getOverlayOrigin() {
|
|
1036
|
+
return this._element;
|
|
1037
|
+
}
|
|
1038
|
+
_getOutsideClickStream(overlayRef) {
|
|
1039
|
+
return overlayRef.backdropClick();
|
|
1040
|
+
}
|
|
1041
|
+
_handleMousedown(event) {
|
|
1042
|
+
if (!isFakeMousedownFromScreenReader(event)) {
|
|
1043
|
+
this._openedBy = event.button === 0 ? 'mouse' : undefined;
|
|
1044
|
+
if (this.triggersSubmenu()) {
|
|
1045
|
+
event.preventDefault();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
_handleKeydown(event) {
|
|
1050
|
+
const keyCode = event.keyCode;
|
|
1051
|
+
if (keyCode === ENTER || keyCode === SPACE) {
|
|
1052
|
+
this._openedBy = 'keyboard';
|
|
1053
|
+
}
|
|
1054
|
+
if (this.triggersSubmenu() && (keyCode === RIGHT_ARROW && this.dir === 'ltr' || keyCode === LEFT_ARROW && this.dir === 'rtl')) {
|
|
1055
|
+
this._openedBy = 'keyboard';
|
|
1056
|
+
this.openMenu();
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
_handleClick(event) {
|
|
1060
|
+
if (this.triggersSubmenu()) {
|
|
1061
|
+
event.stopPropagation();
|
|
1062
|
+
this.openMenu();
|
|
1063
|
+
} else {
|
|
1064
|
+
this.toggleMenu();
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
_handleHover() {
|
|
1068
|
+
if (this.triggersSubmenu() && this._parentMaterialMenu) {
|
|
1069
|
+
this._hoverSubscription = this._parentMaterialMenu._hovered().subscribe(active => {
|
|
1070
|
+
if (active === this._menuItemInstance && !active.disabled && this._parentMaterialMenu?._panelAnimationState !== 'void') {
|
|
1071
|
+
this._openedBy = 'mouse';
|
|
1072
|
+
this._openMenu(false);
|
|
1160
1073
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1078
|
+
minVersion: "12.0.0",
|
|
1079
|
+
version: "20.2.0-next.2",
|
|
1080
|
+
ngImport: i0,
|
|
1081
|
+
type: MatMenuTrigger,
|
|
1082
|
+
deps: [],
|
|
1083
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1084
|
+
});
|
|
1085
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1086
|
+
minVersion: "14.0.0",
|
|
1087
|
+
version: "20.2.0-next.2",
|
|
1088
|
+
type: MatMenuTrigger,
|
|
1089
|
+
isStandalone: true,
|
|
1090
|
+
selector: "[mat-menu-trigger-for], [matMenuTriggerFor]",
|
|
1091
|
+
inputs: {
|
|
1092
|
+
_deprecatedMatMenuTriggerFor: ["mat-menu-trigger-for", "_deprecatedMatMenuTriggerFor"],
|
|
1093
|
+
menu: ["matMenuTriggerFor", "menu"],
|
|
1094
|
+
menuData: ["matMenuTriggerData", "menuData"],
|
|
1095
|
+
restoreFocus: ["matMenuTriggerRestoreFocus", "restoreFocus"]
|
|
1096
|
+
},
|
|
1097
|
+
outputs: {
|
|
1098
|
+
menuOpened: "menuOpened",
|
|
1099
|
+
onMenuOpen: "onMenuOpen",
|
|
1100
|
+
menuClosed: "menuClosed",
|
|
1101
|
+
onMenuClose: "onMenuClose"
|
|
1102
|
+
},
|
|
1103
|
+
host: {
|
|
1104
|
+
listeners: {
|
|
1105
|
+
"click": "_handleClick($event)",
|
|
1106
|
+
"mousedown": "_handleMousedown($event)",
|
|
1107
|
+
"keydown": "_handleKeydown($event)"
|
|
1108
|
+
},
|
|
1109
|
+
properties: {
|
|
1110
|
+
"attr.aria-haspopup": "menu ? \"menu\" : null",
|
|
1111
|
+
"attr.aria-expanded": "menuOpen",
|
|
1112
|
+
"attr.aria-controls": "menuOpen ? menu?.panelId : null"
|
|
1113
|
+
},
|
|
1114
|
+
classAttribute: "mat-mdc-menu-trigger"
|
|
1115
|
+
},
|
|
1116
|
+
exportAs: ["matMenuTrigger"],
|
|
1117
|
+
usesInheritance: true,
|
|
1118
|
+
ngImport: i0
|
|
1119
|
+
});
|
|
1164
1120
|
}
|
|
1165
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1121
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1122
|
+
minVersion: "12.0.0",
|
|
1123
|
+
version: "20.2.0-next.2",
|
|
1124
|
+
ngImport: i0,
|
|
1125
|
+
type: MatMenuTrigger,
|
|
1126
|
+
decorators: [{
|
|
1127
|
+
type: Directive,
|
|
1128
|
+
args: [{
|
|
1129
|
+
selector: '[mat-menu-trigger-for], [matMenuTriggerFor]',
|
|
1130
|
+
host: {
|
|
1131
|
+
'class': 'mat-mdc-menu-trigger',
|
|
1132
|
+
'[attr.aria-haspopup]': 'menu ? "menu" : null',
|
|
1133
|
+
'[attr.aria-expanded]': 'menuOpen',
|
|
1134
|
+
'[attr.aria-controls]': 'menuOpen ? menu?.panelId : null',
|
|
1135
|
+
'(click)': '_handleClick($event)',
|
|
1136
|
+
'(mousedown)': '_handleMousedown($event)',
|
|
1137
|
+
'(keydown)': '_handleKeydown($event)'
|
|
1138
|
+
},
|
|
1139
|
+
exportAs: 'matMenuTrigger'
|
|
1140
|
+
}]
|
|
1141
|
+
}],
|
|
1142
|
+
ctorParameters: () => [],
|
|
1143
|
+
propDecorators: {
|
|
1144
|
+
_deprecatedMatMenuTriggerFor: [{
|
|
1145
|
+
type: Input,
|
|
1146
|
+
args: ['mat-menu-trigger-for']
|
|
1147
|
+
}],
|
|
1148
|
+
menu: [{
|
|
1149
|
+
type: Input,
|
|
1150
|
+
args: ['matMenuTriggerFor']
|
|
1151
|
+
}],
|
|
1152
|
+
menuData: [{
|
|
1153
|
+
type: Input,
|
|
1154
|
+
args: ['matMenuTriggerData']
|
|
1155
|
+
}],
|
|
1156
|
+
restoreFocus: [{
|
|
1157
|
+
type: Input,
|
|
1158
|
+
args: ['matMenuTriggerRestoreFocus']
|
|
1159
|
+
}],
|
|
1160
|
+
menuOpened: [{
|
|
1161
|
+
type: Output
|
|
1162
|
+
}],
|
|
1163
|
+
onMenuOpen: [{
|
|
1164
|
+
type: Output
|
|
1165
|
+
}],
|
|
1166
|
+
menuClosed: [{
|
|
1167
|
+
type: Output
|
|
1168
|
+
}],
|
|
1169
|
+
onMenuClose: [{
|
|
1170
|
+
type: Output
|
|
1171
|
+
}]
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1201
1174
|
|
|
1202
|
-
/**
|
|
1203
|
-
* Trigger that opens a menu whenever the user right-clicks within its host element.
|
|
1204
|
-
*/
|
|
1205
1175
|
class MatContextMenuTrigger extends MatMenuTriggerBase {
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
_handleContextMenuEvent(event) {
|
|
1243
|
-
if (!this.disabled) {
|
|
1244
|
-
event.preventDefault();
|
|
1245
|
-
// If the menu is already open, only update its position.
|
|
1246
|
-
if (this.menuOpen) {
|
|
1247
|
-
this._initializePoint(event.clientX, event.clientY);
|
|
1248
|
-
this._updatePosition();
|
|
1249
|
-
}
|
|
1250
|
-
else {
|
|
1251
|
-
this._openContextMenu(event);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
_destroyMenu(reason) {
|
|
1256
|
-
super._destroyMenu(reason);
|
|
1257
|
-
this._scrollSubscription?.unsubscribe();
|
|
1258
|
-
}
|
|
1259
|
-
_getOverlayOrigin() {
|
|
1260
|
-
return this._point;
|
|
1261
|
-
}
|
|
1262
|
-
_getOutsideClickStream(overlayRef) {
|
|
1263
|
-
return overlayRef.outsidePointerEvents().pipe(skipWhile((event, index) => {
|
|
1264
|
-
if (event.type === 'contextmenu') {
|
|
1265
|
-
// Do not close when attempting to open a context menu within the trigger.
|
|
1266
|
-
return this._isWithinMenuOrTrigger(_getEventTarget(event));
|
|
1267
|
-
}
|
|
1268
|
-
else if (event.type === 'auxclick') {
|
|
1269
|
-
// Skip the first `auxclick` since it happens at
|
|
1270
|
-
// the same time as the event that opens the menu.
|
|
1271
|
-
if (index === 0) {
|
|
1272
|
-
return true;
|
|
1273
|
-
}
|
|
1274
|
-
// Do not close on `auxclick` within the menu since we want to reposition the menu
|
|
1275
|
-
// instead. Note that we have to resolve the clicked element using its position,
|
|
1276
|
-
// rather than `event.target`, because the `target` is set to the `body`.
|
|
1277
|
-
this._rootNode ??= _getShadowRoot(this._element.nativeElement) || this._document;
|
|
1278
|
-
return this._isWithinMenuOrTrigger(this._rootNode.elementFromPoint(event.clientX, event.clientY));
|
|
1279
|
-
}
|
|
1280
|
-
// Using a mouse, the `contextmenu` event can fire either when pressing the right button
|
|
1281
|
-
// or left button + control. Most browsers won't dispatch a `click` event right after
|
|
1282
|
-
// a `contextmenu` event triggered by left button + control, but Safari will (see #27832).
|
|
1283
|
-
// This closes the menu immediately. To work around it, we check that both the triggering
|
|
1284
|
-
// event and the current outside click event both had the control key pressed, and that
|
|
1285
|
-
// that this is the first outside click event.
|
|
1286
|
-
return this._triggerPressedControl && index === 0 && event.ctrlKey;
|
|
1287
|
-
}));
|
|
1288
|
-
}
|
|
1289
|
-
/** Checks whether an element is within the trigger or the opened overlay. */
|
|
1290
|
-
_isWithinMenuOrTrigger(target) {
|
|
1291
|
-
if (!target) {
|
|
1292
|
-
return false;
|
|
1293
|
-
}
|
|
1294
|
-
const element = this._element.nativeElement;
|
|
1295
|
-
if (target === element || element.contains(target)) {
|
|
1296
|
-
return true;
|
|
1297
|
-
}
|
|
1298
|
-
const overlay = this._overlayRef?.hostElement;
|
|
1299
|
-
return overlay === target || !!overlay?.contains(target);
|
|
1300
|
-
}
|
|
1301
|
-
/** Opens the context menu. */
|
|
1302
|
-
_openContextMenu(event) {
|
|
1303
|
-
// A context menu can be triggered via a mouse right click or a keyboard shortcut.
|
|
1304
|
-
if (event.button === 2) {
|
|
1305
|
-
this._openedBy = 'mouse';
|
|
1306
|
-
}
|
|
1307
|
-
else {
|
|
1308
|
-
this._openedBy = event.button === 0 ? 'keyboard' : undefined;
|
|
1309
|
-
}
|
|
1176
|
+
_point = {
|
|
1177
|
+
x: 0,
|
|
1178
|
+
y: 0,
|
|
1179
|
+
initialX: 0,
|
|
1180
|
+
initialY: 0,
|
|
1181
|
+
initialScrollX: 0,
|
|
1182
|
+
initialScrollY: 0
|
|
1183
|
+
};
|
|
1184
|
+
_triggerPressedControl = false;
|
|
1185
|
+
_rootNode;
|
|
1186
|
+
_document = inject(DOCUMENT);
|
|
1187
|
+
_viewportRuler = inject(ViewportRuler);
|
|
1188
|
+
_scrollDispatcher = inject(ScrollDispatcher);
|
|
1189
|
+
_scrollSubscription;
|
|
1190
|
+
get menu() {
|
|
1191
|
+
return this._menu;
|
|
1192
|
+
}
|
|
1193
|
+
set menu(menu) {
|
|
1194
|
+
this._menu = menu;
|
|
1195
|
+
}
|
|
1196
|
+
menuData;
|
|
1197
|
+
restoreFocus = true;
|
|
1198
|
+
disabled = false;
|
|
1199
|
+
menuOpened = new EventEmitter();
|
|
1200
|
+
menuClosed = new EventEmitter();
|
|
1201
|
+
constructor() {
|
|
1202
|
+
super(false);
|
|
1203
|
+
}
|
|
1204
|
+
ngOnDestroy() {
|
|
1205
|
+
super.ngOnDestroy();
|
|
1206
|
+
this._scrollSubscription?.unsubscribe();
|
|
1207
|
+
}
|
|
1208
|
+
_handleContextMenuEvent(event) {
|
|
1209
|
+
if (!this.disabled) {
|
|
1210
|
+
event.preventDefault();
|
|
1211
|
+
if (this.menuOpen) {
|
|
1310
1212
|
this._initializePoint(event.clientX, event.clientY);
|
|
1311
|
-
this.
|
|
1312
|
-
|
|
1313
|
-
this.
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
point.initialScrollY = scrollPosition.top;
|
|
1332
|
-
}
|
|
1333
|
-
/** Refreshes the position of the overlay. */
|
|
1334
|
-
_updatePosition() {
|
|
1335
|
-
const overlayRef = this._overlayRef;
|
|
1336
|
-
if (overlayRef) {
|
|
1337
|
-
const positionStrategy = overlayRef.getConfig()
|
|
1338
|
-
.positionStrategy;
|
|
1339
|
-
positionStrategy.setOrigin(this._point);
|
|
1340
|
-
overlayRef.updatePosition();
|
|
1213
|
+
this._updatePosition();
|
|
1214
|
+
} else {
|
|
1215
|
+
this._openContextMenu(event);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
_destroyMenu(reason) {
|
|
1220
|
+
super._destroyMenu(reason);
|
|
1221
|
+
this._scrollSubscription?.unsubscribe();
|
|
1222
|
+
}
|
|
1223
|
+
_getOverlayOrigin() {
|
|
1224
|
+
return this._point;
|
|
1225
|
+
}
|
|
1226
|
+
_getOutsideClickStream(overlayRef) {
|
|
1227
|
+
return overlayRef.outsidePointerEvents().pipe(skipWhile((event, index) => {
|
|
1228
|
+
if (event.type === 'contextmenu') {
|
|
1229
|
+
return this._isWithinMenuOrTrigger(_getEventTarget(event));
|
|
1230
|
+
} else if (event.type === 'auxclick') {
|
|
1231
|
+
if (index === 0) {
|
|
1232
|
+
return true;
|
|
1341
1233
|
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1234
|
+
this._rootNode ??= _getShadowRoot(this._element.nativeElement) || this._document;
|
|
1235
|
+
return this._isWithinMenuOrTrigger(this._rootNode.elementFromPoint(event.clientX, event.clientY));
|
|
1236
|
+
}
|
|
1237
|
+
return this._triggerPressedControl && index === 0 && event.ctrlKey;
|
|
1238
|
+
}));
|
|
1239
|
+
}
|
|
1240
|
+
_isWithinMenuOrTrigger(target) {
|
|
1241
|
+
if (!target) {
|
|
1242
|
+
return false;
|
|
1243
|
+
}
|
|
1244
|
+
const element = this._element.nativeElement;
|
|
1245
|
+
if (target === element || element.contains(target)) {
|
|
1246
|
+
return true;
|
|
1247
|
+
}
|
|
1248
|
+
const overlay = this._overlayRef?.hostElement;
|
|
1249
|
+
return overlay === target || !!overlay?.contains(target);
|
|
1250
|
+
}
|
|
1251
|
+
_openContextMenu(event) {
|
|
1252
|
+
if (event.button === 2) {
|
|
1253
|
+
this._openedBy = 'mouse';
|
|
1254
|
+
} else {
|
|
1255
|
+
this._openedBy = event.button === 0 ? 'keyboard' : undefined;
|
|
1256
|
+
}
|
|
1257
|
+
this._initializePoint(event.clientX, event.clientY);
|
|
1258
|
+
this._triggerPressedControl = event.ctrlKey;
|
|
1259
|
+
super._openMenu(true);
|
|
1260
|
+
this._scrollSubscription?.unsubscribe();
|
|
1261
|
+
this._scrollSubscription = this._scrollDispatcher.scrolled(0).subscribe(() => {
|
|
1262
|
+
const position = this._viewportRuler.getViewportScrollPosition();
|
|
1263
|
+
const point = this._point;
|
|
1264
|
+
point.y = point.initialY + (point.initialScrollY - position.top);
|
|
1265
|
+
point.x = point.initialX + (point.initialScrollX - position.left);
|
|
1266
|
+
this._updatePosition();
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
_initializePoint(x, y) {
|
|
1270
|
+
const scrollPosition = this._viewportRuler.getViewportScrollPosition();
|
|
1271
|
+
const point = this._point;
|
|
1272
|
+
point.x = point.initialX = x;
|
|
1273
|
+
point.y = point.initialY = y;
|
|
1274
|
+
point.initialScrollX = scrollPosition.left;
|
|
1275
|
+
point.initialScrollY = scrollPosition.top;
|
|
1276
|
+
}
|
|
1277
|
+
_updatePosition() {
|
|
1278
|
+
const overlayRef = this._overlayRef;
|
|
1279
|
+
if (overlayRef) {
|
|
1280
|
+
const positionStrategy = overlayRef.getConfig().positionStrategy;
|
|
1281
|
+
positionStrategy.setOrigin(this._point);
|
|
1282
|
+
overlayRef.updatePosition();
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1286
|
+
minVersion: "12.0.0",
|
|
1287
|
+
version: "20.2.0-next.2",
|
|
1288
|
+
ngImport: i0,
|
|
1289
|
+
type: MatContextMenuTrigger,
|
|
1290
|
+
deps: [],
|
|
1291
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
1292
|
+
});
|
|
1293
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
1294
|
+
minVersion: "16.1.0",
|
|
1295
|
+
version: "20.2.0-next.2",
|
|
1296
|
+
type: MatContextMenuTrigger,
|
|
1297
|
+
isStandalone: true,
|
|
1298
|
+
selector: "[matContextMenuTriggerFor]",
|
|
1299
|
+
inputs: {
|
|
1300
|
+
menu: ["matContextMenuTriggerFor", "menu"],
|
|
1301
|
+
menuData: ["matContextMenuTriggerData", "menuData"],
|
|
1302
|
+
restoreFocus: ["matContextMenuTriggerRestoreFocus", "restoreFocus"],
|
|
1303
|
+
disabled: ["matContextMenuTriggerDisabled", "disabled", booleanAttribute]
|
|
1304
|
+
},
|
|
1305
|
+
outputs: {
|
|
1306
|
+
menuOpened: "menuOpened",
|
|
1307
|
+
menuClosed: "menuClosed"
|
|
1308
|
+
},
|
|
1309
|
+
host: {
|
|
1310
|
+
listeners: {
|
|
1311
|
+
"contextmenu": "_handleContextMenuEvent($event)"
|
|
1312
|
+
},
|
|
1313
|
+
properties: {
|
|
1314
|
+
"class.mat-context-menu-trigger-disabled": "disabled",
|
|
1315
|
+
"attr.aria-controls": "menuOpen ? menu?.panelId : null"
|
|
1316
|
+
},
|
|
1317
|
+
classAttribute: "mat-context-menu-trigger"
|
|
1318
|
+
},
|
|
1319
|
+
exportAs: ["matContextMenuTrigger"],
|
|
1320
|
+
usesInheritance: true,
|
|
1321
|
+
ngImport: i0
|
|
1322
|
+
});
|
|
1345
1323
|
}
|
|
1346
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1324
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1325
|
+
minVersion: "12.0.0",
|
|
1326
|
+
version: "20.2.0-next.2",
|
|
1327
|
+
ngImport: i0,
|
|
1328
|
+
type: MatContextMenuTrigger,
|
|
1329
|
+
decorators: [{
|
|
1330
|
+
type: Directive,
|
|
1331
|
+
args: [{
|
|
1332
|
+
selector: '[matContextMenuTriggerFor]',
|
|
1333
|
+
host: {
|
|
1334
|
+
'class': 'mat-context-menu-trigger',
|
|
1335
|
+
'[class.mat-context-menu-trigger-disabled]': 'disabled',
|
|
1336
|
+
'[attr.aria-controls]': 'menuOpen ? menu?.panelId : null',
|
|
1337
|
+
'(contextmenu)': '_handleContextMenuEvent($event)'
|
|
1338
|
+
},
|
|
1339
|
+
exportAs: 'matContextMenuTrigger'
|
|
1340
|
+
}]
|
|
1341
|
+
}],
|
|
1342
|
+
ctorParameters: () => [],
|
|
1343
|
+
propDecorators: {
|
|
1344
|
+
menu: [{
|
|
1345
|
+
type: Input,
|
|
1346
|
+
args: [{
|
|
1347
|
+
alias: 'matContextMenuTriggerFor',
|
|
1348
|
+
required: true
|
|
1349
|
+
}]
|
|
1350
|
+
}],
|
|
1351
|
+
menuData: [{
|
|
1352
|
+
type: Input,
|
|
1353
|
+
args: ['matContextMenuTriggerData']
|
|
1354
|
+
}],
|
|
1355
|
+
restoreFocus: [{
|
|
1356
|
+
type: Input,
|
|
1357
|
+
args: ['matContextMenuTriggerRestoreFocus']
|
|
1358
|
+
}],
|
|
1359
|
+
disabled: [{
|
|
1360
|
+
type: Input,
|
|
1361
|
+
args: [{
|
|
1362
|
+
alias: 'matContextMenuTriggerDisabled',
|
|
1363
|
+
transform: booleanAttribute
|
|
1364
|
+
}]
|
|
1365
|
+
}],
|
|
1366
|
+
menuOpened: [{
|
|
1367
|
+
type: Output
|
|
1368
|
+
}],
|
|
1369
|
+
menuClosed: [{
|
|
1370
|
+
type: Output
|
|
1371
|
+
}]
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1375
1374
|
|
|
1376
1375
|
class MatMenuModule {
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1376
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1377
|
+
minVersion: "12.0.0",
|
|
1378
|
+
version: "20.2.0-next.2",
|
|
1379
|
+
ngImport: i0,
|
|
1380
|
+
type: MatMenuModule,
|
|
1381
|
+
deps: [],
|
|
1382
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
1383
|
+
});
|
|
1384
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
1385
|
+
minVersion: "14.0.0",
|
|
1386
|
+
version: "20.2.0-next.2",
|
|
1387
|
+
ngImport: i0,
|
|
1388
|
+
type: MatMenuModule,
|
|
1389
|
+
imports: [MatRippleModule, OverlayModule, MatMenu, MatMenuItem, MatMenuContent, MatMenuTrigger, MatContextMenuTrigger],
|
|
1390
|
+
exports: [BidiModule, CdkScrollableModule, MatMenu, MatMenuItem, MatMenuContent, MatMenuTrigger, MatContextMenuTrigger]
|
|
1391
|
+
});
|
|
1392
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
1393
|
+
minVersion: "12.0.0",
|
|
1394
|
+
version: "20.2.0-next.2",
|
|
1395
|
+
ngImport: i0,
|
|
1396
|
+
type: MatMenuModule,
|
|
1397
|
+
imports: [MatRippleModule, OverlayModule, BidiModule, CdkScrollableModule]
|
|
1398
|
+
});
|
|
1394
1399
|
}
|
|
1395
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
BidiModule,
|
|
1409
|
-
CdkScrollableModule,
|
|
1410
|
-
MatMenu,
|
|
1411
|
-
MatMenuItem,
|
|
1412
|
-
MatMenuContent,
|
|
1413
|
-
MatMenuTrigger,
|
|
1414
|
-
MatContextMenuTrigger,
|
|
1415
|
-
],
|
|
1416
|
-
}]
|
|
1417
|
-
}] });
|
|
1400
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1401
|
+
minVersion: "12.0.0",
|
|
1402
|
+
version: "20.2.0-next.2",
|
|
1403
|
+
ngImport: i0,
|
|
1404
|
+
type: MatMenuModule,
|
|
1405
|
+
decorators: [{
|
|
1406
|
+
type: NgModule,
|
|
1407
|
+
args: [{
|
|
1408
|
+
imports: [MatRippleModule, OverlayModule, MatMenu, MatMenuItem, MatMenuContent, MatMenuTrigger, MatContextMenuTrigger],
|
|
1409
|
+
exports: [BidiModule, CdkScrollableModule, MatMenu, MatMenuItem, MatMenuContent, MatMenuTrigger, MatContextMenuTrigger]
|
|
1410
|
+
}]
|
|
1411
|
+
}]
|
|
1412
|
+
});
|
|
1418
1413
|
|
|
1419
1414
|
export { MAT_MENU_CONTENT, MAT_MENU_DEFAULT_OPTIONS, MAT_MENU_PANEL, MAT_MENU_SCROLL_STRATEGY, MENU_PANEL_TOP_PADDING, MatContextMenuTrigger, MatMenu, MatMenuContent, MatMenuItem, MatMenuModule, MatMenuTrigger };
|
|
1420
1415
|
//# sourceMappingURL=menu.mjs.map
|