| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <v-item-group> | 
					
						
							|  |  |  |     <template v-for="btn in buttons"> | 
					
						
							| 
									
										
										
										
											2023-08-23 12:31:23 -05:00
										 |  |  |       <v-menu v-if="btn.children" :key="'menu-' + btn.event" active-class="pa-0" offset-y top left :style="stretch ? 'width: 100%;' : ''"> | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  |         <template #activator="{ on, attrs }"> | 
					
						
							| 
									
										
										
										
											2022-03-29 09:38:23 -08:00
										 |  |  |           <v-btn tile :large="large" icon v-bind="attrs" v-on="on"> | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  |             <v-icon> | 
					
						
							|  |  |  |               {{ btn.icon }} | 
					
						
							|  |  |  |             </v-icon> | 
					
						
							|  |  |  |           </v-btn> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |         <v-list dense> | 
					
						
							| 
									
										
										
										
											2024-03-04 09:41:29 +11:00
										 |  |  |           <template v-for="(child, idx) in btn.children"> | 
					
						
							|  |  |  |             <v-list-item :key="idx" dense @click="$emit(child.event)"> | 
					
						
							|  |  |  |               <v-list-item-title>{{ child.text }}</v-list-item-title> | 
					
						
							|  |  |  |             </v-list-item> | 
					
						
							|  |  |  |             <v-divider v-if="child.divider" :key="`divider-${idx}`" class="my-1"></v-divider> | 
					
						
							|  |  |  |           </template> | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  |         </v-list> | 
					
						
							|  |  |  |       </v-menu> | 
					
						
							|  |  |  |       <v-tooltip | 
					
						
							|  |  |  |         v-else | 
					
						
							|  |  |  |         :key="'btn-' + btn.event" | 
					
						
							|  |  |  |         open-delay="200" | 
					
						
							|  |  |  |         transition="slide-y-reverse-transition" | 
					
						
							|  |  |  |         dense | 
					
						
							|  |  |  |         bottom | 
					
						
							|  |  |  |         content-class="text-caption" | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         <template #activator="{ on, attrs }"> | 
					
						
							| 
									
										
										
										
											2023-08-23 12:31:23 -05:00
										 |  |  |           <v-btn | 
					
						
							|  |  |  |             tile | 
					
						
							|  |  |  |             icon | 
					
						
							|  |  |  |             :color="btn.color" | 
					
						
							|  |  |  |             :large="large" | 
					
						
							|  |  |  |             :disabled="btn.disabled" | 
					
						
							|  |  |  |             :style="stretch ? `width: ${maxButtonWidth};` : ''" | 
					
						
							|  |  |  |             v-bind="attrs" | 
					
						
							|  |  |  |             v-on="on" | 
					
						
							|  |  |  |             @click="$emit(btn.event)" | 
					
						
							|  |  |  |           > | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  |             <v-icon> {{ btn.icon }} </v-icon> | 
					
						
							|  |  |  |           </v-btn> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |         <span>{{ btn.text }}</span> | 
					
						
							|  |  |  |       </v-tooltip> | 
					
						
							|  |  |  |     </template> | 
					
						
							|  |  |  |   </v-item-group> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-08-23 12:31:23 -05:00
										 |  |  | import { computed, defineComponent } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  | export interface ButtonOption { | 
					
						
							| 
									
										
										
										
											2022-03-29 09:38:23 -08:00
										 |  |  |   icon?: string; | 
					
						
							| 
									
										
										
										
											2023-08-23 12:31:23 -05:00
										 |  |  |   color?: string; | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  |   text: string; | 
					
						
							|  |  |  |   event: string; | 
					
						
							| 
									
										
										
										
											2022-01-16 03:38:11 +01:00
										 |  |  |   children?: ButtonOption[]; | 
					
						
							| 
									
										
										
										
											2023-02-26 20:27:22 +01:00
										 |  |  |   disabled?: boolean; | 
					
						
							| 
									
										
										
										
											2024-03-04 09:41:29 +11:00
										 |  |  |   divider?: boolean; | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							|  |  |  |   props: { | 
					
						
							|  |  |  |     buttons: { | 
					
						
							|  |  |  |       type: Array as () => ButtonOption[], | 
					
						
							|  |  |  |       required: true, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2022-03-29 09:38:23 -08:00
										 |  |  |     large: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: true, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2023-08-23 12:31:23 -05:00
										 |  |  |     stretch: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2023-08-23 12:31:23 -05:00
										 |  |  |   setup(props) { | 
					
						
							|  |  |  |     const maxButtonWidth = computed(() => `${100 / props.buttons.length}%`); | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       maxButtonWidth, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-01-08 22:24:34 -09:00
										 |  |  | }); | 
					
						
							|  |  |  | </script> |