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; $props: DialogProps;
$emit(eventName: 'show'): this; $emit(eventName: 'show'): this;
$emit(eventName: 'hide'): this; $emit(eventName: 'hide'): this;
$emit(eventName: 'maximize'): this;
$emit(eventName: 'unmaximize'): this;
$slots: { $slots: {
'': VNode[]; '': VNode[];
header: VNode[]; header: VNode[];

View File

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

View File

@ -216,6 +216,16 @@ export default {
<td>show</td> <td>show</td>
<td>event: Event object</td> <td>event: Event object</td>
<td>Callback to invoke when dialog is showed.</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> </tr>
</tbody> </tbody>
</table> </table>