Fixed #1108 - Add maximize event to Dialog

pull/1088/head
Cagatay Civici 2021-04-14 15:13:48 +03:00
parent b910825a84
commit 343e9a896e
3 changed files with 32 additions and 13 deletions

View File

@ -23,6 +23,8 @@ declare class Dialog {
$props: DialogProps;
$emit(eventName: 'show'): this;
$emit(eventName: 'hide'): this;
$emit(eventName: 'maximize'): this;
$emit(eventName: 'unmaximize'): this;
$slots: {
'': VNode[];
header: VNode[];

View File

@ -34,7 +34,7 @@ import Ripple from 'primevue/ripple';
export default {
inheritAttrs: false,
emits: ['update:visible', 'show', 'hide'],
emits: ['update:visible','show','hide','maximize','unmaximize'],
props: {
header: null,
footer: null,
@ -150,8 +150,15 @@ export default {
focusTarget.focus();
}
},
maximize() {
this.maximized = !this.maximized;
maximize(event) {
if (this.maximized) {
this.maximized = false;
this.$emit('unmaximize', event);
}
else {
this.maximized = true;
this.$emit('maximize', event);
}
if (!this.modal) {
if (this.maximized)

View File

@ -207,16 +207,26 @@ export default {
</tr>
</thead>
<tbody>
<tr>
<td>hide</td>
<td>event: Event object</td>
<td>Callback to invoke when dialog is hidden.</td>
</tr>
<tr>
<td>show</td>
<td>event: Event object</td>
<td>Callback to invoke when dialog is showed.</td>
</tr>
<tr>
<td>hide</td>
<td>event: Event object</td>
<td>Callback to invoke when dialog is hidden.</td>
</tr>
<tr>
<td>show</td>
<td>event: Event object</td>
<td>Callback to invoke when dialog is showed.</td>
</tr>
<tr>
<td>maximize</td>
<td>event: Event object</td>
<td>Fired when a dialog gets maximized.</td>
</tr>
<tr>
<td>unmaximize</td>
<td>event: Event object</td>
<td>Fire when a dialog gets unmaximized.</td>
</tr>
</tbody>
</table>
</div>