dockview-angular 4.12.0 → 4.13.1

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.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -1264,11 +1264,13 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
1264
1264
  document.removeEventListener('pointermove', onPointerMove);
1265
1265
  document.removeEventListener('pointerup', end);
1266
1266
  document.removeEventListener('pointercancel', end);
1267
+ document.removeEventListener('contextmenu', end);
1267
1268
  this._onDidSashEnd.fire(undefined);
1268
1269
  };
1269
1270
  document.addEventListener('pointermove', onPointerMove);
1270
1271
  document.addEventListener('pointerup', end);
1271
1272
  document.addEventListener('pointercancel', end);
1273
+ document.addEventListener('contextmenu', end);
1272
1274
  };
1273
1275
  sash.addEventListener('pointerdown', onPointerStart);
1274
1276
  const sashItem = {
@@ -5130,7 +5132,7 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
5130
5132
  }
5131
5133
  }
5132
5134
 
5133
- class WillShowOverlayLocationEvent {
5135
+ class DockviewWillShowOverlayLocationEvent {
5134
5136
  get kind() {
5135
5137
  return this.options.kind;
5136
5138
  }
@@ -5478,7 +5480,7 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
5478
5480
  index: this._tabs.findIndex((x) => x.value === tab),
5479
5481
  });
5480
5482
  }), tab.onWillShowOverlay((event) => {
5481
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5483
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5482
5484
  kind: 'tab',
5483
5485
  panel: this.group.activePanel,
5484
5486
  api: this.accessor.api,
@@ -5642,7 +5644,7 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
5642
5644
  index: this.tabs.size,
5643
5645
  });
5644
5646
  }), this.voidContainer.onWillShowOverlay((event) => {
5645
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
5647
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
5646
5648
  kind: 'header_space',
5647
5649
  panel: this.group.activePanel,
5648
5650
  api: this.accessor.api,
@@ -6036,7 +6038,7 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
6036
6038
  }), this.tabsContainer.onWillShowOverlay((event) => {
6037
6039
  this._onWillShowOverlay.fire(event);
6038
6040
  }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
6039
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
6041
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
6040
6042
  kind: 'content',
6041
6043
  panel: this.activePanel,
6042
6044
  api: this._api,
@@ -6712,7 +6714,19 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
6712
6714
  this.onDidLocationChange = this._onDidLocationChange.event;
6713
6715
  this._onDidActivePanelChange = new Emitter();
6714
6716
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
6715
- this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
6717
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidVisibilityChange.event((event) => {
6718
+ // When becoming visible, apply any pending size change
6719
+ if (event.isVisible && this._pendingSize) {
6720
+ super.setSize(this._pendingSize);
6721
+ this._pendingSize = undefined;
6722
+ }
6723
+ }));
6724
+ }
6725
+ setSize(event) {
6726
+ // Always store the requested size
6727
+ this._pendingSize = Object.assign({}, event);
6728
+ // Apply the size change immediately
6729
+ super.setSize(event);
6716
6730
  }
