Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add possibility to include scrollable table + example in docs (#869
) * Enhancement - add possibility to include scrollable table + example in docs * Replace fd-table--fixed class by adding overflow
- Loading branch information
Showing
7 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
docs/app/documentation/component-docs/table/examples/table-responsive-example.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<div fd-table-responsive-wrapper> | ||
<table fd-table> | ||
<thead> | ||
<tr> | ||
<th>Column 1</th> | ||
<th>Column 2</th> | ||
<th>Column 3</th> | ||
<th>Date</th> | ||
<th>Type</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let row of tableRows"> | ||
<td class="fd-has-font-weight-semi"><a href="#">{{row.column1}}</a></td> | ||
<td>{{row.column2}}</td> | ||
<td>{{row.column3}}</td> | ||
<td>{{row.date}}</td> | ||
<td><fd-icon [glyph]="row.type"></fd-icon></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> |
54 changes: 54 additions & 0 deletions
54
docs/app/documentation/component-docs/table/examples/table-responsive-example.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'fd-table-responsive-example', | ||
templateUrl: './table-responsive-example.component.html', | ||
styles: [` | ||
td { | ||
min-width: 200px; | ||
} | ||
`] | ||
}) | ||
export class TableResponsiveExampleComponent implements OnInit { | ||
tableRows; | ||
|
||
ngOnInit() { | ||
this.tableRows = [ | ||
{ | ||
column1: 'Row 1', | ||
column2: 'Row 1', | ||
column3: 'Row 1', | ||
date: '09-07-18', | ||
type: 'search' | ||
}, | ||
{ | ||
column1: 'Row 2', | ||
column2: 'Row 2', | ||
column3: 'Row 2', | ||
date: '09-08-18', | ||
type: 'cart' | ||
}, | ||
{ | ||
column1: 'Row 3', | ||
column2: 'Row 3', | ||
column3: 'Row 3', | ||
date: '02-14-18', | ||
type: 'calendar' | ||
}, | ||
{ | ||
column1: 'Row 4', | ||
column2: 'Row 4', | ||
column3: 'Row 4', | ||
date: '12-30-17', | ||
type: 'search' | ||
}, | ||
{ | ||
column1: 'Row 5', | ||
column2: 'Row 5', | ||
column3: 'Row 5', | ||
date: '11-12-18', | ||
type: 'search' | ||
} | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
library/src/lib/table/table-responsive-wrapper.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Directive } from '@angular/core'; | ||
/** | ||
* The directive that represents a table. | ||
* A table is a set of tabular data. Line items can support data, images and actions. | ||
* ```html | ||
* <div fd-table-responsive-wrapper> | ||
* <table fd-table> | ||
* </table> | ||
* </div> | ||
* ``` | ||
*/ | ||
@Directive({ | ||
// tslint:disable-next-line:directive-selector | ||
selector: '[fd-table-responsive-wrapper]', | ||
host: { | ||
style: 'overflow-x: auto' | ||
} | ||
}) | ||
export class TableResponsiveWrapperDirective {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters