Skip to content

Commit 07e102d

Browse files
committed
complete api; fix: #143 - Dialog that starts animating from a specific element
1 parent 2bb20e5 commit 07e102d

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

src/demo-app/app/dialog-declarative/dialog-declarative.component.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ <h5>Attributes of the mdl-dialog component</h5>
176176
</table>
177177

178178
<h5>Dialog configuration object</h5>
179-
179+
<p>Not all of these parameters are available for <i>alert</i> and <i>confirm</i>. If you need these
180+
parameters please use the <i>showDialog</i> method of the <i>MdlDialogService</i> to create these
181+
dialogs.</p>
180182
<table class="docu" mdl-shadow="2">
181183
<thead>
182184
<tr>
@@ -224,5 +226,22 @@ <h5>Dialog configuration object</h5>
224226
</td>
225227
</tr>
226228

229+
<tr>
230+
<td>openFrom?: <br/>MdlButtonComponent | <br/>MouseEvent | <br/>OpenCloseRect</td>
231+
<td>
232+
Use a show animation for the dialag that starts at a MdlButtonComponent, a MousEvent or a OpenCloseRect. From all
233+
of these types the top, left, width and height will be used to create the starting point and startings size of
234+
the dialog animation.
235+
</td>
236+
</tr>
237+
238+
<tr>
239+
<td>closeTo?: <br/>MdlButtonComponent | <br/>MouseEvent | <br/>OpenCloseRect</td>
240+
<td>
241+
Use a show animation for the dialag that ends at a MdlButtonComponent, a MousEvent or a OpenCloseRect. From all
242+
of these types the top, left, width and height will be used to create the end point and end size of
243+
the dialog animation.
244+
</td>
245+
</tr>
227246
</tbody>
228247
</table>

src/demo-app/app/dialog/dialog.component.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ <h5>Dialog with choises</h5>
7373
mdl-button-type="raised"
7474
mdl-colored="primary"
7575
mdl-ripple
76-
(click)="showDialogFullWidthAction()">Show Dialog with full width actions</button>
76+
(click)="showDialogFullWidthAction($event)">Show Dialog with full width actions</button>
7777

7878

7979
<pre prism>
@@ -105,7 +105,13 @@ <h5>Dialog with choises</h5>
105105
}
106106
],
107107
fullWidthAction: true,
108-
isModal: false
108+
isModal: false,
109+
openFrom: $event,
110+
closeTo: {
111+
left: document.body.offsetWidth/2,
112+
height: 0,
113+
top: document.body.offsetHeight/2,
114+
width: 0} as OpenCloseRect
109115
});
110116
pDialog.then( (dialogReference) => console.log('dialog visible', dialogReference) );
111117

src/demo-app/app/dialog/dialog.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
LoginDialogComponent,
1717
TEST_VALUE
1818
} from './login-dialog.component';
19+
import { OpenCloseRect } from '../../../lib/components/dialog/mdl-dialog-configuration';
1920

2021

2122
@Component({
@@ -60,7 +61,7 @@ export class DialogDemo extends AbstractDemoComponent {
6061
})
6162
}
6263

63-
public showDialogFullWidthAction() {
64+
public showDialogFullWidthAction($event: MouseEvent) {
6465
let pDialog = this.dialogService.showDialog({
6566
title: 'Your choice?',
6667
message: 'What drink do you prefer to your meal?',
@@ -86,7 +87,13 @@ export class DialogDemo extends AbstractDemoComponent {
8687
}
8788
],
8889
fullWidthAction: true,
89-
isModal: false
90+
isModal: false,
91+
openFrom: $event,
92+
closeTo: {
93+
left: document.body.offsetWidth/2,
94+
height: 0,
95+
top: document.body.offsetHeight/2,
96+
width: 0} as OpenCloseRect
9097
});
9198
pDialog.subscribe( (dialogReference) => console.log('dialog visible', dialogReference) );
9299
}

0 commit comments

Comments
 (0)