-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Schematic improvements #11191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schematic improvements #11191
Changes from all commits
111826c
e35554b
08174db
cf0fc06
46bddb4
320c2ec
eace06d
1eca79b
2acce79
366f42d
2f7c1aa
5237987
5fe8986
c9296c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { Component<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core'; | ||
import { map } from 'rxjs/operators'; | ||
import { Breakpoints, BreakpointState, BreakpointObserver } from '@angular/cdk/layout'; | ||
|
||
@Component({ | ||
selector: '<%= selector %>',<% if(inlineTemplate) { %> | ||
|
@@ -59,10 +61,26 @@ import { Component<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if( | |
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %> | ||
}) | ||
export class <%= classify(name) %>Component { | ||
cards = [ | ||
{ title: 'Card 1', cols: 2, rows: 1 }, | ||
{ title: 'Card 2', cols: 1, rows: 1 }, | ||
{ title: 'Card 3', cols: 1, rows: 2 }, | ||
{ title: 'Card 4', cols: 1, rows: 1 } | ||
]; | ||
/** Based on the screen size, switch from standard to one column per row */ | ||
cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
map(({ matches }) => { | ||
if (matches) { | ||
return [ | ||
{ title: 'Card 1', cols: 1, rows: 1 }, | ||
{ title: 'Card 2', cols: 1, rows: 1 }, | ||
{ title: 'Card 3', cols: 1, rows: 1 }, | ||
{ title: 'Card 4', cols: 1, rows: 1 } | ||
]; | ||
} | ||
|
||
return [ | ||
{ title: 'Card 1', cols: 2, rows: 1 }, | ||
{ title: 'Card 2', cols: 1, rows: 1 }, | ||
{ title: 'Card 3', cols: 1, rows: 2 }, | ||
{ title: 'Card 4', cols: 1, rows: 1 } | ||
]; | ||
}) | ||
); | ||
|
||
constructor(private breakpointObserver: BreakpointObserver) {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,9 @@ | |
|
||
.sidenav { | ||
width: 200px; | ||
box-shadow: 3px 0 6px rgba(0,0,0,.24); | ||
} | ||
|
||
.mat-toolbar.mat-primary { | ||
position: sticky; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we really be using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We actually use position sticky on the material docs site. Supports seems decent just missing IE11. |
||
top: 0; | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
<div class="mat-elevation-z8"> | ||
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements"> | ||
|
||
<table mat-table #table [dataSource]="dataSource" matSort aria-label="Elements"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't @andrewseguin already change this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. He changed the one in the component, not the one in the html file. |
||
<!-- Id Column --> | ||
<ng-container matColumnDef="id"> | ||
<mat-header-cell *matHeaderCellDef mat-sort-header>Id</mat-header-cell> | ||
<mat-cell *matCellDef="let row">{{row.id}}</mat-cell> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Id</th> | ||
<td mat-cell *matCellDef="let row">{{row.id}}</td> | ||
</ng-container> | ||
|
||
<!-- Name Column --> | ||
<ng-container matColumnDef="name"> | ||
<mat-header-cell *matHeaderCellDef mat-sort-header>Name</mat-header-cell> | ||
<mat-cell *matCellDef="let row">{{row.name}}</mat-cell> | ||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Name</th> | ||
<td mat-cell *matCellDef="let row">{{row.name}}</td> | ||
</ng-container> | ||
|
||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> | ||
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row> | ||
</mat-table> | ||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> | ||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> | ||
</table> | ||
|
||
<mat-paginator #paginator | ||
[length]="dataSource.data.length" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should keep the old name as an alias