@@ -12,6 +12,7 @@ export interface PanelProps {
12
12
class? : string [] | string ;
13
13
labelIcon? : string ;
14
14
labelNumber? : number ;
15
+ toggleable? : boolean ;
15
16
}
16
17
17
18
const props = withDefaults (defineProps <PanelProps >(), {
@@ -21,6 +22,7 @@ const props = withDefaults(defineProps<PanelProps>(), {
21
22
class: undefined ,
22
23
labelIcon: undefined ,
23
24
labelNumber: undefined ,
25
+ toggleable: false ,
24
26
});
25
27
26
28
const panelClass = computed (() => [
@@ -31,7 +33,9 @@ const panelClass = computed(() => [
31
33
const panelState = ref (false );
32
34
33
35
const toggle = () => {
34
- panelState .value = ! panelState .value ;
36
+ if (props .toggleable ) {
37
+ panelState .value = ! panelState .value ;
38
+ }
35
39
};
36
40
37
41
const menu = ref <Menu & MenuState >();
@@ -40,17 +44,25 @@ const toggleMenu = (event: Event) => {
40
44
menu .value ?.toggle (event );
41
45
};
42
46
</script >
47
+
43
48
<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 " >
45
50
<template #header >
46
- <div class =" panel-title" role =" button" @click =" toggle" >
51
+ <div v-if = " toggleable " class =" panel-title" role =" button" @click =" toggle" >
47
52
<h2 >
48
53
<span class =" chevron" :class =" panelState ? 'icon-keyboard_arrow_down' : 'icon-keyboard_arrow_up'" />
49
54
<span v-if =" labelNumber" class =" label-number" >{{ labelNumber }}</span >
50
55
<span >{{ title }}</span >
51
56
<span v-if =" labelIcon" class =" ml-2" :class =" labelIcon" />
52
57
</h2 >
53
58
</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 >
54
66
</template >
55
67
<template v-if =" menuItems && menuItems .length > 0 " #icons >
56
68
<Button severity =" secondary" rounded class =" btn-context" :class =" { 'p-focus': menu?.overlayVisible }" icon =" icon-more_vert" aria-label =" More" @click =" toggleMenu" />
129
141
}
130
142
131
143
:deep(.p-panel-content ) {
132
- border-left : 2 px solid var ( --gray-200 ) ;
144
+ box-shadow : none ;
133
145
margin-left : 10px ;
134
- border-radius : 0 ;
135
146
padding : 0 0 0 1.5rem ;
136
147
}
137
148
@@ -140,6 +151,11 @@ h2 {
140
151
}
141
152
}
142
153
154
+ .toggleable-enabled :deep(.p-panel-content ) {
155
+ border-left : 2px solid var (--gray-200 );
156
+ border-radius : 0 ;
157
+ }
158
+
143
159
.content-wrapper {
144
160
display : flex ;
145
161
flex-direction : column ;
0 commit comments