mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 14:01:20 +08:00
refactor(): restructure components to loosen coupling, move overlay-portal, click-block, menu-controller and other app-level functionality to app directory. The motivation for this change is logical grouping, decoupling components from each other, and improving the ability to drop more unused components from bundle
This commit is contained in:
@ -5,10 +5,8 @@ import { App } from '../components/app/app';
|
||||
import { convertToViews, DIRECTION_BACK, isNav, isTab, isTabs, NavLink, NavSegment } from './nav-util';
|
||||
import { ModuleLoader } from '../util/module-loader';
|
||||
import { isArray, isPresent } from '../util/util';
|
||||
import { Nav } from '../components/nav/nav';
|
||||
import { Nav, Tab, Tabs } from './nav-interfaces';
|
||||
import { NavController } from './nav-controller';
|
||||
import { Tab } from '../components/tabs/tab';
|
||||
import { Tabs } from '../components/tabs/tabs';
|
||||
import { UrlSerializer } from './url-serializer';
|
||||
import { ViewController } from './view-controller';
|
||||
|
||||
@ -77,7 +75,7 @@ export class DeepLinker {
|
||||
}
|
||||
|
||||
// get the app's root nav
|
||||
const appRootNav = <Nav>this._app.getRootNav();
|
||||
const appRootNav = <Nav> (this._app.getRootNav() as any);
|
||||
if (appRootNav) {
|
||||
if (browserUrl === '/') {
|
||||
// a url change to the index url
|
||||
@ -90,17 +88,17 @@ export class DeepLinker {
|
||||
// the url change is to the root but we don't
|
||||
// already know the url used. So let's just
|
||||
// reset the root nav to its root page
|
||||
appRootNav.goToRoot({
|
||||
return appRootNav.goToRoot({
|
||||
updateUrl: false,
|
||||
isNavRoot: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// normal url
|
||||
this._segments = this._serializer.parse(browserUrl);
|
||||
this._loadNavFromPath(appRootNav);
|
||||
// this is so dirty I need a shower
|
||||
this._loadNavFromPath(((appRootNav as any) as NavController));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
src/navigation/nav-interfaces.ts
Normal file
34
src/navigation/nav-interfaces.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { NavOptions } from './nav-util';
|
||||
|
||||
export interface Nav {
|
||||
goToRoot(opts: NavOptions): Promise<any>;
|
||||
};
|
||||
|
||||
export interface Tabs {
|
||||
_tabs: Tab[];
|
||||
select(tabOrIndex: number | Tab, opts: NavOptions): void;
|
||||
_top: number;
|
||||
setTabbarPosition(top: number, bottom: number): void;
|
||||
};
|
||||
|
||||
export interface Tab {
|
||||
tabUrlPath: string;
|
||||
tabTitle: string;
|
||||
index: number;
|
||||
};
|
||||
|
||||
export interface Content {
|
||||
resize(): void;
|
||||
};
|
||||
|
||||
export interface Footer {
|
||||
};
|
||||
|
||||
export interface Header {
|
||||
};
|
||||
|
||||
export interface Navbar {
|
||||
setBackButtonText(backButtonText: string): void;
|
||||
hideBackButton: boolean;
|
||||
didEnter(): void;
|
||||
}
|
@ -1,13 +1,10 @@
|
||||
import { ComponentRef, ElementRef, EventEmitter, Output, Renderer } from '@angular/core';
|
||||
|
||||
import { Footer } from '../components/toolbar/toolbar-footer';
|
||||
import { Header } from '../components/toolbar/toolbar-header';
|
||||
import { isPresent, assert } from '../util/util';
|
||||
import { Navbar } from '../components/navbar/navbar';
|
||||
import { NavController } from './nav-controller';
|
||||
import { NavOptions, STATE_NEW, STATE_INITIALIZED, STATE_ATTACHED, STATE_DESTROYED } from './nav-util';
|
||||
import { NavParams } from './nav-params';
|
||||
import { Content } from '../components/content/content';
|
||||
import { Content, Footer, Header, Navbar } from './nav-interfaces';
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user