mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
style(viewcontroller): some TS types and minor changes
This commit is contained in:
@ -472,6 +472,14 @@ export abstract class NavController {
|
|||||||
*/
|
*/
|
||||||
abstract popTo(page: any, params?: any, opts?: NavOptions, done?: Function): Promise<any>;
|
abstract popTo(page: any, params?: any, opts?: NavOptions, done?: Function): Promise<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* Pop sequently all the pages in the stack.
|
||||||
|
*
|
||||||
|
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
|
||||||
|
*/
|
||||||
|
abstract popAll(): Promise<any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a page from the nav stack at the specified index.
|
* Removes a page from the nav stack at the specified index.
|
||||||
*
|
*
|
||||||
|
@ -3,7 +3,7 @@ import { ComponentRef, ElementRef, EventEmitter, Output, Renderer } from '@angul
|
|||||||
import { Footer, Header } from '../components/toolbar/toolbar';
|
import { Footer, Header } from '../components/toolbar/toolbar';
|
||||||
import { isPresent, assign } from '../util/util';
|
import { isPresent, assign } from '../util/util';
|
||||||
import { Navbar } from '../components/navbar/navbar';
|
import { Navbar } from '../components/navbar/navbar';
|
||||||
import { NavControllerBase } from './nav-controller-base';
|
import { NavController } from './nav-controller';
|
||||||
import { NavOptions, ViewState } from './nav-util';
|
import { NavOptions, ViewState } from './nav-util';
|
||||||
import { NavParams } from './nav-params';
|
import { NavParams } from './nav-params';
|
||||||
import { Content } from '../components/content/content';
|
import { Content } from '../components/content/content';
|
||||||
@ -27,6 +27,7 @@ import { Content } from '../components/content/content';
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export class ViewController {
|
export class ViewController {
|
||||||
|
|
||||||
private _cntDir: any;
|
private _cntDir: any;
|
||||||
private _cntRef: ElementRef;
|
private _cntRef: ElementRef;
|
||||||
private _ionCntDir: Content;
|
private _ionCntDir: Content;
|
||||||
@ -42,6 +43,12 @@ export class ViewController {
|
|||||||
private _dismissRole: any;
|
private _dismissRole: any;
|
||||||
private _detached: boolean;
|
private _detached: boolean;
|
||||||
|
|
||||||
|
_cmp: ComponentRef<any>;
|
||||||
|
_nav: NavController;
|
||||||
|
_zIndex: number;
|
||||||
|
_state: ViewState;
|
||||||
|
_cssClass: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Observable to be subscribed to when the current component will become active
|
* Observable to be subscribed to when the current component will become active
|
||||||
* @returns {Observable} Returns an observable
|
* @returns {Observable} Returns an observable
|
||||||
@ -84,21 +91,6 @@ export class ViewController {
|
|||||||
/** @private */
|
/** @private */
|
||||||
isOverlay: boolean = false;
|
isOverlay: boolean = false;
|
||||||
|
|
||||||
/** @private */
|
|
||||||
_cmp: ComponentRef<any>;
|
|
||||||
|
|
||||||
/** @private */
|
|
||||||
_nav: NavControllerBase;
|
|
||||||
|
|
||||||
/** @private */
|
|
||||||
_zIndex: number;
|
|
||||||
|
|
||||||
/** @private */
|
|
||||||
_state: ViewState;
|
|
||||||
|
|
||||||
/** @private */
|
|
||||||
_cssClass: string;
|
|
||||||
|
|
||||||
/** @private */
|
/** @private */
|
||||||
@Output() private _emitter: EventEmitter<any> = new EventEmitter();
|
@Output() private _emitter: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
@ -118,16 +110,10 @@ export class ViewController {
|
|||||||
this._detached = false;
|
this._detached = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
_setNav(navCtrl: NavController) {
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setNav(navCtrl: NavControllerBase) {
|
|
||||||
this._nav = navCtrl;
|
this._nav = navCtrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setInstance(instance: any) {
|
_setInstance(instance: any) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
@ -181,7 +167,7 @@ export class ViewController {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
getNav() {
|
getNav(): NavController {
|
||||||
return this._nav;
|
return this._nav;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,9 +285,6 @@ export class ViewController {
|
|||||||
return this._cmp && this._cmp.location;
|
return this._cmp && this._cmp.location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setContent(directive: any) {
|
_setContent(directive: any) {
|
||||||
this._cntDir = directive;
|
this._cntDir = directive;
|
||||||
}
|
}
|
||||||
@ -313,9 +296,6 @@ export class ViewController {
|
|||||||
return this._cntDir;
|
return this._cntDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setContentRef(elementRef: ElementRef) {
|
_setContentRef(elementRef: ElementRef) {
|
||||||
this._cntRef = elementRef;
|
this._cntRef = elementRef;
|
||||||
}
|
}
|
||||||
@ -327,9 +307,6 @@ export class ViewController {
|
|||||||
return this._cntRef;
|
return this._cntRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setIONContent(content: Content) {
|
_setIONContent(content: Content) {
|
||||||
this._setContent(content);
|
this._setContent(content);
|
||||||
this._ionCntDir = content;
|
this._ionCntDir = content;
|
||||||
@ -342,9 +319,6 @@ export class ViewController {
|
|||||||
return this._ionCntDir;
|
return this._ionCntDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setIONContentRef(elementRef: ElementRef) {
|
_setIONContentRef(elementRef: ElementRef) {
|
||||||
this._setContentRef(elementRef);
|
this._setContentRef(elementRef);
|
||||||
this._ionCntRef = elementRef;
|
this._ionCntRef = elementRef;
|
||||||
@ -357,9 +331,6 @@ export class ViewController {
|
|||||||
return this._ionCntRef;
|
return this._ionCntRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setHeader(directive: Header) {
|
_setHeader(directive: Header) {
|
||||||
this._hdrDir = directive;
|
this._hdrDir = directive;
|
||||||
}
|
}
|
||||||
@ -367,13 +338,10 @@ export class ViewController {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
getHeader() {
|
getHeader(): Header {
|
||||||
return this._hdrDir;
|
return this._hdrDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setFooter(directive: Footer) {
|
_setFooter(directive: Footer) {
|
||||||
this._ftrDir = directive;
|
this._ftrDir = directive;
|
||||||
}
|
}
|
||||||
@ -381,13 +349,10 @@ export class ViewController {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
getFooter() {
|
getFooter(): Footer {
|
||||||
return this._ftrDir;
|
return this._ftrDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_setNavbar(directive: Navbar) {
|
_setNavbar(directive: Navbar) {
|
||||||
this._nb = directive;
|
this._nb = directive;
|
||||||
}
|
}
|
||||||
@ -429,9 +394,6 @@ export class ViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_preLoad() {
|
_preLoad() {
|
||||||
this._lifecycle('PreLoad');
|
this._lifecycle('PreLoad');
|
||||||
}
|
}
|
||||||
@ -536,7 +498,7 @@ export class ViewController {
|
|||||||
if (renderer) {
|
if (renderer) {
|
||||||
// ensure the element is cleaned up for when the view pool reuses this element
|
// ensure the element is cleaned up for when the view pool reuses this element
|
||||||
// ******** DOM WRITE ****************
|
// ******** DOM WRITE ****************
|
||||||
const cmpEle = this._cmp.location.nativeElement;
|
var cmpEle = this._cmp.location.nativeElement;
|
||||||
renderer.setElementAttribute(cmpEle, 'class', null);
|
renderer.setElementAttribute(cmpEle, 'class', null);
|
||||||
renderer.setElementAttribute(cmpEle, 'style', null);
|
renderer.setElementAttribute(cmpEle, 'style', null);
|
||||||
}
|
}
|
||||||
@ -552,8 +514,8 @@ export class ViewController {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_lifecycleTest(lifecycle: string): boolean | Promise<any> {
|
_lifecycleTest(lifecycle: string): boolean | Promise<any> {
|
||||||
let instance = this.instance;
|
const instance = this.instance;
|
||||||
let methodName = 'ionViewCan' + lifecycle;
|
const methodName = 'ionViewCan' + lifecycle;
|
||||||
if (instance && instance[methodName]) {
|
if (instance && instance[methodName]) {
|
||||||
try {
|
try {
|
||||||
let result = instance[methodName]();
|
let result = instance[methodName]();
|
||||||
@ -574,8 +536,8 @@ export class ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_lifecycle(lifecycle: string) {
|
_lifecycle(lifecycle: string) {
|
||||||
let instance = this.instance;
|
const instance = this.instance;
|
||||||
let methodName = 'ionView' + lifecycle;
|
const methodName = 'ionView' + lifecycle;
|
||||||
if (instance && instance[methodName]) {
|
if (instance && instance[methodName]) {
|
||||||
try {
|
try {
|
||||||
instance[methodName]();
|
instance[methodName]();
|
||||||
@ -588,7 +550,7 @@ export class ViewController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isViewController(viewCtrl: any) {
|
export function isViewController(viewCtrl: any): boolean {
|
||||||
return !!(viewCtrl && (<ViewController>viewCtrl)._didLoad && (<ViewController>viewCtrl)._willUnload);
|
return !!(viewCtrl && (<ViewController>viewCtrl)._didLoad && (<ViewController>viewCtrl)._willUnload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user