dockview-core 4.4.1 → 4.5.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.
Files changed (33) hide show
  1. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +4 -0
  2. package/dist/cjs/api/dockviewGroupPanelApi.js +4 -3
  3. package/dist/cjs/api/dockviewPanelApi.js +1 -0
  4. package/dist/cjs/dockview/dockviewComponent.d.ts +2 -0
  5. package/dist/cjs/dockview/dockviewComponent.js +89 -6
  6. package/dist/dockview-core.amd.js +100 -13
  7. package/dist/dockview-core.amd.js.map +1 -1
  8. package/dist/dockview-core.amd.min.js +2 -2
  9. package/dist/dockview-core.amd.min.js.map +1 -1
  10. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  11. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  12. package/dist/dockview-core.amd.noStyle.js +100 -13
  13. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  14. package/dist/dockview-core.cjs.js +100 -13
  15. package/dist/dockview-core.cjs.js.map +1 -1
  16. package/dist/dockview-core.esm.js +100 -13
  17. package/dist/dockview-core.esm.js.map +1 -1
  18. package/dist/dockview-core.esm.min.js +2 -2
  19. package/dist/dockview-core.esm.min.js.map +1 -1
  20. package/dist/dockview-core.js +100 -13
  21. package/dist/dockview-core.js.map +1 -1
  22. package/dist/dockview-core.min.js +2 -2
  23. package/dist/dockview-core.min.js.map +1 -1
  24. package/dist/dockview-core.min.noStyle.js +2 -2
  25. package/dist/dockview-core.min.noStyle.js.map +1 -1
  26. package/dist/dockview-core.noStyle.js +100 -13
  27. package/dist/dockview-core.noStyle.js.map +1 -1
  28. package/dist/esm/api/dockviewGroupPanelApi.d.ts +4 -0
  29. package/dist/esm/api/dockviewGroupPanelApi.js +4 -3
  30. package/dist/esm/api/dockviewPanelApi.js +1 -0
  31. package/dist/esm/dockview/dockviewComponent.d.ts +2 -0
  32. package/dist/esm/dockview/dockviewComponent.js +94 -9
  33. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.4.1
3
+ * @version 4.5.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -6665,23 +6665,24 @@ class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
6665
6665
  : window;
6666
6666
  }
6667
6667
  moveTo(options) {
6668
- var _a, _b, _c;
6668
+ var _a, _b, _c, _d;
6669
6669
  if (!this._group) {
6670
6670
  throw new Error(NOT_INITIALIZED_MESSAGE);
6671
6671
  }
6672
6672
  const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
6673
6673
  direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
6674
- skipSetActive: true,
6674
+ skipSetActive: (_c = options.skipSetActive) !== null && _c !== void 0 ? _c : false,
6675
6675
  });
6676
6676
  this.accessor.moveGroupOrPanel({
6677
6677
  from: { groupId: this._group.id },
6678
6678
  to: {
6679
6679
  group,
6680
6680
  position: options.group
6681
- ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
6681
+ ? (_d = options.position) !== null && _d !== void 0 ? _d : 'center'
6682
6682
  : 'center',
6683
6683
  index: options.index,
6684
6684
  },
6685
+ skipSetActive: options.skipSetActive,
6685
6686
  });
6686
6687
  }
6687
6688
  maximize() {
@@ -6913,6 +6914,7 @@ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
6913
6914
  : 'center',
6914
6915
  index: options.index,
6915
6916
  },
6917
+ skipSetActive: options.skipSetActive,
6916
6918
  });
6917
6919
  }
6918
6920
  setTitle(title) {
@@ -9505,6 +9507,7 @@ class DockviewComponent extends BaseGrid {
9505
9507
  group: destinationGroup,
9506
9508
  position: destinationTarget,
9507
9509
  },
9510
+ skipSetActive: options.skipSetActive,
9508
9511
  });
9509
9512
  return;
9510
9513
  }
@@ -9523,11 +9526,17 @@ class DockviewComponent extends BaseGrid {
9523
9526
  // remove the group and do not set a new group as active
9524
9527
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9525
9528
  }
9526
- this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
9527
- index: destinationIndex,
9528
- skipSetGroupActive: true,
9529
- }));
9530
- this.doSetGroupAndPanelActive(destinationGroup);
9529
+ this.movingLock(() => {
9530
+ var _a;
9531
+ return destinationGroup.model.openPanel(removedPanel, {
9532
+ index: destinationIndex,
9533
+ skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
9534
+ skipSetGroupActive: true,
9535
+ });
9536
+ });
9537
+ if (!options.skipSetActive) {
9538
+ this.doSetGroupAndPanelActive(destinationGroup);
9539
+ }
9531
9540
  this._onDidMovePanel.fire({
9532
9541
  panel: removedPanel,
9533
9542
  from: sourceGroup,
@@ -9630,6 +9639,7 @@ class DockviewComponent extends BaseGrid {
9630
9639
  const target = options.to.position;
9631
9640
  if (target === 'center') {
9632
9641
  const activePanel = from.activePanel;
9642
+ const targetActivePanel = to.activePanel;
9633
9643
  const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
9634
9644
  skipSetActive: true,
9635
9645
  })));
