Skip to content

Commit

Permalink
Fixed #1599 - Modal layer enter-leave transition v2
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Sep 23, 2021
1 parent 7766023 commit 86470e6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 68 deletions.
20 changes: 5 additions & 15 deletions src/components/blockui/BlockUI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ export default {
},
methods: {
block() {
let styleClass = 'p-blockui p-component-overlay p-component-overlay-enter';
if (this.fullScreen) {
styleClass += ' p-blockui-document';
this.mask = document.createElement('div');
this.mask.setAttribute('class', 'p-blockui p-blockui-document');
this.mask.setAttribute('class', styleClass);
document.body.appendChild(this.mask);
DomHandler.addClass(document.body, 'p-overflow-hidden');
document.activeElement.blur();
Expand All @@ -53,26 +55,20 @@ export default {
const target = this.$children ? this.$children[0]: null;
if (target) {
this.mask = document.createElement('div');
this.mask.setAttribute('class', 'p-blockui');
this.mask.setAttribute('class', styleClass);
target.$el.appendChild(this.mask);
target.$el.style.position = 'relative';
}
}
if (this.mask) {
setTimeout(() => {
DomHandler.addClass(this.mask, 'p-component-overlay');
}, 1);
}
if (this.autoZIndex) {
this.mask.style.zIndex = String(this.baseZIndex + DomHandler.generateZIndex());
}
this.$emit('block');
},
unblock() {
DomHandler.addClass(this.mask, 'p-blockui-leave');
DomHandler.addClass(this.mask, 'p-component-overlay-leave');
this.mask.addEventListener('animationend', () => {
this.removeMask();
});
Expand All @@ -99,8 +95,6 @@ export default {
left: 0;
width: 100%;
height: 100%;
background-color: transparent;
transition-property: background-color;
}
.p-blockui.p-component-overlay {
Expand All @@ -110,8 +104,4 @@ export default {
.p-blockui-document.p-component-overlay {
position: fixed;
}
.p-blockui.p-blockui-leave.p-component-overlay {
background-color: transparent;
}
</style>
18 changes: 3 additions & 15 deletions src/components/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ export default {
if (!this.mask) {
this.mask = document.createElement('div');
this.mask.style.zIndex = String(parseInt(this.$refs.overlay.style.zIndex, 10) - 1);
DomHandler.addMultipleClasses(this.mask, 'p-datepicker-mask p-datepicker-mask-scrollblocker');
DomHandler.addMultipleClasses(this.mask, 'p-datepicker-mask p-datepicker-mask-scrollblocker p-component-overlay p-component-overlay-enter');
this.maskClickListener = () => {
this.overlayVisible = false;
Expand All @@ -1276,18 +1276,14 @@ export default {
document.body.appendChild(this.mask);
DomHandler.addClass(document.body, 'p-overflow-hidden');
setTimeout(() => {
DomHandler.addClass(this.mask, 'p-component-overlay');
}, 1);
}
},
disableModality() {
if (this.mask) {
this.overlayVisible = false;
DomHandler.addClass(this.mask, 'p-datepicker-mask-leave');
this.mask.addEventListener('transitionend', () => {
DomHandler.addClass(this.mask, 'p-component-overlay-leave');
this.mask.addEventListener('animationend', () => {
this.destroyMask();
});
}
Expand Down Expand Up @@ -2323,12 +2319,4 @@ export default {
transform: translate(-50%, -50%);
}
.p-datepicker-mask {
background-color: transparent;
transition-property: background-color;
}
.p-datepicker-mask.p-datepicker-mask-leave.p-component-overlay {
background-color: transparent;
}
</style>
20 changes: 7 additions & 13 deletions src/components/dialog/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ export default {
},
documentKeydownListener: null,
updated() {
this.removeStylesFromMask();
// this.removeStylesFromMask();
if (this.visible && !this.maskVisible) {
this.maskVisible = true;
}
if (this.modal && this.$refs.mask && !DomHandler.hasClass(this.$refs.mask, 'p-component-overlay')) {
DomHandler.addClass(this.$refs.mask, 'p-component-overlay');
}
// if (this.modal && this.$refs.mask && !DomHandler.hasClass(this.$refs.mask, 'p-component-overlay')) {
// DomHandler.addClass(this.$refs.mask, 'p-component-overlay');
// }
},
mounted() {
this.removeStylesFromMask();
// this.removeStylesFromMask();
},
beforeDestroy() {
this.restoreAppend();
Expand All @@ -119,7 +119,7 @@ export default {
this.enableDocumentSettings();
},
onBeforeLeave() {
DomHandler.addClass(this.$refs.mask, 'p-dialog-mask-leave');
// DomHandler.addClass(this.$refs.mask, 'p-dialog-mask-leave');
},
onLeave() {
this.$emit('hide');
Expand Down Expand Up @@ -266,7 +266,7 @@ export default {
};
},
maskClass() {
return ['p-dialog-mask', this.getPositionClass()];
return ['p-dialog-mask', {'p-component-overlay p-component-overlay-enter': this.modal}, this.getPositionClass()];
},
dialogClass() {
return ['p-dialog p-component', {
Expand Down Expand Up @@ -306,8 +306,6 @@ export default {
justify-content: center;
align-items: center;
pointer-events: none;
background-color: transparent;
transition-property: background-color;
}
.p-dialog-mask.p-component-overlay {
Expand Down Expand Up @@ -369,10 +367,6 @@ export default {
transform: scale(0.7);
}
.p-dialog-mask.p-dialog-mask-leave {
background-color: transparent;
}
/* Top, Bottom, Left, Right, Top* and Bottom* */
.p-dialog-top .p-dialog,
.p-dialog-bottom .p-dialog,
Expand Down
10 changes: 2 additions & 8 deletions src/components/galleria/Galleria.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default {
DomHandler.addClass(document.body, 'p-overflow-hidden');
},
onBeforeLeave() {
DomHandler.addClass(this.$refs.mask, 'p-galleria-mask-leave');
DomHandler.addClass(this.$refs.mask, 'p-component-overlay-leave');
},
onAfterLeave() {
this.maskVisible = false;
Expand Down Expand Up @@ -179,7 +179,7 @@ export default {
},
computed: {
maskContentClass() {
return ['p-galleria-mask', {
return ['p-galleria-mask p-component-overlay p-component-overlay-enter', {
'p-galleria-visible': this.visible
}, this.maskClass];
}
Expand Down Expand Up @@ -428,8 +428,6 @@ export default {
display: flex;
align-items: center;
justify-content: center;
background-color: transparent;
transition-property: background-color;
}
.p-galleria-close {
Expand Down Expand Up @@ -467,10 +465,6 @@ export default {
opacity: 0;
}
.p-galleria-mask.p-galleria-mask-leave {
background-color: transparent;
}
/* Keyboard Support */
.p-items-hidden .p-galleria-thumbnail-item {
visibility: hidden;
Expand Down
2 changes: 1 addition & 1 deletion src/components/imagepreview/ImagePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default {
.p-image-preview-leave-active {
transition: all 150ms cubic-bezier(0.4, 0.0, 0.2, 1);
}
.p-image-preview-enter-from,
.p-image-preview-enter,
.p-image-preview-leave-to {
opacity: 0;
transform: scale(0.7);
Expand Down
19 changes: 3 additions & 16 deletions src/components/sidebar/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,19 @@ export default {
enableModality() {
if (!this.mask) {
this.mask = document.createElement('div');
this.mask.setAttribute('class', 'p-sidebar-mask');
this.mask.setAttribute('class', 'p-sidebar-mask p-component-overlay p-component-overlay-enter');
this.mask.style.zIndex = String(parseInt(this.$refs.container.style.zIndex, 10) - 1);
if (this.dismissable) {
this.bindMaskClickListener();
}
document.body.appendChild(this.mask);
DomHandler.addClass(document.body, 'p-overflow-hidden');
setTimeout(() => {
DomHandler.addClass(this.mask, 'p-component-overlay');
}, 1);
}
},
disableModality() {
if (this.mask) {
DomHandler.addClass(this.mask, 'p-sidebar-mask-leave');
this.mask.addEventListener('transitionend', () => {
DomHandler.addClass(this.mask, 'p-component-overlay-leave');
this.mask.addEventListener('animationend', () => {
this.destroyModal();
});
}
Expand Down Expand Up @@ -173,15 +169,6 @@ export default {
justify-content: center;
}
.p-sidebar-mask {
background-color: transparent;
transition-property: background-color;
}
.p-sidebar-mask.p-sidebar-mask-leave.p-component-overlay {
background-color: transparent;
}
.p-sidebar-left {
top: 0;
left: 0;
Expand Down

0 comments on commit 86470e6

Please sign in to comment.