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

94 lines (88 loc) • 2.23 kB
import BaseComponent from '@primevue/core/basecomponent'; import AccordionStyle from 'primevue/accordion/style'; import { openBlock, createElementBlock, mergeProps, renderSlot } from 'vue'; var script$1 = { name: 'BaseAccordion', "extends": BaseComponent, props: { value: { type: [String, Number, Array], "default": undefined }, multiple: { type: Boolean, "default": false }, lazy: { type: Boolean, "default": false }, tabindex: { type: Number, "default": 0 }, selectOnFocus: { type: Boolean, "default": false }, expandIcon: { type: String, "default": undefined }, collapseIcon: { type: String, "default": undefined } }, style: AccordionStyle, provide: function provide() { return { $pcAccordion: this, $parentInstance: this }; } }; var script = { name: 'Accordion', "extends": script$1, inheritAttrs: false, emits: ['update:value'], data: function data() { return { d_value: this.value }; }, watch: { value: function value(newValue) { this.d_value = newValue; } }, methods: { isItemActive: function isItemActive(value) { var _this$d_value; return this.multiple ? (_this$d_value = this.d_value) === null || _this$d_value === void 0 ? void 0 : _this$d_value.includes(value) : this.d_value === value; }, updateValue: function updateValue(newValue) { var active = this.isItemActive(newValue); if (this.multiple) { if (active) { this.d_value = this.d_value.filter(function (v) { return v !== newValue; }); } else { if (this.d_value) this.d_value.push(newValue);else this.d_value = [newValue]; } } else { this.d_value = active ? null : newValue; } this.$emit('update:value', this.d_value); } } }; function render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx('root') }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, "default")], 16); } script.render = render; export { script as default };