primevue
Version:
PrimeVue is a premium UI library for Vue featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, wh
87 lines (81 loc) • 2.54 kB
JavaScript
import { mergeProps, openBlock, createBlock, resolveDynamicComponent, withCtx, renderSlot, normalizeClass } from 'vue';
import BaseComponent from '@primevue/core/basecomponent';
import CarouselItem from 'primevue/carouselitem';
import GalleryThumbnailItemStyle from 'primevue/gallerythumbnailitem/style';
var script$1 = {
name: 'BaseGalleryThumbnailItem',
"extends": BaseComponent,
props: {
index: {
type: Number,
"default": undefined
},
as: {
type: [String, Object],
"default": function _default() {
return CarouselItem;
}
},
asChild: {
type: Boolean,
"default": false
}
},
style: GalleryThumbnailItemStyle,
provide: function provide() {
return {
$pcGalleryThumbnailItem: this,
$parentInstance: this
};
}
};
var script = {
name: 'GalleryThumbnailItem',
"extends": script$1,
inheritAttrs: false,
inject: ['$pcGallery'],
methods: {
onClick: function onClick() {
var _this$$pcGallery;
if (this.index === undefined) return;
(_this$$pcGallery = this.$pcGallery) === null || _this$$pcGallery === void 0 || _this$$pcGallery.selectItem(this.index);
}
},
computed: {
active: function active() {
var _this$$pcGallery$isIt, _this$$pcGallery2;
return this.index !== undefined && ((_this$$pcGallery$isIt = (_this$$pcGallery2 = this.$pcGallery) === null || _this$$pcGallery2 === void 0 ? void 0 : _this$$pcGallery2.isItemActive(this.index)) !== null && _this$$pcGallery$isIt !== void 0 ? _this$$pcGallery$isIt : false);
},
attrs: function attrs() {
return mergeProps(this.a11yAttrs, this.ptmi('root'));
},
a11yAttrs: function a11yAttrs() {
return {
'data-pc-name': 'gallerythumbnailitem',
'data-pc-section': 'root',
'data-active': this.active ? '' : undefined,
onClick: this.onClick
};
}
}
};
function render(_ctx, _cache, $props, $setup, $data, $options) {
return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({
key: 0,
"class": _ctx.cx('root')
}, $options.attrs), {
"default": withCtx(function () {
return [renderSlot(_ctx.$slots, "default", {
active: $options.active
})];
}),
_: 3
}, 16, ["class"])) : renderSlot(_ctx.$slots, "default", {
key: 1,
"class": normalizeClass(_ctx.cx('root')),
a11yAttrs: $options.a11yAttrs,
active: $options.active
});
}
script.render = render;
export { script as default };