Refactor #3965 - Update for Galleria
parent
ff695f200f
commit
3de20a4e55
|
@ -295,7 +295,21 @@ const classes = {
|
||||||
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
'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',
|
closeButton: 'p-galleria-close p-link',
|
||||||
closeIcon: 'p-galleria-close-icon',
|
closeIcon: 'p-galleria-close-icon',
|
||||||
header: 'p-galleria-header',
|
header: 'p-galleria-header',
|
||||||
|
@ -320,10 +334,10 @@ const classes = {
|
||||||
nextItemIcon: 'p-galleria-item-next-icon',
|
nextItemIcon: 'p-galleria-item-next-icon',
|
||||||
caption: 'p-galleria-caption',
|
caption: 'p-galleria-caption',
|
||||||
indicators: 'p-galleria-indicators p-reset',
|
indicators: 'p-galleria-indicators p-reset',
|
||||||
indicator: ({ instance, context }) => [
|
indicator: ({ instance, index }) => [
|
||||||
'p-galleria-indicator',
|
'p-galleria-indicator',
|
||||||
{
|
{
|
||||||
'p-highlight': instance.isIndicatorItemActive(context.index)
|
'p-highlight': instance.isIndicatorItemActive(index)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
indicatorButton: 'p-link',
|
indicatorButton: 'p-link',
|
||||||
|
@ -338,13 +352,13 @@ const classes = {
|
||||||
previousThumbnailIcon: 'p-galleria-thumbnail-prev-icon',
|
previousThumbnailIcon: 'p-galleria-thumbnail-prev-icon',
|
||||||
thumbnailItemsContainer: 'p-galleria-thumbnail-items-container',
|
thumbnailItemsContainer: 'p-galleria-thumbnail-items-container',
|
||||||
thumbnailItems: 'p-galleria-thumbnail-items',
|
thumbnailItems: 'p-galleria-thumbnail-items',
|
||||||
thumbnailItem: ({ instance, context }) => [
|
thumbnailItem: ({ instance, index, activeIndex }) => [
|
||||||
'p-galleria-thumbnail-item',
|
'p-galleria-thumbnail-item',
|
||||||
{
|
{
|
||||||
'p-galleria-thumbnail-item-current': context.activeIndex === context.index,
|
'p-galleria-thumbnail-item-current': activeIndex === index,
|
||||||
'p-galleria-thumbnail-item-active': instance.isItemActive(context.index),
|
'p-galleria-thumbnail-item-active': instance.isItemActive(index),
|
||||||
'p-galleria-thumbnail-item-start': instance.firstItemAciveIndex() === context.index,
|
'p-galleria-thumbnail-item-start': instance.firstItemAciveIndex() === index,
|
||||||
'p-galleria-thumbnail-item-end': instance.lastItemActiveIndex() === context.index
|
'p-galleria-thumbnail-item-end': instance.lastItemActiveIndex() === index
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
thumbnailItemContent: 'p-galleria-thumbnail-item-content',
|
thumbnailItemContent: 'p-galleria-thumbnail-item-content',
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseGalleria from './BaseGalleria.vue';
|
|
||||||
import FocusTrap from 'primevue/focustrap';
|
import FocusTrap from 'primevue/focustrap';
|
||||||
import Portal from 'primevue/portal';
|
import Portal from 'primevue/portal';
|
||||||
import { DomHandler, ZIndexUtils } from 'primevue/utils';
|
import { DomHandler, ZIndexUtils } from 'primevue/utils';
|
||||||
|
import BaseGalleria from './BaseGalleria.vue';
|
||||||
import GalleriaContent from './GalleriaContent.vue';
|
import GalleriaContent from './GalleriaContent.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-if="$attrs.value && $attrs.value.length > 0" :id="id" :class="cx('root')" :style="$attrs.containerStyle" v-bind="{ ...$attrs.containerProps, ...ptm('root') }">
|
<div v-if="$attrs.value && $attrs.value.length > 0" :id="id" :class="[cx('root'), $attrs.containerClass]" :style="$attrs.containerStyle" v-bind="{ ...$attrs.containerProps, ...ptm('root') }" data-pc-name="galleria">
|
||||||
<button v-if="$attrs.fullScreen" v-ripple autofocus type="button" :class="cx('closeButton')" :aria-label="closeAriaLabel" @click="$emit('mask-hide')" v-bind="ptm('closeButton')">
|
<button v-if="$attrs.fullScreen" v-ripple autofocus type="button" :class="cx('closeButton')" :aria-label="closeAriaLabel" @click="$emit('mask-hide')" v-bind="ptm('closeButton')">
|
||||||
<component :is="$attrs.templates['closeicon'] || 'TimesIcon'" :class="cx('closeIcon')" v-bind="ptm('closeIcon')" />
|
<component :is="$attrs.templates['closeicon'] || 'TimesIcon'" :class="cx('closeIcon')" v-bind="ptm('closeIcon')" />
|
||||||
</button>
|
</button>
|
||||||
|
@ -127,22 +127,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
galleriaClass() {
|
|
||||||
const thumbnailsPosClass = this.$attrs.showThumbnails && this.getPositionClass('p-galleria-thumbnails', this.$attrs.thumbnailsPosition);
|
|
||||||
const indicatorPosClass = this.$attrs.showIndicators && this.getPositionClass('p-galleria-indicators', this.$attrs.indicatorsPosition);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'p-galleria p-component',
|
|
||||||
{
|
|
||||||
'p-galleria-fullscreen': this.$attrs.fullScreen,
|
|
||||||
'p-galleria-indicator-onitem': this.$attrs.showIndicatorsOnItem,
|
|
||||||
'p-galleria-item-nav-onhover': this.$attrs.showItemNavigatorsOnHover && !this.$attrs.fullScreen
|
|
||||||
},
|
|
||||||
thumbnailsPosClass,
|
|
||||||
indicatorPosClass,
|
|
||||||
this.$attrs.containerClass
|
|
||||||
];
|
|
||||||
},
|
|
||||||
closeAriaLabel() {
|
closeAriaLabel() {
|
||||||
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;
|
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<li
|
<li
|
||||||
v-for="(item, index) of value"
|
v-for="(item, index) of value"
|
||||||
:key="`p-galleria-indicator-${index}`"
|
:key="`p-galleria-indicator-${index}`"
|
||||||
:class="cx('indicator', { context: { index: index } })"
|
:class="cx('indicator', { index })"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
:aria-label="ariaPageLabel(index + 1)"
|
:aria-label="ariaPageLabel(index + 1)"
|
||||||
:aria-selected="activeIndex === index"
|
:aria-selected="activeIndex === index"
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
@mouseenter="onIndicatorMouseEnter(index)"
|
@mouseenter="onIndicatorMouseEnter(index)"
|
||||||
@keydown="onIndicatorKeyDown($event, index)"
|
@keydown="onIndicatorKeyDown($event, index)"
|
||||||
v-bind="ptm('indicator')"
|
v-bind="ptm('indicator')"
|
||||||
|
:data-p-highlight="isIndicatorItemActive(index)"
|
||||||
>
|
>
|
||||||
<button v-if="!templates['indicator']" type="button" tabindex="-1" :class="cx('indicatorButton')"></button>
|
<button v-if="!templates['indicator']" type="button" tabindex="-1" :class="cx('indicatorButton')"></button>
|
||||||
<component v-if="templates.indicator" :is="templates.indicator" :index="index" />
|
<component v-if="templates.indicator" :is="templates.indicator" :index="index" />
|
||||||
|
|
|
@ -18,20 +18,17 @@
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) of value"
|
v-for="(item, index) of value"
|
||||||
:key="`p-galleria-thumbnail-item-${index}`"
|
:key="`p-galleria-thumbnail-item-${index}`"
|
||||||
:class="
|
:class="cx('thumbnailItem', { index, activeIndex })"
|
||||||
cx('thumbnailItem', {
|
|
||||||
context: {
|
|
||||||
index,
|
|
||||||
activeIndex
|
|
||||||
}
|
|
||||||
})
|
|
||||||
"
|
|
||||||
role="tab"
|
role="tab"
|
||||||
:data-p-active="activeIndex === index"
|
:data-p-active="activeIndex === index"
|
||||||
:aria-selected="activeIndex === index"
|
:aria-selected="activeIndex === index"
|
||||||
:aria-controls="containerId + '_item_' + index"
|
:aria-controls="containerId + '_item_' + index"
|
||||||
@keydown="onThumbnailKeydown($event, index)"
|
@keydown="onThumbnailKeydown($event, index)"
|
||||||
v-bind="ptm('thumbnailItem')"
|
v-bind="ptm('thumbnailItem')"
|
||||||
|
:data-p-galleria-thumbnail-item-current="activeIndex === index"
|
||||||
|
:data-p-galleria-thumbnail-item-active="isItemActive(index)"
|
||||||
|
:data-p-galleria-thumbnail-item-start="firstItemAciveIndex() === index"
|
||||||
|
:data-p-galleria-thumbnail-item-end="lastItemActiveIndex() === index"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
:class="cx('thumbnailItemContent')"
|
:class="cx('thumbnailItemContent')"
|
||||||
|
@ -427,7 +424,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
let innerHTML = `
|
let innerHTML = `
|
||||||
#${this.containerId} .p-galleria-thumbnail-item {
|
#${this.containerId} [data-pc-section="thumbnailitem"] {
|
||||||
flex: 1 0 ${100 / this.d_numVisible}%
|
flex: 1 0 ${100 / this.d_numVisible}%
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
Loading…
Reference in New Issue