index.d.ts 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. import { _AbstractConstructor } from '@angular/material/core';
  2. import { AfterContentInit } from '@angular/core';
  3. import { AfterViewInit } from '@angular/core';
  4. import { AnimationEvent as AnimationEvent_2 } from '@angular/animations';
  5. import { AnimationTriggerMetadata } from '@angular/animations';
  6. import { ApplicationRef } from '@angular/core';
  7. import { BooleanInput } from '@angular/cdk/coercion';
  8. import { CanDisable } from '@angular/material/core';
  9. import { CanDisableRipple } from '@angular/material/core';
  10. import { ChangeDetectorRef } from '@angular/core';
  11. import { ComponentFactoryResolver } from '@angular/core';
  12. import { _Constructor } from '@angular/material/core';
  13. import { Direction } from '@angular/cdk/bidi';
  14. import { Directionality } from '@angular/cdk/bidi';
  15. import { ElementRef } from '@angular/core';
  16. import { EventEmitter } from '@angular/core';
  17. import { FocusableOption } from '@angular/cdk/a11y';
  18. import { FocusMonitor } from '@angular/cdk/a11y';
  19. import { FocusOrigin } from '@angular/cdk/a11y';
  20. import * as i0 from '@angular/core';
  21. import * as i5 from '@angular/common';
  22. import * as i6 from '@angular/material/core';
  23. import * as i7 from '@angular/cdk/overlay';
  24. import * as i8 from '@angular/cdk/scrolling';
  25. import { InjectionToken } from '@angular/core';
  26. import { Injector } from '@angular/core';
  27. import { NgZone } from '@angular/core';
  28. import { Observable } from 'rxjs';
  29. import { OnDestroy } from '@angular/core';
  30. import { OnInit } from '@angular/core';
  31. import { Overlay } from '@angular/cdk/overlay';
  32. import { QueryList } from '@angular/core';
  33. import { ScrollStrategy } from '@angular/cdk/overlay';
  34. import { Subject } from 'rxjs';
  35. import { TemplateRef } from '@angular/core';
  36. import { ViewContainerRef } from '@angular/core';
  37. /**
  38. * @deprecated
  39. * @breaking-change 8.0.0
  40. * @docs-private
  41. */
  42. export declare const fadeInItems: AnimationTriggerMetadata;
  43. declare namespace i1 {
  44. export {
  45. MAT_MENU_DEFAULT_OPTIONS_FACTORY,
  46. MenuCloseReason,
  47. MatMenuDefaultOptions,
  48. MAT_MENU_DEFAULT_OPTIONS,
  49. _MatMenuBase,
  50. MatMenu
  51. }
  52. }
  53. declare namespace i2 {
  54. export {
  55. MatMenuItem
  56. }
  57. }
  58. declare namespace i3 {
  59. export {
  60. MAT_MENU_CONTENT,
  61. _MatMenuContentBase,
  62. MatMenuContent
  63. }
  64. }
  65. declare namespace i4 {
  66. export {
  67. MAT_MENU_SCROLL_STRATEGY_FACTORY,
  68. MAT_MENU_SCROLL_STRATEGY,
  69. MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER,
  70. MENU_PANEL_TOP_PADDING,
  71. _MatMenuTriggerBase,
  72. MatMenuTrigger
  73. }
  74. }
  75. /**
  76. * Injection token that can be used to reference instances of `MatMenuContent`. It serves
  77. * as alternative token to the actual `MatMenuContent` class which could cause unnecessary
  78. * retention of the class and its directive metadata.
  79. */
  80. export declare const MAT_MENU_CONTENT: InjectionToken<MatMenuContent>;
  81. /** Injection token to be used to override the default options for `mat-menu`. */
  82. export declare const MAT_MENU_DEFAULT_OPTIONS: InjectionToken<MatMenuDefaultOptions>;
  83. /** @docs-private */
  84. declare function MAT_MENU_DEFAULT_OPTIONS_FACTORY(): MatMenuDefaultOptions;
  85. /**
  86. * Injection token used to provide the parent menu to menu-specific components.
  87. * @docs-private
  88. */
  89. export declare const MAT_MENU_PANEL: InjectionToken<MatMenuPanel<any>>;
  90. /** Injection token that determines the scroll handling while the menu is open. */
  91. export declare const MAT_MENU_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
  92. /** @docs-private */
  93. declare function MAT_MENU_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy;
  94. /** @docs-private */
  95. export declare const MAT_MENU_SCROLL_STRATEGY_FACTORY_PROVIDER: {
  96. provide: InjectionToken<() => ScrollStrategy>;
  97. deps: (typeof Overlay)[];
  98. useFactory: typeof MAT_MENU_SCROLL_STRATEGY_FACTORY;
  99. };
  100. export declare class MatMenu extends _MatMenuBase {
  101. protected _elevationPrefix: string;
  102. protected _baseElevation: number;
  103. constructor(elementRef: ElementRef<HTMLElement>, ngZone: NgZone, defaultOptions: MatMenuDefaultOptions);
  104. static ɵfac: i0.ɵɵFactoryDeclaration<MatMenu, never>;
  105. static ɵcmp: i0.ɵɵComponentDeclaration<MatMenu, "mat-menu", ["matMenu"], {}, {}, never, ["*"], false, never>;
  106. }
  107. /**
  108. * Animations used by the mat-menu component.
  109. * Animation duration and timing values are based on:
  110. * https://material.io/guidelines/components/menus.html#menus-usage
  111. * @docs-private
  112. */
  113. export declare const matMenuAnimations: {
  114. readonly transformMenu: AnimationTriggerMetadata;
  115. readonly fadeInItems: AnimationTriggerMetadata;
  116. };
  117. /** Base class with all of the `MatMenu` functionality. */
  118. export declare class _MatMenuBase implements AfterContentInit, MatMenuPanel<MatMenuItem>, OnInit, OnDestroy {
  119. private _elementRef;
  120. private _ngZone;
  121. private _changeDetectorRef?;
  122. private _keyManager;
  123. private _xPosition;
  124. private _yPosition;
  125. private _firstItemFocusSubscription?;
  126. private _previousElevation;
  127. protected _elevationPrefix: string;
  128. protected _baseElevation: number;
  129. /** All items inside the menu. Includes items nested inside another menu. */
  130. _allItems: QueryList<MatMenuItem>;
  131. /** Only the direct descendant menu items. */
  132. _directDescendantItems: QueryList<MatMenuItem>;
  133. /** Config object to be passed into the menu's ngClass */
  134. _classList: {
  135. [key: string]: boolean;
  136. };
  137. /** Current state of the panel animation. */
  138. _panelAnimationState: 'void' | 'enter';
  139. /** Emits whenever an animation on the menu completes. */
  140. readonly _animationDone: Subject<AnimationEvent_2>;
  141. /** Whether the menu is animating. */
  142. _isAnimating: boolean;
  143. /** Parent menu of the current menu panel. */
  144. parentMenu: MatMenuPanel | undefined;
  145. /** Layout direction of the menu. */
  146. direction: Direction;
  147. /** Class or list of classes to be added to the overlay panel. */
  148. overlayPanelClass: string | string[];
  149. /** Class to be added to the backdrop element. */
  150. backdropClass: string;
  151. /** aria-label for the menu panel. */
  152. ariaLabel: string;
  153. /** aria-labelledby for the menu panel. */
  154. ariaLabelledby: string;
  155. /** aria-describedby for the menu panel. */
  156. ariaDescribedby: string;
  157. /** Position of the menu in the X axis. */
  158. get xPosition(): MenuPositionX;
  159. set xPosition(value: MenuPositionX);
  160. /** Position of the menu in the Y axis. */
  161. get yPosition(): MenuPositionY;
  162. set yPosition(value: MenuPositionY);
  163. /** @docs-private */
  164. templateRef: TemplateRef<any>;
  165. /**
  166. * List of the items inside of a menu.
  167. * @deprecated
  168. * @breaking-change 8.0.0
  169. */
  170. items: QueryList<MatMenuItem>;
  171. /**
  172. * Menu content that will be rendered lazily.
  173. * @docs-private
  174. */
  175. lazyContent: MatMenuContent;
  176. /** Whether the menu should overlap its trigger. */
  177. get overlapTrigger(): boolean;
  178. set overlapTrigger(value: BooleanInput);
  179. private _overlapTrigger;
  180. /** Whether the menu has a backdrop. */
  181. get hasBackdrop(): boolean | undefined;
  182. set hasBackdrop(value: BooleanInput);
  183. private _hasBackdrop;
  184. /**
  185. * This method takes classes set on the host mat-menu element and applies them on the
  186. * menu template that displays in the overlay container. Otherwise, it's difficult
  187. * to style the containing menu from outside the component.
  188. * @param classes list of class names
  189. */
  190. set panelClass(classes: string);
  191. private _previousPanelClass;
  192. /**
  193. * This method takes classes set on the host mat-menu element and applies them on the
  194. * menu template that displays in the overlay container. Otherwise, it's difficult
  195. * to style the containing menu from outside the component.
  196. * @deprecated Use `panelClass` instead.
  197. * @breaking-change 8.0.0
  198. */
  199. get classList(): string;
  200. set classList(classes: string);
  201. /** Event emitted when the menu is closed. */
  202. readonly closed: EventEmitter<MenuCloseReason>;
  203. /**
  204. * Event emitted when the menu is closed.
  205. * @deprecated Switch to `closed` instead
  206. * @breaking-change 8.0.0
  207. */
  208. readonly close: EventEmitter<MenuCloseReason>;
  209. readonly panelId: string;
  210. constructor(elementRef: ElementRef<HTMLElement>, ngZone: NgZone, defaultOptions: MatMenuDefaultOptions, changeDetectorRef: ChangeDetectorRef);
  211. /**
  212. * @deprecated `_changeDetectorRef` to become a required parameter.
  213. * @breaking-change 15.0.0
  214. */
  215. constructor(elementRef: ElementRef<HTMLElement>, ngZone: NgZone, defaultOptions: MatMenuDefaultOptions, changeDetectorRef?: ChangeDetectorRef);
  216. ngOnInit(): void;
  217. ngAfterContentInit(): void;
  218. ngOnDestroy(): void;
  219. /** Stream that emits whenever the hovered menu item changes. */
  220. _hovered(): Observable<MatMenuItem>;
  221. addItem(_item: MatMenuItem): void;
  222. /**
  223. * Removes an item from the menu.
  224. * @docs-private
  225. * @deprecated No longer being used. To be removed.
  226. * @breaking-change 9.0.0
  227. */
  228. removeItem(_item: MatMenuItem): void;
  229. /** Handle a keyboard event from the menu, delegating to the appropriate action. */
  230. _handleKeydown(event: KeyboardEvent): void;
  231. /**
  232. * Focus the first item in the menu.
  233. * @param origin Action from which the focus originated. Used to set the correct styling.
  234. */
  235. focusFirstItem(origin?: FocusOrigin): void;
  236. /**
  237. * Resets the active item in the menu. This is used when the menu is opened, allowing
  238. * the user to start from the first option when pressing the down arrow.
  239. */
  240. resetActiveItem(): void;
  241. /**
  242. * Sets the menu panel elevation.
  243. * @param depth Number of parent menus that come before the menu.
  244. */
  245. setElevation(depth: number): void;
  246. /**
  247. * Adds classes to the menu panel based on its position. Can be used by
  248. * consumers to add specific styling based on the position.
  249. * @param posX Position of the menu along the x axis.
  250. * @param posY Position of the menu along the y axis.
  251. * @docs-private
  252. */
  253. setPositionClasses(posX?: MenuPositionX, posY?: MenuPositionY): void;
  254. /** Starts the enter animation. */
  255. _startAnimation(): void;
  256. /** Resets the panel animation to its initial state. */
  257. _resetAnimation(): void;
  258. /** Callback that is invoked when the panel animation completes. */
  259. _onAnimationDone(event: AnimationEvent_2): void;
  260. _onAnimationStart(event: AnimationEvent_2): void;
  261. /**
  262. * Sets up a stream that will keep track of any newly-added menu items and will update the list
  263. * of direct descendants. We collect the descendants this way, because `_allItems` can include
  264. * items that are part of child menus, and using a custom way of registering items is unreliable
  265. * when it comes to maintaining the item order.
  266. */
  267. private _updateDirectDescendants;
  268. static ɵfac: i0.ɵɵFactoryDeclaration<_MatMenuBase, never>;
  269. static ɵdir: i0.ɵɵDirectiveDeclaration<_MatMenuBase, never, never, { "backdropClass": { "alias": "backdropClass"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; }; "xPosition": { "alias": "xPosition"; "required": false; }; "yPosition": { "alias": "yPosition"; "required": false; }; "overlapTrigger": { "alias": "overlapTrigger"; "required": false; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; }; "panelClass": { "alias": "class"; "required": false; }; "classList": { "alias": "classList"; "required": false; }; }, { "closed": "closed"; "close": "close"; }, ["lazyContent", "_allItems", "items"], never, false, never>;
  270. }
  271. /** Menu content that will be rendered lazily once the menu is opened. */
  272. export declare class MatMenuContent extends _MatMenuContentBase {
  273. static ɵfac: i0.ɵɵFactoryDeclaration<MatMenuContent, never>;
  274. static ɵdir: i0.ɵɵDirectiveDeclaration<MatMenuContent, "ng-template[matMenuContent]", never, {}, {}, never, never, false, never>;
  275. }
  276. export declare abstract class _MatMenuContentBase implements OnDestroy {
  277. private _template;
  278. private _componentFactoryResolver;
  279. private _appRef;
  280. private _injector;
  281. private _viewContainerRef;
  282. private _document;
  283. private _changeDetectorRef?;
  284. private _portal;
  285. private _outlet;
  286. /** Emits when the menu content has been attached. */
  287. readonly _attached: Subject<void>;
  288. constructor(template: TemplateRef<any>, componentFactoryResolver: ComponentFactoryResolver, appRef: ApplicationRef, injector: Injector, viewContainerRef: ViewContainerRef, document: any, changeDetectorRef: ChangeDetectorRef);
  289. /**
  290. * @deprecated `changeDetectorRef` is now a required parameter.
  291. * @breaking-change 9.0.0
  292. */
  293. constructor(template: TemplateRef<any>, componentFactoryResolver: ComponentFactoryResolver, appRef: ApplicationRef, injector: Injector, viewContainerRef: ViewContainerRef, document: any, changeDetectorRef?: ChangeDetectorRef);
  294. /**
  295. * Attaches the content with a particular context.
  296. * @docs-private
  297. */
  298. attach(context?: any): void;
  299. /**
  300. * Detaches the content.
  301. * @docs-private
  302. */
  303. detach(): void;
  304. ngOnDestroy(): void;
  305. static ɵfac: i0.ɵɵFactoryDeclaration<_MatMenuContentBase, never>;
  306. static ɵdir: i0.ɵɵDirectiveDeclaration<_MatMenuContentBase, never, never, {}, {}, never, never, false, never>;
  307. }
  308. /** Default `mat-menu` options that can be overridden. */
  309. export declare interface MatMenuDefaultOptions {
  310. /** The x-axis position of the menu. */
  311. xPosition: MenuPositionX;
  312. /** The y-axis position of the menu. */
  313. yPosition: MenuPositionY;
  314. /** Whether the menu should overlap the menu trigger. */
  315. overlapTrigger: boolean;
  316. /** Class to be applied to the menu's backdrop. */
  317. backdropClass: string;
  318. /** Class or list of classes to be applied to the menu's overlay panel. */
  319. overlayPanelClass?: string | string[];
  320. /** Whether the menu has a backdrop. */
  321. hasBackdrop?: boolean;
  322. }
  323. /**
  324. * Single item inside of a `mat-menu`. Provides the menu item styling and accessibility treatment.
  325. */
  326. export declare class MatMenuItem extends _MatMenuItemBase implements FocusableOption, CanDisable, CanDisableRipple, AfterViewInit, OnDestroy {
  327. private _elementRef;
  328. private _document?;
  329. private _focusMonitor?;
  330. _parentMenu?: MatMenuPanel<MatMenuItem> | undefined;
  331. private _changeDetectorRef?;
  332. /** ARIA role for the menu item. */
  333. role: 'menuitem' | 'menuitemradio' | 'menuitemcheckbox';
  334. /** Stream that emits when the menu item is hovered. */
  335. readonly _hovered: Subject<MatMenuItem>;
  336. /** Stream that emits when the menu item is focused. */
  337. readonly _focused: Subject<MatMenuItem>;
  338. /** Whether the menu item is highlighted. */
  339. _highlighted: boolean;
  340. /** Whether the menu item acts as a trigger for a sub-menu. */
  341. _triggersSubmenu: boolean;
  342. constructor(elementRef: ElementRef<HTMLElement>, document: any, focusMonitor: FocusMonitor, parentMenu: MatMenuPanel<MatMenuItem> | undefined, changeDetectorRef: ChangeDetectorRef);
  343. /**
  344. * @deprecated `document`, `changeDetectorRef` and `focusMonitor` to become required.
  345. * @breaking-change 12.0.0
  346. */
  347. constructor(elementRef: ElementRef<HTMLElement>, document?: any, focusMonitor?: FocusMonitor, parentMenu?: MatMenuPanel<MatMenuItem>, changeDetectorRef?: ChangeDetectorRef);
  348. /** Focuses the menu item. */
  349. focus(origin?: FocusOrigin, options?: FocusOptions): void;
  350. ngAfterViewInit(): void;
  351. ngOnDestroy(): void;
  352. /** Used to set the `tabindex`. */
  353. _getTabIndex(): string;
  354. /** Returns the host DOM element. */
  355. _getHostElement(): HTMLElement;
  356. /** Prevents the default element actions if it is disabled. */
  357. _checkDisabled(event: Event): void;
  358. /** Emits to the hover stream. */
  359. _handleMouseEnter(): void;
  360. /** Gets the label to be used when determining whether the option should be focused. */
  361. getLabel(): string;
  362. _setHighlighted(isHighlighted: boolean): void;
  363. _setTriggersSubmenu(triggersSubmenu: boolean): void;
  364. _hasFocus(): boolean;
  365. static ɵfac: i0.ɵɵFactoryDeclaration<MatMenuItem, [null, null, null, { optional: true; }, null]>;
  366. static ɵcmp: i0.ɵɵComponentDeclaration<MatMenuItem, "[mat-menu-item]", ["matMenuItem"], { "disabled": { "alias": "disabled"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "role": { "alias": "role"; "required": false; }; }, {}, never, ["mat-icon, [matMenuItemIcon]", "*"], false, never>;
  367. }
  368. /** @docs-private */
  369. declare const _MatMenuItemBase: _Constructor<CanDisableRipple> & _AbstractConstructor<CanDisableRipple> & _Constructor<CanDisable> & _AbstractConstructor<CanDisable> & {
  370. new (): {};
  371. };
  372. export declare class MatMenuModule {
  373. static ɵfac: i0.ɵɵFactoryDeclaration<MatMenuModule, never>;
  374. static ɵmod: i0.ɵɵNgModuleDeclaration<MatMenuModule, [typeof i1.MatMenu, typeof i2.MatMenuItem, typeof i3.MatMenuContent, typeof i4.MatMenuTrigger], [typeof i5.CommonModule, typeof i6.MatRippleModule, typeof i6.MatCommonModule, typeof i7.OverlayModule], [typeof i8.CdkScrollableModule, typeof i1.MatMenu, typeof i6.MatCommonModule, typeof i2.MatMenuItem, typeof i3.MatMenuContent, typeof i4.MatMenuTrigger]>;
  375. static ɵinj: i0.ɵɵInjectorDeclaration<MatMenuModule>;
  376. }
  377. /**
  378. * Interface for a custom menu panel that can be used with `matMenuTriggerFor`.
  379. * @docs-private
  380. */
  381. export declare interface MatMenuPanel<T = any> {
  382. xPosition: MenuPositionX;
  383. yPosition: MenuPositionY;
  384. overlapTrigger: boolean;
  385. templateRef: TemplateRef<any>;
  386. readonly close: EventEmitter<void | 'click' | 'keydown' | 'tab'>;
  387. parentMenu?: MatMenuPanel | undefined;
  388. direction?: Direction;
  389. focusFirstItem: (origin?: FocusOrigin) => void;
  390. resetActiveItem: () => void;
  391. setPositionClasses?: (x: MenuPositionX, y: MenuPositionY) => void;
  392. setElevation?(depth: number): void;
  393. lazyContent?: MatMenuContent;
  394. backdropClass?: string;
  395. overlayPanelClass?: string | string[];
  396. hasBackdrop?: boolean;
  397. readonly panelId?: string;
  398. /**
  399. * @deprecated To be removed.
  400. * @breaking-change 8.0.0
  401. */
  402. addItem?: (item: T) => void;
  403. /**
  404. * @deprecated To be removed.
  405. * @breaking-change 8.0.0
  406. */
  407. removeItem?: (item: T) => void;
  408. }
  409. /** Directive applied to an element that should trigger a `mat-menu`. */
  410. export declare class MatMenuTrigger extends _MatMenuTriggerBase {
  411. static ɵfac: i0.ɵɵFactoryDeclaration<MatMenuTrigger, never>;
  412. static ɵdir: i0.ɵɵDirectiveDeclaration<MatMenuTrigger, "[mat-menu-trigger-for], [matMenuTriggerFor]", ["matMenuTrigger"], {}, {}, never, never, false, never>;
  413. }
  414. export declare abstract class _MatMenuTriggerBase implements AfterContentInit, OnDestroy {
  415. private _overlay;
  416. private _element;
  417. private _viewContainerRef;
  418. private _menuItemInstance;
  419. private _dir;
  420. private _focusMonitor;
  421. private _ngZone?;
  422. private _portal;
  423. private _overlayRef;
  424. private _menuOpen;
  425. private _closingActionsSubscription;
  426. private _hoverSubscription;
  427. private _menuCloseSubscription;
  428. private _scrollStrategy;
  429. private _changeDetectorRef;
  430. /**
  431. * We're specifically looking for a `MatMenu` here since the generic `MatMenuPanel`
  432. * interface lacks some functionality around nested menus and animations.
  433. */
  434. private _parentMaterialMenu;
  435. /**
  436. * Cached value of the padding of the parent menu panel.
  437. * Used to offset sub-menus to compensate for the padding.
  438. */
  439. private _parentInnerPadding;
  440. /**
  441. * Handles touch start events on the trigger.
  442. * Needs to be an arrow function so we can easily use addEventListener and removeEventListener.
  443. */
  444. private _handleTouchStart;
  445. _openedBy: Exclude<FocusOrigin, 'program' | null> | undefined;
  446. /**
  447. * @deprecated
  448. * @breaking-change 8.0.0
  449. */
  450. get _deprecatedMatMenuTriggerFor(): MatMenuPanel | null;
  451. set _deprecatedMatMenuTriggerFor(v: MatMenuPanel | null);
  452. /** References the menu instance that the trigger is associated with. */
  453. get menu(): MatMenuPanel | null;
  454. set menu(menu: MatMenuPanel | null);
  455. private _menu;
  456. /** Data to be passed along to any lazily-rendered content. */
  457. menuData: any;
  458. /**
  459. * Whether focus should be restored when the menu is closed.
  460. * Note that disabling this option can have accessibility implications
  461. * and it's up to you to manage focus, if you decide to turn it off.
  462. */
  463. restoreFocus: boolean;
  464. /** Event emitted when the associated menu is opened. */
  465. readonly menuOpened: EventEmitter<void>;
  466. /**
  467. * Event emitted when the associated menu is opened.
  468. * @deprecated Switch to `menuOpened` instead
  469. * @breaking-change 8.0.0
  470. */
  471. readonly onMenuOpen: EventEmitter<void>;
  472. /** Event emitted when the associated menu is closed. */
  473. readonly menuClosed: EventEmitter<void>;
  474. /**
  475. * Event emitted when the associated menu is closed.
  476. * @deprecated Switch to `menuClosed` instead
  477. * @breaking-change 8.0.0
  478. */
  479. readonly onMenuClose: EventEmitter<void>;
  480. constructor(overlay: Overlay, element: ElementRef<HTMLElement>, viewContainerRef: ViewContainerRef, scrollStrategy: any, parentMenu: MatMenuPanel, menuItemInstance: MatMenuItem, dir: Directionality, focusMonitor: FocusMonitor, ngZone: NgZone);
  481. /**
  482. * @deprecated `focusMonitor` will become a required parameter.
  483. * @breaking-change 8.0.0
  484. */
  485. constructor(overlay: Overlay, element: ElementRef<HTMLElement>, viewContainerRef: ViewContainerRef, scrollStrategy: any, parentMenu: MatMenuPanel, menuItemInstance: MatMenuItem, dir: Directionality, focusMonitor?: FocusMonitor | null);
  486. /**
  487. * @deprecated `ngZone` will become a required parameter.
  488. * @breaking-change 15.0.0
  489. */
  490. constructor(overlay: Overlay, element: ElementRef<HTMLElement>, viewContainerRef: ViewContainerRef, scrollStrategy: any, parentMenu: MatMenuPanel, menuItemInstance: MatMenuItem, dir: Directionality, focusMonitor: FocusMonitor);
  491. ngAfterContentInit(): void;
  492. ngOnDestroy(): void;
  493. /** Whether the menu is open. */
  494. get menuOpen(): boolean;
  495. /** The text direction of the containing app. */
  496. get dir(): Direction;
  497. /** Whether the menu triggers a sub-menu or a top-level one. */
  498. triggersSubmenu(): boolean;
  499. /** Toggles the menu between the open and closed states. */
  500. toggleMenu(): void;
  501. /** Opens the menu. */
  502. openMenu(): void;
  503. /** Closes the menu. */
  504. closeMenu(): void;
  505. /**
  506. * Focuses the menu trigger.
  507. * @param origin Source of the menu trigger's focus.
  508. */
  509. focus(origin?: FocusOrigin, options?: FocusOptions): void;
  510. /**
  511. * Updates the position of the menu to ensure that it fits all options within the viewport.
  512. */
  513. updatePosition(): void;
  514. /** Closes the menu and does the necessary cleanup. */
  515. private _destroyMenu;
  516. /**
  517. * This method sets the menu state to open and focuses the first item if
  518. * the menu was opened via the keyboard.
  519. */
  520. private _initMenu;
  521. /** Updates the menu elevation based on the amount of parent menus that it has. */
  522. private _setMenuElevation;
  523. private _setIsMenuOpen;
  524. /**
  525. * This method creates the overlay from the provided menu's template and saves its
  526. * OverlayRef so that it can be attached to the DOM when openMenu is called.
  527. */
  528. private _createOverlay;
  529. /**
  530. * This method builds the configuration object needed to create the overlay, the OverlayState.
  531. * @returns OverlayConfig
  532. */
  533. private _getOverlayConfig;
  534. /**
  535. * Listens to changes in the position of the overlay and sets the correct classes
  536. * on the menu based on the new position. This ensures the animation origin is always
  537. * correct, even if a fallback position is used for the overlay.
  538. */
  539. private _subscribeToPositions;
  540. /**
  541. * Sets the appropriate positions on a position strategy
  542. * so the overlay connects with the trigger correctly.
  543. * @param positionStrategy Strategy whose position to update.
  544. */
  545. private _setPosition;
  546. /** Returns a stream that emits whenever an action that should close the menu occurs. */
  547. private _menuClosingActions;
  548. /** Handles mouse presses on the trigger. */
  549. _handleMousedown(event: MouseEvent): void;
  550. /** Handles key presses on the trigger. */
  551. _handleKeydown(event: KeyboardEvent): void;
  552. /** Handles click events on the trigger. */
  553. _handleClick(event: MouseEvent): void;
  554. /** Handles the cases where the user hovers over the trigger. */
  555. private _handleHover;
  556. /** Gets the portal that should be attached to the overlay. */
  557. private _getPortal;
  558. static ɵfac: i0.ɵɵFactoryDeclaration<_MatMenuTriggerBase, [null, null, null, null, { optional: true; }, { optional: true; self: true; }, { optional: true; }, null, null]>;
  559. static ɵdir: i0.ɵɵDirectiveDeclaration<_MatMenuTriggerBase, never, never, { "_deprecatedMatMenuTriggerFor": { "alias": "mat-menu-trigger-for"; "required": false; }; "menu": { "alias": "matMenuTriggerFor"; "required": false; }; "menuData": { "alias": "matMenuTriggerData"; "required": false; }; "restoreFocus": { "alias": "matMenuTriggerRestoreFocus"; "required": false; }; }, { "menuOpened": "menuOpened"; "onMenuOpen": "onMenuOpen"; "menuClosed": "menuClosed"; "onMenuClose": "onMenuClose"; }, never, never, false, never>;
  560. }
  561. /**
  562. * Default top padding of the menu panel.
  563. * @deprecated No longer being used. Will be removed.
  564. * @breaking-change 15.0.0
  565. */
  566. export declare const MENU_PANEL_TOP_PADDING = 8;
  567. /** Reason why the menu was closed. */
  568. export declare type MenuCloseReason = void | 'click' | 'keydown' | 'tab';
  569. export declare type MenuPositionX = 'before' | 'after';
  570. export declare type MenuPositionY = 'above' | 'below';
  571. /**
  572. * @deprecated
  573. * @breaking-change 8.0.0
  574. * @docs-private
  575. */
  576. export declare const transformMenu: AnimationTriggerMetadata;
  577. export { }