dockview-angular 4.12.0 → 4.13.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-angular
3
- * @version 4.12.0
3
+ * @version 4.13.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -1268,11 +1268,13 @@
1268
1268
  document.removeEventListener('pointermove', onPointerMove);
1269
1269
  document.removeEventListener('pointerup', end);
1270
1270
  document.removeEventListener('pointercancel', end);
1271
+ document.removeEventListener('contextmenu', end);
1271
1272
  this._onDidSashEnd.fire(undefined);
1272
1273
  };
1273
1274
  document.addEventListener('pointermove', onPointerMove);
1274
1275
  document.addEventListener('pointerup', end);
1275
1276
  document.addEventListener('pointercancel', end);
1277
+ document.addEventListener('contextmenu', end);
1276
1278
  };
1277
1279
  sash.addEventListener('pointerdown', onPointerStart);
1278
1280
  const sashItem = {
@@ -5134,7 +5136,7 @@
5134
5136
  }
5135
5137
  }
5136
5138
 
5137
- class WillShowOverlayLocationEvent {
5139
+ class DockviewWillShowOverlayLocationEvent {
5138
5140
  get kind() {
5139
5141
  return this.options.kind;
5140
5142
  }
@@ -5482,7 +5484,7 @@
5482
5484
  index: this._tabs.findIndex((x) => x.value === tab),
5483
5485
  });
5484
5486
  }), tab.onWillShowOverlay((event) => {
5485
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5487
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5486
5488
  kind: 'tab',
5487
5489
  panel: this.group.activePanel,
5488
5490
  api: this.accessor.api,
@@ -5646,7 +5648,7 @@
5646
5648
  index: this.tabs.size,
5647
5649
  });
5648
5650
  }), this.voidContainer.onWillShowOverlay((event) => {
5649
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5651
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5650
5652
  kind: 'header_space',
5651
5653
  panel: this.group.activePanel,
5652
5654
  api: this.accessor.api,
@@ -6040,7 +6042,7 @@
6040
6042
  }), this.tabsContainer.onWillShowOverlay((event) => {
6041
6043
  this._onWillShowOverlay.fire(event);
6042
6044
  }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
6043
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
6045
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
6044
6046
  kind: 'content',
6045
6047
  panel: this.activePanel,
6046
6048
  api: this._api,
@@ -6716,7 +6718,19 @@
6716
6718
  this.onDidLocationChange = this._onDidLocationChange.event;
6717
6719
  this._onDidActivePanelChange = new Emitter();
6718
6720
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
6719
- this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
6721
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidVisibilityChange.event((event) => {
6722
+ // When becoming visible, apply any pending size change
6723
+ if (event.isVisible && this._pendingSize) {
6724
+ super.setSize(this._pendingSize);
6725
+ this._pendingSize = undefined;
6726
+ }
6727
+ }));
6728
+ }
6729
+ setSize(event) {
6730
+ // Always store the requested size
6731
+ this._pendingSize = Object.assign({}, event);
6732
+ // Apply the size change immediately
6733
+ super.setSize(event);
6720
6734
  }
