Skip to content

Commit 641ec76

Browse files
committed
docs(table): add missing table Jsdoc
1 parent 38b4265 commit 641ec76

19 files changed

+48
-36
lines changed

guides/cdk-table.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ The table provides a foundation upon which other features, such as sorting and p
66
built. Because it enforces no opinions on these matters, developers have full control over the
77
interaction patterns associated with the table.
88

9-
For a Material Design styled table, see the documentation for `<md-table>` which builds on top of
10-
the CDK data-table.
9+
For a Material Design styled table, see the
10+
[documentation for `<md-table>`](https://material.angular.io/components/table) which builds on
11+
top of the CDK data-table.
1112

1213
<!-- example(cdk-table-basic) -->
1314

@@ -117,12 +118,9 @@ sorting and pagination.
117118

118119
##### `trackBy`
119120
To improve performance, a trackBy function can be provided to the table similar to Angular’s
120-
(`ngFor` trackBy)[trackBy]. This informs the table how to uniquely identify rows to track how the
121-
data changes with each update.
121+
[`ngFor` trackBy](https://angular.io/api/common/NgForOf#change-propagation). This informs the
122+
table how to uniquely identify rows to track how the data changes with each update.
122123

123124
```html
124125
<cdk-table [dataSource]="dataSource" [trackBy]="myTrackById">
125126
```
126-
127-
128-
[trackBy][https://angular.io/api/common/NgForOf#change-propagation]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@angular/http": "~4.1.0",
3535
"@angular/platform-browser": "~4.1.0",
3636
"core-js": "^2.4.1",
37+
"material2-build-tools": "file:tools/package-tools",
3738
"rxjs": "^5.0.1",
3839
"systemjs": "0.19.43",
3940
"tslib": "^1.7.1",

src/cdk/table/cell.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ export class CdkHeaderCellDef {
3232
*/
3333
@Directive({selector: '[cdkColumnDef]'})
3434
export class CdkColumnDef {
35+
/** Unique name for this column. */
3536
@Input('cdkColumnDef') name: string;
3637

38+
/** @docs-private */
3739
@ContentChild(CdkCellDef) cell: CdkCellDef;
40+
41+
/** @docs-private */
3842
@ContentChild(CdkHeaderCellDef) headerCell: CdkHeaderCellDef;
3943
}
4044

src/cdk/table/data-source.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ export interface CollectionViewer {
1313
}
1414

1515
export abstract class DataSource<T> {
16+
/**
17+
* Connects a collection viewer (such as a data-table) to this data source.
18+
* @param collectionViewer The component that exposes a view over the data provided by this
19+
* data source.
20+
* @returns Observable that emits a new value when the data changes.
21+
*/
1622
abstract connect(collectionViewer: CollectionViewer): Observable<T[]>;
23+
24+
/**
25+
* Disconnects a collection viewer (such as a data-table) from this data source. Can be used
26+
* to perform any clean-up or tear-down operations when a view is being destroyed.
27+
*
28+
* @param collectionViewer The component that exposes a view over the data provided by this
29+
* data source.
30+
*/
1731
abstract disconnect(collectionViewer: CollectionViewer): void;
1832
}

src/lib/sort/sort-header-intl.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ import {SortDirection} from './sort-direction';
1515
*/
1616
@Injectable()
1717
export class MdSortHeaderIntl {
18-
sortButtonLabel = (id: string) => {
18+
/** Function that, given the column ID, returns the label for the sort header. */
19+
sortButtonLabel: (string) => string = (id: string) => {
1920
return `Change sorting for ${id}`;
20-
}
21+
};
2122

22-
/** A label to describe the current sort (visible only to screenreaders). */
23-
sortDescriptionLabel = (id: string, direction: SortDirection) => {
24-
return `Sorted by ${id} ${direction == 'asc' ? 'ascending' : 'descending'}`;
25-
}
23+
/**
24+
* Function that, given the column ID and sort direction, returns the label for the active sort
25+
* state.
26+
*/
27+
sortDescriptionLabel: (string, SortDirection) => string =
28+
(id: string, direction: SortDirection) => {
29+
return `Sorted by ${id} ${direction == 'asc' ? 'ascending' : 'descending'}`;
30+
};
2631
}

src/lib/sort/sort-header.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {Subscription} from 'rxjs/Subscription';
3939
changeDetection: ChangeDetectionStrategy.OnPush,
4040
})
4141
export class MdSortHeader implements MdSortable {
42+
/** @docs-private */
4243
sortSubscription: Subscription;
4344

4445
/**

src/lib/table/table.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ instead of `cdk-`.
1010
Note that the column definition directives (`cdkColumnDef` and `cdkHeaderCellDef`) are still
1111
prefixed with `cdk-`.
1212

13-
For more information on the interface and how it works, see the guide covering the CDK data-table.
13+
For more information on the interface and how it works, see the
14+
[guide covering the CDK data-table](https://material.angular.io/guides/cdk-table).
1415

1516
### Features
1617

@@ -46,4 +47,4 @@ an update via the table's data source.
4647

4748
In the near future, we will provide a simplified version of the data-table with an easy-to-use
4849
interface, material styling, array input, and more out-of-the-box features (sorting, pagination,
49-
and selection).
50+
and selection).
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<md-input-container class="example-input-container">
22
<input mdInput type="text" placeholder="Clearable input" [(ngModel)]="value"/>
3-
<md-button *ngIf="value" mdSuffix md-icon-button aria-label="Clear" (click)="value=''">
3+
<button md-button *ngIf="value" mdSuffix md-icon-button aria-label="Clear" (click)="value=''">
44
<md-icon>close</md-icon>
5-
</md-button>
5+
</button>
66
</md-input-container>

src/material-examples/table-basic/table-basic-example.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
display: flex;
44
flex-direction: column;
55
max-height: 500px;
6-
background: white;
76
min-width: 300px;
87
}
98

src/material-examples/table-basic/table-basic-example.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<div class="example-container mat-elevation-z8">
2-
<div class="example-header"> Users </div>
3-
42
<md-table #table [dataSource]="dataSource">
53

64
<!--- Note that these columns can be defined in any order.
@@ -33,4 +31,4 @@
3331
<md-header-row *cdkHeaderRowDef="displayedColumns"></md-header-row>
3432
<md-row *cdkRowDef="let row; columns: displayedColumns;"></md-row>
3533
</md-table>
36-
</div>
34+
</div>

src/material-examples/table-filtering/table-filtering-example.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
display: flex;
44
flex-direction: column;
55
max-height: 500px;
6-
background: white;
76
min-width: 300px;
87
}
98

src/material-examples/table-filtering/table-filtering-example.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<div class="example-container mat-elevation-z8">
22
<div class="example-header">
3-
Users
4-
53
<md-input-container floatPlaceholder="never">
64
<input mdInput #filter placeholder="Filter users">
75
</md-input-container>
@@ -39,4 +37,4 @@
3937
<md-header-row *cdkHeaderRowDef="displayedColumns"></md-header-row>
4038
<md-row *cdkRowDef="let row; columns: displayedColumns;"></md-row>
4139
</md-table>
42-
</div>
40+
</div>

src/material-examples/table-overview/table-overview-example.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
display: flex;
44
flex-direction: column;
55
max-height: 500px;
6-
background: white;
76
min-width: 300px;
87
}
98

src/material-examples/table-overview/table-overview-example.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<div class="example-container mat-elevation-z8">
22
<div class="example-header" [style.display]="selection.isEmpty() ? '' : 'none'">
3-
Users
4-
53
<md-input-container floatPlaceholder="never">
64
<input mdInput #filter placeholder="Filter users">
75
</md-input-container>

src/material-examples/table-pagination/table-pagination-example.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
display: flex;
44
flex-direction: column;
55
max-height: 500px;
6-
background: white;
76
min-width: 300px;
87
}
98

src/material-examples/table-pagination/table-pagination-example.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<div class="example-container mat-elevation-z8">
2-
<div class="example-header"> Users </div>
32

43
<md-table #table [dataSource]="dataSource">
54

@@ -40,4 +39,4 @@
4039
[pageSize]="25"
4140
[pageSizeOptions]="[5, 10, 25, 100]">
4241
</md-paginator>
43-
</div>
42+
</div>

src/material-examples/table-sorting/table-sorting-example.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
display: flex;
44
flex-direction: column;
55
max-height: 500px;
6-
background: white;
76
min-width: 300px;
87
}
98

@@ -21,4 +20,4 @@
2120

2221
.mat-header-cell .mat-sort-header-sorted {
2322
color: black;
24-
}
23+
}

src/material-examples/table-sorting/table-sorting-example.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<div class="example-container mat-elevation-z8">
2-
<div class="example-header"> Users </div>
3-
42
<md-table #table [dataSource]="dataSource" mdSort>
53

64
<!--- Note that these columns can be defined in any order.
@@ -33,4 +31,4 @@
3331
<md-header-row *cdkHeaderRowDef="displayedColumns"></md-header-row>
3432
<md-row *cdkRowDef="let row; columns: displayedColumns;"></md-row>
3533
</md-table>
36-
</div>
34+
</div>

tools/dgeni/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ let apiDocsPackage = new DgeniPackage('material2-api-docs', dgeniPackageDeps)
115115
'lib/slide-toggle/index.ts',
116116
'lib/slider/index.ts',
117117
'lib/snack-bar/index.ts',
118+
'lib/sort/index.ts',
119+
'lib/table/index.ts',
118120
'lib/tabs/index.ts',
119121
'lib/toolbar/index.ts',
120122
'lib/tooltip/index.ts',

0 commit comments

Comments
 (0)