@angular/cdk-experimental 14.0.0-next.1 → 14.0.0-next.12
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/column-resize/column-resize-directives/column-resize-flex.d.ts +1 -1
- package/column-resize/column-resize-directives/column-resize.d.ts +1 -1
- package/column-resize/column-resize-directives/default-enabled-column-resize-flex.d.ts +1 -1
- package/column-resize/column-resize-directives/default-enabled-column-resize.d.ts +1 -1
- package/column-resize/column-resize.d.ts +1 -1
- package/column-resize/overlay-handle.d.ts +1 -1
- package/column-resize/resizable.d.ts +1 -1
- package/combobox/combobox-module.d.ts +3 -4
- package/combobox/combobox-popup.d.ts +6 -8
- package/combobox/combobox.d.ts +15 -18
- package/combobox/public-api.d.ts +0 -1
- package/esm2020/column-resize/column-resize-directives/column-resize-flex.mjs +4 -4
- package/esm2020/column-resize/column-resize-directives/column-resize.mjs +4 -4
- package/esm2020/column-resize/column-resize-directives/default-enabled-column-resize-flex.mjs +4 -4
- package/esm2020/column-resize/column-resize-directives/default-enabled-column-resize.mjs +4 -4
- package/esm2020/column-resize/column-resize-module.mjs +9 -9
- package/esm2020/column-resize/column-resize-notifier.mjs +7 -7
- package/esm2020/column-resize/column-resize.mjs +6 -5
- package/esm2020/column-resize/column-size-store.mjs +4 -4
- package/esm2020/column-resize/event-dispatcher.mjs +4 -4
- package/esm2020/column-resize/overlay-handle.mjs +4 -4
- package/esm2020/column-resize/resizable.mjs +4 -4
- package/esm2020/column-resize/resize-strategy.mjs +10 -10
- package/esm2020/combobox/combobox-module.mjs +6 -7
- package/esm2020/combobox/combobox-popup.mjs +12 -23
- package/esm2020/combobox/combobox.mjs +50 -34
- package/esm2020/combobox/public-api.mjs +1 -2
- package/esm2020/listbox/listbox-module.mjs +5 -5
- package/esm2020/listbox/listbox.mjs +26 -44
- package/esm2020/popover-edit/edit-event-dispatcher.mjs +4 -4
- package/esm2020/popover-edit/edit-ref.mjs +4 -4
- package/esm2020/popover-edit/edit-services.mjs +4 -4
- package/esm2020/popover-edit/focus-dispatcher.mjs +4 -4
- package/esm2020/popover-edit/focus-escape-notifier.mjs +4 -4
- package/esm2020/popover-edit/lens-directives.mjs +10 -10
- package/esm2020/popover-edit/popover-edit-module.mjs +5 -5
- package/esm2020/popover-edit/popover-edit-position-strategy-factory.mjs +7 -7
- package/esm2020/popover-edit/table-directives.mjs +16 -16
- package/esm2020/scrolling/auto-size-virtual-scroll.mjs +4 -4
- package/esm2020/scrolling/scrolling-module.mjs +5 -5
- package/esm2020/selection/row-selection.mjs +4 -4
- package/esm2020/selection/select-all.mjs +4 -4
- package/esm2020/selection/selection-column.mjs +10 -10
- package/esm2020/selection/selection-module.mjs +5 -5
- package/esm2020/selection/selection-toggle.mjs +4 -4
- package/esm2020/selection/selection.mjs +4 -4
- package/esm2020/table-scroll-container/table-scroll-container-module.mjs +5 -5
- package/esm2020/table-scroll-container/table-scroll-container.mjs +4 -4
- package/esm2020/version.mjs +1 -1
- package/fesm2015/cdk-experimental.mjs +1 -1
- package/fesm2015/cdk-experimental.mjs.map +1 -1
- package/fesm2015/column-resize.mjs +52 -51
- package/fesm2015/column-resize.mjs.map +1 -1
- package/fesm2015/combobox.mjs +63 -106
- package/fesm2015/combobox.mjs.map +1 -1
- package/fesm2015/listbox.mjs +31 -47
- package/fesm2015/listbox.mjs.map +1 -1
- package/fesm2015/popover-edit.mjs +49 -49
- package/fesm2015/popover-edit.mjs.map +1 -1
- package/fesm2015/scrolling.mjs +7 -7
- package/fesm2015/scrolling.mjs.map +1 -1
- package/fesm2015/selection.mjs +23 -23
- package/fesm2015/selection.mjs.map +1 -1
- package/fesm2015/table-scroll-container.mjs +7 -7
- package/fesm2015/table-scroll-container.mjs.map +1 -1
- package/fesm2020/cdk-experimental.mjs +1 -1
- package/fesm2020/cdk-experimental.mjs.map +1 -1
- package/fesm2020/column-resize.mjs +52 -51
- package/fesm2020/column-resize.mjs.map +1 -1
- package/fesm2020/combobox.mjs +62 -103
- package/fesm2020/combobox.mjs.map +1 -1
- package/fesm2020/listbox.mjs +29 -46
- package/fesm2020/listbox.mjs.map +1 -1
- package/fesm2020/popover-edit.mjs +49 -49
- package/fesm2020/popover-edit.mjs.map +1 -1
- package/fesm2020/scrolling.mjs +7 -7
- package/fesm2020/scrolling.mjs.map +1 -1
- package/fesm2020/selection.mjs +23 -23
- package/fesm2020/selection.mjs.map +1 -1
- package/fesm2020/table-scroll-container.mjs +7 -7
- package/fesm2020/table-scroll-container.mjs.map +1 -1
- package/listbox/listbox.d.ts +16 -13
- package/package.json +3 -19
- package/popover-edit/lens-directives.d.ts +3 -3
- package/popover-edit/table-directives.d.ts +5 -5
- package/scrolling/auto-size-virtual-scroll.d.ts +1 -1
- package/selection/row-selection.d.ts +1 -1
- package/selection/select-all.d.ts +1 -1
- package/selection/selection-column.d.ts +1 -1
- package/selection/selection-toggle.d.ts +1 -1
- package/selection/selection.d.ts +1 -1
- package/table-scroll-container/table-scroll-container.d.ts +1 -1
- package/combobox/combobox-panel.d.ts +0 -27
- package/dialog/dialog-config.d.ts +0 -77
- package/dialog/dialog-container.d.ts +0 -99
- package/dialog/dialog-injectors.d.ts +0 -30
- package/dialog/dialog-module.d.ts +0 -10
- package/dialog/dialog-ref.d.ts +0 -57
- package/dialog/dialog.d.ts +0 -100
- package/dialog/dialog_public_index.d.ts +0 -4
- package/dialog/index.d.ts +0 -8
- package/dialog/package.json +0 -9
- package/dialog/public-api.d.ts +0 -13
- package/esm2020/combobox/combobox-panel.mjs +0 -48
- package/esm2020/dialog/dialog-config.mjs +0 -43
- package/esm2020/dialog/dialog-container.mjs +0 -283
- package/esm2020/dialog/dialog-injectors.mjs +0 -30
- package/esm2020/dialog/dialog-module.mjs +0 -56
- package/esm2020/dialog/dialog-ref.mjs +0 -116
- package/esm2020/dialog/dialog.mjs +0 -252
- package/esm2020/dialog/dialog_public_index.mjs +0 -5
- package/esm2020/dialog/index.mjs +0 -9
- package/esm2020/dialog/public-api.mjs +0 -14
- package/esm2020/menu/context-menu.mjs +0 -294
- package/esm2020/menu/index.mjs +0 -9
- package/esm2020/menu/menu-aim.mjs +0 -199
- package/esm2020/menu/menu-bar.mjs +0 -252
- package/esm2020/menu/menu-errors.mjs +0 -30
- package/esm2020/menu/menu-group.mjs +0 -68
- package/esm2020/menu/menu-interface.mjs +0 -11
- package/esm2020/menu/menu-item-checkbox.mjs +0 -48
- package/esm2020/menu/menu-item-radio.mjs +0 -90
- package/esm2020/menu/menu-item-selectable.mjs +0 -57
- package/esm2020/menu/menu-item-trigger.mjs +0 -361
- package/esm2020/menu/menu-item.mjs +0 -244
- package/esm2020/menu/menu-module.mjs +0 -64
- package/esm2020/menu/menu-panel.mjs +0 -37
- package/esm2020/menu/menu-stack.mjs +0 -106
- package/esm2020/menu/menu.mjs +0 -301
- package/esm2020/menu/menu_public_index.mjs +0 -5
- package/esm2020/menu/pointer-focus-tracker.mjs +0 -49
- package/esm2020/menu/public-api.mjs +0 -21
- package/fesm2015/dialog.mjs +0 -785
- package/fesm2015/dialog.mjs.map +0 -1
- package/fesm2015/menu.mjs +0 -2162
- package/fesm2015/menu.mjs.map +0 -1
- package/fesm2020/dialog.mjs +0 -780
- package/fesm2020/dialog.mjs.map +0 -1
- package/fesm2020/menu.mjs +0 -2127
- package/fesm2020/menu.mjs.map +0 -1
- package/menu/context-menu.d.ts +0 -123
- package/menu/index.d.ts +0 -8
- package/menu/menu-aim.d.ts +0 -96
- package/menu/menu-bar.d.ts +0 -88
- package/menu/menu-errors.d.ts +0 -22
- package/menu/menu-group.d.ts +0 -33
- package/menu/menu-interface.d.ts +0 -23
- package/menu/menu-item-checkbox.d.ts +0 -12
- package/menu/menu-item-radio.d.ts +0 -35
- package/menu/menu-item-selectable.d.ts +0 -31
- package/menu/menu-item-trigger.d.ts +0 -119
- package/menu/menu-item.d.ts +0 -100
- package/menu/menu-module.d.ts +0 -17
- package/menu/menu-panel.d.ts +0 -30
- package/menu/menu-stack.d.ts +0 -78
- package/menu/menu.d.ts +0 -113
- package/menu/menu_public_index.d.ts +0 -4
- package/menu/package.json +0 -9
- package/menu/pointer-focus-tracker.d.ts +0 -44
- package/menu/public-api.d.ts +0 -20
package/fesm2015/menu.mjs
DELETED
|
@@ -1,2162 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, Directive, EventEmitter, Optional, Inject, Input, Output, Self, ContentChildren, NgModule } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/cdk/overlay';
|
|
4
|
-
import { OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
5
|
-
import { FocusKeyManager } from '@angular/cdk/a11y';
|
|
6
|
-
import { UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, SPACE, TAB, ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
7
|
-
import { Subject, fromEvent, merge, defer, partition } from 'rxjs';
|
|
8
|
-
import { filter, takeUntil, startWith, mergeMap, mapTo, mergeAll, take, switchMap, skip } from 'rxjs/operators';
|
|
9
|
-
import * as i1$1 from '@angular/cdk/collections';
|
|
10
|
-
import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
|
|
11
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
12
|
-
import * as i2 from '@angular/cdk/bidi';
|
|
13
|
-
import { TemplatePortal } from '@angular/cdk/portal';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @license
|
|
17
|
-
* Copyright Google LLC All Rights Reserved.
|
|
18
|
-
*
|
|
19
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
20
|
-
* found in the LICENSE file at https://angular.io/license
|
|
21
|
-
*/
|
|
22
|
-
/** Injection token used to return classes implementing the Menu interface */
|
|
23
|
-
const CDK_MENU = new InjectionToken('cdk-menu');
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @license
|
|
27
|
-
* Copyright Google LLC All Rights Reserved.
|
|
28
|
-
*
|
|
29
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
30
|
-
* found in the LICENSE file at https://angular.io/license
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* Throws an exception when a menu panel already has a menu stack.
|
|
34
|
-
* @docs-private
|
|
35
|
-
*/
|
|
36
|
-
function throwExistingMenuStackError() {
|
|
37
|
-
throw Error('CdkMenuPanel is already referenced by different CdkMenuTrigger. Ensure that a menu is' +
|
|
38
|
-
' opened by a single trigger only.');
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Throws an exception when an instance of the PointerFocusTracker is not provided.
|
|
42
|
-
* @docs-private
|
|
43
|
-
*/
|
|
44
|
-
function throwMissingPointerFocusTracker() {
|
|
45
|
-
throw Error('expected an instance of PointerFocusTracker to be provided');
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Throws an exception when a reference to the parent menu is not provided.
|
|
49
|
-
* @docs-private
|
|
50
|
-
*/
|
|
51
|
-
function throwMissingMenuReference() {
|
|
52
|
-
throw Error('expected a reference to the parent menu');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @license
|
|
57
|
-
* Copyright Google LLC All Rights Reserved.
|
|
58
|
-
*
|
|
59
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
60
|
-
* found in the LICENSE file at https://angular.io/license
|
|
61
|
-
*/
|
|
62
|
-
/** Injection token used for an implementation of MenuAim. */
|
|
63
|
-
const MENU_AIM = new InjectionToken('cdk-menu-aim');
|
|
64
|
-
/** Capture every nth mouse move event. */
|
|
65
|
-
const MOUSE_MOVE_SAMPLE_FREQUENCY = 3;
|
|
66
|
-
/** The number of mouse move events to track. */
|
|
67
|
-
const NUM_POINTS = 5;
|
|
68
|
-
/**
|
|
69
|
-
* How long to wait before closing a sibling menu if a user stops short of the submenu they were
|
|
70
|
-
* predicted to go into.
|
|
71
|
-
*/
|
|
72
|
-
const CLOSE_DELAY = 300;
|
|
73
|
-
/** Calculate the slope between point a and b. */
|
|
74
|
-
function getSlope(a, b) {
|
|
75
|
-
return (b.y - a.y) / (b.x - a.x);
|
|
76
|
-
}
|
|
77
|
-
/** Calculate the y intercept for the given point and slope. */
|
|
78
|
-
function getYIntercept(point, slope) {
|
|
79
|
-
return point.y - slope * point.x;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Whether the given mouse trajectory line defined by the slope and y intercept falls within the
|
|
83
|
-
* submenu as defined by `submenuPoints`
|
|
84
|
-
* @param submenuPoints the submenu DOMRect points.
|
|
85
|
-
* @param m the slope of the trajectory line.
|
|
86
|
-
* @param b the y intercept of the trajectory line.
|
|
87
|
-
*
|
|
88
|
-
* @return true if any point on the line falls within the submenu.
|
|
89
|
-
*/
|
|
90
|
-
function isWithinSubmenu(submenuPoints, m, b) {
|
|
91
|
-
const { left, right, top, bottom } = submenuPoints;
|
|
92
|
-
// Check for intersection with each edge of the submenu (left, right, top, bottom)
|
|
93
|
-
// by fixing one coordinate to that edge's coordinate (either x or y) and checking if the
|
|
94
|
-
// other coordinate is within bounds.
|
|
95
|
-
return ((m * left + b >= top && m * left + b <= bottom) ||
|
|
96
|
-
(m * right + b >= top && m * right + b <= bottom) ||
|
|
97
|
-
((top - b) / m >= left && (top - b) / m <= right) ||
|
|
98
|
-
((bottom - b) / m >= left && (bottom - b) / m <= right));
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* TargetMenuAim predicts if a user is moving into a submenu. It calculates the
|
|
102
|
-
* trajectory of the user's mouse movement in the current menu to determine if the
|
|
103
|
-
* mouse is moving towards an open submenu.
|
|
104
|
-
*
|
|
105
|
-
* The determination is made by calculating the slope of the users last NUM_POINTS moves where each
|
|
106
|
-
* pair of points determines if the trajectory line points into the submenu. It uses consensus
|
|
107
|
-
* approach by checking if at least NUM_POINTS / 2 pairs determine that the user is moving towards
|
|
108
|
-
* to submenu.
|
|
109
|
-
*/
|
|
110
|
-
class TargetMenuAim {
|
|
111
|
-
constructor(_ngZone) {
|
|
112
|
-
this._ngZone = _ngZone;
|
|
113
|
-
/** The last NUM_POINTS mouse move events. */
|
|
114
|
-
this._points = [];
|
|
115
|
-
/** Emits when this service is destroyed. */
|
|
116
|
-
this._destroyed = new Subject();
|
|
117
|
-
}
|
|
118
|
-
/** Set the Menu and its PointerFocusTracker. */
|
|
119
|
-
initialize(menu, pointerTracker) {
|
|
120
|
-
this._menu = menu;
|
|
121
|
-
this._pointerTracker = pointerTracker;
|
|
122
|
-
this._subscribeToMouseMoves();
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Calls the `doToggle` callback when it is deemed that the user is not moving towards
|
|
126
|
-
* the submenu.
|
|
127
|
-
* @param doToggle the function called when the user is not moving towards the submenu.
|
|
128
|
-
*/
|
|
129
|
-
toggle(doToggle) {
|
|
130
|
-
// If the menu is horizontal the sub-menus open below and there is no risk of premature
|
|
131
|
-
// closing of any sub-menus therefore we automatically resolve the callback.
|
|
132
|
-
if (this._menu.orientation === 'horizontal') {
|
|
133
|
-
doToggle();
|
|
134
|
-
}
|
|
135
|
-
this._checkConfigured();
|
|
136
|
-
const siblingItemIsWaiting = !!this._timeoutId;
|
|
137
|
-
const hasPoints = this._points.length > 1;
|
|
138
|
-
if (hasPoints && !siblingItemIsWaiting) {
|
|
139
|
-
if (this._isMovingToSubmenu()) {
|
|
140
|
-
this._startTimeout(doToggle);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
doToggle();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else if (!siblingItemIsWaiting) {
|
|
147
|
-
doToggle();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Start the delayed toggle handler if one isn't running already.
|
|
152
|
-
*
|
|
153
|
-
* The delayed toggle handler executes the `doToggle` callback after some period of time iff the
|
|
154
|
-
* users mouse is on an item in the current menu.
|
|
155
|
-
*/
|
|
156
|
-
_startTimeout(doToggle) {
|
|
157
|
-
// If the users mouse is moving towards a submenu we don't want to immediately resolve.
|
|
158
|
-
// Wait for some period of time before determining if the previous menu should close in
|
|
159
|
-
// cases where the user may have moved towards the submenu but stopped on a sibling menu
|
|
160
|
-
// item intentionally.
|
|
161
|
-
const timeoutId = setTimeout(() => {
|
|
162
|
-
// Resolve if the user is currently moused over some element in the root menu
|
|
163
|
-
if (this._pointerTracker.activeElement && timeoutId === this._timeoutId) {
|
|
164
|
-
doToggle();
|
|
165
|
-
}
|
|
166
|
-
this._timeoutId = null;
|
|
167
|
-
}, CLOSE_DELAY);
|
|
168
|
-
this._timeoutId = timeoutId;
|
|
169
|
-
}
|
|
170
|
-
/** Whether the user is heading towards the open submenu. */
|
|
171
|
-
_isMovingToSubmenu() {
|
|
172
|
-
const submenuPoints = this._getSubmenuBounds();
|
|
173
|
-
if (!submenuPoints) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
let numMoving = 0;
|
|
177
|
-
const currPoint = this._points[this._points.length - 1];
|
|
178
|
-
// start from the second last point and calculate the slope between each point and the last
|
|
179
|
-
// point.
|
|
180
|
-
for (let i = this._points.length - 2; i >= 0; i--) {
|
|
181
|
-
const previous = this._points[i];
|
|
182
|
-
const slope = getSlope(currPoint, previous);
|
|
183
|
-
if (isWithinSubmenu(submenuPoints, slope, getYIntercept(currPoint, slope))) {
|
|
184
|
-
numMoving++;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return numMoving >= Math.floor(NUM_POINTS / 2);
|
|
188
|
-
}
|
|
189
|
-
/** Get the bounding DOMRect for the open submenu. */
|
|
190
|
-
_getSubmenuBounds() {
|
|
191
|
-
var _a, _b, _c;
|
|
192
|
-
return (_c = (_b = (_a = this._pointerTracker) === null || _a === void 0 ? void 0 : _a.previousElement) === null || _b === void 0 ? void 0 : _b.getMenu()) === null || _c === void 0 ? void 0 : _c._elementRef.nativeElement.getBoundingClientRect();
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Check if a reference to the PointerFocusTracker and menu element is provided.
|
|
196
|
-
* @throws an error if neither reference is provided.
|
|
197
|
-
*/
|
|
198
|
-
_checkConfigured() {
|
|
199
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
200
|
-
if (!this._pointerTracker) {
|
|
201
|
-
throwMissingPointerFocusTracker();
|
|
202
|
-
}
|
|
203
|
-
if (!this._menu) {
|
|
204
|
-
throwMissingMenuReference();
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
/** Subscribe to the root menus mouse move events and update the tracked mouse points. */
|
|
209
|
-
_subscribeToMouseMoves() {
|
|
210
|
-
this._ngZone.runOutsideAngular(() => {
|
|
211
|
-
fromEvent(this._menu._elementRef.nativeElement, 'mousemove')
|
|
212
|
-
.pipe(filter((_, index) => index % MOUSE_MOVE_SAMPLE_FREQUENCY === 0), takeUntil(this._destroyed))
|
|
213
|
-
.subscribe((event) => {
|
|
214
|
-
this._points.push({ x: event.clientX, y: event.clientY });
|
|
215
|
-
if (this._points.length > NUM_POINTS) {
|
|
216
|
-
this._points.shift();
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
ngOnDestroy() {
|
|
222
|
-
this._destroyed.next();
|
|
223
|
-
this._destroyed.complete();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
TargetMenuAim.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TargetMenuAim, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
227
|
-
TargetMenuAim.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TargetMenuAim });
|
|
228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TargetMenuAim, decorators: [{
|
|
229
|
-
type: Injectable
|
|
230
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
|
231
|
-
/**
|
|
232
|
-
* CdkTargetMenuAim is a provider for the TargetMenuAim service. It should be added to an
|
|
233
|
-
* element with either the `cdkMenu` or `cdkMenuBar` directive and child menu items.
|
|
234
|
-
*/
|
|
235
|
-
class CdkTargetMenuAim {
|
|
236
|
-
}
|
|
237
|
-
CdkTargetMenuAim.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkTargetMenuAim, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
238
|
-
CdkTargetMenuAim.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkTargetMenuAim, selector: "[cdkTargetMenuAim]", providers: [{ provide: MENU_AIM, useClass: TargetMenuAim }], exportAs: ["cdkTargetMenuAim"], ngImport: i0 });
|
|
239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkTargetMenuAim, decorators: [{
|
|
240
|
-
type: Directive,
|
|
241
|
-
args: [{
|
|
242
|
-
selector: '[cdkTargetMenuAim]',
|
|
243
|
-
exportAs: 'cdkTargetMenuAim',
|
|
244
|
-
providers: [{ provide: MENU_AIM, useClass: TargetMenuAim }],
|
|
245
|
-
}]
|
|
246
|
-
}] });
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* @license
|
|
250
|
-
* Copyright Google LLC All Rights Reserved.
|
|
251
|
-
*
|
|
252
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
253
|
-
* found in the LICENSE file at https://angular.io/license
|
|
254
|
-
*/
|
|
255
|
-
/**
|
|
256
|
-
* MenuStack allows subscribers to listen for close events (when a MenuStackItem is popped off
|
|
257
|
-
* of the stack) in order to perform closing actions. Upon the MenuStack being empty it emits
|
|
258
|
-
* from the `empty` observable specifying the next focus action which the listener should perform
|
|
259
|
-
* as requested by the closer.
|
|
260
|
-
*/
|
|
261
|
-
class MenuStack {
|
|
262
|
-
constructor() {
|
|
263
|
-
/** All MenuStackItems tracked by this MenuStack. */
|
|
264
|
-
this._elements = [];
|
|
265
|
-
/** Emits the element which was popped off of the stack when requested by a closer. */
|
|
266
|
-
this._close = new Subject();
|
|
267
|
-
/** Emits once the MenuStack has become empty after popping off elements. */
|
|
268
|
-
this._empty = new Subject();
|
|
269
|
-
/** Observable which emits the MenuStackItem which has been requested to close. */
|
|
270
|
-
this.closed = this._close;
|
|
271
|
-
/**
|
|
272
|
-
* Observable which emits when the MenuStack is empty after popping off the last element. It
|
|
273
|
-
* emits a FocusNext event which specifies the action the closer has requested the listener
|
|
274
|
-
* perform.
|
|
275
|
-
*/
|
|
276
|
-
this.emptied = this._empty;
|
|
277
|
-
}
|
|
278
|
-
/** @param menu the MenuStackItem to put on the stack. */
|
|
279
|
-
push(menu) {
|
|
280
|
-
this._elements.push(menu);
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Pop items off of the stack up to and including `lastItem` and emit each on the close
|
|
284
|
-
* observable. If the stack is empty or `lastItem` is not on the stack it does nothing.
|
|
285
|
-
* @param lastItem the last item to pop off the stack.
|
|
286
|
-
* @param focusNext the event to emit on the `empty` observable if the method call resulted in an
|
|
287
|
-
* empty stack. Does not emit if the stack was initially empty or if `lastItem` was not on the
|
|
288
|
-
* stack.
|
|
289
|
-
*/
|
|
290
|
-
close(lastItem, focusNext) {
|
|
291
|
-
if (this._elements.indexOf(lastItem) >= 0) {
|
|
292
|
-
let poppedElement;
|
|
293
|
-
do {
|
|
294
|
-
poppedElement = this._elements.pop();
|
|
295
|
-
this._close.next(poppedElement);
|
|
296
|
-
} while (poppedElement !== lastItem);
|
|
297
|
-
if (this.isEmpty()) {
|
|
298
|
-
this._empty.next(focusNext);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Pop items off of the stack up to but excluding `lastItem` and emit each on the close
|
|
304
|
-
* observable. If the stack is empty or `lastItem` is not on the stack it does nothing.
|
|
305
|
-
* @param lastItem the element which should be left on the stack
|
|
306
|
-
* @return whether or not an item was removed from the stack
|
|
307
|
-
*/
|
|
308
|
-
closeSubMenuOf(lastItem) {
|
|
309
|
-
let removed = false;
|
|
310
|
-
if (this._elements.indexOf(lastItem) >= 0) {
|
|
311
|
-
removed = this.peek() !== lastItem;
|
|
312
|
-
while (this.peek() !== lastItem) {
|
|
313
|
-
this._close.next(this._elements.pop());
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return removed;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Pop off all MenuStackItems and emit each one on the `close` observable one by one.
|
|
320
|
-
* @param focusNext the event to emit on the `empty` observable once the stack is emptied. Does
|
|
321
|
-
* not emit if the stack was initially empty.
|
|
322
|
-
*/
|
|
323
|
-
closeAll(focusNext) {
|
|
324
|
-
if (!this.isEmpty()) {
|
|
325
|
-
while (!this.isEmpty()) {
|
|
326
|
-
const menuStackItem = this._elements.pop();
|
|
327
|
-
if (menuStackItem) {
|
|
328
|
-
this._close.next(menuStackItem);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
this._empty.next(focusNext);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
/** Return true if this stack is empty. */
|
|
335
|
-
isEmpty() {
|
|
336
|
-
return !this._elements.length;
|
|
337
|
-
}
|
|
338
|
-
/** Return the length of the stack. */
|
|
339
|
-
length() {
|
|
340
|
-
return this._elements.length;
|
|
341
|
-
}
|
|
342
|
-
/** Get the top most element on the stack. */
|
|
343
|
-
peek() {
|
|
344
|
-
return this._elements[this._elements.length - 1];
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
/** NoopMenuStack is a placeholder MenuStack used for inline menus. */
|
|
348
|
-
class NoopMenuStack extends MenuStack {
|
|
349
|
-
/** Noop push - does not add elements to the MenuStack. */
|
|
350
|
-
push(_) { }
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* @license
|
|
355
|
-
* Copyright Google LLC All Rights Reserved.
|
|
356
|
-
*
|
|
357
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
358
|
-
* found in the LICENSE file at https://angular.io/license
|
|
359
|
-
*/
|
|
360
|
-
/**
|
|
361
|
-
* Whether the target element is a menu item to be ignored by the overlay background click handler.
|
|
362
|
-
*/
|
|
363
|
-
function isClickInsideMenuOverlay(target) {
|
|
364
|
-
while (target === null || target === void 0 ? void 0 : target.parentElement) {
|
|
365
|
-
const isOpenTrigger = target.getAttribute('aria-expanded') === 'true' &&
|
|
366
|
-
target.classList.contains('cdk-menu-trigger');
|
|
367
|
-
const isOverlayMenu = target.classList.contains('cdk-menu') && !target.classList.contains('cdk-menu-inline');
|
|
368
|
-
if (isOpenTrigger || isOverlayMenu) {
|
|
369
|
-
return true;
|
|
370
|
-
}
|
|
371
|
-
target = target.parentElement;
|
|
372
|
-
}
|
|
373
|
-
return false;
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* A directive to be combined with CdkMenuItem which opens the Menu it is bound to. If the
|
|
377
|
-
* element is in a top level MenuBar it will open the menu on click, or if a sibling is already
|
|
378
|
-
* opened it will open on hover. If it is inside of a Menu it will open the attached Submenu on
|
|
379
|
-
* hover regardless of its sibling state.
|
|
380
|
-
*
|
|
381
|
-
* The directive must be placed along with the `cdkMenuItem` directive in order to enable full
|
|
382
|
-
* functionality.
|
|
383
|
-
*/
|
|
384
|
-
class CdkMenuItemTrigger {
|
|
385
|
-
constructor(_elementRef, _viewContainerRef, _overlay, _ngZone, _parentMenu, _menuAim, _directionality) {
|
|
386
|
-
this._elementRef = _elementRef;
|
|
387
|
-
this._viewContainerRef = _viewContainerRef;
|
|
388
|
-
this._overlay = _overlay;
|
|
389
|
-
this._ngZone = _ngZone;
|
|
390
|
-
this._parentMenu = _parentMenu;
|
|
391
|
-
this._menuAim = _menuAim;
|
|
392
|
-
this._directionality = _directionality;
|
|
393
|
-
/** Emits when the attached menu is requested to open */
|
|
394
|
-
this.opened = new EventEmitter();
|
|
395
|
-
/** Emits when the attached menu is requested to close */
|
|
396
|
-
this.closed = new EventEmitter();
|
|
397
|
-
/** The menu stack for this trigger and its sub-menus. */
|
|
398
|
-
this._menuStack = new MenuStack();
|
|
399
|
-
/** A reference to the overlay which manages the triggered menu */
|
|
400
|
-
this._overlayRef = null;
|
|
401
|
-
/** Emits when this trigger is destroyed. */
|
|
402
|
-
this._destroyed = new Subject();
|
|
403
|
-
/** Emits when the outside pointer events listener on the overlay should be stopped. */
|
|
404
|
-
this._stopOutsideClicksListener = merge(this.closed, this._destroyed);
|
|
405
|
-
this._registerCloseHandler();
|
|
406
|
-
this._subscribeToMouseEnter();
|
|
407
|
-
}
|
|
408
|
-
/** Template reference variable to the menu this trigger opens */
|
|
409
|
-
get menuPanel() {
|
|
410
|
-
return this._menuPanel;
|
|
411
|
-
}
|
|
412
|
-
set menuPanel(panel) {
|
|
413
|
-
// If the provided panel already has a stack, that means it already has a trigger configured.
|
|
414
|
-
// Note however that there are some edge cases where two triggers **may** share the same menu,
|
|
415
|
-
// e.g. two triggers in two separate menus.
|
|
416
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && (panel === null || panel === void 0 ? void 0 : panel._menuStack)) {
|
|
417
|
-
throwExistingMenuStackError();
|
|
418
|
-
}
|
|
419
|
-
this._menuPanel = panel;
|
|
420
|
-
if (this._menuPanel) {
|
|
421
|
-
this._menuPanel._menuStack = this._getMenuStack();
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
/** Open/close the attached menu if the trigger has been configured with one */
|
|
425
|
-
toggle() {
|
|
426
|
-
if (this.hasMenu()) {
|
|
427
|
-
this.isMenuOpen() ? this.closeMenu() : this.openMenu();
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
/** Open the attached menu. */
|
|
431
|
-
openMenu() {
|
|
432
|
-
if (!this.isMenuOpen()) {
|
|
433
|
-
this.opened.next();
|
|
434
|
-
this._overlayRef = this._overlayRef || this._overlay.create(this._getOverlayConfig());
|
|
435
|
-
this._overlayRef.attach(this._getPortal());
|
|
436
|
-
this._subscribeToOutsideClicks();
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
/** Close the opened menu. */
|
|
440
|
-
closeMenu() {
|
|
441
|
-
if (this.isMenuOpen()) {
|
|
442
|
-
this.closed.next();
|
|
443
|
-
this._overlayRef.detach();
|
|
444
|
-
}
|
|
445
|
-
this._closeSiblingTriggers();
|
|
446
|
-
}
|
|
447
|
-
/** Return true if the trigger has an attached menu */
|
|
448
|
-
hasMenu() {
|
|
449
|
-
return !!this.menuPanel;
|
|
450
|
-
}
|
|
451
|
-
/** Whether the menu this button is a trigger for is open */
|
|
452
|
-
isMenuOpen() {
|
|
453
|
-
return this._overlayRef ? this._overlayRef.hasAttached() : false;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Get a reference to the rendered Menu if the Menu is open and it is visible in the DOM.
|
|
457
|
-
* @return the menu if it is open, otherwise undefined.
|
|
458
|
-
*/
|
|
459
|
-
getMenu() {
|
|
460
|
-
var _a;
|
|
461
|
-
return (_a = this.menuPanel) === null || _a === void 0 ? void 0 : _a._menu;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Subscribe to the mouseenter events and close any sibling menu items if this element is moused
|
|
465
|
-
* into.
|
|
466
|
-
*/
|
|
467
|
-
_subscribeToMouseEnter() {
|
|
468
|
-
// Closes any sibling menu items and opens the menu associated with this trigger.
|
|
469
|
-
const toggleMenus = () => this._ngZone.run(() => {
|
|
470
|
-
this._closeSiblingTriggers();
|
|
471
|
-
this.openMenu();
|
|
472
|
-
});
|
|
473
|
-
this._ngZone.runOutsideAngular(() => {
|
|
474
|
-
fromEvent(this._elementRef.nativeElement, 'mouseenter')
|
|
475
|
-
.pipe(filter(() => { var _a; return !((_a = this._getMenuStack()) === null || _a === void 0 ? void 0 : _a.isEmpty()) && !this.isMenuOpen(); }), takeUntil(this._destroyed))
|
|
476
|
-
.subscribe(() => {
|
|
477
|
-
if (this._menuAim) {
|
|
478
|
-
this._menuAim.toggle(toggleMenus);
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
toggleMenus();
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* Handles keyboard events for the menu item, specifically opening/closing the attached menu and
|
|
488
|
-
* focusing the appropriate submenu item.
|
|
489
|
-
* @param event the keyboard event to handle
|
|
490
|
-
*/
|
|
491
|
-
_toggleOnKeydown(event) {
|
|
492
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
493
|
-
const keyCode = event.keyCode;
|
|
494
|
-
switch (keyCode) {
|
|
495
|
-
case SPACE:
|
|
496
|
-
case ENTER:
|
|
497
|
-
event.preventDefault();
|
|
498
|
-
this.toggle();
|
|
499
|
-
(_b = (_a = this.menuPanel) === null || _a === void 0 ? void 0 : _a._menu) === null || _b === void 0 ? void 0 : _b.focusFirstItem('keyboard');
|
|
500
|
-
break;
|
|
501
|
-
case RIGHT_ARROW:
|
|
502
|
-
if (this._parentMenu && this._isParentVertical()) {
|
|
503
|
-
event.preventDefault();
|
|
504
|
-
if (((_c = this._directionality) === null || _c === void 0 ? void 0 : _c.value) === 'rtl') {
|
|
505
|
-
this._getMenuStack().close(this._parentMenu, 2 /* currentItem */);
|
|
506
|
-
}
|
|
507
|
-
else {
|
|
508
|
-
this.openMenu();
|
|
509
|
-
(_e = (_d = this.menuPanel) === null || _d === void 0 ? void 0 : _d._menu) === null || _e === void 0 ? void 0 : _e.focusFirstItem('keyboard');
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
break;
|
|
513
|
-
case LEFT_ARROW:
|
|
514
|
-
if (this._parentMenu && this._isParentVertical()) {
|
|
515
|
-
event.preventDefault();
|
|
516
|
-
if (((_f = this._directionality) === null || _f === void 0 ? void 0 : _f.value) === 'rtl') {
|
|
517
|
-
this.openMenu();
|
|
518
|
-
(_h = (_g = this.menuPanel) === null || _g === void 0 ? void 0 : _g._menu) === null || _h === void 0 ? void 0 : _h.focusFirstItem('keyboard');
|
|
519
|
-
}
|
|
520
|
-
else {
|
|
521
|
-
this._getMenuStack().close(this._parentMenu, 2 /* currentItem */);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
break;
|
|
525
|
-
case DOWN_ARROW:
|
|
526
|
-
case UP_ARROW:
|
|
527
|
-
if (!this._isParentVertical()) {
|
|
528
|
-
event.preventDefault();
|
|
529
|
-
this.openMenu();
|
|
530
|
-
keyCode === DOWN_ARROW
|
|
531
|
-
? (_k = (_j = this.menuPanel) === null || _j === void 0 ? void 0 : _j._menu) === null || _k === void 0 ? void 0 : _k.focusFirstItem('keyboard')
|
|
532
|
-
: (_m = (_l = this.menuPanel) === null || _l === void 0 ? void 0 : _l._menu) === null || _m === void 0 ? void 0 : _m.focusLastItem('keyboard');
|
|
533
|
-
}
|
|
534
|
-
break;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
/** Close out any sibling menu trigger menus. */
|
|
538
|
-
_closeSiblingTriggers() {
|
|
539
|
-
if (this._parentMenu) {
|
|
540
|
-
const menuStack = this._getMenuStack();
|
|
541
|
-
// If nothing was removed from the stack and the last element is not the parent item
|
|
542
|
-
// that means that the parent menu is a menu bar since we don't put the menu bar on the
|
|
543
|
-
// stack
|
|
544
|
-
const isParentMenuBar = !menuStack.closeSubMenuOf(this._parentMenu) && menuStack.peek() !== this._parentMenu;
|
|
545
|
-
if (isParentMenuBar) {
|
|
546
|
-
menuStack.closeAll();
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
else {
|
|
550
|
-
this._getMenuStack().closeAll();
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
/** Get the configuration object used to create the overlay */
|
|
554
|
-
_getOverlayConfig() {
|
|
555
|
-
return new OverlayConfig({
|
|
556
|
-
positionStrategy: this._getOverlayPositionStrategy(),
|
|
557
|
-
scrollStrategy: this._overlay.scrollStrategies.block(),
|
|
558
|
-
direction: this._directionality,
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
/** Build the position strategy for the overlay which specifies where to place the menu */
|
|
562
|
-
_getOverlayPositionStrategy() {
|
|
563
|
-
return this._overlay
|
|
564
|
-
.position()
|
|
565
|
-
.flexibleConnectedTo(this._elementRef)
|
|
566
|
-
.withPositions(this._getOverlayPositions());
|
|
567
|
-
}
|
|
568
|
-
/** Determine and return where to position the opened menu relative to the menu item */
|
|
569
|
-
_getOverlayPositions() {
|
|
570
|
-
// TODO: use a common positioning config from (possibly) cdk/overlay
|
|
571
|
-
return !this._parentMenu || this._parentMenu.orientation === 'horizontal'
|
|
572
|
-
? [
|
|
573
|
-
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
|
|
574
|
-
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },
|
|
575
|
-
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },
|
|
576
|
-
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },
|
|
577
|
-
]
|
|
578
|
-
: [
|
|
579
|
-
{ originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top' },
|
|
580
|
-
{ originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom' },
|
|
581
|
-
{ originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top' },
|
|
582
|
-
{ originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom' },
|
|
583
|
-
];
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* Get the portal to be attached to the overlay which contains the menu. Allows for the menu
|
|
587
|
-
* content to change dynamically and be reflected in the application.
|
|
588
|
-
*/
|
|
589
|
-
_getPortal() {
|
|
590
|
-
var _a, _b;
|
|
591
|
-
const hasMenuContentChanged = ((_a = this.menuPanel) === null || _a === void 0 ? void 0 : _a._templateRef) !== ((_b = this._panelContent) === null || _b === void 0 ? void 0 : _b.templateRef);
|
|
592
|
-
if (this.menuPanel && (!this._panelContent || hasMenuContentChanged)) {
|
|
593
|
-
this._panelContent = new TemplatePortal(this.menuPanel._templateRef, this._viewContainerRef);
|
|
594
|
-
}
|
|
595
|
-
return this._panelContent;
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* @return true if if the enclosing parent menu is configured in a vertical orientation.
|
|
599
|
-
*/
|
|
600
|
-
_isParentVertical() {
|
|
601
|
-
var _a;
|
|
602
|
-
return ((_a = this._parentMenu) === null || _a === void 0 ? void 0 : _a.orientation) === 'vertical';
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* Subscribe to the MenuStack close events if this is a standalone trigger and close out the menu
|
|
606
|
-
* this triggers when requested.
|
|
607
|
-
*/
|
|
608
|
-
_registerCloseHandler() {
|
|
609
|
-
if (!this._parentMenu) {
|
|
610
|
-
this._menuStack.closed.pipe(takeUntil(this._destroyed)).subscribe(item => {
|
|
611
|
-
var _a;
|
|
612
|
-
if (item === ((_a = this._menuPanel) === null || _a === void 0 ? void 0 : _a._menu)) {
|
|
613
|
-
this.closeMenu();
|
|
614
|
-
}
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
/** Get the menu stack for this trigger - either from the parent or this trigger. */
|
|
619
|
-
_getMenuStack() {
|
|
620
|
-
var _a;
|
|
621
|
-
// We use a function since at the construction of the MenuItemTrigger the parent Menu won't have
|
|
622
|
-
// its menu stack set. Therefore we need to reference the menu stack from the parent each time
|
|
623
|
-
// we want to use it.
|
|
624
|
-
return ((_a = this._parentMenu) === null || _a === void 0 ? void 0 : _a._menuStack) || this._menuStack;
|
|
625
|
-
}
|
|
626
|
-
ngOnDestroy() {
|
|
627
|
-
this._destroyOverlay();
|
|
628
|
-
this._resetPanelMenuStack();
|
|
629
|
-
this._destroyed.next();
|
|
630
|
-
this._destroyed.complete();
|
|
631
|
-
}
|
|
632
|
-
/** Set the menu panels menu stack back to null. */
|
|
633
|
-
_resetPanelMenuStack() {
|
|
634
|
-
// If a CdkMenuTrigger is placed in a submenu, each time the trigger is rendered (its parent
|
|
635
|
-
// menu is opened) the panel setter for CdkMenuPanel is called. From the first render onward,
|
|
636
|
-
// the attached CdkMenuPanel has the MenuStack set. Since we throw an error if a panel already
|
|
637
|
-
// has a stack set, we want to reset the attached stack here to prevent the error from being
|
|
638
|
-
// thrown if the trigger re-configures its attached panel (in the case where there is a 1:1
|
|
639
|
-
// relationship between the panel and trigger).
|
|
640
|
-
if (this._menuPanel) {
|
|
641
|
-
this._menuPanel._menuStack = null;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Subscribe to the overlays outside pointer events stream and handle closing out the stack if a
|
|
646
|
-
* click occurs outside the menus.
|
|
647
|
-
*/
|
|
648
|
-
_subscribeToOutsideClicks() {
|
|
649
|
-
if (this._overlayRef) {
|
|
650
|
-
this._overlayRef
|
|
651
|
-
.outsidePointerEvents()
|
|
652
|
-
.pipe(takeUntil(this._stopOutsideClicksListener))
|
|
653
|
-
.subscribe(event => {
|
|
654
|
-
if (!isClickInsideMenuOverlay(event.target)) {
|
|
655
|
-
this._getMenuStack().closeAll();
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
/** Destroy and unset the overlay reference it if exists */
|
|
661
|
-
_destroyOverlay() {
|
|
662
|
-
if (this._overlayRef) {
|
|
663
|
-
this._overlayRef.dispose();
|
|
664
|
-
this._overlayRef = null;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
CdkMenuItemTrigger.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItemTrigger, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i1.Overlay }, { token: i0.NgZone }, { token: CDK_MENU, optional: true }, { token: MENU_AIM, optional: true }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
669
|
-
CdkMenuItemTrigger.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuItemTrigger, selector: "[cdkMenuTriggerFor]", inputs: { menuPanel: ["cdkMenuTriggerFor", "menuPanel"] }, outputs: { opened: "cdkMenuOpened", closed: "cdkMenuClosed" }, host: { attributes: { "aria-haspopup": "menu" }, listeners: { "keydown": "_toggleOnKeydown($event)", "click": "toggle()" }, properties: { "attr.aria-expanded": "isMenuOpen()" }, classAttribute: "cdk-menu-trigger" }, exportAs: ["cdkMenuTriggerFor"], ngImport: i0 });
|
|
670
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItemTrigger, decorators: [{
|
|
671
|
-
type: Directive,
|
|
672
|
-
args: [{
|
|
673
|
-
selector: '[cdkMenuTriggerFor]',
|
|
674
|
-
exportAs: 'cdkMenuTriggerFor',
|
|
675
|
-
host: {
|
|
676
|
-
'(keydown)': '_toggleOnKeydown($event)',
|
|
677
|
-
'(click)': 'toggle()',
|
|
678
|
-
'class': 'cdk-menu-trigger',
|
|
679
|
-
'aria-haspopup': 'menu',
|
|
680
|
-
'[attr.aria-expanded]': 'isMenuOpen()',
|
|
681
|
-
},
|
|
682
|
-
}]
|
|
683
|
-
}], ctorParameters: function () {
|
|
684
|
-
return [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i1.Overlay }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
685
|
-
type: Optional
|
|
686
|
-
}, {
|
|
687
|
-
type: Inject,
|
|
688
|
-
args: [CDK_MENU]
|
|
689
|
-
}] }, { type: undefined, decorators: [{
|
|
690
|
-
type: Optional
|
|
691
|
-
}, {
|
|
692
|
-
type: Inject,
|
|
693
|
-
args: [MENU_AIM]
|
|
694
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
695
|
-
type: Optional
|
|
696
|
-
}] }];
|
|
697
|
-
}, propDecorators: { menuPanel: [{
|
|
698
|
-
type: Input,
|
|
699
|
-
args: ['cdkMenuTriggerFor']
|
|
700
|
-
}], opened: [{
|
|
701
|
-
type: Output,
|
|
702
|
-
args: ['cdkMenuOpened']
|
|
703
|
-
}], closed: [{
|
|
704
|
-
type: Output,
|
|
705
|
-
args: ['cdkMenuClosed']
|
|
706
|
-
}] } });
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* @license
|
|
710
|
-
* Copyright Google LLC All Rights Reserved.
|
|
711
|
-
*
|
|
712
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
713
|
-
* found in the LICENSE file at https://angular.io/license
|
|
714
|
-
*/
|
|
715
|
-
// TODO refactor this to be configurable allowing for custom elements to be removed
|
|
716
|
-
/** Removes all icons from within the given element. */
|
|
717
|
-
function removeIcons(element) {
|
|
718
|
-
for (const icon of Array.from(element.querySelectorAll('mat-icon, .material-icons'))) {
|
|
719
|
-
icon.remove();
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
/**
|
|
723
|
-
* Directive which provides the ability for an element to be focused and navigated to using the
|
|
724
|
-
* keyboard when residing in a CdkMenu, CdkMenuBar, or CdkMenuGroup. It performs user defined
|
|
725
|
-
* behavior when clicked.
|
|
726
|
-
*/
|
|
727
|
-
class CdkMenuItem {
|
|
728
|
-
constructor(_elementRef, _ngZone, _parentMenu, _menuAim, _dir,
|
|
729
|
-
/** Reference to the CdkMenuItemTrigger directive if one is added to the same element */
|
|
730
|
-
// `CdkMenuItem` is commonly used in combination with a `CdkMenuItemTrigger`.
|
|
731
|
-
// tslint:disable-next-line: lightweight-tokens
|
|
732
|
-
_menuTrigger) {
|
|
733
|
-
this._elementRef = _elementRef;
|
|
734
|
-
this._ngZone = _ngZone;
|
|
735
|
-
this._parentMenu = _parentMenu;
|
|
736
|
-
this._menuAim = _menuAim;
|
|
737
|
-
this._dir = _dir;
|
|
738
|
-
this._menuTrigger = _menuTrigger;
|
|
739
|
-
this._disabled = false;
|
|
740
|
-
/**
|
|
741
|
-
* If this MenuItem is a regular MenuItem, outputs when it is triggered by a keyboard or mouse
|
|
742
|
-
* event.
|
|
743
|
-
*/
|
|
744
|
-
this.triggered = new EventEmitter();
|
|
745
|
-
/**
|
|
746
|
-
* The tabindex for this menu item managed internally and used for implementing roving a
|
|
747
|
-
* tab index.
|
|
748
|
-
*/
|
|
749
|
-
this._tabindex = -1;
|
|
750
|
-
/** Emits when the menu item is destroyed. */
|
|
751
|
-
this._destroyed = new Subject();
|
|
752
|
-
this._setupMouseEnter();
|
|
753
|
-
if (this._isStandaloneItem()) {
|
|
754
|
-
this._tabindex = 0;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
/** Whether the CdkMenuItem is disabled - defaults to false */
|
|
758
|
-
get disabled() {
|
|
759
|
-
return this._disabled;
|
|
760
|
-
}
|
|
761
|
-
set disabled(value) {
|
|
762
|
-
this._disabled = coerceBooleanProperty(value);
|
|
763
|
-
}
|
|
764
|
-
/** Place focus on the element. */
|
|
765
|
-
focus() {
|
|
766
|
-
this._elementRef.nativeElement.focus();
|
|
767
|
-
}
|
|
768
|
-
/** Reset the _tabindex to -1. */
|
|
769
|
-
_resetTabIndex() {
|
|
770
|
-
if (!this._isStandaloneItem()) {
|
|
771
|
-
this._tabindex = -1;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Set the tab index to 0 if not disabled and it's a focus event, or a mouse enter if this element
|
|
776
|
-
* is not in a menu bar.
|
|
777
|
-
*/
|
|
778
|
-
_setTabIndex(event) {
|
|
779
|
-
var _a;
|
|
780
|
-
if (this.disabled) {
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
// don't set the tabindex if there are no open sibling or parent menus
|
|
784
|
-
if (!event || !((_a = this._getMenuStack()) === null || _a === void 0 ? void 0 : _a.isEmpty())) {
|
|
785
|
-
this._tabindex = 0;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
/** Whether this menu item is standalone or within a menu or menu bar. */
|
|
789
|
-
_isStandaloneItem() {
|
|
790
|
-
return !this._parentMenu;
|
|
791
|
-
}
|
|
792
|
-
/**
|
|
793
|
-
* If the menu item is not disabled and the element does not have a menu trigger attached, emit
|
|
794
|
-
* on the cdkMenuItemTriggered emitter and close all open menus.
|
|
795
|
-
*/
|
|
796
|
-
trigger() {
|
|
797
|
-
var _a;
|
|
798
|
-
if (!this.disabled && !this.hasMenu()) {
|
|
799
|
-
this.triggered.next();
|
|
800
|
-
(_a = this._getMenuStack()) === null || _a === void 0 ? void 0 : _a.closeAll();
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
/** Whether the menu item opens a menu. */
|
|
804
|
-
hasMenu() {
|
|
805
|
-
var _a;
|
|
806
|
-
return !!((_a = this._menuTrigger) === null || _a === void 0 ? void 0 : _a.hasMenu());
|
|
807
|
-
}
|
|
808
|
-
/** Return true if this MenuItem has an attached menu and it is open. */
|
|
809
|
-
isMenuOpen() {
|
|
810
|
-
var _a;
|
|
811
|
-
return !!((_a = this._menuTrigger) === null || _a === void 0 ? void 0 : _a.isMenuOpen());
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* Get a reference to the rendered Menu if the Menu is open and it is visible in the DOM.
|
|
815
|
-
* @return the menu if it is open, otherwise undefined.
|
|
816
|
-
*/
|
|
817
|
-
getMenu() {
|
|
818
|
-
var _a;
|
|
819
|
-
return (_a = this._menuTrigger) === null || _a === void 0 ? void 0 : _a.getMenu();
|
|
820
|
-
}
|
|
821
|
-
/** Get the MenuItemTrigger associated with this element. */
|
|
822
|
-
getMenuTrigger() {
|
|
823
|
-
return this._menuTrigger;
|
|
824
|
-
}
|
|
825
|
-
/** Get the label for this element which is required by the FocusableOption interface. */
|
|
826
|
-
getLabel() {
|
|
827
|
-
var _a;
|
|
828
|
-
// TODO cloning the tree may be expensive; implement a better method
|
|
829
|
-
// we know that the current node is an element type
|
|
830
|
-
const clone = this._elementRef.nativeElement.cloneNode(true);
|
|
831
|
-
removeIcons(clone);
|
|
832
|
-
return ((_a = clone.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Handles keyboard events for the menu item, specifically either triggering the user defined
|
|
836
|
-
* callback or opening/closing the current menu based on whether the left or right arrow key was
|
|
837
|
-
* pressed.
|
|
838
|
-
* @param event the keyboard event to handle
|
|
839
|
-
*/
|
|
840
|
-
_onKeydown(event) {
|
|
841
|
-
var _a, _b, _c, _d, _e, _f;
|
|
842
|
-
switch (event.keyCode) {
|
|
843
|
-
case SPACE:
|
|
844
|
-
case ENTER:
|
|
845
|
-
event.preventDefault();
|
|
846
|
-
this.trigger();
|
|
847
|
-
break;
|
|
848
|
-
case RIGHT_ARROW:
|
|
849
|
-
if (this._parentMenu && this._isParentVertical() && !this.hasMenu()) {
|
|
850
|
-
event.preventDefault();
|
|
851
|
-
((_a = this._dir) === null || _a === void 0 ? void 0 : _a.value) === 'rtl'
|
|
852
|
-
? (_b = this._getMenuStack()) === null || _b === void 0 ? void 0 : _b.close(this._parentMenu, 1 /* previousItem */)
|
|
853
|
-
: (_c = this._getMenuStack()) === null || _c === void 0 ? void 0 : _c.closeAll(0 /* nextItem */);
|
|
854
|
-
}
|
|
855
|
-
break;
|
|
856
|
-
case LEFT_ARROW:
|
|
857
|
-
if (this._parentMenu && this._isParentVertical() && !this.hasMenu()) {
|
|
858
|
-
event.preventDefault();
|
|
859
|
-
((_d = this._dir) === null || _d === void 0 ? void 0 : _d.value) === 'rtl'
|
|
860
|
-
? (_e = this._getMenuStack()) === null || _e === void 0 ? void 0 : _e.closeAll(0 /* nextItem */)
|
|
861
|
-
: (_f = this._getMenuStack()) === null || _f === void 0 ? void 0 : _f.close(this._parentMenu, 1 /* previousItem */);
|
|
862
|
-
}
|
|
863
|
-
break;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
/**
|
|
867
|
-
* Subscribe to the mouseenter events and close any sibling menu items if this element is moused
|
|
868
|
-
* into.
|
|
869
|
-
*/
|
|
870
|
-
_setupMouseEnter() {
|
|
871
|
-
if (!this._isStandaloneItem()) {
|
|
872
|
-
const closeOpenSiblings = () => this._ngZone.run(() => { var _a; return (_a = this._getMenuStack()) === null || _a === void 0 ? void 0 : _a.closeSubMenuOf(this._parentMenu); });
|
|
873
|
-
this._ngZone.runOutsideAngular(() => fromEvent(this._elementRef.nativeElement, 'mouseenter')
|
|
874
|
-
.pipe(filter(() => { var _a; return !((_a = this._getMenuStack()) === null || _a === void 0 ? void 0 : _a.isEmpty()) && !this.hasMenu(); }), takeUntil(this._destroyed))
|
|
875
|
-
.subscribe(() => {
|
|
876
|
-
if (this._menuAim) {
|
|
877
|
-
this._menuAim.toggle(closeOpenSiblings);
|
|
878
|
-
}
|
|
879
|
-
else {
|
|
880
|
-
closeOpenSiblings();
|
|
881
|
-
}
|
|
882
|
-
}));
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
/**
|
|
886
|
-
* Return true if the enclosing parent menu is configured in a horizontal orientation, false
|
|
887
|
-
* otherwise or if no parent.
|
|
888
|
-
*/
|
|
889
|
-
_isParentVertical() {
|
|
890
|
-
var _a;
|
|
891
|
-
return ((_a = this._parentMenu) === null || _a === void 0 ? void 0 : _a.orientation) === 'vertical';
|
|
892
|
-
}
|
|
893
|
-
/** Get the MenuStack from the parent menu. */
|
|
894
|
-
_getMenuStack() {
|
|
895
|
-
var _a;
|
|
896
|
-
// We use a function since at the construction of the MenuItemTrigger the parent Menu won't have
|
|
897
|
-
// its menu stack set. Therefore we need to reference the menu stack from the parent each time
|
|
898
|
-
// we want to use it.
|
|
899
|
-
return (_a = this._parentMenu) === null || _a === void 0 ? void 0 : _a._menuStack;
|
|
900
|
-
}
|
|
901
|
-
ngOnDestroy() {
|
|
902
|
-
this._destroyed.next();
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
CdkMenuItem.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItem, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: CDK_MENU, optional: true }, { token: MENU_AIM, optional: true }, { token: i2.Directionality, optional: true }, { token: CdkMenuItemTrigger, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
906
|
-
CdkMenuItem.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuItem, selector: "[cdkMenuItem]", inputs: { disabled: "disabled" }, outputs: { triggered: "cdkMenuItemTriggered" }, host: { attributes: { "type": "button", "role": "menuitem" }, listeners: { "blur": "_resetTabIndex()", "mouseout": "_resetTabIndex()", "focus": "_setTabIndex()", "mouseenter": "_setTabIndex($event)", "click": "trigger()", "keydown": "_onKeydown($event)" }, properties: { "tabindex": "_tabindex", "attr.aria-disabled": "disabled || null" }, classAttribute: "cdk-menu-item" }, exportAs: ["cdkMenuItem"], ngImport: i0 });
|
|
907
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItem, decorators: [{
|
|
908
|
-
type: Directive,
|
|
909
|
-
args: [{
|
|
910
|
-
selector: '[cdkMenuItem]',
|
|
911
|
-
exportAs: 'cdkMenuItem',
|
|
912
|
-
host: {
|
|
913
|
-
'[tabindex]': '_tabindex',
|
|
914
|
-
'type': 'button',
|
|
915
|
-
'role': 'menuitem',
|
|
916
|
-
'class': 'cdk-menu-item',
|
|
917
|
-
'[attr.aria-disabled]': 'disabled || null',
|
|
918
|
-
'(blur)': '_resetTabIndex()',
|
|
919
|
-
'(mouseout)': '_resetTabIndex()',
|
|
920
|
-
'(focus)': '_setTabIndex()',
|
|
921
|
-
'(mouseenter)': '_setTabIndex($event)',
|
|
922
|
-
'(click)': 'trigger()',
|
|
923
|
-
'(keydown)': '_onKeydown($event)',
|
|
924
|
-
},
|
|
925
|
-
}]
|
|
926
|
-
}], ctorParameters: function () {
|
|
927
|
-
return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
928
|
-
type: Optional
|
|
929
|
-
}, {
|
|
930
|
-
type: Inject,
|
|
931
|
-
args: [CDK_MENU]
|
|
932
|
-
}] }, { type: undefined, decorators: [{
|
|
933
|
-
type: Optional
|
|
934
|
-
}, {
|
|
935
|
-
type: Inject,
|
|
936
|
-
args: [MENU_AIM]
|
|
937
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
938
|
-
type: Optional
|
|
939
|
-
}] }, { type: CdkMenuItemTrigger, decorators: [{
|
|
940
|
-
type: Self
|
|
941
|
-
}, {
|
|
942
|
-
type: Optional
|
|
943
|
-
}] }];
|
|
944
|
-
}, propDecorators: { disabled: [{
|
|
945
|
-
type: Input
|
|
946
|
-
}], triggered: [{
|
|
947
|
-
type: Output,
|
|
948
|
-
args: ['cdkMenuItemTriggered']
|
|
949
|
-
}] } });
|
|
950
|
-
|
|
951
|
-
/**
|
|
952
|
-
* @license
|
|
953
|
-
* Copyright Google LLC All Rights Reserved.
|
|
954
|
-
*
|
|
955
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
956
|
-
* found in the LICENSE file at https://angular.io/license
|
|
957
|
-
*/
|
|
958
|
-
/** Counter used to set a unique id and name for a selectable item */
|
|
959
|
-
let nextId = 0;
|
|
960
|
-
/**
|
|
961
|
-
* Base class providing checked state for MenuItems along with outputting a clicked event when the
|
|
962
|
-
* element is triggered. It provides functionality for selectable elements.
|
|
963
|
-
*/
|
|
964
|
-
class CdkMenuItemSelectable extends CdkMenuItem {
|
|
965
|
-
constructor() {
|
|
966
|
-
super(...arguments);
|
|
967
|
-
/** Event emitted when the selectable item is clicked */
|
|
968
|
-
this.toggled = new EventEmitter();
|
|
969
|
-
this._checked = false;
|
|
970
|
-
/** The name of the selectable element with a default value */
|
|
971
|
-
this.name = `cdk-selectable-item-${nextId++}`;
|
|
972
|
-
/** The id of the selectable element with a default value */
|
|
973
|
-
this.id = `cdk-selectable-item-${nextId++}`;
|
|
974
|
-
}
|
|
975
|
-
/** Whether the element is checked */
|
|
976
|
-
get checked() {
|
|
977
|
-
return this._checked;
|
|
978
|
-
}
|
|
979
|
-
set checked(value) {
|
|
980
|
-
this._checked = coerceBooleanProperty(value);
|
|
981
|
-
}
|
|
982
|
-
/** If the element is not disabled emit the click event */
|
|
983
|
-
trigger() {
|
|
984
|
-
if (!this.disabled) {
|
|
985
|
-
this.toggled.next(this);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
CdkMenuItemSelectable.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItemSelectable, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
990
|
-
CdkMenuItemSelectable.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuItemSelectable, inputs: { checked: "checked", name: "name", id: "id" }, outputs: { toggled: "cdkMenuItemToggled" }, usesInheritance: true, ngImport: i0 });
|
|
991
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItemSelectable, decorators: [{
|
|
992
|
-
type: Directive
|
|
993
|
-
}], propDecorators: { toggled: [{
|
|
994
|
-
type: Output,
|
|
995
|
-
args: ['cdkMenuItemToggled']
|
|
996
|
-
}], checked: [{
|
|
997
|
-
type: Input
|
|
998
|
-
}], name: [{
|
|
999
|
-
type: Input
|
|
1000
|
-
}], id: [{
|
|
1001
|
-
type: Input
|
|
1002
|
-
}] } });
|
|
1003
|
-
|
|
1004
|
-
/**
|
|
1005
|
-
* @license
|
|
1006
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1007
|
-
*
|
|
1008
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1009
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1010
|
-
*/
|
|
1011
|
-
/**
|
|
1012
|
-
* Directive which acts as a grouping container for `CdkMenuItem` instances with
|
|
1013
|
-
* `role="menuitemradio"`, similar to a `role="radiogroup"` element.
|
|
1014
|
-
*/
|
|
1015
|
-
class CdkMenuGroup {
|
|
1016
|
-
constructor() {
|
|
1017
|
-
/** Emits the element when checkbox or radiobutton state changed */
|
|
1018
|
-
this.change = new EventEmitter();
|
|
1019
|
-
/** Emits when the _selectableItems QueryList triggers a change */
|
|
1020
|
-
this._selectableChanges = new EventEmitter();
|
|
1021
|
-
}
|
|
1022
|
-
ngAfterContentInit() {
|
|
1023
|
-
this._registerMenuSelectionListeners();
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Register the child selectable elements with the change emitter and ensure any new child
|
|
1027
|
-
* elements do so as well.
|
|
1028
|
-
*/
|
|
1029
|
-
_registerMenuSelectionListeners() {
|
|
1030
|
-
this._selectableItems.forEach(selectable => this._registerClickListener(selectable));
|
|
1031
|
-
this._selectableItems.changes.subscribe((selectableItems) => {
|
|
1032
|
-
this._selectableChanges.next();
|
|
1033
|
-
selectableItems.forEach(selectable => this._registerClickListener(selectable));
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1036
|
-
/** Register each selectable to emit on the change Emitter when clicked */
|
|
1037
|
-
_registerClickListener(selectable) {
|
|
1038
|
-
selectable.toggled
|
|
1039
|
-
.pipe(takeUntil(this._selectableChanges))
|
|
1040
|
-
.subscribe(() => this.change.next(selectable));
|
|
1041
|
-
}
|
|
1042
|
-
ngOnDestroy() {
|
|
1043
|
-
this._selectableChanges.next();
|
|
1044
|
-
this._selectableChanges.complete();
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
CdkMenuGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1048
|
-
CdkMenuGroup.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuGroup, selector: "[cdkMenuGroup]", outputs: { change: "change" }, host: { attributes: { "role": "group" }, classAttribute: "cdk-menu-group" }, providers: [{ provide: UniqueSelectionDispatcher, useClass: UniqueSelectionDispatcher }], queries: [{ propertyName: "_selectableItems", predicate: CdkMenuItemSelectable, descendants: true }], exportAs: ["cdkMenuGroup"], ngImport: i0 });
|
|
1049
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuGroup, decorators: [{
|
|
1050
|
-
type: Directive,
|
|
1051
|
-
args: [{
|
|
1052
|
-
selector: '[cdkMenuGroup]',
|
|
1053
|
-
exportAs: 'cdkMenuGroup',
|
|
1054
|
-
host: {
|
|
1055
|
-
'role': 'group',
|
|
1056
|
-
'class': 'cdk-menu-group',
|
|
1057
|
-
},
|
|
1058
|
-
providers: [{ provide: UniqueSelectionDispatcher, useClass: UniqueSelectionDispatcher }],
|
|
1059
|
-
}]
|
|
1060
|
-
}], propDecorators: { change: [{
|
|
1061
|
-
type: Output
|
|
1062
|
-
}], _selectableItems: [{
|
|
1063
|
-
type: ContentChildren,
|
|
1064
|
-
args: [CdkMenuItemSelectable, { descendants: true }]
|
|
1065
|
-
}] } });
|
|
1066
|
-
|
|
1067
|
-
/**
|
|
1068
|
-
* @license
|
|
1069
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1070
|
-
*
|
|
1071
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1072
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1073
|
-
*/
|
|
1074
|
-
/**
|
|
1075
|
-
* PointerFocusTracker keeps track of the currently active item under mouse focus. It also has
|
|
1076
|
-
* observables which emit when the users mouse enters and leaves a tracked element.
|
|
1077
|
-
*/
|
|
1078
|
-
class PointerFocusTracker {
|
|
1079
|
-
constructor(_items) {
|
|
1080
|
-
this._items = _items;
|
|
1081
|
-
/** Emits when an element is moused into. */
|
|
1082
|
-
this.entered = this._getItemPointerEntries();
|
|
1083
|
-
/** Emits when an element is moused out. */
|
|
1084
|
-
this.exited = this._getItemPointerExits();
|
|
1085
|
-
/** Emits when this is destroyed. */
|
|
1086
|
-
this._destroyed = new Subject();
|
|
1087
|
-
this.entered.subscribe(element => (this.activeElement = element));
|
|
1088
|
-
this.exited.subscribe(() => {
|
|
1089
|
-
this.previousElement = this.activeElement;
|
|
1090
|
-
this.activeElement = undefined;
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Gets a stream of pointer (mouse) entries into the given items.
|
|
1095
|
-
* This should typically run outside the Angular zone.
|
|
1096
|
-
*/
|
|
1097
|
-
_getItemPointerEntries() {
|
|
1098
|
-
return defer(() => this._items.changes.pipe(startWith(this._items), mergeMap((list) => list.map(element => fromEvent(element._elementRef.nativeElement, 'mouseenter').pipe(mapTo(element), takeUntil(this._items.changes)))), mergeAll()));
|
|
1099
|
-
}
|
|
1100
|
-
/**
|
|
1101
|
-
* Gets a stream of pointer (mouse) exits out of the given items.
|
|
1102
|
-
* This should typically run outside the Angular zone.
|
|
1103
|
-
*/
|
|
1104
|
-
_getItemPointerExits() {
|
|
1105
|
-
return defer(() => this._items.changes.pipe(startWith(this._items), mergeMap((list) => list.map(element => fromEvent(element._elementRef.nativeElement, 'mouseout').pipe(mapTo(element), takeUntil(this._items.changes)))), mergeAll()));
|
|
1106
|
-
}
|
|
1107
|
-
/** Stop the managers listeners. */
|
|
1108
|
-
destroy() {
|
|
1109
|
-
this._destroyed.next();
|
|
1110
|
-
this._destroyed.complete();
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
/**
|
|
1115
|
-
* @license
|
|
1116
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1117
|
-
*
|
|
1118
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1119
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1120
|
-
*/
|
|
1121
|
-
/**
|
|
1122
|
-
* Directive applied to an ng-template which wraps a CdkMenu and provides a reference to the
|
|
1123
|
-
* child element it wraps which allows for opening of the CdkMenu in an overlay.
|
|
1124
|
-
*/
|
|
1125
|
-
class CdkMenuPanel {
|
|
1126
|
-
constructor(_templateRef) {
|
|
1127
|
-
this._templateRef = _templateRef;
|
|
1128
|
-
}
|
|
1129
|
-
/**
|
|
1130
|
-
* Set the Menu component on the menu panel. Since we cannot use ContentChild to fetch the
|
|
1131
|
-
* child Menu component, the child Menu must register its self with the parent MenuPanel.
|
|
1132
|
-
*/
|
|
1133
|
-
_registerMenu(child) {
|
|
1134
|
-
var _a;
|
|
1135
|
-
this._menu = child;
|
|
1136
|
-
// The ideal solution would be to affect the CdkMenuPanel injector from the CdkMenuTrigger and
|
|
1137
|
-
// inject the menu stack reference into the child menu and menu items, however this isn't
|
|
1138
|
-
// possible at this time.
|
|
1139
|
-
this._menu._menuStack = this._menuStack;
|
|
1140
|
-
(_a = this._menuStack) === null || _a === void 0 ? void 0 : _a.push(child);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
CdkMenuPanel.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuPanel, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1144
|
-
CdkMenuPanel.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuPanel, selector: "ng-template[cdkMenuPanel]", exportAs: ["cdkMenuPanel"], ngImport: i0 });
|
|
1145
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuPanel, decorators: [{
|
|
1146
|
-
type: Directive,
|
|
1147
|
-
args: [{ selector: 'ng-template[cdkMenuPanel]', exportAs: 'cdkMenuPanel' }]
|
|
1148
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
1149
|
-
|
|
1150
|
-
/**
|
|
1151
|
-
* @license
|
|
1152
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1153
|
-
*
|
|
1154
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1155
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1156
|
-
*/
|
|
1157
|
-
/**
|
|
1158
|
-
* Directive which configures the element as a Menu which should contain child elements marked as
|
|
1159
|
-
* CdkMenuItem or CdkMenuGroup. Sets the appropriate role and aria-attributes for a menu and
|
|
1160
|
-
* contains accessible keyboard and mouse handling logic.
|
|
1161
|
-
*
|
|
1162
|
-
* It also acts as a RadioGroup for elements marked with role `menuitemradio`.
|
|
1163
|
-
*/
|
|
1164
|
-
class CdkMenu extends CdkMenuGroup {
|
|
1165
|
-
constructor(_ngZone, _elementRef, _menuAim, _dir,
|
|
1166
|
-
// `CdkMenuPanel` is always used in combination with a `CdkMenu`.
|
|
1167
|
-
// tslint:disable-next-line: lightweight-tokens
|
|
1168
|
-
_menuPanel) {
|
|
1169
|
-
super();
|
|
1170
|
-
this._ngZone = _ngZone;
|
|
1171
|
-
this._elementRef = _elementRef;
|
|
1172
|
-
this._menuAim = _menuAim;
|
|
1173
|
-
this._dir = _dir;
|
|
1174
|
-
this._menuPanel = _menuPanel;
|
|
1175
|
-
/**
|
|
1176
|
-
* Sets the aria-orientation attribute and determines where menus will be opened.
|
|
1177
|
-
* Does not affect styling/layout.
|
|
1178
|
-
*/
|
|
1179
|
-
this.orientation = 'vertical';
|
|
1180
|
-
/** Event emitted when the menu is closed. */
|
|
1181
|
-
this.closed = new EventEmitter();
|
|
1182
|
-
// We provide a default MenuStack implementation in case the menu is an inline menu.
|
|
1183
|
-
// For Menus part of a MenuBar nested within a MenuPanel this will be overwritten
|
|
1184
|
-
// to the correct parent MenuStack.
|
|
1185
|
-
/** Track the Menus making up the open menu stack. */
|
|
1186
|
-
this._menuStack = new NoopMenuStack();
|
|
1187
|
-
}
|
|
1188
|
-
ngOnInit() {
|
|
1189
|
-
this._registerWithParentPanel();
|
|
1190
|
-
}
|
|
1191
|
-
ngAfterContentInit() {
|
|
1192
|
-
var _a;
|
|
1193
|
-
super.ngAfterContentInit();
|
|
1194
|
-
this._completeChangeEmitter();
|
|
1195
|
-
this._setKeyManager();
|
|
1196
|
-
this._subscribeToMenuOpen();
|
|
1197
|
-
this._subscribeToMenuStack();
|
|
1198
|
-
this._subscribeToMouseManager();
|
|
1199
|
-
(_a = this._menuAim) === null || _a === void 0 ? void 0 : _a.initialize(this, this._pointerTracker);
|
|
1200
|
-
}
|
|
1201
|
-
/** Place focus on the first MenuItem in the menu and set the focus origin. */
|
|
1202
|
-
focusFirstItem(focusOrigin = 'program') {
|
|
1203
|
-
this._keyManager.setFocusOrigin(focusOrigin);
|
|
1204
|
-
this._keyManager.setFirstItemActive();
|
|
1205
|
-
}
|
|
1206
|
-
/** Place focus on the last MenuItem in the menu and set the focus origin. */
|
|
1207
|
-
focusLastItem(focusOrigin = 'program') {
|
|
1208
|
-
this._keyManager.setFocusOrigin(focusOrigin);
|
|
1209
|
-
this._keyManager.setLastItemActive();
|
|
1210
|
-
}
|
|
1211
|
-
/** Handle keyboard events for the Menu. */
|
|
1212
|
-
_handleKeyEvent(event) {
|
|
1213
|
-
const keyManager = this._keyManager;
|
|
1214
|
-
switch (event.keyCode) {
|
|
1215
|
-
case LEFT_ARROW:
|
|
1216
|
-
case RIGHT_ARROW:
|
|
1217
|
-
if (this._isHorizontal()) {
|
|
1218
|
-
event.preventDefault();
|
|
1219
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1220
|
-
keyManager.onKeydown(event);
|
|
1221
|
-
}
|
|
1222
|
-
break;
|
|
1223
|
-
case UP_ARROW:
|
|
1224
|
-
case DOWN_ARROW:
|
|
1225
|
-
if (!this._isHorizontal()) {
|
|
1226
|
-
event.preventDefault();
|
|
1227
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1228
|
-
keyManager.onKeydown(event);
|
|
1229
|
-
}
|
|
1230
|
-
break;
|
|
1231
|
-
case ESCAPE:
|
|
1232
|
-
if (!hasModifierKey(event)) {
|
|
1233
|
-
event.preventDefault();
|
|
1234
|
-
this._menuStack.close(this, 2 /* currentItem */);
|
|
1235
|
-
}
|
|
1236
|
-
break;
|
|
1237
|
-
case TAB:
|
|
1238
|
-
this._menuStack.closeAll();
|
|
1239
|
-
break;
|
|
1240
|
-
default:
|
|
1241
|
-
keyManager.onKeydown(event);
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
/** Register this menu with its enclosing parent menu panel */
|
|
1245
|
-
_registerWithParentPanel() {
|
|
1246
|
-
var _a;
|
|
1247
|
-
(_a = this._getMenuPanel()) === null || _a === void 0 ? void 0 : _a._registerMenu(this);
|
|
1248
|
-
}
|
|
1249
|
-
/**
|
|
1250
|
-
* Get the enclosing CdkMenuPanel defaulting to the injected reference over the developer
|
|
1251
|
-
* provided reference.
|
|
1252
|
-
*/
|
|
1253
|
-
_getMenuPanel() {
|
|
1254
|
-
return this._menuPanel || this._explicitPanel;
|
|
1255
|
-
}
|
|
1256
|
-
/**
|
|
1257
|
-
* Complete the change emitter if there are any nested MenuGroups or register to complete the
|
|
1258
|
-
* change emitter if a MenuGroup is rendered at some point
|
|
1259
|
-
*/
|
|
1260
|
-
_completeChangeEmitter() {
|
|
1261
|
-
if (this._hasNestedGroups()) {
|
|
1262
|
-
this.change.complete();
|
|
1263
|
-
}
|
|
1264
|
-
else {
|
|
1265
|
-
this._nestedGroups.changes.pipe(take(1)).subscribe(() => this.change.complete());
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
/** Return true if there are nested CdkMenuGroup elements within the Menu */
|
|
1269
|
-
_hasNestedGroups() {
|
|
1270
|
-
// view engine has a bug where @ContentChildren will return the current element
|
|
1271
|
-
// along with children if the selectors match - not just the children.
|
|
1272
|
-
// Here, if there is at least one element, we check to see if the first element is a CdkMenu in
|
|
1273
|
-
// order to ensure that we return true iff there are child CdkMenuGroup elements.
|
|
1274
|
-
return this._nestedGroups.length > 0 && !(this._nestedGroups.first instanceof CdkMenu);
|
|
1275
|
-
}
|
|
1276
|
-
/** Setup the FocusKeyManager with the correct orientation for the menu. */
|
|
1277
|
-
_setKeyManager() {
|
|
1278
|
-
var _a;
|
|
1279
|
-
this._keyManager = new FocusKeyManager(this._allItems)
|
|
1280
|
-
.withWrap()
|
|
1281
|
-
.withTypeAhead()
|
|
1282
|
-
.withHomeAndEnd();
|
|
1283
|
-
if (this._isHorizontal()) {
|
|
1284
|
-
this._keyManager.withHorizontalOrientation(((_a = this._dir) === null || _a === void 0 ? void 0 : _a.value) || 'ltr');
|
|
1285
|
-
}
|
|
1286
|
-
else {
|
|
1287
|
-
this._keyManager.withVerticalOrientation();
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
/**
|
|
1291
|
-
* Set the PointerFocusTracker and ensure that when mouse focus changes the key manager is updated
|
|
1292
|
-
* with the latest menu item under mouse focus.
|
|
1293
|
-
*/
|
|
1294
|
-
_subscribeToMouseManager() {
|
|
1295
|
-
this._ngZone.runOutsideAngular(() => {
|
|
1296
|
-
this._pointerTracker = new PointerFocusTracker(this._allItems);
|
|
1297
|
-
this._pointerTracker.entered
|
|
1298
|
-
.pipe(takeUntil(this.closed))
|
|
1299
|
-
.subscribe(item => this._keyManager.setActiveItem(item));
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
/** Subscribe to the MenuStack close and empty observables. */
|
|
1303
|
-
_subscribeToMenuStack() {
|
|
1304
|
-
this._menuStack.closed
|
|
1305
|
-
.pipe(takeUntil(this.closed))
|
|
1306
|
-
.subscribe(item => this._closeOpenMenu(item));
|
|
1307
|
-
this._menuStack.emptied
|
|
1308
|
-
.pipe(takeUntil(this.closed))
|
|
1309
|
-
.subscribe(event => this._toggleMenuFocus(event));
|
|
1310
|
-
}
|
|
1311
|
-
/**
|
|
1312
|
-
* Close the open menu if the current active item opened the requested MenuStackItem.
|
|
1313
|
-
* @param item the MenuStackItem requested to be closed.
|
|
1314
|
-
*/
|
|
1315
|
-
_closeOpenMenu(menu) {
|
|
1316
|
-
var _a, _b, _c;
|
|
1317
|
-
const keyManager = this._keyManager;
|
|
1318
|
-
const trigger = this._openItem;
|
|
1319
|
-
if (menu === ((_a = trigger === null || trigger === void 0 ? void 0 : trigger.getMenuTrigger()) === null || _a === void 0 ? void 0 : _a.getMenu())) {
|
|
1320
|
-
(_b = trigger === null || trigger === void 0 ? void 0 : trigger.getMenuTrigger()) === null || _b === void 0 ? void 0 : _b.closeMenu();
|
|
1321
|
-
// If the user has moused over a sibling item we want to focus the element under mouse focus
|
|
1322
|
-
// not the trigger which previously opened the now closed menu.
|
|
1323
|
-
if (trigger) {
|
|
1324
|
-
keyManager.setActiveItem(((_c = this._pointerTracker) === null || _c === void 0 ? void 0 : _c.activeElement) || trigger);
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
/** Set focus the either the current, previous or next item based on the FocusNext event. */
|
|
1329
|
-
_toggleMenuFocus(event) {
|
|
1330
|
-
const keyManager = this._keyManager;
|
|
1331
|
-
switch (event) {
|
|
1332
|
-
case 0 /* nextItem */:
|
|
1333
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1334
|
-
keyManager.setNextItemActive();
|
|
1335
|
-
break;
|
|
1336
|
-
case 1 /* previousItem */:
|
|
1337
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1338
|
-
keyManager.setPreviousItemActive();
|
|
1339
|
-
break;
|
|
1340
|
-
case 2 /* currentItem */:
|
|
1341
|
-
if (keyManager.activeItem) {
|
|
1342
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1343
|
-
keyManager.setActiveItem(keyManager.activeItem);
|
|
1344
|
-
}
|
|
1345
|
-
break;
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
// TODO(andy9775): remove duplicate logic between menu an menu bar
|
|
1349
|
-
/**
|
|
1350
|
-
* Subscribe to the menu trigger's open events in order to track the trigger which opened the menu
|
|
1351
|
-
* and stop tracking it when the menu is closed.
|
|
1352
|
-
*/
|
|
1353
|
-
_subscribeToMenuOpen() {
|
|
1354
|
-
const exitCondition = merge(this._allItems.changes, this.closed);
|
|
1355
|
-
this._allItems.changes
|
|
1356
|
-
.pipe(startWith(this._allItems), mergeMap((list) => list
|
|
1357
|
-
.filter(item => item.hasMenu())
|
|
1358
|
-
.map(item => item.getMenuTrigger().opened.pipe(mapTo(item), takeUntil(exitCondition)))), mergeAll(), switchMap((item) => {
|
|
1359
|
-
this._openItem = item;
|
|
1360
|
-
return item.getMenuTrigger().closed;
|
|
1361
|
-
}), takeUntil(this.closed))
|
|
1362
|
-
.subscribe(() => (this._openItem = undefined));
|
|
1363
|
-
}
|
|
1364
|
-
/** Return true if this menu has been configured in a horizontal orientation. */
|
|
1365
|
-
_isHorizontal() {
|
|
1366
|
-
return this.orientation === 'horizontal';
|
|
1367
|
-
}
|
|
1368
|
-
/**
|
|
1369
|
-
* Return true if this menu is an inline menu. That is, it does not exist in a pop-up and is
|
|
1370
|
-
* always visible in the dom.
|
|
1371
|
-
*/
|
|
1372
|
-
_isInline() {
|
|
1373
|
-
// NoopMenuStack is the default. If this menu is not inline than the NoopMenuStack is replaced
|
|
1374
|
-
// automatically.
|
|
1375
|
-
return this._menuStack instanceof NoopMenuStack;
|
|
1376
|
-
}
|
|
1377
|
-
ngOnDestroy() {
|
|
1378
|
-
var _a;
|
|
1379
|
-
super.ngOnDestroy();
|
|
1380
|
-
this._emitClosedEvent();
|
|
1381
|
-
(_a = this._pointerTracker) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1382
|
-
}
|
|
1383
|
-
/** Emit and complete the closed event emitter */
|
|
1384
|
-
_emitClosedEvent() {
|
|
1385
|
-
this.closed.next();
|
|
1386
|
-
this.closed.complete();
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
CdkMenu.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenu, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: MENU_AIM, optional: true, self: true }, { token: i2.Directionality, optional: true }, { token: CdkMenuPanel, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1390
|
-
CdkMenu.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenu, selector: "[cdkMenu]", inputs: { orientation: ["cdkMenuOrientation", "orientation"], _explicitPanel: ["cdkMenuPanel", "_explicitPanel"] }, outputs: { closed: "closed" }, host: { attributes: { "role": "menu" }, listeners: { "focus": "focusFirstItem()", "keydown": "_handleKeyEvent($event)" }, properties: { "tabindex": "_isInline() ? 0 : null", "class.cdk-menu-inline": "_isInline()", "attr.aria-orientation": "orientation" }, classAttribute: "cdk-menu" }, providers: [
|
|
1391
|
-
{ provide: CdkMenuGroup, useExisting: CdkMenu },
|
|
1392
|
-
{ provide: CDK_MENU, useExisting: CdkMenu },
|
|
1393
|
-
], queries: [{ propertyName: "_nestedGroups", predicate: CdkMenuGroup, descendants: true }, { propertyName: "_allItems", predicate: CdkMenuItem, descendants: true }], exportAs: ["cdkMenu"], usesInheritance: true, ngImport: i0 });
|
|
1394
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenu, decorators: [{
|
|
1395
|
-
type: Directive,
|
|
1396
|
-
args: [{
|
|
1397
|
-
selector: '[cdkMenu]',
|
|
1398
|
-
exportAs: 'cdkMenu',
|
|
1399
|
-
host: {
|
|
1400
|
-
'[tabindex]': '_isInline() ? 0 : null',
|
|
1401
|
-
'role': 'menu',
|
|
1402
|
-
'class': 'cdk-menu',
|
|
1403
|
-
'[class.cdk-menu-inline]': '_isInline()',
|
|
1404
|
-
'[attr.aria-orientation]': 'orientation',
|
|
1405
|
-
'(focus)': 'focusFirstItem()',
|
|
1406
|
-
'(keydown)': '_handleKeyEvent($event)',
|
|
1407
|
-
},
|
|
1408
|
-
providers: [
|
|
1409
|
-
{ provide: CdkMenuGroup, useExisting: CdkMenu },
|
|
1410
|
-
{ provide: CDK_MENU, useExisting: CdkMenu },
|
|
1411
|
-
],
|
|
1412
|
-
}]
|
|
1413
|
-
}], ctorParameters: function () {
|
|
1414
|
-
return [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
1415
|
-
type: Self
|
|
1416
|
-
}, {
|
|
1417
|
-
type: Optional
|
|
1418
|
-
}, {
|
|
1419
|
-
type: Inject,
|
|
1420
|
-
args: [MENU_AIM]
|
|
1421
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
1422
|
-
type: Optional
|
|
1423
|
-
}] }, { type: CdkMenuPanel, decorators: [{
|
|
1424
|
-
type: Optional
|
|
1425
|
-
}] }];
|
|
1426
|
-
}, propDecorators: { orientation: [{
|
|
1427
|
-
type: Input,
|
|
1428
|
-
args: ['cdkMenuOrientation']
|
|
1429
|
-
}], closed: [{
|
|
1430
|
-
type: Output
|
|
1431
|
-
}], _nestedGroups: [{
|
|
1432
|
-
type: ContentChildren,
|
|
1433
|
-
args: [CdkMenuGroup, { descendants: true }]
|
|
1434
|
-
}], _allItems: [{
|
|
1435
|
-
type: ContentChildren,
|
|
1436
|
-
args: [CdkMenuItem, { descendants: true }]
|
|
1437
|
-
}], _explicitPanel: [{
|
|
1438
|
-
type: Input,
|
|
1439
|
-
args: ['cdkMenuPanel']
|
|
1440
|
-
}] } });
|
|
1441
|
-
|
|
1442
|
-
/**
|
|
1443
|
-
* @license
|
|
1444
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1445
|
-
*
|
|
1446
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1447
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1448
|
-
*/
|
|
1449
|
-
/**
|
|
1450
|
-
* Directive applied to an element which configures it as a MenuBar by setting the appropriate
|
|
1451
|
-
* role, aria attributes, and accessible keyboard and mouse handling logic. The component that
|
|
1452
|
-
* this directive is applied to should contain components marked with CdkMenuItem.
|
|
1453
|
-
*
|
|
1454
|
-
*/
|
|
1455
|
-
class CdkMenuBar extends CdkMenuGroup {
|
|
1456
|
-
constructor(_menuStack, _ngZone, _elementRef, _menuAim, _dir) {
|
|
1457
|
-
super();
|
|
1458
|
-
this._menuStack = _menuStack;
|
|
1459
|
-
this._ngZone = _ngZone;
|
|
1460
|
-
this._elementRef = _elementRef;
|
|
1461
|
-
this._menuAim = _menuAim;
|
|
1462
|
-
this._dir = _dir;
|
|
1463
|
-
/**
|
|
1464
|
-
* Sets the aria-orientation attribute and determines where menus will be opened.
|
|
1465
|
-
* Does not affect styling/layout.
|
|
1466
|
-
*/
|
|
1467
|
-
this.orientation = 'horizontal';
|
|
1468
|
-
/** Emits when the MenuBar is destroyed. */
|
|
1469
|
-
this._destroyed = new Subject();
|
|
1470
|
-
}
|
|
1471
|
-
ngAfterContentInit() {
|
|
1472
|
-
var _a;
|
|
1473
|
-
super.ngAfterContentInit();
|
|
1474
|
-
this._setKeyManager();
|
|
1475
|
-
this._subscribeToMenuOpen();
|
|
1476
|
-
this._subscribeToMenuStack();
|
|
1477
|
-
this._subscribeToMouseManager();
|
|
1478
|
-
(_a = this._menuAim) === null || _a === void 0 ? void 0 : _a.initialize(this, this._pointerTracker);
|
|
1479
|
-
}
|
|
1480
|
-
/** Place focus on the first MenuItem in the menu and set the focus origin. */
|
|
1481
|
-
focusFirstItem(focusOrigin = 'program') {
|
|
1482
|
-
this._keyManager.setFocusOrigin(focusOrigin);
|
|
1483
|
-
this._keyManager.setFirstItemActive();
|
|
1484
|
-
}
|
|
1485
|
-
/** Place focus on the last MenuItem in the menu and set the focus origin. */
|
|
1486
|
-
focusLastItem(focusOrigin = 'program') {
|
|
1487
|
-
this._keyManager.setFocusOrigin(focusOrigin);
|
|
1488
|
-
this._keyManager.setLastItemActive();
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* Handle keyboard events, specifically changing the focused element and/or toggling the active
|
|
1492
|
-
* items menu.
|
|
1493
|
-
* @param event the KeyboardEvent to handle.
|
|
1494
|
-
*/
|
|
1495
|
-
_handleKeyEvent(event) {
|
|
1496
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1497
|
-
const keyManager = this._keyManager;
|
|
1498
|
-
switch (event.keyCode) {
|
|
1499
|
-
case UP_ARROW:
|
|
1500
|
-
case DOWN_ARROW:
|
|
1501
|
-
case LEFT_ARROW:
|
|
1502
|
-
case RIGHT_ARROW:
|
|
1503
|
-
const horizontalArrows = event.keyCode === LEFT_ARROW || event.keyCode === RIGHT_ARROW;
|
|
1504
|
-
// For a horizontal menu if the left/right keys were clicked, or a vertical menu if the
|
|
1505
|
-
// up/down keys were clicked: if the current menu is open, close it then focus and open the
|
|
1506
|
-
// next menu.
|
|
1507
|
-
if ((this._isHorizontal() && horizontalArrows) ||
|
|
1508
|
-
(!this._isHorizontal() && !horizontalArrows)) {
|
|
1509
|
-
event.preventDefault();
|
|
1510
|
-
const prevIsOpen = (_a = keyManager.activeItem) === null || _a === void 0 ? void 0 : _a.isMenuOpen();
|
|
1511
|
-
(_c = (_b = keyManager.activeItem) === null || _b === void 0 ? void 0 : _b.getMenuTrigger()) === null || _c === void 0 ? void 0 : _c.closeMenu();
|
|
1512
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1513
|
-
keyManager.onKeydown(event);
|
|
1514
|
-
if (prevIsOpen) {
|
|
1515
|
-
(_e = (_d = keyManager.activeItem) === null || _d === void 0 ? void 0 : _d.getMenuTrigger()) === null || _e === void 0 ? void 0 : _e.openMenu();
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
break;
|
|
1519
|
-
case ESCAPE:
|
|
1520
|
-
event.preventDefault();
|
|
1521
|
-
(_g = (_f = keyManager.activeItem) === null || _f === void 0 ? void 0 : _f.getMenuTrigger()) === null || _g === void 0 ? void 0 : _g.closeMenu();
|
|
1522
|
-
break;
|
|
1523
|
-
case TAB:
|
|
1524
|
-
(_j = (_h = keyManager.activeItem) === null || _h === void 0 ? void 0 : _h.getMenuTrigger()) === null || _j === void 0 ? void 0 : _j.closeMenu();
|
|
1525
|
-
break;
|
|
1526
|
-
default:
|
|
1527
|
-
keyManager.onKeydown(event);
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
/** Setup the FocusKeyManager with the correct orientation for the menu bar. */
|
|
1531
|
-
_setKeyManager() {
|
|
1532
|
-
var _a;
|
|
1533
|
-
this._keyManager = new FocusKeyManager(this._allItems)
|
|
1534
|
-
.withWrap()
|
|
1535
|
-
.withTypeAhead()
|
|
1536
|
-
.withHomeAndEnd();
|
|
1537
|
-
if (this._isHorizontal()) {
|
|
1538
|
-
this._keyManager.withHorizontalOrientation(((_a = this._dir) === null || _a === void 0 ? void 0 : _a.value) || 'ltr');
|
|
1539
|
-
}
|
|
1540
|
-
else {
|
|
1541
|
-
this._keyManager.withVerticalOrientation();
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
/**
|
|
1545
|
-
* Set the PointerFocusTracker and ensure that when mouse focus changes the key manager is updated
|
|
1546
|
-
* with the latest menu item under mouse focus.
|
|
1547
|
-
*/
|
|
1548
|
-
_subscribeToMouseManager() {
|
|
1549
|
-
this._ngZone.runOutsideAngular(() => {
|
|
1550
|
-
this._pointerTracker = new PointerFocusTracker(this._allItems);
|
|
1551
|
-
this._pointerTracker.entered.pipe(takeUntil(this._destroyed)).subscribe(item => {
|
|
1552
|
-
if (this._hasOpenSubmenu()) {
|
|
1553
|
-
this._keyManager.setActiveItem(item);
|
|
1554
|
-
}
|
|
1555
|
-
});
|
|
1556
|
-
});
|
|
1557
|
-
}
|
|
1558
|
-
/** Subscribe to the MenuStack close and empty observables. */
|
|
1559
|
-
_subscribeToMenuStack() {
|
|
1560
|
-
this._menuStack.closed
|
|
1561
|
-
.pipe(takeUntil(this._destroyed))
|
|
1562
|
-
.subscribe(item => this._closeOpenMenu(item));
|
|
1563
|
-
this._menuStack.emptied
|
|
1564
|
-
.pipe(takeUntil(this._destroyed))
|
|
1565
|
-
.subscribe(event => this._toggleOpenMenu(event));
|
|
1566
|
-
}
|
|
1567
|
-
/**
|
|
1568
|
-
* Close the open menu if the current active item opened the requested MenuStackItem.
|
|
1569
|
-
* @param item the MenuStackItem requested to be closed.
|
|
1570
|
-
*/
|
|
1571
|
-
_closeOpenMenu(menu) {
|
|
1572
|
-
var _a, _b, _c;
|
|
1573
|
-
const trigger = this._openItem;
|
|
1574
|
-
const keyManager = this._keyManager;
|
|
1575
|
-
if (menu === ((_a = trigger === null || trigger === void 0 ? void 0 : trigger.getMenuTrigger()) === null || _a === void 0 ? void 0 : _a.getMenu())) {
|
|
1576
|
-
(_b = trigger === null || trigger === void 0 ? void 0 : trigger.getMenuTrigger()) === null || _b === void 0 ? void 0 : _b.closeMenu();
|
|
1577
|
-
// If the user has moused over a sibling item we want to focus the element under mouse focus
|
|
1578
|
-
// not the trigger which previously opened the now closed menu.
|
|
1579
|
-
if (trigger) {
|
|
1580
|
-
keyManager.setActiveItem(((_c = this._pointerTracker) === null || _c === void 0 ? void 0 : _c.activeElement) || trigger);
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
/**
|
|
1585
|
-
* Set focus to either the current, previous or next item based on the FocusNext event, then
|
|
1586
|
-
* open the previous or next item.
|
|
1587
|
-
*/
|
|
1588
|
-
_toggleOpenMenu(event) {
|
|
1589
|
-
var _a, _b, _c, _d;
|
|
1590
|
-
const keyManager = this._keyManager;
|
|
1591
|
-
switch (event) {
|
|
1592
|
-
case 0 /* nextItem */:
|
|
1593
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1594
|
-
keyManager.setNextItemActive();
|
|
1595
|
-
(_b = (_a = keyManager.activeItem) === null || _a === void 0 ? void 0 : _a.getMenuTrigger()) === null || _b === void 0 ? void 0 : _b.openMenu();
|
|
1596
|
-
break;
|
|
1597
|
-
case 1 /* previousItem */:
|
|
1598
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1599
|
-
keyManager.setPreviousItemActive();
|
|
1600
|
-
(_d = (_c = keyManager.activeItem) === null || _c === void 0 ? void 0 : _c.getMenuTrigger()) === null || _d === void 0 ? void 0 : _d.openMenu();
|
|
1601
|
-
break;
|
|
1602
|
-
case 2 /* currentItem */:
|
|
1603
|
-
if (keyManager.activeItem) {
|
|
1604
|
-
keyManager.setFocusOrigin('keyboard');
|
|
1605
|
-
keyManager.setActiveItem(keyManager.activeItem);
|
|
1606
|
-
}
|
|
1607
|
-
break;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
/**
|
|
1611
|
-
* @return true if the menu bar is configured to be horizontal.
|
|
1612
|
-
*/
|
|
1613
|
-
_isHorizontal() {
|
|
1614
|
-
return this.orientation === 'horizontal';
|
|
1615
|
-
}
|
|
1616
|
-
/**
|
|
1617
|
-
* Subscribe to the menu trigger's open events in order to track the trigger which opened the menu
|
|
1618
|
-
* and stop tracking it when the menu is closed.
|
|
1619
|
-
*/
|
|
1620
|
-
_subscribeToMenuOpen() {
|
|
1621
|
-
const exitCondition = merge(this._allItems.changes, this._destroyed);
|
|
1622
|
-
this._allItems.changes
|
|
1623
|
-
.pipe(startWith(this._allItems), mergeMap((list) => list
|
|
1624
|
-
.filter(item => item.hasMenu())
|
|
1625
|
-
.map(item => item.getMenuTrigger().opened.pipe(mapTo(item), takeUntil(exitCondition)))), mergeAll(), switchMap((item) => {
|
|
1626
|
-
this._openItem = item;
|
|
1627
|
-
return item.getMenuTrigger().closed;
|
|
1628
|
-
}), takeUntil(this._destroyed))
|
|
1629
|
-
.subscribe(() => (this._openItem = undefined));
|
|
1630
|
-
}
|
|
1631
|
-
/** Return true if the MenuBar has an open submenu. */
|
|
1632
|
-
_hasOpenSubmenu() {
|
|
1633
|
-
return !!this._openItem;
|
|
1634
|
-
}
|
|
1635
|
-
ngOnDestroy() {
|
|
1636
|
-
var _a;
|
|
1637
|
-
super.ngOnDestroy();
|
|
1638
|
-
this._destroyed.next();
|
|
1639
|
-
this._destroyed.complete();
|
|
1640
|
-
(_a = this._pointerTracker) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
CdkMenuBar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuBar, deps: [{ token: MenuStack }, { token: i0.NgZone }, { token: i0.ElementRef }, { token: MENU_AIM, optional: true, self: true }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1644
|
-
CdkMenuBar.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuBar, selector: "[cdkMenuBar]", inputs: { orientation: ["cdkMenuBarOrientation", "orientation"] }, host: { attributes: { "role": "menubar", "tabindex": "0" }, listeners: { "focus": "focusFirstItem()", "keydown": "_handleKeyEvent($event)" }, properties: { "attr.aria-orientation": "orientation" }, classAttribute: "cdk-menu-bar" }, providers: [
|
|
1645
|
-
{ provide: CdkMenuGroup, useExisting: CdkMenuBar },
|
|
1646
|
-
{ provide: CDK_MENU, useExisting: CdkMenuBar },
|
|
1647
|
-
{ provide: MenuStack, useClass: MenuStack },
|
|
1648
|
-
], queries: [{ propertyName: "_allItems", predicate: CdkMenuItem, descendants: true }], exportAs: ["cdkMenuBar"], usesInheritance: true, ngImport: i0 });
|
|
1649
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuBar, decorators: [{
|
|
1650
|
-
type: Directive,
|
|
1651
|
-
args: [{
|
|
1652
|
-
selector: '[cdkMenuBar]',
|
|
1653
|
-
exportAs: 'cdkMenuBar',
|
|
1654
|
-
host: {
|
|
1655
|
-
'role': 'menubar',
|
|
1656
|
-
'class': 'cdk-menu-bar',
|
|
1657
|
-
'tabindex': '0',
|
|
1658
|
-
'[attr.aria-orientation]': 'orientation',
|
|
1659
|
-
'(focus)': 'focusFirstItem()',
|
|
1660
|
-
'(keydown)': '_handleKeyEvent($event)',
|
|
1661
|
-
},
|
|
1662
|
-
providers: [
|
|
1663
|
-
{ provide: CdkMenuGroup, useExisting: CdkMenuBar },
|
|
1664
|
-
{ provide: CDK_MENU, useExisting: CdkMenuBar },
|
|
1665
|
-
{ provide: MenuStack, useClass: MenuStack },
|
|
1666
|
-
],
|
|
1667
|
-
}]
|
|
1668
|
-
}], ctorParameters: function () {
|
|
1669
|
-
return [{ type: MenuStack }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
1670
|
-
type: Self
|
|
1671
|
-
}, {
|
|
1672
|
-
type: Optional
|
|
1673
|
-
}, {
|
|
1674
|
-
type: Inject,
|
|
1675
|
-
args: [MENU_AIM]
|
|
1676
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
1677
|
-
type: Optional
|
|
1678
|
-
}] }];
|
|
1679
|
-
}, propDecorators: { orientation: [{
|
|
1680
|
-
type: Input,
|
|
1681
|
-
args: ['cdkMenuBarOrientation']
|
|
1682
|
-
}], _allItems: [{
|
|
1683
|
-
type: ContentChildren,
|
|
1684
|
-
args: [CdkMenuItem, { descendants: true }]
|
|
1685
|
-
}] } });
|
|
1686
|
-
|
|
1687
|
-
/**
|
|
1688
|
-
* A directive providing behavior for the "menuitemradio" ARIA role, which behaves similarly to
|
|
1689
|
-
* a conventional radio-button. Any sibling `CdkMenuItemRadio` instances within the same `CdkMenu`
|
|
1690
|
-
* or `CdkMenuGroup` comprise a radio group with unique selection enforced.
|
|
1691
|
-
*/
|
|
1692
|
-
class CdkMenuItemRadio extends CdkMenuItemSelectable {
|
|
1693
|
-
constructor(_selectionDispatcher, element, ngZone, parentMenu, menuAim, dir,
|
|
1694
|
-
/** Reference to the CdkMenuItemTrigger directive if one is added to the same element */
|
|
1695
|
-
// `CdkMenuItemRadio` is commonly used in combination with a `CdkMenuItemTrigger`.
|
|
1696
|
-
// tslint:disable-next-line: lightweight-tokens
|
|
1697
|
-
menuTrigger) {
|
|
1698
|
-
super(element, ngZone, parentMenu, menuAim, dir, menuTrigger);
|
|
1699
|
-
this._selectionDispatcher = _selectionDispatcher;
|
|
1700
|
-
this._registerDispatcherListener();
|
|
1701
|
-
}
|
|
1702
|
-
/** Configure the unique selection dispatcher listener in order to toggle the checked state */
|
|
1703
|
-
_registerDispatcherListener() {
|
|
1704
|
-
this._removeDispatcherListener = this._selectionDispatcher.listen((id, name) => (this.checked = this.id === id && this.name === name));
|
|
1705
|
-
}
|
|
1706
|
-
/** Toggles the checked state of the radio-button. */
|
|
1707
|
-
trigger() {
|
|
1708
|
-
super.trigger();
|
|
1709
|
-
if (!this.disabled) {
|
|
1710
|
-
this._selectionDispatcher.notify(this.id, this.name);
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
ngOnDestroy() {
|
|
1714
|
-
super.ngOnDestroy();
|
|
1715
|
-
this._removeDispatcherListener();
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
CdkMenuItemRadio.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItemRadio, deps: [{ token: i1$1.UniqueSelectionDispatcher }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: CDK_MENU, optional: true }, { token: MENU_AIM, optional: true }, { token: i2.Directionality, optional: true }, { token: CdkMenuItemTrigger, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1719
|
-
CdkMenuItemRadio.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuItemRadio, selector: "[cdkMenuItemRadio]", host: { attributes: { "type": "button", "role": "menuitemradio" }, properties: { "tabindex": "_tabindex", "attr.aria-checked": "checked || null", "attr.aria-disabled": "disabled || null" } }, providers: [
|
|
1720
|
-
{ provide: CdkMenuItemSelectable, useExisting: CdkMenuItemRadio },
|
|
1721
|
-
{ provide: CdkMenuItem, useExisting: CdkMenuItemSelectable },
|
|
1722
|
-
], exportAs: ["cdkMenuItemRadio"], usesInheritance: true, ngImport: i0 });
|
|
1723
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItemRadio, decorators: [{
|
|
1724
|
-
type: Directive,
|
|
1725
|
-
args: [{
|
|
1726
|
-
selector: '[cdkMenuItemRadio]',
|
|
1727
|
-
exportAs: 'cdkMenuItemRadio',
|
|
1728
|
-
host: {
|
|
1729
|
-
'[tabindex]': '_tabindex',
|
|
1730
|
-
'type': 'button',
|
|
1731
|
-
'role': 'menuitemradio',
|
|
1732
|
-
'[attr.aria-checked]': 'checked || null',
|
|
1733
|
-
'[attr.aria-disabled]': 'disabled || null',
|
|
1734
|
-
},
|
|
1735
|
-
providers: [
|
|
1736
|
-
{ provide: CdkMenuItemSelectable, useExisting: CdkMenuItemRadio },
|
|
1737
|
-
{ provide: CdkMenuItem, useExisting: CdkMenuItemSelectable },
|
|
1738
|
-
],
|
|
1739
|
-
}]
|
|
1740
|
-
}], ctorParameters: function () {
|
|
1741
|
-
return [{ type: i1$1.UniqueSelectionDispatcher }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
1742
|
-
type: Optional
|
|
1743
|
-
}, {
|
|
1744
|
-
type: Inject,
|
|
1745
|
-
args: [CDK_MENU]
|
|
1746
|
-
}] }, { type: undefined, decorators: [{
|
|
1747
|
-
type: Optional
|
|
1748
|
-
}, {
|
|
1749
|
-
type: Inject,
|
|
1750
|
-
args: [MENU_AIM]
|
|
1751
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
1752
|
-
type: Optional
|
|
1753
|
-
}] }, { type: CdkMenuItemTrigger, decorators: [{
|
|
1754
|
-
type: Self
|
|
1755
|
-
}, {
|
|
1756
|
-
type: Optional
|
|
1757
|
-
}] }];
|
|
1758
|
-
} });
|
|
1759
|
-
|
|
1760
|
-
/**
|
|
1761
|
-
* @license
|
|
1762
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1763
|
-
*
|
|
1764
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1765
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1766
|
-
*/
|
|
1767
|
-
/**
|
|
1768
|
-
* A directive providing behavior for the "menuitemcheckbox" ARIA role, which behaves similarly to a
|
|
1769
|
-
* conventional checkbox.
|
|
1770
|
-
*/
|
|
1771
|
-
class CdkMenuItemCheckbox extends CdkMenuItemSelectable {
|
|
1772
|
-
/** Toggle the checked state of the checkbox. */
|
|
1773
|
-
trigger() {
|
|
1774
|
-
super.trigger();
|
|
1775
|
-
if (!this.disabled) {
|
|
1776
|
-
this.checked = !this.checked;
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
CdkMenuItemCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItemCheckbox, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1781
|
-
CdkMenuItemCheckbox.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuItemCheckbox, selector: "[cdkMenuItemCheckbox]", host: { attributes: { "type": "button", "role": "menuitemcheckbox" }, properties: { "tabindex": "_tabindex", "attr.aria-checked": "checked || null", "attr.aria-disabled": "disabled || null" } }, providers: [
|
|
1782
|
-
{ provide: CdkMenuItemSelectable, useExisting: CdkMenuItemCheckbox },
|
|
1783
|
-
{ provide: CdkMenuItem, useExisting: CdkMenuItemSelectable },
|
|
1784
|
-
], exportAs: ["cdkMenuItemCheckbox"], usesInheritance: true, ngImport: i0 });
|
|
1785
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuItemCheckbox, decorators: [{
|
|
1786
|
-
type: Directive,
|
|
1787
|
-
args: [{
|
|
1788
|
-
selector: '[cdkMenuItemCheckbox]',
|
|
1789
|
-
exportAs: 'cdkMenuItemCheckbox',
|
|
1790
|
-
host: {
|
|
1791
|
-
'[tabindex]': '_tabindex',
|
|
1792
|
-
'type': 'button',
|
|
1793
|
-
'role': 'menuitemcheckbox',
|
|
1794
|
-
'[attr.aria-checked]': 'checked || null',
|
|
1795
|
-
'[attr.aria-disabled]': 'disabled || null',
|
|
1796
|
-
},
|
|
1797
|
-
providers: [
|
|
1798
|
-
{ provide: CdkMenuItemSelectable, useExisting: CdkMenuItemCheckbox },
|
|
1799
|
-
{ provide: CdkMenuItem, useExisting: CdkMenuItemSelectable },
|
|
1800
|
-
],
|
|
1801
|
-
}]
|
|
1802
|
-
}] });
|
|
1803
|
-
|
|
1804
|
-
/**
|
|
1805
|
-
* @license
|
|
1806
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1807
|
-
*
|
|
1808
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1809
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1810
|
-
*/
|
|
1811
|
-
/** Tracks the last open context menu trigger across the entire application. */
|
|
1812
|
-
class ContextMenuTracker {
|
|
1813
|
-
/**
|
|
1814
|
-
* Close the previous open context menu and set the given one as being open.
|
|
1815
|
-
* @param trigger the trigger for the currently open Context Menu.
|
|
1816
|
-
*/
|
|
1817
|
-
update(trigger) {
|
|
1818
|
-
var _a;
|
|
1819
|
-
if (ContextMenuTracker._openContextMenuTrigger !== trigger) {
|
|
1820
|
-
(_a = ContextMenuTracker._openContextMenuTrigger) === null || _a === void 0 ? void 0 : _a.close();
|
|
1821
|
-
ContextMenuTracker._openContextMenuTrigger = trigger;
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
ContextMenuTracker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ContextMenuTracker, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1826
|
-
ContextMenuTracker.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ContextMenuTracker, providedIn: 'root' });
|
|
1827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: ContextMenuTracker, decorators: [{
|
|
1828
|
-
type: Injectable,
|
|
1829
|
-
args: [{ providedIn: 'root' }]
|
|
1830
|
-
}] });
|
|
1831
|
-
/** Injection token for the ContextMenu options object. */
|
|
1832
|
-
const CDK_CONTEXT_MENU_DEFAULT_OPTIONS = new InjectionToken('cdk-context-menu-default-options');
|
|
1833
|
-
/**
|
|
1834
|
-
* A directive which when placed on some element opens a the Menu it is bound to when a user
|
|
1835
|
-
* right-clicks within that element. It is aware of nested Context Menus and the lowest level
|
|
1836
|
-
* non-disabled context menu will trigger.
|
|
1837
|
-
*/
|
|
1838
|
-
class CdkContextMenuTrigger {
|
|
1839
|
-
constructor(_viewContainerRef, _overlay, _contextMenuTracker, _options, _directionality) {
|
|
1840
|
-
this._viewContainerRef = _viewContainerRef;
|
|
1841
|
-
this._overlay = _overlay;
|
|
1842
|
-
this._contextMenuTracker = _contextMenuTracker;
|
|
1843
|
-
this._options = _options;
|
|
1844
|
-
this._directionality = _directionality;
|
|
1845
|
-
/** Emits when the attached menu is requested to open. */
|
|
1846
|
-
this.opened = new EventEmitter();
|
|
1847
|
-
/** Emits when the attached menu is requested to close. */
|
|
1848
|
-
this.closed = new EventEmitter();
|
|
1849
|
-
this._disabled = false;
|
|
1850
|
-
/** A reference to the overlay which manages the triggered menu. */
|
|
1851
|
-
this._overlayRef = null;
|
|
1852
|
-
/** Emits when the element is destroyed. */
|
|
1853
|
-
this._destroyed = new Subject();
|
|
1854
|
-
/** The menu stack for this trigger and its associated menus. */
|
|
1855
|
-
this._menuStack = new MenuStack();
|
|
1856
|
-
/** Emits when the outside pointer events listener on the overlay should be stopped. */
|
|
1857
|
-
this._stopOutsideClicksListener = merge(this.closed, this._destroyed);
|
|
1858
|
-
this._setMenuStackListener();
|
|
1859
|
-
}
|
|
1860
|
-
/** Template reference variable to the menu to open on right click. */
|
|
1861
|
-
get menuPanel() {
|
|
1862
|
-
return this._menuPanel;
|
|
1863
|
-
}
|
|
1864
|
-
set menuPanel(panel) {
|
|
1865
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && panel._menuStack) {
|
|
1866
|
-
throwExistingMenuStackError();
|
|
1867
|
-
}
|
|
1868
|
-
this._menuPanel = panel;
|
|
1869
|
-
if (this._menuPanel) {
|
|
1870
|
-
this._menuPanel._menuStack = this._menuStack;
|
|
1871
|
-
}
|
|
1872
|
-
}
|
|
1873
|
-
/** Whether the context menu should be disabled. */
|
|
1874
|
-
get disabled() {
|
|
1875
|
-
return this._disabled;
|
|
1876
|
-
}
|
|
1877
|
-
set disabled(value) {
|
|
1878
|
-
this._disabled = coerceBooleanProperty(value);
|
|
1879
|
-
}
|
|
1880
|
-
/**
|
|
1881
|
-
* Open the attached menu at the specified location.
|
|
1882
|
-
* @param coordinates where to open the context menu
|
|
1883
|
-
*/
|
|
1884
|
-
open(coordinates) {
|
|
1885
|
-
this._open(coordinates, false);
|
|
1886
|
-
}
|
|
1887
|
-
_open(coordinates, ignoreFirstOutsideAuxClick) {
|
|
1888
|
-
if (this.disabled) {
|
|
1889
|
-
return;
|
|
1890
|
-
}
|
|
1891
|
-
else if (this.isOpen()) {
|
|
1892
|
-
// since we're moving this menu we need to close any submenus first otherwise they end up
|
|
1893
|
-
// disconnected from this one.
|
|
1894
|
-
this._menuStack.closeSubMenuOf(this._menuPanel._menu);
|
|
1895
|
-
this._overlayRef.getConfig().positionStrategy.setOrigin(coordinates);
|
|
1896
|
-
this._overlayRef.updatePosition();
|
|
1897
|
-
}
|
|
1898
|
-
else {
|
|
1899
|
-
this.opened.next();
|
|
1900
|
-
if (this._overlayRef) {
|
|
1901
|
-
this._overlayRef.getConfig().positionStrategy.setOrigin(coordinates);
|
|
1902
|
-
this._overlayRef.updatePosition();
|
|
1903
|
-
}
|
|
1904
|
-
else {
|
|
1905
|
-
this._overlayRef = this._overlay.create(this._getOverlayConfig(coordinates));
|
|
1906
|
-
}
|
|
1907
|
-
this._overlayRef.attach(this._getMenuContent());
|
|
1908
|
-
this._subscribeToOutsideClicks(ignoreFirstOutsideAuxClick);
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
/** Close the opened menu. */
|
|
1912
|
-
close() {
|
|
1913
|
-
this._menuStack.closeAll();
|
|
1914
|
-
}
|
|
1915
|
-
/**
|
|
1916
|
-
* Open the context menu and close any previously open menus.
|
|
1917
|
-
* @param event the mouse event which opens the context menu.
|
|
1918
|
-
*/
|
|
1919
|
-
_openOnContextMenu(event) {
|
|
1920
|
-
var _a, _b, _c;
|
|
1921
|
-
if (!this.disabled) {
|
|
1922
|
-
// Prevent the native context menu from opening because we're opening a custom one.
|
|
1923
|
-
event.preventDefault();
|
|
1924
|
-
// Stop event propagation to ensure that only the closest enabled context menu opens.
|
|
1925
|
-
// Otherwise, any context menus attached to containing elements would *also* open,
|
|
1926
|
-
// resulting in multiple stacked context menus being displayed.
|
|
1927
|
-
event.stopPropagation();
|
|
1928
|
-
this._contextMenuTracker.update(this);
|
|
1929
|
-
this._open({ x: event.clientX, y: event.clientY }, true);
|
|
1930
|
-
// A context menu can be triggered via a mouse right click or a keyboard shortcut.
|
|
1931
|
-
if (event.button === 2) {
|
|
1932
|
-
(_a = this._menuPanel._menu) === null || _a === void 0 ? void 0 : _a.focusFirstItem('mouse');
|
|
1933
|
-
}
|
|
1934
|
-
else if (event.button === 0) {
|
|
1935
|
-
(_b = this._menuPanel._menu) === null || _b === void 0 ? void 0 : _b.focusFirstItem('keyboard');
|
|
1936
|
-
}
|
|
1937
|
-
else {
|
|
1938
|
-
(_c = this._menuPanel._menu) === null || _c === void 0 ? void 0 : _c.focusFirstItem('program');
|
|
1939
|
-
}
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
/** Whether the attached menu is open. */
|
|
1943
|
-
isOpen() {
|
|
1944
|
-
var _a;
|
|
1945
|
-
return !!((_a = this._overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached());
|
|
1946
|
-
}
|
|
1947
|
-
/**
|
|
1948
|
-
* Get the configuration object used to create the overlay.
|
|
1949
|
-
* @param coordinates the location to place the opened menu
|
|
1950
|
-
*/
|
|
1951
|
-
_getOverlayConfig(coordinates) {
|
|
1952
|
-
return new OverlayConfig({
|
|
1953
|
-
positionStrategy: this._getOverlayPositionStrategy(coordinates),
|
|
1954
|
-
scrollStrategy: this._overlay.scrollStrategies.block(),
|
|
1955
|
-
direction: this._directionality,
|
|
1956
|
-
});
|
|
1957
|
-
}
|
|
1958
|
-
/**
|
|
1959
|
-
* Build the position strategy for the overlay which specifies where to place the menu.
|
|
1960
|
-
* @param coordinates the location to place the opened menu
|
|
1961
|
-
*/
|
|
1962
|
-
_getOverlayPositionStrategy(coordinates) {
|
|
1963
|
-
return this._overlay
|
|
1964
|
-
.position()
|
|
1965
|
-
.flexibleConnectedTo(coordinates)
|
|
1966
|
-
.withDefaultOffsetX(this._options.offsetX)
|
|
1967
|
-
.withDefaultOffsetY(this._options.offsetY)
|
|
1968
|
-
.withPositions(this._getOverlayPositions());
|
|
1969
|
-
}
|
|
1970
|
-
/**
|
|
1971
|
-
* Determine and return where to position the opened menu relative to the mouse location.
|
|
1972
|
-
*/
|
|
1973
|
-
_getOverlayPositions() {
|
|
1974
|
-
// TODO: this should be configurable through the injected context menu options
|
|
1975
|
-
return [
|
|
1976
|
-
{ originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top' },
|
|
1977
|
-
{ originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top' },
|
|
1978
|
-
{ originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom' },
|
|
1979
|
-
{ originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom' },
|
|
1980
|
-
];
|
|
1981
|
-
}
|
|
1982
|
-
/**
|
|
1983
|
-
* Get the portal to be attached to the overlay which contains the menu. Allows for the menu
|
|
1984
|
-
* content to change dynamically and be reflected in the application.
|
|
1985
|
-
*/
|
|
1986
|
-
_getMenuContent() {
|
|
1987
|
-
var _a;
|
|
1988
|
-
const hasMenuContentChanged = this.menuPanel._templateRef !== ((_a = this._panelContent) === null || _a === void 0 ? void 0 : _a.templateRef);
|
|
1989
|
-
if (this.menuPanel && (!this._panelContent || hasMenuContentChanged)) {
|
|
1990
|
-
this._panelContent = new TemplatePortal(this.menuPanel._templateRef, this._viewContainerRef);
|
|
1991
|
-
}
|
|
1992
|
-
return this._panelContent;
|
|
1993
|
-
}
|
|
1994
|
-
/** Subscribe to the menu stack close events and close this menu when requested. */
|
|
1995
|
-
_setMenuStackListener() {
|
|
1996
|
-
this._menuStack.closed.pipe(takeUntil(this._destroyed)).subscribe(item => {
|
|
1997
|
-
if (item === this._menuPanel._menu && this.isOpen()) {
|
|
1998
|
-
this.closed.next();
|
|
1999
|
-
this._overlayRef.detach();
|
|
2000
|
-
}
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
/**
|
|
2004
|
-
* Subscribe to the overlays outside pointer events stream and handle closing out the stack if a
|
|
2005
|
-
* click occurs outside the menus.
|
|
2006
|
-
*/
|
|
2007
|
-
_subscribeToOutsideClicks(ignoreFirstAuxClick) {
|
|
2008
|
-
if (this._overlayRef) {
|
|
2009
|
-
let outsideClicks = this._overlayRef.outsidePointerEvents();
|
|
2010
|
-
// If the menu was triggered by the `contextmenu` event, skip the first `auxclick` event
|
|
2011
|
-
// because it fires when the mouse is released on the same click that opened the menu.
|
|
2012
|
-
if (ignoreFirstAuxClick) {
|
|
2013
|
-
const [auxClicks, nonAuxClicks] = partition(outsideClicks, ({ type }) => type === 'auxclick');
|
|
2014
|
-
outsideClicks = merge(nonAuxClicks, auxClicks.pipe(skip(1)));
|
|
2015
|
-
}
|
|
2016
|
-
outsideClicks.pipe(takeUntil(this._stopOutsideClicksListener)).subscribe(event => {
|
|
2017
|
-
if (!isClickInsideMenuOverlay(event.target)) {
|
|
2018
|
-
this._menuStack.closeAll();
|
|
2019
|
-
}
|
|
2020
|
-
});
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
ngOnDestroy() {
|
|
2024
|
-
this._destroyOverlay();
|
|
2025
|
-
this._resetPanelMenuStack();
|
|
2026
|
-
this._destroyed.next();
|
|
2027
|
-
this._destroyed.complete();
|
|
2028
|
-
}
|
|
2029
|
-
/** Destroy and unset the overlay reference it if exists. */
|
|
2030
|
-
_destroyOverlay() {
|
|
2031
|
-
if (this._overlayRef) {
|
|
2032
|
-
this._overlayRef.dispose();
|
|
2033
|
-
this._overlayRef = null;
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
/** Set the menu panels menu stack back to null. */
|
|
2037
|
-
_resetPanelMenuStack() {
|
|
2038
|
-
// If a ContextMenuTrigger is placed in a conditionally rendered view, each time the trigger is
|
|
2039
|
-
// rendered the panel setter for ContextMenuTrigger is called. From the first render onward,
|
|
2040
|
-
// the attached CdkMenuPanel has the MenuStack set. Since we throw an error if a panel already
|
|
2041
|
-
// has a stack set, we want to reset the attached stack here to prevent the error from being
|
|
2042
|
-
// thrown if the trigger re-configures its attached panel (in the case where there is a 1:1
|
|
2043
|
-
// relationship between the panel and trigger).
|
|
2044
|
-
if (this._menuPanel) {
|
|
2045
|
-
this._menuPanel._menuStack = null;
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
CdkContextMenuTrigger.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkContextMenuTrigger, deps: [{ token: i0.ViewContainerRef }, { token: i1.Overlay }, { token: ContextMenuTracker }, { token: CDK_CONTEXT_MENU_DEFAULT_OPTIONS }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2050
|
-
CdkContextMenuTrigger.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkContextMenuTrigger, selector: "[cdkContextMenuTriggerFor]", inputs: { menuPanel: ["cdkContextMenuTriggerFor", "menuPanel"], disabled: ["cdkContextMenuDisabled", "disabled"] }, outputs: { opened: "cdkContextMenuOpened", closed: "cdkContextMenuClosed" }, host: { listeners: { "contextmenu": "_openOnContextMenu($event)" } }, providers: [
|
|
2051
|
-
// In cases where the first menu item in the context menu is a trigger the submenu opens on a
|
|
2052
|
-
// hover event. Offsetting the opened context menu by 2px prevents this from occurring.
|
|
2053
|
-
{ provide: CDK_CONTEXT_MENU_DEFAULT_OPTIONS, useValue: { offsetX: 2, offsetY: 2 } },
|
|
2054
|
-
], exportAs: ["cdkContextMenuTriggerFor"], ngImport: i0 });
|
|
2055
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkContextMenuTrigger, decorators: [{
|
|
2056
|
-
type: Directive,
|
|
2057
|
-
args: [{
|
|
2058
|
-
selector: '[cdkContextMenuTriggerFor]',
|
|
2059
|
-
exportAs: 'cdkContextMenuTriggerFor',
|
|
2060
|
-
host: {
|
|
2061
|
-
'(contextmenu)': '_openOnContextMenu($event)',
|
|
2062
|
-
},
|
|
2063
|
-
providers: [
|
|
2064
|
-
// In cases where the first menu item in the context menu is a trigger the submenu opens on a
|
|
2065
|
-
// hover event. Offsetting the opened context menu by 2px prevents this from occurring.
|
|
2066
|
-
{ provide: CDK_CONTEXT_MENU_DEFAULT_OPTIONS, useValue: { offsetX: 2, offsetY: 2 } },
|
|
2067
|
-
],
|
|
2068
|
-
}]
|
|
2069
|
-
}], ctorParameters: function () {
|
|
2070
|
-
return [{ type: i0.ViewContainerRef }, { type: i1.Overlay }, { type: ContextMenuTracker }, { type: undefined, decorators: [{
|
|
2071
|
-
type: Inject,
|
|
2072
|
-
args: [CDK_CONTEXT_MENU_DEFAULT_OPTIONS]
|
|
2073
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
2074
|
-
type: Optional
|
|
2075
|
-
}] }];
|
|
2076
|
-
}, propDecorators: { menuPanel: [{
|
|
2077
|
-
type: Input,
|
|
2078
|
-
args: ['cdkContextMenuTriggerFor']
|
|
2079
|
-
}], opened: [{
|
|
2080
|
-
type: Output,
|
|
2081
|
-
args: ['cdkContextMenuOpened']
|
|
2082
|
-
}], closed: [{
|
|
2083
|
-
type: Output,
|
|
2084
|
-
args: ['cdkContextMenuClosed']
|
|
2085
|
-
}], disabled: [{
|
|
2086
|
-
type: Input,
|
|
2087
|
-
args: ['cdkContextMenuDisabled']
|
|
2088
|
-
}] } });
|
|
2089
|
-
|
|
2090
|
-
/**
|
|
2091
|
-
* @license
|
|
2092
|
-
* Copyright Google LLC All Rights Reserved.
|
|
2093
|
-
*
|
|
2094
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
2095
|
-
* found in the LICENSE file at https://angular.io/license
|
|
2096
|
-
*/
|
|
2097
|
-
const EXPORTED_DECLARATIONS = [
|
|
2098
|
-
CdkMenuBar,
|
|
2099
|
-
CdkMenu,
|
|
2100
|
-
CdkMenuPanel,
|
|
2101
|
-
CdkMenuItem,
|
|
2102
|
-
CdkMenuItemRadio,
|
|
2103
|
-
CdkMenuItemCheckbox,
|
|
2104
|
-
CdkMenuItemTrigger,
|
|
2105
|
-
CdkMenuGroup,
|
|
2106
|
-
CdkContextMenuTrigger,
|
|
2107
|
-
CdkTargetMenuAim,
|
|
2108
|
-
];
|
|
2109
|
-
class CdkMenuModule {
|
|
2110
|
-
}
|
|
2111
|
-
CdkMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2112
|
-
CdkMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuModule, declarations: [CdkMenuBar,
|
|
2113
|
-
CdkMenu,
|
|
2114
|
-
CdkMenuPanel,
|
|
2115
|
-
CdkMenuItem,
|
|
2116
|
-
CdkMenuItemRadio,
|
|
2117
|
-
CdkMenuItemCheckbox,
|
|
2118
|
-
CdkMenuItemTrigger,
|
|
2119
|
-
CdkMenuGroup,
|
|
2120
|
-
CdkContextMenuTrigger,
|
|
2121
|
-
CdkTargetMenuAim], imports: [OverlayModule], exports: [CdkMenuBar,
|
|
2122
|
-
CdkMenu,
|
|
2123
|
-
CdkMenuPanel,
|
|
2124
|
-
CdkMenuItem,
|
|
2125
|
-
CdkMenuItemRadio,
|
|
2126
|
-
CdkMenuItemCheckbox,
|
|
2127
|
-
CdkMenuItemTrigger,
|
|
2128
|
-
CdkMenuGroup,
|
|
2129
|
-
CdkContextMenuTrigger,
|
|
2130
|
-
CdkTargetMenuAim] });
|
|
2131
|
-
CdkMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuModule, imports: [[OverlayModule]] });
|
|
2132
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuModule, decorators: [{
|
|
2133
|
-
type: NgModule,
|
|
2134
|
-
args: [{
|
|
2135
|
-
imports: [OverlayModule],
|
|
2136
|
-
exports: EXPORTED_DECLARATIONS,
|
|
2137
|
-
declarations: EXPORTED_DECLARATIONS,
|
|
2138
|
-
}]
|
|
2139
|
-
}] });
|
|
2140
|
-
|
|
2141
|
-
/**
|
|
2142
|
-
* @license
|
|
2143
|
-
* Copyright Google LLC All Rights Reserved.
|
|
2144
|
-
*
|
|
2145
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
2146
|
-
* found in the LICENSE file at https://angular.io/license
|
|
2147
|
-
*/
|
|
2148
|
-
|
|
2149
|
-
/**
|
|
2150
|
-
* @license
|
|
2151
|
-
* Copyright Google LLC All Rights Reserved.
|
|
2152
|
-
*
|
|
2153
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
2154
|
-
* found in the LICENSE file at https://angular.io/license
|
|
2155
|
-
*/
|
|
2156
|
-
|
|
2157
|
-
/**
|
|
2158
|
-
* Generated bundle index. Do not edit.
|
|
2159
|
-
*/
|
|
2160
|
-
|
|
2161
|
-
export { CDK_CONTEXT_MENU_DEFAULT_OPTIONS, CDK_MENU, CdkContextMenuTrigger, CdkMenu, CdkMenuBar, CdkMenuGroup, CdkMenuItem, CdkMenuItemCheckbox, CdkMenuItemRadio, CdkMenuItemTrigger, CdkMenuModule, CdkMenuPanel, CdkTargetMenuAim, ContextMenuTracker, MENU_AIM, MenuStack, TargetMenuAim, isClickInsideMenuOverlay };
|
|
2162
|
-
//# sourceMappingURL=menu.mjs.map
|