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