cleanup(DI): clean up visibility decorators

BREAKING CHANGE:
    Replace @Ancestor() with @Host() @SkipSelf()
    Replace @Unbounded() wwith @SkipSelf()
    Replace @Ancestor({self:true}) with @Host()
    Replace @Unbounded({self:true}) with nothing
    Replace new AncestorMetadata() with [new HostMetadata(), new SkipSelfMetadata()]
    Replace new UnboundedMetadata() with new SkipSelfMetadata()
    Replace new Ancestor({self:true}) with new HostMetadata()
This commit is contained in:
vsavkin
2015-07-29 11:26:09 -07:00
parent a9ec6b9064
commit 985627bd65
27 changed files with 246 additions and 268 deletions

View File

@ -3,7 +3,8 @@ import {
Directive,
View,
ViewEncapsulation,
Ancestor,
Host,
SkipSelf,
ElementRef,
DynamicComponentLoader,
ComponentRef,
@ -212,8 +213,7 @@ export class MdDialogConfig {
})
@View({
templateUrl: 'package:angular2_material/src/components/dialog/dialog.html',
directives: [forwardRef(() => MdDialogContent)],
encapsulation: ViewEncapsulation.NONE
directives: [forwardRef(() => MdDialogContent)]
})
class MdDialogContainer {
// Ref to the dialog content. Used by the DynamicComponentLoader to load the dialog content.
@ -245,7 +245,7 @@ class MdDialogContainer {
*/
@Directive({selector: 'md-dialog-content'})
class MdDialogContent {
constructor(@Ancestor() dialogContainer: MdDialogContainer, elementRef: ElementRef) {
constructor(@Host() @SkipSelf() dialogContainer: MdDialogContainer, elementRef: ElementRef) {
dialogContainer.contentRef = elementRef;
}
}

View File

@ -1,4 +1,11 @@
import {Component, View, ViewEncapsulation, Ancestor, LifecycleEvent} from 'angular2/angular2';
import {
Component,
View,
ViewEncapsulation,
Host,
SkipSelf,
LifecycleEvent
} from 'angular2/angular2';
import {ListWrapper} from 'angular2/src/facade/collection';
import {StringWrapper, isPresent, isString, NumberWrapper} from 'angular2/src/facade/lang';
@ -244,7 +251,7 @@ export class MdGridTile {
isRegisteredWithGridList: boolean;
constructor(@Ancestor() gridList: MdGridList) {
constructor(@SkipSelf() @Host() gridList: MdGridList) {
this.gridList = gridList;
// Tiles default to 1x1, but rowspan and colspan can be changed via binding.

View File

@ -1,4 +1,4 @@
import {Directive, LifecycleEvent, Attribute, Ancestor} from 'angular2/angular2';
import {Directive, LifecycleEvent, Attribute, Host, SkipSelf} from 'angular2/angular2';
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
@ -73,7 +73,7 @@ export class MdInput {
mdChange: EventEmitter;
mdFocusChange: EventEmitter;
constructor(@Attribute('value') value: string, @Ancestor() container: MdInputContainer,
constructor(@Attribute('value') value: string, @SkipSelf() @Host() container: MdInputContainer,
@Attribute('id') id: string) {
// TODO(jelbourn): Remove this when #1402 is done.
this.yes = true;
@ -111,7 +111,7 @@ export class MdInput {
export class MdTextarea extends MdInput {
constructor(
@Attribute('value') value: string,
@Ancestor() container: MdInputContainer,
@SkipSelf() @Host() container: MdInputContainer,
@Attribute('id') id: string) {
super(value, container, id);
}

View File

@ -3,7 +3,8 @@ import {
View,
ViewEncapsulation,
LifecycleEvent,
Ancestor,
Host,
SkipSelf,
Attribute,
Optional
} from 'angular2/angular2';
@ -232,7 +233,7 @@ export class MdRadioButton {
role: string;
constructor(@Optional() @Ancestor() radioGroup: MdRadioGroup, @Attribute('id') id: string,
constructor(@Optional() @SkipSelf() @Host() radioGroup: MdRadioGroup, @Attribute('id') id: string,
@Attribute('tabindex') tabindex: string, radioDispatcher: MdRadioDispatcher) {
// Assertions. Ideally these should be stripped out by the compiler.
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.