From e65a1ee1d4a66c86486558973dd4f831edd9777a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Wed, 5 Jul 2023 17:36:46 +0300 Subject: [PATCH] Refactor #3965 - Refactor on Dialog --- components/lib/dialog/BaseDialog.vue | 19 ++++++++++++------- components/lib/dialog/Dialog.vue | 6 ------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/components/lib/dialog/BaseDialog.vue b/components/lib/dialog/BaseDialog.vue index 9ddf7a929..4e30a72d4 100644 --- a/components/lib/dialog/BaseDialog.vue +++ b/components/lib/dialog/BaseDialog.vue @@ -160,13 +160,18 @@ const inlineStyles = { }; const classes = { - mask: ({ props, instance }) => [ - 'p-dialog-mask', - { - 'p-component-overlay p-component-overlay-enter': props.modal - }, - instance.getPositionClass() - ], + mask: ({ props }) => { + const positions = ['left', 'right', 'top', 'topleft', 'topright', 'bottom', 'bottomleft', 'bottomright']; + const pos = positions.find((item) => item === props.position); + + return [ + 'p-dialog-mask', + { + 'p-component-overlay p-component-overlay-enter': props.modal + }, + pos ? `p-dialog-${pos}` : '' + ]; + }, root: ({ props, instance }) => [ 'p-dialog p-component', { diff --git a/components/lib/dialog/Dialog.vue b/components/lib/dialog/Dialog.vue index 22b6b45f6..5346cd7ce 100755 --- a/components/lib/dialog/Dialog.vue +++ b/components/lib/dialog/Dialog.vue @@ -222,12 +222,6 @@ export default { this.documentKeydownListener = null; } }, - getPositionClass() { - const positions = ['left', 'right', 'top', 'topleft', 'topright', 'bottom', 'bottomleft', 'bottomright']; - const pos = positions.find((item) => item === this.position); - - return pos ? `p-dialog-${pos}` : ''; - }, containerRef(el) { this.container = el; },