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
  */
@@ -6639,23 +6639,24 @@
6639
6639
  : window;
6640
6640
  }
6641
6641
  moveTo(options) {
6642
- var _a, _b, _c;
6642
+ var _a, _b, _c, _d;
6643
6643
  if (!this._group) {
6644
6644
  throw new Error(NOT_INITIALIZED_MESSAGE);
6645
6645
  }
6646
6646
  const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
6647
6647
  direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
6648
- skipSetActive: true,
6648
+ skipSetActive: (_c = options.skipSetActive) !== null && _c !== void 0 ? _c : false,
6649
6649
  });
6650
6650
  this.accessor.moveGroupOrPanel({
6651
6651
  from: { groupId: this._group.id },
6652
6652
  to: {
6653
6653
  group,
6654
6654
  position: options.group
6655
- ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
6655
+ ? (_d = options.position) !== null && _d !== void 0 ? _d : 'center'
6656
6656
  : 'center',
6657
6657
  index: options.index,
6658
6658
  },
6659
+ skipSetActive: options.skipSetActive,
6659
6660
  });
6660
6661
  }
6661
6662
  maximize() {
@@ -6887,6 +6888,7 @@
6887
6888
  : 'center',
6888
6889
  index: options.index,
6889
6890
  },
6891
+ skipSetActive: options.skipSetActive,
6890
6892
  });
6891
6893
  }
6892
6894
  setTitle(title) {
@@ -9479,6 +9481,7 @@
9479
9481
  group: destinationGroup,
9480
9482
  position: destinationTarget,
9481
9483
  },
9484
+ skipSetActive: options.skipSetActive,
9482
9485
  });
9483
9486
  return;
9484
9487
  }
@@ -9497,11 +9500,17 @@
9497
9500
  // remove the group and do not set a new group as active
9498
9501
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9499
9502
  }
9500
- this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
9501
- index: destinationIndex,
9502
- skipSetGroupActive: true,
9503
- }));
9504
- this.doSetGroupAndPanelActive(destinationGroup);
9503
+ this.movingLock(() => {
9504
+ var _a;
9505
+ return destinationGroup.model.openPanel(removedPanel, {
9506
+ index: destinationIndex,
9507
+ skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
9508
+ skipSetGroupActive: true,
9509
+ });
9510
+ });
9511
+ if (!options.skipSetActive) {
9512
+ this.doSetGroupAndPanelActive(destinationGroup);
9513
+ }
9505
9514
  this._onDidMovePanel.fire({
9506
9515
  panel: removedPanel,
9507
9516
  from: sourceGroup,
@@ -9604,6 +9613,7 @@
9604
9613
  const target = options.to.position;
9605
9614
  if (target === 'center') {
9606
9615
  const activePanel = from.activePanel;
9616
+ const targetActivePanel = to.activePanel;
9607
9617
  const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
9608
9618
  skipSetActive: true,
9609
9619
  })));
@@ -9613,12 +9623,23 @@
9613
9623
  this.movingLock(() => {
9614
9624
  for (const panel of panels) {
9615
9625
  to.model.openPanel(panel, {
9616
- skipSetActive: panel !== activePanel,
9626
+ skipSetActive: true, // Always skip setting panels active during move
9617
9627
  skipSetGroupActive: true,
9618
9628
  });
9619
9629
  }
9620
9630
  });
9621
- this.doSetGroupAndPanelActive(to);
9631
+ if (!options.skipSetActive) {
9632
+ // Make the moved panel (from the source group) active
9633
+ if (activePanel) {
9634
+ this.doSetGroupAndPanelActive(to);
9635
+ }
9636
+ }
9637
+ else if (targetActivePanel) {
9638
+ // Ensure the target group's original active panel remains active
9639
+ to.model.openPanel(targetActivePanel, {
9640
+ skipSetGroupActive: true
9641
+ });
9642
+ }
9622
9643
  }
