dockview-core 5.1.0 → 6.0.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.
- package/README.md +3 -1
- package/dist/cjs/api/component.api.d.ts +93 -1
- package/dist/cjs/api/component.api.js +146 -0
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +26 -0
- package/dist/cjs/api/dockviewGroupPanelApi.js +21 -1
- package/dist/cjs/api/entryPoints.js +4 -5
- package/dist/cjs/array.js +7 -8
- package/dist/cjs/dnd/dataTransfer.d.ts +2 -1
- package/dist/cjs/dnd/dataTransfer.js +5 -4
- package/dist/cjs/dnd/droptarget.d.ts +12 -0
- package/dist/cjs/dnd/droptarget.js +38 -10
- package/dist/cjs/dnd/ghost.js +1 -2
- package/dist/cjs/dockview/components/panel/content.js +5 -1
- package/dist/cjs/dockview/components/popupService.d.ts +9 -2
- package/dist/cjs/dockview/components/popupService.js +24 -9
- package/dist/cjs/dockview/components/tab/tab.d.ts +8 -1
- package/dist/cjs/dockview/components/tab/tab.js +94 -6
- package/dist/cjs/dockview/components/titlebar/tabGroupChip.d.ts +30 -0
- package/dist/cjs/dockview/components/titlebar/tabGroupChip.js +95 -0
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +71 -0
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +471 -0
- package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +57 -0
- package/dist/cjs/dockview/components/titlebar/tabGroups.js +612 -0
- package/dist/cjs/dockview/components/titlebar/tabOverflowControl.js +1 -2
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +67 -0
- package/dist/cjs/dockview/components/titlebar/tabs.js +1464 -34
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +6 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +132 -14
- package/dist/cjs/dockview/contextMenu.d.ts +10 -0
- package/dist/cjs/dockview/contextMenu.js +298 -0
- package/dist/cjs/dockview/dockviewComponent.d.ts +60 -3
- package/dist/cjs/dockview/dockviewComponent.js +712 -126
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +83 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +619 -27
- package/dist/cjs/dockview/dockviewShell.d.ts +128 -0
- package/dist/cjs/dockview/dockviewShell.js +681 -0
- package/dist/cjs/dockview/events.d.ts +9 -0
- package/dist/cjs/dockview/framework.d.ts +14 -0
- package/dist/cjs/dockview/options.d.ts +97 -2
- package/dist/cjs/dockview/options.js +10 -5
- package/dist/cjs/dockview/tabGroup.d.ts +99 -0
- package/dist/cjs/dockview/tabGroup.js +219 -0
- package/dist/cjs/dockview/tabGroupAccent.d.ts +65 -0
- package/dist/cjs/dockview/tabGroupAccent.js +128 -0
- package/dist/cjs/dockview/theme.d.ts +56 -1
- package/dist/cjs/dockview/theme.js +103 -6
- package/dist/cjs/dockview/types.d.ts +2 -0
- package/dist/cjs/dom.js +19 -19
- package/dist/cjs/events.js +2 -2
- package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -0
- package/dist/cjs/gridview/baseComponentGridview.js +6 -3
- package/dist/cjs/gridview/gridview.js +7 -7
- package/dist/cjs/index.d.ts +8 -5
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/popoutWindow.js +3 -3
- package/dist/cjs/splitview/splitviewPanel.d.ts +1 -1
- package/dist/dockview-core.js +5188 -729
- 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 +5186 -727
- package/dist/esm/api/component.api.d.ts +93 -1
- package/dist/esm/api/component.api.js +118 -0
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +26 -0
- package/dist/esm/api/dockviewGroupPanelApi.js +21 -1
- package/dist/esm/dnd/dataTransfer.d.ts +2 -1
- package/dist/esm/dnd/dataTransfer.js +2 -1
- package/dist/esm/dnd/droptarget.d.ts +12 -0
- package/dist/esm/dnd/droptarget.js +33 -5
- package/dist/esm/dockview/components/panel/content.js +5 -1
- package/dist/esm/dockview/components/popupService.d.ts +9 -2
- package/dist/esm/dockview/components/popupService.js +23 -9
- package/dist/esm/dockview/components/tab/tab.d.ts +8 -1
- package/dist/esm/dockview/components/tab/tab.js +96 -6
- package/dist/esm/dockview/components/titlebar/tabGroupChip.d.ts +30 -0
- package/dist/esm/dockview/components/titlebar/tabGroupChip.js +68 -0
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +71 -0
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +354 -0
- package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +57 -0
- package/dist/esm/dockview/components/titlebar/tabGroups.js +406 -0
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +67 -0
- package/dist/esm/dockview/components/titlebar/tabs.js +1212 -25
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +6 -0
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +105 -7
- package/dist/esm/dockview/contextMenu.d.ts +10 -0
- package/dist/esm/dockview/contextMenu.js +213 -0
- package/dist/esm/dockview/dockviewComponent.d.ts +60 -3
- package/dist/esm/dockview/dockviewComponent.js +460 -35
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +83 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +460 -4
- package/dist/esm/dockview/dockviewShell.d.ts +128 -0
- package/dist/esm/dockview/dockviewShell.js +621 -0
- package/dist/esm/dockview/events.d.ts +9 -0
- package/dist/esm/dockview/framework.d.ts +14 -0
- package/dist/esm/dockview/options.d.ts +97 -2
- package/dist/esm/dockview/options.js +5 -0
- package/dist/esm/dockview/tabGroup.d.ts +99 -0
- package/dist/esm/dockview/tabGroup.js +144 -0
- package/dist/esm/dockview/tabGroupAccent.d.ts +65 -0
- package/dist/esm/dockview/tabGroupAccent.js +116 -0
- package/dist/esm/dockview/theme.d.ts +56 -1
- package/dist/esm/dockview/theme.js +102 -5
- package/dist/esm/dockview/types.d.ts +2 -0
- package/dist/esm/dom.js +1 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts +1 -0
- package/dist/esm/gridview/baseComponentGridview.js +4 -1
- package/dist/esm/index.d.ts +8 -5
- package/dist/esm/index.js +2 -1
- package/dist/esm/popoutWindow.js +1 -1
- package/dist/esm/splitview/splitviewPanel.d.ts +1 -1
- package/dist/package/main.cjs.js +5182 -753
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +5168 -753
- package/dist/styles/dockview.css +1968 -195
- package/package.json +5 -1
|
@@ -12,7 +12,7 @@ import { BaseGrid, toTarget, } from '../gridview/baseComponentGridview';
|
|
|
12
12
|
import { DockviewApi } from '../api/component.api';
|
|
13
13
|
import { Orientation } from '../splitview/splitview';
|
|
14
14
|
import { DockviewDidDropEvent, DockviewWillDropEvent, } from './dockviewGroupPanelModel';
|
|
15
|
-
import { DockviewWillShowOverlayLocationEvent } from './events';
|
|
15
|
+
import { DockviewWillShowOverlayLocationEvent, } from './events';
|
|
16
16
|
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
17
17
|
import { DockviewPanelModel } from './dockviewPanelModel';
|
|
18
18
|
import { getPanelData } from '../dnd/dataTransfer';
|
|
@@ -24,12 +24,21 @@ import { OverlayRenderContainer, } from '../overlay/overlayRenderContainer';
|
|
|
24
24
|
import { PopoutWindow } from '../popoutWindow';
|
|
25
25
|
import { StrictEventsSequencing } from './strictEventsSequencing';
|
|
26
26
|
import { PopupService } from './components/popupService';
|
|
27
|
+
import { ContextMenuController } from './contextMenu';
|
|
27
28
|
import { DropTargetAnchorContainer } from '../dnd/dropTargetAnchorContainer';
|
|
28
29
|
import { themeAbyss } from './theme';
|
|
30
|
+
import { ShellManager, } from './dockviewShell';
|
|
31
|
+
import { DEFAULT_TAB_GROUP_COLORS, TabGroupColorPalette, } from './tabGroupAccent';
|
|
29
32
|
const DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
30
33
|
activationSize: { type: 'pixels', value: 10 },
|
|
31
34
|
size: { type: 'pixels', value: 20 },
|
|
32
35
|
};
|
|
36
|
+
function buildTabGroupColorPalette(options) {
|
|
37
|
+
var _a;
|
|
38
|
+
const entries = (_a = options.tabGroupColors) !== null && _a !== void 0 ? _a : DEFAULT_TAB_GROUP_COLORS;
|
|
39
|
+
const enabled = options.tabGroupAccent !== 'off';
|
|
40
|
+
return new TabGroupColorPalette(entries, enabled);
|
|
41
|
+
}
|
|
33
42
|
function moveGroupWithoutDestroying(options) {
|
|
34
43
|
const activePanel = options.from.activePanel;
|
|
35
44
|
const panels = [...options.from.panels].map((panel) => {
|
|
@@ -57,6 +66,9 @@ export class DockviewComponent extends BaseGrid {
|
|
|
57
66
|
get options() {
|
|
58
67
|
return this._options;
|
|
59
68
|
}
|
|
69
|
+
get tabGroupColorPalette() {
|
|
70
|
+
return this._tabGroupColorPalette;
|
|
71
|
+
}
|
|
60
72
|
get activePanel() {
|
|
61
73
|
const activeGroup = this.activeGroup;
|
|
62
74
|
if (!activeGroup) {
|
|
@@ -86,7 +98,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
86
98
|
return this._popoutRestorationPromise;
|
|
87
99
|
}
|
|
88
100
|
constructor(container, options) {
|
|
89
|
-
var _a, _b, _c;
|
|
101
|
+
var _a, _b, _c, _d, _e, _f;
|
|
90
102
|
super(container, {
|
|
91
103
|
proportionalLayout: true,
|
|
92
104
|
orientation: Orientation.HORIZONTAL,
|
|
@@ -101,6 +113,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
101
113
|
this.nextGroupId = sequentialNumberGenerator();
|
|
102
114
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
103
115
|
this._watermark = null;
|
|
116
|
+
this._popoutPopupServices = new Map();
|
|
104
117
|
this._onWillDragPanel = new Emitter();
|
|
105
118
|
this.onWillDragPanel = this._onWillDragPanel.event;
|
|
106
119
|
this._onWillDragGroup = new Emitter();
|
|
@@ -129,8 +142,23 @@ export class DockviewComponent extends BaseGrid {
|
|
|
129
142
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
130
143
|
this._onDidMovePanel = new Emitter();
|
|
131
144
|
this.onDidMovePanel = this._onDidMovePanel.event;
|
|
145
|
+
this._onDidCreateTabGroup = new Emitter();
|
|
146
|
+
this.onDidCreateTabGroup = this._onDidCreateTabGroup.event;
|
|
147
|
+
this._onDidDestroyTabGroup = new Emitter();
|
|
148
|
+
this.onDidDestroyTabGroup = this._onDidDestroyTabGroup.event;
|
|
149
|
+
this._onDidAddPanelToTabGroup = new Emitter();
|
|
150
|
+
this.onDidAddPanelToTabGroup = this._onDidAddPanelToTabGroup.event;
|
|
151
|
+
this._onDidRemovePanelFromTabGroup = new Emitter();
|
|
152
|
+
this.onDidRemovePanelFromTabGroup = this._onDidRemovePanelFromTabGroup.event;
|
|
153
|
+
this._onDidTabGroupChange = new Emitter();
|
|
154
|
+
this.onDidTabGroupChange = this._onDidTabGroupChange.event;
|
|
155
|
+
this._onDidTabGroupCollapsedChange = new Emitter();
|
|
156
|
+
this.onDidTabGroupCollapsedChange = this._onDidTabGroupCollapsedChange.event;
|
|
132
157
|
this._onDidMaximizedGroupChange = new Emitter();
|
|
133
158
|
this.onDidMaximizedGroupChange = this._onDidMaximizedGroupChange.event;
|
|
159
|
+
this._inShellLayout = false;
|
|
160
|
+
this._edgeGroups = new Map();
|
|
161
|
+
this._edgeGroupDisposables = new Map();
|
|
134
162
|
this._floatingGroups = [];
|
|
135
163
|
this._popoutGroups = [];
|
|
136
164
|
this._popoutRestorationPromise = Promise.resolve();
|
|
@@ -144,11 +172,30 @@ export class DockviewComponent extends BaseGrid {
|
|
|
144
172
|
this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
|
|
145
173
|
this._moving = false;
|
|
146
174
|
this._options = options;
|
|
175
|
+
this._tabGroupColorPalette = buildTabGroupColorPalette(options);
|
|
147
176
|
this.popupService = new PopupService(this.element);
|
|
148
|
-
this.
|
|
177
|
+
this.contextMenuController = new ContextMenuController(this);
|
|
149
178
|
this._api = new DockviewApi(this);
|
|
150
|
-
|
|
151
|
-
|
|
179
|
+
// The shell always wraps the dockview element so edge groups can be
|
|
180
|
+
// added at any time via addEdgeGroup() without re-parenting the DOM.
|
|
181
|
+
this.disableResizing = true;
|
|
182
|
+
container.removeChild(this.element);
|
|
183
|
+
this._shellManager = new ShellManager(container, this.element, (w, h) => this._layoutFromShell(w, h), (_d = (_c = options.theme) === null || _c === void 0 ? void 0 : _c.gap) !== null && _d !== void 0 ? _d : 0, (_e = options.theme) === null || _e === void 0 ? void 0 : _e.edgeGroupCollapsedSize);
|
|
184
|
+
// The shell wraps the dockview element, so move the popup anchor
|
|
185
|
+
// into the shell so overflow dropdowns in edge groups position correctly
|
|
186
|
+
this.popupService.updateRoot(this._shellManager.element);
|
|
187
|
+
this._shellThemeClassnames = new Classnames(this._shellManager.element);
|
|
188
|
+
// Anchor the overlay container to the shell element so that edge groups
|
|
189
|
+
// (which live outside this.element in the shell layout) are covered when
|
|
190
|
+
// dndOverlayMounting is 'absolute'.
|
|
191
|
+
this.rootDropTargetContainer = new DropTargetAnchorContainer(this._shellManager.element, { disabled: true });
|
|
192
|
+
this.overlayRenderContainer = new OverlayRenderContainer(this._shellManager.element, this);
|
|
193
|
+
// Hosted in the shell (not inside `.dv-dockview`) so floating overlays
|
|
194
|
+
// share a stacking context with `dv-render-overlay` panels; sized to
|
|
195
|
+
// mirror the gridview rect so saved positions remain valid.
|
|
196
|
+
this._floatingOverlayHost = document.createElement('div');
|
|
197
|
+
this._floatingOverlayHost.className = 'dv-floating-overlay-host';
|
|
198
|
+
this._shellManager.element.appendChild(this._floatingOverlayHost);
|
|
152
199
|
this._rootDropTarget = new Droptarget(this.element, {
|
|
153
200
|
className: 'dv-drop-target-edge',
|
|
154
201
|
canDisplayOverlay: (event, position) => {
|
|
@@ -177,7 +224,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
177
224
|
return firedEvent.isAccepted;
|
|
178
225
|
},
|
|
179
226
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
180
|
-
overlayModel: (
|
|
227
|
+
overlayModel: (_f = options.rootOverlayModel) !== null && _f !== void 0 ? _f : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
181
228
|
getOverrideTarget: () => { var _a; return (_a = this.rootDropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },
|
|
182
229
|
});
|
|
183
230
|
this.updateDropTargetModel(options);
|
|
@@ -195,7 +242,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
195
242
|
* Debounced to avoid multiple calls when moving groups with multiple panels.
|
|
196
243
|
*/
|
|
197
244
|
this.debouncedUpdateAllPositions();
|
|
198
|
-
}), this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
245
|
+
}), this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this._onDidCreateTabGroup, this._onDidDestroyTabGroup, this._onDidAddPanelToTabGroup, this._onDidRemovePanelFromTabGroup, this._onDidTabGroupChange, this._onDidTabGroupCollapsedChange, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
|
|
199
246
|
this.updateWatermark();
|
|
200
247
|
}), this.onDidAdd((event) => {
|
|
201
248
|
if (!this._moving) {
|
|
@@ -216,9 +263,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
216
263
|
});
|
|
217
264
|
}), Event.any(this.onDidAdd, this.onDidRemove)(() => {
|
|
218
265
|
this.updateWatermark();
|
|
219
|
-
}), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidMovePanel, this.onDidActivePanelChange, this.onDidPopoutGroupPositionChange, this.onDidPopoutGroupSizeChange)(() => {
|
|
266
|
+
}), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidRemoveGroup, this.onDidMovePanel, this.onDidActivePanelChange, this.onDidPopoutGroupPositionChange, this.onDidPopoutGroupSizeChange, this.onDidCreateTabGroup, this.onDidDestroyTabGroup, this.onDidAddPanelToTabGroup, this.onDidRemovePanelFromTabGroup, this.onDidTabGroupChange, this.onDidTabGroupCollapsedChange)(() => {
|
|
220
267
|
this._bufferOnDidLayoutChange.fire();
|
|
221
268
|
}), Disposable.from(() => {
|
|
269
|
+
var _a;
|
|
222
270
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
223
271
|
for (const group of [...this._floatingGroups]) {
|
|
224
272
|
group.dispose();
|
|
@@ -227,6 +275,11 @@ export class DockviewComponent extends BaseGrid {
|
|
|
227
275
|
for (const group of [...this._popoutGroups]) {
|
|
228
276
|
group.disposable.dispose();
|
|
229
277
|
}
|
|
278
|
+
(_a = this._shellManager) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
279
|
+
for (const d of this._edgeGroupDisposables.values()) {
|
|
280
|
+
d.dispose();
|
|
281
|
+
}
|
|
282
|
+
this._edgeGroupDisposables.clear();
|
|
230
283
|
}), this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
|
|
231
284
|
if (this.gridview.length > 0 && event.position === 'center') {
|
|
232
285
|
// option only available when no panels in primary grid
|
|
@@ -297,10 +350,28 @@ export class DockviewComponent extends BaseGrid {
|
|
|
297
350
|
case 'popout':
|
|
298
351
|
console.warn('dockview: You cannot hide a group that is in a popout window');
|
|
299
352
|
break;
|
|
353
|
+
case 'edge':
|
|
354
|
+
// Edge group visibility is managed via setEdgeGroupVisible
|
|
355
|
+
break;
|
|
300
356
|
}
|
|
301
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Returns the {@link PopupService} that should host popovers (context
|
|
360
|
+
* menus, tab overflow menus) for the given group. Popout groups have their
|
|
361
|
+
* own service rooted in their popout window so the popover renders there
|
|
362
|
+
* and dismisses on events from that window.
|
|
363
|
+
*/
|
|
364
|
+
getPopupServiceForGroup(group) {
|
|
365
|
+
var _a;
|
|
366
|
+
return (_a = this._popoutPopupServices.get(group.id)) !== null && _a !== void 0 ? _a : this.popupService;
|
|
367
|
+
}
|
|
302
368
|
addPopoutGroup(itemToPopout, options) {
|
|
303
369
|
var _a, _b, _c, _d, _e;
|
|
370
|
+
if (itemToPopout instanceof DockviewGroupPanel &&
|
|
371
|
+
itemToPopout.model.location.type === 'edge') {
|
|
372
|
+
// edge groups are permanent structural elements and cannot be popped out
|
|
373
|
+
return Promise.resolve(false);
|
|
374
|
+
}
|
|
304
375
|
if (itemToPopout instanceof DockviewPanel &&
|
|
305
376
|
itemToPopout.group.size === 1) {
|
|
306
377
|
return this.addPopoutGroup(itemToPopout.group, options);
|
|
@@ -420,6 +491,16 @@ export class DockviewComponent extends BaseGrid {
|
|
|
420
491
|
const dropTargetContainer = new DropTargetAnchorContainer(anchor, { disabled: this.rootDropTargetContainer.disabled });
|
|
421
492
|
popoutContainer.appendChild(anchor);
|
|
422
493
|
group.model.dropTargetContainer = dropTargetContainer;
|
|
494
|
+
// Each popout group needs its own popover service so that
|
|
495
|
+
// tab context menus, chip menus, and tab overflow menus
|
|
496
|
+
// render in the popout window (not the main window) and
|
|
497
|
+
// their pointerdown/keydown listeners fire on the right
|
|
498
|
+
// window for outside-click and Escape dismissal.
|
|
499
|
+
const popoutPopupService = new PopupService(popoutContainer, _window.window);
|
|
500
|
+
this._popoutPopupServices.set(group.id, popoutPopupService);
|
|
501
|
+
popoutWindowDisposable.addDisposables(popoutPopupService, Disposable.from(() => {
|
|
502
|
+
this._popoutPopupServices.delete(group.id);
|
|
503
|
+
}));
|
|
423
504
|
group.model.location = {
|
|
424
505
|
type: 'popout',
|
|
425
506
|
getWindow: () => _window.window,
|
|
@@ -544,7 +625,12 @@ export class DockviewComponent extends BaseGrid {
|
|
|
544
625
|
});
|
|
545
626
|
}
|
|
546
627
|
addFloatingGroup(item, options) {
|
|
547
|
-
var _a, _b, _c, _d, _e;
|
|
628
|
+
var _a, _b, _c, _d, _e, _f;
|
|
629
|
+
if (item instanceof DockviewGroupPanel &&
|
|
630
|
+
item.model.location.type === 'edge') {
|
|
631
|
+
// edge groups are permanent structural elements and cannot be floated
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
548
634
|
let group;
|
|
549
635
|
if (item instanceof DockviewPanel) {
|
|
550
636
|
group = this.createGroup();
|
|
@@ -639,11 +725,11 @@ export class DockviewComponent extends BaseGrid {
|
|
|
639
725
|
};
|
|
640
726
|
}
|
|
641
727
|
const anchoredBox = getAnchoredBox();
|
|
642
|
-
const overlay = new Overlay(Object.assign(Object.assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
728
|
+
const overlay = new Overlay(Object.assign(Object.assign({ container: (_b = this._floatingOverlayHost) !== null && _b !== void 0 ? _b : this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
643
729
|
? undefined
|
|
644
|
-
: ((
|
|
730
|
+
: ((_d = (_c = this.options.floatingGroupBounds) === null || _c === void 0 ? void 0 : _c.minimumWidthWithinViewport) !== null && _d !== void 0 ? _d : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE), minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
645
731
|
? undefined
|
|
646
|
-
: ((
|
|
732
|
+
: ((_f = (_e = this.options.floatingGroupBounds) === null || _e === void 0 ? void 0 : _e.minimumHeightWithinViewport) !== null && _f !== void 0 ? _f : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE) }));
|
|
647
733
|
const el = group.element.querySelector('.dv-void-container');
|
|
648
734
|
if (!el) {
|
|
649
735
|
throw new Error('dockview: failed to find drag handle');
|
|
@@ -724,7 +810,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
724
810
|
}
|
|
725
811
|
}
|
|
726
812
|
updateOptions(options) {
|
|
727
|
-
var _a, _b;
|
|
813
|
+
var _a, _b, _c;
|
|
728
814
|
super.updateOptions(options);
|
|
729
815
|
if ('floatingGroupBounds' in options) {
|
|
730
816
|
for (const group of this._floatingGroups) {
|
|
@@ -765,10 +851,25 @@ export class DockviewComponent extends BaseGrid {
|
|
|
765
851
|
group.model.updateHeaderActions();
|
|
766
852
|
}
|
|
767
853
|
}
|
|
768
|
-
|
|
854
|
+
if ('tabGroupColors' in options || 'tabGroupAccent' in options) {
|
|
855
|
+
this._tabGroupColorPalette.setEntries((_c = this._options.tabGroupColors) !== null && _c !== void 0 ? _c : DEFAULT_TAB_GROUP_COLORS);
|
|
856
|
+
this._tabGroupColorPalette.enabled =
|
|
857
|
+
this._options.tabGroupAccent !== 'off';
|
|
858
|
+
for (const group of this.groups) {
|
|
859
|
+
group.model.refreshTabGroupAccent();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
this._onDidOptionsChange.fire();
|
|
863
|
+
this._layoutFromShell(this.gridview.width, this.gridview.height);
|
|
769
864
|
}
|
|
770
865
|
layout(width, height, forceResize) {
|
|
771
|
-
|
|
866
|
+
if (this._shellManager && !this._inShellLayout) {
|
|
867
|
+
this._shellManager.layout(width, height);
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
super.layout(width, height, forceResize);
|
|
871
|
+
}
|
|
872
|
+
this._syncFloatingOverlayHost();
|
|
772
873
|
if (this._floatingGroups) {
|
|
773
874
|
for (const floating of this._floatingGroups) {
|
|
774
875
|
// ensure floting groups stay within visible boundaries
|
|
@@ -776,6 +877,103 @@ export class DockviewComponent extends BaseGrid {
|
|
|
776
877
|
}
|
|
777
878
|
}
|
|
778
879
|
}
|
|
880
|
+
_syncFloatingOverlayHost() {
|
|
881
|
+
if (!this._floatingOverlayHost || !this._shellManager) {
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
const shellRect = this._shellManager.element.getBoundingClientRect();
|
|
885
|
+
const gridRect = this.element.getBoundingClientRect();
|
|
886
|
+
const host = this._floatingOverlayHost;
|
|
887
|
+
host.style.left = `${gridRect.left - shellRect.left}px`;
|
|
888
|
+
host.style.top = `${gridRect.top - shellRect.top}px`;
|
|
889
|
+
host.style.width = `${gridRect.width}px`;
|
|
890
|
+
host.style.height = `${gridRect.height}px`;
|
|
891
|
+
}
|
|
892
|
+
_layoutFromShell(width, height) {
|
|
893
|
+
this._inShellLayout = true;
|
|
894
|
+
this.layout(width, height, true);
|
|
895
|
+
this._inShellLayout = false;
|
|
896
|
+
}
|
|
897
|
+
forceRelayout() {
|
|
898
|
+
if (this._shellManager) {
|
|
899
|
+
this._layoutFromShell(this.width, this.height);
|
|
900
|
+
}
|
|
901
|
+
else {
|
|
902
|
+
super.forceRelayout();
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
addEdgeGroup(position, options) {
|
|
906
|
+
if (this._edgeGroups.has(position)) {
|
|
907
|
+
throw new Error(`dockview: edge group already exists at position '${position}'`);
|
|
908
|
+
}
|
|
909
|
+
const group = this.createGroup({ id: options.id });
|
|
910
|
+
group.model.location = { type: 'edge', position };
|
|
911
|
+
group.model.headerPosition = position;
|
|
912
|
+
this._edgeGroups.set(position, group);
|
|
913
|
+
this._onDidAddGroup.fire(group);
|
|
914
|
+
// Collapse when the group becomes empty
|
|
915
|
+
const autoCollapseDisposable = group.model.onDidRemovePanel(() => {
|
|
916
|
+
if (group.model.isEmpty) {
|
|
917
|
+
this._shellManager.setEdgeGroupCollapsed(position, true);
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
this._edgeGroupDisposables.set(position, autoCollapseDisposable);
|
|
921
|
+
this._shellManager.addEdgeView(position, options, group);
|
|
922
|
+
return group.api;
|
|
923
|
+
}
|
|
924
|
+
getEdgeGroup(position) {
|
|
925
|
+
var _a;
|
|
926
|
+
return (_a = this._edgeGroups.get(position)) === null || _a === void 0 ? void 0 : _a.api;
|
|
927
|
+
}
|
|
928
|
+
setEdgeGroupVisible(position, visible) {
|
|
929
|
+
this._shellManager.setEdgeGroupVisible(position, visible);
|
|
930
|
+
}
|
|
931
|
+
isEdgeGroupVisible(position) {
|
|
932
|
+
return this._shellManager.isEdgeGroupVisible(position);
|
|
933
|
+
}
|
|
934
|
+
removeEdgeGroup(position) {
|
|
935
|
+
var _a;
|
|
936
|
+
const group = this._edgeGroups.get(position);
|
|
937
|
+
if (!group) {
|
|
938
|
+
throw new Error(`dockview: no edge group exists at position '${position}'`);
|
|
939
|
+
}
|
|
940
|
+
// Remove panels inside the group first
|
|
941
|
+
for (const panel of [...group.panels]) {
|
|
942
|
+
this.removePanel(panel, {
|
|
943
|
+
removeEmptyGroup: false,
|
|
944
|
+
skipDispose: false,
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
// Dispose the auto-collapse listener
|
|
948
|
+
(_a = this._edgeGroupDisposables.get(position)) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
949
|
+
this._edgeGroupDisposables.delete(position);
|
|
950
|
+
// Remove from the shell splitview
|
|
951
|
+
this._shellManager.removeEdgeView(position);
|
|
952
|
+
// Clean up group state
|
|
953
|
+
this._edgeGroups.delete(position);
|
|
954
|
+
group.dispose();
|
|
955
|
+
this._groups.delete(group.id);
|
|
956
|
+
this._onDidRemoveGroup.fire(group);
|
|
957
|
+
}
|
|
958
|
+
setEdgeGroupCollapsed(group, collapsed) {
|
|
959
|
+
for (const [position, edgeGroup] of this._edgeGroups) {
|
|
960
|
+
if (edgeGroup === group) {
|
|
961
|
+
this._shellManager.setEdgeGroupCollapsed(position, collapsed);
|
|
962
|
+
edgeGroup.api._onDidCollapsedChange.fire({
|
|
963
|
+
isCollapsed: collapsed,
|
|
964
|
+
});
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
isEdgeGroupCollapsed(group) {
|
|
970
|
+
for (const [position, edgeGroup] of this._edgeGroups) {
|
|
971
|
+
if (edgeGroup === group) {
|
|
972
|
+
return this._shellManager.isEdgeGroupCollapsed(position);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
return false;
|
|
976
|
+
}
|
|
779
977
|
updateDragAndDropState() {
|
|
780
978
|
// Update draggable state for all tabs and void containers
|
|
781
979
|
for (const group of this.groups) {
|
|
@@ -871,10 +1069,21 @@ export class DockviewComponent extends BaseGrid {
|
|
|
871
1069
|
if (popoutGroups.length > 0) {
|
|
872
1070
|
result.popoutGroups = popoutGroups;
|
|
873
1071
|
}
|
|
1072
|
+
if (this._edgeGroups.size > 0) {
|
|
1073
|
+
const shellSerialized = this._shellManager.toJSON();
|
|
1074
|
+
// Augment each entry with the serialized group state
|
|
1075
|
+
for (const [position, group] of this._edgeGroups) {
|
|
1076
|
+
const entry = shellSerialized[position];
|
|
1077
|
+
if (entry) {
|
|
1078
|
+
entry.group = group.toJSON();
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
result.edgeGroups = shellSerialized;
|
|
1082
|
+
}
|
|
874
1083
|
return result;
|
|
875
1084
|
}
|
|
876
1085
|
fromJSON(data, options) {
|
|
877
|
-
var _a, _b;
|
|
1086
|
+
var _a, _b, _c;
|
|
878
1087
|
const existingPanels = new Map();
|
|
879
1088
|
let tempGroup;
|
|
880
1089
|
if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
|
|
@@ -972,6 +1181,11 @@ export class DockviewComponent extends BaseGrid {
|
|
|
972
1181
|
});
|
|
973
1182
|
}
|
|
974
1183
|
}
|
|
1184
|
+
// Restore tab groups before activating a fallback panel so
|
|
1185
|
+
// that collapsed groups can clear the active panel correctly.
|
|
1186
|
+
if (data.tabGroups && data.tabGroups.length > 0) {
|
|
1187
|
+
group.model.restoreTabGroups(data.tabGroups);
|
|
1188
|
+
}
|
|
975
1189
|
if (!group.activePanel && group.panels.length > 0) {
|
|
976
1190
|
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
977
1191
|
skipSetGroupActive: true,
|
|
@@ -984,8 +1198,59 @@ export class DockviewComponent extends BaseGrid {
|
|
|
984
1198
|
return createGroupFromSerializedState(node.data);
|
|
985
1199
|
},
|
|
986
1200
|
});
|
|
987
|
-
this.
|
|
988
|
-
|
|
1201
|
+
this._layoutFromShell(width, height);
|
|
1202
|
+
if (data.edgeGroups) {
|
|
1203
|
+
// Auto-create edge groups for positions in the serialized state
|
|
1204
|
+
// that don't already have a group registered (e.g. when fromJSON
|
|
1205
|
+
// is called before the user has called addEdgeGroup).
|
|
1206
|
+
for (const _position of [
|
|
1207
|
+
'top',
|
|
1208
|
+
'bottom',
|
|
1209
|
+
'left',
|
|
1210
|
+
'right',
|
|
1211
|
+
]) {
|
|
1212
|
+
const fixedData = data.edgeGroups[_position];
|
|
1213
|
+
if (fixedData && !this._edgeGroups.has(_position)) {
|
|
1214
|
+
const groupState = fixedData.group;
|
|
1215
|
+
const id = (_a = groupState === null || groupState === void 0 ? void 0 : groupState.id) !== null && _a !== void 0 ? _a : `${_position}-group`;
|
|
1216
|
+
this.addEdgeGroup(_position, { id });
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
// Restore panel contents of edge groups
|
|
1220
|
+
for (const [position, edgeGroup] of this._edgeGroups) {
|
|
1221
|
+
const edgeData = data.edgeGroups[position];
|
|
1222
|
+
const groupState = edgeData === null || edgeData === void 0 ? void 0 : edgeData.group;
|
|
1223
|
+
if (groupState) {
|
|
1224
|
+
const { views, activeView } = groupState;
|
|
1225
|
+
const createdPanels = [];
|
|
1226
|
+
for (const panelId of views) {
|
|
1227
|
+
if (panels[panelId]) {
|
|
1228
|
+
const panel = this._deserializer.fromJSON(panels[panelId], edgeGroup);
|
|
1229
|
+
createdPanels.push(panel);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
for (let i = 0; i < createdPanels.length; i++) {
|
|
1233
|
+
const panel = createdPanels[i];
|
|
1234
|
+
const isActive = activeView === panel.id;
|
|
1235
|
+
edgeGroup.model.openPanel(panel, {
|
|
1236
|
+
skipSetActive: !isActive,
|
|
1237
|
+
skipSetGroupActive: true,
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
// Restore tab groups before activating a fallback panel
|
|
1241
|
+
if (groupState.tabGroups &&
|
|
1242
|
+
groupState.tabGroups.length > 0) {
|
|
1243
|
+
edgeGroup.model.restoreTabGroups(groupState.tabGroups);
|
|
1244
|
+
}
|
|
1245
|
+
if (!edgeGroup.activePanel &&
|
|
1246
|
+
edgeGroup.panels.length > 0) {
|
|
1247
|
+
edgeGroup.model.openPanel(edgeGroup.panels[edgeGroup.panels.length - 1], { skipSetGroupActive: true });
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
this._shellManager.fromJSON(data.edgeGroups);
|
|
1252
|
+
}
|
|
1253
|
+
const serializedFloatingGroups = (_b = data.floatingGroups) !== null && _b !== void 0 ? _b : [];
|
|
989
1254
|
for (const serializedFloatingGroup of serializedFloatingGroups) {
|
|
990
1255
|
const { data, position } = serializedFloatingGroup;
|
|
991
1256
|
const group = createGroupFromSerializedState(data);
|
|
@@ -997,7 +1262,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
997
1262
|
inDragMode: false,
|
|
998
1263
|
});
|
|
999
1264
|
}
|
|
1000
|
-
const serializedPopoutGroups = (
|
|
1265
|
+
const serializedPopoutGroups = (_c = data.popoutGroups) !== null && _c !== void 0 ? _c : [];
|
|
1001
1266
|
// Create a promise that resolves when all popout groups are created
|
|
1002
1267
|
const popoutPromises = [];
|
|
1003
1268
|
// Queue popup group creation with delays to avoid browser blocking
|
|
@@ -1078,6 +1343,14 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1078
1343
|
const groups = Array.from(this._groups.values()).map((_) => _.value);
|
|
1079
1344
|
const hasActiveGroup = !!this.activeGroup;
|
|
1080
1345
|
for (const group of groups) {
|
|
1346
|
+
if ([...this._edgeGroups.values()].includes(group)) {
|
|
1347
|
+
// Edge groups are structural - only clear their panels, not the group itself
|
|
1348
|
+
const panels = [...group.panels];
|
|
1349
|
+
for (const panel of panels) {
|
|
1350
|
+
this.removePanel(panel, { removeEmptyGroup: false });
|
|
1351
|
+
}
|
|
1352
|
+
continue;
|
|
1353
|
+
}
|
|
1081
1354
|
// remove the group will automatically remove the panels
|
|
1082
1355
|
this.removeGroup(group, { skipActive: true });
|
|
1083
1356
|
}
|
|
@@ -1167,6 +1440,7 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1167
1440
|
});
|
|
1168
1441
|
}
|
|
1169
1442
|
else if (referenceGroup.api.location.type === 'floating' ||
|
|
1443
|
+
referenceGroup.api.location.type === 'edge' ||
|
|
1170
1444
|
target === 'center') {
|
|
1171
1445
|
panel = this.createPanel(options, referenceGroup);
|
|
1172
1446
|
referenceGroup.model.openPanel(panel, {
|
|
@@ -1340,6 +1614,10 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1340
1614
|
}
|
|
1341
1615
|
doRemoveGroup(group, options) {
|
|
1342
1616
|
var _a;
|
|
1617
|
+
// Edge groups are permanent structural elements - never remove them from the layout
|
|
1618
|
+
if ([...this._edgeGroups.values()].includes(group)) {
|
|
1619
|
+
return group;
|
|
1620
|
+
}
|
|
1343
1621
|
const panels = [...group.panels]; // reassign since group panels will mutate
|
|
1344
1622
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
1345
1623
|
for (const panel of panels) {
|
|
@@ -1440,17 +1718,33 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1440
1718
|
throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
|
|
1441
1719
|
}
|
|
1442
1720
|
if (sourceItemId === undefined) {
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1721
|
+
if (options.from.tabGroupId) {
|
|
1722
|
+
/**
|
|
1723
|
+
* Moving a tab group (subset of panels) into another group
|
|
1724
|
+
*/
|
|
1725
|
+
this.moveTabGroupToGroup({
|
|
1726
|
+
sourceGroup,
|
|
1727
|
+
tabGroupId: options.from.tabGroupId,
|
|
1728
|
+
destinationGroup,
|
|
1729
|
+
destinationTarget,
|
|
1730
|
+
destinationIndex,
|
|
1731
|
+
skipSetActive: options.skipSetActive,
|
|
1732
|
+
keepEmptyGroups: options.keepEmptyGroups,
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
else {
|
|
1736
|
+
/**
|
|
1737
|
+
* Moving an entire group into another group
|
|
1738
|
+
*/
|
|
1739
|
+
this.moveGroup({
|
|
1740
|
+
from: { group: sourceGroup },
|
|
1741
|
+
to: {
|
|
1742
|
+
group: destinationGroup,
|
|
1743
|
+
position: destinationTarget,
|
|
1744
|
+
},
|
|
1745
|
+
skipSetActive: options.skipSetActive,
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1454
1748
|
return;
|
|
1455
1749
|
}
|
|
1456
1750
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
@@ -1540,6 +1834,30 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1540
1834
|
});
|
|
1541
1835
|
return;
|
|
1542
1836
|
}
|
|
1837
|
+
if (sourceGroup.api.location.type === 'edge') {
|
|
1838
|
+
/**
|
|
1839
|
+
* Edge groups are permanent structural elements — never move the
|
|
1840
|
+
* group itself. Instead extract the panel and create a new grid group,
|
|
1841
|
+
* leaving the edge slot intact (same behaviour as the size >= 2 path).
|
|
1842
|
+
*/
|
|
1843
|
+
const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {
|
|
1844
|
+
skipSetActive: false,
|
|
1845
|
+
skipSetActiveGroup: true,
|
|
1846
|
+
}));
|
|
1847
|
+
if (!removedPanel) {
|
|
1848
|
+
throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
1849
|
+
}
|
|
1850
|
+
const newGroup = this.createGroupAtLocation(targetLocation);
|
|
1851
|
+
this.movingLock(() => newGroup.model.openPanel(removedPanel, {
|
|
1852
|
+
skipSetGroupActive: true,
|
|
1853
|
+
}));
|
|
1854
|
+
this.doSetGroupAndPanelActive(newGroup);
|
|
1855
|
+
this._onDidMovePanel.fire({
|
|
1856
|
+
panel: removedPanel,
|
|
1857
|
+
from: sourceGroup,
|
|
1858
|
+
});
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1543
1861
|
// source group will become empty so delete the group
|
|
1544
1862
|
const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {
|
|
1545
1863
|
skipActive: true,
|
|
@@ -1580,6 +1898,73 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1580
1898
|
}
|
|
1581
1899
|
}
|
|
1582
1900
|
}
|
|
1901
|
+
moveTabGroupToGroup(options) {
|
|
1902
|
+
const { sourceGroup, tabGroupId, destinationGroup, destinationTarget, destinationIndex, } = options;
|
|
1903
|
+
const tabGroup = sourceGroup.model
|
|
1904
|
+
.getTabGroups()
|
|
1905
|
+
.find((tg) => tg.id === tabGroupId);
|
|
1906
|
+
if (!tabGroup || tabGroup.panelIds.length === 0) {
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
// Snapshot tab group metadata before removing panels
|
|
1910
|
+
const label = tabGroup.label;
|
|
1911
|
+
const color = tabGroup.color;
|
|
1912
|
+
const collapsed = tabGroup.collapsed;
|
|
1913
|
+
const panelIds = [...tabGroup.panelIds];
|
|
1914
|
+
// Remove panels from the source group
|
|
1915
|
+
const removedPanels = this.movingLock(() => panelIds
|
|
1916
|
+
.map((pid) => sourceGroup.model.removePanel(pid, {
|
|
1917
|
+
skipSetActive: false,
|
|
1918
|
+
skipSetActiveGroup: true,
|
|
1919
|
+
}))
|
|
1920
|
+
.filter((p) => p !== undefined));
|
|
1921
|
+
if (removedPanels.length === 0) {
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
if (!options.keepEmptyGroups &&
|
|
1925
|
+
sourceGroup.model.size === 0 &&
|
|
1926
|
+
sourceGroup !== destinationGroup) {
|
|
1927
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
1928
|
+
}
|
|
1929
|
+
const addPanelsToGroup = (targetGroup) => {
|
|
1930
|
+
this.movingLock(() => {
|
|
1931
|
+
for (const panel of removedPanels) {
|
|
1932
|
+
targetGroup.model.openPanel(panel, {
|
|
1933
|
+
index: destinationIndex,
|
|
1934
|
+
skipSetActive: true,
|
|
1935
|
+
skipSetGroupActive: true,
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
// Recreate the tab group in the destination
|
|
1940
|
+
const newTabGroup = targetGroup.model.createTabGroup({
|
|
1941
|
+
label,
|
|
1942
|
+
color,
|
|
1943
|
+
collapsed,
|
|
1944
|
+
});
|
|
1945
|
+
for (const panel of removedPanels) {
|
|
1946
|
+
targetGroup.model.addPanelToTabGroup(newTabGroup.id, panel.id);
|
|
1947
|
+
}
|
|
1948
|
+
if (!options.skipSetActive) {
|
|
1949
|
+
this.doSetGroupAndPanelActive(targetGroup);
|
|
1950
|
+
}
|
|
1951
|
+
for (const panel of removedPanels) {
|
|
1952
|
+
this._onDidMovePanel.fire({
|
|
1953
|
+
panel,
|
|
1954
|
+
from: sourceGroup,
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1958
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
1959
|
+
addPanelsToGroup(destinationGroup);
|
|
1960
|
+
}
|
|
1961
|
+
else {
|
|
1962
|
+
const referenceLocation = getGridLocation(destinationGroup.element);
|
|
1963
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
1964
|
+
const newGroup = this.createGroupAtLocation(dropLocation);
|
|
1965
|
+
addPanelsToGroup(newGroup);
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1583
1968
|
moveGroup(options) {
|
|
1584
1969
|
const from = options.from.group;
|
|
1585
1970
|
const to = options.to.group;
|
|
@@ -1786,9 +2171,13 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1786
2171
|
}), view.model.onGroupDragStart((event) => {
|
|
1787
2172
|
this._onWillDragGroup.fire(event);
|
|
1788
2173
|
}), view.model.onMove((event) => {
|
|
1789
|
-
const { groupId, itemId, target, index } = event;
|
|
2174
|
+
const { groupId, itemId, target, index, tabGroupId } = event;
|
|
1790
2175
|
this.moveGroupOrPanel({
|
|
1791
|
-
from: {
|
|
2176
|
+
from: {
|
|
2177
|
+
groupId: groupId,
|
|
2178
|
+
panelId: itemId,
|
|
2179
|
+
tabGroupId,
|
|
2180
|
+
},
|
|
1792
2181
|
to: {
|
|
1793
2182
|
group: view,
|
|
1794
2183
|
position: target,
|
|
@@ -1827,6 +2216,18 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1827
2216
|
if (this._onDidActivePanelChange.value !== event.panel) {
|
|
1828
2217
|
this._onDidActivePanelChange.fire(event.panel);
|
|
1829
2218
|
}
|
|
2219
|
+
}), view.model.onDidCreateTabGroup((e) => {
|
|
2220
|
+
this._onDidCreateTabGroup.fire(e);
|
|
2221
|
+
}), view.model.onDidDestroyTabGroup((e) => {
|
|
2222
|
+
this._onDidDestroyTabGroup.fire(e);
|
|
2223
|
+
}), view.model.onDidAddPanelToTabGroup((e) => {
|
|
2224
|
+
this._onDidAddPanelToTabGroup.fire(e);
|
|
2225
|
+
}), view.model.onDidRemovePanelFromTabGroup((e) => {
|
|
2226
|
+
this._onDidRemovePanelFromTabGroup.fire(e);
|
|
2227
|
+
}), view.model.onDidTabGroupChange((e) => {
|
|
2228
|
+
this._onDidTabGroupChange.fire(e);
|
|
2229
|
+
}), view.model.onDidTabGroupCollapsedChange((e) => {
|
|
2230
|
+
this._onDidTabGroupCollapsedChange.fire(e);
|
|
1830
2231
|
}), Event.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {
|
|
1831
2232
|
this._bufferOnDidLayoutChange.fire();
|
|
1832
2233
|
}));
|
|
@@ -1887,10 +2288,23 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1887
2288
|
}
|
|
1888
2289
|
}
|
|
1889
2290
|
updateTheme() {
|
|
1890
|
-
var _a, _b;
|
|
2291
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1891
2292
|
const theme = (_a = this._options.theme) !== null && _a !== void 0 ? _a : themeAbyss;
|
|
1892
|
-
|
|
1893
|
-
|
|
2293
|
+
// Apply the theme class only to the shell so edge groups and the
|
|
2294
|
+
// main grid both inherit its CSS custom properties via the cascade.
|
|
2295
|
+
// Re-declaring it on `.dv-dockview` would block consumer overrides
|
|
2296
|
+
// set on the shell from reaching the dockview subtree.
|
|
2297
|
+
(_b = this._shellThemeClassnames) === null || _b === void 0 ? void 0 : _b.setClassNames(theme.className);
|
|
2298
|
+
this.gridview.margin = (_c = theme.gap) !== null && _c !== void 0 ? _c : 0;
|
|
2299
|
+
(_d = this._shellManager) === null || _d === void 0 ? void 0 : _d.updateTheme((_e = theme.gap) !== null && _e !== void 0 ? _e : 0, (_f = theme.edgeGroupCollapsedSize) !== null && _f !== void 0 ? _f : 35);
|
|
2300
|
+
if (theme.dndOverlayBorder !== undefined) {
|
|
2301
|
+
this.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);
|
|
2302
|
+
(_g = this._shellManager) === null || _g === void 0 ? void 0 : _g.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);
|
|
2303
|
+
}
|
|
2304
|
+
else {
|
|
2305
|
+
this.element.style.removeProperty('--dv-drag-over-border');
|
|
2306
|
+
(_h = this._shellManager) === null || _h === void 0 ? void 0 : _h.element.style.removeProperty('--dv-drag-over-border');
|
|
2307
|
+
}
|
|
1894
2308
|
switch (theme.dndOverlayMounting) {
|
|
1895
2309
|
case 'absolute':
|
|
1896
2310
|
this.rootDropTargetContainer.disabled = false;
|
|
@@ -1900,5 +2314,16 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1900
2314
|
this.rootDropTargetContainer.disabled = true;
|
|
1901
2315
|
break;
|
|
1902
2316
|
}
|
|
2317
|
+
// Toggle a CSS class so theme stylesheets can scope pure-CSS
|
|
2318
|
+
// tab group indicator rules to the 'none' mode only.
|
|
2319
|
+
const indicatorNone = ((_j = theme.tabGroupIndicator) !== null && _j !== void 0 ? _j : 'wrap') === 'none';
|
|
2320
|
+
toggleClass(this.element, 'dv-tab-group-indicator-none', indicatorNone);
|
|
2321
|
+
if (this._shellManager) {
|
|
2322
|
+
toggleClass(this._shellManager.element, 'dv-tab-group-indicator-none', indicatorNone);
|
|
2323
|
+
}
|
|
2324
|
+
// Re-render tab group indicators so the new tabGroupIndicator mode takes effect
|
|
2325
|
+
for (const group of this.groups) {
|
|
2326
|
+
group.model.updateTabGroups();
|
|
2327
|
+
}
|
|
1903
2328
|
}
|
|
1904
2329
|
}
|