diff --git a/src/components/galleria/Galleria.d.ts b/src/components/galleria/Galleria.d.ts index 9c8ffe01a..1b0f04511 100755 --- a/src/components/galleria/Galleria.d.ts +++ b/src/components/galleria/Galleria.d.ts @@ -3,7 +3,7 @@ import Vue, {VNode} from 'vue'; export declare class Galleria extends Vue { id?: string; value?: any; - activeItemIndex?: number; + activeIndex?: number; fullScreen?: boolean; visible?: boolean; numVisible?: number; diff --git a/src/components/galleria/Galleria.vue b/src/components/galleria/Galleria.vue index 5b10daca6..02696446f 100755 --- a/src/components/galleria/Galleria.vue +++ b/src/components/galleria/Galleria.vue @@ -21,7 +21,7 @@ export default { type: Array, default: null }, - activeItemIndex: { + activeIndex: { type: Number, default: 0 }, @@ -136,8 +136,8 @@ export default { }, methods: { onActiveItemChange(index) { - if (this.activeItemIndex !== index) { - this.$emit('update:activeItemIndex', index); + if (this.activeIndex !== index) { + this.$emit('update:activeIndex', index); } }, maskHide() { diff --git a/src/components/galleria/GalleriaContent.vue b/src/components/galleria/GalleriaContent.vue index 37da3addc..db08f01f8 100755 --- a/src/components/galleria/GalleriaContent.vue +++ b/src/components/galleria/GalleriaContent.vue @@ -7,12 +7,12 @@
- - @@ -35,17 +35,17 @@ export default { data() { return { id: this.$attrs.id || UniqueComponentId(), - activeItemIndex: this.$attrs.activeItemIndex, + activeIndex: this.$attrs.activeIndex, slideShowActive: false } }, watch: { - '$attrs.activeItemIndex': function(newVal) { - this.activeItemIndex = newVal; + '$attrs.activeIndex': function(newVal) { + this.activeIndex = newVal; } }, updated() { - this.$emit('activeItemChange', this.activeItemIndex); + this.$emit('activeItemChange', this.activeIndex); }, beforeDestroy() { if (this.slideShowActive) { @@ -58,8 +58,8 @@ export default { }, startSlideShow() { this.interval = setInterval(() => { - let activeIndex = (this.$attrs.circular && (this.$attrs.value.length - 1) === this.activeItemIndex) ? 0 : (this.activeItemIndex + 1); - this.activeItemIndex = activeIndex; + let activeIndex = (this.$attrs.circular && (this.$attrs.value.length - 1) === this.activeIndex) ? 0 : (this.activeIndex + 1); + this.activeIndex = activeIndex; }, this.$attrs.transitionInterval); this.slideShowActive = true; diff --git a/src/components/galleria/GalleriaItem.vue b/src/components/galleria/GalleriaItem.vue index 2613345b5..ad7ba6e9c 100755 --- a/src/components/galleria/GalleriaItem.vue +++ b/src/components/galleria/GalleriaItem.vue @@ -34,7 +34,7 @@ export default { type: Boolean, default: false }, - activeItemIndex: { + activeIndex: { type: Number, default: 0 }, @@ -74,20 +74,20 @@ export default { }, methods: { next() { - let nextItemIndex = this.activeItemIndex + 1; - let activeIndex = this.circular && this.value.length - 1 === this.activeItemIndex + let nextItemIndex = this.activeIndex + 1; + let activeIndex = this.circular && this.value.length - 1 === this.activeIndex ? 0 : nextItemIndex; - this.$emit('update:activeItemIndex', activeIndex); + this.$emit('update:activeIndex', activeIndex); }, prev() { - let prevItemIndex = this.activeItemIndex !== 0 ? this.activeItemIndex - 1 : 0; - let activeIndex = this.circular && this.activeItemIndex === 0 + let prevItemIndex = this.activeIndex !== 0 ? this.activeIndex - 1 : 0; + let activeIndex = this.circular && this.activeIndex === 0 ? this.value.length - 1 : prevItemIndex - this.$emit('update:activeItemIndex', activeIndex); + this.$emit('update:activeIndex', activeIndex); }, stopSlideShow() { if (this.slideShowActive && this.stopSlideShow) { @@ -112,33 +112,33 @@ export default { }, onIndicatorClick(index) { this.stopSlideShow(); - this.$emit('update:activeItemIndex', index); + this.$emit('update:activeIndex', index); }, onIndicatorMouseEnter(index) { if (this.changeItemOnIndicatorHover) { this.stopSlideShow(); - this.$emit('update:activeItemIndex', index); + this.$emit('update:activeIndex', index); } }, onIndicatorKeyDown(index) { this.stopSlideShow(); - this.$emit('update:activeItemIndex', index); + this.$emit('update:activeIndex', index); }, isIndicatorItemActive(index) { - return this.activeItemIndex === index; + return this.activeIndex === index; }, isNavBackwardDisabled() { - return !this.circular && this.activeItemIndex === 0; + return !this.circular && this.activeIndex === 0; }, isNavForwardDisabled() { - return !this.circular && this.activeItemIndex === (this.value.length - 1); + return !this.circular && this.activeIndex === (this.value.length - 1); } }, computed: { activeItem() { - return this.value[this.activeItemIndex]; + return this.value[this.activeIndex]; }, navBackwardClass() { return ['p-galleria-item-prev p-galleria-item-nav p-link', { diff --git a/src/components/galleria/GalleriaThumbnails.vue b/src/components/galleria/GalleriaThumbnails.vue index 065d73ba5..33b72e9a3 100755 --- a/src/components/galleria/GalleriaThumbnails.vue +++ b/src/components/galleria/GalleriaThumbnails.vue @@ -8,7 +8,7 @@
@@ -43,7 +43,7 @@ export default { type: Number, default: 3 }, - activeItemIndex: { + activeIndex: { type: Number, default: 0 }, @@ -83,8 +83,8 @@ export default { return { d_numVisible: this.numVisible, d_oldNumVisible: this.numVisible, - d_activeItemIndex: this.activeItemIndex, - d_oldActiveItemIndex: this.activeItemIndex, + d_activeIndex: this.activeIndex, + d_oldActiveItemIndex: this.activeIndex, totalShiftedItems: 0, page: 0 } @@ -94,8 +94,8 @@ export default { this.d_numVisible = newValue; this.d_oldNumVisible = oldValue; }, - activeItemIndex(newValue, oldValue) { - this.d_activeItemIndex = newValue; + activeIndex(newValue, oldValue) { + this.d_activeIndex = newValue; this.d_oldActiveItemIndex = oldValue; } }, @@ -110,18 +110,18 @@ export default { updated() { let totalShiftedItems = this.totalShiftedItems; - if (this.d_oldNumVisible !== this.d_numVisible || this.d_oldActiveItemIndex !== this.d_activeItemIndex) { - if (this.d_activeItemIndex <= this.getMedianItemIndex()) { + if (this.d_oldNumVisible !== this.d_numVisible || this.d_oldActiveItemIndex !== this.d_activeIndex) { + if (this.d_activeIndex <= this.getMedianItemIndex()) { totalShiftedItems = 0; } - else if (this.value.length - this.d_numVisible + this.getMedianItemIndex() < this.d_activeItemIndex) { + else if (this.value.length - this.d_numVisible + this.getMedianItemIndex() < this.d_activeIndex) { totalShiftedItems = this.d_numVisible - this.value.length; } - else if (this.value.length - this.d_numVisible < this.d_activeItemIndex && this.d_numVisible % 2 === 0) { - totalShiftedItems = (this.d_activeItemIndex * -1) + this.getMedianItemIndex() + 1; + else if (this.value.length - this.d_numVisible < this.d_activeIndex && this.d_numVisible % 2 === 0) { + totalShiftedItems = (this.d_activeIndex * -1) + this.getMedianItemIndex() + 1; } else { - totalShiftedItems = (this.d_activeItemIndex * -1) + this.getMedianItemIndex(); + totalShiftedItems = (this.d_activeIndex * -1) + this.getMedianItemIndex(); } if (totalShiftedItems !== this.totalShiftedItems) { @@ -130,12 +130,12 @@ export default { this.$refs.itemsContainer.style.transform = this.isVertical ? `translate3d(0, ${totalShiftedItems * (100/ this.d_numVisible)}%, 0)` : `translate3d(${totalShiftedItems * (100/ this.d_numVisible)}%, 0, 0)`; - if (this.d_oldActiveItemIndex !== this.d_activeItemIndex) { + if (this.d_oldActiveItemIndex !== this.d_activeIndex) { DomHandler.removeClass(this.$refs.itemsContainer, 'p-items-hidden'); this.$refs.itemsContainer.style.transition = 'transform 500ms ease 0s'; } - this.d_oldActiveItemIndex = this.d_activeItemIndex; + this.d_oldActiveItemIndex = this.d_activeIndex; this.d_oldNumVisible = this.d_numVisible; } }, @@ -160,10 +160,10 @@ export default { } if (this.circular) { - if (dir < 0 && this.value.length - 1 === this.d_activeItemIndex) { + if (dir < 0 && this.value.length - 1 === this.d_activeIndex) { totalShiftedItems = 0; } - else if (dir > 0 && this.d_activeItemIndex === 0) { + else if (dir > 0 && this.d_activeIndex === 0) { totalShiftedItems = this.d_numVisible - this.value.length; } } @@ -189,14 +189,14 @@ export default { navBackward(e) { this.stopSlideShow(); - let prevItemIndex = this.d_activeItemIndex !== 0 ? this.d_activeItemIndex - 1 : 0; + let prevItemIndex = this.d_activeIndex !== 0 ? this.d_activeIndex - 1 : 0; let diff = prevItemIndex + this.totalShiftedItems; if ((this.d_numVisible - diff - 1) > this.getMedianItemIndex() && ((-1 * this.totalShiftedItems) !== 0 || this.circular)) { this.step(1); } - let activeIndex = this.circular && this.d_activeItemIndex === 0 ? this.value.length - 1 : prevItemIndex; - this.$emit('update:activeItemIndex', activeIndex); + let activeIndex = this.circular && this.d_activeIndex === 0 ? this.value.length - 1 : prevItemIndex; + this.$emit('update:activeIndex', activeIndex); if (e.cancelable) { e.preventDefault(); @@ -205,13 +205,13 @@ export default { navForward(e) { this.stopSlideShow(); - let nextItemIndex = this.d_activeItemIndex + 1; + let nextItemIndex = this.d_activeIndex + 1; if (nextItemIndex + this.totalShiftedItems > this.getMedianItemIndex() && ((-1 * this.totalShiftedItems) < this.getTotalPageNumber() - 1 || this.circular)) { this.step(-1); } - let activeIndex = this.circular && (this.value.length - 1) === this.d_activeItemIndex ? 0 : nextItemIndex; - this.$emit('update:activeItemIndex', activeIndex); + let activeIndex = this.circular && (this.value.length - 1) === this.d_activeIndex ? 0 : nextItemIndex; + this.$emit('update:activeIndex', activeIndex); if (e.cancelable) { e.preventDefault(); @@ -221,10 +221,10 @@ export default { this.stopSlideShow(); let selectedItemIndex = index; - if (selectedItemIndex !== this.d_activeItemIndex) { + if (selectedItemIndex !== this.d_activeIndex) { const diff = selectedItemIndex + this.totalShiftedItems; let dir = 0; - if (selectedItemIndex < this.d_activeItemIndex) { + if (selectedItemIndex < this.d_activeIndex) { dir = (this.d_numVisible - diff - 1) - this.getMedianItemIndex(); if (dir > 0 && (-1 * this.totalShiftedItems) !== 0) { this.step(dir); @@ -237,7 +237,7 @@ export default { } } - this.$emit('update:activeItemIndex', selectedItemIndex); + this.$emit('update:activeIndex', selectedItemIndex); } }, onTransitionEnd() { @@ -365,10 +365,10 @@ export default { } }, isNavBackwardDisabled() { - return (!this.circular && this.d_activeItemIndex === 0) || (this.value.length <= this.d_numVisible); + return (!this.circular && this.d_activeIndex === 0) || (this.value.length <= this.d_numVisible); }, isNavForwardDisabled() { - return (!this.circular && this.d_activeItemIndex === (this.value.length - 1)) || (this.value.length <= this.d_numVisible); + return (!this.circular && this.d_activeIndex === (this.value.length - 1)) || (this.value.length <= this.d_numVisible); }, firstItemAciveIndex() { return this.totalShiftedItems * -1; diff --git a/src/views/galleria/GalleriaAdvancedDemo.vue b/src/views/galleria/GalleriaAdvancedDemo.vue index 55324ae4a..807e33ea5 100644 --- a/src/views/galleria/GalleriaAdvancedDemo.vue +++ b/src/views/galleria/GalleriaAdvancedDemo.vue @@ -8,7 +8,7 @@
-