@@ -23,6 +23,7 @@ import ColumnMenuPopup, {
2323    FilterListItem , 
2424    FilterValue , 
2525}  from  "./table/plugins/ColumnMenuPopup" ; 
26+ import  {  TableColumnResizeDialog  }  from  "./table/TableColumnResizeDialog" ; 
2627
2728export  interface  ColumnFilterPopupOptions  { 
2829    columnId : string ; 
@@ -36,8 +37,22 @@ export interface ColumnFilterPopupOptions {
3637    onSortAscending : ( )  =>  Promise < void > ; 
3738    onSortDescending : ( )  =>  Promise < void > ; 
3839    currentSort : SortProperties ; 
40+     onResize : ( )  =>  void ; 
3941} 
4042
43+ /** 
44+  * Options for opening the resize column dialog 
45+  */ 
46+ type  ResizeColumnDialogState  =  { 
47+     open : boolean ; 
48+     columnId : string ; 
49+     columnName : string ; 
50+     initialWidth : number ; 
51+     gridId : string ; 
52+     onSubmit : ( width : number )  =>  Promise < void >  |  void ; 
53+     onDismiss : ( )  =>  void ; 
54+ } ; 
55+ 
4156export  interface  QueryResultReactProvider 
4257    extends  Omit < ExecutionPlanProvider ,  "getExecutionPlan" > , 
4358        CoreRPCs  { 
@@ -65,6 +80,12 @@ export interface QueryResultReactProvider
6580     * @param  type the type of file to open 
6681     */ 
6782    openFileThroughLink ( content : string ,  type : string ) : void ; 
83+     /** 
84+      * Opens the resize column dialog 
85+      * @param  options options for the resize dialog 
86+      * @returns  void 
87+      */ 
88+     openResizeDialog : ( options : Partial < ResizeColumnDialogState > )  =>  void ; 
6889} 
6990
7091export  const  QueryResultCommandsContext  =  createContext < QueryResultReactProvider  |  undefined > ( 
@@ -89,6 +110,16 @@ const QueryResultStateProvider: React.FC<QueryResultProviderProps> = ({ children
89110        undefined , 
90111    ) ; 
91112
113+     const  [ resizeDialogState ,  setResizeDialogState ]  =  useState < ResizeColumnDialogState > ( { 
114+         open : false , 
115+         columnId : "" , 
116+         columnName : "" , 
117+         initialWidth : 0 , 
118+         gridId : "" , 
119+         onDismiss : ( )  =>  { } , 
120+         onSubmit : ( )  =>  { } , 
121+     } ) ; 
122+ 
92123    const  hideFilterPopup  =  useCallback ( ( )  =>  { 
93124        setFilterPopupState ( ( state )  =>  { 
94125            if  ( state ?. onDismiss )  { 
@@ -171,6 +202,13 @@ const QueryResultStateProvider: React.FC<QueryResultProviderProps> = ({ children
171202            updateTotalCost : ( addedCost : number )  =>  { 
172203                extensionRpc . action ( "updateTotalCost" ,  {  addedCost } ) ; 
173204            } , 
205+             openResizeDialog : ( options : Partial < ResizeColumnDialogState > )  =>  { 
206+                 setResizeDialogState ( ( state )  =>  ( { 
207+                     ...state , 
208+                     ...options , 
209+                     open : true , 
210+                 } ) ) ; 
211+             } , 
174212        } ) , 
175213        [ extensionRpc ,  hideFilterPopup ] , 
176214    ) ; 
@@ -227,9 +265,28 @@ const QueryResultStateProvider: React.FC<QueryResultProviderProps> = ({ children
227265                    onClearSort = { filterPopupState . onClearSort } 
228266                    onSortAscending = { filterPopupState . onSortAscending } 
229267                    onSortDescending = { filterPopupState . onSortDescending } 
268+                     onResize = { ( )  =>  { 
269+                         hideFilterPopup ( ) ; 
270+                         filterPopupState . onResize ( ) ; 
271+                     } } 
230272                    currentSort = { filterPopupState . currentSort } 
231273                /> 
232274            ) } 
275+             { resizeDialogState . open  &&  ( 
276+                 < TableColumnResizeDialog 
277+                     open = { resizeDialogState . open } 
278+                     columnName = { resizeDialogState . columnName } 
279+                     initialWidth = { resizeDialogState . initialWidth } 
280+                     onSubmit = { async  ( newWidth : number )  =>  { 
281+                         await  resizeDialogState . onSubmit ( newWidth ) ; 
282+                         setResizeDialogState ( ( state )  =>  ( {  ...state ,  open : false  } ) ) ; 
283+                     } } 
284+                     onDismiss = { ( )  =>  { 
285+                         resizeDialogState . onDismiss ( ) ; 
286+                         setResizeDialogState ( ( state )  =>  ( {  ...state ,  open : false  } ) ) ; 
287+                     } } 
288+                 /> 
289+             ) } 
233290        </ QueryResultCommandsContext . Provider > 
234291    ) ; 
235292} ; 
0 commit comments