@@ -35,25 +35,40 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial
3535
3636<script lang="ts" setup>
3737import { PanelProps } from ' primevue/panel'
38- import { ref , computed } from ' vue'
38+ import { ref , computed , useSlots } from ' vue'
3939
4040const props = defineProps <PanelProps >()
4141const collapsed = ref (props .collapsed )
42+ const slots = useSlots ()
4243
43- const pt = computed (() => ({
44- header: {
45- class: [
46- ' surface-section border-none cursor-pointer' ,
47- // Toggle border radius by open / closed panel
48- collapsed .value ? ' border-round-2xl' : ' border-round-top-2xl' ,
49- props .pt ?.header ?.class ?? ' p-4'
50- ],
51- onclick: headerClick
52- },
53- content: {
54- class: ' border-none border-round-bottom-2xl p-4 pt-0'
44+ const pt = computed (() => {
45+ const hasFooterSlot = Boolean (slots .footer )
46+
47+ return {
48+ header: {
49+ class: [
50+ ' surface-section border-none cursor-pointer' ,
51+ // Toggle border radius by open / closed panel
52+ collapsed .value ? ' border-round-2xl' : ' border-round-top-2xl' ,
53+ props .pt ?.header ?.class ?? ' p-4'
54+ ],
55+ onclick: headerClick
56+ },
57+ content: {
58+ class: [
59+ ' border-none p-4 pt-0' ,
60+ hasFooterSlot ? ' ' : ' border-round-bottom-2xl'
61+ ]
62+ },
63+ ... (hasFooterSlot
64+ ? {
65+ footer: {
66+ class: ' border-none border-round-bottom-2xl p-4 pt-0'
67+ }
68+ }
69+ : {})
5570 }
56- }))
71+ })
5772
5873function headerClick() {
5974 collapsed .value = ! collapsed .value
0 commit comments