From 5b72ff111488218e5dd6cffc21f6f0d9e037c6be Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 28 Aug 2015 15:30:04 -0700 Subject: [PATCH] input docs wip --- ionic/components/form/input.ts | 30 +++++++++- ionic/components/text-input/text-input.ts | 69 ++++++++++++++++++++++- 2 files changed, 94 insertions(+), 5 deletions(-) diff --git a/ionic/components/form/input.ts b/ionic/components/form/input.ts index f8a08218b4..07d52a04a4 100644 --- a/ionic/components/form/input.ts +++ b/ionic/components/form/input.ts @@ -10,25 +10,44 @@ let inputItemIds = -1; let activeInput = null; let lastInput = null; - +/** + * TODO + */ export class IonInput extends Ion { - + /** + * TODO + * @param {TODO} input TODO + */ static registerInput(input) { inputRegistry.push(input); } + /** + * TODO + * @param {TODO} input TODO + */ static setAsLastInput(input) { lastInput = input; } + /** + * TODO + */ static focusPrevious() { this.focusMove(-1); } + /** + * TODO + */ static focusNext() { this.focusMove(1); } + /** + * TODO + * @param {TODO} inc TODO + */ static focusMove(inc) { let input = activeInput || lastInput; if (input) { @@ -41,10 +60,17 @@ export class IonInput extends Ion { } } + /** + * TODO + * @returns {TODO} TODO + */ static nextId() { return ++inputItemIds; } + /** + * TODO + */ static clearTabIndexes() { for (let i = 0; i < inputRegistry.length; i++) { inputRegistry[i].tabIndex = -1; diff --git a/ionic/components/text-input/text-input.ts b/ionic/components/text-input/text-input.ts index eba0909075..6b4b8d6b48 100644 --- a/ionic/components/text-input/text-input.ts +++ b/ionic/components/text-input/text-input.ts @@ -12,7 +12,9 @@ import * as dom from '../../util/dom'; import {Platform} from '../../platform/platform'; - +/** + * TODO + */ @Directive({ selector: 'textarea,input[type=text],input[type=password],input[type=number],input[type=search],input[type=email],input[type=url],input[type=tel]', property: [ @@ -25,6 +27,12 @@ import {Platform} from '../../platform/platform'; } }) export class TextInputElement { + /** + * TODO + * @param {string} type The value of the underlying element's type attribute. + * @param {ElementRef} elementRef TODO + * @param {IonicConfig} config TODO + */ constructor( @Attribute('type') type: string, elementRef: ElementRef, @@ -35,16 +43,25 @@ export class TextInputElement { this.tabIndex = this.tabIndex || ''; } + /** + * Focus the input. + */ setFocus() { this.elementRef.nativeElement.focus(); } + /** + * Whether the input has focus or not. + * @returns {boolean} true if the input has focus, otherwise false. + */ get hasFocus() { return dom.hasFocus(this.elementRef); } } - +/** + * TODO + */ @IonicDirective({ selector: 'ion-input', classId: 'item-input', @@ -63,7 +80,16 @@ export class TextInputElement { } }) export class TextInput extends Ion { - + /** + * TODO + * @param {ElementRef} elementRef TODO + * @param {IonicConfig} config TODO + * @param {IonicApp} app TODO + * @param {NgZone} ngZone TODO + * @param {Content=} scrollView The parent scroll view. + * @param {QueryList} inputQry TODO + * @param {QueryList