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
|
@@ -14,6 +14,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __values = (this && this.__values) || function(o) {
|
|
18
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
19
|
+
if (m) return m.call(o);
|
|
20
|
+
if (o && typeof o.length === "number") return {
|
|
21
|
+
next: function () {
|
|
22
|
+
if (o && i >= o.length) o = void 0;
|
|
23
|
+
return { value: o && o[i++], done: !o };
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
27
|
+
};
|
|
17
28
|
var __read = (this && this.__read) || function (o, n) {
|
|
18
29
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
30
|
if (!m) return o;
|
|
@@ -39,17 +50,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
39
50
|
}
|
|
40
51
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
52
|
};
|
|
42
|
-
var __values = (this && this.__values) || function(o) {
|
|
43
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
44
|
-
if (m) return m.call(o);
|
|
45
|
-
if (o && typeof o.length === "number") return {
|
|
46
|
-
next: function () {
|
|
47
|
-
if (o && i >= o.length) o = void 0;
|
|
48
|
-
return { value: o && o[i++], done: !o };
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
52
|
-
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
54
|
exports.DockviewGroupPanelModel = exports.DockviewWillDropEvent = exports.DockviewDidDropEvent = void 0;
|
|
55
55
|
var component_api_1 = require("../api/component.api");
|
|
@@ -61,6 +61,7 @@ var lifecycle_1 = require("../lifecycle");
|
|
|
61
61
|
var content_1 = require("./components/panel/content");
|
|
62
62
|
var tabsContainer_1 = require("./components/titlebar/tabsContainer");
|
|
63
63
|
var options_1 = require("./options");
|
|
64
|
+
var tabGroup_1 = require("./tabGroup");
|
|
64
65
|
var DockviewDidDropEvent = /** @class */ (function (_super) {
|
|
65
66
|
__extends(DockviewDidDropEvent, _super);
|
|
66
67
|
function DockviewDidDropEvent(options) {
|
|
@@ -151,6 +152,8 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
151
152
|
_this._height = 0;
|
|
152
153
|
_this._panels = [];
|
|
153
154
|
_this._panelDisposables = new Map();
|
|
155
|
+
_this._tabGroupDisposables = new Map();
|
|
156
|
+
_this._pendingMicrotaskDisposables = new Set();
|
|
154
157
|
_this._onMove = new events_1.Emitter();
|
|
155
158
|
_this.onMove = _this._onMove.event;
|
|
156
159
|
_this._onDidDrop = new events_1.Emitter();
|
|
@@ -175,6 +178,23 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
175
178
|
_this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
|
|
176
179
|
_this._onUnhandledDragOverEvent = new events_1.Emitter();
|
|
177
180
|
_this.onUnhandledDragOverEvent = _this._onUnhandledDragOverEvent.event;
|
|
181
|
+
_this._tabGroups = [];
|
|
182
|
+
_this._tabGroupMap = new Map();
|
|
183
|
+
_this._panelToTabGroup = new Map();
|
|
184
|
+
_this._tabGroupIdCounter = 0;
|
|
185
|
+
_this._pendingTabGroupUpdate = false;
|
|
186
|
+
_this._onDidCreateTabGroup = new events_1.Emitter();
|
|
187
|
+
_this.onDidCreateTabGroup = _this._onDidCreateTabGroup.event;
|
|
188
|
+
_this._onDidDestroyTabGroup = new events_1.Emitter();
|
|
189
|
+
_this.onDidDestroyTabGroup = _this._onDidDestroyTabGroup.event;
|
|
190
|
+
_this._onDidAddPanelToTabGroup = new events_1.Emitter();
|
|
191
|
+
_this.onDidAddPanelToTabGroup = _this._onDidAddPanelToTabGroup.event;
|
|
192
|
+
_this._onDidRemovePanelFromTabGroup = new events_1.Emitter();
|
|
193
|
+
_this.onDidRemovePanelFromTabGroup = _this._onDidRemovePanelFromTabGroup.event;
|
|
194
|
+
_this._onDidTabGroupChange = new events_1.Emitter();
|
|
195
|
+
_this.onDidTabGroupChange = _this._onDidTabGroupChange.event;
|
|
196
|
+
_this._onDidTabGroupCollapsedChange = new events_1.Emitter();
|
|
197
|
+
_this.onDidTabGroupCollapsedChange = _this._onDidTabGroupCollapsedChange.event;
|
|
178
198
|
(0, dom_1.toggleClass)(_this.container, 'dv-groupview', true);
|
|
179
199
|
_this._api = new component_api_1.DockviewApi(_this.accessor);
|
|
180
200
|
_this.tabsContainer = new tabsContainer_1.TabsContainer(_this.accessor, _this.groupPanel);
|
|
@@ -189,7 +209,52 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
189
209
|
}), _this.tabsContainer.onGroupDragStart(function (event) {
|
|
190
210
|
_this._onGroupDragStart.fire(event);
|
|
191
211
|
}), _this.tabsContainer.onDrop(function (event) {
|
|
212
|
+
var e_1, _a;
|
|
213
|
+
var _b;
|
|
214
|
+
// Capture panel data before handleDropEvent (which may trigger moves)
|
|
215
|
+
var dragData = (0, dataTransfer_1.getPanelData)();
|
|
216
|
+
var draggedPanelId = (_b = dragData === null || dragData === void 0 ? void 0 : dragData.panelId) !== null && _b !== void 0 ? _b : null;
|
|
192
217
|
_this.handleDropEvent('header', event.event, 'center', event.index);
|
|
218
|
+
// Update tab group membership after the move completes
|
|
219
|
+
if (draggedPanelId && event.targetTabGroupId) {
|
|
220
|
+
// Compute the local index within the target tab group
|
|
221
|
+
// from the global panel index so the panel is inserted
|
|
222
|
+
// at the correct position, not just appended.
|
|
223
|
+
var tabGroup = _this._tabGroupMap.get(event.targetTabGroupId);
|
|
224
|
+
var localIndex = void 0;
|
|
225
|
+
if (tabGroup) {
|
|
226
|
+
var globalIdx = _this._panels.findIndex(function (p) { return p.id === draggedPanelId; });
|
|
227
|
+
if (globalIdx !== -1) {
|
|
228
|
+
// Count how many of this group's panels
|
|
229
|
+
// appear before the dragged panel
|
|
230
|
+
localIndex = 0;
|
|
231
|
+
var _loop_1 = function (pid) {
|
|
232
|
+
var pidIdx = _this._panels.findIndex(function (p) { return p.id === pid; });
|
|
233
|
+
if (pidIdx < globalIdx) {
|
|
234
|
+
localIndex++;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
try {
|
|
238
|
+
for (var _c = __values(tabGroup.panelIds), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
239
|
+
var pid = _d.value;
|
|
240
|
+
_loop_1(pid);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
244
|
+
finally {
|
|
245
|
+
try {
|
|
246
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
247
|
+
}
|
|
248
|
+
finally { if (e_1) throw e_1.error; }
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
_this.addPanelToTabGroup(event.targetTabGroupId, draggedPanelId, localIndex);
|
|
253
|
+
}
|
|
254
|
+
else if (draggedPanelId && event.targetTabGroupId === null) {
|
|
255
|
+
// Dropped outside any group — remove from current group
|
|
256
|
+
_this.removePanelFromTabGroup(draggedPanelId);
|
|
257
|
+
}
|
|
193
258
|
}), _this.contentContainer.onDidFocus(function () {
|
|
194
259
|
_this.accessor.doSetGroupActive(_this.groupPanel);
|
|
195
260
|
}), _this.contentContainer.onDidBlur(function () {
|
|
@@ -206,9 +271,28 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
206
271
|
group: _this.groupPanel,
|
|
207
272
|
getData: dataTransfer_1.getPanelData,
|
|
208
273
|
}));
|
|
209
|
-
}), _this._onMove, _this._onDidChange, _this._onDidDrop, _this._onWillDrop, _this._onDidAddPanel, _this._onDidRemovePanel, _this._onDidActivePanelChange, _this._onUnhandledDragOverEvent, _this._onDidPanelTitleChange, _this._onDidPanelParametersChange)
|
|
274
|
+
}), _this._onMove, _this._onDidChange, _this._onDidDrop, _this._onWillDrop, _this._onDidAddPanel, _this._onDidRemovePanel, _this._onDidActivePanelChange, _this._onUnhandledDragOverEvent, _this._onDidPanelTitleChange, _this._onDidPanelParametersChange, _this._onDidCreateTabGroup, _this._onDidDestroyTabGroup, _this._onDidAddPanelToTabGroup, _this._onDidRemovePanelFromTabGroup, _this._onDidTabGroupChange, _this._onDidTabGroupCollapsedChange, _this._onDidCreateTabGroup.event(function () {
|
|
275
|
+
_this._scheduleTabGroupUpdate();
|
|
276
|
+
}), _this._onDidDestroyTabGroup.event(function () {
|
|
277
|
+
_this._scheduleTabGroupUpdate();
|
|
278
|
+
}), _this._onDidAddPanelToTabGroup.event(function () {
|
|
279
|
+
_this._scheduleTabGroupUpdate();
|
|
280
|
+
}), _this._onDidRemovePanelFromTabGroup.event(function () {
|
|
281
|
+
_this._scheduleTabGroupUpdate();
|
|
282
|
+
}), _this._onDidTabGroupChange.event(function () {
|
|
283
|
+
_this._scheduleTabGroupUpdate();
|
|
284
|
+
}), _this._onDidTabGroupCollapsedChange.event(function () {
|
|
285
|
+
_this._scheduleTabGroupUpdate();
|
|
286
|
+
}));
|
|
210
287
|
return _this;
|
|
211
288
|
}
|
|
289
|
+
Object.defineProperty(DockviewGroupPanelModel.prototype, "tabGroups", {
|
|
290
|
+
get: function () {
|
|
291
|
+
return this._tabGroups;
|
|
292
|
+
},
|
|
293
|
+
enumerable: false,
|
|
294
|
+
configurable: true
|
|
295
|
+
});
|
|
212
296
|
Object.defineProperty(DockviewGroupPanelModel.prototype, "element", {
|
|
213
297
|
get: function () {
|
|
214
298
|
throw new Error('dockview: not supported');
|
|
@@ -321,6 +405,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
321
405
|
this._location = value;
|
|
322
406
|
(0, dom_1.toggleClass)(this.container, 'dv-groupview-floating', false);
|
|
323
407
|
(0, dom_1.toggleClass)(this.container, 'dv-groupview-popout', false);
|
|
408
|
+
(0, dom_1.toggleClass)(this.container, 'dv-groupview-edge', false);
|
|
324
409
|
switch (value.type) {
|
|
325
410
|
case 'grid':
|
|
326
411
|
this.contentContainer.dropTarget.setTargetZones([
|
|
@@ -342,6 +427,10 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
342
427
|
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
343
428
|
(0, dom_1.toggleClass)(this.container, 'dv-groupview-popout', true);
|
|
344
429
|
break;
|
|
430
|
+
case 'edge':
|
|
431
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
432
|
+
(0, dom_1.toggleClass)(this.container, 'dv-groupview-edge', true);
|
|
433
|
+
break;
|
|
345
434
|
}
|
|
346
435
|
this.groupPanel.api._onDidLocationChange.fire({
|
|
347
436
|
location: this.location,
|
|
@@ -350,6 +439,452 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
350
439
|
enumerable: false,
|
|
351
440
|
configurable: true
|
|
352
441
|
});
|
|
442
|
+
DockviewGroupPanelModel.prototype._scheduleTabGroupUpdate = function () {
|
|
443
|
+
var _this = this;
|
|
444
|
+
if (this._pendingTabGroupUpdate) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
this._pendingTabGroupUpdate = true;
|
|
448
|
+
queueMicrotask(function () {
|
|
449
|
+
_this._pendingTabGroupUpdate = false;
|
|
450
|
+
if (!_this.isDisposed) {
|
|
451
|
+
_this.tabsContainer.updateTabGroups();
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
DockviewGroupPanelModel.prototype.createTabGroup = function (options) {
|
|
456
|
+
var _this = this;
|
|
457
|
+
var _a;
|
|
458
|
+
var id = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : "tg-".concat(this.id, "-").concat(this._tabGroupIdCounter++);
|
|
459
|
+
var tabGroup = new tabGroup_1.TabGroup(id, {
|
|
460
|
+
label: options === null || options === void 0 ? void 0 : options.label,
|
|
461
|
+
color: options === null || options === void 0 ? void 0 : options.color,
|
|
462
|
+
collapsed: options === null || options === void 0 ? void 0 : options.collapsed,
|
|
463
|
+
componentParams: options === null || options === void 0 ? void 0 : options.componentParams,
|
|
464
|
+
});
|
|
465
|
+
this._tabGroups.push(tabGroup);
|
|
466
|
+
this._tabGroupMap.set(id, tabGroup);
|
|
467
|
+
this._tabGroupDisposables.set(id, new lifecycle_1.CompositeDisposable(tabGroup.onDidChange(function () {
|
|
468
|
+
_this._onDidTabGroupChange.fire({ tabGroup: tabGroup });
|
|
469
|
+
}), tabGroup.onDidCollapseChange(function (isCollapsed) {
|
|
470
|
+
if (isCollapsed) {
|
|
471
|
+
_this._handleGroupCollapse(tabGroup);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
_this._handleGroupExpand(tabGroup);
|
|
475
|
+
}
|
|
476
|
+
_this._onDidTabGroupCollapsedChange.fire({
|
|
477
|
+
tabGroup: tabGroup,
|
|
478
|
+
});
|
|
479
|
+
}), tabGroup.onDidDestroy(function () {
|
|
480
|
+
_this._removeTabGroupInternal(tabGroup);
|
|
481
|
+
})));
|
|
482
|
+
this._onDidCreateTabGroup.fire({ tabGroup: tabGroup });
|
|
483
|
+
return tabGroup;
|
|
484
|
+
};
|
|
485
|
+
DockviewGroupPanelModel.prototype.dissolveTabGroup = function (tabGroupId) {
|
|
486
|
+
var e_2, _a;
|
|
487
|
+
var tabGroup = this._tabGroupMap.get(tabGroupId);
|
|
488
|
+
if (!tabGroup) {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
// Remove all panels from the group (they stay in the flat panel list)
|
|
492
|
+
var panelIds = __spreadArray([], __read(tabGroup.panelIds), false);
|
|
493
|
+
try {
|
|
494
|
+
for (var panelIds_1 = __values(panelIds), panelIds_1_1 = panelIds_1.next(); !panelIds_1_1.done; panelIds_1_1 = panelIds_1.next()) {
|
|
495
|
+
var panelId = panelIds_1_1.value;
|
|
496
|
+
tabGroup.removePanel(panelId);
|
|
497
|
+
this._panelToTabGroup.delete(panelId);
|
|
498
|
+
this._onDidRemovePanelFromTabGroup.fire({ tabGroup: tabGroup, panelId: panelId });
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
502
|
+
finally {
|
|
503
|
+
try {
|
|
504
|
+
if (panelIds_1_1 && !panelIds_1_1.done && (_a = panelIds_1.return)) _a.call(panelIds_1);
|
|
505
|
+
}
|
|
506
|
+
finally { if (e_2) throw e_2.error; }
|
|
507
|
+
}
|
|
508
|
+
tabGroup.dispose();
|
|
509
|
+
};
|
|
510
|
+
DockviewGroupPanelModel.prototype.addPanelToTabGroup = function (tabGroupId, panelId, index) {
|
|
511
|
+
var tabGroup = this._tabGroupMap.get(tabGroupId);
|
|
512
|
+
if (!tabGroup) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
// Ensure the panel actually exists in this group model
|
|
516
|
+
if (!this._panels.some(function (p) { return p.id === panelId; })) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
// Remove from any existing group first
|
|
520
|
+
var existingGroup = this.getTabGroupForPanel(panelId);
|
|
521
|
+
if (existingGroup) {
|
|
522
|
+
if (existingGroup.id === tabGroupId) {
|
|
523
|
+
return; // already in this group
|
|
524
|
+
}
|
|
525
|
+
this.removePanelFromTabGroup(panelId);
|
|
526
|
+
}
|
|
527
|
+
tabGroup.addPanel(panelId, index);
|
|
528
|
+
this._panelToTabGroup.set(panelId, tabGroup);
|
|
529
|
+
// Enforce contiguity: move the panel in the flat _panels array
|
|
530
|
+
// to the correct global position matching its group-local index
|
|
531
|
+
this._enforceContiguity(tabGroup, panelId);
|
|
532
|
+
this._onDidAddPanelToTabGroup.fire({ tabGroup: tabGroup, panelId: panelId });
|
|
533
|
+
};
|
|
534
|
+
/**
|
|
535
|
+
* Move a panel to a new index within its tab group.
|
|
536
|
+
* Updates both the group's panelIds order and the flat _panels array.
|
|
537
|
+
*/
|
|
538
|
+
DockviewGroupPanelModel.prototype.movePanelWithinGroup = function (tabGroupId, panelId, newIndex) {
|
|
539
|
+
var tabGroup = this._tabGroupMap.get(tabGroupId);
|
|
540
|
+
if (!tabGroup || !tabGroup.containsPanel(panelId)) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
// Remove and re-add at new index within the group
|
|
544
|
+
tabGroup.removePanel(panelId);
|
|
545
|
+
tabGroup.addPanel(panelId, newIndex);
|
|
546
|
+
// Re-enforce contiguity in the flat array
|
|
547
|
+
this._enforceContiguity(tabGroup, panelId);
|
|
548
|
+
this.tabsContainer.updateTabGroups();
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* Move a panel from one tab group to another.
|
|
552
|
+
*/
|
|
553
|
+
DockviewGroupPanelModel.prototype.movePanelBetweenGroups = function (sourcePanelId, targetTabGroupId, targetIndex) {
|
|
554
|
+
var sourceGroup = this._findTabGroupForPanel(sourcePanelId);
|
|
555
|
+
var targetGroup = this._tabGroupMap.get(targetTabGroupId);
|
|
556
|
+
if (!targetGroup) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (sourceGroup) {
|
|
560
|
+
sourceGroup.removePanel(sourcePanelId);
|
|
561
|
+
this._panelToTabGroup.delete(sourcePanelId);
|
|
562
|
+
this._onDidRemovePanelFromTabGroup.fire({
|
|
563
|
+
tabGroup: sourceGroup,
|
|
564
|
+
panelId: sourcePanelId,
|
|
565
|
+
});
|
|
566
|
+
// Auto-destroy empty source group
|
|
567
|
+
if (sourceGroup.isEmpty) {
|
|
568
|
+
sourceGroup.dispose();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
targetGroup.addPanel(sourcePanelId, targetIndex);
|
|
572
|
+
this._panelToTabGroup.set(sourcePanelId, targetGroup);
|
|
573
|
+
this._enforceContiguity(targetGroup, sourcePanelId);
|
|
574
|
+
this._onDidAddPanelToTabGroup.fire({
|
|
575
|
+
tabGroup: targetGroup,
|
|
576
|
+
panelId: sourcePanelId,
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* Move an entire tab group to a new position in the tab bar.
|
|
581
|
+
* The group's internal panel order is preserved.
|
|
582
|
+
*/
|
|
583
|
+
DockviewGroupPanelModel.prototype.moveTabGroup = function (tabGroupId, targetIndex) {
|
|
584
|
+
var e_3, _a, _b, e_4, _c;
|
|
585
|
+
var _this = this;
|
|
586
|
+
var tabGroup = this._tabGroupMap.get(tabGroupId);
|
|
587
|
+
if (!tabGroup || tabGroup.panelIds.length === 0) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
// Collect group panels in their current order
|
|
591
|
+
var groupPanelIds = new Set(tabGroup.panelIds);
|
|
592
|
+
var groupPanels = tabGroup.panelIds
|
|
593
|
+
.map(function (pid) { return _this._panels.find(function (p) { return p.id === pid; }); })
|
|
594
|
+
.filter(function (p) { return p !== undefined; });
|
|
595
|
+
if (groupPanels.length === 0) {
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
// Count how many group panels sit before the target index so
|
|
599
|
+
// we can compensate after removing them from the array.
|
|
600
|
+
var groupPanelsBefore = 0;
|
|
601
|
+
for (var i = 0; i < Math.min(targetIndex, this._panels.length); i++) {
|
|
602
|
+
if (groupPanelIds.has(this._panels[i].id)) {
|
|
603
|
+
groupPanelsBefore++;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
try {
|
|
607
|
+
// Remove group panels from the flat array
|
|
608
|
+
for (var groupPanels_1 = __values(groupPanels), groupPanels_1_1 = groupPanels_1.next(); !groupPanels_1_1.done; groupPanels_1_1 = groupPanels_1.next()) {
|
|
609
|
+
var panel = groupPanels_1_1.value;
|
|
610
|
+
var idx = this._panels.indexOf(panel);
|
|
611
|
+
if (idx !== -1) {
|
|
612
|
+
this._panels.splice(idx, 1);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
617
|
+
finally {
|
|
618
|
+
try {
|
|
619
|
+
if (groupPanels_1_1 && !groupPanels_1_1.done && (_a = groupPanels_1.return)) _a.call(groupPanels_1);
|
|
620
|
+
}
|
|
621
|
+
finally { if (e_3) throw e_3.error; }
|
|
622
|
+
}
|
|
623
|
+
// Adjust target index to account for removed panels
|
|
624
|
+
var adjustedIndex = targetIndex - groupPanelsBefore;
|
|
625
|
+
// Clamp target index to valid range after removal
|
|
626
|
+
var insertAt = Math.max(0, Math.min(adjustedIndex, this._panels.length));
|
|
627
|
+
// Insert group panels at the target position
|
|
628
|
+
(_b = this._panels).splice.apply(_b, __spreadArray([insertAt, 0], __read(groupPanels), false));
|
|
629
|
+
try {
|
|
630
|
+
// Rebuild the tabs container to match new order
|
|
631
|
+
for (var _d = __values(this._panels), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
632
|
+
var panel = _e.value;
|
|
633
|
+
this.tabsContainer.delete(panel.id);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
637
|
+
finally {
|
|
638
|
+
try {
|
|
639
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
640
|
+
}
|
|
641
|
+
finally { if (e_4) throw e_4.error; }
|
|
642
|
+
}
|
|
643
|
+
for (var i = 0; i < this._panels.length; i++) {
|
|
644
|
+
this.tabsContainer.openPanel(this._panels[i], i);
|
|
645
|
+
}
|
|
646
|
+
this.tabsContainer.updateTabGroups();
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* Ensure a panel is at the correct global index in _panels
|
|
650
|
+
* to maintain contiguity of its tab group members.
|
|
651
|
+
*/
|
|
652
|
+
DockviewGroupPanelModel.prototype._enforceContiguity = function (tabGroup, panelId) {
|
|
653
|
+
var panel = this._panels.find(function (p) { return p.id === panelId; });
|
|
654
|
+
if (!panel) {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
var localIndex = tabGroup.indexOfPanel(panelId);
|
|
658
|
+
var globalIndex = this._computeGlobalIndex(tabGroup, localIndex);
|
|
659
|
+
var currentIndex = this._panels.indexOf(panel);
|
|
660
|
+
if (currentIndex === globalIndex) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
// Move panel in the flat array
|
|
664
|
+
this._panels.splice(currentIndex, 1);
|
|
665
|
+
var adjustedIndex = globalIndex > currentIndex ? globalIndex - 1 : globalIndex;
|
|
666
|
+
this._panels.splice(adjustedIndex, 0, panel);
|
|
667
|
+
// Reorder in the tabs container to match
|
|
668
|
+
this.tabsContainer.delete(panelId);
|
|
669
|
+
this.tabsContainer.openPanel(panel, adjustedIndex);
|
|
670
|
+
};
|
|
671
|
+
/**
|
|
672
|
+
* Compute the global index in _panels for a group-local index.
|
|
673
|
+
* Finds where the group's panels start in the flat array and offsets.
|
|
674
|
+
*/
|
|
675
|
+
DockviewGroupPanelModel.prototype._computeGlobalIndex = function (tabGroup, localIndex) {
|
|
676
|
+
var groupPanelIds = tabGroup.panelIds;
|
|
677
|
+
if (groupPanelIds.length <= 1) {
|
|
678
|
+
// Only one panel (the one being added), keep current position
|
|
679
|
+
var panel = this._panels.find(function (p) { return p.id === groupPanelIds[0]; });
|
|
680
|
+
return panel ? this._panels.indexOf(panel) : this._panels.length;
|
|
681
|
+
}
|
|
682
|
+
var _loop_2 = function (i) {
|
|
683
|
+
if (i === localIndex) {
|
|
684
|
+
return "continue";
|
|
685
|
+
}
|
|
686
|
+
var existingPanel = this_1._panels.find(function (p) { return p.id === groupPanelIds[i]; });
|
|
687
|
+
if (existingPanel) {
|
|
688
|
+
var existingGlobalIndex = this_1._panels.indexOf(existingPanel);
|
|
689
|
+
return { value: Math.max(0, existingGlobalIndex + (localIndex - i)) };
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
var this_1 = this;
|
|
693
|
+
// Find the first existing group member (other than the one at localIndex)
|
|
694
|
+
// to anchor the group position
|
|
695
|
+
for (var i = 0; i < groupPanelIds.length; i++) {
|
|
696
|
+
var state_1 = _loop_2(i);
|
|
697
|
+
if (typeof state_1 === "object")
|
|
698
|
+
return state_1.value;
|
|
699
|
+
}
|
|
700
|
+
return this._panels.length;
|
|
701
|
+
};
|
|
702
|
+
DockviewGroupPanelModel.prototype.removePanelFromTabGroup = function (panelId) {
|
|
703
|
+
var tabGroup = this._findTabGroupForPanel(panelId);
|
|
704
|
+
if (!tabGroup) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
tabGroup.removePanel(panelId);
|
|
708
|
+
this._panelToTabGroup.delete(panelId);
|
|
709
|
+
this._onDidRemovePanelFromTabGroup.fire({ tabGroup: tabGroup, panelId: panelId });
|
|
710
|
+
// Auto-destroy empty groups
|
|
711
|
+
if (tabGroup.isEmpty) {
|
|
712
|
+
tabGroup.dispose();
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
DockviewGroupPanelModel.prototype.getTabGroups = function () {
|
|
716
|
+
return this._tabGroups;
|
|
717
|
+
};
|
|
718
|
+
DockviewGroupPanelModel.prototype.updateTabGroups = function () {
|
|
719
|
+
this.tabsContainer.updateTabGroups();
|
|
720
|
+
};
|
|
721
|
+
DockviewGroupPanelModel.prototype.refreshTabGroupAccent = function () {
|
|
722
|
+
this.tabsContainer.refreshTabGroupAccent();
|
|
723
|
+
};
|
|
724
|
+
DockviewGroupPanelModel.prototype.getTabGroupForPanel = function (panelId) {
|
|
725
|
+
return this._findTabGroupForPanel(panelId);
|
|
726
|
+
};
|
|
727
|
+
DockviewGroupPanelModel.prototype._findTabGroupForPanel = function (panelId) {
|
|
728
|
+
return this._panelToTabGroup.get(panelId);
|
|
729
|
+
};
|
|
730
|
+
DockviewGroupPanelModel.prototype._removeTabGroupInternal = function (tabGroup) {
|
|
731
|
+
var e_5, _a;
|
|
732
|
+
var _this = this;
|
|
733
|
+
var index = this._tabGroups.indexOf(tabGroup);
|
|
734
|
+
if (index !== -1) {
|
|
735
|
+
this._tabGroups.splice(index, 1);
|
|
736
|
+
this._tabGroupMap.delete(tabGroup.id);
|
|
737
|
+
try {
|
|
738
|
+
for (var _b = __values(tabGroup.panelIds), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
739
|
+
var panelId = _c.value;
|
|
740
|
+
this._panelToTabGroup.delete(panelId);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
744
|
+
finally {
|
|
745
|
+
try {
|
|
746
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
747
|
+
}
|
|
748
|
+
finally { if (e_5) throw e_5.error; }
|
|
749
|
+
}
|
|
750
|
+
this._onDidDestroyTabGroup.fire({ tabGroup: tabGroup });
|
|
751
|
+
// Dispose the external listeners (onDidChange, onDidCollapseChange)
|
|
752
|
+
// we registered on this group. We cannot dispose synchronously
|
|
753
|
+
// here because this method runs inside the onDidDestroy fire
|
|
754
|
+
// loop — disposing the CompositeDisposable that holds the
|
|
755
|
+
// onDidDestroy subscription would splice listeners mid-iteration.
|
|
756
|
+
// Schedule cleanup on the next microtask instead.
|
|
757
|
+
var tabGroupDisposable_1 = this._tabGroupDisposables.get(tabGroup.id);
|
|
758
|
+
this._tabGroupDisposables.delete(tabGroup.id);
|
|
759
|
+
if (tabGroupDisposable_1) {
|
|
760
|
+
this._pendingMicrotaskDisposables.add(tabGroupDisposable_1);
|
|
761
|
+
queueMicrotask(function () {
|
|
762
|
+
_this._pendingMicrotaskDisposables.delete(tabGroupDisposable_1);
|
|
763
|
+
tabGroupDisposable_1.dispose();
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
DockviewGroupPanelModel.prototype._handleGroupCollapse = function (tabGroup) {
|
|
769
|
+
if (!this._activePanel) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
// Only act if the active panel belongs to the collapsed group
|
|
773
|
+
if (!tabGroup.containsPanel(this._activePanel.id)) {
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
var activePanelIndex = this._panels.indexOf(this._activePanel);
|
|
777
|
+
// Search right first, then left, for a visible (non-collapsed-group) panel
|
|
778
|
+
for (var i = activePanelIndex + 1; i < this._panels.length; i++) {
|
|
779
|
+
var candidate = this._panels[i];
|
|
780
|
+
var candidateGroup = this._findTabGroupForPanel(candidate.id);
|
|
781
|
+
if (!candidateGroup || !candidateGroup.collapsed) {
|
|
782
|
+
this.doSetActivePanel(candidate);
|
|
783
|
+
this.updateContainer();
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
for (var i = activePanelIndex - 1; i >= 0; i--) {
|
|
788
|
+
var candidate = this._panels[i];
|
|
789
|
+
var candidateGroup = this._findTabGroupForPanel(candidate.id);
|
|
790
|
+
if (!candidateGroup || !candidateGroup.collapsed) {
|
|
791
|
+
this.doSetActivePanel(candidate);
|
|
792
|
+
this.updateContainer();
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
// All tabs are in collapsed groups — show watermark
|
|
797
|
+
this.contentContainer.closePanel();
|
|
798
|
+
this.doSetActivePanel(undefined);
|
|
799
|
+
this.updateContainer();
|
|
800
|
+
};
|
|
801
|
+
DockviewGroupPanelModel.prototype._handleGroupExpand = function (tabGroup) {
|
|
802
|
+
if (this._activePanel) {
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
// Watermark is showing because all groups were collapsed.
|
|
806
|
+
// Activate the first panel in the newly expanded group.
|
|
807
|
+
var firstPanelId = tabGroup.panelIds[0];
|
|
808
|
+
if (firstPanelId) {
|
|
809
|
+
var panel = this._panels.find(function (p) { return p.id === firstPanelId; });
|
|
810
|
+
if (panel) {
|
|
811
|
+
this.doSetActivePanel(panel);
|
|
812
|
+
this.updateContainer();
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
/** Restore tab groups from serialized data (used by fromJSON) */
|
|
817
|
+
DockviewGroupPanelModel.prototype.restoreTabGroups = function (serializedGroups) {
|
|
818
|
+
var e_6, _a, e_7, _b, e_8, _c;
|
|
819
|
+
try {
|
|
820
|
+
// Bump counter past any restored numeric suffixes to avoid ID collisions
|
|
821
|
+
for (var serializedGroups_1 = __values(serializedGroups), serializedGroups_1_1 = serializedGroups_1.next(); !serializedGroups_1_1.done; serializedGroups_1_1 = serializedGroups_1.next()) {
|
|
822
|
+
var data = serializedGroups_1_1.value;
|
|
823
|
+
var match = data.id.match(/-(\d+)$/);
|
|
824
|
+
if (match) {
|
|
825
|
+
var num = parseInt(match[1], 10) + 1;
|
|
826
|
+
if (num > this._tabGroupIdCounter) {
|
|
827
|
+
this._tabGroupIdCounter = num;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
833
|
+
finally {
|
|
834
|
+
try {
|
|
835
|
+
if (serializedGroups_1_1 && !serializedGroups_1_1.done && (_a = serializedGroups_1.return)) _a.call(serializedGroups_1);
|
|
836
|
+
}
|
|
837
|
+
finally { if (e_6) throw e_6.error; }
|
|
838
|
+
}
|
|
839
|
+
try {
|
|
840
|
+
for (var serializedGroups_2 = __values(serializedGroups), serializedGroups_2_1 = serializedGroups_2.next(); !serializedGroups_2_1.done; serializedGroups_2_1 = serializedGroups_2.next()) {
|
|
841
|
+
var data = serializedGroups_2_1.value;
|
|
842
|
+
var tabGroup = this.createTabGroup({
|
|
843
|
+
id: data.id,
|
|
844
|
+
label: data.label,
|
|
845
|
+
color: data.color,
|
|
846
|
+
componentParams: data.componentParams,
|
|
847
|
+
});
|
|
848
|
+
var concreteGroup = this._tabGroupMap.get(tabGroup.id);
|
|
849
|
+
var _loop_3 = function (panelId) {
|
|
850
|
+
// Only add panels that actually exist in this group model
|
|
851
|
+
if (this_2._panels.some(function (p) { return p.id === panelId; })) {
|
|
852
|
+
tabGroup.addPanel(panelId);
|
|
853
|
+
this_2._panelToTabGroup.set(panelId, concreteGroup);
|
|
854
|
+
this_2._enforceContiguity(concreteGroup, panelId);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
var this_2 = this;
|
|
858
|
+
try {
|
|
859
|
+
for (var _d = (e_8 = void 0, __values(data.panelIds)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
860
|
+
var panelId = _e.value;
|
|
861
|
+
_loop_3(panelId);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
865
|
+
finally {
|
|
866
|
+
try {
|
|
867
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
868
|
+
}
|
|
869
|
+
finally { if (e_8) throw e_8.error; }
|
|
870
|
+
}
|
|
871
|
+
if (data.collapsed) {
|
|
872
|
+
tabGroup.collapse();
|
|
873
|
+
}
|
|
874
|
+
// Auto-destroy if no valid panels were added
|
|
875
|
+
if (tabGroup.isEmpty) {
|
|
876
|
+
tabGroup.dispose();
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
881
|
+
finally {
|
|
882
|
+
try {
|
|
883
|
+
if (serializedGroups_2_1 && !serializedGroups_2_1.done && (_b = serializedGroups_2.return)) _b.call(serializedGroups_2);
|
|
884
|
+
}
|
|
885
|
+
finally { if (e_7) throw e_7.error; }
|
|
886
|
+
}
|
|
887
|
+
};
|
|
353
888
|
DockviewGroupPanelModel.prototype.focusContent = function () {
|
|
354
889
|
this.contentContainer.element.focus();
|
|
355
890
|
};
|
|
@@ -471,6 +1006,9 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
471
1006
|
if (this.headerPosition !== 'top') {
|
|
472
1007
|
result.headerPosition = this.headerPosition;
|
|
473
1008
|
}
|
|
1009
|
+
if (this._tabGroups.length > 0) {
|
|
1010
|
+
result.tabGroups = this._tabGroups.map(function (tg) { return tg.toJSON(); });
|
|
1011
|
+
}
|
|
474
1012
|
return result;
|
|
475
1013
|
};
|
|
476
1014
|
DockviewGroupPanelModel.prototype.moveToNext = function (options) {
|
|
@@ -577,7 +1115,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
577
1115
|
return this._removePanel(panelToRemove, options);
|
|
578
1116
|
};
|
|
579
1117
|
DockviewGroupPanelModel.prototype.closeAllPanels = function () {
|
|
580
|
-
var
|
|
1118
|
+
var e_9, _a;
|
|
581
1119
|
if (this.panels.length > 0) {
|
|
582
1120
|
// take a copy since we will be edting the array as we iterate through
|
|
583
1121
|
var arrPanelCpy = __spreadArray([], __read(this.panels), false);
|
|
@@ -587,12 +1125,12 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
587
1125
|
this.doClose(panel);
|
|
588
1126
|
}
|
|
589
1127
|
}
|
|
590
|
-
catch (
|
|
1128
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
591
1129
|
finally {
|
|
592
1130
|
try {
|
|
593
1131
|
if (arrPanelCpy_1_1 && !arrPanelCpy_1_1.done && (_a = arrPanelCpy_1.return)) _a.call(arrPanelCpy_1);
|
|
594
1132
|
}
|
|
595
|
-
finally { if (
|
|
1133
|
+
finally { if (e_9) throw e_9.error; }
|
|
596
1134
|
}
|
|
597
1135
|
}
|
|
598
1136
|
else {
|
|
@@ -615,6 +1153,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
615
1153
|
this.tabsContainer.setRightActionsElement(element);
|
|
616
1154
|
};
|
|
617
1155
|
DockviewGroupPanelModel.prototype.setActive = function (isGroupActive, force) {
|
|
1156
|
+
var _this = this;
|
|
618
1157
|
if (force === void 0) { force = false; }
|
|
619
1158
|
if (!force && this.isActive === isGroupActive) {
|
|
620
1159
|
return;
|
|
@@ -624,7 +1163,13 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
624
1163
|
(0, dom_1.toggleClass)(this.container, 'dv-inactive-group', !isGroupActive);
|
|
625
1164
|
this.tabsContainer.setActive(this.isActive);
|
|
626
1165
|
if (!this._activePanel && this.panels.length > 0) {
|
|
627
|
-
this.
|
|
1166
|
+
var candidate = this._panels.find(function (p) {
|
|
1167
|
+
var tg = _this._findTabGroupForPanel(p.id);
|
|
1168
|
+
return !tg || !tg.collapsed;
|
|
1169
|
+
});
|
|
1170
|
+
if (candidate) {
|
|
1171
|
+
this.doSetActivePanel(candidate);
|
|
1172
|
+
}
|
|
628
1173
|
}
|
|
629
1174
|
this.updateContainer();
|
|
630
1175
|
};
|
|
@@ -671,6 +1216,8 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
671
1216
|
disposable.dispose();
|
|
672
1217
|
this._panelDisposables.delete(panel.id);
|
|
673
1218
|
}
|
|
1219
|
+
// Remove panel from its tab group (auto-destroys empty groups)
|
|
1220
|
+
this.removePanelFromTabGroup(panel.id);
|
|
674
1221
|
this._onDidRemovePanel.fire({ panel: panel });
|
|
675
1222
|
};
|
|
676
1223
|
DockviewGroupPanelModel.prototype.doAddPanel = function (panel, index, options) {
|
|
@@ -728,7 +1275,8 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
728
1275
|
var _this = this;
|
|
729
1276
|
var _a, _b;
|
|
730
1277
|
this.panels.forEach(function (panel) { return panel.runEvents(); });
|
|
731
|
-
|
|
1278
|
+
var shouldShowWatermark = this.isEmpty || !this._activePanel;
|
|
1279
|
+
if (shouldShowWatermark && !this.watermark) {
|
|
732
1280
|
var watermark = this.accessor.createWatermarkComponent();
|
|
733
1281
|
watermark.init({
|
|
734
1282
|
containerApi: this._api,
|
|
@@ -742,7 +1290,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
742
1290
|
});
|
|
743
1291
|
this.contentContainer.element.appendChild(this.watermark.element);
|
|
744
1292
|
}
|
|
745
|
-
if (!
|
|
1293
|
+
if (!shouldShowWatermark && this.watermark) {
|
|
746
1294
|
this.watermark.element.remove();
|
|
747
1295
|
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
748
1296
|
this.watermark = undefined;
|
|
@@ -807,6 +1355,7 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
807
1355
|
target: position,
|
|
808
1356
|
groupId: groupId_1,
|
|
809
1357
|
index: index,
|
|
1358
|
+
tabGroupId: data.tabGroupId,
|
|
810
1359
|
});
|
|
811
1360
|
return;
|
|
812
1361
|
}
|
|
@@ -844,24 +1393,67 @@ var DockviewGroupPanelModel = /** @class */ (function (_super) {
|
|
|
844
1393
|
this.tabsContainer.updateDragAndDropState();
|
|
845
1394
|
};
|
|
846
1395
|
DockviewGroupPanelModel.prototype.dispose = function () {
|
|
847
|
-
var
|
|
848
|
-
var
|
|
1396
|
+
var e_10, _a, e_11, _b, e_12, _c, e_13, _d;
|
|
1397
|
+
var _e, _f, _g;
|
|
849
1398
|
_super.prototype.dispose.call(this);
|
|
850
|
-
(
|
|
851
|
-
(
|
|
1399
|
+
(_e = this.watermark) === null || _e === void 0 ? void 0 : _e.element.remove();
|
|
1400
|
+
(_g = (_f = this.watermark) === null || _f === void 0 ? void 0 : _f.dispose) === null || _g === void 0 ? void 0 : _g.call(_f);
|
|
852
1401
|
this.watermark = undefined;
|
|
853
1402
|
try {
|
|
854
|
-
|
|
855
|
-
|
|
1403
|
+
// Dispose all tab groups
|
|
1404
|
+
for (var _h = __values(__spreadArray([], __read(this._tabGroups), false)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
1405
|
+
var tabGroup = _j.value;
|
|
1406
|
+
tabGroup.dispose();
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1410
|
+
finally {
|
|
1411
|
+
try {
|
|
1412
|
+
if (_j && !_j.done && (_a = _h.return)) _a.call(_h);
|
|
1413
|
+
}
|
|
1414
|
+
finally { if (e_10) throw e_10.error; }
|
|
1415
|
+
}
|
|
1416
|
+
try {
|
|
1417
|
+
for (var _k = __values(this._tabGroupDisposables.values()), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
1418
|
+
var disposable = _l.value;
|
|
1419
|
+
disposable.dispose();
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1423
|
+
finally {
|
|
1424
|
+
try {
|
|
1425
|
+
if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
|
|
1426
|
+
}
|
|
1427
|
+
finally { if (e_11) throw e_11.error; }
|
|
1428
|
+
}
|
|
1429
|
+
this._tabGroupDisposables.clear();
|
|
1430
|
+
try {
|
|
1431
|
+
// Dispose any microtask-deferred disposables that haven't run yet
|
|
1432
|
+
for (var _m = __values(this._pendingMicrotaskDisposables), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
1433
|
+
var disposable = _o.value;
|
|
1434
|
+
disposable.dispose();
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1438
|
+
finally {
|
|
1439
|
+
try {
|
|
1440
|
+
if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
|
|
1441
|
+
}
|
|
1442
|
+
finally { if (e_12) throw e_12.error; }
|
|
1443
|
+
}
|
|
1444
|
+
this._pendingMicrotaskDisposables.clear();
|
|
1445
|
+
try {
|
|
1446
|
+
for (var _p = __values(this.panels), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
1447
|
+
var panel = _q.value;
|
|
856
1448
|
panel.dispose();
|
|
857
1449
|
}
|
|
858
1450
|
}
|
|
859
|
-
catch (
|
|
1451
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
860
1452
|
finally {
|
|
861
1453
|
try {
|
|
862
|
-
if (
|
|
1454
|
+
if (_q && !_q.done && (_d = _p.return)) _d.call(_p);
|
|
863
1455
|
}
|
|
864
|
-
finally { if (
|
|
1456
|
+
finally { if (e_13) throw e_13.error; }
|
|
865
1457
|
}
|
|
866
1458
|
this.tabsContainer.dispose();
|
|
867
1459
|
this.contentContainer.dispose();
|