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
@@ -11,6 +11,10 @@ export interface DockviewGroupMoveParams {
11
11
  * The index to place the panel within a group, only applicable if the placement is within an existing group
12
12
  */
13
13
  index?: number;
14
+ /**
15
+ * Whether to skip setting the group as active after moving
16
+ */
17
+ skipSetActive?: boolean;
14
18
  }
15
19
  export interface DockviewGroupPanelApi extends GridviewPanelApi {
16
20
  readonly onDidLocationChange: Event<DockviewGroupPanelFloatingChangeEvent>;
@@ -30,23 +30,24 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
30
30
  : window;
31
31
  }
32
32
  moveTo(options) {
33
- var _a, _b, _c;
33
+ var _a, _b, _c, _d;
34
34
  if (!this._group) {
35
35
  throw new Error(NOT_INITIALIZED_MESSAGE);
36
36
  }
37
37
  const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({
38
38
  direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),
39
- skipSetActive: true,
39
+ skipSetActive: (_c = options.skipSetActive) !== null && _c !== void 0 ? _c : false,
40
40
  });
41
41
  this.accessor.moveGroupOrPanel({
42
42
  from: { groupId: this._group.id },
43
43
  to: {
44
44
  group,
45
45
  position: options.group
46
- ? (_c = options.position) !== null && _c !== void 0 ? _c : 'center'
46
+ ? (_d = options.position) !== null && _d !== void 0 ? _d : 'center'
47
47
  : 'center',
48
48
  index: options.index,
49
49
  },
50
+ skipSetActive: options.skipSetActive,
50
51
  });
51
52
  }
52
53
  maximize() {
@@ -66,6 +66,7 @@ export class DockviewPanelApiImpl extends GridviewPanelApiImpl {
66
66
  : 'center',
67
67
  index: options.index,
68
68
  },
69
+ skipSetActive: options.skipSetActive,
69
70
  });
70
71
  }
71
72
  setTitle(title) {
@@ -80,6 +80,7 @@ type MoveGroupOptions = {
80
80
  group: DockviewGroupPanel;
81
81
  position: Position;
82
82
  };
83
+ skipSetActive?: boolean;
83
84
  };
84
85
  type MoveGroupOrPanelOptions = {
85
86
  from: {
@@ -91,6 +92,7 @@ type MoveGroupOrPanelOptions = {
91
92
  position: Position;
92
93
  index?: number;
93
94
  };
95
+ skipSetActive?: boolean;
94
96
  };
95
97
  export interface FloatingGroupOptions {
96
98
  x?: number;
@@ -1341,6 +1341,7 @@ export class DockviewComponent extends BaseGrid {
1341
1341
  group: destinationGroup,
1342
1342
  position: destinationTarget,
1343
1343
  },
1344
+ skipSetActive: options.skipSetActive,
1344
1345
  });
1345
1346
  return;
1346
1347
  }
@@ -1359,11 +1360,17 @@ export class DockviewComponent extends BaseGrid {
1359
1360
  // remove the group and do not set a new group as active
1360
1361
  this.doRemoveGroup(sourceGroup, { skipActive: true });
1361
1362
  }
1362
- this.movingLock(() => destinationGroup.model.openPanel(removedPanel, {
1363
- index: destinationIndex,
1364
- skipSetGroupActive: true,
1365
- }));
1366
- this.doSetGroupAndPanelActive(destinationGroup);
1363
+ this.movingLock(() => {
1364
+ var _a;
1365
+ return destinationGroup.model.openPanel(removedPanel, {
1366
+ index: destinationIndex,
1367
+ skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
1368
+ skipSetGroupActive: true,
1369
+ });
1370
+ });
1371
+ if (!options.skipSetActive) {
1372
+ this.doSetGroupAndPanelActive(destinationGroup);
1373
+ }
1367
1374
  this._onDidMovePanel.fire({
1368
1375
  panel: removedPanel,
1369
1376
  from: sourceGroup,
@@ -1466,6 +1473,7 @@ export class DockviewComponent extends BaseGrid {
1466
1473
  const target = options.to.position;
1467
1474
  if (target === 'center') {
1468
1475
  const activePanel = from.activePanel;
1476
+ const targetActivePanel = to.activePanel;
1469
1477
  const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
1470
1478
  skipSetActive: true,
1471
1479
  })));
