mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(angular): update to angular 2.0.0-rc.1
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {ViewChild, ElementRef} from 'angular2/core';
|
||||
import {ViewChild, ElementRef} from '@angular/core';
|
||||
import {App, Page} from '../../../../../ionic';
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ViewEncapsulation} from 'angular2/core';
|
||||
import {ViewEncapsulation} from '@angular/core';
|
||||
import {App, Page} from '../../../../../ionic';
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ViewEncapsulation} from 'angular2/core';
|
||||
import {ViewEncapsulation} from '@angular/core';
|
||||
import {App, Page} from '../../../../../ionic';
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Directive, TemplateRef, ViewContainerRef} from 'angular2/core';
|
||||
import {Directive, TemplateRef, ViewContainerRef} from '@angular/core';
|
||||
|
||||
|
||||
/**
|
||||
@@ -6,7 +6,7 @@ import {Directive, TemplateRef, ViewContainerRef} from 'angular2/core';
|
||||
*/
|
||||
@Directive({selector: '[virtualHeader]'})
|
||||
export class VirtualHeader {
|
||||
constructor(public templateRef: TemplateRef) {}
|
||||
constructor(public templateRef: TemplateRef<Object>) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export class VirtualHeader {
|
||||
*/
|
||||
@Directive({selector: '[virtualFooter]'})
|
||||
export class VirtualFooter {
|
||||
constructor(public templateRef: TemplateRef) {}
|
||||
constructor(public templateRef: TemplateRef<Object>) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ export class VirtualFooter {
|
||||
*/
|
||||
@Directive({selector: '[virtualItem]'})
|
||||
export class VirtualItem {
|
||||
constructor(public templateRef: TemplateRef, public viewContainer: ViewContainerRef) {}
|
||||
constructor(public templateRef: TemplateRef<Object>, public viewContainer: ViewContainerRef) {}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Directive, ContentChild, ContentChildren, QueryList, IterableDiffers, IterableDiffer, TrackByFn, Input, Optional, Renderer, ElementRef, ChangeDetectorRef, NgZone, TemplateRef, ViewContainerRef, DoCheck, AfterContentInit, OnDestroy} from 'angular2/core';
|
||||
import {Directive, ContentChild, ContentChildren, QueryList, IterableDiffers, IterableDiffer, TrackByFn, Input, Optional, Renderer, ElementRef, ChangeDetectorRef, NgZone, TemplateRef, ViewContainerRef, DoCheck, AfterContentInit, OnDestroy} from '@angular/core';
|
||||
|
||||
import {Config} from '../../config/config';
|
||||
import {Content} from '../content/content';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Directive, Input, ViewContainerRef, TemplateRef, EmbeddedViewRef} from 'angular2/core';
|
||||
import {Directive, Input, ViewContainerRef, TemplateRef, EmbeddedViewRef, } from '@angular/core';
|
||||
|
||||
import {CSS} from '../../util/dom';
|
||||
|
||||
@@ -129,7 +129,7 @@ function addCell(previousCell: VirtualCell, recordIndex: number, tmpl: number, t
|
||||
*/
|
||||
export function populateNodeData(startCellIndex: number, endCellIndex: number, viewportWidth: number, scrollingDown: boolean,
|
||||
cells: VirtualCell[], records: any[], nodes: VirtualNode[], viewContainer: ViewContainerRef,
|
||||
itmTmp: TemplateRef, hdrTmp: TemplateRef, ftrTmp: TemplateRef,
|
||||
itmTmp: TemplateRef<Object>, hdrTmp: TemplateRef<Object>, ftrTmp: TemplateRef<Object>,
|
||||
initialLoad: boolean): boolean {
|
||||
let madeChanges = false;
|
||||
let node: VirtualNode;
|
||||
@@ -218,10 +218,11 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v
|
||||
|
||||
availableNode = {
|
||||
tmpl: cell.tmpl,
|
||||
view: viewContainer.createEmbeddedView(
|
||||
view: <EmbeddedViewRef<VirtualContext>>viewContainer.createEmbeddedView(
|
||||
cell.tmpl === TEMPLATE_HEADER ? hdrTmp :
|
||||
cell.tmpl === TEMPLATE_FOOTER ? ftrTmp :
|
||||
itmTmp,
|
||||
new VirtualContext(null, null, null),
|
||||
viewInsertIndex
|
||||
)
|
||||
};
|
||||
@@ -236,10 +237,10 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v
|
||||
availableNode.cell = cellIndex;
|
||||
|
||||
// apply the cell's data to this node
|
||||
availableNode.view.setLocal('\$implicit', cell.data || records[cell.record]);
|
||||
availableNode.view.setLocal('index', cellIndex);
|
||||
availableNode.view.setLocal('even', (cellIndex % 2 === 0));
|
||||
availableNode.view.setLocal('odd', (cellIndex % 2 === 1));
|
||||
availableNode.view.context.$implicit = cell.data || records[cell.record];
|
||||
availableNode.view.context.index = cellIndex;
|
||||
availableNode.view.context.even = (cellIndex % 2 === 0);
|
||||
availableNode.view.context.odd = (cellIndex % 2 === 1);
|
||||
availableNode.hasChanges = true;
|
||||
availableNode.lastTransform = null;
|
||||
madeChanges = true;
|
||||
@@ -257,15 +258,15 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v
|
||||
|
||||
|
||||
function addLastNodes(nodes: VirtualNode[], viewContainer: ViewContainerRef,
|
||||
templateType: number, templateRef: TemplateRef) {
|
||||
templateType: number, templateRef: TemplateRef<Object>) {
|
||||
if (templateRef) {
|
||||
let node: VirtualNode = {
|
||||
tmpl: templateType,
|
||||
view: viewContainer.createEmbeddedView(templateRef),
|
||||
view: <EmbeddedViewRef<VirtualContext>>viewContainer.createEmbeddedView(templateRef),
|
||||
isLastRecord: true,
|
||||
hidden: true,
|
||||
};
|
||||
node.view.setLocal('\$implicit', {});
|
||||
node.view.context.$implicit = {};
|
||||
nodes.push(node);
|
||||
}
|
||||
}
|
||||
@@ -632,13 +633,25 @@ export interface VirtualCell {
|
||||
export interface VirtualNode {
|
||||
cell?: number;
|
||||
tmpl: number;
|
||||
view: EmbeddedViewRef;
|
||||
view: EmbeddedViewRef<VirtualContext>;
|
||||
isLastRecord?: boolean;
|
||||
hidden?: boolean;
|
||||
hasChanges?: boolean;
|
||||
lastTransform?: string;
|
||||
}
|
||||
|
||||
export class VirtualContext {
|
||||
constructor(public $implicit: any, public index: number, public count: number) {}
|
||||
|
||||
get first(): boolean { return this.index === 0; }
|
||||
|
||||
get last(): boolean { return this.index === this.count - 1; }
|
||||
|
||||
get even(): boolean { return this.index % 2 === 0; }
|
||||
|
||||
get odd(): boolean { return !this.even; }
|
||||
}
|
||||
|
||||
|
||||
export interface VirtualData {
|
||||
scrollTop?: number;
|
||||
|
||||
Reference in New Issue
Block a user