-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(dialog): add md-dialog component #2855
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ad9617f
add ability to open dialog with templateRef
14ef81c
fix lint
bd19bd3
fix dialog templateRef test
dbb1676
separate component for content elements dialog demo with templateRef
1803505
add missing closing tag
75d2713
dialog element base
662703b
add md-dialog
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,53 +1,107 @@ | ||
<h1>Dialog demo</h1> | ||
|
||
<button md-raised-button color="primary" (click)="openJazz()" [disabled]="dialogRef">Open dialog</button> | ||
<button md-raised-button color="accent" (click)="openContentElement()">Open dialog with content elements</button> | ||
|
||
<md-card class="demo-dialog-card"> | ||
<md-card-content> | ||
<h2>Dialog dimensions</h2> | ||
|
||
<p> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.width" placeholder="Width"> | ||
</md-input-container> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.height" placeholder="Height"> | ||
</md-input-container> | ||
</p> | ||
|
||
<h2>Dialog position</h2> | ||
|
||
<p> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.position.top" (change)="config.position.bottom = ''" placeholder="Top"> | ||
</md-input-container> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.position.bottom" (change)="config.position.top = ''" placeholder="Bottom"> | ||
</md-input-container> | ||
</p> | ||
|
||
<p> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.position.left" (change)="config.position.right = ''" placeholder="Left"> | ||
</md-input-container> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.position.right" (change)="config.position.left = ''" placeholder="Right"> | ||
</md-input-container> | ||
</p> | ||
|
||
<h2>Other options</h2> | ||
|
||
<p> | ||
<md-select placeholder="Button alignment" [(ngModel)]="actionsAlignment"> | ||
<md-option>Start</md-option> | ||
<md-option value="end">End</md-option> | ||
<md-option value="center">Center</md-option> | ||
</md-select> | ||
</p> | ||
|
||
<md-checkbox [(ngModel)]="config.disableClose">Disable close</md-checkbox> | ||
</md-card-content> | ||
</md-card> | ||
|
||
<p>Last close result: {{lastCloseResult}}</p> | ||
<div class="demo-dialog-section"> | ||
|
||
<h2>Using <strong>MdDialog</strong> service</h2> | ||
|
||
<div class="demo-button-group"> | ||
<button md-raised-button color="primary" (click)="openJazz()" [disabled]="dialogRef">Open dialog</button> | ||
<button md-raised-button color="accent" (click)="openContentElement()">Open dialog with content elements</button> | ||
</div> | ||
|
||
<div class="demo-button-group"> | ||
<button md-raised-button color="primary" (click)="openJazzUsingTemplateRef()" [disabled]="dialogTemplateRef">Open dialog using TemplateRef</button> | ||
<button md-raised-button color="accent" (click)="openContentElementUsingTemplateRef()">Open dialog using TemplateRef with content elements</button> | ||
</div> | ||
|
||
<p *ngIf="lastCloseResult">Last close result: {{lastCloseResult}}</p> | ||
|
||
<template #jazzDialogRef> | ||
<demo-jazz-dialog-template-ref (close)="closeJazzUsingTemplateRef($event)"></demo-jazz-dialog-template-ref> | ||
</template> | ||
|
||
<template #contentElementRef> | ||
<demo-content-element-template-ref-dialog (close)="closeContentElementUsingTemplateRef()" [actionsAlignment]="actionsAlignment"></demo-content-element-template-ref-dialog> | ||
</template> | ||
|
||
</div> | ||
|
||
<div class="demo-dialog-section"> | ||
|
||
<h2>Using <strong>md-dialog</strong> element</h2> | ||
|
||
<div class="demo-button-group"> | ||
<button | ||
md-raised-button | ||
color="primary" | ||
(click)="changeMdDialogState(true)" | ||
[disabled]="mdDialogState"> | ||
Open md-dialog with content elements | ||
</button> | ||
</div> | ||
|
||
<md-dialog | ||
[open]="mdDialogState" | ||
(close)="changeMdDialogState(false)"> | ||
|
||
<demo-content-element-template-ref-dialog | ||
(close)="changeMdDialogState(false)" | ||
[actionsAlignment]="actionsAlignment"> | ||
</demo-content-element-template-ref-dialog> | ||
|
||
</md-dialog> | ||
|
||
</div> | ||
|
||
<div class="demo-dialog-section"> | ||
|
||
<h2>Dialog settings</h2> | ||
|
||
<md-card class="demo-dialog-card"> | ||
<md-card-content> | ||
<h2>Dialog dimensions</h2> | ||
|
||
<p> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.width" placeholder="Width"> | ||
</md-input-container> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.height" placeholder="Height"> | ||
</md-input-container> | ||
</p> | ||
|
||
<h2>Dialog position</h2> | ||
|
||
<p> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.position.top" (change)="config.position.bottom = ''" placeholder="Top"> | ||
</md-input-container> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.position.bottom" (change)="config.position.top = ''" placeholder="Bottom"> | ||
</md-input-container> | ||
</p> | ||
|
||
<p> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.position.left" (change)="config.position.right = ''" placeholder="Left"> | ||
</md-input-container> | ||
<md-input-container> | ||
<input mdInput [(ngModel)]="config.position.right" (change)="config.position.left = ''" placeholder="Right"> | ||
</md-input-container> | ||
</p> | ||
|
||
<h2>Other options</h2> | ||
|
||
<p> | ||
<md-select placeholder="Button alignment" [(ngModel)]="actionsAlignment"> | ||
<md-option>Start</md-option> | ||
<md-option value="end">End</md-option> | ||
<md-option value="center">Center</md-option> | ||
</md-select> | ||
</p> | ||
|
||
<md-checkbox [(ngModel)]="config.disableClose">Disable close</md-checkbox> | ||
</md-card-content> | ||
</md-card> | ||
|
||
</div> |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not a full review for now, but I would do this as a directive that is meant to go on a template element, so it would be either of
Mainly so that it doesn't leave a phantom
md-dialog
element in the DOMThere 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.
@jelbourn I think that would make using inputs/outputs impossible, wouldn't it?