From dfef0ca9b534aeb843b058af0c5a195ea7d00604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 1 Aug 2023 10:43:40 +0300 Subject: [PATCH] Refactor #4211 - For Carousel --- components/lib/carousel/Carousel.d.ts | 12 ++++++++++++ components/lib/carousel/Carousel.vue | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/components/lib/carousel/Carousel.d.ts b/components/lib/carousel/Carousel.d.ts index 2f328eea1..79f06a718 100755 --- a/components/lib/carousel/Carousel.d.ts +++ b/components/lib/carousel/Carousel.d.ts @@ -20,6 +20,7 @@ export interface CarouselPassThroughMethodOptions { instance: any; props: CarouselProps; state: CarouselState; + context: CarouselContext; } /** @@ -165,6 +166,17 @@ export interface CarouselState { swipeThreshold: number; } +/** + * Defines current inline options in Carousel component. + */ +export interface GalleriaContext { + /** + * Current highlighted state of the indicator as a boolean. + * @defaultValue false + */ + highlighted: boolean; +} + export interface CarouselResponsiveOptions { /** * Breakpoint for responsive mode. Exp; @media screen and (max-width: ${breakpoint}) {...} diff --git a/components/lib/carousel/Carousel.vue b/components/lib/carousel/Carousel.vue index 7980ca94d..041c63ec4 100755 --- a/components/lib/carousel/Carousel.vue +++ b/components/lib/carousel/Carousel.vue @@ -239,6 +239,13 @@ export default { } }, methods: { + getIndicatorPTOptions(index) { + return { + context: { + highlighted: index === this.d_page + } + }; + }, step(dir, page) { let totalShiftedItems = this.totalShiftedItems; const isCircular = this.isCircular();