a zip code crypto-currency system good for red ONLY

action-sheet-component.js 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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", "../../gestures/gesture-controller", "../../config/config", "../../platform/key", "../../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 gesture_controller_1 = require("../../gestures/gesture-controller");
  14. var config_1 = require("../../config/config");
  15. var key_1 = require("../../platform/key");
  16. var nav_params_1 = require("../../navigation/nav-params");
  17. var view_controller_1 = require("../../navigation/view-controller");
  18. /**
  19. * @hidden
  20. */
  21. var ActionSheetCmp = (function () {
  22. function ActionSheetCmp(_viewCtrl, config, _elementRef, gestureCtrl, params, renderer) {
  23. this._viewCtrl = _viewCtrl;
  24. this._elementRef = _elementRef;
  25. this.gestureBlocker = gestureCtrl.createBlocker(gesture_controller_1.BLOCK_ALL);
  26. this.d = params.data;
  27. this.mode = config.get('mode');
  28. renderer.setElementClass(_elementRef.nativeElement, "action-sheet-" + this.mode, true);
  29. if (this.d.cssClass) {
  30. this.d.cssClass.split(' ').forEach(function (cssClass) {
  31. // Make sure the class isn't whitespace, otherwise it throws exceptions
  32. if (cssClass.trim() !== '')
  33. renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
  34. });
  35. }
  36. this.id = (++actionSheetIds);
  37. if (this.d.title) {
  38. this.hdrId = 'acst-hdr-' + this.id;
  39. }
  40. if (this.d.subTitle) {
  41. this.descId = 'acst-subhdr-' + this.id;
  42. }
  43. }
  44. ActionSheetCmp.prototype.ionViewDidLoad = function () {
  45. var _this = this;
  46. // normalize the data
  47. this.d.buttons = this.d.buttons.map(function (button) {
  48. if (typeof button === 'string') {
  49. button = { text: button };
  50. }
  51. if (!button.cssClass) {
  52. button.cssClass = '';
  53. }
  54. switch (button.role) {
  55. case 'cancel':
  56. _this.cancelButton = button;
  57. return null;
  58. case 'destructive':
  59. button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-destructive';
  60. break;
  61. case 'selected':
  62. button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-selected';
  63. break;
  64. }
  65. return button;
  66. }).filter(function (button) { return button !== null; });
  67. };
  68. ActionSheetCmp.prototype.ionViewWillEnter = function () {
  69. this.gestureBlocker.block();
  70. };
  71. ActionSheetCmp.prototype.ionViewDidLeave = function () {
  72. this.gestureBlocker.unblock();
  73. };
  74. ActionSheetCmp.prototype.ionViewDidEnter = function () {
  75. var focusableEle = this._elementRef.nativeElement.querySelector('button');
  76. if (focusableEle) {
  77. focusableEle.focus();
  78. }
  79. this.enabled = true;
  80. };
  81. ActionSheetCmp.prototype.keyUp = function (ev) {
  82. if (this.enabled && ev.keyCode === key_1.KEY_ESCAPE && this._viewCtrl.isLast()) {
  83. (void 0) /* console.debug */;
  84. this.bdClick();
  85. }
  86. };
  87. ActionSheetCmp.prototype.click = function (button) {
  88. if (!this.enabled) {
  89. return;
  90. }
  91. var shouldDismiss = true;
  92. if (button.handler) {
  93. // a handler has been provided, execute it
  94. if (button.handler() === false) {
  95. // if the return value of the handler is false then do not dismiss
  96. shouldDismiss = false;
  97. }
  98. }
  99. if (shouldDismiss) {
  100. this.dismiss(button.role);
  101. }
  102. };
  103. ActionSheetCmp.prototype.bdClick = function () {
  104. if (this.enabled && this.d.enableBackdropDismiss) {
  105. if (this.cancelButton) {
  106. this.click(this.cancelButton);
  107. }
  108. else {
  109. this.dismiss('backdrop');
  110. }
  111. }
  112. };
  113. ActionSheetCmp.prototype.dismiss = function (role) {
  114. var opts = {
  115. minClickBlockDuration: 400
  116. };
  117. return this._viewCtrl.dismiss(null, role, opts);
  118. };
  119. ActionSheetCmp.prototype.ngOnDestroy = function () {
  120. (void 0) /* assert */;
  121. this.d = this.cancelButton = null;
  122. this.gestureBlocker.destroy();
  123. };
  124. ActionSheetCmp.decorators = [
  125. { type: core_1.Component, args: [{
  126. selector: 'ion-action-sheet',
  127. template: '<ion-backdrop (click)="bdClick()" [class.backdrop-no-tappable]="!d.enableBackdropDismiss"></ion-backdrop>' +
  128. '<div class="action-sheet-wrapper">' +
  129. '<div class="action-sheet-container">' +
  130. '<div class="action-sheet-group">' +
  131. '<div class="action-sheet-title" id="{{hdrId}}" *ngIf="d.title">{{d.title}}</div>' +
  132. '<div class="action-sheet-sub-title" id="{{descId}}" *ngIf="d.subTitle">{{d.subTitle}}</div>' +
  133. '<button ion-button="action-sheet-button" (click)="click(b)" *ngFor="let b of d.buttons" class="disable-hover" [attr.icon-start]="b.icon ? \'\' : null" [ngClass]="b.cssClass">' +
  134. '<ion-icon [name]="b.icon" *ngIf="b.icon" class="action-sheet-icon"></ion-icon>' +
  135. '{{b.text}}' +
  136. '</button>' +
  137. '</div>' +
  138. '<div class="action-sheet-group action-sheet-group-cancel" *ngIf="cancelButton">' +
  139. '<button ion-button="action-sheet-button" (click)="click(cancelButton)" class="action-sheet-cancel disable-hover" [attr.icon-start]="cancelButton.icon ? \'\' : null" [ngClass]="cancelButton.cssClass">' +
  140. '<ion-icon [name]="cancelButton.icon" *ngIf="cancelButton.icon" class="action-sheet-icon"></ion-icon>' +
  141. '{{cancelButton.text}}' +
  142. '</button>' +
  143. '</div>' +
  144. '</div>' +
  145. '</div>',
  146. host: {
  147. 'role': 'dialog',
  148. '[attr.aria-labelledby]': 'hdrId',
  149. '[attr.aria-describedby]': 'descId'
  150. },
  151. encapsulation: core_1.ViewEncapsulation.None,
  152. },] },
  153. ];
  154. /** @nocollapse */
  155. ActionSheetCmp.ctorParameters = function () { return [
  156. { type: view_controller_1.ViewController, },
  157. { type: config_1.Config, },
  158. { type: core_1.ElementRef, },
  159. { type: gesture_controller_1.GestureController, },
  160. { type: nav_params_1.NavParams, },
  161. { type: core_1.Renderer, },
  162. ]; };
  163. ActionSheetCmp.propDecorators = {
  164. 'keyUp': [{ type: core_1.HostListener, args: ['body:keyup', ['$event'],] },],
  165. };
  166. return ActionSheetCmp;
  167. }());
  168. exports.ActionSheetCmp = ActionSheetCmp;
  169. var actionSheetIds = -1;
  170. });
  171. //# sourceMappingURL=action-sheet-component.js.map