@angular/material 12.1.3 → 12.1.4

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.
@@ -536,13 +536,19 @@
536
536
  * @deprecated `_document` parameter is no longer being used and will be removed.
537
537
  * @breaking-change 12.0.0
538
538
  */
539
- _document, _focusMonitor, _parentMenu) {
539
+ _document, _focusMonitor, _parentMenu,
540
+ /**
541
+ * @deprecated `_changeDetectorRef` to become a required parameter.
542
+ * @breaking-change 14.0.0
543
+ */
544
+ _changeDetectorRef) {
540
545
  var _this =
541
546
  // @breaking-change 8.0.0 make `_focusMonitor` and `document` required params.
542
547
  _super.call(this) || this;
543
548
  _this._elementRef = _elementRef;
544
549
  _this._focusMonitor = _focusMonitor;
545
550
  _this._parentMenu = _parentMenu;
551
+ _this._changeDetectorRef = _changeDetectorRef;
546
552
  /** ARIA role for the menu item. */
547
553
  _this.role = 'menuitem';
548
554
  /** Stream that emits when the menu item is hovered. */
@@ -627,6 +633,15 @@
627
633
  }
628
634
  return ((_b = clone.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || '';
629
635
  };
636
+ MatMenuItem.prototype._setHighlighted = function (isHighlighted) {
637
+ var _a;
638
+ // We need to mark this for check for the case where the content is coming from a
639
+ // `matMenuContent` whose change detection tree is at the declaration position,
640
+ // not the insertion position. See #23175.
641
+ // @breaking-change 14.0.0 Remove null check for `_changeDetectorRef`.
642
+ this._highlighted = isHighlighted;
643
+ (_a = this._changeDetectorRef) === null || _a === void 0 ? void 0 : _a.markForCheck();
644
+ };
630
645
  return MatMenuItem;
631
646
  }(_MatMenuItemBase));
632
647
  MatMenuItem.decorators = [
@@ -653,7 +668,8 @@
653
668
  { type: core.ElementRef },
654
669
  { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
655
670
  { type: a11y.FocusMonitor },
656
- { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_PANEL,] }, { type: core.Optional }] }
671
+ { type: undefined, decorators: [{ type: core.Inject, args: [MAT_MENU_PANEL,] }, { type: core.Optional }] },
672
+ { type: core.ChangeDetectorRef }
657
673
  ]; };
658
674
  MatMenuItem.propDecorators = {
659
675
  role: [{ type: core.Input }],
@@ -1332,7 +1348,7 @@
1332
1348
  this._menuOpen = isOpen;
1333
1349
  this._menuOpen ? this.menuOpened.emit() : this.menuClosed.emit();
1334
1350
  if (this.triggersSubmenu()) {
1335
- this._menuItemInstance._highlighted = isOpen;
1351
+ this._menuItemInstance._setHighlighted(isOpen);
1336
1352
  }
1337
1353
  };
1338
1354
  /**