@@ -89,15 +89,16 @@ export const DashboardGridLayout: React.FC<DashboardGridLayoutProps> = ({
8989 const getComponentSchema = React . useCallback ( ( widget : DashboardWidgetSchema ) => {
9090 if ( widget . component ) return widget . component ;
9191
92- if ( widget . type === 'bar' || widget . type === 'line' || widget . type === 'area' || widget . type === 'pie' || widget . type === 'donut' ) {
92+ const widgetType = ( widget as any ) . type ;
93+ if ( widgetType === 'bar' || widgetType === 'line' || widgetType === 'area' || widgetType === 'pie' || widgetType === 'donut' ) {
9394 const dataItems = Array . isArray ( ( widget as any ) . data ) ? ( widget as any ) . data : ( widget as any ) . data ?. items || [ ] ;
9495 const options = ( widget as any ) . options || { } ;
9596 const xAxisKey = options . xField || 'name' ;
9697 const yField = options . yField || 'value' ;
9798
9899 return {
99100 type : 'chart' ,
100- chartType : widget . type ,
101+ chartType : widgetType ,
101102 data : dataItems ,
102103 xAxisKey : xAxisKey ,
103104 series : [ { dataKey : yField } ] ,
@@ -106,7 +107,7 @@ export const DashboardGridLayout: React.FC<DashboardGridLayoutProps> = ({
106107 } ;
107108 }
108109
109- if ( widget . type === 'table' ) {
110+ if ( widgetType === 'table' ) {
110111 return {
111112 type : 'data-table' ,
112113 ...( widget as any ) . options ,
@@ -162,7 +163,7 @@ export const DashboardGridLayout: React.FC<DashboardGridLayoutProps> = ({
162163 { schema . widgets ?. map ( ( widget , index ) => {
163164 const widgetId = widget . id || `widget-${ index } ` ;
164165 const componentSchema = getComponentSchema ( widget ) ;
165- const isSelfContained = widget . type === 'metric' ;
166+ const isSelfContained = ( widget as any ) . type === 'metric' ;
166167
167168 return (
168169 < div key = { widgetId } className = "h-full" >
0 commit comments