mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 13:01:01 +08:00
refactor(navigation): update interfaces
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
import { Component, Element, Method, Prop } from '@stencil/core';
|
import { Component, Element, Method, Prop } from '@stencil/core';
|
||||||
import { AnimationController, Config } from '../..';
|
|
||||||
import { ComponentDataPair, FrameworkDelegate, Nav, NavController, NavOptions, ViewController } from '../../navigation/nav-interfaces';
|
import { ComponentDataPair, FrameworkDelegate, Nav, NavController, NavOptions, ViewController } from '../../navigation/nav-interfaces';
|
||||||
|
|
||||||
import { isReady } from '../../utils/helpers';
|
import { isReady } from '../../utils/helpers';
|
||||||
@ -25,9 +24,6 @@ let defaultDelegate: FrameworkDelegate = null;
|
|||||||
export class NavControllerImpl implements NavController {
|
export class NavControllerImpl implements NavController {
|
||||||
|
|
||||||
@Element() element: HTMLElement;
|
@Element() element: HTMLElement;
|
||||||
|
|
||||||
@Prop({ connect: 'ion-animation-controller' }) animationCtrl: AnimationController;
|
|
||||||
@Prop({ context: 'config' }) config: Config;
|
|
||||||
@Prop() delegate: FrameworkDelegate;
|
@Prop() delegate: FrameworkDelegate;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, Element, Event, EventEmitter, Method, Prop } from '@stencil/core';
|
import { Component, Element, Event, EventEmitter, Listen, Method, Prop } from '@stencil/core';
|
||||||
import { AnimationController, Config } from '../..';
|
import { AnimationController, Config } from '../..';
|
||||||
import { ComponentDataPair, FrameworkDelegate, Nav, NavController, NavOptions, ViewController } from '../../navigation/nav-interfaces';
|
import { ComponentDataPair, FrameworkDelegate, Nav, NavController, NavOptions, ViewController } from '../../navigation/nav-interfaces';
|
||||||
|
|
||||||
@ -118,16 +118,23 @@ export class IonNav implements Nav {
|
|||||||
return getFirstView(this);
|
return getFirstView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Listen('navInit')
|
||||||
|
navInitialized(event: any) {
|
||||||
|
console.log('got the event: ', event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <slot></slot>;
|
return <slot></slot>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ionViewDidLoadImpl(nav: Nav) {
|
export function ionViewDidLoadImpl(nav: Nav) {
|
||||||
nav.
|
nav.navInit.emit(nav);
|
||||||
if (nav.root) {
|
if (nav.root) {
|
||||||
nav.setRoot(nav.root);
|
nav.setRoot(nav.root);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pushImpl(nav: Nav, component: any, data: any, opts: NavOptions) {
|
export function pushImpl(nav: Nav, component: any, data: any, opts: NavOptions) {
|
||||||
|
2
packages/core/src/index.d.ts
vendored
2
packages/core/src/index.d.ts
vendored
@ -24,8 +24,6 @@ import { SegmentButton, SegmentButtonEvent } from './components/segment-button/s
|
|||||||
import { Toast, ToastEvent, ToastOptions } from './components/toast/toast'
|
import { Toast, ToastEvent, ToastOptions } from './components/toast/toast'
|
||||||
import { ToastController } from './components/toast-controller/toast-controller'
|
import { ToastController } from './components/toast-controller/toast-controller'
|
||||||
|
|
||||||
import * as Stencil from '@stencil/core';
|
|
||||||
|
|
||||||
import { TransitionBuilder } from './navigation/nav-interfaces';
|
import { TransitionBuilder } from './navigation/nav-interfaces';
|
||||||
|
|
||||||
export interface Config {
|
export interface Config {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { EventEmitter } from '@stencil/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Animation,
|
Animation,
|
||||||
AnimationController,
|
AnimationController,
|
||||||
@ -25,7 +27,11 @@ export interface Nav {
|
|||||||
parent?: Nav;
|
parent?: Nav;
|
||||||
childNavs?: Nav[]; // TODO - make nav container
|
childNavs?: Nav[]; // TODO - make nav container
|
||||||
root?: any;
|
root?: any;
|
||||||
|
navInit?: EventEmitter;
|
||||||
|
config?: Config;
|
||||||
|
animationCtrl?: AnimationController;
|
||||||
|
|
||||||
|
// public methods
|
||||||
getActive(): ViewController;
|
getActive(): ViewController;
|
||||||
getPrevious(view?: ViewController): ViewController;
|
getPrevious(view?: ViewController): ViewController;
|
||||||
getViews(): ViewController[];
|
getViews(): ViewController[];
|
||||||
|
@ -166,6 +166,7 @@ export function isReady(element: HTMLElement) {
|
|||||||
resolve(elm);
|
resolve(elm);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
export function deepCopy(obj: any) {
|
export function deepCopy(obj: any) {
|
||||||
|
Reference in New Issue
Block a user