@angular/material 19.1.0-next.2 → 19.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/autocomplete/index.d.ts +6 -6
- package/badge/index.d.ts +2 -2
- package/button/index.d.ts +6 -4
- package/checkbox/index.d.ts +4 -4
- package/chips/index.d.ts +3 -3
- package/core/theming/_theming.scss +1 -1
- package/datepicker/index.d.ts +16 -39
- package/expansion/index.d.ts +2 -0
- package/fesm2022/autocomplete.mjs +54 -50
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge.mjs +12 -12
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +10 -10
- package/fesm2022/button-toggle.mjs +10 -10
- package/fesm2022/button.mjs +41 -39
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/checkbox.mjs +16 -16
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips.mjs +42 -42
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +65 -65
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +790 -798
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +25 -25
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/expansion.mjs +30 -28
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +41 -39
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon.mjs +12 -12
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input.mjs +26 -32
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list.mjs +63 -59
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +178 -133
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator.mjs +21 -24
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +14 -12
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +9 -9
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio.mjs +19 -18
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select.mjs +10 -10
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +138 -114
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +16 -16
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider.mjs +40 -41
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +22 -22
- package/fesm2022/sort.mjs +14 -14
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper.mjs +37 -37
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +59 -70
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +66 -74
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +21 -17
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +12 -12
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +37 -28
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree.mjs +25 -25
- package/form-field/index.d.ts +5 -4
- package/icon/index.d.ts +4 -4
- package/input/index.d.ts +8 -5
- package/list/index.d.ts +8 -5
- package/menu/index.d.ts +13 -14
- package/package.json +2 -2
- package/paginator/index.d.ts +5 -5
- package/progress-bar/index.d.ts +6 -4
- package/progress-spinner/index.d.ts +4 -4
- package/radio/index.d.ts +8 -6
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/select/index.d.ts +1 -1
- package/sidenav/index.d.ts +12 -10
- package/slide-toggle/index.d.ts +4 -4
- package/slider/index.d.ts +6 -3
- package/stepper/index.d.ts +6 -6
- package/tabs/index.d.ts +12 -10
- package/timepicker/index.d.ts +1 -0
- package/toolbar/index.d.ts +2 -2
- package/tooltip/index.d.ts +3 -0
package/fesm2022/menu.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ElementRef, ChangeDetectorRef, booleanAttribute, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, TemplateRef, ApplicationRef, Injector, ViewContainerRef, Directive, QueryList, EventEmitter, afterNextRender, ContentChildren, ViewChild, ContentChild, Output, NgZone, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, ElementRef, ChangeDetectorRef, booleanAttribute, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, TemplateRef, ApplicationRef, Injector, ViewContainerRef, Directive, QueryList, EventEmitter, ANIMATION_MODULE_TYPE, afterNextRender, ContentChildren, ViewChild, ContentChild, Output, NgZone, NgModule } from '@angular/core';
|
|
3
3
|
import { FocusMonitor, _IdGenerator, FocusKeyManager, isFakeTouchstartFromScreenReader, isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';
|
|
4
4
|
import { UP_ARROW, DOWN_ARROW, RIGHT_ARROW, LEFT_ARROW, ESCAPE, hasModifierKey, ENTER, SPACE } from '@angular/cdk/keycodes';
|
|
5
5
|
import { Subject, merge, Subscription, of } from 'rxjs';
|
|
6
|
-
import { startWith, switchMap, takeUntil, filter } from 'rxjs/operators';
|
|
6
|
+
import { startWith, switchMap, takeUntil, take, filter } from 'rxjs/operators';
|
|
7
7
|
import { DOCUMENT } from '@angular/common';
|
|
8
8
|
import { _StructuralStylesLoader, MatRipple, MatRippleModule, MatCommonModule } from '@angular/material/core';
|
|
9
9
|
import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
|
|
10
10
|
import { TemplatePortal, DomPortalOutlet } from '@angular/cdk/portal';
|
|
11
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
12
11
|
import { Directionality } from '@angular/cdk/bidi';
|
|
13
12
|
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
14
13
|
import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
|
|
15
14
|
import { CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
15
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Injection token used to provide the parent menu to menu-specific components.
|
|
@@ -118,10 +118,10 @@ class MatMenuItem {
|
|
|
118
118
|
_hasFocus() {
|
|
119
119
|
return this._document && this._document.activeElement === this._getHostElement();
|
|
120
120
|
}
|
|
121
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
122
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0-next.
|
|
121
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
122
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0-next.3", type: MatMenuItem, isStandalone: true, selector: "[mat-menu-item]", inputs: { role: "role", disabled: ["disabled", "disabled", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute] }, host: { listeners: { "click": "_checkDisabled($event)", "mouseenter": "_handleMouseEnter()" }, properties: { "attr.role": "role", "class.mat-mdc-menu-item-highlighted": "_highlighted", "class.mat-mdc-menu-item-submenu-trigger": "_triggersSubmenu", "attr.tabindex": "_getTabIndex()", "attr.aria-disabled": "disabled", "attr.disabled": "disabled || null" }, classAttribute: "mat-mdc-menu-item mat-focus-indicator" }, exportAs: ["matMenuItem"], ngImport: i0, template: "<ng-content select=\"mat-icon, [matMenuItemIcon]\"></ng-content>\n<span class=\"mat-mdc-menu-item-text\"><ng-content></ng-content></span>\n<div class=\"mat-mdc-menu-ripple\" matRipple\n [matRippleDisabled]=\"disableRipple || disabled\"\n [matRippleTrigger]=\"_getHostElement()\">\n</div>\n\n@if (_triggersSubmenu) {\n <svg\n class=\"mat-mdc-menu-submenu-icon\"\n viewBox=\"0 0 5 10\"\n focusable=\"false\"\n aria-hidden=\"true\"><polygon points=\"0,0 5,5 0,10\"/></svg>\n}\n", dependencies: [{ kind: "directive", type: MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
123
123
|
}
|
|
124
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuItem, decorators: [{
|
|
125
125
|
type: Component,
|
|
126
126
|
args: [{ selector: '[mat-menu-item]', exportAs: 'matMenuItem', host: {
|
|
127
127
|
'[attr.role]': 'role',
|
|
@@ -230,10 +230,10 @@ class MatMenuContent {
|
|
|
230
230
|
this.detach();
|
|
231
231
|
this._outlet?.dispose();
|
|
232
232
|
}
|
|
233
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
234
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.
|
|
233
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
234
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.3", type: MatMenuContent, isStandalone: true, selector: "ng-template[matMenuContent]", providers: [{ provide: MAT_MENU_CONTENT, useExisting: MatMenuContent }], ngImport: i0 });
|
|
235
235
|
}
|
|
236
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuContent, decorators: [{
|
|
237
237
|
type: Directive,
|
|
238
238
|
args: [{
|
|
239
239
|
selector: 'ng-template[matMenuContent]',
|
|
@@ -241,59 +241,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2",
|
|
|
241
241
|
}]
|
|
242
242
|
}], ctorParameters: () => [] });
|
|
243
243
|
|
|
244
|
-
/**
|
|
245
|
-
* Animations used by the mat-menu component.
|
|
246
|
-
* Animation duration and timing values are based on:
|
|
247
|
-
* https://material.io/guidelines/components/menus.html#menus-usage
|
|
248
|
-
* @docs-private
|
|
249
|
-
*/
|
|
250
|
-
const matMenuAnimations = {
|
|
251
|
-
/**
|
|
252
|
-
* This animation controls the menu panel's entry and exit from the page.
|
|
253
|
-
*
|
|
254
|
-
* When the menu panel is added to the DOM, it scales in and fades in its border.
|
|
255
|
-
*
|
|
256
|
-
* When the menu panel is removed from the DOM, it simply fades out after a brief
|
|
257
|
-
* delay to display the ripple.
|
|
258
|
-
*/
|
|
259
|
-
transformMenu: trigger('transformMenu', [
|
|
260
|
-
state('void', style({
|
|
261
|
-
opacity: 0,
|
|
262
|
-
transform: 'scale(0.8)',
|
|
263
|
-
})),
|
|
264
|
-
transition('void => enter', animate('120ms cubic-bezier(0, 0, 0.2, 1)', style({
|
|
265
|
-
opacity: 1,
|
|
266
|
-
transform: 'scale(1)',
|
|
267
|
-
}))),
|
|
268
|
-
transition('* => void', animate('100ms 25ms linear', style({ opacity: 0 }))),
|
|
269
|
-
]),
|
|
270
|
-
/**
|
|
271
|
-
* This animation fades in the background color and content of the menu panel
|
|
272
|
-
* after its containing element is scaled in.
|
|
273
|
-
*/
|
|
274
|
-
fadeInItems: trigger('fadeInItems', [
|
|
275
|
-
// TODO(crisbeto): this is inside the `transformMenu`
|
|
276
|
-
// now. Remove next time we do breaking changes.
|
|
277
|
-
state('showing', style({ opacity: 1 })),
|
|
278
|
-
transition('void => *', [
|
|
279
|
-
style({ opacity: 0 }),
|
|
280
|
-
animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
|
|
281
|
-
]),
|
|
282
|
-
]),
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
* @deprecated
|
|
286
|
-
* @breaking-change 8.0.0
|
|
287
|
-
* @docs-private
|
|
288
|
-
*/
|
|
289
|
-
const fadeInItems = matMenuAnimations.fadeInItems;
|
|
290
|
-
/**
|
|
291
|
-
* @deprecated
|
|
292
|
-
* @breaking-change 8.0.0
|
|
293
|
-
* @docs-private
|
|
294
|
-
*/
|
|
295
|
-
const transformMenu = matMenuAnimations.transformMenu;
|
|
296
|
-
|
|
297
244
|
/** Injection token to be used to override the default options for `mat-menu`. */
|
|
298
245
|
const MAT_MENU_DEFAULT_OPTIONS = new InjectionToken('mat-menu-default-options', {
|
|
299
246
|
providedIn: 'root',
|
|
@@ -308,13 +255,21 @@ function MAT_MENU_DEFAULT_OPTIONS_FACTORY() {
|
|
|
308
255
|
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
309
256
|
};
|
|
310
257
|
}
|
|
258
|
+
/** Name of the enter animation `@keyframes`. */
|
|
259
|
+
const ENTER_ANIMATION = '_mat-menu-enter';
|
|
260
|
+
/** Name of the exit animation `@keyframes`. */
|
|
261
|
+
const EXIT_ANIMATION = '_mat-menu-exit';
|
|
311
262
|
class MatMenu {
|
|
312
263
|
_elementRef = inject(ElementRef);
|
|
313
264
|
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
265
|
+
_injector = inject(Injector);
|
|
314
266
|
_keyManager;
|
|
315
267
|
_xPosition;
|
|
316
268
|
_yPosition;
|
|
317
269
|
_firstItemFocusRef;
|
|
270
|
+
_exitFallbackTimeout;
|
|
271
|
+
/** Whether animations are currently disabled. */
|
|
272
|
+
_animationsDisabled;
|
|
318
273
|
/** All items inside the menu. Includes items nested inside another menu. */
|
|
319
274
|
_allItems;
|
|
320
275
|
/** Only the direct descendant menu items. */
|
|
@@ -326,7 +281,7 @@ class MatMenu {
|
|
|
326
281
|
/** Emits whenever an animation on the menu completes. */
|
|
327
282
|
_animationDone = new Subject();
|
|
328
283
|
/** Whether the menu is animating. */
|
|
329
|
-
_isAnimating;
|
|
284
|
+
_isAnimating = false;
|
|
330
285
|
/** Parent menu of the current menu panel. */
|
|
331
286
|
parentMenu;
|
|
332
287
|
/** Layout direction of the menu. */
|
|
@@ -428,7 +383,6 @@ class MatMenu {
|
|
|
428
383
|
*/
|
|
429
384
|
close = this.closed;
|
|
430
385
|
panelId = inject(_IdGenerator).getId('mat-menu-panel-');
|
|
431
|
-
_injector = inject(Injector);
|
|
432
386
|
constructor() {
|
|
433
387
|
const defaultOptions = inject(MAT_MENU_DEFAULT_OPTIONS);
|
|
434
388
|
this.overlayPanelClass = defaultOptions.overlayPanelClass || '';
|
|
@@ -437,6 +391,7 @@ class MatMenu {
|
|
|
437
391
|
this.backdropClass = defaultOptions.backdropClass;
|
|
438
392
|
this.overlapTrigger = defaultOptions.overlapTrigger;
|
|
439
393
|
this.hasBackdrop = defaultOptions.hasBackdrop;
|
|
394
|
+
this._animationsDisabled = inject(ANIMATION_MODULE_TYPE, { optional: true }) === 'NoopAnimations';
|
|
440
395
|
}
|
|
441
396
|
ngOnInit() {
|
|
442
397
|
this.setPositionClasses();
|
|
@@ -476,6 +431,7 @@ class MatMenu {
|
|
|
476
431
|
this._directDescendantItems.destroy();
|
|
477
432
|
this.closed.complete();
|
|
478
433
|
this._firstItemFocusRef?.destroy();
|
|
434
|
+
clearTimeout(this._exitFallbackTimeout);
|
|
479
435
|
}
|
|
480
436
|
/** Stream that emits whenever the hovered menu item changes. */
|
|
481
437
|
_hovered() {
|
|
@@ -534,14 +490,7 @@ class MatMenu {
|
|
|
534
490
|
// Wait for `afterNextRender` to ensure iOS VoiceOver screen reader focuses the first item (#24735).
|
|
535
491
|
this._firstItemFocusRef?.destroy();
|
|
536
492
|
this._firstItemFocusRef = afterNextRender(() => {
|
|
537
|
-
|
|
538
|
-
if (this._directDescendantItems.length) {
|
|
539
|
-
// Because the `mat-menuPanel` is at the DOM insertion point, not inside the overlay, we don't
|
|
540
|
-
// have a nice way of getting a hold of the menuPanel panel. We can't use a `ViewChild` either
|
|
541
|
-
// because the panel is inside an `ng-template`. We work around it by starting from one of
|
|
542
|
-
// the items and walking up the DOM.
|
|
543
|
-
menuPanel = this._directDescendantItems.first._getHostElement().closest('[role="menu"]');
|
|
544
|
-
}
|
|
493
|
+
const menuPanel = this._resolvePanel();
|
|
545
494
|
// If an item in the menuPanel is already focused, avoid overriding the focus.
|
|
546
495
|
if (!menuPanel || !menuPanel.contains(document.activeElement)) {
|
|
547
496
|
const manager = this._keyManager;
|
|
@@ -584,32 +533,52 @@ class MatMenu {
|
|
|
584
533
|
};
|
|
585
534
|
this._changeDetectorRef.markForCheck();
|
|
586
535
|
}
|
|
587
|
-
/**
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
536
|
+
/** Callback that is invoked when the panel animation completes. */
|
|
537
|
+
_onAnimationDone(state) {
|
|
538
|
+
const isExit = state === EXIT_ANIMATION;
|
|
539
|
+
if (isExit || state === ENTER_ANIMATION) {
|
|
540
|
+
if (isExit) {
|
|
541
|
+
clearTimeout(this._exitFallbackTimeout);
|
|
542
|
+
this._exitFallbackTimeout = undefined;
|
|
543
|
+
}
|
|
544
|
+
this._animationDone.next(isExit ? 'void' : 'enter');
|
|
545
|
+
this._isAnimating = false;
|
|
546
|
+
}
|
|
591
547
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
548
|
+
_onAnimationStart(state) {
|
|
549
|
+
if (state === ENTER_ANIMATION || state === EXIT_ANIMATION) {
|
|
550
|
+
this._isAnimating = true;
|
|
551
|
+
}
|
|
596
552
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
553
|
+
_setIsOpen(isOpen) {
|
|
554
|
+
this._panelAnimationState = isOpen ? 'enter' : 'void';
|
|
555
|
+
if (isOpen) {
|
|
556
|
+
if (this._keyManager.activeItemIndex === 0) {
|
|
557
|
+
// Scroll the content element to the top as soon as the animation starts. This is necessary,
|
|
558
|
+
// because we move focus to the first item while it's still being animated, which can throw
|
|
559
|
+
// the browser off when it determines the scroll position. Alternatively we can move focus
|
|
560
|
+
// when the animation is done, however moving focus asynchronously will interrupt screen
|
|
561
|
+
// readers which are in the process of reading out the menu already. We take the `element`
|
|
562
|
+
// from the `event` since we can't use a `ViewChild` to access the pane.
|
|
563
|
+
const menuPanel = this._resolvePanel();
|
|
564
|
+
if (menuPanel) {
|
|
565
|
+
menuPanel.scrollTop = 0;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
else if (!this._animationsDisabled) {
|
|
570
|
+
// Some apps do `* { animation: none !important; }` in tests which will prevent the
|
|
571
|
+
// `animationend` event from firing. Since the exit animation is loading-bearing for
|
|
572
|
+
// removing the content from the DOM, add a fallback timer.
|
|
573
|
+
this._exitFallbackTimeout = setTimeout(() => this._onAnimationDone(EXIT_ANIMATION), 200);
|
|
612
574
|
}
|
|
575
|
+
// Animation events won't fire when animations are disabled so we simulate them.
|
|
576
|
+
if (this._animationsDisabled) {
|
|
577
|
+
setTimeout(() => {
|
|
578
|
+
this._onAnimationDone(isOpen ? ENTER_ANIMATION : EXIT_ANIMATION);
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
this._changeDetectorRef.markForCheck();
|
|
613
582
|
}
|
|
614
583
|
/**
|
|
615
584
|
* Sets up a stream that will keep track of any newly-added menu items and will update the list
|
|
@@ -625,16 +594,28 @@ class MatMenu {
|
|
|
625
594
|
this._directDescendantItems.notifyOnChanges();
|
|
626
595
|
});
|
|
627
596
|
}
|
|
628
|
-
|
|
629
|
-
|
|
597
|
+
/** Gets the menu panel DOM node. */
|
|
598
|
+
_resolvePanel() {
|
|
599
|
+
let menuPanel = null;
|
|
600
|
+
if (this._directDescendantItems.length) {
|
|
601
|
+
// Because the `mat-menuPanel` is at the DOM insertion point, not inside the overlay, we don't
|
|
602
|
+
// have a nice way of getting a hold of the menuPanel panel. We can't use a `ViewChild` either
|
|
603
|
+
// because the panel is inside an `ng-template`. We work around it by starting from one of
|
|
604
|
+
// the items and walking up the DOM.
|
|
605
|
+
menuPanel = this._directDescendantItems.first._getHostElement().closest('[role="menu"]');
|
|
606
|
+
}
|
|
607
|
+
return menuPanel;
|
|
608
|
+
}
|
|
609
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
610
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.0-next.3", type: MatMenu, isStandalone: true, selector: "mat-menu", inputs: { backdropClass: "backdropClass", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaDescribedby: ["aria-describedby", "ariaDescribedby"], xPosition: "xPosition", yPosition: "yPosition", overlapTrigger: ["overlapTrigger", "overlapTrigger", booleanAttribute], hasBackdrop: ["hasBackdrop", "hasBackdrop", (value) => (value == null ? null : booleanAttribute(value))], panelClass: ["class", "panelClass"], classList: "classList" }, outputs: { closed: "closed", close: "close" }, host: { properties: { "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.aria-describedby": "null" } }, providers: [{ provide: MAT_MENU_PANEL, useExisting: MatMenu }], queries: [{ propertyName: "lazyContent", first: true, predicate: MAT_MENU_CONTENT, descendants: true }, { propertyName: "_allItems", predicate: MatMenuItem, descendants: true }, { propertyName: "items", predicate: MatMenuItem }], viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], exportAs: ["matMenu"], ngImport: i0, template: "<ng-template>\n <div\n class=\"mat-mdc-menu-panel\"\n [id]=\"panelId\"\n [class]=\"_classList\"\n [class.mat-menu-panel-animations-disabled]=\"_animationsDisabled\"\n [class.mat-menu-panel-exit-animation]=\"_panelAnimationState === 'void'\"\n [class.mat-menu-panel-animating]=\"_isAnimating\"\n (click)=\"closed.emit('click')\"\n tabindex=\"-1\"\n role=\"menu\"\n (animationstart)=\"_onAnimationStart($event.animationName)\"\n (animationend)=\"_onAnimationDone($event.animationName)\"\n (animationcancel)=\"_onAnimationDone($event.animationName)\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [attr.aria-describedby]=\"ariaDescribedby || null\">\n <div class=\"mat-mdc-menu-content\">\n <ng-content></ng-content>\n </div>\n </div>\n</ng-template>\n", styles: ["mat-menu{display:none}.mat-mdc-menu-content{margin:0;padding:8px 0;outline:0}.mat-mdc-menu-content,.mat-mdc-menu-content .mat-mdc-menu-item .mat-mdc-menu-item-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;flex:1;white-space:normal;font-family:var(--mat-menu-item-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-menu-item-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-menu-item-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-menu-item-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-menu-item-label-text-weight, var(--mat-sys-label-large-weight))}@keyframes _mat-menu-enter{from{opacity:0;transform:scale(0.8)}to{opacity:1;transform:none}}@keyframes _mat-menu-exit{from{opacity:1}to{opacity:0}}.mat-mdc-menu-panel{min-width:112px;max-width:280px;overflow:auto;box-sizing:border-box;outline:0;animation:_mat-menu-enter 120ms cubic-bezier(0, 0, 0.2, 1);border-radius:var(--mat-menu-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mat-menu-container-color, var(--mat-sys-surface-container));box-shadow:var(--mat-menu-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));will-change:transform,opacity}.mat-mdc-menu-panel.mat-menu-panel-exit-animation{animation:_mat-menu-exit 100ms 25ms linear forwards}.mat-mdc-menu-panel.mat-menu-panel-animations-disabled{animation:none}.mat-mdc-menu-panel.mat-menu-panel-animating{pointer-events:none}.mat-mdc-menu-panel.mat-menu-panel-animating:has(.mat-mdc-menu-content:empty){display:none}@media(forced-colors: active){.mat-mdc-menu-panel{outline:solid 1px}}.mat-mdc-menu-panel .mat-divider{color:var(--mat-menu-divider-color, var(--mat-sys-surface-variant));margin-bottom:var(--mat-menu-divider-bottom-spacing, 8px);margin-top:var(--mat-menu-divider-top-spacing, 8px)}.mat-mdc-menu-item{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;cursor:pointer;width:100%;text-align:left;box-sizing:border-box;color:inherit;font-size:inherit;background:none;text-decoration:none;margin:0;min-height:48px;padding-left:var(--mat-menu-item-leading-spacing, 12px);padding-right:var(--mat-menu-item-trailing-spacing, 12px);-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-menu-item::-moz-focus-inner{border:0}[dir=rtl] .mat-mdc-menu-item{padding-left:var(--mat-menu-item-trailing-spacing, 12px);padding-right:var(--mat-menu-item-leading-spacing, 12px)}.mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-leading-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-trailing-spacing, 12px)}[dir=rtl] .mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-trailing-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-leading-spacing, 12px)}.mat-mdc-menu-item,.mat-mdc-menu-item:visited,.mat-mdc-menu-item:link{color:var(--mat-menu-item-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-menu-item .mat-icon-no-color,.mat-mdc-menu-item .mat-mdc-menu-submenu-icon{color:var(--mat-menu-item-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-menu-item[disabled]{cursor:default;opacity:.38}.mat-mdc-menu-item[disabled]::after{display:block;position:absolute;content:\"\";top:0;left:0;bottom:0;right:0}.mat-mdc-menu-item:focus{outline:0}.mat-mdc-menu-item .mat-icon{flex-shrink:0;margin-right:var(--mat-menu-item-spacing, 12px);height:var(--mat-menu-item-icon-size, 24px);width:var(--mat-menu-item-icon-size, 24px)}[dir=rtl] .mat-mdc-menu-item{text-align:right}[dir=rtl] .mat-mdc-menu-item .mat-icon{margin-right:0;margin-left:var(--mat-menu-item-spacing, 12px)}.mat-mdc-menu-item:not([disabled]):hover{background-color:var(--mat-menu-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-menu-item:not([disabled]).cdk-program-focused,.mat-mdc-menu-item:not([disabled]).cdk-keyboard-focused,.mat-mdc-menu-item:not([disabled]).mat-mdc-menu-item-highlighted{background-color:var(--mat-menu-item-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}@media(forced-colors: active){.mat-mdc-menu-item{margin-top:1px}}.mat-mdc-menu-submenu-icon{width:var(--mat-menu-item-icon-size, 24px);height:10px;fill:currentColor;padding-left:var(--mat-menu-item-spacing, 12px)}[dir=rtl] .mat-mdc-menu-submenu-icon{padding-right:var(--mat-menu-item-spacing, 12px);padding-left:0}[dir=rtl] .mat-mdc-menu-submenu-icon polygon{transform:scaleX(-1);transform-origin:center}@media(forced-colors: active){.mat-mdc-menu-submenu-icon{fill:CanvasText}}.mat-mdc-menu-item .mat-mdc-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
630
611
|
}
|
|
631
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
612
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenu, decorators: [{
|
|
632
613
|
type: Component,
|
|
633
614
|
args: [{ selector: 'mat-menu', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'matMenu', host: {
|
|
634
615
|
'[attr.aria-label]': 'null',
|
|
635
616
|
'[attr.aria-labelledby]': 'null',
|
|
636
617
|
'[attr.aria-describedby]': 'null',
|
|
637
|
-
},
|
|
618
|
+
}, providers: [{ provide: MAT_MENU_PANEL, useExisting: MatMenu }], template: "<ng-template>\n <div\n class=\"mat-mdc-menu-panel\"\n [id]=\"panelId\"\n [class]=\"_classList\"\n [class.mat-menu-panel-animations-disabled]=\"_animationsDisabled\"\n [class.mat-menu-panel-exit-animation]=\"_panelAnimationState === 'void'\"\n [class.mat-menu-panel-animating]=\"_isAnimating\"\n (click)=\"closed.emit('click')\"\n tabindex=\"-1\"\n role=\"menu\"\n (animationstart)=\"_onAnimationStart($event.animationName)\"\n (animationend)=\"_onAnimationDone($event.animationName)\"\n (animationcancel)=\"_onAnimationDone($event.animationName)\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [attr.aria-describedby]=\"ariaDescribedby || null\">\n <div class=\"mat-mdc-menu-content\">\n <ng-content></ng-content>\n </div>\n </div>\n</ng-template>\n", styles: ["mat-menu{display:none}.mat-mdc-menu-content{margin:0;padding:8px 0;outline:0}.mat-mdc-menu-content,.mat-mdc-menu-content .mat-mdc-menu-item .mat-mdc-menu-item-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;flex:1;white-space:normal;font-family:var(--mat-menu-item-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-menu-item-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-menu-item-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-menu-item-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-menu-item-label-text-weight, var(--mat-sys-label-large-weight))}@keyframes _mat-menu-enter{from{opacity:0;transform:scale(0.8)}to{opacity:1;transform:none}}@keyframes _mat-menu-exit{from{opacity:1}to{opacity:0}}.mat-mdc-menu-panel{min-width:112px;max-width:280px;overflow:auto;box-sizing:border-box;outline:0;animation:_mat-menu-enter 120ms cubic-bezier(0, 0, 0.2, 1);border-radius:var(--mat-menu-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mat-menu-container-color, var(--mat-sys-surface-container));box-shadow:var(--mat-menu-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));will-change:transform,opacity}.mat-mdc-menu-panel.mat-menu-panel-exit-animation{animation:_mat-menu-exit 100ms 25ms linear forwards}.mat-mdc-menu-panel.mat-menu-panel-animations-disabled{animation:none}.mat-mdc-menu-panel.mat-menu-panel-animating{pointer-events:none}.mat-mdc-menu-panel.mat-menu-panel-animating:has(.mat-mdc-menu-content:empty){display:none}@media(forced-colors: active){.mat-mdc-menu-panel{outline:solid 1px}}.mat-mdc-menu-panel .mat-divider{color:var(--mat-menu-divider-color, var(--mat-sys-surface-variant));margin-bottom:var(--mat-menu-divider-bottom-spacing, 8px);margin-top:var(--mat-menu-divider-top-spacing, 8px)}.mat-mdc-menu-item{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;cursor:pointer;width:100%;text-align:left;box-sizing:border-box;color:inherit;font-size:inherit;background:none;text-decoration:none;margin:0;min-height:48px;padding-left:var(--mat-menu-item-leading-spacing, 12px);padding-right:var(--mat-menu-item-trailing-spacing, 12px);-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-menu-item::-moz-focus-inner{border:0}[dir=rtl] .mat-mdc-menu-item{padding-left:var(--mat-menu-item-trailing-spacing, 12px);padding-right:var(--mat-menu-item-leading-spacing, 12px)}.mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-leading-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-trailing-spacing, 12px)}[dir=rtl] .mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-trailing-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-leading-spacing, 12px)}.mat-mdc-menu-item,.mat-mdc-menu-item:visited,.mat-mdc-menu-item:link{color:var(--mat-menu-item-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-menu-item .mat-icon-no-color,.mat-mdc-menu-item .mat-mdc-menu-submenu-icon{color:var(--mat-menu-item-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-menu-item[disabled]{cursor:default;opacity:.38}.mat-mdc-menu-item[disabled]::after{display:block;position:absolute;content:\"\";top:0;left:0;bottom:0;right:0}.mat-mdc-menu-item:focus{outline:0}.mat-mdc-menu-item .mat-icon{flex-shrink:0;margin-right:var(--mat-menu-item-spacing, 12px);height:var(--mat-menu-item-icon-size, 24px);width:var(--mat-menu-item-icon-size, 24px)}[dir=rtl] .mat-mdc-menu-item{text-align:right}[dir=rtl] .mat-mdc-menu-item .mat-icon{margin-right:0;margin-left:var(--mat-menu-item-spacing, 12px)}.mat-mdc-menu-item:not([disabled]):hover{background-color:var(--mat-menu-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-menu-item:not([disabled]).cdk-program-focused,.mat-mdc-menu-item:not([disabled]).cdk-keyboard-focused,.mat-mdc-menu-item:not([disabled]).mat-mdc-menu-item-highlighted{background-color:var(--mat-menu-item-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}@media(forced-colors: active){.mat-mdc-menu-item{margin-top:1px}}.mat-mdc-menu-submenu-icon{width:var(--mat-menu-item-icon-size, 24px);height:10px;fill:currentColor;padding-left:var(--mat-menu-item-spacing, 12px)}[dir=rtl] .mat-mdc-menu-submenu-icon{padding-right:var(--mat-menu-item-spacing, 12px);padding-left:0}[dir=rtl] .mat-mdc-menu-submenu-icon polygon{transform:scaleX(-1);transform-origin:center}@media(forced-colors: active){.mat-mdc-menu-submenu-icon{fill:CanvasText}}.mat-mdc-menu-item .mat-mdc-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}"] }]
|
|
638
619
|
}], ctorParameters: () => [], propDecorators: { _allItems: [{
|
|
639
620
|
type: ContentChildren,
|
|
640
621
|
args: [MatMenuItem, { descendants: true }]
|
|
@@ -724,6 +705,7 @@ class MatMenuTrigger {
|
|
|
724
705
|
_closingActionsSubscription = Subscription.EMPTY;
|
|
725
706
|
_hoverSubscription = Subscription.EMPTY;
|
|
726
707
|
_menuCloseSubscription = Subscription.EMPTY;
|
|
708
|
+
_pendingRemoval;
|
|
727
709
|
/**
|
|
728
710
|
* We're specifically looking for a `MatMenu` here since the generic `MatMenuPanel`
|
|
729
711
|
* interface lacks some functionality around nested menus and animations.
|
|
@@ -820,6 +802,7 @@ class MatMenuTrigger {
|
|
|
820
802
|
PANELS_TO_TRIGGERS.delete(this.menu);
|
|
821
803
|
}
|
|
822
804
|
this._element.nativeElement.removeEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
|
|
805
|
+
this._pendingRemoval?.unsubscribe();
|
|
823
806
|
this._menuCloseSubscription.unsubscribe();
|
|
824
807
|
this._closingActionsSubscription.unsubscribe();
|
|
825
808
|
this._hoverSubscription.unsubscribe();
|
|
@@ -850,20 +833,33 @@ class MatMenuTrigger {
|
|
|
850
833
|
if (this._menuOpen || !menu) {
|
|
851
834
|
return;
|
|
852
835
|
}
|
|
836
|
+
this._pendingRemoval?.unsubscribe();
|
|
837
|
+
const previousTrigger = PANELS_TO_TRIGGERS.get(menu);
|
|
838
|
+
PANELS_TO_TRIGGERS.set(menu, this);
|
|
839
|
+
// If the same menu is currently attached to another trigger,
|
|
840
|
+
// we need to close it so it doesn't end up in a broken state.
|
|
841
|
+
if (previousTrigger && previousTrigger !== this) {
|
|
842
|
+
previousTrigger.closeMenu();
|
|
843
|
+
}
|
|
853
844
|
const overlayRef = this._createOverlay(menu);
|
|
854
845
|
const overlayConfig = overlayRef.getConfig();
|
|
855
846
|
const positionStrategy = overlayConfig.positionStrategy;
|
|
856
847
|
this._setPosition(menu, positionStrategy);
|
|
857
848
|
overlayConfig.hasBackdrop =
|
|
858
849
|
menu.hasBackdrop == null ? !this.triggersSubmenu() : menu.hasBackdrop;
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
850
|
+
// We need the `hasAttached` check for the case where the user kicked off a removal animation,
|
|
851
|
+
// but re-entered the menu. Re-attaching the same portal will trigger an error otherwise.
|
|
852
|
+
if (!overlayRef.hasAttached()) {
|
|
853
|
+
overlayRef.attach(this._getPortal(menu));
|
|
854
|
+
menu.lazyContent?.attach(this.menuData);
|
|
862
855
|
}
|
|
863
856
|
this._closingActionsSubscription = this._menuClosingActions().subscribe(() => this.closeMenu());
|
|
864
|
-
this.
|
|
857
|
+
menu.parentMenu = this.triggersSubmenu() ? this._parentMaterialMenu : undefined;
|
|
858
|
+
menu.direction = this.dir;
|
|
859
|
+
menu.focusFirstItem(this._openedBy || 'program');
|
|
860
|
+
this._setIsMenuOpen(true);
|
|
865
861
|
if (menu instanceof MatMenu) {
|
|
866
|
-
menu.
|
|
862
|
+
menu._setIsOpen(true);
|
|
867
863
|
menu._directDescendantItems.changes.pipe(takeUntil(menu.close)).subscribe(() => {
|
|
868
864
|
// Re-adjust the position without locking when the amount of items
|
|
869
865
|
// changes so that the overlay is allowed to pick a new optimal position.
|
|
@@ -896,11 +892,25 @@ class MatMenuTrigger {
|
|
|
896
892
|
}
|
|
897
893
|
/** Closes the menu and does the necessary cleanup. */
|
|
898
894
|
_destroyMenu(reason) {
|
|
899
|
-
|
|
895
|
+
const overlayRef = this._overlayRef;
|
|
896
|
+
const menu = this._menu;
|
|
897
|
+
if (!overlayRef || !this.menuOpen) {
|
|
900
898
|
return;
|
|
901
899
|
}
|
|
902
900
|
this._closingActionsSubscription.unsubscribe();
|
|
903
|
-
this.
|
|
901
|
+
this._pendingRemoval?.unsubscribe();
|
|
902
|
+
// Note that we don't wait for the animation to finish if another trigger took
|
|
903
|
+
// over the menu, because the panel will end up empty which looks glitchy.
|
|
904
|
+
if (menu instanceof MatMenu && this._ownsMenu(menu)) {
|
|
905
|
+
this._pendingRemoval = menu._animationDone.pipe(take(1)).subscribe(() => overlayRef.detach());
|
|
906
|
+
menu._setIsOpen(false);
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
overlayRef.detach();
|
|
910
|
+
}
|
|
911
|
+
if (menu && this._ownsMenu(menu)) {
|
|
912
|
+
PANELS_TO_TRIGGERS.delete(menu);
|
|
913
|
+
}
|
|
904
914
|
// Always restore focus if the user is navigating using the keyboard or the menu was opened
|
|
905
915
|
// programmatically. We don't restore for non-root triggers, because it can prevent focus
|
|
906
916
|
// from making it back to the root trigger when closing a long chain of menus by clicking
|
|
@@ -910,26 +920,6 @@ class MatMenuTrigger {
|
|
|
910
920
|
}
|
|
911
921
|
this._openedBy = undefined;
|
|
912
922
|
this._setIsMenuOpen(false);
|
|
913
|
-
if (this.menu && this._ownsMenu(this.menu)) {
|
|
914
|
-
PANELS_TO_TRIGGERS.delete(this.menu);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
/**
|
|
918
|
-
* This method sets the menu state to open and focuses the first item if
|
|
919
|
-
* the menu was opened via the keyboard.
|
|
920
|
-
*/
|
|
921
|
-
_initMenu(menu) {
|
|
922
|
-
const previousTrigger = PANELS_TO_TRIGGERS.get(menu);
|
|
923
|
-
// If the same menu is currently attached to another trigger,
|
|
924
|
-
// we need to close it so it doesn't end up in a broken state.
|
|
925
|
-
if (previousTrigger && previousTrigger !== this) {
|
|
926
|
-
previousTrigger.closeMenu();
|
|
927
|
-
}
|
|
928
|
-
PANELS_TO_TRIGGERS.set(menu, this);
|
|
929
|
-
menu.parentMenu = this.triggersSubmenu() ? this._parentMaterialMenu : undefined;
|
|
930
|
-
menu.direction = this.dir;
|
|
931
|
-
menu.focusFirstItem(this._openedBy || 'program');
|
|
932
|
-
this._setIsMenuOpen(true);
|
|
933
923
|
}
|
|
934
924
|
// set state rather than toggle to support triggers sharing a menu
|
|
935
925
|
_setIsMenuOpen(isOpen) {
|
|
@@ -1121,10 +1111,10 @@ class MatMenuTrigger {
|
|
|
1121
1111
|
_ownsMenu(menu) {
|
|
1122
1112
|
return PANELS_TO_TRIGGERS.get(menu) === this;
|
|
1123
1113
|
}
|
|
1124
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
1125
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.
|
|
1114
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1115
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.3", type: MatMenuTrigger, isStandalone: true, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: { _deprecatedMatMenuTriggerFor: ["mat-menu-trigger-for", "_deprecatedMatMenuTriggerFor"], menu: ["matMenuTriggerFor", "menu"], menuData: ["matMenuTriggerData", "menuData"], restoreFocus: ["matMenuTriggerRestoreFocus", "restoreFocus"] }, outputs: { menuOpened: "menuOpened", onMenuOpen: "onMenuOpen", menuClosed: "menuClosed", onMenuClose: "onMenuClose" }, host: { listeners: { "click": "_handleClick($event)", "mousedown": "_handleMousedown($event)", "keydown": "_handleKeydown($event)" }, properties: { "attr.aria-haspopup": "menu ? \"menu\" : null", "attr.aria-expanded": "menuOpen", "attr.aria-controls": "menuOpen ? menu.panelId : null" }, classAttribute: "mat-mdc-menu-trigger" }, exportAs: ["matMenuTrigger"], ngImport: i0 });
|
|
1126
1116
|
}
|
|
1127
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
1117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuTrigger, decorators: [{
|
|
1128
1118
|
type: Directive,
|
|
1129
1119
|
args: [{
|
|
1130
1120
|
selector: `[mat-menu-trigger-for], [matMenuTriggerFor]`,
|
|
@@ -1162,8 +1152,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2",
|
|
|
1162
1152
|
}] } });
|
|
1163
1153
|
|
|
1164
1154
|
class MatMenuModule {
|
|
1165
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
1166
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.
|
|
1155
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1156
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuModule, imports: [MatRippleModule,
|
|
1167
1157
|
MatCommonModule,
|
|
1168
1158
|
OverlayModule,
|
|
1169
1159
|
MatMenu,
|
|
@@ -1175,12 +1165,12 @@ class MatMenuModule {
|
|
|
1175
1165
|
MatMenuItem,
|
|
1176
1166
|
MatMenuContent,
|
|
1177
1167
|
MatMenuTrigger] });
|
|
1178
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
1168
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuModule, providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [MatRippleModule,
|
|
1179
1169
|
MatCommonModule,
|
|
1180
1170
|
OverlayModule, CdkScrollableModule,
|
|
1181
1171
|
MatCommonModule] });
|
|
1182
1172
|
}
|
|
1183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.
|
|
1173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatMenuModule, decorators: [{
|
|
1184
1174
|
type: NgModule,
|
|
1185
1175
|
args: [{
|
|
1186
1176
|
imports: [
|
|
@@ -1204,6 +1194,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2",
|
|
|
1204
1194
|
}]
|
|
1205
1195
|
}] });
|
|
1206
1196
|
|
|
1197
|
+
/**
|
|
1198
|
+
* Animations used by the mat-menu component.
|
|
1199
|
+
* Animation duration and timing values are based on:
|
|
1200
|
+
* https://material.io/guidelines/components/menus.html#menus-usage
|
|
1201
|
+
* @docs-private
|
|
1202
|
+
* @deprecated No longer used, will be removed.
|
|
1203
|
+
* @breaking-change 21.0.0
|
|
1204
|
+
*/
|
|
1205
|
+
const matMenuAnimations = {
|
|
1206
|
+
/**
|
|
1207
|
+
* This animation controls the menu panel's entry and exit from the page.
|
|
1208
|
+
*
|
|
1209
|
+
* When the menu panel is added to the DOM, it scales in and fades in its border.
|
|
1210
|
+
*
|
|
1211
|
+
* When the menu panel is removed from the DOM, it simply fades out after a brief
|
|
1212
|
+
* delay to display the ripple.
|
|
1213
|
+
*/
|
|
1214
|
+
transformMenu: trigger('transformMenu', [
|
|
1215
|
+
state('void', style({
|
|
1216
|
+
opacity: 0,
|
|
1217
|
+
transform: 'scale(0.8)',
|
|
1218
|
+
})),
|
|
1219
|
+
transition('void => enter', animate('120ms cubic-bezier(0, 0, 0.2, 1)', style({
|
|
1220
|
+
opacity: 1,
|
|
1221
|
+
transform: 'scale(1)',
|
|
1222
|
+
}))),
|
|
1223
|
+
transition('* => void', animate('100ms 25ms linear', style({ opacity: 0 }))),
|
|
1224
|
+
]),
|
|
1225
|
+
/**
|
|
1226
|
+
* This animation fades in the background color and content of the menu panel
|
|
1227
|
+
* after its containing element is scaled in.
|
|
1228
|
+
*/
|
|
1229
|
+
fadeInItems: trigger('fadeInItems', [
|
|
1230
|
+
// TODO(crisbeto): this is inside the `transformMenu`
|
|
1231
|
+
// now. Remove next time we do breaking changes.
|
|
1232
|
+
state('showing', style({ opacity: 1 })),
|
|
1233
|
+
transition('void => *', [
|
|
1234
|
+
style({ opacity: 0 }),
|
|
1235
|
+
animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
|
|
1236
|
+
]),
|
|
1237
|
+
]),
|
|
1238
|
+
};
|
|
1239
|
+
/**
|
|
1240
|
+
* @deprecated
|
|
1241
|
+
* @breaking-change 8.0.0
|
|
1242
|
+
* @docs-private
|
|
1243
|
+
*/
|
|
1244
|
+
const fadeInItems = matMenuAnimations.fadeInItems;
|
|
1245
|
+
/**
|
|
1246
|
+
* @deprecated
|
|
1247
|
+
* @breaking-change 8.0.0
|
|
1248
|
+
* @docs-private
|
|
1249
|
+
*/
|
|
1250
|
+
const transformMenu = matMenuAnimations.transformMenu;
|
|
1251
|
+
|
|
1207
1252
|
/**
|
|
1208
1253
|
* Generated bundle index. Do not edit.
|
|
1209
1254
|
*/
|