9623
9644
  else {
9624
9645
  switch (from.api.location.type) {
@@ -9638,12 +9659,39 @@
9638
9659
  if (!selectedPopoutGroup) {
9639
9660
  throw new Error('failed to find popout group');
9640
9661
  }
9641
- selectedPopoutGroup.disposable.dispose();
9662
+ // Remove from popout groups list to prevent automatic restoration
9663
+ const index = this._popoutGroups.indexOf(selectedPopoutGroup);
9664
+ if (index >= 0) {
9665
+ this._popoutGroups.splice(index, 1);
9666
+ }
9667
+ // Clean up the reference group (ghost) if it exists and is hidden
9668
+ if (selectedPopoutGroup.referenceGroup) {
9669
+ const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
9670
+ if (referenceGroup && !referenceGroup.api.isVisible) {
9671
+ this.doRemoveGroup(referenceGroup, { skipActive: true });
9672
+ }
9673
+ }
9674
+ // Manually dispose the window without triggering restoration
9675
+ selectedPopoutGroup.window.dispose();
9676
+ // Update group's location and containers for target
9677
+ if (to.api.location.type === 'grid') {
9678
+ from.model.renderContainer = this.overlayRenderContainer;
9679
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
9680
+ from.model.location = { type: 'grid' };
9681
+ }
9682
+ else if (to.api.location.type === 'floating') {
9683
+ from.model.renderContainer = this.overlayRenderContainer;
9684
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
9685
+ from.model.location = { type: 'floating' };
9686
+ }
9687
+ break;
9642
9688
  }
9643
9689
  }
9644
- if (from.api.location.type !== 'popout') {
9690
+ // For moves to grid locations
9691
+ if (to.api.location.type === 'grid') {
9645
9692
  const referenceLocation = getGridLocation(to.element);
9646
9693
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9694
+ // Add to grid for all moves targeting grid location
9647
9695
  let size;
9648
9696
  switch (this.gridview.orientation) {
9649
9697
  case exports.Orientation.VERTICAL:
@@ -9661,10 +9709,49 @@
9661
9709
  }
9662
9710
  this.gridview.addView(from, size, dropLocation);
9663
9711
  }
9712
+ else if (to.api.location.type === 'floating') {
9713
+ // For moves to floating locations, add as floating group
9714
+ // Get the position/size from the target floating group
9715
+ const targetFloatingGroup = this._floatingGroups.find((x) => x.group === to);
9716
+ if (targetFloatingGroup) {
9717
+ const box = targetFloatingGroup.overlay.toJSON();
9718
+ // Calculate position based on available properties
9719
+ let left, top;
9720
+ if ('left' in box) {
9721
+ left = box.left + 50;
9722
+ }
9723
+ else if ('right' in box) {
9724
+ left = Math.max(0, box.right - box.width - 50);
9725
+ }
9726
+ else {
9727
+ left = 50; // Default fallback
9728
+ }
9729
+ if ('top' in box) {
9730
+ top = box.top + 50;
9731
+ }
9732
+ else if ('bottom' in box) {
9733
+ top = Math.max(0, box.bottom - box.height - 50);
9734
+ }
9735
+ else {
9736
+ top = 50; // Default fallback
9737
+ }
9738
+ this.addFloatingGroup(from, {
9739
+ height: box.height,
9740
+ width: box.width,
9741
+ position: {
9742
+ left,
9743
+ top,
9744
+ },
9745
+ });
9746
+ }
9747
+ }
9664
9748
  }
9665
9749
  from.panels.forEach((panel) => {
9666
9750
  this._onDidMovePanel.fire({ panel, from });
9667
9751
  });
9752
+ if (!options.skipSetActive) {
9753
+ this.doSetGroupAndPanelActive(from);
9754
+ }
9668
9755
  }
9669
9756
  doSetGroupActive(group) {
9670
9757
  super.doSetGroupActive(group);