UNPKG

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

96 lines (90 loc) • 3.54 kB
import { mergeProps, openBlock, createBlock, resolveDynamicComponent, withCtx, renderSlot, normalizeClass } from 'vue'; import BaseComponent from '@primevue/core/basecomponent'; import CarouselIndicatorStyle from 'primevue/carouselindicator/style'; var script$1 = { name: 'BaseCarouselIndicator', "extends": BaseComponent, props: { as: { type: [String, Object], "default": 'BUTTON' }, asChild: { type: Boolean, "default": false }, page: { type: Number, "default": null } }, style: CarouselIndicatorStyle, provide: function provide() { return { $pcCarouselIndicator: this, $parentInstance: this }; } }; var script = { name: 'CarouselIndicator', "extends": script$1, inheritAttrs: false, inject: ['$pcCarousel'], methods: { onClick: function onClick(event) { var _this$$pcCarousel; (_this$$pcCarousel = this.$pcCarousel) === null || _this$$pcCarousel === void 0 || _this$$pcCarousel.scrollToPage(this.page); if (event !== null && event !== void 0 && event.cancelable) { event.preventDefault(); } } }, computed: { active: function active() { var _this$$pcCarousel2; return ((_this$$pcCarousel2 = this.$pcCarousel) === null || _this$$pcCarousel2 === void 0 ? void 0 : _this$$pcCarousel2.d_page) === this.page; }, attrs: function attrs() { return mergeProps(this.asAttrs, this.a11yAttrs, this.ptmi('root')); }, asAttrs: function asAttrs() { return this.as === 'BUTTON' ? { type: 'button' } : undefined; }, a11yAttrs: function a11yAttrs() { var _this$$pcCarousel3, _this$$pcCarousel3$ar, _this$$pcCarousel4, _this$$pcCarousel5, _this$$pcCarousel6, _this$$pcCarousel7; return { 'aria-label': (_this$$pcCarousel3 = this.$pcCarousel) === null || _this$$pcCarousel3 === void 0 || (_this$$pcCarousel3$ar = _this$$pcCarousel3.ariaPageLabel) === null || _this$$pcCarousel3$ar === void 0 ? void 0 : _this$$pcCarousel3$ar.call(_this$$pcCarousel3, this.page + 1), 'aria-current': this.active ? 'page' : undefined, 'data-pc-name': 'carouselindicator', 'data-pc-section': 'root', 'data-orientation': (_this$$pcCarousel4 = this.$pcCarousel) === null || _this$$pcCarousel4 === void 0 ? void 0 : _this$$pcCarousel4.orientation, 'data-align': (_this$$pcCarousel5 = this.$pcCarousel) === null || _this$$pcCarousel5 === void 0 ? void 0 : _this$$pcCarousel5.align, 'data-page': (_this$$pcCarousel6 = this.$pcCarousel) === null || _this$$pcCarousel6 === void 0 ? void 0 : _this$$pcCarousel6.d_page, 'data-active': this.active ? '' : undefined, 'data-swiping': (_this$$pcCarousel7 = this.$pcCarousel) !== null && _this$$pcCarousel7 !== void 0 && _this$$pcCarousel7.swiping ? '' : 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")]; }), _: 3 }, 16, ["class"])) : renderSlot(_ctx.$slots, "default", { a11yAttrs: $options.a11yAttrs, "class": normalizeClass(_ctx.cx('root')), active: $options.active, onClick: $options.onClick }, undefined, undefined, 1); } script.render = render; export { script as default };