static tabs

This commit is contained in:
Adam Bradley
2015-06-05 11:28:00 -05:00
parent 9b299f8c22
commit 630e965e1a
3 changed files with 13 additions and 13 deletions

View File

@@ -137,9 +137,6 @@ export class NavBase {
// create a new NavStackItem
let enteringItem = new NavItem(this, ComponentClass, params);
// set that this item is staged (it's not ready to be animated in yet)
enteringItem.state = STAGED_STATE;
// add the item to the stack
this.add(enteringItem);
@@ -541,11 +538,10 @@ export class NavBase {
}
const ACTIVE_STATE = 1;
const CACHED_STATE = 2;
const STAGED_ENTERING_STATE = 3;
const STAGED_LEAVING_STATE = 4;
const ACTIVELY_ENTERING_STATE = 5;
const ACTIVELY_LEAVING_STATE = 6;
const STAGED_STATE = 'staged';
const STAGED_ENTERING_STATE = 'staged-enter';
const STAGED_LEAVING_STATE = 'staged-leave';
const ACTIVELY_ENTERING_STATE = 'entering';
const ACTIVELY_LEAVING_STATE = 'leaving';
const ACTIVE_STATE = 'active';
const CACHED_STATE = 'cached';

View File

@@ -16,6 +16,7 @@ export class NavItem {
this.ComponentClass = ComponentClass;
this.params = params;
this.instance = null;
this.state = 0;
this._titleEle = undefined;
this._backBtn = undefined;

View File

@@ -53,11 +53,15 @@ export class Tab {
this.navBase = new NavBase(parentNavBase, compiler, elementRef, loader, injector);
this.parentNavBase = parentNavBase;
if (parentNavBase) {
this.sections = parentNavBase.panes['_n'].sections;
}
this.item = new NavItem(parentNavBase);
this.item.setInstance(this);
this.item.setViewElement(elementRef.domElement);
tabs.add(this.item);
this.tabs = tabs;
this.panelId = 'tab-panel-' + this.item.id;
this.labeledBy = 'tab-button-' + this.item.id;
@@ -66,7 +70,6 @@ export class Tab {
this.viewContainerRef = viewContainerRef;
this.sections = parentNavBase.panes['_n'].sections;
this.navBase.panes['_n'] = this;
this.domElement = elementRef.domElement;
@@ -74,7 +77,7 @@ export class Tab {
}
onInit() {
if ( this.parentNavBase.isActive(this.item) || this.parentNavBase.isStagedEntering(this.item) ) {
if ( this.tabs.navBase.isActive(this.item) || this.tabs.navBase.isStagedEntering(this.item) ) {
this.loadInitial();
}
}
@@ -87,7 +90,7 @@ export class Tab {
}
get isSelected() {
return this.parentNavBase.isActive(this.item);
return this.tabs.navBase.isActive(this.item);
}
}