@@ -12,6 +12,7 @@ export interface PanelProps {
1212 class? : string [] | string ;
1313 labelIcon? : string ;
1414 labelNumber? : number ;
15+ toggleable? : boolean ;
1516}
1617
1718const props = withDefaults (defineProps <PanelProps >(), {
@@ -21,6 +22,7 @@ const props = withDefaults(defineProps<PanelProps>(), {
2122 class: undefined ,
2223 labelIcon: undefined ,
2324 labelNumber: undefined ,
25+ toggleable: false ,
2426});
2527
2628const panelClass = computed (() => [
@@ -31,7 +33,9 @@ const panelClass = computed(() => [
3133const panelState = ref (false );
3234
3335const toggle = () => {
34- panelState .value = ! panelState .value ;
36+ if (props .toggleable ) {
37+ panelState .value = ! panelState .value ;
38+ }
3539};
3640
3741const menu = ref <Menu & MenuState >();
@@ -40,17 +44,25 @@ const toggleMenu = (event: Event) => {
4044 menu .value ?.toggle (event );
4145};
4246 </script >
47+
4348<template >
44- <Panel v-if =" !noUi" :class =" panelClass" :toggleable =" true " :collapsed =" panelState" >
49+ <Panel v-if =" !noUi" :class =" [ panelClass, { 'toggleable-enabled': toggleable }] " :toggleable =" toggleable " :collapsed =" toggleable ? panelState : false " >
4550 <template #header >
46- <div class =" panel-title" role =" button" @click =" toggle" >
51+ <div v-if = " toggleable " class =" panel-title" role =" button" @click =" toggle" >
4752 <h2 >
4853 <span class =" chevron" :class =" panelState ? 'icon-keyboard_arrow_down' : 'icon-keyboard_arrow_up'" />
4954 <span v-if =" labelNumber" class =" label-number" >{{ labelNumber }}</span >
5055 <span >{{ title }}</span >
5156 <span v-if =" labelIcon" class =" ml-2" :class =" labelIcon" />
5257 </h2 >
5358 </div >
59+ <div v-else >
60+ <h2 >
61+ <span v-if =" labelNumber" class =" label-number" >{{ labelNumber }}</span >
62+ <span >{{ title }}</span >
63+ <span v-if =" labelIcon" class =" ml-2" :class =" labelIcon" />
64+ </h2 >
65+ </div >
5466 </template >
5567 <template v-if =" menuItems && menuItems .length > 0 " #icons >
5668 <Button severity =" secondary" rounded class =" btn-context" :class =" { 'p-focus': menu?.overlayVisible }" icon =" icon-more_vert" aria-label =" More" @click =" toggleMenu" />
129141 }
130142
131143 :deep(.p-panel-content ) {
132- border-left : 2 px solid var ( --gray-200 ) ;
144+ box-shadow : none ;
133145 margin-left : 10px ;
134- border-radius : 0 ;
135146 padding : 0 0 0 1.5rem ;
136147 }
137148
@@ -140,6 +151,11 @@ h2 {
140151 }
141152}
142153
154+ .toggleable-enabled :deep(.p-panel-content ) {
155+ border-left : 2px solid var (--gray-200 );
156+ border-radius : 0 ;
157+ }
158+
143159.content-wrapper {
144160 display : flex ;
145161 flex-direction : column ;
0 commit comments