UI for Zipcoin Blue

app-root.js 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = Object.setPrototypeOf ||
  3. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5. return function (d, b) {
  6. extendStatics(d, b);
  7. function __() { this.constructor = d; }
  8. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9. };
  10. })();
  11. import { Component, ComponentFactoryResolver, ElementRef, Inject, InjectionToken, Renderer, ViewChild, ViewContainerRef } from '@angular/core';
  12. import { App } from './app';
  13. import { Config } from '../../config/config';
  14. import { Ion } from '../ion';
  15. import { OverlayPortal } from './overlay-portal';
  16. import { Platform } from '../../platform/platform';
  17. import * as Constants from './app-constants';
  18. export var AppRootToken = new InjectionToken('USERROOT');
  19. /**
  20. * @hidden
  21. */
  22. var IonicApp = (function (_super) {
  23. __extends(IonicApp, _super);
  24. function IonicApp(_userCmp, _cfr, elementRef, renderer, config, _plt, app) {
  25. var _this = _super.call(this, config, elementRef, renderer, 'app-root') || this;
  26. _this._userCmp = _userCmp;
  27. _this._cfr = _cfr;
  28. _this._plt = _plt;
  29. // register with App that this is Ionic's appRoot component. tada!
  30. app._appRoot = _this;
  31. _this._stopScrollPlugin = window['IonicStopScroll'];
  32. return _this;
  33. }
  34. IonicApp.prototype.ngOnInit = function () {
  35. var _this = this;
  36. // load the user root component
  37. // into Ionic's root component
  38. var factory = this._cfr.resolveComponentFactory(this._userCmp);
  39. var componentRef = this._viewport.createComponent(factory);
  40. this._renderer.setElementClass(componentRef.location.nativeElement, 'app-root', true);
  41. componentRef.changeDetectorRef.detectChanges();
  42. // set the mode class name
  43. // ios/md/wp
  44. this.setElementClass(this._config.get('mode'), true);
  45. var versions = this._plt.versions();
  46. this._plt.platforms().forEach(function (platformName) {
  47. // platform-ios
  48. var platformClass = 'platform-' + platformName;
  49. _this.setElementClass(platformClass, true);
  50. var platformVersion = versions[platformName];
  51. if (platformVersion) {
  52. // platform-ios9
  53. platformClass += platformVersion.major;
  54. _this.setElementClass(platformClass, true);
  55. // platform-ios9_3
  56. _this.setElementClass(platformClass + '_' + platformVersion.minor, true);
  57. }
  58. });
  59. // touch devices should not use :hover CSS pseudo
  60. // enable :hover CSS when the "hoverCSS" setting is not false
  61. if (this._config.getBoolean('hoverCSS', true)) {
  62. this.setElementClass('enable-hover', true);
  63. }
  64. // sweet, the app root has loaded!
  65. // which means angular and ionic has fully loaded!
  66. // fire off the platform prepare ready, which could
  67. // have been switched out by any of the platform engines
  68. this._plt.prepareReady();
  69. };
  70. /**
  71. * @hidden
  72. */
  73. IonicApp.prototype._getPortal = function (portal) {
  74. if (portal === Constants.PORTAL_LOADING) {
  75. return this._loadingPortal;
  76. }
  77. if (portal === Constants.PORTAL_TOAST) {
  78. return this._toastPortal;
  79. }
  80. // Modals need their own overlay becuase we don't want an ActionSheet
  81. // or Alert to trigger lifecycle events inside a modal
  82. if (portal === Constants.PORTAL_MODAL) {
  83. return this._modalPortal;
  84. }
  85. return this._overlayPortal;
  86. };
  87. IonicApp.prototype._getActivePortal = function () {
  88. var defaultPortal = this._overlayPortal;
  89. var modalPortal = this._modalPortal;
  90. var hasModal = modalPortal.length() > 0;
  91. var hasDefault = defaultPortal.length() > 0;
  92. if (!hasModal && !hasDefault) {
  93. return null;
  94. }
  95. else if (hasModal && hasDefault) {
  96. var defaultIndex = defaultPortal.getActive().getZIndex();
  97. var modalIndex = modalPortal.getActive().getZIndex();
  98. if (defaultIndex > modalIndex) {
  99. return defaultPortal;
  100. }
  101. else {
  102. (void 0) /* assert */;
  103. return modalPortal;
  104. }
  105. }
  106. if (hasModal) {
  107. return modalPortal;
  108. }
  109. else if (hasDefault) {
  110. return defaultPortal;
  111. }
  112. };
  113. IonicApp.prototype._disableScroll = function (shouldDisableScroll) {
  114. var _this = this;
  115. if (shouldDisableScroll) {
  116. this.stopScroll().then(function () {
  117. _this._tmr = _this._plt.timeout(function () {
  118. (void 0) /* console.debug */;
  119. _this.setElementClass('disable-scroll', true);
  120. }, 32);
  121. });
  122. }
  123. else {
  124. var plugin = this._stopScrollPlugin;
  125. if (plugin && plugin.cancel) {
  126. plugin.cancel();
  127. }
  128. clearTimeout(this._tmr);
  129. (void 0) /* console.debug */;
  130. this.setElementClass('disable-scroll', false);
  131. }
  132. };
  133. IonicApp.prototype.stopScroll = function () {
  134. var _this = this;
  135. if (this._stopScrollPlugin) {
  136. return new Promise(function (resolve) {
  137. _this._stopScrollPlugin.stop(function () { return resolve(true); });
  138. });
  139. }
  140. else {
  141. return Promise.resolve(false);
  142. }
  143. };
  144. IonicApp.decorators = [
  145. { type: Component, args: [{
  146. selector: 'ion-app',
  147. template: '<div #viewport app-viewport></div>' +
  148. '<div #modalPortal overlay-portal></div>' +
  149. '<div #overlayPortal overlay-portal></div>' +
  150. '<div #loadingPortal class="loading-portal" overlay-portal></div>' +
  151. '<div #toastPortal class="toast-portal" [overlay-portal]="10000"></div>' +
  152. '<div class="click-block"></div>'
  153. },] },
  154. ];
  155. /** @nocollapse */
  156. IonicApp.ctorParameters = function () { return [
  157. { type: undefined, decorators: [{ type: Inject, args: [AppRootToken,] },] },
  158. { type: ComponentFactoryResolver, },
  159. { type: ElementRef, },
  160. { type: Renderer, },
  161. { type: Config, },
  162. { type: Platform, },
  163. { type: App, },
  164. ]; };
  165. IonicApp.propDecorators = {
  166. '_viewport': [{ type: ViewChild, args: ['viewport', { read: ViewContainerRef },] },],
  167. '_modalPortal': [{ type: ViewChild, args: ['modalPortal', { read: OverlayPortal },] },],
  168. '_overlayPortal': [{ type: ViewChild, args: ['overlayPortal', { read: OverlayPortal },] },],
  169. '_loadingPortal': [{ type: ViewChild, args: ['loadingPortal', { read: OverlayPortal },] },],
  170. '_toastPortal': [{ type: ViewChild, args: ['toastPortal', { read: OverlayPortal },] },],
  171. };
  172. return IonicApp;
  173. }(Ion));
  174. export { IonicApp };
  175. //# sourceMappingURL=app-root.js.map