mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
nav and modal docs wip
This commit is contained in:
@ -4,10 +4,18 @@ import {Overlay} from '../overlay/overlay';
|
||||
import {Animation} from '../../animations/animation';
|
||||
import * as util from 'ionic/util';
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@Injectable()
|
||||
export class Modal extends Overlay {
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {Type} ComponentType TODO
|
||||
* @param {Object} [opts={}] TODO
|
||||
* @returns {TODO} TODO
|
||||
*/
|
||||
open(ComponentType: Type, opts={}) {
|
||||
let defaults = {
|
||||
enterAnimation: 'modal-slide-in',
|
||||
@ -17,6 +25,11 @@ export class Modal extends Overlay {
|
||||
return this.create(OVERLAY_TYPE, ComponentType, util.extend(defaults, opts));
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {TODO} handle TODO
|
||||
* @returns {TODO} TODO
|
||||
*/
|
||||
get(handle) {
|
||||
if (handle) {
|
||||
return this.getByHandle(handle, OVERLAY_TYPE);
|
||||
|
@ -1,14 +1,21 @@
|
||||
import {extend} from '../../util/util';
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
export class NavController {
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {TODO} nav TODO
|
||||
*/
|
||||
constructor(nav) {
|
||||
this._nav = nav;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the history stack to match the list of component items.
|
||||
* @param {TODO} items TODO
|
||||
* @return {TODO} TODO
|
||||
*/
|
||||
setItems(items) {
|
||||
return this._nav.setItems(items);
|
||||
@ -16,13 +23,15 @@ export class NavController {
|
||||
|
||||
/**
|
||||
* Clear the history stack.
|
||||
* @return {TODO} TODO
|
||||
*/
|
||||
clear() {
|
||||
return this._nav.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an ew component onto the history stack.
|
||||
* Push a new component onto the history stack.
|
||||
* @return {TODO} TODO
|
||||
*/
|
||||
push() {
|
||||
return this._nav.push.apply(this._nav, arguments);
|
||||
@ -30,16 +39,29 @@ export class NavController {
|
||||
|
||||
/**
|
||||
* Pop the top most (visible) component off the history stack.
|
||||
* @return {TODO} TODO
|
||||
*/
|
||||
pop() {
|
||||
return this._nav.pop.apply(this._nav, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
export class NavParams {
|
||||
/**
|
||||
* TODO
|
||||
* @param {TODO} data TODO
|
||||
*/
|
||||
constructor(data) {
|
||||
this.data = data || {};
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {TODO} param TODO
|
||||
*/
|
||||
get(param) {
|
||||
return this.data[param];
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
import {Directive} from 'angular2/angular2';
|
||||
import {NavController} from './nav-controller';
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[nav-push]',
|
||||
properties: [
|
||||
@ -14,15 +16,22 @@ import {NavController} from './nav-controller';
|
||||
}
|
||||
})
|
||||
export class NavPush {
|
||||
/**
|
||||
* TODO
|
||||
* @param {NavController} nav TODO
|
||||
*/
|
||||
constructor(nav: NavController) {
|
||||
this.nav = nav;
|
||||
}
|
||||
|
||||
onClick(event) {
|
||||
this.nav.push(this.navPush, this.pushData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[nav-pop]',
|
||||
host: {
|
||||
@ -31,6 +40,10 @@ export class NavPush {
|
||||
}
|
||||
})
|
||||
export class NavPop {
|
||||
/**
|
||||
* TODO
|
||||
* @param {NavController} nav TODO
|
||||
*/
|
||||
constructor(nav: NavController) {
|
||||
this.nav = nav;
|
||||
}
|
||||
|
@ -8,12 +8,22 @@ import {
|
||||
|
||||
import {Nav} from './nav';
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@Directive({
|
||||
selector: 'ion-nav'
|
||||
})
|
||||
export class NavRouter extends RouterOutlet {
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {ElementRef} _elementRef TODO
|
||||
* @param {DynamicComponentLoader} _loader TODO
|
||||
* @param {Router} _parentRouter TODO
|
||||
* @param {string} nameAttr Value of the element's 'name' attribute
|
||||
* @param {Nav} nav TODO
|
||||
*/
|
||||
constructor(_elementRef: ElementRef, _loader: DynamicComponentLoader,
|
||||
_parentRouter: Router, @Attribute('name') nameAttr: string,
|
||||
nav: Nav) {
|
||||
@ -28,6 +38,11 @@ export class NavRouter extends RouterOutlet {
|
||||
nav.registerRouter(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* TODO
|
||||
* @param {ComponentInstruction} instruction TODO
|
||||
*/
|
||||
_activate(instruction: ComponentInstruction): Promise<any> {
|
||||
var previousInstruction = this._currentInstruction;
|
||||
this._currentInstruction = instruction;
|
||||
@ -38,6 +53,11 @@ export class NavRouter extends RouterOutlet {
|
||||
this.nav.push(componentType, instruction.params);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {TODO} type TODO
|
||||
* @param {TODO} viewItem TODO
|
||||
*/
|
||||
stateChange(type, viewItem) {
|
||||
// stateChange is called by Ionic's ViewController
|
||||
// type could be "push" or "pop"
|
||||
@ -62,6 +82,11 @@ export class NavRouter extends RouterOutlet {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {TODO} componentType TODO
|
||||
* @returns {TODO} TODO
|
||||
*/
|
||||
getPathRecognizerByComponent(componentType) {
|
||||
// given a componentType, figure out the best PathRecognizer to use
|
||||
let rules = this._parentRouter.registry._rules;
|
||||
|
@ -3,7 +3,9 @@ import {Directive, View, ElementRef, Host, Optional, forwardRef, Injector, NgZon
|
||||
import {IonicComponent} from '../../config/annotations';
|
||||
import {ViewController} from '../view/view-controller';
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@IonicComponent({
|
||||
selector: 'ion-nav',
|
||||
properties: [
|
||||
@ -19,6 +21,13 @@ import {ViewController} from '../view/view-controller';
|
||||
})
|
||||
export class Nav extends ViewController {
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {ViewController} hostViewCtrl TODO
|
||||
* @param {Injector} injector TODO
|
||||
* @param {ElementRef} elementRef TODO
|
||||
* @param {NgZone} zone TODO
|
||||
*/
|
||||
constructor(
|
||||
@Optional() hostViewCtrl: ViewController,
|
||||
injector: Injector,
|
||||
@ -28,6 +37,9 @@ export class Nav extends ViewController {
|
||||
super(hostViewCtrl, injector, elementRef, zone);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
onIonInit() {
|
||||
|
||||
if (this.root) {
|
||||
|
@ -7,8 +7,14 @@ import {SwipeHandle} from './swipe-handle';
|
||||
import {IonicComponent} from '../../config/annotations';
|
||||
import {PaneAnchor, PaneContentAnchor, NavBarContainer} from './anchors';
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
export class PaneController {
|
||||
/**
|
||||
* TODO
|
||||
* @param {ViewController} viewCtrl TODO
|
||||
*/
|
||||
constructor(viewCtrl: ViewController) {
|
||||
this.panes = [];
|
||||
this.viewCtrl = viewCtrl;
|
||||
@ -18,6 +24,11 @@ export class PaneController {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param {TODO} nav TODO
|
||||
* @param {Function} nav TODO
|
||||
*/
|
||||
get(itemStructure, callback) {
|
||||
// this gets or creates the Pane which similar nav items live in
|
||||
// Nav items with just a navbar/content would all use the same Pane
|
||||
|
@ -5,6 +5,9 @@ import {Pane} from './pane';
|
||||
import {Gesture} from 'ionic/gestures/gesture';
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@Directive({
|
||||
selector: '.swipe-handle',
|
||||
host: {
|
||||
@ -12,6 +15,13 @@ import {Gesture} from 'ionic/gestures/gesture';
|
||||
}
|
||||
})
|
||||
export class SwipeHandle {
|
||||
/**
|
||||
* TODO
|
||||
* @param {ViewController=} viewCtrl TODO
|
||||
* @param {Pane} pane TODO
|
||||
* @param {ElementRef} elementRef TODO
|
||||
* @param {NgZone} ngZone TODO
|
||||
*/
|
||||
constructor(
|
||||
@Optional() @Inject(forwardRef(() => ViewController)) viewCtrl: ViewController,
|
||||
@Host() @Inject(forwardRef(() => Pane)) pane: Pane,
|
||||
|
Reference in New Issue
Block a user