From 343e9a896eb2181a816d71d647f65e8b1e50df37 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 14 Apr 2021 15:13:48 +0300 Subject: [PATCH] Fixed #1108 - Add maximize event to Dialog --- src/components/dialog/Dialog.d.ts | 2 ++ src/components/dialog/Dialog.vue | 13 ++++++++++--- src/views/dialog/DialogDoc.vue | 30 ++++++++++++++++++++---------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/components/dialog/Dialog.d.ts b/src/components/dialog/Dialog.d.ts index d0d420d3e..26041454f 100755 --- a/src/components/dialog/Dialog.d.ts +++ b/src/components/dialog/Dialog.d.ts @@ -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[]; diff --git a/src/components/dialog/Dialog.vue b/src/components/dialog/Dialog.vue index 91f0257d3..48ed0e3ff 100755 --- a/src/components/dialog/Dialog.vue +++ b/src/components/dialog/Dialog.vue @@ -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) diff --git a/src/views/dialog/DialogDoc.vue b/src/views/dialog/DialogDoc.vue index 172792328..89897f36f 100755 --- a/src/views/dialog/DialogDoc.vue +++ b/src/views/dialog/DialogDoc.vue @@ -207,16 +207,26 @@ export default { - - hide - event: Event object - Callback to invoke when dialog is hidden. - - - show - event: Event object - Callback to invoke when dialog is showed. - + + hide + event: Event object + Callback to invoke when dialog is hidden. + + + show + event: Event object + Callback to invoke when dialog is showed. + + + maximize + event: Event object + Fired when a dialog gets maximized. + + + unmaximize + event: Event object + Fire when a dialog gets unmaximized. +