Refactor #3965 - Refactor on Sidebar

This commit is contained in:
Tuğçe Küçükoğlu 2023-07-05 18:06:50 +03:00
parent e65a1ee1d4
commit 22498f1e61
2 changed files with 31 additions and 41 deletions

View file

@ -1,6 +1,6 @@
<template>
<Portal>
<div v-if="containerVisible" :ref="maskRef" @mousedown="onMaskClick" :class="cx('mask')" v-bind="ptm('mask')">
<div v-if="containerVisible" :ref="maskRef" @mousedown="onMaskClick" :class="cx('mask')" :style="sx('mask', true, { position })" v-bind="ptm('mask')">
<transition name="p-sidebar" @enter="onEnter" @after-enter="onAfterEnter" @before-leave="onBeforeLeave" @leave="onLeave" @after-leave="onAfterLeave" appear>
<div v-if="visible" :ref="containerRef" v-focustrap :class="cx('root')" role="complementary" :aria-modal="modal" @keydown="onKeydown" v-bind="{ ...$attrs, ...ptm('root') }">
<div :ref="headerContainerRef" :class="cx('header')" v-bind="ptm('header')">
@ -151,12 +151,6 @@ export default {
closeButtonRef(el) {
this.closeButton = el;
},
getPositionClass() {
const positions = ['left', 'right', 'top', 'bottom'];
const pos = positions.find((item) => item === this.position);
return pos ? `p-sidebar-${pos}` : '';
},
bindOutsideClickListener() {
if (!this.outsideClickListener) {
this.outsideClickListener = (event) => {