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
package/dist/dockview-core.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -3785,8 +3785,8 @@
|
|
|
3785
3785
|
/**
|
|
3786
3786
|
* Create a component from a serialized object.
|
|
3787
3787
|
*/
|
|
3788
|
-
fromJSON(data) {
|
|
3789
|
-
this.component.fromJSON(data);
|
|
3788
|
+
fromJSON(data, options) {
|
|
3789
|
+
this.component.fromJSON(data, options);
|
|
3790
3790
|
}
|
|
3791
3791
|
/**
|
|
3792
3792
|
* Create a serialized object of the current component.
|
|
@@ -5017,6 +5017,7 @@
|
|
|
5017
5017
|
}
|
|
5018
5018
|
if (doRender) {
|
|
5019
5019
|
const focusTracker = trackFocus(container);
|
|
5020
|
+
this.focusTracker = focusTracker;
|
|
5020
5021
|
const disposable = new CompositeDisposable();
|
|
5021
5022
|
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
5022
5023
|
this.disposable.value = disposable;
|
|
@@ -5044,6 +5045,16 @@
|
|
|
5044
5045
|
this.disposable.dispose();
|
|
5045
5046
|
super.dispose();
|
|
5046
5047
|
}
|
|
5048
|
+
/**
|
|
5049
|
+
* Refresh the focus tracker state to handle cases where focus state
|
|
5050
|
+
* gets out of sync due to programmatic panel activation
|
|
5051
|
+
*/
|
|
5052
|
+
refreshFocusState() {
|
|
5053
|
+
var _a;
|
|
5054
|
+
if ((_a = this.focusTracker) === null || _a === void 0 ? void 0 : _a.refreshState) {
|
|
5055
|
+
this.focusTracker.refreshState();
|
|
5056
|
+
}
|
|
5057
|
+
}
|
|
5047
5058
|
}
|
|
5048
5059
|
|
|
5049
5060
|
function addGhostImage(dataTransfer, ghostElement, options) {
|
|
@@ -6370,8 +6381,11 @@
|
|
|
6370
6381
|
this._activePanel = panel;
|
|
6371
6382
|
if (panel) {
|
|
6372
6383
|
this.tabsContainer.setActivePanel(panel);
|
|
6384
|
+
this.contentContainer.openPanel(panel);
|
|
6373
6385
|
panel.layout(this._width, this._height);
|
|
6374
6386
|
this.updateMru(panel);
|
|
6387
|
+
// Refresh focus state to handle programmatic activation without DOM focus change
|
|
6388
|
+
this.contentContainer.refreshFocusState();
|
|
6375
6389
|
this._onDidActivePanelChange.fire({
|
|
6376
6390
|
panel,
|
|
6377
6391
|
});
|
|
@@ -6795,11 +6809,16 @@
|
|
|
6795
6809
|
}
|
|
6796
6810
|
}
|
|
6797
6811
|
|
|
6812
|
+
// GridConstraintChangeEvent2 is not exported, so we'll type it manually
|
|
6798
6813
|
const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
|
|
6799
6814
|
const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
|
|
6800
6815
|
class DockviewGroupPanel extends GridviewPanel {
|
|
6801
6816
|
get minimumWidth() {
|
|
6802
6817
|
var _a;
|
|
6818
|
+
// Check for explicitly set group constraint first
|
|
6819
|
+
if (typeof this._explicitConstraints.minimumWidth === 'number') {
|
|
6820
|
+
return this._explicitConstraints.minimumWidth;
|
|
6821
|
+
}
|
|
6803
6822
|
const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
|
|
6804
6823
|
if (typeof activePanelMinimumWidth === 'number') {
|
|
6805
6824
|
return activePanelMinimumWidth;
|
|
@@ -6808,6 +6827,10 @@
|
|
|
6808
6827
|
}
|
|
6809
6828
|
get minimumHeight() {
|
|
6810
6829
|
var _a;
|
|
6830
|
+
// Check for explicitly set group constraint first
|
|
6831
|
+
if (typeof this._explicitConstraints.minimumHeight === 'number') {
|
|
6832
|
+
return this._explicitConstraints.minimumHeight;
|
|
6833
|
+
}
|
|
6811
6834
|
const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
|
|
6812
6835
|
if (typeof activePanelMinimumHeight === 'number') {
|
|
6813
6836
|
return activePanelMinimumHeight;
|
|
@@ -6816,6 +6839,10 @@
|
|
|
6816
6839
|
}
|
|
6817
6840
|
get maximumWidth() {
|
|
6818
6841
|
var _a;
|
|
6842
|
+
// Check for explicitly set group constraint first
|
|
6843
|
+
if (typeof this._explicitConstraints.maximumWidth === 'number') {
|
|
6844
|
+
return this._explicitConstraints.maximumWidth;
|
|
6845
|
+
}
|
|
6819
6846
|
const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
|
|
6820
6847
|
if (typeof activePanelMaximumWidth === 'number') {
|
|
6821
6848
|
return activePanelMaximumWidth;
|
|
@@ -6824,6 +6851,10 @@
|
|
|
6824
6851
|
}
|
|
6825
6852
|
get maximumHeight() {
|
|
6826
6853
|
var _a;
|
|
6854
|
+
// Check for explicitly set group constraint first
|
|
6855
|
+
if (typeof this._explicitConstraints.maximumHeight === 'number') {
|
|
6856
|
+
return this._explicitConstraints.maximumHeight;
|
|
6857
|
+
}
|
|
6827
6858
|
const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
|
|
6828
6859
|
if (typeof activePanelMaximumHeight === 'number') {
|
|
6829
6860
|
return activePanelMaximumHeight;
|
|
@@ -6855,14 +6886,39 @@
|
|
|
6855
6886
|
var _a, _b, _c, _d, _e, _f;
|
|
6856
6887
|
super(id, 'groupview_default', {
|
|
6857
6888
|
minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
|
|
6858
|
-
minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.
|
|
6889
|
+
minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.minimumWidth) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
|
|
6859
6890
|
maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
|
|
6860
6891
|
maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
|
|
6861
6892
|
}, new DockviewGroupPanelApiImpl(id, accessor));
|
|
6893
|
+
// Track explicitly set constraints to override panel constraints
|
|
6894
|
+
this._explicitConstraints = {};
|
|
6862
6895
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
6863
6896
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
6864
6897
|
this.addDisposables(this.model.onDidActivePanelChange((event) => {
|
|
6865
6898
|
this.api._onDidActivePanelChange.fire(event);
|
|
6899
|
+
}), this.api.onDidConstraintsChangeInternal((event) => {
|
|
6900
|
+
// Track explicitly set constraints to override panel constraints
|
|
6901
|
+
// Extract numeric values from functions or values
|
|
6902
|
+
if (event.minimumWidth !== undefined) {
|
|
6903
|
+
this._explicitConstraints.minimumWidth = typeof event.minimumWidth === 'function'
|
|
6904
|
+
? event.minimumWidth()
|
|
6905
|
+
: event.minimumWidth;
|
|
6906
|
+
}
|
|
6907
|
+
if (event.minimumHeight !== undefined) {
|
|
6908
|
+
this._explicitConstraints.minimumHeight = typeof event.minimumHeight === 'function'
|
|
6909
|
+
? event.minimumHeight()
|
|
6910
|
+
: event.minimumHeight;
|
|
6911
|
+
}
|
|
6912
|
+
if (event.maximumWidth !== undefined) {
|
|
6913
|
+
this._explicitConstraints.maximumWidth = typeof event.maximumWidth === 'function'
|
|
6914
|
+
? event.maximumWidth()
|
|
6915
|
+
: event.maximumWidth;
|
|
6916
|
+
}
|
|
6917
|
+
if (event.maximumHeight !== undefined) {
|
|
6918
|
+
this._explicitConstraints.maximumHeight = typeof event.maximumHeight === 'function'
|
|
6919
|
+
? event.maximumHeight()
|
|
6920
|
+
: event.maximumHeight;
|
|
6921
|
+
}
|
|
6866
6922
|
}));
|
|
6867
6923
|
}
|
|
6868
6924
|
focus() {
|
|
@@ -7159,6 +7215,18 @@
|
|
|
7159
7215
|
params: this._params,
|
|
7160
7216
|
});
|
|
7161
7217
|
}
|
|
7218
|
+
updateFromStateModel(state) {
|
|
7219
|
+
var _a, _b, _c;
|
|
7220
|
+
this._maximumHeight = state.maximumHeight;
|
|
7221
|
+
this._minimumHeight = state.minimumHeight;
|
|
7222
|
+
this._maximumWidth = state.maximumWidth;
|
|
7223
|
+
this._minimumWidth = state.minimumWidth;
|
|
7224
|
+
this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });
|
|
7225
|
+
this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);
|
|
7226
|
+
this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);
|
|
7227
|
+
// state.contentComponent;
|
|
7228
|
+
// state.tabComponent;
|
|
7229
|
+
}
|
|
7162
7230
|
updateParentGroup(group, options) {
|
|
7163
7231
|
this._group = group;
|
|
7164
7232
|
this.api.group = this._group;
|
|
@@ -8945,7 +9013,7 @@
|
|
|
8945
9013
|
: (_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumHeightWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE }));
|
|
8946
9014
|
const el = group.element.querySelector('.dv-void-container');
|
|
8947
9015
|
if (!el) {
|
|
8948
|
-
throw new Error('failed to find drag handle');
|
|
9016
|
+
throw new Error('dockview: failed to find drag handle');
|
|
8949
9017
|
}
|
|
8950
9018
|
overlay.setupDrag(el, {
|
|
8951
9019
|
inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'
|
|
@@ -9017,7 +9085,7 @@
|
|
|
9017
9085
|
case 'right':
|
|
9018
9086
|
return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position
|
|
9019
9087
|
default:
|
|
9020
|
-
throw new Error(`unsupported position ${position}`);
|
|
9088
|
+
throw new Error(`dockview: unsupported position ${position}`);
|
|
9021
9089
|
}
|
|
9022
9090
|
}
|
|
9023
9091
|
updateOptions(options) {
|
|
@@ -9163,15 +9231,48 @@
|
|
|
9163
9231
|
}
|
|
9164
9232
|
return result;
|
|
9165
9233
|
}
|
|
9166
|
-
fromJSON(data) {
|
|
9234
|
+
fromJSON(data, options) {
|
|
9167
9235
|
var _a, _b;
|
|
9236
|
+
const existingPanels = new Map();
|
|
9237
|
+
let tempGroup;
|
|
9238
|
+
if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
|
|
9239
|
+
/**
|
|
9240
|
+
* What are we doing here?
|
|
9241
|
+
*
|
|
9242
|
+
* 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout
|
|
9243
|
+
* 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout
|
|
9244
|
+
*/
|
|
9245
|
+
tempGroup = this.createGroup();
|
|
9246
|
+
this._groups.delete(tempGroup.api.id);
|
|
9247
|
+
const newPanels = Object.keys(data.panels);
|
|
9248
|
+
for (const panel of this.panels) {
|
|
9249
|
+
if (newPanels.includes(panel.api.id)) {
|
|
9250
|
+
existingPanels.set(panel.api.id, panel);
|
|
9251
|
+
}
|
|
9252
|
+
}
|
|
9253
|
+
this.movingLock(() => {
|
|
9254
|
+
Array.from(existingPanels.values()).forEach((panel) => {
|
|
9255
|
+
this.moveGroupOrPanel({
|
|
9256
|
+
from: {
|
|
9257
|
+
groupId: panel.api.group.api.id,
|
|
9258
|
+
panelId: panel.api.id,
|
|
9259
|
+
},
|
|
9260
|
+
to: {
|
|
9261
|
+
group: tempGroup,
|
|
9262
|
+
position: 'center',
|
|
9263
|
+
},
|
|
9264
|
+
keepEmptyGroups: true,
|
|
9265
|
+
});
|
|
9266
|
+
});
|
|
9267
|
+
});
|
|
9268
|
+
}
|
|
9168
9269
|
this.clear();
|
|
9169
9270
|
if (typeof data !== 'object' || data === null) {
|
|
9170
|
-
throw new Error('serialized layout must be a non-null object');
|
|
9271
|
+
throw new Error('dockview: serialized layout must be a non-null object');
|
|
9171
9272
|
}
|
|
9172
9273
|
const { grid, panels, activeGroup } = data;
|
|
9173
9274
|
if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {
|
|
9174
|
-
throw new Error('root must be of type branch');
|
|
9275
|
+
throw new Error('dockview: root must be of type branch');
|
|
9175
9276
|
}
|
|
9176
9277
|
try {
|
|
9177
9278
|
// take note of the existing dimensions
|
|
@@ -9180,7 +9281,7 @@
|
|
|
9180
9281
|
const createGroupFromSerializedState = (data) => {
|
|
9181
9282
|
const { id, locked, hideHeader, views, activeView } = data;
|
|
9182
9283
|
if (typeof id !== 'string') {
|
|
9183
|
-
throw new Error('group id must be of type string');
|
|
9284
|
+
throw new Error('dockview: group id must be of type string');
|
|
9184
9285
|
}
|
|
9185
9286
|
const group = this.createGroup({
|
|
9186
9287
|
id,
|
|
@@ -9195,17 +9296,38 @@
|
|
|
9195
9296
|
* In running this section first we avoid firing lots of 'add' events in the event of a failure
|
|
9196
9297
|
* due to a corruption of input data.
|
|
9197
9298
|
*/
|
|
9198
|
-
const
|
|
9199
|
-
|
|
9299
|
+
const existingPanel = existingPanels.get(child);
|
|
9300
|
+
if (tempGroup && existingPanel) {
|
|
9301
|
+
this.movingLock(() => {
|
|
9302
|
+
tempGroup.model.removePanel(existingPanel);
|
|
9303
|
+
});
|
|
9304
|
+
createdPanels.push(existingPanel);
|
|
9305
|
+
existingPanel.updateFromStateModel(panels[child]);
|
|
9306
|
+
}
|
|
9307
|
+
else {
|
|
9308
|
+
const panel = this._deserializer.fromJSON(panels[child], group);
|
|
9309
|
+
createdPanels.push(panel);
|
|
9310
|
+
}
|
|
9200
9311
|
}
|
|
9201
9312
|
for (let i = 0; i < views.length; i++) {
|
|
9202
9313
|
const panel = createdPanels[i];
|
|
9203
9314
|
const isActive = typeof activeView === 'string' &&
|
|
9204
9315
|
activeView === panel.id;
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9316
|
+
const hasExisting = existingPanels.has(panel.api.id);
|
|
9317
|
+
if (hasExisting) {
|
|
9318
|
+
this.movingLock(() => {
|
|
9319
|
+
group.model.openPanel(panel, {
|
|
9320
|
+
skipSetActive: !isActive,
|
|
9321
|
+
skipSetGroupActive: true,
|
|
9322
|
+
});
|
|
9323
|
+
});
|
|
9324
|
+
}
|
|
9325
|
+
else {
|
|
9326
|
+
group.model.openPanel(panel, {
|
|
9327
|
+
skipSetActive: !isActive,
|
|
9328
|
+
skipSetGroupActive: true,
|
|
9329
|
+
});
|
|
9330
|
+
}
|
|
9209
9331
|
}
|
|
9210
9332
|
if (!group.activePanel && group.panels.length > 0) {
|
|
9211
9333
|
group.model.openPanel(group.panels[group.panels.length - 1], {
|
|
@@ -9244,7 +9366,9 @@
|
|
|
9244
9366
|
setTimeout(() => {
|
|
9245
9367
|
this.addPopoutGroup(group, {
|
|
9246
9368
|
position: position !== null && position !== void 0 ? position : undefined,
|
|
9247
|
-
overridePopoutGroup: gridReferenceGroup
|
|
9369
|
+
overridePopoutGroup: gridReferenceGroup
|
|
9370
|
+
? group
|
|
9371
|
+
: undefined,
|
|
9248
9372
|
referenceGroup: gridReferenceGroup
|
|
9249
9373
|
? this.getPanel(gridReferenceGroup)
|
|
9250
9374
|
: undefined,
|
|
@@ -9330,11 +9454,11 @@
|
|
|
9330
9454
|
addPanel(options) {
|
|
9331
9455
|
var _a, _b;
|
|
9332
9456
|
if (this.panels.find((_) => _.id === options.id)) {
|
|
9333
|
-
throw new Error(`panel with id ${options.id} already exists`);
|
|
9457
|
+
throw new Error(`dockview: panel with id ${options.id} already exists`);
|
|
9334
9458
|
}
|
|
9335
9459
|
let referenceGroup;
|
|
9336
9460
|
if (options.position && options.floating) {
|
|
9337
|
-
throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
|
|
9461
|
+
throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');
|
|
9338
9462
|
}
|
|
9339
9463
|
const initial = {
|
|
9340
9464
|
width: options.initialWidth,
|
|
@@ -9348,7 +9472,7 @@
|
|
|
9348
9472
|
: options.position.referencePanel;
|
|
9349
9473
|
index = options.position.index;
|
|
9350
9474
|
if (!referencePanel) {
|
|
9351
|
-
throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
|
|
9475
|
+
throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);
|
|
9352
9476
|
}
|
|
9353
9477
|
referenceGroup = this.findGroup(referencePanel);
|
|
9354
9478
|
}
|
|
@@ -9359,7 +9483,7 @@
|
|
|
9359
9483
|
: options.position.referenceGroup;
|
|
9360
9484
|
index = options.position.index;
|
|
9361
9485
|
if (!referenceGroup) {
|
|
9362
|
-
throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
|
|
9486
|
+
throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);
|
|
9363
9487
|
}
|
|
9364
9488
|
}
|
|
9365
9489
|
else {
|
|
@@ -9471,7 +9595,7 @@
|
|
|
9471
9595
|
}) {
|
|
9472
9596
|
const group = panel.group;
|
|
9473
9597
|
if (!group) {
|
|
9474
|
-
throw new Error(`cannot remove panel ${panel.id}. it's missing a group.`);
|
|
9598
|
+
throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);
|
|
9475
9599
|
}
|
|
9476
9600
|
group.model.removePanel(panel, {
|
|
9477
9601
|
skipSetActiveGroup: options.skipSetActiveGroup,
|
|
@@ -9520,11 +9644,11 @@
|
|
|
9520
9644
|
? this.panels.find((panel) => panel.id === options.referencePanel)
|
|
9521
9645
|
: options.referencePanel;
|
|
9522
9646
|
if (!referencePanel) {
|
|
9523
|
-
throw new Error(`reference panel ${options.referencePanel} does not exist`);
|
|
9647
|
+
throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);
|
|
9524
9648
|
}
|
|
9525
9649
|
referenceGroup = this.findGroup(referencePanel);
|
|
9526
9650
|
if (!referenceGroup) {
|
|
9527
|
-
throw new Error(`reference group for reference panel ${options.referencePanel} does not exist`);
|
|
9651
|
+
throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);
|
|
9528
9652
|
}
|
|
9529
9653
|
}
|
|
9530
9654
|
else if (isGroupOptionsWithGroup(options)) {
|
|
@@ -9533,7 +9657,7 @@
|
|
|
9533
9657
|
? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
|
|
9534
9658
|
: options.referenceGroup;
|
|
9535
9659
|
if (!referenceGroup) {
|
|
9536
|
-
throw new Error(`reference group ${options.referenceGroup} does not exist`);
|
|
9660
|
+
throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);
|
|
9537
9661
|
}
|
|
9538
9662
|
}
|
|
9539
9663
|
else {
|
|
@@ -9601,7 +9725,7 @@
|
|
|
9601
9725
|
}
|
|
9602
9726
|
return floatingGroup.group;
|
|
9603
9727
|
}
|
|
9604
|
-
throw new Error('failed to find floating group');
|
|
9728
|
+
throw new Error('dockview: failed to find floating group');
|
|
9605
9729
|
}
|
|
9606
9730
|
if (group.api.location.type === 'popout') {
|
|
9607
9731
|
const selectedGroup = this._popoutGroups.find((_) => _.popoutGroup === group);
|
|
@@ -9632,7 +9756,7 @@
|
|
|
9632
9756
|
this.updateWatermark();
|
|
9633
9757
|
return selectedGroup.popoutGroup;
|
|
9634
9758
|
}
|
|
9635
|
-
throw new Error('failed to find popout group');
|
|
9759
|
+
throw new Error('dockview: failed to find popout group');
|
|
9636
9760
|
}
|
|
9637
9761
|
const re = super.doRemoveGroup(group, options);
|
|
9638
9762
|
if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {
|
|
@@ -9663,7 +9787,7 @@
|
|
|
9663
9787
|
? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value
|
|
9664
9788
|
: undefined;
|
|
9665
9789
|
if (!sourceGroup) {
|
|
9666
|
-
throw new Error(`Failed to find group id ${sourceGroupId}`);
|
|
9790
|
+
throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);
|
|
9667
9791
|
}
|
|
9668
9792
|
if (sourceItemId === undefined) {
|
|
9669
9793
|
/**
|
|
@@ -9688,9 +9812,9 @@
|
|
|
9688
9812
|
skipSetActiveGroup: true,
|
|
9689
9813
|
}));
|
|
9690
9814
|
if (!removedPanel) {
|
|
9691
|
-
throw new Error(`No panel with id ${sourceItemId}`);
|
|
9815
|
+
throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
9692
9816
|
}
|
|
9693
|
-
if (sourceGroup.model.size === 0) {
|
|
9817
|
+
if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {
|
|
9694
9818
|
// remove the group and do not set a new group as active
|
|
9695
9819
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
9696
9820
|
}
|
|
@@ -9700,7 +9824,8 @@
|
|
|
9700
9824
|
var _a;
|
|
9701
9825
|
return destinationGroup.model.openPanel(removedPanel, {
|
|
9702
9826
|
index: destinationIndex,
|
|
9703
|
-
skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
|
|
9827
|
+
skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&
|
|
9828
|
+
!isDestinationGroupEmpty,
|
|
9704
9829
|
skipSetGroupActive: true,
|
|
9705
9830
|
});
|
|
9706
9831
|
});
|
|
@@ -9755,7 +9880,9 @@
|
|
|
9755
9880
|
}));
|
|
9756
9881
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
9757
9882
|
const newGroup = this.createGroupAtLocation(targetLocation);
|
|
9758
|
-
this.movingLock(() => newGroup.model.openPanel(removedPanel
|
|
9883
|
+
this.movingLock(() => newGroup.model.openPanel(removedPanel, {
|
|
9884
|
+
skipSetActive: true,
|
|
9885
|
+
}));
|
|
9759
9886
|
this.doSetGroupAndPanelActive(newGroup);
|
|
9760
9887
|
this._onDidMovePanel.fire({
|
|
9761
9888
|
panel: this.getGroupPanel(sourceItemId),
|
|
@@ -9788,7 +9915,7 @@
|
|
|
9788
9915
|
skipSetActiveGroup: true,
|
|
9789
9916
|
}));
|
|
9790
9917
|
if (!removedPanel) {
|
|
9791
|
-
throw new Error(`No panel with id ${sourceItemId}`);
|
|
9918
|
+
throw new Error(`dockview: No panel with id ${sourceItemId}`);
|
|
9792
9919
|
}
|
|
9793
9920
|
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);
|
|
9794
9921
|
const group = this.createGroupAtLocation(dropLocation);
|
|
@@ -9843,7 +9970,7 @@
|
|
|
9843
9970
|
case 'floating': {
|
|
9844
9971
|
const selectedFloatingGroup = this._floatingGroups.find((x) => x.group === from);
|
|
9845
9972
|
if (!selectedFloatingGroup) {
|
|
9846
|
-
throw new Error('failed to find floating group');
|
|
9973
|
+
throw new Error('dockview: failed to find floating group');
|
|
9847
9974
|
}
|
|
9848
9975
|
selectedFloatingGroup.dispose();
|
|
9849
9976
|
break;
|
|
@@ -9851,7 +9978,7 @@
|
|
|
9851
9978
|
case 'popout': {
|
|
9852
9979
|
const selectedPopoutGroup = this._popoutGroups.find((x) => x.popoutGroup === from);
|
|
9853
9980
|
if (!selectedPopoutGroup) {
|
|
9854
|
-
throw new Error('failed to find popout group');
|
|
9981
|
+
throw new Error('dockview: failed to find popout group');
|
|
9855
9982
|
}
|
|
9856
9983
|
// Remove from popout groups list to prevent automatic restoration
|
|
9857
9984
|
const index = this._popoutGroups.indexOf(selectedPopoutGroup);
|