mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
nav-pane/tab view anchors
This commit is contained in:
@ -65,82 +65,3 @@ class NavPaneAnchor {
|
||||
nav.navBase.setPaneAnchor(elementRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component({selector:'ion-nav-pane'})
|
||||
@View({
|
||||
template: `
|
||||
<template nav-section-anchor></template>
|
||||
<section class="content-container">
|
||||
<template content-anchor></template>
|
||||
</section>
|
||||
`,
|
||||
directives: [NavPaneSectionAnchor, NavPaneContentAnchor]
|
||||
})
|
||||
export class NavPane {
|
||||
constructor(@Parent() nav: Nav, viewContainerRef: ViewContainerRef) {
|
||||
this.viewContainerRef = viewContainerRef;
|
||||
this.sections = {};
|
||||
nav.addPane(this);
|
||||
}
|
||||
addSection(sectionName, instance) {
|
||||
this.sections[sectionName] = instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Used to dynamically create new sections for a NavPane
|
||||
// This is simply a reference point to create new sections
|
||||
// Navbar, toolbar, and tabbar sections would be created next to this
|
||||
@Directive({
|
||||
selector: 'template[nav-section-anchor]'
|
||||
})
|
||||
class NavPaneSectionAnchor {
|
||||
constructor(@Parent() navPane: NavPane, elementRef: ElementRef) {
|
||||
navPane.sectionAnchorElementRef = elementRef;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Where the content of the NavItem goes next to. All NavPanes have content.
|
||||
// This is simply a reference point to where content goes
|
||||
@Directive({
|
||||
selector: 'template[content-anchor]'
|
||||
})
|
||||
class NavPaneContentAnchor {
|
||||
constructor(@Parent() navPane: NavPane, viewContainerRef: ViewContainerRef) {
|
||||
navPane.contentContainerRef = viewContainerRef;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
@Component({
|
||||
selector: 'section',
|
||||
hostAttributes: {
|
||||
'class': 'navbar-container'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
template: `
|
||||
<template section-anchor></template>
|
||||
`,
|
||||
directives: [NavBarSectionAnchor]
|
||||
})
|
||||
export class NavBarSection {
|
||||
constructor(@Parent() navPane: NavPane, viewContainerRef: ViewContainerRef, elementRef: ElementRef) {
|
||||
this.navPane = navPane;
|
||||
navPane.addSection('navbar', this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Reference point of where the guts of the NavBar should go next to
|
||||
@Directive({
|
||||
selector: 'template[section-anchor]'
|
||||
})
|
||||
class NavBarSectionAnchor {
|
||||
constructor(@Parent() navBarSection: NavBarSection, viewContainerRef: ViewContainerRef) {
|
||||
navBarSection.viewContainerRef = viewContainerRef;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user