@@ -26,7 +26,7 @@ export const COLLAPSED_SIDE_PANEL_SIZE = 45;
2626export const MIN_SHEET_VIEW_WIDTH = 150 ;
2727
2828interface PanelInfo {
29- initialPanelProps : SidePanelComponentProps ;
29+ currentPanelProps : SidePanelComponentProps ;
3030 componentTag : string ;
3131 size : number ;
3232 isCollapsed ?: boolean ;
@@ -87,6 +87,7 @@ export class SidePanelStore extends SpreadsheetStore {
8787 private getPanelProps ( panelInfo : PanelInfo ) : SidePanelComponentProps {
8888 const state = this . computeState ( panelInfo ) ;
8989 if ( state . isOpen ) {
90+ panelInfo . currentPanelProps = state . props ?? panelInfo . currentPanelProps ;
9091 return state . props ?? { } ;
9192 }
9293 return { } ;
@@ -100,12 +101,12 @@ export class SidePanelStore extends SpreadsheetStore {
100101 return undefined ;
101102 }
102103
103- open ( componentTag : string , initialPanelProps : SidePanelComponentProps = { } ) {
104+ open ( componentTag : string , currentPanelProps : SidePanelComponentProps = { } ) {
104105 if ( this . screenWidthStore . isSmall ) {
105106 return ;
106107 }
107108
108- const newPanelInfo = { initialPanelProps , componentTag, size : DEFAULT_SIDE_PANEL_SIZE } ;
109+ const newPanelInfo = { currentPanelProps , componentTag, size : DEFAULT_SIDE_PANEL_SIZE } ;
109110 const state = this . computeState ( newPanelInfo ) ;
110111 if ( ! state . isOpen ) {
111112 return ;
@@ -138,9 +139,9 @@ export class SidePanelStore extends SpreadsheetStore {
138139 replace (
139140 componentTag : string ,
140141 currentPanelKey : string ,
141- initialPanelProps : SidePanelComponentProps = { }
142+ currentPanelProps : SidePanelComponentProps = { }
142143 ) {
143- const newPanelInfo = { initialPanelProps , componentTag, size : DEFAULT_SIDE_PANEL_SIZE } ;
144+ const newPanelInfo = { currentPanelProps , componentTag, size : DEFAULT_SIDE_PANEL_SIZE } ;
144145 const state = this . computeState ( newPanelInfo ) ;
145146 if ( ! state . isOpen ) {
146147 return ;
@@ -178,10 +179,10 @@ export class SidePanelStore extends SpreadsheetStore {
178179 const currentPanel = this [ panel ] ;
179180
180181 if ( currentPanel && newPanel . componentTag !== currentPanel . componentTag ) {
181- currentPanel . initialPanelProps ?. onCloseSidePanel ?.( ) ;
182+ currentPanel . currentPanelProps ?. onCloseSidePanel ?.( ) ;
182183 }
183184 this [ panel ] = {
184- initialPanelProps : state . props ?? { } ,
185+ currentPanelProps : state . props ?? { } ,
185186 componentTag : newPanel . componentTag ,
186187 size : currentPanel ?. size || DEFAULT_SIDE_PANEL_SIZE ,
187188 isCollapsed : currentPanel ?. isCollapsed || false ,
@@ -204,17 +205,17 @@ export class SidePanelStore extends SpreadsheetStore {
204205 close ( ) {
205206 if ( this . mainPanel ?. isPinned ) {
206207 if ( this . secondaryPanel ) {
207- this . secondaryPanel . initialPanelProps . onCloseSidePanel ?.( ) ;
208+ this . secondaryPanel . currentPanelProps . onCloseSidePanel ?.( ) ;
208209 this . secondaryPanel = undefined ;
209210 }
210211 return ;
211212 }
212- this . mainPanel ?. initialPanelProps . onCloseSidePanel ?.( ) ;
213+ this . mainPanel ?. currentPanelProps . onCloseSidePanel ?.( ) ;
213214 this . mainPanel = undefined ;
214215 }
215216
216217 closeMainPanel ( ) {
217- this . mainPanel ?. initialPanelProps . onCloseSidePanel ?.( ) ;
218+ this . mainPanel ?. currentPanelProps . onCloseSidePanel ?.( ) ;
218219 this . mainPanel = this . secondaryPanel || undefined ;
219220 this . secondaryPanel = undefined ;
220221 }
@@ -252,7 +253,7 @@ export class SidePanelStore extends SpreadsheetStore {
252253 }
253254 this . mainPanel . isPinned = ! this . mainPanel . isPinned ;
254255 if ( ! this . mainPanel . isPinned && this . secondaryPanel ) {
255- this . secondaryPanel ?. initialPanelProps . onCloseSidePanel ?.( ) ;
256+ this . secondaryPanel ?. currentPanelProps . onCloseSidePanel ?.( ) ;
256257 this . mainPanel = this . secondaryPanel ;
257258 this . secondaryPanel = undefined ;
258259 }
@@ -272,7 +273,10 @@ export class SidePanelStore extends SpreadsheetStore {
272273 }
273274 }
274275
275- private computeState ( { componentTag, initialPanelProps } : PanelInfo ) : SidePanelState {
276+ private computeState ( {
277+ componentTag,
278+ currentPanelProps : initialPanelProps ,
279+ } : PanelInfo ) : SidePanelState {
276280 const customComputeState = sidePanelRegistry . get ( componentTag ) . computeState ;
277281 const state : SidePanelState = customComputeState
278282 ? customComputeState ( this . getters , initialPanelProps )
@@ -283,7 +287,7 @@ export class SidePanelStore extends SpreadsheetStore {
283287 changeSpreadsheetWidth ( width : number ) {
284288 this . availableWidth = width - MIN_SHEET_VIEW_WIDTH ;
285289 if ( this . secondaryPanel && width - this . totalPanelSize < MIN_SHEET_VIEW_WIDTH ) {
286- this . secondaryPanel ?. initialPanelProps . onCloseSidePanel ?.( ) ;
290+ this . secondaryPanel ?. currentPanelProps . onCloseSidePanel ?.( ) ;
287291 this . secondaryPanel = undefined ;
288292 }
289293 if ( this . mainPanel && width - this . totalPanelSize < MIN_SHEET_VIEW_WIDTH ) {
0 commit comments