6721
6735
  close() {
6722
6736
  if (!this._group) {
@@ -7668,13 +7682,16 @@
7668
7682
  let right = undefined;
7669
7683
  let width = undefined;
7670
7684
  const moveTop = () => {
7671
- top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
7685
+ // When dragging top handle, constrain top position to prevent oversizing
7686
+ const maxTop = startPosition.originalY +
7672
7687
  startPosition.originalHeight >
7673
7688
  containerRect.height
7674
- ? this.getMinimumHeight(containerRect.height)
7689
+ ? Math.max(0, containerRect.height -
7690
+ Overlay.MINIMUM_HEIGHT)
7675
7691
  : Math.max(0, startPosition.originalY +
7676
7692
  startPosition.originalHeight -
7677
- Overlay.MINIMUM_HEIGHT));
7693
+ Overlay.MINIMUM_HEIGHT);
7694
+ top = clamp(y, 0, maxTop);
7678
7695
  height =
7679
7696
  startPosition.originalY +
7680
7697
  startPosition.originalHeight -
@@ -7685,22 +7702,27 @@
7685
7702
  top =
7686
7703
  startPosition.originalY -
7687
7704
  startPosition.originalHeight;
7688
- height = clamp(y - top, top < 0 &&
7689
- typeof this.options
7690
- .minimumInViewportHeight === 'number'
7705
+ // When dragging bottom handle, constrain height to container height
7706
+ const minHeight = top < 0 &&
7707
+ typeof this.options.minimumInViewportHeight ===
7708
+ 'number'
7691
7709
  ? -top +
7692
7710
  this.options.minimumInViewportHeight
7693
- : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
7711
+ : Overlay.MINIMUM_HEIGHT;
7712
+ const maxHeight = containerRect.height - Math.max(0, top);
7713
+ height = clamp(y - top, minHeight, maxHeight);
7694
7714
  bottom = containerRect.height - top - height;
7695
7715
  };
7696
7716
  const moveLeft = () => {
7697
- left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
7717
+ const maxLeft = startPosition.originalX +
7698
7718
  startPosition.originalWidth >
7699
7719
  containerRect.width
7700
- ? this.getMinimumWidth(containerRect.width)
7720
+ ? Math.max(0, containerRect.width -
7721
+ Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge
7701
7722
  : Math.max(0, startPosition.originalX +
7702
7723
  startPosition.originalWidth -
7703
- Overlay.MINIMUM_WIDTH));
7724
+ Overlay.MINIMUM_WIDTH);
7725
+ left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge
7704
7726
  width =
7705
7727
  startPosition.originalX +
7706
7728
  startPosition.originalWidth -
@@ -7711,12 +7733,15 @@
7711
7733
  left =
7712
7734
  startPosition.originalX -
7713
7735
  startPosition.originalWidth;
7714
- width = clamp(x - left, left < 0 &&
7715
- typeof this.options
7716
- .minimumInViewportWidth === 'number'
7736
+ // When dragging right handle, constrain width to container width
7737
+ const minWidth = left < 0 &&
7738
+ typeof this.options.minimumInViewportWidth ===
7739
+ 'number'
7717
7740
  ? -left +
7718
7741
  this.options.minimumInViewportWidth
7719
- : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
7742
+ : Overlay.MINIMUM_WIDTH;
7743
+ const maxWidth = containerRect.width - Math.max(0, left);
7744
+ width = clamp(x - left, minWidth, maxWidth);
7720
7745
  right = containerRect.width - left - width;
7721
7746
  };
7722
7747
  switch (direction) {
@@ -8546,7 +8571,7 @@
8546
8571
  // option only available when no panels in primary grid
8547
8572
  return;
8548
8573
  }
8549
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
8574
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
8550
8575
  kind: 'edge',
8551
8576
  panel: undefined,
8552
8577
  api: this._api,
@@ -9783,6 +9808,13 @@
9783
9808
  panel: removedPanel,
9784
9809
  from: sourceGroup,
9785
9810
  });
9811
+ /**
9812
+ * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
9813
+ * With defaultRenderer="always" this results in panel content not showing after move operations.
9814
+ */
9815
+ requestAnimationFrame(() => {
9816
+ this.overlayRenderContainer.updateAllPositions();
9817
+ });
9786
9818
  }
9787
9819
  else {
9788
9820
  /**
@@ -13086,6 +13118,7 @@
13086
13118
  exports.DockviewPanel = DockviewPanel;
13087
13119
  exports.DockviewUnhandledDragOverEvent = DockviewUnhandledDragOverEvent;
13088
13120
  exports.DockviewWillDropEvent = DockviewWillDropEvent;
13121
+ exports.DockviewWillShowOverlayLocationEvent = DockviewWillShowOverlayLocationEvent;
13089
13122
  exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
13090
13123
  exports.Gridview = Gridview;
13091
13124
  exports.GridviewApi = GridviewApi;