diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d7d81d1d45..4ab192e18f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -14,9 +14,9 @@ Please see our [Contributor Code of Conduct](https://github.com/driftyco/ionic/b * It is required that you clearly describe the steps necessary to reproduce the issue you are running into. Although we would love to help our users as much as possible, diagnosing issues without clear reproduction steps is extremely time-consuming and simply not sustainable. -* The issue list of this repo is exclusively for bug reports and feature requests. Non-conforming issues will be closed immediately. +* The issue list of this repository is exclusively for bug reports and feature requests. Non-conforming issues will be closed immediately. -* Issues with no clear repro steps will not be triaged. If an issue labeled "need reply" receives no further input from the issue author for more than 5 days, it will be closed. +* Issues with no clear steps to reproduce will not be triaged. If an issue is labeled with "needs reply" and receives no further replies from the author of the issue for more than 5 days, it will be closed. * If you think you have found a bug, or have a new feature idea, please start by making sure it hasn't already been [reported](https://github.com/driftyco/ionic/issues?utf8=%E2%9C%93&q=is%3Aissue). You can search through existing issues to see if there is a similar one reported. Include closed issues as it may have been closed with a solution. diff --git a/scripts/docs/deploy.sh b/scripts/docs/deploy.sh index d8e4be7f29..1e93393f15 100755 --- a/scripts/docs/deploy.sh +++ b/scripts/docs/deploy.sh @@ -38,6 +38,8 @@ function run { ./node_modules/.bin/gulp docs.dgeni --doc-version="$VERSION_NAME" ./node_modules/.bin/gulp docs.dgeni --doc-version="nightly" + ./node_modules/.bin/gulp docs.homepageVersionUpdate + else if [ -d "$DOCS_DEST/nightly/api" ]; then diff --git a/scripts/gulp/constants.ts b/scripts/gulp/constants.ts index 05fe33b550..ad6d9a14a1 100644 --- a/scripts/gulp/constants.ts +++ b/scripts/gulp/constants.ts @@ -17,6 +17,7 @@ export const ES_2015 = 'es2015'; export const ES5 = 'es5'; export const INDEX_JS = 'index.js'; export const BUNDLES = 'bundles'; +export const SITE_NAME = 'ionic-site'; // File Paths export const PROJECT_ROOT = join(__dirname, '../..'); @@ -36,6 +37,7 @@ export const DIST_VENDOR_ROOT = join(DIST_ROOT, VENDOR_NAME); export const NODE_MODULES_ROOT = join(PROJECT_ROOT, NODE_MODULES); export const SCRIPTS_ROOT = join(PROJECT_ROOT, SCRIPTS_NAME); export const SRC_ROOT = join(PROJECT_ROOT, SRC_NAME); +export const SITE_ROOT = join(PROJECT_ROOT, '..', SITE_NAME); export const SRC_COMPONENTS_ROOT = join(SRC_ROOT, COMPONENTS_NAME); export const WORKERS_SRC = join(SCRIPTS_ROOT, 'workers'); diff --git a/scripts/gulp/tasks/docs.ts b/scripts/gulp/tasks/docs.ts index 18d97c9d92..94dbebf709 100644 --- a/scripts/gulp/tasks/docs.ts +++ b/scripts/gulp/tasks/docs.ts @@ -10,6 +10,8 @@ import { valid }from 'semver'; import { argv } from 'yargs'; import { DIST_DEMOS_ROOT } from '../constants'; +import { SITE_ROOT } from '../constants'; +import { PROJECT_ROOT } from '../constants'; task('docs', ['docs.dgeni', 'docs.demos', 'docs.sassVariables']); @@ -136,3 +138,16 @@ task('docs.sassVariables', () => { writeFileSync(outputFile, JSON.stringify(variables)); })); }); + +task('docs.homepageVersionUpdate', () => { + // This assumes you're currently releasing + const sourcePackageJSON = require(`${PROJECT_ROOT}/package.json`); + let now = new Date(); + + const frameworkInfo = JSON.stringify({ + version: sourcePackageJSON.version, + date: now.toISOString().split('T')[0] + }, null, 2); + + writeFileSync(`${SITE_ROOT}/server/data/framework-info.json`, frameworkInfo); +}); diff --git a/scripts/gulp/tasks/test.ts b/scripts/gulp/tasks/test.ts index bba7e5789a..e6c3572763 100644 --- a/scripts/gulp/tasks/test.ts +++ b/scripts/gulp/tasks/test.ts @@ -85,6 +85,7 @@ function karmaTest(watch: boolean, done: Function) { let karmaConfig = { configFile: join(SCRIPTS_ROOT, 'karma/karma.conf.js'), + singleRun: true, }; if (watch) { @@ -96,6 +97,9 @@ function karmaTest(watch: boolean, done: Function) { args: ['--grep', argv.testGrep] }; } + if (typeof argv.debug !== 'undefined') { + karmaConfig.singleRun = false; + } new karma.Server(karmaConfig, done).start(); } diff --git a/scripts/karma/system.config.js b/scripts/karma/system.config.js index 5801d5cd51..c156fddd1d 100644 --- a/scripts/karma/system.config.js +++ b/scripts/karma/system.config.js @@ -4,7 +4,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; // disable console debugs/errors/warns from printing out console.debug = () => {}; -console.error = () => {}; +// console.error = () => {}; console.warn = () => {}; __karma__.loaded = function () {}; diff --git a/src/animations/animation.ts b/src/animations/animation.ts index 244fb3656c..b04397cd21 100644 --- a/src/animations/animation.ts +++ b/src/animations/animation.ts @@ -103,6 +103,13 @@ export class Animation { return 0; } + /** + * Returns if the animation is a root one. + */ + isRoot(): boolean { + return !this.parent; + } + /** * Set the duration for this animation. */ diff --git a/src/components/action-sheet/action-sheet.module.ts b/src/components/action-sheet/action-sheet.module.ts deleted file mode 100644 index 13d31b05bd..0000000000 --- a/src/components/action-sheet/action-sheet.module.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { ButtonModule } from '../button/button.module'; -import { BackdropModule } from '../backdrop/backdrop.module'; -import { IconModule } from '../icon/icon.module'; - -import { ActionSheetCmp } from './action-sheet-component'; - -/** @hidden */ -@NgModule({ - imports: [ - BackdropModule, - ButtonModule, - CommonModule, - IconModule - ], - declarations: [ - ActionSheetCmp - ], - exports: [ - ActionSheetCmp - ], - entryComponents: [ - ActionSheetCmp - ] -}) -export class ActionSheetModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ActionSheetModule, providers: [] - }; - } -} diff --git a/src/components/alert/alert-component.ts b/src/components/alert/alert-component.ts index 9ed1869143..756e2c6b5b 100644 --- a/src/components/alert/alert-component.ts +++ b/src/components/alert/alert-component.ts @@ -256,9 +256,7 @@ export class AlertCmp { } if (shouldDismiss) { - this.dismiss(button.role).catch(() => { - console.debug('alert can not be dismissed'); - }); + this.dismiss(button.role); } } diff --git a/src/components/alert/alert.module.ts b/src/components/alert/alert.module.ts deleted file mode 100644 index 30f7c594b9..0000000000 --- a/src/components/alert/alert.module.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { ButtonModule } from '../button/button.module'; -import { BackdropModule } from '../backdrop/backdrop.module'; - -import { AlertCmp } from './alert-component'; - -/** @hidden */ -@NgModule({ - imports: [ - BackdropModule, - ButtonModule, - CommonModule, - FormsModule - ], - declarations: [ - AlertCmp - ], - exports: [ - AlertCmp - ], - entryComponents: [ - AlertCmp - ] -}) -export class AlertModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: AlertModule, providers: [] - }; - } -} diff --git a/src/components/app/app-root.ts b/src/components/app/app-root.ts index bf25cc6804..c181ce1c3f 100644 --- a/src/components/app/app-root.ts +++ b/src/components/app/app-root.ts @@ -4,7 +4,7 @@ import { App } from './app'; import { assert } from '../../util/util'; import { Config } from '../../config/config'; import { Ion } from '../ion'; -import { OverlayPortal } from '../nav/overlay-portal'; +import { OverlayPortal } from './overlay-portal'; import { Platform } from '../../platform/platform'; import * as Constants from './app-constants'; @@ -42,7 +42,7 @@ export class IonicApp extends Ion implements OnInit { private _plt: Platform, app: App ) { - super(config, elementRef, renderer); + super(config, elementRef, renderer, 'app-root'); // register with App that this is Ionic's appRoot component. tada! app._appRoot = this; this._stopScrollPlugin = (window)['IonicStopScroll']; diff --git a/src/components/app/app.module.ts b/src/components/app/app.module.ts deleted file mode 100644 index b3a9daf33d..0000000000 --- a/src/components/app/app.module.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { IonicApp } from './app-root'; - -import { NavModule } from '../nav/nav.module'; - -/** @hidden */ -@NgModule({ - imports: [ - NavModule - ], - declarations: [ - IonicApp - ], - exports: [ - IonicApp - ], - entryComponents: [ - IonicApp - ] -}) -export class AppModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: AppModule, providers: [] - }; - } -} diff --git a/src/components/app/app.ts b/src/components/app/app.ts index 8ac8c22f47..883f1cb43b 100644 --- a/src/components/app/app.ts +++ b/src/components/app/app.ts @@ -3,11 +3,11 @@ import { Title, DOCUMENT } from '@angular/platform-browser'; import { IonicApp } from './app-root'; import * as Constants from './app-constants'; -import { ClickBlock } from '../click-block/click-block'; +import { ClickBlock } from './click-block'; import { runInDev } from '../../util/util'; import { Config } from '../../config/config'; import { isNav, NavOptions, DIRECTION_FORWARD, DIRECTION_BACK } from '../../navigation/nav-util'; -import { MenuController } from '../menu/menu-controller'; +import { MenuController } from './menu-controller'; import { NavController } from '../../navigation/nav-controller'; import { Platform } from '../../platform/platform'; import { ViewController } from '../../navigation/view-controller'; diff --git a/src/components/click-block/click-block.ts b/src/components/app/click-block.ts similarity index 100% rename from src/components/click-block/click-block.ts rename to src/components/app/click-block.ts diff --git a/src/components/menu/menu-controller.ts b/src/components/app/menu-controller.ts similarity index 99% rename from src/components/menu/menu-controller.ts rename to src/components/app/menu-controller.ts index ba35197c22..acb0712150 100644 --- a/src/components/menu/menu-controller.ts +++ b/src/components/app/menu-controller.ts @@ -1,5 +1,4 @@ -import { Menu } from './menu'; -import { MenuType } from './menu-types'; +import { Menu, MenuType } from './menu-interface'; import { Platform } from '../../platform/platform'; import { removeArrayItem, assert } from '../../util/util'; @@ -343,3 +342,5 @@ export class MenuController { } let menuTypes: { [name: string]: new(...args: any[]) => MenuType } = {}; + + diff --git a/src/components/app/menu-interface.ts b/src/components/app/menu-interface.ts new file mode 100644 index 0000000000..ed2d6bdde2 --- /dev/null +++ b/src/components/app/menu-interface.ts @@ -0,0 +1,31 @@ +import { Animation } from '../../animations/animation'; + +export interface Menu { + setOpen(shouldOpen: boolean, animated: boolean): Promise; + open(): Promise; + close(): Promise; + toggle(): Promise; + enable(shouldEnable: boolean, menuId?: string): Menu; + swipeEnable(shouldEnable: boolean): Menu; + isOpen: boolean; + enabled: boolean; + side: string; + id: string; + isAnimating(): boolean; + width(): number; + getContentElement(): HTMLElement; + getMenuElement(): HTMLElement; + getBackdropElement(): HTMLElement; + _canOpen(): boolean; + persistent: boolean; +}; + +export interface MenuType { + ani: Animation; + isOpening: boolean; + setOpen(shouldOpen: boolean, animated: boolean, done: Function): void; + setProgressStart(isOpen: boolean): void; + setProgessStep(stepValue: number): void; + setProgressEnd(shouldComplete: boolean, currentStepValue: number, velocity: number, done: Function): void; + destroy(): void; +}; diff --git a/src/components/nav/overlay-portal.ts b/src/components/app/overlay-portal.ts similarity index 84% rename from src/components/nav/overlay-portal.ts rename to src/components/app/overlay-portal.ts index 74f68cdb12..0bc79493a8 100644 --- a/src/components/nav/overlay-portal.ts +++ b/src/components/app/overlay-portal.ts @@ -1,6 +1,6 @@ -import { ComponentFactoryResolver, Directive, ElementRef, forwardRef, Inject, Input, NgZone, Optional, Renderer, ViewContainerRef } from '@angular/core'; +import { ComponentFactoryResolver, Directive, ElementRef, ErrorHandler, forwardRef, Inject, Input, NgZone, Optional, Renderer, ViewContainerRef } from '@angular/core'; -import { App } from '../app/app'; +import { App } from './app'; import { Config } from '../../config/config'; import { DeepLinker } from '../../navigation/deep-linker'; import { DomController } from '../../platform/dom-controller'; @@ -31,8 +31,9 @@ export class OverlayPortal extends NavControllerBase { @Optional() linker: DeepLinker, viewPort: ViewContainerRef, domCtrl: DomController, + errHandler: ErrorHandler ) { - super(null, app, config, plt, keyboard, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, domCtrl); + super(null, app, config, plt, keyboard, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, domCtrl, errHandler); this._isPortal = true; this._init = true; this.setViewport(viewPort); @@ -54,4 +55,3 @@ export class OverlayPortal extends NavControllerBase { } } - diff --git a/src/components/app/test/app.spec.ts b/src/components/app/test/app.spec.ts index 143790cd26..17c4ae96f8 100644 --- a/src/components/app/test/app.spec.ts +++ b/src/components/app/test/app.spec.ts @@ -1,8 +1,8 @@ import { App } from '../app'; -import { ClickBlock } from '../../click-block/click-block'; +import { ClickBlock } from '../click-block'; import { Config } from '../../../config/config'; import { mockApp, mockConfig, mockElementRef, mockNavController, mockPlatform, MockPlatform, mockRenderer, mockTab, mockTabs, mockView, mockViews } from '../../../util/mock-providers'; -import { OverlayPortal } from '../../nav/overlay-portal'; +import { OverlayPortal } from '../overlay-portal'; import { PORTAL_MODAL } from '../app-constants'; @@ -167,8 +167,9 @@ describe('App', () => { expect(plt.exitApp).not.toHaveBeenCalled(); done(); }).catch((err: Error) => { + fail(err); done(err); - }); + }); }); it('should pop the second view in the root nav', () => { diff --git a/src/components/avatar/avatar.module.ts b/src/components/avatar/avatar.module.ts deleted file mode 100644 index a28a653d50..0000000000 --- a/src/components/avatar/avatar.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Avatar } from './avatar'; - -/** @hidden */ -@NgModule({ - declarations: [ - Avatar - ], - exports: [ - Avatar - ] -}) -export class AvatarModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: AvatarModule, providers: [] - }; - } -} diff --git a/src/components/avatar/avatar.ts b/src/components/avatar/avatar.ts index 1ddaf3f7f2..e05fe3d04e 100644 --- a/src/components/avatar/avatar.ts +++ b/src/components/avatar/avatar.ts @@ -12,5 +12,6 @@ import { Directive } from '@angular/core'; selector: 'ion-avatar' }) export class Avatar { - + constructor() { + } } diff --git a/src/components/backdrop/backdrop.module.ts b/src/components/backdrop/backdrop.module.ts deleted file mode 100644 index 3b5ea9c71a..0000000000 --- a/src/components/backdrop/backdrop.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Backdrop } from './backdrop'; - -/** @hidden */ -@NgModule({ - declarations: [ - Backdrop - ], - exports: [ - Backdrop - ] -}) -export class BackdropModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: BackdropModule, providers: [] - }; - } -} diff --git a/src/components/backdrop/backdrop.ts b/src/components/backdrop/backdrop.ts index c9b67e9ea6..58f5365eb6 100644 --- a/src/components/backdrop/backdrop.ts +++ b/src/components/backdrop/backdrop.ts @@ -12,11 +12,8 @@ import { Directive, ElementRef, Renderer } from '@angular/core'; }, }) export class Backdrop { - - constructor( - private _elementRef: ElementRef, - private _renderer: Renderer - ) { } + constructor(private _elementRef: ElementRef, private _renderer: Renderer) { + } getNativeElement(): HTMLElement { return this._elementRef.nativeElement; diff --git a/src/components/button/button.module.ts b/src/components/button/button.module.ts deleted file mode 100644 index efbfdeb89a..0000000000 --- a/src/components/button/button.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Button } from './button'; - -/** @hidden */ -@NgModule({ - declarations: [ - Button - ], - exports: [ - Button - ] -}) -export class ButtonModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ButtonModule, providers: [] - }; - } -} diff --git a/src/components/card/card.module.ts b/src/components/card/card.module.ts deleted file mode 100644 index 900741d8da..0000000000 --- a/src/components/card/card.module.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Card } from './card'; -import { CardContent } from './card-content'; -import { CardHeader } from './card-header'; -import { CardTitle } from './card-title'; - -/** @hidden */ -@NgModule({ - declarations: [ - Card, - CardContent, - CardHeader, - CardTitle - ], - exports: [ - Card, - CardContent, - CardHeader, - CardTitle - ] -}) -export class CardModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: CardModule, providers: [] - }; - } -} diff --git a/src/components/checkbox/checkbox.module.ts b/src/components/checkbox/checkbox.module.ts deleted file mode 100644 index 5ab2b17f98..0000000000 --- a/src/components/checkbox/checkbox.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Checkbox } from './checkbox'; - -/** @hidden */ -@NgModule({ - declarations: [ - Checkbox - ], - exports: [ - Checkbox - ] -}) -export class CheckboxModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: CheckboxModule, providers: [] - }; - } -} diff --git a/src/components/checkbox/checkbox.ts b/src/components/checkbox/checkbox.ts index 3cf847fd7c..9107765279 100644 --- a/src/components/checkbox/checkbox.ts +++ b/src/components/checkbox/checkbox.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, forwardRef, HostListener, Input, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core'; +import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, HostListener, Input, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { Config } from '../../config/config'; @@ -7,12 +7,6 @@ import { Form, IonicTapInput } from '../../util/form'; import { BaseInput } from '../../util/base-input'; import { Item } from '../item/item'; -export const CHECKBOX_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Checkbox), - multi: true -}; - /** * @name Checkbox * @module ionic @@ -69,7 +63,7 @@ export const CHECKBOX_VALUE_ACCESSOR: any = { host: { '[class.checkbox-disabled]': '_disabled' }, - providers: [CHECKBOX_VALUE_ACCESSOR], + providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Checkbox, multi: true } ], encapsulation: ViewEncapsulation.None, }) export class Checkbox extends BaseInput implements IonicTapInput, AfterViewInit, OnDestroy { diff --git a/src/components/chip/chip.module.ts b/src/components/chip/chip.module.ts deleted file mode 100644 index acebd286ec..0000000000 --- a/src/components/chip/chip.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Chip } from './chip'; - -/** @hidden */ -@NgModule({ - declarations: [ - Chip - ], - exports: [ - Chip - ] -}) -export class ChipModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ChipModule, providers: [] - }; - } -} diff --git a/src/components/click-block/click-block.module.ts b/src/components/click-block/click-block.module.ts deleted file mode 100644 index a105b5fc24..0000000000 --- a/src/components/click-block/click-block.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { ClickBlock } from './click-block'; - -/** @hidden */ -@NgModule({ - declarations: [ - ClickBlock - ], - exports: [ - ClickBlock - ] -}) -export class ClickBlockModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ClickBlockModule, providers: [] - }; - } -} diff --git a/src/components/content/content.module.ts b/src/components/content/content.module.ts deleted file mode 100644 index ae78bf1ce7..0000000000 --- a/src/components/content/content.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Content } from './content'; - -/** @hidden */ -@NgModule({ - declarations: [ - Content - ], - exports: [ - Content - ] -}) -export class ContentModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ContentModule, providers: [] - }; - } -} diff --git a/src/components/content/content.ts b/src/components/content/content.ts index 0100eca530..83f41b9bdb 100644 --- a/src/components/content/content.ts +++ b/src/components/content/content.ts @@ -3,15 +3,15 @@ import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, EventEmi import { App } from '../app/app'; import { Config } from '../../config/config'; import { DomController } from '../../platform/dom-controller'; -import { Img } from '../img/img'; +import { Img } from '../img/img-interface'; import { Ion } from '../ion'; import { isTabs } from '../../navigation/nav-util'; import { isTrueProperty, assert, removeArrayItem } from '../../util/util'; import { Keyboard } from '../../platform/keyboard'; import { NavController } from '../../navigation/nav-controller'; +import { Content as IContent, Tabs } from '../../navigation/nav-interfaces'; import { Platform } from '../../platform/platform'; import { ScrollView, ScrollEvent } from '../../util/scroll-view'; -import { Tabs } from '../tabs/tabs'; import { ViewController } from '../../navigation/view-controller'; export { ScrollEvent } from '../../util/scroll-view'; @@ -135,7 +135,7 @@ export class EventEmitterProxy extends EventEmitter { changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }) -export class Content extends Ion implements OnDestroy, AfterViewInit { +export class Content extends Ion implements OnDestroy, AfterViewInit, IContent { /** @internal */ _cTop: number; /** @internal */ diff --git a/src/components/datetime/datetime.module.ts b/src/components/datetime/datetime.module.ts deleted file mode 100644 index 68a4dc8a4e..0000000000 --- a/src/components/datetime/datetime.module.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { DateTime } from './datetime'; - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule - ], - declarations: [ - DateTime - ], - exports: [ - DateTime - ] -}) -export class DateTimeModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: DateTimeModule, providers: [] - }; - } -} diff --git a/src/components/datetime/datetime.ts b/src/components/datetime/datetime.ts index ac1e09fa1d..aa5a65799a 100644 --- a/src/components/datetime/datetime.ts +++ b/src/components/datetime/datetime.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, ElementRef, EventEmitter, forwardRef, HostListener, Input, OnDestroy, Optional, Output, Renderer, ViewEncapsulation } from '@angular/core'; +import { AfterViewInit, Component, ElementRef, EventEmitter, HostListener, Input, OnDestroy, Optional, Output, Renderer, ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { Config } from '../../config/config'; @@ -11,12 +11,6 @@ import { Item } from '../item/item'; import { deepCopy, isBlank, isPresent, isArray, isString, assert, clamp } from '../../util/util'; import { dateValueRange, renderDateTime, renderTextFormat, convertFormatToKey, getValueFromFormat, parseTemplate, parseDate, updateDate, DateTimeData, daysInMonth, dateSortValue, dateDataSortValue, LocaleData } from '../../util/datetime-util'; -export const DATETIME_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => DateTime), - multi: true -}; - /** * @name DateTime * @description @@ -270,7 +264,7 @@ export const DATETIME_VALUE_ACCESSOR: any = { host: { '[class.datetime-disabled]': '_disabled' }, - providers: [DATETIME_VALUE_ACCESSOR], + providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: DateTime, multi: true } ], encapsulation: ViewEncapsulation.None, }) export class DateTime extends BaseInput implements AfterViewInit, ControlValueAccessor, OnDestroy { diff --git a/src/components/fab/fab.md.scss b/src/components/fab/fab.md.scss index a8b2fd45e1..8e504470b5 100755 --- a/src/components/fab/fab.md.scss +++ b/src/components/fab/fab.md.scss @@ -36,6 +36,10 @@ $fab-md-list-button-transition-timing-function: ease !default; /// @prop - Transition delay of the transform and opacity of the button in a list $fab-md-list-button-transition-delay: 10ms !default; +$fab-button-md-transition-duration: 300ms !default; + +$fab-button-md-transition-timing-function: cubic-bezier(.4, 0, .2, 1) !default; + .fab-md { color: $fab-md-text-color; @@ -43,9 +47,9 @@ $fab-md-list-button-transition-delay: 10ms !default; box-shadow: $fab-md-box-shadow; - transition: box-shadow $button-md-transition-duration $button-md-transition-timing-function, - background-color $button-md-transition-duration $button-md-transition-timing-function, - color $button-md-transition-duration $button-md-transition-timing-function; + transition: box-shadow $fab-button-md-transition-duration $fab-button-md-transition-timing-function, + background-color $fab-button-md-transition-duration $fab-button-md-transition-timing-function, + color $fab-button-md-transition-duration $fab-button-md-transition-timing-function; } .fab-md.activated { @@ -59,9 +63,9 @@ $fab-md-list-button-transition-delay: 10ms !default; transition: transform $fab-md-list-button-transition-duration $fab-md-list-button-transition-timing-function $fab-md-list-button-transition-delay, opacity $fab-md-list-button-transition-duration $fab-md-list-button-transition-timing-function $fab-md-list-button-transition-delay, - box-shadow $button-md-transition-duration $button-md-transition-timing-function, - background-color $button-md-transition-duration $button-md-transition-timing-function, - color $button-md-transition-duration $button-md-transition-timing-function; + box-shadow $fab-button-md-transition-duration $fab-button-md-transition-timing-function, + background-color $fab-button-md-transition-duration $fab-button-md-transition-timing-function, + color $fab-button-md-transition-duration $fab-button-md-transition-timing-function; } .fab-md-in-list.activated { diff --git a/src/components/fab/fab.module.ts b/src/components/fab/fab.module.ts deleted file mode 100644 index f7dec299d5..0000000000 --- a/src/components/fab/fab.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { IconModule } from '../icon/icon.module'; - -import { FabButton } from './fab'; -import { FabContainer } from './fab-container'; -import { FabList } from './fab-list'; - -/** @hidden */ -@NgModule({ - imports: [ - IconModule - ], - declarations: [ - FabButton, - FabContainer, - FabList - ], - exports: [ - FabButton, - FabContainer, - FabList - ] -}) -export class FabModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: FabModule, providers: [] - }; - } -} diff --git a/src/components/grid/grid.module.ts b/src/components/grid/grid.module.ts deleted file mode 100644 index 3122dd8d9f..0000000000 --- a/src/components/grid/grid.module.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Grid } from './grid'; -import { Row } from './row'; -import { Col } from './col'; - -/** @hidden */ -@NgModule({ - declarations: [ - Grid, - Row, - Col - ], - exports: [ - Grid, - Row, - Col - ] -}) -export class GridModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: GridModule, providers: [] - }; - } -} diff --git a/src/components/icon/icon.module.ts b/src/components/icon/icon.module.ts deleted file mode 100644 index b5625f5f75..0000000000 --- a/src/components/icon/icon.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Icon } from './icon'; - -/** @hidden */ -@NgModule({ - declarations: [ - Icon - ], - exports: [ - Icon - ] -}) -export class IconModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: IconModule, providers: [] - }; - } -} diff --git a/src/components/img/img-interface.ts b/src/components/img/img-interface.ts new file mode 100644 index 0000000000..6d46381dfc --- /dev/null +++ b/src/components/img/img-interface.ts @@ -0,0 +1,9 @@ + +export interface Img { + top: number; + bottom: number; + canRender: boolean; + canRequest: boolean; + reset(): void; + update(): void; +}; diff --git a/src/components/img/img.module.ts b/src/components/img/img.module.ts deleted file mode 100644 index bddd2c689c..0000000000 --- a/src/components/img/img.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Img } from './img'; - -/** @hidden */ -@NgModule({ - declarations: [ - Img - ], - exports: [ - Img - ] -}) -export class ImgModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ImgModule, providers: [] - }; - } -} diff --git a/src/components/img/img.ts b/src/components/img/img.ts index de49093d62..ff3d120148 100644 --- a/src/components/img/img.ts +++ b/src/components/img/img.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component, ElementRef, Input, NgZone, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core'; +import { Img as IImg } from './img-interface'; import { Content } from '../content/content'; import { DomController } from '../../platform/dom-controller'; import { isPresent, isTrueProperty } from '../../util/util'; @@ -95,7 +96,7 @@ import { Platform } from '../../platform/platform'; changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, }) -export class Img implements OnDestroy { +export class Img implements OnDestroy, IImg { /** @internal */ _src: string; /** @internal */ diff --git a/src/components/infinite-scroll/infinite-scroll.module.ts b/src/components/infinite-scroll/infinite-scroll.module.ts deleted file mode 100644 index cc18485383..0000000000 --- a/src/components/infinite-scroll/infinite-scroll.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { InfiniteScroll } from './infinite-scroll'; -import { InfiniteScrollContent } from './infinite-scroll-content'; - -import { SpinnerModule } from '../spinner/spinner.module'; - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule, - SpinnerModule - ], - declarations: [ - InfiniteScroll, - InfiniteScrollContent - ], - exports: [ - InfiniteScroll, - InfiniteScrollContent - ] -}) -export class InfiniteScrollModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: InfiniteScrollModule, providers: [] - }; - } -} diff --git a/src/components/input/input.module.ts b/src/components/input/input.module.ts deleted file mode 100644 index 2e1df431f0..0000000000 --- a/src/components/input/input.module.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { NativeInput } from './native-input'; -import { NextInput } from './next-input'; -import { TextInput } from './input'; - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule, - FormsModule, - ReactiveFormsModule - ], - declarations: [ - NativeInput, - NextInput, - TextInput - ], - exports: [ - NativeInput, - NextInput, - TextInput - ] -}) -export class InputModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: InputModule, providers: [] - }; - } -} diff --git a/src/components/item/item-options.ts b/src/components/item/item-options.ts index 3d9646a6a3..6d7cb85a19 100644 --- a/src/components/item/item-options.ts +++ b/src/components/item/item-options.ts @@ -1,7 +1,6 @@ import { Directive, ElementRef, EventEmitter, Input, Output, Renderer } from '@angular/core'; import { Platform } from '../../platform/platform'; -import { isPresent} from '../../util/util'; import { ITEM_SIDE_FLAG_LEFT, ITEM_SIDE_FLAG_RIGHT, ItemSliding } from './item-sliding'; /** @@ -29,6 +28,7 @@ import { ITEM_SIDE_FLAG_LEFT, ITEM_SIDE_FLAG_RIGHT, ItemSliding } from './item-s selector: 'ion-item-options', }) export class ItemOptions { + /** * @input {string} The side the option button should be on. Defaults to `"right"`. * If you have multiple `ion-item-options`, a side must be provided for each. @@ -40,25 +40,26 @@ export class ItemOptions { */ @Output() ionSwipe: EventEmitter = new EventEmitter(); - constructor(private _elementRef: ElementRef, private _renderer: Renderer, private _plt: Platform) {} + constructor( + private _elementRef: ElementRef, + private _renderer: Renderer, + private _plt: Platform + ) { } /** * @hidden */ getSides(): number { - if (isPresent(this.side)) { - switch (this.side) { - case 'left': - return ITEM_SIDE_FLAG_LEFT; - case 'right': - return ITEM_SIDE_FLAG_RIGHT; - case 'start': - return this._plt.isRTL() ? ITEM_SIDE_FLAG_RIGHT : ITEM_SIDE_FLAG_LEFT; - case 'end': - return this._plt.isRTL() ? ITEM_SIDE_FLAG_LEFT : ITEM_SIDE_FLAG_RIGHT; - } + switch (this.side) { + case 'left': + return ITEM_SIDE_FLAG_LEFT; + case 'right': + return ITEM_SIDE_FLAG_RIGHT; + case 'start': + return this._plt.isRTL() ? ITEM_SIDE_FLAG_RIGHT : ITEM_SIDE_FLAG_LEFT; + default: // end + return this._plt.isRTL() ? ITEM_SIDE_FLAG_LEFT : ITEM_SIDE_FLAG_RIGHT; } - return this._plt.isRTL() ? ITEM_SIDE_FLAG_LEFT : ITEM_SIDE_FLAG_RIGHT; } /** diff --git a/src/components/item/item-sliding-gesture.ts b/src/components/item/item-sliding-gesture.ts index 2e34d91266..7fdd420556 100644 --- a/src/components/item/item-sliding-gesture.ts +++ b/src/components/item/item-sliding-gesture.ts @@ -2,7 +2,7 @@ import { ItemSliding } from './item-sliding'; import { List } from '../list/list'; import { DomController } from '../../platform/dom-controller'; import { GestureController, GESTURE_PRIORITY_SLIDING_ITEM, GESTURE_ITEM_SWIPE } from '../../gestures/gesture-controller'; -import { PanGesture } from '../../gestures/drag-gesture'; +import { PanGesture } from '../../gestures/pan-gesture'; import { Platform } from '../../platform/platform'; import { pointerCoord } from '../../util/dom'; diff --git a/src/components/item/item.module.ts b/src/components/item/item.module.ts deleted file mode 100644 index 5a8cb9213c..0000000000 --- a/src/components/item/item.module.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Item } from './item'; -import { ItemContent } from './item-content'; -import { ItemDivider } from './item-divider'; -import { ItemGroup } from './item-group'; -import { ItemOptions } from './item-options'; -import { ItemReorder } from './item-reorder'; -import { ItemSliding } from './item-sliding'; -import { Reorder } from './reorder'; - -import { IconModule } from '../icon/icon.module'; -import { LabelModule } from '../label/label.module'; - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule, - IconModule, - LabelModule - ], - declarations: [ - Item, - ItemContent, - ItemDivider, - ItemGroup, - ItemOptions, - ItemReorder, - ItemSliding, - Reorder - ], - exports: [ - Item, - ItemContent, - ItemDivider, - ItemGroup, - ItemOptions, - ItemReorder, - ItemSliding, - Reorder - ] -}) -export class ItemModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ItemModule, providers: [] - }; - } -} diff --git a/src/components/label/label.module.ts b/src/components/label/label.module.ts deleted file mode 100644 index feb3559900..0000000000 --- a/src/components/label/label.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Label } from './label'; - -/** @hidden */ -@NgModule({ - declarations: [ - Label - ], - exports: [ - Label - ] -}) -export class LabelModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: LabelModule, providers: [] - }; - } -} diff --git a/src/components/list/list.module.ts b/src/components/list/list.module.ts deleted file mode 100644 index 5120a5de37..0000000000 --- a/src/components/list/list.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { List } from './list'; -import { ListHeader } from './list-header'; - -/** @hidden */ -@NgModule({ - declarations: [ - List, - ListHeader - ], - exports: [ - List, - ListHeader - ] -}) -export class ListModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ListModule, providers: [] - }; - } -} diff --git a/src/components/loading/loading.module.ts b/src/components/loading/loading.module.ts deleted file mode 100644 index 62e66c2033..0000000000 --- a/src/components/loading/loading.module.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { BackdropModule } from '../backdrop/backdrop.module'; -import { SpinnerModule } from '../spinner/spinner.module'; - -import { LoadingCmp } from './loading-component'; - -/** @hidden */ -@NgModule({ - imports: [ - BackdropModule, - CommonModule, - SpinnerModule - ], - declarations: [ - LoadingCmp - ], - exports: [ - LoadingCmp - ], - entryComponents: [ - LoadingCmp - ] -}) -export class LoadingModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: LoadingModule, providers: [] - }; - } -} diff --git a/src/components/menu/menu-close.ts b/src/components/menu/menu-close.ts index f11f1cb349..b2365c8bda 100644 --- a/src/components/menu/menu-close.ts +++ b/src/components/menu/menu-close.ts @@ -1,6 +1,6 @@ import { Directive, HostListener, Input } from '@angular/core'; -import { MenuController } from './menu-controller'; +import { MenuController } from '../app/menu-controller'; /** diff --git a/src/components/menu/menu-toggle.ts b/src/components/menu/menu-toggle.ts index 1254ed29a5..166195b499 100644 --- a/src/components/menu/menu-toggle.ts +++ b/src/components/menu/menu-toggle.ts @@ -1,8 +1,8 @@ import { Directive, Input, HostListener, Optional } from '@angular/core'; import { Button } from '../button/button'; -import { MenuController } from './menu-controller'; -import { Navbar } from '../navbar/navbar'; +import { MenuController } from '../app/menu-controller'; +import { Navbar } from '../toolbar/navbar'; import { ViewController } from '../../navigation/view-controller'; /** diff --git a/src/components/menu/menu-types.ts b/src/components/menu/menu-types.ts index fb159b4b73..a3c2d0850f 100644 --- a/src/components/menu/menu-types.ts +++ b/src/components/menu/menu-types.ts @@ -1,6 +1,6 @@ import { Animation } from '../../animations/animation'; -import { Menu } from './menu'; -import { MenuController } from './menu-controller'; +import { Menu, MenuType as IMenuType } from '../app/menu-interface'; +import { MenuController } from '../app/menu-controller'; import { Platform } from '../../platform/platform'; @@ -11,7 +11,7 @@ import { Platform } from '../../platform/platform'; * type will provide their own animations for open and close * and registers itself with Menu. */ -export class MenuType { +export class MenuType implements IMenuType { ani: Animation; isOpening: boolean; diff --git a/src/components/menu/menu.module.ts b/src/components/menu/menu.module.ts deleted file mode 100644 index a190bb0a00..0000000000 --- a/src/components/menu/menu.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { BackdropModule } from '../backdrop/backdrop.module'; - -import { Menu } from './menu'; -import { MenuClose } from './menu-close'; -import { MenuToggle } from './menu-toggle'; - -/** @hidden */ -@NgModule({ - imports: [ - BackdropModule - ], - declarations: [ - Menu, - MenuClose, - MenuToggle - ], - exports: [ - Menu, - MenuClose, - MenuToggle - ] -}) -export class MenuModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: MenuModule, providers: [] - }; - } -} diff --git a/src/components/menu/menu.ts b/src/components/menu/menu.ts index 3fa16232dd..70fa7f2f82 100644 --- a/src/components/menu/menu.ts +++ b/src/components/menu/menu.ts @@ -9,7 +9,8 @@ import { GestureController, GESTURE_GO_BACK_SWIPE, BlockerDelegate } from '../.. import { isTrueProperty, assert } from '../../util/util'; import { Keyboard } from '../../platform/keyboard'; import { MenuContentGesture } from './menu-gestures'; -import { MenuController } from './menu-controller'; +import { Menu as MenuInterface } from '../app/menu-interface'; +import { MenuController } from '../app/menu-controller'; import { MenuType } from './menu-types'; import { Nav } from '../nav/nav'; import { Platform } from '../../platform/platform'; @@ -192,7 +193,7 @@ import { RootNode } from '../split-pane/split-pane'; encapsulation: ViewEncapsulation.None, providers: [{provide: RootNode, useExisting: forwardRef(() => Menu) }] }) -export class Menu implements RootNode { +export class Menu implements RootNode, MenuInterface { private _cntEle: HTMLElement; private _gesture: MenuContentGesture; diff --git a/src/components/menu/test/menu.spec.ts b/src/components/menu/test/menu.spec.ts index 8140dd4f3f..5828903bf7 100644 --- a/src/components/menu/test/menu.spec.ts +++ b/src/components/menu/test/menu.spec.ts @@ -1,4 +1,4 @@ -import { MenuController } from '../menu-controller'; +import { MenuController } from '../../app/menu-controller'; import { mockMenu } from '../../../util/mock-providers'; diff --git a/src/components/modal/modal-component.ts b/src/components/modal/modal-component.ts index abee0c4815..f87b158f5c 100644 --- a/src/components/modal/modal-component.ts +++ b/src/components/modal/modal-component.ts @@ -54,30 +54,32 @@ export class ModalCmp { } ionViewPreLoad() { - this._load(this._navParams.data.component); - } - - /** @hidden */ - _load(component: any) { - if (component) { - - let cfr = this.moduleLoader.getComponentFactoryResolver(component); - if (!cfr) { - cfr = this._cfr; - } - const componentFactory = cfr.resolveComponentFactory(component); - - // ******** DOM WRITE **************** - const componentRef = this._viewport.createComponent(componentFactory, this._viewport.length, this._viewport.parentInjector, []); - this._viewCtrl._setInstance(componentRef.instance); - - this._setCssClass(componentRef, 'ion-page'); - this._setCssClass(componentRef, 'show-page'); - this._enabled = true; - - this._viewCtrl.willEnter.subscribe(this._viewWillEnter.bind(this)); - this._viewCtrl.didLeave.subscribe(this._viewDidLeave.bind(this)); + const component = this._navParams.data.component; + if (!component) { + console.warn('modal\'s page was not defined'); + return; } + + let cfr = this.moduleLoader.getComponentFactoryResolver(component); + if (!cfr) { + cfr = this._cfr; + } + const componentFactory = cfr.resolveComponentFactory(component); + + // ******** DOM WRITE **************** + const componentRef = this._viewport.createComponent(componentFactory, this._viewport.length, this._viewport.parentInjector, []); + + this._setCssClass(componentRef, 'ion-page'); + this._setCssClass(componentRef, 'show-page'); + + // Change the viewcontroller's instance to point the user provided page + // Lifecycle events will be sent to the new instance, instead of the modal's component + // we need to manually subscribe to them + this._viewCtrl._setInstance(componentRef.instance); + this._viewCtrl.willEnter.subscribe(this._viewWillEnter.bind(this)); + this._viewCtrl.didLeave.subscribe(this._viewDidLeave.bind(this)); + + this._enabled = true; } _viewWillEnter() { @@ -88,7 +90,6 @@ export class ModalCmp { this._gestureBlocker.unblock(); } - /** @hidden */ _setCssClass(componentRef: any, className: string) { this._renderer.setElementClass(componentRef.location.nativeElement, className, true); } @@ -98,9 +99,7 @@ export class ModalCmp { const opts: NavOptions = { minClickBlockDuration: 400 }; - return this._viewCtrl.dismiss(null, 'backdrop', opts).catch(() => { - console.debug('Dismiss modal by clicking backdrop was cancelled'); - }); + return this._viewCtrl.dismiss(null, 'backdrop', opts); } } diff --git a/src/components/modal/modal.module.ts b/src/components/modal/modal.module.ts deleted file mode 100644 index 8d1c21b58e..0000000000 --- a/src/components/modal/modal.module.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { BackdropModule } from '../backdrop/backdrop.module'; - -import { ModalCmp } from './modal-component'; - -/** @hidden */ -@NgModule({ - imports: [ - BackdropModule - ], - declarations: [ - ModalCmp - ], - exports: [ - ModalCmp - ], - entryComponents: [ - ModalCmp - ] -}) -export class ModalModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ModalModule, providers: [] - }; - } -} diff --git a/src/components/modal/test/basic/pages/modal-pass-data/modal-pass-data.ts b/src/components/modal/test/basic/pages/modal-pass-data/modal-pass-data.ts index 739d0e3361..1cc05090c5 100644 --- a/src/components/modal/test/basic/pages/modal-pass-data/modal-pass-data.ts +++ b/src/components/modal/test/basic/pages/modal-pass-data/modal-pass-data.ts @@ -42,9 +42,7 @@ export class ModalPassData { submit() { console.time('modal'); - this.viewCtrl.dismiss(this.data).catch(() => { - console.log('submit was cancelled'); - }); + this.viewCtrl.dismiss(this.data); } ionViewCanEnter() { diff --git a/src/components/nav/nav-push.ts b/src/components/nav/nav-push.ts index 47d861bb6c..33b0f32d19 100644 --- a/src/components/nav/nav-push.ts +++ b/src/components/nav/nav-push.ts @@ -74,9 +74,7 @@ export class NavPush { @HostListener('click') onClick(): boolean { if (this._nav && this.navPush) { - this._nav.push(this.navPush, this.navParams).catch(() => { - console.debug('navPush was rejected'); - }); + this._nav.push(this.navPush, this.navParams); return false; } return true; diff --git a/src/components/nav/nav.module.ts b/src/components/nav/nav.module.ts deleted file mode 100644 index 66d18303f7..0000000000 --- a/src/components/nav/nav.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Nav } from './nav'; -import { NavPop, } from './nav-pop'; -import { NavPopAnchor } from './nav-pop-anchor'; -import { NavPush } from './nav-push'; -import { NavPushAnchor } from './nav-push-anchor'; -import { OverlayPortal } from './overlay-portal'; - -/** @hidden */ -@NgModule({ - declarations: [ - Nav, - NavPop, - NavPopAnchor, - NavPush, - NavPushAnchor, - OverlayPortal - ], - exports: [ - Nav, - NavPop, - NavPopAnchor, - NavPush, - NavPushAnchor, - OverlayPortal - ] -}) -export class NavModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: NavModule, providers: [] - }; - } -} diff --git a/src/components/nav/nav.ts b/src/components/nav/nav.ts index 1f8318d018..c9c5c5a75a 100644 --- a/src/components/nav/nav.ts +++ b/src/components/nav/nav.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, ComponentFactoryResolver, ElementRef, forwardRef, Input, Optional, NgZone, Renderer, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core'; +import { AfterViewInit, Component, ComponentFactoryResolver, ElementRef, ErrorHandler, forwardRef, Input, Optional, NgZone, Renderer, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core'; import { App } from '../app/app'; import { Config } from '../../config/config'; @@ -6,6 +6,7 @@ import { DeepLinker } from '../../navigation/deep-linker'; import { DomController } from '../../platform/dom-controller'; import { GestureController } from '../../gestures/gesture-controller'; import { Keyboard } from '../../platform/keyboard'; +import { Nav as INav } from '../../navigation/nav-interfaces'; import { NavController } from '../../navigation/nav-controller'; import { NavControllerBase } from '../../navigation/nav-controller-base'; import { NavOptions } from '../../navigation/nav-util'; @@ -54,7 +55,7 @@ import { RootNode } from '../split-pane/split-pane'; encapsulation: ViewEncapsulation.None, providers: [{provide: RootNode, useExisting: forwardRef(() => Nav) }] }) -export class Nav extends NavControllerBase implements AfterViewInit, RootNode { +export class Nav extends NavControllerBase implements AfterViewInit, RootNode, INav { private _root: any; private _hasInit: boolean = false; @@ -74,8 +75,9 @@ export class Nav extends NavControllerBase implements AfterViewInit, RootNode { transCtrl: TransitionController, @Optional() linker: DeepLinker, domCtrl: DomController, + errHandler: ErrorHandler ) { - super(parent, app, config, plt, keyboard, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, domCtrl); + super(parent, app, config, plt, keyboard, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, domCtrl, errHandler); if (viewCtrl) { // an ion-nav can also act as an ion-page within a parent ion-nav @@ -126,7 +128,7 @@ export class Nav extends NavControllerBase implements AfterViewInit, RootNode { } goToRoot(opts: NavOptions) { - this.setRoot(this._root, this.rootParams, opts, null); + return this.setRoot(this._root, this.rootParams, opts, null); } /** diff --git a/src/components/nav/test/basic/pages/first-page/first-page.html b/src/components/nav/test/basic/pages/first-page/first-page.html index 52ace40630..ff751b61e2 100644 --- a/src/components/nav/test/basic/pages/first-page/first-page.html +++ b/src/components/nav/test/basic/pages/first-page/first-page.html @@ -42,7 +42,7 @@ Toggle Can Leave - + diff --git a/src/components/nav/test/basic/pages/first-page/first-page.ts b/src/components/nav/test/basic/pages/first-page/first-page.ts index 1fc238c2d1..5a318ce405 100644 --- a/src/components/nav/test/basic/pages/first-page/first-page.ts +++ b/src/components/nav/test/basic/pages/first-page/first-page.ts @@ -84,6 +84,7 @@ export class FirstPage { } ionViewCanLeave() { + this.called.ionViewCanLeave++; if (this.canLeave) { return true; } @@ -93,8 +94,6 @@ export class FirstPage { alert.addButton({ text: 'Umm, ok', role: 'cancel', }); alert.present(); - this.called.ionViewCanLeave++; - return false; } @@ -132,7 +131,6 @@ export class FirstPage { this.navCtrl.push('full-page', { id: 8675309, myData: [1, 2, 3, 4] }, { animate: true, animation: 'md-transition' - }).catch(() => { }); } @@ -140,36 +138,30 @@ export class FirstPage { this.navCtrl.push('another-page', null, { animate: true, animation: 'wp-transition' - }).catch(() => { }); } pushTabsPage() { - this.navCtrl.push('tabs').catch(() => { - }); + this.navCtrl.push('tabs'); } quickPush() { - this.navCtrl.push('another-page').catch(() => { - }); + this.navCtrl.push('another-page'); setTimeout(() => { - this.navCtrl.push('primary-header-page').catch(() => { - }); + this.navCtrl.push('primary-header-page'); }, 150); } quickPop() { - this.navCtrl.push('another-page').catch(() => { - }); + this.navCtrl.push('another-page'); setTimeout(() => { - this.navCtrl.remove(1, 1).catch(() => { - }); + this.navCtrl.remove(1, 1); }, 250); } pop() { - this.navCtrl.pop().catch(() => {}); + this.navCtrl.pop(); } viewDismiss() { diff --git a/src/components/nav/test/basic/pages/tab-three/tab-three.ts b/src/components/nav/test/basic/pages/tab-three/tab-three.ts index dfecf2d3d7..0a6e05a7f1 100644 --- a/src/components/nav/test/basic/pages/tab-three/tab-three.ts +++ b/src/components/nav/test/basic/pages/tab-three/tab-three.ts @@ -42,6 +42,7 @@ export class Tab3 { } presentModal() { + console.debug('modal was commented out'); // this.modalCtrl.create(MyModal).present(); } diff --git a/src/components/nav/test/nav.spec.ts b/src/components/nav/test/nav.spec.ts index de2c9ce51e..075213abdb 100644 --- a/src/components/nav/test/nav.spec.ts +++ b/src/components/nav/test/nav.spec.ts @@ -34,6 +34,7 @@ describe('Nav', () => { expect(nav.setPages).toHaveBeenCalledWith(knownViews, null, null); done(); }).catch((err: Error) => { + fail(err); done(err); }); }); @@ -56,6 +57,7 @@ describe('Nav', () => { expect(nav.setPages).toHaveBeenCalledWith(knownViews, null, null); done(); }).catch((err: Error) => { + fail(err); done(err); }); }); @@ -72,7 +74,8 @@ describe('Nav', () => { promise.then(() => { expect(nav.push).toHaveBeenCalled(); done(); - }).catch((err: Error) => { + }).catch((err: Error) => { + fail(err); done(err); }); }); @@ -106,7 +109,8 @@ function getNav() { gestureCtrl, trnsCtrl, linker, - dom + dom, + null ); return nav; } diff --git a/src/components/nav/test/worst-case/app.module.ts b/src/components/nav/test/worst-case/app.module.ts index 1671b56479..af9a82c0d4 100644 --- a/src/components/nav/test/worst-case/app.module.ts +++ b/src/components/nav/test/worst-case/app.module.ts @@ -5,8 +5,11 @@ import { DomSanitizer } from '@angular/platform-browser'; let LOG = ''; +let SIMPLE_LOG = ''; function log(page: string, message: string, color: string) { console.log(`${page}: ${message}`); + SIMPLE_LOG += `${page}:${message}`; + SIMPLE_LOG += '\n'; LOG += `${page}:${message}`; LOG += '\n'; } @@ -25,8 +28,16 @@ const TEMPLATE: string = ` `; +const baseCounter: any = {}; + export class Base { - constructor(public _name: string) { } + constructor(public _name: string) { + if (baseCounter[_name] === undefined) { + baseCounter[_name] = 0; + } + this._name = `${this._name}-${baseCounter[_name]}`; + baseCounter[_name]++; + } ionViewWillLoad() { log(this._name, 'willLoad', 'green'); } @@ -132,9 +143,11 @@ export class Page4 extends Base { setTimeout(() => { this.doSomethingSync(); setTimeout(() => { - this.nav.push(Page5).catch(() => { - this.nav.push(Page6, { continue: false }); - setTimeout(() => this.nav.push(Page6, { continue: true }), 510); + this.nav.push(Page5).then((hasCompleted) => { + if (!hasCompleted) { + this.nav.push(Page6, { continue: false }); + setTimeout(() => this.nav.push(Page6, { continue: true }), 510); + } }); }, 2000); }, 0); @@ -202,10 +215,12 @@ export class Page6 extends Base { } pop() { - this.nav.pop().then(() => { - this.pushPage7(); - }).catch(() => { - this.pop(); + this.nav.pop().then((hasCompleted) => { + if (hasCompleted) { + this.pushPage7(); + } else { + this.pop(); + } }); } @@ -238,6 +253,8 @@ export class Page7 extends Base { }); this.nav.push(Page8); this.nav.push(Page8); + this.nav.pop(); + this.nav.push(Page8); setTimeout(() => { this.nav.pop({ animate: false }); }, Math.random() * 100); @@ -274,10 +291,14 @@ export class Page8 extends Base { }) export class Results { result: any; - constructor(private nav: NavController, private sanitizer: DomSanitizer) { - } + constructor(private nav: NavController, private sanitizer: DomSanitizer) {} ionViewDidEnter() { - this.result = this.sanitizer.bypassSecurityTrustHtml(LOG); + setTimeout(() => { + if (SIMPLE_LOG !== EXPECTED) { + throw 'LOG DOES NOT MATCH'; + } + this.result = this.sanitizer.bypassSecurityTrustHtml(LOG); + }, 100); } } @@ -323,3 +344,207 @@ export class AppComponent { ] }) export class AppModule {} + + +const EXPECTED = `Page1-0:canEnter +Page1-0:willLoad +Page1-0:didLoad +Page1-0:willEnter +Page1-0:didEnter +Page1-0:canLeave +Page2-0:canEnter +Page2-0:willLoad +Page2-0:didLoad +Page1-0:willLeave +Page2-0:willEnter +Page2-0:didEnter +Page1-0:didLeave +Page1-0:willUnload +Page2-0:canLeave +Page3-0:canEnter +Page3-0:willLoad +Page3-0:didLoad +Page2-0:willLeave +Page3-0:willEnter +Page3-0:didEnter +Page2-0:didLeave +Page3-0:canLeave +Page2-0:canEnter +Page3-0:willLeave +Page2-0:willEnter +Page2-0:didEnter +Page3-0:didLeave +Page3-0:willUnload +Page2-0:canLeave +Page3-1:canEnter +Page3-1:willLoad +Page3-1:didLoad +Page2-0:willLeave +Page3-1:willEnter +Page3-1:didEnter +Page2-0:didLeave +Page3-1:canLeave +Page2-0:canEnter +Page3-1:willLeave +Page2-0:willEnter +Page2-0:didEnter +Page3-1:didLeave +Page3-1:willUnload +Page2-0:canLeave +Page3-2:canEnter +Page3-2:willLoad +Page3-2:didLoad +Page2-0:willLeave +Page3-2:willEnter +Page3-2:didEnter +Page2-0:didLeave +Page3-2:canLeave +Page2-0:canEnter +Page3-2:willLeave +Page2-0:willEnter +Page2-0:didEnter +Page3-2:didLeave +Page3-2:willUnload +Page2-0:canLeave +Page3-3:canEnter +Page3-3:willLoad +Page3-3:didLoad +Page2-0:willLeave +Page3-3:willEnter +Page3-3:didEnter +Page2-0:didLeave +Page3-3:canLeave +Page2-0:canEnter +Page3-3:willLeave +Page2-0:willEnter +Page2-0:didEnter +Page3-3:didLeave +Page3-3:willUnload +Page2-0:canLeave +Page4-0:canEnter +Page4-0:willLoad +Page4-0:didLoad +Page2-0:willLeave +Page4-0:willEnter +Page4-0:didEnter +Page2-0:didLeave +Page4-0:canLeave +Page5-0:canEnter +Page4-0:canLeave +Page6-0:canEnter +Page6-0:willLoad +Page6-0:didLoad +Page4-0:willLeave +Page6-0:willEnter +Page4-0:didLeave +Page6-0:canLeave +Page6-1:canEnter +Page6-1:willLoad +Page6-1:didLoad +Page6-0:willLeave +Page6-1:willEnter +Page6-0:didLeave +Page6-1:canLeave +Page6-0:canEnter +Page6-1:canLeave +Page6-0:canEnter +Page6-1:canLeave +Page6-0:canEnter +Page6-1:willLeave +Page6-0:willEnter +Page6-1:didLeave +Page6-1:willUnload +Page6-0:canLeave +Page7-0:canEnter +Page7-0:willLoad +Page7-0:didLoad +Page6-0:willLeave +Page7-0:willEnter +Page7-0:didEnter +Page6-0:didLeave +Page7-0:canLeave +Page8-0:canEnter +Page2-0:willLeave +Page2-0:didLeave +Page2-0:willUnload +Page4-0:willLeave +Page4-0:didLeave +Page4-0:willUnload +Page6-0:willLeave +Page6-0:didLeave +Page6-0:willUnload +Page8-0:willLoad +Page8-0:didLoad +Page7-0:willLeave +Page8-0:willEnter +Page8-0:didEnter +Page7-0:didLeave +Page7-0:willUnload +Page8-0:canLeave +Page8-1:canEnter +Page8-1:willLoad +Page8-1:didLoad +Page8-0:willLeave +Page8-1:willEnter +Page8-1:didEnter +Page8-0:didLeave +Page8-0:willUnload +Page8-1:canLeave +Page8-2:canEnter +Page8-2:willLoad +Page8-2:didLoad +Page8-1:willLeave +Page8-2:willEnter +Page8-2:didEnter +Page8-1:didLeave +Page8-1:willUnload +Page8-2:canLeave +Page8-3:canEnter +Page8-3:willLoad +Page8-3:didLoad +Page8-2:willLeave +Page8-3:willEnter +Page8-3:didEnter +Page8-2:didLeave +Page8-3:canLeave +Page8-4:canEnter +Page8-4:willLoad +Page8-4:didLoad +Page8-3:willLeave +Page8-4:willEnter +Page8-4:didEnter +Page8-3:didLeave +Page8-4:canLeave +Page8-3:canEnter +Page8-4:willLeave +Page8-3:willEnter +Page8-3:didEnter +Page8-4:didLeave +Page8-4:willUnload +Page8-3:canLeave +Page8-5:canEnter +Page8-5:willLoad +Page8-5:didLoad +Page8-3:willLeave +Page8-5:willEnter +Page8-5:didEnter +Page8-3:didLeave +Page8-5:canLeave +Page8-3:canEnter +Page8-5:willLeave +Page8-3:willEnter +Page8-3:didEnter +Page8-5:didLeave +Page8-5:willUnload +Page8-3:canLeave +Page8-2:canEnter +Page8-3:willLeave +Page8-2:willEnter +Page8-2:didEnter +Page8-3:didLeave +Page8-3:willUnload +Page8-2:canLeave +Page8-2:willLeave +Page8-2:didLeave +Page8-2:willUnload +`; diff --git a/src/components/navbar/navbar.module.ts b/src/components/navbar/navbar.module.ts deleted file mode 100644 index 409126c520..0000000000 --- a/src/components/navbar/navbar.module.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Navbar } from './navbar'; - -import { ButtonModule } from '../button/button.module'; -import { IconModule } from '../icon/icon.module'; - -/** @hidden */ -@NgModule({ - imports: [ - ButtonModule, - CommonModule, - IconModule - ], - declarations: [ - Navbar - ], - exports: [ - Navbar - ] -}) -export class NavbarModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: NavbarModule, providers: [] - }; - } -} diff --git a/src/components/note/note.module.ts b/src/components/note/note.module.ts deleted file mode 100644 index ff263c91a1..0000000000 --- a/src/components/note/note.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Note } from './note'; - -/** @hidden */ -@NgModule({ - declarations: [ - Note - ], - exports: [ - Note - ] -}) -export class NoteModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: NoteModule, providers: [] - }; - } -} diff --git a/src/components/option/option.module.ts b/src/components/option/option.module.ts deleted file mode 100644 index 25e619f8a5..0000000000 --- a/src/components/option/option.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Option } from './option'; - -/** @hidden */ -@NgModule({ - declarations: [ - Option - ], - exports: [ - Option - ] -}) -export class OptionModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: OptionModule, providers: [] - }; - } -} diff --git a/src/components/picker/picker.module.ts b/src/components/picker/picker.module.ts deleted file mode 100644 index 833c5b54e9..0000000000 --- a/src/components/picker/picker.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { BackdropModule } from '../backdrop/backdrop.module'; -import { ButtonModule } from '../button/button.module'; - -import { PickerCmp } from './picker-component'; -import { PickerColumnCmp } from './picker-column'; - -/** @hidden */ -@NgModule({ - imports: [ - BackdropModule, - ButtonModule, - CommonModule - ], - declarations: [ - PickerCmp, - PickerColumnCmp - ], - exports: [ - PickerCmp, - PickerColumnCmp - ], - entryComponents: [ - PickerCmp - ] -}) -export class PickerModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: PickerModule, providers: [] - }; - } -} diff --git a/src/components/popover/popover.module.ts b/src/components/popover/popover.module.ts deleted file mode 100644 index 097c2c997d..0000000000 --- a/src/components/popover/popover.module.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { BackdropModule } from '../backdrop/backdrop.module'; - -import { PopoverCmp } from './popover-component'; - -/** @hidden */ -@NgModule({ - imports: [ - BackdropModule - ], - declarations: [ - PopoverCmp - ], - exports: [ - PopoverCmp - ], - entryComponents: [ - PopoverCmp - ] -}) -export class PopoverModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: PopoverModule, providers: [] - }; - } -} diff --git a/src/components/radio/radio-group.ts b/src/components/radio/radio-group.ts index 938b521aae..f1656a2faa 100644 --- a/src/components/radio/radio-group.ts +++ b/src/components/radio/radio-group.ts @@ -1,16 +1,10 @@ -import { ChangeDetectorRef, ContentChild, Directive, ElementRef, EventEmitter, forwardRef, Input, Output, Renderer } from '@angular/core'; +import { ChangeDetectorRef, ContentChild, Directive, ElementRef, EventEmitter, Input, Output, Renderer } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { ListHeader } from '../list/list-header'; import { isCheckedProperty, isTrueProperty } from '../../util/util'; import { RadioButton } from './radio-button'; -export const RADIO_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => RadioGroup), - multi: true -}; - /** * @name RadioGroup * @description @@ -67,7 +61,7 @@ export const RADIO_VALUE_ACCESSOR: any = { host: { 'role': 'radiogroup' }, - providers: [RADIO_VALUE_ACCESSOR] + providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: RadioGroup, multi: true } ], }) export class RadioGroup { diff --git a/src/components/radio/radio.module.ts b/src/components/radio/radio.module.ts deleted file mode 100644 index e43db9cdc6..0000000000 --- a/src/components/radio/radio.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { RadioButton } from './radio-button'; -import { RadioGroup } from './radio-group'; - -/** @hidden */ -@NgModule({ - declarations: [ - RadioButton, - RadioGroup - ], - exports: [ - RadioButton, - RadioGroup - ] -}) -export class RadioModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: RadioModule, providers: [] - }; - } -} diff --git a/src/components/range/range.module.ts b/src/components/range/range.module.ts deleted file mode 100644 index 0f07537d19..0000000000 --- a/src/components/range/range.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Range } from './range'; -import { RangeKnob } from './range-knob'; - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule - ], - declarations: [ - Range, - RangeKnob - ], - exports: [ - Range, - RangeKnob - ] -}) -export class RangeModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: RangeModule, providers: [] - }; - } -} diff --git a/src/components/range/range.ts b/src/components/range/range.ts index f421783415..e6c1e69253 100644 --- a/src/components/range/range.ts +++ b/src/components/range/range.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, forwardRef, Input, OnDestroy, Optional, Renderer, ViewChild, ViewEncapsulation } from '@angular/core'; +import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, Input, OnDestroy, Optional, Renderer, ViewChild, ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { clamp, isTrueProperty } from '../../util/util'; @@ -13,13 +13,6 @@ import { PointerCoordinates, pointerCoord } from '../../util/dom'; import { UIEventManager } from '../../gestures/ui-event-manager'; -export const RANGE_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Range), - multi: true -}; - - /** * @name Range * @description @@ -108,7 +101,7 @@ export const RANGE_VALUE_ACCESSOR: any = { '[class.range-pressed]': '_pressed', '[class.range-has-pin]': '_pin' }, - providers: [RANGE_VALUE_ACCESSOR], + providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Range, multi: true } ], encapsulation: ViewEncapsulation.None, }) export class Range extends BaseInput implements AfterViewInit, ControlValueAccessor, OnDestroy { diff --git a/src/components/refresher/refresher.module.ts b/src/components/refresher/refresher.module.ts deleted file mode 100644 index 0956432492..0000000000 --- a/src/components/refresher/refresher.module.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { IconModule } from '../icon/icon.module'; -import { SpinnerModule } from '../spinner/spinner.module'; - -import { Refresher } from './refresher'; -import { RefresherContent } from './refresher-content'; - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule, - IconModule, - SpinnerModule - ], - declarations: [ - Refresher, - RefresherContent - ], - exports: [ - Refresher, - RefresherContent - ] -}) -export class RefresherModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: RefresherModule, providers: [] - }; - } -} diff --git a/src/components/scroll/scroll.module.ts b/src/components/scroll/scroll.module.ts deleted file mode 100644 index 76960551ce..0000000000 --- a/src/components/scroll/scroll.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Scroll } from './scroll'; - -/** @hidden */ -@NgModule({ - declarations: [ - Scroll - ], - exports: [ - Scroll - ] -}) -export class ScrollModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ScrollModule, providers: [] - }; - } -} diff --git a/src/components/searchbar/searchbar.module.ts b/src/components/searchbar/searchbar.module.ts deleted file mode 100644 index e00d3be428..0000000000 --- a/src/components/searchbar/searchbar.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { ButtonModule } from '../button/button.module'; -import { IconModule } from '../icon/icon.module'; - -import { Searchbar } from './searchbar'; - -/** @hidden */ -@NgModule({ - imports: [ - ButtonModule, - IconModule - ], - declarations: [ - Searchbar - ], - exports: [ - Searchbar - ] -}) -export class SearchbarModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: SearchbarModule, providers: [] - }; - } -} diff --git a/src/components/segment/segment.module.ts b/src/components/segment/segment.module.ts deleted file mode 100644 index bf87d420ef..0000000000 --- a/src/components/segment/segment.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Segment } from './segment'; -import { SegmentButton } from './segment-button'; - -/** @hidden */ -@NgModule({ - declarations: [ - Segment, - SegmentButton - ], - exports: [ - Segment, - SegmentButton - ] -}) -export class SegmentModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: SegmentModule, providers: [] - }; - } -} diff --git a/src/components/select/select.module.ts b/src/components/select/select.module.ts deleted file mode 100644 index b4e8e449b9..0000000000 --- a/src/components/select/select.module.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; - -import { Select } from './select'; -import { SelectPopover } from './select-popover-component'; - -import { ItemModule } from '../item/item.module'; -import { LabelModule } from '../label/label.module'; -import { ListModule } from '../list/list.module'; -import { RadioModule } from '../radio/radio.module'; - - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule, - FormsModule, - ReactiveFormsModule, - ItemModule, - LabelModule, - ListModule, - RadioModule - ], - declarations: [ - Select, - SelectPopover - ], - exports: [ - Select, - SelectPopover - ], - entryComponents: [ - SelectPopover - ] -}) -export class SelectModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: SelectModule, providers: [] - }; - } -} diff --git a/src/components/select/select.ts b/src/components/select/select.ts index 35de7aabb8..b5d4acfaba 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, ContentChildren, ElementRef, EventEmitter, forwardRef, Input, HostListener, OnDestroy, Optional, Output, Renderer, QueryList, ViewEncapsulation } from '@angular/core'; +import { AfterViewInit, Component, ContentChildren, ElementRef, EventEmitter, Input, HostListener, OnDestroy, Optional, Output, Renderer, QueryList, ViewEncapsulation } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { ActionSheet } from '../action-sheet/action-sheet'; @@ -15,12 +15,6 @@ import { NavController } from '../../navigation/nav-controller'; import { Option } from '../option/option'; import { SelectPopover, SelectPopoverOption } from './select-popover-component'; -export const SELECT_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Select), - multi: true -}; - /** * @name Select * @description @@ -150,7 +144,7 @@ export const SELECT_VALUE_ACCESSOR: any = { host: { '[class.select-disabled]': '_disabled' }, - providers: [SELECT_VALUE_ACCESSOR], + providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Select, multi: true } ], encapsulation: ViewEncapsulation.None, }) export class Select extends BaseInput implements AfterViewInit, OnDestroy { diff --git a/src/components/show-hide-when/show-hide-when.module.ts b/src/components/show-hide-when/show-hide-when.module.ts deleted file mode 100644 index cbcfe28b2a..0000000000 --- a/src/components/show-hide-when/show-hide-when.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { ShowWhen } from './show-when'; -import { HideWhen } from './hide-when'; - -/** @hidden */ -@NgModule({ - declarations: [ - ShowWhen, - HideWhen - ], - exports: [ - ShowWhen, - HideWhen - ] -}) -export class ShowHideWhenModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ShowHideWhenModule, providers: [] - }; - } -} diff --git a/src/components/slides/slides.module.ts b/src/components/slides/slides.module.ts deleted file mode 100644 index 6bcebc7faf..0000000000 --- a/src/components/slides/slides.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Slide } from './slide'; -import { Slides } from './slides'; - -/** @hidden */ -@NgModule({ - declarations: [ - Slide, - Slides - ], - exports: [ - Slide, - Slides - ] -}) -export class SlidesModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: SlidesModule, providers: [] - }; - } -} diff --git a/src/components/spinner/spinner.module.ts b/src/components/spinner/spinner.module.ts deleted file mode 100644 index fb16ad9e3c..0000000000 --- a/src/components/spinner/spinner.module.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Spinner } from './spinner'; - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule - ], - declarations: [ - Spinner - ], - exports: [ - Spinner - ] -}) -export class SpinnerModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: SpinnerModule, providers: [] - }; - } -} diff --git a/src/components/split-pane/split-pane.module.ts b/src/components/split-pane/split-pane.module.ts deleted file mode 100644 index 07746d2a50..0000000000 --- a/src/components/split-pane/split-pane.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { SplitPane } from './split-pane'; - -/** @hidden */ -@NgModule({ - declarations: [ - SplitPane - ], - exports: [ - SplitPane - ] -}) -export class SplitPaneModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: SplitPaneModule, providers: [] - }; - } -} diff --git a/src/components/tabs/tab.ts b/src/components/tabs/tab.ts index 9f81934581..e2f3d55f12 100644 --- a/src/components/tabs/tab.ts +++ b/src/components/tabs/tab.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, ComponentFactoryResolver, ComponentRef, ElementRef, EventEmitter, Input, NgZone, Optional, Output, Renderer, ViewChild, ViewEncapsulation, ViewContainerRef } from '@angular/core'; +import { ChangeDetectorRef, Component, ComponentFactoryResolver, ComponentRef, ElementRef, ErrorHandler, EventEmitter, Input, NgZone, Optional, Output, Renderer, ViewChild, ViewEncapsulation, ViewContainerRef } from '@angular/core'; import { App } from '../app/app'; import { Config } from '../../config/config'; @@ -7,6 +7,7 @@ import { DomController } from '../../platform/dom-controller'; import { GestureController } from '../../gestures/gesture-controller'; import { isTrueProperty } from '../../util/util'; import { Keyboard } from '../../platform/keyboard'; +import { Tab as ITab } from '../../navigation/nav-interfaces'; import { NavControllerBase } from '../../navigation/nav-controller-base'; import { NavOptions } from '../../navigation/nav-util'; import { Platform } from '../../platform/platform'; @@ -132,7 +133,7 @@ import { ViewController } from '../../navigation/view-controller'; }, encapsulation: ViewEncapsulation.None, }) -export class Tab extends NavControllerBase { +export class Tab extends NavControllerBase implements ITab { /** * @hidden */ @@ -264,9 +265,10 @@ export class Tab extends NavControllerBase { transCtrl: TransitionController, @Optional() private linker: DeepLinker, private _dom: DomController, + errHandler: ErrorHandler ) { // A Tab is a NavController for its child pages - super(parent, app, config, plt, keyboard, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, _dom); + super(parent, app, config, plt, keyboard, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, _dom, errHandler); this.id = parent.add(this); this._tabsHideOnSubPages = config.getBoolean('tabsHideOnSubPages'); @@ -292,7 +294,7 @@ export class Tab extends NavControllerBase { /** * @hidden */ - load(opts: NavOptions, done?: Function) { + load(opts: NavOptions, done?: () => void) { if (!this._loaded && this.root) { this.setElementClass('show-tab', true); this.push(this.root, this.rootParams, opts, done); @@ -305,7 +307,7 @@ export class Tab extends NavControllerBase { this._dom.read(() => { this.resize(); }); - done(true); + done(); } } diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index 0593ab8358..a37b4a9f5b 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -5,6 +5,7 @@ import { Config } from '../../config/config'; import { DeepLinker } from '../../navigation/deep-linker'; import { Ion } from '../ion'; import { isBlank, assert } from '../../util/util'; +import { Tabs as ITabs } from '../../navigation/nav-interfaces'; import { NavController } from '../../navigation/nav-controller'; import { NavControllerBase } from '../../navigation/nav-controller-base'; import { getComponent, NavOptions, DIRECTION_SWITCH } from '../../navigation/nav-util'; @@ -159,7 +160,7 @@ import { ViewController } from '../../navigation/view-controller'; encapsulation: ViewEncapsulation.None, providers: [{provide: RootNode, useExisting: forwardRef(() => Tabs) }] }) -export class Tabs extends Ion implements AfterViewInit, RootNode { +export class Tabs extends Ion implements AfterViewInit, RootNode, ITabs { /** @internal */ _ids: number = -1; /** @internal */ @@ -506,9 +507,7 @@ export class Tabs extends Ion implements AfterViewInit, RootNode { } else if (tab.length() > 1) { // if we're a few pages deep, pop to root - tab.popToRoot().catch(() => { - console.debug('Tabs: pop to root was cancelled'); - }); + tab.popToRoot(); } else { getComponent(this._linker, tab.root).then(viewController => { if (viewController.component !== active.component) { diff --git a/src/components/tabs/test/advanced/pages/tab1-page1/tab1-page1.ts b/src/components/tabs/test/advanced/pages/tab1-page1/tab1-page1.ts index 46ee24017c..c762337481 100644 --- a/src/components/tabs/test/advanced/pages/tab1-page1/tab1-page1.ts +++ b/src/components/tabs/test/advanced/pages/tab1-page1/tab1-page1.ts @@ -28,9 +28,7 @@ export class Tab1Page1 { } logout() { - this.app.getRootNav().setRoot('sign-in', null, { animate: true, direction: 'back' }).catch(() => { - console.debug('logout cancelled'); - }); + this.app.getRootNav().setRoot('sign-in', null, { animate: true, direction: 'back' }); } ionViewWillEnter() { diff --git a/src/components/tabs/test/advanced/pages/tabs-page/tabs.ts b/src/components/tabs/test/advanced/pages/tabs-page/tabs.ts index 2104292d6d..df84b044ab 100644 --- a/src/components/tabs/test/advanced/pages/tabs-page/tabs.ts +++ b/src/components/tabs/test/advanced/pages/tabs-page/tabs.ts @@ -37,9 +37,7 @@ export class TabsPage { } logout() { - this.navCtrl.pop().catch(() => { - console.log('Cannot go back.'); - }); + this.navCtrl.pop(); } ionViewCanLeave() { diff --git a/src/components/tabs/test/tabs.spec.ts b/src/components/tabs/test/tabs.spec.ts index 426c402f50..a26adbce4a 100644 --- a/src/components/tabs/test/tabs.spec.ts +++ b/src/components/tabs/test/tabs.spec.ts @@ -162,7 +162,6 @@ describe('Tabs', () => { it('should get the tab', () => { var tabs = mockTabs(); var tab0 = mockTab(tabs); - tab0.setRoot({}); var tab1 = mockTab(tabs); expect(tabs.getIndex(tab0)).toEqual(0); diff --git a/src/components/thumbnail/thumbnail.module.ts b/src/components/thumbnail/thumbnail.module.ts deleted file mode 100644 index 53c5bf1d14..0000000000 --- a/src/components/thumbnail/thumbnail.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Thumbnail } from './thumbnail'; - -/** @hidden */ -@NgModule({ - declarations: [ - Thumbnail - ], - exports: [ - Thumbnail - ] -}) -export class ThumbnailModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ThumbnailModule, providers: [] - }; - } -} diff --git a/src/components/toast/toast.module.ts b/src/components/toast/toast.module.ts deleted file mode 100644 index 70e52f31cd..0000000000 --- a/src/components/toast/toast.module.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { BackdropModule } from '../backdrop/backdrop.module'; -import { ButtonModule } from '../button/button.module'; - -import { ToastCmp } from './toast-component'; - -/** @hidden */ -@NgModule({ - imports: [ - BackdropModule, - ButtonModule, - CommonModule - ], - declarations: [ - ToastCmp - ], - exports: [ - ToastCmp - ], - entryComponents: [ - ToastCmp - ] -}) -export class ToastModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ToastModule, providers: [] - }; - } -} diff --git a/src/components/toggle/toggle-gesture.ts b/src/components/toggle/toggle-gesture.ts index 8b97d4b8ca..45d4e0084a 100644 --- a/src/components/toggle/toggle-gesture.ts +++ b/src/components/toggle/toggle-gesture.ts @@ -1,6 +1,6 @@ import { GestureController, GESTURE_PRIORITY_TOGGLE, GESTURE_TOGGLE } from '../../gestures/gesture-controller'; import { DomController } from '../../platform/dom-controller'; -import { PanGesture } from '../../gestures/drag-gesture'; +import { PanGesture } from '../../gestures/pan-gesture'; import { Platform } from '../../platform/platform'; import { pointerCoord } from '../../util/dom'; import { Toggle } from './toggle'; diff --git a/src/components/toggle/toggle.module.ts b/src/components/toggle/toggle.module.ts deleted file mode 100644 index c4401e5bd8..0000000000 --- a/src/components/toggle/toggle.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Toggle } from './toggle'; - -/** @hidden */ -@NgModule({ - declarations: [ - Toggle - ], - exports: [ - Toggle - ] -}) -export class ToggleModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ToggleModule, providers: [] - }; - } -} diff --git a/src/components/toggle/toggle.ts b/src/components/toggle/toggle.ts index d941e130cd..f92400a374 100644 --- a/src/components/toggle/toggle.ts +++ b/src/components/toggle/toggle.ts @@ -1,4 +1,4 @@ -import { NgZone, AfterViewInit, ChangeDetectorRef, Component, ElementRef, forwardRef, HostListener, Input, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core'; +import { NgZone, AfterViewInit, ChangeDetectorRef, Component, ElementRef, HostListener, Input, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { Config } from '../../config/config'; @@ -13,12 +13,6 @@ import { KEY_ENTER, KEY_SPACE } from '../../platform/key'; import { Platform } from '../../platform/platform'; import { ToggleGesture } from './toggle-gesture'; -export const TOGGLE_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Toggle), - multi: true -}; - /** * @name Toggle * @description @@ -76,7 +70,7 @@ export const TOGGLE_VALUE_ACCESSOR: any = { '[class.toggle-checked]': '_value', '[class.toggle-activated]': '_activated', }, - providers: [TOGGLE_VALUE_ACCESSOR], + providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Toggle, multi: true } ], encapsulation: ViewEncapsulation.None, }) export class Toggle extends BaseInput implements IonicTapInput, AfterViewInit, OnDestroy { diff --git a/src/components/navbar/navbar.ts b/src/components/toolbar/navbar.ts similarity index 98% rename from src/components/navbar/navbar.ts rename to src/components/toolbar/navbar.ts index edc834bd45..1d3f28bbe1 100644 --- a/src/components/navbar/navbar.ts +++ b/src/components/toolbar/navbar.ts @@ -4,7 +4,7 @@ import { App } from '../app/app'; import { Config } from '../../config/config'; import { isTrueProperty } from '../../util/util'; import { NavController } from '../../navigation/nav-controller'; -import { ToolbarBase } from '../toolbar/toolbar-base'; +import { ToolbarBase } from './toolbar-base'; import { ViewController } from '../../navigation/view-controller'; diff --git a/src/components/toolbar/toolbar-footer.ts b/src/components/toolbar/toolbar-footer.ts index d0e4a1358e..a9d2abdaff 100644 --- a/src/components/toolbar/toolbar-footer.ts +++ b/src/components/toolbar/toolbar-footer.ts @@ -2,6 +2,7 @@ import { Directive, ElementRef, Optional, Renderer } from '@angular/core'; import { Config } from '../../config/config'; import { Ion } from '../ion'; +import { Footer as IFooter } from '../../navigation/nav-interfaces'; import { ViewController } from '../../navigation/view-controller'; /** @@ -26,7 +27,7 @@ import { ViewController } from '../../navigation/view-controller'; @Directive({ selector: 'ion-footer' }) -export class Footer extends Ion { +export class Footer extends Ion implements IFooter { constructor(config: Config, elementRef: ElementRef, renderer: Renderer, @Optional() viewCtrl: ViewController) { super(config, elementRef, renderer, 'footer'); diff --git a/src/components/toolbar/toolbar-header.ts b/src/components/toolbar/toolbar-header.ts index 03b0a62f54..8fdf21fea4 100644 --- a/src/components/toolbar/toolbar-header.ts +++ b/src/components/toolbar/toolbar-header.ts @@ -2,6 +2,7 @@ import { Directive, ElementRef, Optional, Renderer } from '@angular/core'; import { Config } from '../../config/config'; import { Ion } from '../ion'; +import { Header as IHeader } from '../../navigation/nav-interfaces'; import { ViewController } from '../../navigation/view-controller'; /** @@ -30,7 +31,7 @@ import { ViewController } from '../../navigation/view-controller'; @Directive({ selector: 'ion-header' }) -export class Header extends Ion { +export class Header extends Ion implements IHeader { constructor(config: Config, elementRef: ElementRef, renderer: Renderer, @Optional() viewCtrl: ViewController) { super(config, elementRef, renderer, 'header'); diff --git a/src/components/toolbar/toolbar-item.ts b/src/components/toolbar/toolbar-item.ts index 4ef0ccf4d9..c5aa3c026a 100644 --- a/src/components/toolbar/toolbar-item.ts +++ b/src/components/toolbar/toolbar-item.ts @@ -3,7 +3,7 @@ import { ContentChildren, Directive, ElementRef, forwardRef, Optional, Inject, R import { Button } from '../button/button'; import { Config } from '../../config/config'; import { Ion } from '../ion'; -import { Navbar } from '../navbar/navbar'; +import { Navbar } from './navbar'; import { Toolbar } from './toolbar'; diff --git a/src/components/toolbar/toolbar-title.ts b/src/components/toolbar/toolbar-title.ts index 0c3d5aa7fe..38a4e3d239 100644 --- a/src/components/toolbar/toolbar-title.ts +++ b/src/components/toolbar/toolbar-title.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, ElementRef, forwardRef, Optional, I import { Config } from '../../config/config'; import { Ion } from '../ion'; -import { Navbar } from '../navbar/navbar'; +import { Navbar } from './navbar'; import { Toolbar } from './toolbar'; diff --git a/src/components/toolbar/toolbar.module.ts b/src/components/toolbar/toolbar.module.ts deleted file mode 100644 index fc0cbb1f14..0000000000 --- a/src/components/toolbar/toolbar.module.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Footer } from './toolbar-footer'; -import { Header } from './toolbar-header'; -import { Toolbar } from './toolbar'; -import { ToolbarItem } from './toolbar-item'; -import { ToolbarTitle } from './toolbar-title'; - -/** @hidden */ -@NgModule({ - imports: [ - CommonModule - ], - declarations: [ - Footer, - Header, - Toolbar, - ToolbarItem, - ToolbarTitle - ], - exports: [ - Footer, - Header, - Toolbar, - ToolbarItem, - ToolbarTitle - ] -}) -export class ToolbarModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: ToolbarModule, providers: [] - }; - } -} diff --git a/src/components/typography/typography.module.ts b/src/components/typography/typography.module.ts deleted file mode 100644 index d25758444e..0000000000 --- a/src/components/typography/typography.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { Typography } from './typography'; - -/** @hidden */ -@NgModule({ - declarations: [ - Typography - ], - exports: [ - Typography - ] -}) -export class TypographyModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: TypographyModule, providers: [] - }; - } -} diff --git a/src/components/virtual-scroll/virtual-scroll.module.ts b/src/components/virtual-scroll/virtual-scroll.module.ts deleted file mode 100644 index f3f8124b1d..0000000000 --- a/src/components/virtual-scroll/virtual-scroll.module.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; - -import { VirtualFooter } from './virtual-footer'; -import { VirtualHeader } from './virtual-header'; -import { VirtualItem } from './virtual-item'; -import { VirtualScroll } from './virtual-scroll'; - -/** @hidden */ -@NgModule({ - declarations: [ - VirtualFooter, - VirtualHeader, - VirtualItem, - VirtualScroll - ], - exports: [ - VirtualFooter, - VirtualHeader, - VirtualItem, - VirtualScroll - ] -}) -export class VirtualScrollModule { - public static forRoot(): ModuleWithProviders { - return { - ngModule: VirtualScrollModule, providers: [] - }; - } -} diff --git a/src/components/virtual-scroll/virtual-scroll.ts b/src/components/virtual-scroll/virtual-scroll.ts index 136b7d13eb..d64e1365bb 100644 --- a/src/components/virtual-scroll/virtual-scroll.ts +++ b/src/components/virtual-scroll/virtual-scroll.ts @@ -501,15 +501,17 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy { adjustRendered(cells, data); - populateNodeData( - data.topCell, data.bottomCell, - data.viewWidth, true, - cells, records, nodes, - this._itmTmp.viewContainer, - this._itmTmp.templateRef, - this._hdrTmp && this._hdrTmp.templateRef, - this._ftrTmp && this._ftrTmp.templateRef, needClean - ); + this._zone.run(() => { + populateNodeData( + data.topCell, data.bottomCell, + data.viewWidth, true, + cells, records, nodes, + this._itmTmp.viewContainer, + this._itmTmp.templateRef, + this._hdrTmp && this._hdrTmp.templateRef, + this._ftrTmp && this._ftrTmp.templateRef, needClean, + ); + }); if (needClean) { this._cd.detectChanges(); diff --git a/src/components/virtual-scroll/virtual-util.ts b/src/components/virtual-scroll/virtual-util.ts index 246b0bcd4e..cb9bad9fff 100644 --- a/src/components/virtual-scroll/virtual-util.ts +++ b/src/components/virtual-scroll/virtual-util.ts @@ -233,9 +233,10 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v availableNode.cell = cellIndex; // apply the cell's data to this node - availableNode.view.context.$implicit = cell.data || records[cell.record]; - availableNode.view.context.index = cellIndex; - availableNode.view.context.count = recordsLength; + var context = availableNode.view.context; + context.$implicit = cell.data || records[cell.record]; + context.index = cellIndex; + context.count = recordsLength; availableNode.hasChanges = true; availableNode.lastTransform = null; hasChanges = true; diff --git a/src/gestures/drag-gesture.ts b/src/gestures/pan-gesture.ts similarity index 100% rename from src/gestures/drag-gesture.ts rename to src/gestures/pan-gesture.ts diff --git a/src/gestures/slide-gesture.ts b/src/gestures/slide-gesture.ts index ac836fd6bf..79399a92c9 100644 --- a/src/gestures/slide-gesture.ts +++ b/src/gestures/slide-gesture.ts @@ -1,4 +1,4 @@ -import { PanGesture } from './drag-gesture'; +import { PanGesture } from './pan-gesture'; import { clamp, assert } from '../util/util'; import { Platform } from '../platform/platform'; import { pointerCoord } from '../util/dom'; diff --git a/src/index.ts b/src/index.ts index 2ef30497f6..c9ad2a50a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,168 +1,18 @@ - -/** - * Import Angular - */ -import { ANALYZE_FOR_ENTRY_COMPONENTS, APP_INITIALIZER, ComponentFactoryResolver, CUSTOM_ELEMENTS_SCHEMA, Inject, Injector, ModuleWithProviders, NgModule, NgZone, Optional } from '@angular/core'; -import { APP_BASE_HREF, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, PlatformLocation } from '@angular/common'; -import { DOCUMENT } from '@angular/platform-browser'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { CommonModule } from '@angular/common'; - -/** - * Import Other - */ -import { DeepLinkConfig } from './navigation/nav-util'; - -/** - * Import Providers - */ -import { ActionSheetController } from './components/action-sheet/action-sheet-controller'; -import { AlertController } from './components/alert/alert-controller'; -import { App } from './components/app/app'; -import { AppRootToken } from './components/app/app-root'; -import { Config, setupConfig, ConfigToken } from './config/config'; -import { DeepLinker, setupDeepLinker } from './navigation/deep-linker'; -import { DomController } from './platform/dom-controller'; -import { Events, setupProvideEvents } from './util/events'; -import { Form } from './util/form'; -import { GestureController } from './gestures/gesture-controller'; -import { Haptic } from './tap-click/haptic'; -import { Keyboard } from './platform/keyboard'; -import { LoadingController } from './components/loading/loading-controller'; -import { MenuController } from './components/menu/menu-controller'; -import { ModalController } from './components/modal/modal-controller'; -import { ModuleLoader, provideModuleLoader, setupPreloading, LAZY_LOADED_TOKEN } from './util/module-loader'; -import { NgModuleLoader } from './util/ng-module-loader'; -import { PickerController } from './components/picker/picker-controller'; -import { Platform, setupPlatform } from './platform/platform'; -import { PlatformConfigToken, providePlatformConfigs } from './platform/platform-registry'; -import { PopoverController } from './components/popover/popover-controller'; -import { setupCore } from './util/ionic-core'; -import { TapClick, setupTapClick } from './tap-click/tap-click'; -import { ToastController } from './components/toast/toast-controller'; -import { registerModeConfigs } from './config/mode-registry'; -import { TransitionController } from './transitions/transition-controller'; -import { UrlSerializer, setupUrlSerializer, DeepLinkConfigToken } from './navigation/url-serializer'; - - -/** - * Import Modules - */ -import { ActionSheetModule } from './components/action-sheet/action-sheet.module'; -import { AlertModule } from './components/alert/alert.module'; -import { AppModule } from './components/app/app.module'; -import { AvatarModule } from './components/avatar/avatar.module'; -import { BackdropModule } from './components/backdrop/backdrop.module'; -import { ButtonModule } from './components/button/button.module'; -import { CardModule } from './components/card/card.module'; -import { CheckboxModule } from './components/checkbox/checkbox.module'; -import { ChipModule } from './components/chip/chip.module'; -import { ClickBlockModule } from './components/click-block/click-block.module'; -import { ContentModule } from './components/content/content.module'; -import { DateTimeModule } from './components/datetime/datetime.module'; -import { FabModule } from './components/fab/fab.module'; -import { GridModule } from './components/grid/grid.module'; -import { IconModule } from './components/icon/icon.module'; -import { ImgModule } from './components/img/img.module'; -import { InfiniteScrollModule } from './components/infinite-scroll/infinite-scroll.module'; -import { InputModule } from './components/input/input.module'; -import { ItemModule } from './components/item/item.module'; -import { LabelModule } from './components/label/label.module'; -import { ListModule } from './components/list/list.module'; -import { LoadingModule } from './components/loading/loading.module'; -import { MenuModule } from './components/menu/menu.module'; -import { ModalModule } from './components/modal/modal.module'; -import { NavModule } from './components/nav/nav.module'; -import { NavbarModule } from './components/navbar/navbar.module'; -import { NoteModule } from './components/note/note.module'; -import { OptionModule } from './components/option/option.module'; -import { PickerModule } from './components/picker/picker.module'; -import { PopoverModule } from './components/popover/popover.module'; -import { RadioModule } from './components/radio/radio.module'; -import { RangeModule } from './components/range/range.module'; -import { RefresherModule } from './components/refresher/refresher.module'; -import { ScrollModule } from './components/scroll/scroll.module'; -import { SearchbarModule } from './components/searchbar/searchbar.module'; -import { SegmentModule } from './components/segment/segment.module'; -import { SelectModule } from './components/select/select.module'; -import { ShowHideWhenModule } from './components/show-hide-when/show-hide-when.module'; -import { SlidesModule } from './components/slides/slides.module'; -import { SpinnerModule } from './components/spinner/spinner.module'; -import { SplitPaneModule } from './components/split-pane/split-pane.module'; -import { TabsModule } from './components/tabs/tabs.module'; -import { ThumbnailModule } from './components/thumbnail/thumbnail.module'; -import { ToastModule } from './components/toast/toast.module'; -import { ToggleModule } from './components/toggle/toggle.module'; -import { ToolbarModule } from './components/toolbar/toolbar.module'; -import { TypographyModule } from './components/typography/typography.module'; -import { VirtualScrollModule } from './components/virtual-scroll/virtual-scroll.module'; - - -/** - * Export Modules - */ -export { ActionSheetModule } from './components/action-sheet/action-sheet.module'; -export { AlertModule } from './components/alert/alert.module'; -export { AppModule } from './components/app/app.module'; -export { AvatarModule } from './components/avatar/avatar.module'; -export { BackdropModule } from './components/backdrop/backdrop.module'; -export { ButtonModule } from './components/button/button.module'; -export { CardModule } from './components/card/card.module'; -export { CheckboxModule } from './components/checkbox/checkbox.module'; -export { ChipModule } from './components/chip/chip.module'; -export { ClickBlockModule } from './components/click-block/click-block.module'; -export { ContentModule } from './components/content/content.module'; -export { DateTimeModule } from './components/datetime/datetime.module'; -export { FabModule } from './components/fab/fab.module'; -export { GridModule } from './components/grid/grid.module'; -export { IconModule } from './components/icon/icon.module'; -export { ImgModule } from './components/img/img.module'; -export { InfiniteScrollModule } from './components/infinite-scroll/infinite-scroll.module'; -export { InputModule } from './components/input/input.module'; -export { ItemModule } from './components/item/item.module'; -export { LabelModule } from './components/label/label.module'; -export { ListModule } from './components/list/list.module'; -export { LoadingModule } from './components/loading/loading.module'; -export { MenuModule } from './components/menu/menu.module'; -export { ModalModule } from './components/modal/modal.module'; -export { NavModule } from './components/nav/nav.module'; -export { NavbarModule } from './components/navbar/navbar.module'; -export { NoteModule } from './components/note/note.module'; -export { OptionModule } from './components/option/option.module'; -export { PickerModule } from './components/picker/picker.module'; -export { PopoverModule } from './components/popover/popover.module'; -export { RadioModule } from './components/radio/radio.module'; -export { RangeModule } from './components/range/range.module'; -export { RefresherModule } from './components/refresher/refresher.module'; -export { ScrollModule } from './components/scroll/scroll.module'; -export { SearchbarModule } from './components/searchbar/searchbar.module'; -export { SegmentModule } from './components/segment/segment.module'; -export { SelectModule } from './components/select/select.module'; -export { ShowHideWhenModule } from './components/show-hide-when/show-hide-when.module'; -export { SlidesModule } from './components/slides/slides.module'; -export { SpinnerModule } from './components/spinner/spinner.module'; -export { SplitPaneModule } from './components/split-pane/split-pane.module'; -export { TabsModule } from './components/tabs/tabs.module'; -export { ThumbnailModule } from './components/thumbnail/thumbnail.module'; -export { ToastModule } from './components/toast/toast.module'; -export { ToggleModule } from './components/toggle/toggle.module'; -export { ToolbarModule } from './components/toolbar/toolbar.module'; -export { TypographyModule } from './components/typography/typography.module'; -export { VirtualScrollModule } from './components/virtual-scroll/virtual-scroll.module'; - -/** - * Export Components/Directives - */ +export { IonicApp } from './components/app/app-root'; +export { MenuController } from './components/app/menu-controller'; export { ActionSheet } from './components/action-sheet/action-sheet'; export { ActionSheetController } from './components/action-sheet/action-sheet-controller'; export { ActionSheetOptions } from './components/action-sheet/action-sheet-options'; -export { AlertController } from './components/alert/alert-controller'; +export { ActionSheetCmp } from './components/action-sheet/action-sheet-component'; export { Alert } from './components/alert/alert'; -export { AlertOptions, AlertInputOptions } from './components/alert/alert-options'; +export { AlertController } from './components/alert/alert-controller'; +export { AlertOptions } from './components/alert/alert-options'; +export { AlertCmp } from './components/alert/alert-component'; export { App } from './components/app/app'; export { Avatar } from './components/avatar/avatar'; export { Backdrop } from './components/backdrop/backdrop'; +export { Badge } from './components/badge/badge'; export { Button } from './components/button/button'; export { Card } from './components/card/card'; export { CardContent } from './components/card/card-content'; @@ -170,7 +20,6 @@ export { CardHeader } from './components/card/card-header'; export { CardTitle } from './components/card/card-title'; export { Checkbox } from './components/checkbox/checkbox'; export { Chip } from './components/chip/chip'; -export { ClickBlock } from './components/click-block/click-block'; export { Content, ScrollEvent } from './components/content/content'; export { DateTime } from './components/datetime/datetime'; export { FabButton } from './components/fab/fab'; @@ -185,29 +34,27 @@ export { Img } from './components/img/img'; export { InfiniteScroll } from './components/infinite-scroll/infinite-scroll'; export { InfiniteScrollContent } from './components/infinite-scroll/infinite-scroll-content'; export { TextInput } from './components/input/input'; -export { IonicApp } from './components/app/app-root'; - export { Item } from './components/item/item'; export { ItemContent } from './components/item/item-content'; export { ItemDivider } from './components/item/item-divider'; export { ItemGroup } from './components/item/item-group'; -export { ItemReorder } from './components/item/item-reorder'; -export { Reorder } from './components/item/reorder'; -export { ItemSliding } from './components/item/item-sliding'; export { ItemOptions } from './components/item/item-options'; - +export { ItemReorder } from './components/item/item-reorder'; +export { ItemSliding } from './components/item/item-sliding'; +export { Reorder } from './components/item/reorder'; export { Label } from './components/label/label'; export { List } from './components/list/list'; export { ListHeader } from './components/list/list-header'; export { Loading } from './components/loading/loading'; export { LoadingController } from './components/loading/loading-controller'; export { LoadingOptions } from './components/loading/loading-options'; +export { LoadingCmp } from './components/loading/loading-component'; export { Menu } from './components/menu/menu'; export { MenuClose } from './components/menu/menu-close'; -export { MenuController } from './components/menu/menu-controller'; export { MenuToggle } from './components/menu/menu-toggle'; export { MenuType } from './components/menu/menu-types'; export { Modal } from './components/modal/modal'; +export { ModalCmp } from './components/modal/modal-component'; export { ModalController } from './components/modal/modal-controller'; export { ModalOptions } from './components/modal/modal-options'; export { Nav } from './components/nav/nav'; @@ -215,16 +62,17 @@ export { NavPop } from './components/nav/nav-pop'; export { NavPopAnchor } from './components/nav/nav-pop-anchor'; export { NavPush } from './components/nav/nav-push'; export { NavPushAnchor } from './components/nav/nav-push-anchor'; -export { Navbar } from './components/navbar/navbar'; export { NativeInput } from './components/input/native-input'; export { NextInput } from './components/input/next-input'; export { Note } from './components/note/note'; export { Option } from './components/option/option'; -export { OverlayPortal } from './components/nav/overlay-portal'; export { Picker } from './components/picker/picker'; +export { PickerCmp } from './components/picker/picker-component'; +export { PickerColumnCmp } from './components/picker/picker-column'; export { PickerController } from './components/picker/picker-controller'; export { PickerOptions, PickerColumn, PickerColumnOption } from './components/picker/picker-options'; export { Popover } from './components/popover/popover'; +export { PopoverCmp } from './components/popover/popover-component'; export { PopoverController } from './components/popover/popover-controller'; export { PopoverOptions } from './components/popover/popover-options'; export { RadioButton } from './components/radio/radio-button'; @@ -238,7 +86,7 @@ export { Searchbar } from './components/searchbar/searchbar'; export { Segment } from './components/segment/segment'; export { SegmentButton } from './components/segment/segment-button'; export { Select } from './components/select/select'; -export { SelectPopover } from './components/select/select-popover-component'; +export { SelectPopover, SelectPopoverOption } from './components/select/select-popover-component'; export { ShowWhen } from './components/show-hide-when/show-when'; export { DisplayWhen } from './components/show-hide-when/display-when'; export { HideWhen } from './components/show-hide-when/hide-when'; @@ -246,29 +94,31 @@ export { Slide } from './components/slides/slide'; export { Slides } from './components/slides/slides'; export { Spinner } from './components/spinner/spinner'; export { SplitPane, RootNode } from './components/split-pane/split-pane'; -export { setupCore } from './util/ionic-core'; export { Tab } from './components/tabs/tab'; export { TabButton } from './components/tabs/tab-button'; export { TabHighlight } from './components/tabs/tab-highlight'; export { Tabs } from './components/tabs/tabs'; -export { TapClick, setupTapClick, isActivatable } from './tap-click/tap-click'; export { Toast } from './components/toast/toast'; +export { ToastCmp } from './components/toast/toast-component'; export { ToastController } from './components/toast/toast-controller'; export { ToastOptions } from './components/toast/toast-options'; export { Toggle } from './components/toggle/toggle'; -export { ToolbarBase } from './components/toolbar/toolbar-base'; -export { Toolbar } from './components/toolbar/toolbar'; -export { Header } from './components/toolbar/toolbar-header'; export { Footer } from './components/toolbar/toolbar-footer'; +export { Header } from './components/toolbar/toolbar-header'; +export { Toolbar } from './components/toolbar/toolbar'; export { ToolbarItem } from './components/toolbar/toolbar-item'; -export { ToolbarTitle } from'./components/toolbar/toolbar-title'; +export { ToolbarTitle } from './components/toolbar/toolbar-title'; +export { Navbar } from './components/toolbar/navbar'; export { Thumbnail } from './components/thumbnail/thumbnail'; export { Typography } from './components/typography/typography'; +export { VirtualFooter } from './components/virtual-scroll/virtual-footer'; +export { VirtualHeader } from './components/virtual-scroll/virtual-header'; +export { VirtualItem } from './components/virtual-scroll/virtual-item'; export { VirtualScroll } from './components/virtual-scroll/virtual-scroll'; /** - * Export Providers + * Global Providers */ export { Config, setupConfig, ConfigToken } from './config/config'; export { DomController, DomCallback } from './platform/dom-controller'; @@ -280,22 +130,15 @@ export { NavController } from './navigation/nav-controller'; export { NavControllerBase } from './navigation/nav-controller-base'; export { NavParams } from './navigation/nav-params'; export { NavLink, NavOptions, DeepLinkConfig, DeepLinkMetadata, DeepLinkMetadataFactory } from './navigation/nav-util'; +export { TapClick, setupTapClick, isActivatable } from './tap-click/tap-click'; export { UrlSerializer, DeepLinkConfigToken } from './navigation/url-serializer'; export { ViewController } from './navigation/view-controller'; -export { ActionSheetCmp } from './components/action-sheet/action-sheet-component'; -export { AlertCmp } from './components/alert/alert-component'; -export { LoadingCmp } from './components/loading/loading-component'; -export { ModalCmp } from './components/modal/modal-component'; -export { PickerCmp } from './components/picker/picker-component'; -export { PickerColumnCmp } from './components/picker/picker-column'; -export { PopoverCmp } from './components/popover/popover-component'; -export { ToastCmp } from './components/toast/toast-component'; /** * Export Utils */ -export { PanGesture, PanGestureConfig } from './gestures/drag-gesture'; +export { PanGesture, PanGestureConfig } from './gestures/pan-gesture'; export { Gesture } from './gestures/gesture'; export { SlideEdgeGesture } from './gestures/slide-edge-gesture'; export { SlideData, SlideGesture } from './gestures/slide-gesture'; @@ -324,282 +167,5 @@ export { PlatformConfigToken } from './platform/platform-registry'; export { registerModeConfigs } from './config/mode-registry'; export { IonicGestureConfig } from './gestures/gesture-config'; +export { IonicModule, IonicPageModule, provideLocationStrategy } from './module'; - -/** - * @name IonicModule - * @description - * IonicModule is an [NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) that bootstraps - * an Ionic App. By passing a root component, IonicModule will make sure that all of the components, - * directives, and providers from the framework are imported. - * - * Any configuration for the app can be passed as the second argument to `forRoot`. This can be any - * valid property from the [Config](/docs/api/config/Config/). - * - * @usage - * ```ts - * import { NgModule } from '@angular/core'; - * - * import { IonicApp, IonicModule } from 'ionic-angular'; - * - * import { MyApp } from './app.component'; - * import { HomePage } from '../pages/home/home'; - * - * @NgModule({ - * declarations: [ - * MyApp, - * HomePage - * ], - * imports: [ - * BrowserModule, - * IonicModule.forRoot(MyApp, { - * - * }) - * ], - * bootstrap: [IonicApp], - * entryComponents: [ - * MyApp, - * HomePage - * ], - * providers: [] - * }) - * export class AppModule {} - * ``` - */ -@NgModule({ - imports: [ - CommonModule, - FormsModule, - ReactiveFormsModule, - - ActionSheetModule.forRoot(), - AlertModule.forRoot(), - AppModule.forRoot(), - AvatarModule.forRoot(), - BackdropModule.forRoot(), - ButtonModule.forRoot(), - CardModule.forRoot(), - CheckboxModule.forRoot(), - ChipModule.forRoot(), - ClickBlockModule.forRoot(), - ContentModule.forRoot(), - DateTimeModule.forRoot(), - FabModule.forRoot(), - GridModule.forRoot(), - IconModule.forRoot(), - ImgModule.forRoot(), - InfiniteScrollModule.forRoot(), - InputModule.forRoot(), - ItemModule.forRoot(), - LabelModule.forRoot(), - ListModule.forRoot(), - LoadingModule.forRoot(), - MenuModule.forRoot(), - ModalModule.forRoot(), - NavModule.forRoot(), - NavbarModule.forRoot(), - NoteModule.forRoot(), - OptionModule.forRoot(), - PickerModule.forRoot(), - PopoverModule.forRoot(), - RadioModule.forRoot(), - RangeModule.forRoot(), - RefresherModule.forRoot(), - ScrollModule.forRoot(), - SearchbarModule.forRoot(), - SegmentModule.forRoot(), - SelectModule.forRoot(), - ShowHideWhenModule.forRoot(), - SlidesModule.forRoot(), - SpinnerModule.forRoot(), - SplitPaneModule.forRoot(), - TabsModule.forRoot(), - ThumbnailModule.forRoot(), - ToastModule.forRoot(), - ToggleModule.forRoot(), - ToolbarModule.forRoot(), - TypographyModule.forRoot(), - VirtualScrollModule.forRoot() - ], - exports: [ - CommonModule, - FormsModule, - ReactiveFormsModule, - - ActionSheetModule, - AlertModule, - AppModule, - AvatarModule, - BackdropModule, - ButtonModule, - CardModule, - CheckboxModule, - ChipModule, - ClickBlockModule, - ContentModule, - DateTimeModule, - FabModule, - GridModule, - IconModule, - ImgModule, - InfiniteScrollModule, - InputModule, - ItemModule, - LabelModule, - ListModule, - LoadingModule, - MenuModule, - ModalModule, - NavModule, - NavbarModule, - NoteModule, - OptionModule, - PickerModule, - PopoverModule, - RadioModule, - RangeModule, - RefresherModule, - ScrollModule, - SearchbarModule, - SegmentModule, - SelectModule, - ShowHideWhenModule, - SlidesModule, - SpinnerModule, - SplitPaneModule, - TabsModule, - ThumbnailModule, - ToastModule, - ToggleModule, - ToolbarModule, - TypographyModule, - VirtualScrollModule - ], - schemas: [ - CUSTOM_ELEMENTS_SCHEMA - ] -}) -export class IonicModule { - - /** - * Set the root app component for you IonicModule - * @param {any} appRoot The root AppComponent for this app. - * @param {any} config Config Options for the app. Accepts any config property. - * @param {any} deepLinkConfig Any configuration needed for the Ionic Deeplinker. - */ - static forRoot(appRoot: any, config: any = null, deepLinkConfig: DeepLinkConfig = null): ModuleWithProviders { - return { - ngModule: IonicModule, - providers: [ - // useValue: bootstrap values - { provide: AppRootToken, useValue: appRoot }, - { provide: ConfigToken, useValue: config }, - { provide: DeepLinkConfigToken, useValue: deepLinkConfig }, - { provide: APP_BASE_HREF, useValue: '/'}, - - // useFactory: user values - { provide: PlatformConfigToken, useFactory: providePlatformConfigs }, - - // useFactory: ionic core providers - { provide: Platform, useFactory: setupPlatform, deps: [ DOCUMENT, PlatformConfigToken, NgZone ] }, - { provide: Config, useFactory: setupConfig, deps: [ ConfigToken, Platform ] }, - - // useFactory: ionic app initializers - { provide: APP_INITIALIZER, useFactory: registerModeConfigs, deps: [ Config ], multi: true }, - { provide: APP_INITIALIZER, useFactory: setupProvideEvents, deps: [ Platform, DomController ], multi: true }, - { provide: APP_INITIALIZER, useFactory: setupTapClick, deps: [ Config, Platform, DomController, App, NgZone, GestureController ], multi: true }, - { provide: APP_INITIALIZER, useFactory: setupPreloading, deps: [ Config, DeepLinkConfigToken, ModuleLoader, NgZone ], multi: true }, - { provide: APP_INITIALIZER, useFactory: setupCore, deps: [ Config, Platform, DomController, NgZone ], multi: true }, - - // useClass - // { provide: HAMMER_GESTURE_CONFIG, useClass: IonicGestureConfig }, - - // useValue - { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: appRoot, multi: true }, - - // ionic providers - ActionSheetController, - AlertController, - App, - DomController, - Events, - Form, - GestureController, - Haptic, - Keyboard, - LoadingController, - Location, - MenuController, - ModalController, - PickerController, - PopoverController, - NgModuleLoader, - TapClick, - ToastController, - TransitionController, - - { provide: ModuleLoader, useFactory: provideModuleLoader, deps: [NgModuleLoader, Injector]}, - { provide: LocationStrategy, useFactory: provideLocationStrategy, deps: [ PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], Config ] }, - { provide: UrlSerializer, useFactory: setupUrlSerializer, deps: [ DeepLinkConfigToken ] }, - { provide: DeepLinker, useFactory: setupDeepLinker, deps: [ App, UrlSerializer, Location, ModuleLoader, ComponentFactoryResolver ] }, - ] - }; - } -} - - -/** - * @name IonicPageModule - * @description - * IonicPageModule is an [NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) that - * bootstraps a child [IonicPage](../navigation/IonicPage/) in order to set up routing. - * - * @usage - * ```ts - * import { NgModule } from '@angular/core'; - * - * import { IonicPageModule } from 'ionic-angular'; - * - * import { HomePage } from './home'; - * - * @NgModule({ - * declarations: [ - * HomePage - * ], - * imports: [ - * IonicPageModule.forChild(HomePage) - * ], - * entryComponents: [ - * HomePage - * ] - * }) - * export class HomePageModule { } - * ``` - */ -@NgModule({ - imports: [IonicModule], - exports: [IonicModule] -}) -export class IonicPageModule { - - static forChild(page: any): ModuleWithProviders { - return { - ngModule: IonicPageModule, - providers: [ - { provide: LAZY_LOADED_TOKEN, useValue: page }, - { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: page, multi: true }, - ] - }; - } - -} - -/** - * @hidden - */ -export function provideLocationStrategy(platformLocationStrategy: PlatformLocation, - baseHref: string, config: Config) { - return config.get('locationStrategy') === 'path' ? - new PathLocationStrategy(platformLocationStrategy, baseHref) : - new HashLocationStrategy(platformLocationStrategy, baseHref); -} diff --git a/src/module.ts b/src/module.ts new file mode 100644 index 0000000000..b210ade49c --- /dev/null +++ b/src/module.ts @@ -0,0 +1,516 @@ +/** + * Import Angular + */ +import { ANALYZE_FOR_ENTRY_COMPONENTS, APP_INITIALIZER, ComponentFactoryResolver, Inject, Injector, ModuleWithProviders, NgModule, NgZone, Optional } from '@angular/core'; +import { APP_BASE_HREF, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, PlatformLocation } from '@angular/common'; +import { DOCUMENT, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { CommonModule } from '@angular/common'; + +/** + * Import Other + */ +import { DeepLinkConfig } from './navigation/nav-util'; + +/** + * Global Providers + */ + +import { App } from './components/app/app'; +import { AppRootToken } from './components/app/app-root'; +import { Config, setupConfig, ConfigToken } from './config/config'; +import { DeepLinker, setupDeepLinker } from './navigation/deep-linker'; +import { DomController } from './platform/dom-controller'; +import { Events, setupProvideEvents } from './util/events'; +import { Form } from './util/form'; +import { GestureController } from './gestures/gesture-controller'; +import { IonicGestureConfig } from './gestures/gesture-config'; +import { Haptic } from './tap-click/haptic'; +import { Keyboard } from './platform/keyboard'; +import { ModuleLoader, provideModuleLoader, setupPreloading, LAZY_LOADED_TOKEN } from './util/module-loader'; +import { NgModuleLoader } from './util/ng-module-loader'; +import { Platform, setupPlatform } from './platform/platform'; +import { PlatformConfigToken, providePlatformConfigs } from './platform/platform-registry'; +import { TapClick, setupTapClick } from './tap-click/tap-click'; +import { registerModeConfigs } from './config/mode-registry'; +import { TransitionController } from './transitions/transition-controller'; +import { UrlSerializer, setupUrlSerializer, DeepLinkConfigToken } from './navigation/url-serializer'; + +/** + * Import Components/Directives/Etc + */ + +import { ActionSheetCmp } from './components/action-sheet/action-sheet-component'; +import { ActionSheetController } from './components/action-sheet/action-sheet-controller'; +import { AlertCmp } from './components/alert/alert-component'; +import { AlertController } from './components/alert/alert-controller'; +import { ClickBlock } from './components/app/click-block'; +import { IonicApp } from './components/app/app-root'; +import { OverlayPortal } from './components/app/overlay-portal'; +import { Avatar } from './components/avatar/avatar'; +import { Backdrop } from './components/backdrop/backdrop'; +import { Badge } from './components/badge/badge'; +import { Button } from './components/button/button'; +import { Card } from './components/card/card'; +import { CardContent } from './components/card/card-content'; +import { CardHeader } from './components/card/card-header'; +import { CardTitle } from './components/card/card-title'; +import { Checkbox } from './components/checkbox/checkbox'; +import { Chip } from './components/chip/chip'; +import { Content } from './components/content/content'; +import { DateTime } from './components/datetime/datetime'; +import { FabButton } from './components/fab/fab'; +import { FabContainer } from './components/fab/fab-container'; +import { FabList } from './components/fab/fab-list'; +import { Col } from './components/grid/col'; +import { Grid } from './components/grid/grid'; +import { Row } from './components/grid/row'; +import { Icon } from './components/icon/icon'; +import { Img } from './components/img/img'; +import { InfiniteScroll } from './components/infinite-scroll/infinite-scroll'; +import { InfiniteScrollContent } from './components/infinite-scroll/infinite-scroll-content'; +import { NativeInput } from './components/input/native-input'; +import { NextInput } from './components/input/next-input'; +import { TextInput } from './components/input/input'; +import { Item } from './components/item/item'; +import { ItemContent } from './components/item/item-content'; +import { ItemDivider } from './components/item/item-divider'; +import { ItemGroup } from './components/item/item-group'; +import { ItemOptions } from './components/item/item-options'; +import { ItemReorder } from './components/item/item-reorder'; +import { ItemSliding } from './components/item/item-sliding'; +import { Reorder } from './components/item/reorder'; +import { Label } from './components/label/label'; +import { List } from './components/list/list'; +import { ListHeader } from './components/list/list-header'; +import { LoadingCmp } from './components/loading/loading-component'; +import { LoadingController } from './components/loading/loading-controller'; +import { Menu } from './components/menu/menu'; +import { MenuClose } from './components/menu/menu-close'; +import { MenuController } from './components/app/menu-controller'; +import { MenuToggle } from './components/menu/menu-toggle'; +import { ModalCmp } from './components/modal/modal-component'; +import { ModalController } from './components/modal/modal-controller'; +import { Nav } from './components/nav/nav'; +import { NavPop } from './components/nav/nav-pop'; +import { NavPopAnchor } from './components/nav/nav-pop-anchor'; +import { NavPush } from './components/nav/nav-push'; +import { NavPushAnchor } from './components/nav/nav-push-anchor'; +import { Note } from './components/note/note'; +import { Option } from './components/option/option'; +import { PickerCmp } from './components/picker/picker-component'; +import { PickerColumnCmp } from './components/picker/picker-column'; +import { PickerController } from './components/picker/picker-controller'; +import { PopoverCmp } from './components/popover/popover-component'; +import { PopoverController } from './components/popover/popover-controller'; +import { RadioButton } from './components/radio/radio-button'; +import { RadioGroup } from './components/radio/radio-group'; +import { Range } from './components/range/range'; +import { RangeKnob } from './components/range/range-knob'; +import { Refresher } from './components/refresher/refresher'; +import { RefresherContent } from './components/refresher/refresher-content'; +import { Scroll } from './components/scroll/scroll'; +import { Searchbar } from './components/searchbar/searchbar'; +import { Segment } from './components/segment/segment'; +import { Select } from './components/select/select'; +import { SelectPopover } from './components/select/select-popover-component'; +import { SegmentButton } from './components/segment/segment-button'; +import { ShowWhen } from './components/show-hide-when/show-when'; +import { HideWhen } from './components/show-hide-when/hide-when'; +import { Slide } from './components/slides/slide'; +import { Slides } from './components/slides/slides'; +import { Spinner } from './components/spinner/spinner'; +import { SplitPane } from './components/split-pane/split-pane'; +import { Tab } from './components/tabs/tab'; +import { TabButton } from './components/tabs/tab-button'; +import { TabHighlight } from './components/tabs/tab-highlight'; +import { Tabs } from './components/tabs/tabs'; +import { Thumbnail } from './components/thumbnail/thumbnail'; +import { ToastCmp } from './components/toast/toast-component'; +import { ToastController } from './components/toast/toast-controller'; +import { Toggle } from './components/toggle/toggle'; +import { Footer } from './components/toolbar/toolbar-footer'; +import { Header } from './components/toolbar/toolbar-header'; +import { Toolbar } from './components/toolbar/toolbar'; +import { ToolbarItem } from './components/toolbar/toolbar-item'; +import { ToolbarTitle } from './components/toolbar/toolbar-title'; +import { Navbar } from './components/toolbar/navbar'; +import { Typography } from './components/typography/typography'; +import { VirtualFooter } from './components/virtual-scroll/virtual-footer'; +import { VirtualHeader } from './components/virtual-scroll/virtual-header'; +import { VirtualItem } from './components/virtual-scroll/virtual-item'; +import { VirtualScroll } from './components/virtual-scroll/virtual-scroll'; + +/** + * @name IonicModule + * @description + * IonicModule is an [NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) that bootstraps + * an Ionic App. By passing a root component, IonicModule will make sure that all of the components, + * directives, and providers from the framework are imported. + * + * Any configuration for the app can be passed as the second argument to `forRoot`. This can be any + * valid property from the [Config](/docs/api/config/Config/). + * + * @usage + * ```ts + * import { NgModule } from '@angular/core'; + * + * import { IonicApp, IonicModule } from 'ionic-angular'; + * + * import { MyApp } from './app.component'; + * import { HomePage } from '../pages/home/home'; + * + * @NgModule({ + * declarations: [ + * MyApp, + * HomePage + * ], + * imports: [ + * BrowserModule, + * IonicModule.forRoot(MyApp, { + * + * }) + * ], + * bootstrap: [IonicApp], + * entryComponents: [ + * MyApp, + * HomePage + * ], + * providers: [] + * }) + * export class AppModule {} + * ``` + */ +@NgModule({ + declarations: [ + ActionSheetCmp, + AlertCmp, + ClickBlock, + IonicApp, + OverlayPortal, + Avatar, + Backdrop, + Badge, + Button, + Card, + CardContent, + CardHeader, + CardTitle, + Checkbox, + Chip, + Col, + Content, + DateTime, + FabButton, + FabContainer, + FabList, + Grid, + Img, + Icon, + InfiniteScroll, + InfiniteScrollContent, + Item, + ItemContent, + ItemDivider, + ItemGroup, + ItemOptions, + ItemReorder, + ItemSliding, + Label, + List, + ListHeader, + Reorder, + LoadingCmp, + NativeInput, + NextInput, + Menu, + MenuClose, + MenuToggle, + ModalCmp, + Nav, + NavPop, + NavPopAnchor, + NavPush, + NavPushAnchor, + Note, + Option, + PickerCmp, + PickerColumnCmp, + PopoverCmp, + RadioButton, + RadioGroup, + Range, + RangeKnob, + Refresher, + RefresherContent, + Row, + Scroll, + Searchbar, + Segment, + SegmentButton, + Select, + SelectPopover, + ShowWhen, + HideWhen, + Slide, + Slides, + Spinner, + SplitPane, + Tab, + TabButton, + TabHighlight, + Tabs, + TextInput, + Thumbnail, + ToastCmp, + Toggle, + Footer, + Header, + Toolbar, + ToolbarItem, + ToolbarTitle, + Navbar, + Typography, + VirtualFooter, + VirtualHeader, + VirtualItem, + VirtualScroll + ], + imports: [ + CommonModule, + FormsModule, + ReactiveFormsModule, + ], + exports: [ + CommonModule, + FormsModule, + ReactiveFormsModule, + + ActionSheetCmp, + AlertCmp, + ClickBlock, + IonicApp, + OverlayPortal, + Avatar, + Backdrop, + Badge, + Button, + Card, + CardContent, + CardHeader, + CardTitle, + Checkbox, + Chip, + Col, + Content, + DateTime, + FabButton, + FabContainer, + FabList, + Grid, + Img, + Icon, + InfiniteScroll, + InfiniteScrollContent, + Item, + ItemContent, + ItemDivider, + ItemGroup, + ItemOptions, + ItemReorder, + ItemSliding, + Label, + List, + ListHeader, + Reorder, + LoadingCmp, + NativeInput, + NextInput, + Menu, + MenuClose, + MenuToggle, + ModalCmp, + Nav, + NavPop, + NavPopAnchor, + NavPush, + NavPushAnchor, + Note, + Option, + PickerCmp, + PickerColumnCmp, + PopoverCmp, + RadioButton, + RadioGroup, + Range, + RangeKnob, + Refresher, + RefresherContent, + Row, + Scroll, + Searchbar, + Segment, + SegmentButton, + Select, + SelectPopover, + ShowWhen, + HideWhen, + Slide, + Slides, + Spinner, + SplitPane, + Tab, + TabButton, + TabHighlight, + Tabs, + TextInput, + Thumbnail, + ToastCmp, + Toggle, + Footer, + Header, + Toolbar, + ToolbarItem, + ToolbarTitle, + Navbar, + Typography, + VirtualFooter, + VirtualHeader, + VirtualItem, + VirtualScroll + ], + entryComponents: [ + ActionSheetCmp, + AlertCmp, + IonicApp, + LoadingCmp, + ModalCmp, + PickerCmp, + PopoverCmp, + SelectPopover, + ToastCmp + ] +}) +export class IonicModule { + + /** + * Set the root app component for you IonicModule + * @param {any} appRoot The root AppComponent for this app. + * @param {any} config Config Options for the app. Accepts any config property. + * @param {any} deepLinkConfig Any configuration needed for the Ionic Deeplinker. + */ + static forRoot(appRoot: any, config: any = null, deepLinkConfig: DeepLinkConfig = null): ModuleWithProviders { + return { + ngModule: IonicModule, + providers: [ + // useValue: bootstrap values + { provide: AppRootToken, useValue: appRoot }, + { provide: ConfigToken, useValue: config }, + { provide: DeepLinkConfigToken, useValue: deepLinkConfig }, + { provide: APP_BASE_HREF, useValue: '/'}, + + // useFactory: user values + { provide: PlatformConfigToken, useFactory: providePlatformConfigs }, + + // useFactory: ionic core providers + { provide: Platform, useFactory: setupPlatform, deps: [ DOCUMENT, PlatformConfigToken, NgZone ] }, + { provide: Config, useFactory: setupConfig, deps: [ ConfigToken, Platform ] }, + + // useFactory: ionic app initializers + { provide: APP_INITIALIZER, useFactory: registerModeConfigs, deps: [ Config ], multi: true }, + { provide: APP_INITIALIZER, useFactory: setupProvideEvents, deps: [ Platform, DomController ], multi: true }, + { provide: APP_INITIALIZER, useFactory: setupTapClick, deps: [ Config, Platform, DomController, App, NgZone, GestureController ], multi: true }, + { provide: APP_INITIALIZER, useFactory: setupPreloading, deps: [ Config, DeepLinkConfigToken, ModuleLoader, NgZone ], multi: true }, + + // useClass + { provide: HAMMER_GESTURE_CONFIG, useClass: IonicGestureConfig }, + + // useValue + { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: appRoot, multi: true }, + + // ionic providers + ActionSheetController, + AlertController, + App, + DomController, + Events, + Form, + GestureController, + Haptic, + Keyboard, + LoadingController, + Location, + MenuController, + ModalController, + NgModuleLoader, + PickerController, + PopoverController, + TapClick, + ToastController, + TransitionController, + + { provide: ModuleLoader, useFactory: provideModuleLoader, deps: [NgModuleLoader, Injector]}, + { provide: LocationStrategy, useFactory: provideLocationStrategy, deps: [ PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], Config ] }, + { provide: UrlSerializer, useFactory: setupUrlSerializer, deps: [ DeepLinkConfigToken ] }, + { provide: DeepLinker, useFactory: setupDeepLinker, deps: [ App, UrlSerializer, Location, ModuleLoader, ComponentFactoryResolver ] }, + ] + }; + } +} + + +/** + * @name IonicPageModule + * @description + * IonicPageModule is an [NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) that + * bootstraps a child [IonicPage](../navigation/IonicPage/) in order to set up routing. + * + * @usage + * ```ts + * import { NgModule } from '@angular/core'; + * + * import { IonicPageModule } from 'ionic-angular'; + * + * import { HomePage } from './home'; + * + * @NgModule({ + * declarations: [ + * HomePage + * ], + * imports: [ + * IonicPageModule.forChild(HomePage) + * ], + * entryComponents: [ + * HomePage + * ] + * }) + * export class HomePageModule { } + * ``` + */ +@NgModule({ + imports: [IonicModule], + exports: [IonicModule] +}) +export class IonicPageModule { + + static forChild(page: any): ModuleWithProviders { + return { + ngModule: IonicPageModule, + providers: [ + { provide: LAZY_LOADED_TOKEN, useValue: page }, + { provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: page, multi: true }, + ] + }; + } + +} + +/** + * @hidden + */ +export function provideLocationStrategy(platformLocationStrategy: PlatformLocation, + baseHref: string, config: Config) { + return config.get('locationStrategy') === 'path' ? + new PathLocationStrategy(platformLocationStrategy, baseHref) : + new HashLocationStrategy(platformLocationStrategy, baseHref); +} diff --git a/src/navigation/deep-linker.ts b/src/navigation/deep-linker.ts index 486f779bd6..a4d57d5860 100644 --- a/src/navigation/deep-linker.ts +++ b/src/navigation/deep-linker.ts @@ -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 =