From 3de20a4e556b83fa59ff894ba3bcdb2e00b33e8c 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: Fri, 9 Jun 2023 14:49:47 +0300 Subject: [PATCH] Refactor #3965 - Update for Galleria --- components/lib/galleria/BaseGalleria.vue | 30 ++++++++++++++----- components/lib/galleria/Galleria.vue | 2 +- components/lib/galleria/GalleriaContent.vue | 18 +---------- components/lib/galleria/GalleriaItem.vue | 3 +- .../lib/galleria/GalleriaThumbnails.vue | 15 ++++------ 5 files changed, 32 insertions(+), 36 deletions(-) diff --git a/components/lib/galleria/BaseGalleria.vue b/components/lib/galleria/BaseGalleria.vue index 60a5bf484..372a7c1f0 100644 --- a/components/lib/galleria/BaseGalleria.vue +++ b/components/lib/galleria/BaseGalleria.vue @@ -295,7 +295,21 @@ const classes = { 'p-ripple-disabled': instance.$primevue.config.ripple === false } ], - root: ({ instance }) => instance.galleriaClass, + root: ({ instance }) => { + const thumbnailsPosClass = instance.$attrs.showThumbnails && instance.getPositionClass('p-galleria-thumbnails', instance.$attrs.thumbnailsPosition); + const indicatorPosClass = instance.$attrs.showIndicators && instance.getPositionClass('p-galleria-indicators', instance.$attrs.indicatorsPosition); + + return [ + 'p-galleria p-component', + { + 'p-galleria-fullscreen': instance.$attrs.fullScreen, + 'p-galleria-indicator-onitem': instance.$attrs.showIndicatorsOnItem, + 'p-galleria-item-nav-onhover': instance.$attrs.showItemNavigatorsOnHover && !instance.$attrs.fullScreen + }, + thumbnailsPosClass, + indicatorPosClass + ]; + }, closeButton: 'p-galleria-close p-link', closeIcon: 'p-galleria-close-icon', header: 'p-galleria-header', @@ -320,10 +334,10 @@ const classes = { nextItemIcon: 'p-galleria-item-next-icon', caption: 'p-galleria-caption', indicators: 'p-galleria-indicators p-reset', - indicator: ({ instance, context }) => [ + indicator: ({ instance, index }) => [ 'p-galleria-indicator', { - 'p-highlight': instance.isIndicatorItemActive(context.index) + 'p-highlight': instance.isIndicatorItemActive(index) } ], indicatorButton: 'p-link', @@ -338,13 +352,13 @@ const classes = { previousThumbnailIcon: 'p-galleria-thumbnail-prev-icon', thumbnailItemsContainer: 'p-galleria-thumbnail-items-container', thumbnailItems: 'p-galleria-thumbnail-items', - thumbnailItem: ({ instance, context }) => [ + thumbnailItem: ({ instance, index, activeIndex }) => [ 'p-galleria-thumbnail-item', { - 'p-galleria-thumbnail-item-current': context.activeIndex === context.index, - 'p-galleria-thumbnail-item-active': instance.isItemActive(context.index), - 'p-galleria-thumbnail-item-start': instance.firstItemAciveIndex() === context.index, - 'p-galleria-thumbnail-item-end': instance.lastItemActiveIndex() === context.index + 'p-galleria-thumbnail-item-current': activeIndex === index, + 'p-galleria-thumbnail-item-active': instance.isItemActive(index), + 'p-galleria-thumbnail-item-start': instance.firstItemAciveIndex() === index, + 'p-galleria-thumbnail-item-end': instance.lastItemActiveIndex() === index } ], thumbnailItemContent: 'p-galleria-thumbnail-item-content', diff --git a/components/lib/galleria/Galleria.vue b/components/lib/galleria/Galleria.vue index 30c8e18f7..77eed30e7 100755 --- a/components/lib/galleria/Galleria.vue +++ b/components/lib/galleria/Galleria.vue @@ -10,10 +10,10 @@