dockview-core 4.10.0 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ export interface ActiveGroupEvent {
18
18
  export interface GroupChangedEvent {
19
19
  }
20
20
  export type DockviewPanelMoveParams = DockviewGroupMoveParams;
21
- export interface DockviewPanelApi extends Omit<GridviewPanelApi, 'setVisible' | 'onDidConstraintsChange' | 'setConstraints'> {
21
+ export interface DockviewPanelApi extends Omit<GridviewPanelApi, 'setVisible' | 'onDidConstraintsChange'> {
22
22
  /**
23
23
  * The id of the tab component renderer
24
24
  *
@@ -14,6 +14,7 @@ export interface IDockviewGroupPanel extends IGridviewPanel<DockviewGroupPanelAp
14
14
  export type IDockviewGroupPanelPublic = IDockviewGroupPanel;
15
15
  export declare class DockviewGroupPanel extends GridviewPanel<DockviewGroupPanelApiImpl> implements IDockviewGroupPanel {
16
16
  private readonly _model;
17
+ private _explicitConstraints;
17
18
  get minimumWidth(): number;
18
19
  get minimumHeight(): number;
19
20
  get maximumWidth(): number;
@@ -1,11 +1,16 @@
1
1
  import { DockviewGroupPanelModel, } from './dockviewGroupPanelModel';
2
2
  import { GridviewPanel } from '../gridview/gridviewPanel';
3
3
  import { DockviewGroupPanelApiImpl, } from '../api/dockviewGroupPanelApi';
4
+ // GridConstraintChangeEvent2 is not exported, so we'll type it manually
4
5
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
5
6
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
6
7
  export class DockviewGroupPanel extends GridviewPanel {
7
8
  get minimumWidth() {
8
9
  var _a;
10
+ // Check for explicitly set group constraint first
11
+ if (typeof this._explicitConstraints.minimumWidth === 'number') {
12
+ return this._explicitConstraints.minimumWidth;
13
+ }
9
14
  const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
10
15
  if (typeof activePanelMinimumWidth === 'number') {
11
16
  return activePanelMinimumWidth;
@@ -14,6 +19,10 @@ export class DockviewGroupPanel extends GridviewPanel {
14
19
  }
15
20
  get minimumHeight() {
16
21
  var _a;
22
+ // Check for explicitly set group constraint first
23
+ if (typeof this._explicitConstraints.minimumHeight === 'number') {
24
+ return this._explicitConstraints.minimumHeight;
25
+ }
17
26
  const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
18
27
  if (typeof activePanelMinimumHeight === 'number') {
19
28
  return activePanelMinimumHeight;
@@ -22,6 +31,10 @@ export class DockviewGroupPanel extends GridviewPanel {
22
31
  }
23
32
  get maximumWidth() {
24
33
  var _a;
34
+ // Check for explicitly set group constraint first
35
+ if (typeof this._explicitConstraints.maximumWidth === 'number') {
36
+ return this._explicitConstraints.maximumWidth;
37
+ }
25
38
  const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
26
39
  if (typeof activePanelMaximumWidth === 'number') {
27
40
  return activePanelMaximumWidth;
@@ -30,6 +43,10 @@ export class DockviewGroupPanel extends GridviewPanel {
30
43
  }
31
44
  get maximumHeight() {
32
45
  var _a;
46
+ // Check for explicitly set group constraint first
47
+ if (typeof this._explicitConstraints.maximumHeight === 'number') {
48
+ return this._explicitConstraints.maximumHeight;
49
+ }
33
50
  const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
34
51
  if (typeof activePanelMaximumHeight === 'number') {
35
52
  return activePanelMaximumHeight;
@@ -61,14 +78,39 @@ export class DockviewGroupPanel extends GridviewPanel {
61
78
  var _a, _b, _c, _d, _e, _f;
62
79
  super(id, 'groupview_default', {
63
80
  minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
64
- minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
81
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.minimumWidth) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
65
82
  maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
66
83
  maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
67
84
  }, new DockviewGroupPanelApiImpl(id, accessor));
85
+ // Track explicitly set constraints to override panel constraints
86
+ this._explicitConstraints = {};
68
87
  this.api.initialize(this); // cannot use 'this' after after 'super' call
69
88
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
70
89
  this.addDisposables(this.model.onDidActivePanelChange((event) => {
71
90
  this.api._onDidActivePanelChange.fire(event);
91
+ }), this.api.onDidConstraintsChangeInternal((event) => {
92
+ // Track explicitly set constraints to override panel constraints
93
+ // Extract numeric values from functions or values
94
+ if (event.minimumWidth !== undefined) {
95
+ this._explicitConstraints.minimumWidth = typeof event.minimumWidth === 'function'
96
+ ? event.minimumWidth()
97
+ : event.minimumWidth;
98
+ }
99
+ if (event.minimumHeight !== undefined) {
100
+ this._explicitConstraints.minimumHeight = typeof event.minimumHeight === 'function'
101
+ ? event.minimumHeight()
102
+ : event.minimumHeight;
103
+ }
104
+ if (event.maximumWidth !== undefined) {
105
+ this._explicitConstraints.maximumWidth = typeof event.maximumWidth === 'function'
106
+ ? event.maximumWidth()
107
+ : event.maximumWidth;
108
+ }
109
+ if (event.maximumHeight !== undefined) {
110
+ this._explicitConstraints.maximumHeight = typeof event.maximumHeight === 'function'
111
+ ? event.maximumHeight()
112
+ : event.maximumHeight;
113
+ }
72
114
  }));
73
115
  }
74
116
  focus() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dockview-core",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "description": "Zero dependency layout manager supporting tabs, grids and splitviews",
5
5
  "keywords": [
6
6
  "splitview",