a zip code crypto-currency system good for red ONLY

form.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { Injectable } from '@angular/core';
  2. import { removeArrayItem } from './util';
  3. /**
  4. * @hidden
  5. */
  6. export class Form {
  7. constructor() {
  8. this._focused = null;
  9. this._ids = -1;
  10. this._inputs = [];
  11. }
  12. register(input) {
  13. this._inputs.push(input);
  14. }
  15. deregister(input) {
  16. removeArrayItem(this._inputs, input);
  17. this.unsetAsFocused(input);
  18. }
  19. setAsFocused(input) {
  20. this._focused = input;
  21. }
  22. unsetAsFocused(input) {
  23. if (input === this._focused) {
  24. this._focused = null;
  25. }
  26. }
  27. /**
  28. * Focuses the next input element, if it exists.
  29. */
  30. tabFocus(currentInput) {
  31. const inputs = this._inputs;
  32. let index = inputs.indexOf(currentInput) + 1;
  33. if (index > 0 && index < inputs.length) {
  34. var nextInput = inputs[index];
  35. if (nextInput !== this._focused) {
  36. (void 0) /* console.debug */;
  37. return nextInput.initFocus();
  38. }
  39. }
  40. index = inputs.indexOf(this._focused);
  41. if (index > 0) {
  42. var previousInput = inputs[index - 1];
  43. if (previousInput) {
  44. (void 0) /* console.debug */;
  45. previousInput.initFocus();
  46. }
  47. }
  48. }
  49. nextId() {
  50. return ++this._ids;
  51. }
  52. }
  53. Form.decorators = [
  54. { type: Injectable },
  55. ];
  56. /** @nocollapse */
  57. Form.ctorParameters = () => [];
  58. /**
  59. * @hidden
  60. */
  61. export class IonicTapInput {
  62. }
  63. /**
  64. * @hidden
  65. */
  66. export class IonicFormInput {
  67. }
  68. //# sourceMappingURL=form.js.map