replace @Parent w/ @Ancestor

This commit is contained in:
Adam Bradley
2015-07-30 21:15:22 -05:00
parent b89f383ecc
commit 8794182e6c
21 changed files with 35701 additions and 30919 deletions

View File

@ -4,7 +4,6 @@ import {
ElementRef,
Renderer,
Optional,
Parent,
NgControl
} from 'angular2/angular2';

View File

@ -1,4 +1,4 @@
import {Component, Directive, View, Parent, ElementRef, forwardRef} from 'angular2/angular2';
import {Component, Directive, View, Ancestor, 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, @Parent() holder: FocusHolder) {
constructor(elementRef: ElementRef, @Ancestor() holder: FocusHolder) {
this.elementRef = elementRef;
holder.register(this);
this.holder = holder;

View File

@ -1,4 +1,4 @@
import {Directive, Parent, Optional} from 'angular2/angular2';
import {Directive, Ancestor, 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() @Parent() textContainer: Input,
@Optional() @Parent() checkboxContainer: Checkbox,
@Optional() @Parent() radioContainer: RadioButton,
@Optional() @Parent() switchContainer: Switch,
@Optional() @Ancestor() textContainer: Input,
@Optional() @Ancestor() checkboxContainer: Checkbox,
@Optional() @Ancestor() radioContainer: RadioButton,
@Optional() @Ancestor() switchContainer: Switch,
config: IonicConfig
) {
this.container = textContainer || checkboxContainer || radioContainer || switchContainer;

View File

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

View File

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

View File

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

View File

@ -1,7 +1,8 @@
import {ElementRef, Parent} from 'angular2/angular2'
import {Directive} from 'angular2/angular2';
import {Item} from 'ionic/components/item/item'
import {SlideGesture} from 'ionic/gestures/slide-gesture'
import {ElementRef, Ancestor, Directive} from 'angular2/angular2';
import {Item} from 'ionic/components/item/item';
import {SlideGesture} from 'ionic/gestures/slide-gesture';
@Directive({
selector: 'ion-primary-swipe-buttons'
@ -9,11 +10,11 @@ import {SlideGesture} from 'ionic/gestures/slide-gesture'
export class ItemPrimarySwipeButtons {
constructor(
elementRef: ElementRef,
@Parent() item: Item
@Ancestor() item: Item
) {
item.primarySwipeButtons = this
this.ele = elementRef.nativeElement
this.parentItem = item
this.AncestorItem = item
this.gesture = new ItemSlideGesture(this)
this.gesture.listen()
}
@ -36,7 +37,7 @@ export class ItemSecondarySwipeButtons {
class ItemSlideGesture extends SlideGesture {
constructor(buttons) {
super(buttons.parentItem.ele)
super(buttons.AncestorItem.ele)
this.buttons = buttons
}

View File

@ -1,5 +1,5 @@
import {ProtoViewRef, ViewContainerRef} from 'angular2/angular2'
import {Directive, Parent, forwardRef} from 'angular2/angular2';
import {Directive, Ancestor, forwardRef} from 'angular2/angular2';
import {App, List} from 'ionic/ionic';
@ -31,7 +31,7 @@ class IonicApp {
selector: 'template[cell]'
})
export class ItemCellTemplate {
constructor(@Parent() list: List, viewContainer: ViewContainerRef, protoViewRef: ProtoViewRef) {
constructor(@Ancestor() 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, Parent, Optional, ElementRef, forwardRef} from 'angular2/angular2';
import {Directive, View, Ancestor, Optional, ElementRef, forwardRef} from 'angular2/angular2';
import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
import {ToolbarBase} from '../toolbar/toolbar';
@ -88,7 +88,7 @@ export class Navbar extends ToolbarBase {
}
})
class BackButton {
constructor(@Parent() navbar: Navbar, @Optional() item: ViewItem, elementRef: ElementRef) {
constructor(@Ancestor() navbar: Navbar, @Optional() item: ViewItem, elementRef: ElementRef) {
this.item = item;
navbar.backButtonElement(elementRef);
}
@ -104,7 +104,7 @@ class BackButton {
selector: '.back-button-text'
})
class BackButtonText {
constructor(@Parent() navbar: Navbar, elementRef: ElementRef) {
constructor(@Ancestor() navbar: Navbar, elementRef: ElementRef) {
navbar.backButtonTextElement(elementRef);
}
}
@ -113,7 +113,7 @@ class BackButtonText {
selector: '.toolbar-title'
})
class Title {
constructor(@Parent() toolbar: Navbar, elementRef: ElementRef) {
constructor(@Ancestor() toolbar: Navbar, elementRef: ElementRef) {
toolbar.titleElement(elementRef);
}
}
@ -122,7 +122,7 @@ class Title {
selector: '.toolbar-item'
})
class NavbarItem {
constructor(@Parent() toolbar: Navbar, elementRef: ElementRef) {
constructor(@Ancestor() toolbar: Navbar, elementRef: ElementRef) {
toolbar.itemElements(elementRef);
}
}

View File

@ -1,4 +1,4 @@
import {Component, View, Directive, Parent, ElementRef, forwardRef, Inject} from 'angular2/angular2';
import {Component, View, Directive, Ancestor, 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(
@Parent() @Inject(forwardRef(() => Pane)) pane: Pane,
@Ancestor() @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(
@Parent() @Inject(forwardRef(() => Pane)) pane: Pane,
@Ancestor() @Inject(forwardRef(() => Pane)) pane: Pane,
viewContainerRef: ViewContainerRef
) {
pane.contentContainerRef = viewContainerRef;

View File

@ -1,4 +1,4 @@
import {Directive, View, ElementRef, Parent, Optional, forwardRef, Injector} from 'angular2/angular2';
import {Directive, View, ElementRef, Ancestor, 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() parentViewCtrl: ViewController,
@Optional() AncestorViewCtrl: ViewController,
injector: Injector,
elementRef: ElementRef
) {
super(parentViewCtrl, injector, elementRef);
super(AncestorViewCtrl, injector, elementRef);
}
onIonInit() {
@ -42,7 +42,7 @@ export class Nav extends ViewController {
@Directive({selector: 'template[pane-anchor]'})
class NavPaneAnchor {
constructor(@Parent() nav: Nav, elementRef: ElementRef) {
constructor(@Ancestor() nav: Nav, elementRef: ElementRef) {
nav.anchorElementRef(elementRef);
}
}

View File

@ -1,4 +1,4 @@
import {ElementRef, Directive, Parent, Optional, Inject, forwardRef, NgZone} from 'angular2/angular2';
import {ElementRef, Directive, Ancestor, 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,
@Parent() @Inject(forwardRef(() => Pane)) pane: Pane,
@Ancestor() @Inject(forwardRef(() => Pane)) pane: Pane,
elementRef: ElementRef,
ngZone: NgZone
) {

View File

@ -1,4 +1,4 @@
import {Component, View, NgIf, CSSClass, ElementRef, EventEmitter, Parent, onInit} from 'angular2/angular2'
import {Component, View, NgIf, CSSClass, ElementRef, EventEmitter, Ancestor, onInit} from 'angular2/angular2'
import {Content} from '../content/content';
@ -39,7 +39,7 @@ import {raf, ready, CSS} from 'ionic/util/dom';
})
export class Refresher {
constructor(
@Parent() content: Content,
@Ancestor() content: Content,
element: ElementRef
) {
this.ele = element.nativeElement;
@ -71,7 +71,7 @@ export class Refresher {
this.startY = null;
this.deltaY = null;
this.canOverscroll = true;
this.scrollParent = sp;
this.scrollAncestor = sp;
this.scrollChild = sc;
util.defaults(this, {
@ -248,7 +248,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 && scrollParent.scrollTop === 0) {
if (ionic.Platform.isAndroid() && ionic.Platform.version() === 4.4 && scrollAncestor.scrollTop === 0) {
isDragging = true;
e.preventDefault();
}
@ -260,7 +260,7 @@ export class Refresher {
// if we've dragged up and back down in to native scroll territory
if (this.deltaY - this.dragOffset <= 0 || this.scrollParent.scrollTop !== 0) {
if (this.deltaY - this.dragOffset <= 0 || this.scrollAncestor.scrollTop !== 0) {
if (this.isOverscrolling) {
this.isOverscrolling = false;
@ -268,7 +268,7 @@ export class Refresher {
}
if (this.isDragging) {
this.nativescroll(this.scrollParent, parseInt(this.deltaY - this.dragOffset, 10) * -1);
this.nativescroll(this.scrollAncestor, parseInt(this.deltaY - this.dragOffset, 10) * -1);
}
// if we're not at overscroll 0 yet, 0 out
@ -277,7 +277,7 @@ export class Refresher {
}
return;
} else if (this.deltaY > 0 && this.scrollParent.scrollTop === 0 && !this.isOverscrolling) {
} else if (this.deltaY > 0 && this.scrollAncestor.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

@ -4,7 +4,6 @@ import {
ElementRef,
Renderer,
Optional,
Parent,
NgControl
} from 'angular2/angular2';

View File

@ -1,4 +1,4 @@
import {Directive, Component, View, onInit, Parent, ElementRef, forwardRef, Injector} from 'angular2/angular2';
import {Directive, Component, View, onInit, Ancestor, 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(
@Parent() tabs: Tabs,
@Ancestor() 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 parent Tabs (which extends ViewController)
// A Tab is one ViewItem within it's Ancestor 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.parent);
let item = this.item = new ViewItem(tabs.Ancestor);
item.setInstance(this);
item.viewElement(elementRef.nativeElement);
tabs.addTab(this);
@ -105,7 +105,7 @@ export class Tab extends ViewController {
selector: 'template[pane-anchor]'
})
class TabPaneAnchor {
constructor(@Parent() tab: Tab, elementRef: ElementRef) {
constructor(@Ancestor() tab: Tab, elementRef: ElementRef) {
tab.anchorElementRef(elementRef);
}
}

View File

@ -1,4 +1,4 @@
import {Component, Directive, View, Injector, NgFor, ElementRef, Optional, Parent, forwardRef} from 'angular2/angular2';
import {Component, Directive, View, Injector, NgFor, ElementRef, Optional, Ancestor, 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() parentViewCtrl: ViewController,
@Optional() AncestorViewCtrl: ViewController,
@Optional() viewItem: ViewItem,
injector: Injector,
elementRef: ElementRef
) {
super(parentViewCtrl, injector, elementRef);
super(AncestorViewCtrl, 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(@Parent() tabs: Tabs) {
constructor(@Ancestor() tabs: Tabs) {
this.tabs = tabs;
}

View File

@ -1,4 +1,4 @@
import {Directive, View, Parent, onInit, ElementRef, forwardRef} from 'angular2/angular2';
import {Directive, View, Ancestor, onInit, 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(@Parent() toolbar: Toolbar, elementRef: ElementRef) {
constructor(@Ancestor() toolbar: Toolbar, elementRef: ElementRef) {
toolbar.titleElement(elementRef);
}
}
@ -130,7 +130,7 @@ class ToolbarTitle {
selector: '.toolbar-item'
})
class ToolbarItem {
constructor(@Parent() toolbar: Toolbar, elementRef: ElementRef) {
constructor(@Ancestor() toolbar: Toolbar, elementRef: ElementRef) {
toolbar.itemElements(elementRef);
}
}

View File

@ -1,8 +1,4 @@
import {ElementRef, For, Parent, onInit} from 'angular2/angular2'
import {Component, Directive} from 'angular2/angular2';
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
import {Log} from 'ionic/util'
import {onInit, Directive} from 'angular2/angular2';
import {IonicApp} from 'ionic/ionic'

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

22
scripts/resources/angular2.min.js vendored Normal file

File diff suppressed because one or more lines are too long