a zip code crypto-currency system good for red ONLY

menu-toggle.js 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. (function (factory) {
  2. if (typeof module === "object" && typeof module.exports === "object") {
  3. var v = factory(require, exports);
  4. if (v !== undefined) module.exports = v;
  5. }
  6. else if (typeof define === "function" && define.amd) {
  7. define(["require", "exports", "@angular/core", "../button/button", "../app/menu-controller", "../toolbar/navbar", "../../navigation/view-controller"], factory);
  8. }
  9. })(function (require, exports) {
  10. "use strict";
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var core_1 = require("@angular/core");
  13. var button_1 = require("../button/button");
  14. var menu_controller_1 = require("../app/menu-controller");
  15. var navbar_1 = require("../toolbar/navbar");
  16. var view_controller_1 = require("../../navigation/view-controller");
  17. /**
  18. * @name MenuToggle
  19. * @description
  20. * The `menuToggle` directive can be placed on any button to toggle a menu open or closed.
  21. * If it is added to the [NavBar](../../toolbar/Navbar) of a page, the button will only appear
  22. * when the page it's in is currently a root page. See the [Menu Navigation Bar Behavior](../Menu#navigation-bar-behavior)
  23. * docs for more information.
  24. *
  25. *
  26. * @usage
  27. *
  28. * A simple `menuToggle` button can be added using the following markup:
  29. *
  30. * ```html
  31. * <button ion-button menuToggle>Toggle Menu</button>
  32. * ```
  33. *
  34. * To toggle a specific menu by its id or side, give the `menuToggle`
  35. * directive a value.
  36. *
  37. * ```html
  38. * <button ion-button menuToggle="right">Toggle Right Menu</button>
  39. * ```
  40. *
  41. * If placing the `menuToggle` in a navbar or toolbar, it should be
  42. * placed as a child of the `<ion-navbar>` or `<ion-toolbar>`, and not in
  43. * the `<ion-buttons>` element:
  44. *
  45. * ```html
  46. * <ion-header>
  47. *
  48. * <ion-navbar>
  49. * <ion-buttons start>
  50. * <button ion-button>
  51. * <ion-icon name="contact"></ion-icon>
  52. * </button>
  53. * </ion-buttons>
  54. * <button ion-button menuToggle>
  55. * <ion-icon name="menu"></ion-icon>
  56. * </button>
  57. * <ion-title>
  58. * Title
  59. * </ion-title>
  60. * <ion-buttons end>
  61. * <button ion-button (click)="doClick()">
  62. * <ion-icon name="more"></ion-icon>
  63. * </button>
  64. * </ion-buttons>
  65. * </ion-navbar>
  66. *
  67. * </ion-header>
  68. * ```
  69. *
  70. * Similar to `<ion-buttons>`, the `menuToggle` can be positioned using
  71. * `start`, `end`, `left`, or `right`:
  72. *
  73. * ```html
  74. * <ion-toolbar>
  75. * <button ion-button menuToggle right>
  76. * <ion-icon name="menu"></ion-icon>
  77. * </button>
  78. * <ion-title>
  79. * Title
  80. * </ion-title>
  81. * <ion-buttons end>
  82. * <button ion-button (click)="doClick()">
  83. * <ion-icon name="more"></ion-icon>
  84. * </button>
  85. * </ion-buttons>
  86. * </ion-toolbar>
  87. * ```
  88. *
  89. * See the [Toolbar API docs](../../toolbar/Toolbar) for more information
  90. * on the different positions.
  91. *
  92. * @demo /docs/demos/src/menu/
  93. * @see {@link /docs/components#menus Menu Component Docs}
  94. * @see {@link ../../menu/Menu Menu API Docs}
  95. */
  96. var MenuToggle = (function () {
  97. function MenuToggle(_menu, _viewCtrl, _button, _navbar) {
  98. this._menu = _menu;
  99. this._viewCtrl = _viewCtrl;
  100. this._button = _button;
  101. this._isButton = !!_button;
  102. this._inNavbar = !!_navbar;
  103. }
  104. MenuToggle.prototype.ngAfterContentInit = function () {
  105. // Add the bar-button-menutoggle / button-menutoggle class
  106. if (this._isButton) {
  107. this._button._setClass('menutoggle', true);
  108. }
  109. };
  110. /**
  111. * @hidden
  112. */
  113. MenuToggle.prototype.toggle = function () {
  114. var menu = this._menu.get(this.menuToggle);
  115. menu && menu.toggle();
  116. };
  117. Object.defineProperty(MenuToggle.prototype, "isHidden", {
  118. /**
  119. * @hidden
  120. */
  121. get: function () {
  122. var menu = this._menu.get(this.menuToggle);
  123. if (this._inNavbar && this._viewCtrl) {
  124. if (!menu || !menu._canOpen()) {
  125. return true;
  126. }
  127. if (this._viewCtrl.isFirst()) {
  128. // this is the first view, so it should always show
  129. return false;
  130. }
  131. if (menu) {
  132. // this is not the root view, so see if this menu
  133. // is configured to still be enabled if it's not the root view
  134. return !menu.persistent;
  135. }
  136. }
  137. return false;
  138. },
  139. enumerable: true,
  140. configurable: true
  141. });
  142. MenuToggle.decorators = [
  143. { type: core_1.Directive, args: [{
  144. selector: '[menuToggle]',
  145. host: {
  146. '[hidden]': 'isHidden'
  147. }
  148. },] },
  149. ];
  150. /** @nocollapse */
  151. MenuToggle.ctorParameters = function () { return [
  152. { type: menu_controller_1.MenuController, },
  153. { type: view_controller_1.ViewController, decorators: [{ type: core_1.Optional },] },
  154. { type: button_1.Button, decorators: [{ type: core_1.Optional },] },
  155. { type: navbar_1.Navbar, decorators: [{ type: core_1.Optional },] },
  156. ]; };
  157. MenuToggle.propDecorators = {
  158. 'menuToggle': [{ type: core_1.Input },],
  159. 'toggle': [{ type: core_1.HostListener, args: ['click',] },],
  160. };
  161. return MenuToggle;
  162. }());
  163. exports.MenuToggle = MenuToggle;
  164. });
  165. //# sourceMappingURL=menu-toggle.js.map