added carousel changes

pull/5432/head
Rodrigo Sanchez 2024-03-18 14:28:01 +11:00
parent f8e22edf6d
commit e97f0eb05b
2 changed files with 92 additions and 76 deletions

View File

@ -121,7 +121,11 @@ const CarouselSlots = [
{
name: 'nexticon',
description: 'Custom next icon template.'
}
},
{
name: 'empty',
description: 'Custom content when there is no data to display.'
},
];
module.exports = {

View File

@ -4,6 +4,7 @@
<slot name="header"></slot>
</div>
<div :class="[cx('content'), contentClass]" v-bind="ptm('content')">
<template v-if="!empty">
<div :class="[cx('container'), containerClass]" :aria-live="allowAutoplay ? 'polite' : 'off'" v-bind="ptm('container')">
<button
v-if="showNavigators"
@ -88,6 +89,9 @@
/>
</li>
</ul>
</template>
<div v-else>
</div>
</div>
<div v-if="$slots.footer" :class="cx('footer')" v-bind="ptm('footer')">
<slot name="footer"></slot>
@ -231,8 +235,10 @@ export default {
this.d_oldNumVisible = this.d_numVisible;
this.d_oldValue = this.value;
if(!this.empty) {
this.$refs.itemsContainer.style.transform = this.isVertical() ? `translate3d(0, ${totalShiftedItems * (100 / this.d_numVisible)}%, 0)` : `translate3d(${totalShiftedItems * (100 / this.d_numVisible)}%, 0, 0)`;
}
}
if (isCircular) {
if (this.d_page === 0) {
@ -604,6 +610,12 @@ export default {
}
},
computed: {
empty() {
return !this.value || this.value.length === 0;
},
emptyMessageText() {
return this.$primevue.config?.locale?.emptyMessage || '';
},
totalIndicators() {
return this.value ? Math.max(Math.ceil((this.value.length - this.d_numVisible) / this.d_numScroll) + 1, 0) : 0;
},