primevue-mirror/components/lib/accordion/BaseAccordion.vue

96 lines
2.1 KiB
Vue
Raw Normal View History

2023-05-23 23:40:14 +00:00
<script>
import BaseComponent from 'primevue/basecomponent';
import { useStyle } from 'primevue/usestyle';
const styles = `
2023-09-26 09:14:27 +00:00
@layer primevue {
2023-09-25 19:11:55 +00:00
.p-accordion-header-action {
cursor: pointer;
display: flex;
align-items: center;
user-select: none;
position: relative;
text-decoration: none;
}
.p-accordion-header-action:focus {
z-index: 1;
}
.p-accordion-header-text {
line-height: 1;
}
2023-05-23 23:40:14 +00:00
}
`;
const classes = {
root: 'p-accordion p-component',
tab: {
root: ({ instance, index }) => [
'p-accordion-tab',
{
'p-accordion-tab-active': instance.isTabActive(index)
}
],
header: ({ instance, tab, index }) => [
'p-accordion-header',
{
'p-highlight': instance.isTabActive(index),
'p-disabled': instance.getTabProp(tab, 'disabled')
}
],
headerAction: 'p-accordion-header-link p-accordion-header-action',
headerIcon: 'p-accordion-toggle-icon',
headerTitle: 'p-accordion-header-text',
toggleableContent: 'p-toggleable-content',
content: 'p-accordion-content'
}
};
const { load: loadStyle } = useStyle(styles, { name: 'accordion', manual: true });
2023-05-23 23:40:14 +00:00
export default {
name: 'BaseAccordion',
extends: BaseComponent,
props: {
multiple: {
type: Boolean,
default: false
},
activeIndex: {
type: [Number, Array],
default: null
},
lazy: {
type: Boolean,
default: false
},
expandIcon: {
type: String,
default: undefined
},
collapseIcon: {
type: String,
default: undefined
},
tabindex: {
type: Number,
default: 0
},
selectOnFocus: {
type: Boolean,
default: false
}
},
css: {
classes,
loadStyle
2023-05-23 23:40:14 +00:00
},
provide() {
return {
$parentInstance: this
};
2023-05-23 23:40:14 +00:00
}
};
</script>