pull/358/head
cagataycivici 2020-06-19 12:16:06 +03:00
commit 69cab0e8cb
3 changed files with 69 additions and 19 deletions

View File

@ -524,6 +524,7 @@ export default {
.p-carousel-items-content { .p-carousel-items-content {
overflow: hidden; overflow: hidden;
width: 100%;
} }
.p-carousel-items-container { .p-carousel-items-container {
@ -562,4 +563,4 @@ export default {
.p-items-hidden .p-carousel-item.p-carousel-item-active { .p-items-hidden .p-carousel-item.p-carousel-item-active {
visibility: visible; visibility: visible;
} }
</style> </style>

View File

@ -239,7 +239,6 @@ export default {
return true; return true;
}, },
onDragEnter(event) { onDragEnter(event) {
console.log('enter');
if (!this.disabled) { if (!this.disabled) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();

View File

@ -1,6 +1,8 @@
<template> <template>
<div v-if="fullScreen && visible" ref="mask" :class="maskContentClass"> <div v-if="fullScreen && (maskVisible || visible)" ref="mask" :class="maskContentClass">
<GalleriaContent v-bind="$props" @maskHide="maskHide" :templates="$scopedSlots" @activeItemChange="onActiveItemChange" /> <transition name="p-galleria" @enter="onEnter" @before-leave="onBeforeLeave" @after-leave="onAfterLeave" @appear="onAppear">
<GalleriaContent v-if="visible" v-bind="$props" @maskHide="maskHide" :templates="$scopedSlots" @activeItemChange="onActiveItemChange" />
</transition>
</div> </div>
<GalleriaContent v-else-if="!fullScreen" v-bind="$props" :templates="$scopedSlots" @activeItemChange="onActiveItemChange" /> <GalleriaContent v-else-if="!fullScreen" v-bind="$props" :templates="$scopedSlots" @activeItemChange="onActiveItemChange" />
@ -110,20 +112,16 @@ export default {
default: null default: null
} }
}, },
data() {
return {
maskVisible: this.visible
}
},
updated() { updated() {
this.removeStylesFromMask(); this.removeStylesFromMask();
if (this.fullScreen) { if (this.fullScreen && this.visible && !this.maskVisible) {
if (this.visible) { this.maskVisible = true;
DomHandler.addClass(document.body, 'p-overflow-hidden');
if (this.$refs.mask) {
this.$refs.mask.style.zIndex = String(this.baseZIndex + DomHandler.generateZIndex());
}
}
else {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
}
} }
}, },
mounted() { mounted() {
@ -135,6 +133,26 @@ export default {
} }
}, },
methods: { methods: {
onEnter() {
this.$refs.mask.style.zIndex = String(this.baseZIndex + DomHandler.generateZIndex());
DomHandler.addClass(document.body, 'p-overflow-hidden');
},
onBeforeLeave() {
DomHandler.addClass(this.$refs.mask, 'p-galleria-mask-leave');
},
onAfterLeave() {
this.maskVisible = false;
DomHandler.removeClass(document.body, 'p-overflow-hidden');
},
onAppear() {
if (this.visible) {
this.onEnter();
setTimeout(() => {
DomHandler.addClass(this.$refs.mask, 'p-component-overlay');
}, 1);
}
},
onActiveItemChange(index) { onActiveItemChange(index) {
if (this.activeIndex !== index) { if (this.activeIndex !== index) {
this.$emit('update:activeIndex', index); this.$emit('update:activeIndex', index);
@ -154,14 +172,14 @@ export default {
this.galleriaClasses = this.$vnode.data.class || this.$vnode.data.staticClass; this.galleriaClasses = this.$vnode.data.class || this.$vnode.data.staticClass;
if (this.galleriaClasses) { if (this.galleriaClasses) {
this.$refs.mask.classList = 'p-galleria-mask p-component-overlay' + (this.visible && ' p-galleria-visible'); this.$refs.mask.classList = 'p-galleria-mask' + (this.visible && ' p-galleria-visible');
} }
} }
} }
}, },
computed: { computed: {
maskContentClass() { maskContentClass() {
return ['p-galleria-mask p-component-overlay', { return ['p-galleria-mask', {
'p-galleria-visible': this.visible 'p-galleria-visible': this.visible
}, this.maskClass]; }, this.maskClass];
} }
@ -285,10 +303,13 @@ export default {
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
opacity: .5; opacity: .5;
}
.p-galleria-thumbnail-item:hover {
opacity: 1;
transition: opacity .3s; transition: opacity .3s;
} }
.p-galleria-thumbnail-item:hover,
.p-galleria-thumbnail-item-current { .p-galleria-thumbnail-item-current {
opacity: 1; opacity: 1;
} }
@ -395,10 +416,16 @@ export default {
/* FullScreen */ /* FullScreen */
.p-galleria-mask { .p-galleria-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: fixed; background-color: transparent;
transition-property: background-color;
} }
.p-galleria-close { .p-galleria-close {
@ -416,6 +443,29 @@ export default {
margin-top: -.5rem; margin-top: -.5rem;
} }
/* Animation */
.p-galleria-enter-active {
transition: all 150ms cubic-bezier(0, 0, 0.2, 1);
}
.p-galleria-leave-active {
transition: all 150ms cubic-bezier(0.4, 0.0, 0.2, 1);
}
.p-galleria-enter,
.p-galleria-leave-to {
opacity: 0;
transform: scale(0.7);
}
.p-galleria-enter-active .p-galleria-item-nav {
opacity: 0;
}
.p-galleria-mask.p-galleria-mask-leave {
background-color: transparent;
}
/* Keyboard Support */ /* Keyboard Support */
.p-items-hidden .p-galleria-thumbnail-item { .p-items-hidden .p-galleria-thumbnail-item {
visibility: hidden; visibility: hidden;