dockview-core 6.0.1 → 6.0.3
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.
- package/dist/cjs/dnd/groupDragHandler.js +3 -0
- package/dist/cjs/dockview/dockviewComponent.js +112 -54
- package/dist/cjs/dockview/dockviewShell.js +6 -1
- package/dist/cjs/overlay/overlayRenderContainer.js +10 -4
- package/dist/cjs/resizable.d.ts +2 -0
- package/dist/cjs/resizable.js +12 -1
- package/dist/dockview-core.js +127 -59
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +127 -59
- package/dist/esm/dnd/groupDragHandler.js +3 -0
- package/dist/esm/dockview/dockviewComponent.js +95 -52
- package/dist/esm/dockview/dockviewShell.js +6 -1
- package/dist/esm/overlay/overlayRenderContainer.js +10 -4
- package/dist/esm/resizable.d.ts +2 -0
- package/dist/esm/resizable.js +12 -1
- package/dist/package/main.cjs.js +127 -59
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +127 -59
- package/package.json +1 -1
|
@@ -44,6 +44,9 @@ var GroupDragHandler = /** @class */ (function (_super) {
|
|
|
44
44
|
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
45
45
|
return true;
|
|
46
46
|
}
|
|
47
|
+
if (this.group.api.location.type === 'edge' && this.group.size === 0) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
47
50
|
return false;
|
|
48
51
|
};
|
|
49
52
|
GroupDragHandler.prototype.getData = function (dragEvent) {
|
|
@@ -902,10 +902,20 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
902
902
|
if (event.isActive) {
|
|
903
903
|
overlay.bringToFront();
|
|
904
904
|
}
|
|
905
|
-
}), (
|
|
906
|
-
var
|
|
907
|
-
|
|
908
|
-
|
|
905
|
+
}), (function () {
|
|
906
|
+
var lastWidth = -1;
|
|
907
|
+
var lastHeight = -1;
|
|
908
|
+
return (0, dom_1.watchElementResize)(group.element, function (entry) {
|
|
909
|
+
var width = Math.round(entry.contentRect.width);
|
|
910
|
+
var height = Math.round(entry.contentRect.height);
|
|
911
|
+
if (width === lastWidth && height === lastHeight) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
lastWidth = width;
|
|
915
|
+
lastHeight = height;
|
|
916
|
+
group.layout(width, height); // let the group know it's size is changing so it can fire events to the panel
|
|
917
|
+
});
|
|
918
|
+
})());
|
|
909
919
|
floatingGroupPanel.addDisposables(overlay.onDidChange(function () {
|
|
910
920
|
// this is either a resize or a move
|
|
911
921
|
// to inform the panels .layout(...) the group with it's current size
|
|
@@ -2446,6 +2456,10 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2446
2456
|
var from = options.from.group;
|
|
2447
2457
|
var to = options.to.group;
|
|
2448
2458
|
var target = options.to.position;
|
|
2459
|
+
// The group whose panels end up at the target. For non-edge moves
|
|
2460
|
+
// we relocate `from` itself; for edge moves we move panels into a
|
|
2461
|
+
// freshly created group so the edge slot stays anchored.
|
|
2462
|
+
var source = from;
|
|
2449
2463
|
if (target === 'center') {
|
|
2450
2464
|
var activePanel_1 = from.activePanel;
|
|
2451
2465
|
var panels_3 = this.movingLock(function () {
|
|
@@ -2490,55 +2504,94 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2490
2504
|
}
|
|
2491
2505
|
}
|
|
2492
2506
|
else {
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
var referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
|
|
2518
|
-
if (referenceGroup && !referenceGroup.api.isVisible) {
|
|
2519
|
-
this.doRemoveGroup(referenceGroup, {
|
|
2520
|
-
skipActive: true,
|
|
2507
|
+
if (from.api.location.type === 'edge') {
|
|
2508
|
+
/**
|
|
2509
|
+
* Edge groups are permanent structural elements and must
|
|
2510
|
+
* stay anchored in their edge slot. Move the panels into a
|
|
2511
|
+
* new group; the auto-collapse listener registered in
|
|
2512
|
+
* addEdgeGroup will collapse the now-empty edge slot once
|
|
2513
|
+
* the last panel leaves. The placement code below then
|
|
2514
|
+
* positions `source` like any other moved group.
|
|
2515
|
+
*/
|
|
2516
|
+
var activePanel_2 = from.activePanel;
|
|
2517
|
+
var movedPanels_1 = this.movingLock(function () {
|
|
2518
|
+
return __spreadArray([], __read(from.panels), false).map(function (p) {
|
|
2519
|
+
return from.model.removePanel(p.id, { skipSetActive: true });
|
|
2520
|
+
});
|
|
2521
|
+
});
|
|
2522
|
+
source = this.createGroup();
|
|
2523
|
+
this.movingLock(function () {
|
|
2524
|
+
var e_32, _a;
|
|
2525
|
+
try {
|
|
2526
|
+
for (var movedPanels_2 = __values(movedPanels_1), movedPanels_2_1 = movedPanels_2.next(); !movedPanels_2_1.done; movedPanels_2_1 = movedPanels_2.next()) {
|
|
2527
|
+
var panel = movedPanels_2_1.value;
|
|
2528
|
+
source.model.openPanel(panel, {
|
|
2529
|
+
skipSetActive: panel !== activePanel_2,
|
|
2530
|
+
skipSetGroupActive: true,
|
|
2521
2531
|
});
|
|
2522
2532
|
}
|
|
2523
2533
|
}
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2534
|
+
catch (e_32_1) { e_32 = { error: e_32_1 }; }
|
|
2535
|
+
finally {
|
|
2536
|
+
try {
|
|
2537
|
+
if (movedPanels_2_1 && !movedPanels_2_1.done && (_a = movedPanels_2.return)) _a.call(movedPanels_2);
|
|
2538
|
+
}
|
|
2539
|
+
finally { if (e_32) throw e_32.error; }
|
|
2540
|
+
}
|
|
2541
|
+
});
|
|
2542
|
+
}
|
|
2543
|
+
else {
|
|
2544
|
+
switch (from.api.location.type) {
|
|
2545
|
+
case 'grid':
|
|
2546
|
+
this.gridview.removeView((0, gridview_1.getGridLocation)(from.element));
|
|
2547
|
+
break;
|
|
2548
|
+
case 'floating': {
|
|
2549
|
+
var selectedFloatingGroup = this._floatingGroups.find(function (x) { return x.group === from; });
|
|
2550
|
+
if (!selectedFloatingGroup) {
|
|
2551
|
+
throw new Error('dockview: failed to find floating group');
|
|
2552
|
+
}
|
|
2553
|
+
selectedFloatingGroup.dispose();
|
|
2554
|
+
break;
|
|
2533
2555
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
from
|
|
2556
|
+
case 'popout': {
|
|
2557
|
+
var selectedPopoutGroup = this._popoutGroups.find(function (x) { return x.popoutGroup === from; });
|
|
2558
|
+
if (!selectedPopoutGroup) {
|
|
2559
|
+
throw new Error('dockview: failed to find popout group');
|
|
2560
|
+
}
|
|
2561
|
+
// Remove from popout groups list to prevent automatic restoration
|
|
2562
|
+
var index = this._popoutGroups.indexOf(selectedPopoutGroup);
|
|
2563
|
+
if (index >= 0) {
|
|
2564
|
+
this._popoutGroups.splice(index, 1);
|
|
2565
|
+
}
|
|
2566
|
+
// Clean up the reference group (ghost) if it exists and is hidden
|
|
2567
|
+
if (selectedPopoutGroup.referenceGroup) {
|
|
2568
|
+
var referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
|
|
2569
|
+
if (referenceGroup &&
|
|
2570
|
+
!referenceGroup.api.isVisible) {
|
|
2571
|
+
this.doRemoveGroup(referenceGroup, {
|
|
2572
|
+
skipActive: true,
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
// Manually dispose the window without triggering restoration
|
|
2577
|
+
selectedPopoutGroup.window.dispose();
|
|
2578
|
+
// Update group's location and containers for target
|
|
2579
|
+
if (to.api.location.type === 'grid') {
|
|
2580
|
+
from.model.renderContainer =
|
|
2581
|
+
this.overlayRenderContainer;
|
|
2582
|
+
from.model.dropTargetContainer =
|
|
2583
|
+
this.rootDropTargetContainer;
|
|
2584
|
+
from.model.location = { type: 'grid' };
|
|
2585
|
+
}
|
|
2586
|
+
else if (to.api.location.type === 'floating') {
|
|
2587
|
+
from.model.renderContainer =
|
|
2588
|
+
this.overlayRenderContainer;
|
|
2589
|
+
from.model.dropTargetContainer =
|
|
2590
|
+
this.rootDropTargetContainer;
|
|
2591
|
+
from.model.location = { type: 'floating' };
|
|
2592
|
+
}
|
|
2593
|
+
break;
|
|
2540
2594
|
}
|
|
2541
|
-
break;
|
|
2542
2595
|
}
|
|
2543
2596
|
}
|
|
2544
2597
|
// For moves to grid locations
|
|
@@ -2561,7 +2614,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2561
2614
|
: from.api.width;
|
|
2562
2615
|
break;
|
|
2563
2616
|
}
|
|
2564
|
-
this.gridview.addView(
|
|
2617
|
+
this.gridview.addView(source, size, dropLocation);
|
|
2565
2618
|
}
|
|
2566
2619
|
else if (to.api.location.type === 'floating') {
|
|
2567
2620
|
// For moves to floating locations, add as floating group
|
|
@@ -2589,7 +2642,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2589
2642
|
else {
|
|
2590
2643
|
top_1 = 50; // Default fallback
|
|
2591
2644
|
}
|
|
2592
|
-
this.addFloatingGroup(
|
|
2645
|
+
this.addFloatingGroup(source, {
|
|
2593
2646
|
height: box.height,
|
|
2594
2647
|
width: box.width,
|
|
2595
2648
|
position: {
|
|
@@ -2600,7 +2653,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2600
2653
|
}
|
|
2601
2654
|
}
|
|
2602
2655
|
}
|
|
2603
|
-
|
|
2656
|
+
source.panels.forEach(function (panel) {
|
|
2604
2657
|
_this._onDidMovePanel.fire({ panel: panel, from: from });
|
|
2605
2658
|
});
|
|
2606
2659
|
this.debouncedUpdateAllPositions();
|
|
@@ -2611,6 +2664,11 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2611
2664
|
var targetGroup = to !== null && to !== void 0 ? to : from;
|
|
2612
2665
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
2613
2666
|
}
|
|
2667
|
+
else if (source !== from && options.skipSetActive !== true) {
|
|
2668
|
+
// Edge group moves create a fresh `source` group; activate it
|
|
2669
|
+
// by default so the moved panels receive focus.
|
|
2670
|
+
this.doSetGroupAndPanelActive(source);
|
|
2671
|
+
}
|
|
2614
2672
|
};
|
|
2615
2673
|
DockviewComponent.prototype.doSetGroupActive = function (group) {
|
|
2616
2674
|
_super.prototype.doSetGroupActive.call(this, group);
|
|
@@ -2783,7 +2841,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2783
2841
|
}
|
|
2784
2842
|
};
|
|
2785
2843
|
DockviewComponent.prototype.updateTheme = function () {
|
|
2786
|
-
var
|
|
2844
|
+
var e_33, _a;
|
|
2787
2845
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2788
2846
|
var theme = (_b = this._options.theme) !== null && _b !== void 0 ? _b : theme_1.themeAbyss;
|
|
2789
2847
|
// Apply the theme class only to the shell so edge groups and the
|
|
@@ -2824,12 +2882,12 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2824
2882
|
group.model.updateTabGroups();
|
|
2825
2883
|
}
|
|
2826
2884
|
}
|
|
2827
|
-
catch (
|
|
2885
|
+
catch (e_33_1) { e_33 = { error: e_33_1 }; }
|
|
2828
2886
|
finally {
|
|
2829
2887
|
try {
|
|
2830
2888
|
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
2831
2889
|
}
|
|
2832
|
-
finally { if (
|
|
2890
|
+
finally { if (e_33) throw e_33.error; }
|
|
2833
2891
|
}
|
|
2834
2892
|
};
|
|
2835
2893
|
return DockviewComponent;
|
|
@@ -316,7 +316,12 @@ var ShellManager = /** @class */ (function () {
|
|
|
316
316
|
this._middleIndex = 0;
|
|
317
317
|
this._outerSplitview.addView(this._middleColumn, { type: 'distribute' }, 0);
|
|
318
318
|
this._disposables.addDisposables((0, dom_1.watchElementResize)(this._shellElement, function (entry) {
|
|
319
|
-
var
|
|
319
|
+
var width = Math.round(entry.contentRect.width);
|
|
320
|
+
var height = Math.round(entry.contentRect.height);
|
|
321
|
+
if (width === _this._currentWidth &&
|
|
322
|
+
height === _this._currentHeight) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
320
325
|
_this._currentWidth = width;
|
|
321
326
|
_this._currentHeight = height;
|
|
322
327
|
_this.layout(width, height);
|
|
@@ -146,8 +146,14 @@ var OverlayRenderContainer = /** @class */ (function (_super) {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
var focusContainer = this.map[panel.api.id].element;
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
// Capture the content element now so the destroy disposable below
|
|
150
|
+
// does not re-query the renderer's `element` getter during teardown.
|
|
151
|
+
// Some framework adapters (e.g. dockview-angular) tear down their
|
|
152
|
+
// backing renderer before this disposable fires; reading through the
|
|
153
|
+
// getter at that point can throw.
|
|
154
|
+
var contentElement = panel.view.content.element;
|
|
155
|
+
if (contentElement.parentElement !== focusContainer) {
|
|
156
|
+
focusContainer.appendChild(contentElement);
|
|
151
157
|
}
|
|
152
158
|
if (focusContainer.parentElement !== this.element) {
|
|
153
159
|
this.element.appendChild(focusContainer);
|
|
@@ -260,8 +266,8 @@ var OverlayRenderContainer = /** @class */ (function (_super) {
|
|
|
260
266
|
}));
|
|
261
267
|
this.map[panel.api.id].destroy = lifecycle_1.Disposable.from(function () {
|
|
262
268
|
var _a;
|
|
263
|
-
if (
|
|
264
|
-
focusContainer.removeChild(
|
|
269
|
+
if (contentElement.parentElement === focusContainer) {
|
|
270
|
+
focusContainer.removeChild(contentElement);
|
|
265
271
|
}
|
|
266
272
|
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
267
273
|
});
|
package/dist/cjs/resizable.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { CompositeDisposable } from './lifecycle';
|
|
|
2
2
|
export declare abstract class Resizable extends CompositeDisposable {
|
|
3
3
|
private readonly _element;
|
|
4
4
|
private _disableResizing;
|
|
5
|
+
private _lastWidth;
|
|
6
|
+
private _lastHeight;
|
|
5
7
|
get element(): HTMLElement;
|
|
6
8
|
get disableResizing(): boolean;
|
|
7
9
|
set disableResizing(value: boolean);
|
package/dist/cjs/resizable.js
CHANGED
|
@@ -23,6 +23,8 @@ var Resizable = /** @class */ (function (_super) {
|
|
|
23
23
|
function Resizable(parentElement, disableResizing) {
|
|
24
24
|
if (disableResizing === void 0) { disableResizing = false; }
|
|
25
25
|
var _this = _super.call(this) || this;
|
|
26
|
+
_this._lastWidth = -1;
|
|
27
|
+
_this._lastHeight = -1;
|
|
26
28
|
_this._disableResizing = disableResizing;
|
|
27
29
|
_this._element = parentElement;
|
|
28
30
|
_this.addDisposables((0, dom_1.watchElementResize)(_this._element, function (entry) {
|
|
@@ -59,7 +61,16 @@ var Resizable = /** @class */ (function (_super) {
|
|
|
59
61
|
*/
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
62
|
-
|
|
64
|
+
// Round to integers to absorb sub-pixel jitter from
|
|
65
|
+
// fractional devicePixelRatio (e.g. multi-monitor setups),
|
|
66
|
+
// which would otherwise re-fire layout in a feedback loop.
|
|
67
|
+
var width = Math.round(entry.contentRect.width);
|
|
68
|
+
var height = Math.round(entry.contentRect.height);
|
|
69
|
+
if (width === _this._lastWidth && height === _this._lastHeight) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
_this._lastWidth = width;
|
|
73
|
+
_this._lastHeight = height;
|
|
63
74
|
_this.layout(width, height);
|
|
64
75
|
}));
|
|
65
76
|
return _this;
|
package/dist/dockview-core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 6.0.
|
|
3
|
+
* @version 6.0.3
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -2860,6 +2860,8 @@
|
|
|
2860
2860
|
}
|
|
2861
2861
|
constructor(parentElement, disableResizing = false) {
|
|
2862
2862
|
super();
|
|
2863
|
+
this._lastWidth = -1;
|
|
2864
|
+
this._lastHeight = -1;
|
|
2863
2865
|
this._disableResizing = disableResizing;
|
|
2864
2866
|
this._element = parentElement;
|
|
2865
2867
|
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
@@ -2896,7 +2898,16 @@
|
|
|
2896
2898
|
*/
|
|
2897
2899
|
return;
|
|
2898
2900
|
}
|
|
2899
|
-
|
|
2901
|
+
// Round to integers to absorb sub-pixel jitter from
|
|
2902
|
+
// fractional devicePixelRatio (e.g. multi-monitor setups),
|
|
2903
|
+
// which would otherwise re-fire layout in a feedback loop.
|
|
2904
|
+
const width = Math.round(entry.contentRect.width);
|
|
2905
|
+
const height = Math.round(entry.contentRect.height);
|
|
2906
|
+
if (width === this._lastWidth && height === this._lastHeight) {
|
|
2907
|
+
return;
|
|
2908
|
+
}
|
|
2909
|
+
this._lastWidth = width;
|
|
2910
|
+
this._lastHeight = height;
|
|
2900
2911
|
this.layout(width, height);
|
|
2901
2912
|
}));
|
|
2902
2913
|
}
|
|
@@ -5478,6 +5489,9 @@
|
|
|
5478
5489
|
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
5479
5490
|
return true;
|
|
5480
5491
|
}
|
|
5492
|
+
if (this.group.api.location.type === 'edge' && this.group.size === 0) {
|
|
5493
|
+
return true;
|
|
5494
|
+
}
|
|
5481
5495
|
return false;
|
|
5482
5496
|
}
|
|
5483
5497
|
getData(dragEvent) {
|
|
@@ -11325,8 +11339,14 @@
|
|
|
11325
11339
|
};
|
|
11326
11340
|
}
|
|
11327
11341
|
const focusContainer = this.map[panel.api.id].element;
|
|
11328
|
-
|
|
11329
|
-
|
|
11342
|
+
// Capture the content element now so the destroy disposable below
|
|
11343
|
+
// does not re-query the renderer's `element` getter during teardown.
|
|
11344
|
+
// Some framework adapters (e.g. dockview-angular) tear down their
|
|
11345
|
+
// backing renderer before this disposable fires; reading through the
|
|
11346
|
+
// getter at that point can throw.
|
|
11347
|
+
const contentElement = panel.view.content.element;
|
|
11348
|
+
if (contentElement.parentElement !== focusContainer) {
|
|
11349
|
+
focusContainer.appendChild(contentElement);
|
|
11330
11350
|
}
|
|
11331
11351
|
if (focusContainer.parentElement !== this.element) {
|
|
11332
11352
|
this.element.appendChild(focusContainer);
|
|
@@ -11437,8 +11457,8 @@
|
|
|
11437
11457
|
}));
|
|
11438
11458
|
this.map[panel.api.id].destroy = exports.DockviewDisposable.from(() => {
|
|
11439
11459
|
var _a;
|
|
11440
|
-
if (
|
|
11441
|
-
focusContainer.removeChild(
|
|
11460
|
+
if (contentElement.parentElement === focusContainer) {
|
|
11461
|
+
focusContainer.removeChild(contentElement);
|
|
11442
11462
|
}
|
|
11443
11463
|
(_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);
|
|
11444
11464
|
});
|
|
@@ -12293,7 +12313,12 @@
|
|
|
12293
12313
|
this._middleIndex = 0;
|
|
12294
12314
|
this._outerSplitview.addView(this._middleColumn, { type: 'distribute' }, 0);
|
|
12295
12315
|
this._disposables.addDisposables(watchElementResize(this._shellElement, (entry) => {
|
|
12296
|
-
const
|
|
12316
|
+
const width = Math.round(entry.contentRect.width);
|
|
12317
|
+
const height = Math.round(entry.contentRect.height);
|
|
12318
|
+
if (width === this._currentWidth &&
|
|
12319
|
+
height === this._currentHeight) {
|
|
12320
|
+
return;
|
|
12321
|
+
}
|
|
12297
12322
|
this._currentWidth = width;
|
|
12298
12323
|
this._currentHeight = height;
|
|
12299
12324
|
this.layout(width, height);
|
|
@@ -13363,10 +13388,20 @@
|
|
|
13363
13388
|
if (event.isActive) {
|
|
13364
13389
|
overlay.bringToFront();
|
|
13365
13390
|
}
|
|
13366
|
-
}),
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13391
|
+
}), (() => {
|
|
13392
|
+
let lastWidth = -1;
|
|
13393
|
+
let lastHeight = -1;
|
|
13394
|
+
return watchElementResize(group.element, (entry) => {
|
|
13395
|
+
const width = Math.round(entry.contentRect.width);
|
|
13396
|
+
const height = Math.round(entry.contentRect.height);
|
|
13397
|
+
if (width === lastWidth && height === lastHeight) {
|
|
13398
|
+
return;
|
|
13399
|
+
}
|
|
13400
|
+
lastWidth = width;
|
|
13401
|
+
lastHeight = height;
|
|
13402
|
+
group.layout(width, height); // let the group know it's size is changing so it can fire events to the panel
|
|
13403
|
+
});
|
|
13404
|
+
})());
|
|
13370
13405
|
floatingGroupPanel.addDisposables(overlay.onDidChange(() => {
|
|
13371
13406
|
// this is either a resize or a move
|
|
13372
13407
|
// to inform the panels .layout(...) the group with it's current size
|
|
@@ -14586,6 +14621,10 @@
|
|
|
14586
14621
|
const from = options.from.group;
|
|
14587
14622
|
const to = options.to.group;
|
|
14588
14623
|
const target = options.to.position;
|
|
14624
|
+
// The group whose panels end up at the target. For non-edge moves
|
|
14625
|
+
// we relocate `from` itself; for edge moves we move panels into a
|
|
14626
|
+
// freshly created group so the edge slot stays anchored.
|
|
14627
|
+
let source = from;
|
|
14589
14628
|
if (target === 'center') {
|
|
14590
14629
|
const activePanel = from.activePanel;
|
|
14591
14630
|
const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {
|
|
@@ -14615,55 +14654,79 @@
|
|
|
14615
14654
|
}
|
|
14616
14655
|
}
|
|
14617
14656
|
else {
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
const
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
const index = this._popoutGroups.indexOf(selectedPopoutGroup);
|
|
14637
|
-
if (index >= 0) {
|
|
14638
|
-
this._popoutGroups.splice(index, 1);
|
|
14657
|
+
if (from.api.location.type === 'edge') {
|
|
14658
|
+
/**
|
|
14659
|
+
* Edge groups are permanent structural elements and must
|
|
14660
|
+
* stay anchored in their edge slot. Move the panels into a
|
|
14661
|
+
* new group; the auto-collapse listener registered in
|
|
14662
|
+
* addEdgeGroup will collapse the now-empty edge slot once
|
|
14663
|
+
* the last panel leaves. The placement code below then
|
|
14664
|
+
* positions `source` like any other moved group.
|
|
14665
|
+
*/
|
|
14666
|
+
const activePanel = from.activePanel;
|
|
14667
|
+
const movedPanels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, { skipSetActive: true })));
|
|
14668
|
+
source = this.createGroup();
|
|
14669
|
+
this.movingLock(() => {
|
|
14670
|
+
for (const panel of movedPanels) {
|
|
14671
|
+
source.model.openPanel(panel, {
|
|
14672
|
+
skipSetActive: panel !== activePanel,
|
|
14673
|
+
skipSetGroupActive: true,
|
|
14674
|
+
});
|
|
14639
14675
|
}
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14676
|
+
});
|
|
14677
|
+
}
|
|
14678
|
+
else {
|
|
14679
|
+
switch (from.api.location.type) {
|
|
14680
|
+
case 'grid':
|
|
14681
|
+
this.gridview.removeView(getGridLocation(from.element));
|
|
14682
|
+
break;
|
|
14683
|
+
case 'floating': {
|
|
14684
|
+
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
14685
|
+
if (!selectedFloatingGroup) {
|
|
14686
|
+
throw new Error('dockview: failed to find floating group');
|
|
14647
14687
|
}
|
|
14688
|
+
selectedFloatingGroup.dispose();
|
|
14689
|
+
break;
|
|
14648
14690
|
}
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
this.
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14691
|
+
case 'popout': {
|
|
14692
|
+
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
14693
|
+
if (!selectedPopoutGroup) {
|
|
14694
|
+
throw new Error('dockview: failed to find popout group');
|
|
14695
|
+
}
|
|
14696
|
+
// Remove from popout groups list to prevent automatic restoration
|
|
14697
|
+
const index = this._popoutGroups.indexOf(selectedPopoutGroup);
|
|
14698
|
+
if (index >= 0) {
|
|
14699
|
+
this._popoutGroups.splice(index, 1);
|
|
14700
|
+
}
|
|
14701
|
+
// Clean up the reference group (ghost) if it exists and is hidden
|
|
14702
|
+
if (selectedPopoutGroup.referenceGroup) {
|
|
14703
|
+
const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);
|
|
14704
|
+
if (referenceGroup &&
|
|
14705
|
+
!referenceGroup.api.isVisible) {
|
|
14706
|
+
this.doRemoveGroup(referenceGroup, {
|
|
14707
|
+
skipActive: true,
|
|
14708
|
+
});
|
|
14709
|
+
}
|
|
14710
|
+
}
|
|
14711
|
+
// Manually dispose the window without triggering restoration
|
|
14712
|
+
selectedPopoutGroup.window.dispose();
|
|
14713
|
+
// Update group's location and containers for target
|
|
14714
|
+
if (to.api.location.type === 'grid') {
|
|
14715
|
+
from.model.renderContainer =
|
|
14716
|
+
this.overlayRenderContainer;
|
|
14717
|
+
from.model.dropTargetContainer =
|
|
14718
|
+
this.rootDropTargetContainer;
|
|
14719
|
+
from.model.location = { type: 'grid' };
|
|
14720
|
+
}
|
|
14721
|
+
else if (to.api.location.type === 'floating') {
|
|
14722
|
+
from.model.renderContainer =
|
|
14723
|
+
this.overlayRenderContainer;
|
|
14724
|
+
from.model.dropTargetContainer =
|
|
14725
|
+
this.rootDropTargetContainer;
|
|
14726
|
+
from.model.location = { type: 'floating' };
|
|
14727
|
+
}
|
|
14728
|
+
break;
|
|
14665
14729
|
}
|
|
14666
|
-
break;
|
|
14667
14730
|
}
|
|
14668
14731
|
}
|
|
14669
14732
|
// For moves to grid locations
|
|
@@ -14686,7 +14749,7 @@
|
|
|
14686
14749
|
: from.api.width;
|
|
14687
14750
|
break;
|
|
14688
14751
|
}
|
|
14689
|
-
this.gridview.addView(
|
|
14752
|
+
this.gridview.addView(source, size, dropLocation);
|
|
14690
14753
|
}
|
|
14691
14754
|
else if (to.api.location.type === 'floating') {
|
|
14692
14755
|
// For moves to floating locations, add as floating group
|
|
@@ -14714,7 +14777,7 @@
|
|
|
14714
14777
|
else {
|
|
14715
14778
|
top = 50; // Default fallback
|
|
14716
14779
|
}
|
|
14717
|
-
this.addFloatingGroup(
|
|
14780
|
+
this.addFloatingGroup(source, {
|
|
14718
14781
|
height: box.height,
|
|
14719
14782
|
width: box.width,
|
|
14720
14783
|
position: {
|
|
@@ -14725,7 +14788,7 @@
|
|
|
14725
14788
|
}
|
|
14726
14789
|
}
|
|
14727
14790
|
}
|
|
14728
|
-
|
|
14791
|
+
source.panels.forEach((panel) => {
|
|
14729
14792
|
this._onDidMovePanel.fire({ panel, from });
|
|
14730
14793
|
});
|
|
14731
14794
|
this.debouncedUpdateAllPositions();
|
|
@@ -14736,6 +14799,11 @@
|
|
|
14736
14799
|
const targetGroup = to !== null && to !== void 0 ? to : from;
|
|
14737
14800
|
this.doSetGroupAndPanelActive(targetGroup);
|
|
14738
14801
|
}
|
|
14802
|
+
else if (source !== from && options.skipSetActive !== true) {
|
|
14803
|
+
// Edge group moves create a fresh `source` group; activate it
|
|
14804
|
+
// by default so the moved panels receive focus.
|
|
14805
|
+
this.doSetGroupAndPanelActive(source);
|
|
14806
|
+
}
|
|
14739
14807
|
}
|
|
14740
14808
|
doSetGroupActive(group) {
|
|
14741
14809
|
super.doSetGroupActive(group);
|