1- <script setup lang="ts">
2- import { ref , computed } from ' vue' ;
1+ <script setup lang="ts">
2+ import { computed } from ' vue' ;
33import { type Widget , WidgetType } from ' @/core/widget' ;
44import type { Metric } from ' @/core/metric' ;
55import type { MetricOption } from ' @/core/metric-option' ;
@@ -123,6 +123,9 @@ const findMetricById = (metricId: number) => {
123123};
124124
125125const widgetTypeToString = (t : WidgetType ) => WidgetType [t ];
126+ const metricOptionFromItem = (item : ListItem <unknown >) => item .raw as MetricOption ;
127+ const statFromItem = (item : ListItem <unknown >) => item .raw as Stat ;
128+ const widgetTypeFromItem = (item : ListItem <unknown >) => item .raw as WidgetType ;
126129
127130const metricOptionsFiltered = computed (() => {
128131 return props .lineIdx === 0
@@ -161,10 +164,10 @@ const isReadoutWidget = computed(() => widgetType.value === WidgetType.Readout);
161164 return-object
162165 :density =" isMaster ? 'default' : 'compact'"
163166 >
164- <template v-slot :item =" {item , props: itemProps }: {item: ListItem < MetricOption > , props: any } " >
165- <v-tooltip :text =" findMetricById(item.raw .metricId).description" >
167+ <template v-slot :item =" { item , props: itemProps } " >
168+ <v-tooltip :text =" findMetricById(metricOptionFromItem( item) .metricId).description" >
166169 <template v-slot :activator =" {props: tooltipProps } " >
167- <v-list-item v-bind =" {...itemProps, ...tooltipProps}" :title =" item.raw .name" />
170+ <v-list-item v-bind =" {...itemProps, ...tooltipProps}" :title =" metricOptionFromItem( item) .name" />
168171 </template >
169172 </v-tooltip >
170173 </template >
@@ -179,10 +182,10 @@ const isReadoutWidget = computed(() => widgetType.value === WidgetType.Readout);
179182 return-object
180183 :density =" isMaster ? 'default' : 'compact'"
181184 >
182- <template v-slot :item =" {item , props: itemProps }: {item: ListItem < Stat > , props: any } " >
183- <v-tooltip :text =" `${item.raw. name}: ${item.raw .description}`" >
185+ <template v-slot :item =" { item , props: itemProps } " >
186+ <v-tooltip :text =" `${statFromItem( item). name}: ${statFromItem( item) .description}`" >
184187 <template v-slot :activator =" {props: tooltipProps } " >
185- <v-list-item v-bind =" {...itemProps, ...tooltipProps}" :title =" item.raw .shortName" />
188+ <v-list-item v-bind =" {...itemProps, ...tooltipProps}" :title =" statFromItem( item) .shortName" />
186189 </template >
187190 </v-tooltip >
188191 </template >
@@ -196,11 +199,11 @@ const isReadoutWidget = computed(() => widgetType.value === WidgetType.Readout);
196199 :disabled =" locked || widgetTypeOptions.length < 2"
197200 :density =" isMaster ? 'default' : 'compact'"
198201 >
199- <template v-slot :selection =" {item , index }: { item: ListItem < WidgetType > , index: number } " >
200- {{ widgetTypeToString(item.raw ) }}
202+ <template v-slot :selection =" { item } " >
203+ {{ widgetTypeToString(widgetTypeFromItem( item) ) }}
201204 </template >
202- <template v-slot :item =" {item , props , index }: { item: ListItem < WidgetType > , props: any , index: number } " >
203- <v-list-item v-bind =" props" :title =" widgetTypeToString(item.raw )" >
205+ <template v-slot :item =" { item , props } " >
206+ <v-list-item v-bind =" props" :title =" widgetTypeToString(widgetTypeFromItem( item) )" >
204207 </v-list-item >
205208 </template >
206209 </v-select >
@@ -271,4 +274,4 @@ const isReadoutWidget = computed(() => widgetType.value === WidgetType.Readout);
271274</template >
272275
273276<style scoped lang="scss">
274- </style >
277+ </style >
0 commit comments