6717
6731
  close() {
6718
6732
  if (!this._group) {
@@ -7664,13 +7678,16 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
7664
7678
  let right = undefined;
7665
7679
  let width = undefined;
7666
7680
  const moveTop = () => {
7667
- top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
7681
+ // When dragging top handle, constrain top position to prevent oversizing
7682
+ const maxTop = startPosition.originalY +
7668
7683
  startPosition.originalHeight >
7669
7684
  containerRect.height
7670
- ? this.getMinimumHeight(containerRect.height)
7685
+ ? Math.max(0, containerRect.height -
7686
+ Overlay.MINIMUM_HEIGHT)
7671
7687
  : Math.max(0, startPosition.originalY +
7672
7688
  startPosition.originalHeight -
7673
- Overlay.MINIMUM_HEIGHT));
7689
+ Overlay.MINIMUM_HEIGHT);
7690
+ top = clamp(y, 0, maxTop);
7674
7691
  height =
7675
7692
  startPosition.originalY +
7676
7693
  startPosition.originalHeight -
@@ -7681,22 +7698,27 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
7681
7698
  top =
7682
7699
  startPosition.originalY -
7683
7700
  startPosition.originalHeight;
7684
- height = clamp(y - top, top < 0 &&
7685
- typeof this.options
7686
- .minimumInViewportHeight === 'number'
7701
+ // When dragging bottom handle, constrain height to container height
7702
+ const minHeight = top < 0 &&
7703
+ typeof this.options.minimumInViewportHeight ===
7704
+ 'number'
7687
7705
  ? -top +
7688
7706
  this.options.minimumInViewportHeight
7689
- : Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
7707
+ : Overlay.MINIMUM_HEIGHT;
7708
+ const maxHeight = containerRect.height - Math.max(0, top);
7709
+ height = clamp(y - top, minHeight, maxHeight);
7690
7710
  bottom = containerRect.height - top - height;
7691
7711
  };
7692
7712
  const moveLeft = () => {
7693
- left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
7713
+ const maxLeft = startPosition.originalX +
7694
7714
  startPosition.originalWidth >
7695
7715
  containerRect.width
7696
- ? this.getMinimumWidth(containerRect.width)
7716
+ ? Math.max(0, containerRect.width -
7717
+ Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge
7697
7718
  : Math.max(0, startPosition.originalX +
7698
7719
  startPosition.originalWidth -
7699
- Overlay.MINIMUM_WIDTH));
7720
+ Overlay.MINIMUM_WIDTH);
7721
+ left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge
7700
7722
  width =
7701
7723
  startPosition.originalX +
7702
7724
  startPosition.originalWidth -
@@ -7707,12 +7729,15 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
7707
7729
  left =
7708
7730
  startPosition.originalX -
7709
7731
  startPosition.originalWidth;
7710
- width = clamp(x - left, left < 0 &&
7711
- typeof this.options
7712
- .minimumInViewportWidth === 'number'
7732
+ // When dragging right handle, constrain width to container width
7733
+ const minWidth = left < 0 &&
7734
+ typeof this.options.minimumInViewportWidth ===
7735
+ 'number'
7713
7736
  ? -left +
7714
7737
  this.options.minimumInViewportWidth
7715
- : Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
7738
+ : Overlay.MINIMUM_WIDTH;
7739
+ const maxWidth = containerRect.width - Math.max(0, left);
7740
+ width = clamp(x - left, minWidth, maxWidth);
7716
7741
  right = containerRect.width - left - width;
7717
7742
  };
7718
7743
  switch (direction) {
@@ -8505,7 +8530,14 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
8505
8530
  if (options.debug) {
8506
8531
  this.addDisposables(new StrictEventsSequencing(this));
8507
8532
  }
8508
- this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8533
+ this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidMovePanel.event(() => {
8534
+ /**
8535
+ * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.
8536
+ * With defaultRenderer="always" this results in panel content not showing after move operations.
8537
+ * Debounced to avoid multiple calls when moving groups with multiple panels.
8538
+ */
8539
+ this.debouncedUpdateAllPositions();
8540
+ }), this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8509
8541
  this.updateWatermark();
8510
8542
  }), this.onDidAdd((event) => {
8511
8543
  if (!this._moving) {
@@ -8542,7 +8574,7 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
8542
8574
  // option only available when no panels in primary grid
8543
8575
  return;
8544
8576
  }
8545
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
8577
+ this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
8546
8578
  kind: 'edge',
8547
8579
  panel: undefined,
8548
8580
  api: this._api,
@@ -9371,9 +9403,7 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
9371
9403
  }
9372
9404
  this.updateWatermark();
9373
9405
  // Force position updates for always visible panels after DOM layout is complete
9374
- requestAnimationFrame(() => {
9375
- this.overlayRenderContainer.updateAllPositions();
9376
- });
9406
+ this.debouncedUpdateAllPositions();
9377
9407
  this._onDidLayoutFromJSON.fire();
9378
9408
  }
9379
9409
  clear() {
@@ -9709,6 +9739,15 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
9709
9739
  }
9710
9740
  return re;
9711
9741
  }
9742
+ debouncedUpdateAllPositions() {
9743
+ if (this._updatePositionsFrameId !== undefined) {
9744
+ cancelAnimationFrame(this._updatePositionsFrameId);
9745
+ }
9746
+ this._updatePositionsFrameId = requestAnimationFrame(() => {
9747
+ this._updatePositionsFrameId = undefined;
9748
+ this.overlayRenderContainer.updateAllPositions();
9749
+ });
9750
+ }
9712
9751
  movingLock(func) {
9713
9752
  const isMoving = this._moving;
9714
9753
  try {
@@ -10019,6 +10058,7 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
10019
10058
  from.panels.forEach((panel) => {
10020
10059
  this._onDidMovePanel.fire({ panel, from });
10021
10060
  });
10061
+ this.debouncedUpdateAllPositions();
10022
10062
  // Ensure group becomes active after move
10023
10063
  if (options.skipSetActive === false) {
10024
10064
  // Only activate when explicitly requested (skipSetActive: false)
@@ -13082,6 +13122,7 @@ define(['exports', '@angular/core', '@angular/common', 'rxjs'], (function (expor
13082
13122
  exports.DockviewPanel = DockviewPanel;
13083
13123
  exports.DockviewUnhandledDragOverEvent = DockviewUnhandledDragOverEvent;
13084
13124
  exports.DockviewWillDropEvent = DockviewWillDropEvent;
13125
+ exports.DockviewWillShowOverlayLocationEvent = DockviewWillShowOverlayLocationEvent;
13085
13126
  exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
13086
13127
  exports.Gridview = Gridview;
13087
13128
  exports.GridviewApi = GridviewApi;