11import React , {
2+ ComponentType ,
23 ReactElement ,
34 useCallback ,
45 useEffect ,
@@ -63,6 +64,9 @@ interface DashboardLayoutProps {
6364 data ?: DashboardData ;
6465 children ?: React . ReactNode | React . ReactNode [ ] ;
6566 emptyDashboard ?: React . ReactNode ;
67+
68+ /** Component to wrap each panel with */
69+ panelWrapper ?: ComponentType ;
6670}
6771
6872/**
@@ -78,6 +82,8 @@ export function DashboardLayout({
7882 onLayoutInitialized = DEFAULT_CALLBACK ,
7983 hydrate = hydrateDefault ,
8084 dehydrate = dehydrateDefault ,
85+ // eslint-disable-next-line react/jsx-no-useless-fragment
86+ panelWrapper = ( { children : panelChildren } ) => < > { panelChildren } </ > ,
8187} : DashboardLayoutProps ) : JSX . Element {
8288 const dispatch = useDispatch ( ) ;
8389 const data =
@@ -117,14 +123,19 @@ export function DashboardLayout({
117123 // ComponentType doesn't seem to work right, ReactNode is also incorrect
118124 // eslint-disable-next-line @typescript-eslint/no-explicit-any
119125 const CType = componentType as any ;
126+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
127+ const PanelWrapperType = panelWrapper as any ;
120128
121129 // Props supplied by GoldenLayout
122130 // eslint-disable-next-line react/prop-types
123131 const { glContainer, glEventHub } = props ;
124132 return (
125133 < PanelErrorBoundary glContainer = { glContainer } glEventHub = { glEventHub } >
126134 { /* eslint-disable-next-line react/jsx-props-no-spreading */ }
127- < CType { ...props } ref = { ref } />
135+ < PanelWrapperType { ...props } >
136+ { /* eslint-disable-next-line react/jsx-props-no-spreading */ }
137+ < CType { ...props } ref = { ref } />
138+ </ PanelWrapperType >
128139 </ PanelErrorBoundary >
129140 ) ;
130141 }
@@ -135,7 +146,7 @@ export function DashboardLayout({
135146 dehydrateMap . set ( name , componentDehydrate ) ;
136147 return cleanup ;
137148 } ,
138- [ hydrate , dehydrate , hydrateMap , dehydrateMap , layout ]
149+ [ hydrate , dehydrate , hydrateMap , dehydrateMap , layout , panelWrapper ]
139150 ) ;
140151 const hydrateComponent = useCallback (
141152 ( name , props ) => ( hydrateMap . get ( name ) ?? FALLBACK_CALLBACK ) ( props , id ) ,
0 commit comments