This commit is contained in:
Adam Bradley
2015-08-07 10:50:41 -05:00
parent 898160cca2
commit 13cd3da6b2
27 changed files with 43754 additions and 1846 deletions

View File

@ -1,4 +1,4 @@
import {Directive, ElementRef, Optional, Ancestor, onDestroy, NgZone, Query, QueryList} from 'angular2/angular2';
import {Directive, ElementRef, Optional, Host, onDestroy, NgZone, Query, QueryList} from 'angular2/angular2';
import {Icon} from '../icon/icon';
import {IonicConfig} from '../../config/config';
@ -50,7 +50,7 @@ export class TapClick {
elementRef: ElementRef,
config: IonicConfig,
ngZone: NgZone,
@Optional() @Ancestor() tapDisabled: TapDisabled
@Optional() @Host() tapDisabled: TapDisabled
) {
this.ele = elementRef.nativeElement;
this.tapEnabled = !tapDisabled;

View File

@ -1,4 +1,4 @@
import {Component, Directive, View, Ancestor, ElementRef, forwardRef} from 'angular2/angular2';
import {Component, Directive, View, Host, ElementRef, forwardRef} from 'angular2/angular2';
import {IonicConfig} from '../../config/config';
import * as dom from '../../util/dom';
@ -75,7 +75,7 @@ export class FocusHolder {
}
})
class FocusInput {
constructor(elementRef: ElementRef, @Ancestor() holder: FocusHolder) {
constructor(elementRef: ElementRef, @Host() holder: FocusHolder) {
this.elementRef = elementRef;
holder.register(this);
this.holder = holder;

View File

@ -1,4 +1,4 @@
import {Directive, Ancestor, Optional} from 'angular2/angular2';
import {Directive, Host, Optional} from 'angular2/angular2';
import {IonicConfig} from '../../config/config';
import * as dom from '../../util/dom';
@ -21,10 +21,10 @@ import {Switch} from '../switch/switch';
})
export class Label {
constructor(
@Optional() @Ancestor() textContainer: Input,
@Optional() @Ancestor() checkboxContainer: Checkbox,
@Optional() @Ancestor() radioContainer: RadioButton,
@Optional() @Ancestor() switchContainer: Switch,
@Optional() @Host() textContainer: Input,
@Optional() @Host() checkboxContainer: Checkbox,
@Optional() @Host() radioContainer: RadioButton,
@Optional() @Host() switchContainer: Switch,
config: IonicConfig
) {
this.container = textContainer || checkboxContainer || radioContainer || switchContainer;

View File

@ -1,4 +1,4 @@
import {Ancestor, Optional, ElementRef, Attribute, Directive} from 'angular2/angular2';
import {Host, Optional, ElementRef, Attribute, Directive} from 'angular2/angular2';
import {IonInput} from './input';
import {IonicApp} from '../app/app';
@ -24,9 +24,9 @@ import {RadioButton} from '../radio/radio';
})
export class TapInput extends IonInput {
constructor(
@Optional() @Ancestor() checkboxContainer: Checkbox,
@Optional() @Ancestor() radioContainer: RadioButton,
@Optional() @Ancestor() scrollView: Content,
@Optional() @Host() checkboxContainer: Checkbox,
@Optional() @Host() radioContainer: RadioButton,
@Optional() @Host() scrollView: Content,
@Attribute('type') type: string,
elementRef: ElementRef,
app: IonicApp,

View File

@ -1,4 +1,4 @@
import {Directive, View, Ancestor, Optional, ElementRef, Attribute, forwardRef} from 'angular2/angular2';
import {Directive, View, Host, Optional, ElementRef, Attribute, forwardRef} from 'angular2/angular2';
import {IonicDirective} from '../../config/annotations';
import {IonicConfig} from '../../config/config';
@ -51,8 +51,8 @@ export class Input extends IonInputItem {
})
export class TextInput extends IonInput {
constructor(
@Optional() @Ancestor() container: Input,
@Optional() @Ancestor() scrollView: Content,
@Optional() @Host() container: Input,
@Optional() @Host() scrollView: Content,
@Attribute('type') type: string,
elementRef: ElementRef,
app: IonicApp,

View File

@ -1,4 +1,4 @@
import {Directive, View, CSSClass, ElementRef, Optional, Ancestor, Attribute, Renderer} from 'angular2/angular2';
import {Directive, View, CSSClass, ElementRef, Optional, Host, Attribute, Renderer} from 'angular2/angular2';
import {IonicConfig} from '../../config/config';
import {IonicComponent} from '../../config/annotations';
@ -66,7 +66,7 @@ Custom Font Icon
export class IconDirective {
constructor(
private _elementRef: ElementRef,
@Optional() @Ancestor() AncestorButton: Button,
@Optional() @Host() hostButton: Button,
@Attribute('forward') forward: string,
config: IonicConfig,
private renderer: Renderer
@ -80,7 +80,7 @@ export class IconDirective {
this.fwdIcon = config.setting('forwardIcon');
}
if (AncestorButton) {
if (hostButton) {
// this icon is within a button
this.withinButton = true;
@ -98,7 +98,7 @@ export class IconDirective {
// tell the button there's a child icon
// the button will set the correct css classes on itself
AncestorButton.registerIcon(this);
hostButton.registerIcon(this);
}
}

View File

@ -1,4 +1,4 @@
import {ElementRef, Ancestor, Directive} from 'angular2/angular2';
import {ElementRef, Host, Directive} from 'angular2/angular2';
import {Item} from 'ionic/components/item/item';
import {SlideGesture} from 'ionic/gestures/slide-gesture';
@ -10,21 +10,21 @@ import {SlideGesture} from 'ionic/gestures/slide-gesture';
export class ItemPrimarySwipeButtons {
constructor(
elementRef: ElementRef,
@Ancestor() item: Item
@Host() item: Item
) {
item.primarySwipeButtons = this
this.ele = elementRef.nativeElement
this.AncestorItem = item
this.gesture = new ItemSlideGesture(this)
this.gesture.listen()
item.primarySwipeButtons = this;
this.ele = elementRef.nativeElement;
this.item = item;
this.gesture = new ItemSlideGesture(this);
this.gesture.listen();
}
setOpen(isOpen) {
if (isOpen !== this.isOpen) {
this.isOpen = isOpen
this.isOpen = isOpen;
requestAnimationFrame(() => {
this.ele.classList[isOpen?'add':'remove'](isOpen)
})
this.ele.classList[isOpen?'add':'remove'](isOpen);
});
}
}
}
@ -37,7 +37,7 @@ export class ItemSecondarySwipeButtons {
class ItemSlideGesture extends SlideGesture {
constructor(buttons) {
super(buttons.AncestorItem.ele)
super(buttons.item.ele)
this.buttons = buttons
}

View File

@ -1,5 +1,5 @@
import {ProtoViewRef, ViewContainerRef} from 'angular2/angular2'
import {Directive, Ancestor, forwardRef} from 'angular2/angular2';
import {Directive, Host, forwardRef} from 'angular2/angular2';
import {App, List} from 'ionic/ionic';
@ -31,7 +31,7 @@ class IonicApp {
selector: 'template[cell]'
})
export class ItemCellTemplate {
constructor(@Ancestor() list: List, viewContainer: ViewContainerRef, protoViewRef: ProtoViewRef) {
constructor(@Host() list: List, viewContainer: ViewContainerRef, protoViewRef: ProtoViewRef) {
console.log('Item cell template', list, viewContainer, protoViewRef);
this.protoViewRef = protoViewRef;

View File

@ -1,4 +1,4 @@
import {Directive, View, Ancestor, Optional, ElementRef, forwardRef} from 'angular2/angular2';
import {Directive, View, Host, Optional, ElementRef, forwardRef} from 'angular2/angular2';
import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
import {TemplateRef} from 'angular2/angular2';
@ -90,7 +90,7 @@ export class Navbar extends ToolbarBase {
}
})
class BackButton {
constructor(@Ancestor() navbar: Navbar, @Optional() item: ViewItem, elementRef: ElementRef) {
constructor(@Host() navbar: Navbar, @Optional() item: ViewItem, elementRef: ElementRef) {
this.item = item;
navbar.backButtonElement(elementRef);
}
@ -106,7 +106,7 @@ class BackButton {
selector: '.back-button-text'
})
class BackButtonText {
constructor(@Ancestor() navbar: Navbar, elementRef: ElementRef) {
constructor(@Host() navbar: Navbar, elementRef: ElementRef) {
navbar.backButtonTextElement(elementRef);
}
}
@ -115,7 +115,7 @@ class BackButtonText {
selector: '.toolbar-title'
})
class Title {
constructor(@Ancestor() toolbar: Navbar, elementRef: ElementRef) {
constructor(@Host() toolbar: Navbar, elementRef: ElementRef) {
toolbar.titleElement(elementRef);
}
}
@ -124,7 +124,7 @@ class Title {
selector: '.toolbar-item'
})
class NavbarItem {
constructor(@Ancestor() toolbar: Navbar, elementRef: ElementRef) {
constructor(@Host() toolbar: Navbar, elementRef: ElementRef) {
toolbar.itemElements(elementRef);
}
}

View File

@ -1,4 +1,4 @@
import {Component, View, Directive, Ancestor, ElementRef, forwardRef, Inject} from 'angular2/angular2';
import {Component, View, Directive, Host, ElementRef, forwardRef, Inject} from 'angular2/angular2';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {Pane} from './pane';
@ -8,7 +8,7 @@ import {ViewController} from '../view/view-controller';
@Directive({selector: 'template[pane-anchor]'})
export class PaneAnchor {
constructor(
@Ancestor() @Inject(forwardRef(() => Pane)) pane: Pane,
@Host() @Inject(forwardRef(() => Pane)) pane: Pane,
elementRef: ElementRef
) {
pane.sectionAnchorElementRef = elementRef;
@ -19,7 +19,7 @@ export class PaneAnchor {
@Directive({selector: 'template[content-anchor]'})
export class PaneContentAnchor {
constructor(
@Ancestor() @Inject(forwardRef(() => Pane)) pane: Pane,
@Host() @Inject(forwardRef(() => Pane)) pane: Pane,
viewContainerRef: ViewContainerRef
) {
pane.contentContainerRef = viewContainerRef;

View File

@ -1,4 +1,4 @@
import {Directive, View, ElementRef, Ancestor, Optional, forwardRef, Injector} from 'angular2/angular2';
import {Directive, View, ElementRef, Host, Optional, forwardRef, Injector} from 'angular2/angular2';
import {IonicComponent} from '../../config/annotations';
import {ViewController} from '../view/view-controller';
@ -20,11 +20,11 @@ import {ViewController} from '../view/view-controller';
export class Nav extends ViewController {
constructor(
@Optional() ancestorViewCtrl: ViewController,
@Optional() hostViewCtrl: ViewController,
injector: Injector,
elementRef: ElementRef
) {
super(ancestorViewCtrl, injector, elementRef);
super(hostViewCtrl, injector, elementRef);
}
onIonInit() {
@ -43,7 +43,7 @@ export class Nav extends ViewController {
@Directive({selector: 'template[pane-anchor]'})
class NavPaneAnchor {
constructor(@Ancestor() nav: Nav, elementRef: ElementRef) {
constructor(@Host() nav: Nav, elementRef: ElementRef) {
nav.anchorElementRef(elementRef);
}
}

View File

@ -1,4 +1,4 @@
import {ElementRef, Directive, Ancestor, Optional, Inject, forwardRef, NgZone} from 'angular2/angular2';
import {ElementRef, Directive, Host, Optional, Inject, forwardRef, NgZone} from 'angular2/angular2';
import {ViewController} from '../view/view-controller';
import {Pane} from './pane';
@ -14,7 +14,7 @@ import {Gesture} from 'ionic/gestures/gesture';
export class SwipeHandle {
constructor(
@Optional() @Inject(forwardRef(() => ViewController)) viewCtrl: ViewController,
@Ancestor() @Inject(forwardRef(() => Pane)) pane: Pane,
@Host() @Inject(forwardRef(() => Pane)) pane: Pane,
elementRef: ElementRef,
ngZone: NgZone
) {

View File

@ -5,7 +5,6 @@ import {
bootstrap,
Injectable,
Inject,
Ancestor,
forwardRef,
Inject,
DynamicComponentLoader,

View File

@ -1,4 +1,4 @@
import {ElementRef, Ancestor, Optional, NgControl, Query, QueryList} from 'angular2/angular2';
import {ElementRef, Host, Optional, NgControl, Query, QueryList} from 'angular2/angular2';
import {IonicDirective, IonicComponent, IonicView} from '../../config/annotations';
import {IonicConfig} from '../../config/config';
@ -111,7 +111,7 @@ export class RadioGroup extends Ion {
})
export class RadioButton extends IonInputItem {
constructor(
@Ancestor() @Optional() group: RadioGroup,
@Host() @Optional() group: RadioGroup,
elementRef: ElementRef,
config: IonicConfig,
tapClick: TapClick

View File

@ -1,4 +1,4 @@
import {Component, View, NgIf, CSSClass, ElementRef, EventEmitter, Ancestor, onInit} from 'angular2/angular2'
import {Component, View, NgIf, CSSClass, ElementRef, EventEmitter, Host} from 'angular2/angular2'
import {Content} from '../content/content';
@ -20,8 +20,7 @@ import {raf, ready, CSS} from 'ionic/util/dom';
'[class.active]': 'isActive',
'[class.refreshing]': 'isRefreshing',
'[class.refreshingTail]': 'isRefreshingTail'
},
lifecycle: [onInit]
}
})
@View({
template: `<div class="refresher-content" [class.refresher-with-text]="pullingText || refreshingText">
@ -39,7 +38,7 @@ import {raf, ready, CSS} from 'ionic/util/dom';
})
export class Refresher {
constructor(
@Ancestor() content: Content,
@Host() content: Content,
element: ElementRef
) {
this.ele = element.nativeElement;
@ -71,7 +70,7 @@ export class Refresher {
this.startY = null;
this.deltaY = null;
this.canOverscroll = true;
this.scrollAncestor = sp;
this.scrollHost = sp;
this.scrollChild = sc;
util.defaults(this, {
@ -248,7 +247,7 @@ export class Refresher {
// kitkat fix for touchcancel events http://updates.html5rocks.com/2014/05/A-More-Compatible-Smoother-Touch
/*
if (ionic.Platform.isAndroid() && ionic.Platform.version() === 4.4 && scrollAncestor.scrollTop === 0) {
if (ionic.Platform.isAndroid() && ionic.Platform.version() === 4.4 && scrollHost.scrollTop === 0) {
isDragging = true;
e.preventDefault();
}
@ -260,7 +259,7 @@ export class Refresher {
// if we've dragged up and back down in to native scroll territory
if (this.deltaY - this.dragOffset <= 0 || this.scrollAncestor.scrollTop !== 0) {
if (this.deltaY - this.dragOffset <= 0 || this.scrollHost.scrollTop !== 0) {
if (this.isOverscrolling) {
this.isOverscrolling = false;
@ -268,7 +267,7 @@ export class Refresher {
}
if (this.isDragging) {
this.nativescroll(this.scrollAncestor, parseInt(this.deltaY - this.dragOffset, 10) * -1);
this.nativescroll(this.scrollHost, parseInt(this.deltaY - this.dragOffset, 10) * -1);
}
// if we're not at overscroll 0 yet, 0 out
@ -277,7 +276,7 @@ export class Refresher {
}
return;
} else if (this.deltaY > 0 && this.scrollAncestor.scrollTop === 0 && !this.isOverscrolling) {
} else if (this.deltaY > 0 && this.scrollHost.scrollTop === 0 && !this.isOverscrolling) {
// starting overscroll, but drag started below scrollTop 0, so we need to offset the position
this.dragOffset = this.deltaY;
}

View File

@ -1,4 +1,4 @@
import {View, Renderer, ElementRef, EventEmitter, Ancestor, forwardRef} from 'angular2/angular2';
import {View, Renderer, ElementRef, EventEmitter, Host, forwardRef} from 'angular2/angular2';
import {Control, NgControl,NgFormControl} from 'angular2/forms';
import {ControlGroup, ControlDirective} from 'angular2/forms'
@ -168,7 +168,7 @@ export class SegmentControlValueAccessor {
})
export class SegmentButton {
constructor(
@Ancestor() segment: Segment,
@Host() segment: Segment,
elementRef: ElementRef
) {
this.ele = elementRef.ele

View File

@ -1,4 +1,4 @@
import {Component, View, ElementRef, onInit, Ancestor, NgFor} from 'angular2/angular2';
import {Component, View, ElementRef, onInit, Host, NgFor} from 'angular2/angular2';
import {DragGesture} from 'ionic/gestures/drag-gesture';
import {IonicComponent, IonicDirective} from '../../config/annotations';
@ -452,7 +452,7 @@ export class Slides {
})
export class Slide {
constructor(
@Ancestor() slides: Slides,
@Host() slides: Slides,
elementRef: ElementRef
) {
this.ele = elementRef.nativeElement;
@ -502,7 +502,7 @@ export class Slide {
})
export class SlidePager {
constructor(
@Ancestor() slides: Slides,
@Host() slides: Slides,
elementRef: ElementRef
) {
this.ele = elementRef.nativeElement;

View File

@ -2,7 +2,7 @@ import {
View,
Directive,
ElementRef,
Ancestor,
Host,
Optional,
NgControl,
Renderer,
@ -29,7 +29,7 @@ import {pointerCoord} from '../../util/dom';
})
class MediaSwitch {
constructor(
@Ancestor() @Inject(forwardRef(() => Switch)) swtch: Switch,
@Host() @Inject(forwardRef(() => Switch)) swtch: Switch,
elementRef: ElementRef,
config: IonicConfig
) {

View File

@ -1,4 +1,4 @@
import {Directive, Component, View, onInit, Ancestor, ElementRef, forwardRef, Injector} from 'angular2/angular2';
import {Directive, Component, View, Host, ElementRef, forwardRef, Injector} from 'angular2/angular2';
import {ViewController} from '../view/view-controller';
import {ViewItem} from '../view/view-item';
@ -27,19 +27,19 @@ import {Tabs} from './tabs';
export class Tab extends ViewController {
constructor(
@Ancestor() tabs: Tabs,
@Host() tabs: Tabs,
elementRef: ElementRef,
injector: Injector
) {
// A Tab is both a container of many views, and is a view itself.
// A Tab is one ViewItem within it's Ancestor Tabs (which extends ViewController)
// A Tab is one ViewItem within it's Host Tabs (which extends ViewController)
// A Tab is a ViewController for its child ViewItems
super(tabs, injector, elementRef);
this.tabs = tabs;
this.childNavbar(true);
let item = this.item = new ViewItem(tabs.Ancestor);
let item = this.item = new ViewItem(tabs.Host);
item.setInstance(this);
item.viewElementRef(elementRef);
tabs.addTab(this);
@ -105,7 +105,7 @@ export class Tab extends ViewController {
selector: 'template[pane-anchor]'
})
class TabPaneAnchor {
constructor(@Ancestor() tab: Tab, elementRef: ElementRef) {
constructor(@Host() tab: Tab, elementRef: ElementRef) {
tab.anchorElementRef(elementRef);
}
}

View File

@ -1,4 +1,4 @@
import {Component, Directive, View, Injector, NgFor, ElementRef, Optional, Ancestor, forwardRef} from 'angular2/angular2';
import {Component, Directive, View, Injector, NgFor, ElementRef, Optional, Host, forwardRef} from 'angular2/angular2';
import {ViewController} from '../view/view-controller';
import {ViewItem} from '../view/view-item';
@ -30,12 +30,12 @@ import {IonicComponent, IonicView} from '../../config/annotations';
})
export class Tabs extends ViewController {
constructor(
@Optional() AncestorViewCtrl: ViewController,
@Optional() hostViewCtrl: ViewController,
@Optional() viewItem: ViewItem,
injector: Injector,
elementRef: ElementRef
) {
super(AncestorViewCtrl, injector, elementRef);
super(hostViewCtrl, injector, elementRef);
// Tabs may also be an actual ViewItem which was navigated to
// if Tabs is static and not navigated to within a ViewController
@ -126,7 +126,7 @@ export class Tabs extends ViewController {
}
})
class TabButton {
constructor(@Ancestor() tabs: Tabs) {
constructor(@Host() tabs: Tabs) {
this.tabs = tabs;
}

View File

@ -1,4 +1,4 @@
import {Directive, View, Ancestor, onInit, ElementRef, forwardRef} from 'angular2/angular2';
import {Directive, View, Host, ElementRef, forwardRef} from 'angular2/angular2';
import {Ion} from '../ion';
import {IonicConfig} from '../../config/config';
@ -120,7 +120,7 @@ export class Toolbar extends ToolbarBase {
selector: '.toolbar-title'
})
class ToolbarTitle {
constructor(@Ancestor() toolbar: Toolbar, elementRef: ElementRef) {
constructor(@Host() toolbar: Toolbar, elementRef: ElementRef) {
toolbar.titleElement(elementRef);
}
}
@ -130,7 +130,7 @@ class ToolbarTitle {
selector: '.toolbar-item'
})
class ToolbarItem {
constructor(@Ancestor() toolbar: Toolbar, elementRef: ElementRef) {
constructor(@Host() toolbar: Toolbar, elementRef: ElementRef) {
toolbar.itemElements(elementRef);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long