File tree Expand file tree Collapse file tree
src/components/BootstrapBlazor.DockView/wwwroot/js Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,16 +223,23 @@ const setWidth = (target, dockview) => {
223223 group . panels [ 0 ] && group . panels [ 0 ] . api . setActive ( )
224224 }
225225}
226-
226+ const cleanUndefined = ( obj ) => Object . fromEntries (
227+ Object . entries ( obj ) . filter ( ( [ , v ] ) => v != null )
228+ ) ;
227229const toggleComponent = ( dockview , options ) => {
228230 const optionsPanels = getPanelsFromOptions ( options ) ;
229231 const panels = optionsPanels . filter ( p => p . params . visible ) ;
230232 const localPanels = dockview . panels ;
231233 panels . forEach ( p => {
232234 const pan = findContentFromPanels ( localPanels , p ) ;
233235 if ( pan === void 0 ) {
234- const panel = findContentFromPanels ( dockview . params . panels , p ) || p ;
235- panel . params = { ...panel . params , ...p . params } ;
236+ const existingPanel = findContentFromPanels ( dockview . params . panels , p ) ;
237+ const panel = existingPanel ?
238+ {
239+ ...existingPanel ,
240+ ...cleanUndefined ( p ) ,
241+ params : { ...existingPanel . params , ...cleanUndefined ( p . params ) }
242+ } : p ;
236243 const groupPanels = panels . filter ( p1 => p1 . params . parentId == p . params . parentId ) ;
237244 let indexOfOptions = groupPanels . findIndex ( p => p . params . key == panel ?. params . key ) ;
238245 indexOfOptions = indexOfOptions == - 1 ? 0 : indexOfOptions ;
You can’t perform that action at this time.
0 commit comments