mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
refactor(ViewController): remove need for viewType property
This commit is contained in:
@ -141,7 +141,6 @@ export class ActionSheet extends ViewController {
|
|||||||
opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
|
opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
|
||||||
|
|
||||||
super(ActionSheetCmp, opts);
|
super(ActionSheetCmp, opts);
|
||||||
this.viewType = 'action-sheet';
|
|
||||||
this.isOverlay = true;
|
this.isOverlay = true;
|
||||||
|
|
||||||
// by default, actionsheets should not fire lifecycle events of other views
|
// by default, actionsheets should not fire lifecycle events of other views
|
||||||
|
@ -194,7 +194,6 @@ export class Alert extends ViewController {
|
|||||||
opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
|
opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
|
||||||
|
|
||||||
super(AlertCmp, opts);
|
super(AlertCmp, opts);
|
||||||
this.viewType = 'alert';
|
|
||||||
this.isOverlay = true;
|
this.isOverlay = true;
|
||||||
|
|
||||||
// by default, alerts should not fire lifecycle events of other views
|
// by default, alerts should not fire lifecycle events of other views
|
||||||
|
@ -111,7 +111,6 @@ export class Loading extends ViewController {
|
|||||||
opts.dismissOnPageChange = isPresent(opts.dismissOnPageChange) ? !!opts.dismissOnPageChange : false;
|
opts.dismissOnPageChange = isPresent(opts.dismissOnPageChange) ? !!opts.dismissOnPageChange : false;
|
||||||
|
|
||||||
super(LoadingCmp, opts);
|
super(LoadingCmp, opts);
|
||||||
this.viewType = 'loading';
|
|
||||||
this.isOverlay = true;
|
this.isOverlay = true;
|
||||||
this.usePortal = true;
|
this.usePortal = true;
|
||||||
|
|
||||||
|
@ -1201,10 +1201,6 @@ export class NavController extends Ion {
|
|||||||
this.setTransitioning(!enableApp, duration);
|
this.setTransitioning(!enableApp, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enteringView.viewType) {
|
|
||||||
transAnimation.before.addClass(enteringView.viewType);
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a callback for when the animation is done
|
// create a callback for when the animation is done
|
||||||
transAnimation.onFinish((trans: Transition) => {
|
transAnimation.onFinish((trans: Transition) => {
|
||||||
// transition animation has ended
|
// transition animation has ended
|
||||||
@ -1472,8 +1468,8 @@ export class NavController extends Ion {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// automatically set "ion-page" selector
|
// TEMPORARY: automatically set selector w/ dah reflector
|
||||||
// TODO: see about having this set using ComponentFactory
|
// TODO: use componentFactory.create once fixed
|
||||||
addSelector(view.componentType, 'ion-page');
|
addSelector(view.componentType, 'ion-page');
|
||||||
|
|
||||||
this._compiler.resolveComponent(view.componentType).then(componentFactory => {
|
this._compiler.resolveComponent(view.componentType).then(componentFactory => {
|
||||||
|
@ -68,11 +68,6 @@ export class ViewController {
|
|||||||
*/
|
*/
|
||||||
state: string = '';
|
state: string = '';
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
viewType: string = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* If this is currently the active view, then set to false
|
* If this is currently the active view, then set to false
|
||||||
|
@ -26,7 +26,6 @@ export class Picker extends ViewController {
|
|||||||
opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
|
opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
|
||||||
|
|
||||||
super(PickerDisplayCmp, opts);
|
super(PickerDisplayCmp, opts);
|
||||||
this.viewType = 'picker';
|
|
||||||
this.isOverlay = true;
|
this.isOverlay = true;
|
||||||
|
|
||||||
this.ionChange = new EventEmitter();
|
this.ionChange = new EventEmitter();
|
||||||
|
@ -2,14 +2,13 @@ import {Component, ComponentResolver, ElementRef, HostListener, Renderer, ViewCh
|
|||||||
|
|
||||||
import {addSelector} from '../../config/bootstrap';
|
import {addSelector} from '../../config/bootstrap';
|
||||||
import {Animation} from '../../animations/animation';
|
import {Animation} from '../../animations/animation';
|
||||||
|
import {Config} from '../../config/config';
|
||||||
|
import {CSS, nativeRaf} from '../../util/dom';
|
||||||
|
import {isPresent, pascalCaseToDashCase} from '../../util/util';
|
||||||
|
import {Key} from '../../util/key';
|
||||||
|
import {NavParams} from '../nav/nav-params';
|
||||||
import {PageTransition} from '../../transitions/page-transition';
|
import {PageTransition} from '../../transitions/page-transition';
|
||||||
import {TransitionOptions} from '../../transitions/transition';
|
import {TransitionOptions} from '../../transitions/transition';
|
||||||
import {Config} from '../../config/config';
|
|
||||||
import {NavParams} from '../nav/nav-params';
|
|
||||||
import {Platform} from '../../platform/platform';
|
|
||||||
import {Key} from '../../util/key';
|
|
||||||
import {isPresent, isUndefined, isDefined} from '../../util/util';
|
|
||||||
import {nativeRaf, CSS} from '../../util/dom';
|
|
||||||
import {ViewController} from '../nav/view-controller';
|
import {ViewController} from '../nav/view-controller';
|
||||||
|
|
||||||
const POPOVER_IOS_BODY_PADDING = 2;
|
const POPOVER_IOS_BODY_PADDING = 2;
|
||||||
@ -114,7 +113,6 @@ export class Popover extends ViewController {
|
|||||||
data.componentType = componentType;
|
data.componentType = componentType;
|
||||||
data.opts = opts;
|
data.opts = opts;
|
||||||
super(PopoverCmp, data);
|
super(PopoverCmp, data);
|
||||||
this.viewType = 'popover';
|
|
||||||
this.isOverlay = true;
|
this.isOverlay = true;
|
||||||
|
|
||||||
// by default, popovers should not fire lifecycle events of other views
|
// by default, popovers should not fire lifecycle events of other views
|
||||||
@ -123,13 +121,13 @@ export class Popover extends ViewController {
|
|||||||
this.fireOtherLifecycles = false;
|
this.fireOtherLifecycles = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
getTransitionName(direction: string) {
|
getTransitionName(direction: string) {
|
||||||
let key = (direction === 'back' ? 'popoverLeave' : 'popoverEnter');
|
let key = (direction === 'back' ? 'popoverLeave' : 'popoverEnter');
|
||||||
return this._nav && this._nav.config.get(key);
|
return this._nav && this._nav.config.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a popover with the following options
|
* Create a popover with the following options
|
||||||
@ -162,7 +160,7 @@ export class Popover extends ViewController {
|
|||||||
'<div class="popover-arrow"></div>' +
|
'<div class="popover-arrow"></div>' +
|
||||||
'<div class="popover-content">' +
|
'<div class="popover-content">' +
|
||||||
'<div class="popover-viewport">' +
|
'<div class="popover-viewport">' +
|
||||||
'<div #viewport></div>' +
|
'<div #viewport nav-viewport></div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
@ -230,7 +228,7 @@ class PopoverCmp {
|
|||||||
|
|
||||||
@HostListener('body:keyup', ['$event'])
|
@HostListener('body:keyup', ['$event'])
|
||||||
private _keyUp(ev: KeyboardEvent) {
|
private _keyUp(ev: KeyboardEvent) {
|
||||||
if (this.enabled && this._viewCtrl.isLast() && ev.keyCode === Key.ESCAPE ) {
|
if (this.enabled && ev.keyCode === Key.ESCAPE && this._viewCtrl.isLast()) {
|
||||||
this.bdClick();
|
this.bdClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,6 @@ export class Toast extends ViewController {
|
|||||||
opts.position = TOAST_POSITION_BOTTOM;
|
opts.position = TOAST_POSITION_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.viewType = 'toast';
|
|
||||||
this.isOverlay = true;
|
this.isOverlay = true;
|
||||||
this.usePortal = true;
|
this.usePortal = true;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ export * from './util/keyboard';
|
|||||||
export * from './util/form';
|
export * from './util/form';
|
||||||
|
|
||||||
export * from './animations/animation';
|
export * from './animations/animation';
|
||||||
|
export * from './transitions/page-transition';
|
||||||
export * from './transitions/transition';
|
export * from './transitions/transition';
|
||||||
|
|
||||||
export * from './translation/translate';
|
export * from './translation/translate';
|
||||||
|
@ -2,7 +2,7 @@ import {Animation} from '../animations/animation';
|
|||||||
import {closest} from '../util/dom';
|
import {closest} from '../util/dom';
|
||||||
import {Content} from '../components/content/content';
|
import {Content} from '../components/content/content';
|
||||||
import {Tabs} from '../components/tabs/tabs';
|
import {Tabs} from '../components/tabs/tabs';
|
||||||
import {Transition} from './transition';
|
import {Transition, TransitionOptions} from './transition';
|
||||||
import {ViewController} from '../components/nav/view-controller';
|
import {ViewController} from '../components/nav/view-controller';
|
||||||
|
|
||||||
|
|
||||||
@ -130,13 +130,3 @@ function parsePxUnit(val: string): number {
|
|||||||
return (val.indexOf('px') > 0) ? parseInt(val, 10) : 0;
|
return (val.indexOf('px') > 0) ? parseInt(val, 10) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransitionOptions {
|
|
||||||
animation: string;
|
|
||||||
duration: number;
|
|
||||||
easing: string;
|
|
||||||
direction: string;
|
|
||||||
renderDelay?: number;
|
|
||||||
isRTL?: boolean;
|
|
||||||
ev?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user