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