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
  */
@@ -6669,23 +6669,24 @@
6669
6669
  : window;
6670
6670
  }
6671
6671
  moveTo(options) {
6672
- var _a, _b, _c;
6672
+ var _a, _b, _c, _d;
6673
6673
  if (!this._group) {
6674
6674
  throw new Error(NOT_INITIALIZED_MESSAGE);
6675
6675
  }
6676
6676
  const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
6677
6677
  direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
6678
- skipSetActive: true,
6678
+ skipSetActive: (_c = options.skipSetActive) !== null && _c !== void 0 ? _c : false,
6679
6679
  });
6680
6680
  this.accessor.moveGroupOrPanel({
6681
6681
  from: { groupId: this._group.id },
6682
6682
  to: {
6683
6683
  group,
6684
6684
  position: options.group
6685
- ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
6685
+ ? (_d = options.position) !== null && _d !== void 0 ? _d : 'center'
6686
6686
  : 'center',
6687
6687
  index: options.index,
6688
6688
  },
6689
+ skipSetActive: options.skipSetActive,
6689
6690
  });
6690
6691
  }
6691
6692
  maximize() {
@@ -6917,6 +6918,7 @@
6917
6918
  : 'center',
6918
6919
  index: options.index,
6919
6920
  },
6921
+ skipSetActive: options.skipSetActive,
6920
6922
  });
6921
6923
  }
6922
6924
  setTitle(title) {
@@ -9509,6 +9511,7 @@
9509
9511
  group: destinationGroup,
9510
9512
  position: destinationTarget,
9511
9513
  },
9514
+ skipSetActive: options.skipSetActive,
9512
9515
  });
9513
9516
  return;
9514
9517
  }
@@ -9527,11 +9530,17 @@
9527
9530
  // remove the group and do not set a new group as active
9528
9531
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9529
9532
  }
9530
- this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
9531
- index: destinationIndex,
9532
- skipSetGroupActive: true,
9533
- }));
9534
- this.doSetGroupAndPanelActive(destinationGroup);
9533
+ this.movingLock(() => {
9534
+ var _a;
9535
+ return destinationGroup.model.openPanel(removedPanel, {
9536
+ index: destinationIndex,
9537
+ skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
9538
+ skipSetGroupActive: true,
9539
+ });
9540
+ });
9541
+ if (!options.skipSetActive) {
9542
+ this.doSetGroupAndPanelActive(destinationGroup);
9543
+ }
9535
9544
  this._onDidMovePanel.fire({
9536
9545
  panel: removedPanel,
9537
9546
  from: sourceGroup,
@@ -9634,6 +9643,7 @@
9634
9643
  const target = options.to.position;
9635
9644
  if (target === 'center') {
9636
9645
  const activePanel = from.activePanel;
9646
+ const targetActivePanel = to.activePanel;
9637
9647
  const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
9638
9648
  skipSetActive: true,
9639
9649
  })));
@@ -9643,12 +9653,23 @@
9643
9653
  this.movingLock(() => {
9644
9654
  for (const panel of panels) {
9645
9655
  to.model.openPanel(panel, {
9646
- skipSetActive: panel !== activePanel,
9656
+ skipSetActive: true, // Always skip setting panels active during move
9647
9657
  skipSetGroupActive: true,
9648
9658
  });
9649
9659
  }
9650
9660
  });
9651
- this.doSetGroupAndPanelActive(to);
9661
+ if (!options.skipSetActive) {
9662
+ // Make the moved panel (from the source group) active
9663
+ if (activePanel) {
9664
+ this.doSetGroupAndPanelActive(to);
9665
+ }
9666
+ }
9667
+ else if (targetActivePanel) {
9668
+ // Ensure the target group's original active panel remains active
9669
+ to.model.openPanel(targetActivePanel, {
9670
+ skipSetGroupActive: true
9671
+ });
9672
+ }
9652
9673
  }
