dockview-core 4.10.0 → 4.12.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/dist/cjs/api/component.api.d.ts +3 -1
- package/dist/cjs/api/component.api.js +2 -2
- package/dist/cjs/api/dockviewPanelApi.d.ts +1 -1
- package/dist/cjs/dockview/components/panel/content.d.ts +7 -0
- package/dist/cjs/dockview/components/panel/content.js +11 -0
- package/dist/cjs/dockview/dockviewComponent.d.ts +7 -1
- package/dist/cjs/dockview/dockviewComponent.js +159 -84
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +1 -0
- package/dist/cjs/dockview/dockviewGroupPanel.js +43 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +3 -0
- package/dist/cjs/dockview/dockviewPanel.d.ts +6 -4
- package/dist/cjs/dockview/dockviewPanel.js +12 -0
- package/dist/dockview-core.amd.js +162 -35
- package/dist/dockview-core.amd.js.map +1 -1
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.js.map +1 -1
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-core.amd.noStyle.js +162 -35
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +162 -35
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +162 -35
- package/dist/dockview-core.esm.js.map +1 -1
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.esm.min.js.map +1 -1
- package/dist/dockview-core.js +162 -35
- package/dist/dockview-core.js.map +1 -1
- 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 +162 -35
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +3 -1
- package/dist/esm/api/component.api.js +2 -2
- package/dist/esm/api/dockviewPanelApi.d.ts +1 -1
- package/dist/esm/dockview/components/panel/content.d.ts +7 -0
- package/dist/esm/dockview/components/panel/content.js +11 -0
- package/dist/esm/dockview/dockviewComponent.d.ts +7 -1
- package/dist/esm/dockview/dockviewComponent.js +90 -31
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +1 -0
- package/dist/esm/dockview/dockviewGroupPanel.js +43 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.js +3 -0
- package/dist/esm/dockview/dockviewPanel.d.ts +6 -4
- package/dist/esm/dockview/dockviewPanel.js +12 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 4.
|
|
3
|
+
* @version 4.12.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -3755,8 +3755,8 @@
|
|
|
3755
3755
|
/**
|
|
3756
3756
|
* Create a component from a serialized object.
|
|
3757
3757
|
*/
|
|
3758
|
-
fromJSON(data) {
|
|
3759
|
-
this.component.fromJSON(data);
|
|
3758
|
+
fromJSON(data, options) {
|
|
3759
|
+
this.component.fromJSON(data, options);
|
|
3760
3760
|
}
|
|
3761
3761
|
/**
|
|
3762
3762
|
* Create a serialized object of the current component.
|
|
@@ -4987,6 +4987,7 @@
|
|
|
4987
4987
|
}
|
|
4988
4988
|
if (doRender) {
|
|
4989
4989
|
const focusTracker = trackFocus(container);
|
|
4990
|
+
this.focusTracker = focusTracker;
|
|
4990
4991
|
const disposable = new CompositeDisposable();
|
|
4991
4992
|
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
4992
4993
|
this.disposable.value = disposable;
|
|
@@ -5014,6 +5015,16 @@
|
|
|
5014
5015
|
this.disposable.dispose();
|
|
5015
5016
|
super.dispose();
|
|
5016
5017
|
}
|
|
5018
|
+
/**
|
|
5019
|
+
* Refresh the focus tracker state to handle cases where focus state
|
|
5020
|
+
* gets out of sync due to programmatic panel activation
|
|
5021
|
+
*/
|
|
5022
|
+
refreshFocusState() {
|
|
5023
|
+
var _a;
|
|
5024
|
+
if ((_a = this.focusTracker) === null || _a === void 0 ? void 0 : _a.refreshState) {
|
|
5025
|
+
this.focusTracker.refreshState();
|
|
5026
|
+
}
|
|
5027
|
+
}
|
|
5017
5028
|
}
|
|
5018
5029
|
|
|
5019
5030
|
function addGhostImage(dataTransfer, ghostElement, options) {
|
|
@@ -6340,8 +6351,11 @@
|
|
|
6340
6351
|
this._activePanel = panel;
|
|
6341
6352
|
if (panel) {
|
|
6342
6353
|
this.tabsContainer.setActivePanel(panel);
|
|
6354
|
+
this.contentContainer.openPanel(panel);
|
|
6343
6355
|
panel.layout(this._width, this._height);
|
|
6344
6356
|
this.updateMru(panel);
|
|
6357
|
+
// Refresh focus state to handle programmatic activation without DOM focus change
|
|
6358
|
+
this.contentContainer.refreshFocusState();
|
|
6345
6359
|
this._onDidActivePanelChange.fire({
|
|
6346
6360
|
panel,
|
|
6347
6361
|
});
|
|
@@ -6765,11 +6779,16 @@
|
|
|
6765
6779
|
}
|
|
6766
6780
|
}
|
|
6767
6781
|
|
|
6782
|
+
// GridConstraintChangeEvent2 is not exported, so we'll type it manually
|
|
6768
6783
|
const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
|
|
6769
6784
|
const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
|
|
6770
6785
|
class DockviewGroupPanel extends GridviewPanel {
|
|
6771
6786
|
get minimumWidth() {
|
|
6772
6787
|
var _a;
|
|
6788
|
+
// Check for explicitly set group constraint first
|
|
6789
|
+
if (typeof this._explicitConstraints.minimumWidth === 'number') {
|
|
6790
|
+
return this._explicitConstraints.minimumWidth;
|
|
6791
|
+
}
|
|
6773
6792
|
const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
|
|
6774
6793
|
if (typeof activePanelMinimumWidth === 'number') {
|
|
6775
6794
|
return activePanelMinimumWidth;
|
|
@@ -6778,6 +6797,10 @@
|
|
|
6778
6797
|
}
|
|
6779
6798
|
get minimumHeight() {
|
|
6780
6799
|
var _a;
|
|
6800
|
+
// Check for explicitly set group constraint first
|
|
6801
|
+
if (typeof this._explicitConstraints.minimumHeight === 'number') {
|
|
6802
|
+
return this._explicitConstraints.minimumHeight;
|
|
6803
|
+
}
|
|
6781
6804
|
const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
|
|
6782
6805
|
if (typeof activePanelMinimumHeight === 'number') {
|
|
6783
6806
|
return activePanelMinimumHeight;
|
|
@@ -6786,6 +6809,10 @@
|
|
|
6786
6809
|
}
|
|
6787
6810
|
get maximumWidth() {
|
|
6788
6811
|
var _a;
|
|
6812
|
+
// Check for explicitly set group constraint first
|
|
6813
|
+
if (typeof this._explicitConstraints.maximumWidth === 'number') {
|
|
6814
|
+
return this._explicitConstraints.maximumWidth;
|
|
6815
|
+
}
|
|
6789
6816
|
const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
|
|
6790
6817
|
if (typeof activePanelMaximumWidth === 'number') {
|
|
6791
6818
|
return activePanelMaximumWidth;
|
|
@@ -6794,6 +6821,10 @@
|
|
|
6794
6821
|
}
|
|
6795
6822
|
get maximumHeight() {
|
|
6796
6823
|
var _a;
|
|
6824
|
+
// Check for explicitly set group constraint first
|
|
6825
|
+
if (typeof this._explicitConstraints.maximumHeight === 'number') {
|
|
6826
|
+
return this._explicitConstraints.maximumHeight;
|
|
6827
|
+
}
|
|
6797
6828
|
const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
|
|
6798
6829
|
if (typeof activePanelMaximumHeight === 'number') {
|
|
6799
6830
|
return activePanelMaximumHeight;
|
|
@@ -6825,14 +6856,39 @@
|
|
|
6825
6856
|
var _a, _b, _c, _d, _e, _f;
|
|
6826
6857
|
super(id, 'groupview_default', {
|
|
6827
6858
|
minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
|
|
6828
|
-
minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.
|
|
6859
|
+
minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.minimumWidth) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
|
|
6829
6860
|
maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
|
|
6830
6861
|
maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
|
|
6831
6862
|
}, new DockviewGroupPanelApiImpl(id, accessor));
|
|
6863
|
+
// Track explicitly set constraints to override panel constraints
|
|
6864
|
+
this._explicitConstraints = {};
|
|
6832
6865
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
6833
6866
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
6834
6867
|
this.addDisposables(this.model.onDidActivePanelChange((event) => {
|
|
6835
6868
|
this.api._onDidActivePanelChange.fire(event);
|
|
6869
|
+
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
6870
|
+
// Track explicitly set constraints to override panel constraints
|
|
6871
|
+
// Extract numeric values from functions or values
|
|
6872
|
+
if (event.minimumWidth !== undefined) {
|
|
6873
|
+
this._explicitConstraints.minimumWidth = typeof event.minimumWidth === 'function'
|
|
6874
|
+
? event.minimumWidth()
|
|
6875
|
+
: event.minimumWidth;
|
|
6876
|
+
}
|
|
6877
|
+
if (event.minimumHeight !== undefined) {
|
|
6878
|
+
this._explicitConstraints.minimumHeight = typeof event.minimumHeight === 'function'
|
|
6879
|
+
? event.minimumHeight()
|
|
6880
|
+
: event.minimumHeight;
|
|
6881
|
+
}
|
|
6882
|
+
if (event.maximumWidth !== undefined) {
|
|
6883
|
+
this._explicitConstraints.maximumWidth = typeof event.maximumWidth === 'function'
|
|
6884
|
+
? event.maximumWidth()
|
|
6885
|
+
: event.maximumWidth;
|
|
6886
|
+
}
|
|
6887
|
+
if (event.maximumHeight !== undefined) {
|
|
6888
|
+
this._explicitConstraints.maximumHeight = typeof event.maximumHeight === 'function'
|
|
6889
|
+
? event.maximumHeight()
|
|
6890
|
+
: event.maximumHeight;
|
|
6891
|
+
}
|
|
6836
6892
|
}));
|
|
6837
6893
|
}
|
|
6838
6894
|
focus() {
|
|
@@ -7129,6 +7185,18 @@
|
|
|
7129
7185
|
params: this._params,
|
|
7130
7186
|
});
|
|
7131
7187
|
}
|
|
7188
|
+
updateFromStateModel(state) {
|
|
7189
|
+
var _a, _b, _c;
|
|
7190
|
+
this._maximumHeight = state.maximumHeight;
|
|
7191
|
+
this._minimumHeight = state.minimumHeight;
|
|
7192
|
+
this._maximumWidth = state.maximumWidth;
|
|
7193
|
+
this._minimumWidth = state.minimumWidth;
|
|
7194
|
+
this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
|
|
7195
|
+
this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
|
|
7196
|
+
this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
|
|
7197
|
+
// state.contentComponent;
|
|
7198
|
+
// state.tabComponent;
|
|
7199
|
+
}
|
|
7132
7200
|
updateParentGroup(group, options) {
|
|
7133
7201
|
this._group = group;
|
|
7134
7202
|
this.api.group = this._group;
|
|
@@ -8915,7 +8983,7 @@
|
|
|
8915
8983
|
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
8916
8984
|
const el = group.element.querySelector('.dv-void-container');
|
|
8917
8985
|
if (!el) {
|
|
8918
|
-
throw new Error('failed to find drag handle');
|
|
8986
|
+
throw new Error('dockview: failed to find drag handle');
|
|
8919
8987
|
}
|
|
8920
8988
|
overlay.setupDrag(el, {
|
|
8921
8989
|
inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
|
|
@@ -8987,7 +9055,7 @@
|
|
|
8987
9055
|
case 'right':
|
|
8988
9056
|
return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
|
|
8989
9057
|
default:
|
|
8990
|
-
throw new Error(`unsupported position ${position}`);
|
|
9058
|
+
throw new Error(`dockview: unsupported position ${position}`);
|
|
8991
9059
|
}
|
|
8992
9060
|
}
|
|
8993
9061
|
updateOptions(options) {
|
|
@@ -9133,15 +9201,48 @@
|
|
|
9133
9201
|
}
|
|
9134
9202
|
return result;
|
|
9135
9203
|
}
|
|
9136
|
-
fromJSON(data) {
|
|
9204
|
+
fromJSON(data, options) {
|
|
9137
9205
|
var _a, _b;
|
|
9206
|
+
const existingPanels = new Map();
|
|
9207
|
+
let tempGroup;
|
|
9208
|
+
if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
|
|
9209
|
+
/**
|
|
9210
|
+
* What are we doing here?
|
|
9211
|
+
*
|
|
9212
|
+
* 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
|
|
9213
|
+
* 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
|
|
9214
|
+
*/
|
|
9215
|
+
tempGroup = this.createGroup();
|
|
9216
|
+
this._groups.delete(tempGroup.api.id);
|
|
9217
|
+
const newPanels = Object.keys(data.panels);
|
|
9218
|
+
for (const panel of this.panels) {
|
|
9219
|
+
if (newPanels.includes(panel.api.id)) {
|
|
9220
|
+
existingPanels.set(panel.api.id, panel);
|
|
9221
|
+
}
|
|
9222
|
+
}
|
|
9223
|
+
this.movingLock(() => {
|
|
9224
|
+
Array.from(existingPanels.values()).forEach((panel) => {
|
|
9225
|
+
this.moveGroupOrPanel({
|
|
9226
|
+
from: {
|
|
9227
|
+
groupId: panel.api.group.api.id,
|
|
9228
|
+
panelId: panel.api.id,
|
|
9229
|
+
},
|
|
9230
|
+
to: {
|
|
9231
|
+
group: tempGroup,
|
|
9232
|
+
position: 'center',
|
|
9233
|
+
},
|
|
9234
|
+
keepEmptyGroups: true,
|
|
9235
|
+
});
|
|
9236
|
+
});
|
|
9237
|
+
});
|
|
9238
|
+
}
|
|
9138
9239
|
this.clear();
|
|
9139
9240
|
if (typeof data !== 'object' || data === null) {
|
|
9140
|
-
throw new Error('serialized layout must be a non-null object');
|
|
9241
|
+
throw new Error('dockview: serialized layout must be a non-null object');
|
|
9141
9242
|
}
|
|
9142
9243
|
const { grid, panels, activeGroup } = data;
|
|
9143
9244
|
if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
|
|
9144
|
-
throw new Error('root must be of type branch');
|
|
9245
|
+
throw new Error('dockview: root must be of type branch');
|
|
9145
9246
|
}
|
|
9146
9247
|
try {
|
|
9147
9248
|
// take note of the existing dimensions
|
|
@@ -9150,7 +9251,7 @@
|
|
|
9150
9251
|
const createGroupFromSerializedState = (data) => {
|
|
9151
9252
|
const { id, locked, hideHeader, views, activeView } = data;
|
|
9152
9253
|
if (typeof id !== 'string') {
|
|
9153
|
-
throw new Error('group id must be of type string');
|
|
9254
|
+
throw new Error('dockview: group id must be of type string');
|
|
9154
9255
|
}
|
|
9155
9256
|
const group = this.createGroup({
|
|
9156
9257
|
id,
|
|
@@ -9165,17 +9266,38 @@
|
|
|
9165
9266
|
* In running this section first we avoid firing lots of 'add' events in the event of a failure
|
|
9166
9267
|
* due to a corruption of input data.
|
|
9167
9268
|
*/
|
|
9168
|
-
const
|
|
9169
|
-
|
|
9269
|
+
const existingPanel = existingPanels.get(child);
|
|
9270
|
+
if (tempGroup && existingPanel) {
|
|
9271
|
+
this.movingLock(() => {
|
|
9272
|
+
tempGroup.model.removePanel(existingPanel);
|
|
9273
|
+
});
|
|
9274
|
+
createdPanels.push(existingPanel);
|
|
9275
|
+
existingPanel.updateFromStateModel(panels[child]);
|
|
9276
|
+
}
|
|
9277
|
+
else {
|
|
9278
|
+
const panel = this._deserializer.fromJSON(panels[child], group);
|
|
9279
|
+
createdPanels.push(panel);
|
|
9280
|
+
}
|
|
9170
9281
|
}
|
|
9171
9282
|
for (let i = 0; i < views.length; i++) {
|
|
9172
9283
|
const panel = createdPanels[i];
|
|
9173
9284
|
const isActive = typeof activeView === 'string' &&
|
|
9174
9285
|
activeView === panel.id;
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9286
|
+
const hasExisting = existingPanels.has(panel.api.id);
|
|
9287
|
+
if (hasExisting) {
|
|
9288
|
+
this.movingLock(() => {
|
|
9289
|
+
group.model.openPanel(panel, {
|
|
9290
|
+
skipSetActive: !isActive,
|
|
9291
|
+
skipSetGroupActive: true,
|
|
9292
|
+
});
|
|
9293
|
+
});
|
|
9294
|
+
}
|
|
9295
|
+
else {
|
|
9296
|
+
group.model.openPanel(panel, {
|
|
9297
|
+
skipSetActive: !isActive,
|
|
9298
|
+
skipSetGroupActive: true,
|
|
9299
|
+
});
|
|
9300
|
+
}
|
|
9179
9301
|
}
|
|
9180
9302
|
if (!group.activePanel && group.panels.length > 0) {
|
|
9181
9303
|
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
@@ -9214,7 +9336,9 @@
|
|
|
9214
9336
|
setTimeout(() => {
|
|
9215
9337
|
this.addPopoutGroup(group, {
|
|
9216
9338
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
9217
|
-
overridePopoutGroup: gridReferenceGroup
|
|
9339
|
+
overridePopoutGroup: gridReferenceGroup
|
|
9340
|
+
? group
|
|
9341
|
+
: undefined,
|
|
9218
9342
|
referenceGroup: gridReferenceGroup
|
|
9219
9343
|
? this.getPanel(gridReferenceGroup)
|
|
9220
9344
|
: undefined,
|
|
@@ -9300,11 +9424,11 @@
|
|
|
9300
9424
|
addPanel(options) {
|
|
9301
9425
|
var _a, _b;
|
|
9302
9426
|
if (this.panels.find((_) => _.id === options.id)) {
|
|
9303
|
-
throw new Error(`panel with id ${options.id} already exists`);
|
|
9427
|
+
throw new Error(`dockview: panel with id ${options.id} already exists`);
|
|
9304
9428
|
}
|
|
9305
9429
|
let referenceGroup;
|
|
9306
9430
|
if (options.position && options.floating) {
|
|
9307
|
-
throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
|
|
9431
|
+
throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
|
|
9308
9432
|
}
|
|
9309
9433
|
const initial = {
|
|
9310
9434
|
width: options.initialWidth,
|
|
@@ -9318,7 +9442,7 @@
|
|
|
9318
9442
|
: options.position.referencePanel;
|
|
9319
9443
|
index = options.position.index;
|
|
9320
9444
|
if (!referencePanel) {
|
|
9321
|
-
throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
|
|
9445
|
+
throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
|
|
9322
9446
|
}
|
|
9323
9447
|
referenceGroup = this.findGroup(referencePanel);
|
|
9324
9448
|
}
|
|
@@ -9329,7 +9453,7 @@
|
|
|
9329
9453
|
: options.position.referenceGroup;
|
|
9330
9454
|
index = options.position.index;
|
|
9331
9455
|
if (!referenceGroup) {
|
|
9332
|
-
throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
|
|
9456
|
+
throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
|
|
9333
9457
|
}
|
|
9334
9458
|
}
|
|
9335
9459
|
else {
|
|
@@ -9441,7 +9565,7 @@
|
|
|
9441
9565
|
}) {
|
|
9442
9566
|
const group = panel.group;
|
|
9443
9567
|
if (!group) {
|
|
9444
|
-
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
9568
|
+
throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
|
|
9445
9569
|
}
|
|
9446
9570
|
group.model.removePanel(panel, {
|
|
9447
9571
|
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
@@ -9490,11 +9614,11 @@
|
|
|
9490
9614
|
? this.panels.find((panel) => panel.id === options.referencePanel)
|
|
9491
9615
|
: options.referencePanel;
|
|
9492
9616
|
if (!referencePanel) {
|
|
9493
|
-
throw new Error(`reference panel ${options.referencePanel} does not exist`);
|
|
9617
|
+
throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
|
|
9494
9618
|
}
|
|
9495
9619
|
referenceGroup = this.findGroup(referencePanel);
|
|
9496
9620
|
if (!referenceGroup) {
|
|
9497
|
-
throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
|
|
9621
|
+
throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
|
|
9498
9622
|
}
|
|
9499
9623
|
}
|
|
9500
9624
|
else if (isGroupOptionsWithGroup(options)) {
|
|
@@ -9503,7 +9627,7 @@
|
|
|
9503
9627
|
? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
|
|
9504
9628
|
: options.referenceGroup;
|
|
9505
9629
|
if (!referenceGroup) {
|
|
9506
|
-
throw new Error(`reference group ${options.referenceGroup} does not exist`);
|
|
9630
|
+
throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
|
|
9507
9631
|
}
|
|
9508
9632
|
}
|
|
9509
9633
|
else {
|
|
@@ -9571,7 +9695,7 @@
|
|
|
9571
9695
|
}
|
|
9572
9696
|
return floatingGroup.group;
|
|
9573
9697
|
}
|
|
9574
|
-
throw new Error('failed to find floating group');
|
|
9698
|
+
throw new Error('dockview: failed to find floating group');
|
|
9575
9699
|
}
|
|
9576
9700
|
if (group.api.location.type === 'popout') {
|
|
9577
9701
|
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
@@ -9602,7 +9726,7 @@
|
|
|
9602
9726
|
this.updateWatermark();
|
|
9603
9727
|
return selectedGroup.popoutGroup;
|
|
9604
9728
|
}
|
|
9605
|
-
throw new Error('failed to find popout group');
|
|
9729
|
+
throw new Error('dockview: failed to find popout group');
|
|
9606
9730
|
}
|
|
9607
9731
|
const re = super.doRemoveGroup(group, options);
|
|
9608
9732
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
@@ -9633,7 +9757,7 @@
|
|
|
9633
9757
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
9634
9758
|
: undefined;
|
|
9635
9759
|
if (!sourceGroup) {
|
|
9636
|
-
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
9760
|
+
throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
|
|
9637
9761
|
}
|
|
9638
9762
|
if (sourceItemId === undefined) {
|
|
9639
9763
|
/**
|
|
@@ -9658,9 +9782,9 @@
|
|
|
9658
9782
|
skipSetActiveGroup: true,
|
|
9659
9783
|
}));
|
|
9660
9784
|
if (!removedPanel) {
|
|
9661
|
-
throw new Error(`No panel with id ${sourceItemId}`);
|
|
9785
|
+
throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
9662
9786
|
}
|
|
9663
|
-
if (sourceGroup.model.size === 0) {
|
|
9787
|
+
if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
|
|
9664
9788
|
// remove the group and do not set a new group as active
|
|
9665
9789
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
9666
9790
|
}
|
|
@@ -9670,7 +9794,8 @@
|
|
|
9670
9794
|
var _a;
|
|
9671
9795
|
return destinationGroup.model.openPanel(removedPanel, {
|
|
9672
9796
|
index: destinationIndex,
|
|
9673
|
-
skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
|
|
9797
|
+
skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
|
|
9798
|
+
!isDestinationGroupEmpty,
|
|
9674
9799
|
skipSetGroupActive: true,
|
|
9675
9800
|
});
|
|
9676
9801
|
});
|
|
@@ -9725,7 +9850,9 @@
|
|
|
9725
9850
|
}));
|
|
9726
9851
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
9727
9852
|
const newGroup = this.createGroupAtLocation(targetLocation);
|
|
9728
|
-
this.movingLock(() => newGroup.model.openPanel(removedPanel
|
|
9853
|
+
this.movingLock(() => newGroup.model.openPanel(removedPanel, {
|
|
9854
|
+
skipSetActive: true,
|
|
9855
|
+
}));
|
|
9729
9856
|
this.doSetGroupAndPanelActive(newGroup);
|
|
9730
9857
|
this._onDidMovePanel.fire({
|
|
9731
9858
|
panel: this.getGroupPanel(sourceItemId),
|
|
@@ -9758,7 +9885,7 @@
|
|
|
9758
9885
|
skipSetActiveGroup: true,
|
|
9759
9886
|
}));
|
|
9760
9887
|
if (!removedPanel) {
|
|
9761
|
-
throw new Error(`No panel with id ${sourceItemId}`);
|
|
9888
|
+
throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
9762
9889
|
}
|
|
9763
9890
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
9764
9891
|
const group = this.createGroupAtLocation(dropLocation);
|
|
@@ -9813,7 +9940,7 @@
|
|
|
9813
9940
|
case 'floating': {
|
|
9814
9941
|
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
9815
9942
|
if (!selectedFloatingGroup) {
|
|
9816
|
-
throw new Error('failed to find floating group');
|
|
9943
|
+
throw new Error('dockview: failed to find floating group');
|
|
9817
9944
|
}
|
|
9818
9945
|
selectedFloatingGroup.dispose();
|
|
9819
9946
|
break;
|
|
@@ -9821,7 +9948,7 @@
|
|
|
9821
9948
|
case 'popout': {
|
|
9822
9949
|
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
9823
9950
|
if (!selectedPopoutGroup) {
|
|
9824
|
-
throw new Error('failed to find popout group');
|
|
9951
|
+
throw new Error('dockview: failed to find popout group');
|
|
9825
9952
|
}
|
|
9826
9953
|
// Remove from popout groups list to prevent automatic restoration
|
|
9827
9954
|
const index = this._popoutGroups.indexOf(selectedPopoutGroup);
|