forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stepper): allow for content to be rendered lazily
Adds the `matStepContent` directive that allows consumers to defer rendering the content of a step until it is opened for the first time. Fixes angular#12339.
- Loading branch information
Showing
13 changed files
with
178 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {Directive, TemplateRef} from '@angular/core'; | ||
|
||
/** | ||
* Content for a `mat-step` that will be rendered lazily. | ||
*/ | ||
@Directive({ | ||
selector: 'ng-template[matStepContent]' | ||
}) | ||
export class MatStepContent { | ||
constructor(public _template: TemplateRef<any>) {} | ||
} |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
<ng-template><ng-content></ng-content></ng-template> | ||
<ng-template> | ||
<ng-content></ng-content> | ||
<ng-template [cdkPortalOutlet]="_portal"></ng-template> | ||
</ng-template> |
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
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
1 change: 1 addition & 0 deletions
1
src/material-examples/stepper-lazy-content/stepper-lazy-content-example.css
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 @@ | ||
/** No CSS for this example */ |
22 changes: 22 additions & 0 deletions
22
src/material-examples/stepper-lazy-content/stepper-lazy-content-example.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 @@ | ||
<mat-vertical-stepper> | ||
<mat-step> | ||
<ng-template matStepLabel>Step 1</ng-template> | ||
<ng-template matStepContent> | ||
<p>This content was rendered lazily</p> | ||
<button mat-button matStepperNext>Next</button> | ||
</ng-template> | ||
</mat-step> | ||
<mat-step> | ||
<ng-template matStepLabel>Step 2</ng-template> | ||
<ng-template matStepContent> | ||
<p>This content was also rendered lazily</p> | ||
<button mat-button matStepperPrevious>Back</button> | ||
<button mat-button matStepperNext>Next</button> | ||
</ng-template> | ||
</mat-step> | ||
<mat-step> | ||
<ng-template matStepLabel>Step 3</ng-template> | ||
<p>This content was rendered eagerly</p> | ||
<button mat-button matStepperPrevious>Back</button> | ||
</mat-step> | ||
</mat-vertical-stepper> |
11 changes: 11 additions & 0 deletions
11
src/material-examples/stepper-lazy-content/stepper-lazy-content-example.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,11 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
/** | ||
* @title Stepper lazy content rendering | ||
*/ | ||
@Component({ | ||
selector: 'stepper-lazy-content-example', | ||
templateUrl: 'stepper-lazy-content-example.html', | ||
styleUrls: ['stepper-lazy-content-example.css'], | ||
}) | ||
export class StepperLazyContentExample {} |
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