diff --git a/ionic/animations/animation.ts b/ionic/animations/animation.ts index 94f7eac87b..ac0df206d2 100644 --- a/ionic/animations/animation.ts +++ b/ionic/animations/animation.ts @@ -524,13 +524,13 @@ export class Animation { dest._ani = []; for (let i = 0; i < src._chld.length; i++) { - dest.add( copy(new Animation(), src._chld[i]) ); + dest.add( copy(new Animation(null), src._chld[i]) ); } return dest; } - return copy(new Animation(), this); + return copy(new Animation(null), this); } dispose(removeElement) { diff --git a/ionic/components/item/item-sliding-gesture.ts b/ionic/components/item/item-sliding-gesture.ts index 3b4f2e04eb..8df4b299eb 100644 --- a/ionic/components/item/item-sliding-gesture.ts +++ b/ionic/components/item/item-sliding-gesture.ts @@ -148,7 +148,7 @@ export class ItemSlidingGesture extends DragGesture { }); } - closeOpened(doNotCloseEle) { + closeOpened(doNotCloseEle?: HTMLElement) { let didClose = false; if (this.openItems) { let openItemElements = this.listEle.querySelectorAll('.active-slide'); diff --git a/ionic/components/list/list.ts b/ionic/components/list/list.ts index 9c5c0d6772..ef74537e58 100644 --- a/ionic/components/list/list.ts +++ b/ionic/components/list/list.ts @@ -1,4 +1,4 @@ -import {Directive, ElementRef, Renderer, Attribute, NgZone} from 'angular2/core'; +import {Directive, ElementRef, Renderer, Attribute, NgZone, Input} from 'angular2/core'; import {Ion} from '../ion'; import {ListVirtualScroll} from './virtual'; @@ -17,22 +17,25 @@ import {isDefined} from '../../util'; * @demo /docs/v2/demos/list/ * @see {@link /docs/v2/components#lists List Component Docs} * - * */ @Directive({ - selector: 'ion-list', - inputs: [ - 'items', - 'virtual', - 'content' - ] + selector: 'ion-list' }) export class List extends Ion { + private _enableSliding: boolean = false; + private _virtualScrollingManager: ListVirtualScroll; + + ele: HTMLElement; + itemTemplate; + slidingGesture: ItemSlidingGesture; + + @Input() items; + @Input() virtual; + @Input() content; constructor(elementRef: ElementRef, private zone: NgZone) { super(elementRef); this.ele = elementRef.nativeElement; - this._enableSliding = false; } /** @@ -138,8 +141,9 @@ export class List extends Ion { selector: 'ion-list-header' }) export class ListHeader { + private _id: string; - constructor(private _renderer: Renderer, private _elementRef: ElementRef, @Attribute('id') id:string){ + constructor(private _renderer: Renderer, private _elementRef: ElementRef, @Attribute('id') id:string) { this._id = id; } diff --git a/ionic/components/list/virtual.ts b/ionic/components/list/virtual.ts index 6e8f2e1a1b..93d582b86a 100644 --- a/ionic/components/list/virtual.ts +++ b/ionic/components/list/virtual.ts @@ -1,7 +1,20 @@ +import {List} from './list'; export class ListVirtualScroll { - constructor(list) { + content; + viewContainer; + viewportHeight; + virtualHeight; + viewportScrollHeight; + itemsPerScreen; + list: List; + itemHeight: number = 60; + shownItems = {}; + enteringItems = []; + leavingItems = []; + + constructor(list: List) { this.list = list; this.content = this.list.content; @@ -9,12 +22,6 @@ export class ListVirtualScroll { this.viewContainer = this.list.itemTemplate.viewContainer; - this.itemHeight = 60; - - this.shownItems = {}; - this.enteringItems = []; - this.leavingItems = []; - // Compute the initial sizes setTimeout(() => { this.resize(); @@ -58,8 +65,8 @@ export class ListVirtualScroll { // and compare the index to our index range, // pushing the items to remove to our leaving // list if they're ouside this range. - for(let i in this.shownItems) { - if(i < topIndex || i > bottomIndex) { + for (let i in this.shownItems) { + if (i < topIndex || i > bottomIndex) { this.leavingItems.push(this.shownItems[i]); delete this.shownItems[i]; } @@ -69,14 +76,14 @@ export class ListVirtualScroll { // Iterate the set of items that will be rendered, using the // index from the actual items list as the map for the // virtual items we draw - for(let i = topIndex, realIndex = 0; i < bottomIndex && i < items.length; i++, realIndex++) { + for (let i = topIndex, realIndex = 0; i < bottomIndex && i < items.length; i++, realIndex++) { item = items[i]; console.log('Drawing item', i, item.title); shownItemRef = this.shownItems[i]; // Is this a new item? - if(!shownItemRef) { + if (!shownItemRef) { let itemView = this.viewContainer.create(this.list.itemTemplate.protoViewRef, realIndex); itemView.setLocal('\$implicit', item); @@ -88,12 +95,10 @@ export class ListVirtualScroll { this.enteringItems.push(shownItemRef); } - //tuple.view = viewContainer.create(protoViewRef, tuple.record.currentIndex); - } - while(this.leavingItems.length) { + while (this.leavingItems.length) { let itemRef = this.leavingItems.pop(); console.log('Removing item', itemRef.item, itemRef.realIndex); this.viewContainer.remove(itemRef.realIndex); @@ -110,10 +115,5 @@ export class ListVirtualScroll { } class VirtualItemRef { - constructor(item, index, realIndex, view) { - this.item = item; - this.index = index; - this.realIndex = realIndex; - this.view = view; - } + constructor(public item, public index, public realIndex, public view) {} } diff --git a/ionic/components/menu/menu-close.ts b/ionic/components/menu/menu-close.ts index e28ca26402..1ad5dbbeec 100644 --- a/ionic/components/menu/menu-close.ts +++ b/ionic/components/menu/menu-close.ts @@ -1,4 +1,4 @@ -import {Directive} from 'angular2/core'; +import {Directive, Input, HostListener} from 'angular2/core'; import {IonicApp} from '../app/app'; import {Menu} from './menu'; @@ -27,21 +27,17 @@ import {Menu} from './menu'; * @see {@link ../../menu/Menu Menu API Docs} */ @Directive({ - selector: '[menuClose]', - inputs: [ - 'menuClose' - ], - host: { - '(click)': 'close()' - } + selector: '[menuClose]' }) export class MenuClose { + @Input() menuClose; constructor(private _app: IonicApp) {} /** * @private */ + @HostListener('click') close() { let menu = Menu.getById(this._app, this.menuClose); menu && menu.close();