a zip code crypto-currency system good for red ONLY

toast-component.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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", "../../config/config", "../../navigation/nav-params", "../../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 config_1 = require("../../config/config");
  14. var nav_params_1 = require("../../navigation/nav-params");
  15. var view_controller_1 = require("../../navigation/view-controller");
  16. /**
  17. * @hidden
  18. */
  19. var ToastCmp = (function () {
  20. function ToastCmp(_viewCtrl, _config, _elementRef, params, renderer) {
  21. this._viewCtrl = _viewCtrl;
  22. this._config = _config;
  23. this._elementRef = _elementRef;
  24. this.dismissTimeout = undefined;
  25. renderer.setElementClass(_elementRef.nativeElement, "toast-" + _config.get('mode'), true);
  26. this.d = params.data;
  27. if (this.d.cssClass) {
  28. this.d.cssClass.split(' ').forEach(function (cssClass) {
  29. // Make sure the class isn't whitespace, otherwise it throws exceptions
  30. if (cssClass.trim() !== '')
  31. renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
  32. });
  33. }
  34. this.id = (++toastIds);
  35. if (this.d.message) {
  36. this.hdrId = 'toast-hdr-' + this.id;
  37. }
  38. }
  39. ToastCmp.prototype.ngAfterViewInit = function () {
  40. var _this = this;
  41. // if there's a `duration` set, automatically dismiss.
  42. if (this.d.duration) {
  43. this.dismissTimeout = setTimeout(function () {
  44. _this.dismiss('backdrop');
  45. }, this.d.duration);
  46. }
  47. this.enabled = true;
  48. };
  49. ToastCmp.prototype.ionViewDidEnter = function () {
  50. var activeElement = document.activeElement;
  51. if (activeElement) {
  52. activeElement.blur();
  53. }
  54. var focusableEle = this._elementRef.nativeElement.querySelector('button');
  55. if (focusableEle) {
  56. focusableEle.focus();
  57. }
  58. };
  59. ToastCmp.prototype.cbClick = function () {
  60. if (this.enabled) {
  61. this.dismiss('close');
  62. }
  63. };
  64. ToastCmp.prototype.dismiss = function (role) {
  65. clearTimeout(this.dismissTimeout);
  66. this.dismissTimeout = undefined;
  67. return this._viewCtrl.dismiss(null, role, { disableApp: false });
  68. };
  69. ToastCmp.decorators = [
  70. { type: core_1.Component, args: [{
  71. selector: 'ion-toast',
  72. template: '<div class="toast-wrapper" ' +
  73. '[class.toast-bottom]="d.position === \'bottom\'" ' +
  74. '[class.toast-middle]="d.position === \'middle\'" ' +
  75. '[class.toast-top]="d.position === \'top\'"> ' +
  76. '<div class="toast-container"> ' +
  77. '<div class="toast-message" id="{{hdrId}}" *ngIf="d.message">{{d.message}}</div> ' +
  78. '<button ion-button clear class="toast-button" *ngIf="d.showCloseButton" (click)="cbClick()"> ' +
  79. '{{ d.closeButtonText || \'Close\' }} ' +
  80. '</button> ' +
  81. '</div> ' +
  82. '</div>',
  83. host: {
  84. 'role': 'dialog',
  85. '[attr.aria-labelledby]': 'hdrId',
  86. '[attr.aria-describedby]': 'descId',
  87. },
  88. },] },
  89. ];
  90. /** @nocollapse */
  91. ToastCmp.ctorParameters = function () { return [
  92. { type: view_controller_1.ViewController, },
  93. { type: config_1.Config, },
  94. { type: core_1.ElementRef, },
  95. { type: nav_params_1.NavParams, },
  96. { type: core_1.Renderer, },
  97. ]; };
  98. return ToastCmp;
  99. }());
  100. exports.ToastCmp = ToastCmp;
  101. var toastIds = -1;
  102. });
  103. //# sourceMappingURL=toast-component.js.map