menu-controller.d.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import type { MenuControllerI, AnimationBuilder, MenuI, Animation } from '@ionic/core/components';
  2. export declare class MenuController implements MenuControllerI {
  3. private menuController;
  4. constructor(menuController: MenuControllerI);
  5. /**
  6. * Programmatically open the Menu.
  7. * @param [menuId] Optionally get the menu by its id, or side.
  8. * @return returns a promise when the menu is fully opened
  9. */
  10. open(menuId?: string): Promise<boolean>;
  11. /**
  12. * Programmatically close the Menu. If no `menuId` is given as the first
  13. * argument then it'll close any menu which is open. If a `menuId`
  14. * is given then it'll close that exact menu.
  15. * @param [menuId] Optionally get the menu by its id, or side.
  16. * @return returns a promise when the menu is fully closed
  17. */
  18. close(menuId?: string): Promise<boolean>;
  19. /**
  20. * Toggle the menu. If it's closed, it will open, and if opened, it
  21. * will close.
  22. * @param [menuId] Optionally get the menu by its id, or side.
  23. * @return returns a promise when the menu has been toggled
  24. */
  25. toggle(menuId?: string): Promise<boolean>;
  26. /**
  27. * Used to enable or disable a menu. For example, there could be multiple
  28. * left menus, but only one of them should be able to be opened at the same
  29. * time. If there are multiple menus on the same side, then enabling one menu
  30. * will also automatically disable all the others that are on the same side.
  31. * @param [menuId] Optionally get the menu by its id, or side.
  32. * @return Returns the instance of the menu, which is useful for chaining.
  33. */
  34. enable(shouldEnable: boolean, menuId?: string): Promise<HTMLIonMenuElement | undefined>;
  35. /**
  36. * Used to enable or disable the ability to swipe open the menu.
  37. * @param shouldEnable True if it should be swipe-able, false if not.
  38. * @param [menuId] Optionally get the menu by its id, or side.
  39. * @return Returns the instance of the menu, which is useful for chaining.
  40. */
  41. swipeGesture(shouldEnable: boolean, menuId?: string): Promise<HTMLIonMenuElement | undefined>;
  42. /**
  43. * @param [menuId] Optionally get the menu by its id, or side.
  44. * @return Returns true if the specified menu is currently open, otherwise false.
  45. * If the menuId is not specified, it returns true if ANY menu is currenly open.
  46. */
  47. isOpen(menuId?: string): Promise<boolean>;
  48. /**
  49. * @param [menuId] Optionally get the menu by its id, or side.
  50. * @return Returns true if the menu is currently enabled, otherwise false.
  51. */
  52. isEnabled(menuId?: string): Promise<boolean>;
  53. /**
  54. * Used to get a menu instance. If a `menuId` is not provided then it'll
  55. * return the first menu found. If a `menuId` is `left` or `right`, then
  56. * it'll return the enabled menu on that side. Otherwise, if a `menuId` is
  57. * provided, then it'll try to find the menu using the menu's `id`
  58. * property. If a menu is not found then it'll return `null`.
  59. * @param [menuId] Optionally get the menu by its id, or side.
  60. * @return Returns the instance of the menu if found, otherwise `null`.
  61. */
  62. get(menuId?: string): Promise<HTMLIonMenuElement | undefined>;
  63. /**
  64. * @return Returns the instance of the menu already opened, otherwise `null`.
  65. */
  66. getOpen(): Promise<HTMLIonMenuElement | undefined>;
  67. /**
  68. * @return Returns an array of all menu instances.
  69. */
  70. getMenus(): Promise<HTMLIonMenuElement[]>;
  71. registerAnimation(name: string, animation: AnimationBuilder): void;
  72. isAnimating(): Promise<boolean>;
  73. _getOpenSync(): HTMLIonMenuElement | undefined;
  74. _createAnimation(type: string, menuCmp: MenuI): Promise<Animation>;
  75. _register(menu: MenuI): void;
  76. _unregister(menu: MenuI): void;
  77. _setOpen(menu: MenuI, shouldOpen: boolean, animated: boolean): Promise<boolean>;
  78. }