a zip code crypto-currency system good for red ONLY

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. (function (factory) {
  12. if (typeof module === "object" && typeof module.exports === "object") {
  13. var v = factory(require, exports);
  14. if (v !== undefined) module.exports = v;
  15. }
  16. else if (typeof define === "function" && define.amd) {
  17. define(["require", "exports", "@angular/core", "@angular/forms", "../../config/config", "../../platform/dom-controller", "../../util/form", "../../gestures/gesture-controller", "../../tap-click/haptic", "../../util/util", "../../util/base-input", "../item/item", "../../platform/key", "../../platform/platform", "./toggle-gesture"], factory);
  18. }
  19. })(function (require, exports) {
  20. "use strict";
  21. Object.defineProperty(exports, "__esModule", { value: true });
  22. var core_1 = require("@angular/core");
  23. var forms_1 = require("@angular/forms");
  24. var config_1 = require("../../config/config");
  25. var dom_controller_1 = require("../../platform/dom-controller");
  26. var form_1 = require("../../util/form");
  27. var gesture_controller_1 = require("../../gestures/gesture-controller");
  28. var haptic_1 = require("../../tap-click/haptic");
  29. var util_1 = require("../../util/util");
  30. var base_input_1 = require("../../util/base-input");
  31. var item_1 = require("../item/item");
  32. var key_1 = require("../../platform/key");
  33. var platform_1 = require("../../platform/platform");
  34. var toggle_gesture_1 = require("./toggle-gesture");
  35. /**
  36. * @name Toggle
  37. * @description
  38. * A toggle technically is the same thing as an HTML checkbox input,
  39. * except it looks different and is easier to use on a touch device.
  40. * Toggles can also have colors assigned to them, by adding any color
  41. * attribute.
  42. *
  43. * See the [Angular Docs](https://angular.io/docs/ts/latest/guide/forms.html)
  44. * for more info on forms and inputs.
  45. *
  46. * @usage
  47. * ```html
  48. *
  49. * <ion-list>
  50. *
  51. * <ion-item>
  52. * <ion-label>Pepperoni</ion-label>
  53. * <ion-toggle [(ngModel)]="pepperoni"></ion-toggle>
  54. * </ion-item>
  55. *
  56. * <ion-item>
  57. * <ion-label>Sausage</ion-label>
  58. * <ion-toggle [(ngModel)]="sausage" disabled="true"></ion-toggle>
  59. * </ion-item>
  60. *
  61. * <ion-item>
  62. * <ion-label>Mushrooms</ion-label>
  63. * <ion-toggle [(ngModel)]="mushrooms"></ion-toggle>
  64. * </ion-item>
  65. *
  66. * </ion-list>
  67. * ```
  68. *
  69. * @demo /docs/demos/src/toggle/
  70. * @see {@link /docs/components#toggle Toggle Component Docs}
  71. */
  72. var Toggle = (function (_super) {
  73. __extends(Toggle, _super);
  74. function Toggle(form, config, _plt, elementRef, renderer, _haptic, item, _gestureCtrl, _domCtrl, _zone) {
  75. var _this = _super.call(this, config, elementRef, renderer, 'toggle', false, form, item, null) || this;
  76. _this._plt = _plt;
  77. _this._haptic = _haptic;
  78. _this._gestureCtrl = _gestureCtrl;
  79. _this._domCtrl = _domCtrl;
  80. _this._zone = _zone;
  81. _this._activated = false;
  82. return _this;
  83. }
  84. Object.defineProperty(Toggle.prototype, "checked", {
  85. /**
  86. * @input {boolean} If true, the element is selected.
  87. */
  88. get: function () {
  89. return this.value;
  90. },
  91. set: function (val) {
  92. this.value = val;
  93. },
  94. enumerable: true,
  95. configurable: true
  96. });
  97. /**
  98. * @hidden
  99. */
  100. Toggle.prototype.ngAfterContentInit = function () {
  101. this._initialize();
  102. this._gesture = new toggle_gesture_1.ToggleGesture(this._plt, this, this._gestureCtrl, this._domCtrl);
  103. this._gesture.listen();
  104. };
  105. /**
  106. * @hidden
  107. */
  108. Toggle.prototype._inputUpdated = function () { };
  109. /**
  110. * @hidden
  111. */
  112. Toggle.prototype._inputNormalize = function (val) {
  113. return util_1.isTrueProperty(val);
  114. };
  115. /**
  116. * @hidden
  117. */
  118. Toggle.prototype._onDragStart = function (startX) {
  119. var _this = this;
  120. (void 0) /* assert */;
  121. (void 0) /* console.debug */;
  122. this._zone.run(function () {
  123. _this._startX = startX;
  124. _this._fireFocus();
  125. _this._activated = true;
  126. });
  127. };
  128. /**
  129. * @hidden
  130. */
  131. Toggle.prototype._onDragMove = function (currentX) {
  132. var _this = this;
  133. if (!this._startX) {
  134. (void 0) /* assert */;
  135. return;
  136. }
  137. if (this._shouldToggle(currentX, -15)) {
  138. this._zone.run(function () {
  139. _this.value = !_this.value;
  140. _this._startX = currentX;
  141. _this._haptic.selection();
  142. });
  143. }
  144. };
  145. /**
  146. * @hidden
  147. */
  148. Toggle.prototype._onDragEnd = function (endX) {
  149. var _this = this;
  150. if (!this._startX) {
  151. (void 0) /* assert */;
  152. return;
  153. }
  154. (void 0) /* console.debug */;
  155. this._zone.run(function () {
  156. if (_this._shouldToggle(endX, 4)) {
  157. _this.value = !_this.value;
  158. _this._haptic.selection();
  159. }
  160. _this._activated = false;
  161. _this._fireBlur();
  162. _this._startX = null;
  163. });
  164. };
  165. /**
  166. * @hidden
  167. */
  168. Toggle.prototype._shouldToggle = function (currentX, margin) {
  169. var isLTR = !this._plt.isRTL;
  170. var startX = this._startX;
  171. if (this._value) {
  172. return (isLTR && (startX + margin > currentX)) ||
  173. (!isLTR && (startX - margin < currentX));
  174. }
  175. else {
  176. return (isLTR && (startX - margin < currentX)) ||
  177. (!isLTR && (startX + margin > currentX));
  178. }
  179. };
  180. /**
  181. * @hidden
  182. */
  183. Toggle.prototype._keyup = function (ev) {
  184. if (ev.keyCode === key_1.KEY_SPACE || ev.keyCode === key_1.KEY_ENTER) {
  185. (void 0) /* console.debug */;
  186. ev.preventDefault();
  187. ev.stopPropagation();
  188. this.value = !this.value;
  189. }
  190. };
  191. /**
  192. * @hidden
  193. */
  194. Toggle.prototype.ngOnDestroy = function () {
  195. _super.prototype.ngOnDestroy.call(this);
  196. this._gesture && this._gesture.destroy();
  197. };
  198. Toggle.decorators = [
  199. { type: core_1.Component, args: [{
  200. selector: 'ion-toggle',
  201. template: '<div class="toggle-icon">' +
  202. '<div class="toggle-inner"></div>' +
  203. '</div>' +
  204. '<button role="checkbox" ' +
  205. 'type="button" ' +
  206. 'ion-button="item-cover" ' +
  207. '[id]="id" ' +
  208. '[attr.aria-checked]="_value" ' +
  209. '[attr.aria-labelledby]="_labelId" ' +
  210. '[attr.aria-disabled]="_disabled" ' +
  211. 'class="item-cover" disable-activated>' +
  212. '</button>',
  213. host: {
  214. '[class.toggle-disabled]': '_disabled',
  215. '[class.toggle-checked]': '_value',
  216. '[class.toggle-activated]': '_activated',
  217. },
  218. providers: [{ provide: forms_1.NG_VALUE_ACCESSOR, useExisting: Toggle, multi: true }],
  219. encapsulation: core_1.ViewEncapsulation.None,
  220. },] },
  221. ];
  222. /** @nocollapse */
  223. Toggle.ctorParameters = function () { return [
  224. { type: form_1.Form, },
  225. { type: config_1.Config, },
  226. { type: platform_1.Platform, },
  227. { type: core_1.ElementRef, },
  228. { type: core_1.Renderer, },
  229. { type: haptic_1.Haptic, },
  230. { type: item_1.Item, decorators: [{ type: core_1.Optional },] },
  231. { type: gesture_controller_1.GestureController, },
  232. { type: dom_controller_1.DomController, },
  233. { type: core_1.NgZone, },
  234. ]; };
  235. Toggle.propDecorators = {
  236. 'checked': [{ type: core_1.Input },],
  237. '_keyup': [{ type: core_1.HostListener, args: ['keyup', ['$event'],] },],
  238. };
  239. return Toggle;
  240. }(base_input_1.BaseInput));
  241. exports.Toggle = Toggle;
  242. });
  243. //# sourceMappingURL=toggle.js.map