Refactor #4211 - For Galleria

pull/4203/head
Tuğçe Küçükoğlu 2023-08-01 10:40:55 +03:00
parent b5a0a46f33
commit 0d949220ba
2 changed files with 20 additions and 1 deletions

View File

@ -19,6 +19,7 @@ export interface GalleriaPassThroughMethodOptions {
instance: any; instance: any;
props: GalleriaProps; props: GalleriaProps;
state: GalleriaState; state: GalleriaState;
context: GalleriaContext;
} }
export interface GalleriaResponsiveOptions { export interface GalleriaResponsiveOptions {
@ -223,6 +224,17 @@ export interface GalleriaState {
totalShiftedItems: number; totalShiftedItems: number;
} }
/**
* Defines current inline options in Galleria component.
*/
export interface GalleriaState {
/**
* Current highlighted state of the indicator as a boolean.
* @defaultValue false
*/
highlighted: boolean;
}
/** /**
* Defines valid properties in Galleria component. * Defines valid properties in Galleria component.
*/ */

View File

@ -26,7 +26,7 @@
@click="onIndicatorClick(index)" @click="onIndicatorClick(index)"
@mouseenter="onIndicatorMouseEnter(index)" @mouseenter="onIndicatorMouseEnter(index)"
@keydown="onIndicatorKeyDown($event, index)" @keydown="onIndicatorKeyDown($event, index)"
v-bind="ptm('indicator')" v-bind="ptm('indicator', getIndicatorPTOptions(index))"
:data-p-highlight="isIndicatorItemActive(index)" :data-p-highlight="isIndicatorItemActive(index)"
> >
<button v-if="!templates['indicator']" type="button" tabindex="-1" :class="cx('indicatorButton')" v-bind="ptm('indicatorButton')"></button> <button v-if="!templates['indicator']" type="button" tabindex="-1" :class="cx('indicatorButton')" v-bind="ptm('indicatorButton')"></button>
@ -95,6 +95,13 @@ export default {
} }
}, },
methods: { methods: {
getIndicatorPTOptions(index) {
return {
context: {
highlighted: this.activeIndex === index
}
};
},
next() { next() {
let nextItemIndex = this.activeIndex + 1; let nextItemIndex = this.activeIndex + 1;
let activeIndex = this.circular && this.value.length - 1 === this.activeIndex ? 0 : nextItemIndex; let activeIndex = this.circular && this.value.length - 1 === this.activeIndex ? 0 : nextItemIndex;