Skip to content

Commit 521b111

Browse files
rafaelss95jelbourn
authored andcommitted
chore: add missing lifecycles interfaces to declarations (#10768)
1 parent ce0040d commit 521b111

File tree

40 files changed

+3753
-3607
lines changed

40 files changed

+3753
-3607
lines changed

package-lock.json

Lines changed: 3580 additions & 3473 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"axe-core": "^2.3.1",
6969
"axe-webdriverjs": "^1.1.1",
7070
"chalk": "^1.1.3",
71+
"codelyzer": "^4.3.0",
7172
"dgeni": "^0.4.9",
7273
"dgeni-packages": "^0.26.0",
7374
"firebase": "^4.0.0",

src/cdk-experimental/dialog/dialog-container.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,31 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
import {animate, AnimationEvent, state, style, transition, trigger} from '@angular/animations';
10+
import {FocusTrapFactory} from '@angular/cdk/a11y';
911
import {
10-
ElementRef,
11-
HostBinding,
12-
ViewChild,
13-
ComponentRef,
14-
EmbeddedViewRef,
12+
BasePortalOutlet,
13+
ComponentPortal,
14+
PortalHostDirective,
15+
TemplatePortal
16+
} from '@angular/cdk/portal';
17+
import {DOCUMENT} from '@angular/common';
18+
import {
19+
ChangeDetectionStrategy,
1520
ChangeDetectorRef,
1621
Component,
17-
Optional,
22+
ComponentRef,
23+
ElementRef,
24+
EmbeddedViewRef,
25+
HostBinding,
1826
Inject,
27+
OnDestroy,
28+
Optional,
29+
ViewChild,
1930
ViewEncapsulation,
20-
ChangeDetectionStrategy,
2131
} from '@angular/core';
22-
import {DOCUMENT} from '@angular/common';
23-
import {trigger, state, style, transition, animate, AnimationEvent} from '@angular/animations';
24-
import {
25-
BasePortalOutlet,
26-
PortalHostDirective,
27-
ComponentPortal,
28-
TemplatePortal
29-
} from '@angular/cdk/portal';
30-
import {FocusTrapFactory} from '@angular/cdk/a11y';
31-
import {DialogConfig} from './dialog-config';
3232
import {Subject} from 'rxjs';
33+
import {DialogConfig} from './dialog-config';
3334

3435

3536
export function throwDialogContentAlreadyAttachedError() {
@@ -63,7 +64,7 @@ export function throwDialogContentAlreadyAttachedError() {
6364
'(@dialog.done)': '_onAnimationDone($event)',
6465
},
6566
})
66-
export class CdkDialogContainer extends BasePortalOutlet {
67+
export class CdkDialogContainer extends BasePortalOutlet implements OnDestroy {
6768
/** State of the dialog animation. */
6869
_state: 'void' | 'enter' | 'exit' = 'enter';
6970

src/cdk/a11y/aria-describer/aria-describer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Inject,
1212
Injectable,
1313
InjectionToken,
14+
OnDestroy,
1415
Optional,
1516
SkipSelf,
1617
} from '@angular/core';
@@ -54,7 +55,7 @@ let messagesContainer: HTMLElement | null = null;
5455
* @docs-private
5556
*/
5657
@Injectable({providedIn: 'root'})
57-
export class AriaDescriber {
58+
export class AriaDescriber implements OnDestroy {
5859
private _document: Document;
5960

6061
constructor(@Inject(DOCUMENT) _document: any) {

src/cdk/portal/portal-directives.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
*/
88

99
import {
10-
NgModule,
10+
ComponentFactoryResolver,
1111
ComponentRef,
1212
Directive,
1313
EmbeddedViewRef,
14-
TemplateRef,
15-
ComponentFactoryResolver,
16-
ViewContainerRef,
14+
EventEmitter,
15+
NgModule,
1716
OnDestroy,
1817
OnInit,
19-
EventEmitter,
2018
Output,
19+
TemplateRef,
20+
ViewContainerRef,
2121
} from '@angular/core';
22-
import {Portal, TemplatePortal, ComponentPortal, BasePortalOutlet} from './portal';
22+
import {BasePortalOutlet, ComponentPortal, Portal, TemplatePortal} from './portal';
2323

2424

2525
/**
@@ -92,7 +92,7 @@ export class CdkPortalOutlet extends BasePortalOutlet implements OnInit, OnDestr
9292
this._attachedPortal = portal;
9393
}
9494

95-
@Output('attached') attached: EventEmitter<CdkPortalOutletAttachedRef> =
95+
@Output() attached: EventEmitter<CdkPortalOutletAttachedRef> =
9696
new EventEmitter<CdkPortalOutletAttachedRef>();
9797

9898
/** Component or view reference that is attached to the portal. */

src/cdk/table/row.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
IterableChanges,
1414
IterableDiffer,
1515
IterableDiffers,
16+
OnChanges,
1617
SimpleChanges,
1718
TemplateRef,
1819
ViewContainerRef,
@@ -30,7 +31,7 @@ export const CDK_ROW_TEMPLATE = `<ng-container cdkCellOutlet></ng-container>`;
3031
* Base class for the CdkHeaderRowDef and CdkRowDef that handles checking their columns inputs
3132
* for changes and notifying the table.
3233
*/
33-
export abstract class BaseRowDef {
34+
export abstract class BaseRowDef implements OnChanges {
3435
/** The columns to be displayed on this row. */
3536
columns: Iterable<string>;
3637

src/cdk/table/table.spec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import {CollectionViewer, DataSource} from '@angular/cdk/collections';
12
import {
3+
AfterContentInit,
24
Component,
35
ContentChild,
46
ContentChildren,
@@ -7,12 +9,13 @@ import {
79
Type,
810
ViewChild
911
} from '@angular/core';
10-
import {ComponentFixture, TestBed, fakeAsync, flush} from '@angular/core/testing';
11-
import {CdkTable} from './table';
12-
import {CollectionViewer, DataSource} from '@angular/cdk/collections';
13-
import {combineLatest, BehaviorSubject, Observable, of as observableOf} from 'rxjs';
12+
import {ComponentFixture, fakeAsync, flush, TestBed} from '@angular/core/testing';
13+
import {BehaviorSubject, combineLatest, Observable, of as observableOf} from 'rxjs';
1414
import {map} from 'rxjs/operators';
15+
import {CdkColumnDef} from './cell';
1516
import {CdkTableModule} from './index';
17+
import {CdkHeaderRowDef, CdkRowDef} from './row';
18+
import {CdkTable} from './table';
1619
import {
1720
getTableDuplicateColumnNameError,
1821
getTableMissingMatchingRowDefError,
@@ -21,8 +24,6 @@ import {
2124
getTableUnknownColumnError,
2225
getTableUnknownDataSourceError
2326
} from './table-errors';
24-
import {CdkHeaderRowDef, CdkRowDef} from './row';
25-
import {CdkColumnDef} from './cell';
2627

2728
describe('CdkTable', () => {
2829
let fixture: ComponentFixture<any>;
@@ -1502,7 +1503,7 @@ class RowContextCdkTableApp {
15021503
</cdk-table>
15031504
`
15041505
})
1505-
class WrapperCdkTableApp<T> {
1506+
class WrapperCdkTableApp<T> implements AfterContentInit {
15061507
@ContentChildren(CdkColumnDef) columnDefs: QueryList<CdkColumnDef>;
15071508
@ContentChild(CdkHeaderRowDef) headerRowDef: CdkHeaderRowDef;
15081509
@ContentChildren(CdkRowDef) rowDefs: QueryList<CdkRowDef<T>>;

src/cdk/table/table.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
import {CollectionViewer, DataSource} from '@angular/cdk/collections';
910
import {
1011
AfterContentChecked,
1112
Attribute,
@@ -22,6 +23,7 @@ import {
2223
IterableChangeRecord,
2324
IterableDiffer,
2425
IterableDiffers,
26+
OnDestroy,
2527
OnInit,
2628
QueryList,
2729
TemplateRef,
@@ -30,7 +32,9 @@ import {
3032
ViewContainerRef,
3133
ViewEncapsulation,
3234
} from '@angular/core';
33-
import {CollectionViewer, DataSource} from '@angular/cdk/collections';
35+
import {BehaviorSubject, Observable, of as observableOf, Subject, Subscription} from 'rxjs';
36+
import {takeUntil} from 'rxjs/operators';
37+
import {CdkColumnDef} from './cell';
3438
import {
3539
BaseRowDef,
3640
CdkCellOutlet,
@@ -40,9 +44,6 @@ import {
4044
CdkHeaderRowDef,
4145
CdkRowDef
4246
} from './row';
43-
import {takeUntil} from 'rxjs/operators';
44-
import {BehaviorSubject, Observable, of as observableOf, Subject, Subscription} from 'rxjs';
45-
import {CdkColumnDef} from './cell';
4647
import {
4748
getTableDuplicateColumnNameError,
4849
getTableMissingMatchingRowDefError,
@@ -144,7 +145,7 @@ export interface RenderRow<T> {
144145
encapsulation: ViewEncapsulation.None,
145146
changeDetection: ChangeDetectionStrategy.OnPush,
146147
})
147-
export class CdkTable<T> implements CollectionViewer, OnInit, AfterContentChecked {
148+
export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDestroy, OnInit {
148149
/** Subject that emits when the component has been destroyed. */
149150
private _onDestroy = new Subject<void>();
150151

src/cdk/tree/tree.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,34 @@
88
import {FocusableOption} from '@angular/cdk/a11y';
99
import {CollectionViewer, DataSource} from '@angular/cdk/collections';
1010
import {
11+
AfterContentChecked,
1112
ChangeDetectionStrategy,
1213
ChangeDetectorRef,
1314
Component,
1415
ContentChildren,
1516
Directive,
1617
ElementRef,
1718
Input,
18-
IterableDiffers,
19-
IterableDiffer,
2019
IterableChangeRecord,
20+
IterableDiffer,
21+
IterableDiffers,
2122
OnDestroy,
2223
OnInit,
2324
QueryList,
2425
ViewChild,
2526
ViewContainerRef,
2627
ViewEncapsulation
2728
} from '@angular/core';
28-
import {of, BehaviorSubject, Observable, Subject, Subscription} from 'rxjs';
29+
import {BehaviorSubject, Observable, of as observableOf, Subject, Subscription} from 'rxjs';
2930
import {takeUntil} from 'rxjs/operators';
31+
import {TreeControl} from './control/tree-control';
3032
import {CdkTreeNodeDef, CdkTreeNodeOutletContext} from './node';
3133
import {CdkTreeNodeOutlet} from './outlet';
32-
import {TreeControl} from './control/tree-control';
3334
import {
35+
getTreeControlFunctionsMissingError,
3436
getTreeControlMissingError,
3537
getTreeMissingMatchingNodeDefError,
3638
getTreeMultipleDefaultNodeDefsError,
37-
getTreeControlFunctionsMissingError,
3839
getTreeNoValidDataSourceError
3940
} from './tree-errors';
4041

@@ -130,7 +131,8 @@ export class CdkTreeNode<T> implements FocusableOption, OnDestroy {
130131
encapsulation: ViewEncapsulation.None,
131132
changeDetection: ChangeDetectionStrategy.OnPush
132133
})
133-
export class CdkTree<T> implements CollectionViewer, OnInit, OnDestroy {
134+
export class CdkTree<T>
135+
implements AfterContentChecked, CollectionViewer, OnDestroy, OnInit {
134136
/** Subject that emits when the component has been destroyed. */
135137
private _onDestroy = new Subject<void>();
136138

@@ -257,7 +259,7 @@ export class CdkTree<T> implements CollectionViewer, OnInit, OnDestroy {
257259
} else if (this._dataSource instanceof Observable) {
258260
dataStream = this._dataSource;
259261
} else if (Array.isArray(this._dataSource)) {
260-
dataStream = of(this._dataSource);
262+
dataStream = observableOf(this._dataSource);
261263
}
262264

263265
if (dataStream) {

src/demo-app/a11y/table/table-a11y.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Component, ViewChild} from '@angular/core';
109
import {DataSource} from '@angular/cdk/table';
11-
import {merge, Observable, BehaviorSubject} from 'rxjs';
12-
import {MatSort, MatPaginator} from '@angular/material';
10+
import {Component, OnInit, ViewChild} from '@angular/core';
11+
import {MatPaginator, MatSort} from '@angular/material';
12+
import {BehaviorSubject, merge, Observable} from 'rxjs';
1313
import {map} from 'rxjs/operators';
1414

1515

@@ -34,7 +34,7 @@ const exampleData = [
3434
templateUrl: 'table-a11y.html',
3535
styleUrls: ['table-a11y.css'],
3636
})
37-
export class TableAccessibilityDemo {
37+
export class TableAccessibilityDemo implements OnInit {
3838
@ViewChild(MatSort) sort: MatSort;
3939
@ViewChild(MatPaginator) pager: MatPaginator;
4040

0 commit comments

Comments
 (0)