@@ -9639,12 +9649,23 @@ class DockviewComponent extends BaseGrid {
9639
9649
  this.movingLock(() => {
9640
9650
  for (const panel of panels) {
9641
9651
  to.model.openPanel(panel, {
9642
- skipSetActive: panel !== activePanel,
9652
+ skipSetActive: true, // Always skip setting panels active during move
9643
9653
  skipSetGroupActive: true,
9644
9654
  });
9645
9655
  }
9646
9656
  });
9647
- this.doSetGroupAndPanelActive(to);
9657
+ if (!options.skipSetActive) {
9658
+ // Make the moved panel (from the source group) active
9659
+ if (activePanel) {
9660
+ this.doSetGroupAndPanelActive(to);
9661
+ }
9662
+ }
9663
+ else if (targetActivePanel) {
9664
+ // Ensure the target group's original active panel remains active
9665
+ to.model.openPanel(targetActivePanel, {
9666
+ skipSetGroupActive: true
9667
+ });
9668
+ }
9648
9669
  }
9649
9670
  else {
9650
9671
  switch (from.api.location.type) {
@@ -9664,12 +9685,39 @@ class DockviewComponent extends BaseGrid {
9664
9685
  if (!selectedPopoutGroup) {
9665
9686
  throw new Error('failed to find popout group');
9666
9687
  }
9667
- selectedPopoutGroup.disposable.dispose();
9688
+ // Remove from popout groups list to prevent automatic restoration
9689
+ const index = this._popoutGroups.indexOf(selectedPopoutGroup);
9690
+ if (index >= 0) {
9691
+ this._popoutGroups.splice(index, 1);
9692
+ }
9693
+ // Clean up the reference group (ghost) if it exists and is hidden
9694
+ if (selectedPopoutGroup.referenceGroup) {
9695
+ const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
9696
+ if (referenceGroup && !referenceGroup.api.isVisible) {
9697
+ this.doRemoveGroup(referenceGroup, { skipActive: true });
9698
+ }
9699
+ }
9700
+ // Manually dispose the window without triggering restoration
9701
+ selectedPopoutGroup.window.dispose();
9702
+ // Update group's location and containers for target
9703
+ if (to.api.location.type === 'grid') {
9704
+ from.model.renderContainer = this.overlayRenderContainer;
9705
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
9706
+ from.model.location = { type: 'grid' };
9707
+ }
9708
+ else if (to.api.location.type === 'floating') {
9709
+ from.model.renderContainer = this.overlayRenderContainer;
9710
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
9711
+ from.model.location = { type: 'floating' };
9712
+ }
9713
+ break;
9668
9714
  }
9669
9715
  }
9670
- if (from.api.location.type !== 'popout') {
9716
+ // For moves to grid locations
9717
+ if (to.api.location.type === 'grid') {
9671
9718
  const referenceLocation = getGridLocation(to.element);
9672
9719
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9720
+ // Add to grid for all moves targeting grid location
9673
9721
  let size;
9674
9722
  switch (this.gridview.orientation) {
9675
9723
  case exports.Orientation.VERTICAL:
@@ -9687,10 +9735,49 @@ class DockviewComponent extends BaseGrid {
9687
9735
  }
9688
9736
  this.gridview.addView(from, size, dropLocation);
9689
9737
  }
9738
+ else if (to.api.location.type === 'floating') {
9739
+ // For moves to floating locations, add as floating group
9740
+ // Get the position/size from the target floating group
9741
+ const targetFloatingGroup = this._floatingGroups.find((x) => x.group === to);
9742
+ if (targetFloatingGroup) {
9743
+ const box = targetFloatingGroup.overlay.toJSON();
9744
+ // Calculate position based on available properties
9745
+ let left, top;
9746
+ if ('left' in box) {
9747
+ left = box.left + 50;
9748
+ }
9749
+ else if ('right' in box) {
9750
+ left = Math.max(0, box.right - box.width - 50);
9751
+ }
9752
+ else {
9753
+ left = 50; // Default fallback
9754
+ }
9755
+ if ('top' in box) {
9756
+ top = box.top + 50;
9757
+ }
9758
+ else if ('bottom' in box) {
9759
+ top = Math.max(0, box.bottom - box.height - 50);
9760
+ }
9761
+ else {
9762
+ top = 50; // Default fallback
9763
+ }
9764
+ this.addFloatingGroup(from, {
9765
+ height: box.height,
9766
+ width: box.width,
9767
+ position: {
9768
+ left,
9769
+ top,
9770
+ },
9771
+ });
9772
+ }
9773
+ }
9690
9774
  }
9691
9775
  from.panels.forEach((panel) => {
9692
9776
  this._onDidMovePanel.fire({ panel, from });
9693
9777
  });
9778
+ if (!options.skipSetActive) {
9779
+ this.doSetGroupAndPanelActive(from);
9780
+ }
9694
9781
  }
9695
9782
  doSetGroupActive(group) {
9696
9783
  super.doSetGroupActive(group);