chore(): update dependencies

This commit is contained in:
Manu Mtz.-Almeida
2018-08-01 18:32:20 +02:00
parent 76b780f5d8
commit 4fcab89651
14 changed files with 64 additions and 60 deletions

View File

@ -29,6 +29,7 @@
"clean": "node scripts/clean.js",
"clean-generated": "node ./scripts/clean-generated.js",
"lint": "tslint --project .",
"lint.fix": "tslint --project . --fix",
"prerelease": "npm run validate && np prerelease --yolo --any-branch --tag next",
"test": "echo 'angular no tests yet'",
"tsc": "tsc -p .",

View File

@ -10,9 +10,9 @@ import { bindLifecycleEvents } from '../../providers/angular-delegate';
})
export class IonRouterOutlet implements OnDestroy, OnInit {
private activated: ComponentRef<any>|null = null;
private activated: ComponentRef<any> | null = null;
private _activatedRoute: ActivatedRoute|null = null;
private _activatedRoute: ActivatedRoute | null = null;
private name: string;
private stackCtrl: StackController;
@ -64,7 +64,7 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
get isActivated(): boolean { return !!this.activated; }
get component(): Object {
get component(): object {
if (!this.activated) {
throw new Error('Outlet is not activated');
}
@ -78,7 +78,7 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
return this._activatedRoute as ActivatedRoute;
}
get activatedRouteData() {
get activatedRouteData(): any {
if (this._activatedRoute) {
return this._activatedRoute.snapshot.data;
}
@ -117,7 +117,7 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
}
}
async activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver|null) {
async activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver | null) {
if (this.isActivated) {
throw new Error('Cannot activate an already activated outlet');
}
@ -128,7 +128,7 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
this.activated = enteringView.ref;
} else {
const snapshot = (activatedRoute as any)._futureSnapshot;
const component = <any>snapshot.routeConfig !.component;
const component = snapshot.routeConfig!.component as any;
resolver = resolver || this.resolver;
const factory = resolver.resolveComponentFactory(component);
@ -145,7 +145,7 @@ export class IonRouterOutlet implements OnDestroy, OnInit {
enteringView = this.stackCtrl.createView(this.activated, activatedRoute);
}
const {direction, animated} = this.navCtrl.consumeTransition();
const { direction, animated } = this.navCtrl.consumeTransition();
await this.stackCtrl.setActive(enteringView, direction, animated);
this.activateEvents.emit(this.activated.instance);
@ -185,6 +185,7 @@ class OutletInjector implements Injector {
return this.childContexts;
}
// tslint:disable-next-line
return this.parent.get(token, notFoundValue);
}
}

View File

