mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
overalys now are enabled via ionViewDidEnter * style(overlays): fixed tslint error fixed tslint error * style(overlays): formatting formatting * refactor(overlays): minor refactor to match style minor refactor to match style
This commit is contained in:
@ -5,6 +5,7 @@ import {Animation} from '../../animations/animation';
|
||||
import {Transition, TransitionOptions} from '../../transitions/transition';
|
||||
import {Config} from '../../config/config';
|
||||
import {isPresent, isString, isNumber, clamp} from '../../util/util';
|
||||
import {Key} from '../../util/key';
|
||||
import {NavParams} from '../nav/nav-params';
|
||||
import {ViewController} from '../nav/view-controller';
|
||||
import {raf, cancelRaf, CSS, pointerCoord} from '../../util/dom';
|
||||
@ -459,7 +460,7 @@ class PickerColumnCmp {
|
||||
class PickerDisplayCmp {
|
||||
@ViewChildren(PickerColumnCmp) private _cols: QueryList<PickerColumnCmp>;
|
||||
private d: PickerOptions;
|
||||
private created: number;
|
||||
private enabled: boolean;
|
||||
private lastClick: number;
|
||||
private id: number;
|
||||
|
||||
@ -479,7 +480,6 @@ class PickerDisplayCmp {
|
||||
}
|
||||
|
||||
this.id = (++pickerIds);
|
||||
this.created = Date.now();
|
||||
this.lastClick = 0;
|
||||
}
|
||||
|
||||
@ -544,8 +544,8 @@ class PickerDisplayCmp {
|
||||
|
||||
@HostListener('body:keyup', ['$event'])
|
||||
private _keyUp(ev: KeyboardEvent) {
|
||||
if (this.isEnabled() && this._viewCtrl.isLast()) {
|
||||
if (ev.keyCode === 13) {
|
||||
if (this.enabled && this._viewCtrl.isLast()) {
|
||||
if (ev.keyCode === Key.ENTER) {
|
||||
if (this.lastClick + 1000 < Date.now()) {
|
||||
// do not fire this click if there recently was already a click
|
||||
// this can happen when the button has focus and used the enter
|
||||
@ -556,7 +556,7 @@ class PickerDisplayCmp {
|
||||
this.btnClick(button);
|
||||
}
|
||||
|
||||
} else if (ev.keyCode === 27) {
|
||||
} else if (ev.keyCode === Key.ESCAPE) {
|
||||
console.debug('picker, escape button');
|
||||
this.bdClick();
|
||||
}
|
||||
@ -573,10 +573,11 @@ class PickerDisplayCmp {
|
||||
if (focusableEle) {
|
||||
focusableEle.focus();
|
||||
}
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
btnClick(button: any, dismissDelay?: number) {
|
||||
if (!this.isEnabled()) {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -602,7 +603,7 @@ class PickerDisplayCmp {
|
||||
}
|
||||
|
||||
bdClick() {
|
||||
if (this.isEnabled() && this.d.enableBackdropDismiss) {
|
||||
if (this.enabled && this.d.enableBackdropDismiss) {
|
||||
this.dismiss('backdrop');
|
||||
}
|
||||
}
|
||||
@ -623,11 +624,6 @@ class PickerDisplayCmp {
|
||||
});
|
||||
return selected;
|
||||
}
|
||||
|
||||
isEnabled() {
|
||||
let tm = this._config.getNumber('overlayCreatedDiff', 750);
|
||||
return (this.created + tm < Date.now());
|
||||
}
|
||||
}
|
||||
|
||||
export interface PickerOptions {
|
||||
|
Reference in New Issue
Block a user