menu-panel.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. import { EventEmitter, TemplateRef, InjectionToken } from '@angular/core';
  9. import { MenuPositionX, MenuPositionY } from './menu-positions';
  10. import { Direction } from '@angular/cdk/bidi';
  11. import { FocusOrigin } from '@angular/cdk/a11y';
  12. import { MatMenuContent } from './menu-content';
  13. /**
  14. * Injection token used to provide the parent menu to menu-specific components.
  15. * @docs-private
  16. */
  17. export declare const MAT_MENU_PANEL: InjectionToken<MatMenuPanel<any>>;
  18. /**
  19. * Interface for a custom menu panel that can be used with `matMenuTriggerFor`.
  20. * @docs-private
  21. */
  22. export interface MatMenuPanel<T = any> {
  23. xPosition: MenuPositionX;
  24. yPosition: MenuPositionY;
  25. overlapTrigger: boolean;
  26. templateRef: TemplateRef<any>;
  27. close: EventEmitter<void | 'click' | 'keydown' | 'tab'>;
  28. parentMenu?: MatMenuPanel | undefined;
  29. direction?: Direction;
  30. focusFirstItem: (origin?: FocusOrigin) => void;
  31. resetActiveItem: () => void;
  32. setPositionClasses?: (x: MenuPositionX, y: MenuPositionY) => void;
  33. setElevation?(depth: number): void;
  34. lazyContent?: MatMenuContent;
  35. backdropClass?: string;
  36. hasBackdrop?: boolean;
  37. /**
  38. * @deprecated To be removed.
  39. * @breaking-change 8.0.0
  40. */
  41. addItem?: (item: T) => void;
  42. /**
  43. * @deprecated To be removed.
  44. * @breaking-change 8.0.0
  45. */
  46. removeItem?: (item: T) => void;
  47. }