1 | import { Injectable } from '@angular/core';
|
2 | import { removeArrayItem } from './util';
|
3 |
|
4 |
|
5 |
|
6 | var Form = (function () {
|
7 | function Form() {
|
8 | this._focused = null;
|
9 | this._ids = -1;
|
10 | this._inputs = [];
|
11 | }
|
12 | Form.prototype.register = function (input) {
|
13 | this._inputs.push(input);
|
14 | };
|
15 | Form.prototype.deregister = function (input) {
|
16 | removeArrayItem(this._inputs, input);
|
17 | this.unsetAsFocused(input);
|
18 | };
|
19 | Form.prototype.setAsFocused = function (input) {
|
20 | this._focused = input;
|
21 | };
|
22 | Form.prototype.unsetAsFocused = function (input) {
|
23 | if (input === this._focused) {
|
24 | this._focused = null;
|
25 | }
|
26 | };
|
27 | |
28 |
|
29 |
|
30 | Form.prototype.tabFocus = function (currentInput) {
|
31 | var inputs = this._inputs;
|
32 | var 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) ;
|
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) ;
|
45 | previousInput.initFocus();
|
46 | }
|
47 | }
|
48 | };
|
49 | Form.prototype.nextId = function () {
|
50 | return ++this._ids;
|
51 | };
|
52 | Form.decorators = [
|
53 | { type: Injectable },
|
54 | ];
|
55 |
|
56 | Form.ctorParameters = function () { return []; };
|
57 | return Form;
|
58 | }());
|
59 | export { Form };
|
60 |
|
61 |
|
62 |
|
63 | var IonicTapInput = (function () {
|
64 | function IonicTapInput() {
|
65 | }
|
66 | return IonicTapInput;
|
67 | }());
|
68 | export { IonicTapInput };
|
69 |
|
70 |
|
71 |
|
72 | var IonicFormInput = (function () {
|
73 | function IonicFormInput() {
|
74 | }
|
75 | return IonicFormInput;
|
76 | }());
|
77 | export { IonicFormInput };
|
78 |
|
\ | No newline at end of file |