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