mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
chore(): fix Input types
This commit is contained in:
@ -23,7 +23,7 @@ export class ScrollTo {
|
||||
}
|
||||
}
|
||||
|
||||
start(x, y, duration, tolerance): Promise<any> {
|
||||
start(x: number, y: number, duration: number, tolerance?: number): Promise<any> {
|
||||
// scroll animation loop w/ easing
|
||||
// credit https://gist.github.com/dezinezync/5487119
|
||||
let self = this;
|
||||
|
@ -213,7 +213,7 @@ export class Content {
|
||||
* @param {TODO} tolerance TODO
|
||||
* @returns {Promise} Returns a promise when done
|
||||
*/
|
||||
scrollTo(x, y, duration, tolerance) {
|
||||
scrollTo(x: number, y: number, duration: number, tolerance?: number): Promise<any> {
|
||||
if (this._scrollTo) {
|
||||
this._scrollTo.dispose();
|
||||
}
|
||||
|
@ -74,11 +74,20 @@ import {Icon} from '../icon/icon';
|
||||
directives: [NgIf, forwardRef(() => InputScrollAssist), TextInput, Button]
|
||||
})
|
||||
export class ItemInput {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Input() clearInput: any;
|
||||
private _assist: boolean;
|
||||
private input: TextInput;
|
||||
private label: Label;
|
||||
private scrollMove: EventListener;
|
||||
private startCoord: {x: number, y: number};
|
||||
private deregScroll: () => void;
|
||||
|
||||
keyboardHeight: number;
|
||||
value: string = '';
|
||||
type: string = null;
|
||||
lastTouch: number = 0;
|
||||
displayType: string;
|
||||
|
||||
@Input() clearInput: any;
|
||||
|
||||
constructor(
|
||||
config: Config,
|
||||
@ -96,10 +105,7 @@ export class ItemInput {
|
||||
) {
|
||||
_form.register(this);
|
||||
|
||||
this.type = null;
|
||||
this.lastTouch = 0;
|
||||
|
||||
// make more gud with pending @Attributes API
|
||||
//TODO make more gud with pending @Attributes API
|
||||
this.displayType = (isFloating === '' ? 'floating' : (isStacked === '' ? 'stacked' : (isFixed === '' ? 'fixed' : (isInset === '' ? 'inset' : null))));
|
||||
|
||||
this._assist = config.get('scrollAssist');
|
||||
@ -110,7 +116,7 @@ export class ItemInput {
|
||||
* @private
|
||||
*/
|
||||
@ContentChild(TextInput)
|
||||
set _setInput(textInput) {
|
||||
set _setInput(textInput: TextInput) {
|
||||
if (textInput) {
|
||||
textInput.addClass('item-input');
|
||||
if (this.displayType) {
|
||||
@ -135,7 +141,7 @@ export class ItemInput {
|
||||
* @private
|
||||
*/
|
||||
@ContentChild(Label)
|
||||
set _setLabel(label) {
|
||||
set _setLabel(label: Label) {
|
||||
if (label && this.displayType) {
|
||||
label.addClass(this.displayType + '-label');
|
||||
}
|
||||
@ -187,7 +193,7 @@ export class ItemInput {
|
||||
self.input.labelledBy(self.label.id);
|
||||
}
|
||||
|
||||
self.scrollMove = function(ev) {
|
||||
self.scrollMove = function(ev: UIEvent) {
|
||||
if (!(self._nav && self._nav.isTransitioning())) {
|
||||
self.deregMove();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Directive, ElementRef, Renderer} from 'angular2/core';
|
||||
import {Directive, ElementRef, Renderer, Input} from 'angular2/core';
|
||||
|
||||
import {Form} from '../../util/form';
|
||||
|
||||
@ -23,14 +23,12 @@ import {Form} from '../../util/form';
|
||||
|
||||
@Directive({
|
||||
selector: 'ion-label',
|
||||
inputs: [
|
||||
'id'
|
||||
],
|
||||
host: {
|
||||
'[attr.id]': 'id'
|
||||
}
|
||||
})
|
||||
export class Label {
|
||||
@Input() id: string;
|
||||
|
||||
constructor(
|
||||
private _form: Form,
|
||||
|
@ -155,7 +155,7 @@ export function windowLoad(callback) {
|
||||
return promise;
|
||||
}
|
||||
|
||||
export function pointerCoord(ev) {
|
||||
export function pointerCoord(ev): {x: number, y: number} {
|
||||
// get coordinates for either a mouse click
|
||||
// or a touch depending on the given event
|
||||
let c = { x: 0, y: 0 };
|
||||
|
Reference in New Issue
Block a user