dockview-react 4.9.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 4.9.0
3
+ * @version 4.11.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -6794,11 +6794,16 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
6794
6794
  }
6795
6795
  }
6796
6796
 
6797
+ // GridConstraintChangeEvent2 is not exported, so we'll type it manually
6797
6798
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
6798
6799
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
6799
6800
  class DockviewGroupPanel extends GridviewPanel {
6800
6801
  get minimumWidth() {
6801
6802
  var _a;
6803
+ // Check for explicitly set group constraint first
6804
+ if (typeof this._explicitConstraints.minimumWidth === 'number') {
6805
+ return this._explicitConstraints.minimumWidth;
6806
+ }
6802
6807
  const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
6803
6808
  if (typeof activePanelMinimumWidth === 'number') {
6804
6809
  return activePanelMinimumWidth;
@@ -6807,6 +6812,10 @@ class DockviewGroupPanel extends GridviewPanel {
6807
6812
  }
6808
6813
  get minimumHeight() {
6809
6814
  var _a;
6815
+ // Check for explicitly set group constraint first
6816
+ if (typeof this._explicitConstraints.minimumHeight === 'number') {
6817
+ return this._explicitConstraints.minimumHeight;
6818
+ }
6810
6819
  const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
6811
6820
  if (typeof activePanelMinimumHeight === 'number') {
6812
6821
  return activePanelMinimumHeight;
@@ -6815,6 +6824,10 @@ class DockviewGroupPanel extends GridviewPanel {
6815
6824
  }
6816
6825
  get maximumWidth() {
6817
6826
  var _a;
6827
+ // Check for explicitly set group constraint first
6828
+ if (typeof this._explicitConstraints.maximumWidth === 'number') {
6829
+ return this._explicitConstraints.maximumWidth;
6830
+ }
6818
6831
  const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
6819
6832
  if (typeof activePanelMaximumWidth === 'number') {
6820
6833
  return activePanelMaximumWidth;
@@ -6823,6 +6836,10 @@ class DockviewGroupPanel extends GridviewPanel {
6823
6836
  }
6824
6837
  get maximumHeight() {
6825
6838
  var _a;
6839
+ // Check for explicitly set group constraint first
6840
+ if (typeof this._explicitConstraints.maximumHeight === 'number') {
6841
+ return this._explicitConstraints.maximumHeight;
6842
+ }
6826
6843
  const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
6827
6844
  if (typeof activePanelMaximumHeight === 'number') {
6828
6845
  return activePanelMaximumHeight;
@@ -6854,14 +6871,39 @@ class DockviewGroupPanel extends GridviewPanel {
6854
6871
  var _a, _b, _c, _d, _e, _f;
6855
6872
  super(id, 'groupview_default', {
6856
6873
  minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6857
- minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6874
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.minimumWidth) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6858
6875
  maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
6859
6876
  maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
6860
6877
  }, new DockviewGroupPanelApiImpl(id, accessor));
6878
+ // Track explicitly set constraints to override panel constraints
6879
+ this._explicitConstraints = {};
6861
6880
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6862
6881
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
6863
6882
  this.addDisposables(this.model.onDidActivePanelChange((event) => {
6864
6883
  this.api._onDidActivePanelChange.fire(event);
6884
+ }), this.api.onDidConstraintsChangeInternal((event) => {
6885
+ // Track explicitly set constraints to override panel constraints
6886
+ // Extract numeric values from functions or values
6887
+ if (event.minimumWidth !== undefined) {
6888
+ this._explicitConstraints.minimumWidth = typeof event.minimumWidth === 'function'
6889
+ ? event.minimumWidth()
6890
+ : event.minimumWidth;
6891
+ }
6892
+ if (event.minimumHeight !== undefined) {
6893
+ this._explicitConstraints.minimumHeight = typeof event.minimumHeight === 'function'
6894
+ ? event.minimumHeight()
6895
+ : event.minimumHeight;
6896
+ }
6897
+ if (event.maximumWidth !== undefined) {
6898
+ this._explicitConstraints.maximumWidth = typeof event.maximumWidth === 'function'
6899
+ ? event.maximumWidth()
6900
+ : event.maximumWidth;
6901
+ }
6902
+ if (event.maximumHeight !== undefined) {
6903
+ this._explicitConstraints.maximumHeight = typeof event.maximumHeight === 'function'
6904
+ ? event.maximumHeight()
6905
+ : event.maximumHeight;
6906
+ }
6865
6907
  }));
6866
6908
  }
6867
6909
  focus() {
@@ -10306,8 +10348,8 @@ class GridviewComponent extends BaseGrid {
10306
10348
  accessor: this,
10307
10349
  isVisible: true,
10308
10350
  });
10309
- this.registerPanel(view);
10310
10351
  this.doAddGroup(view, relativeLocation, options.size);
10352
+ this.registerPanel(view);
10311
10353
  this.doSetGroupActive(view);
10312
10354
  return view;
10313
10355
  }
@@ -11633,6 +11675,10 @@ function useTitle(api) {
11633
11675
  const disposable = api.onDidTitleChange((event) => {
11634
11676
  setTitle(event.title);
11635
11677
  });
11678
+ // Depending on the order in which React effects are run, the title may already be out of sync (cf. issue #1003).
11679
+ if (title !== api.title) {
11680
+ setTitle(api.title);
11681
+ }
11636
11682
  return () => {
11637
11683
  disposable.dispose();
11638
11684
  };