9653
9674
  else {
9654
9675
  switch (from.api.location.type) {
@@ -9668,12 +9689,39 @@
9668
9689
  if (!selectedPopoutGroup) {
9669
9690
  throw new Error('failed to find popout group');
9670
9691
  }
9671
- selectedPopoutGroup.disposable.dispose();
9692
+ // Remove from popout groups list to prevent automatic restoration
9693
+ const index = this._popoutGroups.indexOf(selectedPopoutGroup);
9694
+ if (index >= 0) {
9695
+ this._popoutGroups.splice(index, 1);
9696
+ }
9697
+ // Clean up the reference group (ghost) if it exists and is hidden
9698
+ if (selectedPopoutGroup.referenceGroup) {
9699
+ const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
9700
+ if (referenceGroup && !referenceGroup.api.isVisible) {
9701
+ this.doRemoveGroup(referenceGroup, { skipActive: true });
9702
+ }
9703
+ }
9704
+ // Manually dispose the window without triggering restoration
9705
+ selectedPopoutGroup.window.dispose();
9706
+ // Update group's location and containers for target
9707
+ if (to.api.location.type === 'grid') {
9708
+ from.model.renderContainer = this.overlayRenderContainer;
9709
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
9710
+ from.model.location = { type: 'grid' };
9711
+ }
9712
+ else if (to.api.location.type === 'floating') {
9713
+ from.model.renderContainer = this.overlayRenderContainer;
9714
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
9715
+ from.model.location = { type: 'floating' };
9716
+ }
9717
+ break;
9672
9718
  }
9673
9719
  }
9674
- if (from.api.location.type !== 'popout') {
9720
+ // For moves to grid locations
9721
+ if (to.api.location.type === 'grid') {
9675
9722
  const referenceLocation = getGridLocation(to.element);
9676
9723
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9724
+ // Add to grid for all moves targeting grid location
9677
9725
  let size;
9678
9726
  switch (this.gridview.orientation) {
9679
9727
  case exports.Orientation.VERTICAL:
@@ -9691,10 +9739,49 @@
9691
9739
  }
9692
9740
  this.gridview.addView(from, size, dropLocation);
9693
9741
  }
9742
+ else if (to.api.location.type === 'floating') {
9743
+ // For moves to floating locations, add as floating group
9744
+ // Get the position/size from the target floating group
9745
+ const targetFloatingGroup = this._floatingGroups.find((x) => x.group === to);
9746
+ if (targetFloatingGroup) {
9747
+ const box = targetFloatingGroup.overlay.toJSON();
9748
+ // Calculate position based on available properties
9749
+ let left, top;
9750
+ if ('left' in box) {
9751
+ left = box.left + 50;
9752
+ }
9753
+ else if ('right' in box) {
9754
+ left = Math.max(0, box.right - box.width - 50);
9755
+ }
9756
+ else {
9757
+ left = 50; // Default fallback
9758
+ }
9759
+ if ('top' in box) {
9760
+ top = box.top + 50;
9761
+ }
9762
+ else if ('bottom' in box) {
9763
+ top = Math.max(0, box.bottom - box.height - 50);
9764
+ }
9765
+ else {
9766
+ top = 50; // Default fallback
9767
+ }
9768
+ this.addFloatingGroup(from, {
9769
+ height: box.height,
9770
+ width: box.width,
9771
+ position: {
9772
+ left,
9773
+ top,
9774
+ },
9775
+ });
9776
+ }
9777
+ }
9694
9778
  }
9695
9779
  from.panels.forEach((panel) => {
9696
9780
  this._onDidMovePanel.fire({ panel, from });
9697
9781
  });
9782
+ if (!options.skipSetActive) {
9783
+ this.doSetGroupAndPanelActive(from);
9784
+ }
9698
9785
  }
9699
9786
  doSetGroupActive(group) {
9700
9787
  super.doSetGroupActive(group);