@@ -1475,12 +1483,23 @@ export class DockviewComponent extends BaseGrid {
1475
1483
  this.movingLock(() => {
1476
1484
  for (const panel of panels) {
1477
1485
  to.model.openPanel(panel, {
1478
- skipSetActive: panel !== activePanel,
1486
+ skipSetActive: true, // Always skip setting panels active during move
1479
1487
  skipSetGroupActive: true,
1480
1488
  });
1481
1489
  }
1482
1490
  });
1483
- this.doSetGroupAndPanelActive(to);
1491
+ if (!options.skipSetActive) {
1492
+ // Make the moved panel (from the source group) active
1493
+ if (activePanel) {
1494
+ this.doSetGroupAndPanelActive(to);
1495
+ }
1496
+ }
1497
+ else if (targetActivePanel) {
1498
+ // Ensure the target group's original active panel remains active
1499
+ to.model.openPanel(targetActivePanel, {
1500
+ skipSetGroupActive: true
1501
+ });
1502
+ }
1484
1503
  }
1485
1504
  else {
1486
1505
  switch (from.api.location.type) {
@@ -1500,12 +1519,39 @@ export class DockviewComponent extends BaseGrid {
1500
1519
  if (!selectedPopoutGroup) {
1501
1520
  throw new Error('failed to find popout group');
1502
1521
  }
1503
- selectedPopoutGroup.disposable.dispose();
1522
+ // Remove from popout groups list to prevent automatic restoration
1523
+ const index = this._popoutGroups.indexOf(selectedPopoutGroup);
1524
+ if (index >= 0) {
1525
+ this._popoutGroups.splice(index, 1);
1526
+ }
1527
+ // Clean up the reference group (ghost) if it exists and is hidden
1528
+ if (selectedPopoutGroup.referenceGroup) {
1529
+ const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
1530
+ if (referenceGroup && !referenceGroup.api.isVisible) {
1531
+ this.doRemoveGroup(referenceGroup, { skipActive: true });
1532
+ }
1533
+ }
1534
+ // Manually dispose the window without triggering restoration
1535
+ selectedPopoutGroup.window.dispose();
1536
+ // Update group's location and containers for target
1537
+ if (to.api.location.type === 'grid') {
1538
+ from.model.renderContainer = this.overlayRenderContainer;
1539
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
1540
+ from.model.location = { type: 'grid' };
1541
+ }
1542
+ else if (to.api.location.type === 'floating') {
1543
+ from.model.renderContainer = this.overlayRenderContainer;
1544
+ from.model.dropTargetContainer = this.rootDropTargetContainer;
1545
+ from.model.location = { type: 'floating' };
1546
+ }
1547
+ break;
1504
1548
  }
1505
1549
  }
1506
- if (from.api.location.type !== 'popout') {
1550
+ // For moves to grid locations
1551
+ if (to.api.location.type === 'grid') {
1507
1552
  const referenceLocation = getGridLocation(to.element);
1508
1553
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
1554
+ // Add to grid for all moves targeting grid location
1509
1555
  let size;
1510
1556
  switch (this.gridview.orientation) {
1511
1557
  case Orientation.VERTICAL:
@@ -1523,10 +1569,49 @@ export class DockviewComponent extends BaseGrid {
1523
1569
  }
1524
1570
  this.gridview.addView(from, size, dropLocation);
1525
1571
  }
1572
+ else if (to.api.location.type === 'floating') {
1573
+ // For moves to floating locations, add as floating group
1574
+ // Get the position/size from the target floating group
1575
+ const targetFloatingGroup = this._floatingGroups.find((x) => x.group === to);
1576
+ if (targetFloatingGroup) {
1577
+ const box = targetFloatingGroup.overlay.toJSON();
1578
+ // Calculate position based on available properties
1579
+ let left, top;
1580
+ if ('left' in box) {
1581
+ left = box.left + 50;
1582
+ }
1583
+ else if ('right' in box) {
1584
+ left = Math.max(0, box.right - box.width - 50);
1585
+ }
1586
+ else {
1587
+ left = 50; // Default fallback
1588
+ }
1589
+ if ('top' in box) {
1590
+ top = box.top + 50;
1591
+ }
1592
+ else if ('bottom' in box) {
1593
+ top = Math.max(0, box.bottom - box.height - 50);
1594
+ }
1595
+ else {
1596
+ top = 50; // Default fallback
1597
+ }
1598
+ this.addFloatingGroup(from, {
1599
+ height: box.height,
1600
+ width: box.width,
1601
+ position: {
1602
+ left,
1603
+ top,
1604
+ },
1605
+ });
1606
+ }
1607
+ }
1526
1608
  }
1527
1609
  from.panels.forEach((panel) => {
1528
1610
  this._onDidMovePanel.fire({ panel, from });
1529
1611
  });
1612
+ if (!options.skipSetActive) {
1613
+ this.doSetGroupAndPanelActive(from);
1614
+ }
1530
1615
  }
1531
1616
  doSetGroupActive(group) {
1532
1617
  super.doSetGroupActive(group);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dockview-core",
3
- "version": "4.4.1",
3
+ "version": "4.5.0",
4
4
  "description": "Zero dependency layout manager supporting tabs, grids and splitviews",
5
5
  "keywords": [
6
6
  "splitview",