@@ -7,12 +7,13 @@ import {
77 IHeader ,
88 DockviewGroupPanelLocked ,
99} from './dockviewGroupPanelModel' ;
10- import { GridviewPanel , IGridviewPanel } from '../gridview/gridviewPanel' ;
10+ import { GridviewPanel , IGridviewPanel , Contraints } from '../gridview/gridviewPanel' ;
1111import { IDockviewPanel } from '../dockview/dockviewPanel' ;
1212import {
1313 DockviewGroupPanelApi ,
1414 DockviewGroupPanelApiImpl ,
1515} from '../api/dockviewGroupPanelApi' ;
16+ // GridConstraintChangeEvent2 is not exported, so we'll type it manually
1617
1718const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100 ;
1819const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100 ;
@@ -33,8 +34,16 @@ export class DockviewGroupPanel
3334 implements IDockviewGroupPanel
3435{
3536 private readonly _model : DockviewGroupPanelModel ;
37+
38+ // Track explicitly set constraints to override panel constraints
39+ private _explicitConstraints : Partial < Contraints > = { } ;
3640
3741 override get minimumWidth ( ) : number {
42+ // Check for explicitly set group constraint first
43+ if ( typeof this . _explicitConstraints . minimumWidth === 'number' ) {
44+ return this . _explicitConstraints . minimumWidth ;
45+ }
46+
3847 const activePanelMinimumWidth = this . activePanel ?. minimumWidth ;
3948 if ( typeof activePanelMinimumWidth === 'number' ) {
4049 return activePanelMinimumWidth ;
@@ -43,6 +52,11 @@ export class DockviewGroupPanel
4352 }
4453
4554 override get minimumHeight ( ) : number {
55+ // Check for explicitly set group constraint first
56+ if ( typeof this . _explicitConstraints . minimumHeight === 'number' ) {
57+ return this . _explicitConstraints . minimumHeight ;
58+ }
59+
4660 const activePanelMinimumHeight = this . activePanel ?. minimumHeight ;
4761 if ( typeof activePanelMinimumHeight === 'number' ) {
4862 return activePanelMinimumHeight ;
@@ -51,6 +65,11 @@ export class DockviewGroupPanel
5165 }
5266
5367 override get maximumWidth ( ) : number {
68+ // Check for explicitly set group constraint first
69+ if ( typeof this . _explicitConstraints . maximumWidth === 'number' ) {
70+ return this . _explicitConstraints . maximumWidth ;
71+ }
72+
5473 const activePanelMaximumWidth = this . activePanel ?. maximumWidth ;
5574 if ( typeof activePanelMaximumWidth === 'number' ) {
5675 return activePanelMaximumWidth ;
@@ -59,6 +78,11 @@ export class DockviewGroupPanel
5978 }
6079
6180 override get maximumHeight ( ) : number {
81+ // Check for explicitly set group constraint first
82+ if ( typeof this . _explicitConstraints . maximumHeight === 'number' ) {
83+ return this . _explicitConstraints . maximumHeight ;
84+ }
85+
6286 const activePanelMaximumHeight = this . activePanel ?. maximumHeight ;
6387 if ( typeof activePanelMaximumHeight === 'number' ) {
6488 return activePanelMaximumHeight ;
@@ -107,7 +131,7 @@ export class DockviewGroupPanel
107131 options . constraints ?. minimumHeight ??
108132 MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT ,
109133 minimumWidth :
110- options . constraints ?. maximumHeight ??
134+ options . constraints ?. minimumWidth ??
111135 MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH ,
112136 maximumHeight : options . constraints ?. maximumHeight ,
113137 maximumWidth : options . constraints ?. maximumWidth ,
@@ -128,6 +152,30 @@ export class DockviewGroupPanel
128152 this . addDisposables (
129153 this . model . onDidActivePanelChange ( ( event ) => {
130154 this . api . _onDidActivePanelChange . fire ( event ) ;
155+ } ) ,
156+ this . api . onDidConstraintsChangeInternal ( ( event : any ) => {
157+ // Track explicitly set constraints to override panel constraints
158+ // Extract numeric values from functions or values
159+ if ( event . minimumWidth !== undefined ) {
160+ this . _explicitConstraints . minimumWidth = typeof event . minimumWidth === 'function'
161+ ? event . minimumWidth ( )
162+ : event . minimumWidth ;
163+ }
164+ if ( event . minimumHeight !== undefined ) {
165+ this . _explicitConstraints . minimumHeight = typeof event . minimumHeight === 'function'
166+ ? event . minimumHeight ( )
167+ : event . minimumHeight ;
168+ }
169+ if ( event . maximumWidth !== undefined ) {
170+ this . _explicitConstraints . maximumWidth = typeof event . maximumWidth === 'function'
171+ ? event . maximumWidth ( )
172+ : event . maximumWidth ;
173+ }
174+ if ( event . maximumHeight !== undefined ) {
175+ this . _explicitConstraints . maximumHeight = typeof event . maximumHeight === 'function'
176+ ? event . maximumHeight ( )
177+ : event . maximumHeight ;
178+ }
131179 } )
132180 ) ;
133181 }
0 commit comments