refactor(LifecycleEvent): remove LifecycleEvent
fixes #3924 BREAKING CHANGE The `lifecycle` configuration for directive has been dropped. Before // Dart @Component({lifecycle: const [LifecycleEvent.OnChanges], ...}) class MyComponent implements OnChanges { void onChanges() {...} } // Typescript @Component({lifecycle: [LifecycleEvent.OnChanges], ...}) class MyComponent implements OnChanges { onChanges(): void {...} } // ES5 var MyComponent = ng. Component({lifecycle: [LifecycleEvent.OnChanges], ...}). Class({ onChanges: function() {...} }); After // Dart @Component({...}) class MyComponent implements OnChanges { void onChanges() {...} } // Typescript @Component({...}) class MyComponent implements OnChanges { onChanges(): void {...} } // ES5 var MyComponent = ng .Component({...}) .Class({ onChanges: function() { } });
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import {Component, View, LifecycleEvent, ViewEncapsulation} from 'angular2/angular2';
|
||||
import {Component, View, LifecycleEvent, ViewEncapsulation, OnChanges} from 'angular2/angular2';
|
||||
|
||||
import {TimerWrapper} from 'angular2/src/core/facade/async';
|
||||
import {isPresent} from 'angular2/src/core/facade/lang';
|
||||
@ -48,7 +48,6 @@ export class MdButton {
|
||||
@Component({
|
||||
selector: 'a[md-button], a[md-raised-button], a[md-fab]',
|
||||
properties: ['disabled'],
|
||||
lifecycle: [LifecycleEvent.OnChanges],
|
||||
host: {
|
||||
'(click)': 'onClick($event)',
|
||||
'(mousedown)': 'onMousedown()',
|
||||
@ -63,7 +62,7 @@ export class MdButton {
|
||||
templateUrl: 'package:angular2_material/src/components/button/button.html',
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MdAnchor extends MdButton {
|
||||
export class MdAnchor extends MdButton implements OnChanges {
|
||||
tabIndex: number;
|
||||
|
||||
/** Whether the component is disabled. */
|
||||
|
@ -4,7 +4,9 @@ import {
|
||||
ViewEncapsulation,
|
||||
Host,
|
||||
SkipSelf,
|
||||
LifecycleEvent
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
AfterContentChecked
|
||||
} from 'angular2/angular2';
|
||||
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
@ -25,16 +27,12 @@ class RowHeightMode {
|
||||
}
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'md-grid-list',
|
||||
properties: ['cols', 'rowHeight', 'gutterSize'],
|
||||
lifecycle: [LifecycleEvent.AfterContentChecked]
|
||||
})
|
||||
@Component({selector: 'md-grid-list', properties: ['cols', 'rowHeight', 'gutterSize']})
|
||||
@View({
|
||||
templateUrl: 'package:angular2_material/src/components/grid_list/grid_list.html',
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MdGridList {
|
||||
export class MdGridList implements AfterContentChecked {
|
||||
/** Array of tiles that are being rendered. */
|
||||
tiles: MdGridTile[];
|
||||
|
||||
@ -225,14 +223,14 @@ export class MdGridList {
|
||||
'[style.left]': 'style.left',
|
||||
'[style.marginTop]': 'style.marginTop',
|
||||
'[style.paddingTop]': 'style.paddingTop',
|
||||
},
|
||||
lifecycle: [LifecycleEvent.OnDestroy, LifecycleEvent.OnChanges]
|
||||
}
|
||||
})
|
||||
@View({
|
||||
templateUrl: 'package:angular2_material/src/components/grid_list/grid_tile.html',
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MdGridTile {
|
||||
export class MdGridTile implements OnDestroy,
|
||||
OnChanges {
|
||||
gridList: MdGridList;
|
||||
_rowspan: number;
|
||||
_colspan: number;
|
||||
|
@ -1,4 +1,11 @@
|
||||
import {Directive, LifecycleEvent, Attribute, Host, SkipSelf} from 'angular2/angular2';
|
||||
import {
|
||||
Directive,
|
||||
LifecycleEvent,
|
||||
Attribute,
|
||||
Host,
|
||||
SkipSelf,
|
||||
AfterContentChecked
|
||||
} from 'angular2/angular2';
|
||||
|
||||
import {ObservableWrapper, EventEmitter} from 'angular2/src/core/facade/async';
|
||||
|
||||
@ -9,13 +16,12 @@ import {ObservableWrapper, EventEmitter} from 'angular2/src/core/facade/async';
|
||||
|
||||
@Directive({
|
||||
selector: 'md-input-container',
|
||||
lifecycle: [LifecycleEvent.AfterContentChecked],
|
||||
host: {
|
||||
'[class.md-input-has-value]': 'inputHasValue',
|
||||
'[class.md-input-focused]': 'inputHasFocus',
|
||||
}
|
||||
})
|
||||
export class MdInputContainer {
|
||||
export class MdInputContainer implements AfterContentChecked {
|
||||
// The MdInput or MdTextarea inside of this container.
|
||||
_input: MdInput;
|
||||
|
||||
|
@ -1,9 +1,15 @@
|
||||
import {Component, LifecycleEvent, View, ViewEncapsulation, Attribute} from 'angular2/angular2';
|
||||
import {
|
||||
Component,
|
||||
LifecycleEvent,
|
||||
View,
|
||||
ViewEncapsulation,
|
||||
Attribute,
|
||||
OnChanges
|
||||
} from 'angular2/angular2';
|
||||
import {CONST} from 'angular2/src/core/facade/lang';
|
||||
import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
|
||||
import {Math} from 'angular2/src/core/facade/math';
|
||||
|
||||
|
||||
/** Different display / behavior modes for progress-linear. */
|
||||
@CONST()
|
||||
class ProgressMode {
|
||||
@ -15,7 +21,6 @@ class ProgressMode {
|
||||
|
||||
@Component({
|
||||
selector: 'md-progress-linear',
|
||||
lifecycle: [LifecycleEvent.OnChanges],
|
||||
properties: ['value', 'bufferValue'],
|
||||
host: {
|
||||
'role': 'progressbar',
|
||||
@ -29,7 +34,7 @@ class ProgressMode {
|
||||
directives: [],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MdProgressLinear {
|
||||
export class MdProgressLinear implements OnChanges {
|
||||
/** Value for the primary bar. */
|
||||
value_: number;
|
||||
|
||||
|
@ -6,7 +6,9 @@ import {
|
||||
Host,
|
||||
SkipSelf,
|
||||
Attribute,
|
||||
Optional
|
||||
Optional,
|
||||
OnChanges,
|
||||
OnInit
|
||||
} from 'angular2/angular2';
|
||||
|
||||
import {isPresent, StringWrapper, NumberWrapper} from 'angular2/src/core/facade/lang';
|
||||
@ -33,7 +35,6 @@ var _uniqueIdCounter: number = 0;
|
||||
|
||||
@Component({
|
||||
selector: 'md-radio-group',
|
||||
lifecycle: [LifecycleEvent.OnChanges],
|
||||
events: ['change'],
|
||||
properties: ['disabled', 'value'],
|
||||
host: {
|
||||
@ -49,7 +50,7 @@ var _uniqueIdCounter: number = 0;
|
||||
templateUrl: 'package:angular2_material/src/components/radio/radio_group.html',
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MdRadioGroup {
|
||||
export class MdRadioGroup implements OnChanges {
|
||||
/** The selected value for the radio group. The value comes from the options. */
|
||||
value: any;
|
||||
|
||||
@ -191,7 +192,6 @@ export class MdRadioGroup {
|
||||
|
||||
@Component({
|
||||
selector: 'md-radio-button',
|
||||
lifecycle: [LifecycleEvent.OnInit],
|
||||
properties: ['id', 'name', 'value', 'checked', 'disabled'],
|
||||
host: {
|
||||
'role': 'radio',
|
||||
@ -207,7 +207,7 @@ export class MdRadioGroup {
|
||||
directives: [],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MdRadioButton {
|
||||
export class MdRadioButton implements OnInit {
|
||||
/** Whether this radio is checked. */
|
||||
checked: boolean;
|
||||
|
||||
|
Reference in New Issue
Block a user