@angular/material 19.1.0-next.0 → 19.1.0-next.2
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/expansion/index.d.ts +9 -8
- package/fesm2022/autocomplete.mjs +13 -13
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge.mjs +10 -10
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +10 -10
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +38 -27
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +34 -34
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +14 -14
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips.mjs +40 -40
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +66 -66
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +82 -82
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +25 -25
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion.mjs +112 -105
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +34 -34
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon/testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +10 -10
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input.mjs +7 -7
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list.mjs +49 -49
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +57 -72
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator.mjs +40 -31
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +7 -7
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +7 -7
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio.mjs +10 -10
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select.mjs +24 -13
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +22 -22
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +14 -14
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider.mjs +16 -16
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +22 -22
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort.mjs +98 -210
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper.mjs +31 -31
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +55 -55
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +44 -43
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +54 -39
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +10 -10
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +10 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree.mjs +25 -25
- package/fesm2022/tree.mjs.map +1 -1
- package/menu/index.d.ts +6 -0
- package/package.json +2 -2
- package/paginator/index.d.ts +8 -0
- package/radio/index.d.ts +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/theme-color/index_bundled.js +2 -2
- package/schematics/ng-update/index_bundled.js +50 -41
- package/schematics/ng-update/index_bundled.js.map +2 -2
- package/select/index.d.ts +15 -2
- package/sort/index.d.ts +15 -48
- package/timepicker/index.d.ts +3 -0
package/fesm2022/menu.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import * as i0 from '@angular/core';
|
|
|
2
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';
|
|
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
|
-
import { Subject, merge, Subscription, of
|
|
6
|
-
import { startWith, switchMap, takeUntil, filter
|
|
5
|
+
import { Subject, merge, Subscription, of } from 'rxjs';
|
|
6
|
+
import { startWith, switchMap, takeUntil, 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';
|
|
@@ -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.0.
|
|
122
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.
|
|
121
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
122
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0-next.2", 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.0.
|
|
124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuItem, decorators: [{
|
|
125
125
|
type: Component,
|
|
126
126
|
args: [{ selector: '[mat-menu-item]', exportAs: 'matMenuItem', host: {
|
|
127
127
|
'[attr.role]': 'role',
|
|
@@ -222,19 +222,18 @@ class MatMenuContent {
|
|
|
222
222
|
* @docs-private
|
|
223
223
|
*/
|
|
224
224
|
detach() {
|
|
225
|
-
if (this._portal
|
|
225
|
+
if (this._portal?.isAttached) {
|
|
226
226
|
this._portal.detach();
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
ngOnDestroy() {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
230
|
+
this.detach();
|
|
231
|
+
this._outlet?.dispose();
|
|
233
232
|
}
|
|
234
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
235
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.
|
|
233
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
234
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", type: MatMenuContent, isStandalone: true, selector: "ng-template[matMenuContent]", providers: [{ provide: MAT_MENU_CONTENT, useExisting: MatMenuContent }], ngImport: i0 });
|
|
236
235
|
}
|
|
237
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuContent, decorators: [{
|
|
238
237
|
type: Directive,
|
|
239
238
|
args: [{
|
|
240
239
|
selector: 'ng-template[matMenuContent]',
|
|
@@ -626,10 +625,10 @@ class MatMenu {
|
|
|
626
625
|
this._directDescendantItems.notifyOnChanges();
|
|
627
626
|
});
|
|
628
627
|
}
|
|
629
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
630
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.0.
|
|
628
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
629
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.0-next.2", 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 (click)=\"closed.emit('click')\"\n [@transformMenu]=\"_panelAnimationState\"\n (@transformMenu.start)=\"_onAnimationStart($event)\"\n (@transformMenu.done)=\"_onAnimationDone($event)\"\n tabindex=\"-1\"\n role=\"menu\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [attr.aria-describedby]=\"ariaDescribedby || null\">\n <div class=\"mat-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))}.mat-mdc-menu-panel{min-width:112px;max-width:280px;overflow:auto;box-sizing:border-box;outline:0;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.ng-animating{pointer-events:none}.mat-mdc-menu-panel.ng-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}"], animations: [matMenuAnimations.transformMenu, matMenuAnimations.fadeInItems], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
631
630
|
}
|
|
632
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenu, decorators: [{
|
|
633
632
|
type: Component,
|
|
634
633
|
args: [{ selector: 'mat-menu', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'matMenu', host: {
|
|
635
634
|
'[attr.aria-label]': 'null',
|
|
@@ -706,6 +705,8 @@ const passiveEventListenerOptions = normalizePassiveListenerOptions({ passive: t
|
|
|
706
705
|
* @breaking-change 15.0.0
|
|
707
706
|
*/
|
|
708
707
|
const MENU_PANEL_TOP_PADDING = 8;
|
|
708
|
+
/** Mapping between menu panels and the last trigger that opened them. */
|
|
709
|
+
const PANELS_TO_TRIGGERS = new WeakMap();
|
|
709
710
|
/** Directive applied to an element that should trigger a `mat-menu`. */
|
|
710
711
|
class MatMenuTrigger {
|
|
711
712
|
_overlay = inject(Overlay);
|
|
@@ -815,14 +816,17 @@ class MatMenuTrigger {
|
|
|
815
816
|
this._handleHover();
|
|
816
817
|
}
|
|
817
818
|
ngOnDestroy() {
|
|
818
|
-
if (this.
|
|
819
|
-
this.
|
|
820
|
-
this._overlayRef = null;
|
|
819
|
+
if (this.menu && this._ownsMenu(this.menu)) {
|
|
820
|
+
PANELS_TO_TRIGGERS.delete(this.menu);
|
|
821
821
|
}
|
|
822
822
|
this._element.nativeElement.removeEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
|
|
823
823
|
this._menuCloseSubscription.unsubscribe();
|
|
824
824
|
this._closingActionsSubscription.unsubscribe();
|
|
825
825
|
this._hoverSubscription.unsubscribe();
|
|
826
|
+
if (this._overlayRef) {
|
|
827
|
+
this._overlayRef.dispose();
|
|
828
|
+
this._overlayRef = null;
|
|
829
|
+
}
|
|
826
830
|
}
|
|
827
831
|
/** Whether the menu is open. */
|
|
828
832
|
get menuOpen() {
|
|
@@ -895,7 +899,6 @@ class MatMenuTrigger {
|
|
|
895
899
|
if (!this._overlayRef || !this.menuOpen) {
|
|
896
900
|
return;
|
|
897
901
|
}
|
|
898
|
-
const menu = this.menu;
|
|
899
902
|
this._closingActionsSubscription.unsubscribe();
|
|
900
903
|
this._overlayRef.detach();
|
|
901
904
|
// Always restore focus if the user is navigating using the keyboard or the menu was opened
|
|
@@ -906,27 +909,9 @@ class MatMenuTrigger {
|
|
|
906
909
|
this.focus(this._openedBy);
|
|
907
910
|
}
|
|
908
911
|
this._openedBy = undefined;
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
// Wait for the exit animation to finish before detaching the content.
|
|
913
|
-
menu._animationDone
|
|
914
|
-
.pipe(filter(event => event.toState === 'void'), take(1),
|
|
915
|
-
// Interrupt if the content got re-attached.
|
|
916
|
-
takeUntil(menu.lazyContent._attached))
|
|
917
|
-
.subscribe({
|
|
918
|
-
next: () => menu.lazyContent.detach(),
|
|
919
|
-
// No matter whether the content got re-attached, reset the menu.
|
|
920
|
-
complete: () => this._setIsMenuOpen(false),
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
else {
|
|
924
|
-
this._setIsMenuOpen(false);
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
else {
|
|
928
|
-
this._setIsMenuOpen(false);
|
|
929
|
-
menu?.lazyContent?.detach();
|
|
912
|
+
this._setIsMenuOpen(false);
|
|
913
|
+
if (this.menu && this._ownsMenu(this.menu)) {
|
|
914
|
+
PANELS_TO_TRIGGERS.delete(this.menu);
|
|
930
915
|
}
|
|
931
916
|
}
|
|
932
917
|
/**
|
|
@@ -934,6 +919,13 @@ class MatMenuTrigger {
|
|
|
934
919
|
* the menu was opened via the keyboard.
|
|
935
920
|
*/
|
|
936
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);
|
|
937
929
|
menu.parentMenu = this.triggersSubmenu() ? this._parentMaterialMenu : undefined;
|
|
938
930
|
menu.direction = this.dir;
|
|
939
931
|
menu.focusFirstItem(this._openedBy || 'program');
|
|
@@ -1054,7 +1046,9 @@ class MatMenuTrigger {
|
|
|
1054
1046
|
const detachments = this._overlayRef.detachments();
|
|
1055
1047
|
const parentClose = this._parentMaterialMenu ? this._parentMaterialMenu.closed : of();
|
|
1056
1048
|
const hover = this._parentMaterialMenu
|
|
1057
|
-
? this._parentMaterialMenu
|
|
1049
|
+
? this._parentMaterialMenu
|
|
1050
|
+
._hovered()
|
|
1051
|
+
.pipe(filter(active => this._menuOpen && active !== this._menuItemInstance))
|
|
1058
1052
|
: of();
|
|
1059
1053
|
return merge(backdrop, parentClose, hover, detachments);
|
|
1060
1054
|
}
|
|
@@ -1100,31 +1094,14 @@ class MatMenuTrigger {
|
|
|
1100
1094
|
/** Handles the cases where the user hovers over the trigger. */
|
|
1101
1095
|
_handleHover() {
|
|
1102
1096
|
// Subscribe to changes in the hovered item in order to toggle the panel.
|
|
1103
|
-
if (
|
|
1104
|
-
|
|
1097
|
+
if (this.triggersSubmenu() && this._parentMaterialMenu) {
|
|
1098
|
+
this._hoverSubscription = this._parentMaterialMenu._hovered().subscribe(active => {
|
|
1099
|
+
if (active === this._menuItemInstance && !active.disabled) {
|
|
1100
|
+
this._openedBy = 'mouse';
|
|
1101
|
+
this.openMenu();
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1105
1104
|
}
|
|
1106
|
-
this._hoverSubscription = this._parentMaterialMenu
|
|
1107
|
-
._hovered()
|
|
1108
|
-
// Since we might have multiple competing triggers for the same menu (e.g. a sub-menu
|
|
1109
|
-
// with different data and triggers), we have to delay it by a tick to ensure that
|
|
1110
|
-
// it won't be closed immediately after it is opened.
|
|
1111
|
-
.pipe(filter(active => active === this._menuItemInstance && !active.disabled), delay(0, asapScheduler))
|
|
1112
|
-
.subscribe(() => {
|
|
1113
|
-
this._openedBy = 'mouse';
|
|
1114
|
-
// If the same menu is used between multiple triggers, it might still be animating
|
|
1115
|
-
// while the new trigger tries to re-open it. Wait for the animation to finish
|
|
1116
|
-
// before doing so. Also interrupt if the user moves to another item.
|
|
1117
|
-
if (this.menu instanceof MatMenu && this.menu._isAnimating) {
|
|
1118
|
-
// We need the `delay(0)` here in order to avoid
|
|
1119
|
-
// 'changed after checked' errors in some cases. See #12194.
|
|
1120
|
-
this.menu._animationDone
|
|
1121
|
-
.pipe(take(1), delay(0, asapScheduler), takeUntil(this._parentMaterialMenu._hovered()))
|
|
1122
|
-
.subscribe(() => this.openMenu());
|
|
1123
|
-
}
|
|
1124
|
-
else {
|
|
1125
|
-
this.openMenu();
|
|
1126
|
-
}
|
|
1127
|
-
});
|
|
1128
1105
|
}
|
|
1129
1106
|
/** Gets the portal that should be attached to the overlay. */
|
|
1130
1107
|
_getPortal(menu) {
|
|
@@ -1136,10 +1113,18 @@ class MatMenuTrigger {
|
|
|
1136
1113
|
}
|
|
1137
1114
|
return this._portal;
|
|
1138
1115
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1116
|
+
/**
|
|
1117
|
+
* Determines whether the trigger owns a specific menu panel, at the current point in time.
|
|
1118
|
+
* This allows us to distinguish the case where the same panel is passed into multiple triggers
|
|
1119
|
+
* and multiple are open at a time.
|
|
1120
|
+
*/
|
|
1121
|
+
_ownsMenu(menu) {
|
|
1122
|
+
return PANELS_TO_TRIGGERS.get(menu) === this;
|
|
1123
|
+
}
|
|
1124
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1125
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0-next.2", 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 });
|
|
1141
1126
|
}
|
|
1142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuTrigger, decorators: [{
|
|
1143
1128
|
type: Directive,
|
|
1144
1129
|
args: [{
|
|
1145
1130
|
selector: `[mat-menu-trigger-for], [matMenuTriggerFor]`,
|
|
@@ -1177,8 +1162,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
1177
1162
|
}] } });
|
|
1178
1163
|
|
|
1179
1164
|
class MatMenuModule {
|
|
1180
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
1181
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.
|
|
1165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1166
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuModule, imports: [MatRippleModule,
|
|
1182
1167
|
MatCommonModule,
|
|
1183
1168
|
OverlayModule,
|
|
1184
1169
|
MatMenu,
|
|
@@ -1190,12 +1175,12 @@ class MatMenuModule {
|
|
|
1190
1175
|
MatMenuItem,
|
|
1191
1176
|
MatMenuContent,
|
|
1192
1177
|
MatMenuTrigger] });
|
|
1193
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.
|
|
1178
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuModule, providers: [MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [MatRippleModule,
|
|
1194
1179
|
MatCommonModule,
|
|
1195
1180
|
OverlayModule, CdkScrollableModule,
|
|
1196
1181
|
MatCommonModule] });
|
|
1197
1182
|
}
|
|
1198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
1183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatMenuModule, decorators: [{
|
|
1199
1184
|
type: NgModule,
|
|
1200
1185
|
args: [{
|
|
1201
1186
|
imports: [
|