This repository has been archived by the owner on Feb 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MdDialog): add material2 overlay based dialog
- use portals and Overlay service to position and display user dialog content. - add basic documentation of API and usage - add example for three types of dialogs
- Loading branch information
1 parent
329dac2
commit 3a02410
Showing
14 changed files
with
341 additions
and
158 deletions.
There are no files selected for viewing
72 changes: 56 additions & 16 deletions
72
modules/docs/src/app/examples/dialog/dialog-basic-usage.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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
``` | ||
This example is currently broken. | ||
These components are a work in progress. | ||
``` |
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,28 @@ | ||
.md-dialog { | ||
md-dialog-actions { | ||
display: flex; | ||
order: 2; | ||
box-sizing: border-box; | ||
align-items: center; | ||
justify-content: flex-end; | ||
padding-top: $baseline-grid * 3; | ||
padding-right: $baseline-grid; | ||
padding-left: $baseline-grid * 2; | ||
|
||
// Align md-actions outside of the padding of .md-dialog | ||
margin-bottom: -$baseline-grid * 3; | ||
margin-left: -$baseline-grid * 3; | ||
margin-right: -$baseline-grid * 3; | ||
|
||
right: -$baseline-grid * 3; | ||
min-height: $baseline-grid * 6.5; | ||
overflow: hidden; | ||
|
||
[md-button], [md-raised-button] { | ||
margin-bottom: $baseline-grid; | ||
margin-left: $baseline-grid; | ||
margin-right: 0; | ||
margin-top: $baseline-grid; | ||
} | ||
} | ||
} |
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,20 @@ | ||
import {Component, Input, ChangeDetectionStrategy} from '@angular/core'; | ||
import {MdDialog} from './dialog'; | ||
|
||
@Component({ | ||
selector: 'md-dialog-actions', | ||
template: ` | ||
<button *ngIf="cancel" md-button type="button" (click)="dialog.close(false)"> | ||
<span>{{ cancel }}</span> | ||
</button> | ||
<button *ngIf="ok" md-button class="md-primary" type="button" (click)="dialog.close(true)"> | ||
<span>{{ ok }}</span> | ||
</button> | ||
<ng-content></ng-content>`, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class MdDialogActions { | ||
@Input() cancel: string; | ||
@Input() ok: string; | ||
@Input() dialog: MdDialog; | ||
} |
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,9 @@ | ||
import {Directive, ViewContainerRef, TemplateRef} from '@angular/core'; | ||
import {TemplatePortalDirective} from '@angular2-material/core'; | ||
|
||
@Directive({selector: '[mdDialogPortal]'}) | ||
export class MdDialogPortal extends TemplatePortalDirective { | ||
constructor(templateRef: TemplateRef<any>, viewContainerRef: ViewContainerRef) { | ||
super(templateRef, viewContainerRef); | ||
} | ||
} |
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,8 @@ | ||
@import "../../core/style/typography"; | ||
|
||
.md-dialog { | ||
md-dialog-title { | ||
@extend .md-headline; | ||
margin-bottom: 20px; | ||
} | ||
} |
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, Input, ChangeDetectionStrategy} from '@angular/core'; | ||
import {MdDialog} from './dialog'; | ||
|
||
@Component({ | ||
selector: 'md-dialog-title', | ||
template: `<h2 *ngIf="title">{{title}}</h2><ng-content></ng-content>`, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class MdDialogTitle { | ||
@Input() title: string; | ||
} |
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
Oops, something went wrong.