dockview-core 5.2.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 +6 -1
- package/dist/cjs/dockview/components/tab/tab.js +81 -9
- 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 +59 -0
- package/dist/cjs/dockview/components/titlebar/tabs.js +1227 -144
- 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 +92 -10
- package/dist/cjs/dockview/options.js +10 -7
- 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 +6942 -2777
- 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 +6940 -2775
- 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 +6 -1
- package/dist/esm/dockview/components/tab/tab.js +83 -9
- 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 +59 -0
- package/dist/esm/dockview/components/titlebar/tabs.js +1011 -99
- 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 +92 -10
- package/dist/esm/dockview/options.js +5 -2
- 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 +6936 -2801
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +6922 -2800
- package/dist/styles/dockview.css +1945 -196
- package/package.json +5 -1
|
@@ -89,12 +89,21 @@ var overlayRenderContainer_1 = require("../overlay/overlayRenderContainer");
|
|
|
89
89
|
var popoutWindow_1 = require("../popoutWindow");
|
|
90
90
|
var strictEventsSequencing_1 = require("./strictEventsSequencing");
|
|
91
91
|
var popupService_1 = require("./components/popupService");
|
|
92
|
+
var contextMenu_1 = require("./contextMenu");
|
|
92
93
|
var dropTargetAnchorContainer_1 = require("../dnd/dropTargetAnchorContainer");
|
|
93
94
|
var theme_1 = require("./theme");
|
|
95
|
+
var dockviewShell_1 = require("./dockviewShell");
|
|
96
|
+
var tabGroupAccent_1 = require("./tabGroupAccent");
|
|
94
97
|
var DEFAULT_ROOT_OVERLAY_MODEL = {
|
|
95
98
|
activationSize: { type: 'pixels', value: 10 },
|
|
96
99
|
size: { type: 'pixels', value: 20 },
|
|
97
100
|
};
|
|
101
|
+
function buildTabGroupColorPalette(options) {
|
|
102
|
+
var _a;
|
|
103
|
+
var entries = (_a = options.tabGroupColors) !== null && _a !== void 0 ? _a : tabGroupAccent_1.DEFAULT_TAB_GROUP_COLORS;
|
|
104
|
+
var enabled = options.tabGroupAccent !== 'off';
|
|
105
|
+
return new tabGroupAccent_1.TabGroupColorPalette(entries, enabled);
|
|
106
|
+
}
|
|
98
107
|
function moveGroupWithoutDestroying(options) {
|
|
99
108
|
var activePanel = options.from.activePanel;
|
|
100
109
|
var panels = __spreadArray([], __read(options.from.panels), false).map(function (panel) {
|
|
@@ -112,7 +121,7 @@ function moveGroupWithoutDestroying(options) {
|
|
|
112
121
|
var DockviewComponent = /** @class */ (function (_super) {
|
|
113
122
|
__extends(DockviewComponent, _super);
|
|
114
123
|
function DockviewComponent(container, options) {
|
|
115
|
-
var _a, _b, _c;
|
|
124
|
+
var _a, _b, _c, _d, _e, _f;
|
|
116
125
|
var _this = _super.call(this, container, {
|
|
117
126
|
proportionalLayout: true,
|
|
118
127
|
orientation: splitview_1.Orientation.HORIZONTAL,
|
|
@@ -127,6 +136,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
127
136
|
_this.nextGroupId = (0, math_1.sequentialNumberGenerator)();
|
|
128
137
|
_this._deserializer = new deserializer_1.DefaultDockviewDeserialzier(_this);
|
|
129
138
|
_this._watermark = null;
|
|
139
|
+
_this._popoutPopupServices = new Map();
|
|
130
140
|
_this._onWillDragPanel = new events_1.Emitter();
|
|
131
141
|
_this.onWillDragPanel = _this._onWillDragPanel.event;
|
|
132
142
|
_this._onWillDragGroup = new events_1.Emitter();
|
|
@@ -155,8 +165,23 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
155
165
|
_this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
|
|
156
166
|
_this._onDidMovePanel = new events_1.Emitter();
|
|
157
167
|
_this.onDidMovePanel = _this._onDidMovePanel.event;
|
|
168
|
+
_this._onDidCreateTabGroup = new events_1.Emitter();
|
|
169
|
+
_this.onDidCreateTabGroup = _this._onDidCreateTabGroup.event;
|
|
170
|
+
_this._onDidDestroyTabGroup = new events_1.Emitter();
|
|
171
|
+
_this.onDidDestroyTabGroup = _this._onDidDestroyTabGroup.event;
|
|
172
|
+
_this._onDidAddPanelToTabGroup = new events_1.Emitter();
|
|
173
|
+
_this.onDidAddPanelToTabGroup = _this._onDidAddPanelToTabGroup.event;
|
|
174
|
+
_this._onDidRemovePanelFromTabGroup = new events_1.Emitter();
|
|
175
|
+
_this.onDidRemovePanelFromTabGroup = _this._onDidRemovePanelFromTabGroup.event;
|
|
176
|
+
_this._onDidTabGroupChange = new events_1.Emitter();
|
|
177
|
+
_this.onDidTabGroupChange = _this._onDidTabGroupChange.event;
|
|
178
|
+
_this._onDidTabGroupCollapsedChange = new events_1.Emitter();
|
|
179
|
+
_this.onDidTabGroupCollapsedChange = _this._onDidTabGroupCollapsedChange.event;
|
|
158
180
|
_this._onDidMaximizedGroupChange = new events_1.Emitter();
|
|
159
181
|
_this.onDidMaximizedGroupChange = _this._onDidMaximizedGroupChange.event;
|
|
182
|
+
_this._inShellLayout = false;
|
|
183
|
+
_this._edgeGroups = new Map();
|
|
184
|
+
_this._edgeGroupDisposables = new Map();
|
|
160
185
|
_this._floatingGroups = [];
|
|
161
186
|
_this._popoutGroups = [];
|
|
162
187
|
_this._popoutRestorationPromise = Promise.resolve();
|
|
@@ -170,11 +195,30 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
170
195
|
_this.onDidActiveGroupChange = _this._onDidActiveGroupChange.event;
|
|
171
196
|
_this._moving = false;
|
|
172
197
|
_this._options = options;
|
|
198
|
+
_this._tabGroupColorPalette = buildTabGroupColorPalette(options);
|
|
173
199
|
_this.popupService = new popupService_1.PopupService(_this.element);
|
|
174
|
-
_this.
|
|
200
|
+
_this.contextMenuController = new contextMenu_1.ContextMenuController(_this);
|
|
175
201
|
_this._api = new component_api_1.DockviewApi(_this);
|
|
176
|
-
|
|
177
|
-
|
|
202
|
+
// The shell always wraps the dockview element so edge groups can be
|
|
203
|
+
// added at any time via addEdgeGroup() without re-parenting the DOM.
|
|
204
|
+
_this.disableResizing = true;
|
|
205
|
+
container.removeChild(_this.element);
|
|
206
|
+
_this._shellManager = new dockviewShell_1.ShellManager(container, _this.element, function (w, h) { return _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);
|
|
207
|
+
// The shell wraps the dockview element, so move the popup anchor
|
|
208
|
+
// into the shell so overflow dropdowns in edge groups position correctly
|
|
209
|
+
_this.popupService.updateRoot(_this._shellManager.element);
|
|
210
|
+
_this._shellThemeClassnames = new dom_1.Classnames(_this._shellManager.element);
|
|
211
|
+
// Anchor the overlay container to the shell element so that edge groups
|
|
212
|
+
// (which live outside this.element in the shell layout) are covered when
|
|
213
|
+
// dndOverlayMounting is 'absolute'.
|
|
214
|
+
_this.rootDropTargetContainer = new dropTargetAnchorContainer_1.DropTargetAnchorContainer(_this._shellManager.element, { disabled: true });
|
|
215
|
+
_this.overlayRenderContainer = new overlayRenderContainer_1.OverlayRenderContainer(_this._shellManager.element, _this);
|
|
216
|
+
// Hosted in the shell (not inside `.dv-dockview`) so floating overlays
|
|
217
|
+
// share a stacking context with `dv-render-overlay` panels; sized to
|
|
218
|
+
// mirror the gridview rect so saved positions remain valid.
|
|
219
|
+
_this._floatingOverlayHost = document.createElement('div');
|
|
220
|
+
_this._floatingOverlayHost.className = 'dv-floating-overlay-host';
|
|
221
|
+
_this._shellManager.element.appendChild(_this._floatingOverlayHost);
|
|
178
222
|
_this._rootDropTarget = new droptarget_1.Droptarget(_this.element, {
|
|
179
223
|
className: 'dv-drop-target-edge',
|
|
180
224
|
canDisplayOverlay: function (event, position) {
|
|
@@ -203,7 +247,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
203
247
|
return firedEvent.isAccepted;
|
|
204
248
|
},
|
|
205
249
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
206
|
-
overlayModel: (
|
|
250
|
+
overlayModel: (_f = options.rootOverlayModel) !== null && _f !== void 0 ? _f : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
207
251
|
getOverrideTarget: function () { var _a; return (_a = _this.rootDropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },
|
|
208
252
|
});
|
|
209
253
|
_this.updateDropTargetModel(options);
|
|
@@ -221,7 +265,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
221
265
|
* Debounced to avoid multiple calls when moving groups with multiple panels.
|
|
222
266
|
*/
|
|
223
267
|
_this.debouncedUpdateAllPositions();
|
|
224
|
-
}), _this._onDidAddGroup, _this._onDidRemoveGroup, _this._onDidActiveGroupChange, _this._onUnhandledDragOverEvent, _this._onDidMaximizedGroupChange, _this._onDidOptionsChange, _this._onDidPopoutGroupSizeChange, _this._onDidPopoutGroupPositionChange, _this._onDidOpenPopoutWindowFail, _this.onDidViewVisibilityChangeMicroTaskQueue(function () {
|
|
268
|
+
}), _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(function () {
|
|
225
269
|
_this.updateWatermark();
|
|
226
270
|
}), _this.onDidAdd(function (event) {
|
|
227
271
|
if (!_this._moving) {
|
|
@@ -242,38 +286,54 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
242
286
|
});
|
|
243
287
|
}), events_1.Event.any(_this.onDidAdd, _this.onDidRemove)(function () {
|
|
244
288
|
_this.updateWatermark();
|
|
245
|
-
}), events_1.Event.any(_this.onDidAddPanel, _this.onDidRemovePanel, _this.onDidAddGroup, _this.onDidRemove, _this.onDidMovePanel, _this.onDidActivePanelChange, _this.onDidPopoutGroupPositionChange, _this.onDidPopoutGroupSizeChange)(function () {
|
|
289
|
+
}), events_1.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)(function () {
|
|
246
290
|
_this._bufferOnDidLayoutChange.fire();
|
|
247
291
|
}), lifecycle_1.Disposable.from(function () {
|
|
248
|
-
var e_1, _a, e_2, _b;
|
|
292
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
293
|
+
var _d;
|
|
249
294
|
try {
|
|
250
295
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
251
|
-
for (var
|
|
252
|
-
var group =
|
|
296
|
+
for (var _e = __values(__spreadArray([], __read(_this._floatingGroups), false)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
297
|
+
var group = _f.value;
|
|
253
298
|
group.dispose();
|
|
254
299
|
}
|
|
255
300
|
}
|
|
256
301
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
257
302
|
finally {
|
|
258
303
|
try {
|
|
259
|
-
if (
|
|
304
|
+
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
260
305
|
}
|
|
261
306
|
finally { if (e_1) throw e_1.error; }
|
|
262
307
|
}
|
|
263
308
|
try {
|
|
264
309
|
// iterate over a copy of the array since .dispose() mutates the original array
|
|
265
|
-
for (var
|
|
266
|
-
var group =
|
|
310
|
+
for (var _g = __values(__spreadArray([], __read(_this._popoutGroups), false)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
311
|
+
var group = _h.value;
|
|
267
312
|
group.disposable.dispose();
|
|
268
313
|
}
|
|
269
314
|
}
|
|
270
315
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
271
316
|
finally {
|
|
272
317
|
try {
|
|
273
|
-
if (
|
|
318
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
274
319
|
}
|
|
275
320
|
finally { if (e_2) throw e_2.error; }
|
|
276
321
|
}
|
|
322
|
+
(_d = _this._shellManager) === null || _d === void 0 ? void 0 : _d.dispose();
|
|
323
|
+
try {
|
|
324
|
+
for (var _j = __values(_this._edgeGroupDisposables.values()), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
325
|
+
var d = _k.value;
|
|
326
|
+
d.dispose();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
330
|
+
finally {
|
|
331
|
+
try {
|
|
332
|
+
if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
|
|
333
|
+
}
|
|
334
|
+
finally { if (e_3) throw e_3.error; }
|
|
335
|
+
}
|
|
336
|
+
_this._edgeGroupDisposables.clear();
|
|
277
337
|
}), _this._rootDropTarget, _this._rootDropTarget.onWillShowOverlay(function (event) {
|
|
278
338
|
if (_this.gridview.length > 0 && event.position === 'center') {
|
|
279
339
|
// option only available when no panels in primary grid
|
|
@@ -355,6 +415,13 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
355
415
|
enumerable: false,
|
|
356
416
|
configurable: true
|
|
357
417
|
});
|
|
418
|
+
Object.defineProperty(DockviewComponent.prototype, "tabGroupColorPalette", {
|
|
419
|
+
get: function () {
|
|
420
|
+
return this._tabGroupColorPalette;
|
|
421
|
+
},
|
|
422
|
+
enumerable: false,
|
|
423
|
+
configurable: true
|
|
424
|
+
});
|
|
358
425
|
Object.defineProperty(DockviewComponent.prototype, "activePanel", {
|
|
359
426
|
get: function () {
|
|
360
427
|
var activeGroup = this.activeGroup;
|
|
@@ -425,11 +492,29 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
425
492
|
case 'popout':
|
|
426
493
|
console.warn('dockview: You cannot hide a group that is in a popout window');
|
|
427
494
|
break;
|
|
495
|
+
case 'edge':
|
|
496
|
+
// Edge group visibility is managed via setEdgeGroupVisible
|
|
497
|
+
break;
|
|
428
498
|
}
|
|
429
499
|
};
|
|
500
|
+
/**
|
|
501
|
+
* Returns the {@link PopupService} that should host popovers (context
|
|
502
|
+
* menus, tab overflow menus) for the given group. Popout groups have their
|
|
503
|
+
* own service rooted in their popout window so the popover renders there
|
|
504
|
+
* and dismisses on events from that window.
|
|
505
|
+
*/
|
|
506
|
+
DockviewComponent.prototype.getPopupServiceForGroup = function (group) {
|
|
507
|
+
var _a;
|
|
508
|
+
return (_a = this._popoutPopupServices.get(group.id)) !== null && _a !== void 0 ? _a : this.popupService;
|
|
509
|
+
};
|
|
430
510
|
DockviewComponent.prototype.addPopoutGroup = function (itemToPopout, options) {
|
|
431
511
|
var _this = this;
|
|
432
512
|
var _a, _b, _c, _d, _e;
|
|
513
|
+
if (itemToPopout instanceof dockviewGroupPanel_1.DockviewGroupPanel &&
|
|
514
|
+
itemToPopout.model.location.type === 'edge') {
|
|
515
|
+
// edge groups are permanent structural elements and cannot be popped out
|
|
516
|
+
return Promise.resolve(false);
|
|
517
|
+
}
|
|
433
518
|
if (itemToPopout instanceof dockviewPanel_1.DockviewPanel &&
|
|
434
519
|
itemToPopout.group.size === 1) {
|
|
435
520
|
return this.addPopoutGroup(itemToPopout.group, options);
|
|
@@ -555,6 +640,16 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
555
640
|
var dropTargetContainer = new dropTargetAnchorContainer_1.DropTargetAnchorContainer(anchor, { disabled: _this.rootDropTargetContainer.disabled });
|
|
556
641
|
popoutContainer.appendChild(anchor);
|
|
557
642
|
group.model.dropTargetContainer = dropTargetContainer;
|
|
643
|
+
// Each popout group needs its own popover service so that
|
|
644
|
+
// tab context menus, chip menus, and tab overflow menus
|
|
645
|
+
// render in the popout window (not the main window) and
|
|
646
|
+
// their pointerdown/keydown listeners fire on the right
|
|
647
|
+
// window for outside-click and Escape dismissal.
|
|
648
|
+
var popoutPopupService = new popupService_1.PopupService(popoutContainer, _window.window);
|
|
649
|
+
_this._popoutPopupServices.set(group.id, popoutPopupService);
|
|
650
|
+
popoutWindowDisposable.addDisposables(popoutPopupService, lifecycle_1.Disposable.from(function () {
|
|
651
|
+
_this._popoutPopupServices.delete(group.id);
|
|
652
|
+
}));
|
|
558
653
|
group.model.location = {
|
|
559
654
|
type: 'popout',
|
|
560
655
|
getWindow: function () { return _window.window; },
|
|
@@ -682,7 +777,12 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
682
777
|
};
|
|
683
778
|
DockviewComponent.prototype.addFloatingGroup = function (item, options) {
|
|
684
779
|
var _this = this;
|
|
685
|
-
var _a, _b, _c, _d, _e;
|
|
780
|
+
var _a, _b, _c, _d, _e, _f;
|
|
781
|
+
if (item instanceof dockviewGroupPanel_1.DockviewGroupPanel &&
|
|
782
|
+
item.model.location.type === 'edge') {
|
|
783
|
+
// edge groups are permanent structural elements and cannot be floated
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
686
786
|
var group;
|
|
687
787
|
if (item instanceof dockviewPanel_1.DockviewPanel) {
|
|
688
788
|
group = this.createGroup();
|
|
@@ -783,11 +883,11 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
783
883
|
};
|
|
784
884
|
}
|
|
785
885
|
var anchoredBox = getAnchoredBox();
|
|
786
|
-
var overlay = new overlay_1.Overlay(__assign(__assign({ container: this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
886
|
+
var overlay = new overlay_1.Overlay(__assign(__assign({ container: (_b = this._floatingOverlayHost) !== null && _b !== void 0 ? _b : this.gridview.element, content: group.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
787
887
|
? undefined
|
|
788
|
-
: ((
|
|
888
|
+
: ((_d = (_c = this.options.floatingGroupBounds) === null || _c === void 0 ? void 0 : _c.minimumWidthWithinViewport) !== null && _d !== void 0 ? _d : constants_1.DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE), minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
789
889
|
? undefined
|
|
790
|
-
: ((
|
|
890
|
+
: ((_f = (_e = this.options.floatingGroupBounds) === null || _e === void 0 ? void 0 : _e.minimumHeightWithinViewport) !== null && _f !== void 0 ? _f : constants_1.DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE) }));
|
|
791
891
|
var el = group.element.querySelector('.dv-void-container');
|
|
792
892
|
if (!el) {
|
|
793
893
|
throw new Error('dockview: failed to find drag handle');
|
|
@@ -868,13 +968,13 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
868
968
|
}
|
|
869
969
|
};
|
|
870
970
|
DockviewComponent.prototype.updateOptions = function (options) {
|
|
871
|
-
var
|
|
872
|
-
var
|
|
971
|
+
var e_4, _a, e_5, _b, e_6, _c;
|
|
972
|
+
var _d, _e, _f;
|
|
873
973
|
_super.prototype.updateOptions.call(this, options);
|
|
874
974
|
if ('floatingGroupBounds' in options) {
|
|
875
975
|
try {
|
|
876
|
-
for (var
|
|
877
|
-
var group =
|
|
976
|
+
for (var _g = __values(this._floatingGroups), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
977
|
+
var group = _h.value;
|
|
878
978
|
switch (options.floatingGroupBounds) {
|
|
879
979
|
case 'boundedWithinViewport':
|
|
880
980
|
group.overlay.minimumInViewportHeight = undefined;
|
|
@@ -888,19 +988,19 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
888
988
|
break;
|
|
889
989
|
default:
|
|
890
990
|
group.overlay.minimumInViewportHeight =
|
|
891
|
-
(
|
|
991
|
+
(_d = options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport;
|
|
892
992
|
group.overlay.minimumInViewportWidth =
|
|
893
|
-
(
|
|
993
|
+
(_e = options.floatingGroupBounds) === null || _e === void 0 ? void 0 : _e.minimumWidthWithinViewport;
|
|
894
994
|
}
|
|
895
995
|
group.overlay.setBounds();
|
|
896
996
|
}
|
|
897
997
|
}
|
|
898
|
-
catch (
|
|
998
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
899
999
|
finally {
|
|
900
1000
|
try {
|
|
901
|
-
if (
|
|
1001
|
+
if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
|
|
902
1002
|
}
|
|
903
|
-
finally { if (
|
|
1003
|
+
finally { if (e_4) throw e_4.error; }
|
|
904
1004
|
}
|
|
905
1005
|
}
|
|
906
1006
|
this.updateDropTargetModel(options);
|
|
@@ -917,24 +1017,49 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
917
1017
|
'createLeftHeaderActionComponent' in options ||
|
|
918
1018
|
'createPrefixHeaderActionComponent' in options) {
|
|
919
1019
|
try {
|
|
920
|
-
for (var
|
|
921
|
-
var group =
|
|
1020
|
+
for (var _j = __values(this.groups), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1021
|
+
var group = _k.value;
|
|
922
1022
|
group.model.updateHeaderActions();
|
|
923
1023
|
}
|
|
924
1024
|
}
|
|
925
|
-
catch (
|
|
1025
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
926
1026
|
finally {
|
|
927
1027
|
try {
|
|
928
|
-
if (
|
|
1028
|
+
if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
|
|
1029
|
+
}
|
|
1030
|
+
finally { if (e_5) throw e_5.error; }
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
if ('tabGroupColors' in options || 'tabGroupAccent' in options) {
|
|
1034
|
+
this._tabGroupColorPalette.setEntries((_f = this._options.tabGroupColors) !== null && _f !== void 0 ? _f : tabGroupAccent_1.DEFAULT_TAB_GROUP_COLORS);
|
|
1035
|
+
this._tabGroupColorPalette.enabled =
|
|
1036
|
+
this._options.tabGroupAccent !== 'off';
|
|
1037
|
+
try {
|
|
1038
|
+
for (var _l = __values(this.groups), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
1039
|
+
var group = _m.value;
|
|
1040
|
+
group.model.refreshTabGroupAccent();
|
|
929
1041
|
}
|
|
930
|
-
|
|
1042
|
+
}
|
|
1043
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1044
|
+
finally {
|
|
1045
|
+
try {
|
|
1046
|
+
if (_m && !_m.done && (_c = _l.return)) _c.call(_l);
|
|
1047
|
+
}
|
|
1048
|
+
finally { if (e_6) throw e_6.error; }
|
|
931
1049
|
}
|
|
932
1050
|
}
|
|
933
|
-
this.
|
|
1051
|
+
this._onDidOptionsChange.fire();
|
|
1052
|
+
this._layoutFromShell(this.gridview.width, this.gridview.height);
|
|
934
1053
|
};
|
|
935
1054
|
DockviewComponent.prototype.layout = function (width, height, forceResize) {
|
|
936
|
-
var
|
|
937
|
-
|
|
1055
|
+
var e_7, _a;
|
|
1056
|
+
if (this._shellManager && !this._inShellLayout) {
|
|
1057
|
+
this._shellManager.layout(width, height);
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
_super.prototype.layout.call(this, width, height, forceResize);
|
|
1061
|
+
}
|
|
1062
|
+
this._syncFloatingOverlayHost();
|
|
938
1063
|
if (this._floatingGroups) {
|
|
939
1064
|
try {
|
|
940
1065
|
for (var _b = __values(this._floatingGroups), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -943,17 +1068,148 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
943
1068
|
floating.overlay.setBounds();
|
|
944
1069
|
}
|
|
945
1070
|
}
|
|
946
|
-
catch (
|
|
1071
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
947
1072
|
finally {
|
|
948
1073
|
try {
|
|
949
1074
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
950
1075
|
}
|
|
951
|
-
finally { if (
|
|
1076
|
+
finally { if (e_7) throw e_7.error; }
|
|
952
1077
|
}
|
|
953
1078
|
}
|
|
954
1079
|
};
|
|
1080
|
+
DockviewComponent.prototype._syncFloatingOverlayHost = function () {
|
|
1081
|
+
if (!this._floatingOverlayHost || !this._shellManager) {
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
var shellRect = this._shellManager.element.getBoundingClientRect();
|
|
1085
|
+
var gridRect = this.element.getBoundingClientRect();
|
|
1086
|
+
var host = this._floatingOverlayHost;
|
|
1087
|
+
host.style.left = "".concat(gridRect.left - shellRect.left, "px");
|
|
1088
|
+
host.style.top = "".concat(gridRect.top - shellRect.top, "px");
|
|
1089
|
+
host.style.width = "".concat(gridRect.width, "px");
|
|
1090
|
+
host.style.height = "".concat(gridRect.height, "px");
|
|
1091
|
+
};
|
|
1092
|
+
DockviewComponent.prototype._layoutFromShell = function (width, height) {
|
|
1093
|
+
this._inShellLayout = true;
|
|
1094
|
+
this.layout(width, height, true);
|
|
1095
|
+
this._inShellLayout = false;
|
|
1096
|
+
};
|
|
1097
|
+
DockviewComponent.prototype.forceRelayout = function () {
|
|
1098
|
+
if (this._shellManager) {
|
|
1099
|
+
this._layoutFromShell(this.width, this.height);
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
_super.prototype.forceRelayout.call(this);
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
DockviewComponent.prototype.addEdgeGroup = function (position, options) {
|
|
1106
|
+
var _this = this;
|
|
1107
|
+
if (this._edgeGroups.has(position)) {
|
|
1108
|
+
throw new Error("dockview: edge group already exists at position '".concat(position, "'"));
|
|
1109
|
+
}
|
|
1110
|
+
var group = this.createGroup({ id: options.id });
|
|
1111
|
+
group.model.location = { type: 'edge', position: position };
|
|
1112
|
+
group.model.headerPosition = position;
|
|
1113
|
+
this._edgeGroups.set(position, group);
|
|
1114
|
+
this._onDidAddGroup.fire(group);
|
|
1115
|
+
// Collapse when the group becomes empty
|
|
1116
|
+
var autoCollapseDisposable = group.model.onDidRemovePanel(function () {
|
|
1117
|
+
if (group.model.isEmpty) {
|
|
1118
|
+
_this._shellManager.setEdgeGroupCollapsed(position, true);
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
this._edgeGroupDisposables.set(position, autoCollapseDisposable);
|
|
1122
|
+
this._shellManager.addEdgeView(position, options, group);
|
|
1123
|
+
return group.api;
|
|
1124
|
+
};
|
|
1125
|
+
DockviewComponent.prototype.getEdgeGroup = function (position) {
|
|
1126
|
+
var _a;
|
|
1127
|
+
return (_a = this._edgeGroups.get(position)) === null || _a === void 0 ? void 0 : _a.api;
|
|
1128
|
+
};
|
|
1129
|
+
DockviewComponent.prototype.setEdgeGroupVisible = function (position, visible) {
|
|
1130
|
+
this._shellManager.setEdgeGroupVisible(position, visible);
|
|
1131
|
+
};
|
|
1132
|
+
DockviewComponent.prototype.isEdgeGroupVisible = function (position) {
|
|
1133
|
+
return this._shellManager.isEdgeGroupVisible(position);
|
|
1134
|
+
};
|
|
1135
|
+
DockviewComponent.prototype.removeEdgeGroup = function (position) {
|
|
1136
|
+
var e_8, _a;
|
|
1137
|
+
var _b;
|
|
1138
|
+
var group = this._edgeGroups.get(position);
|
|
1139
|
+
if (!group) {
|
|
1140
|
+
throw new Error("dockview: no edge group exists at position '".concat(position, "'"));
|
|
1141
|
+
}
|
|
1142
|
+
try {
|
|
1143
|
+
// Remove panels inside the group first
|
|
1144
|
+
for (var _c = __values(__spreadArray([], __read(group.panels), false)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1145
|
+
var panel = _d.value;
|
|
1146
|
+
this.removePanel(panel, {
|
|
1147
|
+
removeEmptyGroup: false,
|
|
1148
|
+
skipDispose: false,
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1153
|
+
finally {
|
|
1154
|
+
try {
|
|
1155
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1156
|
+
}
|
|
1157
|
+
finally { if (e_8) throw e_8.error; }
|
|
1158
|
+
}
|
|
1159
|
+
// Dispose the auto-collapse listener
|
|
1160
|
+
(_b = this._edgeGroupDisposables.get(position)) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
1161
|
+
this._edgeGroupDisposables.delete(position);
|
|
1162
|
+
// Remove from the shell splitview
|
|
1163
|
+
this._shellManager.removeEdgeView(position);
|
|
1164
|
+
// Clean up group state
|
|
1165
|
+
this._edgeGroups.delete(position);
|
|
1166
|
+
group.dispose();
|
|
1167
|
+
this._groups.delete(group.id);
|
|
1168
|
+
this._onDidRemoveGroup.fire(group);
|
|
1169
|
+
};
|
|
1170
|
+
DockviewComponent.prototype.setEdgeGroupCollapsed = function (group, collapsed) {
|
|
1171
|
+
var e_9, _a;
|
|
1172
|
+
try {
|
|
1173
|
+
for (var _b = __values(this._edgeGroups), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1174
|
+
var _d = __read(_c.value, 2), position = _d[0], edgeGroup = _d[1];
|
|
1175
|
+
if (edgeGroup === group) {
|
|
1176
|
+
this._shellManager.setEdgeGroupCollapsed(position, collapsed);
|
|
1177
|
+
edgeGroup.api._onDidCollapsedChange.fire({
|
|
1178
|
+
isCollapsed: collapsed,
|
|
1179
|
+
});
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1185
|
+
finally {
|
|
1186
|
+
try {
|
|
1187
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1188
|
+
}
|
|
1189
|
+
finally { if (e_9) throw e_9.error; }
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
DockviewComponent.prototype.isEdgeGroupCollapsed = function (group) {
|
|
1193
|
+
var e_10, _a;
|
|
1194
|
+
try {
|
|
1195
|
+
for (var _b = __values(this._edgeGroups), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1196
|
+
var _d = __read(_c.value, 2), position = _d[0], edgeGroup = _d[1];
|
|
1197
|
+
if (edgeGroup === group) {
|
|
1198
|
+
return this._shellManager.isEdgeGroupCollapsed(position);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1203
|
+
finally {
|
|
1204
|
+
try {
|
|
1205
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1206
|
+
}
|
|
1207
|
+
finally { if (e_10) throw e_10.error; }
|
|
1208
|
+
}
|
|
1209
|
+
return false;
|
|
1210
|
+
};
|
|
955
1211
|
DockviewComponent.prototype.updateDragAndDropState = function () {
|
|
956
|
-
var
|
|
1212
|
+
var e_11, _a;
|
|
957
1213
|
try {
|
|
958
1214
|
// Update draggable state for all tabs and void containers
|
|
959
1215
|
for (var _b = __values(this.groups), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -961,12 +1217,12 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
961
1217
|
group.model.updateDragAndDropState();
|
|
962
1218
|
}
|
|
963
1219
|
}
|
|
964
|
-
catch (
|
|
1220
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
965
1221
|
finally {
|
|
966
1222
|
try {
|
|
967
1223
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
968
1224
|
}
|
|
969
|
-
finally { if (
|
|
1225
|
+
finally { if (e_11) throw e_11.error; }
|
|
970
1226
|
}
|
|
971
1227
|
};
|
|
972
1228
|
DockviewComponent.prototype.focus = function () {
|
|
@@ -1027,7 +1283,8 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1027
1283
|
* @returns A JSON respresentation of the layout
|
|
1028
1284
|
*/
|
|
1029
1285
|
DockviewComponent.prototype.toJSON = function () {
|
|
1030
|
-
var _a;
|
|
1286
|
+
var e_12, _a;
|
|
1287
|
+
var _b;
|
|
1031
1288
|
var data = this.gridview.serialize();
|
|
1032
1289
|
var panels = this.panels.reduce(function (collection, panel) {
|
|
1033
1290
|
collection[panel.id] = panel.toJSON();
|
|
@@ -1052,7 +1309,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1052
1309
|
var result = {
|
|
1053
1310
|
grid: data,
|
|
1054
1311
|
panels: panels,
|
|
1055
|
-
activeGroup: (
|
|
1312
|
+
activeGroup: (_b = this.activeGroup) === null || _b === void 0 ? void 0 : _b.id,
|
|
1056
1313
|
};
|
|
1057
1314
|
if (floats.length > 0) {
|
|
1058
1315
|
result.floatingGroups = floats;
|
|
@@ -1060,12 +1317,33 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1060
1317
|
if (popoutGroups.length > 0) {
|
|
1061
1318
|
result.popoutGroups = popoutGroups;
|
|
1062
1319
|
}
|
|
1320
|
+
if (this._edgeGroups.size > 0) {
|
|
1321
|
+
var shellSerialized = this._shellManager.toJSON();
|
|
1322
|
+
try {
|
|
1323
|
+
// Augment each entry with the serialized group state
|
|
1324
|
+
for (var _c = __values(this._edgeGroups), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1325
|
+
var _e = __read(_d.value, 2), position = _e[0], group = _e[1];
|
|
1326
|
+
var entry = shellSerialized[position];
|
|
1327
|
+
if (entry) {
|
|
1328
|
+
entry.group = group.toJSON();
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1333
|
+
finally {
|
|
1334
|
+
try {
|
|
1335
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1336
|
+
}
|
|
1337
|
+
finally { if (e_12) throw e_12.error; }
|
|
1338
|
+
}
|
|
1339
|
+
result.edgeGroups = shellSerialized;
|
|
1340
|
+
}
|
|
1063
1341
|
return result;
|
|
1064
1342
|
};
|
|
1065
1343
|
DockviewComponent.prototype.fromJSON = function (data, options) {
|
|
1066
|
-
var
|
|
1344
|
+
var e_13, _a, e_14, _b, e_15, _c, e_16, _d, e_17, _e, e_18, _f, e_19, _g, e_20, _h, e_21, _j, e_22, _k;
|
|
1067
1345
|
var _this = this;
|
|
1068
|
-
var
|
|
1346
|
+
var _l, _m, _o;
|
|
1069
1347
|
var existingPanels = new Map();
|
|
1070
1348
|
var tempGroup;
|
|
1071
1349
|
if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
|
|
@@ -1079,19 +1357,19 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1079
1357
|
this._groups.delete(tempGroup.api.id);
|
|
1080
1358
|
var newPanels = Object.keys(data.panels);
|
|
1081
1359
|
try {
|
|
1082
|
-
for (var
|
|
1083
|
-
var panel =
|
|
1360
|
+
for (var _p = __values(this.panels), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
1361
|
+
var panel = _q.value;
|
|
1084
1362
|
if (newPanels.includes(panel.api.id)) {
|
|
1085
1363
|
existingPanels.set(panel.api.id, panel);
|
|
1086
1364
|
}
|
|
1087
1365
|
}
|
|
1088
1366
|
}
|
|
1089
|
-
catch (
|
|
1367
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1090
1368
|
finally {
|
|
1091
1369
|
try {
|
|
1092
|
-
if (
|
|
1370
|
+
if (_q && !_q.done && (_a = _p.return)) _a.call(_p);
|
|
1093
1371
|
}
|
|
1094
|
-
finally { if (
|
|
1372
|
+
finally { if (e_13) throw e_13.error; }
|
|
1095
1373
|
}
|
|
1096
1374
|
this.movingLock(function () {
|
|
1097
1375
|
Array.from(existingPanels.values()).forEach(function (panel) {
|
|
@@ -1122,7 +1400,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1122
1400
|
var width = this.width;
|
|
1123
1401
|
var height = this.height;
|
|
1124
1402
|
var createGroupFromSerializedState_1 = function (data) {
|
|
1125
|
-
var
|
|
1403
|
+
var e_23, _a;
|
|
1126
1404
|
var id = data.id, locked = data.locked, hideHeader = data.hideHeader, headerPosition = data.headerPosition, views = data.views, activeView = data.activeView;
|
|
1127
1405
|
if (typeof id !== 'string') {
|
|
1128
1406
|
throw new Error('dockview: group id must be of type string');
|
|
@@ -1155,17 +1433,17 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1155
1433
|
}
|
|
1156
1434
|
};
|
|
1157
1435
|
try {
|
|
1158
|
-
for (var
|
|
1159
|
-
var child =
|
|
1436
|
+
for (var views_2 = __values(views), views_2_1 = views_2.next(); !views_2_1.done; views_2_1 = views_2.next()) {
|
|
1437
|
+
var child = views_2_1.value;
|
|
1160
1438
|
_loop_1(child);
|
|
1161
1439
|
}
|
|
1162
1440
|
}
|
|
1163
|
-
catch (
|
|
1441
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
1164
1442
|
finally {
|
|
1165
1443
|
try {
|
|
1166
|
-
if (
|
|
1444
|
+
if (views_2_1 && !views_2_1.done && (_a = views_2.return)) _a.call(views_2);
|
|
1167
1445
|
}
|
|
1168
|
-
finally { if (
|
|
1446
|
+
finally { if (e_23) throw e_23.error; }
|
|
1169
1447
|
}
|
|
1170
1448
|
var _loop_2 = function (i) {
|
|
1171
1449
|
var panel = createdPanels[i];
|
|
@@ -1190,6 +1468,11 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1190
1468
|
for (var i = 0; i < views.length; i++) {
|
|
1191
1469
|
_loop_2(i);
|
|
1192
1470
|
}
|
|
1471
|
+
// Restore tab groups before activating a fallback panel so
|
|
1472
|
+
// that collapsed groups can clear the active panel correctly.
|
|
1473
|
+
if (data.tabGroups && data.tabGroups.length > 0) {
|
|
1474
|
+
group.model.restoreTabGroups(data.tabGroups);
|
|
1475
|
+
}
|
|
1193
1476
|
if (!group.activePanel && group.panels.length > 0) {
|
|
1194
1477
|
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
1195
1478
|
skipSetGroupActive: true,
|
|
@@ -1202,8 +1485,89 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1202
1485
|
return createGroupFromSerializedState_1(node.data);
|
|
1203
1486
|
},
|
|
1204
1487
|
});
|
|
1205
|
-
this.
|
|
1206
|
-
|
|
1488
|
+
this._layoutFromShell(width, height);
|
|
1489
|
+
if (data.edgeGroups) {
|
|
1490
|
+
try {
|
|
1491
|
+
// Auto-create edge groups for positions in the serialized state
|
|
1492
|
+
// that don't already have a group registered (e.g. when fromJSON
|
|
1493
|
+
// is called before the user has called addEdgeGroup).
|
|
1494
|
+
for (var _r = __values([
|
|
1495
|
+
'top',
|
|
1496
|
+
'bottom',
|
|
1497
|
+
'left',
|
|
1498
|
+
'right',
|
|
1499
|
+
]), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
1500
|
+
var _position = _s.value;
|
|
1501
|
+
var fixedData = data.edgeGroups[_position];
|
|
1502
|
+
if (fixedData && !this._edgeGroups.has(_position)) {
|
|
1503
|
+
var groupState = fixedData.group;
|
|
1504
|
+
var id = (_l = groupState === null || groupState === void 0 ? void 0 : groupState.id) !== null && _l !== void 0 ? _l : "".concat(_position, "-group");
|
|
1505
|
+
this.addEdgeGroup(_position, { id: id });
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1510
|
+
finally {
|
|
1511
|
+
try {
|
|
1512
|
+
if (_s && !_s.done && (_b = _r.return)) _b.call(_r);
|
|
1513
|
+
}
|
|
1514
|
+
finally { if (e_14) throw e_14.error; }
|
|
1515
|
+
}
|
|
1516
|
+
try {
|
|
1517
|
+
// Restore panel contents of edge groups
|
|
1518
|
+
for (var _t = __values(this._edgeGroups), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
1519
|
+
var _v = __read(_u.value, 2), position = _v[0], edgeGroup = _v[1];
|
|
1520
|
+
var edgeData = data.edgeGroups[position];
|
|
1521
|
+
var groupState = edgeData === null || edgeData === void 0 ? void 0 : edgeData.group;
|
|
1522
|
+
if (groupState) {
|
|
1523
|
+
var views = groupState.views, activeView = groupState.activeView;
|
|
1524
|
+
var createdPanels = [];
|
|
1525
|
+
try {
|
|
1526
|
+
for (var views_1 = (e_16 = void 0, __values(views)), views_1_1 = views_1.next(); !views_1_1.done; views_1_1 = views_1.next()) {
|
|
1527
|
+
var panelId = views_1_1.value;
|
|
1528
|
+
if (panels[panelId]) {
|
|
1529
|
+
var panel = this._deserializer.fromJSON(panels[panelId], edgeGroup);
|
|
1530
|
+
createdPanels.push(panel);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
1535
|
+
finally {
|
|
1536
|
+
try {
|
|
1537
|
+
if (views_1_1 && !views_1_1.done && (_d = views_1.return)) _d.call(views_1);
|
|
1538
|
+
}
|
|
1539
|
+
finally { if (e_16) throw e_16.error; }
|
|
1540
|
+
}
|
|
1541
|
+
for (var i = 0; i < createdPanels.length; i++) {
|
|
1542
|
+
var panel = createdPanels[i];
|
|
1543
|
+
var isActive = activeView === panel.id;
|
|
1544
|
+
edgeGroup.model.openPanel(panel, {
|
|
1545
|
+
skipSetActive: !isActive,
|
|
1546
|
+
skipSetGroupActive: true,
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
// Restore tab groups before activating a fallback panel
|
|
1550
|
+
if (groupState.tabGroups &&
|
|
1551
|
+
groupState.tabGroups.length > 0) {
|
|
1552
|
+
edgeGroup.model.restoreTabGroups(groupState.tabGroups);
|
|
1553
|
+
}
|
|
1554
|
+
if (!edgeGroup.activePanel &&
|
|
1555
|
+
edgeGroup.panels.length > 0) {
|
|
1556
|
+
edgeGroup.model.openPanel(edgeGroup.panels[edgeGroup.panels.length - 1], { skipSetGroupActive: true });
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1562
|
+
finally {
|
|
1563
|
+
try {
|
|
1564
|
+
if (_u && !_u.done && (_c = _t.return)) _c.call(_t);
|
|
1565
|
+
}
|
|
1566
|
+
finally { if (e_15) throw e_15.error; }
|
|
1567
|
+
}
|
|
1568
|
+
this._shellManager.fromJSON(data.edgeGroups);
|
|
1569
|
+
}
|
|
1570
|
+
var serializedFloatingGroups = (_m = data.floatingGroups) !== null && _m !== void 0 ? _m : [];
|
|
1207
1571
|
try {
|
|
1208
1572
|
for (var serializedFloatingGroups_1 = __values(serializedFloatingGroups), serializedFloatingGroups_1_1 = serializedFloatingGroups_1.next(); !serializedFloatingGroups_1_1.done; serializedFloatingGroups_1_1 = serializedFloatingGroups_1.next()) {
|
|
1209
1573
|
var serializedFloatingGroup = serializedFloatingGroups_1_1.value;
|
|
@@ -1218,14 +1582,14 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1218
1582
|
});
|
|
1219
1583
|
}
|
|
1220
1584
|
}
|
|
1221
|
-
catch (
|
|
1585
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1222
1586
|
finally {
|
|
1223
1587
|
try {
|
|
1224
|
-
if (serializedFloatingGroups_1_1 && !serializedFloatingGroups_1_1.done && (
|
|
1588
|
+
if (serializedFloatingGroups_1_1 && !serializedFloatingGroups_1_1.done && (_e = serializedFloatingGroups_1.return)) _e.call(serializedFloatingGroups_1);
|
|
1225
1589
|
}
|
|
1226
|
-
finally { if (
|
|
1590
|
+
finally { if (e_17) throw e_17.error; }
|
|
1227
1591
|
}
|
|
1228
|
-
var serializedPopoutGroups = (
|
|
1592
|
+
var serializedPopoutGroups = (_o = data.popoutGroups) !== null && _o !== void 0 ? _o : [];
|
|
1229
1593
|
// Create a promise that resolves when all popout groups are created
|
|
1230
1594
|
var popoutPromises_1 = [];
|
|
1231
1595
|
// Queue popup group creation with delays to avoid browser blocking
|
|
@@ -1253,17 +1617,17 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1253
1617
|
// Store the promise for tests to wait on
|
|
1254
1618
|
this._popoutRestorationPromise = Promise.all(popoutPromises_1).then(function () { return void 0; });
|
|
1255
1619
|
try {
|
|
1256
|
-
for (var
|
|
1257
|
-
var floatingGroup =
|
|
1620
|
+
for (var _w = __values(this._floatingGroups), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1621
|
+
var floatingGroup = _x.value;
|
|
1258
1622
|
floatingGroup.overlay.setBounds();
|
|
1259
1623
|
}
|
|
1260
1624
|
}
|
|
1261
|
-
catch (
|
|
1625
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1262
1626
|
finally {
|
|
1263
1627
|
try {
|
|
1264
|
-
if (
|
|
1628
|
+
if (_x && !_x.done && (_f = _w.return)) _f.call(_w);
|
|
1265
1629
|
}
|
|
1266
|
-
finally { if (
|
|
1630
|
+
finally { if (e_18) throw e_18.error; }
|
|
1267
1631
|
}
|
|
1268
1632
|
if (typeof activeGroup === 'string') {
|
|
1269
1633
|
var panel = this.getPanel(activeGroup);
|
|
@@ -1278,65 +1642,65 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1278
1642
|
/**
|
|
1279
1643
|
* Takes all the successfully created groups and remove all of their panels.
|
|
1280
1644
|
*/
|
|
1281
|
-
for (var
|
|
1282
|
-
var group =
|
|
1645
|
+
for (var _y = __values(this.groups), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1646
|
+
var group = _z.value;
|
|
1283
1647
|
try {
|
|
1284
|
-
for (var
|
|
1285
|
-
var panel =
|
|
1648
|
+
for (var _0 = (e_20 = void 0, __values(group.panels)), _1 = _0.next(); !_1.done; _1 = _0.next()) {
|
|
1649
|
+
var panel = _1.value;
|
|
1286
1650
|
this.removePanel(panel, {
|
|
1287
1651
|
removeEmptyGroup: false,
|
|
1288
1652
|
skipDispose: false,
|
|
1289
1653
|
});
|
|
1290
1654
|
}
|
|
1291
1655
|
}
|
|
1292
|
-
catch (
|
|
1656
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
1293
1657
|
finally {
|
|
1294
1658
|
try {
|
|
1295
|
-
if (
|
|
1659
|
+
if (_1 && !_1.done && (_h = _0.return)) _h.call(_0);
|
|
1296
1660
|
}
|
|
1297
|
-
finally { if (
|
|
1661
|
+
finally { if (e_20) throw e_20.error; }
|
|
1298
1662
|
}
|
|
1299
1663
|
}
|
|
1300
1664
|
}
|
|
1301
|
-
catch (
|
|
1665
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
1302
1666
|
finally {
|
|
1303
1667
|
try {
|
|
1304
|
-
if (
|
|
1668
|
+
if (_z && !_z.done && (_g = _y.return)) _g.call(_y);
|
|
1305
1669
|
}
|
|
1306
|
-
finally { if (
|
|
1670
|
+
finally { if (e_19) throw e_19.error; }
|
|
1307
1671
|
}
|
|
1308
1672
|
try {
|
|
1309
1673
|
/**
|
|
1310
1674
|
* To remove a group we cannot call this.removeGroup(...) since this makes assumptions about
|
|
1311
1675
|
* the underlying HTMLElement existing in the Gridview.
|
|
1312
1676
|
*/
|
|
1313
|
-
for (var
|
|
1314
|
-
var group =
|
|
1677
|
+
for (var _2 = __values(this.groups), _3 = _2.next(); !_3.done; _3 = _2.next()) {
|
|
1678
|
+
var group = _3.value;
|
|
1315
1679
|
group.dispose();
|
|
1316
1680
|
this._groups.delete(group.id);
|
|
1317
1681
|
this._onDidRemoveGroup.fire(group);
|
|
1318
1682
|
}
|
|
1319
1683
|
}
|
|
1320
|
-
catch (
|
|
1684
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
1321
1685
|
finally {
|
|
1322
1686
|
try {
|
|
1323
|
-
if (
|
|
1687
|
+
if (_3 && !_3.done && (_j = _2.return)) _j.call(_2);
|
|
1324
1688
|
}
|
|
1325
|
-
finally { if (
|
|
1689
|
+
finally { if (e_21) throw e_21.error; }
|
|
1326
1690
|
}
|
|
1327
1691
|
try {
|
|
1328
1692
|
// iterate over a reassigned array since original array will be modified
|
|
1329
|
-
for (var
|
|
1330
|
-
var floatingGroup =
|
|
1693
|
+
for (var _4 = __values(__spreadArray([], __read(this._floatingGroups), false)), _5 = _4.next(); !_5.done; _5 = _4.next()) {
|
|
1694
|
+
var floatingGroup = _5.value;
|
|
1331
1695
|
floatingGroup.dispose();
|
|
1332
1696
|
}
|
|
1333
1697
|
}
|
|
1334
|
-
catch (
|
|
1698
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1335
1699
|
finally {
|
|
1336
1700
|
try {
|
|
1337
|
-
if (
|
|
1701
|
+
if (_5 && !_5.done && (_k = _4.return)) _k.call(_4);
|
|
1338
1702
|
}
|
|
1339
|
-
finally { if (
|
|
1703
|
+
finally { if (e_22) throw e_22.error; }
|
|
1340
1704
|
}
|
|
1341
1705
|
// fires clean-up events and clears the underlying HTML gridview.
|
|
1342
1706
|
this.clear();
|
|
@@ -1353,22 +1717,40 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1353
1717
|
this._onDidLayoutFromJSON.fire();
|
|
1354
1718
|
};
|
|
1355
1719
|
DockviewComponent.prototype.clear = function () {
|
|
1356
|
-
var
|
|
1720
|
+
var e_24, _a, e_25, _b;
|
|
1357
1721
|
var groups = Array.from(this._groups.values()).map(function (_) { return _.value; });
|
|
1358
1722
|
var hasActiveGroup = !!this.activeGroup;
|
|
1359
1723
|
try {
|
|
1360
1724
|
for (var groups_1 = __values(groups), groups_1_1 = groups_1.next(); !groups_1_1.done; groups_1_1 = groups_1.next()) {
|
|
1361
1725
|
var group = groups_1_1.value;
|
|
1726
|
+
if (__spreadArray([], __read(this._edgeGroups.values()), false).includes(group)) {
|
|
1727
|
+
// Edge groups are structural - only clear their panels, not the group itself
|
|
1728
|
+
var panels = __spreadArray([], __read(group.panels), false);
|
|
1729
|
+
try {
|
|
1730
|
+
for (var panels_1 = (e_25 = void 0, __values(panels)), panels_1_1 = panels_1.next(); !panels_1_1.done; panels_1_1 = panels_1.next()) {
|
|
1731
|
+
var panel = panels_1_1.value;
|
|
1732
|
+
this.removePanel(panel, { removeEmptyGroup: false });
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
1736
|
+
finally {
|
|
1737
|
+
try {
|
|
1738
|
+
if (panels_1_1 && !panels_1_1.done && (_b = panels_1.return)) _b.call(panels_1);
|
|
1739
|
+
}
|
|
1740
|
+
finally { if (e_25) throw e_25.error; }
|
|
1741
|
+
}
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1362
1744
|
// remove the group will automatically remove the panels
|
|
1363
1745
|
this.removeGroup(group, { skipActive: true });
|
|
1364
1746
|
}
|
|
1365
1747
|
}
|
|
1366
|
-
catch (
|
|
1748
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
1367
1749
|
finally {
|
|
1368
1750
|
try {
|
|
1369
1751
|
if (groups_1_1 && !groups_1_1.done && (_a = groups_1.return)) _a.call(groups_1);
|
|
1370
1752
|
}
|
|
1371
|
-
finally { if (
|
|
1753
|
+
finally { if (e_24) throw e_24.error; }
|
|
1372
1754
|
}
|
|
1373
1755
|
if (hasActiveGroup) {
|
|
1374
1756
|
this.doSetGroupAndPanelActive(undefined);
|
|
@@ -1376,7 +1758,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1376
1758
|
this.gridview.clear();
|
|
1377
1759
|
};
|
|
1378
1760
|
DockviewComponent.prototype.closeAllGroups = function () {
|
|
1379
|
-
var
|
|
1761
|
+
var e_26, _a;
|
|
1380
1762
|
try {
|
|
1381
1763
|
for (var _b = __values(this._groups.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1382
1764
|
var entry = _c.value;
|
|
@@ -1384,12 +1766,12 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1384
1766
|
group.value.model.closeAllPanels();
|
|
1385
1767
|
}
|
|
1386
1768
|
}
|
|
1387
|
-
catch (
|
|
1769
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
1388
1770
|
finally {
|
|
1389
1771
|
try {
|
|
1390
1772
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1391
1773
|
}
|
|
1392
|
-
finally { if (
|
|
1774
|
+
finally { if (e_26) throw e_26.error; }
|
|
1393
1775
|
}
|
|
1394
1776
|
};
|
|
1395
1777
|
DockviewComponent.prototype.addPanel = function (options) {
|
|
@@ -1467,6 +1849,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1467
1849
|
});
|
|
1468
1850
|
}
|
|
1469
1851
|
else if (referenceGroup.api.location.type === 'floating' ||
|
|
1852
|
+
referenceGroup.api.location.type === 'edge' ||
|
|
1470
1853
|
target === 'center') {
|
|
1471
1854
|
panel = this.createPanel(options, referenceGroup);
|
|
1472
1855
|
referenceGroup.model.openPanel(panel, {
|
|
@@ -1640,25 +2023,29 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1640
2023
|
this.doRemoveGroup(group, options);
|
|
1641
2024
|
};
|
|
1642
2025
|
DockviewComponent.prototype.doRemoveGroup = function (group, options) {
|
|
1643
|
-
var
|
|
2026
|
+
var e_27, _a;
|
|
1644
2027
|
var _b;
|
|
2028
|
+
// Edge groups are permanent structural elements - never remove them from the layout
|
|
2029
|
+
if (__spreadArray([], __read(this._edgeGroups.values()), false).includes(group)) {
|
|
2030
|
+
return group;
|
|
2031
|
+
}
|
|
1645
2032
|
var panels = __spreadArray([], __read(group.panels), false); // reassign since group panels will mutate
|
|
1646
2033
|
if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
1647
2034
|
try {
|
|
1648
|
-
for (var
|
|
1649
|
-
var panel =
|
|
2035
|
+
for (var panels_2 = __values(panels), panels_2_1 = panels_2.next(); !panels_2_1.done; panels_2_1 = panels_2.next()) {
|
|
2036
|
+
var panel = panels_2_1.value;
|
|
1650
2037
|
this.removePanel(panel, {
|
|
1651
2038
|
removeEmptyGroup: false,
|
|
1652
2039
|
skipDispose: (_b = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _b !== void 0 ? _b : false,
|
|
1653
2040
|
});
|
|
1654
2041
|
}
|
|
1655
2042
|
}
|
|
1656
|
-
catch (
|
|
2043
|
+
catch (e_27_1) { e_27 = { error: e_27_1 }; }
|
|
1657
2044
|
finally {
|
|
1658
2045
|
try {
|
|
1659
|
-
if (
|
|
2046
|
+
if (panels_2_1 && !panels_2_1.done && (_a = panels_2.return)) _a.call(panels_2);
|
|
1660
2047
|
}
|
|
1661
|
-
finally { if (
|
|
2048
|
+
finally { if (e_27) throw e_27.error; }
|
|
1662
2049
|
}
|
|
1663
2050
|
}
|
|
1664
2051
|
var activePanel = this.activePanel;
|
|
@@ -1754,17 +2141,33 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1754
2141
|
throw new Error("dockview: Failed to find group id ".concat(sourceGroupId));
|
|
1755
2142
|
}
|
|
1756
2143
|
if (sourceItemId === undefined) {
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
2144
|
+
if (options.from.tabGroupId) {
|
|
2145
|
+
/**
|
|
2146
|
+
* Moving a tab group (subset of panels) into another group
|
|
2147
|
+
*/
|
|
2148
|
+
this.moveTabGroupToGroup({
|
|
2149
|
+
sourceGroup: sourceGroup,
|
|
2150
|
+
tabGroupId: options.from.tabGroupId,
|
|
2151
|
+
destinationGroup: destinationGroup,
|
|
2152
|
+
destinationTarget: destinationTarget,
|
|
2153
|
+
destinationIndex: destinationIndex,
|
|
2154
|
+
skipSetActive: options.skipSetActive,
|
|
2155
|
+
keepEmptyGroups: options.keepEmptyGroups,
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
else {
|
|
2159
|
+
/**
|
|
2160
|
+
* Moving an entire group into another group
|
|
2161
|
+
*/
|
|
2162
|
+
this.moveGroup({
|
|
2163
|
+
from: { group: sourceGroup },
|
|
2164
|
+
to: {
|
|
2165
|
+
group: destinationGroup,
|
|
2166
|
+
position: destinationTarget,
|
|
2167
|
+
},
|
|
2168
|
+
skipSetActive: options.skipSetActive,
|
|
2169
|
+
});
|
|
2170
|
+
}
|
|
1768
2171
|
return;
|
|
1769
2172
|
}
|
|
1770
2173
|
if (!destinationTarget || destinationTarget === 'center') {
|
|
@@ -1860,6 +2263,34 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1860
2263
|
});
|
|
1861
2264
|
return;
|
|
1862
2265
|
}
|
|
2266
|
+
if (sourceGroup.api.location.type === 'edge') {
|
|
2267
|
+
/**
|
|
2268
|
+
* Edge groups are permanent structural elements — never move the
|
|
2269
|
+
* group itself. Instead extract the panel and create a new grid group,
|
|
2270
|
+
* leaving the edge slot intact (same behaviour as the size >= 2 path).
|
|
2271
|
+
*/
|
|
2272
|
+
var removedPanel_3 = this.movingLock(function () {
|
|
2273
|
+
return sourceGroup.model.removePanel(sourceItemId, {
|
|
2274
|
+
skipSetActive: false,
|
|
2275
|
+
skipSetActiveGroup: true,
|
|
2276
|
+
});
|
|
2277
|
+
});
|
|
2278
|
+
if (!removedPanel_3) {
|
|
2279
|
+
throw new Error("dockview: No panel with id ".concat(sourceItemId));
|
|
2280
|
+
}
|
|
2281
|
+
var newGroup_2 = this.createGroupAtLocation(targetLocation);
|
|
2282
|
+
this.movingLock(function () {
|
|
2283
|
+
return newGroup_2.model.openPanel(removedPanel_3, {
|
|
2284
|
+
skipSetGroupActive: true,
|
|
2285
|
+
});
|
|
2286
|
+
});
|
|
2287
|
+
this.doSetGroupAndPanelActive(newGroup_2);
|
|
2288
|
+
this._onDidMovePanel.fire({
|
|
2289
|
+
panel: removedPanel_3,
|
|
2290
|
+
from: sourceGroup,
|
|
2291
|
+
});
|
|
2292
|
+
return;
|
|
2293
|
+
}
|
|
1863
2294
|
// source group will become empty so delete the group
|
|
1864
2295
|
var targetGroup_1 = this.movingLock(function () {
|
|
1865
2296
|
return _this.doRemoveGroup(sourceGroup, {
|
|
@@ -1882,30 +2313,134 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1882
2313
|
* The group we are removing from has many panels, we need to remove the panels we are moving,
|
|
1883
2314
|
* create a new group, add the panels to that new group and add the new group in an appropiate position
|
|
1884
2315
|
*/
|
|
1885
|
-
var
|
|
2316
|
+
var removedPanel_4 = this.movingLock(function () {
|
|
1886
2317
|
return sourceGroup.model.removePanel(sourceItemId, {
|
|
1887
2318
|
skipSetActive: false,
|
|
1888
2319
|
skipSetActiveGroup: true,
|
|
1889
2320
|
});
|
|
1890
2321
|
});
|
|
1891
|
-
if (!
|
|
2322
|
+
if (!removedPanel_4) {
|
|
1892
2323
|
throw new Error("dockview: No panel with id ".concat(sourceItemId));
|
|
1893
2324
|
}
|
|
1894
2325
|
var dropLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
1895
2326
|
var group_2 = this.createGroupAtLocation(dropLocation);
|
|
1896
2327
|
this.movingLock(function () {
|
|
1897
|
-
return group_2.model.openPanel(
|
|
2328
|
+
return group_2.model.openPanel(removedPanel_4, {
|
|
1898
2329
|
skipSetGroupActive: true,
|
|
1899
2330
|
});
|
|
1900
2331
|
});
|
|
1901
2332
|
this.doSetGroupAndPanelActive(group_2);
|
|
1902
2333
|
this._onDidMovePanel.fire({
|
|
1903
|
-
panel:
|
|
2334
|
+
panel: removedPanel_4,
|
|
1904
2335
|
from: sourceGroup,
|
|
1905
2336
|
});
|
|
1906
2337
|
}
|
|
1907
2338
|
}
|
|
1908
2339
|
};
|
|
2340
|
+
DockviewComponent.prototype.moveTabGroupToGroup = function (options) {
|
|
2341
|
+
var _this = this;
|
|
2342
|
+
var sourceGroup = options.sourceGroup, tabGroupId = options.tabGroupId, destinationGroup = options.destinationGroup, destinationTarget = options.destinationTarget, destinationIndex = options.destinationIndex;
|
|
2343
|
+
var tabGroup = sourceGroup.model
|
|
2344
|
+
.getTabGroups()
|
|
2345
|
+
.find(function (tg) { return tg.id === tabGroupId; });
|
|
2346
|
+
if (!tabGroup || tabGroup.panelIds.length === 0) {
|
|
2347
|
+
return;
|
|
2348
|
+
}
|
|
2349
|
+
// Snapshot tab group metadata before removing panels
|
|
2350
|
+
var label = tabGroup.label;
|
|
2351
|
+
var color = tabGroup.color;
|
|
2352
|
+
var collapsed = tabGroup.collapsed;
|
|
2353
|
+
var panelIds = __spreadArray([], __read(tabGroup.panelIds), false);
|
|
2354
|
+
// Remove panels from the source group
|
|
2355
|
+
var removedPanels = this.movingLock(function () {
|
|
2356
|
+
return panelIds
|
|
2357
|
+
.map(function (pid) {
|
|
2358
|
+
return sourceGroup.model.removePanel(pid, {
|
|
2359
|
+
skipSetActive: false,
|
|
2360
|
+
skipSetActiveGroup: true,
|
|
2361
|
+
});
|
|
2362
|
+
})
|
|
2363
|
+
.filter(function (p) { return p !== undefined; });
|
|
2364
|
+
});
|
|
2365
|
+
if (removedPanels.length === 0) {
|
|
2366
|
+
return;
|
|
2367
|
+
}
|
|
2368
|
+
if (!options.keepEmptyGroups &&
|
|
2369
|
+
sourceGroup.model.size === 0 &&
|
|
2370
|
+
sourceGroup !== destinationGroup) {
|
|
2371
|
+
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
2372
|
+
}
|
|
2373
|
+
var addPanelsToGroup = function (targetGroup) {
|
|
2374
|
+
var e_28, _a, e_29, _b;
|
|
2375
|
+
_this.movingLock(function () {
|
|
2376
|
+
var e_30, _a;
|
|
2377
|
+
try {
|
|
2378
|
+
for (var removedPanels_3 = __values(removedPanels), removedPanels_3_1 = removedPanels_3.next(); !removedPanels_3_1.done; removedPanels_3_1 = removedPanels_3.next()) {
|
|
2379
|
+
var panel = removedPanels_3_1.value;
|
|
2380
|
+
targetGroup.model.openPanel(panel, {
|
|
2381
|
+
index: destinationIndex,
|
|
2382
|
+
skipSetActive: true,
|
|
2383
|
+
skipSetGroupActive: true,
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
2388
|
+
finally {
|
|
2389
|
+
try {
|
|
2390
|
+
if (removedPanels_3_1 && !removedPanels_3_1.done && (_a = removedPanels_3.return)) _a.call(removedPanels_3);
|
|
2391
|
+
}
|
|
2392
|
+
finally { if (e_30) throw e_30.error; }
|
|
2393
|
+
}
|
|
2394
|
+
});
|
|
2395
|
+
// Recreate the tab group in the destination
|
|
2396
|
+
var newTabGroup = targetGroup.model.createTabGroup({
|
|
2397
|
+
label: label,
|
|
2398
|
+
color: color,
|
|
2399
|
+
collapsed: collapsed,
|
|
2400
|
+
});
|
|
2401
|
+
try {
|
|
2402
|
+
for (var removedPanels_1 = __values(removedPanels), removedPanels_1_1 = removedPanels_1.next(); !removedPanels_1_1.done; removedPanels_1_1 = removedPanels_1.next()) {
|
|
2403
|
+
var panel = removedPanels_1_1.value;
|
|
2404
|
+
targetGroup.model.addPanelToTabGroup(newTabGroup.id, panel.id);
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
2408
|
+
finally {
|
|
2409
|
+
try {
|
|
2410
|
+
if (removedPanels_1_1 && !removedPanels_1_1.done && (_a = removedPanels_1.return)) _a.call(removedPanels_1);
|
|
2411
|
+
}
|
|
2412
|
+
finally { if (e_28) throw e_28.error; }
|
|
2413
|
+
}
|
|
2414
|
+
if (!options.skipSetActive) {
|
|
2415
|
+
_this.doSetGroupAndPanelActive(targetGroup);
|
|
2416
|
+
}
|
|
2417
|
+
try {
|
|
2418
|
+
for (var removedPanels_2 = __values(removedPanels), removedPanels_2_1 = removedPanels_2.next(); !removedPanels_2_1.done; removedPanels_2_1 = removedPanels_2.next()) {
|
|
2419
|
+
var panel = removedPanels_2_1.value;
|
|
2420
|
+
_this._onDidMovePanel.fire({
|
|
2421
|
+
panel: panel,
|
|
2422
|
+
from: sourceGroup,
|
|
2423
|
+
});
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
2427
|
+
finally {
|
|
2428
|
+
try {
|
|
2429
|
+
if (removedPanels_2_1 && !removedPanels_2_1.done && (_b = removedPanels_2.return)) _b.call(removedPanels_2);
|
|
2430
|
+
}
|
|
2431
|
+
finally { if (e_29) throw e_29.error; }
|
|
2432
|
+
}
|
|
2433
|
+
};
|
|
2434
|
+
if (!destinationTarget || destinationTarget === 'center') {
|
|
2435
|
+
addPanelsToGroup(destinationGroup);
|
|
2436
|
+
}
|
|
2437
|
+
else {
|
|
2438
|
+
var referenceLocation = (0, gridview_1.getGridLocation)(destinationGroup.element);
|
|
2439
|
+
var dropLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
2440
|
+
var newGroup = this.createGroupAtLocation(dropLocation);
|
|
2441
|
+
addPanelsToGroup(newGroup);
|
|
2442
|
+
}
|
|
2443
|
+
};
|
|
1909
2444
|
DockviewComponent.prototype.moveGroup = function (options) {
|
|
1910
2445
|
var _this = this;
|
|
1911
2446
|
var from = options.from.group;
|
|
@@ -1913,7 +2448,7 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1913
2448
|
var target = options.to.position;
|
|
1914
2449
|
if (target === 'center') {
|
|
1915
2450
|
var activePanel_1 = from.activePanel;
|
|
1916
|
-
var
|
|
2451
|
+
var panels_3 = this.movingLock(function () {
|
|
1917
2452
|
return __spreadArray([], __read(from.panels), false).map(function (p) {
|
|
1918
2453
|
return from.model.removePanel(p.id, {
|
|
1919
2454
|
skipSetActive: true,
|
|
@@ -1924,22 +2459,22 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1924
2459
|
this.doRemoveGroup(from, { skipActive: true });
|
|
1925
2460
|
}
|
|
1926
2461
|
this.movingLock(function () {
|
|
1927
|
-
var
|
|
2462
|
+
var e_31, _a;
|
|
1928
2463
|
try {
|
|
1929
|
-
for (var
|
|
1930
|
-
var panel =
|
|
2464
|
+
for (var panels_4 = __values(panels_3), panels_4_1 = panels_4.next(); !panels_4_1.done; panels_4_1 = panels_4.next()) {
|
|
2465
|
+
var panel = panels_4_1.value;
|
|
1931
2466
|
to.model.openPanel(panel, {
|
|
1932
2467
|
skipSetActive: panel !== activePanel_1,
|
|
1933
2468
|
skipSetGroupActive: true,
|
|
1934
2469
|
});
|
|
1935
2470
|
}
|
|
1936
2471
|
}
|
|
1937
|
-
catch (
|
|
2472
|
+
catch (e_31_1) { e_31 = { error: e_31_1 }; }
|
|
1938
2473
|
finally {
|
|
1939
2474
|
try {
|
|
1940
|
-
if (
|
|
2475
|
+
if (panels_4_1 && !panels_4_1.done && (_a = panels_4.return)) _a.call(panels_4);
|
|
1941
2476
|
}
|
|
1942
|
-
finally { if (
|
|
2477
|
+
finally { if (e_31) throw e_31.error; }
|
|
1943
2478
|
}
|
|
1944
2479
|
});
|
|
1945
2480
|
// Ensure group becomes active after move
|
|
@@ -2129,9 +2664,13 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2129
2664
|
}), view.model.onGroupDragStart(function (event) {
|
|
2130
2665
|
_this._onWillDragGroup.fire(event);
|
|
2131
2666
|
}), view.model.onMove(function (event) {
|
|
2132
|
-
var groupId = event.groupId, itemId = event.itemId, target = event.target, index = event.index;
|
|
2667
|
+
var groupId = event.groupId, itemId = event.itemId, target = event.target, index = event.index, tabGroupId = event.tabGroupId;
|
|
2133
2668
|
_this.moveGroupOrPanel({
|
|
2134
|
-
from: {
|
|
2669
|
+
from: {
|
|
2670
|
+
groupId: groupId,
|
|
2671
|
+
panelId: itemId,
|
|
2672
|
+
tabGroupId: tabGroupId,
|
|
2673
|
+
},
|
|
2135
2674
|
to: {
|
|
2136
2675
|
group: view,
|
|
2137
2676
|
position: target,
|
|
@@ -2170,6 +2709,18 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2170
2709
|
if (_this._onDidActivePanelChange.value !== event.panel) {
|
|
2171
2710
|
_this._onDidActivePanelChange.fire(event.panel);
|
|
2172
2711
|
}
|
|
2712
|
+
}), view.model.onDidCreateTabGroup(function (e) {
|
|
2713
|
+
_this._onDidCreateTabGroup.fire(e);
|
|
2714
|
+
}), view.model.onDidDestroyTabGroup(function (e) {
|
|
2715
|
+
_this._onDidDestroyTabGroup.fire(e);
|
|
2716
|
+
}), view.model.onDidAddPanelToTabGroup(function (e) {
|
|
2717
|
+
_this._onDidAddPanelToTabGroup.fire(e);
|
|
2718
|
+
}), view.model.onDidRemovePanelFromTabGroup(function (e) {
|
|
2719
|
+
_this._onDidRemovePanelFromTabGroup.fire(e);
|
|
2720
|
+
}), view.model.onDidTabGroupChange(function (e) {
|
|
2721
|
+
_this._onDidTabGroupChange.fire(e);
|
|
2722
|
+
}), view.model.onDidTabGroupCollapsedChange(function (e) {
|
|
2723
|
+
_this._onDidTabGroupCollapsedChange.fire(e);
|
|
2173
2724
|
}), events_1.Event.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(function () {
|
|
2174
2725
|
_this._bufferOnDidLayoutChange.fire();
|
|
2175
2726
|
}));
|
|
@@ -2232,10 +2783,24 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2232
2783
|
}
|
|
2233
2784
|
};
|
|
2234
2785
|
DockviewComponent.prototype.updateTheme = function () {
|
|
2235
|
-
var
|
|
2236
|
-
var
|
|
2237
|
-
this.
|
|
2238
|
-
|
|
2786
|
+
var e_32, _a;
|
|
2787
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2788
|
+
var theme = (_b = this._options.theme) !== null && _b !== void 0 ? _b : theme_1.themeAbyss;
|
|
2789
|
+
// Apply the theme class only to the shell so edge groups and the
|
|
2790
|
+
// main grid both inherit its CSS custom properties via the cascade.
|
|
2791
|
+
// Re-declaring it on `.dv-dockview` would block consumer overrides
|
|
2792
|
+
// set on the shell from reaching the dockview subtree.
|
|
2793
|
+
(_c = this._shellThemeClassnames) === null || _c === void 0 ? void 0 : _c.setClassNames(theme.className);
|
|
2794
|
+
this.gridview.margin = (_d = theme.gap) !== null && _d !== void 0 ? _d : 0;
|
|
2795
|
+
(_e = this._shellManager) === null || _e === void 0 ? void 0 : _e.updateTheme((_f = theme.gap) !== null && _f !== void 0 ? _f : 0, (_g = theme.edgeGroupCollapsedSize) !== null && _g !== void 0 ? _g : 35);
|
|
2796
|
+
if (theme.dndOverlayBorder !== undefined) {
|
|
2797
|
+
this.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);
|
|
2798
|
+
(_h = this._shellManager) === null || _h === void 0 ? void 0 : _h.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);
|
|
2799
|
+
}
|
|
2800
|
+
else {
|
|
2801
|
+
this.element.style.removeProperty('--dv-drag-over-border');
|
|
2802
|
+
(_j = this._shellManager) === null || _j === void 0 ? void 0 : _j.element.style.removeProperty('--dv-drag-over-border');
|
|
2803
|
+
}
|
|
2239
2804
|
switch (theme.dndOverlayMounting) {
|
|
2240
2805
|
case 'absolute':
|
|
2241
2806
|
this.rootDropTargetContainer.disabled = false;
|
|
@@ -2245,6 +2810,27 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
2245
2810
|
this.rootDropTargetContainer.disabled = true;
|
|
2246
2811
|
break;
|
|
2247
2812
|
}
|
|
2813
|
+
// Toggle a CSS class so theme stylesheets can scope pure-CSS
|
|
2814
|
+
// tab group indicator rules to the 'none' mode only.
|
|
2815
|
+
var indicatorNone = ((_k = theme.tabGroupIndicator) !== null && _k !== void 0 ? _k : 'wrap') === 'none';
|
|
2816
|
+
(0, dom_1.toggleClass)(this.element, 'dv-tab-group-indicator-none', indicatorNone);
|
|
2817
|
+
if (this._shellManager) {
|
|
2818
|
+
(0, dom_1.toggleClass)(this._shellManager.element, 'dv-tab-group-indicator-none', indicatorNone);
|
|
2819
|
+
}
|
|
2820
|
+
try {
|
|
2821
|
+
// Re-render tab group indicators so the new tabGroupIndicator mode takes effect
|
|
2822
|
+
for (var _l = __values(this.groups), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
2823
|
+
var group = _m.value;
|
|
2824
|
+
group.model.updateTabGroups();
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
catch (e_32_1) { e_32 = { error: e_32_1 }; }
|
|
2828
|
+
finally {
|
|
2829
|
+
try {
|
|
2830
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
2831
|
+
}
|
|
2832
|
+
finally { if (e_32) throw e_32.error; }
|
|
2833
|
+
}
|
|
2248
2834
|
};
|
|
2249
2835
|
return DockviewComponent;
|
|
2250
2836
|
}(baseComponentGridview_1.BaseGrid));
|