@ -1,5 +1,4 @@
/**
* @name NavParams
* @description
* NavParams are an object that exists on a page and can contain data for that particular view.
* Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
@ -37,7 +36,7 @@ export class NavParams {
* }
* ```
*
* @param {string} param Which param you want to look up
* @param param Which param you want to look up
*/
get(param: string): any {
return this.data[param];

View File

@ -56,7 +56,7 @@ export class StackController {
}
// stack setRoot
if (direction === 0) {
if (direction === 0) {
this.views = [enteringView];
return;
}

View File

@ -4,7 +4,7 @@ import { VirtualContext } from './virtual-utils';
/**
* @hidden
*/
@Directive({selector: '[virtualFooter]'})
@Directive({ selector: '[virtualFooter]' })
export class VirtualFooter {
constructor(public templateRef: TemplateRef<VirtualContext>) {}
}

View File

@ -4,7 +4,7 @@ import { VirtualContext } from './virtual-utils';
/**
* @hidden
*/
@Directive({selector: '[virtualHeader]'})
@Directive({ selector: '[virtualHeader]' })
export class VirtualHeader {
constructor(public templateRef: TemplateRef<VirtualContext>) {}
}

View File

@ -4,7 +4,7 @@ import { VirtualContext } from './virtual-utils';
/**
* @hidden
*/
@Directive({selector: '[virtualItem]'})
@Directive({ selector: '[virtualItem]' })
export class VirtualItem {
constructor(public templateRef: TemplateRef<VirtualContext>, public viewContainer: ViewContainerRef) {}
}

View File

@ -41,15 +41,15 @@ export class VirtualScroll {
]);
}
private nodeRender(el: HTMLElement|null, cell: any, index: number) {
private nodeRender(el: HTMLElement | null, cell: any, index: number) {
if (!el) {
const node = this.itmTmp.viewContainer.createEmbeddedView(
const view = this.itmTmp.viewContainer.createEmbeddedView(
this.getComponent(cell.type),
{ $implicit: null, index },
index
);
el = getElement(node);
(el as any)['$ionView'] = node;
el = getElement(view);
(el as any)['$ionView'] = view;
}
const node = (el as any)['$ionView'];
const ctx = node.context as VirtualContext;

View File

@ -68,7 +68,10 @@ export function attachView(
container: any, component: any, params: any, cssClasses: string[] | undefined
) {
const factory = resolver.resolveComponentFactory(component);
const childInjector = Injector.create(getProviders(params), injector);
const childInjector = Injector.create({
providers: getProviders(params),
parent: injector
});
const componentRef = (location)
? location.createComponent(factory, location.length, childInjector)
: factory.create(childInjector);

View File

@ -24,4 +24,4 @@ function getQueue() {
};
}
export type RafCallback = { (timeStamp?: number): void };
export type RafCallback = (timeStamp?: number) => void;

View File

@ -1,17 +1,18 @@
import { Injectable } from '@angular/core';
export type EventHandler = (...args: any[]) => any;
@Injectable()
export class Events {
private c = new Map<string, Function[]>();
private c = new Map<string, EventHandler[]>();
/**
* Subscribe to an event topic. Events that get posted to that topic will trigger the provided handler.
*
* @param {string} topic the topic to subscribe to
* @param {function} handler the event handler
* @param topic the topic to subscribe to
* @param handler the event handler
*/
subscribe(topic: string, ...handlers: Function[]) {
subscribe(topic: string, ...handlers: EventHandler[]) {
let topics = this.c.get(topic);
if (!topics) {
this.c.set(topic, topics = []);
@ -22,12 +23,12 @@ export class Events {
/**
* Unsubscribe from the given topic. Your handler will no longer receive events published to this topic.
*
* @param {string} topic the topic to unsubscribe from
* @param {function} handler the event handler
* @param topic the topic to unsubscribe from
* @param handler the event handler
*
* @return true if a handler was removed
*/
unsubscribe(topic: string, handler?: Function): boolean {
unsubscribe(topic: string, handler?: EventHandler): boolean {
if (!handler) {
return this.c.delete(topic);
}
@ -54,8 +55,8 @@ export class Events {
/**
* Publish an event to the given topic.
*
* @param {string} topic the topic to publish to
* @param {any} eventData the data to send as the event
* @param topic the topic to publish to
* @param eventData the data to send as the event
*/
publish(topic: string, ...args: any[]): any[] | null {
const topics = this.c.get(topic);
@ -88,7 +89,7 @@ export function setupEvents() {
export function setupProvideEvents() {
return function() {
return () => {
return setupEvents();
};
}

View File

@ -7,8 +7,8 @@ export class MenuController {
/**
* Programatically open the Menu.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Promise} returns a promise when the menu is fully opened
* @param [menuId] Optionally get the menu by its id, or side.
* @return returns a promise when the menu is fully opened
*/
open(menuId?: string): Promise<boolean> {
return proxyMethod(CTRL, 'open', menuId);
@ -19,8 +19,8 @@ export class MenuController {
* Programatically close the Menu. If no `menuId` is given as the first
* argument then it'll close any menu which is open. If a `menuId`
* is given then it'll close that exact menu.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Promise} returns a promise when the menu is fully closed
* @param [menuId] Optionally get the menu by its id, or side.
* @return returns a promise when the menu is fully closed
*/
close(menuId?: string): Promise<boolean> {
return proxyMethod(CTRL, 'close', menuId);
@ -29,8 +29,8 @@ export class MenuController {
/**
* Toggle the menu. If it's closed, it will open, and if opened, it
* will close.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Promise} returns a promise when the menu has been toggled
* @param [menuId] Optionally get the menu by its id, or side.
* @return returns a promise when the menu has been toggled
*/
toggle(menuId?: string): Promise<boolean> {
return proxyMethod(CTRL, 'toggle', menuId);
@ -41,8 +41,8 @@ export class MenuController {
* left menus, but only one of them should be able to be opened at the same
* time. If there are multiple menus on the same side, then enabling one menu
* will also automatically disable all the others that are on the same side.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {HTMLIonMenuElement} Returns the instance of the menu, which is useful for chaining.
* @param [menuId] Optionally get the menu by its id, or side.
* @return Returns the instance of the menu, which is useful for chaining.
*/
enable(shouldEnable: boolean, menuId?: string): Promise<HTMLIonMenuElement> {
return proxyMethod(CTRL, 'enable', shouldEnable, menuId);
@ -50,17 +50,17 @@ export class MenuController {
/**
* Used to enable or disable the ability to swipe open the menu.
* @param {boolean} shouldEnable True if it should be swipe-able, false if not.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {HTMLIonMenuElement} Returns the instance of the menu, which is useful for chaining.
* @param shouldEnable True if it should be swipe-able, false if not.
* @param [menuId] Optionally get the menu by its id, or side.
* @return Returns the instance of the menu, which is useful for chaining.
*/
swipeEnable(shouldEnable: boolean, menuId?: string): Promise<HTMLIonMenuElement> {
return proxyMethod(CTRL, 'swipeEnable', shouldEnable, menuId);
}
/**
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {boolean} Returns true if the specified menu is currently open, otherwise false.
* @param [menuId] Optionally get the menu by its id, or side.
* @return Returns true if the specified menu is currently open, otherwise false.
* If the menuId is not specified, it returns true if ANY menu is currenly open.
*/
isOpen(menuId?: string): Promise<boolean> {
@ -68,8 +68,8 @@ export class MenuController {
}
/**
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {boolean} Returns true if the menu is currently enabled, otherwise false.
* @param [menuId] Optionally get the menu by its id, or side.
* @return Returns true if the menu is currently enabled, otherwise false.
*/
isEnabled(menuId?: string): Promise<boolean> {
return proxyMethod(CTRL, 'isEnabled', menuId);
@ -81,22 +81,22 @@ export class MenuController {
* it'll return the enabled menu on that side. Otherwise, if a `menuId` is
* provided, then it'll try to find the menu using the menu's `id`
* property. If a menu is not found then it'll return `null`.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {HTMLIonMenuElement} Returns the instance of the menu if found, otherwise `null`.
* @param [menuId] Optionally get the menu by its id, or side.
* @return Returns the instance of the menu if found, otherwise `null`.
*/
get(menuId?: string): Promise<HTMLIonMenuElement> {
return proxyMethod(CTRL, 'get', menuId);
}
/**
* @return {Menu} Returns the instance of the menu already opened, otherwise `null`.
* @return Returns the instance of the menu already opened, otherwise `null`.
*/
getOpen(): Promise<HTMLIonMenuElement> {
return proxyMethod(CTRL, 'getOpen');
}
/**
* @return {Array<HTMLIonMenuElement>} Returns an array of all menu instances.
* @return Returns an array of all menu instances.
*/
getMenus(): Promise<HTMLIonMenuElement[]> {
return proxyMethod(CTRL, 'getMenus');

View File

@ -43,18 +43,18 @@ export class Platform {
proxyEvent(this.resize, document, 'resize');
let readyResolve: (value: string) => void;
this._readyPromise = new Promise(res => { readyResolve = res; } );
this._readyPromise = new Promise(res => { readyResolve = res; });
if ((window as any)['cordova']) {
document.addEventListener('deviceready', () => {
readyResolve('cordova');
}, {once: true});
}, { once: true });
} else {
readyResolve!('dom');
}
}
/**
* @returns {boolean} returns true/false based on platform.
* @returns returns true/false based on platform.
* @description
* Depending on the platform the user is on, `is(platformName)` will
* return `true` or `false`. Note that the same app can return `true`
@ -93,15 +93,14 @@ export class Platform {
* | windows | on a device running Windows. |
* | electron | in Electron on a desktop device. |
*
* @param {string} platformName
*/
is(platformName: string): boolean {
return this._platforms.some(p => p.name === platformName);
}
/**
* @param {Window} win the window object
* @param {PlatformConfig[]} platforms an array of platforms (platform configs)
* @param win the window object
* @param platforms an array of platforms (platform configs)
* to get the appropriate platforms according to the configs provided.
* @description
* Detects the platforms using window and the platforms config provided.
@ -112,7 +111,7 @@ export class Platform {
}
/**
* @returns {array} the array of platforms
* @returns the array of platforms
* @description
* Depending on what device you are on, `platforms` can return multiple values.
* Each possible value is a hierarchy of platforms. For example, on an iPhone,
@ -150,7 +149,7 @@ export class Platform {
* }
* ```
*
* @returns {object} An object containing all of the platforms and their versions.
* @returns An object containing all of the platforms and their versions.
*/
versions(): PlatformConfig[] {
return this._platforms.slice();

View File

@ -1,12 +1,12 @@
export interface IonicGlobal {
config?: any;
ael?: (elm: any, eventName: string, cb: Function, opts: any) => void;
raf?: Function;
rel?: (elm: any, eventName: string, cb: Function, opts: any) => void;
ael?: (elm: any, eventName: string, cb: (ev: Event) => void, opts: any) => void;
raf?: (ts: number) => void;
rel?: (elm: any, eventName: string, cb: (ev: Event) => void, opts: any) => void;
}
export interface IonicWindow extends Window {
Ionic: IonicGlobal;
__zone_symbol__requestAnimationFrame: Function;
__zone_symbol__requestAnimationFrame: (ts: number) => void;
}